autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Be done with AU_DEFUN's third argument


From: Paolo Bonzini
Subject: Be done with AU_DEFUN's third argument
Date: Wed, 26 Nov 2003 10:22:12 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031020 Debian/1.5-1

AFAICT even the first revision that is in CVS of autoupdate did not output the messages, so I took some liberties in the implementation. What this patch does is:

1) move all the AC_DIAGNOSE in AU_DEFUN'd macros to the infamous third parameter.

2) in autoupdate, trace AU_DEFINE instead of AU_DEFUN.

3) in AU_DEFUN, spit out the warning just once, but include the AC_DIAGNOSE in every instance of the macro. This way, one can simply search the autoupdated configure.ac for AC_DIAGNOSE in order to find places that needs work (AC_LINK_FILES may appear multiple times).

It also removes the notices about the brokenness of the third parameter that I put in when I reverted my original patch.

No problem for me if you got confused, I admit I was not very clear because I was not sure if it worked by accident... It looks much better now.

Paolo

2003-11-26  Paolo Bonzini  <address@hidden>

        * bin/autoupdate.in: Trace AU_DEFINE instead of AU_DEFUN.
        * doc/autoconf.texi: Don't say that the third parameter
        is broken.
        * lib/autoconf/autoupdate.m4 (AU_DEFINE): New dummy macro.
        (AU_DEFUN): Honor the third parameter, create autoupdate
        macros with AU_DEFINE.
        * lib/autoconf/headers.m4 (AC_USG, AC_MEMORY_H,
        AC_DIR_HEADER): Use AU_DEFUN's third parameter.
        * lib/autoconf/lang.m4 (AC_LANG_SAVE): Likewise.
        * lib/autoconf/programs.m4 (AC_RSH): Likewise.
        * lib/autoconf/specific.m4 (AC_HAVE_POUNDBANG,
        AC_ARG_ARRAY, AC_CYGWIN, AC_EMXOS2, AC_MINGW32,
        AC_XENIX_DIR): Likewise.
        * lib/autoconf/types.m4 (AC_INT_16_BITS, AC_LONG_64_BITS,
        AC_STRUCT_ST_BLKSIZE, AC_STRUCT_ST_RDEV): Likewise.
        * lib/autoconf/status.m4: Remove FIXME.
        * local.at (AT_CHECK_AU_MACRO): Ignore stderr, check
        that the macro is not present anymore in the updated
        configure.ac.
        * tools.at (autoupdate AC_LINK_FILES): Ignore stderr
        of autoupdate

Index: bin/autoupdate.in
===================================================================
RCS file: /cvsroot/autoconf/autoconf/bin/autoupdate.in,v
retrieving revision 1.48
diff -u -r1.48 autoupdate.in
--- bin/autoupdate.in   27 Aug 2003 11:35:09 -0000      1.48
+++ bin/autoupdate.in   26 Nov 2003 09:08:37 -0000
@@ -172,7 +172,7 @@
 sub handle_autoconf_macros ()
 {
   my $macros = new Autom4te::XFile ("$autoconf"
-                                   . " --trace AU_DEFUN:'AU:\$f:\$1'"
+                                   . " --trace AU_DEFINE:'AU:\$f:\$1'"
                                    . " --trace define:'AC:\$f:\$1'"
                                    . " --melt /dev/null |");
   while ($_ = $macros->getline)
@@ -251,7 +251,7 @@
   's/\b(' . join ('|', keys %au_macros) . ')\b/_au_changequote([,])$1/g';
 
 # au.m4 -- definitions the AU macros.
-xsystem ("$autoconf --trace AU_DEFUN:'_au_defun(\@<:address@hidden@:>\@,
+xsystem ("$autoconf --trace AU_DEFINE:'_au_defun(\@<:address@hidden@:>\@,
 \@<:address@hidden@:>\@)' --melt /dev/null "
        . ">$tmp/au.m4");
 
Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.782
diff -u -r1.782 autoconf.texi
--- doc/autoconf.texi   25 Nov 2003 13:50:46 -0000      1.782
+++ doc/autoconf.texi   26 Nov 2003 09:08:38 -0000
@@ -8854,8 +8854,8 @@
 @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}.  In the future, 
