summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--bin/autoconf.as21
-rw-r--r--bin/autoheader.in14
-rw-r--r--bin/autom4te.in10
-rw-r--r--bin/autoreconf.in2
-rw-r--r--bin/autoupdate.in5
-rw-r--r--lib/Autom4te/ChannelDefs.pm172
-rw-r--r--lib/Autom4te/Config.pm43
-rw-r--r--lib/local.mk1
-rw-r--r--tests/base.at2
-rw-r--r--tests/c.at2
-rw-r--r--tests/compile.at7
-rw-r--r--tests/local.at52
-rw-r--r--tests/m4sh.at2
-rw-r--r--tests/m4sugar.at25
-rw-r--r--tests/semantics.at34
-rw-r--r--tests/tools.at54
-rw-r--r--tests/torture.at5
18 files changed, 334 insertions, 120 deletions
diff --git a/NEWS b/NEWS
index 72761730..9ee7dbec 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,9 @@ GNU Autoconf NEWS - User visible changes.
per-process temporary runtime files (such as pid files) into '/run'
instead of '/var/run'.
+** Warnings about obsolete constructs are now on by default.
+ They can be turned off with '-Wno-obsolete'.
+
** The use of the long-deprecated name 'configure.in' for the autoconf
input file now elicits a warning in the 'obsolete' category.
diff --git a/bin/autoconf.as b/bin/autoconf.as
index 1cfb5462..93563c97 100644
--- a/bin/autoconf.as
+++ b/bin/autoconf.as
@@ -37,16 +37,21 @@ Operation modes:
-d, --debug don't remove temporary files
-f, --force consider all files obsolete
-o, --output=FILE save output in FILE (stdout is the default)
- -W, --warnings=CATEGORY report the warnings falling in CATEGORY [syntax]
+ -W, --warnings=CATEGORY report the warnings falling in CATEGORY
Warning categories include:
- 'cross' cross compilation issues
- 'obsolete' obsolete constructs
- 'syntax' dubious syntactic constructs
- 'all' all the warnings
- 'no-CATEGORY' turn off the warnings on CATEGORY
- 'none' turn off all the warnings
- 'error' warnings are error
+ cross cross compilation issues
+ gnu GNU coding standards (default in gnu and gnits modes)
+ obsolete obsolete features or constructions (default)
+ override user redefinitions of Automake rules or variables
+ portability portability issues (default in gnu and gnits modes)
+ portability-recursive nested Make variables (default with -Wportability)
+ extra-portability extra portability issues related to obscure tools
+ syntax dubious syntactic constructs (default)
+ unsupported unsupported or incomplete features (default)
+ all all the warnings
+ no-CATEGORY turn off warnings in CATEGORY
+ none turn off all the warnings
The environment variables 'M4' and 'WARNINGS' are honored.
diff --git a/bin/autoheader.in b/bin/autoheader.in
index 29d0fe52..6b02cbb8 100644
--- a/bin/autoheader.in
+++ b/bin/autoheader.in
@@ -58,7 +58,7 @@ my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@';
my $config_h_in;
my @prepend_include;
my @include;
-
+my @warnings;
# $HELP
# -----
@@ -112,10 +112,12 @@ sub parse_args ()
{
my $srcdir;
- parse_WARNINGS;
getopt ('I|include=s' => \@include,
'B|prepend-include=s' => \@prepend_include,
- 'W|warnings=s' => \&parse_warnings);
+ 'W|warnings=s' => \@warnings);
+
+ parse_WARNINGS;
+ parse_warnings @warnings;
if (! @ARGV)
{
@@ -130,7 +132,6 @@ sub parse_args ()
## -------------- ##
mktmpdir ('ah');
-switch_warning 'obsolete';
parse_args;
# Preach.
@@ -165,6 +166,7 @@ END
my $autoconf = "'$autom4te' --language=autoconf ";
$autoconf .= join (' --include=', '', map { shell_quote ($_) } @include);
$autoconf .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include);
+$autoconf .= join (' --warnings=', '', map { shell_quote ($_) } @warnings);
$autoconf .= ' --debug' if $debug;
$autoconf .= ' --force' if $force;
$autoconf .= ' --verbose' if $verbose;
@@ -278,7 +280,7 @@ $out->close;
{
if (! -r $template)
{
- msg 'syntax', "warning: cannot read $template: $!";
+ msg 'syntax', "cannot read $template: $!";
}
else
{
@@ -297,7 +299,7 @@ $out->close;
foreach (sort keys %symbol)
{
- msg 'syntax', "warning: missing template: $_";
+ msg 'syntax', "missing template: $_";
if ($suggest_ac_define)
{
msg 'syntax', "Use AC_DEFINE([$_], [], [Description])";
diff --git a/bin/autom4te.in b/bin/autom4te.in
index 78902f13..20ecca9e 100644
--- a/bin/autom4te.in
+++ b/bin/autom4te.in
@@ -336,12 +336,13 @@ sub parse_args ()
# Process the arguments for real this time.
my @trace;
my @prepend_include;
- parse_WARNINGS;
+ my @warnings;
+
getopt
(
# Operation modes:
"o|output=s" => \$output,
- "W|warnings=s" => \&parse_warnings,
+ "W|warnings=s" => \@warnings,
"m|mode=s" => \$mode,
"M|melt" => \$melt,
@@ -365,6 +366,9 @@ sub parse_args ()
"no-cache" => sub { $cache = undef; },
);
+ parse_WARNINGS;
+ parse_warnings @warnings;
+
fatal "too few arguments
Try '$me --help' for more information."
unless @ARGV;
@@ -1048,7 +1052,7 @@ for (split (/\n*$separator\n*/o, contents ("$tmp/warnings")))
# In particular, m4_warn guarantees that either $stackdump is empty, or
# it consists of lines where only the last line ends in "top level".
my ($cat, $loc, $msg, $stacktrace) = split ('::', $_, 4);
- msg $cat, $loc, "warning: $msg",
+ msg $cat, $loc, $msg,
partial => ($stacktrace =~ /top level$/) + 0;
for (split /\n/, $stacktrace)
{
diff --git a/bin/autoreconf.in b/bin/autoreconf.in
index 73de08a7..80185ba9 100644
--- a/bin/autoreconf.in
+++ b/bin/autoreconf.in
@@ -167,7 +167,7 @@ sub parse_args ()
# lists.
@warning = map { split /,/ } @warning;
parse_WARNINGS;
- parse_warnings '--warnings', @warning;
+ parse_warnings @warning;
# Even if the user specified a configure.ac, trim to get the
# directory, and look for configure.ac again. Because (i) the code
diff --git a/bin/autoupdate.in b/bin/autoupdate.in
index 3f13254b..047f8e0e 100644
--- a/bin/autoupdate.in
+++ b/bin/autoupdate.in
@@ -229,6 +229,11 @@ $autoconf .= " --verbose" if $verbose;
$autoconf .= join (' --include=', '', map { shell_quote ($_) } @include);
$autoconf .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include);
+# Disable all warnings from autoconf invocations.
+# In particular we do not want warnings about obsolete constructs,
+# which are on by default as of autoconf 2.70.
+$ENV{'WARNINGS'} = 'none';
+
mktmpdir ('au');
handle_autoconf_macros;
diff --git a/lib/Autom4te/ChannelDefs.pm b/lib/Autom4te/ChannelDefs.pm
index 84e634e8..21f444b9 100644
--- a/lib/Autom4te/ChannelDefs.pm
+++ b/lib/Autom4te/ChannelDefs.pm
@@ -1,10 +1,9 @@
-# Copyright (C) 2002-2003, 2006, 2008-2017, 2020 Free Software
-# Foundation, Inc.
+# Copyright (C) 2002-2020 Free Software Foundation, Inc.
-# This program is free software: you can redistribute it and/or modify
+# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -16,8 +15,6 @@
package Autom4te::ChannelDefs;
-use Autom4te::Channels;
-
=head1 NAME
Autom4te::ChannelDefs - channel definitions for Automake and helper functions
@@ -53,6 +50,17 @@ use warnings FATAL => 'all';
use Exporter;
+use Autom4te::Channels;
+use Autom4te::Config;
+BEGIN
+{
+ if ($perl_threads)
+ {
+ require threads;
+ import threads;
+ }
+}
+
our @ISA = qw (Exporter);
our @EXPORT = qw (&prog_error &error &fatal &verb
&switch_warning &parse_WARNINGS &parse_warnings);
@@ -79,7 +87,7 @@ Errors related to GNU Standards.
=item C<error-gnu/warn>
-Errors related to GNU Standards that should be warnings in "foreign" mode.
+Errors related to GNU Standards that should be warnings in 'foreign' mode.
=item C<error-gnits>
@@ -99,7 +107,7 @@ Warnings related to GNU Coding Standards.
=item C<obsolete>
-Warnings about obsolete features (silent by default).
+Warnings about obsolete features.
=item C<override>
@@ -110,9 +118,21 @@ variables (silent by default).
Warnings about non-portable constructs.
+=item C<portability-recursive>
+
+Warnings about recursive variable expansions (C<$(foo$(x))>).
+These are not universally supported, but are more portable than
+the other non-portable constructs diagnosed by C<-Wportability>.
+These warnings are turned on by C<-Wportability> but can then be
+turned off separately by C<-Wno-portability-recursive>.
+
+=item C<extra-portability>
+
+Extra warnings about non-portable constructs covering obscure tools.
+
=item C<syntax>
-Warnings about weird syntax, unused variables, typos ...
+Warnings about weird syntax, unused variables, typos...
=item C<unsupported>
@@ -134,7 +154,7 @@ Informative messages.
# Do not forget to update &usage and the manual
# if you add or change a warning channel.
-register_channel 'fatal', type => 'fatal', ordered => 0;
+register_channel 'fatal', type => 'fatal', uniq_part => UP_NONE, ordered => 0;
register_channel 'error', type => 'error';
register_channel 'error-gnu', type => 'error';
register_channel 'error-gnu/warn', type => 'error';
@@ -143,20 +163,27 @@ register_channel 'automake', type => 'fatal', backtrace => 1,
header => ("####################\n" .
"## Internal Error ##\n" .
"####################\n"),
- footer => "\nPlease contact <bug-automake\@gnu.org>.",
- ordered => 0;
+ footer => "\nPlease contact <$PACKAGE_BUGREPORT>.",
+ uniq_part => UP_NONE, ordered => 0;
register_channel 'cross', type => 'warning', silent => 1;
register_channel 'gnu', type => 'warning';
-register_channel 'obsolete', type => 'warning', silent => 1;
+register_channel 'obsolete', type => 'warning';
register_channel 'override', type => 'warning', silent => 1;
register_channel 'portability', type => 'warning', silent => 1;
+register_channel 'extra-portability', type => 'warning', silent => 1;
+register_channel 'portability-recursive', type => 'warning', silent => 1;
register_channel 'syntax', type => 'warning';
register_channel 'unsupported', type => 'warning';
-register_channel 'verb', type => 'debug', silent => 1, ordered => 0;
+register_channel 'verb', type => 'debug', silent => 1, uniq_part => UP_NONE,
+ ordered => 0;
register_channel 'note', type => 'debug', silent => 0;
+setup_channel_type 'warning', header => 'warning: ';
+setup_channel_type 'error', header => 'error: ';
+setup_channel_type 'fatal', header => 'error: ';
+
=head2 FUNCTIONS
=over 4
@@ -170,17 +197,19 @@ Return the warning category descriptions.
sub usage ()
{
return "Warning categories include:
- `cross' cross compilation issues
- `gnu' GNU coding standards (default in gnu and gnits modes)
- `obsolete' obsolete features or constructions
- `override' user redefinitions of Automake rules or variables
- `portability' portability issues (default in gnu and gnits modes)
- `syntax' dubious syntactic constructs (default)
- `unsupported' unsupported or incomplete features (default)
- `all' all the warnings
- `no-CATEGORY' turn off warnings in CATEGORY
- `none' turn off all the warnings
- `error' treat warnings as errors";
+ cross cross compilation issues
+ gnu GNU coding standards (default in gnu and gnits modes)
+ obsolete obsolete features or constructions (default)
+ override user redefinitions of Automake rules or variables
+ portability portability issues (default in gnu and gnits modes)
+ portability-recursive nested Make variables (default with -Wportability)
+ extra-portability extra portability issues related to obscure tools
+ syntax dubious syntactic constructs (default)
+ unsupported unsupported or incomplete features (default)
+ all all the warnings
+ no-CATEGORY turn off warnings in CATEGORY
+ none turn off all the warnings
+ error treat warnings as errors";
}
=item C<prog_error ($MESSAGE, [%OPTIONS])>
@@ -233,6 +262,8 @@ C<--verbose> messages.
sub verb ($;%)
{
my ($msg, %opts) = @_;
+ $msg = "thread " . threads->tid . ": " . $msg
+ if $perl_threads;
msg 'verb', '', $msg, %opts;
}
@@ -274,6 +305,38 @@ sub switch_warning ($)
elsif (channel_type ($cat) eq 'warning')
{
setup_channel $cat, silent => $has_no;
+ #
+ # Handling of portability warnings is trickier. For relevant tests,
+ # see 'dollarvar2', 'extra-portability' and 'extra-portability3'.
+ #
+ # -Wportability-recursive and -Wno-portability-recursive should not
+ # have any effect on other 'portability' or 'extra-portability'
+ # warnings, so there's no need to handle them separately or ad-hoc.
+ #
+ if ($cat eq 'extra-portability' && ! $has_no) # -Wextra-portability
+ {
+ # -Wextra-portability must enable 'portability' and
+ # 'portability-recursive' warnings.
+ setup_channel 'portability', silent => 0;
+ setup_channel 'portability-recursive', silent => 0;
+ }
+ if ($cat eq 'portability') # -Wportability or -Wno-portability
+ {
+ if ($has_no) # -Wno-portability
+ {
+ # -Wno-portability must disable 'extra-portability' and
+ # 'portability-recursive' warnings.
+ setup_channel 'portability-recursive', silent => 1;
+ setup_channel 'extra-portability', silent => 1;
+ }
+ else # -Wportability
+ {
+ # -Wportability must enable 'portability-recursive'
+ # warnings. But it should have no influence over the
+ # 'extra-portability' warnings.
+ setup_channel 'portability-recursive', silent => 0;
+ }
+ }
}
else
{
@@ -288,36 +351,62 @@ Parse the WARNINGS environment variable.
=cut
+# Used to communicate from parse_WARNINGS to parse_warnings.
+our $_werror = 0;
+
sub parse_WARNINGS ()
{
if (exists $ENV{'WARNINGS'})
{
# Ignore unknown categories. This is required because WARNINGS
# should be honored by many tools.
- switch_warning $_ foreach (split (',', $ENV{'WARNINGS'}));
+ # For the same reason, do not turn on -Werror at this point, just
+ # record that we saw it; parse_warnings will turn on -Werror after
+ # the command line has been processed.
+ foreach (split (',', $ENV{'WARNINGS'}))
+ {
+ if (/^(no-)?error$/)
+ {
+ $_werror = !defined $1;
+ }
+ else
+ {
+ switch_warning $_;
+ }
+ }
}
}
-=item C<parse_warnings ($OPTION, @ARGUMENT)>
+=item C<parse_warnings (@CATEGORIES)>
Parse the argument of C<--warning=CATEGORY> or C<-WCATEGORY>.
+C<@CATEGORIES> is the accumulated set of warnings categories.
+Use like this:
-C<$OPTIONS> is C<"--warning"> or C<"-W">, C<@ARGUMENT> is a list of
-C<CATEGORY>.
-
-This can be used as an argument to C<Getopt>.
+ Autom4te::GetOpt::parse_options (
+ # ...
+ 'W|warnings=s' => \@warnings,
+ )
+ # possibly call set_strictness here
+ parse_warnings @warnings;
=cut
-sub parse_warnings ($@)
+sub parse_warnings (@)
{
- my ($opt, @categories) = @_;
-
- foreach my $cat (map { split ',' } @categories)
+ foreach my $cat (map { split ',' } @_)
{
- msg 'unsupported', "unknown warning category `$cat'"
- if switch_warning $cat;
+ if ($cat =~ /^(no-)?error$/)
+ {
+ $_werror = !defined $1;
+ }
+ elsif (switch_warning $cat)
+ {
+ msg 'unsupported', "unknown warning category '$cat'";
+ }
}
+
+ switch_warning ($_werror ? 'error' : 'no-error');
}
=item C<set_strictness ($STRICTNESS_NAME)>
@@ -336,6 +425,7 @@ sub set_strictness ($)
setup_channel 'error-gnu/warn', silent => 0, type => 'error';
setup_channel 'error-gnits', silent => 1;
setup_channel 'portability', silent => 0;
+ setup_channel 'extra-portability', silent => 1;
setup_channel 'gnu', silent => 0;
}
elsif ($name eq 'gnits')
@@ -344,6 +434,7 @@ sub set_strictness ($)
setup_channel 'error-gnu/warn', silent => 0, type => 'error';
setup_channel 'error-gnits', silent => 0;
setup_channel 'portability', silent => 0;
+ setup_channel 'extra-portability', silent => 1;
setup_channel 'gnu', silent => 0;
}
elsif ($name eq 'foreign')
@@ -352,11 +443,12 @@ sub set_strictness ($)
setup_channel 'error-gnu/warn', silent => 0, type => 'warning';
setup_channel 'error-gnits', silent => 1;
setup_channel 'portability', silent => 1;
+ setup_channel 'extra-portability', silent => 1;
setup_channel 'gnu', silent => 1;
}
else
{
- prog_error "level `$name' not recognized\n";
+ prog_error "level '$name' not recognized";
}
}
@@ -372,6 +464,8 @@ Written by Alexandre Duret-Lutz E<lt>F<adl@gnu.org>E<gt>.
=cut
+1;
+
### Setup "GNU" style for perl-mode and cperl-mode.
## Local Variables:
## perl-indent-level: 2
diff --git a/lib/Autom4te/Config.pm b/lib/Autom4te/Config.pm
new file mode 100644
index 00000000..23c5ac14
--- /dev/null
+++ b/lib/Autom4te/Config.pm
@@ -0,0 +1,43 @@
+# -*- Perl -*-
+# Copyright (C) 2003-2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+package Autom4te::Config;
+
+# This is a stub version of Automake/Config.pm.
+# It defines only the variables that are necessary in order to fetch
+# Autom4te/ChannelDefs.pm from Automake/ChannelDefs.pm
+# (see build-aux/fetch.pl).
+# We would like to fetch Automake/Config.pm as well,
+# but that file is generated when automake is built,
+# and autoconf's build machinery is not prepared to do that.
+# Revisit after 2.70.
+
+use 5.006;
+use strict;
+use warnings FATAL => 'all';
+
+use Exporter;
+
+our @ISA = qw (Exporter);
+our @EXPORT = qw ($PACKAGE_BUGREPORT $perl_threads);
+
+# this must be kept in sync with configure.ac
+our $PACKAGE_BUGREPORT = 'bug-autoconf@gnu.org';
+
+# autom4te currently has no use for threads
+our $perl_threads = 0;
+
+1;
diff --git a/lib/local.mk b/lib/local.mk
index 5cc9d44a..4e2e5b65 100644
--- a/lib/local.mk
+++ b/lib/local.mk
@@ -34,6 +34,7 @@ dist_perllib_DATA = \
lib/Autom4te/C4che.pm \
lib/Autom4te/ChannelDefs.pm \
lib/Autom4te/Channels.pm \
+ lib/Autom4te/Config.pm \
lib/Autom4te/Configure_ac.pm \
lib/Autom4te/FileUtils.pm \
lib/Autom4te/General.pm \
diff --git a/tests/base.at b/tests/base.at
index 6894990a..6a1d9742 100644
--- a/tests/base.at
+++ b/tests/base.at
@@ -81,7 +81,7 @@ AT_DATA([configure.ac],
AT_CHECK_AUTOCONF([], [1], [],
[[configure.ac:1: error: AC_REQUIRE(AC_PROG_CC): cannot be used outside of an AC_DEFUN'd macro
configure.ac:1: the top level
-autom4te: m4 failed with exit status: 1
+autom4te: error: m4 failed with exit status: 1
]])
AT_CLEANUP
diff --git a/tests/c.at b/tests/c.at
index d13b321e..1ae678d1 100644
--- a/tests/c.at
+++ b/tests/c.at
@@ -262,7 +262,7 @@ AT_SETUP([AC_USE_SYSTEM_EXTENSIONS])
_AT_CHECK_AC_MACRO(
[[AC_AIX
AC_DEFINE([__EXTENSIONS__], [1], [Manually defined for Solaris])
-]])
+]], [], [-Wno-obsolete])
_AT_CHECK_AC_MACRO(
[[AC_USE_SYSTEM_EXTENSIONS
diff --git a/tests/compile.at b/tests/compile.at
index fbba8e63..c93722b9 100644
--- a/tests/compile.at
+++ b/tests/compile.at
@@ -344,7 +344,12 @@ test $estatus != 3 &&
AC_OUTPUT
]])
-AT_CHECK_AUTOCONF
+AT_CHECK_AUTOCONF([], 0, [],
+[[configure.ac:14: warning: The macro `AC_TRY_RUN' is obsolete.
+configure.ac:14: You should run autoupdate.
+general.m4: AC_TRY_RUN is expanded from...
+configure.ac:14: the top level
+]])
AT_CHECK_CONFIGURE([-q])
AT_CLEANUP
diff --git a/tests/local.at b/tests/local.at
index a875b5e0..3424bd6a 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -137,6 +137,7 @@ m4_case([$4], [], [], [ignore], [],
s/: C\(annot open \)\([^`:]*\):/: c\1`\2'\'':/
s/: include:\( cannot open\)/:\1/
s/^autom4te: [^ ]*m4[.ex]* /autom4te: m4 /
+ s/^autom4te: error: [^ ]*m4[.ex]* /autom4te: error: m4 /
s!^.*/\([^/][^/]*\)\.m4: *[0-9][0-9]*: *!\1.m4: !
s!^.*/\([^/][^/]*\)\.m4: *[0-9][0-9]*: *[0-9][0-9]*: *!\1.m4: !
s/ (E[A-Z]*)$//
@@ -508,39 +509,37 @@ dnl pacify editors that don't understand sh case: ((
])
-# _AT_CHECK_AC_MACRO(AC-BODY, PRE-TESTS)
+# _AT_CHECK_AC_MACRO(AC-BODY, PRE-TESTS, [AUTOCONF-FLAGS])
# --------------------------------------
# Create a minimalist configure.ac running the macro named
# NAME-OF-THE-MACRO, check that autoconf runs on that script,
-# and that the shell runs correctly the configure.
+# and that the generated configure script runs without error.
m4_define([_AT_CHECK_AC_MACRO],
[AT_CONFIGURE_AC([$1])
$2
-AT_CHECK_AUTOCONF
-AT_CHECK_AUTOHEADER([], [ignore])
+AT_CHECK_AUTOCONF([$3])
+AT_CHECK_AUTOHEADER([$3], [ignore])
AT_CHECK_CONFIGURE
AT_CHECK_ENV
])# _AT_CHECK_AC_MACRO
# AT_CHECK_MACRO(MACRO, [MACRO-USE], [ADDITIONAL-CMDS],
-# [AUTOCONF-FLAGS = -W obsolete])
+# [AUTOCONF-FLAGS])
# -----------------------------------------------------
# Create a minimalist configure.ac running the macro named
# NAME-OF-THE-MACRO, check that autoconf runs on that script,
-# and that the shell runs correctly the configure.
+# and that the generated configure script runs without error.
#
# We run `configure' twice, both times with a cache, and compare
# the environment after each run to detect inconsistencies.
-#
-# New macros are not expected to depend upon obsolete macros.
m4_define([AT_CHECK_MACRO],
[AT_SETUP([$1])
AT_CONFIGURE_AC([m4_default([$2], [$1])])
-AT_CHECK_AUTOCONF([m4_default([$4], [-W obsolete])])
-AT_CHECK_AUTOHEADER([], [ignore])
+AT_CHECK_AUTOCONF([$4])
+AT_CHECK_AUTOHEADER([$4], [ignore])
for at_run in r1 r2
do
@@ -562,7 +561,7 @@ AT_CLEANUP[]dnl
# AT_CHECK_MACRO_CROSS(MACRO, [MACRO-USE], [ADDITIONAL-CMDS],
-# [AUTOCONF-FLAGS = -W obsolete])
+# [AUTOCONF-FLAGS])
# -----------------------------------------------------------
# Like the previous one, but creates two checks: for native
# compile and for cross-compile.
@@ -581,22 +580,29 @@ AT_CHECK_MACRO([$1 (cross compile)],
# AT_CHECK_AU_MACRO(MACRO)
# ------------------------
# Create a minimalist configure.ac running the macro named
-# NAME-OF-THE-MACRO, autoupdate this script, check that autoconf runs
-# on that script, and that the shell runs correctly the configure.
-#
-# Updated configure.ac shall not depend upon obsolete macros, which votes
-# in favor of `-W obsolete', but since many of these macros leave a message
-# to be removed by the user once her code is adjusted, let's not check.
-#
-# Remove config.hin to avoid `autoheader: config.hin is unchanged'.
+# NAME-OF-THE-MACRO, check that autoconf runs on that script,
+# and that the generated configure script runs without error.
+#
+# Then run autoupdate on that script, and check that NAME-OF-THE-MACRO
+# no longer appears in configure.ac, autoconf runs on the updated
+# script, the configure script still runs without error, and the
+# result is unchanged.
+#
+# On the first pass, check for a -Wobsolete warning naming
+# NAME-OF-THE-MACRO. On the second pass, *don't* check for the
+# absence of -Wobsolete warnings, because many of autoupdate's edits
+# leave the configure.ac author with some manual work to do, and
+# indicate this by inserting an AC_DIAGNOSE message to be removed
+# after the manual work is complete.
m4_define([AT_CHECK_AU_MACRO],
[AT_SETUP([$1])
AT_KEYWORDS([autoupdate])
AT_CONFIGURE_AC([$1])
-AT_CHECK_AUTOCONF
-AT_CHECK_AUTOHEADER([], [ignore])
+AT_CHECK_AUTOCONF([], 0, [], [stderr])
+AT_CHECK([grep 'macro .$1. is obsolete' stderr], 0, [ignore], [ignore])
+AT_CHECK_AUTOHEADER([-Wno-obsolete], [ignore])
AT_CHECK_CONFIGURE
AT_CHECK_ENV
@@ -604,8 +610,8 @@ rm config.hin
AT_CHECK_AUTOUPDATE([], 0, [], ignore)
AT_CHECK([grep '^$1$' configure.ac], 1)
-AT_CHECK_AUTOCONF
-AT_CHECK_AUTOHEADER([], [ignore])
+AT_CHECK_AUTOCONF([-Wno-obsolete])
+AT_CHECK_AUTOHEADER([-Wno-obsolete], [ignore])
AT_CHECK_CONFIGURE
AT_CHECK_ENV
diff --git a/tests/m4sh.at b/tests/m4sh.at
index b352704d..30e3fa58 100644
--- a/tests/m4sh.at
+++ b/tests/m4sh.at
@@ -599,7 +599,7 @@ ECHO_TEST([
AS_EXIT(0)
]])
-AT_CHECK_M4SH([-Wobsolete], 0, [],
+AT_CHECK_M4SH([], 0, [],
[[script.as:13: warning: $as@&t@_echo is obsolete; use AS@&t@_ECHO(["message"]) instead
script.as:13: warning: $as@&t@_echo_n is obsolete; use AS@&t@_ECHO_N(["message"]) instead
script.as:14: warning: $as@&t@_echo is obsolete; use AS@&t@_ECHO(["message"]) instead
diff --git a/tests/m4sugar.at b/tests/m4sugar.at
index 3b861d55..aff83cfa 100644
--- a/tests/m4sugar.at
+++ b/tests/m4sugar.at
@@ -259,6 +259,7 @@ m4_warn([syntax], [syntax])dnl
AT_CHECK_M4SUGAR([-o-], 0, [],
[script.4s:4: warning: prefer named diversions
+script.4s:5: warning: obsolete
script.4s:7: warning: syntax
script.4s:9: warning: syntax
])
@@ -354,7 +355,7 @@ AT_DATA_M4SUGAR([script.4s],
AT_CHECK_M4SUGAR([-o-], [1], [],
[[script.4s:1: error: too many m4@&t@_divert_pop
script.4s:1: the top level
-autom4te: m4 failed with exit status: 1
+autom4te: error: m4 failed with exit status: 1
]])
AT_DATA_M4SUGAR([script.4s],
@@ -367,7 +368,7 @@ AT_CHECK_M4SUGAR([-o-], [1], [],
script.4s:2: m4@&t@_divert_push: 1
script.4s:1: m4@&t@_divert: KILL
script.4s:3: the top level
-autom4te: m4 failed with exit status: 1
+autom4te: error: m4 failed with exit status: 1
]])
AT_DATA_M4SUGAR([script.4s],
@@ -380,7 +381,7 @@ AT_CHECK_M4SUGAR([-o-], [1], [],
script.4s:3: m4@&t@_divert_push: 2
script.4s:2: m4@&t@_divert: KILL
script.4s:2: the top level
-autom4te: m4 failed with exit status: 1
+autom4te: error: m4 failed with exit status: 1
]])
AT_CLEANUP
@@ -425,7 +426,7 @@ m4_require([foo])
AT_CHECK_M4SUGAR([], 1, [],
[[script.4s:2: error: m4@&t@_require(foo): cannot be used outside of an m4_defun'd macro
script.4s:2: the top level
-autom4te: m4 failed with exit status: 1
+autom4te: error: m4 failed with exit status: 1
]])
AT_CLEANUP
@@ -506,7 +507,7 @@ script.4s:3: bar is expanded from...
script.4s:1: foo is expanded from...
script.4s:5: baz is expanded from...
script.4s:9: the top level
-autom4te: m4 failed with exit status: 1
+autom4te: error: m4 failed with exit status: 1
]])
AT_CLEANUP
@@ -923,7 +924,7 @@ m4_argn([0], [a], [b], [c])
AT_CHECK_M4SUGAR([-o-], [1], [],
[[script.4s:2: error: assert failed: 0 < 0
script.4s:2: the top level
-autom4te: m4 failed with exit status: 1
+autom4te: error: m4 failed with exit status: 1
]])
AT_CLEANUP
@@ -1605,7 +1606,7 @@ m4_for([myvar], 1, 3,-1, [ myvar])
AT_CHECK_M4SUGAR([], 1, [],
[[script.4s:3: error: assert failed: -1 > 0
script.4s:3: the top level
-autom4te: m4 failed with exit status: 1
+autom4te: error: m4 failed with exit status: 1
]])
AT_DATA_M4SUGAR([script.4s],
@@ -1616,7 +1617,7 @@ m4_for([myvar], 1, 2, 0, [ myvar])
AT_CHECK_M4SUGAR([], 1, [],
[[script.4s:3: error: assert failed: 0 > 0
script.4s:3: the top level
-autom4te: m4 failed with exit status: 1
+autom4te: error: m4 failed with exit status: 1
]])
AT_DATA_M4SUGAR([script.4s],
@@ -1627,7 +1628,7 @@ m4_for([myvar], 2, 1, 0, [ myvar])
AT_CHECK_M4SUGAR([], 1, [],
[[script.4s:3: error: assert failed: 0 < 0
script.4s:3: the top level
-autom4te: m4 failed with exit status: 1
+autom4te: error: m4 failed with exit status: 1
]])
dnl m4_shiftn also does bounds checking
@@ -1639,7 +1640,7 @@ m4_shiftn(3,1,2)
AT_CHECK_M4SUGAR([], 1, [],
[[script.4s:3: error: assert failed: 0 < 3 && 3 < 3
script.4s:3: the top level
-autom4te: m4 failed with exit status: 1
+autom4te: error: m4 failed with exit status: 1
]])
AT_CLEANUP
@@ -1832,7 +1833,7 @@ AT_DATA_M4SUGAR([script.4s],
AT_CHECK_M4SUGAR([], 1, [],
[[script.4s:1: error: too few arguments to m4@&t@_max
script.4s:1: the top level
-autom4te: m4 failed with exit status: 1
+autom4te: error: m4 failed with exit status: 1
]])
AT_DATA_M4SUGAR([script.4s],
@@ -1842,7 +1843,7 @@ AT_DATA_M4SUGAR([script.4s],
AT_CHECK_M4SUGAR([], 1, [],
[[script.4s:1: error: too few arguments to m4@&t@_min
script.4s:1: the top level
-autom4te: m4 failed with exit status: 1
+autom4te: error: m4 failed with exit status: 1
]])
AT_CHECK_M4SUGAR_TEXT([[dnl
diff --git a/tests/semantics.at b/tests/semantics.at
index 32811f6d..e7dd7c5a 100644
--- a/tests/semantics.at
+++ b/tests/semantics.at
@@ -251,7 +251,7 @@ AT_DATA([autoconf_io.h],
])
AT_CONFIGURE_AC([AC_CHECK_HEADERS(stdio.h autoconf_io.h)])
-AT_CHECK_AUTOCONF([-W obsolete])
+AT_CHECK_AUTOCONF
AT_CHECK_AUTOHEADER([], [
HAVE_AUTOCONF_IO_H
HAVE_INTTYPES_H
@@ -291,7 +291,7 @@ AT_DATA([header2.h],
AT_CONFIGURE_AC([[AC_CHECK_HEADERS([header2.h], [], [], [-])]])
-AT_CHECK_AUTOCONF([-W obsolete], [], [],
+AT_CHECK_AUTOCONF([], 0, [],
[[configure.ac:4: warning: Checking for headers with the preprocessor is
configure.ac:4: deprecated. Specify prerequisite code to AC_CHECK_HEADER
configure.ac:4: instead of using fourth argument `-'. (Many headers need
@@ -303,7 +303,7 @@ headers.m4: AC_CHECK_HEADER is expanded from...
headers.m4: AC_CHECK_HEADERS is expanded from...
configure.ac:4: the top level
]])
-AT_CHECK_AUTOHEADER([], [HAVE_HEADER2_H])
+AT_CHECK_AUTOHEADER([-W no-obsolete], [HAVE_HEADER2_H])
AT_CHECK_CONFIGURE([CPPFLAGS=-I.])
AT_CHECK_ENV
AT_CHECK_DEFINES(
@@ -334,7 +334,7 @@ AT_DATA([header3.h],
AT_CONFIGURE_AC(
[AC_CHECK_HEADERS(header2.h header3.h, [], [], [[@%:@include "header1.h"]])])
-AT_CHECK_AUTOCONF([-W obsolete])
+AT_CHECK_AUTOCONF
AT_CHECK_AUTOHEADER([], [
HAVE_HEADER2_H
HAVE_HEADER3_H
@@ -829,14 +829,14 @@ $1([dn@&t@l
fn_blurf dn@&t@l Apos'trophed comment
])
]])
-AT_CHECK_AUTOCONF([-W obsolete], [0], [],
+AT_CHECK_AUTOCONF([], [0], [],
[configure.ac:6: warning: whitespace-separated list contains macros;
configure.ac:6: in a future version of Autoconf they will not be expanded
configure.ac:6: note: `dn@&t@l' is a macro
functions.m4: $1 is expanded from...
configure.ac:6: the top level
])
-AT_CHECK_AUTOHEADER([], [
+AT_CHECK_AUTOHEADER([-W no-obsolete], [
HAVE_FN_BLURF
HAVE_FN_FOO
HAVE_FN_NOCOMMENT
@@ -858,7 +858,7 @@ $1([dn@&t@l
fn_blurf dn@&t@l Apos'trophed comment
])
]])
-AT_CHECK_AUTOCONF([-W obsolete], [0], [],
+AT_CHECK_AUTOCONF([], [0], [],
[configure.ac:8: warning: whitespace-separated list contains macros;
configure.ac:8: in a future version of Autoconf they will not be expanded
configure.ac:8: note: `dn@&t@l' is a macro
@@ -868,7 +868,7 @@ configure.ac:8: warning: $1($fns): you should use literals
functions.m4: $1 is expanded from...
configure.ac:8: the top level
])
-AT_CHECK_AUTOHEADER([], [
+AT_CHECK_AUTOHEADER([-W no-obsolete], [
HAVE_FN_BLURF
HAVE_FN_FOO
HAVE_FN_NOCOMMENT
@@ -894,14 +894,14 @@ $1([dn@&t@l
blurf.h dn@&t@l Apos'trophed comment
])
]])
-AT_CHECK_AUTOCONF([-W obsolete], [0], [],
+AT_CHECK_AUTOCONF([], [0], [],
[configure.ac:6: warning: whitespace-separated list contains macros;
configure.ac:6: in a future version of Autoconf they will not be expanded
configure.ac:6: note: `dn@&t@l' is a macro
headers.m4: $1 is expanded from...
configure.ac:6: the top level
])
-AT_CHECK_AUTOHEADER([], [
+AT_CHECK_AUTOHEADER([-W no-obsolete], [
HAVE_BLURF_H
HAVE_FOO_H
HAVE_INTTYPES_H
@@ -932,7 +932,7 @@ $1([dn@&t@l
blurf.h dn@&t@l Apos'trophed comment
])
]])
-AT_CHECK_AUTOCONF([-W obsolete], [0], [],
+AT_CHECK_AUTOCONF([], [0], [],
[configure.ac:8: warning: whitespace-separated list contains macros;
configure.ac:8: in a future version of Autoconf they will not be expanded
configure.ac:8: note: `dn@&t@l' is a macro
@@ -942,7 +942,7 @@ configure.ac:8: warning: $1($hs): you should use literals
headers.m4: $1 is expanded from...
configure.ac:8: the top level
])
-AT_CHECK_AUTOHEADER([], [
+AT_CHECK_AUTOHEADER([-W no-obsolete], [
HAVE_BLURF_H
HAVE_FOO_H
HAVE_INTTYPES_H
@@ -982,14 +982,14 @@ AC_CHECK_FILES([dn@&t@l
/nonex/f_blurf dn@&t@l Apos'trophed comment
])
]])
-AT_CHECK_AUTOCONF([-W obsolete], [0], [],
+AT_CHECK_AUTOCONF([], [0], [],
[configure.ac:6: warning: whitespace-separated list contains macros;
configure.ac:6: in a future version of Autoconf they will not be expanded
configure.ac:6: note: `dn@&t@l' is a macro
general.m4: AC_CHECK_FILES is expanded from...
configure.ac:6: the top level
])
-AT_CHECK_AUTOHEADER([], [
+AT_CHECK_AUTOHEADER([-W no-obsolete], [
HAVE__NONEX_F_BLURF
HAVE__NONEX_F_FOO
HAVE__NONEX_F_QUUX
@@ -1008,7 +1008,7 @@ AC_CONFIG_MACRO_DIRS([dn@&t@l
d_blurf dn@&t@l Apos'trophed comment
])
]])
-AT_CHECK_AUTOCONF([-W obsolete -t AC_CONFIG_MACRO_DIR_TRACE], [0],
+AT_CHECK_AUTOCONF([-t AC_CONFIG_MACRO_DIR_TRACE], [0],
[configure.ac:6:AC_CONFIG_MACRO_DIR_TRACE:d_foo
configure.ac:6:AC_CONFIG_MACRO_DIR_TRACE:d_quux
configure.ac:6:AC_CONFIG_MACRO_DIR_TRACE:d_blurf
@@ -1040,14 +1040,14 @@ AC_CONFIG_SUBDIRS([dn@&t@l
d_blurf dn@&t@l Apos'trophed comment
])
]])
-AT_CHECK_AUTOCONF([-W obsolete], [0], [],
+AT_CHECK_AUTOCONF([], [0], [],
[configure.ac:6: warning: whitespace-separated list contains macros;
configure.ac:6: in a future version of Autoconf they will not be expanded
configure.ac:6: note: `dn@&t@l' is a macro
status.m4: AC_CONFIG_SUBDIRS is expanded from...
configure.ac:6: the top level
])
-AT_CHECK_AUTOHEADER
+AT_CHECK_AUTOHEADER([-W no-obsolete])
AT_CHECK_CONFIGURE([], [0], [stdout])
AT_CHECK([grep '^entered' stdout], [0],
[[entered d_foo/configure
diff --git a/tests/tools.at b/tests/tools.at
index 3093225c..1bb670fa 100644
--- a/tests/tools.at
+++ b/tests/tools.at
@@ -100,7 +100,7 @@ mkdir sub
mv foo sub
AT_CHECK_M4SUGAR([], [1], [],
[m4:script.4s:1: cannot open `foo': No such file or directory
-autom4te: m4 failed with exit status: 1
+autom4te: error: m4 failed with exit status: 1
])
# But if we change the main file, then we should no longer complain of
@@ -414,7 +414,7 @@ AC_CONFIG_MACRO_DIR_TRACE([dir1])
AT_CHECK_AUTOCONF([], [1], [],
[[configure.ac:2: error: Do not invoke AC_CONFIG_MACRO_DIR_TRACE directly
configure.ac:2: the top level
-autom4te: m4 failed with exit status: 1
+autom4te: error: m4 failed with exit status: 1
]])
# Legacy macro use is not required, but still gets traced
@@ -952,7 +952,17 @@ AT_DATA([dst2], dst2
# Checking `autoupdate'.
AT_CHECK_AUTOUPDATE([], 0, [], ignore)
-AT_CHECK_AUTOCONF
+
+# The replacement for AC_LINK_FILES includes a forced -Wobsolete
+# warning, becuause it needs to be manually adjusted afterward.
+# Look for it in the autoconf output.
+AT_CHECK_AUTOCONF([], 0, [], stderr)
+AT_CHECK([grep 'AC_LINK_FILES' stderr], 0, ignore, ignore)
+AT_CHECK([grep 'AC_CONFIG_LINKS' stderr], 0, ignore, ignore)
+AT_CHECK([grep 'warning: It is technically impossible' stderr],
+ 0, ignore, ignore)
+AT_CHECK([grep 'tune the result yourself' stderr], 0, ignore, ignore)
+
AT_CHECK_CONFIGURE
AT_CHECK([cat src1], 0, [dst1
])
@@ -994,12 +1004,37 @@ AU_ALIAS([BAZ],[FOO])
test "FOO:FOO():FOO(x) BAZ:BAZ():BAZ(x)" = "0:1:1 0:1:1" || exit 1
AC_PROG_CC
AC_WORDS_BIGENDIAN
+AC_CONFIG_HEADERS([config.h])
AC_OUTPUT
]])
# Checking `autoupdate'.
AT_CHECK_AUTOUPDATE
-AT_CHECK_AUTOCONF
+
+# autoupdate does not replace AU_DEFUNs/AU_ALIASes defined by
+# configure.ac itself, nor by aclocal.m4, so BAZ will still be present
+# in the updated configure.ac. This is actually desirable for this
+# test: the point of that part of the above configure.ac is to to
+# verify that the expansion of an AU_ALIAS definition handles $#
+# correctly. If BAZ got turned into FOO by the above call to
+# autoupdate, we would need to run autoconf and configure twice in
+# this test. However, it does also mean that by default we get a
+# -Wobsolete warning because of BAZ, so turn that off so it doesn't
+# cause a spurious failure.
+AT_CHECK_AUTOCONF([-Wno-obsolete])
+AT_CHECK_AUTOHEADER([-Wno-obsolete], [
+ AC_APPLE_UNIVERSAL_BUILD
+ HAVE_INTTYPES_H
+ HAVE_STDINT_H
+ HAVE_STDLIB_H
+ HAVE_STRINGS_H
+ HAVE_STRING_H
+ HAVE_SYS_STAT_H
+ HAVE_SYS_TYPES_H
+ HAVE_UNISTD_H
+ STDC_HEADERS
+ WORDS_BIGENDIAN
+])
AT_CHECK_CONFIGURE
AT_CHECK([grep 'AC_C_BIGENDIAN[(]' configure.ac], 1, [ignore], [ignore])
AT_CHECK([grep 'AC_C_BIGENDIAN' configure.ac], 0, [ignore], [ignore])
@@ -1208,9 +1243,16 @@ AC_OUTPUT
]])
# Checking `autoupdate'.
+
+# Both the autoupdate and autoconf invocations will complain about
+# AC_LANG_SAVE being obsolete, because autoupdate cannot replace
+# two-macro sequences (e.g. AC_LANG_SAVE \n AC_LANG([C]) ideally would
+# become AC_LANG_PUSH([C]) but we can't do that) so an AC_DIAGNOSE
+# is left in place to remind people they need to do some hand edits.
+# Ignore these diagnostics.
AT_CHECK_AUTOUPDATE([], [], [], [ignore])
-AT_CHECK_AUTOCONF
-AT_CHECK_CONFIGURE([], [], [], [ignore])
+AT_CHECK_AUTOCONF([], [], [], [ignore])
+AT_CHECK_CONFIGURE
AT_CLEANUP
diff --git a/tests/torture.at b/tests/torture.at
index 53859f6b..5c61027c 100644
--- a/tests/torture.at
+++ b/tests/torture.at
@@ -149,7 +149,10 @@ AT_DATA([file.in],
[[`@precious@'
]])
-AT_CHECK_AUTOCONF
+AT_CHECK_AUTOCONF([], 0, [],
+[[configure.ac:4: warning: AC_OUTPUT should be used without arguments.
+configure.ac:4: You should run autoupdate.
+]])
# Set a precious variable
AT_CHECK_AC_ARG_VAR([], [apple of my eye])