The following macros help you manage the contents of your source tree.
Distinguish this package’s source directory from other source
directories that might happen to exist in the file system.
unique-file-in-source-dir should name a file that is unique to
this package. configure
will verify that this file exists in
srcdir, before it runs any other checks.
Use of this macro is strongly recommended. It protects against people accidentally specifying the wrong directory with --srcdir. See configure Invocation, for more information.
Packages that use aclocal
to generate aclocal.m4
should declare where local macros can be found using
AC_CONFIG_MACRO_DIRS
.
Specify the given directories as the location of additional local Autoconf
macros. These macros are intended for use by commands like
autoreconf
or aclocal
that trace macro calls; they should
be called directly from configure.ac so that tools that install
macros for aclocal
can find the macros’ declarations. Tools
that want to learn which directories have been selected should trace
AC_CONFIG_MACRO_DIR_TRACE
, which will be called once per directory.
AC_CONFIG_MACRO_DIRS is the preferred form, and can be called multiple
times and with multiple arguments; in such cases, directories in earlier
calls are expected to be searched before directories in later calls, and
directories appearing in the same call are expected to be searched in
the order in which they appear in the call. For historical reasons, the
macro AC_CONFIG_MACRO_DIR can also be used once, if it appears first,
for tools such as older libtool
that weren’t prepared to
handle multiple directories. For example, a usage like
AC_CONFIG_MACRO_DIR([dir1]) AC_CONFIG_MACRO_DIRS([dir2]) AC_CONFIG_MACRO_DIRS([dir3 dir4])
will cause the trace of AC_CONFIG_MACRO_DIR_TRACE to appear four times, and should cause the directories to be searched in this order: ‘dir1 dir2 dir3 dir4’.
Note that if you use aclocal
from an Automake release prior to
1.13 to generate aclocal.m4, you must also set
ACLOCAL_AMFLAGS = -I dir1 [-I dir2 ... -I dirN]
in your top-level Makefile.am. Due to a limitation in
the Autoconf implementation of autoreconf
, these include
directives currently must be set on a single line in Makefile.am,
without any backslash-newlines.
Some Autoconf macros require auxiliary scripts. AC_PROG_INSTALL
and AC_PROG_MKDIR_P
(see Particular Programs) require a
fallback implementation of install
called install-sh,
and the AC_CANONICAL
macros (see Manual Configuration)
require the system-identification scripts config.sub and
config.guess. Third-party tools, such as Automake and Libtool,
may require additional auxiliary scripts.
By default, configure
looks for these scripts next to itself,
in srcdir. For convenience when working with subdirectories
with their own configure scripts (see Subdirectories), if the
scripts are not in srcdir it will also look in
srcdir/.. and srcdir/../... All of the
scripts must be found in the same directory.
If these default locations are not adequate, or simply to reduce clutter
at the top level of the source tree, packages can use
AC_CONFIG_AUX_DIR
to declare where to look for auxiliary scripts.
Look for auxiliary scripts in dir. Normally, dir should be a relative path, which is taken as relative to srcdir. If dir is an absolute path or contains shell variables, however, it is used as-is.
When the goal of using AC_CONFIG_AUX_DIR
is to reduce clutter at
the top level of the source tree, the conventional name for dir is
build-aux. If you need portability to DOS variants, do not name
the auxiliary directory aux. See File System Conventions.
Declare that file is an auxiliary script needed by this configure
script, and set the shell variable ac_aux_dir
to the directory
where it can be found. The value of ac_aux_dir
is guaranteed to
end with a ‘/’.
Macros that need auxiliary scripts must use this macro to register each script they need.
configure
checks for all the auxiliary scripts it needs on
startup, and exits with an error if any are missing.
autoreconf
also detects missing auxiliary scripts. When used
with the --install option, autoreconf
will try to add
missing scripts to the directory specified by AC_CONFIG_AUX_DIR
,
or to the top level of the source tree if AC_CONFIG_AUX_DIR
was
not used. It can always do this for the scripts needed by Autoconf core
macros: install-sh, config.sub, and config.guess.
Many other commonly-needed scripts are installed by the third-party
tools that autoreconf
knows how to run, such as missing
for Automake and ltmain.sh for Libtool.
If you are using Automake, auxiliary scripts will automatically be
included in the tarball created by make dist
. If you are
not using Automake you will need to arrange for auxiliary scripts to
be included in tarballs yourself. Auxiliary scripts should normally
not be checked into a version control system, for the same
reasons that configure
shouldn’t be.
The scripts needed by Autoconf core macros can be found in $(datadir)/autoconf/build-aux of the Autoconf installation (see Installation Directory Variables). install-sh can be downloaded from https://git.savannah.gnu.org/cgit/automake.git/plain/lib/install-sh. config.sub and config.guess can be downloaded from https://git.savannah.gnu.org/cgit/config.git/tree/.