summaryrefslogtreecommitdiff
path: root/lib/autoconf
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 /lib/autoconf
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.
Diffstat (limited to 'lib/autoconf')
-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
9 files changed, 62 insertions, 62 deletions
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