diff options
author | Stefano Lattarini <stefano.lattarini@gmail.com> | 2012-11-03 13:05:09 +0100 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2012-11-09 16:16:22 -0700 |
commit | 1ed0548896e941b381e96724e41badc42ef7ec6e (patch) | |
tree | fee14cc6bd4837e7974a747d2d23fbe2638d89f9 /tests | |
parent | 4f6345bda73fc081a57f4e733512cd946aeeb3fd (diff) | |
download | autoconf-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 'tests')
-rw-r--r-- | tests/m4sugar.at | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/m4sugar.at b/tests/m4sugar.at index 997e2ddd..56927b90 100644 --- a/tests/m4sugar.at +++ b/tests/m4sugar.at @@ -429,6 +429,57 @@ autom4te: m4 failed with exit status: 1 AT_CLEANUP +## ----------------------------- ## +## m4_require: warning message. ## +## ----------------------------- ## + +AT_SETUP([m4@&t@_require: warning message]) +AT_KEYWORDS([m4@&t@_require m4@&t@_require_silent_probe]) + +# Mirror the job of aclocal on a typical scenario: the user invokes a +# single macro that comes from one included file, which in turn requires +# another macro from a second file. When using the incomplete set of +# files, we want a warning, unless we are merely learning which additional +# macros are needed in order to regenerate the list of files to include. +AT_DATA_M4SUGAR([script.4s], +[[m4_init +m4_include([script1.4s]) +foo +]]) + +AT_DATA_M4SUGAR([script1.4s], +[[m4_defun([foo], [m4_require([bar])]) +]]) + +AT_DATA_M4SUGAR([script2.4s], +[[m4_defun([bar], [BAR]) +]]) + +AT_CHECK_M4SUGAR([], [0], [], +[[script.4s:3: warning: bar is m4@&t@_require'd but not m4@&t@_defun'd +script1.4s:1: foo is expanded from... +script.4s:3: the top level +]]) + +# Inline expansion of AT_CHECK_M4SUGAR, mirroring how aclocal will +# inject a definition of our witness macro for a silent run. +echo 'm4@&t@_define([m4@&t@_require_silent_probe])' | + AT_CHECK_AUTOM4TE([--language=m4sugar - script.4s -o script], +[0], [], []) + +# Now that we have recomputed the set of include files, things should work. +AT_DATA_M4SUGAR([script.4s], +[[m4_init +m4_include([script1.4s]) +m4_include([script2.4s]) +foo +]]) + +AT_CHECK_M4SUGAR([], [0], [], []) + +AT_CLEANUP + + ## ----------------------------------- ## ## m4_require: circular dependencies. ## ## ----------------------------------- ## |