From: Paolo Bonzini Date: Tue, 3 Feb 2004 09:00:27 +0000 (+0000) Subject: * bin/autoupdate.in: Define __file__ so that warnings X-Git-Tag: AUTOCONF-2.59c~739 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ddbbac5eef8b64dbee2dea15b9aba51775534a1;p=thirdparty%2Fautoconf.git * 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). --- diff --git a/bin/autoupdate.in b/bin/autoupdate.in index 9c58ff854..065c339bd 100644 --- a/bin/autoupdate.in +++ b/bin/autoupdate.in @@ -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" diff --git a/doc/autoconf.texi b/doc/autoconf.texi index aec04a12f..b3ffb1398 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -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 diff --git a/lib/autoconf/autoupdate.m4 b/lib/autoconf/autoupdate.m4 index 0cc41593d..8eaa388a7 100644 --- a/lib/autoconf/autoupdate.m4 +++ b/lib/autoconf/autoupdate.m4 @@ -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])])