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-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>
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";
}
}
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
# 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
#
# 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@)])]])
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])
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