* 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.
This commit is contained in:
Ralf Wildenhues 2006-02-14 23:18:51 +00:00
parent 9a0e3a3558
commit 8d75399149
5 changed files with 56 additions and 4 deletions

View File

@ -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>

View 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";
}
}

View 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

View 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@)])]])

View 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