]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* bin/autoupdate.in (handle_autoconf_macros): Fix updating of
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 14 Feb 2006 23:18:51 +0000 (23:18 +0000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 14 Feb 2006 23:18:51 +0000 (23:18 +0000)
macros without parameters.
* lib/autoconf/autoupdate.m4 (AU_ALIAS): Likewise.
* doc/autoconf.texi (Obsoleting Macros): Document AU_ALIAS.
* tests/tools.at (autoupdating AU_ALIAS): New test for AU_ALIAS
`$#' bug.
(autoupdate): Updated to match AU_ALIAS fix.

ChangeLog
bin/autoupdate.in
doc/autoconf.texi
lib/autoconf/autoupdate.m4
tests/tools.at

index 78d7b972585ad636c6e1ff07ae059157413c97bc..9ee20205cc0e667c357878b4a1e29b8a5dfab291 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2006-02-14  Stepan Kasal  <kasal@ucw.cz>
+       and Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       * bin/autoupdate.in (handle_autoconf_macros): Fix updating of
+       macros without parameters.
+       * lib/autoconf/autoupdate.m4 (AU_ALIAS): Likewise.
+       * doc/autoconf.texi (Obsoleting Macros): Document AU_ALIAS.
+       * tests/tools.at (autoupdating AU_ALIAS): New test for AU_ALIAS
+       `$#' bug.
+       (autoupdate): Updated to match AU_ALIAS fix.
+
 2006-02-13 Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
        and Paul Eggert  <eggert@cs.ucla.edu>
 
index 378d4556edae8410219f06e867cd29f60257053c..4518b087f88dca588f1ce1677c82ac14703f0d8c 100644 (file)
@@ -227,7 +227,7 @@ sub handle_autoconf_macros ()
   print $unac_m4 "# unac.m4 -- undefine the AC macros.\n";
   foreach (sort grep { $ac_macros{$_} ne 'm4sugar' } keys %ac_macros)
     {
-      print $ac_m4   "_au_define([$_], [[\$0(\$\@)]])\n";
+      print $ac_m4   "_au_define([$_], [m4_if(\$#, 0, [[\$0]], [[\$0(\$\@)]])])\n";
       print $unac_m4 "_au_undefine([$_])\n";
     }
 }
index 306ecf7daf12046ec38cdede56f74a8cf73d8e8d..4e6890ecaff09c894755a9e109b0cf31c6c2cd59 100644 (file)
@@ -9519,6 +9519,12 @@ include information on what to do after running @command{autoupdate};
 in the updated @file{configure.ac} file.
 @end defmac
 
+@defmac AU_ALIAS (@var{old-name}, @var{new-name})
+@auindex{ALIAS}
+Used if the @var{old-name} is to be replaced by a call to @var{new-macro}
+with the same parameters.  This happens for example if the macro was renamed.
+@end defmac
+
 @node Coding Style
 @section Coding Style
 @cindex Coding style
index cee3f16a3f1719ae1e373dc5ad372ee009ae862c..52db00da7ad383050b75d9d6034f27a5b61e0b23 100644 (file)
@@ -2,7 +2,7 @@
 # Interface with autoupdate.
 
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2003, 2004 Free Software Foundation, Inc.
+# 2003, 2004, 2006 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -115,5 +115,16 @@ $2])])
 #
 # Do not use `defn' since then autoupdate would replace an old macro
 # call with the new macro body instead of the new macro call.
+#
+# Moreover, we have to take care that calls without parameters are
+# expanded to calls without parameters, not with one empty parameter.
+# This is not only an aesthetical improvement of autoupdate, it also
+# matters with poorly written macros which test for $# = 0.
+#
 m4_define([AU_ALIAS],
-[AU_DEFUN([$1], [$2($][@)])])
+[AU_DEFUN([$1], _AU_ALIAS_BODY([$], [$2]))])
+
+# The body for the AU_DEFUN above should look like:
+#      [m4_if($#, 0, [NEW-NAME], [NEW-NAME($@)])]
+# Thus the helper macro is:
+m4_define([_AU_ALIAS_BODY], [[m4_if($1#, 0, [$2], [$2($1@)])]])
index d2bbbf6043f65773e3e2bc033902b4c9d1d39a55..713ce193814f974f7accfdb1bb26d6318d6a29a4 100644 (file)
@@ -506,7 +506,7 @@ AC_OUTPUT(Makefile, echo $fubar, fubar=$fubar)
 
 AT_DATA([expout],
 [[AC_INIT([Test],[1.0])
-AC_CANONICAL_TARGET([])
+AC_CANONICAL_TARGET
 # The doc says 27 is a valid fubar.
 fubar=27
 AC_CONFIG_FILES([Makefile])
@@ -570,3 +570,27 @@ AT_CHECK([echo "AC_PREREQ(999.99)" | autoupdate -],
         63, [], [ignore])
 
 AT_CLEANUP
+
+
+# autoupdating AU_ALIAS
+# ---------------------
+AT_SETUP([autoupdating AU_ALIAS])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+AC_DEFUN([FOO], [$#])
+AU_ALIAS([BAZ],[FOO])
+test "FOO:FOO():FOO(x) BAZ:BAZ():BAZ(x)" = "0:1:1 0:1:1" || exit 1
+AC_PROG_CC
+AC_STDC_HEADERS
+AC_OUTPUT
+]])
+
+# Checking `autoupdate'.
+AT_CHECK_AUTOUPDATE
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE
+AT_CHECK([grep 'AC_HEADER_STDC(' configure.ac], 1, [ignore], [ignore])
+AT_CHECK([grep 'AC_HEADER_STDC' configure.ac], 0, [ignore], [ignore])
+
+AT_CLEANUP