address@hidden will then print the additional @var{message}.
+replaced by the modern @var{implementation}.  @command{autoupdate} will
+then print the additional @var{message}.
 @end defmac
 
 @node Coding Style
Index: lib/autoconf/autoupdate.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/autoupdate.m4,v
retrieving revision 1.5
diff -u -r1.5 autoupdate.m4
--- lib/autoconf/autoupdate.m4  25 Nov 2003 13:50:45 -0000      1.5
+++ lib/autoconf/autoupdate.m4  26 Nov 2003 09:08:38 -0000
@@ -55,25 +55,34 @@
 ## ---------------------------------- ##
 
 
+# AU_DEFINE(NAME, CODE)
+# ---------------------
+# Define the macro NAME so that it expand to CODE only when
+# autoupdate is running.  This is achieved with traces in
+# autoupdate itself, so this macro expands to nothing.
+#
+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.
 #
-# FIXME: MESSAGE should be grabbed with autom4te traces, and that's
-# why it is never used in the body of the macro; however, as of 2003-11-25
-# it is never used and it seems that it never was.  Also, MESSAGE is
-# used only once in AC_LINK_FILES, it may be the case to remove it from
-# there.  See the FIXME in AC_LINK_FILES as well.
-#
 # Also define NAME as a macro which code is NEW-CODE.
 #
 # This allows to share the same code for both supporting obsoleted macros,
 # and to update a configure.ac.
 # See `acobsolete.m4' for a longer description.
 m4_define([AU_DEFUN],
-[AC_DEFUN([$1],
+[AU_DEFINE([$1],
+[m4_ifval([$3], [_au_warn_$1[]AC_DIAGNOSE([obsolete], [$3])d[]nl
+])dnl
+$2])
+AU_DEFINE([_au_warn_$1],
+[m4_warning([$3])dnl
+m4_define([_au_warn_$1], [])])
+AC_DEFUN([$1],
           [AC_DIAGNOSE([obsolete], [The macro `$1' is obsolete.
 You should run autoupdate.])dnl
 $2])])
Index: lib/autoconf/headers.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/headers.m4,v
retrieving revision 1.36
diff -u -r1.36 headers.m4
--- lib/autoconf/headers.m4     24 Nov 2003 10:40:59 -0000      1.36
+++ lib/autoconf/headers.m4     26 Nov 2003 09:08:38 -0000
@@ -731,10 +731,7 @@
 # ----------
 # Define `USG' if string functions are in strings.h.
 AU_DEFUN([AC_USG],
-[AC_DIAGNOSE([obsolete],
-[$0: Remove `AC_MSG_CHECKING', `AC_LINK_IFELSE' and this `AC_DIAGNOSE'
-when you adjust your code to use HAVE_STRING_H.])dnl
-AC_MSG_CHECKING([for BSD string and memory functions])
+[AC_MSG_CHECKING([for BSD string and memory functions])
 AC_LINK_IFELSE([AC_LANG_PROGRAM(address@hidden:@include <strings.h>]],
                                [[rindex(0, 0); bzero(0, 0);]])],
               [AC_MSG_RESULT(yes)],
@@ -743,8 +740,9 @@
                          [Define to 1 if you do not have <strings.h>, index,
                           bzero, etc... This symbol is obsolete, you should
                           not depend upon it.])])
-AC_CHECK_HEADERS(string.h)
-])# AU::AC_USG
+AC_CHECK_HEADERS(string.h)],
+[Remove `AC_MSG_CHECKING', `AC_LINK_IFELSE' and this warning
+when you adjust your code to use HAVE_STRING_H.])
 
 
 # AU::AC_MEMORY_H
@@ -761,14 +759,13 @@
 # But it is better to check for both headers, and alias NEED_MEMORY_H to
 # HAVE_MEMORY_H.
 AU_DEFUN([AC_MEMORY_H],
-[AC_DIAGNOSE([obsolete], [$0: Remove this `AC_DIAGNOSE' and
-`AC_CHECK_HEADER(memory.h, AC_DEFINE(...))' when you adjust your code to
-use and HAVE_STRING_H and HAVE_MEMORY_H, not NEED_MEMORY_H.])dnl
-AC_CHECK_HEADER(memory.h,
+[AC_CHECK_HEADER(memory.h,
                [AC_DEFINE([NEED_MEMORY_H], 1,
                           [Same as `HAVE_MEMORY_H', don't depend on me.])])
-AC_CHECK_HEADERS(string.h memory.h)
-])
+AC_CHECK_HEADERS(string.h memory.h)],
+[Remove this warning and
+`AC_CHECK_HEADER(memory.h, AC_DEFINE(...))' when you adjust your code to
+use HAVE_STRING_H and HAVE_MEMORY_H, not NEED_MEMORY_H.])
 
 
 # AU::AC_DIR_HEADER
@@ -779,9 +776,6 @@
 AU_DEFUN([AC_DIR_HEADER],
 [AC_HEADER_DIRENT
 AC_FUNC_CLOSEDIR_VOID
-AC_DIAGNOSE([obsolete],
-[$0: Remove this `AC_DIAGNOSE' and the four `AC_DEFINE' when you
-adjust your code to use `AC_HEADER_DIRENT'.])
 test ac_cv_header_dirent_dirent_h &&
   AC_DEFINE([DIRENT], 1, [Same as `HAVE_DIRENT_H', don't depend on me.])
 test ac_cv_header_dirent_sys_ndir_h &&
@@ -789,5 +783,6 @@
 test ac_cv_header_dirent_sys_dir_h &&
   AC_DEFINE([SYSDIR], 1, [Same as `HAVE_SYS_DIR_H', don't depend on me.])
 test ac_cv_header_dirent_ndir_h &&
-  AC_DEFINE([NDIR], 1, [Same as `HAVE_NDIR_H', don't depend on me.])
-])
+  AC_DEFINE([NDIR], 1, [Same as `HAVE_NDIR_H', don't depend on me.])],
+[Remove this warning and the four `AC_DEFINE' when you
+adjust your code to use `AC_HEADER_DIRENT'.])
Index: lib/autoconf/lang.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/lang.m4,v
retrieving revision 1.167
diff -u -r1.167 lang.m4
--- lib/autoconf/lang.m4        20 Oct 2003 16:18:26 -0000      1.167
+++ lib/autoconf/lang.m4        26 Nov 2003 09:08:38 -0000
@@ -160,10 +160,9 @@
 # ------------
 # Save the current language, but don't change language.
 AU_DEFUN([AC_LANG_SAVE],
-[AC_DIAGNOSE([obsolete],
-            [instead of using `AC_LANG', `AC_LANG_SAVE',
-and `AC_LANG_RESTORE', you should use `AC_LANG_PUSH' and `AC_LANG_POP'.])
-m4_pushdef([_AC_LANG], _AC_LANG)])
+[m4_pushdef([_AC_LANG], _AC_LANG)],
+[Instead of using `AC_LANG', `AC_LANG_SAVE', and `AC_LANG_RESTORE',
+you should use `AC_LANG_PUSH' and `AC_LANG_POP'.])
 
 
 # AC_LANG_RESTORE
Index: lib/autoconf/programs.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/programs.m4,v
retrieving revision 1.17
diff -u -r1.17 programs.m4
--- lib/autoconf/programs.m4    22 May 2003 13:24:05 -0000      1.17
+++ lib/autoconf/programs.m4    26 Nov 2003 09:08:38 -0000
@@ -496,9 +496,9 @@
 # AC_RSH
 # ------
 # I don't know what it used to do, but it no longer does.
-AU_DEFUN([AC_RSH],
-[AC_DIAGNOSE([obsolete], [$0: is no longer supported.
-Remove this warning when you adjust the code.])])
+AU_DEFUN([AC_RSH], [],
+[$0 is no longer supported.  Remove this warning when you
+adjust the code.])
 
 
 # AC_PROG_YACC
Index: lib/autoconf/specific.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/specific.m4,v
retrieving revision 1.357
diff -u -r1.357 specific.m4
--- lib/autoconf/specific.m4    24 Nov 2003 10:40:59 -0000      1.357
+++ lib/autoconf/specific.m4    26 Nov 2003 09:08:38 -0000
@@ -97,16 +97,14 @@
 
 
 AU_DEFUN([AC_HAVE_POUNDBANG],
-[AC_SYS_INTERPRETER
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning when you adjust your code to use
-      `AC_SYS_INTERPRETER'.])])
+[AC_SYS_INTERPRETER],
+[Remove this warning when you adjust your code to use
+`AC_SYS_INTERPRETER'.])
 
 
-AU_DEFUN([AC_ARG_ARRAY],
-[AC_DIAGNOSE([obsolete],
-[$0: no longer implemented: don't do unportable things
-with arguments. Remove this warning when you adjust your code.])])
+AU_DEFUN([AC_ARG_ARRAY], [],
+[$0 is no longer implemented: don't do unportable things
+with arguments. Remove this warning when you adjust your code.])
 
 
 # _AC_SYS_LARGEFILE_TEST_INCLUDES
@@ -354,13 +352,12 @@
 # EXEEXT.
 AU_DEFUN([AC_CYGWIN],
 [AC_CANONICAL_HOST
-AC_DIAGNOSE([obsolete],
-           [$0 is obsolete: use AC_CANONICAL_HOST and check if $host_os 
matches *cygwin*])dnl
 case $host_os in
   *cygwin* ) CYGWIN=yes;;
         * ) CYGWIN=no;;
 esac
-])# AC_CYGWIN
+], [$0 is obsolete: use AC_CANONICAL_HOST and check if $host_os
+matches *cygwin*])# AC_CYGWIN
 
 
 # AC_EMXOS2
@@ -369,13 +366,12 @@
 # for EXEEXT.
 AU_DEFUN([AC_EMXOS2],
 [AC_CANONICAL_HOST
-AC_DIAGNOSE([obsolete],
-           [$0 is obsolete: use AC_CANONICAL_HOST and check if $host_os 
matches *emx*])dnl
 case $host_os in
   *emx* ) EMXOS2=yes;;
       * ) EMXOS2=no;;
 esac
-])# AC_EMXOS2
+], [$0 is obsolete: use AC_CANONICAL_HOST and check if $host_os
+matches *emx*])# AC_EMXOS2
 
 
 # AC_MINGW32
@@ -384,13 +380,12 @@
 # EXEEXT.
 AU_DEFUN([AC_MINGW32],
 [AC_CANONICAL_HOST
-AC_DIAGNOSE([obsolete],
-           [$0 is obsolete: use AC_CANONICAL_HOST and check if $host_os 
matches *mingw32*])dnl
 case $host_os in
   *mingw32* ) MINGW32=yes;;
          * ) MINGW32=no;;
 esac
-])# AC_MINGW32
+], [$0 is obsolete: use AC_CANONICAL_HOST and check if $host_os
+matches *mingw32*])# AC_MINGW32
 
 
 
