* bin/autoupdate.in: Define __file__ so that warnings

refer to the correct file.
* doc/autoconf.texi (AU_DEFUN): Describe more correctly
the behavior of the third argument.
* lib/autoconf/autoupdate.m4 (AU_DEFUN): Describe more
correctly the behavior of the third argument.  Document
what the three macros that AU_DEFUN defines do.  Fix
warning message when the third argument includes $0
(reported by Alexandre Duret-Lutz).
This commit is contained in:
Paolo Bonzini 2004-02-03 09:00:27 +00:00
parent 7c1b2b4c78
commit 8ddbbac5ee
3 changed files with 31 additions and 8 deletions

View File

@ -282,6 +282,9 @@ foreach my $file (@ARGV)
divert(-1) -*- Autoconf -*-
changequote([, ])
# Redefine __file__ to make warnings nicer; $file is replaced below.
define([__file__], [$file])
# Move all the builtins into the `_au_' pseudo namespace
include([m4save.m4])
@ -379,6 +382,7 @@ foreach my $file (@ARGV)
EOF
$input_m4 =~ s/^ //mg;
$input_m4 =~ s/\$file/$file/g;
# prepared input -- input, but reenables the quote before each AU macro.
open INPUT_M4, ">$tmp/input.m4"

View File

@ -8940,8 +8940,10 @@ with @code{AC_DEFUN} is that the user will be warned that
@var{old-macro} is now obsolete.
If she then uses @command{autoupdate}, the call to @var{old-macro} will be
replaced by the modern @var{implementation}. @command{autoupdate} will
then print the additional @var{message}.
replaced by the modern @var{implementation}. @var{message} should
include information on what to do after running @command{autoupdate},
and @command{autoupdate} will print it as a warning, @emph{and} include
it in the updated @file{configure.ac} file.
@end defmac
@node Coding Style

View File

@ -67,8 +67,9 @@ m4_define([AU_DEFINE], [])
# AU_DEFUN(NAME, NEW-CODE, [MESSAGE])
# -----------------------------------
# Declare that the macro NAME is now obsoleted, and should be replaced
# by NEW-CODE. Tell the user she should run autoupdate, and include
# the additional MESSAGE.
# by NEW-CODE. Tell the user she should run autoupdate, and when
# autoupdate is run, emit MESSAGE as a warning and include it in
# the updated configure.ac file.
#
# Also define NAME as a macro which code is NEW-CODE.
#
@ -76,15 +77,31 @@ m4_define([AU_DEFINE], [])
# and to update a configure.ac.
# See `acobsolete.m4' for a longer description.
m4_define([AU_DEFUN],
[AU_DEFINE([$1],
[m4_ifval([$3], [_au_warn_$1[]AC_DIAGNOSE([obsolete], [$3])d[]nl
[# This is what autoupdate's m4 run will expand. It fires
# the warning (with _au_warn_XXX), outputs it into the
# updated configure.ac (with AC_DIAGNOSE), and then outputs
# the replacement expansion.
AU_DEFINE([$1],
[m4_ifval([$3], [_au_warn_$1([$3])AC_DIAGNOSE([obsolete], [$3])d[]nl
])dnl
$2])
# This is an auxiliary macro that is also run when
# autoupdate runs m4. It simply calls m4_warning, but
# we need a wrapper so that each warning is emitted only
# once. We break the quoting in m4_warning's argument in
# order to expand this macro's arguments, not AU_DEFUN's.
AU_DEFINE([_au_warn_$1],
[m4_warning([$3])dnl
[m4_warning($][@)dnl
m4_define([_au_warn_$1], [])])
# Finally, this is the expansion that is picked up by
# autoconf. It tells the user to run autoupdate, and
# then outputs the replacement expansion. We do not care
# about autoupdate's warning because that contains
# information on what to do *after* running autoupdate.
AC_DEFUN([$1],
[AC_DIAGNOSE([obsolete], [The macro `$1' is obsolete.
[AC_DIAGNOSE([obsolete], [The macro `$1' is obsolete.
You should run autoupdate.])dnl
$2])])