From: Akim Demaille Date: Mon, 27 Aug 2001 07:20:21 +0000 (+0000) Subject: * lib/autoconf/status.m4 (_AC_SRCPATHS): Rename `ac_dots' as X-Git-Tag: AUTOCONF-2.52d~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dfa9245cdb321b36e299646ffa22271010716c55;p=thirdparty%2Fautoconf.git * lib/autoconf/status.m4 (_AC_SRCPATHS): Rename `ac_dots' as `ac_top_builddir' to mimic Automake's vocabulary, which much more readable. Adjust callers. * doc/autoconf.texi (Configuration Actions): Document the vars available in commands. Emphasize the risks of collisions in init-cmds. --- diff --git a/ChangeLog b/ChangeLog index e1c4ff34f..b738ebf4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2001-08-27 Akim Demaille + + * lib/autoconf/status.m4 (_AC_SRCPATHS): Rename `ac_dots' as + `ac_top_builddir' to mimic Automake's vocabulary, which much more + readable. + Adjust callers. + * doc/autoconf.texi (Configuration Actions): Document the vars + available in commands. + Emphasize the risks of collisions in init-cmds. + 2001-08-27 Akim Demaille * doc/autoconf.texi (Input) : Move to.. diff --git a/NEWS b/NEWS index 85b5847e8..1a20bf23f 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,9 @@ ACTION-IF-UNKNOWN arguments. All are facultative, and the default for ACTION-IF-TRUE is to define WORDS_BIGENDIAN like AC_C_BIGENDIAN always did. +** Generic macros +- AC_CONFIG_COMMANDS, HEADERS, FILES, LINKS. + Provide the user with srcdir, ac_top_srcdir, ac_top_builddir, ac_srcdir. * Major changes in Autoconf 2.52 ** Documentation diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 966bda5de..aedbd84fb 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -1765,25 +1765,6 @@ where the arguments are: 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 @@ -1801,11 +1782,10 @@ and use this instead: @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 @@ -1824,6 +1804,78 @@ The @var{inputs} may be absolute or relative filenames. In the latter 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 @@ -1849,16 +1901,16 @@ but other files, such as @file{.gdbinit}, can be specified as well. 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 @@ -2280,8 +2332,8 @@ config.status: configure (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}. @@ -2333,8 +2385,8 @@ override the input file name by appending to @var{header}, a 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 @@ -2361,8 +2413,8 @@ statements which are used as hooks. For example, suppose your @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 @@ -2608,14 +2660,14 @@ see @ref{Configuration Actions}. 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 @@ -10523,7 +10575,7 @@ Here is an unrealistic example: @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 @@ -10546,7 +10598,7 @@ with @code{AC_OUTPUT_COMMANDS}, you need two with @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 diff --git a/lib/autoconf/autotest.m4 b/lib/autoconf/autotest.m4 index e1227a45a..3113345af 100644 --- a/lib/autoconf/autotest.m4 +++ b/lib/autoconf/autotest.m4 @@ -75,7 +75,7 @@ at_c='$at_c' at_testdir='$1' srcdir='$ac_srcdir' top_srcdir='$ac_top_srcdir' -top_builddir='$ac_dots' +top_builddir='$ac_top_builddir' AUTOTEST_PATH='m4_default([$2], [.])' diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4 index 7731bf220..c7e339dd1 100644 --- a/lib/autoconf/status.m4 +++ b/lib/autoconf/status.m4 @@ -127,32 +127,33 @@ # - `$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 @@ -749,7 +750,7 @@ for ac_file in : $CONFIG_LINKS; do test "x$ac_file" = x: && continue 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. @@ -900,7 +901,7 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue 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 @@ -1090,7 +1091,7 @@ if test "$no_recursion" != yes; then 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])