From: Akim Demaille Date: Wed, 9 Feb 2000 17:42:53 +0000 (+0000) Subject: AU_ glue code for AC_OUTPUT_COMMANDS. X-Git-Tag: autoconf-2.50~1179 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=367368c91609cb3a1f70c6e7a2dc0b776e08fd06;p=thirdparty%2Fautoconf.git AU_ glue code for AC_OUTPUT_COMMANDS. * acgeneral.m4 (AC_OUTPUT_COMMANDS): AU_DEFUNed in terms of AC_CONFIG_COMMANDS. (AC_OUTPUT_COMMANDS_CNT): New variable, declared both in `autoconf::' and `autoupdate::'. (AC_OUTPUT): Register your arguments to AC_OUTPUT_COMMANDS only if there are to avoid spurious `run autoupdate' messages. * doc/autoconf.texi (Libraries): Document the changes. --- diff --git a/ChangeLog b/ChangeLog index 6bfe4775d..0f7385951 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2000-02-09 Akim Demaille + + AU_ glue code for AC_OUTPUT_COMMANDS. + + * acgeneral.m4 (AC_OUTPUT_COMMANDS): AU_DEFUNed in terms of + AC_CONFIG_COMMANDS. + (AC_OUTPUT_COMMANDS_CNT): New variable, declared both in + `autoconf::' and `autoupdate::'. + (AC_OUTPUT): Register your arguments to AC_OUTPUT_COMMANDS only if + there are to avoid spurious `run autoupdate' messages. + * doc/autoconf.texi (Libraries): Document the changes. + 2000-02-09 Akim Demaille Avoid outputting `config_files' code in `config.status' if there diff --git a/acgeneral.m4 b/acgeneral.m4 index e3c3fd1a5..e87ea03cc 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -355,6 +355,7 @@ define(AC_VAR_IF_SET, # # AC_VAR_POPDEF([header]) + # AC_VAR_PUSHDEF(VARNAME, VALUE) # ------------------------------ # Define the m4 macro VARNAME to an accessor to the shell variable @@ -3052,17 +3053,28 @@ define([AC_LIST_COMMANDS_COMMANDS]) # AC_OUTPUT_COMMANDS(EXTRA-CMDS, INIT-CMDS) # ----------------------------------------- +# # Add additional commands for AC_OUTPUT to put into config.status. -# Use diversions instead of macros so we can be robust in the -# presence of commas in $1 and/or $2. -# FIXME: Obsolete it? -AC_DEFUN(AC_OUTPUT_COMMANDS, -[AC_DIVERT_PUSH(AC_DIVERSION_CMDS)dnl -[$1] -AC_DIVERT_POP()dnl -AC_DIVERT_PUSH(AC_DIVERSION_ICMDS)dnl -[$2] -AC_DIVERT_POP()]) +# +# This macro is an obsolete version of AC_CONFIG_COMMANDS. The only +# difficulty in mapping AC_OUTPUT_COMMANDS to AC_CONFIG_COMMANDS is +# to give a unique key. The scheme we have chosen is `default-1', +# `default-2' etc. for each call. +# +# Unfortunately this scheme is fragile: bad things might happen +# if you update an included file and configure.in: you might have +# clashes :( On the other hand, I'd like to avoid weird keys (e.g., +# depending upon __file__ or the pid). +AU_DEFUN(AC_OUTPUT_COMMANDS, +[define([AC_OUTPUT_COMMANDS_CNT], incr(AC_OUTPUT_COMMANDS_CNT))dnl +dnl Double quoted since that was the case in the original macro. +AC_CONFIG_COMMANDS([default-]AC_OUTPUT_COMMANDS_CNT, [[$1]], [[$2]])dnl +]) + +# Initialize both in `autoconf::' and `autoupdate::'. +define(AC_OUTPUT_COMMANDS_CNT, 0) +m4_namespace_define(autoupdate, + [AC_OUTPUT_COMMANDS_CNT], 0) # AC_CONFIG_COMMANDS_PRE(CMDS) @@ -3230,7 +3242,8 @@ define(AC_OUTPUT, [dnl Dispatch the extra arguments to their native macros. ifval([$1], [AC_CONFIG_FILES([$1])])dnl -AC_OUTPUT_COMMANDS([$2], [$3])dnl +ifset([$2$3], + [AC_OUTPUT_COMMANDS([$2], [$3])])dnl trap '' 1 2 15 AC_CACHE_SAVE trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 diff --git a/autoconf.texi b/autoconf.texi index dc73f2ec0..f9ef75744 100644 --- a/autoconf.texi +++ b/autoconf.texi @@ -2517,6 +2517,28 @@ example, @code{struct timeval} or @code{struct timezone} as well as @end example @end defmac +Aside from the fact that @code{AC_CONFIG_COMMANDS} requires an +additional key, an important difference is that +@code{AC_OUTPUT_COMMANDS} is quoting its arguments twice, while +@code{AC_CONFIG_COMMANDS}. This means that @code{AC_CONFIG_COMMANDS} +can safely be given macro calls as arguments: + +@example +AC_CONFIG_COMMANDS(foo, [my_FOO()]) +@end example + +@noindent +conversely, where one level of quoting was enough for literal strings +with @code{AC_OUTPUT_COMMANDS}, you need two with +@code{AC_CONFIG_COMMANDS}. The following lines are equivalent: + +@example +@group +AC_OUTPUT_COMMANDS([echo "Square brackets: []"]) +AC_CONFIG_COMMANDS(default, [[echo "Square brackets: []"]]) +@end group +@end example + @defmac AC_HEADER_DIRENT @maindex HEADER_DIRENT diff --git a/doc/autoconf.texi b/doc/autoconf.texi index dc73f2ec0..f9ef75744 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -2517,6 +2517,28 @@ example, @code{struct timeval} or @code{struct timezone} as well as @end example @end defmac +Aside from the fact that @code{AC_CONFIG_COMMANDS} requires an +additional key, an important difference is that +@code{AC_OUTPUT_COMMANDS} is quoting its arguments twice, while +@code{AC_CONFIG_COMMANDS}. This means that @code{AC_CONFIG_COMMANDS} +can safely be given macro calls as arguments: + +@example +AC_CONFIG_COMMANDS(foo, [my_FOO()]) +@end example + +@noindent +conversely, where one level of quoting was enough for literal strings +with @code{AC_OUTPUT_COMMANDS}, you need two with +@code{AC_CONFIG_COMMANDS}. The following lines are equivalent: + +@example +@group +AC_OUTPUT_COMMANDS([echo "Square brackets: []"]) +AC_CONFIG_COMMANDS(default, [[echo "Square brackets: []"]]) +@end group +@end example + @defmac AC_HEADER_DIRENT @maindex HEADER_DIRENT diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index e3c3fd1a5..e87ea03cc 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -355,6 +355,7 @@ define(AC_VAR_IF_SET, # # AC_VAR_POPDEF([header]) + # AC_VAR_PUSHDEF(VARNAME, VALUE) # ------------------------------ # Define the m4 macro VARNAME to an accessor to the shell variable @@ -3052,17 +3053,28 @@ define([AC_LIST_COMMANDS_COMMANDS]) # AC_OUTPUT_COMMANDS(EXTRA-CMDS, INIT-CMDS) # ----------------------------------------- +# # Add additional commands for AC_OUTPUT to put into config.status. -# Use diversions instead of macros so we can be robust in the -# presence of commas in $1 and/or $2. -# FIXME: Obsolete it? -AC_DEFUN(AC_OUTPUT_COMMANDS, -[AC_DIVERT_PUSH(AC_DIVERSION_CMDS)dnl -[$1] -AC_DIVERT_POP()dnl -AC_DIVERT_PUSH(AC_DIVERSION_ICMDS)dnl -[$2] -AC_DIVERT_POP()]) +# +# This macro is an obsolete version of AC_CONFIG_COMMANDS. The only +# difficulty in mapping AC_OUTPUT_COMMANDS to AC_CONFIG_COMMANDS is +# to give a unique key. The scheme we have chosen is `default-1', +# `default-2' etc. for each call. +# +# Unfortunately this scheme is fragile: bad things might happen +# if you update an included file and configure.in: you might have +# clashes :( On the other hand, I'd like to avoid weird keys (e.g., +# depending upon __file__ or the pid). +AU_DEFUN(AC_OUTPUT_COMMANDS, +[define([AC_OUTPUT_COMMANDS_CNT], incr(AC_OUTPUT_COMMANDS_CNT))dnl +dnl Double quoted since that was the case in the original macro. +AC_CONFIG_COMMANDS([default-]AC_OUTPUT_COMMANDS_CNT, [[$1]], [[$2]])dnl +]) + +# Initialize both in `autoconf::' and `autoupdate::'. +define(AC_OUTPUT_COMMANDS_CNT, 0) +m4_namespace_define(autoupdate, + [AC_OUTPUT_COMMANDS_CNT], 0) # AC_CONFIG_COMMANDS_PRE(CMDS) @@ -3230,7 +3242,8 @@ define(AC_OUTPUT, [dnl Dispatch the extra arguments to their native macros. ifval([$1], [AC_CONFIG_FILES([$1])])dnl -AC_OUTPUT_COMMANDS([$2], [$3])dnl +ifset([$2$3], + [AC_OUTPUT_COMMANDS([$2], [$3])])dnl trap '' 1 2 15 AC_CACHE_SAVE trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15