A whitespace-separated list of tags, which are typically the names of
the files to instantiate.
-@item commands
-Shell commands output literally into @file{config.status}, and
-associated with a tag that the user can use to tell @file{config.status}
-which the commands to run. The commands are run each time a @var{tag}
-request is given to @file{config.status}; typically, each time the file
-@file{@var{tag}} is created.
-
-@item init-cmds
-Shell commands output @emph{unquoted} near the beginning of
-@file{config.status}, and executed each time @file{config.status} runs
-(regardless of the tag). Because they are unquoted, for example,
-@samp{$var} will be output as the value of @code{var}. @var{init-cmds}
-is typically used by @file{configure} to give @file{config.status} some
-variables it needs to run the @var{commands}.
-@end table
-
-All these macros can be called multiple times, with different
-@var{tag}s, of course!
-
You are encouraged to use literals as @var{tags}. In particular, you
should avoid
@dots{} && AC_CONFIG_FOOS(foooo)
@end example
-The macro @code{AC_CONFIG_FILES} and @code{AC_CONFIG_HEADERS} use
-specials @var{tag}s: they may have the form @samp{@var{output}} or
+The macros @code{AC_CONFIG_FILES} and @code{AC_CONFIG_HEADERS} use
+special @var{tag}s: they may have the form @samp{@var{output}} or
@samp{@var{output}:@var{inputs}}. The file @var{output} is instantiated
-from its templates, @var{inputs} if specified, defaulting to
-@samp{@var{output}.in}.
+from its templates, @var{inputs} (defaulting to @samp{@var{output}.in}).
For instance
@samp{AC_CONFIG_FILES(Makefile:boiler/top.mk:boiler/bot.mk)} asks for
case they are first looked for in the build tree, and then in the source
tree.
+@item commands
+Shell commands output literally into @file{config.status}, and
+associated with a tag that the user can use to tell @file{config.status}
+which the commands to run. The commands are run each time a @var{tag}
+request is given to @file{config.status}; typically, each time the file
+@file{@var{tag}} is created.
+
+The variable set during the execution of @command{configure} are
+@emph{not} available here: you first need to set them via the
+@var{init-cmds}. Nonetheless the following variables are precomputed:
+
+@table @code
+@item srcdir
+The path from the top build directory to the top source directory. This
+is what @command{configure}'s option @option{--srcdir} sets.
+
+@item ac_top_srcdir
+The path from the current build directory to the top source directory.
+
+
+@item ac_top_builddir
+The path from the current build directory to the top build directory.
+It can be empty, or else ends with a slash, so that you may concatenate
+it.
+
+@item ac_srcdir
+The path from the current build directory to the corresponding source
+directory.
+@end table
+
+@noindent
+The @dfn{current} directory refers to the directory (or
+pseudo-directory) containing the input part of @var{tags}. For
+instance, running
+
+@example
+AC_CONFIG_COMMANDS([deep/dir/out:in/in.in], [@dots{}], [@dots{}])
+@end example
+
+@noindent
+ with @option{--srcdir=../package} produces the following values:
+
+@example
+# Argument of --srcdir
+srcdir='../package'
+# Reversing deep/dir
+ac_top_builddir='../../'
+# Concatenation of $ac_top_builddir and srcdir
+ac_top_srcdir='../../../package'
+# Concatenation of $ac_top_srcdir and deep/dir
+ac_srcdir='../../../package/deep/dir'
+@end example
+
+@noindent
+independently of @samp{in/in.in}.
+
+@item init-cmds
+Shell commands output @emph{unquoted} near the beginning of
+@file{config.status}, and executed each time @file{config.status} runs
+(regardless of the tag). Because they are unquoted, for example,
+@samp{$var} will be output as the value of @code{var}. @var{init-cmds}
+is typically used by @file{configure} to give @file{config.status} some
+variables it needs to run the @var{commands}.
+
+You should be extremely cautious in your variable names: all the
+@var{init-cmds} share the same name space and may overwrite each other
+in unpredictable ways. Sorry@dots{}
+@end table
+
+All these macros can be called multiple times, with different
+@var{tag}s, of course!
+
@node Configuration Files, Makefile Substitutions, Configuration Actions, Setup
@section Creating Configuration Files
Typical calls to @code{AC_CONFIG_FILES} look like this:
@example
-AC_CONFIG_FILES(Makefile src/Makefile man/Makefile X/Imakefile)
-AC_CONFIG_FILES(autoconf, chmod +x autoconf)
+AC_CONFIG_FILES([Makefile src/Makefile man/Makefile X/Imakefile])
+AC_CONFIG_FILES([autoconf], [chmod +x autoconf])
@end example
You can override an input file name by appending to @var{file} a
colon-separated list of input files. Examples:
@example
-AC_CONFIG_FILES(Makefile:boiler/top.mk:boiler/bot.mk
- lib/Makefile:boiler/lib.mk)
+AC_CONFIG_FILES([Makefile:boiler/top.mk:boiler/bot.mk]
+ [lib/Makefile:boiler/lib.mk])
@end example
@noindent
(Be careful if you copy these lines directly into your Makefile, as you
will need to convert the indented lines to start with the tab character.)
-In addition, you should use @samp{AC_CONFIG_FILES(stamp-h, echo
-timestamp > stamp-h)} so @file{config.status} will ensure that
+In addition, you should use @samp{AC_CONFIG_FILES([stamp-h], [echo
+timestamp > stamp-h])} so @file{config.status} will ensure that
@file{config.h} is considered up to date. @xref{Output}, for more
information about @code{AC_OUTPUT}.
colon-separated list of input files. Examples:
@example
-AC_CONFIG_HEADERS(config.h:config.hin)
-AC_CONFIG_HEADERS(defines.h:defs.pre:defines.h.in:defs.post)
+AC_CONFIG_HEADERS([config.h:config.hin])
+AC_CONFIG_HEADERS([defines.h:defs.pre:defines.h.in:defs.post])
@end example
@noindent
@file{configure.ac} makes these calls:
@example
-AC_CONFIG_HEADERS(conf.h)
-AC_CHECK_HEADERS(unistd.h)
+AC_CONFIG_HEADERS([conf.h])
+AC_CHECK_HEADERS([unistd.h])
@end example
@noindent
Here is an unrealistic example:
@example
fubar=42
-AC_CONFIG_COMMANDS(fubar,
+AC_CONFIG_COMMANDS([fubar],
[echo this is extra $fubar, and so on.],
[fubar=$fubar])
@end example
Here is a better one:
@example
-AC_CONFIG_COMMANDS(time-stamp, [date >time-stamp])
+AC_CONFIG_COMMANDS([time-stamp], [date >time-stamp])
@end example
@end defmac
@example
fubar=27
AC_OUTPUT_COMMANDS([echo this is extra $fubar, and so on.],
- fubar=$fubar)
+ [fubar=$fubar])
AC_OUTPUT_COMMANDS([echo this is another, extra, bit],
[echo init bit])
@end example
@example
@group
AC_OUTPUT_COMMANDS([echo "Square brackets: []"])
-AC_CONFIG_COMMANDS(default, [[echo "Square brackets: []"]])
+AC_CONFIG_COMMANDS([default], [[echo "Square brackets: []"]])
@end group
@end example
@end defmac
# - `$srcdir' is `top-build -> top-src'
#
# Ouputs:
-# - `ac_dots' is `build -> top_build'. If not empty, has a trailing slash.
+# - `ac_top_builddir' is `build -> top_build'.
+# If not empty, has a trailing slash.
# - `ac_srcdir' is `build -> src'.
# - `ac_top_srcdir' is `build -> top-src'
m4_define([_AC_SRCPATHS],
[if test $1 != .; then
ac_dir_suffix=/`echo $1 | sed 's,^\./,,'`
# A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo "$ac_dir_suffix" | sed 's,/[[^/]]*,../,g'`
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[[^/]]*,../,g'`
else
- ac_dir_suffix= ac_dots=
+ ac_dir_suffix= ac_top_builddir=
fi
case $srcdir in
.) # No --srcdir option. We are building in place.
ac_srcdir=.
- if test -z "$ac_dots"; then
+ if test -z "$ac_top_builddir"; then
ac_top_srcdir=.
else
- ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'`
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
fi ;;
[[\\/]]* | ?:[[\\/]]* ) # Absolute path.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir ;;
*) # Relative path.
- ac_srcdir=$ac_dots$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_dots$srcdir ;;
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
])# _AC_SRCPATHS
case $srcdir in
[[\\/$]]* | ?:[[\\/]]* ) ac_rel_source=$srcdir/$ac_source ;;
- *) ac_rel_source=$ac_dots$srcdir/$ac_source ;;
+ *) ac_rel_source=$ac_top_builddir$srcdir/$ac_source ;;
esac
# Make a symlink if possible; otherwise try a hard link.
AC_PROVIDE_IFELSE([AC_PROG_INSTALL],
[ case $INSTALL in
[[\\/$]]* | ?:[[\\/]]* ) ac_INSTALL=$INSTALL ;;
- *) ac_INSTALL=$ac_dots$INSTALL ;;
+ *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
esac
])dnl
case $cache_file in
[[\\/]]* | ?:[[\\/]]* ) ac_sub_cache_file=$cache_file ;;
*) # Relative path.
- ac_sub_cache_file=$ac_dots$cache_file ;;
+ ac_sub_cache_file=$ac_top_builddir$cache_file ;;
esac
AC_MSG_NOTICE([running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir])