summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2020-09-18 13:40:20 -0400
committerZack Weinberg <zackw@panix.com>2020-09-21 14:14:44 -0400
commitbd09c76a76288998ce5f804bffca3c690232d1c8 (patch)
treef0d7f0c0cc5896b6d55ceac88d568adb740627c3
parent22089fa6e91f944411aea174b2d5840871142d1b (diff)
downloadautomake-bd09c76a76288998ce5f804bffca3c690232d1c8.tar.gz
Use WARNINGS=none to suppress warnings from autom4te runs.
aclocal uses autom4te in trace mode to scan configure.ac for macros whose definition is not yet available. It has a kludge to prevent this from producing spurious warnings, but a cleaner, fully backward compatible, way to get the same effect is to set WARNINGS=none in the environment and not pass down any -W options. (This is better than passing -Wnone on the command line because it automatically inherits to any subprocesses started by autom4te.) Perl’s ‘local’ feature can be used to make the enviironment variable setting temporary, reverting to the previous value when we exit the function. automake also runs autom4te (technically autoconf) in trace mode; warnings from this invocation will not be *spurious*, but in the common case where the person running automake is going to run autoconf next, they will be duplicated. Therefore, make the same change to automake. * bin/aclocal.in (trace_used_macros) * bin/automake.in (scan_autoconf_traces): Use “local $ENV{WARNINGS}='none'” to suppress warnings from autom4te.
-rw-r--r--bin/aclocal.in19
-rw-r--r--bin/automake.in7
2 files changed, 14 insertions, 12 deletions
diff --git a/bin/aclocal.in b/bin/aclocal.in
index 42e8d839a..ca2f96324 100644
--- a/bin/aclocal.in
+++ b/bin/aclocal.in
@@ -762,22 +762,19 @@ sub trace_used_macros ()
my %files = map { $map{$_} => 1 } keys %macro_seen;
%files = strip_redundant_includes %files;
- # When AC_CONFIG_MACRO_DIRS is used, avoid possible spurious warnings
- # from autom4te about macros being "m4_require'd but not m4_defun'd";
- # for more background, see:
- # https://lists.gnu.org/archive/html/autoconf-patches/2012-11/msg00004.html
- # as well as autoconf commit 'v2.69-44-g1ed0548', "warn: allow aclocal
- # to silence m4_require warnings".
- my $early_m4_code .= "m4_define([m4_require_silent_probe], [-])";
+ # Suppress all warnings from this invocation of autom4te.
+ # In particular we want to avoid spurious warnings about
+ # macros being "m4_require'd but not m4_defun'd" because
+ # aclocal.m4 is not yet available.
+ local $ENV{WARNINGS} = 'none';
my $traces = ($ENV{AUTOM4TE} || '@am_AUTOM4TE@');
$traces .= " --language Autoconf-without-aclocal-m4 ";
- $traces = "echo '$early_m4_code' | $traces - ";
# Support AC_CONFIG_MACRO_DIRS also with older autoconf.
# Note that we can't use '$ac_config_macro_dirs_fallback' here, because
- # a bug in option parsing code of autom4te 2.68 and earlier will cause
- # it to read standard input last, even if the "-" argument is specified
+ # a bug in option parsing code of autom4te 2.68 and earlier would cause
+ # it to read standard input last, even if the "-" argument was specified
# early.
# FIXME: To be removed in Automake 2.0, once we can assume autoconf
# 2.70 or later.
@@ -807,7 +804,7 @@ sub trace_used_macros ()
# characters (like newlines).
(map { "--trace='$_:\$f::\$n'" } (keys %macro_seen)));
- verb "running $traces $configure_ac";
+ verb "running WARNINGS=$ENV{WARNINGS} $traces $configure_ac";
my $tracefh = new Automake::XFile ("$traces $configure_ac |");
diff --git a/bin/automake.in b/bin/automake.in
index 67b729045..a88b835a5 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -5249,6 +5249,11 @@ sub scan_autoconf_traces
sinclude => 1,
);
+ # Suppress all warnings from this invocation of autoconf.
+ # The user is presumably about to run autoconf themselves
+ # and will see its warnings then.
+ local $ENV{WARNINGS} = 'none';
+
my $traces = ($ENV{AUTOCONF} || '@am_AUTOCONF@') . " ";
# Use a separator unlikely to be used, not ':', the default, which
@@ -5257,8 +5262,8 @@ sub scan_autoconf_traces
map { "--trace=$_" . ':\$f:\$l::\$d::\$n::\${::}%' }
(keys %traced));
+ verb "running WARNINGS=$ENV{WARNINGS} $traces";
my $tracefh = new Automake::XFile ("$traces $filename |");
- verb "reading $traces";
@cond_stack = ();
my $where;