@@ -453,9 +448,8 @@
 
 # AC_XENIX_DIR
 # ------------
-AU_DEFUN(AC_XENIX_DIR,
-[# You shouldn't need to depend upon XENIX.  Remove this test if useless.
-AC_MSG_CHECKING([for Xenix])
+AU_DEFUN([AC_XENIX_DIR],
+[AC_MSG_CHECKING([for Xenix])
 AC_EGREP_CPP(yes,
 [#if defined(M_XENIX) && !defined(M_UNIX)
   yes
@@ -464,7 +458,10 @@
             [AC_MSG_RESULT([no]); XENIX=])
 
 AC_HEADER_DIRENT[]dnl
-])
+],
+[You shouldn't need to depend upon XENIX.  Remove the
+`AC_MSG_CHECKING', `AC_EGREP_CPP', and this warning if this part
+of the test is useless.])
 
 
 # AC_DYNIX_SEQ
Index: lib/autoconf/status.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/status.m4,v
retrieving revision 1.42
diff -u -r1.42 status.m4
--- lib/autoconf/status.m4      25 Nov 2003 13:50:46 -0000      1.42
+++ lib/autoconf/status.m4      26 Nov 2003 09:08:38 -0000
@@ -747,18 +747,9 @@
 done
 AC_CONFIG_LINKS($[ac_config_links_]_AC_LINK_FILES_CNT)dnl
 ],
