summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/autoreconf.in85
-rw-r--r--tests/torture.at47
2 files changed, 88 insertions, 44 deletions
diff --git a/bin/autoreconf.in b/bin/autoreconf.in
index 80185ba9..2ea917b5 100644
--- a/bin/autoreconf.in
+++ b/bin/autoreconf.in
@@ -126,17 +126,10 @@ my $make = $ENV{'MAKE'} || 'make';
my $install = 0;
# symlink -- when --install, use symlinks instead.
my $symlink = 0;
-# Does aclocal support -Wfoo?
-my $aclocal_supports_warnings = 0;
-# Does automake support -Wfoo?
-my $automake_supports_warnings = 0;
my @prepend_include;
my @include;
-# List of command line warning requests.
-my @warning;
-
# Rerun './configure && make'?
my $run_make = 0;
@@ -155,6 +148,9 @@ sub parse_args ()
{
my $srcdir;
+ # List of command line warning requests.
+ my @warning;
+
getopt ("W|warnings=s" => \@warning,
'I|include=s' => \@include,
'B|prepend-include=s' => \@prepend_include,
@@ -190,11 +186,6 @@ sub parse_args ()
}
}
- my $aclocal_help = `$aclocal --help 2>/dev/null`;
- my $automake_help = `$automake --help 2>/dev/null`;
- $aclocal_supports_warnings = $aclocal_help =~ /--warnings/;
- $automake_supports_warnings = $automake_help =~ /--warnings/;
-
# Dispatch autoreconf's option to the tools.
# --include;
$aclocal .= join (' -I ', '', map { shell_quote ($_) } @include);
@@ -241,17 +232,15 @@ sub parse_args ()
$autoheader .= ' --debug';
$libtoolize .= ' --debug';
}
- # --warnings;
- if (@warning)
- {
- my $warn = ' --warnings=' . join (',', @warning);
- $autoconf .= $warn;
- $autoheader .= $warn;
- $automake .= $warn
- if $automake_supports_warnings;
- $aclocal .= $warn
- if $aclocal_supports_warnings;
- }
+
+ # Pass down warnings via the WARNINGS environment variable, instead
+ # of via --warnings, so that unrecognized warning categories are
+ # silently ignored. We already issued diagnostics about warning
+ # categories *we* don't recognize; older subsidiary tools may not
+ # know all of them, and may treat unrecognized warning categories on
+ # the command line as a fatal error when -Werror is in effect.
+ $ENV{WARNINGS} = merge_WARNINGS @warning;
+ verb "export WARNINGS=$ENV{WARNINGS}";
}
@@ -297,7 +286,7 @@ sub autoreconf_current_directory ($)
# ------------------- #
# Gettext is a bit of a problem: its macros are not necessarily
- # visible to aclocal, so if we start with a completely striped down
+ # visible to aclocal, so if we start with a completely stripped down
# package (think of a fresh CVS checkout), running 'aclocal' first
# will fail: the Gettext macros are missing.
#
@@ -397,6 +386,9 @@ sub autoreconf_current_directory ($)
# Perform a single trace reading to avoid --force forcing a rerun
# between two --trace, that's useless. If there is no AC_INIT, then
# we are not interested: it looks like a Cygnus thingy.
+ # Suppress all warnings from this invocation; they may be spurious
+ # due to out-of-date files, and in any case they'll duplicate warnings
+ # from the final autoconf invocation.
my $aux_dir;
my $uses_gettext_via_traces;
my $uses_libtool;
@@ -406,27 +398,31 @@ sub autoreconf_current_directory ($)
my $uses_autoheader;
my $uses_automake;
my @subdir;
+ my $traces;
verb "$configure_ac: tracing";
- my $traces = new Autom4te::XFile
- ("$autoconf"
- . join (' ',
- map { ' --trace=' . $_ . ':\$n::\${::}%' }
- # If you change this list, update the
- # 'Autoreconf-preselections' section of autom4te.in.
- 'AC_CONFIG_AUX_DIR',
- 'AC_CONFIG_HEADERS',
- 'AC_CONFIG_SUBDIRS',
- 'AC_INIT',
- 'AC_PROG_LIBTOOL',
- 'AM_PROG_LIBTOOL',
- 'LT_INIT',
- 'LT_CONFIG_LTDL_DIR',
- 'AM_GNU_GETTEXT',
- 'AM_INIT_AUTOMAKE',
- 'IT_PROG_INTLTOOL',
- 'GTK_DOC_CHECK',
- )
- . ' |');
+ {
+ local $ENV{WARNINGS} = 'none';
+ $traces = new Autom4te::XFile
+ ("$autoconf"
+ . join (' ',
+ map { ' --trace=' . $_ . ':\$n::\${::}%' }
+ # If you change this list, update the
+ # 'Autoreconf-preselections' section of autom4te.in.
+ 'AC_CONFIG_AUX_DIR',
+ 'AC_CONFIG_HEADERS',
+ 'AC_CONFIG_SUBDIRS',
+ 'AC_INIT',
+ 'AC_PROG_LIBTOOL',
+ 'AM_PROG_LIBTOOL',
+ 'LT_INIT',
+ 'LT_CONFIG_LTDL_DIR',
+ 'AM_GNU_GETTEXT',
+ 'AM_INIT_AUTOMAKE',
+ 'IT_PROG_INTLTOOL',
+ 'GTK_DOC_CHECK',
+ )
+ . ' |');
+ }
while ($_ = $traces->getline)
{
chomp;
@@ -445,6 +441,7 @@ sub autoreconf_current_directory ($)
push @subdir, split (' ', $args[0])
if $macro eq "AC_CONFIG_SUBDIRS" && $recursive;
}
+ $traces->close;
# The subdirs are *optional*, they may not exist.
foreach (@subdir)
diff --git a/tests/torture.at b/tests/torture.at
index 82706d34..ff0f53f3 100644
--- a/tests/torture.at
+++ b/tests/torture.at
@@ -1857,3 +1857,50 @@ AT_CHECK([autoreconf -Wall -v -i], 0, [ignore], [stderr],
AT_CHECK([test -f HeeHee.in])
AT_CLEANUP
+
+## ------------------------------ ##
+## Specific warnings options. ##
+## ------------------------------ ##
+
+AT_SETUP([Specific warnings options for autoreconf])
+AT_KEYWORDS([autoreconf])
+
+# If autoreconf is given a -W option that's mentioned in its own
+# --help output, that option should not cause errors, even if some
+# of the subsidiary programs don't support it.
+
+# We use aclocal and automake via autoreconf.
+AT_CHECK([automake --version || exit 77], [], [ignore], [ignore])
+
+AT_DATA([configure.ac],
+[[AC_INIT(GNU foo, 1.0)
+AM_INIT_AUTOMAKE
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+]])
+
+AT_DATA([Makefile.am],
+[[AUTOMAKE_OPTIONS = foreign
+]])
+
+# To silence complaints about required helper scripts from automake.
+# We aren't going to run the generated Makefile so we don't need the
+# real helper scripts.
+AT_DATA([install-sh], [])
+AT_DATA([missing], [])
+
+# In order to cut down the time this test takes, we do not test all
+# of the supported warning categories, just the most common case
+# (-Wall) and some specific categories that are known to have been a
+# problem in the past.
+AT_CHECK([autoreconf -Werror -Wall], 0, [], [])
+rm -rf configure config.h.in Makefile.in aclocal.m4 autom4te.cache
+
+AT_CHECK([autoreconf -Werror -Wcross], 0, [], [])
+rm -rf configure config.h.in Makefile.in aclocal.m4 autom4te.cache
+
+AT_CHECK([autoreconf -Werror -Wportability-recursive], 0, [], [])
+rm -rf configure config.h.in Makefile.in aclocal.m4 autom4te.cache
+
+AT_CLEANUP