summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2020-10-07 09:01:16 -0400
committerZack Weinberg <zackw@panix.com>2020-10-07 09:18:33 -0400
commit09346f1a776b1bba3634f2d3ccf30460fc372d44 (patch)
tree8c26f75ed05db434165f921fb9dabf1ad4931a1f /lib
parent1b52a8609b9417a188fee773b8f296c180c4cc73 (diff)
downloadautoconf-09346f1a776b1bba3634f2d3ccf30460fc372d44.tar.gz
Don’t issue obsoletion warnings for AC_DIAGNOSE.
AC_DIAGNOSE is used in several extremely popular add-on macros, notably AM_INIT_AUTOMAKE, AM_GNU_GETTEXT, and AC_LIBTOOL_DLOPEN. Until newer versions of these macros are available, -Wobsolete warnings for AC_DIAGNOSE will be unhelpful noise. Therefore, make it so AC_DIAGNOSE(...) will still be replaced with m4_warn(...) by autoupdate, but autoconf runs will not complain about AC_DIAGNOSE. The bulk of the patch is augmenting AU_DEFUN so that it can define a “silent” autoupdate replacement, and documenting the new feature. * lib/autoconf/autoupdate.m4 (AU_DEFUN): Add a fourth argument, SILENT, which must be either empty or the word ‘silent’. If it is ‘silent’, the macro being defined will *not* issue a -Wobsolete warning when expanded by autoconf. Tweak quotation to prevent emacs’ parenthesis matching from getting confused. (AU_ALIAS): Add the SILENT argument here as well. * lib/autoconf/general.m4 (AC_DIAGNOSE): Define as a silent AU_DEFUN. Add commentary explaining why this was done and when it can be changed back. * doc/autoconf.texi (AU_DEFUN, AU_ALIAS): Revise; document new SILENT argument.
Diffstat (limited to 'lib')
-rw-r--r--lib/autoconf/autoupdate.m447
-rw-r--r--lib/autoconf/general.m412
2 files changed, 38 insertions, 21 deletions
diff --git a/lib/autoconf/autoupdate.m4 b/lib/autoconf/autoupdate.m4
index 109d8949..a3e13a69 100644
--- a/lib/autoconf/autoupdate.m4
+++ b/lib/autoconf/autoupdate.m4
@@ -36,20 +36,27 @@
# AU_DEFINE(NAME, CODE)
# ---------------------
-# Define the macro NAME so that it expand to CODE only when
+# Define the macro NAME so that it expands 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])
+# AU_DEFUN(NAME, NEW-CODE, [MESSAGE], [SILENT])
# -----------------------------------
-# Declare that the macro NAME is now obsoleted, and should be replaced
-# 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.
+# Define NAME as a macro whose expansion is NEW-CODE, just like
+# AC_DEFUN, but also declare NAME as obsolete. When autoupdate
+# is run, occurrences of NAME will be replaced with NEW-CODE in
+# the updated configure.ac.
#
-# Also define NAME as a macro which code is NEW-CODE.
+# If MESSAGE is not empty, it should be instructions for manual edits
+# to configure.ac that are required to finish the job of replacing NAME.
+# autoupdate will print MESSAGE, and [m4_warn([obsolete], [MESSAGE])]
+# will be placed next to NEW-CODE in the updated configure.ac.
+#
+# SILENT must be either empty or the word "silent". If it is empty,
+# *autoconf* will issue a generic obsolete-category warning when NAME
+# is expanded, telling the maintainer to run autoupdate.
#
# This allows sharing the same code for both supporting obsoleted macros,
# and to update a configure.ac.
@@ -62,8 +69,8 @@ m4_define([AU_DEFUN],
# unexpanded into the updated configure.ac.
AU_DEFINE([$1],
[m4_ifval([$3], [_au_warn_$1([$3])[m4_warn([obsolete],
-[$3])dnl]
-])dnl
+[$3])dnl
+]])dnl
$2])
# This is an auxiliary macro that is also run when
@@ -76,22 +83,28 @@ AU_DEFINE([_au_warn_$1],
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],
+# autoconf, causing NAME to expand to NEW-CODE, plus
+# (if SILENT is not "silent") a m4_warning telling the
+# maintainer to run autoupdate. We don't issue MESSAGE
+# from autoconf, because that's instructions for what
+# to do *after* running autoupdate.
+m4_case([$4],
+ [silent], [AC_DEFUN([$1], [$2])],
+ [], [AC_DEFUN([$1],
[m4_warn([obsolete], [The macro `$1' is obsolete.
You should run autoupdate.])dnl
-$2])])
+$2])],
+ [m4_fatal([SILENT argument to `$0' must be either empty or `silent'])]dnl
+)])
-# AU_ALIAS(OLD-NAME, NEW-NAME)
+# AU_ALIAS(OLD-NAME, NEW-NAME, [SILENT])
# ----------------------------
# The OLD-NAME is no longer used, just use NEW-NAME instead. There is
# little difference with using AU_DEFUN but the fact there is little
# interest in running the test suite on both OLD-NAME and NEW-NAME.
# This macro makes it possible to distinguish such cases.
+# The SILENT argument works the same as for AU_DEFUN.
#
# Do not use `defn' since then autoupdate would replace an old macro
# call with the new macro body instead of the new macro call.
@@ -102,7 +115,7 @@ $2])])
# matters with poorly written macros which test for $# = 0.
#
m4_define([AU_ALIAS],
-[AU_DEFUN([$1], _AU_ALIAS_BODY([$], [$2]))])
+[AU_DEFUN([$1], _AU_ALIAS_BODY([$], [$2]), [], [$4])])
# The body for the AU_DEFUN above should look like:
# [m4_if($#, 0, [NEW-NAME], [NEW-NAME($@)])]
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index de5633d8..eaa1d91b 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2324,10 +2324,14 @@ m4_append_uniq([_AC_SUBST_FILES], [$1], [
# 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.])])
+
+# 2020-10-06 / autoconf 2.70: Widely used third-party macros
+# (among others, from automake, libtool, and gettext) use AC_DIAGNOSE,
+# so we temporarily don't issue an obsoletion warning for it.
+# Revisit after third parties have had a chance to update their macros
+# and make releases.
+AU_DEFUN([AC_DIAGNOSE], [[m4_warn($@)]], [], [silent])
+AC_DEFUN([AC_DIAGNOSE], [m4_warn($@)])
AU_DEFUN([AC_FATAL], [[m4_fatal($@)]])
AC_DEFUN([AC_FATAL], [m4_fatal($@)dnl