-dnl FIXME: Macros such as AC_USG put messages like this into an
-dnl AC_DIAGNOSE macro, in the first parameter of AU_DEFUN.  We cannot
-dnl do the same with this one, because it makes no sense to print it
-dnl when running `autoconf -W obsolete' on a configure script that uses
-dnl AC_LINK_FILES.  Instead, only `autoupdate' should print it (it may
-dnl be acceptable that autoupdated configure scripts print this message
-dnl when running `autoconf -W obsolete').  As of 2003-11-25, the third
-dnl argument to AU_DEFUN is broken, so this is never seen by the user.
-[
-  It is technically impossible to `autoupdate' cleanly from AC_LINK_FILES
-  to AC_CONFIG_FILES.  `autoupdate' provides a functional but inelegant
-  update, you should probably tune the result yourself.])# AC_LINK_FILES
+[It is technically impossible to `autoupdate' cleanly from AC_LINK_FILES
+to AC_CONFIG_FILES.  `autoupdate' provides a functional but inelegant
+update, you should probably tune the result yourself.])# AC_LINK_FILES
 
 
 # Initialize.
Index: lib/autoconf/types.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/types.m4,v
retrieving revision 1.24
diff -u -r1.24 types.m4
--- lib/autoconf/types.m4       24 Nov 2003 10:40:59 -0000      1.24
+++ lib/autoconf/types.m4       26 Nov 2003 09:08:38 -0000
@@ -415,29 +415,25 @@
 # What a great name :)
 AU_DEFUN([AC_INT_16_BITS],
 [AC_CHECK_SIZEOF([int])
-AC_DIAGNOSE([obsolete], [$0:
-       your code should no longer depend upon `INT_16_BITS', but upon
-       `SIZEOF_INT == 2'.  Remove this warning and the `AC_DEFINE' when you
-       adjust the code.])dnl
 test $ac_cv_sizeof_int = 2 &&
   AC_DEFINE(INT_16_BITS, 1,
            [Define to 1 if `sizeof (int)' = 2.  Obsolete, use `SIZEOF_INT'.])
-])
+], [your code should no longer depend upon `INT_16_BITS', but upon
+`SIZEOF_INT == 2'.  Remove this warning and the `AC_DEFINE' when you
+adjust the code.])
 
 
 # AU::AC_LONG_64_BITS
 # -------------------
 AU_DEFUN([AC_LONG_64_BITS],
 [AC_CHECK_SIZEOF([long int])
-AC_DIAGNOSE([obsolete], [$0:
-       your code should no longer depend upon `LONG_64_BITS', but upon
-       `SIZEOF_LONG_INT == 8'.  Remove this warning and the `AC_DEFINE' when
-       you adjust the code.])dnl
 test $ac_cv_sizeof_long_int = 8 &&
   AC_DEFINE(LONG_64_BITS, 1,
            [Define to 1 if `sizeof (long int)' = 8.  Obsolete, use
             `SIZEOF_LONG_INT'.])
-])
+], [your code should no longer depend upon `LONG_64_BITS', but upon
+`SIZEOF_LONG_INT == 8'.  Remove this warning and the `AC_DEFINE' when
+you adjust the code.])
 
 
 
