summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2020-09-22 14:24:33 -0400
committerZack Weinberg <zackw@panix.com>2020-09-22 15:46:44 -0400
commit119beb03250a5ddf9514994c5c5d601692b81fa6 (patch)
treec8adad651c7f3bb674af8001fd657425d569ec82
parent8cb3442318041c78df6182fc37ad55a2450048fc (diff)
downloadautoconf-119beb03250a5ddf9514994c5c5d601692b81fa6.tar.gz
Autoupdate AC_{DIAGNOSE,FATAL,OBSOLETE,WARNING} and _AC_COMPUTE_INT.
While working on the previous patches I noticed that all of these macros are officially obsolete, but autoupdate doesn’t replace them. _AC_COMPUTE_INT is easy to autoupdate. AC_{DIAGNOSE,FATAL,WARNING} require a little special handling because their replacements are m4sugar macros, and autoupdate normally expands m4sugar macros as it goes. Fortunately, the same workaround as is used for AC_FOREACH can be applied. AC_OBSOLETE also needs that workaround, and cannot be fully replaced automatically. The bulk of the patch is removing internal uses of AC_DIAGNOSE. * lib/autoconf/autoupdate.m4 * lib/autoconf/c.m4 * lib/autoconf/functions.m4 * lib/autoconf/general.m4 * lib/autoconf/headers.m4 * lib/autoconf/lang.m4 * lib/autoconf/status.m4 * lib/autoconf/types.m4 * tests/local.at * tests/tools.at: Use, and/or refer to, m4_warn instead of AC_DIAGNOSE. * lib/autoconf/general.m4 (_AC_COMPUTE_INT): Define using AU_DEFUN. (AC_DIAGNOSE, AC_FATAL, AC_WARNING): Autoupdate to m4_warn, m4_fatal, and m4_warn([syntax], [$1]) respectively, using the same paired AU_DEFUN/AC_DEFUN trick that is used for AC_FOREACH. (AC_OBSOLETE): Autoupdate to m4_warn([obsolete], [$1]) and advise hand-conversion to AU_DEFUN. * lib/autoconf/autoupdate.m4 (AU_DEFUN): Tweak quoting so m4_warn([$3]) is emitted into the edited configure.ac instead of being expanded at autoupdate time. * tests/tools.at (autoupdating AC_FOREACH): Adjust grep expressions. (autoupdating AC_DIAGNOSE and AC_WARNING): New test. (autoupdating AC_FATAL): New test. (autoupdating AC_OBSOLETE): New test. * tests/mktests.sh (ac_exclude_list, au_exclude_list): Exclude AC_DIAGNOSE, AC_FATAL, AC_FOREACH, AC_OBSOLETE, and AC_WARNING if not already excluded.
-rw-r--r--NEWS10
-rw-r--r--lib/autoconf/autoupdate.m414
-rw-r--r--lib/autoconf/c.m42
-rw-r--r--lib/autoconf/functions.m48
-rw-r--r--lib/autoconf/general.m478
-rw-r--r--lib/autoconf/headers.m48
-rw-r--r--lib/autoconf/lang.m42
-rw-r--r--lib/autoconf/specific.m42
-rw-r--r--lib/autoconf/status.m46
-rw-r--r--lib/autoconf/types.m44
-rw-r--r--tests/local.at2
-rwxr-xr-xtests/mktests.sh10
-rw-r--r--tests/tools.at129
13 files changed, 205 insertions, 70 deletions
diff --git a/NEWS b/NEWS
index 9ee7dbec..8a8ac9f1 100644
--- a/NEWS
+++ b/NEWS
@@ -199,6 +199,16 @@ GNU Autoconf NEWS - User visible changes.
diagnosed as obsolete, and replaced with AC_CONFIG_HEADERS by
autoupdate.
+- The obsolete macros AC_DIAGNOSE, AC_FATAL, AC_WARNING, and
+ _AC_COMPUTE_INT are now replaced with modern equivalents by
+ autoupdate.
+
+- The macro AC_OBSOLETE is obsolete. Autoupdate will replace it with
+ m4_warn([obsolete], [explanation]). If possible, macros using
+ AC_OBSOLETE should be converted to use AU_DEFUN or AU_ALIAS instead,
+ which enables autoupdate to replace them, but this has to be done by
+ hand and is not always possible.
+
- AC_FC_LINE_LENGTH now documents the maximum portable length of
"unlimited" Fortran source code lines to be 250 columns, not 254.
diff --git a/lib/autoconf/autoupdate.m4 b/lib/autoconf/autoupdate.m4
index 056ef08f..109d8949 100644
--- a/lib/autoconf/autoupdate.m4
+++ b/lib/autoconf/autoupdate.m4
@@ -55,12 +55,14 @@ m4_define([AU_DEFINE], [])
# and to update a configure.ac.
# See the end of `autoupdate.in' for a longer description.
m4_define([AU_DEFUN],
-[# 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.
+[# 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
+# m4_warn), and then outputs the replacement expansion. We need extra
+# quotation around the m4_warn and dnl so they will be written
+# unexpanded into the updated configure.ac.
AU_DEFINE([$1],
-[m4_ifval([$3], [_au_warn_$1([$3])AC_DIAGNOSE([obsolete], [$3])d[]nl
+[m4_ifval([$3], [_au_warn_$1([$3])[m4_warn([obsolete],
+[$3])dnl]
])dnl
$2])
@@ -79,7 +81,7 @@ m4_define([_au_warn_$1], [])])
# 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.
+ [m4_warn([obsolete], [The macro `$1' is obsolete.
You should run autoupdate.])dnl
$2])])
diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index fe6aa2b6..be5e4148 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -1690,7 +1690,7 @@ dnl the user did not specify a config header but is relying on the
dnl default behavior for universal builds.
m4_default([$4],
[AC_CONFIG_COMMANDS_PRE([m4_ifset([AH_HEADER], [],
- [AC_DIAGNOSE([obsolete],
+ [m4_warn([obsolete],
[AC_C_BIGENDIAN should be used with AC_CONFIG_HEADERS])])])dnl
AC_DEFINE([AC_APPLE_UNIVERSAL_BUILD],1,
[Define if building universal (internal helper macro)])])
diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index 46c4a115..aa560a63 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -85,7 +85,7 @@ m4_define([_AH_CHECK_FUNC],
m4_define([_AC_CHECK_FUNCS_ONE_U],
[AS_LITERAL_WORD_IF([$1],
[_AH_CHECK_FUNC([$1])],
- [AC_DIAGNOSE([syntax], [AC_CHECK_FUNCS($1): you should use literals])])])
+ [m4_warn([syntax], [AC_CHECK_FUNCS($1): you should use literals])])])
# _AC_CHECK_FUNCS_ONE_S(FUNCTION)
# -------------------------------
@@ -173,7 +173,7 @@ done])])
m4_define([_AC_REPLACE_FUNC_U],
[AS_LITERAL_WORD_IF([$1],
[_AH_CHECK_FUNC([$1])AC_LIBSOURCE([$1.c])],
- [AC_DIAGNOSE([syntax], [AC_REPLACE_FUNCS($1): you should use literals])])])
+ [m4_warn([syntax], [AC_REPLACE_FUNCS($1): you should use literals])])])
# _AC_REPLACE_FUNC_L(FUNCTION)
# ----------------------------
@@ -1776,7 +1776,7 @@ test $ac_cv_func_strnlen_working = no && AC_LIBOBJ([strnlen])
# AC_FUNC_SETVBUF_REVERSED
# ------------------------
AC_DEFUN([AC_FUNC_SETVBUF_REVERSED],
-[AC_DIAGNOSE([obsolete],
+[m4_warn([obsolete],
[The macro `$0' is obsolete. Remove it and all references to SETVBUF_REVERSED.])dnl
AC_CACHE_VAL([ac_cv_func_setvbuf_reversed], [ac_cv_func_setvbuf_reversed=no])
])# AC_FUNC_SETVBUF_REVERSED
@@ -2063,7 +2063,7 @@ AU_ALIAS([AC_VPRINTF], [AC_FUNC_VPRINTF])
# any invocation should be removed, and the code adjusted.
AN_FUNCTION([wait3], [AC_FUNC_WAIT3])
AC_DEFUN([AC_FUNC_WAIT3],
-[AC_DIAGNOSE([obsolete],
+[m4_warn([obsolete],
[$0: `wait3' has been removed from POSIX.
Remove this `AC_FUNC_WAIT3' and adjust your code to use `waitpid' instead.])dnl
AC_CACHE_CHECK([for wait3 that fills in rusage],
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 81360b78..de5633d8 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -162,13 +162,6 @@ m4_copy([m4_provide], [AC_PROVIDE])
m4_copy([m4_provide_if], [AC_PROVIDE_IFELSE])
-# AC_OBSOLETE(THIS-MACRO-NAME, [SUGGESTION])
-# ------------------------------------------
-m4_define([AC_OBSOLETE],
-[AC_DIAGNOSE([obsolete], [$1 is obsolete$2])])
-
-
-
## ----------------------------- ##
## Implementing shell functions. ##
## ----------------------------- ##
@@ -190,9 +183,12 @@ AC_DEFUN([AC_REQUIRE_SHELL_FN],
# AU::AC_FOREACH(VARIABLE, LIST, EXPRESSION)
# ------------------------------------------
+# The double definition is necessary because autoupdate expands m4_
+# macros, so we have to double-quote the replacement, but then it
+# won't work in a normal autoconf run.
AU_DEFUN([AC_FOREACH], [[m4_foreach_w($@)]])
AC_DEFUN([AC_FOREACH], [m4_foreach_w($@)dnl
-AC_DIAGNOSE([obsolete], [The macro `AC_FOREACH' is obsolete.
+m4_warn([obsolete], [The macro `AC_FOREACH' is obsolete.
You should run autoupdate.])])
@@ -2152,14 +2148,14 @@ rm -f confcache[]dnl
# Should be dnl'ed. Try to catch common mistakes.
m4_defun([AC_CACHE_VAL],
[AS_LITERAL_WORD_IF([$1], [m4_if(m4_index(m4_quote($1), [_cv_]), [-1],
- [AC_DIAGNOSE([syntax],
+ [m4_warn([syntax],
[$0($1, ...): suspicious cache-id, must contain _cv_ to be cached])])])dnl
m4_if(m4_index([$2], [AC_DEFINE]), [-1], [],
- [AC_DIAGNOSE([syntax],
+ [m4_warn([syntax],
[$0($1, ...): suspicious presence of an AC_DEFINE in the second argument, ]dnl
[where no actions should be taken])])dnl
m4_if(m4_index([$2], [AC_SUBST]), [-1], [],
- [AC_DIAGNOSE([syntax],
+ [m4_warn([syntax],
[$0($1, ...): suspicious presence of an AC_SUBST in the second argument, ]dnl
[where no actions should be taken])])dnl
AS_VAR_SET_IF([$1],
@@ -2320,25 +2316,34 @@ m4_append_uniq([_AC_SUBST_FILES], [$1], [
## Printing messages at autoconf runtime. ##
## --------------------------------------- ##
-# In fact, I think we should promote the use of m4_warn and m4_fatal
-# directly. This will also avoid to some people to get it wrong
-# between AC_FATAL and AC_MSG_ERROR.
-
-
-# AC_DIAGNOSE(CATEGORY, MESSAGE)
-# AC_FATAL(MESSAGE, [EXIT-STATUS])
+# AU::AC_DIAGNOSE(CATEGORY, MESSAGE)
+# AU::AC_FATAL(MESSAGE, [EXIT-STATUS])
+# AU::AC_WARNING(MESSAGE)
+# AU::AC_OBSOLETE(THIS-MACRO, [SUGGESTION])
# --------------------------------
-m4_define([AC_DIAGNOSE], [m4_warn($@)])
-m4_define([AC_FATAL], [m4_fatal($@)])
+# The double definitions are necessary because autoupdate expands m4_
+# macros, so we have to double-quote the replacements, but then they
+# won't work in a normal autoconf run.
+AU_DEFUN([AC_DIAGNOSE], [[m4_warn($@)]])
+AC_DEFUN([AC_DIAGNOSE], [m4_warn($@)dnl
+m4_warn([obsolete], [The macro `$0' is obsolete.
+You should run autoupdate.])])
+AU_DEFUN([AC_FATAL], [[m4_fatal($@)]])
+AC_DEFUN([AC_FATAL], [m4_fatal($@)dnl
+m4_warn([obsolete], [The macro `$0' is obsolete.
+You should run autoupdate.])])
-# AC_WARNING(MESSAGE)
-# -------------------
-# Report a MESSAGE to the user of autoconf if `-W' or `-W all' was
-# specified.
-m4_define([AC_WARNING],
-[AC_DIAGNOSE([syntax], [$1])])
+AU_DEFUN([AC_WARNING], [[m4_warn([syntax], [$1])]])
+AC_DEFUN([AC_WARNING], [m4_warn([syntax], [$1])dnl
+m4_warn([obsolete], [The macro `$0' is obsolete.
+You should run autoupdate.])])
+AU_DEFUN([AC_OBSOLETE], [[m4_warn([obsolete], [$1 is obsolete$2])]],
+[if possible, define this macro using AU_DEFUN.])
+AC_DEFUN([AC_OBSOLETE], [m4_warn([obsolete], [$1 is obsolete$2])dnl
+m4_warn([obsolete], [The macro `$0' is obsolete.
+You should run autoupdate.])])
@@ -2872,8 +2877,8 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
AC_DEFUN([AC_RUN_IFELSE],
[AC_LANG_COMPILER_REQUIRE()dnl
m4_ifval([$4], [],
- [AC_DIAGNOSE([cross],
- [$0 called without default to allow cross compiling])])dnl
+ [m4_warn([cross],
+ [$0 called without default to allow cross compiling])])dnl
AS_IF([test "$cross_compiling" = yes],
[m4_default([$4],
[AC_MSG_FAILURE([cannot run test program while cross compiling])])],
@@ -2899,8 +2904,8 @@ AU_DEFUN([AC_TRY_RUN],
#
# Check for the existence of FILE.
AC_DEFUN([AC_CHECK_FILE],
-[AC_DIAGNOSE([cross],
- [cannot check for file existence when cross compiling])dnl
+[m4_warn([cross],
+ [cannot check for file existence when cross compiling])dnl
AS_VAR_PUSHDEF([ac_File], [ac_cv_file_$1])dnl
AC_CACHE_CHECK([for $1], [ac_File],
[test "$cross_compiling" = yes &&
@@ -3121,7 +3126,7 @@ esac
AC_DEFUN([AC_LIBOBJ],
[_AC_LIBOBJ([$1])]dnl
[AS_LITERAL_WORD_IF([$1], [AC_LIBSOURCE([$1.c])],
- [AC_DIAGNOSE([syntax], [$0($1): you should use literals])])])
+ [m4_warn([syntax], [$0($1): you should use literals])])])
# _AC_LIBOBJS_NORMALIZE
@@ -3250,15 +3255,8 @@ AC_DEFUN([AC_COMPUTE_INT],
[], [$4])
])# AC_COMPUTE_INT
-# _AC_COMPUTE_INT(EXPRESSION, VARIABLE, PROLOGUE, [IF-FAILS])
+# AU::_AC_COMPUTE_INT(EXPRESSION, VARIABLE, PROLOGUE, [IF-FAILS])
# -----------------------------------------------------------
# FIXME: this private interface was used by several packages.
# Give them time to transition to AC_COMPUTE_INT and then delete this one.
-AC_DEFUN([_AC_COMPUTE_INT],
-[AC_COMPUTE_INT([$2], [$1], [$3], [$4])
-AC_DIAGNOSE([obsolete],
-[The macro `_AC_COMPUTE_INT' is obsolete and will be deleted in a
-future version or Autoconf. Hence, it is suggested that you use
-instead the public AC_COMPUTE_INT macro. Note that the arguments are
-slightly different between the two.])dnl
-])# _AC_COMPUTE_INT
+AU_DEFUN([_AC_COMPUTE_INT], [AC_COMPUTE_INT([$2], [$1], [$3], [$4])])
diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4
index cd750ebe..21b37197 100644
--- a/lib/autoconf/headers.m4
+++ b/lib/autoconf/headers.m4
@@ -113,7 +113,7 @@ m4_define([_AC_CHECK_HEADER_PREPROC_BODY],
# --------------------------------------------------------------
# Check the preprocessor accepts HEADER-FILE.
AC_DEFUN([_AC_CHECK_HEADER_PREPROC],
-[AC_DIAGNOSE([obsolete], [Checking for headers with the preprocessor is
+[m4_warn([obsolete], [Checking for headers with the preprocessor is
deprecated. Specify prerequisite code to AC_CHECK_HEADER
instead of using fourth argument `-'. (Many headers need
no prerequisites. If you truly need to test whether
@@ -142,12 +142,12 @@ AS_VAR_POPDEF([ac_Header])])# _AC_CHECK_HEADER_PREPROC
# AU_DEFUN([_AC_CHECK_HEADER_OLD],
# [AC_CHECK_HEADER([$1], [$2], [$3], [-])])
AC_DEFUN([_AC_CHECK_HEADER_OLD],
-[AC_DIAGNOSE([obsolete], [The macro `$0' is obsolete.
+[m4_warn([obsolete], [The macro `$0' is obsolete.
You should use AC_CHECK_HEADER with a fourth argument.])]dnl
[_AC_CHECK_HEADER_PREPROC($@)])
AC_DEFUN([_AC_CHECK_HEADER_NEW],
-[AC_DIAGNOSE([obsolete], [The macro `$0' is obsolete.
+[m4_warn([obsolete], [The macro `$0' is obsolete.
You should use AC_CHECK_HEADER with a fourth argument.])]dnl
[_AC_CHECK_HEADER_COMPILE($@)])
@@ -180,7 +180,7 @@ m4_define([AH_CHECK_HEADERS],
m4_define([_AC_CHECK_HEADERS_ONE_U],
[AS_LITERAL_WORD_IF([$1],
[_AH_CHECK_HEADER([$1])],
- [AC_DIAGNOSE([syntax], [AC_CHECK_HEADERS($1): you should use literals])])])
+ [m4_warn([syntax], [AC_CHECK_HEADERS($1): you should use literals])])])
# _AC_CHECK_HEADERS_ONE_S(HEADER-FILE, [INCLUDES])
# -------------------------------
diff --git a/lib/autoconf/lang.m4 b/lib/autoconf/lang.m4
index 27eaa129..9e6e3b35 100644
--- a/lib/autoconf/lang.m4
+++ b/lib/autoconf/lang.m4
@@ -125,7 +125,7 @@ AU_DEFUN([AC_LANG_SAVE],
you should use `AC_LANG_PUSH' and `AC_LANG_POP'.])
AC_DEFUN([AC_LANG_SAVE],
[m4_pushdef([_AC_LANG], _AC_LANG)dnl
-AC_DIAGNOSE([obsolete], [The macro `AC_LANG_SAVE' is obsolete.
+m4_warn([obsolete], [The macro `AC_LANG_SAVE' is obsolete.
You should run autoupdate.])])
diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4
index f750722a..7478ee7f 100644
--- a/lib/autoconf/specific.m4
+++ b/lib/autoconf/specific.m4
@@ -228,7 +228,7 @@ fi
# If the system automatically restarts a system call that is
# interrupted by a signal, define `HAVE_RESTARTABLE_SYSCALLS'.
AC_DEFUN([AC_SYS_RESTARTABLE_SYSCALLS],
-[AC_DIAGNOSE([obsolete],
+[m4_warn([obsolete],
[$0: AC_SYS_RESTARTABLE_SYSCALLS is useful only when supporting very
old systems that lack `sigaction' and `SA_RESTART'. Don't bother with
this macro unless you need to support very old systems like 4.2BSD and
diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4
index 2d3f92ba..1389f328 100644
--- a/lib/autoconf/status.m4
+++ b/lib/autoconf/status.m4
@@ -1100,7 +1100,7 @@ m4_define([_AC_CONFIG_SUBDIRS],
[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])]dnl
[AC_REQUIRE([AC_DISABLE_OPTION_CHECKING])]dnl
[AS_LITERAL_IF([$1], [],
- [AC_DIAGNOSE([syntax], [$0: you should use literals])])]dnl
+ [m4_warn([syntax], [$0: you should use literals])])]dnl
[m4_map_args_w([$1], [_AC_CONFIG_UNIQUE([SUBDIRS],
_AC_CONFIG_COMPUTE_DEST(], [))])]dnl
[m4_append([_AC_LIST_SUBDIRS], [$1], [
@@ -1258,8 +1258,8 @@ m4_ifvaln([$1],
m4_ifvaln([$2$3],
[AC_CONFIG_COMMANDS(default, [$2], [$3])])dnl
m4_ifval([$1$2$3],
- [AC_DIAGNOSE([obsolete],
- [$0 should be used without arguments.
+ [m4_warn([obsolete],
+ [$0 should be used without arguments.
You should run autoupdate.])])dnl
AC_CACHE_SAVE
diff --git a/lib/autoconf/types.m4 b/lib/autoconf/types.m4
index a41eeb18..fff850ac 100644
--- a/lib/autoconf/types.m4
+++ b/lib/autoconf/types.m4
@@ -238,8 +238,8 @@ AC_DEFUN([AC_CHECK_TYPE],
[_AC_CHECK_TYPE_REPLACEMENT_TYPE_P([$2])], [1],
[_AC_CHECK_TYPE_OLD],
[_AC_CHECK_TYPE_MAYBE_TYPE_P([$2])], [1],
- [AC_DIAGNOSE([syntax],
- [$0: assuming `$2' is not a type])_AC_CHECK_TYPE_NEW],
+ [m4_warn([syntax],
+ [$0: assuming `$2' is not a type])_AC_CHECK_TYPE_NEW],
[_AC_CHECK_TYPE_NEW])($@)])# AC_CHECK_TYPE
diff --git a/tests/local.at b/tests/local.at
index 3424bd6a..b9f866f7 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -592,7 +592,7 @@ AT_CHECK_MACRO([$1 (cross compile)],
# NAME-OF-THE-MACRO. On the second pass, *don't* check for the
# absence of -Wobsolete warnings, because many of autoupdate's edits
# leave the configure.ac author with some manual work to do, and
-# indicate this by inserting an AC_DIAGNOSE message to be removed
+# indicate this by inserting an m4_warn message to be removed
# after the manual work is complete.
m4_define([AT_CHECK_AU_MACRO],
[AT_SETUP([$1])
diff --git a/tests/mktests.sh b/tests/mktests.sh
index 37b97b2a..05356cb2 100755
--- a/tests/mktests.sh
+++ b/tests/mktests.sh
@@ -110,8 +110,9 @@ ac_exclude_list='
# Is a number.
/^AC_FD_CC$/ {next}
- # Obsolete, but needs to be AC_DEFUNed.
- /^AC_FOREACH$/ {next}
+ # Obsolete, but needs to be AC_DEFUNed and cannot safely be called
+ # without arguments. Tested in tools.at.
+ /^AC_(DIAGNOSE|FATAL|FOREACH|OBSOLETE|WARNING)$/ {next}
# Require a file that is not shipped with Autoconf. But it should.
/^AC_FUNC_(GETLOADAVG|FNMATCH_GNU)$/ {next}
@@ -167,8 +168,9 @@ au_exclude_list='
# AC_LANG_RESTORE cannot be used alone.
/^AC_LANG_(SAVE|RESTORE)$/ {next}
- # Need arguments and are tested elsewhere.
- /^AC_(LINK_FILES|PREREQ)$/ {next}
+ # Need arguments. Tested in tools.at.
+ /^AC_(DIAGNOSE|FATAL|FOREACH|OBSOLETE|LINK_FILES|PREREQ|WARNING)$/
+ {next}
'
# au_exclude_script
diff --git a/tests/tools.at b/tests/tools.at
index 1bb670fa..2ad46ca1 100644
--- a/tests/tools.at
+++ b/tests/tools.at
@@ -1014,7 +1014,7 @@ AT_CHECK_AUTOUPDATE
# autoupdate does not replace AU_DEFUNs/AU_ALIASes defined by
# configure.ac itself, nor by aclocal.m4, so BAZ will still be present
# in the updated configure.ac. This is actually desirable for this
-# test: the point of that part of the above configure.ac is to to
+# test: the point of that part of the above configure.ac is to
# verify that the expansion of an AU_ALIAS definition handles $#
# correctly. If BAZ got turned into FOO by the above call to
# autoupdate, we would need to run autoconf and configure twice in
@@ -1247,7 +1247,7 @@ AC_OUTPUT
# Both the autoupdate and autoconf invocations will complain about
# AC_LANG_SAVE being obsolete, because autoupdate cannot replace
# two-macro sequences (e.g. AC_LANG_SAVE \n AC_LANG([C]) ideally would
-# become AC_LANG_PUSH([C]) but we can't do that) so an AC_DIAGNOSE
+# become AC_LANG_PUSH([C]) but we can't do that) so an m4_warn
# is left in place to remind people they need to do some hand edits.
# Ignore these diagnostics.
AT_CHECK_AUTOUPDATE([], [], [], [ignore])
@@ -1272,15 +1272,138 @@ AC_OUTPUT
]])
# Checking `autoupdate'.
+# AC_FOREACH is replaced with an m4sugar macro, so we must make sure
+# the m4sugar macro wasn't expanded.
AT_CHECK_AUTOUPDATE
-AT_CHECK([[grep 'echo 1 2 3 4 5 6' configure.ac]], 1, [ignore], [ignore])
AT_CHECK([[grep 'm4@&t@_foreach_w' configure.ac]], 0, [ignore], [ignore])
+AT_CHECK([[grep 'echo 1 2 3 4 5 6' configure.ac]], 1, [ignore], [ignore])
+AT_CHECK([[grep "echo ' 1'' 2'' 3'' 4'' 5'' 6'" configure.ac]], 1,
+ [ignore], [ignore])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([], [0], [stdout])
AT_CHECK([[grep ' 1 2 3 4 5 6' stdout]], 0, [ignore], [ignore])
AT_CLEANUP
+# autoupdating AC_OBSOLETE
+# ------------------------
+AT_SETUP([autoupdating AC_OBSOLETE])
+
+AT_DATA([aclocal.m4],
+[[AC_DEFUN([OLD],
+[AC_OBSOLETE([$0], [; convert to NEW])
+NEW([$2], [$1])])
+AC_DEFUN([NEW],
+[AS@&t@_ECHO(["dst=$1 src=$2"])])
+]])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+OLD([src], [dst])
+AC_OUTPUT
+]])
+
+AT_CHECK_AUTOCONF([-Werror], 1, [],
+[[configure.ac:2: warning: OLD is obsolete; convert to NEW
+general.m4: AC_OBSOLETE is expanded from...
+aclocal.m4:1: OLD is expanded from...
+configure.ac:2: the top level
+configure.ac:2: warning: The macro `AC_OBSOLETE' is obsolete.
+configure.ac:2: You should run autoupdate.
+general.m4: AC_OBSOLETE is expanded from...
+aclocal.m4:1: OLD is expanded from...
+configure.ac:2: the top level
+]])
+
+# autoupdate does not know how to replace OLD with NEW
+AT_CHECK_AUTOUPDATE
+AT_CHECK([[grep OLD configure.ac]], 0, [ignore], [ignore])
+
+# autoupdate _does_ know how to remove AC_OBSOLETE from aclocal.m4
+AT_CHECK_AUTOUPDATE([aclocal.m4], 0, [],
+[[aclocal.m4:2: warning: if possible, define this macro using AU_DEFUN.
+]])
+
+# AC_OBSOLETE is replaced with an m4sugar macro, so we must make sure
+# the m4sugar macro wasn't expanded.
+AT_CHECK([[grep 'm4@&t@_warn' aclocal.m4]], 0, [ignore], [ignore])
+AT_CHECK([[grep 'if possible, define this' aclocal.m4]], 0, [ignore], [ignore])
+AT_CHECK([[grep 'AC_OBSOLETE(' aclocal.m4]], 1, [ignore], [ignore])
+
+AT_CHECK_AUTOCONF([-Wobsolete -Wno-error], 0, [],
+[[configure.ac:2: warning: if possible, define this macro using AU_DEFUN.
+aclocal.m4:1: OLD is expanded from...
+configure.ac:2: the top level
+configure.ac:2: warning: OLD is obsolete; convert to NEW
+aclocal.m4:1: OLD is expanded from...
+configure.ac:2: the top level
+]])
+
+AT_CHECK_CONFIGURE([], 0,
+[[dst=dst src=src
+configure: creating ./config.status
+]])
+
+AT_CLEANUP
+
+
+# autoupdating AC_DIAGNOSE and AC_WARNING
+-----------------------------------------
+AT_SETUP([autoupdating AC_DIAGNOSE and AC_WARNING])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+AC_DIAGNOSE([gnu], [The gnu has escaped])
+AC_WARNING([funny punctu&tion])
+AC_OUTPUT
+]])
+
+# Checking `autoupdate'.
+# AC_DIAGNOSE and AC_WARNING are replaced with m4sugar macros, so we
+# must make sure the m4sugar macros weren't expanded.
+AT_CHECK_AUTOUPDATE
+AT_CHECK([[grep 'm4@&t@_warn' configure.ac]], 0, [ignore], [ignore])
+AT_CHECK([[grep 'The gnu has escaped' configure.ac]], 0, [ignore], [ignore])
+AT_CHECK([[grep 'funny punctu&tion' configure.ac]], 0, [ignore], [ignore])
+
+# The diagnostics should appear when autoconf is run.
+AT_CHECK_AUTOCONF([-Wall], [0], [],
+[[configure.ac:2: warning: The gnu has escaped
+configure.ac:3: warning: funny punctu&tion
+]])
+AT_CHECK_CONFIGURE
+
+AT_CLEANUP
+
+
+# autoupdating AC_FATAL
+-----------------------
+AT_SETUP([autoupdating AC_FATAL])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+AC_FATAL([what did you do this time])
+AC_OUTPUT
+]])
+
+# Checking `autoupdate'.
+# AC_FATAL is replaced with a m4sugar macro, so we
+# must make sure the m4sugar macro wasn't expanded.
+AT_CHECK_AUTOUPDATE
+AT_CHECK([[grep 'm4@&t@_fatal' configure.ac]], 0, [ignore], [ignore])
+AT_CHECK([[grep 'what did you do this time' configure.ac]],
+ 0, [ignore], [ignore])
+
+# The diagnostic should appear when autoconf is run.
+AT_CHECK_AUTOCONF([-Wall], [1], [],
+[[configure.ac:2: error: what did you do this time
+configure.ac:2: the top level
+autom4te: error: m4 failed with exit status: 1
+]])
+AT_CHECK([[test \! -f configure]])
+
+AT_CLEANUP
+
# autoupdating with aclocal and m4_include
# ----------------------------------------