Apparently I never read the replies/approvals to http://article.gmane.org/gmane.comp.sysutils.autoconf.bugs/4681 I really don't know how that could have happened, must be connected with the fact that I have not been subscribed to bug-autoconf until now.. :-/
Anyway, I have applied the patch in that post and Stepan's patch in http://article.gmane.org/gmane.comp.sysutils.autoconf.bugs/4651 as directed. Stepan, I hope you agree with the ChangeLog entry I wrote. For reference, the combined patch is shown below. Cheers, Ralf 2006-02-14 Stepan Kasal <[EMAIL PROTECTED]> and Ralf Wildenhues <[EMAIL PROTECTED]> * 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. Index: bin/autoupdate.in =================================================================== RCS file: /cvsroot/autoconf/autoconf/bin/autoupdate.in,v retrieving revision 1.56 diff -u -r1.56 autoupdate.in --- bin/autoupdate.in 6 Jan 2006 00:10:37 -0000 1.56 +++ bin/autoupdate.in 14 Feb 2006 23:07:23 -0000 @@ -227,7 +227,7 @@ 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: doc/autoconf.texi =================================================================== RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v retrieving revision 1.946 diff -u -r1.946 autoconf.texi --- doc/autoconf.texi 13 Feb 2006 18:46:04 -0000 1.946 +++ doc/autoconf.texi 14 Feb 2006 23:07:31 -0000 @@ -9519,6 +9519,12 @@ in the updated @file{configure.ac} file. @end defmac [EMAIL PROTECTED] AU_ALIAS (@var{old-name}, @var{new-name}) [EMAIL PROTECTED] +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. [EMAIL PROTECTED] defmac + @node Coding Style @section Coding Style @cindex Coding style Index: lib/autoconf/autoupdate.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/autoupdate.m4,v retrieving revision 1.10 diff -u -r1.10 autoupdate.m4 --- lib/autoconf/autoupdate.m4 14 May 2005 07:00:39 -0000 1.10 +++ lib/autoconf/autoupdate.m4 14 Feb 2006 23:07:31 -0000 @@ -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 @@ # # 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: tests/tools.at =================================================================== RCS file: /cvsroot/autoconf/autoconf/tests/tools.at,v retrieving revision 1.79 diff -u -r1.79 tools.at --- tests/tools.at 24 Jan 2006 00:20:15 -0000 1.79 +++ tests/tools.at 14 Feb 2006 23:07:32 -0000 @@ -506,7 +506,7 @@ 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 @@ 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
