* tests/base.at, tests/compile.at, tests/foreign.at,
* tests/m4sh.at, tests/m4sugar.at, tests/mktests.sh,
* tests/semantics.at, tests/suite.at, tests/tools.at,
* tests/torture.at: Ask Autotest mode, not Autoconf mode.
2001-08-20 14:44:38 +00:00
|
|
|
# -*- Autotest -*-
|
2000-02-07 11:54:29 +00:00
|
|
|
|
2000-12-07 15:21:54 +00:00
|
|
|
AT_BANNER([Semantics.])
|
2000-02-07 11:54:29 +00:00
|
|
|
|
2023-01-20 23:35:08 -06:00
|
|
|
# Copyright (C) 2000-2002, 2004-2007, 2009-2017, 2020-2023 Free Software
|
2011-01-04 16:13:09 -07:00
|
|
|
# Foundation, Inc.
|
* AUTHORS, BUGS, ChangeLog, ChangeLog.0, ChangeLog.1,
ChangeLog.2, GNUmakefile, Makefile.maint, NEWS, README,
README-alpha, TODO, configure.ac, lib/autoconf/Makefile.am,
m4/atconfig.m4, m4/init.m4, m4/m4.m4, m4/missing.m4,
m4/sanity.m4, tests/README, tests/aclocal.m4,
tests/atspecific.m4, tests/base.at, tests/compile.at,
tests/foreign.at, tests/m4sh.at, tests/m4sugar.at,
tests/semantics.at, tests/suite.at, tests/tools.at,
tests/torture.at: Add copyright notice.
* tests/mktests.sh: Update year in copyright notice.
2001-08-12 13:05:11 +00:00
|
|
|
#
|
2007-07-20 23:11:49 +00:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
* AUTHORS, BUGS, ChangeLog, ChangeLog.0, ChangeLog.1,
ChangeLog.2, GNUmakefile, Makefile.maint, NEWS, README,
README-alpha, TODO, configure.ac, lib/autoconf/Makefile.am,
m4/atconfig.m4, m4/init.m4, m4/m4.m4, m4/missing.m4,
m4/sanity.m4, tests/README, tests/aclocal.m4,
tests/atspecific.m4, tests/base.at, tests/compile.at,
tests/foreign.at, tests/m4sh.at, tests/m4sugar.at,
tests/semantics.at, tests/suite.at, tests/tools.at,
tests/torture.at: Add copyright notice.
* tests/mktests.sh: Update year in copyright notice.
2001-08-12 13:05:11 +00:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
Update License to GPLv3+ including new Autoconf Exception.
* NEWS, README: Update licensing information.
* COPYING.EXCEPTION: New file.
* Makefile.am (EXTRA_DIST): Distribute it.
* cfg.mk (autom4te-update): Remove copyright change warning.
* lib/autoconf/autoconf.m4, lib/autoconf/autoheader.m4,
lib/autoconf/autoscan.m4, lib/autoconf/autotest.m4,
lib/autoconf/autoupdate.m4, lib/autoconf/c.m4,
lib/autoconf/erlang.m4, lib/autoconf/fortran.m4,
lib/autoconf/functions.m4, lib/autoconf/general.m4,
lib/autoconf/headers.m4, lib/autoconf/lang.m4,
lib/autoconf/libs.m4, lib/autoconf/oldnames.m4,
lib/autoconf/programs.m4, lib/autoconf/specific.m4,
lib/autoconf/status.m4, lib/autoconf/types.m4,
lib/autotest/autotest.m4, lib/autotest/general.m4,
lib/autotest/specific.m4, lib/m4sugar/foreach.m4,
lib/m4sugar/m4sh.m4, lib/m4sugar/m4sugar.m4: Update exception
statement, bump to GPLv3.
* bin/autoconf.as, bin/autoheader.in, bin/autom4te.in,
bin/autoreconf.in, bin/autoscan.in, bin/autoupdate.in,
bin/ifnames.in: Bump to GPLv3+, adjust --version output
to reflect the GPLv3+ and the Autoconf Exception.
* lib/Autom4te/C4che.pm, lib/Autom4te/ChannelDefs.pm,
lib/Autom4te/General.pm, lib/Autom4te/Request.pm,
lib/autom4te.in, lib/autoscan/autoscan.pre,
lib/emacs/autoconf-mode.el, lib/emacs/autotest-mode.el,
lib/freeze.mk, tests/atlocal.in, tests/autoscan.at,
tests/autotest.at, tests/base.at, tests/c.at,
tests/compile.at, tests/erlang.at, tests/foreign.at,
tests/fortran.at, tests/local.at, tests/m4sh.at,
tests/m4sugar.at, tests/mktests.sh, tests/semantics.at,
tests/statesave.m4, tests/suite.at, tests/tools.at,
tests/torture.at, tests/wrapper.as: Bump to GPLv3+.
2009-09-09 19:53:31 +02:00
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
* AUTHORS, BUGS, ChangeLog, ChangeLog.0, ChangeLog.1,
ChangeLog.2, GNUmakefile, Makefile.maint, NEWS, README,
README-alpha, TODO, configure.ac, lib/autoconf/Makefile.am,
m4/atconfig.m4, m4/init.m4, m4/m4.m4, m4/missing.m4,
m4/sanity.m4, tests/README, tests/aclocal.m4,
tests/atspecific.m4, tests/base.at, tests/compile.at,
tests/foreign.at, tests/m4sh.at, tests/m4sugar.at,
tests/semantics.at, tests/suite.at, tests/tools.at,
tests/torture.at: Add copyright notice.
* tests/mktests.sh: Update year in copyright notice.
2001-08-12 13:05:11 +00:00
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2017-09-16 17:48:19 -07:00
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2000-03-25 09:06:24 +00:00
|
|
|
|
Eradicate AC_TRY_COMPILE.
* aclang.m4 (AC_PROG_CC_STDC, AC_C_BIGENDIAN, AC_C_INLINE,
AC_C_CONST, AC_C_VOLATILE, AC_F77_NAME_MANGLING): Use
`AC_COMPILE_IFELSE'.
* acspecific.m4 (AC_DECL_SYS_SIGLIST, _AC_CHECK_HEADER_DIRENT,
AC_HEADER_SYS_WAIT, AC_HEADER_TIME, AC_TYPE_SIGNAL,
AC_FUNC_GETLOADAVG, AC_FUNC_SELECT_ARGTYPES, AC_STRUCT_TM,
AC_CYGWIN, AC_MINGW32, AC_EMXOS2): Likewise.
* tests/semantics.m4 (C keywords): Check that AC_C_CONST,
AC_C_VOLATILE, and AC_C_INLINE function properly with GCC.
2000-05-11 13:09:05 +00:00
|
|
|
|
|
|
|
## -------------------------------- ##
|
|
|
|
## Members of the AC_CHECK family. ##
|
|
|
|
## -------------------------------- ##
|
|
|
|
|
|
|
|
|
2000-03-25 09:06:24 +00:00
|
|
|
# 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)
|
|
|
|
])
|
2001-06-06 08:25:00 +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
|
|
|
# Using : for the ACTION-IF-FOUND in each call to AC_CHECK_LIB
|
|
|
|
# prevents LIBS from accumulating copies of "-lz".
|
2001-06-06 08:25:00 +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
|
|
|
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])
|
2020-07-02 22:23:59 -07:00
|
|
|
fi
|
2001-06-06 08:25:00 +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
|
|
|
# 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
|
2001-06-06 08:25:00 +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
|
|
|
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
|
2001-06-06 08:25:00 +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
|
|
|
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
|
2001-06-06 08:25:00 +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
|
|
|
# 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
|
2001-06-06 08:25:00 +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
|
|
|
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
|
2001-06-06 08:25:00 +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
|
|
|
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
|
|
|
|
]])
|
2000-03-25 09:06:24 +00:00
|
|
|
|
|
|
|
|
2003-05-18 14:48:02 +00:00
|
|
|
# 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"
|
|
|
|
]])
|
|
|
|
|
2003-05-18 14:48:02 +00:00
|
|
|
|
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
|
|
|
|
]])
|
2003-05-18 14:48:02 +00:00
|
|
|
|
|
|
|
|
2000-03-25 09:06:24 +00:00
|
|
|
# AC_CHECK_DECLS
|
|
|
|
# --------------
|
Use -fno-builtin, not -Werror, in AC_CHECK_DECLS (#110400)
clang issues only a warning, not an error, when an undeclared
identifier that names a built-in function is used: for instance
char *(*p)(const char *, int) = strchr;
(with no `#include <string.h>`) is an error with most compilers,
a warning with clang. This broke the 2.69 implementation of
AC_CHECK_DECL. In commit 82ef7805faffa151e724aa76c245ec590d174580,
we tried to work around this quirk by using -Werror, but that put us
at risk of being tripped up by other warnings. Bug 110400 reports,
for instance, that this fragment (which is roughly what you get, after
preprocessing, when AC_CHECK_DECL is applied to a function that *is*
properly declared)
extern void ac_decl (int, char *);
int main (void)
{
(void) ac_decl;
;
return 0;
}
provokes a warning from clang (and thus an error) when -Wextra-semi-stmt
has been added to CFLAGS earlier in the configure script. The extra
semicolon comes from AC_LANG_PROGRAM, and we can’t get rid of it
because we have no way of telling reliably when someone wrote
something like
AC_LANG_PROGRAM([[#include <stdio.h>]],
[[puts("hello world")]])
with no semicolon at the end of the statement; this has been
acceptable for decades. Besides, that’s just one warning, who knows
what compilers will start complaining about tomorrow?
So: change AC_CHECK_DECL to compile its programs with -fno-builtin,
instead, when the default compilation mode fails to detect an
undeclared strchr. The code is restructured so that we can try other
options as well, if we find another compiler with the same quirk but
different command-line syntax.
(All of this logic is very C-family specific, but it appears to me
that AC_CHECK_DECL has never worked with other languages, so we can
continue to live with that for now.)
Fixes bug 110400; partially reverts 82ef7805faffa151e724aa76c245ec590d174580.
* lib/autoconf/general.m4 (_AC_UNDECLARED_WARNING): Rename to
_AC_UNDECLARED_BUILTIN. Instead of looking at diagnostic output,
loop trying to find a command-line option that makes the compiler
error out on undeclared builtins.
(_AC_CHECK_DECL_BODY): Don’t AC_REQUIRE anything here.
Make shell code language-agnostic, except for the actual test program.
Add arguments to the shell function for additional compiler options
to use.
(AC_CHECK_DECL): AC_REQUIRE _AC_UNDECLARED_BUILTIN here.
Supply $ac_{AC_LANG_ABBREV}_undeclared_builtin_options to
ac_fn_check_decl.
* tests/local.at (AT_CONFIG_CMP): Update list of variables to ignore
when comparing C and C++ configure runs.
* tests/semantics.at (AC_CHECK_DECLS): Add memcpy and strchr to
AC_CHECK_DECLS call for functions that may be known to the compiler.
* doc/autoconf.texi (AC_CHECK_DECL, AC_CHECK_DECLS): Remove note
about compiler warnings.
2020-12-23 12:14:06 -05:00
|
|
|
# Check that it performs the correct actions:
|
2000-11-29 10:11:38 +00:00
|
|
|
AT_CHECK_MACRO([AC_CHECK_DECLS],
|
2006-09-26 20:42:43 +00:00
|
|
|
[[AC_CHECK_DECLS([yes, no, myenum, mystruct, myfunc, mymacro1, mymacro2],,,
|
2015-05-13 21:11:47 -04:00
|
|
|
[[extern int yes;
|
2006-09-26 20:42:43 +00:00
|
|
|
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;
|
2022-09-01 16:19:50 -05:00
|
|
|
extern int myfunc (int);
|
2006-09-26 20:42:43 +00:00
|
|
|
#define mymacro1(arg) arg
|
2010-06-01 21:54:39 +02:00
|
|
|
#define mymacro2]])
|
Use -fno-builtin, not -Werror, in AC_CHECK_DECLS (#110400)
clang issues only a warning, not an error, when an undeclared
identifier that names a built-in function is used: for instance
char *(*p)(const char *, int) = strchr;
(with no `#include <string.h>`) is an error with most compilers,
a warning with clang. This broke the 2.69 implementation of
AC_CHECK_DECL. In commit 82ef7805faffa151e724aa76c245ec590d174580,
we tried to work around this quirk by using -Werror, but that put us
at risk of being tripped up by other warnings. Bug 110400 reports,
for instance, that this fragment (which is roughly what you get, after
preprocessing, when AC_CHECK_DECL is applied to a function that *is*
properly declared)
extern void ac_decl (int, char *);
int main (void)
{
(void) ac_decl;
;
return 0;
}
provokes a warning from clang (and thus an error) when -Wextra-semi-stmt
has been added to CFLAGS earlier in the configure script. The extra
semicolon comes from AC_LANG_PROGRAM, and we can’t get rid of it
because we have no way of telling reliably when someone wrote
something like
AC_LANG_PROGRAM([[#include <stdio.h>]],
[[puts("hello world")]])
with no semicolon at the end of the statement; this has been
acceptable for decades. Besides, that’s just one warning, who knows
what compilers will start complaining about tomorrow?
So: change AC_CHECK_DECL to compile its programs with -fno-builtin,
instead, when the default compilation mode fails to detect an
undeclared strchr. The code is restructured so that we can try other
options as well, if we find another compiler with the same quirk but
different command-line syntax.
(All of this logic is very C-family specific, but it appears to me
that AC_CHECK_DECL has never worked with other languages, so we can
continue to live with that for now.)
Fixes bug 110400; partially reverts 82ef7805faffa151e724aa76c245ec590d174580.
* lib/autoconf/general.m4 (_AC_UNDECLARED_WARNING): Rename to
_AC_UNDECLARED_BUILTIN. Instead of looking at diagnostic output,
loop trying to find a command-line option that makes the compiler
error out on undeclared builtins.
(_AC_CHECK_DECL_BODY): Don’t AC_REQUIRE anything here.
Make shell code language-agnostic, except for the actual test program.
Add arguments to the shell function for additional compiler options
to use.
(AC_CHECK_DECL): AC_REQUIRE _AC_UNDECLARED_BUILTIN here.
Supply $ac_{AC_LANG_ABBREV}_undeclared_builtin_options to
ac_fn_check_decl.
* tests/local.at (AT_CONFIG_CMP): Update list of variables to ignore
when comparing C and C++ configure runs.
* tests/semantics.at (AC_CHECK_DECLS): Add memcpy and strchr to
AC_CHECK_DECLS call for functions that may be known to the compiler.
* doc/autoconf.texi (AC_CHECK_DECL, AC_CHECK_DECLS): Remove note
about compiler warnings.
2020-12-23 12:14:06 -05:00
|
|
|
# Ensure we can detect missing declarations of functions whose
|
|
|
|
# signature may be built into the compiler.
|
|
|
|
AC_CHECK_DECLS([memcpy, strchr, strerror],,, [[]])
|
2010-06-01 21:54:39 +02:00
|
|
|
# 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)],,,
|
2010-06-01 21:54:39 +02:00
|
|
|
[[#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
|
|
|
|
]])
|
2018-11-24 20:57:43 -08:00
|
|
|
AC_LANG_WERROR
|
2010-06-01 21:54:39 +02:00
|
|
|
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])
|
2018-11-24 20:57:43 -08:00
|
|
|
fi
|
2010-06-01 21:54:39 +02:00
|
|
|
]],
|
2000-02-07 17:28:43 +00:00
|
|
|
[AT_CHECK_DEFINES(
|
2010-06-01 21:54:39 +02:00
|
|
|
[#define HAVE_DECL_BASENAM 1
|
|
|
|
#define HAVE_DECL_DIRNAM 0
|
Use -fno-builtin, not -Werror, in AC_CHECK_DECLS (#110400)
clang issues only a warning, not an error, when an undeclared
identifier that names a built-in function is used: for instance
char *(*p)(const char *, int) = strchr;
(with no `#include <string.h>`) is an error with most compilers,
a warning with clang. This broke the 2.69 implementation of
AC_CHECK_DECL. In commit 82ef7805faffa151e724aa76c245ec590d174580,
we tried to work around this quirk by using -Werror, but that put us
at risk of being tripped up by other warnings. Bug 110400 reports,
for instance, that this fragment (which is roughly what you get, after
preprocessing, when AC_CHECK_DECL is applied to a function that *is*
properly declared)
extern void ac_decl (int, char *);
int main (void)
{
(void) ac_decl;
;
return 0;
}
provokes a warning from clang (and thus an error) when -Wextra-semi-stmt
has been added to CFLAGS earlier in the configure script. The extra
semicolon comes from AC_LANG_PROGRAM, and we can’t get rid of it
because we have no way of telling reliably when someone wrote
something like
AC_LANG_PROGRAM([[#include <stdio.h>]],
[[puts("hello world")]])
with no semicolon at the end of the statement; this has been
acceptable for decades. Besides, that’s just one warning, who knows
what compilers will start complaining about tomorrow?
So: change AC_CHECK_DECL to compile its programs with -fno-builtin,
instead, when the default compilation mode fails to detect an
undeclared strchr. The code is restructured so that we can try other
options as well, if we find another compiler with the same quirk but
different command-line syntax.
(All of this logic is very C-family specific, but it appears to me
that AC_CHECK_DECL has never worked with other languages, so we can
continue to live with that for now.)
Fixes bug 110400; partially reverts 82ef7805faffa151e724aa76c245ec590d174580.
* lib/autoconf/general.m4 (_AC_UNDECLARED_WARNING): Rename to
_AC_UNDECLARED_BUILTIN. Instead of looking at diagnostic output,
loop trying to find a command-line option that makes the compiler
error out on undeclared builtins.
(_AC_CHECK_DECL_BODY): Don’t AC_REQUIRE anything here.
Make shell code language-agnostic, except for the actual test program.
Add arguments to the shell function for additional compiler options
to use.
(AC_CHECK_DECL): AC_REQUIRE _AC_UNDECLARED_BUILTIN here.
Supply $ac_{AC_LANG_ABBREV}_undeclared_builtin_options to
ac_fn_check_decl.
* tests/local.at (AT_CONFIG_CMP): Update list of variables to ignore
when comparing C and C++ configure runs.
* tests/semantics.at (AC_CHECK_DECLS): Add memcpy and strchr to
AC_CHECK_DECLS call for functions that may be known to the compiler.
* doc/autoconf.texi (AC_CHECK_DECL, AC_CHECK_DECLS): Remove note
about compiler warnings.
2020-12-23 12:14:06 -05:00
|
|
|
#define HAVE_DECL_MEMCPY 0
|
2010-06-01 21:54:39 +02:00
|
|
|
#define HAVE_DECL_MOREARGS 1
|
|
|
|
#define HAVE_DECL_MYENUM 1
|
2006-09-26 20:42:43 +00:00
|
|
|
#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
|
Use -fno-builtin, not -Werror, in AC_CHECK_DECLS (#110400)
clang issues only a warning, not an error, when an undeclared
identifier that names a built-in function is used: for instance
char *(*p)(const char *, int) = strchr;
(with no `#include <string.h>`) is an error with most compilers,
a warning with clang. This broke the 2.69 implementation of
AC_CHECK_DECL. In commit 82ef7805faffa151e724aa76c245ec590d174580,
we tried to work around this quirk by using -Werror, but that put us
at risk of being tripped up by other warnings. Bug 110400 reports,
for instance, that this fragment (which is roughly what you get, after
preprocessing, when AC_CHECK_DECL is applied to a function that *is*
properly declared)
extern void ac_decl (int, char *);
int main (void)
{
(void) ac_decl;
;
return 0;
}
provokes a warning from clang (and thus an error) when -Wextra-semi-stmt
has been added to CFLAGS earlier in the configure script. The extra
semicolon comes from AC_LANG_PROGRAM, and we can’t get rid of it
because we have no way of telling reliably when someone wrote
something like
AC_LANG_PROGRAM([[#include <stdio.h>]],
[[puts("hello world")]])
with no semicolon at the end of the statement; this has been
acceptable for decades. Besides, that’s just one warning, who knows
what compilers will start complaining about tomorrow?
So: change AC_CHECK_DECL to compile its programs with -fno-builtin,
instead, when the default compilation mode fails to detect an
undeclared strchr. The code is restructured so that we can try other
options as well, if we find another compiler with the same quirk but
different command-line syntax.
(All of this logic is very C-family specific, but it appears to me
that AC_CHECK_DECL has never worked with other languages, so we can
continue to live with that for now.)
Fixes bug 110400; partially reverts 82ef7805faffa151e724aa76c245ec590d174580.
* lib/autoconf/general.m4 (_AC_UNDECLARED_WARNING): Rename to
_AC_UNDECLARED_BUILTIN. Instead of looking at diagnostic output,
loop trying to find a command-line option that makes the compiler
error out on undeclared builtins.
(_AC_CHECK_DECL_BODY): Don’t AC_REQUIRE anything here.
Make shell code language-agnostic, except for the actual test program.
Add arguments to the shell function for additional compiler options
to use.
(AC_CHECK_DECL): AC_REQUIRE _AC_UNDECLARED_BUILTIN here.
Supply $ac_{AC_LANG_ABBREV}_undeclared_builtin_options to
ac_fn_check_decl.
* tests/local.at (AT_CONFIG_CMP): Update list of variables to ignore
when comparing C and C++ configure runs.
* tests/semantics.at (AC_CHECK_DECLS): Add memcpy and strchr to
AC_CHECK_DECLS call for functions that may be known to the compiler.
* doc/autoconf.texi (AC_CHECK_DECL, AC_CHECK_DECLS): Remove note
about compiler warnings.
2020-12-23 12:14:06 -05:00
|
|
|
#define HAVE_DECL_STRCHR 0
|
2015-05-13 21:11:47 -04:00
|
|
|
#define HAVE_DECL_STRERROR 0
|
2000-02-15 09:33:59 +00:00
|
|
|
#define HAVE_DECL_YES 1
|
2000-02-07 17:28:43 +00:00
|
|
|
])])
|
|
|
|
|
|
|
|
|
2000-03-25 09:06:24 +00:00
|
|
|
# AC_CHECK_FUNCS
|
|
|
|
# --------------
|
|
|
|
# Check that it performs the correct actions:
|
2001-01-11 15:17:13 +00:00
|
|
|
# Must define HAVE_PRINTF, but not HAVE_AUTOCONF_FTNIRP
|
2000-11-03 11:59:39 +00:00
|
|
|
AT_CHECK_MACRO([AC_CHECK_FUNCS],
|
2001-01-11 15:17:13 +00:00
|
|
|
[AC_CHECK_FUNCS(printf autoconf_ftnirp)],
|
2000-11-03 11:59:39 +00:00
|
|
|
[AT_CHECK_DEFINES(
|
2001-01-11 15:17:13 +00:00
|
|
|
[/* #undef HAVE_AUTOCONF_FTNIRP */
|
|
|
|
#define HAVE_PRINTF 1
|
2000-11-03 11:59:39 +00:00
|
|
|
])])
|
|
|
|
|
|
|
|
|
2001-02-05 10:16:32 +00:00
|
|
|
# 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.
|
2001-02-05 10:16:32 +00:00
|
|
|
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'
|
2010-09-21 17:00:09 -06:00
|
|
|
AH_TEMPLATE([HAVE_FPRINTF], [])
|
|
|
|
AH_TEMPLATE([HAVE_AUTOCONF_FTNIRPF], [])
|
2010-09-22 15:55:26 -06:00
|
|
|
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
|
|
|
])
|
2001-02-05 10:16:32 +00:00
|
|
|
AT_CHECK_CONFIGURE
|
|
|
|
AT_CHECK_ENV
|
|
|
|
AT_CHECK_DEFINES(
|
|
|
|
[/* #undef HAVE_AUTOCONF_FTNIRP */
|
2010-09-21 17:00:09 -06:00
|
|
|
/* #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 */
|
2011-06-30 09:13:41 -07:00
|
|
|
#define HAVE_FOPEN 1
|
2010-09-21 17:00:09 -06:00
|
|
|
#define HAVE_FPRINTF 1
|
2001-02-05 10:16:32 +00:00
|
|
|
#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
|
2001-02-05 10:16:32 +00:00
|
|
|
])
|
|
|
|
|
2007-05-16 09:42:25 +00:00
|
|
|
AT_CLEANUP
|
2001-02-05 10:16:32 +00:00
|
|
|
|
|
|
|
|
2000-03-25 09:06:24 +00:00
|
|
|
# AC_CHECK_HEADERS
|
|
|
|
# ----------------
|
|
|
|
# Check that it performs the correct actions:
|
AC_INCLUDES_DEFAULT: Check for presence of C90 hosted headers (#110393)
Since 1993, Autoconf has been assuming that it is safe to include any
of the headers defined by ISO C90 without checking for them; this is
inaccurate, since only a subset are necessarily available in a
C90 *freestanding* environment.
It is OK to assume the presence of a header in a macro that checks
specifically for something declared by that header (if the header is
not present, we will think the specific declaration is unavailable,
which is probably accurate for modern embedded environments). It is
also OK to continue recommending that user code use these headers
unconditionally—anyone working with a freestanding environment knows
it. But it is not OK for very generic code within Autoconf itself,
such as AC_INCLUDES_DEFAULT, to make this assumption.
Note that the set of headers that are not always available includes
stdio.h, which we have been assuming can be included unconditionally
for even longer.
In AC_INCLUDES_DEFAULT, revert to checking for string.h and stdlib.h
before including them. Also revert to defining STDC_HEADERS only when
string.h and stdlib.h are available (but do not check for float.h and
stdarg.h, as these are part of the freestanding set). Add a new check
for stdio.h. Sort the inclusion list by standard (C90 freestanding;
C90 hosted; C99; POSIX) and alphabetically within each group. Revise
all the documentation and update the testsuite.
This partially reverts commit 86c213d0e355296f026a36e3203c0813041aae89
and is a partial fix for bug #110393.
* lib/autoconf/headers.m4 (AC_CHECK_INCLUDES_DEFAULT): Check for
stdio.h, stdlib.h, and string.h before including them. Define
STDC_HEADERS only when string.h and stdlib.h are both available.
Organize includes list by standard, then alphabetically.
* doc/autoconf.texi, NEWS: Update to match.
* tests/local.at (AT_CHECK_DEFINES): Make regexes more specific.
Also expect a definition of HAVE_STDIO_H.
* tests/c.at, tests/semantics.at, tests/tools.at: Use <float.h>,
not <stdio.h>, as a header that we expect always to exist.
Add HAVE_STDIO_H to various lists of macros that are expected to
appear in config.h.
2020-12-06 11:40:39 -05:00
|
|
|
# Must define HAVE_FLOAT_H, but not HAVE_AUTOCONF_IO_H.
|
2008-11-06 10:54:51 +01:00
|
|
|
AT_SETUP([AC_CHECK_HEADERS])
|
|
|
|
|
|
|
|
AT_DATA([autoconf_io.h],
|
|
|
|
[blah blah
|
|
|
|
])
|
|
|
|
|
AC_INCLUDES_DEFAULT: Check for presence of C90 hosted headers (#110393)
Since 1993, Autoconf has been assuming that it is safe to include any
of the headers defined by ISO C90 without checking for them; this is
inaccurate, since only a subset are necessarily available in a
C90 *freestanding* environment.
It is OK to assume the presence of a header in a macro that checks
specifically for something declared by that header (if the header is
not present, we will think the specific declaration is unavailable,
which is probably accurate for modern embedded environments). It is
also OK to continue recommending that user code use these headers
unconditionally—anyone working with a freestanding environment knows
it. But it is not OK for very generic code within Autoconf itself,
such as AC_INCLUDES_DEFAULT, to make this assumption.
Note that the set of headers that are not always available includes
stdio.h, which we have been assuming can be included unconditionally
for even longer.
In AC_INCLUDES_DEFAULT, revert to checking for string.h and stdlib.h
before including them. Also revert to defining STDC_HEADERS only when
string.h and stdlib.h are available (but do not check for float.h and
stdarg.h, as these are part of the freestanding set). Add a new check
for stdio.h. Sort the inclusion list by standard (C90 freestanding;
C90 hosted; C99; POSIX) and alphabetically within each group. Revise
all the documentation and update the testsuite.
This partially reverts commit 86c213d0e355296f026a36e3203c0813041aae89
and is a partial fix for bug #110393.
* lib/autoconf/headers.m4 (AC_CHECK_INCLUDES_DEFAULT): Check for
stdio.h, stdlib.h, and string.h before including them. Define
STDC_HEADERS only when string.h and stdlib.h are both available.
Organize includes list by standard, then alphabetically.
* doc/autoconf.texi, NEWS: Update to match.
* tests/local.at (AT_CHECK_DEFINES): Make regexes more specific.
Also expect a definition of HAVE_STDIO_H.
* tests/c.at, tests/semantics.at, tests/tools.at: Use <float.h>,
not <stdio.h>, as a header that we expect always to exist.
Add HAVE_STDIO_H to various lists of macros that are expected to
appear in config.h.
2020-12-06 11:40:39 -05:00
|
|
|
AT_CONFIGURE_AC([AC_CHECK_HEADERS([float.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
|
AC_INCLUDES_DEFAULT: Check for presence of C90 hosted headers (#110393)
Since 1993, Autoconf has been assuming that it is safe to include any
of the headers defined by ISO C90 without checking for them; this is
inaccurate, since only a subset are necessarily available in a
C90 *freestanding* environment.
It is OK to assume the presence of a header in a macro that checks
specifically for something declared by that header (if the header is
not present, we will think the specific declaration is unavailable,
which is probably accurate for modern embedded environments). It is
also OK to continue recommending that user code use these headers
unconditionally—anyone working with a freestanding environment knows
it. But it is not OK for very generic code within Autoconf itself,
such as AC_INCLUDES_DEFAULT, to make this assumption.
Note that the set of headers that are not always available includes
stdio.h, which we have been assuming can be included unconditionally
for even longer.
In AC_INCLUDES_DEFAULT, revert to checking for string.h and stdlib.h
before including them. Also revert to defining STDC_HEADERS only when
string.h and stdlib.h are available (but do not check for float.h and
stdarg.h, as these are part of the freestanding set). Add a new check
for stdio.h. Sort the inclusion list by standard (C90 freestanding;
C90 hosted; C99; POSIX) and alphabetically within each group. Revise
all the documentation and update the testsuite.
This partially reverts commit 86c213d0e355296f026a36e3203c0813041aae89
and is a partial fix for bug #110393.
* lib/autoconf/headers.m4 (AC_CHECK_INCLUDES_DEFAULT): Check for
stdio.h, stdlib.h, and string.h before including them. Define
STDC_HEADERS only when string.h and stdlib.h are both available.
Organize includes list by standard, then alphabetically.
* doc/autoconf.texi, NEWS: Update to match.
* tests/local.at (AT_CHECK_DEFINES): Make regexes more specific.
Also expect a definition of HAVE_STDIO_H.
* tests/c.at, tests/semantics.at, tests/tools.at: Use <float.h>,
not <stdio.h>, as a header that we expect always to exist.
Add HAVE_STDIO_H to various lists of macros that are expected to
appear in config.h.
2020-12-06 11:40:39 -05:00
|
|
|
HAVE_FLOAT_H
|
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
|
|
|
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
|
|
|
|
])
|
2013-09-13 20:42:04 -04:00
|
|
|
AT_CHECK_CONFIGURE([CPPFLAGS=-I.])
|
2008-11-06 10:54:51 +01:00
|
|
|
AT_CHECK_ENV
|
|
|
|
AT_CHECK_DEFINES(
|
2000-02-07 17:28:43 +00:00
|
|
|
[/* #undef HAVE_AUTOCONF_IO_H */
|
AC_INCLUDES_DEFAULT: Check for presence of C90 hosted headers (#110393)
Since 1993, Autoconf has been assuming that it is safe to include any
of the headers defined by ISO C90 without checking for them; this is
inaccurate, since only a subset are necessarily available in a
C90 *freestanding* environment.
It is OK to assume the presence of a header in a macro that checks
specifically for something declared by that header (if the header is
not present, we will think the specific declaration is unavailable,
which is probably accurate for modern embedded environments). It is
also OK to continue recommending that user code use these headers
unconditionally—anyone working with a freestanding environment knows
it. But it is not OK for very generic code within Autoconf itself,
such as AC_INCLUDES_DEFAULT, to make this assumption.
Note that the set of headers that are not always available includes
stdio.h, which we have been assuming can be included unconditionally
for even longer.
In AC_INCLUDES_DEFAULT, revert to checking for string.h and stdlib.h
before including them. Also revert to defining STDC_HEADERS only when
string.h and stdlib.h are available (but do not check for float.h and
stdarg.h, as these are part of the freestanding set). Add a new check
for stdio.h. Sort the inclusion list by standard (C90 freestanding;
C90 hosted; C99; POSIX) and alphabetically within each group. Revise
all the documentation and update the testsuite.
This partially reverts commit 86c213d0e355296f026a36e3203c0813041aae89
and is a partial fix for bug #110393.
* lib/autoconf/headers.m4 (AC_CHECK_INCLUDES_DEFAULT): Check for
stdio.h, stdlib.h, and string.h before including them. Define
STDC_HEADERS only when string.h and stdlib.h are both available.
Organize includes list by standard, then alphabetically.
* doc/autoconf.texi, NEWS: Update to match.
* tests/local.at (AT_CHECK_DEFINES): Make regexes more specific.
Also expect a definition of HAVE_STDIO_H.
* tests/c.at, tests/semantics.at, tests/tools.at: Use <float.h>,
not <stdio.h>, as a header that we expect always to exist.
Add HAVE_STDIO_H to various lists of macros that are expected to
appear in config.h.
2020-12-06 11:40:39 -05:00
|
|
|
#define HAVE_FLOAT_H 1
|
2008-11-06 10:54:51 +01:00
|
|
|
])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
2000-02-07 17:28:43 +00:00
|
|
|
|
|
|
|
|
2003-05-18 14:48:02 +00:00
|
|
|
# AC_CHECK_HEADERS_OLD
|
|
|
|
# --------------------
|
|
|
|
# Check that it performs the correct actions:
|
|
|
|
# Must not check prerequisites, hence define header2.h
|
2008-10-31 16:53:17 +01:00
|
|
|
AT_SETUP([AC_CHECK_HEADERS (preprocessor test)])
|
2003-05-18 14:48:02 +00:00
|
|
|
|
|
|
|
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], [], [], [-])]])
|
2003-05-18 14:48:02 +00: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_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
|
2013-09-13 20:42:04 -04:00
|
|
|
configure.ac:4: deprecated. Specify prerequisite code to AC_CHECK_HEADER
|
2021-07-20 16:01:43 -05:00
|
|
|
configure.ac:4: instead of using fourth argument '-'. (Many headers need
|
2013-09-13 20:42:04 -04:00
|
|
|
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...
|
2013-09-13 20:42:04 -04:00
|
|
|
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])
|
2005-02-05 04:55:08 +00:00
|
|
|
AT_CHECK_CONFIGURE([CPPFLAGS=-I.])
|
2003-05-18 14:48:02 +00:00
|
|
|
AT_CHECK_ENV
|
|
|
|
AT_CHECK_DEFINES(
|
|
|
|
[#define HAVE_HEADER2_H 1
|
|
|
|
])
|
|
|
|
|
2007-05-16 09:42:25 +00:00
|
|
|
AT_CLEANUP
|
2003-05-18 14:48:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
# AC_CHECK_HEADERS_NEW
|
|
|
|
# --------------------
|
|
|
|
# Check that it performs the correct actions:
|
|
|
|
# Must check prerequisites, hence define header2.h but not header3.h
|
2008-10-31 16:53:17 +01:00
|
|
|
AT_SETUP([AC_CHECK_HEADERS (compiler test)])
|
2003-05-18 14:48:02 +00:00
|
|
|
|
|
|
|
AT_DATA([header1.h],
|
|
|
|
[typedef int foo;
|
|
|
|
])
|
|
|
|
|
|
|
|
AT_DATA([header2.h],
|
|
|
|
[typedef foo bar;
|
|
|
|
])
|
|
|
|
|
|
|
|
AT_DATA([header3.h],
|
|
|
|
[typedef bar wow;
|
|
|
|
])
|
|
|
|
|
|
|
|
AT_CONFIGURE_AC(
|
2005-02-05 04:55:08 +00:00
|
|
|
[AC_CHECK_HEADERS(header2.h header3.h, [], [], [[@%:@include "header1.h"]])])
|
2003-05-18 14:48:02 +00: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_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
|
|
|
|
])
|
2005-02-05 04:55:08 +00:00
|
|
|
AT_CHECK_CONFIGURE([CPPFLAGS=-I.])
|
2003-05-18 14:48:02 +00:00
|
|
|
AT_CHECK_ENV
|
|
|
|
AT_CHECK_DEFINES(
|
|
|
|
[#define HAVE_HEADER2_H 1
|
|
|
|
/* #undef HAVE_HEADER3_H */
|
|
|
|
])
|
|
|
|
|
2007-05-16 09:42:25 +00:00
|
|
|
AT_CLEANUP
|
2003-05-18 14:48:02 +00:00
|
|
|
|
|
|
|
|
2009-08-10 20:35:12 +02:00
|
|
|
# AC_CHECK_MEMBER
|
Formatting cleanups in macro comments.
For a list of candidate unaligned underlines, use this script:
for f in `git ls-files`; do
awk '{ len[NR] = length($0) }
/----*/ && len[NR-1] != 0 {
if (len[NR-1] != len[NR])
print FILENAME ":" NR ":" $0
}' $f
done
* lib/autoconf/c.m4, lib/autoconf/erlang.m4,
lib/autoconf/fortran.m4, lib/autoconf/functions.m4,
lib/autoconf/general.m4, lib/autoconf/lang.m4,
lib/autoconf/programs.m4, lib/autoconf/specific.m4,
lib/autoconf/status.m4, lib/autoconf/types.m4,
lib/autotest/general.m4, lib/autotest/specific.m4,
lib/m4sugar/m4sh.m4, lib/m4sugar/m4sugar.m4,
tests/autotest.at, tests/local.at, tests/m4sh.at,
tests/semantics.at, tests/tools.at, tests/torture.at: Fix macro
comment format.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2010-03-12 06:58:46 +01:00
|
|
|
# ---------------
|
2009-08-10 20:35:12 +02:00
|
|
|
# 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],
|
2021-07-20 16:01:43 -05:00
|
|
|
[Define to 1 if 'yes' is a member of 'struct yes_s'.])],,
|
2009-08-10 20:35:12 +02:00
|
|
|
[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],
|
2021-07-20 16:01:43 -05:00
|
|
|
[Define to 1 if 'no' is a member of 'struct yes_s'.])],,
|
2009-08-10 20:35:12 +02:00
|
|
|
[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],
|
2021-07-20 16:01:43 -05:00
|
|
|
[Define to 1 if 'substruct' is a member of 'struct yes_s'.])],,
|
2009-08-10 20:35:12 +02:00
|
|
|
[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
|
|
|
|
])])
|
|
|
|
|
2000-03-25 09:06:24 +00:00
|
|
|
# AC_CHECK_MEMBERS
|
|
|
|
# ----------------
|
|
|
|
# Check that it performs the correct actions.
|
2000-04-11 12:07:45 +00:00
|
|
|
# Must define HAVE_STRUCT_YES_S_YES, but not HAVE_STRUCT_YES_S_NO.
|
2000-11-29 10:11:38 +00:00
|
|
|
AT_CHECK_MACRO([AC_CHECK_MEMBERS],
|
2006-09-26 18:07:16 +00:00
|
|
|
[[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; };])]],
|
2000-02-07 17:28:43 +00:00
|
|
|
[AT_CHECK_DEFINES(
|
2000-04-11 12:07:45 +00:00
|
|
|
[/* #undef HAVE_STRUCT_YES_S_NO */
|
2006-09-26 18:07:16 +00:00
|
|
|
#define HAVE_STRUCT_YES_S_SUBSTRUCT 1
|
2000-04-11 12:07:45 +00:00
|
|
|
#define HAVE_STRUCT_YES_S_YES 1
|
2009-08-10 20:35:12 +02:00
|
|
|
])
|
|
|
|
AT_CHECK([grep 'yes.*member of.*yes_s' config.h], [], [ignore])
|
|
|
|
])
|
2000-02-07 11:54:29 +00:00
|
|
|
|
|
|
|
|
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
|
|
|
|
])])
|
|
|
|
|
|
|
|
|
2006-03-11 13:22:42 +00:00
|
|
|
# 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],
|
2006-03-11 13:22:42 +00:00
|
|
|
[[AC_CHECK_ALIGNOF([struct { char c; }])
|
|
|
|
AC_CHECK_ALIGNOF([struct nosuchstruct])
|
|
|
|
]],
|
2010-07-06 22:00:44 +02:00
|
|
|
[AT_CHECK([[grep "#define ALIGNOF_STRUCT___CHAR_C___ [1-9]" config.h]],
|
2006-03-11 13:22:42 +00:00
|
|
|
0, ignore)
|
|
|
|
AT_CHECK([[grep "#define ALIGNOF_STRUCT_NOSUCHSTRUCT 0" config.h]],
|
|
|
|
0, ignore)
|
|
|
|
])
|
|
|
|
|
2000-03-25 09:06:24 +00:00
|
|
|
# AC_CHECK_SIZEOF
|
2000-04-11 12:07:45 +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
|
|
|
AT_CHECK_MACRO([AC_CHECK_SIZEOF],
|
2000-11-29 14:14:10 +00:00
|
|
|
[[AC_CHECK_SIZEOF(char)
|
2000-02-07 17:28:43 +00:00
|
|
|
AC_CHECK_SIZEOF(charchar,,
|
2000-11-29 14:14:10 +00:00
|
|
|
[[#include <stdio.h>
|
|
|
|
typedef char charchar[2];]])
|
2000-05-26 11:33:54 +00:00
|
|
|
AC_CHECK_SIZEOF(charcharchar)
|
2002-01-30 15:11:49 +00:00
|
|
|
]],
|
|
|
|
[AT_CHECK_DEFINES(
|
|
|
|
[#define SIZEOF_CHAR 1
|
|
|
|
#define SIZEOF_CHARCHAR 2
|
|
|
|
#define SIZEOF_CHARCHARCHAR 0
|
|
|
|
])])
|
|
|
|
|
2000-05-26 11:33:54 +00:00
|
|
|
|
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],
|
2006-03-11 13:22:42 +00:00
|
|
|
[[AC_C_CONST
|
2007-04-13 07:52:57 +00:00
|
|
|
AC_CHECK_SIZEOF([struct x], [], [struct x { char c; int x; };])
|
|
|
|
AC_CHECK_SIZEOF([const struct x], [], [struct x { const char *p; int x; };])
|
2006-03-11 13:22:42 +00:00
|
|
|
AC_CHECK_SIZEOF([struct nosuchstruct])
|
2010-07-06 22:00:44 +02:00
|
|
|
# Taken from autoconf.texi:Generic Compiler Characteristics.
|
|
|
|
AC_CHECK_SIZEOF([int *])
|
2006-03-11 13:22:42 +00:00
|
|
|
]],
|
2010-07-06 22:00:44 +02:00
|
|
|
[AT_CHECK([[grep "#define SIZEOF_STRUCT_X [1-9]" config.h]],
|
2006-03-11 13:22:42 +00:00
|
|
|
0, ignore)
|
2010-07-06 22:00:44 +02:00
|
|
|
AT_CHECK([[grep "#define SIZEOF_CONST_STRUCT_X [1-9]" config.h]],
|
2006-03-11 13:22:42 +00:00
|
|
|
0, ignore)
|
|
|
|
AT_CHECK([[grep "#define SIZEOF_STRUCT_NOSUCHSTRUCT 0" config.h]],
|
|
|
|
0, ignore)
|
2010-07-06 22:00:44 +02:00
|
|
|
AT_CHECK([[grep "#define SIZEOF_INT_P [1-9]" config.h]],
|
|
|
|
0, ignore)
|
2006-03-11 13:22:42 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
|
2000-03-25 09:06:24 +00:00
|
|
|
# AC_CHECK_TYPES
|
|
|
|
# --------------
|
|
|
|
# Check that it performs the correct actions.
|
2000-04-11 12:07:45 +00:00
|
|
|
# Must define HAVE_STRUCT_YES_S, HAVE_INT, but not HAVE_STRUCT_NO_S.
|
2021-07-20 16:01:43 -05:00
|
|
|
# 'int' and 'struct yes_s' are both checked to test both the compiler
|
2000-03-25 09:06:24 +00:00
|
|
|
# builtin types, and defined types.
|
2000-11-29 10:11:38 +00:00
|
|
|
AT_CHECK_MACRO([AC_CHECK_TYPES],
|
2000-05-10 16:16:31 +00:00
|
|
|
[[AC_CHECK_TYPES([int, struct yes_s, struct no_s],,,
|
* aclocal.m4, bin/autoconf.as, lib/autoconf/autoconf.m4,
* lib/autoconf/autoheader.m4, lib/autoconf/autoupdate.m4,
* lib/autoconf/c.m4, lib/autoconf/fortran.m4,
* lib/autoconf/general.m4, lib/autoconf/headers.m4,
* lib/autoconf/lang.m4, lib/autoconf/libs.m4,
* lib/autoconf/programs.m4, lib/autoconf/specific.m4,
* lib/autoconf/status.m4, lib/autoconf/types.m4,
* lib/autotest/general.m4, lib/m4sugar/m4sugar.m4,
* tests/atspecific.m4, tests/base.at, tests/compile.at,
* tests/foreign.at, tests/m4sh.at, tests/semantics.at,
* tests/tools.at, tests/torture.at:
Whitespace clean up.
Suggested by Jim Meyering.
2003-05-22 13:24:04 +00:00
|
|
|
[struct yes_s { int yes ;} ;])]],
|
2000-02-07 17:28:43 +00:00
|
|
|
[AT_CHECK_DEFINES(
|
|
|
|
[#define HAVE_INT 1
|
2000-04-11 12:07:45 +00:00
|
|
|
/* #undef HAVE_STRUCT_NO_S */
|
|
|
|
#define HAVE_STRUCT_YES_S 1
|
2000-02-07 11:54:29 +00:00
|
|
|
])])
|
2000-02-10 09:40:55 +00:00
|
|
|
|
|
|
|
|
2000-03-25 09:06:24 +00:00
|
|
|
# AC_CHECK_TYPES
|
|
|
|
# --------------
|
|
|
|
# Check that we properly dispatch properly to the old implementation
|
|
|
|
# or to the new one.
|
2000-12-14 15:36:47 +00:00
|
|
|
AT_SETUP([AC_CHECK_TYPES: backward compatibility])
|
2000-02-10 10:24:10 +00:00
|
|
|
|
2001-08-20 14:45:09 +00:00
|
|
|
AT_DATA([configure.ac],
|
2000-02-10 10:24:10 +00:00
|
|
|
[[AC_INIT
|
Get rid of the m4 name spaces.
* libm4.m4 (m4_changequote, m4_define, m4_defn, m4_dnl, m4_indir,
m4_popdef, m4_pushdef, m4_undefine, m4_namespace_push,
m4_namespace_pop, m4_namespace_register, m4_namespace_define,
m4_disable, m4_enable): Removed.
All dependencies adjusted.
* libm4.m4: Remove all the name space initialization.
* acgeneral.m4: Adjust.
(AU_DEFINE): Redefine as `AC_DEFUN'.
* autoupdate.m4: Adjust.
* tests/tools.m4: Temporarily disable the `autoupdate' test.
2000-05-11 13:28:47 +00:00
|
|
|
define([_AC_CHECK_TYPE_NEW], [NEW])
|
|
|
|
define([_AC_CHECK_TYPE_OLD], [OLD])
|
2000-02-10 10:24:10 +00:00
|
|
|
#(cut-from-here
|
|
|
|
AC_CHECK_TYPE(ptrdiff_t)
|
|
|
|
AC_CHECK_TYPE(ptrdiff_t, int)
|
2004-03-30 07:55:25 +00:00
|
|
|
AC_CHECK_TYPE(quad, long long int)
|
2000-02-10 10:24:10 +00:00
|
|
|
AC_CHECK_TYPE(table_42, [int[42]])
|
2000-03-25 09:06:24 +00:00
|
|
|
# Nice machine!
|
2000-02-10 10:24:10 +00:00
|
|
|
AC_CHECK_TYPE(uint8_t, uint65536_t)
|
|
|
|
AC_CHECK_TYPE(a,b,c,d)
|
|
|
|
#to-here)
|
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
|
2001-07-17 10:01:09 +00:00
|
|
|
AT_CHECK_AUTOCONF
|
2000-02-17 09:38:08 +00:00
|
|
|
AT_CHECK([[sed -e '/^#(cut-from-here/,/^#to-here)/!d' -e '/^#/d' configure]],
|
* aclocal.m4, bin/autoconf.as, lib/autoconf/autoconf.m4,
* lib/autoconf/autoheader.m4, lib/autoconf/autoupdate.m4,
* lib/autoconf/c.m4, lib/autoconf/fortran.m4,
* lib/autoconf/general.m4, lib/autoconf/headers.m4,
* lib/autoconf/lang.m4, lib/autoconf/libs.m4,
* lib/autoconf/programs.m4, lib/autoconf/specific.m4,
* lib/autoconf/status.m4, lib/autoconf/types.m4,
* lib/autotest/general.m4, lib/m4sugar/m4sugar.m4,
* tests/atspecific.m4, tests/base.at, tests/compile.at,
* tests/foreign.at, tests/m4sh.at, tests/semantics.at,
* tests/tools.at, tests/torture.at:
Whitespace clean up.
Suggested by Jim Meyering.
2003-05-22 13:24:04 +00:00
|
|
|
0,
|
|
|
|
[NEW
|
2000-02-10 10:24:10 +00:00
|
|
|
OLD
|
|
|
|
OLD
|
|
|
|
OLD
|
2001-07-17 10:01:09 +00:00
|
|
|
OLD
|
2000-02-10 10:24:10 +00:00
|
|
|
NEW
|
|
|
|
])
|
|
|
|
|
2000-12-19 08:15:48 +00:00
|
|
|
AT_CLEANUP
|
2000-02-10 10:24:10 +00:00
|
|
|
|
|
|
|
|
2000-03-25 09:06:24 +00:00
|
|
|
# AC_CHECK_FILES
|
|
|
|
# --------------
|
|
|
|
# FIXME: To really test HAVE_AC_EXISTS2 and HAVE_AC_MISSING2 we need to
|
2021-07-20 16:01:43 -05:00
|
|
|
# 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
|
2001-01-18 09:30:10 +00:00
|
|
|
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]],
|
|
|
|
[], [],
|
2000-02-10 09:40:55 +00:00
|
|
|
[AT_CHECK_DEFINES(
|
2001-01-18 09:30:10 +00:00
|
|
|
[#define HAVE_AT_EXISTS1 1
|
|
|
|
/* #undef HAVE_AT_MISSING1 */
|
2000-02-10 09:40:55 +00:00
|
|
|
])])
|
2000-03-03 14:15:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2000-03-21 12:22:27 +00:00
|
|
|
## ------------------------------ ##
|
|
|
|
## AC_CHECK_PROG & AC_PATH_PROG. ##
|
|
|
|
## ------------------------------ ##
|
2000-03-03 14:15:41 +00:00
|
|
|
|
|
|
|
|
2000-10-27 14:15:28 +00:00
|
|
|
# AT_CHECK_PROGS_PREPARE
|
|
|
|
# ----------------------
|
2021-07-20 16:01:43 -05:00
|
|
|
# Create a sub directory 'path' with 6 subdirs which all 7 contain
|
|
|
|
# an executable 'tool'. '6' contains a 'better' tool.
|
2000-11-29 10:11:38 +00:00
|
|
|
m4_define([AT_CHECK_PROGS_PREPARE],
|
2000-10-27 14:15:28 +00:00
|
|
|
[mkdir path
|
2000-03-03 14:15:41 +00:00
|
|
|
|
|
|
|
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
|
2000-10-27 14:15:28 +00:00
|
|
|
cp path/tool path/6/better])
|
2000-03-03 14:15:41 +00:00
|
|
|
|
2000-03-21 12:22:27 +00:00
|
|
|
|
|
|
|
# -------------------------------- #
|
|
|
|
# AC_CHECK_PROG & AC_CHECK_PROGS. #
|
|
|
|
# -------------------------------- #
|
|
|
|
|
2000-11-29 10:11:38 +00:00
|
|
|
AT_SETUP([AC_CHECK_PROG & AC_CHECK_PROGS])
|
2000-10-27 14:15:28 +00:00
|
|
|
|
|
|
|
AT_CHECK_PROGS_PREPARE
|
|
|
|
|
2001-08-20 14:45:09 +00:00
|
|
|
AT_DATA([configure.ac],
|
2000-03-03 14:15:41 +00:00
|
|
|
[[AC_INIT
|
2000-03-21 12:22:27 +00:00
|
|
|
pwd=`pwd`
|
2001-09-10 07:17:41 +00:00
|
|
|
p="1${PATH_SEPARATOR}2${PATH_SEPARATOR}3${PATH_SEPARATOR}4${PATH_SEPARATOR}5${PATH_SEPARATOR}6"
|
Fix Posix-conformance bugs re use of { command in sed scripts,
and improve the sed-related documentation a bit.
* doc/autoconf.texi (Installation Directory Variables): Use
our own style advice re 's,a,b,' versus 's|a|b|'. Use "Sed"
rather than "sed" when talking about Sed in general.
(Particular Programs): Likewise.
(Coding Style): y is like s with respect to / and ,.
(Limitations of Usual Tools): Document the weird restrictions
that Posix has about { }. Use better quoting.
* lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE, _AC_OUTPUT_HEADER):
Rewrite to conform to Posix rules about { } in sed scripts.
* lib/m4sugar/m4sh.m4 (AS_DIRNAME_SED, AS_BASENAME_SED): Likewise.
* tests/foreign.at (Libtool): Likewise.
* tests/semantics.at (AC_CHECK_PROG & AC_CHECK_PROGS):
Use our own style advice re 's,a,b,' versus 's|a|b|'.
2006-01-05 21:43:44 +00:00
|
|
|
path=`echo $p | sed -e 's,\([[0-9]]\),'"$pwd"'/path/\1,g'`
|
2000-10-27 14:15:28 +00:00
|
|
|
fail=false
|
2000-03-03 14:15:41 +00:00
|
|
|
|
|
|
|
AC_CHECK_PROG(TOOL1, tool, found, not-found, $path)
|
2000-10-27 14:15:28 +00:00
|
|
|
test "$TOOL1" = found || fail=:
|
2000-03-03 14:15:41 +00:00
|
|
|
|
|
|
|
# Yes, the semantics of this macro is weird.
|
|
|
|
AC_CHECK_PROG(TOOL2, tool,, not-found, $path)
|
2000-10-27 14:15:28 +00:00
|
|
|
test "$TOOL2" = not-found || fail=:
|
2000-03-03 14:15:41 +00:00
|
|
|
|
2000-03-21 12:22:27 +00:00
|
|
|
AC_CHECK_PROG(TOOL3, tool, tool, not-found, $path, $pwd/path/1/tool)
|
2005-03-23 01:01:58 +00:00
|
|
|
test "$TOOL3" = "$pwd/path/2/tool" || fail=:
|
2000-03-03 14:15:41 +00:00
|
|
|
|
2000-03-21 12:22:27 +00:00
|
|
|
AC_CHECK_PROG(TOOL4, better, better, not-found, $path, $pwd/path/1/tool)
|
2000-10-27 14:15:28 +00:00
|
|
|
test "$TOOL4" = better || fail=:
|
2000-03-03 14:15:41 +00:00
|
|
|
|
|
|
|
# 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)
|
2000-10-27 14:15:28 +00:00
|
|
|
test -z "$TOOL5" || fail=:
|
2000-03-03 14:15:41 +00:00
|
|
|
|
|
|
|
AC_CHECK_PROGS(TOOL6, missing tool better,, $path)
|
2000-10-27 14:15:28 +00:00
|
|
|
test "$TOOL6" = tool || fail=:
|
2000-03-03 14:15:41 +00:00
|
|
|
|
2000-10-27 14:15:28 +00:00
|
|
|
$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
|
2000-03-03 14:15:41 +00:00
|
|
|
]])
|
|
|
|
|
2000-11-23 09:52:35 +00:00
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
AT_CHECK_CONFIGURE
|
2000-03-03 14:15:41 +00:00
|
|
|
|
2007-05-16 09:42:25 +00:00
|
|
|
AT_CLEANUP
|
2000-10-27 14:15:28 +00:00
|
|
|
|
2001-08-12 12:35:50 +00:00
|
|
|
|
2001-08-31 13:32:54 +00:00
|
|
|
|
|
|
|
## ---------------- ##
|
|
|
|
## AC_C_BIGENDIAN. ##
|
|
|
|
## ---------------- ##
|
|
|
|
|
2005-02-05 08:28:35 +00:00
|
|
|
AT_SETUP([AC_C_BIGENDIAN])
|
2001-09-13 06:53:19 +00:00
|
|
|
AT_KEYWORDS([cross])
|
2001-08-12 12:35:50 +00:00
|
|
|
|
|
|
|
# Make sure that AC_C_BIGENDIAN behave the same whether we are
|
2001-08-12 15:20:29 +00:00
|
|
|
# cross-compiling or not.
|
|
|
|
|
|
|
|
_AT_CHECK_AC_MACRO(
|
2007-03-01 00:18:28 +00:00
|
|
|
[[AC_C_BIGENDIAN(
|
|
|
|
[ac_endian=big],
|
|
|
|
[ac_endian=little],
|
|
|
|
[ac_endian=unknown],
|
|
|
|
[ac_endian=universal])
|
2001-08-12 15:20:29 +00:00
|
|
|
echo $ac_endian > at-endian
|
2005-09-27 16:08:10 +00:00
|
|
|
]])
|
2001-08-12 12:35:50 +00:00
|
|
|
|
|
|
|
rm -f config.hin # So that next run of autoheader is quiet.
|
|
|
|
_AT_CHECK_AC_MACRO(
|
2006-03-17 20:37:26 +00:00
|
|
|
[[# Force cross compiling.
|
|
|
|
cross_compiling=yes
|
|
|
|
ac_tool_warned=yes
|
2007-03-01 00:18:28 +00:00
|
|
|
AC_C_BIGENDIAN(
|
|
|
|
[ac_endian=big],
|
|
|
|
[ac_endian=little],
|
|
|
|
[ac_endian=unknown],
|
|
|
|
[ac_endian=universal])
|
2001-08-12 15:20:29 +00:00
|
|
|
ac_prevendian=`cat at-endian`
|
2002-06-27 07:50:42 +00:00
|
|
|
# Check that we have found the same result as in the previous run
|
2001-08-12 15:20:29 +00:00
|
|
|
# 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).
|
2002-06-27 07:50:42 +00:00
|
|
|
if test $ac_endian != $ac_prevendian && test $ac_endian != unknown; then
|
2001-08-12 15:20:29 +00:00
|
|
|
AC_MSG_ERROR([unexpected endianness: first run found '$ac_prevendian' but second run found '$ac_endian'])
|
|
|
|
fi
|
2005-09-27 16:08:10 +00:00
|
|
|
]])
|
2001-08-12 12:35:50 +00:00
|
|
|
|
2007-03-01 00:18:28 +00:00
|
|
|
# Make sure AC_C_BIGENDIAN with no argument will create a config.h template
|
|
|
|
# containing "WORDS_BIGENDIAN".
|
2005-09-27 16:08:10 +00:00
|
|
|
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
|
AC_INCLUDES_DEFAULT: Check for presence of C90 hosted headers (#110393)
Since 1993, Autoconf has been assuming that it is safe to include any
of the headers defined by ISO C90 without checking for them; this is
inaccurate, since only a subset are necessarily available in a
C90 *freestanding* environment.
It is OK to assume the presence of a header in a macro that checks
specifically for something declared by that header (if the header is
not present, we will think the specific declaration is unavailable,
which is probably accurate for modern embedded environments). It is
also OK to continue recommending that user code use these headers
unconditionally—anyone working with a freestanding environment knows
it. But it is not OK for very generic code within Autoconf itself,
such as AC_INCLUDES_DEFAULT, to make this assumption.
Note that the set of headers that are not always available includes
stdio.h, which we have been assuming can be included unconditionally
for even longer.
In AC_INCLUDES_DEFAULT, revert to checking for string.h and stdlib.h
before including them. Also revert to defining STDC_HEADERS only when
string.h and stdlib.h are available (but do not check for float.h and
stdarg.h, as these are part of the freestanding set). Add a new check
for stdio.h. Sort the inclusion list by standard (C90 freestanding;
C90 hosted; C99; POSIX) and alphabetically within each group. Revise
all the documentation and update the testsuite.
This partially reverts commit 86c213d0e355296f026a36e3203c0813041aae89
and is a partial fix for bug #110393.
* lib/autoconf/headers.m4 (AC_CHECK_INCLUDES_DEFAULT): Check for
stdio.h, stdlib.h, and string.h before including them. Define
STDC_HEADERS only when string.h and stdlib.h are both available.
Organize includes list by standard, then alphabetically.
* doc/autoconf.texi, NEWS: Update to match.
* tests/local.at (AT_CHECK_DEFINES): Make regexes more specific.
Also expect a definition of HAVE_STDIO_H.
* tests/c.at, tests/semantics.at, tests/tools.at: Use <float.h>,
not <stdio.h>, as a header that we expect always to exist.
Add HAVE_STDIO_H to various lists of macros that are expected to
appear in config.h.
2020-12-06 11:40:39 -05:00
|
|
|
HAVE_STDIO_H
|
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
|
|
|
HAVE_STDLIB_H
|
|
|
|
HAVE_STRINGS_H
|
|
|
|
HAVE_STRING_H
|
|
|
|
HAVE_SYS_STAT_H
|
|
|
|
HAVE_SYS_TYPES_H
|
|
|
|
HAVE_UNISTD_H
|
|
|
|
STDC_HEADERS
|
|
|
|
WORDS_BIGENDIAN
|
|
|
|
])
|
2001-08-12 12:35:50 +00:00
|
|
|
AT_CHECK([grep WORDS_BIGENDIAN config.hin], [], [ignore])
|
|
|
|
|
2007-05-16 09:42:25 +00:00
|
|
|
AT_CLEANUP
|
2000-03-21 12:22:27 +00:00
|
|
|
|
2001-08-31 13:32:54 +00:00
|
|
|
|
2000-03-21 12:22:27 +00:00
|
|
|
# ------------------------------ #
|
|
|
|
# AC_PATH_PROG & AC_PATH_PROGS. #
|
|
|
|
# ------------------------------ #
|
|
|
|
|
2005-02-05 08:28:35 +00:00
|
|
|
AT_SETUP([AC_PATH_PROG & AC_PATH_PROGS])
|
2000-10-27 14:15:28 +00:00
|
|
|
|
|
|
|
AT_CHECK_PROGS_PREPARE
|
|
|
|
|
2001-08-20 14:45:09 +00:00
|
|
|
AT_DATA([configure.ac],
|
2000-03-21 12:22:27 +00:00
|
|
|
[[AC_INIT
|
|
|
|
pwd=`pwd`
|
2001-09-10 07:17:41 +00:00
|
|
|
p="1${PATH_SEPARATOR}2${PATH_SEPARATOR}3${PATH_SEPARATOR}4${PATH_SEPARATOR}5${PATH_SEPARATOR}6"
|
Fix Posix-conformance bugs re use of { command in sed scripts,
and improve the sed-related documentation a bit.
* doc/autoconf.texi (Installation Directory Variables): Use
our own style advice re 's,a,b,' versus 's|a|b|'. Use "Sed"
rather than "sed" when talking about Sed in general.
(Particular Programs): Likewise.
(Coding Style): y is like s with respect to / and ,.
(Limitations of Usual Tools): Document the weird restrictions
that Posix has about { }. Use better quoting.
* lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE, _AC_OUTPUT_HEADER):
Rewrite to conform to Posix rules about { } in sed scripts.
* lib/m4sugar/m4sh.m4 (AS_DIRNAME_SED, AS_BASENAME_SED): Likewise.
* tests/foreign.at (Libtool): Likewise.
* tests/semantics.at (AC_CHECK_PROG & AC_CHECK_PROGS):
Use our own style advice re 's,a,b,' versus 's|a|b|'.
2006-01-05 21:43:44 +00:00
|
|
|
path=`echo $p | sed -e 's,\([[0-9]]\),'"$pwd"'/path/\1,g'`
|
2000-10-27 14:15:28 +00:00
|
|
|
fail=false
|
2000-03-21 12:22:27 +00:00
|
|
|
|
|
|
|
AC_PATH_PROG(TOOL1, tool, not-found, $path)
|
2005-03-23 01:01:58 +00:00
|
|
|
test "$TOOL1" = "$pwd/path/1/tool" || fail=:
|
2000-03-21 12:22:27 +00:00
|
|
|
|
|
|
|
AC_PATH_PROG(TOOL2, better, not-found, $path)
|
2005-03-23 01:01:58 +00:00
|
|
|
test "$TOOL2" = "$pwd/path/6/better" || fail=:
|
2000-03-21 12:22:27 +00:00
|
|
|
|
|
|
|
# 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)
|
2000-10-27 14:15:28 +00:00
|
|
|
test -z "$TOOL3" || fail=:
|
2000-03-21 12:22:27 +00:00
|
|
|
|
|
|
|
AC_PATH_PROGS(TOOL4, missing tool better,, $path)
|
2005-03-23 01:01:58 +00:00
|
|
|
test "$TOOL4" = "$pwd/path/1/tool" || fail=:
|
2000-03-21 12:22:27 +00:00
|
|
|
|
2000-10-27 14:15:28 +00:00
|
|
|
$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
|
2000-03-21 12:22:27 +00:00
|
|
|
]])
|
|
|
|
|
2000-11-23 09:52:35 +00:00
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
AT_CHECK_CONFIGURE
|
2000-03-21 12:22:27 +00:00
|
|
|
|
2007-05-16 09:42:25 +00:00
|
|
|
AT_CLEANUP
|
Eradicate AC_TRY_COMPILE.
* aclang.m4 (AC_PROG_CC_STDC, AC_C_BIGENDIAN, AC_C_INLINE,
AC_C_CONST, AC_C_VOLATILE, AC_F77_NAME_MANGLING): Use
`AC_COMPILE_IFELSE'.
* acspecific.m4 (AC_DECL_SYS_SIGLIST, _AC_CHECK_HEADER_DIRENT,
AC_HEADER_SYS_WAIT, AC_HEADER_TIME, AC_TYPE_SIGNAL,
AC_FUNC_GETLOADAVG, AC_FUNC_SELECT_ARGTYPES, AC_STRUCT_TM,
AC_CYGWIN, AC_MINGW32, AC_EMXOS2): Likewise.
* tests/semantics.m4 (C keywords): Check that AC_C_CONST,
AC_C_VOLATILE, and AC_C_INLINE function properly with GCC.
2000-05-11 13:09:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2007-09-08 14:48:49 +00:00
|
|
|
# ----------------------------- #
|
|
|
|
# AC_PATH_PROGS_FEATURE_CHECK. #
|
|
|
|
# ----------------------------- #
|
|
|
|
|
|
|
|
AT_SETUP([AC_PATH_PROGS_FEATURE_CHECK])
|
|
|
|
|
2007-12-04 22:49:06 +01:00
|
|
|
# This test doesn't work if `pwd` contains white space
|
|
|
|
case `pwd` in
|
|
|
|
*\ * | *\ *) AT_CHECK([exit 77]) ;;
|
|
|
|
esac
|
|
|
|
|
2007-09-08 14:48:49 +00:00
|
|
|
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
|
2007-09-08 14:48:49 +00:00
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
AT_CHECK_CONFIGURE
|
|
|
|
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
|
|
|
|
|
Eradicate AC_TRY_COMPILE.
* aclang.m4 (AC_PROG_CC_STDC, AC_C_BIGENDIAN, AC_C_INLINE,
AC_C_CONST, AC_C_VOLATILE, AC_F77_NAME_MANGLING): Use
`AC_COMPILE_IFELSE'.
* acspecific.m4 (AC_DECL_SYS_SIGLIST, _AC_CHECK_HEADER_DIRENT,
AC_HEADER_SYS_WAIT, AC_HEADER_TIME, AC_TYPE_SIGNAL,
AC_FUNC_GETLOADAVG, AC_FUNC_SELECT_ARGTYPES, AC_STRUCT_TM,
AC_CYGWIN, AC_MINGW32, AC_EMXOS2): Likewise.
* tests/semantics.m4 (C keywords): Check that AC_C_CONST,
AC_C_VOLATILE, and AC_C_INLINE function properly with GCC.
2000-05-11 13:09:05 +00:00
|
|
|
|
2000-12-07 15:21:54 +00:00
|
|
|
## -------------- ##
|
|
|
|
## AC_PATH_XTRA. ##
|
|
|
|
## -------------- ##
|
|
|
|
|
|
|
|
|
|
|
|
AT_SETUP([AC_PATH_XTRA])
|
|
|
|
|
|
|
|
_AT_CHECK_AC_MACRO([AC_PATH_XTRA])
|
|
|
|
|
|
|
|
# Check X_DISPLAY_MISSING.
|
2000-12-19 08:15:48 +00:00
|
|
|
AT_CHECK_CONFIGURE([--without-x])
|
2000-12-07 15:21:54 +00:00
|
|
|
AT_CHECK_DEFINES(
|
|
|
|
[#define X_DISPLAY_MISSING 1
|
|
|
|
])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
2001-06-25 18:27:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
## ------------------------------- ##
|
|
|
|
## 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])
|
2006-12-01 19:36:56 +00:00
|
|
|
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
|
2021-07-20 16:01:43 -05:00
|
|
|
configure.ac:6: note: 'dn@&t@l' is a macro
|
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
|
|
|
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
|
2021-07-20 16:01:43 -05:00
|
|
|
configure.ac:8: note: 'dn@&t@l' is a macro
|
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
|
|
|
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
|
2021-07-20 16:01:43 -05:00
|
|
|
configure.ac:6: note: 'dn@&t@l' is a macro
|
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: $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
|
AC_INCLUDES_DEFAULT: Check for presence of C90 hosted headers (#110393)
Since 1993, Autoconf has been assuming that it is safe to include any
of the headers defined by ISO C90 without checking for them; this is
inaccurate, since only a subset are necessarily available in a
C90 *freestanding* environment.
It is OK to assume the presence of a header in a macro that checks
specifically for something declared by that header (if the header is
not present, we will think the specific declaration is unavailable,
which is probably accurate for modern embedded environments). It is
also OK to continue recommending that user code use these headers
unconditionally—anyone working with a freestanding environment knows
it. But it is not OK for very generic code within Autoconf itself,
such as AC_INCLUDES_DEFAULT, to make this assumption.
Note that the set of headers that are not always available includes
stdio.h, which we have been assuming can be included unconditionally
for even longer.
In AC_INCLUDES_DEFAULT, revert to checking for string.h and stdlib.h
before including them. Also revert to defining STDC_HEADERS only when
string.h and stdlib.h are available (but do not check for float.h and
stdarg.h, as these are part of the freestanding set). Add a new check
for stdio.h. Sort the inclusion list by standard (C90 freestanding;
C90 hosted; C99; POSIX) and alphabetically within each group. Revise
all the documentation and update the testsuite.
This partially reverts commit 86c213d0e355296f026a36e3203c0813041aae89
and is a partial fix for bug #110393.
* lib/autoconf/headers.m4 (AC_CHECK_INCLUDES_DEFAULT): Check for
stdio.h, stdlib.h, and string.h before including them. Define
STDC_HEADERS only when string.h and stdlib.h are both available.
Organize includes list by standard, then alphabetically.
* doc/autoconf.texi, NEWS: Update to match.
* tests/local.at (AT_CHECK_DEFINES): Make regexes more specific.
Also expect a definition of HAVE_STDIO_H.
* tests/c.at, tests/semantics.at, tests/tools.at: Use <float.h>,
not <stdio.h>, as a header that we expect always to exist.
Add HAVE_STDIO_H to various lists of macros that are expected to
appear in config.h.
2020-12-06 11:40:39 -05:00
|
|
|
HAVE_STDIO_H
|
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_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
|
2021-07-20 16:01:43 -05:00
|
|
|
configure.ac:8: note: 'dn@&t@l' is a macro
|
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: $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
|
AC_INCLUDES_DEFAULT: Check for presence of C90 hosted headers (#110393)
Since 1993, Autoconf has been assuming that it is safe to include any
of the headers defined by ISO C90 without checking for them; this is
inaccurate, since only a subset are necessarily available in a
C90 *freestanding* environment.
It is OK to assume the presence of a header in a macro that checks
specifically for something declared by that header (if the header is
not present, we will think the specific declaration is unavailable,
which is probably accurate for modern embedded environments). It is
also OK to continue recommending that user code use these headers
unconditionally—anyone working with a freestanding environment knows
it. But it is not OK for very generic code within Autoconf itself,
such as AC_INCLUDES_DEFAULT, to make this assumption.
Note that the set of headers that are not always available includes
stdio.h, which we have been assuming can be included unconditionally
for even longer.
In AC_INCLUDES_DEFAULT, revert to checking for string.h and stdlib.h
before including them. Also revert to defining STDC_HEADERS only when
string.h and stdlib.h are available (but do not check for float.h and
stdarg.h, as these are part of the freestanding set). Add a new check
for stdio.h. Sort the inclusion list by standard (C90 freestanding;
C90 hosted; C99; POSIX) and alphabetically within each group. Revise
all the documentation and update the testsuite.
This partially reverts commit 86c213d0e355296f026a36e3203c0813041aae89
and is a partial fix for bug #110393.
* lib/autoconf/headers.m4 (AC_CHECK_INCLUDES_DEFAULT): Check for
stdio.h, stdlib.h, and string.h before including them. Define
STDC_HEADERS only when string.h and stdlib.h are both available.
Organize includes list by standard, then alphabetically.
* doc/autoconf.texi, NEWS: Update to match.
* tests/local.at (AT_CHECK_DEFINES): Make regexes more specific.
Also expect a definition of HAVE_STDIO_H.
* tests/c.at, tests/semantics.at, tests/tools.at: Use <float.h>,
not <stdio.h>, as a header that we expect always to exist.
Add HAVE_STDIO_H to various lists of macros that are expected to
appear in config.h.
2020-12-06 11:40:39 -05:00
|
|
|
HAVE_STDIO_H
|
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_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
|
2021-07-20 16:01:43 -05:00
|
|
|
configure.ac:6: note: 'dn@&t@l' is a macro
|
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
|
|
|
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
|
2021-07-20 16:01:43 -05:00
|
|
|
configure.ac:6: note: 'dn@&t@l' is a macro
|
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
|
|
|
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
|
2021-07-20 16:01:43 -05:00
|
|
|
configure.ac:6: note: 'dn@&t@l' is a macro
|
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
|
|
|
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.
|
|
|
|
|
Overhaul AC_PROG_LEX for precision and maintainability
AC_PROG_LEX has three different operating modes (“yywrap”, “noyywrap”,
and 2.69 compatibility mode) which were all tangled together and hard
to understand. In addition, the way we were handling yywrap, in all
three modes, was imprecise to the point where I am unsure we were
actually testing the property people want to test.
Refactor AC_PROG_LEX into a set of smaller macros:
- AC_PROG_LEX and _AC_PROG_LEX_1 perform argument validation and
normalization. _AC_PROG_LEX_1 also ensures that repeated invocation
of AC_PROG_LEX is harmless.
- _AC_PROG_LEX_2 is invoked with exactly one argument which is the
name of one of the three _AC_PROG_LEX_LIBL_* macros (described below).
It invokes, in sequence, AC_CHECK_PROGS([LEX]), _AC_PROG_LEX_OUTPUT_ROOT,
the _AC_PROG_LEX_LIBL_ macro it was given as an argument, and
finally _AC_PROG_LEX_YYTEXT_DECL. If any of these sets LEX to ‘:’,
further tests are skipped. _AC_PROG_LEX_2 is also responsible for
cleaning up conftest.l and lex.yy.c afterward.
- _AC_PROG_LEX_YYTEXT_DECL now *only* tests whether yytext is a
pointer. It reuses the conftest.l from previous tests.
- _AC_PROG_LEX_OUTPUT_ROOT just does the test for the name of the
file produced by running ‘lex conftest.l’ with no further arguments.
- _AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP, and
_AC_PROG_LEX_LIBL_COMPAT determine whether a generated lexer needs
to be linked with -ll or -lfl. Each is dedicated to one of the
three operating modes, and uses a conftest.l specialized for that mode.
In compat mode we do *not* look for ‘yywrap’ using AC_SEARCH_LIBS;
instead we actually try to link a generated lexer that uses yywrap.
- _AC_PROG_LEX_SEARCH_LIBL, _AC_PROG_LEX_TEST_COMMON,
_AC_PROG_LEX_TEST_YYWRAP, and _AC_PROG_LEX_TEST_NOYYWRAP are
subroutines of the _AC_PROG_LEX_LIBL_* macros.
TODO:
- Shrink and sharpen the test program used by _AC_PROG_LEX_YYTEXT_DECL and
make it independent of previous operations. Possibly smush it
back together with _AC_PROG_LEX_OUTPUT_ROOT.
- Re-audit the “noyywrap” program, it might be better to declare
“_static_ int yywrap(void)” in the %{ %} block instead of not
declaring it at all.
- Re-audit the “yywrap” program, it might be better to rely on the
skeleton to declare yywrap.
* lib/autoconf/programs.m4 (AC_PROG_LEX): Extensive refactor.
Test for yywrap is now done by linking a generated lexer, not with
AC_SEARCH_LIBS.
(_AC_PROG_LEX_YYTEXT_DECL): Just test whether yytext is a pointer.
(_AC_PROG_LEX): Removed.
(_AC_PROG_LEX_1, _AC_PROG_LEX_2): New macros dividing up the labor
formerly performed by _AC_PROG_LEX and the order of operations in
the old _AC_PROG_LEX_YYTEXT_DECL.
(_AC_PROG_LEX_OUTPUT_ROOT, _AC_PROG_LEX_SEARCH_LIBL)
(_AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP)
(_AC_PROG_LEX_LIBL_COMPAT, _AC_PROG_LEX_TEST_COMMON)
(_AC_PROG_LEX_TEST_YYWRAP, _AC_PROG_LEX_TEST_NOYYWRAP):
New macros dividing up the rest of the labor formerly performed by
_AC_PROG_LEX_YYTEXT_DECL.
* tests/semantics.at
(AC_PROG_LEX with noyywrap): Rename “AC_PROG_LEX: noyywrap”.
(AC_PROG_LEX with yywrap): Rename “AC_PROG_LEX: yywrap”. No longer
necessary to skip this test on OSes where there is no -ll nor -lfl.
(AC_PROG_LEX in legacy mode): Rename “AC_PROG_LEX: compat mode.”
Convert to AT_CHECK_MACRO test using -Wno-obsolete.
(Invalid arguments to AC_PROG_LEX): Rename “AC_PROG_LEX: invalid
arguments and warnings.” Move the test for the warning
“AC_PROG_LEX without either yywrap or noyywrap is obsolete” here.
Adjust expected stack traces.
2023-12-03 12:09:37 -05:00
|
|
|
AT_CHECK_MACRO([AC_PROG_LEX: noyywrap],
|
|
|
|
[AC_PROG_LEX([noyywrap])])
|
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
|
|
|
|
Overhaul AC_PROG_LEX for precision and maintainability
AC_PROG_LEX has three different operating modes (“yywrap”, “noyywrap”,
and 2.69 compatibility mode) which were all tangled together and hard
to understand. In addition, the way we were handling yywrap, in all
three modes, was imprecise to the point where I am unsure we were
actually testing the property people want to test.
Refactor AC_PROG_LEX into a set of smaller macros:
- AC_PROG_LEX and _AC_PROG_LEX_1 perform argument validation and
normalization. _AC_PROG_LEX_1 also ensures that repeated invocation
of AC_PROG_LEX is harmless.
- _AC_PROG_LEX_2 is invoked with exactly one argument which is the
name of one of the three _AC_PROG_LEX_LIBL_* macros (described below).
It invokes, in sequence, AC_CHECK_PROGS([LEX]), _AC_PROG_LEX_OUTPUT_ROOT,
the _AC_PROG_LEX_LIBL_ macro it was given as an argument, and
finally _AC_PROG_LEX_YYTEXT_DECL. If any of these sets LEX to ‘:’,
further tests are skipped. _AC_PROG_LEX_2 is also responsible for
cleaning up conftest.l and lex.yy.c afterward.
- _AC_PROG_LEX_YYTEXT_DECL now *only* tests whether yytext is a
pointer. It reuses the conftest.l from previous tests.
- _AC_PROG_LEX_OUTPUT_ROOT just does the test for the name of the
file produced by running ‘lex conftest.l’ with no further arguments.
- _AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP, and
_AC_PROG_LEX_LIBL_COMPAT determine whether a generated lexer needs
to be linked with -ll or -lfl. Each is dedicated to one of the
three operating modes, and uses a conftest.l specialized for that mode.
In compat mode we do *not* look for ‘yywrap’ using AC_SEARCH_LIBS;
instead we actually try to link a generated lexer that uses yywrap.
- _AC_PROG_LEX_SEARCH_LIBL, _AC_PROG_LEX_TEST_COMMON,
_AC_PROG_LEX_TEST_YYWRAP, and _AC_PROG_LEX_TEST_NOYYWRAP are
subroutines of the _AC_PROG_LEX_LIBL_* macros.
TODO:
- Shrink and sharpen the test program used by _AC_PROG_LEX_YYTEXT_DECL and
make it independent of previous operations. Possibly smush it
back together with _AC_PROG_LEX_OUTPUT_ROOT.
- Re-audit the “noyywrap” program, it might be better to declare
“_static_ int yywrap(void)” in the %{ %} block instead of not
declaring it at all.
- Re-audit the “yywrap” program, it might be better to rely on the
skeleton to declare yywrap.
* lib/autoconf/programs.m4 (AC_PROG_LEX): Extensive refactor.
Test for yywrap is now done by linking a generated lexer, not with
AC_SEARCH_LIBS.
(_AC_PROG_LEX_YYTEXT_DECL): Just test whether yytext is a pointer.
(_AC_PROG_LEX): Removed.
(_AC_PROG_LEX_1, _AC_PROG_LEX_2): New macros dividing up the labor
formerly performed by _AC_PROG_LEX and the order of operations in
the old _AC_PROG_LEX_YYTEXT_DECL.
(_AC_PROG_LEX_OUTPUT_ROOT, _AC_PROG_LEX_SEARCH_LIBL)
(_AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP)
(_AC_PROG_LEX_LIBL_COMPAT, _AC_PROG_LEX_TEST_COMMON)
(_AC_PROG_LEX_TEST_YYWRAP, _AC_PROG_LEX_TEST_NOYYWRAP):
New macros dividing up the rest of the labor formerly performed by
_AC_PROG_LEX_YYTEXT_DECL.
* tests/semantics.at
(AC_PROG_LEX with noyywrap): Rename “AC_PROG_LEX: noyywrap”.
(AC_PROG_LEX with yywrap): Rename “AC_PROG_LEX: yywrap”. No longer
necessary to skip this test on OSes where there is no -ll nor -lfl.
(AC_PROG_LEX in legacy mode): Rename “AC_PROG_LEX: compat mode.”
Convert to AT_CHECK_MACRO test using -Wno-obsolete.
(Invalid arguments to AC_PROG_LEX): Rename “AC_PROG_LEX: invalid
arguments and warnings.” Move the test for the warning
“AC_PROG_LEX without either yywrap or noyywrap is obsolete” here.
Adjust expected stack traces.
2023-12-03 12:09:37 -05:00
|
|
|
AT_CHECK_MACRO([AC_PROG_LEX: yywrap],
|
|
|
|
[AC_PROG_LEX([yywrap])])
|
Three minor testsuite fixes.
1. To insulate the test suite from a system-provided config.site file,
set the CONFIG_SITE environment variable to a file that is known not
to exist. Problem reported by Jannick.
2. AC_PROG_CC, AC_PROG_CXX, AC_PROG_CPP, and AC_PROG_CXXCPP may set
cache variables named ‘ac_cv_prog_$tool’ or ‘ac_cv_prog_ac_ct_$tool’,
depending on system conditions; _AT_CONFIG_CMP_PRUNE needs to handle
both possibilities. Found by testing on FreeBSD 12; I have no idea
why it didn’t show up on _any_ of my other test platforms.
3. The ‘AC_PROG_LEX with yywrap’ test needs to be skipped on systems
that don’t provide libl.a nor libfl.a. This change needed yet another
hook for AT_CHECK_MACRO. Found by testing on Alpine Linux.
(Ideally, instead of skipping this test, we would test that this
configure script *errors out* on these systems, but that would involve
much more invasive changes to AT_CHECK_MACRO, which I don’t want to
hold the release for.)
* tests/local.at (AT_PREPARE_TESTS): Set CONFIG_SITE to refer to
a file that is known not to exist, and export it.
(_AT_CONFIG_CMP_PRUNE): Prune all variables matching the
ERE ‘ac_cv_prog_(ac_ct_)?(CC|CXX|CPP|CXXCPP)’.
(AT_CHECK_MACRO): Add PRETEST-CMDS argument which takes commands to
execute immediately after AT_SETUP.
* tests/semantics.at (AC_PROG_LEX with yywrap): Using PRETEST-CMDS,
skip this test on OSes where neither -ll nor -lfl provides a
definition of yywrap.
2020-12-08 10:36:28 -05:00
|
|
|
|
Overhaul AC_PROG_LEX for precision and maintainability
AC_PROG_LEX has three different operating modes (“yywrap”, “noyywrap”,
and 2.69 compatibility mode) which were all tangled together and hard
to understand. In addition, the way we were handling yywrap, in all
three modes, was imprecise to the point where I am unsure we were
actually testing the property people want to test.
Refactor AC_PROG_LEX into a set of smaller macros:
- AC_PROG_LEX and _AC_PROG_LEX_1 perform argument validation and
normalization. _AC_PROG_LEX_1 also ensures that repeated invocation
of AC_PROG_LEX is harmless.
- _AC_PROG_LEX_2 is invoked with exactly one argument which is the
name of one of the three _AC_PROG_LEX_LIBL_* macros (described below).
It invokes, in sequence, AC_CHECK_PROGS([LEX]), _AC_PROG_LEX_OUTPUT_ROOT,
the _AC_PROG_LEX_LIBL_ macro it was given as an argument, and
finally _AC_PROG_LEX_YYTEXT_DECL. If any of these sets LEX to ‘:’,
further tests are skipped. _AC_PROG_LEX_2 is also responsible for
cleaning up conftest.l and lex.yy.c afterward.
- _AC_PROG_LEX_YYTEXT_DECL now *only* tests whether yytext is a
pointer. It reuses the conftest.l from previous tests.
- _AC_PROG_LEX_OUTPUT_ROOT just does the test for the name of the
file produced by running ‘lex conftest.l’ with no further arguments.
- _AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP, and
_AC_PROG_LEX_LIBL_COMPAT determine whether a generated lexer needs
to be linked with -ll or -lfl. Each is dedicated to one of the
three operating modes, and uses a conftest.l specialized for that mode.
In compat mode we do *not* look for ‘yywrap’ using AC_SEARCH_LIBS;
instead we actually try to link a generated lexer that uses yywrap.
- _AC_PROG_LEX_SEARCH_LIBL, _AC_PROG_LEX_TEST_COMMON,
_AC_PROG_LEX_TEST_YYWRAP, and _AC_PROG_LEX_TEST_NOYYWRAP are
subroutines of the _AC_PROG_LEX_LIBL_* macros.
TODO:
- Shrink and sharpen the test program used by _AC_PROG_LEX_YYTEXT_DECL and
make it independent of previous operations. Possibly smush it
back together with _AC_PROG_LEX_OUTPUT_ROOT.
- Re-audit the “noyywrap” program, it might be better to declare
“_static_ int yywrap(void)” in the %{ %} block instead of not
declaring it at all.
- Re-audit the “yywrap” program, it might be better to rely on the
skeleton to declare yywrap.
* lib/autoconf/programs.m4 (AC_PROG_LEX): Extensive refactor.
Test for yywrap is now done by linking a generated lexer, not with
AC_SEARCH_LIBS.
(_AC_PROG_LEX_YYTEXT_DECL): Just test whether yytext is a pointer.
(_AC_PROG_LEX): Removed.
(_AC_PROG_LEX_1, _AC_PROG_LEX_2): New macros dividing up the labor
formerly performed by _AC_PROG_LEX and the order of operations in
the old _AC_PROG_LEX_YYTEXT_DECL.
(_AC_PROG_LEX_OUTPUT_ROOT, _AC_PROG_LEX_SEARCH_LIBL)
(_AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP)
(_AC_PROG_LEX_LIBL_COMPAT, _AC_PROG_LEX_TEST_COMMON)
(_AC_PROG_LEX_TEST_YYWRAP, _AC_PROG_LEX_TEST_NOYYWRAP):
New macros dividing up the rest of the labor formerly performed by
_AC_PROG_LEX_YYTEXT_DECL.
* tests/semantics.at
(AC_PROG_LEX with noyywrap): Rename “AC_PROG_LEX: noyywrap”.
(AC_PROG_LEX with yywrap): Rename “AC_PROG_LEX: yywrap”. No longer
necessary to skip this test on OSes where there is no -ll nor -lfl.
(AC_PROG_LEX in legacy mode): Rename “AC_PROG_LEX: compat mode.”
Convert to AT_CHECK_MACRO test using -Wno-obsolete.
(Invalid arguments to AC_PROG_LEX): Rename “AC_PROG_LEX: invalid
arguments and warnings.” Move the test for the warning
“AC_PROG_LEX without either yywrap or noyywrap is obsolete” here.
Adjust expected stack traces.
2023-12-03 12:09:37 -05:00
|
|
|
AT_CHECK_MACRO([AC_PROG_LEX: compat mode],
|
|
|
|
[AC_PROG_LEX], [], [-Wno-obsolete])
|
Three minor testsuite fixes.
1. To insulate the test suite from a system-provided config.site file,
set the CONFIG_SITE environment variable to a file that is known not
to exist. Problem reported by Jannick.
2. AC_PROG_CC, AC_PROG_CXX, AC_PROG_CPP, and AC_PROG_CXXCPP may set
cache variables named ‘ac_cv_prog_$tool’ or ‘ac_cv_prog_ac_ct_$tool’,
depending on system conditions; _AT_CONFIG_CMP_PRUNE needs to handle
both possibilities. Found by testing on FreeBSD 12; I have no idea
why it didn’t show up on _any_ of my other test platforms.
3. The ‘AC_PROG_LEX with yywrap’ test needs to be skipped on systems
that don’t provide libl.a nor libfl.a. This change needed yet another
hook for AT_CHECK_MACRO. Found by testing on Alpine Linux.
(Ideally, instead of skipping this test, we would test that this
configure script *errors out* on these systems, but that would involve
much more invasive changes to AT_CHECK_MACRO, which I don’t want to
hold the release for.)
* tests/local.at (AT_PREPARE_TESTS): Set CONFIG_SITE to refer to
a file that is known not to exist, and export it.
(_AT_CONFIG_CMP_PRUNE): Prune all variables matching the
ERE ‘ac_cv_prog_(ac_ct_)?(CC|CXX|CPP|CXXCPP)’.
(AT_CHECK_MACRO): Add PRETEST-CMDS argument which takes commands to
execute immediately after AT_SETUP.
* tests/semantics.at (AC_PROG_LEX with yywrap): Using PRETEST-CMDS,
skip this test on OSes where neither -ll nor -lfl provides a
definition of yywrap.
2020-12-08 10:36:28 -05:00
|
|
|
|
Overhaul AC_PROG_LEX for precision and maintainability
AC_PROG_LEX has three different operating modes (“yywrap”, “noyywrap”,
and 2.69 compatibility mode) which were all tangled together and hard
to understand. In addition, the way we were handling yywrap, in all
three modes, was imprecise to the point where I am unsure we were
actually testing the property people want to test.
Refactor AC_PROG_LEX into a set of smaller macros:
- AC_PROG_LEX and _AC_PROG_LEX_1 perform argument validation and
normalization. _AC_PROG_LEX_1 also ensures that repeated invocation
of AC_PROG_LEX is harmless.
- _AC_PROG_LEX_2 is invoked with exactly one argument which is the
name of one of the three _AC_PROG_LEX_LIBL_* macros (described below).
It invokes, in sequence, AC_CHECK_PROGS([LEX]), _AC_PROG_LEX_OUTPUT_ROOT,
the _AC_PROG_LEX_LIBL_ macro it was given as an argument, and
finally _AC_PROG_LEX_YYTEXT_DECL. If any of these sets LEX to ‘:’,
further tests are skipped. _AC_PROG_LEX_2 is also responsible for
cleaning up conftest.l and lex.yy.c afterward.
- _AC_PROG_LEX_YYTEXT_DECL now *only* tests whether yytext is a
pointer. It reuses the conftest.l from previous tests.
- _AC_PROG_LEX_OUTPUT_ROOT just does the test for the name of the
file produced by running ‘lex conftest.l’ with no further arguments.
- _AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP, and
_AC_PROG_LEX_LIBL_COMPAT determine whether a generated lexer needs
to be linked with -ll or -lfl. Each is dedicated to one of the
three operating modes, and uses a conftest.l specialized for that mode.
In compat mode we do *not* look for ‘yywrap’ using AC_SEARCH_LIBS;
instead we actually try to link a generated lexer that uses yywrap.
- _AC_PROG_LEX_SEARCH_LIBL, _AC_PROG_LEX_TEST_COMMON,
_AC_PROG_LEX_TEST_YYWRAP, and _AC_PROG_LEX_TEST_NOYYWRAP are
subroutines of the _AC_PROG_LEX_LIBL_* macros.
TODO:
- Shrink and sharpen the test program used by _AC_PROG_LEX_YYTEXT_DECL and
make it independent of previous operations. Possibly smush it
back together with _AC_PROG_LEX_OUTPUT_ROOT.
- Re-audit the “noyywrap” program, it might be better to declare
“_static_ int yywrap(void)” in the %{ %} block instead of not
declaring it at all.
- Re-audit the “yywrap” program, it might be better to rely on the
skeleton to declare yywrap.
* lib/autoconf/programs.m4 (AC_PROG_LEX): Extensive refactor.
Test for yywrap is now done by linking a generated lexer, not with
AC_SEARCH_LIBS.
(_AC_PROG_LEX_YYTEXT_DECL): Just test whether yytext is a pointer.
(_AC_PROG_LEX): Removed.
(_AC_PROG_LEX_1, _AC_PROG_LEX_2): New macros dividing up the labor
formerly performed by _AC_PROG_LEX and the order of operations in
the old _AC_PROG_LEX_YYTEXT_DECL.
(_AC_PROG_LEX_OUTPUT_ROOT, _AC_PROG_LEX_SEARCH_LIBL)
(_AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP)
(_AC_PROG_LEX_LIBL_COMPAT, _AC_PROG_LEX_TEST_COMMON)
(_AC_PROG_LEX_TEST_YYWRAP, _AC_PROG_LEX_TEST_NOYYWRAP):
New macros dividing up the rest of the labor formerly performed by
_AC_PROG_LEX_YYTEXT_DECL.
* tests/semantics.at
(AC_PROG_LEX with noyywrap): Rename “AC_PROG_LEX: noyywrap”.
(AC_PROG_LEX with yywrap): Rename “AC_PROG_LEX: yywrap”. No longer
necessary to skip this test on OSes where there is no -ll nor -lfl.
(AC_PROG_LEX in legacy mode): Rename “AC_PROG_LEX: compat mode.”
Convert to AT_CHECK_MACRO test using -Wno-obsolete.
(Invalid arguments to AC_PROG_LEX): Rename “AC_PROG_LEX: invalid
arguments and warnings.” Move the test for the warning
“AC_PROG_LEX without either yywrap or noyywrap is obsolete” here.
Adjust expected stack traces.
2023-12-03 12:09:37 -05:00
|
|
|
## ---------------------------------- ##
|
|
|
|
## Invalid arguments to AC_PROG_LEX. ##
|
|
|
|
## ---------------------------------- ##
|
Three minor testsuite fixes.
1. To insulate the test suite from a system-provided config.site file,
set the CONFIG_SITE environment variable to a file that is known not
to exist. Problem reported by Jannick.
2. AC_PROG_CC, AC_PROG_CXX, AC_PROG_CPP, and AC_PROG_CXXCPP may set
cache variables named ‘ac_cv_prog_$tool’ or ‘ac_cv_prog_ac_ct_$tool’,
depending on system conditions; _AT_CONFIG_CMP_PRUNE needs to handle
both possibilities. Found by testing on FreeBSD 12; I have no idea
why it didn’t show up on _any_ of my other test platforms.
3. The ‘AC_PROG_LEX with yywrap’ test needs to be skipped on systems
that don’t provide libl.a nor libfl.a. This change needed yet another
hook for AT_CHECK_MACRO. Found by testing on Alpine Linux.
(Ideally, instead of skipping this test, we would test that this
configure script *errors out* on these systems, but that would involve
much more invasive changes to AT_CHECK_MACRO, which I don’t want to
hold the release for.)
* tests/local.at (AT_PREPARE_TESTS): Set CONFIG_SITE to refer to
a file that is known not to exist, and export it.
(_AT_CONFIG_CMP_PRUNE): Prune all variables matching the
ERE ‘ac_cv_prog_(ac_ct_)?(CC|CXX|CPP|CXXCPP)’.
(AT_CHECK_MACRO): Add PRETEST-CMDS argument which takes commands to
execute immediately after AT_SETUP.
* tests/semantics.at (AC_PROG_LEX with yywrap): Using PRETEST-CMDS,
skip this test on OSes where neither -ll nor -lfl provides a
definition of yywrap.
2020-12-08 10:36:28 -05:00
|
|
|
|
Overhaul AC_PROG_LEX for precision and maintainability
AC_PROG_LEX has three different operating modes (“yywrap”, “noyywrap”,
and 2.69 compatibility mode) which were all tangled together and hard
to understand. In addition, the way we were handling yywrap, in all
three modes, was imprecise to the point where I am unsure we were
actually testing the property people want to test.
Refactor AC_PROG_LEX into a set of smaller macros:
- AC_PROG_LEX and _AC_PROG_LEX_1 perform argument validation and
normalization. _AC_PROG_LEX_1 also ensures that repeated invocation
of AC_PROG_LEX is harmless.
- _AC_PROG_LEX_2 is invoked with exactly one argument which is the
name of one of the three _AC_PROG_LEX_LIBL_* macros (described below).
It invokes, in sequence, AC_CHECK_PROGS([LEX]), _AC_PROG_LEX_OUTPUT_ROOT,
the _AC_PROG_LEX_LIBL_ macro it was given as an argument, and
finally _AC_PROG_LEX_YYTEXT_DECL. If any of these sets LEX to ‘:’,
further tests are skipped. _AC_PROG_LEX_2 is also responsible for
cleaning up conftest.l and lex.yy.c afterward.
- _AC_PROG_LEX_YYTEXT_DECL now *only* tests whether yytext is a
pointer. It reuses the conftest.l from previous tests.
- _AC_PROG_LEX_OUTPUT_ROOT just does the test for the name of the
file produced by running ‘lex conftest.l’ with no further arguments.
- _AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP, and
_AC_PROG_LEX_LIBL_COMPAT determine whether a generated lexer needs
to be linked with -ll or -lfl. Each is dedicated to one of the
three operating modes, and uses a conftest.l specialized for that mode.
In compat mode we do *not* look for ‘yywrap’ using AC_SEARCH_LIBS;
instead we actually try to link a generated lexer that uses yywrap.
- _AC_PROG_LEX_SEARCH_LIBL, _AC_PROG_LEX_TEST_COMMON,
_AC_PROG_LEX_TEST_YYWRAP, and _AC_PROG_LEX_TEST_NOYYWRAP are
subroutines of the _AC_PROG_LEX_LIBL_* macros.
TODO:
- Shrink and sharpen the test program used by _AC_PROG_LEX_YYTEXT_DECL and
make it independent of previous operations. Possibly smush it
back together with _AC_PROG_LEX_OUTPUT_ROOT.
- Re-audit the “noyywrap” program, it might be better to declare
“_static_ int yywrap(void)” in the %{ %} block instead of not
declaring it at all.
- Re-audit the “yywrap” program, it might be better to rely on the
skeleton to declare yywrap.
* lib/autoconf/programs.m4 (AC_PROG_LEX): Extensive refactor.
Test for yywrap is now done by linking a generated lexer, not with
AC_SEARCH_LIBS.
(_AC_PROG_LEX_YYTEXT_DECL): Just test whether yytext is a pointer.
(_AC_PROG_LEX): Removed.
(_AC_PROG_LEX_1, _AC_PROG_LEX_2): New macros dividing up the labor
formerly performed by _AC_PROG_LEX and the order of operations in
the old _AC_PROG_LEX_YYTEXT_DECL.
(_AC_PROG_LEX_OUTPUT_ROOT, _AC_PROG_LEX_SEARCH_LIBL)
(_AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP)
(_AC_PROG_LEX_LIBL_COMPAT, _AC_PROG_LEX_TEST_COMMON)
(_AC_PROG_LEX_TEST_YYWRAP, _AC_PROG_LEX_TEST_NOYYWRAP):
New macros dividing up the rest of the labor formerly performed by
_AC_PROG_LEX_YYTEXT_DECL.
* tests/semantics.at
(AC_PROG_LEX with noyywrap): Rename “AC_PROG_LEX: noyywrap”.
(AC_PROG_LEX with yywrap): Rename “AC_PROG_LEX: yywrap”. No longer
necessary to skip this test on OSes where there is no -ll nor -lfl.
(AC_PROG_LEX in legacy mode): Rename “AC_PROG_LEX: compat mode.”
Convert to AT_CHECK_MACRO test using -Wno-obsolete.
(Invalid arguments to AC_PROG_LEX): Rename “AC_PROG_LEX: invalid
arguments and warnings.” Move the test for the warning
“AC_PROG_LEX without either yywrap or noyywrap is obsolete” here.
Adjust expected stack traces.
2023-12-03 12:09:37 -05:00
|
|
|
AT_SETUP([AC_PROG_LEX: invalid arguments and warnings])
|
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
|
|
|
|
|
|
|
AT_CONFIGURE_AC([[AC_PROG_LEX]])
|
|
|
|
AT_CHECK_AUTOCONF([], [], [],
|
|
|
|
[[configure.ac:4: warning: AC_PROG_LEX without either yywrap or noyywrap is obsolete
|
Overhaul AC_PROG_LEX for precision and maintainability
AC_PROG_LEX has three different operating modes (“yywrap”, “noyywrap”,
and 2.69 compatibility mode) which were all tangled together and hard
to understand. In addition, the way we were handling yywrap, in all
three modes, was imprecise to the point where I am unsure we were
actually testing the property people want to test.
Refactor AC_PROG_LEX into a set of smaller macros:
- AC_PROG_LEX and _AC_PROG_LEX_1 perform argument validation and
normalization. _AC_PROG_LEX_1 also ensures that repeated invocation
of AC_PROG_LEX is harmless.
- _AC_PROG_LEX_2 is invoked with exactly one argument which is the
name of one of the three _AC_PROG_LEX_LIBL_* macros (described below).
It invokes, in sequence, AC_CHECK_PROGS([LEX]), _AC_PROG_LEX_OUTPUT_ROOT,
the _AC_PROG_LEX_LIBL_ macro it was given as an argument, and
finally _AC_PROG_LEX_YYTEXT_DECL. If any of these sets LEX to ‘:’,
further tests are skipped. _AC_PROG_LEX_2 is also responsible for
cleaning up conftest.l and lex.yy.c afterward.
- _AC_PROG_LEX_YYTEXT_DECL now *only* tests whether yytext is a
pointer. It reuses the conftest.l from previous tests.
- _AC_PROG_LEX_OUTPUT_ROOT just does the test for the name of the
file produced by running ‘lex conftest.l’ with no further arguments.
- _AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP, and
_AC_PROG_LEX_LIBL_COMPAT determine whether a generated lexer needs
to be linked with -ll or -lfl. Each is dedicated to one of the
three operating modes, and uses a conftest.l specialized for that mode.
In compat mode we do *not* look for ‘yywrap’ using AC_SEARCH_LIBS;
instead we actually try to link a generated lexer that uses yywrap.
- _AC_PROG_LEX_SEARCH_LIBL, _AC_PROG_LEX_TEST_COMMON,
_AC_PROG_LEX_TEST_YYWRAP, and _AC_PROG_LEX_TEST_NOYYWRAP are
subroutines of the _AC_PROG_LEX_LIBL_* macros.
TODO:
- Shrink and sharpen the test program used by _AC_PROG_LEX_YYTEXT_DECL and
make it independent of previous operations. Possibly smush it
back together with _AC_PROG_LEX_OUTPUT_ROOT.
- Re-audit the “noyywrap” program, it might be better to declare
“_static_ int yywrap(void)” in the %{ %} block instead of not
declaring it at all.
- Re-audit the “yywrap” program, it might be better to rely on the
skeleton to declare yywrap.
* lib/autoconf/programs.m4 (AC_PROG_LEX): Extensive refactor.
Test for yywrap is now done by linking a generated lexer, not with
AC_SEARCH_LIBS.
(_AC_PROG_LEX_YYTEXT_DECL): Just test whether yytext is a pointer.
(_AC_PROG_LEX): Removed.
(_AC_PROG_LEX_1, _AC_PROG_LEX_2): New macros dividing up the labor
formerly performed by _AC_PROG_LEX and the order of operations in
the old _AC_PROG_LEX_YYTEXT_DECL.
(_AC_PROG_LEX_OUTPUT_ROOT, _AC_PROG_LEX_SEARCH_LIBL)
(_AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP)
(_AC_PROG_LEX_LIBL_COMPAT, _AC_PROG_LEX_TEST_COMMON)
(_AC_PROG_LEX_TEST_YYWRAP, _AC_PROG_LEX_TEST_NOYYWRAP):
New macros dividing up the rest of the labor formerly performed by
_AC_PROG_LEX_YYTEXT_DECL.
* tests/semantics.at
(AC_PROG_LEX with noyywrap): Rename “AC_PROG_LEX: noyywrap”.
(AC_PROG_LEX with yywrap): Rename “AC_PROG_LEX: yywrap”. No longer
necessary to skip this test on OSes where there is no -ll nor -lfl.
(AC_PROG_LEX in legacy mode): Rename “AC_PROG_LEX: compat mode.”
Convert to AT_CHECK_MACRO test using -Wno-obsolete.
(Invalid arguments to AC_PROG_LEX): Rename “AC_PROG_LEX: invalid
arguments and warnings.” Move the test for the warning
“AC_PROG_LEX without either yywrap or noyywrap is obsolete” here.
Adjust expected stack traces.
2023-12-03 12:09:37 -05:00
|
|
|
programs.m4: _AC_PROG_LEX_1 is expanded from...
|
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
|
|
|
programs.m4: AC_PROG_LEX is expanded from...
|
|
|
|
configure.ac:4: the top level
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CONFIGURE_AC(
|
|
|
|
[[AC_PROG_LEX([nonsense])
|
|
|
|
]])
|
|
|
|
AT_CHECK_AUTOCONF([], [1], [],
|
|
|
|
[[configure.ac:4: error: AC_PROG_LEX: unrecognized argument: nonsense
|
Overhaul AC_PROG_LEX for precision and maintainability
AC_PROG_LEX has three different operating modes (“yywrap”, “noyywrap”,
and 2.69 compatibility mode) which were all tangled together and hard
to understand. In addition, the way we were handling yywrap, in all
three modes, was imprecise to the point where I am unsure we were
actually testing the property people want to test.
Refactor AC_PROG_LEX into a set of smaller macros:
- AC_PROG_LEX and _AC_PROG_LEX_1 perform argument validation and
normalization. _AC_PROG_LEX_1 also ensures that repeated invocation
of AC_PROG_LEX is harmless.
- _AC_PROG_LEX_2 is invoked with exactly one argument which is the
name of one of the three _AC_PROG_LEX_LIBL_* macros (described below).
It invokes, in sequence, AC_CHECK_PROGS([LEX]), _AC_PROG_LEX_OUTPUT_ROOT,
the _AC_PROG_LEX_LIBL_ macro it was given as an argument, and
finally _AC_PROG_LEX_YYTEXT_DECL. If any of these sets LEX to ‘:’,
further tests are skipped. _AC_PROG_LEX_2 is also responsible for
cleaning up conftest.l and lex.yy.c afterward.
- _AC_PROG_LEX_YYTEXT_DECL now *only* tests whether yytext is a
pointer. It reuses the conftest.l from previous tests.
- _AC_PROG_LEX_OUTPUT_ROOT just does the test for the name of the
file produced by running ‘lex conftest.l’ with no further arguments.
- _AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP, and
_AC_PROG_LEX_LIBL_COMPAT determine whether a generated lexer needs
to be linked with -ll or -lfl. Each is dedicated to one of the
three operating modes, and uses a conftest.l specialized for that mode.
In compat mode we do *not* look for ‘yywrap’ using AC_SEARCH_LIBS;
instead we actually try to link a generated lexer that uses yywrap.
- _AC_PROG_LEX_SEARCH_LIBL, _AC_PROG_LEX_TEST_COMMON,
_AC_PROG_LEX_TEST_YYWRAP, and _AC_PROG_LEX_TEST_NOYYWRAP are
subroutines of the _AC_PROG_LEX_LIBL_* macros.
TODO:
- Shrink and sharpen the test program used by _AC_PROG_LEX_YYTEXT_DECL and
make it independent of previous operations. Possibly smush it
back together with _AC_PROG_LEX_OUTPUT_ROOT.
- Re-audit the “noyywrap” program, it might be better to declare
“_static_ int yywrap(void)” in the %{ %} block instead of not
declaring it at all.
- Re-audit the “yywrap” program, it might be better to rely on the
skeleton to declare yywrap.
* lib/autoconf/programs.m4 (AC_PROG_LEX): Extensive refactor.
Test for yywrap is now done by linking a generated lexer, not with
AC_SEARCH_LIBS.
(_AC_PROG_LEX_YYTEXT_DECL): Just test whether yytext is a pointer.
(_AC_PROG_LEX): Removed.
(_AC_PROG_LEX_1, _AC_PROG_LEX_2): New macros dividing up the labor
formerly performed by _AC_PROG_LEX and the order of operations in
the old _AC_PROG_LEX_YYTEXT_DECL.
(_AC_PROG_LEX_OUTPUT_ROOT, _AC_PROG_LEX_SEARCH_LIBL)
(_AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP)
(_AC_PROG_LEX_LIBL_COMPAT, _AC_PROG_LEX_TEST_COMMON)
(_AC_PROG_LEX_TEST_YYWRAP, _AC_PROG_LEX_TEST_NOYYWRAP):
New macros dividing up the rest of the labor formerly performed by
_AC_PROG_LEX_YYTEXT_DECL.
* tests/semantics.at
(AC_PROG_LEX with noyywrap): Rename “AC_PROG_LEX: noyywrap”.
(AC_PROG_LEX with yywrap): Rename “AC_PROG_LEX: yywrap”. No longer
necessary to skip this test on OSes where there is no -ll nor -lfl.
(AC_PROG_LEX in legacy mode): Rename “AC_PROG_LEX: compat mode.”
Convert to AT_CHECK_MACRO test using -Wno-obsolete.
(Invalid arguments to AC_PROG_LEX): Rename “AC_PROG_LEX: invalid
arguments and warnings.” Move the test for the warning
“AC_PROG_LEX without either yywrap or noyywrap is obsolete” here.
Adjust expected stack traces.
2023-12-03 12:09:37 -05:00
|
|
|
programs.m4: _AC_PROG_LEX_1 is expanded from...
|
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
|
|
|
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
|
Overhaul AC_PROG_LEX for precision and maintainability
AC_PROG_LEX has three different operating modes (“yywrap”, “noyywrap”,
and 2.69 compatibility mode) which were all tangled together and hard
to understand. In addition, the way we were handling yywrap, in all
three modes, was imprecise to the point where I am unsure we were
actually testing the property people want to test.
Refactor AC_PROG_LEX into a set of smaller macros:
- AC_PROG_LEX and _AC_PROG_LEX_1 perform argument validation and
normalization. _AC_PROG_LEX_1 also ensures that repeated invocation
of AC_PROG_LEX is harmless.
- _AC_PROG_LEX_2 is invoked with exactly one argument which is the
name of one of the three _AC_PROG_LEX_LIBL_* macros (described below).
It invokes, in sequence, AC_CHECK_PROGS([LEX]), _AC_PROG_LEX_OUTPUT_ROOT,
the _AC_PROG_LEX_LIBL_ macro it was given as an argument, and
finally _AC_PROG_LEX_YYTEXT_DECL. If any of these sets LEX to ‘:’,
further tests are skipped. _AC_PROG_LEX_2 is also responsible for
cleaning up conftest.l and lex.yy.c afterward.
- _AC_PROG_LEX_YYTEXT_DECL now *only* tests whether yytext is a
pointer. It reuses the conftest.l from previous tests.
- _AC_PROG_LEX_OUTPUT_ROOT just does the test for the name of the
file produced by running ‘lex conftest.l’ with no further arguments.
- _AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP, and
_AC_PROG_LEX_LIBL_COMPAT determine whether a generated lexer needs
to be linked with -ll or -lfl. Each is dedicated to one of the
three operating modes, and uses a conftest.l specialized for that mode.
In compat mode we do *not* look for ‘yywrap’ using AC_SEARCH_LIBS;
instead we actually try to link a generated lexer that uses yywrap.
- _AC_PROG_LEX_SEARCH_LIBL, _AC_PROG_LEX_TEST_COMMON,
_AC_PROG_LEX_TEST_YYWRAP, and _AC_PROG_LEX_TEST_NOYYWRAP are
subroutines of the _AC_PROG_LEX_LIBL_* macros.
TODO:
- Shrink and sharpen the test program used by _AC_PROG_LEX_YYTEXT_DECL and
make it independent of previous operations. Possibly smush it
back together with _AC_PROG_LEX_OUTPUT_ROOT.
- Re-audit the “noyywrap” program, it might be better to declare
“_static_ int yywrap(void)” in the %{ %} block instead of not
declaring it at all.
- Re-audit the “yywrap” program, it might be better to rely on the
skeleton to declare yywrap.
* lib/autoconf/programs.m4 (AC_PROG_LEX): Extensive refactor.
Test for yywrap is now done by linking a generated lexer, not with
AC_SEARCH_LIBS.
(_AC_PROG_LEX_YYTEXT_DECL): Just test whether yytext is a pointer.
(_AC_PROG_LEX): Removed.
(_AC_PROG_LEX_1, _AC_PROG_LEX_2): New macros dividing up the labor
formerly performed by _AC_PROG_LEX and the order of operations in
the old _AC_PROG_LEX_YYTEXT_DECL.
(_AC_PROG_LEX_OUTPUT_ROOT, _AC_PROG_LEX_SEARCH_LIBL)
(_AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP)
(_AC_PROG_LEX_LIBL_COMPAT, _AC_PROG_LEX_TEST_COMMON)
(_AC_PROG_LEX_TEST_YYWRAP, _AC_PROG_LEX_TEST_NOYYWRAP):
New macros dividing up the rest of the labor formerly performed by
_AC_PROG_LEX_YYTEXT_DECL.
* tests/semantics.at
(AC_PROG_LEX with noyywrap): Rename “AC_PROG_LEX: noyywrap”.
(AC_PROG_LEX with yywrap): Rename “AC_PROG_LEX: yywrap”. No longer
necessary to skip this test on OSes where there is no -ll nor -lfl.
(AC_PROG_LEX in legacy mode): Rename “AC_PROG_LEX: compat mode.”
Convert to AT_CHECK_MACRO test using -Wno-obsolete.
(Invalid arguments to AC_PROG_LEX): Rename “AC_PROG_LEX: invalid
arguments and warnings.” Move the test for the warning
“AC_PROG_LEX without either yywrap or noyywrap is obsolete” here.
Adjust expected stack traces.
2023-12-03 12:09:37 -05:00
|
|
|
programs.m4: _AC_PROG_LEX_1 is expanded from...
|
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
|
|
|
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
|
Overhaul AC_PROG_LEX for precision and maintainability
AC_PROG_LEX has three different operating modes (“yywrap”, “noyywrap”,
and 2.69 compatibility mode) which were all tangled together and hard
to understand. In addition, the way we were handling yywrap, in all
three modes, was imprecise to the point where I am unsure we were
actually testing the property people want to test.
Refactor AC_PROG_LEX into a set of smaller macros:
- AC_PROG_LEX and _AC_PROG_LEX_1 perform argument validation and
normalization. _AC_PROG_LEX_1 also ensures that repeated invocation
of AC_PROG_LEX is harmless.
- _AC_PROG_LEX_2 is invoked with exactly one argument which is the
name of one of the three _AC_PROG_LEX_LIBL_* macros (described below).
It invokes, in sequence, AC_CHECK_PROGS([LEX]), _AC_PROG_LEX_OUTPUT_ROOT,
the _AC_PROG_LEX_LIBL_ macro it was given as an argument, and
finally _AC_PROG_LEX_YYTEXT_DECL. If any of these sets LEX to ‘:’,
further tests are skipped. _AC_PROG_LEX_2 is also responsible for
cleaning up conftest.l and lex.yy.c afterward.
- _AC_PROG_LEX_YYTEXT_DECL now *only* tests whether yytext is a
pointer. It reuses the conftest.l from previous tests.
- _AC_PROG_LEX_OUTPUT_ROOT just does the test for the name of the
file produced by running ‘lex conftest.l’ with no further arguments.
- _AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP, and
_AC_PROG_LEX_LIBL_COMPAT determine whether a generated lexer needs
to be linked with -ll or -lfl. Each is dedicated to one of the
three operating modes, and uses a conftest.l specialized for that mode.
In compat mode we do *not* look for ‘yywrap’ using AC_SEARCH_LIBS;
instead we actually try to link a generated lexer that uses yywrap.
- _AC_PROG_LEX_SEARCH_LIBL, _AC_PROG_LEX_TEST_COMMON,
_AC_PROG_LEX_TEST_YYWRAP, and _AC_PROG_LEX_TEST_NOYYWRAP are
subroutines of the _AC_PROG_LEX_LIBL_* macros.
TODO:
- Shrink and sharpen the test program used by _AC_PROG_LEX_YYTEXT_DECL and
make it independent of previous operations. Possibly smush it
back together with _AC_PROG_LEX_OUTPUT_ROOT.
- Re-audit the “noyywrap” program, it might be better to declare
“_static_ int yywrap(void)” in the %{ %} block instead of not
declaring it at all.
- Re-audit the “yywrap” program, it might be better to rely on the
skeleton to declare yywrap.
* lib/autoconf/programs.m4 (AC_PROG_LEX): Extensive refactor.
Test for yywrap is now done by linking a generated lexer, not with
AC_SEARCH_LIBS.
(_AC_PROG_LEX_YYTEXT_DECL): Just test whether yytext is a pointer.
(_AC_PROG_LEX): Removed.
(_AC_PROG_LEX_1, _AC_PROG_LEX_2): New macros dividing up the labor
formerly performed by _AC_PROG_LEX and the order of operations in
the old _AC_PROG_LEX_YYTEXT_DECL.
(_AC_PROG_LEX_OUTPUT_ROOT, _AC_PROG_LEX_SEARCH_LIBL)
(_AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP)
(_AC_PROG_LEX_LIBL_COMPAT, _AC_PROG_LEX_TEST_COMMON)
(_AC_PROG_LEX_TEST_YYWRAP, _AC_PROG_LEX_TEST_NOYYWRAP):
New macros dividing up the rest of the labor formerly performed by
_AC_PROG_LEX_YYTEXT_DECL.
* tests/semantics.at
(AC_PROG_LEX with noyywrap): Rename “AC_PROG_LEX: noyywrap”.
(AC_PROG_LEX with yywrap): Rename “AC_PROG_LEX: yywrap”. No longer
necessary to skip this test on OSes where there is no -ll nor -lfl.
(AC_PROG_LEX in legacy mode): Rename “AC_PROG_LEX: compat mode.”
Convert to AT_CHECK_MACRO test using -Wno-obsolete.
(Invalid arguments to AC_PROG_LEX): Rename “AC_PROG_LEX: invalid
arguments and warnings.” Move the test for the warning
“AC_PROG_LEX without either yywrap or noyywrap is obsolete” here.
Adjust expected stack traces.
2023-12-03 12:09:37 -05:00
|
|
|
programs.m4: _AC_PROG_LEX_1 is expanded from...
|
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
|
|
|
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
|
Overhaul AC_PROG_LEX for precision and maintainability
AC_PROG_LEX has three different operating modes (“yywrap”, “noyywrap”,
and 2.69 compatibility mode) which were all tangled together and hard
to understand. In addition, the way we were handling yywrap, in all
three modes, was imprecise to the point where I am unsure we were
actually testing the property people want to test.
Refactor AC_PROG_LEX into a set of smaller macros:
- AC_PROG_LEX and _AC_PROG_LEX_1 perform argument validation and
normalization. _AC_PROG_LEX_1 also ensures that repeated invocation
of AC_PROG_LEX is harmless.
- _AC_PROG_LEX_2 is invoked with exactly one argument which is the
name of one of the three _AC_PROG_LEX_LIBL_* macros (described below).
It invokes, in sequence, AC_CHECK_PROGS([LEX]), _AC_PROG_LEX_OUTPUT_ROOT,
the _AC_PROG_LEX_LIBL_ macro it was given as an argument, and
finally _AC_PROG_LEX_YYTEXT_DECL. If any of these sets LEX to ‘:’,
further tests are skipped. _AC_PROG_LEX_2 is also responsible for
cleaning up conftest.l and lex.yy.c afterward.
- _AC_PROG_LEX_YYTEXT_DECL now *only* tests whether yytext is a
pointer. It reuses the conftest.l from previous tests.
- _AC_PROG_LEX_OUTPUT_ROOT just does the test for the name of the
file produced by running ‘lex conftest.l’ with no further arguments.
- _AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP, and
_AC_PROG_LEX_LIBL_COMPAT determine whether a generated lexer needs
to be linked with -ll or -lfl. Each is dedicated to one of the
three operating modes, and uses a conftest.l specialized for that mode.
In compat mode we do *not* look for ‘yywrap’ using AC_SEARCH_LIBS;
instead we actually try to link a generated lexer that uses yywrap.
- _AC_PROG_LEX_SEARCH_LIBL, _AC_PROG_LEX_TEST_COMMON,
_AC_PROG_LEX_TEST_YYWRAP, and _AC_PROG_LEX_TEST_NOYYWRAP are
subroutines of the _AC_PROG_LEX_LIBL_* macros.
TODO:
- Shrink and sharpen the test program used by _AC_PROG_LEX_YYTEXT_DECL and
make it independent of previous operations. Possibly smush it
back together with _AC_PROG_LEX_OUTPUT_ROOT.
- Re-audit the “noyywrap” program, it might be better to declare
“_static_ int yywrap(void)” in the %{ %} block instead of not
declaring it at all.
- Re-audit the “yywrap” program, it might be better to rely on the
skeleton to declare yywrap.
* lib/autoconf/programs.m4 (AC_PROG_LEX): Extensive refactor.
Test for yywrap is now done by linking a generated lexer, not with
AC_SEARCH_LIBS.
(_AC_PROG_LEX_YYTEXT_DECL): Just test whether yytext is a pointer.
(_AC_PROG_LEX): Removed.
(_AC_PROG_LEX_1, _AC_PROG_LEX_2): New macros dividing up the labor
formerly performed by _AC_PROG_LEX and the order of operations in
the old _AC_PROG_LEX_YYTEXT_DECL.
(_AC_PROG_LEX_OUTPUT_ROOT, _AC_PROG_LEX_SEARCH_LIBL)
(_AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP)
(_AC_PROG_LEX_LIBL_COMPAT, _AC_PROG_LEX_TEST_COMMON)
(_AC_PROG_LEX_TEST_YYWRAP, _AC_PROG_LEX_TEST_NOYYWRAP):
New macros dividing up the rest of the labor formerly performed by
_AC_PROG_LEX_YYTEXT_DECL.
* tests/semantics.at
(AC_PROG_LEX with noyywrap): Rename “AC_PROG_LEX: noyywrap”.
(AC_PROG_LEX with yywrap): Rename “AC_PROG_LEX: yywrap”. No longer
necessary to skip this test on OSes where there is no -ll nor -lfl.
(AC_PROG_LEX in legacy mode): Rename “AC_PROG_LEX: compat mode.”
Convert to AT_CHECK_MACRO test using -Wno-obsolete.
(Invalid arguments to AC_PROG_LEX): Rename “AC_PROG_LEX: invalid
arguments and warnings.” Move the test for the warning
“AC_PROG_LEX without either yywrap or noyywrap is obsolete” here.
Adjust expected stack traces.
2023-12-03 12:09:37 -05:00
|
|
|
programs.m4: _AC_PROG_LEX_1 is expanded from...
|
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
|
|
|
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
|
Overhaul AC_PROG_LEX for precision and maintainability
AC_PROG_LEX has three different operating modes (“yywrap”, “noyywrap”,
and 2.69 compatibility mode) which were all tangled together and hard
to understand. In addition, the way we were handling yywrap, in all
three modes, was imprecise to the point where I am unsure we were
actually testing the property people want to test.
Refactor AC_PROG_LEX into a set of smaller macros:
- AC_PROG_LEX and _AC_PROG_LEX_1 perform argument validation and
normalization. _AC_PROG_LEX_1 also ensures that repeated invocation
of AC_PROG_LEX is harmless.
- _AC_PROG_LEX_2 is invoked with exactly one argument which is the
name of one of the three _AC_PROG_LEX_LIBL_* macros (described below).
It invokes, in sequence, AC_CHECK_PROGS([LEX]), _AC_PROG_LEX_OUTPUT_ROOT,
the _AC_PROG_LEX_LIBL_ macro it was given as an argument, and
finally _AC_PROG_LEX_YYTEXT_DECL. If any of these sets LEX to ‘:’,
further tests are skipped. _AC_PROG_LEX_2 is also responsible for
cleaning up conftest.l and lex.yy.c afterward.
- _AC_PROG_LEX_YYTEXT_DECL now *only* tests whether yytext is a
pointer. It reuses the conftest.l from previous tests.
- _AC_PROG_LEX_OUTPUT_ROOT just does the test for the name of the
file produced by running ‘lex conftest.l’ with no further arguments.
- _AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP, and
_AC_PROG_LEX_LIBL_COMPAT determine whether a generated lexer needs
to be linked with -ll or -lfl. Each is dedicated to one of the
three operating modes, and uses a conftest.l specialized for that mode.
In compat mode we do *not* look for ‘yywrap’ using AC_SEARCH_LIBS;
instead we actually try to link a generated lexer that uses yywrap.
- _AC_PROG_LEX_SEARCH_LIBL, _AC_PROG_LEX_TEST_COMMON,
_AC_PROG_LEX_TEST_YYWRAP, and _AC_PROG_LEX_TEST_NOYYWRAP are
subroutines of the _AC_PROG_LEX_LIBL_* macros.
TODO:
- Shrink and sharpen the test program used by _AC_PROG_LEX_YYTEXT_DECL and
make it independent of previous operations. Possibly smush it
back together with _AC_PROG_LEX_OUTPUT_ROOT.
- Re-audit the “noyywrap” program, it might be better to declare
“_static_ int yywrap(void)” in the %{ %} block instead of not
declaring it at all.
- Re-audit the “yywrap” program, it might be better to rely on the
skeleton to declare yywrap.
* lib/autoconf/programs.m4 (AC_PROG_LEX): Extensive refactor.
Test for yywrap is now done by linking a generated lexer, not with
AC_SEARCH_LIBS.
(_AC_PROG_LEX_YYTEXT_DECL): Just test whether yytext is a pointer.
(_AC_PROG_LEX): Removed.
(_AC_PROG_LEX_1, _AC_PROG_LEX_2): New macros dividing up the labor
formerly performed by _AC_PROG_LEX and the order of operations in
the old _AC_PROG_LEX_YYTEXT_DECL.
(_AC_PROG_LEX_OUTPUT_ROOT, _AC_PROG_LEX_SEARCH_LIBL)
(_AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP)
(_AC_PROG_LEX_LIBL_COMPAT, _AC_PROG_LEX_TEST_COMMON)
(_AC_PROG_LEX_TEST_YYWRAP, _AC_PROG_LEX_TEST_NOYYWRAP):
New macros dividing up the rest of the labor formerly performed by
_AC_PROG_LEX_YYTEXT_DECL.
* tests/semantics.at
(AC_PROG_LEX with noyywrap): Rename “AC_PROG_LEX: noyywrap”.
(AC_PROG_LEX with yywrap): Rename “AC_PROG_LEX: yywrap”. No longer
necessary to skip this test on OSes where there is no -ll nor -lfl.
(AC_PROG_LEX in legacy mode): Rename “AC_PROG_LEX: compat mode.”
Convert to AT_CHECK_MACRO test using -Wno-obsolete.
(Invalid arguments to AC_PROG_LEX): Rename “AC_PROG_LEX: invalid
arguments and warnings.” Move the test for the warning
“AC_PROG_LEX without either yywrap or noyywrap is obsolete” here.
Adjust expected stack traces.
2023-12-03 12:09:37 -05:00
|
|
|
programs.m4: _AC_PROG_LEX_1 is expanded from...
|
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
|
|
|
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
|
Overhaul AC_PROG_LEX for precision and maintainability
AC_PROG_LEX has three different operating modes (“yywrap”, “noyywrap”,
and 2.69 compatibility mode) which were all tangled together and hard
to understand. In addition, the way we were handling yywrap, in all
three modes, was imprecise to the point where I am unsure we were
actually testing the property people want to test.
Refactor AC_PROG_LEX into a set of smaller macros:
- AC_PROG_LEX and _AC_PROG_LEX_1 perform argument validation and
normalization. _AC_PROG_LEX_1 also ensures that repeated invocation
of AC_PROG_LEX is harmless.
- _AC_PROG_LEX_2 is invoked with exactly one argument which is the
name of one of the three _AC_PROG_LEX_LIBL_* macros (described below).
It invokes, in sequence, AC_CHECK_PROGS([LEX]), _AC_PROG_LEX_OUTPUT_ROOT,
the _AC_PROG_LEX_LIBL_ macro it was given as an argument, and
finally _AC_PROG_LEX_YYTEXT_DECL. If any of these sets LEX to ‘:’,
further tests are skipped. _AC_PROG_LEX_2 is also responsible for
cleaning up conftest.l and lex.yy.c afterward.
- _AC_PROG_LEX_YYTEXT_DECL now *only* tests whether yytext is a
pointer. It reuses the conftest.l from previous tests.
- _AC_PROG_LEX_OUTPUT_ROOT just does the test for the name of the
file produced by running ‘lex conftest.l’ with no further arguments.
- _AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP, and
_AC_PROG_LEX_LIBL_COMPAT determine whether a generated lexer needs
to be linked with -ll or -lfl. Each is dedicated to one of the
three operating modes, and uses a conftest.l specialized for that mode.
In compat mode we do *not* look for ‘yywrap’ using AC_SEARCH_LIBS;
instead we actually try to link a generated lexer that uses yywrap.
- _AC_PROG_LEX_SEARCH_LIBL, _AC_PROG_LEX_TEST_COMMON,
_AC_PROG_LEX_TEST_YYWRAP, and _AC_PROG_LEX_TEST_NOYYWRAP are
subroutines of the _AC_PROG_LEX_LIBL_* macros.
TODO:
- Shrink and sharpen the test program used by _AC_PROG_LEX_YYTEXT_DECL and
make it independent of previous operations. Possibly smush it
back together with _AC_PROG_LEX_OUTPUT_ROOT.
- Re-audit the “noyywrap” program, it might be better to declare
“_static_ int yywrap(void)” in the %{ %} block instead of not
declaring it at all.
- Re-audit the “yywrap” program, it might be better to rely on the
skeleton to declare yywrap.
* lib/autoconf/programs.m4 (AC_PROG_LEX): Extensive refactor.
Test for yywrap is now done by linking a generated lexer, not with
AC_SEARCH_LIBS.
(_AC_PROG_LEX_YYTEXT_DECL): Just test whether yytext is a pointer.
(_AC_PROG_LEX): Removed.
(_AC_PROG_LEX_1, _AC_PROG_LEX_2): New macros dividing up the labor
formerly performed by _AC_PROG_LEX and the order of operations in
the old _AC_PROG_LEX_YYTEXT_DECL.
(_AC_PROG_LEX_OUTPUT_ROOT, _AC_PROG_LEX_SEARCH_LIBL)
(_AC_PROG_LEX_LIBL_YYWRAP, _AC_PROG_LEX_LIBL_NOYYWRAP)
(_AC_PROG_LEX_LIBL_COMPAT, _AC_PROG_LEX_TEST_COMMON)
(_AC_PROG_LEX_TEST_YYWRAP, _AC_PROG_LEX_TEST_NOYYWRAP):
New macros dividing up the rest of the labor formerly performed by
_AC_PROG_LEX_YYTEXT_DECL.
* tests/semantics.at
(AC_PROG_LEX with noyywrap): Rename “AC_PROG_LEX: noyywrap”.
(AC_PROG_LEX with yywrap): Rename “AC_PROG_LEX: yywrap”. No longer
necessary to skip this test on OSes where there is no -ll nor -lfl.
(AC_PROG_LEX in legacy mode): Rename “AC_PROG_LEX: compat mode.”
Convert to AT_CHECK_MACRO test using -Wno-obsolete.
(Invalid arguments to AC_PROG_LEX): Rename “AC_PROG_LEX: invalid
arguments and warnings.” Move the test for the warning
“AC_PROG_LEX without either yywrap or noyywrap is obsolete” here.
Adjust expected stack traces.
2023-12-03 12:09:37 -05:00
|
|
|
programs.m4: _AC_PROG_LEX_1 is expanded from...
|
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
|
|
|
programs.m4: AC_PROG_LEX is expanded from...
|
|
|
|
configure.ac:5: the top level
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CLEANUP
|