@@ -515,16 +511,14 @@
 # AC_STRUCT_ST_BLKSIZE
 # --------------------
 AU_DEFUN([AC_STRUCT_ST_BLKSIZE],
-[AC_DIAGNOSE([obsolete], [$0:
-       your code should no longer depend upon `HAVE_ST_BLKSIZE', but
-       `HAVE_STRUCT_STAT_ST_BLKSIZE'.  Remove this warning and
-       the `AC_DEFINE' when you adjust the code.])
-AC_CHECK_MEMBERS([struct stat.st_blksize],
+[AC_CHECK_MEMBERS([struct stat.st_blksize],
                 [AC_DEFINE(HAVE_ST_BLKSIZE, 1,
                            [Define to 1 if your `struct stat' has
                             `st_blksize'.  Deprecated, use
                             `HAVE_STRUCT_STAT_ST_BLKSIZE' instead.])])
-])# AC_STRUCT_ST_BLKSIZE
+], [your code should no longer depend upon `HAVE_ST_BLKSIZE', but
+`HAVE_STRUCT_STAT_ST_BLKSIZE'.  Remove this warning and
+the `AC_DEFINE' when you adjust the code.])# AC_STRUCT_ST_BLKSIZE
 
 
 # AC_STRUCT_ST_BLOCKS
@@ -555,16 +549,14 @@
 # AC_STRUCT_ST_RDEV
 # -----------------
 AU_DEFUN([AC_STRUCT_ST_RDEV],
-[AC_DIAGNOSE([obsolete], [$0:
-       your code should no longer depend upon `HAVE_ST_RDEV', but
-       `HAVE_STRUCT_STAT_ST_RDEV'.  Remove this warning and
-       the `AC_DEFINE' when you adjust the code.])
-AC_CHECK_MEMBERS([struct stat.st_rdev],
+[AC_CHECK_MEMBERS([struct stat.st_rdev],
                 [AC_DEFINE(HAVE_ST_RDEV, 1,
                            [Define to 1 if your `struct stat' has `st_rdev'.
                             Deprecated, use `HAVE_STRUCT_STAT_ST_RDEV'
                             instead.])])
-])# AC_STRUCT_ST_RDEV
+], [your code should no longer depend upon `HAVE_ST_RDEV', but
+`HAVE_STRUCT_STAT_ST_RDEV'.  Remove this warning and
+the `AC_DEFINE' when you adjust the code.])# AC_STRUCT_ST_RDEV
 
 
 # AC_STRUCT_TM
Index: tests/local.at
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/local.at,v
retrieving revision 1.3
diff -u -r1.3 local.at
--- tests/local.at      27 Aug 2003 15:14:04 -0000      1.3
+++ tests/local.at      26 Nov 2003 09:08:38 -0000
@@ -351,7 +351,8 @@
 AT_CHECK_ENV
 
 rm config.hin
-AT_CHECK_AUTOUPDATE
+AT_CHECK_AUTOUPDATE([], 0, [], ignore)
+AT_CHECK([grep '^$1$' configure.ac], 1)
 
 AT_CHECK_AUTOCONF
 AT_CHECK_AUTOHEADER
Index: tests/tools.at
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/tools.at,v
retrieving revision 1.72
diff -u -r1.72 tools.at
--- tests/tools.at      23 Jun 2003 11:11:42 -0000      1.72
+++ tests/tools.at      26 Nov 2003 09:08:38 -0000
@@ -570,7 +570,7 @@
 )
 
 # Checking `autoupdate'.
-AT_CHECK_AUTOUPDATE
+AT_CHECK_AUTOUPDATE([], 0, [], ignore)
 AT_CHECK_AUTOCONF
 AT_CHECK_CONFIGURE
 AT_CHECK([cat src1], 0, [dst1

reply via email to

[Prev in Thread] Current Thread [Next in Thread]