summaryrefslogtreecommitdiff
path: root/lib/m4sugar
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2012-11-03 13:05:09 +0100
committerEric Blake <eblake@redhat.com>2012-11-09 16:16:22 -0700
commit1ed0548896e941b381e96724e41badc42ef7ec6e (patch)
treefee14cc6bd4837e7974a747d2d23fbe2638d89f9 /lib/m4sugar
parent4f6345bda73fc081a57f4e733512cd946aeeb3fd (diff)
downloadautoconf-1ed0548896e941b381e96724e41badc42ef7ec6e.tar.gz
warn: allow aclocal to silence m4_require warnings
We introduce a new witness macro, m4_require_silent_probe, for use by aclocal during the Autoconf-without-aclocal-m4 language. This will let aclocal process AC_CONFIG_MACRO_DIRS without emitting spurious warnings. In fact, if aclocal doesn't suppress require warnings, then, when some macro expanded in configure.ac calls AC_REQUIRE on another macro that is defined in one of the local m4 macro dirs specified with AC_CONFIG_MACRO_DIRS, the *first* autom4te invocation issued by aclocal, not yet being able to "see" the m4 macro definitions in the local m4 dirs, will print spurious warnings like: configure.ac:4: warning: MY_BAR is m4_require'd but not m4_defun'd configure.ac:3: MY_FOO is expanded from... Expose the use of this macro in our testsuite. Originally reported by Nick Bowler; see point (4) of: <http://lists.gnu.org/archive/html/autoconf-patches/2012-11/msg00000.html> * lib/m4sugar/m4sugar.m4 (_m4_require_call): Make warnings in the -Wsyntax category depend on the witness macro. * tests/m4sugar.at (m4@&t@_require: warning message): New test. * doc/autoconf.texi (Prerequisite Macros): Document how aclocal can silence AC_REQUIRE (m4_require) warnings. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com> Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'lib/m4sugar')
-rw-r--r--lib/m4sugar/m4sugar.m48
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4
index 12a9ab74..94c4ba86 100644
--- a/lib/m4sugar/m4sugar.m4
+++ b/lib/m4sugar/m4sugar.m4
@@ -2080,13 +2080,19 @@ m4_if([$0], [m4_require], [[m4_defun]], [[AC_DEFUN]])['d macro])])]dnl
#
# This is called frequently, so minimize the number of macro invocations
# by avoiding dnl and other overhead on the common path.
+# The use of a witness macro protecting the warning allows aclocal
+# to silence any warnings when probing for what macros are required
+# and must therefore be located, when using the Autoconf-without-aclocal-m4
+# autom4te language. For more background, see:
+# https://lists.gnu.org/archive/html/automake-patches/2012-11/msg00035.html
m4_define([_m4_require_call],
[m4_pushdef([_m4_divert_grow], m4_decr(_m4_divert_grow))]dnl
[m4_pushdef([_m4_diverting([$1])])m4_pushdef([_m4_diverting], [$1])]dnl
[m4_divert_push(_m4_divert_grow, [-])]dnl
[m4_if([$2], [], [$1], [$2])
m4_provide_if([$1], [m4_set_remove([_m4_provide], [$1])],
- [m4_warn([syntax], [$1 is m4_require'd but not m4_defun'd])])]dnl
+ [m4_ifndef([m4_require_silent_probe],
+ [m4_warn([syntax], [$1 is m4_require'd but not m4_defun'd])])])]dnl
[_m4_divert_raw($3)_m4_undivert(_m4_divert_grow)]dnl
[m4_divert_pop(_m4_divert_grow)_m4_popdef([_m4_divert_grow],
[_m4_diverting([$1])], [_m4_diverting])])