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.
-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.
my $config_h_in;
my @prepend_include;
my @include;
-
+my @warnings;
# $HELP
# -----
{
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)
{
## -------------- ##
mktmpdir ('ah');
-switch_warning 'obsolete';
parse_args;
# Preach.
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;
{
if (! -r $template)
{
- msg 'syntax', "warning: cannot read $template: $!";
+ msg 'syntax', "cannot read $template: $!";
}
else
{
foreach (sort keys %symbol)
{
- msg 'syntax', "warning: missing template: $_";
+ msg 'syntax', "missing template: $_";
if ($suggest_ac_define)
{
msg 'syntax', "Use AC_DEFINE([$_], [], [Description])";
# 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,
"no-cache" => sub { $cache = undef; },
);
+ parse_WARNINGS;
+ parse_warnings @warnings;
+
fatal "too few arguments
Try '$me --help' for more information."
unless @ARGV;
# 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)
{
# 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
$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;
-# 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
package Autom4te::ChannelDefs;
-use Autom4te::Channels;
-
=head1 NAME
Autom4te::ChannelDefs - channel definitions for Automake and helper functions
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);
=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>
=item C<obsolete>
-Warnings about obsolete features (silent by default).
+Warnings about obsolete features.
=item C<override>
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>
# 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';
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
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])>
sub verb ($;%)
{
my ($msg, %opts) = @_;
+ $msg = "thread " . threads->tid . ": " . $msg
+ if $perl_threads;
msg 'verb', '', $msg, %opts;
}
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
{
=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)>
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')
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')
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";
}
}
=cut
+1;
+
### Setup "GNU" style for perl-mode and cperl-mode.
## Local Variables:
## perl-indent-level: 2
--- /dev/null
+# -*- 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;
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 \
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
_AT_CHECK_AC_MACRO(
[[AC_AIX
AC_DEFINE([__EXTENSIONS__], [1], [Manually defined for Solaris])
-]])
+]], [], [-Wno-obsolete])
_AT_CHECK_AC_MACRO(
[[AC_USE_SYSTEM_EXTENSIONS
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
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]*)$//
])
-# _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
# 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.
# 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
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
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
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
])
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],
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],
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
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
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
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
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],
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],
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
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
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],
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
])
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
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
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(
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
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
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
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
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
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
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
/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
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
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
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
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
# 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
])
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])
]])
# 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
[[`@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])