autoconf/lib/Autom4te/Config.pm
Zack Weinberg 1d4b7c049e
Manually sync ChannelDefs.pm from automake.
ChannelDefs.pm *ought* to be kept in sync between automake and autoconf,
because it defines the set of valid -W options, and autoreconf assumes
that it can pass arbitrary -W options to all of the tools it invokes.
However, it isn’t covered by either project’s ‘make fetch’ and it hasn’t
actually *been* in sync for more than 17 years.

This patch manually brings over all of the changes made on the
automake side.  Once the complementary patch is applied by the
automake team, both versions of the file will be the same, and then we
can add it to the list in fetch.pl and not have this problem any more
in the future.

There are some user-visible consequences to bringing this file back
into sync.  The only one worth mentioning in NEWS is that the ‘obsolete’
category of warnings is now on by default.  This had quite a bit of
fallout throughout the testsuite.  There are also some new warning
categories that get mentioned in --help output, but we don’t actually
generate any warnings in those categories, so people using ‘-Wall’
won’t see any change.  More diagnostics are automatically tagged with
‘warning:’ or ‘error:’, which also had some fallout in the testsuite.
Finally, ‘-Werror’ no longer causes complaints about unknown warning
categories to be treated as hard errors.

Internally, there are some small API changes: ‘parse_warnings’ is no
longer usable as a ‘getopt’ callback function, and we now have a stub
Autom4te/Config.pm to match the automake code’s expectations.  (This
file *should* also be synced from automake by ‘make fetch’, but we
can’t quite do that yet because it’s a generated file and our build
system is not prepared to handle adding *two* directories to @INC when
running a not-yet-installed Perl script.  I plan to fix that after 2.70.)

As a side-effect of adding a Config.pm, ‘prog_error’ now says to
report the bug to bug-autoconf, not bug-automake.  If this is why we
mostly haven’t been using prog_error for internal errors, we can stop
avoiding it.  (I did not change anything to use prog_error in this
patch.)

* lib/Autom4te/ChannelDefs.pm: Merge from automake.
* lib/Autom4te/Config.pm: New file.
* lib/local.mk (dist_perllib_DATA): Add Autom4te/Config.pm.

* bin/autoconf.as: Update list of warning categories to match
  Autom4te::ChannelDefs::usage.
* bin/autoheader.in (@warnings): New global.
  (parse_args): Don’t use parse_warnings as a getopt callback.
  (main): Add warnings options from our command line to $autoconf.
  No need to turn on 'obsolete' warnings explicitly.
  No need to include "warning: " in warning messages.
* bin/autom4te.in (parse_args): Don’t use parse_warnings as a getopt callback.
  (main): No need to include "warning: " in warning messages.
* bin/autoreconf.in (parse_args): parse_warnings now takes only one argument.
* bin/autoupdate.in: Set WARNINGS=none in environment for all child processes.

* tests/local.at
  (AT_CHECK_M4): Handle `autom4te: error: /usr/bin/m4 ...` like
  `autom4te: /usr/bin/m4 ...`.
  (_AT_CHECK_AC_MACRO): Add AUTOCONF-FLAGS argument, passed to both
  autoconf and autoheader.
  (AT_CHECK_MACRO): Default AUTOCONF-FLAGS argument to empty.
  Pass that argument to autoheader as well as autoconf.
  (AT_CHECK_AU_MACRO): Expect a “macro ‘NAME’ is obsolete’ diagnostic
  on the first run of autoconf.  Pass -Wno-obsolete to autoconf on the
  second run, and to autoheader on both runs.

* tests/base.at
* tests/c.at
* tests/compile.at
* tests/m4sh.at
* tests/m4sugar.at
* tests/semantics.at
* tests/tools.at
* tests/torture.at:
  No need to pass -Wobsolete to autoconf.
  Pass -Wno-obsolete to autoheader where needed to avoid handling
  the same warning twice.
  Update various expectations for diagnostics to match behavior
  changes.

* tests/tools.at (autoupdating AU_ALIAS): Add an AC_CONFIG_HEADERS
  line to the test configure.ac to eliminate an unrelated diagnostic.
2020-09-22 15:46:42 -04:00

44 lines
1.4 KiB
Perl

# -*- 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;