]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* bin/autoupdate.in: Define __file__ so that warnings
authorPaolo Bonzini <bonzini@gnu.org>
Tue, 3 Feb 2004 09:00:27 +0000 (09:00 +0000)
committerPaolo Bonzini <bonzini@gnu.org>
Tue, 3 Feb 2004 09:00:27 +0000 (09:00 +0000)
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).

bin/autoupdate.in
doc/autoconf.texi
lib/autoconf/autoupdate.m4

index 9c58ff85482f549cca1000683b00675d942ac421..065c339bdfaf11418a9b51b3ab6e1230cce75dba 100644 (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"
index aec04a12f74f9085bf8f1857354c70e566aa0523..b3ffb1398070b75144918a8c8355886aa746d2ad 100644 (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
index 0cc41593d296bcf1938dd7624bfc52b5820b72b6..8eaa388a7e3c1aeaeccaee0e40c79ddd3ce2e043 100644 (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])])