From: Ralf Wildenhues Date: Tue, 14 Feb 2006 23:18:51 +0000 (+0000) Subject: * bin/autoupdate.in (handle_autoconf_macros): Fix updating of X-Git-Tag: AUTOCONF-2.59c~182 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d75399149a528fae0b99b29d4f310fc3e08ef16;p=thirdparty%2Fautoconf.git * 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. --- diff --git a/ChangeLog b/ChangeLog index 78d7b9725..9ee20205c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-02-14 Stepan Kasal + and Ralf Wildenhues + + * 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 and Paul Eggert diff --git a/bin/autoupdate.in b/bin/autoupdate.in index 378d4556e..4518b087f 100644 --- a/bin/autoupdate.in +++ b/bin/autoupdate.in @@ -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"; } } diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 306ecf7da..4e6890eca 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -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 diff --git a/lib/autoconf/autoupdate.m4 b/lib/autoconf/autoupdate.m4 index cee3f16a3..52db00da7 100644 --- a/lib/autoconf/autoupdate.m4 +++ b/lib/autoconf/autoupdate.m4 @@ -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@)])]]) diff --git a/tests/tools.at b/tests/tools.at index d2bbbf604..713ce1938 100644 --- a/tests/tools.at +++ b/tests/tools.at @@ -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