mirror of
git://git.sv.gnu.org/autoconf
synced 2025-02-11 13:51:04 +08:00
Many of the reported regressions in Autoconf 2.70 betas went unnoticed for years because Autoconf’s bundled test suite didn’t test most of the macros with a C++ compiler and/or in cross compilation mode. There’s a special makefile target ‘maintainer-check-c++’ that runs all the tests with CC=g++, but that doesn’t catch the regressions either, because it doesn’t compare the configure results with what you’d have gotten with a C compiler. Also, C and C++ have diverged to the point where setting CC to a C++ compiler doesn’t work reliably anymore. This patch overhauls AT_CHECK_MACRO to test each macro four times: (C compiler, C++ compiler) x (native mode, cross-compilation mode). All four tests are expected to produce the same config.cache and config.h, except for certain predictable differences due to running AC_PROG_CXX instead of AC_PROG_CC, and a short list of known, acceptable differences, maintained in mktests.pl. There are two classes of known, acceptable differences. Macros that use AC_RUN_IFELSE aren’t tested in cross-compilation mode at all, because they may crash the script (this is temporary and will be revisited after 2.70). Macros that correctly detect a difference between C and C++ (e.g. AC_HEADER_STDBOOL will notice that C++ doesn’t have the _Bool type) are annotated with the specific cache variable and #define that varies. mktests.pl now also has the capability to provide values for the MACRO-USE, ADDITIONAL-COMMANDS, and AUTOCONF-FLAGS arguments to AT_CHECK_(AU_)MACRO, on a per-macro basis, but that’s not used in this patch. Some of the manual uses of AT_CHECK_MACRO do not need to test C++ and/or cross compilation; for them, there is a new test helper, AT_CHECK_CONFIGURE_AC. Another new helper, AT_PRESERVE_CONFIG_STATUS, is used extensively in AT_CHECK_(AU_)MACRO but may be also useful in manual tests that need to do multiple configure runs. This change supersedes AT_CHECK_MACRO_CROSS and ‘make maintainer-check-c++’, which are removed. In my testing, setting CC to a C++ compiler no longer works at all, for reasons that are impractical to fix (e.g. C++ compilers choke on the test for C2011 features) so I have added a note to NEWS saying that this is not supported anymore. * tests/local.at (AT_CHECK_MACRO): Default behavior is now to test the macro in both native and cross-compilation mode, and expect the results to be identical. If the macro transitively required AC_PROG_CC, and a C++ compiler is available, then test it twice more with AC_LANG([C++]) in effect, and again expect the results to be identical. New fifth argument TEST-PARAMETERS can modify this behavior. (_AT_FILTER_CXX_CV_VARIES, _AT_FILTER_CXX_DEFINE_VARIES): New, subroutines of AT_CHECK_MACRO. (AT_CHECK_MACRO_CROSS): Remove, subsumed by new AT_CHECK_MACRO behavior. (AT_CHECK_AU_MACRO): Forward to AT_CHECK_MACRO for the basic test; then do the same autoupdate test as before, as a separate test group. (at_check_env): Also ignore OPENMP_CXXFLAGS. (AT_CONFIG_CMP): Add third argument EXTRA-VARIANCE that specifies additional variables that are expected to vary in a particular test. (_AT_CONFIG_CMP_PRUNE): New, subroutine of AT_CONFIG_CMP. (AT_DEFINES_CMP): New helper macro that compares config.h headers, with the ability to ignore variation in specific defines. (_AT_DEFINES_CMP_PRUNE): New, subroutine of AT_DEFINES_CMP. (AT_PRESERVE_CONFIG_STATUS): New helper that makes copies of config.h, config.log, config.status, and state-env.after under names that won’t be clobbered by a subsequent run of configure. (AT_CHECK_CONFIGURE_AC): New helper that defines a complete test group consisting of a single invocation of _AT_CHECK_AC_MACRO; effectively what AT_CHECK_MACRO used to be. (_AT_CHECK_AC_MACRO): Correct documentation comment; the PRE-TESTS argument has always been optional. * tests/mktests.pl (test_parameters): New global data object giving extra arguments to pass to AT_CHECK_MACRO/AT_CHECK_AU_MACRO on a per-macro basis. (emit_test): New function that handles emitting calls to AT_CHECK_(AU_)MACRO with the desired arguments. (scan_m4_files): Use emit_test. (au_exclude_list): Add AC_HAVE_LIBRARY, AC_COMPILE_CHECK, AC_TRY_CPP, AC_TRY_COMPILE, AC_TRY_LINK, and AC_TRY_RUN. * tests/semantics.at (AC_CHECK_LIB, AC_SEARCH_LIBS): Rewrite test using symbols from zlib instead of libm, to get consistent behavior from C and C++. (AC_SEARCH_LIBS (none needed)): Revise to clarify what is being tested. (AC_CHECK_DECLS): Use _AC_LANG_ABBREV when inspecting cache variables. (AC_CHECK_ALIGNOF, AC_CHECK_ALIGNOF struct) (AC_CHECK_SIZEOF, AC_CHECK_SIZEOF struct) No need for AT_CHECK_MACRO_CROSS. (AC_CHECK_FILES): Switch to AT_CHECK_CONFIGURE_AC. (AC_SYS_RESTARTABLE_SYSCALLS, AC_FUNC_WAIT3): Do not test in cross compilation mode. (AC_TRY_CPP, AC_TRY_COMPILE, AC_TRY_LINK, AC_TRY_RUN) (AC_COMPILE_CHECK, AC_HAVE_LIBRARY): New manual AT_CHECK_AU_MACRO tests. * tests/c.at (Extensions, C keywords, AC_PROG_CPP requires AC_PROG_CC) (AC_NO_EXECUTABLES (working linker), AC_NO_EXECUTABLES (broken linker)): Switch to AT_CHECK_CONFIGURE_AC. Also convert case statements to AS_CASE. (Broken/missing compilers): Pass CC=no-such-compiler on the command line instead of hardwiring it in the configure script. * tests/local.mk (maintainer-check-c++): Remove target. (maintainer-check): Run the ordinary ‘make check’ as well as ‘make maintainer-check-posix’. |
||
---|---|---|
bin | ||
build-aux | ||
doc | ||
lib | ||
m4 | ||
man | ||
tests | ||
.gitattributes | ||
.gitignore | ||
.prev-version | ||
.x-update-copyright | ||
AUTHORS | ||
BUGS | ||
cfg.mk | ||
ChangeLog.0 | ||
ChangeLog.1 | ||
ChangeLog.2 | ||
ChangeLog.3 | ||
configure.ac | ||
COPYING | ||
COPYING.EXCEPTION | ||
COPYINGv3 | ||
GNUmakefile | ||
HACKING | ||
maint.mk | ||
Makefile.am | ||
NEWS | ||
README | ||
README-alpha | ||
README-hacking | ||
THANKS | ||
TODO |
-*- text -*- Autoconf Autoconf is an extensible package of M4 macros that produce shell scripts to automatically configure software source code packages. These scripts can adapt the packages to many kinds of UNIX-like systems without manual user intervention. Autoconf creates a configuration script for a package from a template file that lists the operating system features that the package can use, in the form of M4 macro calls. Producing configuration scripts using Autoconf requires GNU M4 and Perl. You should install GNU M4 (version 1.4.6 or later is required; 1.4.14 or later is recommended) and Perl (5.006 or later) before configuring Autoconf, so that Autoconf's configure script can find them. The configuration scripts produced by Autoconf are self-contained, so their users do not need to have Autoconf (or GNU M4, Perl, etc.). You can get GNU M4 here: https://ftp.gnu.org/gnu/m4/ The file INSTALL should be distributed with packages that use Autoconf-generated configure scripts and Makefiles that conform to the GNU coding standards. The package's README can just give an overview of the package, where to report bugs, and a pointer to INSTALL for instructions on compilation and installation. This removes the need to maintain many similar sets of installation instructions. Be sure to read BUGS and INSTALL. Mail suggestions to autoconf@gnu.org, report bugs to bug-autoconf@gnu.org, and submit patches to autoconf-patches@gnu.org. All changes can be tracked at the read-only autoconf-commit@gnu.org. Always include the Autoconf version number, which you can get by running `autoconf --version'. Archives of bug-autoconf@gnu.org can be found in <https://lists.gnu.org/archive/html/bug-autoconf/>, and similarly for the other mailing lists. Licensing Autoconf is released under the General Public License version 3 (GPLv3+). Additionally, Autoconf includes a licensing exception in some of its source files; see the respective copyright notices for how your project is impacted by including scripts generated by Autoconf, and the COPYING.EXCEPTION file for the exception in terms of the Additional Permissions as described in section 7 of GPLv3. For more licensing information, see <https://www.gnu.org/licenses/gpl-faq.html> and <https://www.gnu.org/licenses/exceptions.html>. For any copyright year range specified as YYYY-ZZZZ in this package note that the range specifies every single year in that closed interval. ----- Copyright (C) 1992-1994, 1998, 2000-2017, 2020 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind.