* tests/base.at, tests/compile.at, tests/foreign.at,
* tests/m4sh.at, tests/m4sugar.at, tests/mktests.sh,
* tests/semantics.at, tests/suite.at, tests/tools.at,
* tests/torture.at: Ask Autotest mode, not Autoconf mode.
2001-08-20 22:44:38 +08:00
|
|
|
# -*- Autotest -*-
|
2000-12-19 16:14:19 +08:00
|
|
|
|
Revert "AC_PROG_CC: define via AC_DEFUN_ONCE". (#110350)
Revert commit 18c140b50b0619454d4da50d58a318cc257d580a, restoring
AC_PROG_CC to being defined as an ordinary AC_DEFUN. This broke
third-party macros (e.g. the Autoconf Macro Archive’s
AX_PROG_CC_FOR_BUILD) that intentionally invoked AC_PROG_CC a second
time with its guts redefined via a whole bunch of ‘pushdef’s. I don’t
think we want to support this long-term, but needing access to a
build-native compiler in cross-compilation is common enough that we
should have *some* supported way to do it, and it may as well be
AX_PROG_CC_FOR_BUILD until we come up with something better.
If we go back to AC_DEFUN_ONCE for AC_PROG_CC in the future, we should
do it consistently for all the “find me a compiler” macros -- it
was *only* done for AC_PROG_CC in 18c140b5.
The rationale for AC_DEFUN_ONCE seems to have been to reduce the size
of the generated configure script. The bulk of the size accountable to
AC_PROG_CC is the test programs for figuring out which version of the
C standard is available, so I tweaked _AC_C_STD_TRY (and _AC_CXX_STD_TRY)
to emit that text only once per program, into shell variables which
can then be referenced repeatedly.
Fixes bug #110350.
* NEWS, doc/autoconf.texi: Revert documentation changes associated
with AC_PROG_CC being a one-shot macro.
* lib/autoconf/c.m4 (AC_PROG_CC): Revert to defining with AC_DEFUN.
(_AC_C_STD_TRY, _AC_CXX_STD_TRY): Emit the test program only once,
even if invoked multiple times with the same arguments.
* tests/foreign.at (AX_PROG_CC_FOR_BUILD, AX_PROG_CXX_FOR_BUILD):
New tests.
2020-12-05 05:32:35 +08:00
|
|
|
AT_BANNER([Compatibility with external tools and macros.])
|
2000-12-19 16:14:19 +08:00
|
|
|
|
2024-01-06 01:11:48 +08:00
|
|
|
# Copyright (C) 2000-2007, 2009-2017, 2020-2024 Free Software
|
2021-01-29 04:19:21 +08:00
|
|
|
# Foundation, Inc.
|
* AUTHORS, BUGS, ChangeLog, ChangeLog.0, ChangeLog.1,
ChangeLog.2, GNUmakefile, Makefile.maint, NEWS, README,
README-alpha, TODO, configure.ac, lib/autoconf/Makefile.am,
m4/atconfig.m4, m4/init.m4, m4/m4.m4, m4/missing.m4,
m4/sanity.m4, tests/README, tests/aclocal.m4,
tests/atspecific.m4, tests/base.at, tests/compile.at,
tests/foreign.at, tests/m4sh.at, tests/m4sugar.at,
tests/semantics.at, tests/suite.at, tests/tools.at,
tests/torture.at: Add copyright notice.
* tests/mktests.sh: Update year in copyright notice.
2001-08-12 21:05:11 +08:00
|
|
|
#
|
2007-07-21 07:11:49 +08:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
* AUTHORS, BUGS, ChangeLog, ChangeLog.0, ChangeLog.1,
ChangeLog.2, GNUmakefile, Makefile.maint, NEWS, README,
README-alpha, TODO, configure.ac, lib/autoconf/Makefile.am,
m4/atconfig.m4, m4/init.m4, m4/m4.m4, m4/missing.m4,
m4/sanity.m4, tests/README, tests/aclocal.m4,
tests/atspecific.m4, tests/base.at, tests/compile.at,
tests/foreign.at, tests/m4sh.at, tests/m4sugar.at,
tests/semantics.at, tests/suite.at, tests/tools.at,
tests/torture.at: Add copyright notice.
* tests/mktests.sh: Update year in copyright notice.
2001-08-12 21:05:11 +08:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
Update License to GPLv3+ including new Autoconf Exception.
* NEWS, README: Update licensing information.
* COPYING.EXCEPTION: New file.
* Makefile.am (EXTRA_DIST): Distribute it.
* cfg.mk (autom4te-update): Remove copyright change warning.
* lib/autoconf/autoconf.m4, lib/autoconf/autoheader.m4,
lib/autoconf/autoscan.m4, lib/autoconf/autotest.m4,
lib/autoconf/autoupdate.m4, lib/autoconf/c.m4,
lib/autoconf/erlang.m4, lib/autoconf/fortran.m4,
lib/autoconf/functions.m4, lib/autoconf/general.m4,
lib/autoconf/headers.m4, lib/autoconf/lang.m4,
lib/autoconf/libs.m4, lib/autoconf/oldnames.m4,
lib/autoconf/programs.m4, lib/autoconf/specific.m4,
lib/autoconf/status.m4, lib/autoconf/types.m4,
lib/autotest/autotest.m4, lib/autotest/general.m4,
lib/autotest/specific.m4, lib/m4sugar/foreach.m4,
lib/m4sugar/m4sh.m4, lib/m4sugar/m4sugar.m4: Update exception
statement, bump to GPLv3.
* bin/autoconf.as, bin/autoheader.in, bin/autom4te.in,
bin/autoreconf.in, bin/autoscan.in, bin/autoupdate.in,
bin/ifnames.in: Bump to GPLv3+, adjust --version output
to reflect the GPLv3+ and the Autoconf Exception.
* lib/Autom4te/C4che.pm, lib/Autom4te/ChannelDefs.pm,
lib/Autom4te/General.pm, lib/Autom4te/Request.pm,
lib/autom4te.in, lib/autoscan/autoscan.pre,
lib/emacs/autoconf-mode.el, lib/emacs/autotest-mode.el,
lib/freeze.mk, tests/atlocal.in, tests/autoscan.at,
tests/autotest.at, tests/base.at, tests/c.at,
tests/compile.at, tests/erlang.at, tests/foreign.at,
tests/fortran.at, tests/local.at, tests/m4sh.at,
tests/m4sugar.at, tests/mktests.sh, tests/semantics.at,
tests/statesave.m4, tests/suite.at, tests/tools.at,
tests/torture.at, tests/wrapper.as: Bump to GPLv3+.
2009-09-10 01:53:31 +08:00
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
* AUTHORS, BUGS, ChangeLog, ChangeLog.0, ChangeLog.1,
ChangeLog.2, GNUmakefile, Makefile.maint, NEWS, README,
README-alpha, TODO, configure.ac, lib/autoconf/Makefile.am,
m4/atconfig.m4, m4/init.m4, m4/m4.m4, m4/missing.m4,
m4/sanity.m4, tests/README, tests/aclocal.m4,
tests/atspecific.m4, tests/base.at, tests/compile.at,
tests/foreign.at, tests/m4sh.at, tests/m4sugar.at,
tests/semantics.at, tests/suite.at, tests/tools.at,
tests/torture.at: Add copyright notice.
* tests/mktests.sh: Update year in copyright notice.
2001-08-12 21:05:11 +08:00
|
|
|
#
|
|
|
|
# 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
|
2017-09-17 08:48:19 +08:00
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* AUTHORS, BUGS, ChangeLog, ChangeLog.0, ChangeLog.1,
ChangeLog.2, GNUmakefile, Makefile.maint, NEWS, README,
README-alpha, TODO, configure.ac, lib/autoconf/Makefile.am,
m4/atconfig.m4, m4/init.m4, m4/m4.m4, m4/missing.m4,
m4/sanity.m4, tests/README, tests/aclocal.m4,
tests/atspecific.m4, tests/base.at, tests/compile.at,
tests/foreign.at, tests/m4sh.at, tests/m4sugar.at,
tests/semantics.at, tests/suite.at, tests/tools.at,
tests/torture.at: Add copyright notice.
* tests/mktests.sh: Update year in copyright notice.
2001-08-12 21:05:11 +08:00
|
|
|
|
|
|
|
|
2002-10-28 16:57:40 +08:00
|
|
|
## --------- ##
|
|
|
|
## Libtool. ##
|
|
|
|
## --------- ##
|
2000-12-19 16:14:19 +08:00
|
|
|
|
2005-02-05 16:28:35 +08:00
|
|
|
AT_SETUP([Libtool])
|
2000-12-19 16:14:19 +08:00
|
|
|
|
|
|
|
# Skip this test if there is no libtoolize.
|
2000-12-20 21:48:07 +08:00
|
|
|
AT_CHECK([libtoolize --version || exit 77],
|
2010-06-08 00:11:07 +08:00
|
|
|
[ignore], [ignore], [ignore])
|
|
|
|
# Modern Libtool has further tests for compatibility with older autoconf;
|
|
|
|
# from the Autoconf side, we will merely assume newer libtool.
|
2001-06-23 22:01:29 +08:00
|
|
|
AT_CHECK([[
|
|
|
|
case `libtoolize --version |
|
Fix Posix-conformance bugs re use of { command in sed scripts,
and improve the sed-related documentation a bit.
* doc/autoconf.texi (Installation Directory Variables): Use
our own style advice re 's,a,b,' versus 's|a|b|'. Use "Sed"
rather than "sed" when talking about Sed in general.
(Particular Programs): Likewise.
(Coding Style): y is like s with respect to / and ,.
(Limitations of Usual Tools): Document the weird restrictions
that Posix has about { }. Use better quoting.
* lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE, _AC_OUTPUT_HEADER):
Rewrite to conform to Posix rules about { } in sed scripts.
* lib/m4sugar/m4sh.m4 (AS_DIRNAME_SED, AS_BASENAME_SED): Likewise.
* tests/foreign.at (Libtool): Likewise.
* tests/semantics.at (AC_CHECK_PROG & AC_CHECK_PROGS):
Use our own style advice re 's,a,b,' versus 's|a|b|'.
2006-01-06 05:43:44 +08:00
|
|
|
sed -n '/^.* \([0-9][0-9.a-z]*\)$/{
|
|
|
|
s//\1/
|
|
|
|
p
|
|
|
|
q
|
|
|
|
}'` in
|
2010-06-08 00:11:07 +08:00
|
|
|
0.* ) exit 77;;
|
|
|
|
1.* ) exit 77;;
|
2001-06-23 22:01:29 +08:00
|
|
|
esac]],
|
2010-06-08 00:11:07 +08:00
|
|
|
[ignore], [ignore], [ignore])
|
2000-12-19 16:14:19 +08:00
|
|
|
|
2010-06-08 00:11:07 +08:00
|
|
|
# Using a configure.ac, have libtoolize confess where libtool.m4 is.
|
|
|
|
AT_DATA([configure.ac],
|
2000-12-19 16:14:19 +08:00
|
|
|
[[AC_INIT
|
2007-12-05 05:49:36 +08:00
|
|
|
# State that we explicitly want auxiliary files here, so libtoolize
|
|
|
|
# won't pollute files outside the test directory.
|
2010-06-08 00:11:07 +08:00
|
|
|
AC_CONFIG_AUX_DIR([.])
|
2000-12-19 16:14:19 +08:00
|
|
|
AC_PROG_LIBTOOL
|
|
|
|
]])
|
2015-09-05 22:55:52 +08:00
|
|
|
AT_CHECK([LC_ALL=C libtoolize -i], [0], [stdout], [ignore])
|
2002-10-28 17:31:48 +08:00
|
|
|
|
|
|
|
# Some broken libtoolize fail to install a functional config.guess.
|
2015-09-05 22:55:52 +08:00
|
|
|
AT_CHECK([LC_ALL=C ./config.guess || exit 77], [], [ignore], [ignore])
|
2002-10-28 17:31:48 +08:00
|
|
|
|
|
|
|
# Make sure at-path contains something valid, and let the test suite
|
|
|
|
# display it when verbose. And fail, skipping would too easily hide
|
|
|
|
# problems.
|
2014-11-03 14:25:03 +08:00
|
|
|
AT_CHECK([sed -n ["s,^[^']*[\`']\\(/[^']*\\)'.*,\\1,p"] stdout], [0], [stdout])
|
2010-06-08 00:11:07 +08:00
|
|
|
AT_CHECK([test -f "`sed -n 1p stdout`"])
|
2001-01-18 21:16:02 +08:00
|
|
|
|
2010-06-08 00:11:07 +08:00
|
|
|
# Older libtoolize installed everything but install-sh...
|
|
|
|
AT_CHECK([test -f install-sh || touch install-sh])
|
2001-04-21 01:38:22 +08:00
|
|
|
|
2000-12-23 18:11:57 +08:00
|
|
|
# Build the concatenation of libtool.m4 and configure.ac.
|
2010-06-08 00:11:07 +08:00
|
|
|
AT_CHECK([[sed 's/.*/m4''_include([&])/' stdout]], [0], [stdout])
|
|
|
|
AT_CHECK([mv stdout aclocal.m4])
|
|
|
|
cat >configure.ac <<_EOF
|
2000-12-19 16:14:19 +08:00
|
|
|
AC_INIT
|
2010-06-08 00:11:07 +08:00
|
|
|
AC_CONFIG_AUX_DIR([.])
|
2001-03-20 22:15:59 +08:00
|
|
|
AC_CANONICAL_SYSTEM
|
2000-12-19 16:14:19 +08:00
|
|
|
AC_PROG_LIBTOOL
|
|
|
|
_EOF
|
|
|
|
|
2002-10-22 19:14:44 +08:00
|
|
|
# FIXME: Once Libtool really fixed, stop ignoring stderr.
|
|
|
|
AT_CHECK_AUTOCONF([], [], [], [ignore])
|
2000-12-19 16:14:19 +08:00
|
|
|
|
2001-04-21 01:38:22 +08:00
|
|
|
# Ignore stderr, because ltconfig always loads the cache, which is
|
|
|
|
# /dev/null, and some shells choke on this. For instance with Bash
|
|
|
|
# 2.05, you get:
|
|
|
|
#
|
|
|
|
# loading cache /dev/null within ltconfig
|
|
|
|
# ./ltconfig: .: /dev/null: not a regular file
|
|
|
|
#
|
|
|
|
# But the script executes properly.
|
|
|
|
AT_CHECK_CONFIGURE([], [], [], [ignore])
|
2000-12-19 16:14:19 +08:00
|
|
|
|
2007-05-16 17:42:25 +08:00
|
|
|
AT_CLEANUP
|
2009-12-15 13:52:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
AT_SETUP([shtool])
|
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT([shtool test], [1.0])
|
|
|
|
AC_CONFIG_AUX_DIR([build-aux])
|
|
|
|
AC_PATH_PROG([SHTOOL], [shtool], [false])
|
|
|
|
AC_PROG_INSTALL
|
|
|
|
AC_SUBST([ac_install_sh])
|
|
|
|
AC_CONFIG_FILES([Makefile])
|
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_DATA([Makefile.in],
|
|
|
|
[[SHTOOL = @SHTOOL@
|
2012-03-02 13:55:25 +08:00
|
|
|
# fake these, so that we use shtool wherever possible.
|
2009-12-15 13:52:19 +08:00
|
|
|
INSTALL_PROGRAM = $(ac_install_sh)
|
|
|
|
INSTALL_DATA = $(ac_install_sh) -m 644
|
|
|
|
prefix = @prefix@
|
|
|
|
ac_install_sh = @ac_install_sh@
|
|
|
|
|
|
|
|
install:
|
|
|
|
$(INSTALL_PROGRAM) file1 $(prefix)/file1
|
|
|
|
$(INSTALL_DATA) file2 $(prefix)/file2
|
|
|
|
|
|
|
|
copy-shtool:
|
|
|
|
test '$(SHTOOL)' != false
|
|
|
|
cp '$(SHTOOL)' build-aux
|
|
|
|
]])
|
|
|
|
|
|
|
|
: >file1
|
|
|
|
: >file2
|
|
|
|
chmod +x file1
|
|
|
|
mkdir build-aux inst
|
|
|
|
instdir=`pwd`/inst
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
cp "$abs_top_srcdir/build-aux/install-sh" build-aux
|
|
|
|
AT_CHECK_CONFIGURE
|
2020-08-20 23:04:20 +08:00
|
|
|
AT_SKIP_IF([grep 'SHTOOL = false' Makefile > /dev/null 2>&1])
|
|
|
|
|
|
|
|
AT_CHECK_MAKE([copy-shtool])
|
|
|
|
AT_CHECK([test -s build-aux/shtool])
|
|
|
|
|
|
|
|
# AC_PROG_INSTALL should pick up shtool from build-aux, even though
|
|
|
|
# we're forcing AC_PATH_PROG not to find it on the host system.
|
2009-12-15 13:52:19 +08:00
|
|
|
rm -f build-aux/install-sh
|
|
|
|
AT_CHECK_CONFIGURE([--prefix="$instdir" ac_cv_path_SHTOOL=false])
|
|
|
|
AT_CHECK([grep '^ac_install_sh = .*shtool install -c' Makefile], [], [ignore])
|
2020-08-20 23:04:20 +08:00
|
|
|
AT_CHECK_MAKE([install])
|
|
|
|
AT_CHECK([test -f inst/file1 && test -f inst/file2 && test -x inst/file1])
|
2009-12-15 13:52:19 +08:00
|
|
|
|
|
|
|
AT_CLEANUP
|
Revert "AC_PROG_CC: define via AC_DEFUN_ONCE". (#110350)
Revert commit 18c140b50b0619454d4da50d58a318cc257d580a, restoring
AC_PROG_CC to being defined as an ordinary AC_DEFUN. This broke
third-party macros (e.g. the Autoconf Macro Archive’s
AX_PROG_CC_FOR_BUILD) that intentionally invoked AC_PROG_CC a second
time with its guts redefined via a whole bunch of ‘pushdef’s. I don’t
think we want to support this long-term, but needing access to a
build-native compiler in cross-compilation is common enough that we
should have *some* supported way to do it, and it may as well be
AX_PROG_CC_FOR_BUILD until we come up with something better.
If we go back to AC_DEFUN_ONCE for AC_PROG_CC in the future, we should
do it consistently for all the “find me a compiler” macros -- it
was *only* done for AC_PROG_CC in 18c140b5.
The rationale for AC_DEFUN_ONCE seems to have been to reduce the size
of the generated configure script. The bulk of the size accountable to
AC_PROG_CC is the test programs for figuring out which version of the
C standard is available, so I tweaked _AC_C_STD_TRY (and _AC_CXX_STD_TRY)
to emit that text only once per program, into shell variables which
can then be referenced repeatedly.
Fixes bug #110350.
* NEWS, doc/autoconf.texi: Revert documentation changes associated
with AC_PROG_CC being a one-shot macro.
* lib/autoconf/c.m4 (AC_PROG_CC): Revert to defining with AC_DEFUN.
(_AC_C_STD_TRY, _AC_CXX_STD_TRY): Emit the test program only once,
even if invoked multiple times with the same arguments.
* tests/foreign.at (AX_PROG_CC_FOR_BUILD, AX_PROG_CXX_FOR_BUILD):
New tests.
2020-12-05 05:32:35 +08:00
|
|
|
|
|
|
|
AT_SETUP([AX_PROG_CC_FOR_BUILD])
|
|
|
|
|
|
|
|
cp "$abs_top_srcdir/build-aux/install-sh" \
|
|
|
|
"$abs_top_srcdir/build-aux/config.guess" \
|
|
|
|
"$abs_top_srcdir/build-aux/config.sub" .
|
|
|
|
|
|
|
|
# The Autoconf Macro Archive's AX_PROG_CC_FOR_BUILD invokes AC_PROG_CC
|
|
|
|
# twice, with a whole bunch of shell variables renamed at the m4 level
|
|
|
|
# the second time. Git commit 18c140b50b0619454d4da50d58a318cc257d580a
|
|
|
|
# broke this usage and the breakage went unnoticed for *eight years*.
|
|
|
|
|
Restore compatibility with older std-gnu11.m4.
Gnulib’s std-gnu11.m4 backports C11 and C++11 detection to autoconf
2.69. It does this by replacing the definitions of AC_PROC_CC and
AC_PROG_CXX and most of their subroutines. In particular, it replaces
the definitions of _AC_PROG_CC_C11, _AC_PROG_CC_C99, and _AC_C_STD_TRY,
but it does *not* replace the definition of _AC_PROG_CC_C89.
Autoconf commit 131d8c69f31dc6fc8dc93abe1096d52d1fe19fd3 changed the
calling convention of _AC_C_STD_TRY, and changed the internal
definitions of _AC_PROG_CC_C{11,99,89} to match. If std-gnu11.m4 is
in use, our _AC_PROG_CC_C89 calls their _AC_C_STD_TRY with the new
calling convention, and this produces a syntactically invalid
configure script. (This is is fortunate: it could easily have been a
runtime malfunction that only manifested with compilers that only
implement C89, and then we might not have noticed the problem for
years.)
Gnulib commit a3b3fc85e3e632374811b27cb2111e50fa177e36 makes
std-gnu11.m4 do nothing when used with autoconf >=2.70, but older
versions of the file will circulate for years to come, so this patch
works around the problem in autoconf. It does this by renaming all of
the internal macros involved with C and C++ standard edition
detection, *except* _AC_PROG_CC_C89. AC_PROG_CC now calls
_AC_PROG_CC_STDC_EDITION, which loops over all supported editions
calling _AC_PROG_CC_STDC_EDITION_TRY, which uses the data provided by
the existing _AC_C_C${edition}_TEST_PROGRAM macros and a new set of
macros called _AC_C_C${edition}_OPTIONS to perform the test for that
edition of the standard. Similarly, AC_PROG_CXX calls
_AC_PROG_CXX_STDCXX_EDITION, which loops calling
_AC_PROG_CXX_STDCXX_EDITION_TRY, which uses data from
_AC_CXX_CXX${edition}_TEST_PROGRAM and _AC_CXX_CXX${edition}_OPTIONS.
_AC_PROG_CC_C89 is the only macro from the old set that we still
define, and its definition is reverted to what std-gnu11.m4 expects it
to be. Nothing in Autoconf proper uses it anymore.
foreign.at grows a test to verify that the compatibility stub version
of _AC_PROG_CC_C89 does its job. Since this is now the third test
involving an embedded copy of a third-party macro, I broke them all
out of foreign.at to separate files in test/data/.
In addition to fixing the breakage, this patch should make it easier
to extend C / C++ standard edition detection in the future, by getting
rid of the if-else chains in AC_PROG_CC/CXX and by disentangling the
lists of command-line options to test from the logic.
I also changed the manual to suggest people refer to the variables
‘ac_prog_cc_stdc’ and ‘ac_prog_cxx_stdcxx’ to learn which edition
of the C and C++ standards are selected; these are much easier to
work with than the ac_cv_prog_cc_cNN cache variables.
* lib/autoconf/c.m4 (_AC_C_STD_TRY, _AC_PROG_CC_C99, _AC_PROG_CC_C11)
(_AC_CXX_STD_TRY, _AC_PROG_CXX_CXX98, _AC_PROG_CXX_CXX11): Remove macro.
(_AC_C_C89_OPTIONS, _AC_C_C99_OPTIONS, _AC_C_C11_OPTIONS)
(_AC_PROG_CC_STDC_EDITION, _AC_PROG_CC_STDC_EDITION_TRY)
(_AC_CXX_CXX98_OPTIONS, _AC_CXX_CXX11_OPTIONS)
(_AC_PROG_CXX_STDCXX_EDITION, _AC_PROG_CXX_STDCXX_EDITION_TRY): New macros.
(_AC_PROG_CC_C89): Convert to compatibility stub for std-gnu11.m4.
(AC_PROG_CC): Use _AC_PROG_CC_STDC_EDITION.
(AC_PROG_CXX): Use _AC_PROG_CXX_STDCXX_EDITION.
* tests/data/ax_prog_cc_for_build_v18.m4
* tests/data/ax_prog_cxx_for_build_v3.m4
* tests/data/gnulib_std_gnu11_2020_08_17.m4: New files.
* tests/foreign.at (AX_PROG_CC_FOR_BUILD, AX_PROG_CXX_FOR_BUILD):
Remove embedded copy of ax_prog_cc_for_build_v18.m4,
ax_prog_cxx_for_build_v3.m4 respectively.
(gnulib-std-gnu11.m4): New test.
* tests/local.mk: Distribute tests/data/*.m4.
* doc/autoconf.texi (AC_PROG_CC, AC_PROG_CXX): Document use of
ac_prog_cc_stdc / ac_prog_cxx_stdcxx, respectively, to tell which
edition of the C / C++ standards are selected, instead of looking
through a series of cache variables with awkward definitions.
2020-12-22 03:04:22 +08:00
|
|
|
cp "$abs_top_srcdir/tests/data/ax_prog_cc_for_build_v18.m4" \
|
|
|
|
aclocal.m4
|
Revert "AC_PROG_CC: define via AC_DEFUN_ONCE". (#110350)
Revert commit 18c140b50b0619454d4da50d58a318cc257d580a, restoring
AC_PROG_CC to being defined as an ordinary AC_DEFUN. This broke
third-party macros (e.g. the Autoconf Macro Archive’s
AX_PROG_CC_FOR_BUILD) that intentionally invoked AC_PROG_CC a second
time with its guts redefined via a whole bunch of ‘pushdef’s. I don’t
think we want to support this long-term, but needing access to a
build-native compiler in cross-compilation is common enough that we
should have *some* supported way to do it, and it may as well be
AX_PROG_CC_FOR_BUILD until we come up with something better.
If we go back to AC_DEFUN_ONCE for AC_PROG_CC in the future, we should
do it consistently for all the “find me a compiler” macros -- it
was *only* done for AC_PROG_CC in 18c140b5.
The rationale for AC_DEFUN_ONCE seems to have been to reduce the size
of the generated configure script. The bulk of the size accountable to
AC_PROG_CC is the test programs for figuring out which version of the
C standard is available, so I tweaked _AC_C_STD_TRY (and _AC_CXX_STD_TRY)
to emit that text only once per program, into shell variables which
can then be referenced repeatedly.
Fixes bug #110350.
* NEWS, doc/autoconf.texi: Revert documentation changes associated
with AC_PROG_CC being a one-shot macro.
* lib/autoconf/c.m4 (AC_PROG_CC): Revert to defining with AC_DEFUN.
(_AC_C_STD_TRY, _AC_CXX_STD_TRY): Emit the test program only once,
even if invoked multiple times with the same arguments.
* tests/foreign.at (AX_PROG_CC_FOR_BUILD, AX_PROG_CXX_FOR_BUILD):
New tests.
2020-12-05 05:32:35 +08:00
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT([foo], [1.0])
|
|
|
|
AX_PROG_CC_FOR_BUILD
|
|
|
|
AC_CONFIG_FILES([Makefile])
|
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_DATA([Makefile.in],
|
|
|
|
[[CC = @CC@
|
|
|
|
CC_FOR_BUILD = @CC_FOR_BUILD@
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
AT_CHECK_CONFIGURE
|
|
|
|
|
|
|
|
AT_CHECK([grep '^CC = ..*$' Makefile > /dev/null 2>&1])
|
|
|
|
AT_CHECK([grep '^CC_FOR_BUILD = ..*$' Makefile > /dev/null 2>&1])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
AT_SETUP([AX_PROG_CXX_FOR_BUILD])
|
|
|
|
|
|
|
|
cp "$abs_top_srcdir/build-aux/install-sh" \
|
|
|
|
"$abs_top_srcdir/build-aux/config.guess" \
|
|
|
|
"$abs_top_srcdir/build-aux/config.sub" .
|
|
|
|
|
|
|
|
# The Autoconf Macro Archive's AX_PROG_CXX_FOR_BUILD invokes AC_PROG_CXX
|
|
|
|
# twice, with a whole bunch of shell variables renamed at the m4 level
|
|
|
|
# the second time. This usage was never broken (unlike with AC_PROG_CC)
|
|
|
|
# but it seems sensible to make sure it doesn't *get* broken.
|
|
|
|
|
Restore compatibility with older std-gnu11.m4.
Gnulib’s std-gnu11.m4 backports C11 and C++11 detection to autoconf
2.69. It does this by replacing the definitions of AC_PROC_CC and
AC_PROG_CXX and most of their subroutines. In particular, it replaces
the definitions of _AC_PROG_CC_C11, _AC_PROG_CC_C99, and _AC_C_STD_TRY,
but it does *not* replace the definition of _AC_PROG_CC_C89.
Autoconf commit 131d8c69f31dc6fc8dc93abe1096d52d1fe19fd3 changed the
calling convention of _AC_C_STD_TRY, and changed the internal
definitions of _AC_PROG_CC_C{11,99,89} to match. If std-gnu11.m4 is
in use, our _AC_PROG_CC_C89 calls their _AC_C_STD_TRY with the new
calling convention, and this produces a syntactically invalid
configure script. (This is is fortunate: it could easily have been a
runtime malfunction that only manifested with compilers that only
implement C89, and then we might not have noticed the problem for
years.)
Gnulib commit a3b3fc85e3e632374811b27cb2111e50fa177e36 makes
std-gnu11.m4 do nothing when used with autoconf >=2.70, but older
versions of the file will circulate for years to come, so this patch
works around the problem in autoconf. It does this by renaming all of
the internal macros involved with C and C++ standard edition
detection, *except* _AC_PROG_CC_C89. AC_PROG_CC now calls
_AC_PROG_CC_STDC_EDITION, which loops over all supported editions
calling _AC_PROG_CC_STDC_EDITION_TRY, which uses the data provided by
the existing _AC_C_C${edition}_TEST_PROGRAM macros and a new set of
macros called _AC_C_C${edition}_OPTIONS to perform the test for that
edition of the standard. Similarly, AC_PROG_CXX calls
_AC_PROG_CXX_STDCXX_EDITION, which loops calling
_AC_PROG_CXX_STDCXX_EDITION_TRY, which uses data from
_AC_CXX_CXX${edition}_TEST_PROGRAM and _AC_CXX_CXX${edition}_OPTIONS.
_AC_PROG_CC_C89 is the only macro from the old set that we still
define, and its definition is reverted to what std-gnu11.m4 expects it
to be. Nothing in Autoconf proper uses it anymore.
foreign.at grows a test to verify that the compatibility stub version
of _AC_PROG_CC_C89 does its job. Since this is now the third test
involving an embedded copy of a third-party macro, I broke them all
out of foreign.at to separate files in test/data/.
In addition to fixing the breakage, this patch should make it easier
to extend C / C++ standard edition detection in the future, by getting
rid of the if-else chains in AC_PROG_CC/CXX and by disentangling the
lists of command-line options to test from the logic.
I also changed the manual to suggest people refer to the variables
‘ac_prog_cc_stdc’ and ‘ac_prog_cxx_stdcxx’ to learn which edition
of the C and C++ standards are selected; these are much easier to
work with than the ac_cv_prog_cc_cNN cache variables.
* lib/autoconf/c.m4 (_AC_C_STD_TRY, _AC_PROG_CC_C99, _AC_PROG_CC_C11)
(_AC_CXX_STD_TRY, _AC_PROG_CXX_CXX98, _AC_PROG_CXX_CXX11): Remove macro.
(_AC_C_C89_OPTIONS, _AC_C_C99_OPTIONS, _AC_C_C11_OPTIONS)
(_AC_PROG_CC_STDC_EDITION, _AC_PROG_CC_STDC_EDITION_TRY)
(_AC_CXX_CXX98_OPTIONS, _AC_CXX_CXX11_OPTIONS)
(_AC_PROG_CXX_STDCXX_EDITION, _AC_PROG_CXX_STDCXX_EDITION_TRY): New macros.
(_AC_PROG_CC_C89): Convert to compatibility stub for std-gnu11.m4.
(AC_PROG_CC): Use _AC_PROG_CC_STDC_EDITION.
(AC_PROG_CXX): Use _AC_PROG_CXX_STDCXX_EDITION.
* tests/data/ax_prog_cc_for_build_v18.m4
* tests/data/ax_prog_cxx_for_build_v3.m4
* tests/data/gnulib_std_gnu11_2020_08_17.m4: New files.
* tests/foreign.at (AX_PROG_CC_FOR_BUILD, AX_PROG_CXX_FOR_BUILD):
Remove embedded copy of ax_prog_cc_for_build_v18.m4,
ax_prog_cxx_for_build_v3.m4 respectively.
(gnulib-std-gnu11.m4): New test.
* tests/local.mk: Distribute tests/data/*.m4.
* doc/autoconf.texi (AC_PROG_CC, AC_PROG_CXX): Document use of
ac_prog_cc_stdc / ac_prog_cxx_stdcxx, respectively, to tell which
edition of the C / C++ standards are selected, instead of looking
through a series of cache variables with awkward definitions.
2020-12-22 03:04:22 +08:00
|
|
|
cat "$abs_top_srcdir/tests/data/ax_prog_cc_for_build_v18.m4" \
|
|
|
|
"$abs_top_srcdir/tests/data/ax_prog_cxx_for_build_v3.m4" \
|
|
|
|
> aclocal.m4
|
Revert "AC_PROG_CC: define via AC_DEFUN_ONCE". (#110350)
Revert commit 18c140b50b0619454d4da50d58a318cc257d580a, restoring
AC_PROG_CC to being defined as an ordinary AC_DEFUN. This broke
third-party macros (e.g. the Autoconf Macro Archive’s
AX_PROG_CC_FOR_BUILD) that intentionally invoked AC_PROG_CC a second
time with its guts redefined via a whole bunch of ‘pushdef’s. I don’t
think we want to support this long-term, but needing access to a
build-native compiler in cross-compilation is common enough that we
should have *some* supported way to do it, and it may as well be
AX_PROG_CC_FOR_BUILD until we come up with something better.
If we go back to AC_DEFUN_ONCE for AC_PROG_CC in the future, we should
do it consistently for all the “find me a compiler” macros -- it
was *only* done for AC_PROG_CC in 18c140b5.
The rationale for AC_DEFUN_ONCE seems to have been to reduce the size
of the generated configure script. The bulk of the size accountable to
AC_PROG_CC is the test programs for figuring out which version of the
C standard is available, so I tweaked _AC_C_STD_TRY (and _AC_CXX_STD_TRY)
to emit that text only once per program, into shell variables which
can then be referenced repeatedly.
Fixes bug #110350.
* NEWS, doc/autoconf.texi: Revert documentation changes associated
with AC_PROG_CC being a one-shot macro.
* lib/autoconf/c.m4 (AC_PROG_CC): Revert to defining with AC_DEFUN.
(_AC_C_STD_TRY, _AC_CXX_STD_TRY): Emit the test program only once,
even if invoked multiple times with the same arguments.
* tests/foreign.at (AX_PROG_CC_FOR_BUILD, AX_PROG_CXX_FOR_BUILD):
New tests.
2020-12-05 05:32:35 +08:00
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT([foo], [1.0])
|
|
|
|
AX_PROG_CXX_FOR_BUILD
|
|
|
|
AC_CONFIG_FILES([Makefile])
|
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_DATA([Makefile.in],
|
|
|
|
[[CXX = @CXX@
|
|
|
|
CXX_FOR_BUILD = @CXX_FOR_BUILD@
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
AT_CHECK_CONFIGURE
|
|
|
|
|
|
|
|
AT_CHECK([grep '^CXX = ..*$' Makefile > /dev/null 2>&1])
|
|
|
|
AT_CHECK([grep '^CXX_FOR_BUILD = ..*$' Makefile > /dev/null 2>&1])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
Restore compatibility with older std-gnu11.m4.
Gnulib’s std-gnu11.m4 backports C11 and C++11 detection to autoconf
2.69. It does this by replacing the definitions of AC_PROC_CC and
AC_PROG_CXX and most of their subroutines. In particular, it replaces
the definitions of _AC_PROG_CC_C11, _AC_PROG_CC_C99, and _AC_C_STD_TRY,
but it does *not* replace the definition of _AC_PROG_CC_C89.
Autoconf commit 131d8c69f31dc6fc8dc93abe1096d52d1fe19fd3 changed the
calling convention of _AC_C_STD_TRY, and changed the internal
definitions of _AC_PROG_CC_C{11,99,89} to match. If std-gnu11.m4 is
in use, our _AC_PROG_CC_C89 calls their _AC_C_STD_TRY with the new
calling convention, and this produces a syntactically invalid
configure script. (This is is fortunate: it could easily have been a
runtime malfunction that only manifested with compilers that only
implement C89, and then we might not have noticed the problem for
years.)
Gnulib commit a3b3fc85e3e632374811b27cb2111e50fa177e36 makes
std-gnu11.m4 do nothing when used with autoconf >=2.70, but older
versions of the file will circulate for years to come, so this patch
works around the problem in autoconf. It does this by renaming all of
the internal macros involved with C and C++ standard edition
detection, *except* _AC_PROG_CC_C89. AC_PROG_CC now calls
_AC_PROG_CC_STDC_EDITION, which loops over all supported editions
calling _AC_PROG_CC_STDC_EDITION_TRY, which uses the data provided by
the existing _AC_C_C${edition}_TEST_PROGRAM macros and a new set of
macros called _AC_C_C${edition}_OPTIONS to perform the test for that
edition of the standard. Similarly, AC_PROG_CXX calls
_AC_PROG_CXX_STDCXX_EDITION, which loops calling
_AC_PROG_CXX_STDCXX_EDITION_TRY, which uses data from
_AC_CXX_CXX${edition}_TEST_PROGRAM and _AC_CXX_CXX${edition}_OPTIONS.
_AC_PROG_CC_C89 is the only macro from the old set that we still
define, and its definition is reverted to what std-gnu11.m4 expects it
to be. Nothing in Autoconf proper uses it anymore.
foreign.at grows a test to verify that the compatibility stub version
of _AC_PROG_CC_C89 does its job. Since this is now the third test
involving an embedded copy of a third-party macro, I broke them all
out of foreign.at to separate files in test/data/.
In addition to fixing the breakage, this patch should make it easier
to extend C / C++ standard edition detection in the future, by getting
rid of the if-else chains in AC_PROG_CC/CXX and by disentangling the
lists of command-line options to test from the logic.
I also changed the manual to suggest people refer to the variables
‘ac_prog_cc_stdc’ and ‘ac_prog_cxx_stdcxx’ to learn which edition
of the C and C++ standards are selected; these are much easier to
work with than the ac_cv_prog_cc_cNN cache variables.
* lib/autoconf/c.m4 (_AC_C_STD_TRY, _AC_PROG_CC_C99, _AC_PROG_CC_C11)
(_AC_CXX_STD_TRY, _AC_PROG_CXX_CXX98, _AC_PROG_CXX_CXX11): Remove macro.
(_AC_C_C89_OPTIONS, _AC_C_C99_OPTIONS, _AC_C_C11_OPTIONS)
(_AC_PROG_CC_STDC_EDITION, _AC_PROG_CC_STDC_EDITION_TRY)
(_AC_CXX_CXX98_OPTIONS, _AC_CXX_CXX11_OPTIONS)
(_AC_PROG_CXX_STDCXX_EDITION, _AC_PROG_CXX_STDCXX_EDITION_TRY): New macros.
(_AC_PROG_CC_C89): Convert to compatibility stub for std-gnu11.m4.
(AC_PROG_CC): Use _AC_PROG_CC_STDC_EDITION.
(AC_PROG_CXX): Use _AC_PROG_CXX_STDCXX_EDITION.
* tests/data/ax_prog_cc_for_build_v18.m4
* tests/data/ax_prog_cxx_for_build_v3.m4
* tests/data/gnulib_std_gnu11_2020_08_17.m4: New files.
* tests/foreign.at (AX_PROG_CC_FOR_BUILD, AX_PROG_CXX_FOR_BUILD):
Remove embedded copy of ax_prog_cc_for_build_v18.m4,
ax_prog_cxx_for_build_v3.m4 respectively.
(gnulib-std-gnu11.m4): New test.
* tests/local.mk: Distribute tests/data/*.m4.
* doc/autoconf.texi (AC_PROG_CC, AC_PROG_CXX): Document use of
ac_prog_cc_stdc / ac_prog_cxx_stdcxx, respectively, to tell which
edition of the C / C++ standards are selected, instead of looking
through a series of cache variables with awkward definitions.
2020-12-22 03:04:22 +08:00
|
|
|
|
|
|
|
|
|
|
|
AT_SETUP([gnulib-std-gnu11.m4])
|
|
|
|
|
|
|
|
# Gnulib's std-gnu11.m4 (last significant change 2016-03-15) overrides
|
|
|
|
# most but not all of the internal macros used by AC_PROG_CC and AC_PROG_CXX.
|
|
|
|
# Commit 131d8c69f31dc6fc8dc93abe1096d52d1fe19fd3 changed the calling
|
|
|
|
# convention of _AC_C_STD_TRY, causing configure scripts that load
|
|
|
|
# std-gnu11.m4 to have shell syntax errors.
|
|
|
|
|
|
|
|
cp "$abs_top_srcdir/tests/data/gnulib_std_gnu11_2020_08_17.m4" \
|
|
|
|
aclocal.m4
|
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT([foo], [1.0])
|
|
|
|
AC_PROG_CC
|
|
|
|
AC_PROG_CXX
|
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
AT_CHECK_CONFIGURE
|
|
|
|
|
|
|
|
AT_CLEANUP
|