autoconf/tests/semantics.at

1360 lines
37 KiB
Plaintext
Raw Normal View History

# -*- Autotest -*-
AT_BANNER([Semantics.])
2020-01-01 11:45:50 -08:00
# Copyright (C) 2000-2002, 2004-2007, 2009-2017, 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
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-09 19:53:31 +02:00
# the Free Software Foundation, either version 3 of the License, 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
2017-09-16 17:48:19 -07:00
# along with this program. If not, see <https://www.gnu.org/licenses/>.
## -------------------------------- ##
## Members of the AC_CHECK family. ##
## -------------------------------- ##
# AC_CHECK_LIB
# ------------
AT_CHECK_MACRO: test C++ as well as C, cross as well as native 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’.
2020-10-14 11:21:30 -04:00
# Test for symbols in a library that is very likely to be available
# and can be used from both C and C++: zlib, which we assume is
# available unless <zlib.h> doesn't exist.
# We used to use math library symbols for this, but that no longer
# works, because some C++ compilers pull in libm by default when the
# matching C compiler doesn't, breaking AT_CHECK_MACRO's expectations.
AT_CHECK_MACRO([AC_CHECK_LIB], [[
AC_CHECK_HEADER([zlib.h], [], [
AC_MSG_NOTICE([zlib not available, skipping test])
AS_EXIT(77)
])
AT_CHECK_MACRO: test C++ as well as C, cross as well as native 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’.
2020-10-14 11:21:30 -04:00
# Using : for the ACTION-IF-FOUND in each call to AC_CHECK_LIB
# prevents LIBS from accumulating copies of "-lz".
AT_CHECK_MACRO: test C++ as well as C, cross as well as native 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’.
2020-10-14 11:21:30 -04:00
AC_CHECK_LIB([z], [zlibVersion], [:], [
AC_MSG_ERROR([cannot find zlibVersion in libz])
])
if test "${ac_cv_lib_z_zlibVersion+set}" != set; then
AC_MSG_ERROR([ac_cv_lib_z_zlibVersion not set])
fi
AT_CHECK_MACRO: test C++ as well as C, cross as well as native 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’.
2020-10-14 11:21:30 -04:00
# No kidding, using variables was broken in 2.50 :(
ac_deflate=deflate
AC_CHECK_LIB([z], [$ac_deflate], [:], [
AC_MSG_ERROR([cannot find \$ac_deflate (= $ac_deflate) in libz])
])
if test "${ac_cv_lib_z_deflate+set}" != set; then
AC_MSG_ERROR([ac_cv_lib_z_deflate not set])
fi
AT_CHECK_MACRO: test C++ as well as C, cross as well as native 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’.
2020-10-14 11:21:30 -04:00
ac_z=z
AC_CHECK_LIB([$ac_z], [deflateEnd], [:], [
AC_MSG_ERROR([cannot find deflateEnd in lib\$ac_z (= lib$ac_z)])
])
if test "${ac_cv_lib_z_deflateEnd+set}" != set; then
AC_MSG_ERROR([ac_cv_lib_z_deflateEnd not set])
fi
AT_CHECK_MACRO: test C++ as well as C, cross as well as native 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’.
2020-10-14 11:21:30 -04:00
ac_inflate=inflate
AC_CHECK_LIB([$ac_z], [$ac_inflate], [:], [
AC_MSG_ERROR(
[cannot find \$ac_inflate (= $ac_inflate) in lib\$ac_z (= lib$ac_z)])
])
if test "${ac_cv_lib_z_inflate+set}" != set; then
AC_MSG_ERROR([ac_cv_lib_z_inflate not set])
fi
AT_CHECK_MACRO: test C++ as well as C, cross as well as native 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’.
2020-10-14 11:21:30 -04:00
# Also test for symbols that don't (well, shouldn't) exist.
# These should still set their cache variables!
AC_CHECK_LIB([z], [deflagrate], [
AC_MSG_ERROR([found deflagrate in libz])
], [:])
if test "${ac_cv_lib_z_deflagrate+set}" != set; then
AC_MSG_ERROR([ac_cv_lib_z_zlibVersion not set])
fi
AT_CHECK_MACRO: test C++ as well as C, cross as well as native 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’.
2020-10-14 11:21:30 -04:00
ac_defenestrate=defenestrate
AC_CHECK_LIB([z], [$ac_defenestrate], [
AC_MSG_ERROR([found \$ac_defenestrate (= $ac_defenestrate) in libz])
], [:])
if test "${ac_cv_lib_z_defenestrate+set}" != set; then
AC_MSG_ERROR([ac_cv_lib_z_defenestrate not set])
fi
AT_CHECK_MACRO: test C++ as well as C, cross as well as native 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’.
2020-10-14 11:21:30 -04:00
AC_CHECK_LIB([$ac_z], [defoliate], [
AC_MSG_ERROR([found defoliate in lib\$ac_z (= lib$ac_z)])
], [:])
if test "${ac_cv_lib_z_defoliate+set}" != set; then
AC_MSG_ERROR([ac_cv_lib_z_defoliate not set])
fi
ac_infiltrate=infiltrate
AC_CHECK_LIB([$ac_z], [$ac_infiltrate], [
AC_MSG_ERROR(
[found \$ac_infiltrate (= $ac_infiltrate) in lib\$ac_z (= lib$ac_z)])
], [:])
if test "${ac_cv_lib_z_infiltrate+set}" != set; then
AC_MSG_ERROR([ac_cv_lib_z_infiltrate not set])
fi
]])
# AC_SEARCH_LIBS
# --------------
AT_CHECK_MACRO: test C++ as well as C, cross as well as native 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’.
2020-10-14 11:21:30 -04:00
# Like AC_CHECK_LIBS, we use zlib here because we need the behavior to
# be consistent between the C and C++ compilers.
AT_CHECK_MACRO([AC_SEARCH_LIBS (needed)], [[
AC_CHECK_HEADER([zlib.h], [], [
AC_MSG_NOTICE([zlib not available, skipping test])
AS_EXIT(77)
2005-09-06 15:34:06 +00:00
])
AT_CHECK_MACRO: test C++ as well as C, cross as well as native 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’.
2020-10-14 11:21:30 -04:00
# Unlike AC_CHECK_LIBS, AC_SEARCH_LIBS sets $LIBS *even if*
# ACTION-IF-FOUND is given, so we need to reset it after each test.
ac_at_save_LIBS="$LIBS"
AC_SEARCH_LIBS([zlibVersion], [z], [:], [:])
if test x"$ac_cv_search_zlibVersion" != x-lz; then
AC_MSG_ERROR([wrong zlibVersion search result: $ac_cv_search_zlibVersion])
fi
LIBS="$ac_at_save_LIBS"
# No kidding, using variables was broken in 2.50 :(
ac_deflate=deflate
AC_SEARCH_LIBS([$ac_deflate], [z], [:], [:])
if test x"$ac_cv_search_deflate" != x-lz; then
AC_MSG_ERROR([wrong deflate search result: $ac_cv_search_deflate])
fi
LIBS="$ac_at_save_LIBS"
ac_z=z
AC_SEARCH_LIBS([deflateEnd], [$ac_z], [:], [:])
if test x"$ac_cv_search_deflateEnd" != x-lz; then
AC_MSG_ERROR([wrong deflateEnd search result: $ac_cv_search_deflateEnd])
fi
LIBS="$ac_at_save_LIBS"
ac_inflate=inflate
AC_SEARCH_LIBS([$ac_inflate], [$ac_z], [:], [:])
if test x"$ac_cv_search_inflate" != x-lz; then
AC_MSG_ERROR([wrong inflate search result: $ac_cv_search_inflate])
fi
LIBS="$ac_at_save_LIBS"
# Also test for symbols that don't (well, shouldn't) exist.
# These should still set their cache variables!
AC_SEARCH_LIBS([deflagrate], [z], [:], [:])
if test x"$ac_cv_search_deflagrate" != xno; then
AC_MSG_ERROR([wrong deflagrate search result: $ac_cv_search_deflagrate])
fi
LIBS="$ac_at_save_LIBS"
ac_defenestrate=defenestrate
AC_SEARCH_LIBS([$ac_defenestrate], [z], [:], [:])
if test x"$ac_cv_search_defenestrate" != xno; then
AC_MSG_ERROR([wrong defenestrate search result: $ac_cv_search_defenestrate])
fi
LIBS="$ac_at_save_LIBS"
AC_SEARCH_LIBS([defoliate], [$ac_z], [:], [:])
if test x"$ac_cv_search_defoliate" != xno; then
AC_MSG_ERROR([wrong defoliate search result: $ac_cv_search_defoliate])
fi
LIBS="$ac_at_save_LIBS"
ac_infiltrate=infiltrate
AC_SEARCH_LIBS([$ac_infiltrate], [$ac_z], [:], [:])
if test x"$ac_cv_search_infiltrate" != xno; then
AC_MSG_ERROR([wrong infiltrate search result: $ac_cv_search_infiltrate])
fi
LIBS="$ac_at_save_LIBS"
]])
2005-09-06 15:34:06 +00:00
# AC_SEARCH_LIBS (none needed)
# ----------------------------
AT_CHECK_MACRO: test C++ as well as C, cross as well as native 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’.
2020-10-14 11:21:30 -04:00
# This test doesn't need to be nearly as thorough as the above; its
# purpose is simply to ensure that when no library is needed,
# AC_SEARCH_LIBS really does produce "none needed" as its result.
AT_CHECK_MACRO([AC_SEARCH_LIBS (none needed)], [[
# No library should be required to link with printf, but we throw
# -lc in the search list so that it includes both libraries that
# don't exist and libraries that probably do.
AC_SEARCH_LIBS([printf], [oser c ust], [:], [:])
if test x"$ac_cv_search_printf" != "xnone required"; then
AC_MSG_ERROR([wrong printf search result: $ac_cv_search_printf])
fi
]])
# AC_CHECK_DECLS
# --------------
# For the benefit of _AC_UNDECLARED_WARNING compilers, these INCLUDES sections
# should not elicit warnings.
AT_CHECK_MACRO([AC_CHECK_DECLS],
[[AC_CHECK_DECLS([yes, no, myenum, mystruct, myfunc, mymacro1, mymacro2],,,
[[extern int yes;
enum { myenum };
Fix testsuite failures from ‘make maintainer-check-c++’. ‘make maintainer-check-c++’ has two test failures that don’t show in an ordinary ‘make check’. One of these is a pair of problems with the semantics.at test of AC_CHECK_DECL(S): * AC_CHECK_DECL cannot handle a function argument whose declared type is ‘char []’; it generates a cast to the array type, which is invalid in both C and C++. This was masked by an M4 quotation bug, causing it to emit a cast to ‘char’ instead, prodicing code that was valid C but invalid C++. I don’t think it’s practical to teach AC_CHECK_DECL to do argument type decay, so I changed the type signature in the AC_CHECK_DECL call (not in the actual declaration) to ‘char *’. Conveniently this also avoids the quotation issue. * In C++, apparently ‘extern struct { int x; } foo;’ is invalid. (clang++ explains at length: “variable ‘foo’ is used but not defined in this translation unit, and cannot be defined in any other translation unit because its type does not have linkage.”) Fixed by giving the struct a tag. The other failure is an actual bug in AC_PROG_LEX: the test program used by _AC_PROG_LEX_YYTEXT_DECL uses the flex utility function ‘input’, which is renamed to ‘yyinput’ when the scanner is compiled as C++. Fixed with ifdefs in the offending action--it might seem cleaner to use a macro defined in a %{ %} block, but that would be inserted into the skeleton *above* the declaration of (yy)input, so I didn’t feel it was safe. * tests/semantics.at (AC_CHECK_DECLS): Adjust test programs for C++ compatibility and to work around lack of support for argument type decay. * programs.m4 (_AC_PROG_LEX_YYTEXT_DECL): Call yyinput(), not input(), in scanner action when scanner is compiled as C++.
2020-08-28 16:42:28 -04:00
extern struct mystruct_s { int x[20]; } mystruct;
extern int myfunc();
#define mymacro1(arg) arg
#define mymacro2]])
# Clang reports a warning for an undeclared builtin.
AC_CHECK_DECLS([strerror],,, [[]])
# The difference in space-before-open-paren is intentional.
AC_CHECK_DECLS([basenam (char *), dirnam(char *),
Fix testsuite failures from ‘make maintainer-check-c++’. ‘make maintainer-check-c++’ has two test failures that don’t show in an ordinary ‘make check’. One of these is a pair of problems with the semantics.at test of AC_CHECK_DECL(S): * AC_CHECK_DECL cannot handle a function argument whose declared type is ‘char []’; it generates a cast to the array type, which is invalid in both C and C++. This was masked by an M4 quotation bug, causing it to emit a cast to ‘char’ instead, prodicing code that was valid C but invalid C++. I don’t think it’s practical to teach AC_CHECK_DECL to do argument type decay, so I changed the type signature in the AC_CHECK_DECL call (not in the actual declaration) to ‘char *’. Conveniently this also avoids the quotation issue. * In C++, apparently ‘extern struct { int x; } foo;’ is invalid. (clang++ explains at length: “variable ‘foo’ is used but not defined in this translation unit, and cannot be defined in any other translation unit because its type does not have linkage.”) Fixed by giving the struct a tag. The other failure is an actual bug in AC_PROG_LEX: the test program used by _AC_PROG_LEX_YYTEXT_DECL uses the flex utility function ‘input’, which is renamed to ‘yyinput’ when the scanner is compiled as C++. Fixed with ifdefs in the offending action--it might seem cleaner to use a macro defined in a %{ %} block, but that would be inserted into the skeleton *above* the declaration of (yy)input, so I didn’t feel it was safe. * tests/semantics.at (AC_CHECK_DECLS): Adjust test programs for C++ compatibility and to work around lack of support for argument type decay. * programs.m4 (_AC_PROG_LEX_YYTEXT_DECL): Call yyinput(), not input(), in scanner action when scanner is compiled as C++.
2020-08-28 16:42:28 -04:00
moreargs (char, short, int, long, void *, char *, float, double)],,,
[[#ifdef __cplusplus
extern "C++" char *basenam (char *);
extern "C++" const char *basenam (const char *);
#else
extern char *basenam (const char *);
#endif
#ifdef __cplusplus
extern "C" {
#endif
extern int moreargs (char, short, int, long, void *,
char [], float, double);
#ifdef __cplusplus
}
#endif
]])
AC_CHECK_DECL([declared (char *)],, [AS_EXIT([1])],
[[#ifdef __cplusplus
extern "C++" char *declared (char *);
extern "C++" const char *declared (const char *);
#else
extern char *declared (const char *);
#endif
]])
AC_LANG_WERROR
AC_CHECK_DECL([undeclared (char *)], [AS_EXIT([1])],, [[]])
AT_CHECK_MACRO: test C++ as well as C, cross as well as native 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’.
2020-10-14 11:21:30 -04:00
if test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag"; then
AC_MSG_ERROR([ac_]_AC_LANG_ABBREV[_werror_flag overwritten])
fi
]],
[AT_CHECK_DEFINES(
[#define HAVE_DECL_BASENAM 1
#define HAVE_DECL_DIRNAM 0
#define HAVE_DECL_MOREARGS 1
#define HAVE_DECL_MYENUM 1
#define HAVE_DECL_MYFUNC 1
#define HAVE_DECL_MYMACRO1 1
#define HAVE_DECL_MYMACRO2 1
#define HAVE_DECL_MYSTRUCT 1
#define HAVE_DECL_NO 0
#define HAVE_DECL_STRERROR 0
#define HAVE_DECL_YES 1
])])
# AC_CHECK_FUNCS
# --------------
# Check that it performs the correct actions:
# Must define HAVE_PRINTF, but not HAVE_AUTOCONF_FTNIRP
AT_CHECK_MACRO([AC_CHECK_FUNCS],
[AC_CHECK_FUNCS(printf autoconf_ftnirp)],
[AT_CHECK_DEFINES(
[/* #undef HAVE_AUTOCONF_FTNIRP */
#define HAVE_PRINTF 1
])])
# AC_REPLACE_FUNCS
# ----------------
# Check that it performs the correct actions: autoconf_ftnirp.c must
# be compiled, and must define HAVE_PRINTF, but not HAVE_AUTOCONF_FTNIRP
# FIXME: Maybe check the traces?
AT_SETUP([AC_REPLACE_FUNCS])
AT_DATA([config.in],
[@LIBOBJS@
])
AC_REPLACE_FUNCS: invoke _AH_CHECK_FUNC and AC_LIBSOURCE unconditionally. While investigating something else, I noticed that AC_REPLACE_FUNCS calls _AH_CHECK_FUNC and AC_LIBSOURCE in the success branch of an AC_CHECK_FUNC. This doesn’t work; both of those are marker macros that need to be expanded unconditionally at m4 time so that traces (placed by autoheader and automake, respectively) will fire. In order to fix this while keeping the code readable, I would up doing a major refactor. There are now four internal macros implementing AC_REPLACE_FUNCS. _AC_REPLACE_FUNC_U is called unconditionally for every shell word in the list passed to AC_REPLACE_FUNCS, and does _AH_CHECK_FUNC + AC_LIBSOURCE if it can, or issues a warning if it can’t. (It could make sense to make this a public function, if we think shell variables in the AC_REPLACE_FUNCS list need to be supported long-term. I dunno if there’s a use case that can’t be handled by AC_REPLACE_FUNCS inside a shell conditional just as well.) _AC_REPLACE_FUNC_L and _AC_REPLACE_FUNC_NL implement the actual test performed for each function to be replaced; the difference is that _L (for literal) can only be used on a function whose name is known at m4 expansion time, _NL (nonliteral) works regardless. _AC_REPLACE_FUNCS, which already existed, handles looping either at m4 time or shell time as appropriate. AC_REPLACE_FUNCS remains a thin wrapper that runs _AC_REPLACE_FUNCS(m4_flatten([$1])). The _bulk_ of the patch is changes to the testsuite so that it notices the original bug. Specifically, AT_CHECK_AUTOHEADER now takes an argument which is a whitespace-separated list of preprocessor macro names that ought to appear in the generated config.h.in. This can be set to ‘ignore’ to skip the test, and unfortunately that’s what the “trivial” per-macro tests have to do (AT_CHECK_MACRO and friends), so coverage is not ideal, but it’s better than what we had. Also, AT_CHECK_M4 now normalizes the backtrace lines that appear in the output of an AC_DIAGNOSE, e.g. configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete. configure.ac:6: You should run autoupdate. ../../lib/autoconf/lang.m4:125: AC_LANG_SAVE is expanded from... configure.ac:6: the top level becomes configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete. configure.ac:6: You should run autoupdate. lang.m4: AC_LANG_SAVE is expanded from... configure.ac:6: the top level This allows us to write tests for these diagnostics that don’t depend on the relationship between the source and build directories, and won’t break when unrelated patches change the line number of a macro definition. * lib/autoconf/functions.m4 (AC_REPLACE_FUNCS, _AC_REPLACE_FUNCS) (_AC_REPLACE_FUNC): Refactor into AC_REPLACE_FUNCS, _AC_REPLACE_FUNCS, _AC_REPLACE_FUNC_U, _AC_REPLACE_FUNC_L, _AC_REPLACE_FUNC_NL. Ensure that _AH_CHECK_FUNC and AC_LIBSOURCE are invoked unconditionally at m4 expansion time for each literal function name in the argument to AC_CHECK_FUNCS. Issue warnings about non-literal names. * tests/local.at (AT_CHECK_M4): Normalize backtrace lines from the output of AC_DIAGNOSE / m4_warn. (AT_CHECK_AUTOHEADER): Add arg EXPECTED-TMPLS giving a list of preprocessor macro names that should appear in the generated config.h.in. Use AT_CHECK_M4 to invoke autoheader. (_AT_CHECK_AC_MACRO, AT_CHECK_MACRO, AT_CHECK_AU_MACRO): Update uses of AT_CHECK_AUTOHEADER. * tests/fortran.at, tests/semantics.at, tests/tools.at * tests/torture.at: Update all uses of AT_CHECK_AUTOHEADER. * tests/semantics.at (AC_REPLACE_FUNCS test): Make somewhat more thorough, using new functionality of AT_CHECK_M4 and AT_CHECK_AUTOHEADER. Signed-off-by: Zack Weinberg <zackw@panix.com>
2020-06-29 18:55:39 -07:00
# AC_REPLACE_FUNCS has an AS_LITERAL_IF optimization; test both paths.
# Manual invocation of AH_TEMPLATE should only be necessary for functions
# whose names are hidden inside a shell variable at m4 expansion time.
AT_CONFIGURE_AC(
AC_REPLACE_FUNCS: invoke _AH_CHECK_FUNC and AC_LIBSOURCE unconditionally. While investigating something else, I noticed that AC_REPLACE_FUNCS calls _AH_CHECK_FUNC and AC_LIBSOURCE in the success branch of an AC_CHECK_FUNC. This doesn’t work; both of those are marker macros that need to be expanded unconditionally at m4 time so that traces (placed by autoheader and automake, respectively) will fire. In order to fix this while keeping the code readable, I would up doing a major refactor. There are now four internal macros implementing AC_REPLACE_FUNCS. _AC_REPLACE_FUNC_U is called unconditionally for every shell word in the list passed to AC_REPLACE_FUNCS, and does _AH_CHECK_FUNC + AC_LIBSOURCE if it can, or issues a warning if it can’t. (It could make sense to make this a public function, if we think shell variables in the AC_REPLACE_FUNCS list need to be supported long-term. I dunno if there’s a use case that can’t be handled by AC_REPLACE_FUNCS inside a shell conditional just as well.) _AC_REPLACE_FUNC_L and _AC_REPLACE_FUNC_NL implement the actual test performed for each function to be replaced; the difference is that _L (for literal) can only be used on a function whose name is known at m4 expansion time, _NL (nonliteral) works regardless. _AC_REPLACE_FUNCS, which already existed, handles looping either at m4 time or shell time as appropriate. AC_REPLACE_FUNCS remains a thin wrapper that runs _AC_REPLACE_FUNCS(m4_flatten([$1])). The _bulk_ of the patch is changes to the testsuite so that it notices the original bug. Specifically, AT_CHECK_AUTOHEADER now takes an argument which is a whitespace-separated list of preprocessor macro names that ought to appear in the generated config.h.in. This can be set to ‘ignore’ to skip the test, and unfortunately that’s what the “trivial” per-macro tests have to do (AT_CHECK_MACRO and friends), so coverage is not ideal, but it’s better than what we had. Also, AT_CHECK_M4 now normalizes the backtrace lines that appear in the output of an AC_DIAGNOSE, e.g. configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete. configure.ac:6: You should run autoupdate. ../../lib/autoconf/lang.m4:125: AC_LANG_SAVE is expanded from... configure.ac:6: the top level becomes configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete. configure.ac:6: You should run autoupdate. lang.m4: AC_LANG_SAVE is expanded from... configure.ac:6: the top level This allows us to write tests for these diagnostics that don’t depend on the relationship between the source and build directories, and won’t break when unrelated patches change the line number of a macro definition. * lib/autoconf/functions.m4 (AC_REPLACE_FUNCS, _AC_REPLACE_FUNCS) (_AC_REPLACE_FUNC): Refactor into AC_REPLACE_FUNCS, _AC_REPLACE_FUNCS, _AC_REPLACE_FUNC_U, _AC_REPLACE_FUNC_L, _AC_REPLACE_FUNC_NL. Ensure that _AH_CHECK_FUNC and AC_LIBSOURCE are invoked unconditionally at m4 expansion time for each literal function name in the argument to AC_CHECK_FUNCS. Issue warnings about non-literal names. * tests/local.at (AT_CHECK_M4): Normalize backtrace lines from the output of AC_DIAGNOSE / m4_warn. (AT_CHECK_AUTOHEADER): Add arg EXPECTED-TMPLS giving a list of preprocessor macro names that should appear in the generated config.h.in. Use AT_CHECK_M4 to invoke autoheader. (_AT_CHECK_AC_MACRO, AT_CHECK_MACRO, AT_CHECK_AU_MACRO): Update uses of AT_CHECK_AUTOHEADER. * tests/fortran.at, tests/semantics.at, tests/tools.at * tests/torture.at: Update all uses of AT_CHECK_AUTOHEADER. * tests/semantics.at (AC_REPLACE_FUNCS test): Make somewhat more thorough, using new functionality of AT_CHECK_M4 and AT_CHECK_AUTOHEADER. Signed-off-by: Zack Weinberg <zackw@panix.com>
2020-06-29 18:55:39 -07:00
[[AC_CONFIG_FILES([config.libobjs:config.in])
AC_REPLACE_FUNCS([printf autoconf_ftnirp])
funcs='fprintf autoconf_ftnirpf'
AH_TEMPLATE([HAVE_FPRINTF], [])
AH_TEMPLATE([HAVE_AUTOCONF_FTNIRPF], [])
AC_REPLACE_FUNCS([\
AC_REPLACE_FUNCS: invoke _AH_CHECK_FUNC and AC_LIBSOURCE unconditionally. While investigating something else, I noticed that AC_REPLACE_FUNCS calls _AH_CHECK_FUNC and AC_LIBSOURCE in the success branch of an AC_CHECK_FUNC. This doesn’t work; both of those are marker macros that need to be expanded unconditionally at m4 time so that traces (placed by autoheader and automake, respectively) will fire. In order to fix this while keeping the code readable, I would up doing a major refactor. There are now four internal macros implementing AC_REPLACE_FUNCS. _AC_REPLACE_FUNC_U is called unconditionally for every shell word in the list passed to AC_REPLACE_FUNCS, and does _AH_CHECK_FUNC + AC_LIBSOURCE if it can, or issues a warning if it can’t. (It could make sense to make this a public function, if we think shell variables in the AC_REPLACE_FUNCS list need to be supported long-term. I dunno if there’s a use case that can’t be handled by AC_REPLACE_FUNCS inside a shell conditional just as well.) _AC_REPLACE_FUNC_L and _AC_REPLACE_FUNC_NL implement the actual test performed for each function to be replaced; the difference is that _L (for literal) can only be used on a function whose name is known at m4 expansion time, _NL (nonliteral) works regardless. _AC_REPLACE_FUNCS, which already existed, handles looping either at m4 time or shell time as appropriate. AC_REPLACE_FUNCS remains a thin wrapper that runs _AC_REPLACE_FUNCS(m4_flatten([$1])). The _bulk_ of the patch is changes to the testsuite so that it notices the original bug. Specifically, AT_CHECK_AUTOHEADER now takes an argument which is a whitespace-separated list of preprocessor macro names that ought to appear in the generated config.h.in. This can be set to ‘ignore’ to skip the test, and unfortunately that’s what the “trivial” per-macro tests have to do (AT_CHECK_MACRO and friends), so coverage is not ideal, but it’s better than what we had. Also, AT_CHECK_M4 now normalizes the backtrace lines that appear in the output of an AC_DIAGNOSE, e.g. configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete. configure.ac:6: You should run autoupdate. ../../lib/autoconf/lang.m4:125: AC_LANG_SAVE is expanded from... configure.ac:6: the top level becomes configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete. configure.ac:6: You should run autoupdate. lang.m4: AC_LANG_SAVE is expanded from... configure.ac:6: the top level This allows us to write tests for these diagnostics that don’t depend on the relationship between the source and build directories, and won’t break when unrelated patches change the line number of a macro definition. * lib/autoconf/functions.m4 (AC_REPLACE_FUNCS, _AC_REPLACE_FUNCS) (_AC_REPLACE_FUNC): Refactor into AC_REPLACE_FUNCS, _AC_REPLACE_FUNCS, _AC_REPLACE_FUNC_U, _AC_REPLACE_FUNC_L, _AC_REPLACE_FUNC_NL. Ensure that _AH_CHECK_FUNC and AC_LIBSOURCE are invoked unconditionally at m4 expansion time for each literal function name in the argument to AC_CHECK_FUNCS. Issue warnings about non-literal names. * tests/local.at (AT_CHECK_M4): Normalize backtrace lines from the output of AC_DIAGNOSE / m4_warn. (AT_CHECK_AUTOHEADER): Add arg EXPECTED-TMPLS giving a list of preprocessor macro names that should appear in the generated config.h.in. Use AT_CHECK_M4 to invoke autoheader. (_AT_CHECK_AC_MACRO, AT_CHECK_MACRO, AT_CHECK_AU_MACRO): Update uses of AT_CHECK_AUTOHEADER. * tests/fortran.at, tests/semantics.at, tests/tools.at * tests/torture.at: Update all uses of AT_CHECK_AUTOHEADER. * tests/semantics.at (AC_REPLACE_FUNCS test): Make somewhat more thorough, using new functionality of AT_CHECK_M4 and AT_CHECK_AUTOHEADER. Signed-off-by: Zack Weinberg <zackw@panix.com>
2020-06-29 18:55:39 -07:00
$funcs \
fopen \
autoconf_nepof])
AS@&t@_UNSET([funcs])]])
AT_CHECK_AUTOCONF([], [], [],
[[configure.ac:9: warning: AC_REPLACE_FUNCS($funcs): you should use literals
functions.m4: AC_REPLACE_FUNCS is expanded from...
configure.ac:9: the top level
]])
AT_CHECK_AUTOHEADER([], [
HAVE_AUTOCONF_FTNIRP
HAVE_AUTOCONF_FTNIRPF
HAVE_AUTOCONF_NEPOF
HAVE_FOPEN
HAVE_FPRINTF
HAVE_PRINTF
Disable all warnings when running autoconf as a subprocess. autoheader and autoscan both run autoconf in trace mode, and autoheader makes a point of passing down the warnings options. This means autoheader prints warnings that a regular invocation of autoconf would also print, so in the common case where both are being run by autoreconf, the warnings are duplicated. autoscan doesn’t pass down warnings options but it _does_ leave the WARNINGS environment variable alone, which means it may issue completely spurious warnings because the configure script is still under construction. Change this so that both programs disable all warnings for the subsidiary invocation of autoconf, by not passing any warnings options themselves, and by setting the WARNINGS environment variable to “none” for the subprocess. For this to work correctly, the ‘args: --warnings syntax’ line has to be removed from autom4te.cfg (m4sugar section). Since syntax warnings are on by default anyway, the sole effect of this is to allow WARNINGS=none to turn off syntax warnings. The test suite changes are all to remove expectations of duplicate diagnostics from autoheader. * bin/autoheader.in: Do not pass warnings options down to subsidiary autoconf, and set WARNINGS=none in the environment for that process. * bin/autoscan.in: Set WARNINGS=none in the environment for subsidiary autoconf. * lib/autom4te.in (M4sugar): Remove ‘--warnings syntax’. * tests/semantics.at, tests/torture.at: No longer expect various diagnostics from autoheader as well as autoconf.
2020-09-21 16:59:46 -04:00
])
AT_CHECK_CONFIGURE
AT_CHECK_ENV
AT_CHECK_DEFINES(
[/* #undef HAVE_AUTOCONF_FTNIRP */
/* #undef HAVE_AUTOCONF_FTNIRPF */
AC_REPLACE_FUNCS: invoke _AH_CHECK_FUNC and AC_LIBSOURCE unconditionally. While investigating something else, I noticed that AC_REPLACE_FUNCS calls _AH_CHECK_FUNC and AC_LIBSOURCE in the success branch of an AC_CHECK_FUNC. This doesn’t work; both of those are marker macros that need to be expanded unconditionally at m4 time so that traces (placed by autoheader and automake, respectively) will fire. In order to fix this while keeping the code readable, I would up doing a major refactor. There are now four internal macros implementing AC_REPLACE_FUNCS. _AC_REPLACE_FUNC_U is called unconditionally for every shell word in the list passed to AC_REPLACE_FUNCS, and does _AH_CHECK_FUNC + AC_LIBSOURCE if it can, or issues a warning if it can’t. (It could make sense to make this a public function, if we think shell variables in the AC_REPLACE_FUNCS list need to be supported long-term. I dunno if there’s a use case that can’t be handled by AC_REPLACE_FUNCS inside a shell conditional just as well.) _AC_REPLACE_FUNC_L and _AC_REPLACE_FUNC_NL implement the actual test performed for each function to be replaced; the difference is that _L (for literal) can only be used on a function whose name is known at m4 expansion time, _NL (nonliteral) works regardless. _AC_REPLACE_FUNCS, which already existed, handles looping either at m4 time or shell time as appropriate. AC_REPLACE_FUNCS remains a thin wrapper that runs _AC_REPLACE_FUNCS(m4_flatten([$1])). The _bulk_ of the patch is changes to the testsuite so that it notices the original bug. Specifically, AT_CHECK_AUTOHEADER now takes an argument which is a whitespace-separated list of preprocessor macro names that ought to appear in the generated config.h.in. This can be set to ‘ignore’ to skip the test, and unfortunately that’s what the “trivial” per-macro tests have to do (AT_CHECK_MACRO and friends), so coverage is not ideal, but it’s better than what we had. Also, AT_CHECK_M4 now normalizes the backtrace lines that appear in the output of an AC_DIAGNOSE, e.g. configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete. configure.ac:6: You should run autoupdate. ../../lib/autoconf/lang.m4:125: AC_LANG_SAVE is expanded from... configure.ac:6: the top level becomes configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete. configure.ac:6: You should run autoupdate. lang.m4: AC_LANG_SAVE is expanded from... configure.ac:6: the top level This allows us to write tests for these diagnostics that don’t depend on the relationship between the source and build directories, and won’t break when unrelated patches change the line number of a macro definition. * lib/autoconf/functions.m4 (AC_REPLACE_FUNCS, _AC_REPLACE_FUNCS) (_AC_REPLACE_FUNC): Refactor into AC_REPLACE_FUNCS, _AC_REPLACE_FUNCS, _AC_REPLACE_FUNC_U, _AC_REPLACE_FUNC_L, _AC_REPLACE_FUNC_NL. Ensure that _AH_CHECK_FUNC and AC_LIBSOURCE are invoked unconditionally at m4 expansion time for each literal function name in the argument to AC_CHECK_FUNCS. Issue warnings about non-literal names. * tests/local.at (AT_CHECK_M4): Normalize backtrace lines from the output of AC_DIAGNOSE / m4_warn. (AT_CHECK_AUTOHEADER): Add arg EXPECTED-TMPLS giving a list of preprocessor macro names that should appear in the generated config.h.in. Use AT_CHECK_M4 to invoke autoheader. (_AT_CHECK_AC_MACRO, AT_CHECK_MACRO, AT_CHECK_AU_MACRO): Update uses of AT_CHECK_AUTOHEADER. * tests/fortran.at, tests/semantics.at, tests/tools.at * tests/torture.at: Update all uses of AT_CHECK_AUTOHEADER. * tests/semantics.at (AC_REPLACE_FUNCS test): Make somewhat more thorough, using new functionality of AT_CHECK_M4 and AT_CHECK_AUTOHEADER. Signed-off-by: Zack Weinberg <zackw@panix.com>
2020-06-29 18:55:39 -07:00
/* #undef HAVE_AUTOCONF_NEPOF */
#define HAVE_FOPEN 1
#define HAVE_FPRINTF 1
#define HAVE_PRINTF 1
])
AC_REPLACE_FUNCS: invoke _AH_CHECK_FUNC and AC_LIBSOURCE unconditionally. While investigating something else, I noticed that AC_REPLACE_FUNCS calls _AH_CHECK_FUNC and AC_LIBSOURCE in the success branch of an AC_CHECK_FUNC. This doesn’t work; both of those are marker macros that need to be expanded unconditionally at m4 time so that traces (placed by autoheader and automake, respectively) will fire. In order to fix this while keeping the code readable, I would up doing a major refactor. There are now four internal macros implementing AC_REPLACE_FUNCS. _AC_REPLACE_FUNC_U is called unconditionally for every shell word in the list passed to AC_REPLACE_FUNCS, and does _AH_CHECK_FUNC + AC_LIBSOURCE if it can, or issues a warning if it can’t. (It could make sense to make this a public function, if we think shell variables in the AC_REPLACE_FUNCS list need to be supported long-term. I dunno if there’s a use case that can’t be handled by AC_REPLACE_FUNCS inside a shell conditional just as well.) _AC_REPLACE_FUNC_L and _AC_REPLACE_FUNC_NL implement the actual test performed for each function to be replaced; the difference is that _L (for literal) can only be used on a function whose name is known at m4 expansion time, _NL (nonliteral) works regardless. _AC_REPLACE_FUNCS, which already existed, handles looping either at m4 time or shell time as appropriate. AC_REPLACE_FUNCS remains a thin wrapper that runs _AC_REPLACE_FUNCS(m4_flatten([$1])). The _bulk_ of the patch is changes to the testsuite so that it notices the original bug. Specifically, AT_CHECK_AUTOHEADER now takes an argument which is a whitespace-separated list of preprocessor macro names that ought to appear in the generated config.h.in. This can be set to ‘ignore’ to skip the test, and unfortunately that’s what the “trivial” per-macro tests have to do (AT_CHECK_MACRO and friends), so coverage is not ideal, but it’s better than what we had. Also, AT_CHECK_M4 now normalizes the backtrace lines that appear in the output of an AC_DIAGNOSE, e.g. configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete. configure.ac:6: You should run autoupdate. ../../lib/autoconf/lang.m4:125: AC_LANG_SAVE is expanded from... configure.ac:6: the top level becomes configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete. configure.ac:6: You should run autoupdate. lang.m4: AC_LANG_SAVE is expanded from... configure.ac:6: the top level This allows us to write tests for these diagnostics that don’t depend on the relationship between the source and build directories, and won’t break when unrelated patches change the line number of a macro definition. * lib/autoconf/functions.m4 (AC_REPLACE_FUNCS, _AC_REPLACE_FUNCS) (_AC_REPLACE_FUNC): Refactor into AC_REPLACE_FUNCS, _AC_REPLACE_FUNCS, _AC_REPLACE_FUNC_U, _AC_REPLACE_FUNC_L, _AC_REPLACE_FUNC_NL. Ensure that _AH_CHECK_FUNC and AC_LIBSOURCE are invoked unconditionally at m4 expansion time for each literal function name in the argument to AC_CHECK_FUNCS. Issue warnings about non-literal names. * tests/local.at (AT_CHECK_M4): Normalize backtrace lines from the output of AC_DIAGNOSE / m4_warn. (AT_CHECK_AUTOHEADER): Add arg EXPECTED-TMPLS giving a list of preprocessor macro names that should appear in the generated config.h.in. Use AT_CHECK_M4 to invoke autoheader. (_AT_CHECK_AC_MACRO, AT_CHECK_MACRO, AT_CHECK_AU_MACRO): Update uses of AT_CHECK_AUTOHEADER. * tests/fortran.at, tests/semantics.at, tests/tools.at * tests/torture.at: Update all uses of AT_CHECK_AUTOHEADER. * tests/semantics.at (AC_REPLACE_FUNCS test): Make somewhat more thorough, using new functionality of AT_CHECK_M4 and AT_CHECK_AUTOHEADER. Signed-off-by: Zack Weinberg <zackw@panix.com>
2020-06-29 18:55:39 -07:00
AT_CHECK([sed 's/ */ /g;s/^ //;s/ $//' config.libobjs | tr ' ' '
' | sort], [],
[${LIBOBJDIR}autoconf_ftnirp$U.o
${LIBOBJDIR}autoconf_ftnirpf$U.o
${LIBOBJDIR}autoconf_nepof$U.o
])
AT_CLEANUP
# AC_CHECK_HEADERS
# ----------------
# Check that it performs the correct actions:
# Must define HAVE_STDIO_H, but not HAVE_AUTOCONF_IO_H.
AT_SETUP([AC_CHECK_HEADERS])
AT_DATA([autoconf_io.h],
[blah blah
])
AT_CONFIGURE_AC([AC_CHECK_HEADERS(stdio.h autoconf_io.h)])
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-12 14:59:56 -04:00
AT_CHECK_AUTOCONF
AC_REPLACE_FUNCS: invoke _AH_CHECK_FUNC and AC_LIBSOURCE unconditionally. While investigating something else, I noticed that AC_REPLACE_FUNCS calls _AH_CHECK_FUNC and AC_LIBSOURCE in the success branch of an AC_CHECK_FUNC. This doesn’t work; both of those are marker macros that need to be expanded unconditionally at m4 time so that traces (placed by autoheader and automake, respectively) will fire. In order to fix this while keeping the code readable, I would up doing a major refactor. There are now four internal macros implementing AC_REPLACE_FUNCS. _AC_REPLACE_FUNC_U is called unconditionally for every shell word in the list passed to AC_REPLACE_FUNCS, and does _AH_CHECK_FUNC + AC_LIBSOURCE if it can, or issues a warning if it can’t. (It could make sense to make this a public function, if we think shell variables in the AC_REPLACE_FUNCS list need to be supported long-term. I dunno if there’s a use case that can’t be handled by AC_REPLACE_FUNCS inside a shell conditional just as well.) _AC_REPLACE_FUNC_L and _AC_REPLACE_FUNC_NL implement the actual test performed for each function to be replaced; the difference is that _L (for literal) can only be used on a function whose name is known at m4 expansion time, _NL (nonliteral) works regardless. _AC_REPLACE_FUNCS, which already existed, handles looping either at m4 time or shell time as appropriate. AC_REPLACE_FUNCS remains a thin wrapper that runs _AC_REPLACE_FUNCS(m4_flatten([$1])). The _bulk_ of the patch is changes to the testsuite so that it notices the original bug. Specifically, AT_CHECK_AUTOHEADER now takes an argument which is a whitespace-separated list of preprocessor macro names that ought to appear in the generated config.h.in. This can be set to ‘ignore’ to skip the test, and unfortunately that’s what the “trivial” per-macro tests have to do (AT_CHECK_MACRO and friends), so coverage is not ideal, but it’s better than what we had. Also, AT_CHECK_M4 now normalizes the backtrace lines that appear in the output of an AC_DIAGNOSE, e.g. configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete. configure.ac:6: You should run autoupdate. ../../lib/autoconf/lang.m4:125: AC_LANG_SAVE is expanded from... configure.ac:6: the top level becomes configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete. configure.ac:6: You should run autoupdate. lang.m4: AC_LANG_SAVE is expanded from... configure.ac:6: the top level This allows us to write tests for these diagnostics that don’t depend on the relationship between the source and build directories, and won’t break when unrelated patches change the line number of a macro definition. * lib/autoconf/functions.m4 (AC_REPLACE_FUNCS, _AC_REPLACE_FUNCS) (_AC_REPLACE_FUNC): Refactor into AC_REPLACE_FUNCS, _AC_REPLACE_FUNCS, _AC_REPLACE_FUNC_U, _AC_REPLACE_FUNC_L, _AC_REPLACE_FUNC_NL. Ensure that _AH_CHECK_FUNC and AC_LIBSOURCE are invoked unconditionally at m4 expansion time for each literal function name in the argument to AC_CHECK_FUNCS. Issue warnings about non-literal names. * tests/local.at (AT_CHECK_M4): Normalize backtrace lines from the output of AC_DIAGNOSE / m4_warn. (AT_CHECK_AUTOHEADER): Add arg EXPECTED-TMPLS giving a list of preprocessor macro names that should appear in the generated config.h.in. Use AT_CHECK_M4 to invoke autoheader. (_AT_CHECK_AC_MACRO, AT_CHECK_MACRO, AT_CHECK_AU_MACRO): Update uses of AT_CHECK_AUTOHEADER. * tests/fortran.at, tests/semantics.at, tests/tools.at * tests/torture.at: Update all uses of AT_CHECK_AUTOHEADER. * tests/semantics.at (AC_REPLACE_FUNCS test): Make somewhat more thorough, using new functionality of AT_CHECK_M4 and AT_CHECK_AUTOHEADER. Signed-off-by: Zack Weinberg <zackw@panix.com>
2020-06-29 18:55:39 -07:00
AT_CHECK_AUTOHEADER([], [
HAVE_AUTOCONF_IO_H
HAVE_INTTYPES_H
HAVE_STDINT_H
HAVE_STDIO_H
HAVE_STDLIB_H
HAVE_STRINGS_H
HAVE_STRING_H
HAVE_SYS_STAT_H
HAVE_SYS_TYPES_H
HAVE_UNISTD_H
STDC_HEADERS
])
AT_CHECK_CONFIGURE([CPPFLAGS=-I.])
AT_CHECK_ENV
AT_CHECK_DEFINES(
[/* #undef HAVE_AUTOCONF_IO_H */
#define HAVE_STDIO_H 1
])
AT_CLEANUP
# AC_CHECK_HEADERS_OLD
# --------------------
# Check that it performs the correct actions:
# Must not check prerequisites, hence define header2.h
AT_SETUP([AC_CHECK_HEADERS (preprocessor test)])
AT_DATA([header1.h],
[typedef int foo;
])
AT_DATA([header2.h],
[typedef foo bar;
])
Consistently expand macros in whitespace-separated lists. Several of the most commonly used Autoconf macros (starting with AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list of symbols as their primary argument. It would abstractly be best if this list were _not_ subject to M4 macro expansion, in case there’s a collision between a M4 macro name and something to be looked for. However, we have historically not been careful about this, and there’s been reports of configure scripts using ‘dnl’ to write comments inside the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre shell syntax errors. Also, the macro expansion behavior is not consistent among all of the macros that take whitespace-separated lists, nor is it consistent between autoconf and autoheader. Address this by introducing a new m4sugar macro, currently called ‘m4_validate_w’ (I’m open to suggestions for better names). Here’s its documentation comment: | m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])), | but if that is not the same as just m4_normalize([STRING]), | issue a warning. The text of the warning is | configure.ac:N: warning: whitespace-separated-list contains macros; | configure.ac:N: in a future version of Autoconf they will not be expanded If the unexpanded form of the string contains the token ‘dnl’ then there’s an additional line: | configure.ac:N: note: ‘dnl’ is a macro All of the public macros that take a whitespace-separated list of symbols are changed to pass that argument through m4_validate_w before doing anything else with it, and the test suite is updated to verify consistent behavior for every last one of them. This addresses Savannah issues #110210 and #110211, and the harmless but annoying autoheader behavior described at https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html . In order to avoid expanding relatively expensive m4sugar macros multiple times per top-level macro invocation, several of the affected Autoconf macros are restructured along the same lines as I did for AC_REPLACE_FUNCS in the previous patch. * lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE) (AC_REPLACE_FUNCS) * lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES) * lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE) * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through m4_validate_w before use. * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers _AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C. (AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE. (AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers _AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C. * lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize. * tests/semantics.at: Add tests for expansion of M4 macros in whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
AT_CONFIGURE_AC([[AC_CHECK_HEADERS([header2.h], [], [], [-])]])
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-12 14:59:56 -04:00
AT_CHECK_AUTOCONF([], 0, [],
Consistently expand macros in whitespace-separated lists. Several of the most commonly used Autoconf macros (starting with AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list of symbols as their primary argument. It would abstractly be best if this list were _not_ subject to M4 macro expansion, in case there’s a collision between a M4 macro name and something to be looked for. However, we have historically not been careful about this, and there’s been reports of configure scripts using ‘dnl’ to write comments inside the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre shell syntax errors. Also, the macro expansion behavior is not consistent among all of the macros that take whitespace-separated lists, nor is it consistent between autoconf and autoheader. Address this by introducing a new m4sugar macro, currently called ‘m4_validate_w’ (I’m open to suggestions for better names). Here’s its documentation comment: | m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])), | but if that is not the same as just m4_normalize([STRING]), | issue a warning. The text of the warning is | configure.ac:N: warning: whitespace-separated-list contains macros; | configure.ac:N: in a future version of Autoconf they will not be expanded If the unexpanded form of the string contains the token ‘dnl’ then there’s an additional line: | configure.ac:N: note: ‘dnl’ is a macro All of the public macros that take a whitespace-separated list of symbols are changed to pass that argument through m4_validate_w before doing anything else with it, and the test suite is updated to verify consistent behavior for every last one of them. This addresses Savannah issues #110210 and #110211, and the harmless but annoying autoheader behavior described at https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html . In order to avoid expanding relatively expensive m4sugar macros multiple times per top-level macro invocation, several of the affected Autoconf macros are restructured along the same lines as I did for AC_REPLACE_FUNCS in the previous patch. * lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE) (AC_REPLACE_FUNCS) * lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES) * lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE) * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through m4_validate_w before use. * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers _AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C. (AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE. (AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers _AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C. * lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize. * tests/semantics.at: Add tests for expansion of M4 macros in whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
[[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
configure.ac:4: no prerequisites. If you truly need to test whether
configure.ac:4: something passes the preprocessor but not the compiler,
configure.ac:4: use AC_PREPROC_IFELSE.)
Consistently expand macros in whitespace-separated lists. Several of the most commonly used Autoconf macros (starting with AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list of symbols as their primary argument. It would abstractly be best if this list were _not_ subject to M4 macro expansion, in case there’s a collision between a M4 macro name and something to be looked for. However, we have historically not been careful about this, and there’s been reports of configure scripts using ‘dnl’ to write comments inside the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre shell syntax errors. Also, the macro expansion behavior is not consistent among all of the macros that take whitespace-separated lists, nor is it consistent between autoconf and autoheader. Address this by introducing a new m4sugar macro, currently called ‘m4_validate_w’ (I’m open to suggestions for better names). Here’s its documentation comment: | m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])), | but if that is not the same as just m4_normalize([STRING]), | issue a warning. The text of the warning is | configure.ac:N: warning: whitespace-separated-list contains macros; | configure.ac:N: in a future version of Autoconf they will not be expanded If the unexpanded form of the string contains the token ‘dnl’ then there’s an additional line: | configure.ac:N: note: ‘dnl’ is a macro All of the public macros that take a whitespace-separated list of symbols are changed to pass that argument through m4_validate_w before doing anything else with it, and the test suite is updated to verify consistent behavior for every last one of them. This addresses Savannah issues #110210 and #110211, and the harmless but annoying autoheader behavior described at https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html . In order to avoid expanding relatively expensive m4sugar macros multiple times per top-level macro invocation, several of the affected Autoconf macros are restructured along the same lines as I did for AC_REPLACE_FUNCS in the previous patch. * lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE) (AC_REPLACE_FUNCS) * lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES) * lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE) * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through m4_validate_w before use. * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers _AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C. (AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE. (AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers _AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C. * lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize. * tests/semantics.at: Add tests for expansion of M4 macros in whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
headers.m4: _AC_CHECK_HEADER_PREPROC is expanded from...
headers.m4: AC_CHECK_HEADER is expanded from...
headers.m4: AC_CHECK_HEADERS is expanded from...
configure.ac:4: the top level
Consistently expand macros in whitespace-separated lists. Several of the most commonly used Autoconf macros (starting with AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list of symbols as their primary argument. It would abstractly be best if this list were _not_ subject to M4 macro expansion, in case there’s a collision between a M4 macro name and something to be looked for. However, we have historically not been careful about this, and there’s been reports of configure scripts using ‘dnl’ to write comments inside the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre shell syntax errors. Also, the macro expansion behavior is not consistent among all of the macros that take whitespace-separated lists, nor is it consistent between autoconf and autoheader. Address this by introducing a new m4sugar macro, currently called ‘m4_validate_w’ (I’m open to suggestions for better names). Here’s its documentation comment: | m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])), | but if that is not the same as just m4_normalize([STRING]), | issue a warning. The text of the warning is | configure.ac:N: warning: whitespace-separated-list contains macros; | configure.ac:N: in a future version of Autoconf they will not be expanded If the unexpanded form of the string contains the token ‘dnl’ then there’s an additional line: | configure.ac:N: note: ‘dnl’ is a macro All of the public macros that take a whitespace-separated list of symbols are changed to pass that argument through m4_validate_w before doing anything else with it, and the test suite is updated to verify consistent behavior for every last one of them. This addresses Savannah issues #110210 and #110211, and the harmless but annoying autoheader behavior described at https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html . In order to avoid expanding relatively expensive m4sugar macros multiple times per top-level macro invocation, several of the affected Autoconf macros are restructured along the same lines as I did for AC_REPLACE_FUNCS in the previous patch. * lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE) (AC_REPLACE_FUNCS) * lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES) * lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE) * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through m4_validate_w before use. * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers _AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C. (AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE. (AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers _AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C. * lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize. * tests/semantics.at: Add tests for expansion of M4 macros in whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
]])
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-12 14:59:56 -04:00
AT_CHECK_AUTOHEADER([-W no-obsolete], [HAVE_HEADER2_H])
AT_CHECK_CONFIGURE([CPPFLAGS=-I.])
AT_CHECK_ENV
AT_CHECK_DEFINES(
[#define HAVE_HEADER2_H 1
])
AT_CLEANUP
# AC_CHECK_HEADERS_NEW
# --------------------
# Check that it performs the correct actions:
# Must check prerequisites, hence define header2.h but not header3.h
AT_SETUP([AC_CHECK_HEADERS (compiler test)])
AT_DATA([header1.h],
[typedef int foo;
])
AT_DATA([header2.h],
[typedef foo bar;
])
AT_DATA([header3.h],
[typedef bar wow;
])
AT_CONFIGURE_AC(
[AC_CHECK_HEADERS(header2.h header3.h, [], [], [[@%:@include "header1.h"]])])
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-12 14:59:56 -04:00
AT_CHECK_AUTOCONF
AC_REPLACE_FUNCS: invoke _AH_CHECK_FUNC and AC_LIBSOURCE unconditionally. While investigating something else, I noticed that AC_REPLACE_FUNCS calls _AH_CHECK_FUNC and AC_LIBSOURCE in the success branch of an AC_CHECK_FUNC. This doesn’t work; both of those are marker macros that need to be expanded unconditionally at m4 time so that traces (placed by autoheader and automake, respectively) will fire. In order to fix this while keeping the code readable, I would up doing a major refactor. There are now four internal macros implementing AC_REPLACE_FUNCS. _AC_REPLACE_FUNC_U is called unconditionally for every shell word in the list passed to AC_REPLACE_FUNCS, and does _AH_CHECK_FUNC + AC_LIBSOURCE if it can, or issues a warning if it can’t. (It could make sense to make this a public function, if we think shell variables in the AC_REPLACE_FUNCS list need to be supported long-term. I dunno if there’s a use case that can’t be handled by AC_REPLACE_FUNCS inside a shell conditional just as well.) _AC_REPLACE_FUNC_L and _AC_REPLACE_FUNC_NL implement the actual test performed for each function to be replaced; the difference is that _L (for literal) can only be used on a function whose name is known at m4 expansion time, _NL (nonliteral) works regardless. _AC_REPLACE_FUNCS, which already existed, handles looping either at m4 time or shell time as appropriate. AC_REPLACE_FUNCS remains a thin wrapper that runs _AC_REPLACE_FUNCS(m4_flatten([$1])). The _bulk_ of the patch is changes to the testsuite so that it notices the original bug. Specifically, AT_CHECK_AUTOHEADER now takes an argument which is a whitespace-separated list of preprocessor macro names that ought to appear in the generated config.h.in. This can be set to ‘ignore’ to skip the test, and unfortunately that’s what the “trivial” per-macro tests have to do (AT_CHECK_MACRO and friends), so coverage is not ideal, but it’s better than what we had. Also, AT_CHECK_M4 now normalizes the backtrace lines that appear in the output of an AC_DIAGNOSE, e.g. configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete. configure.ac:6: You should run autoupdate. ../../lib/autoconf/lang.m4:125: AC_LANG_SAVE is expanded from... configure.ac:6: the top level becomes configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete. configure.ac:6: You should run autoupdate. lang.m4: AC_LANG_SAVE is expanded from... configure.ac:6: the top level This allows us to write tests for these diagnostics that don’t depend on the relationship between the source and build directories, and won’t break when unrelated patches change the line number of a macro definition. * lib/autoconf/functions.m4 (AC_REPLACE_FUNCS, _AC_REPLACE_FUNCS) (_AC_REPLACE_FUNC): Refactor into AC_REPLACE_FUNCS, _AC_REPLACE_FUNCS, _AC_REPLACE_FUNC_U, _AC_REPLACE_FUNC_L, _AC_REPLACE_FUNC_NL. Ensure that _AH_CHECK_FUNC and AC_LIBSOURCE are invoked unconditionally at m4 expansion time for each literal function name in the argument to AC_CHECK_FUNCS. Issue warnings about non-literal names. * tests/local.at (AT_CHECK_M4): Normalize backtrace lines from the output of AC_DIAGNOSE / m4_warn. (AT_CHECK_AUTOHEADER): Add arg EXPECTED-TMPLS giving a list of preprocessor macro names that should appear in the generated config.h.in. Use AT_CHECK_M4 to invoke autoheader. (_AT_CHECK_AC_MACRO, AT_CHECK_MACRO, AT_CHECK_AU_MACRO): Update uses of AT_CHECK_AUTOHEADER. * tests/fortran.at, tests/semantics.at, tests/tools.at * tests/torture.at: Update all uses of AT_CHECK_AUTOHEADER. * tests/semantics.at (AC_REPLACE_FUNCS test): Make somewhat more thorough, using new functionality of AT_CHECK_M4 and AT_CHECK_AUTOHEADER. Signed-off-by: Zack Weinberg <zackw@panix.com>
2020-06-29 18:55:39 -07:00
AT_CHECK_AUTOHEADER([], [
HAVE_HEADER2_H
HAVE_HEADER3_H
])
AT_CHECK_CONFIGURE([CPPFLAGS=-I.])
AT_CHECK_ENV
AT_CHECK_DEFINES(
[#define HAVE_HEADER2_H 1
/* #undef HAVE_HEADER3_H */
])
AT_CLEANUP
# AC_CHECK_MEMBER
# ---------------
# Check that it performs the correct actions.
# Must define HAVE_STRUCT_YES_S_YES, but not HAVE_STRUCT_YES_S_NO.
AT_CHECK_MACRO([AC_CHECK_MEMBER],
[[AC_CHECK_MEMBER([struct yes_s.yes],
[AC_DEFINE([HAVE_STRUCT_YES_S_YES], [1],
[Define to 1 if `yes' is a member of `struct yes_s'.])],,
[struct sub { int x; };
struct yes_s { int yes; struct sub substruct; };])
AC_CHECK_MEMBER([struct yes_s.no],
[AC_DEFINE([HAVE_STRUCT_YES_S_NO], [1],
[Define to 1 if `no' is a member of `struct yes_s'.])],,
[struct sub { int x; };
struct yes_s { int yes; struct sub substruct; };])
AC_CHECK_MEMBER([struct yes_s.substruct],
[AC_DEFINE([HAVE_STRUCT_YES_S_SUBSTRUCT], [1],
[Define to 1 if `substruct' is a member of `struct yes_s'.])],,
[struct sub { int x; };
struct yes_s { int yes; struct sub substruct; };])]],
[AT_CHECK_DEFINES(
[/* #undef HAVE_STRUCT_YES_S_NO */
#define HAVE_STRUCT_YES_S_SUBSTRUCT 1
#define HAVE_STRUCT_YES_S_YES 1
])])
# AC_CHECK_MEMBERS
# ----------------
# Check that it performs the correct actions.
# Must define HAVE_STRUCT_YES_S_YES, but not HAVE_STRUCT_YES_S_NO.
AT_CHECK_MACRO([AC_CHECK_MEMBERS],
[[AC_CHECK_MEMBERS([struct yes_s.yes, struct yes_s.no, struct yes_s.substruct],,,
[struct sub { int x; };
struct yes_s { int yes; struct sub substruct; };])]],
[AT_CHECK_DEFINES(
[/* #undef HAVE_STRUCT_YES_S_NO */
#define HAVE_STRUCT_YES_S_SUBSTRUCT 1
#define HAVE_STRUCT_YES_S_YES 1
])
AT_CHECK([grep 'yes.*member of.*yes_s' config.h], [], [ignore])
])
2004-03-15 22:00:05 +00:00
# AC_CHECK_ALIGNOF
# ----------------
AT_CHECK_MACRO: test C++ as well as C, cross as well as native 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’.
2020-10-14 11:21:30 -04:00
AT_CHECK_MACRO([AC_CHECK_ALIGNOF],
2004-03-15 22:00:05 +00:00
[[AC_CHECK_ALIGNOF(char)
AC_CHECK_ALIGNOF(charchar,
[[#include <stddef.h>
#include <stdio.h>
typedef char charchar[2];]])
AC_CHECK_ALIGNOF(charcharchar)
]],
[AT_CHECK_DEFINES(
[#define ALIGNOF_CHAR 1
#define ALIGNOF_CHARCHAR 1
#define ALIGNOF_CHARCHARCHAR 0
])])
# AC_CHECK_ALIGNOF struct
# -----------------------
AT_CHECK_MACRO: test C++ as well as C, cross as well as native 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’.
2020-10-14 11:21:30 -04:00
AT_CHECK_MACRO([AC_CHECK_ALIGNOF struct],
[[AC_CHECK_ALIGNOF([struct { char c; }])
AC_CHECK_ALIGNOF([struct nosuchstruct])
]],
[AT_CHECK([[grep "#define ALIGNOF_STRUCT___CHAR_C___ [1-9]" config.h]],
0, ignore)
AT_CHECK([[grep "#define ALIGNOF_STRUCT_NOSUCHSTRUCT 0" config.h]],
0, ignore)
])
# AC_CHECK_SIZEOF
# ---------------
AT_CHECK_MACRO: test C++ as well as C, cross as well as native 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’.
2020-10-14 11:21:30 -04:00
AT_CHECK_MACRO([AC_CHECK_SIZEOF],
[[AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(charchar,,
[[#include <stdio.h>
typedef char charchar[2];]])
AC_CHECK_SIZEOF(charcharchar)
]],
[AT_CHECK_DEFINES(
[#define SIZEOF_CHAR 1
#define SIZEOF_CHARCHAR 2
#define SIZEOF_CHARCHARCHAR 0
])])
2006-03-17 18:03:01 +00:00
# AC_CHECK_SIZEOF struct
# ----------------------
AT_CHECK_MACRO: test C++ as well as C, cross as well as native 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’.
2020-10-14 11:21:30 -04:00
AT_CHECK_MACRO([AC_CHECK_SIZEOF struct],
[[AC_C_CONST
AC_CHECK_SIZEOF([struct x], [], [struct x { char c; int x; };])
AC_CHECK_SIZEOF([const struct x], [], [struct x { const char *p; int x; };])
AC_CHECK_SIZEOF([struct nosuchstruct])
# Taken from autoconf.texi:Generic Compiler Characteristics.
AC_CHECK_SIZEOF([int *])
]],
[AT_CHECK([[grep "#define SIZEOF_STRUCT_X [1-9]" config.h]],
0, ignore)
AT_CHECK([[grep "#define SIZEOF_CONST_STRUCT_X [1-9]" config.h]],
0, ignore)
AT_CHECK([[grep "#define SIZEOF_STRUCT_NOSUCHSTRUCT 0" config.h]],
0, ignore)
AT_CHECK([[grep "#define SIZEOF_INT_P [1-9]" config.h]],
0, ignore)
])
# AC_CHECK_TYPES
# --------------
# Check that it performs the correct actions.
# Must define HAVE_STRUCT_YES_S, HAVE_INT, but not HAVE_STRUCT_NO_S.
# `int' and `struct yes_s' are both checked to test both the compiler
# builtin types, and defined types.
AT_CHECK_MACRO([AC_CHECK_TYPES],
[[AC_CHECK_TYPES([int, struct yes_s, struct no_s],,,
[struct yes_s { int yes ;} ;])]],
[AT_CHECK_DEFINES(
[#define HAVE_INT 1
/* #undef HAVE_STRUCT_NO_S */
#define HAVE_STRUCT_YES_S 1
])])
# AC_CHECK_TYPES
# --------------
# Check that we properly dispatch properly to the old implementation
# or to the new one.
AT_SETUP([AC_CHECK_TYPES: backward compatibility])
AT_DATA([configure.ac],
[[AC_INIT
define([_AC_CHECK_TYPE_NEW], [NEW])
define([_AC_CHECK_TYPE_OLD], [OLD])
#(cut-from-here
AC_CHECK_TYPE(ptrdiff_t)
AC_CHECK_TYPE(ptrdiff_t, int)
AC_CHECK_TYPE(quad, long long int)
AC_CHECK_TYPE(table_42, [int[42]])
# Nice machine!
AC_CHECK_TYPE(uint8_t, uint65536_t)
AC_CHECK_TYPE(a,b,c,d)
#to-here)
AC_OUTPUT
]])
AT_CHECK_AUTOCONF
AT_CHECK([[sed -e '/^#(cut-from-here/,/^#to-here)/!d' -e '/^#/d' configure]],
0,
[NEW
OLD
OLD
OLD
OLD
NEW
])
AT_CLEANUP
# AC_CHECK_FILES
# --------------
# FIXME: To really test HAVE_AC_EXISTS2 and HAVE_AC_MISSING2 we need to
# open AH_TEMPLATE to `configure.ac', which is not yet the case.
AT_CHECK_MACRO: test C++ as well as C, cross as well as native 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’.
2020-10-14 11:21:30 -04:00
# Don't use AT_CHECK_MACRO for this one because AC_CHECK_FILES can't be
# used when cross compiling.
AT_CHECK_CONFIGURE_AC([AC_CHECK_FILES],
[[touch at-exists1 at-exists2
ac_exists2=at-exists2
ac_missing2=at-missing2
AC_CHECK_FILES(at-exists1 at-missing1 $ac_exists2 $ac_missing2)
AT_CHECK_MACRO: test C++ as well as C, cross as well as native 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’.
2020-10-14 11:21:30 -04:00
rm at-exists1 at-exists2]],
[], [],
[AT_CHECK_DEFINES(
[#define HAVE_AT_EXISTS1 1
/* #undef HAVE_AT_MISSING1 */
])])
## ------------------------------ ##
## AC_CHECK_PROG & AC_PATH_PROG. ##
## ------------------------------ ##
# AT_CHECK_PROGS_PREPARE
# ----------------------
# Create a sub directory `path' with 6 subdirs which all 7 contain
# an executable `tool'. `6' contains a `better' tool.
m4_define([AT_CHECK_PROGS_PREPARE],
[mkdir path
cat >path/tool <<\EOF
#! /bin/sh
exit 0
EOF
chmod +x path/tool
for i in 1 2 3 4 5 6
do
mkdir path/$i
cp path/tool path/$i
done
cp path/tool path/6/better])
# -------------------------------- #
# AC_CHECK_PROG & AC_CHECK_PROGS. #
# -------------------------------- #
AT_SETUP([AC_CHECK_PROG & AC_CHECK_PROGS])
AT_CHECK_PROGS_PREPARE
AT_DATA([configure.ac],
[[AC_INIT
pwd=`pwd`
p="1${PATH_SEPARATOR}2${PATH_SEPARATOR}3${PATH_SEPARATOR}4${PATH_SEPARATOR}5${PATH_SEPARATOR}6"
path=`echo $p | sed -e 's,\([[0-9]]\),'"$pwd"'/path/\1,g'`
fail=false
AC_CHECK_PROG(TOOL1, tool, found, not-found, $path)
test "$TOOL1" = found || fail=:
# Yes, the semantics of this macro is weird.
AC_CHECK_PROG(TOOL2, tool,, not-found, $path)
test "$TOOL2" = not-found || fail=:
AC_CHECK_PROG(TOOL3, tool, tool, not-found, $path, $pwd/path/1/tool)
test "$TOOL3" = "$pwd/path/2/tool" || fail=:
AC_CHECK_PROG(TOOL4, better, better, not-found, $path, $pwd/path/1/tool)
test "$TOOL4" = better || fail=:
# When a tool is not found, and no value is given for not-found,
# the variable is left empty.
AC_CHECK_PROGS(TOOL5, missing,, $path)
test -z "$TOOL5" || fail=:
AC_CHECK_PROGS(TOOL6, missing tool better,, $path)
test "$TOOL6" = tool || fail=:
$fail &&
AC_MSG_ERROR([[CHECK_PROG failed]])
Warn if AC_INIT or AC_OUTPUT are missing from configure.ac (#107986) It is almost always incorrect for a configure script to omit either AC_INIT or AC_OUTPUT. Issue warnings in the ‘syntax’ category for this. The implementation is, unfortunately, a bit of a kludge. To check for the _absence_ of a macro invocation, we can use m4_provide_if inside a m4_wrap hook. However, if we activate the m4_wrap hook directly from general.m4, we get spurious warnings at freeze time. We also get warnings whenever a script that’s missing AC_INIT and/or AC_OUTPUT is *traced*, which means we get double warnings from autoconf, and autoheader and aclocal complain about it too, which seems unnecessary. A clean way to deal with this would be to make the hook look for a special macro that’s defined only when autoconf (the program) is invoked without any --trace arguments. Unfortunately, autom4te doesn’t pass --define down to M4, and changing that would involve coordinating with Automake (the project), so instead I’ve gone for the kludge: a new file lib/autoconf/trailer.m4 that calls m4_wrap. This file is *not* included in autoconf.m4f, but it’s installed, and it’s added to the m4 invocation by autoconf (the program) only when not tracing. (It still uses m4_wrap, because we pass it to m4 *before* configure.ac, because otherwise we get nonsense locations for any *other* diagnostics coming out of this autoconf invocation. I don’t know why.) The additional checks in autoreconf are intended to make sure that if autoreconf skips a directory entirely, you get told why. Lots of tests in the testsuite didn’t bother with AC_OUTPUT, and somewhat fewer didn’t bother with AC_INIT; where possible I just added them. Suggested by David A. Wheeler, who submitted a patch, but I didn’t wind up using any of his code. (His implementation used an extra tracing pass, only checked for a missing AC_INIT, and invented a new command-line option to turn off this specific warning. I thought this was tidier overall, despite the kludge.) * lib/autoconf/general.m4 (_AC_FINALIZE): New macro: code to be run when generating configure, after the entire configure.ac is processed. Currently only checks that AC_INIT and AC_OUTPUT were called at some point, issuing syntax-category warnings if not. (AC_INIT, AC_OUTPUT): m4_provide self. * lib/autoconf/trailer.m4: New file that just calls m4_wrap([_AC_FINALIZE]). * lib/local.mk: Install new file. * bin/autoconf.as: Add trailer.m4 to the final invocation of autom4te, but only when not tracing. * bin/autoreconf.in (autoreconf_current_directory): Distinguish in diagnostics between “directory skipped because it doesn’t have a configure.ac or configure.in” (e.g. Cygnus configure) and “directory has a configure.ac but it doesn’t appear to be autoconf input.” * tests/*.at: Fix all tests affected by the new warnings.
2020-08-14 13:16:58 -04:00
AC_OUTPUT
]])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE
AT_CLEANUP
## ---------------- ##
## AC_C_BIGENDIAN. ##
## ---------------- ##
AT_SETUP([AC_C_BIGENDIAN])
AT_KEYWORDS([cross])
# Make sure that AC_C_BIGENDIAN behave the same whether we are
# cross-compiling or not.
_AT_CHECK_AC_MACRO(
[[AC_C_BIGENDIAN(
[ac_endian=big],
[ac_endian=little],
[ac_endian=unknown],
[ac_endian=universal])
echo $ac_endian > at-endian
]])
rm -f config.hin # So that next run of autoheader is quiet.
_AT_CHECK_AC_MACRO(
[[# Force cross compiling.
cross_compiling=yes
ac_tool_warned=yes
AC_C_BIGENDIAN(
[ac_endian=big],
[ac_endian=little],
[ac_endian=unknown],
[ac_endian=universal])
ac_prevendian=`cat at-endian`
# Check that we have found the same result as in the previous run
# or unknown (because the cross-compiling check is allowed to fail;
# although it might be interesting to suppress this comparison, just
# to know on which system it fails if it ever does).
if test $ac_endian != $ac_prevendian && test $ac_endian != unknown; then
AC_MSG_ERROR([unexpected endianness: first run found '$ac_prevendian' but second run found '$ac_endian'])
fi
]])
# Make sure AC_C_BIGENDIAN with no argument will create a config.h template
# containing "WORDS_BIGENDIAN".
AT_CONFIGURE_AC([[AC_C_BIGENDIAN]])
# --force is necessary, the computer might be too fast.
AC_REPLACE_FUNCS: invoke _AH_CHECK_FUNC and AC_LIBSOURCE unconditionally. While investigating something else, I noticed that AC_REPLACE_FUNCS calls _AH_CHECK_FUNC and AC_LIBSOURCE in the success branch of an AC_CHECK_FUNC. This doesn’t work; both of those are marker macros that need to be expanded unconditionally at m4 time so that traces (placed by autoheader and automake, respectively) will fire. In order to fix this while keeping the code readable, I would up doing a major refactor. There are now four internal macros implementing AC_REPLACE_FUNCS. _AC_REPLACE_FUNC_U is called unconditionally for every shell word in the list passed to AC_REPLACE_FUNCS, and does _AH_CHECK_FUNC + AC_LIBSOURCE if it can, or issues a warning if it can’t. (It could make sense to make this a public function, if we think shell variables in the AC_REPLACE_FUNCS list need to be supported long-term. I dunno if there’s a use case that can’t be handled by AC_REPLACE_FUNCS inside a shell conditional just as well.) _AC_REPLACE_FUNC_L and _AC_REPLACE_FUNC_NL implement the actual test performed for each function to be replaced; the difference is that _L (for literal) can only be used on a function whose name is known at m4 expansion time, _NL (nonliteral) works regardless. _AC_REPLACE_FUNCS, which already existed, handles looping either at m4 time or shell time as appropriate. AC_REPLACE_FUNCS remains a thin wrapper that runs _AC_REPLACE_FUNCS(m4_flatten([$1])). The _bulk_ of the patch is changes to the testsuite so that it notices the original bug. Specifically, AT_CHECK_AUTOHEADER now takes an argument which is a whitespace-separated list of preprocessor macro names that ought to appear in the generated config.h.in. This can be set to ‘ignore’ to skip the test, and unfortunately that’s what the “trivial” per-macro tests have to do (AT_CHECK_MACRO and friends), so coverage is not ideal, but it’s better than what we had. Also, AT_CHECK_M4 now normalizes the backtrace lines that appear in the output of an AC_DIAGNOSE, e.g. configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete. configure.ac:6: You should run autoupdate. ../../lib/autoconf/lang.m4:125: AC_LANG_SAVE is expanded from... configure.ac:6: the top level becomes configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete. configure.ac:6: You should run autoupdate. lang.m4: AC_LANG_SAVE is expanded from... configure.ac:6: the top level This allows us to write tests for these diagnostics that don’t depend on the relationship between the source and build directories, and won’t break when unrelated patches change the line number of a macro definition. * lib/autoconf/functions.m4 (AC_REPLACE_FUNCS, _AC_REPLACE_FUNCS) (_AC_REPLACE_FUNC): Refactor into AC_REPLACE_FUNCS, _AC_REPLACE_FUNCS, _AC_REPLACE_FUNC_U, _AC_REPLACE_FUNC_L, _AC_REPLACE_FUNC_NL. Ensure that _AH_CHECK_FUNC and AC_LIBSOURCE are invoked unconditionally at m4 expansion time for each literal function name in the argument to AC_CHECK_FUNCS. Issue warnings about non-literal names. * tests/local.at (AT_CHECK_M4): Normalize backtrace lines from the output of AC_DIAGNOSE / m4_warn. (AT_CHECK_AUTOHEADER): Add arg EXPECTED-TMPLS giving a list of preprocessor macro names that should appear in the generated config.h.in. Use AT_CHECK_M4 to invoke autoheader. (_AT_CHECK_AC_MACRO, AT_CHECK_MACRO, AT_CHECK_AU_MACRO): Update uses of AT_CHECK_AUTOHEADER. * tests/fortran.at, tests/semantics.at, tests/tools.at * tests/torture.at: Update all uses of AT_CHECK_AUTOHEADER. * tests/semantics.at (AC_REPLACE_FUNCS test): Make somewhat more thorough, using new functionality of AT_CHECK_M4 and AT_CHECK_AUTOHEADER. Signed-off-by: Zack Weinberg <zackw@panix.com>
2020-06-29 18:55:39 -07:00
AT_CHECK_AUTOHEADER([--force], [
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([grep WORDS_BIGENDIAN config.hin], [], [ignore])
AT_CLEANUP
# ------------------------------ #
# AC_PATH_PROG & AC_PATH_PROGS. #
# ------------------------------ #
AT_SETUP([AC_PATH_PROG & AC_PATH_PROGS])
AT_CHECK_PROGS_PREPARE
AT_DATA([configure.ac],
[[AC_INIT
pwd=`pwd`
p="1${PATH_SEPARATOR}2${PATH_SEPARATOR}3${PATH_SEPARATOR}4${PATH_SEPARATOR}5${PATH_SEPARATOR}6"
path=`echo $p | sed -e 's,\([[0-9]]\),'"$pwd"'/path/\1,g'`
fail=false
AC_PATH_PROG(TOOL1, tool, not-found, $path)
test "$TOOL1" = "$pwd/path/1/tool" || fail=:
AC_PATH_PROG(TOOL2, better, not-found, $path)
test "$TOOL2" = "$pwd/path/6/better" || fail=:
# When a tool is not found, and no value is given for not-found,
# the variable is left empty.
AC_PATH_PROGS(TOOL3, missing,, $path)
test -z "$TOOL3" || fail=:
AC_PATH_PROGS(TOOL4, missing tool better,, $path)
test "$TOOL4" = "$pwd/path/1/tool" || fail=:
$fail &&
AC_MSG_ERROR([[PATH_PROG failed]])
Warn if AC_INIT or AC_OUTPUT are missing from configure.ac (#107986) It is almost always incorrect for a configure script to omit either AC_INIT or AC_OUTPUT. Issue warnings in the ‘syntax’ category for this. The implementation is, unfortunately, a bit of a kludge. To check for the _absence_ of a macro invocation, we can use m4_provide_if inside a m4_wrap hook. However, if we activate the m4_wrap hook directly from general.m4, we get spurious warnings at freeze time. We also get warnings whenever a script that’s missing AC_INIT and/or AC_OUTPUT is *traced*, which means we get double warnings from autoconf, and autoheader and aclocal complain about it too, which seems unnecessary. A clean way to deal with this would be to make the hook look for a special macro that’s defined only when autoconf (the program) is invoked without any --trace arguments. Unfortunately, autom4te doesn’t pass --define down to M4, and changing that would involve coordinating with Automake (the project), so instead I’ve gone for the kludge: a new file lib/autoconf/trailer.m4 that calls m4_wrap. This file is *not* included in autoconf.m4f, but it’s installed, and it’s added to the m4 invocation by autoconf (the program) only when not tracing. (It still uses m4_wrap, because we pass it to m4 *before* configure.ac, because otherwise we get nonsense locations for any *other* diagnostics coming out of this autoconf invocation. I don’t know why.) The additional checks in autoreconf are intended to make sure that if autoreconf skips a directory entirely, you get told why. Lots of tests in the testsuite didn’t bother with AC_OUTPUT, and somewhat fewer didn’t bother with AC_INIT; where possible I just added them. Suggested by David A. Wheeler, who submitted a patch, but I didn’t wind up using any of his code. (His implementation used an extra tracing pass, only checked for a missing AC_INIT, and invented a new command-line option to turn off this specific warning. I thought this was tidier overall, despite the kludge.) * lib/autoconf/general.m4 (_AC_FINALIZE): New macro: code to be run when generating configure, after the entire configure.ac is processed. Currently only checks that AC_INIT and AC_OUTPUT were called at some point, issuing syntax-category warnings if not. (AC_INIT, AC_OUTPUT): m4_provide self. * lib/autoconf/trailer.m4: New file that just calls m4_wrap([_AC_FINALIZE]). * lib/local.mk: Install new file. * bin/autoconf.as: Add trailer.m4 to the final invocation of autom4te, but only when not tracing. * bin/autoreconf.in (autoreconf_current_directory): Distinguish in diagnostics between “directory skipped because it doesn’t have a configure.ac or configure.in” (e.g. Cygnus configure) and “directory has a configure.ac but it doesn’t appear to be autoconf input.” * tests/*.at: Fix all tests affected by the new warnings.
2020-08-14 13:16:58 -04:00
AC_OUTPUT
]])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE
AT_CLEANUP
# ----------------------------- #
# AC_PATH_PROGS_FEATURE_CHECK. #
# ----------------------------- #
AT_SETUP([AC_PATH_PROGS_FEATURE_CHECK])
# This test doesn't work if `pwd` contains white space
case `pwd` in
*\ * | *\ *) AT_CHECK([exit 77]) ;;
esac
AT_CHECK_PROGS_PREPARE
AT_DATA([configure.ac],
[[AC_INIT
pwd=`pwd`
p="1${PATH_SEPARATOR}2${PATH_SEPARATOR}3${PATH_SEPARATOR}4${PATH_SEPARATOR}5${PATH_SEPARATOR}6"
path=`echo $p | sed -e 's,\([[0-9]]\),'"$pwd"'/path/\1,g'`
fail=false
# Find first candidate and stop search
AC_PATH_PROGS_FEATURE_CHECK(TOOL1, [tool better],
[$ac_path_TOOL1 && ac_cv_path_TOOL1=$ac_path_TOOL1 ac_path_TOOL1_found=:],
fail=:, $path)
test -z "$TOOL1" || fail=:
test "$ac_cv_path_TOOL1" = "$pwd/path/1/tool" || fail=:
# Keep searching each candidate
AC_PATH_PROGS_FEATURE_CHECK(TOOL2, [tool better],
[$ac_path_TOOL2 && ac_cv_path_TOOL2=$ac_path_TOOL2],
fail=:, $path)
test "$ac_cv_path_TOOL2" = "$pwd/path/6/better" || fail=:
# Only accept better candidate
AC_PATH_PROGS_FEATURE_CHECK(TOOL3, [tool better],
[case "$ac_path_TOOL3" in #(
*better) ac_cv_path_TOOL3=$ac_path_TOOL3;;
esac],
fail=:, $path)
test "$ac_cv_path_TOOL3" = "$pwd/path/6/better" || fail=:
# When a tool is not found, and no action is given for not-found,
# the variable is left empty.
AC_PATH_PROGS_FEATURE_CHECK(TOOL4, missing,
[ac_cv_path_TOOL4=$ac_path_TOOL4], [], $path)
test -z "$ac_cv_path_TOOL4" || fail=:
# Test action when tool is not found
AC_PATH_PROGS_FEATURE_CHECK(TOOL5, missing, [],
[ac_cv_path_TOOL5='not found'], $path)
test "$ac_cv_path_TOOL5" = "not found" || fail=:
# Test that pre-set tool bypasses feature test
TOOL6=$pwd/path/6/better
AC_PATH_PROGS_FEATURE_CHECK(TOOL6, tool, fail=:, fail=:, $path)
test "$ac_cv_path_TOOL6" = "$pwd/path/6/better" || fail=:
# A blank pre-set does not bypass feature test
TOOL7=
AC_PATH_PROGS_FEATURE_CHECK(TOOL7, [tool better],
[$ac_path_TOOL7 && ac_cv_path_TOOL7=$ac_path_TOOL7 ac_path_TOOL7_found=:],
fail=:, $path)
test -z "$TOOL7" || fail=:
test "$ac_cv_path_TOOL7" = "$pwd/path/1/tool" || fail=:
$fail &&
AC_MSG_ERROR([[PATH_PROG failed]])
Warn if AC_INIT or AC_OUTPUT are missing from configure.ac (#107986) It is almost always incorrect for a configure script to omit either AC_INIT or AC_OUTPUT. Issue warnings in the ‘syntax’ category for this. The implementation is, unfortunately, a bit of a kludge. To check for the _absence_ of a macro invocation, we can use m4_provide_if inside a m4_wrap hook. However, if we activate the m4_wrap hook directly from general.m4, we get spurious warnings at freeze time. We also get warnings whenever a script that’s missing AC_INIT and/or AC_OUTPUT is *traced*, which means we get double warnings from autoconf, and autoheader and aclocal complain about it too, which seems unnecessary. A clean way to deal with this would be to make the hook look for a special macro that’s defined only when autoconf (the program) is invoked without any --trace arguments. Unfortunately, autom4te doesn’t pass --define down to M4, and changing that would involve coordinating with Automake (the project), so instead I’ve gone for the kludge: a new file lib/autoconf/trailer.m4 that calls m4_wrap. This file is *not* included in autoconf.m4f, but it’s installed, and it’s added to the m4 invocation by autoconf (the program) only when not tracing. (It still uses m4_wrap, because we pass it to m4 *before* configure.ac, because otherwise we get nonsense locations for any *other* diagnostics coming out of this autoconf invocation. I don’t know why.) The additional checks in autoreconf are intended to make sure that if autoreconf skips a directory entirely, you get told why. Lots of tests in the testsuite didn’t bother with AC_OUTPUT, and somewhat fewer didn’t bother with AC_INIT; where possible I just added them. Suggested by David A. Wheeler, who submitted a patch, but I didn’t wind up using any of his code. (His implementation used an extra tracing pass, only checked for a missing AC_INIT, and invented a new command-line option to turn off this specific warning. I thought this was tidier overall, despite the kludge.) * lib/autoconf/general.m4 (_AC_FINALIZE): New macro: code to be run when generating configure, after the entire configure.ac is processed. Currently only checks that AC_INIT and AC_OUTPUT were called at some point, issuing syntax-category warnings if not. (AC_INIT, AC_OUTPUT): m4_provide self. * lib/autoconf/trailer.m4: New file that just calls m4_wrap([_AC_FINALIZE]). * lib/local.mk: Install new file. * bin/autoconf.as: Add trailer.m4 to the final invocation of autom4te, but only when not tracing. * bin/autoreconf.in (autoreconf_current_directory): Distinguish in diagnostics between “directory skipped because it doesn’t have a configure.ac or configure.in” (e.g. Cygnus configure) and “directory has a configure.ac but it doesn’t appear to be autoconf input.” * tests/*.at: Fix all tests affected by the new warnings.
2020-08-14 13:16:58 -04:00
AC_OUTPUT
]])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE
AT_CLEANUP
## -------------- ##
## AC_PATH_XTRA. ##
## -------------- ##
AT_SETUP([AC_PATH_XTRA])
_AT_CHECK_AC_MACRO([AC_PATH_XTRA])
# Check X_DISPLAY_MISSING.
AT_CHECK_CONFIGURE([--without-x])
AT_CHECK_DEFINES(
[#define X_DISPLAY_MISSING 1
])
AT_CLEANUP
## ------------------------------- ##
## Obsolete non-updatable macros. ##
## ------------------------------- ##
AT_CHECK_MACRO: test C++ as well as C, cross as well as native 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’.
2020-10-14 11:21:30 -04:00
AT_CHECK_MACRO([AC_SYS_RESTARTABLE_SYSCALLS], , ,[-W no-obsolete], [no-cross])
AT_CHECK_MACRO([AC_FUNC_SETVBUF_REVERSED], , ,[-W no-obsolete])
AT_CHECK_MACRO: test C++ as well as C, cross as well as native 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’.
2020-10-14 11:21:30 -04:00
AT_CHECK_MACRO([AC_FUNC_WAIT3], , ,[-W no-obsolete], [no-cross])
## ------------------------------------- ##
## Obsolete macros requiring arguments. ##
## ------------------------------------- ##
# These all wrap the macro under test in an AC_CACHE_CHECK and an
# AC_DEFINE so the full verification machinery of AT_CHECK_MACRO is
# effective. Caution: AT_CHECK_AU_MACRO expects that after an
# autoupdate run, a naive grep will not find the old macro name
# anywhere in the updated configure.ac, not even as part of a
# longer identifier. (But it's case sensitive.)
AT_CHECK_AU_MACRO([AC_TRY_CPP],
[[AC_CACHE_CHECK([working ac_try_cpp], [ac_cv_ac_try_cpp_works], [
AC_TRY_CPP([
@%:@if 2 + 2 != 4
@%:@error "SEVEN!" /* in memory of Stanislaw Lem */
@%:@endif
], [ac_cv_ac_try_cpp_works=yes],
[ac_cv_ac_try_cpp_works=no])
])
if test $ac_cv_ac_try_cpp_works = yes; then
AC_DEFINE([ac_try_cpp_works], [1], [label])
fi
]])
AT_CHECK_AU_MACRO([AC_TRY_COMPILE],
[[AC_CACHE_CHECK([working ac_try_compile], [ac_cv_ac_try_compile_works], [
AC_TRY_COMPILE([int variable;], [return variable;],
[ac_cv_ac_try_compile_works=yes],
[ac_cv_ac_try_compile_works=no])
])
if test $ac_cv_ac_try_compile_works = yes; then
AC_DEFINE([ac_try_compile_works], [1], [label])
fi
]])
AT_CHECK_AU_MACRO([AC_TRY_LINK],
[[AC_CACHE_CHECK([working ac_try_link], [ac_cv_ac_try_link_works], [
AC_TRY_LINK([@%:@include <stdio.h>], [return !feof(stdin);],
[ac_cv_ac_try_link_works=yes],
[ac_cv_ac_try_link_works=no])
])
if test $ac_cv_ac_try_link_works = yes; then
AC_DEFINE([ac_try_link_works], [1], [label])
fi
]])
# Oddly enough, AC_COMPILE_CHECK was shorthand for AC_MSG_CHECKING +
# AC_TRY_LINK, not AC_TRY_COMPILE. When not cached, this will print
# checking for working ac_compile_check... checking for feof ... yes
# but whatever.
AT_CHECK_AU_MACRO([AC_COMPILE_CHECK],
[[AC_CACHE_CHECK([working ac_compile_check], [ac_cv_ac_compile_check_works], [
AC_COMPILE_CHECK([feof], [@%:@include <stdio.h>], [return !feof(stdin);],
[ac_cv_ac_compile_check_works=yes],
[ac_cv_ac_compile_check_works=no])
])
if test $ac_cv_ac_compile_check_works = yes; then
AC_DEFINE([ac_compile_check_works], [1], [label])
fi
]])
AT_CHECK_AU_MACRO([AC_TRY_RUN],
[[AC_CACHE_CHECK([working ac_try_run], [ac_cv_ac_try_run_works], [
AC_TRY_RUN([int main(void) { return 0; }],
[ac_cv_ac_try_run_works=yes],
[ac_cv_ac_try_run_works=no],
[ac_cv_ac_try_run_works=yes]) # cross compile, assume it works
])
if test $ac_cv_ac_try_run_works = yes; then
AC_DEFINE([ac_try_run_works], [1], [label])
fi
]])
# For purpose of this test, we don't care whether these libraries
# exist (as long as the result is consistent between C and C++)
# but we _do_ need to make sure that autoupdate correctly handles
# AC_HAVE_LIBRARY's acceptance of "-lfoo" and "libfoo.a" as the
# LIBRARY argument, where AC_CHECK_LIB only takes "foo".
AT_CHECK_AU_MACRO([AC_HAVE_LIBRARY],
[[AC_HAVE_LIBRARY([alice])
AC_HAVE_LIBRARY([-lbob])
AC_HAVE_LIBRARY([libmallory.a])
]])
Consistently expand macros in whitespace-separated lists. Several of the most commonly used Autoconf macros (starting with AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list of symbols as their primary argument. It would abstractly be best if this list were _not_ subject to M4 macro expansion, in case there’s a collision between a M4 macro name and something to be looked for. However, we have historically not been careful about this, and there’s been reports of configure scripts using ‘dnl’ to write comments inside the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre shell syntax errors. Also, the macro expansion behavior is not consistent among all of the macros that take whitespace-separated lists, nor is it consistent between autoconf and autoheader. Address this by introducing a new m4sugar macro, currently called ‘m4_validate_w’ (I’m open to suggestions for better names). Here’s its documentation comment: | m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])), | but if that is not the same as just m4_normalize([STRING]), | issue a warning. The text of the warning is | configure.ac:N: warning: whitespace-separated-list contains macros; | configure.ac:N: in a future version of Autoconf they will not be expanded If the unexpanded form of the string contains the token ‘dnl’ then there’s an additional line: | configure.ac:N: note: ‘dnl’ is a macro All of the public macros that take a whitespace-separated list of symbols are changed to pass that argument through m4_validate_w before doing anything else with it, and the test suite is updated to verify consistent behavior for every last one of them. This addresses Savannah issues #110210 and #110211, and the harmless but annoying autoheader behavior described at https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html . In order to avoid expanding relatively expensive m4sugar macros multiple times per top-level macro invocation, several of the affected Autoconf macros are restructured along the same lines as I did for AC_REPLACE_FUNCS in the previous patch. * lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE) (AC_REPLACE_FUNCS) * lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES) * lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE) * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through m4_validate_w before use. * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers _AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C. (AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE. (AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers _AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C. * lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize. * tests/semantics.at: Add tests for expansion of M4 macros in whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
## ----------------------------------------- ##
## Expansion of whitespace-separated lists. ##
## ----------------------------------------- ##
m4_define([AT_CHECK_EXPANSION_IN_FUNCS],
[AT_SETUP([Macro expansion in $1]m4_if([$2],[literal],[],[ (literal)]))
AT_CONFIGURE_AC([[
m4@&t@_define([fn_bar],[fn_quux])
$1([dn@&t@l
fn_foo dn@&t@l
fn_nocomment
fn_bar dn@&t@l Ordinary comment
fn_blurf dn@&t@l Apos'trophed comment
])
]])
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-12 14:59:56 -04:00
AT_CHECK_AUTOCONF([], [0], [],
Consistently expand macros in whitespace-separated lists. Several of the most commonly used Autoconf macros (starting with AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list of symbols as their primary argument. It would abstractly be best if this list were _not_ subject to M4 macro expansion, in case there’s a collision between a M4 macro name and something to be looked for. However, we have historically not been careful about this, and there’s been reports of configure scripts using ‘dnl’ to write comments inside the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre shell syntax errors. Also, the macro expansion behavior is not consistent among all of the macros that take whitespace-separated lists, nor is it consistent between autoconf and autoheader. Address this by introducing a new m4sugar macro, currently called ‘m4_validate_w’ (I’m open to suggestions for better names). Here’s its documentation comment: | m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])), | but if that is not the same as just m4_normalize([STRING]), | issue a warning. The text of the warning is | configure.ac:N: warning: whitespace-separated-list contains macros; | configure.ac:N: in a future version of Autoconf they will not be expanded If the unexpanded form of the string contains the token ‘dnl’ then there’s an additional line: | configure.ac:N: note: ‘dnl’ is a macro All of the public macros that take a whitespace-separated list of symbols are changed to pass that argument through m4_validate_w before doing anything else with it, and the test suite is updated to verify consistent behavior for every last one of them. This addresses Savannah issues #110210 and #110211, and the harmless but annoying autoheader behavior described at https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html . In order to avoid expanding relatively expensive m4sugar macros multiple times per top-level macro invocation, several of the affected Autoconf macros are restructured along the same lines as I did for AC_REPLACE_FUNCS in the previous patch. * lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE) (AC_REPLACE_FUNCS) * lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES) * lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE) * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through m4_validate_w before use. * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers _AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C. (AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE. (AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers _AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C. * lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize. * tests/semantics.at: Add tests for expansion of M4 macros in whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
[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
])
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-12 14:59:56 -04:00
AT_CHECK_AUTOHEADER([-W no-obsolete], [
Consistently expand macros in whitespace-separated lists. Several of the most commonly used Autoconf macros (starting with AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list of symbols as their primary argument. It would abstractly be best if this list were _not_ subject to M4 macro expansion, in case there’s a collision between a M4 macro name and something to be looked for. However, we have historically not been careful about this, and there’s been reports of configure scripts using ‘dnl’ to write comments inside the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre shell syntax errors. Also, the macro expansion behavior is not consistent among all of the macros that take whitespace-separated lists, nor is it consistent between autoconf and autoheader. Address this by introducing a new m4sugar macro, currently called ‘m4_validate_w’ (I’m open to suggestions for better names). Here’s its documentation comment: | m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])), | but if that is not the same as just m4_normalize([STRING]), | issue a warning. The text of the warning is | configure.ac:N: warning: whitespace-separated-list contains macros; | configure.ac:N: in a future version of Autoconf they will not be expanded If the unexpanded form of the string contains the token ‘dnl’ then there’s an additional line: | configure.ac:N: note: ‘dnl’ is a macro All of the public macros that take a whitespace-separated list of symbols are changed to pass that argument through m4_validate_w before doing anything else with it, and the test suite is updated to verify consistent behavior for every last one of them. This addresses Savannah issues #110210 and #110211, and the harmless but annoying autoheader behavior described at https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html . In order to avoid expanding relatively expensive m4sugar macros multiple times per top-level macro invocation, several of the affected Autoconf macros are restructured along the same lines as I did for AC_REPLACE_FUNCS in the previous patch. * lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE) (AC_REPLACE_FUNCS) * lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES) * lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE) * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through m4_validate_w before use. * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers _AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C. (AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE. (AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers _AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C. * lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize. * tests/semantics.at: Add tests for expansion of M4 macros in whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
HAVE_FN_BLURF
HAVE_FN_FOO
HAVE_FN_NOCOMMENT
HAVE_FN_QUUX
])
AT_CHECK_CONFIGURE
AT_CLEANUP
m4_if([$2], [literal], [], [
AT_SETUP([Macro expansion in $1 (variable)])
AT_CONFIGURE_AC([[
m4@&t@_define([fn_bar],[fn_quux])
fns="fn_foo" _AH_CHECK_FUNC([fn_foo])
fns="$fns fn_nocomment" _AH_CHECK_FUNC([fn_nocomment])
$1([dn@&t@l
$[]fns
fn_bar dn@&t@l Ordinary comment
fn_blurf dn@&t@l Apos'trophed comment
])
]])
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-12 14:59:56 -04:00
AT_CHECK_AUTOCONF([], [0], [],
Consistently expand macros in whitespace-separated lists. Several of the most commonly used Autoconf macros (starting with AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list of symbols as their primary argument. It would abstractly be best if this list were _not_ subject to M4 macro expansion, in case there’s a collision between a M4 macro name and something to be looked for. However, we have historically not been careful about this, and there’s been reports of configure scripts using ‘dnl’ to write comments inside the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre shell syntax errors. Also, the macro expansion behavior is not consistent among all of the macros that take whitespace-separated lists, nor is it consistent between autoconf and autoheader. Address this by introducing a new m4sugar macro, currently called ‘m4_validate_w’ (I’m open to suggestions for better names). Here’s its documentation comment: | m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])), | but if that is not the same as just m4_normalize([STRING]), | issue a warning. The text of the warning is | configure.ac:N: warning: whitespace-separated-list contains macros; | configure.ac:N: in a future version of Autoconf they will not be expanded If the unexpanded form of the string contains the token ‘dnl’ then there’s an additional line: | configure.ac:N: note: ‘dnl’ is a macro All of the public macros that take a whitespace-separated list of symbols are changed to pass that argument through m4_validate_w before doing anything else with it, and the test suite is updated to verify consistent behavior for every last one of them. This addresses Savannah issues #110210 and #110211, and the harmless but annoying autoheader behavior described at https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html . In order to avoid expanding relatively expensive m4sugar macros multiple times per top-level macro invocation, several of the affected Autoconf macros are restructured along the same lines as I did for AC_REPLACE_FUNCS in the previous patch. * lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE) (AC_REPLACE_FUNCS) * lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES) * lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE) * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through m4_validate_w before use. * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers _AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C. (AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE. (AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers _AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C. * lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize. * tests/semantics.at: Add tests for expansion of M4 macros in whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
[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
configure.ac:8: warning: $1($fns): you should use literals
functions.m4: $1 is expanded from...
configure.ac:8: the top level
])
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-12 14:59:56 -04:00
AT_CHECK_AUTOHEADER([-W no-obsolete], [
Consistently expand macros in whitespace-separated lists. Several of the most commonly used Autoconf macros (starting with AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list of symbols as their primary argument. It would abstractly be best if this list were _not_ subject to M4 macro expansion, in case there’s a collision between a M4 macro name and something to be looked for. However, we have historically not been careful about this, and there’s been reports of configure scripts using ‘dnl’ to write comments inside the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre shell syntax errors. Also, the macro expansion behavior is not consistent among all of the macros that take whitespace-separated lists, nor is it consistent between autoconf and autoheader. Address this by introducing a new m4sugar macro, currently called ‘m4_validate_w’ (I’m open to suggestions for better names). Here’s its documentation comment: | m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])), | but if that is not the same as just m4_normalize([STRING]), | issue a warning. The text of the warning is | configure.ac:N: warning: whitespace-separated-list contains macros; | configure.ac:N: in a future version of Autoconf they will not be expanded If the unexpanded form of the string contains the token ‘dnl’ then there’s an additional line: | configure.ac:N: note: ‘dnl’ is a macro All of the public macros that take a whitespace-separated list of symbols are changed to pass that argument through m4_validate_w before doing anything else with it, and the test suite is updated to verify consistent behavior for every last one of them. This addresses Savannah issues #110210 and #110211, and the harmless but annoying autoheader behavior described at https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html . In order to avoid expanding relatively expensive m4sugar macros multiple times per top-level macro invocation, several of the affected Autoconf macros are restructured along the same lines as I did for AC_REPLACE_FUNCS in the previous patch. * lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE) (AC_REPLACE_FUNCS) * lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES) * lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE) * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through m4_validate_w before use. * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers _AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C. (AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE. (AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers _AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C. * lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize. * tests/semantics.at: Add tests for expansion of M4 macros in whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
HAVE_FN_BLURF
HAVE_FN_FOO
HAVE_FN_NOCOMMENT
HAVE_FN_QUUX
])
AT_CHECK_CONFIGURE
AT_CLEANUP
])])
m4_define([AT_CHECK_EXPANSION_IN_HEADERS],
[AT_SETUP([Macro expansion in $1]m4_if([$2],[literal],[],[ (literal)]))
AT_CONFIGURE_AC([[
m4@&t@_define([bar],[quux])
$1([dn@&t@l
foo.h dn@&t@l
nocomment.h
bar.h dn@&t@l Ordinary comment
blurf.h dn@&t@l Apos'trophed comment
])
]])
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-12 14:59:56 -04:00
AT_CHECK_AUTOCONF([], [0], [],
Consistently expand macros in whitespace-separated lists. Several of the most commonly used Autoconf macros (starting with AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list of symbols as their primary argument. It would abstractly be best if this list were _not_ subject to M4 macro expansion, in case there’s a collision between a M4 macro name and something to be looked for. However, we have historically not been careful about this, and there’s been reports of configure scripts using ‘dnl’ to write comments inside the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre shell syntax errors. Also, the macro expansion behavior is not consistent among all of the macros that take whitespace-separated lists, nor is it consistent between autoconf and autoheader. Address this by introducing a new m4sugar macro, currently called ‘m4_validate_w’ (I’m open to suggestions for better names). Here’s its documentation comment: | m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])), | but if that is not the same as just m4_normalize([STRING]), | issue a warning. The text of the warning is | configure.ac:N: warning: whitespace-separated-list contains macros; | configure.ac:N: in a future version of Autoconf they will not be expanded If the unexpanded form of the string contains the token ‘dnl’ then there’s an additional line: | configure.ac:N: note: ‘dnl’ is a macro All of the public macros that take a whitespace-separated list of symbols are changed to pass that argument through m4_validate_w before doing anything else with it, and the test suite is updated to verify consistent behavior for every last one of them. This addresses Savannah issues #110210 and #110211, and the harmless but annoying autoheader behavior described at https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html . In order to avoid expanding relatively expensive m4sugar macros multiple times per top-level macro invocation, several of the affected Autoconf macros are restructured along the same lines as I did for AC_REPLACE_FUNCS in the previous patch. * lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE) (AC_REPLACE_FUNCS) * lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES) * lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE) * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through m4_validate_w before use. * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers _AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C. (AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE. (AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers _AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C. * lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize. * tests/semantics.at: Add tests for expansion of M4 macros in whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
[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
])
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-12 14:59:56 -04:00
AT_CHECK_AUTOHEADER([-W no-obsolete], [
Consistently expand macros in whitespace-separated lists. Several of the most commonly used Autoconf macros (starting with AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list of symbols as their primary argument. It would abstractly be best if this list were _not_ subject to M4 macro expansion, in case there’s a collision between a M4 macro name and something to be looked for. However, we have historically not been careful about this, and there’s been reports of configure scripts using ‘dnl’ to write comments inside the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre shell syntax errors. Also, the macro expansion behavior is not consistent among all of the macros that take whitespace-separated lists, nor is it consistent between autoconf and autoheader. Address this by introducing a new m4sugar macro, currently called ‘m4_validate_w’ (I’m open to suggestions for better names). Here’s its documentation comment: | m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])), | but if that is not the same as just m4_normalize([STRING]), | issue a warning. The text of the warning is | configure.ac:N: warning: whitespace-separated-list contains macros; | configure.ac:N: in a future version of Autoconf they will not be expanded If the unexpanded form of the string contains the token ‘dnl’ then there’s an additional line: | configure.ac:N: note: ‘dnl’ is a macro All of the public macros that take a whitespace-separated list of symbols are changed to pass that argument through m4_validate_w before doing anything else with it, and the test suite is updated to verify consistent behavior for every last one of them. This addresses Savannah issues #110210 and #110211, and the harmless but annoying autoheader behavior described at https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html . In order to avoid expanding relatively expensive m4sugar macros multiple times per top-level macro invocation, several of the affected Autoconf macros are restructured along the same lines as I did for AC_REPLACE_FUNCS in the previous patch. * lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE) (AC_REPLACE_FUNCS) * lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES) * lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE) * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through m4_validate_w before use. * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers _AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C. (AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE. (AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers _AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C. * lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize. * tests/semantics.at: Add tests for expansion of M4 macros in whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
HAVE_BLURF_H
HAVE_FOO_H
HAVE_INTTYPES_H
HAVE_NOCOMMENT_H
HAVE_QUUX_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
])
AT_CHECK_CONFIGURE
AT_CLEANUP
m4_if([$2], [literal], [], [
AT_SETUP([Macro expansion in $1 (variable)])
AT_CONFIGURE_AC([[
m4@&t@_define([bar],[quux])
hs="foo.h" _AH_CHECK_HEADER([foo.h])
hs="$hs nocomment.h" _AH_CHECK_HEADER([nocomment.h])
$1([dn@&t@l
$[]hs
bar.h dn@&t@l Ordinary comment
blurf.h dn@&t@l Apos'trophed comment
])
]])
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-12 14:59:56 -04:00
AT_CHECK_AUTOCONF([], [0], [],
Consistently expand macros in whitespace-separated lists. Several of the most commonly used Autoconf macros (starting with AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list of symbols as their primary argument. It would abstractly be best if this list were _not_ subject to M4 macro expansion, in case there’s a collision between a M4 macro name and something to be looked for. However, we have historically not been careful about this, and there’s been reports of configure scripts using ‘dnl’ to write comments inside the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre shell syntax errors. Also, the macro expansion behavior is not consistent among all of the macros that take whitespace-separated lists, nor is it consistent between autoconf and autoheader. Address this by introducing a new m4sugar macro, currently called ‘m4_validate_w’ (I’m open to suggestions for better names). Here’s its documentation comment: | m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])), | but if that is not the same as just m4_normalize([STRING]), | issue a warning. The text of the warning is | configure.ac:N: warning: whitespace-separated-list contains macros; | configure.ac:N: in a future version of Autoconf they will not be expanded If the unexpanded form of the string contains the token ‘dnl’ then there’s an additional line: | configure.ac:N: note: ‘dnl’ is a macro All of the public macros that take a whitespace-separated list of symbols are changed to pass that argument through m4_validate_w before doing anything else with it, and the test suite is updated to verify consistent behavior for every last one of them. This addresses Savannah issues #110210 and #110211, and the harmless but annoying autoheader behavior described at https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html . In order to avoid expanding relatively expensive m4sugar macros multiple times per top-level macro invocation, several of the affected Autoconf macros are restructured along the same lines as I did for AC_REPLACE_FUNCS in the previous patch. * lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE) (AC_REPLACE_FUNCS) * lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES) * lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE) * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through m4_validate_w before use. * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers _AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C. (AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE. (AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers _AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C. * lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize. * tests/semantics.at: Add tests for expansion of M4 macros in whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
[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
configure.ac:8: warning: $1($hs): you should use literals
headers.m4: $1 is expanded from...
configure.ac:8: the top level
])
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-12 14:59:56 -04:00
AT_CHECK_AUTOHEADER([-W no-obsolete], [
Consistently expand macros in whitespace-separated lists. Several of the most commonly used Autoconf macros (starting with AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list of symbols as their primary argument. It would abstractly be best if this list were _not_ subject to M4 macro expansion, in case there’s a collision between a M4 macro name and something to be looked for. However, we have historically not been careful about this, and there’s been reports of configure scripts using ‘dnl’ to write comments inside the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre shell syntax errors. Also, the macro expansion behavior is not consistent among all of the macros that take whitespace-separated lists, nor is it consistent between autoconf and autoheader. Address this by introducing a new m4sugar macro, currently called ‘m4_validate_w’ (I’m open to suggestions for better names). Here’s its documentation comment: | m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])), | but if that is not the same as just m4_normalize([STRING]), | issue a warning. The text of the warning is | configure.ac:N: warning: whitespace-separated-list contains macros; | configure.ac:N: in a future version of Autoconf they will not be expanded If the unexpanded form of the string contains the token ‘dnl’ then there’s an additional line: | configure.ac:N: note: ‘dnl’ is a macro All of the public macros that take a whitespace-separated list of symbols are changed to pass that argument through m4_validate_w before doing anything else with it, and the test suite is updated to verify consistent behavior for every last one of them. This addresses Savannah issues #110210 and #110211, and the harmless but annoying autoheader behavior described at https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html . In order to avoid expanding relatively expensive m4sugar macros multiple times per top-level macro invocation, several of the affected Autoconf macros are restructured along the same lines as I did for AC_REPLACE_FUNCS in the previous patch. * lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE) (AC_REPLACE_FUNCS) * lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES) * lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE) * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through m4_validate_w before use. * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers _AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C. (AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE. (AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers _AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C. * lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize. * tests/semantics.at: Add tests for expansion of M4 macros in whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
HAVE_BLURF_H
HAVE_FOO_H
HAVE_INTTYPES_H
HAVE_NOCOMMENT_H
HAVE_QUUX_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
])
AT_CHECK_CONFIGURE
AT_CLEANUP
])])
AT_CHECK_EXPANSION_IN_FUNCS([AC_CHECK_FUNCS])
AT_CHECK_EXPANSION_IN_FUNCS([AC_CHECK_FUNCS_ONCE], [literal])
AT_CHECK_EXPANSION_IN_FUNCS([AC_REPLACE_FUNCS])
AT_CHECK_EXPANSION_IN_HEADERS([AC_CHECK_HEADERS])
AT_CHECK_EXPANSION_IN_HEADERS([AC_CHECK_HEADERS_ONCE], [literal])
AT_SETUP([Macro expansion in AC_CHECK_FILES])
AT_CONFIGURE_AC([[
m4@&t@_define([f_bar], [f_quux])
AC_CHECK_FILES([dn@&t@l
/nonex/f_foo
/nonex/f_bar dn@&t@l Ordinary comment
/nonex/f_blurf dn@&t@l Apos'trophed comment
])
]])
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-12 14:59:56 -04:00
AT_CHECK_AUTOCONF([], [0], [],
Consistently expand macros in whitespace-separated lists. Several of the most commonly used Autoconf macros (starting with AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list of symbols as their primary argument. It would abstractly be best if this list were _not_ subject to M4 macro expansion, in case there’s a collision between a M4 macro name and something to be looked for. However, we have historically not been careful about this, and there’s been reports of configure scripts using ‘dnl’ to write comments inside the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre shell syntax errors. Also, the macro expansion behavior is not consistent among all of the macros that take whitespace-separated lists, nor is it consistent between autoconf and autoheader. Address this by introducing a new m4sugar macro, currently called ‘m4_validate_w’ (I’m open to suggestions for better names). Here’s its documentation comment: | m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])), | but if that is not the same as just m4_normalize([STRING]), | issue a warning. The text of the warning is | configure.ac:N: warning: whitespace-separated-list contains macros; | configure.ac:N: in a future version of Autoconf they will not be expanded If the unexpanded form of the string contains the token ‘dnl’ then there’s an additional line: | configure.ac:N: note: ‘dnl’ is a macro All of the public macros that take a whitespace-separated list of symbols are changed to pass that argument through m4_validate_w before doing anything else with it, and the test suite is updated to verify consistent behavior for every last one of them. This addresses Savannah issues #110210 and #110211, and the harmless but annoying autoheader behavior described at https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html . In order to avoid expanding relatively expensive m4sugar macros multiple times per top-level macro invocation, several of the affected Autoconf macros are restructured along the same lines as I did for AC_REPLACE_FUNCS in the previous patch. * lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE) (AC_REPLACE_FUNCS) * lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES) * lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE) * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through m4_validate_w before use. * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers _AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C. (AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE. (AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers _AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C. * lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize. * tests/semantics.at: Add tests for expansion of M4 macros in whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
[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
])
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-12 14:59:56 -04:00
AT_CHECK_AUTOHEADER([-W no-obsolete], [
Consistently expand macros in whitespace-separated lists. Several of the most commonly used Autoconf macros (starting with AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list of symbols as their primary argument. It would abstractly be best if this list were _not_ subject to M4 macro expansion, in case there’s a collision between a M4 macro name and something to be looked for. However, we have historically not been careful about this, and there’s been reports of configure scripts using ‘dnl’ to write comments inside the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre shell syntax errors. Also, the macro expansion behavior is not consistent among all of the macros that take whitespace-separated lists, nor is it consistent between autoconf and autoheader. Address this by introducing a new m4sugar macro, currently called ‘m4_validate_w’ (I’m open to suggestions for better names). Here’s its documentation comment: | m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])), | but if that is not the same as just m4_normalize([STRING]), | issue a warning. The text of the warning is | configure.ac:N: warning: whitespace-separated-list contains macros; | configure.ac:N: in a future version of Autoconf they will not be expanded If the unexpanded form of the string contains the token ‘dnl’ then there’s an additional line: | configure.ac:N: note: ‘dnl’ is a macro All of the public macros that take a whitespace-separated list of symbols are changed to pass that argument through m4_validate_w before doing anything else with it, and the test suite is updated to verify consistent behavior for every last one of them. This addresses Savannah issues #110210 and #110211, and the harmless but annoying autoheader behavior described at https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html . In order to avoid expanding relatively expensive m4sugar macros multiple times per top-level macro invocation, several of the affected Autoconf macros are restructured along the same lines as I did for AC_REPLACE_FUNCS in the previous patch. * lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE) (AC_REPLACE_FUNCS) * lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES) * lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE) * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through m4_validate_w before use. * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers _AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C. (AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE. (AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers _AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C. * lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize. * tests/semantics.at: Add tests for expansion of M4 macros in whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
HAVE__NONEX_F_BLURF
HAVE__NONEX_F_FOO
HAVE__NONEX_F_QUUX
])
AT_CHECK_CONFIGURE
AT_CLEANUP
AT_SETUP([Macro expansion in AC_CONFIG_MACRO_DIRS])
AT_CONFIGURE_AC([[
m4@&t@_define([d_bar], [d_quux])
AC_CONFIG_MACRO_DIRS([dn@&t@l
d_foo
d_bar dn@&t@l Ordinary comment
d_blurf dn@&t@l Apos'trophed comment
])
]])
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-12 14:59:56 -04:00
AT_CHECK_AUTOCONF([-t AC_CONFIG_MACRO_DIR_TRACE], [0],
Consistently expand macros in whitespace-separated lists. Several of the most commonly used Autoconf macros (starting with AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list of symbols as their primary argument. It would abstractly be best if this list were _not_ subject to M4 macro expansion, in case there’s a collision between a M4 macro name and something to be looked for. However, we have historically not been careful about this, and there’s been reports of configure scripts using ‘dnl’ to write comments inside the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre shell syntax errors. Also, the macro expansion behavior is not consistent among all of the macros that take whitespace-separated lists, nor is it consistent between autoconf and autoheader. Address this by introducing a new m4sugar macro, currently called ‘m4_validate_w’ (I’m open to suggestions for better names). Here’s its documentation comment: | m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])), | but if that is not the same as just m4_normalize([STRING]), | issue a warning. The text of the warning is | configure.ac:N: warning: whitespace-separated-list contains macros; | configure.ac:N: in a future version of Autoconf they will not be expanded If the unexpanded form of the string contains the token ‘dnl’ then there’s an additional line: | configure.ac:N: note: ‘dnl’ is a macro All of the public macros that take a whitespace-separated list of symbols are changed to pass that argument through m4_validate_w before doing anything else with it, and the test suite is updated to verify consistent behavior for every last one of them. This addresses Savannah issues #110210 and #110211, and the harmless but annoying autoheader behavior described at https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html . In order to avoid expanding relatively expensive m4sugar macros multiple times per top-level macro invocation, several of the affected Autoconf macros are restructured along the same lines as I did for AC_REPLACE_FUNCS in the previous patch. * lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE) (AC_REPLACE_FUNCS) * lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES) * lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE) * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through m4_validate_w before use. * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers _AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C. (AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE. (AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers _AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C. * lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize. * tests/semantics.at: Add tests for expansion of M4 macros in whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
[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
],
[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_CONFIG_MACRO_DIRS is expanded from...
configure.ac:6: the top level
])
AT_CLEANUP
AT_SETUP([Macro expansion in AC_CONFIG_SUBDIRS])
(set -ex
for d in d_foo d_bar d_blurf d_quux; do
mkdir $d
printf '%s\n%s\n' '#! /bin/sh' "echo entered $d/configure" \
> $d/configure
chmod +x $d/configure
done)
AT_CONFIGURE_AC([[
m4@&t@_define([d_bar], [d_quux])
AC_CONFIG_SUBDIRS([dn@&t@l
d_foo
d_bar dn@&t@l Ordinary comment
d_blurf dn@&t@l Apos'trophed comment
])
]])
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-12 14:59:56 -04:00
AT_CHECK_AUTOCONF([], [0], [],
Consistently expand macros in whitespace-separated lists. Several of the most commonly used Autoconf macros (starting with AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list of symbols as their primary argument. It would abstractly be best if this list were _not_ subject to M4 macro expansion, in case there’s a collision between a M4 macro name and something to be looked for. However, we have historically not been careful about this, and there’s been reports of configure scripts using ‘dnl’ to write comments inside the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre shell syntax errors. Also, the macro expansion behavior is not consistent among all of the macros that take whitespace-separated lists, nor is it consistent between autoconf and autoheader. Address this by introducing a new m4sugar macro, currently called ‘m4_validate_w’ (I’m open to suggestions for better names). Here’s its documentation comment: | m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])), | but if that is not the same as just m4_normalize([STRING]), | issue a warning. The text of the warning is | configure.ac:N: warning: whitespace-separated-list contains macros; | configure.ac:N: in a future version of Autoconf they will not be expanded If the unexpanded form of the string contains the token ‘dnl’ then there’s an additional line: | configure.ac:N: note: ‘dnl’ is a macro All of the public macros that take a whitespace-separated list of symbols are changed to pass that argument through m4_validate_w before doing anything else with it, and the test suite is updated to verify consistent behavior for every last one of them. This addresses Savannah issues #110210 and #110211, and the harmless but annoying autoheader behavior described at https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html . In order to avoid expanding relatively expensive m4sugar macros multiple times per top-level macro invocation, several of the affected Autoconf macros are restructured along the same lines as I did for AC_REPLACE_FUNCS in the previous patch. * lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE) (AC_REPLACE_FUNCS) * lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES) * lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE) * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through m4_validate_w before use. * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers _AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C. (AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE. (AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers _AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C. * lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize. * tests/semantics.at: Add tests for expansion of M4 macros in whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
[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
])
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-12 14:59:56 -04:00
AT_CHECK_AUTOHEADER([-W no-obsolete])
Consistently expand macros in whitespace-separated lists. Several of the most commonly used Autoconf macros (starting with AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list of symbols as their primary argument. It would abstractly be best if this list were _not_ subject to M4 macro expansion, in case there’s a collision between a M4 macro name and something to be looked for. However, we have historically not been careful about this, and there’s been reports of configure scripts using ‘dnl’ to write comments inside the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre shell syntax errors. Also, the macro expansion behavior is not consistent among all of the macros that take whitespace-separated lists, nor is it consistent between autoconf and autoheader. Address this by introducing a new m4sugar macro, currently called ‘m4_validate_w’ (I’m open to suggestions for better names). Here’s its documentation comment: | m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])), | but if that is not the same as just m4_normalize([STRING]), | issue a warning. The text of the warning is | configure.ac:N: warning: whitespace-separated-list contains macros; | configure.ac:N: in a future version of Autoconf they will not be expanded If the unexpanded form of the string contains the token ‘dnl’ then there’s an additional line: | configure.ac:N: note: ‘dnl’ is a macro All of the public macros that take a whitespace-separated list of symbols are changed to pass that argument through m4_validate_w before doing anything else with it, and the test suite is updated to verify consistent behavior for every last one of them. This addresses Savannah issues #110210 and #110211, and the harmless but annoying autoheader behavior described at https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html . In order to avoid expanding relatively expensive m4sugar macros multiple times per top-level macro invocation, several of the affected Autoconf macros are restructured along the same lines as I did for AC_REPLACE_FUNCS in the previous patch. * lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE) (AC_REPLACE_FUNCS) * lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES) * lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE) * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through m4_validate_w before use. * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers _AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C. (AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE. (AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers _AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C. * lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize. * tests/semantics.at: Add tests for expansion of M4 macros in whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
AT_CHECK_CONFIGURE([], [0], [stdout])
AT_CHECK([grep '^entered' stdout], [0],
[[entered d_foo/configure
entered d_quux/configure
entered d_blurf/configure
]])
AT_CLEANUP
Revert to 2.69-compatible behavior in AC_PROG_LEX (#110346) Commit 29ede6b96feee29c0c477d1659081bbdb82cd8b3 caused AC_PROG_LEX to stop looking for a library that provides yywrap. This broke several packages in a Debian archive rebuild. Revert all the way to the 2.69 behavior, which was to set LEXLIB to -ll or -lfl if that library defines yywrap, but allow AC_PROG_LEX to succeed if neither -ll nor -lfl exists on the system, even if a lex program that doesn't define yywrap would need it. (This behavior was a bug, but people have come to depend on it. See https://savannah.gnu.org/support/index.php?110269 and the thread starting from https://lists.gnu.org/r/autoconf-patches/2020-07/msg00013.html for gory details.) To provide a path away from bug-compatibility, AC_PROG_LEX now takes one argument, documented as a whitespace-separated list of options. Two options are defined: ‘yywrap’ means to look for yywrap and behave as if lex is unavailable if it isn’t found; ‘noyywrap’ means to not look for yywrap at all. These are mutually exclusive. Fixes bug #110346. * lib/autoconf/programs.m4 (AC_PROG_LEX): Add an argument which can be either ‘yywrap’, meaning to look for yywrap in -ll, or ‘noyywrap’, meaning to not look for yywrap at all. In the absence of either option, issue an obsoletion warning and revert to behavior bug-compatible with 2.69. * tests/semantics.at: Add more tests of AC_PROG_LEX. * tests/mktests.sh: Exclude AC_PROG_LEX from autogenerated tests. * doc/autoconf.texi: Update documentation of AC_PROG_LEX. * NEWS: Update notes on AC_PROG_LEX.
2020-11-02 16:56:32 -05:00
## ------------------------------------- ##
## AC_PROG_LEX with and without yywrap. ##
## ------------------------------------- ##
# We don't currently have a good way of verifying that each mode
# does what it's supposed to, but we can at least put them through
# their paces as much as the autogenerated AT_CHECK_MACRO invocation
# used to, back when AC_PROG_LEX took no arguments.
AT_CHECK_MACRO([AC_PROG_LEX with yywrap], [AC_PROG_LEX([yywrap])])
AT_CHECK_MACRO([AC_PROG_LEX with noyywrap], [AC_PROG_LEX([noyywrap])])
AT_SETUP([AC_PROG_LEX in legacy mode])
AT_CONFIGURE_AC([[AC_PROG_LEX]])
AT_CHECK_AUTOHEADER([], [ignore])
AT_CHECK_AUTOCONF([], [], [],
[[configure.ac:4: warning: AC_PROG_LEX without either yywrap or noyywrap is obsolete
programs.m4: _AC_PROG_LEX is expanded from...
programs.m4: AC_PROG_LEX is expanded from...
configure.ac:4: the top level
]])
AT_CHECK_CONFIGURE
AT_CLEANUP
## ---------------------------------- ##
## Invalid arguments to AC_PROG_LEX. ##
## ---------------------------------- ##
AT_SETUP([Invalid arguments to AC_PROG_LEX])
AT_CONFIGURE_AC(
[[AC_PROG_LEX([nonsense])
]])
AT_CHECK_AUTOCONF([], [1], [],
[[configure.ac:4: error: AC_PROG_LEX: unrecognized argument: nonsense
programs.m4: _AC_PROG_LEX is expanded from...
programs.m4: AC_PROG_LEX is expanded from...
configure.ac:4: the top level
autom4te: error: m4 failed with exit status: 1
]])
AT_CONFIGURE_AC(
[[AC_PROG_LEX([too],[many])
]])
AT_CHECK_AUTOCONF([], [1], [],
[[configure.ac:4: error: too many arguments to AC_PROG_LEX
programs.m4: AC_PROG_LEX is expanded from...
configure.ac:4: the top level
autom4te: error: m4 failed with exit status: 1
]])
AT_CONFIGURE_AC(
[[AC_PROG_LEX([yywrap noyywrap])
]])
AT_CHECK_AUTOCONF([], [1], [],
[[configure.ac:4: error: AC_PROG_LEX: yywrap and noyywrap are mutually exclusive
programs.m4: _AC_PROG_LEX is expanded from...
programs.m4: AC_PROG_LEX is expanded from...
configure.ac:4: the top level
autom4te: error: m4 failed with exit status: 1
]])
AT_CONFIGURE_AC(
[[AC_PROG_LEX([noyywrap yywrap])
]])
AT_CHECK_AUTOCONF([], [1], [],
[[configure.ac:4: error: AC_PROG_LEX: yywrap and noyywrap are mutually exclusive
programs.m4: _AC_PROG_LEX is expanded from...
programs.m4: AC_PROG_LEX is expanded from...
configure.ac:4: the top level
autom4te: error: m4 failed with exit status: 1
]])
AT_CONFIGURE_AC(
[[AC_PROG_LEX([yywrap nonsense])
]])
AT_CHECK_AUTOCONF([], [1], [],
[[configure.ac:4: error: AC_PROG_LEX: unrecognized argument: yywrap nonsense
programs.m4: _AC_PROG_LEX is expanded from...
programs.m4: AC_PROG_LEX is expanded from...
configure.ac:4: the top level
autom4te: error: m4 failed with exit status: 1
]])
AT_CONFIGURE_AC(
[[AC_PROG_LEX([nonsense noyywrap])
]])
AT_CHECK_AUTOCONF([], [1], [],
[[configure.ac:4: error: AC_PROG_LEX: unrecognized argument: nonsense noyywrap
programs.m4: _AC_PROG_LEX is expanded from...
programs.m4: AC_PROG_LEX is expanded from...
configure.ac:4: the top level
autom4te: error: m4 failed with exit status: 1
]])
# A double invocation with matching arguments should be accepted
# without complaint. FIXME: verify that it runs the test only once.
AT_CONFIGURE_AC(
[[AC_PROG_LEX([noyywrap])
AC_PROG_LEX([noyywrap])
]])
AT_CHECK_AUTOCONF
# A double invocation with matching arguments should trigger a warning.
AT_CONFIGURE_AC(
[[AC_PROG_LEX([yywrap])
AC_PROG_LEX([noyywrap])
]])
AT_CHECK_AUTOCONF([], [0], [],
[[configure.ac:5: warning: AC_PROG_LEX used twice with mismatched options
programs.m4: _AC_PROG_LEX is expanded from...
programs.m4: AC_PROG_LEX is expanded from...
configure.ac:5: the top level
]])
AT_CLEANUP