]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
AU_ glue code for AC_OUTPUT_COMMANDS.
authorAkim Demaille <akim@epita.fr>
Wed, 9 Feb 2000 17:42:53 +0000 (17:42 +0000)
committerAkim Demaille <akim@epita.fr>
Wed, 9 Feb 2000 17:42:53 +0000 (17:42 +0000)
* 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.

ChangeLog
acgeneral.m4
autoconf.texi
doc/autoconf.texi
lib/autoconf/general.m4

index 6bfe4775d490621a26bdc5650796c90ce3e948bb..0f73859514e572c92a86bf7ee3140a91e17f8d0d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2000-02-09  Akim Demaille  <akim@epita.fr>
+
+       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  <akim@epita.fr>
 
        Avoid outputting `config_files' code in `config.status' if there
index e3c3fd1a5205495cdf7bd775403b9ca3234926aa..e87ea03cc07c87c66f765e0fef637345875647eb 100644 (file)
@@ -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
index dc73f2ec07c0f404345c017744684c8ae0963d92..f9ef75744302615db5ff5ef399afc6de62d7af7a 100644 (file)
@@ -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
index dc73f2ec07c0f404345c017744684c8ae0963d92..f9ef75744302615db5ff5ef399afc6de62d7af7a 100644 (file)
@@ -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
index e3c3fd1a5205495cdf7bd775403b9ca3234926aa..e87ea03cc07c87c66f765e0fef637345875647eb 100644 (file)
@@ -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