* 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
|
|
|
|
2020-01-01 11:45:50 -08:00
|
|
|
# Copyright (C) 2000-2002, 2004-2007, 2009-2017, 2020 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
|
|
|
|
# ------------
|
|
|
|
# Well, I can't imagine a system where `cos' is neither in libc, nor
|
|
|
|
# in libm. Nor can I imagine a lib more likely to exists than libm.
|
2000-04-11 12:07:45 +00:00
|
|
|
# But there are systems without libm, on which we don't want to have
|
2000-03-25 09:06:24 +00:00
|
|
|
# this test fail, so exit successfully if `cos' is in libc.
|
2000-11-29 10:11:38 +00:00
|
|
|
AT_CHECK_MACRO([AC_CHECK_LIB],
|
2001-06-06 08:25:00 +00:00
|
|
|
[AC_TRY_LINK_FUNC(cos,
|
* 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
|
|
|
[AC_MSG_ERROR([`cos' is in `libc'], 77)])
|
2001-06-06 08:25:00 +00:00
|
|
|
|
2000-10-27 14:15:28 +00:00
|
|
|
AC_CHECK_LIB(m, cos,,
|
* 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
|
|
|
[AC_MSG_ERROR([cannot find `cos' in `libm'])])
|
2001-06-06 08:25:00 +00:00
|
|
|
|
|
|
|
# No kidding, using variables was broken in 2.50 :(
|
|
|
|
ac_sin=sin
|
|
|
|
AC_CHECK_LIB(m, $ac_sin,,
|
|
|
|
[AC_MSG_ERROR([cannot find `\$ac_sin' (= `$ac_sin') in `libm'])])
|
|
|
|
|
2020-07-02 22:23:59 -07:00
|
|
|
AS_UNSET([ac_cv_lib_m_acos])
|
2001-06-06 08:25:00 +00:00
|
|
|
ac_m=m
|
|
|
|
AC_CHECK_LIB($ac_m, acos,,
|
|
|
|
[AC_MSG_ERROR([cannot find `acos' in `\$ac_m' (= `$ac_m')])])
|
2020-07-02 22:23:59 -07:00
|
|
|
if test "${ac_cv_lib_m_acos+set}" != set; then
|
|
|
|
AC_MSG_ERROR([ac_cv_lib_m_acos not set])
|
|
|
|
fi
|
2001-06-06 08:25:00 +00:00
|
|
|
|
|
|
|
ac_asin=asin
|
|
|
|
AC_CHECK_LIB($ac_m, $ac_asin,,
|
2007-11-12 09:46:16 +01:00
|
|
|
[AC_MSG_ERROR([cannot find `\$ac_asin' (= `$ac_asin') in `\$ac_m' (= `$ac_m')])])
|
2001-06-06 08:25:00 +00:00
|
|
|
|
|
|
|
# But if the bug is in the caching mechanism, then be sure we
|
|
|
|
# correctly detect failures.
|
|
|
|
|
|
|
|
AC_CHECK_LIB(m, cossack,
|
* 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
|
|
|
[AC_MSG_ERROR([found `cossack' in `libm'])])
|
2001-06-06 08:25:00 +00:00
|
|
|
|
|
|
|
# No kidding, using variables was broken in 2.50 :(
|
|
|
|
ac_sinner=sinner
|
|
|
|
AC_CHECK_LIB(m, $ac_sinner,
|
|
|
|
[AC_MSG_ERROR([found `\$ac_sinner' (= `$ac_sinner') in `libm'])])
|
|
|
|
|
|
|
|
ac_m=m
|
|
|
|
AC_CHECK_LIB($ac_m, acossack,
|
|
|
|
[AC_MSG_ERROR([found `acossack' in `\$ac_m' (= `$ac_m')])])
|
|
|
|
|
|
|
|
ac_asinner=asinner
|
|
|
|
AC_CHECK_LIB($ac_m, $ac_asinner,
|
2007-11-12 09:46:16 +01:00
|
|
|
[AC_MSG_ERROR([found `\$ac_asinner' (= `$ac_asinner') in `\$ac_m' (= `$ac_m')])])
|
2001-06-06 08:25:00 +00:00
|
|
|
|
|
|
|
])
|
2000-03-25 09:06:24 +00:00
|
|
|
|
|
|
|
|
2003-05-18 14:48:02 +00:00
|
|
|
# AC_SEARCH_LIBS
|
|
|
|
# --------------
|
|
|
|
AT_CHECK_MACRO([AC_SEARCH_LIBS],
|
|
|
|
[
|
|
|
|
AC_SEARCH_LIBS(cos, oser m ust,,
|
* 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
|
|
|
[AC_MSG_ERROR([cannot find `cos'])])
|
2003-05-18 14:48:02 +00:00
|
|
|
|
|
|
|
case "$ac_cv_search_cos" in
|
|
|
|
-loser|-lust) AC_MSG_ERROR([jeez, $ac_cv_search_cos must be a cool library!]) ;;
|
|
|
|
esac
|
2005-09-06 15:34:06 +00:00
|
|
|
])
|
|
|
|
|
2003-05-18 14:48:02 +00:00
|
|
|
|
2005-09-06 15:34:06 +00:00
|
|
|
# AC_SEARCH_LIBS (none needed)
|
|
|
|
# ----------------------------
|
|
|
|
AT_CHECK_MACRO([AC_SEARCH_LIBS (none needed)],
|
|
|
|
[
|
2003-05-18 14:48:02 +00:00
|
|
|
AC_SEARCH_LIBS(printf, oser c ust,,
|
* 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
|
|
|
[AC_MSG_ERROR([cannot find `printf'])])
|
2003-05-18 14:48:02 +00:00
|
|
|
|
|
|
|
case "$ac_cv_search_printf" in
|
|
|
|
-loser|-lust) AC_MSG_ERROR([jeez, $ac_cv_search_printf must be a cool library!]) ;;
|
|
|
|
-lc) AC_MSG_ERROR([huh, you need to give -lc?])
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
|
|
|
|
|
2000-03-25 09:06:24 +00:00
|
|
|
# AC_CHECK_DECLS
|
|
|
|
# --------------
|
2015-05-13 21:11:47 -04:00
|
|
|
# For the benefit of _AC_UNDECLARED_WARNING compilers, these INCLUDES sections
|
|
|
|
# should not elicit warnings.
|
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;
|
2006-09-26 20:42:43 +00:00
|
|
|
extern int myfunc();
|
|
|
|
#define mymacro1(arg) arg
|
2010-06-01 21:54:39 +02:00
|
|
|
#define mymacro2]])
|
2015-05-13 21:11:47 -04:00
|
|
|
# Clang reports a warning for an undeclared builtin.
|
|
|
|
AC_CHECK_DECLS([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])],, [[]])
|
2018-11-24 20:57:43 -08:00
|
|
|
if test -z "$ac_c_werror_flag"; then
|
|
|
|
AC_MSG_ERROR([ac_c_werror_flag overwritten])
|
|
|
|
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
|
|
|
|
#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
|
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
|
|
|
|
], [], [],
|
|
|
|
[[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
|
|
|
|
]])
|
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:
|
|
|
|
# Must define HAVE_STDIO_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
|
|
|
|
])
|
|
|
|
|
|
|
|
AT_CONFIGURE_AC([AC_CHECK_HEADERS(stdio.h autoconf_io.h)])
|
Manually sync ChannelDefs.pm from automake.
ChannelDefs.pm *ought* to be kept in sync between automake and autoconf,
because it defines the set of valid -W options, and autoreconf assumes
that it can pass arbitrary -W options to all of the tools it invokes.
However, it isn’t covered by either project’s ‘make fetch’ and it hasn’t
actually *been* in sync for more than 17 years.
This patch manually brings over all of the changes made on the
automake side. Once the complementary patch is applied by the
automake team, both versions of the file will be the same, and then we
can add it to the list in fetch.pl and not have this problem any more
in the future.
There are some user-visible consequences to bringing this file back
into sync. The only one worth mentioning in NEWS is that the ‘obsolete’
category of warnings is now on by default. This had quite a bit of
fallout throughout the testsuite. There are also some new warning
categories that get mentioned in --help output, but we don’t actually
generate any warnings in those categories, so people using ‘-Wall’
won’t see any change. More diagnostics are automatically tagged with
‘warning:’ or ‘error:’, which also had some fallout in the testsuite.
Finally, ‘-Werror’ no longer causes complaints about unknown warning
categories to be treated as hard errors.
Internally, there are some small API changes: ‘parse_warnings’ is no
longer usable as a ‘getopt’ callback function, and we now have a stub
Autom4te/Config.pm to match the automake code’s expectations. (This
file *should* also be synced from automake by ‘make fetch’, but we
can’t quite do that yet because it’s a generated file and our build
system is not prepared to handle adding *two* directories to @INC when
running a not-yet-installed Perl script. I plan to fix that after 2.70.)
As a side-effect of adding a Config.pm, ‘prog_error’ now says to
report the bug to bug-autoconf, not bug-automake. If this is why we
mostly haven’t been using prog_error for internal errors, we can stop
avoiding it. (I did not change anything to use prog_error in this
patch.)
* lib/Autom4te/ChannelDefs.pm: Merge from automake.
* lib/Autom4te/Config.pm: New file.
* lib/local.mk (dist_perllib_DATA): Add Autom4te/Config.pm.
* bin/autoconf.as: Update list of warning categories to match
Autom4te::ChannelDefs::usage.
* bin/autoheader.in (@warnings): New global.
(parse_args): Don’t use parse_warnings as a getopt callback.
(main): Add warnings options from our command line to $autoconf.
No need to turn on 'obsolete' warnings explicitly.
No need to include "warning: " in warning messages.
* bin/autom4te.in (parse_args): Don’t use parse_warnings as a getopt callback.
(main): No need to include "warning: " in warning messages.
* bin/autoreconf.in (parse_args): parse_warnings now takes only one argument.
* bin/autoupdate.in: Set WARNINGS=none in environment for all child processes.
* tests/local.at
(AT_CHECK_M4): Handle `autom4te: error: /usr/bin/m4 ...` like
`autom4te: /usr/bin/m4 ...`.
(_AT_CHECK_AC_MACRO): Add AUTOCONF-FLAGS argument, passed to both
autoconf and autoheader.
(AT_CHECK_MACRO): Default AUTOCONF-FLAGS argument to empty.
Pass that argument to autoheader as well as autoconf.
(AT_CHECK_AU_MACRO): Expect a “macro ‘NAME’ is obsolete’ diagnostic
on the first run of autoconf. Pass -Wno-obsolete to autoconf on the
second run, and to autoheader on both runs.
* tests/base.at
* tests/c.at
* tests/compile.at
* tests/m4sh.at
* tests/m4sugar.at
* tests/semantics.at
* tests/tools.at
* tests/torture.at:
No need to pass -Wobsolete to autoconf.
Pass -Wno-obsolete to autoheader where needed to avoid handling
the same warning twice.
Update various expectations for diagnostics to match behavior
changes.
* tests/tools.at (autoupdating AU_ALIAS): Add an AC_CONFIG_HEADERS
line to the test configure.ac to eliminate an unrelated diagnostic.
2020-09-12 14:59:56 -04:00
|
|
|
AT_CHECK_AUTOCONF
|
AC_REPLACE_FUNCS: invoke _AH_CHECK_FUNC and AC_LIBSOURCE unconditionally.
While investigating something else, I noticed that AC_REPLACE_FUNCS
calls _AH_CHECK_FUNC and AC_LIBSOURCE in the success branch of an
AC_CHECK_FUNC. This doesn’t work; both of those are marker macros
that need to be expanded unconditionally at m4 time so that traces
(placed by autoheader and automake, respectively) will fire. In order
to fix this while keeping the code readable, I would up doing a major
refactor. There are now four internal macros implementing AC_REPLACE_FUNCS.
_AC_REPLACE_FUNC_U is called unconditionally for every shell word in
the list passed to AC_REPLACE_FUNCS, and does _AH_CHECK_FUNC +
AC_LIBSOURCE if it can, or issues a warning if it can’t. (It could
make sense to make this a public function, if we think shell variables
in the AC_REPLACE_FUNCS list need to be supported long-term. I dunno
if there’s a use case that can’t be handled by AC_REPLACE_FUNCS inside
a shell conditional just as well.)
_AC_REPLACE_FUNC_L and _AC_REPLACE_FUNC_NL implement the actual test
performed for each function to be replaced; the difference is that _L
(for literal) can only be used on a function whose name is known at m4
expansion time, _NL (nonliteral) works regardless. _AC_REPLACE_FUNCS,
which already existed, handles looping either at m4 time or shell time
as appropriate. AC_REPLACE_FUNCS remains a thin wrapper that runs
_AC_REPLACE_FUNCS(m4_flatten([$1])).
The _bulk_ of the patch is changes to the testsuite so that it notices
the original bug. Specifically, AT_CHECK_AUTOHEADER now takes an
argument which is a whitespace-separated list of preprocessor macro
names that ought to appear in the generated config.h.in. This can be
set to ‘ignore’ to skip the test, and unfortunately that’s what the
“trivial” per-macro tests have to do (AT_CHECK_MACRO and friends), so
coverage is not ideal, but it’s better than what we had. Also,
AT_CHECK_M4 now normalizes the backtrace lines that appear in the
output of an AC_DIAGNOSE, e.g.
configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete.
configure.ac:6: You should run autoupdate.
../../lib/autoconf/lang.m4:125: AC_LANG_SAVE is expanded from...
configure.ac:6: the top level
becomes
configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete.
configure.ac:6: You should run autoupdate.
lang.m4: AC_LANG_SAVE is expanded from...
configure.ac:6: the top level
This allows us to write tests for these diagnostics that don’t depend
on the relationship between the source and build directories, and
won’t break when unrelated patches change the line number of a macro
definition.
* lib/autoconf/functions.m4 (AC_REPLACE_FUNCS, _AC_REPLACE_FUNCS)
(_AC_REPLACE_FUNC): Refactor into AC_REPLACE_FUNCS,
_AC_REPLACE_FUNCS, _AC_REPLACE_FUNC_U, _AC_REPLACE_FUNC_L,
_AC_REPLACE_FUNC_NL. Ensure that _AH_CHECK_FUNC and
AC_LIBSOURCE are invoked unconditionally at m4 expansion
time for each literal function name in the argument to
AC_CHECK_FUNCS. Issue warnings about non-literal names.
* tests/local.at (AT_CHECK_M4): Normalize backtrace lines from
the output of AC_DIAGNOSE / m4_warn.
(AT_CHECK_AUTOHEADER): Add arg EXPECTED-TMPLS
giving a list of preprocessor macro names that should appear
in the generated config.h.in. Use AT_CHECK_M4 to invoke autoheader.
(_AT_CHECK_AC_MACRO, AT_CHECK_MACRO, AT_CHECK_AU_MACRO):
Update uses of AT_CHECK_AUTOHEADER.
* tests/fortran.at, tests/semantics.at, tests/tools.at
* tests/torture.at: Update all uses of AT_CHECK_AUTOHEADER.
* tests/semantics.at (AC_REPLACE_FUNCS test): Make somewhat
more thorough, using new functionality of AT_CHECK_M4 and
AT_CHECK_AUTOHEADER.
Signed-off-by: Zack Weinberg <zackw@panix.com>
2020-06-29 18:55:39 -07:00
|
|
|
AT_CHECK_AUTOHEADER([], [
|
|
|
|
HAVE_AUTOCONF_IO_H
|
|
|
|
HAVE_INTTYPES_H
|
|
|
|
HAVE_STDINT_H
|
|
|
|
HAVE_STDIO_H
|
|
|
|
HAVE_STDLIB_H
|
|
|
|
HAVE_STRINGS_H
|
|
|
|
HAVE_STRING_H
|
|
|
|
HAVE_SYS_STAT_H
|
|
|
|
HAVE_SYS_TYPES_H
|
|
|
|
HAVE_UNISTD_H
|
|
|
|
STDC_HEADERS
|
|
|
|
])
|
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 */
|
|
|
|
#define HAVE_STDIO_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
|
|
|
|
configure.ac:4: instead of using fourth argument `-'. (Many headers need
|
|
|
|
configure.ac:4: no prerequisites. If you truly need to test whether
|
|
|
|
configure.ac:4: something passes the preprocessor but not the compiler,
|
|
|
|
configure.ac:4: use AC_PREPROC_IFELSE.)
|
Consistently expand macros in whitespace-separated lists.
Several of the most commonly used Autoconf macros (starting with
AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list
of symbols as their primary argument. It would abstractly be best if
this list were _not_ subject to M4 macro expansion, in case there’s a
collision between a M4 macro name and something to be looked for.
However, we have historically not been careful about this, and there’s
been reports of configure scripts using ‘dnl’ to write comments inside
the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and
AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre
shell syntax errors.
Also, the macro expansion behavior is not consistent among all of the
macros that take whitespace-separated lists, nor is it consistent
between autoconf and autoheader.
Address this by introducing a new m4sugar macro, currently called
‘m4_validate_w’ (I’m open to suggestions for better names). Here’s
its documentation comment:
| m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])),
| but if that is not the same as just m4_normalize([STRING]),
| issue a warning.
The text of the warning is
| configure.ac:N: warning: whitespace-separated-list contains macros;
| configure.ac:N: in a future version of Autoconf they will not be expanded
If the unexpanded form of the string contains the token ‘dnl’ then
there’s an additional line:
| configure.ac:N: note: ‘dnl’ is a macro
All of the public macros that take a whitespace-separated list of
symbols are changed to pass that argument through m4_validate_w before
doing anything else with it, and the test suite is updated to verify
consistent behavior for every last one of them.
This addresses Savannah issues #110210 and #110211, and the harmless
but annoying autoheader behavior described at
https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html .
In order to avoid expanding relatively expensive m4sugar macros
multiple times per top-level macro invocation, several of the affected
Autoconf macros are restructured along the same lines as I did for
AC_REPLACE_FUNCS in the previous patch.
* lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE)
(AC_REPLACE_FUNCS)
* lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES)
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE)
* lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through
m4_validate_w before use.
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers
_AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C.
(AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE.
(AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers
_AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C.
* lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize.
* tests/semantics.at: Add tests for expansion of M4 macros in
whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
|
|
|
headers.m4: _AC_CHECK_HEADER_PREPROC is expanded from...
|
|
|
|
headers.m4: AC_CHECK_HEADER is expanded from...
|
|
|
|
headers.m4: AC_CHECK_HEADERS is expanded from...
|
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],
|
|
|
|
[Define to 1 if `yes' is a member of `struct yes_s'.])],,
|
|
|
|
[struct sub { int x; };
|
|
|
|
struct yes_s { int yes; struct sub substruct; };])
|
|
|
|
AC_CHECK_MEMBER([struct yes_s.no],
|
|
|
|
[AC_DEFINE([HAVE_STRUCT_YES_S_NO], [1],
|
|
|
|
[Define to 1 if `no' is a member of `struct yes_s'.])],,
|
|
|
|
[struct sub { int x; };
|
|
|
|
struct yes_s { int yes; struct sub substruct; };])
|
|
|
|
AC_CHECK_MEMBER([struct yes_s.substruct],
|
|
|
|
[AC_DEFINE([HAVE_STRUCT_YES_S_SUBSTRUCT], [1],
|
|
|
|
[Define to 1 if `substruct' is a member of `struct yes_s'.])],,
|
|
|
|
[struct sub { int x; };
|
|
|
|
struct yes_s { int yes; struct sub substruct; };])]],
|
|
|
|
[AT_CHECK_DEFINES(
|
|
|
|
[/* #undef HAVE_STRUCT_YES_S_NO */
|
|
|
|
#define HAVE_STRUCT_YES_S_SUBSTRUCT 1
|
|
|
|
#define HAVE_STRUCT_YES_S_YES 1
|
|
|
|
])])
|
|
|
|
|
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
|
|
|
|
# ----------------
|
2006-03-17 18:03:01 +00:00
|
|
|
AT_CHECK_MACRO_CROSS([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
|
|
|
|
# -----------------------
|
2006-03-17 18:03:01 +00:00
|
|
|
AT_CHECK_MACRO_CROSS([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
|
|
|
# ---------------
|
2006-03-17 18:03:01 +00:00
|
|
|
AT_CHECK_MACRO_CROSS([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_CROSS([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.
|
|
|
|
# `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
|
2000-12-23 10:11:57 +00:00
|
|
|
# open AH_TEMPLATE to `configure.ac', which is not yet the case.
|
2000-11-29 10:11:38 +00:00
|
|
|
AT_CHECK_MACRO([AC_CHECK_FILES],
|
2001-01-18 09:30:10 +00:00
|
|
|
[touch at-exists1 at-exists2
|
|
|
|
ac_exists2=at-exists2
|
|
|
|
ac_missing2=at-missing2
|
|
|
|
AC_CHECK_FILES(at-exists1 at-missing1 $ac_exists2 $ac_missing2)
|
|
|
|
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
|
|
|
|
# ----------------------
|
2000-03-03 14:15:41 +00: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
|
|
|
|
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([AC_SYS_RESTARTABLE_SYSCALLS], , ,[-W no-obsolete])
|
2006-12-01 19:36:56 +00:00
|
|
|
AT_CHECK_MACRO([AC_FUNC_SETVBUF_REVERSED], , ,[-W no-obsolete])
|
2001-06-25 18:27:51 +00:00
|
|
|
AT_CHECK_MACRO([AC_FUNC_WAIT3], , ,[-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
|
|
|
|
|
|
|
|
|
|
|
## ----------------------------------------- ##
|
|
|
|
## Expansion of whitespace-separated lists. ##
|
|
|
|
## ----------------------------------------- ##
|
|
|
|
|
|
|
|
|
|
|
|
m4_define([AT_CHECK_EXPANSION_IN_FUNCS],
|
|
|
|
[AT_SETUP([Macro expansion in $1]m4_if([$2],[literal],[],[ (literal)]))
|
|
|
|
|
|
|
|
AT_CONFIGURE_AC([[
|
|
|
|
m4@&t@_define([fn_bar],[fn_quux])
|
|
|
|
$1([dn@&t@l
|
|
|
|
fn_foo dn@&t@l
|
|
|
|
fn_nocomment
|
|
|
|
fn_bar dn@&t@l Ordinary comment
|
|
|
|
fn_blurf dn@&t@l Apos'trophed comment
|
|
|
|
])
|
|
|
|
]])
|
Manually sync ChannelDefs.pm from automake.
ChannelDefs.pm *ought* to be kept in sync between automake and autoconf,
because it defines the set of valid -W options, and autoreconf assumes
that it can pass arbitrary -W options to all of the tools it invokes.
However, it isn’t covered by either project’s ‘make fetch’ and it hasn’t
actually *been* in sync for more than 17 years.
This patch manually brings over all of the changes made on the
automake side. Once the complementary patch is applied by the
automake team, both versions of the file will be the same, and then we
can add it to the list in fetch.pl and not have this problem any more
in the future.
There are some user-visible consequences to bringing this file back
into sync. The only one worth mentioning in NEWS is that the ‘obsolete’
category of warnings is now on by default. This had quite a bit of
fallout throughout the testsuite. There are also some new warning
categories that get mentioned in --help output, but we don’t actually
generate any warnings in those categories, so people using ‘-Wall’
won’t see any change. More diagnostics are automatically tagged with
‘warning:’ or ‘error:’, which also had some fallout in the testsuite.
Finally, ‘-Werror’ no longer causes complaints about unknown warning
categories to be treated as hard errors.
Internally, there are some small API changes: ‘parse_warnings’ is no
longer usable as a ‘getopt’ callback function, and we now have a stub
Autom4te/Config.pm to match the automake code’s expectations. (This
file *should* also be synced from automake by ‘make fetch’, but we
can’t quite do that yet because it’s a generated file and our build
system is not prepared to handle adding *two* directories to @INC when
running a not-yet-installed Perl script. I plan to fix that after 2.70.)
As a side-effect of adding a Config.pm, ‘prog_error’ now says to
report the bug to bug-autoconf, not bug-automake. If this is why we
mostly haven’t been using prog_error for internal errors, we can stop
avoiding it. (I did not change anything to use prog_error in this
patch.)
* lib/Autom4te/ChannelDefs.pm: Merge from automake.
* lib/Autom4te/Config.pm: New file.
* lib/local.mk (dist_perllib_DATA): Add Autom4te/Config.pm.
* bin/autoconf.as: Update list of warning categories to match
Autom4te::ChannelDefs::usage.
* bin/autoheader.in (@warnings): New global.
(parse_args): Don’t use parse_warnings as a getopt callback.
(main): Add warnings options from our command line to $autoconf.
No need to turn on 'obsolete' warnings explicitly.
No need to include "warning: " in warning messages.
* bin/autom4te.in (parse_args): Don’t use parse_warnings as a getopt callback.
(main): No need to include "warning: " in warning messages.
* bin/autoreconf.in (parse_args): parse_warnings now takes only one argument.
* bin/autoupdate.in: Set WARNINGS=none in environment for all child processes.
* tests/local.at
(AT_CHECK_M4): Handle `autom4te: error: /usr/bin/m4 ...` like
`autom4te: /usr/bin/m4 ...`.
(_AT_CHECK_AC_MACRO): Add AUTOCONF-FLAGS argument, passed to both
autoconf and autoheader.
(AT_CHECK_MACRO): Default AUTOCONF-FLAGS argument to empty.
Pass that argument to autoheader as well as autoconf.
(AT_CHECK_AU_MACRO): Expect a “macro ‘NAME’ is obsolete’ diagnostic
on the first run of autoconf. Pass -Wno-obsolete to autoconf on the
second run, and to autoheader on both runs.
* tests/base.at
* tests/c.at
* tests/compile.at
* tests/m4sh.at
* tests/m4sugar.at
* tests/semantics.at
* tests/tools.at
* tests/torture.at:
No need to pass -Wobsolete to autoconf.
Pass -Wno-obsolete to autoheader where needed to avoid handling
the same warning twice.
Update various expectations for diagnostics to match behavior
changes.
* tests/tools.at (autoupdating AU_ALIAS): Add an AC_CONFIG_HEADERS
line to the test configure.ac to eliminate an unrelated diagnostic.
2020-09-12 14:59:56 -04:00
|
|
|
AT_CHECK_AUTOCONF([], [0], [],
|
Consistently expand macros in whitespace-separated lists.
Several of the most commonly used Autoconf macros (starting with
AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list
of symbols as their primary argument. It would abstractly be best if
this list were _not_ subject to M4 macro expansion, in case there’s a
collision between a M4 macro name and something to be looked for.
However, we have historically not been careful about this, and there’s
been reports of configure scripts using ‘dnl’ to write comments inside
the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and
AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre
shell syntax errors.
Also, the macro expansion behavior is not consistent among all of the
macros that take whitespace-separated lists, nor is it consistent
between autoconf and autoheader.
Address this by introducing a new m4sugar macro, currently called
‘m4_validate_w’ (I’m open to suggestions for better names). Here’s
its documentation comment:
| m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])),
| but if that is not the same as just m4_normalize([STRING]),
| issue a warning.
The text of the warning is
| configure.ac:N: warning: whitespace-separated-list contains macros;
| configure.ac:N: in a future version of Autoconf they will not be expanded
If the unexpanded form of the string contains the token ‘dnl’ then
there’s an additional line:
| configure.ac:N: note: ‘dnl’ is a macro
All of the public macros that take a whitespace-separated list of
symbols are changed to pass that argument through m4_validate_w before
doing anything else with it, and the test suite is updated to verify
consistent behavior for every last one of them.
This addresses Savannah issues #110210 and #110211, and the harmless
but annoying autoheader behavior described at
https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html .
In order to avoid expanding relatively expensive m4sugar macros
multiple times per top-level macro invocation, several of the affected
Autoconf macros are restructured along the same lines as I did for
AC_REPLACE_FUNCS in the previous patch.
* lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE)
(AC_REPLACE_FUNCS)
* lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES)
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE)
* lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through
m4_validate_w before use.
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers
_AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C.
(AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE.
(AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers
_AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C.
* lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize.
* tests/semantics.at: Add tests for expansion of M4 macros in
whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
|
|
|
[configure.ac:6: warning: whitespace-separated list contains macros;
|
|
|
|
configure.ac:6: in a future version of Autoconf they will not be expanded
|
|
|
|
configure.ac:6: note: `dn@&t@l' is a macro
|
|
|
|
functions.m4: $1 is expanded from...
|
|
|
|
configure.ac:6: the top level
|
|
|
|
])
|
Manually sync ChannelDefs.pm from automake.
ChannelDefs.pm *ought* to be kept in sync between automake and autoconf,
because it defines the set of valid -W options, and autoreconf assumes
that it can pass arbitrary -W options to all of the tools it invokes.
However, it isn’t covered by either project’s ‘make fetch’ and it hasn’t
actually *been* in sync for more than 17 years.
This patch manually brings over all of the changes made on the
automake side. Once the complementary patch is applied by the
automake team, both versions of the file will be the same, and then we
can add it to the list in fetch.pl and not have this problem any more
in the future.
There are some user-visible consequences to bringing this file back
into sync. The only one worth mentioning in NEWS is that the ‘obsolete’
category of warnings is now on by default. This had quite a bit of
fallout throughout the testsuite. There are also some new warning
categories that get mentioned in --help output, but we don’t actually
generate any warnings in those categories, so people using ‘-Wall’
won’t see any change. More diagnostics are automatically tagged with
‘warning:’ or ‘error:’, which also had some fallout in the testsuite.
Finally, ‘-Werror’ no longer causes complaints about unknown warning
categories to be treated as hard errors.
Internally, there are some small API changes: ‘parse_warnings’ is no
longer usable as a ‘getopt’ callback function, and we now have a stub
Autom4te/Config.pm to match the automake code’s expectations. (This
file *should* also be synced from automake by ‘make fetch’, but we
can’t quite do that yet because it’s a generated file and our build
system is not prepared to handle adding *two* directories to @INC when
running a not-yet-installed Perl script. I plan to fix that after 2.70.)
As a side-effect of adding a Config.pm, ‘prog_error’ now says to
report the bug to bug-autoconf, not bug-automake. If this is why we
mostly haven’t been using prog_error for internal errors, we can stop
avoiding it. (I did not change anything to use prog_error in this
patch.)
* lib/Autom4te/ChannelDefs.pm: Merge from automake.
* lib/Autom4te/Config.pm: New file.
* lib/local.mk (dist_perllib_DATA): Add Autom4te/Config.pm.
* bin/autoconf.as: Update list of warning categories to match
Autom4te::ChannelDefs::usage.
* bin/autoheader.in (@warnings): New global.
(parse_args): Don’t use parse_warnings as a getopt callback.
(main): Add warnings options from our command line to $autoconf.
No need to turn on 'obsolete' warnings explicitly.
No need to include "warning: " in warning messages.
* bin/autom4te.in (parse_args): Don’t use parse_warnings as a getopt callback.
(main): No need to include "warning: " in warning messages.
* bin/autoreconf.in (parse_args): parse_warnings now takes only one argument.
* bin/autoupdate.in: Set WARNINGS=none in environment for all child processes.
* tests/local.at
(AT_CHECK_M4): Handle `autom4te: error: /usr/bin/m4 ...` like
`autom4te: /usr/bin/m4 ...`.
(_AT_CHECK_AC_MACRO): Add AUTOCONF-FLAGS argument, passed to both
autoconf and autoheader.
(AT_CHECK_MACRO): Default AUTOCONF-FLAGS argument to empty.
Pass that argument to autoheader as well as autoconf.
(AT_CHECK_AU_MACRO): Expect a “macro ‘NAME’ is obsolete’ diagnostic
on the first run of autoconf. Pass -Wno-obsolete to autoconf on the
second run, and to autoheader on both runs.
* tests/base.at
* tests/c.at
* tests/compile.at
* tests/m4sh.at
* tests/m4sugar.at
* tests/semantics.at
* tests/tools.at
* tests/torture.at:
No need to pass -Wobsolete to autoconf.
Pass -Wno-obsolete to autoheader where needed to avoid handling
the same warning twice.
Update various expectations for diagnostics to match behavior
changes.
* tests/tools.at (autoupdating AU_ALIAS): Add an AC_CONFIG_HEADERS
line to the test configure.ac to eliminate an unrelated diagnostic.
2020-09-12 14:59:56 -04:00
|
|
|
AT_CHECK_AUTOHEADER([-W no-obsolete], [
|
Consistently expand macros in whitespace-separated lists.
Several of the most commonly used Autoconf macros (starting with
AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list
of symbols as their primary argument. It would abstractly be best if
this list were _not_ subject to M4 macro expansion, in case there’s a
collision between a M4 macro name and something to be looked for.
However, we have historically not been careful about this, and there’s
been reports of configure scripts using ‘dnl’ to write comments inside
the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and
AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre
shell syntax errors.
Also, the macro expansion behavior is not consistent among all of the
macros that take whitespace-separated lists, nor is it consistent
between autoconf and autoheader.
Address this by introducing a new m4sugar macro, currently called
‘m4_validate_w’ (I’m open to suggestions for better names). Here’s
its documentation comment:
| m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])),
| but if that is not the same as just m4_normalize([STRING]),
| issue a warning.
The text of the warning is
| configure.ac:N: warning: whitespace-separated-list contains macros;
| configure.ac:N: in a future version of Autoconf they will not be expanded
If the unexpanded form of the string contains the token ‘dnl’ then
there’s an additional line:
| configure.ac:N: note: ‘dnl’ is a macro
All of the public macros that take a whitespace-separated list of
symbols are changed to pass that argument through m4_validate_w before
doing anything else with it, and the test suite is updated to verify
consistent behavior for every last one of them.
This addresses Savannah issues #110210 and #110211, and the harmless
but annoying autoheader behavior described at
https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html .
In order to avoid expanding relatively expensive m4sugar macros
multiple times per top-level macro invocation, several of the affected
Autoconf macros are restructured along the same lines as I did for
AC_REPLACE_FUNCS in the previous patch.
* lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE)
(AC_REPLACE_FUNCS)
* lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES)
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE)
* lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through
m4_validate_w before use.
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers
_AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C.
(AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE.
(AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers
_AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C.
* lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize.
* tests/semantics.at: Add tests for expansion of M4 macros in
whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
|
|
|
HAVE_FN_BLURF
|
|
|
|
HAVE_FN_FOO
|
|
|
|
HAVE_FN_NOCOMMENT
|
|
|
|
HAVE_FN_QUUX
|
|
|
|
])
|
|
|
|
AT_CHECK_CONFIGURE
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
m4_if([$2], [literal], [], [
|
|
|
|
AT_SETUP([Macro expansion in $1 (variable)])
|
|
|
|
|
|
|
|
AT_CONFIGURE_AC([[
|
|
|
|
m4@&t@_define([fn_bar],[fn_quux])
|
|
|
|
fns="fn_foo" _AH_CHECK_FUNC([fn_foo])
|
|
|
|
fns="$fns fn_nocomment" _AH_CHECK_FUNC([fn_nocomment])
|
|
|
|
$1([dn@&t@l
|
|
|
|
$[]fns
|
|
|
|
fn_bar dn@&t@l Ordinary comment
|
|
|
|
fn_blurf dn@&t@l Apos'trophed comment
|
|
|
|
])
|
|
|
|
]])
|
Manually sync ChannelDefs.pm from automake.
ChannelDefs.pm *ought* to be kept in sync between automake and autoconf,
because it defines the set of valid -W options, and autoreconf assumes
that it can pass arbitrary -W options to all of the tools it invokes.
However, it isn’t covered by either project’s ‘make fetch’ and it hasn’t
actually *been* in sync for more than 17 years.
This patch manually brings over all of the changes made on the
automake side. Once the complementary patch is applied by the
automake team, both versions of the file will be the same, and then we
can add it to the list in fetch.pl and not have this problem any more
in the future.
There are some user-visible consequences to bringing this file back
into sync. The only one worth mentioning in NEWS is that the ‘obsolete’
category of warnings is now on by default. This had quite a bit of
fallout throughout the testsuite. There are also some new warning
categories that get mentioned in --help output, but we don’t actually
generate any warnings in those categories, so people using ‘-Wall’
won’t see any change. More diagnostics are automatically tagged with
‘warning:’ or ‘error:’, which also had some fallout in the testsuite.
Finally, ‘-Werror’ no longer causes complaints about unknown warning
categories to be treated as hard errors.
Internally, there are some small API changes: ‘parse_warnings’ is no
longer usable as a ‘getopt’ callback function, and we now have a stub
Autom4te/Config.pm to match the automake code’s expectations. (This
file *should* also be synced from automake by ‘make fetch’, but we
can’t quite do that yet because it’s a generated file and our build
system is not prepared to handle adding *two* directories to @INC when
running a not-yet-installed Perl script. I plan to fix that after 2.70.)
As a side-effect of adding a Config.pm, ‘prog_error’ now says to
report the bug to bug-autoconf, not bug-automake. If this is why we
mostly haven’t been using prog_error for internal errors, we can stop
avoiding it. (I did not change anything to use prog_error in this
patch.)
* lib/Autom4te/ChannelDefs.pm: Merge from automake.
* lib/Autom4te/Config.pm: New file.
* lib/local.mk (dist_perllib_DATA): Add Autom4te/Config.pm.
* bin/autoconf.as: Update list of warning categories to match
Autom4te::ChannelDefs::usage.
* bin/autoheader.in (@warnings): New global.
(parse_args): Don’t use parse_warnings as a getopt callback.
(main): Add warnings options from our command line to $autoconf.
No need to turn on 'obsolete' warnings explicitly.
No need to include "warning: " in warning messages.
* bin/autom4te.in (parse_args): Don’t use parse_warnings as a getopt callback.
(main): No need to include "warning: " in warning messages.
* bin/autoreconf.in (parse_args): parse_warnings now takes only one argument.
* bin/autoupdate.in: Set WARNINGS=none in environment for all child processes.
* tests/local.at
(AT_CHECK_M4): Handle `autom4te: error: /usr/bin/m4 ...` like
`autom4te: /usr/bin/m4 ...`.
(_AT_CHECK_AC_MACRO): Add AUTOCONF-FLAGS argument, passed to both
autoconf and autoheader.
(AT_CHECK_MACRO): Default AUTOCONF-FLAGS argument to empty.
Pass that argument to autoheader as well as autoconf.
(AT_CHECK_AU_MACRO): Expect a “macro ‘NAME’ is obsolete’ diagnostic
on the first run of autoconf. Pass -Wno-obsolete to autoconf on the
second run, and to autoheader on both runs.
* tests/base.at
* tests/c.at
* tests/compile.at
* tests/m4sh.at
* tests/m4sugar.at
* tests/semantics.at
* tests/tools.at
* tests/torture.at:
No need to pass -Wobsolete to autoconf.
Pass -Wno-obsolete to autoheader where needed to avoid handling
the same warning twice.
Update various expectations for diagnostics to match behavior
changes.
* tests/tools.at (autoupdating AU_ALIAS): Add an AC_CONFIG_HEADERS
line to the test configure.ac to eliminate an unrelated diagnostic.
2020-09-12 14:59:56 -04:00
|
|
|
AT_CHECK_AUTOCONF([], [0], [],
|
Consistently expand macros in whitespace-separated lists.
Several of the most commonly used Autoconf macros (starting with
AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list
of symbols as their primary argument. It would abstractly be best if
this list were _not_ subject to M4 macro expansion, in case there’s a
collision between a M4 macro name and something to be looked for.
However, we have historically not been careful about this, and there’s
been reports of configure scripts using ‘dnl’ to write comments inside
the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and
AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre
shell syntax errors.
Also, the macro expansion behavior is not consistent among all of the
macros that take whitespace-separated lists, nor is it consistent
between autoconf and autoheader.
Address this by introducing a new m4sugar macro, currently called
‘m4_validate_w’ (I’m open to suggestions for better names). Here’s
its documentation comment:
| m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])),
| but if that is not the same as just m4_normalize([STRING]),
| issue a warning.
The text of the warning is
| configure.ac:N: warning: whitespace-separated-list contains macros;
| configure.ac:N: in a future version of Autoconf they will not be expanded
If the unexpanded form of the string contains the token ‘dnl’ then
there’s an additional line:
| configure.ac:N: note: ‘dnl’ is a macro
All of the public macros that take a whitespace-separated list of
symbols are changed to pass that argument through m4_validate_w before
doing anything else with it, and the test suite is updated to verify
consistent behavior for every last one of them.
This addresses Savannah issues #110210 and #110211, and the harmless
but annoying autoheader behavior described at
https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html .
In order to avoid expanding relatively expensive m4sugar macros
multiple times per top-level macro invocation, several of the affected
Autoconf macros are restructured along the same lines as I did for
AC_REPLACE_FUNCS in the previous patch.
* lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE)
(AC_REPLACE_FUNCS)
* lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES)
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE)
* lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through
m4_validate_w before use.
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers
_AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C.
(AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE.
(AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers
_AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C.
* lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize.
* tests/semantics.at: Add tests for expansion of M4 macros in
whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
|
|
|
[configure.ac:8: warning: whitespace-separated list contains macros;
|
|
|
|
configure.ac:8: in a future version of Autoconf they will not be expanded
|
|
|
|
configure.ac:8: note: `dn@&t@l' is a macro
|
|
|
|
functions.m4: $1 is expanded from...
|
|
|
|
configure.ac:8: the top level
|
|
|
|
configure.ac:8: warning: $1($fns): you should use literals
|
|
|
|
functions.m4: $1 is expanded from...
|
|
|
|
configure.ac:8: the top level
|
|
|
|
])
|
Manually sync ChannelDefs.pm from automake.
ChannelDefs.pm *ought* to be kept in sync between automake and autoconf,
because it defines the set of valid -W options, and autoreconf assumes
that it can pass arbitrary -W options to all of the tools it invokes.
However, it isn’t covered by either project’s ‘make fetch’ and it hasn’t
actually *been* in sync for more than 17 years.
This patch manually brings over all of the changes made on the
automake side. Once the complementary patch is applied by the
automake team, both versions of the file will be the same, and then we
can add it to the list in fetch.pl and not have this problem any more
in the future.
There are some user-visible consequences to bringing this file back
into sync. The only one worth mentioning in NEWS is that the ‘obsolete’
category of warnings is now on by default. This had quite a bit of
fallout throughout the testsuite. There are also some new warning
categories that get mentioned in --help output, but we don’t actually
generate any warnings in those categories, so people using ‘-Wall’
won’t see any change. More diagnostics are automatically tagged with
‘warning:’ or ‘error:’, which also had some fallout in the testsuite.
Finally, ‘-Werror’ no longer causes complaints about unknown warning
categories to be treated as hard errors.
Internally, there are some small API changes: ‘parse_warnings’ is no
longer usable as a ‘getopt’ callback function, and we now have a stub
Autom4te/Config.pm to match the automake code’s expectations. (This
file *should* also be synced from automake by ‘make fetch’, but we
can’t quite do that yet because it’s a generated file and our build
system is not prepared to handle adding *two* directories to @INC when
running a not-yet-installed Perl script. I plan to fix that after 2.70.)
As a side-effect of adding a Config.pm, ‘prog_error’ now says to
report the bug to bug-autoconf, not bug-automake. If this is why we
mostly haven’t been using prog_error for internal errors, we can stop
avoiding it. (I did not change anything to use prog_error in this
patch.)
* lib/Autom4te/ChannelDefs.pm: Merge from automake.
* lib/Autom4te/Config.pm: New file.
* lib/local.mk (dist_perllib_DATA): Add Autom4te/Config.pm.
* bin/autoconf.as: Update list of warning categories to match
Autom4te::ChannelDefs::usage.
* bin/autoheader.in (@warnings): New global.
(parse_args): Don’t use parse_warnings as a getopt callback.
(main): Add warnings options from our command line to $autoconf.
No need to turn on 'obsolete' warnings explicitly.
No need to include "warning: " in warning messages.
* bin/autom4te.in (parse_args): Don’t use parse_warnings as a getopt callback.
(main): No need to include "warning: " in warning messages.
* bin/autoreconf.in (parse_args): parse_warnings now takes only one argument.
* bin/autoupdate.in: Set WARNINGS=none in environment for all child processes.
* tests/local.at
(AT_CHECK_M4): Handle `autom4te: error: /usr/bin/m4 ...` like
`autom4te: /usr/bin/m4 ...`.
(_AT_CHECK_AC_MACRO): Add AUTOCONF-FLAGS argument, passed to both
autoconf and autoheader.
(AT_CHECK_MACRO): Default AUTOCONF-FLAGS argument to empty.
Pass that argument to autoheader as well as autoconf.
(AT_CHECK_AU_MACRO): Expect a “macro ‘NAME’ is obsolete’ diagnostic
on the first run of autoconf. Pass -Wno-obsolete to autoconf on the
second run, and to autoheader on both runs.
* tests/base.at
* tests/c.at
* tests/compile.at
* tests/m4sh.at
* tests/m4sugar.at
* tests/semantics.at
* tests/tools.at
* tests/torture.at:
No need to pass -Wobsolete to autoconf.
Pass -Wno-obsolete to autoheader where needed to avoid handling
the same warning twice.
Update various expectations for diagnostics to match behavior
changes.
* tests/tools.at (autoupdating AU_ALIAS): Add an AC_CONFIG_HEADERS
line to the test configure.ac to eliminate an unrelated diagnostic.
2020-09-12 14:59:56 -04:00
|
|
|
AT_CHECK_AUTOHEADER([-W no-obsolete], [
|
Consistently expand macros in whitespace-separated lists.
Several of the most commonly used Autoconf macros (starting with
AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list
of symbols as their primary argument. It would abstractly be best if
this list were _not_ subject to M4 macro expansion, in case there’s a
collision between a M4 macro name and something to be looked for.
However, we have historically not been careful about this, and there’s
been reports of configure scripts using ‘dnl’ to write comments inside
the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and
AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre
shell syntax errors.
Also, the macro expansion behavior is not consistent among all of the
macros that take whitespace-separated lists, nor is it consistent
between autoconf and autoheader.
Address this by introducing a new m4sugar macro, currently called
‘m4_validate_w’ (I’m open to suggestions for better names). Here’s
its documentation comment:
| m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])),
| but if that is not the same as just m4_normalize([STRING]),
| issue a warning.
The text of the warning is
| configure.ac:N: warning: whitespace-separated-list contains macros;
| configure.ac:N: in a future version of Autoconf they will not be expanded
If the unexpanded form of the string contains the token ‘dnl’ then
there’s an additional line:
| configure.ac:N: note: ‘dnl’ is a macro
All of the public macros that take a whitespace-separated list of
symbols are changed to pass that argument through m4_validate_w before
doing anything else with it, and the test suite is updated to verify
consistent behavior for every last one of them.
This addresses Savannah issues #110210 and #110211, and the harmless
but annoying autoheader behavior described at
https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html .
In order to avoid expanding relatively expensive m4sugar macros
multiple times per top-level macro invocation, several of the affected
Autoconf macros are restructured along the same lines as I did for
AC_REPLACE_FUNCS in the previous patch.
* lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE)
(AC_REPLACE_FUNCS)
* lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES)
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE)
* lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through
m4_validate_w before use.
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers
_AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C.
(AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE.
(AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers
_AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C.
* lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize.
* tests/semantics.at: Add tests for expansion of M4 macros in
whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
|
|
|
HAVE_FN_BLURF
|
|
|
|
HAVE_FN_FOO
|
|
|
|
HAVE_FN_NOCOMMENT
|
|
|
|
HAVE_FN_QUUX
|
|
|
|
], [], [],
|
|
|
|
[configure.ac:8: warning: $1($fns): you should use literals
|
|
|
|
functions.m4: $1 is expanded from...
|
|
|
|
configure.ac:8: the top level
|
|
|
|
])
|
|
|
|
AT_CHECK_CONFIGURE
|
|
|
|
AT_CLEANUP
|
|
|
|
])])
|
|
|
|
|
|
|
|
m4_define([AT_CHECK_EXPANSION_IN_HEADERS],
|
|
|
|
[AT_SETUP([Macro expansion in $1]m4_if([$2],[literal],[],[ (literal)]))
|
|
|
|
|
|
|
|
AT_CONFIGURE_AC([[
|
|
|
|
m4@&t@_define([bar],[quux])
|
|
|
|
$1([dn@&t@l
|
|
|
|
foo.h dn@&t@l
|
|
|
|
nocomment.h
|
|
|
|
bar.h dn@&t@l Ordinary comment
|
|
|
|
blurf.h dn@&t@l Apos'trophed comment
|
|
|
|
])
|
|
|
|
]])
|
Manually sync ChannelDefs.pm from automake.
ChannelDefs.pm *ought* to be kept in sync between automake and autoconf,
because it defines the set of valid -W options, and autoreconf assumes
that it can pass arbitrary -W options to all of the tools it invokes.
However, it isn’t covered by either project’s ‘make fetch’ and it hasn’t
actually *been* in sync for more than 17 years.
This patch manually brings over all of the changes made on the
automake side. Once the complementary patch is applied by the
automake team, both versions of the file will be the same, and then we
can add it to the list in fetch.pl and not have this problem any more
in the future.
There are some user-visible consequences to bringing this file back
into sync. The only one worth mentioning in NEWS is that the ‘obsolete’
category of warnings is now on by default. This had quite a bit of
fallout throughout the testsuite. There are also some new warning
categories that get mentioned in --help output, but we don’t actually
generate any warnings in those categories, so people using ‘-Wall’
won’t see any change. More diagnostics are automatically tagged with
‘warning:’ or ‘error:’, which also had some fallout in the testsuite.
Finally, ‘-Werror’ no longer causes complaints about unknown warning
categories to be treated as hard errors.
Internally, there are some small API changes: ‘parse_warnings’ is no
longer usable as a ‘getopt’ callback function, and we now have a stub
Autom4te/Config.pm to match the automake code’s expectations. (This
file *should* also be synced from automake by ‘make fetch’, but we
can’t quite do that yet because it’s a generated file and our build
system is not prepared to handle adding *two* directories to @INC when
running a not-yet-installed Perl script. I plan to fix that after 2.70.)
As a side-effect of adding a Config.pm, ‘prog_error’ now says to
report the bug to bug-autoconf, not bug-automake. If this is why we
mostly haven’t been using prog_error for internal errors, we can stop
avoiding it. (I did not change anything to use prog_error in this
patch.)
* lib/Autom4te/ChannelDefs.pm: Merge from automake.
* lib/Autom4te/Config.pm: New file.
* lib/local.mk (dist_perllib_DATA): Add Autom4te/Config.pm.
* bin/autoconf.as: Update list of warning categories to match
Autom4te::ChannelDefs::usage.
* bin/autoheader.in (@warnings): New global.
(parse_args): Don’t use parse_warnings as a getopt callback.
(main): Add warnings options from our command line to $autoconf.
No need to turn on 'obsolete' warnings explicitly.
No need to include "warning: " in warning messages.
* bin/autom4te.in (parse_args): Don’t use parse_warnings as a getopt callback.
(main): No need to include "warning: " in warning messages.
* bin/autoreconf.in (parse_args): parse_warnings now takes only one argument.
* bin/autoupdate.in: Set WARNINGS=none in environment for all child processes.
* tests/local.at
(AT_CHECK_M4): Handle `autom4te: error: /usr/bin/m4 ...` like
`autom4te: /usr/bin/m4 ...`.
(_AT_CHECK_AC_MACRO): Add AUTOCONF-FLAGS argument, passed to both
autoconf and autoheader.
(AT_CHECK_MACRO): Default AUTOCONF-FLAGS argument to empty.
Pass that argument to autoheader as well as autoconf.
(AT_CHECK_AU_MACRO): Expect a “macro ‘NAME’ is obsolete’ diagnostic
on the first run of autoconf. Pass -Wno-obsolete to autoconf on the
second run, and to autoheader on both runs.
* tests/base.at
* tests/c.at
* tests/compile.at
* tests/m4sh.at
* tests/m4sugar.at
* tests/semantics.at
* tests/tools.at
* tests/torture.at:
No need to pass -Wobsolete to autoconf.
Pass -Wno-obsolete to autoheader where needed to avoid handling
the same warning twice.
Update various expectations for diagnostics to match behavior
changes.
* tests/tools.at (autoupdating AU_ALIAS): Add an AC_CONFIG_HEADERS
line to the test configure.ac to eliminate an unrelated diagnostic.
2020-09-12 14:59:56 -04:00
|
|
|
AT_CHECK_AUTOCONF([], [0], [],
|
Consistently expand macros in whitespace-separated lists.
Several of the most commonly used Autoconf macros (starting with
AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list
of symbols as their primary argument. It would abstractly be best if
this list were _not_ subject to M4 macro expansion, in case there’s a
collision between a M4 macro name and something to be looked for.
However, we have historically not been careful about this, and there’s
been reports of configure scripts using ‘dnl’ to write comments inside
the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and
AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre
shell syntax errors.
Also, the macro expansion behavior is not consistent among all of the
macros that take whitespace-separated lists, nor is it consistent
between autoconf and autoheader.
Address this by introducing a new m4sugar macro, currently called
‘m4_validate_w’ (I’m open to suggestions for better names). Here’s
its documentation comment:
| m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])),
| but if that is not the same as just m4_normalize([STRING]),
| issue a warning.
The text of the warning is
| configure.ac:N: warning: whitespace-separated-list contains macros;
| configure.ac:N: in a future version of Autoconf they will not be expanded
If the unexpanded form of the string contains the token ‘dnl’ then
there’s an additional line:
| configure.ac:N: note: ‘dnl’ is a macro
All of the public macros that take a whitespace-separated list of
symbols are changed to pass that argument through m4_validate_w before
doing anything else with it, and the test suite is updated to verify
consistent behavior for every last one of them.
This addresses Savannah issues #110210 and #110211, and the harmless
but annoying autoheader behavior described at
https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html .
In order to avoid expanding relatively expensive m4sugar macros
multiple times per top-level macro invocation, several of the affected
Autoconf macros are restructured along the same lines as I did for
AC_REPLACE_FUNCS in the previous patch.
* lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE)
(AC_REPLACE_FUNCS)
* lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES)
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE)
* lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through
m4_validate_w before use.
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers
_AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C.
(AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE.
(AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers
_AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C.
* lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize.
* tests/semantics.at: Add tests for expansion of M4 macros in
whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
|
|
|
[configure.ac:6: warning: whitespace-separated list contains macros;
|
|
|
|
configure.ac:6: in a future version of Autoconf they will not be expanded
|
|
|
|
configure.ac:6: note: `dn@&t@l' is a macro
|
|
|
|
headers.m4: $1 is expanded from...
|
|
|
|
configure.ac:6: the top level
|
|
|
|
])
|
Manually sync ChannelDefs.pm from automake.
ChannelDefs.pm *ought* to be kept in sync between automake and autoconf,
because it defines the set of valid -W options, and autoreconf assumes
that it can pass arbitrary -W options to all of the tools it invokes.
However, it isn’t covered by either project’s ‘make fetch’ and it hasn’t
actually *been* in sync for more than 17 years.
This patch manually brings over all of the changes made on the
automake side. Once the complementary patch is applied by the
automake team, both versions of the file will be the same, and then we
can add it to the list in fetch.pl and not have this problem any more
in the future.
There are some user-visible consequences to bringing this file back
into sync. The only one worth mentioning in NEWS is that the ‘obsolete’
category of warnings is now on by default. This had quite a bit of
fallout throughout the testsuite. There are also some new warning
categories that get mentioned in --help output, but we don’t actually
generate any warnings in those categories, so people using ‘-Wall’
won’t see any change. More diagnostics are automatically tagged with
‘warning:’ or ‘error:’, which also had some fallout in the testsuite.
Finally, ‘-Werror’ no longer causes complaints about unknown warning
categories to be treated as hard errors.
Internally, there are some small API changes: ‘parse_warnings’ is no
longer usable as a ‘getopt’ callback function, and we now have a stub
Autom4te/Config.pm to match the automake code’s expectations. (This
file *should* also be synced from automake by ‘make fetch’, but we
can’t quite do that yet because it’s a generated file and our build
system is not prepared to handle adding *two* directories to @INC when
running a not-yet-installed Perl script. I plan to fix that after 2.70.)
As a side-effect of adding a Config.pm, ‘prog_error’ now says to
report the bug to bug-autoconf, not bug-automake. If this is why we
mostly haven’t been using prog_error for internal errors, we can stop
avoiding it. (I did not change anything to use prog_error in this
patch.)
* lib/Autom4te/ChannelDefs.pm: Merge from automake.
* lib/Autom4te/Config.pm: New file.
* lib/local.mk (dist_perllib_DATA): Add Autom4te/Config.pm.
* bin/autoconf.as: Update list of warning categories to match
Autom4te::ChannelDefs::usage.
* bin/autoheader.in (@warnings): New global.
(parse_args): Don’t use parse_warnings as a getopt callback.
(main): Add warnings options from our command line to $autoconf.
No need to turn on 'obsolete' warnings explicitly.
No need to include "warning: " in warning messages.
* bin/autom4te.in (parse_args): Don’t use parse_warnings as a getopt callback.
(main): No need to include "warning: " in warning messages.
* bin/autoreconf.in (parse_args): parse_warnings now takes only one argument.
* bin/autoupdate.in: Set WARNINGS=none in environment for all child processes.
* tests/local.at
(AT_CHECK_M4): Handle `autom4te: error: /usr/bin/m4 ...` like
`autom4te: /usr/bin/m4 ...`.
(_AT_CHECK_AC_MACRO): Add AUTOCONF-FLAGS argument, passed to both
autoconf and autoheader.
(AT_CHECK_MACRO): Default AUTOCONF-FLAGS argument to empty.
Pass that argument to autoheader as well as autoconf.
(AT_CHECK_AU_MACRO): Expect a “macro ‘NAME’ is obsolete’ diagnostic
on the first run of autoconf. Pass -Wno-obsolete to autoconf on the
second run, and to autoheader on both runs.
* tests/base.at
* tests/c.at
* tests/compile.at
* tests/m4sh.at
* tests/m4sugar.at
* tests/semantics.at
* tests/tools.at
* tests/torture.at:
No need to pass -Wobsolete to autoconf.
Pass -Wno-obsolete to autoheader where needed to avoid handling
the same warning twice.
Update various expectations for diagnostics to match behavior
changes.
* tests/tools.at (autoupdating AU_ALIAS): Add an AC_CONFIG_HEADERS
line to the test configure.ac to eliminate an unrelated diagnostic.
2020-09-12 14:59:56 -04:00
|
|
|
AT_CHECK_AUTOHEADER([-W no-obsolete], [
|
Consistently expand macros in whitespace-separated lists.
Several of the most commonly used Autoconf macros (starting with
AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list
of symbols as their primary argument. It would abstractly be best if
this list were _not_ subject to M4 macro expansion, in case there’s a
collision between a M4 macro name and something to be looked for.
However, we have historically not been careful about this, and there’s
been reports of configure scripts using ‘dnl’ to write comments inside
the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and
AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre
shell syntax errors.
Also, the macro expansion behavior is not consistent among all of the
macros that take whitespace-separated lists, nor is it consistent
between autoconf and autoheader.
Address this by introducing a new m4sugar macro, currently called
‘m4_validate_w’ (I’m open to suggestions for better names). Here’s
its documentation comment:
| m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])),
| but if that is not the same as just m4_normalize([STRING]),
| issue a warning.
The text of the warning is
| configure.ac:N: warning: whitespace-separated-list contains macros;
| configure.ac:N: in a future version of Autoconf they will not be expanded
If the unexpanded form of the string contains the token ‘dnl’ then
there’s an additional line:
| configure.ac:N: note: ‘dnl’ is a macro
All of the public macros that take a whitespace-separated list of
symbols are changed to pass that argument through m4_validate_w before
doing anything else with it, and the test suite is updated to verify
consistent behavior for every last one of them.
This addresses Savannah issues #110210 and #110211, and the harmless
but annoying autoheader behavior described at
https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html .
In order to avoid expanding relatively expensive m4sugar macros
multiple times per top-level macro invocation, several of the affected
Autoconf macros are restructured along the same lines as I did for
AC_REPLACE_FUNCS in the previous patch.
* lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE)
(AC_REPLACE_FUNCS)
* lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES)
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE)
* lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through
m4_validate_w before use.
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers
_AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C.
(AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE.
(AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers
_AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C.
* lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize.
* tests/semantics.at: Add tests for expansion of M4 macros in
whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
|
|
|
HAVE_BLURF_H
|
|
|
|
HAVE_FOO_H
|
|
|
|
HAVE_INTTYPES_H
|
|
|
|
HAVE_NOCOMMENT_H
|
|
|
|
HAVE_QUUX_H
|
|
|
|
HAVE_STDINT_H
|
|
|
|
HAVE_STDLIB_H
|
|
|
|
HAVE_STRINGS_H
|
|
|
|
HAVE_STRING_H
|
|
|
|
HAVE_SYS_STAT_H
|
|
|
|
HAVE_SYS_TYPES_H
|
|
|
|
HAVE_UNISTD_H
|
|
|
|
STDC_HEADERS
|
|
|
|
])
|
|
|
|
AT_CHECK_CONFIGURE
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
m4_if([$2], [literal], [], [
|
|
|
|
AT_SETUP([Macro expansion in $1 (variable)])
|
|
|
|
|
|
|
|
AT_CONFIGURE_AC([[
|
|
|
|
m4@&t@_define([bar],[quux])
|
|
|
|
hs="foo.h" _AH_CHECK_HEADER([foo.h])
|
|
|
|
hs="$hs nocomment.h" _AH_CHECK_HEADER([nocomment.h])
|
|
|
|
$1([dn@&t@l
|
|
|
|
$[]hs
|
|
|
|
bar.h dn@&t@l Ordinary comment
|
|
|
|
blurf.h dn@&t@l Apos'trophed comment
|
|
|
|
])
|
|
|
|
]])
|
Manually sync ChannelDefs.pm from automake.
ChannelDefs.pm *ought* to be kept in sync between automake and autoconf,
because it defines the set of valid -W options, and autoreconf assumes
that it can pass arbitrary -W options to all of the tools it invokes.
However, it isn’t covered by either project’s ‘make fetch’ and it hasn’t
actually *been* in sync for more than 17 years.
This patch manually brings over all of the changes made on the
automake side. Once the complementary patch is applied by the
automake team, both versions of the file will be the same, and then we
can add it to the list in fetch.pl and not have this problem any more
in the future.
There are some user-visible consequences to bringing this file back
into sync. The only one worth mentioning in NEWS is that the ‘obsolete’
category of warnings is now on by default. This had quite a bit of
fallout throughout the testsuite. There are also some new warning
categories that get mentioned in --help output, but we don’t actually
generate any warnings in those categories, so people using ‘-Wall’
won’t see any change. More diagnostics are automatically tagged with
‘warning:’ or ‘error:’, which also had some fallout in the testsuite.
Finally, ‘-Werror’ no longer causes complaints about unknown warning
categories to be treated as hard errors.
Internally, there are some small API changes: ‘parse_warnings’ is no
longer usable as a ‘getopt’ callback function, and we now have a stub
Autom4te/Config.pm to match the automake code’s expectations. (This
file *should* also be synced from automake by ‘make fetch’, but we
can’t quite do that yet because it’s a generated file and our build
system is not prepared to handle adding *two* directories to @INC when
running a not-yet-installed Perl script. I plan to fix that after 2.70.)
As a side-effect of adding a Config.pm, ‘prog_error’ now says to
report the bug to bug-autoconf, not bug-automake. If this is why we
mostly haven’t been using prog_error for internal errors, we can stop
avoiding it. (I did not change anything to use prog_error in this
patch.)
* lib/Autom4te/ChannelDefs.pm: Merge from automake.
* lib/Autom4te/Config.pm: New file.
* lib/local.mk (dist_perllib_DATA): Add Autom4te/Config.pm.
* bin/autoconf.as: Update list of warning categories to match
Autom4te::ChannelDefs::usage.
* bin/autoheader.in (@warnings): New global.
(parse_args): Don’t use parse_warnings as a getopt callback.
(main): Add warnings options from our command line to $autoconf.
No need to turn on 'obsolete' warnings explicitly.
No need to include "warning: " in warning messages.
* bin/autom4te.in (parse_args): Don’t use parse_warnings as a getopt callback.
(main): No need to include "warning: " in warning messages.
* bin/autoreconf.in (parse_args): parse_warnings now takes only one argument.
* bin/autoupdate.in: Set WARNINGS=none in environment for all child processes.
* tests/local.at
(AT_CHECK_M4): Handle `autom4te: error: /usr/bin/m4 ...` like
`autom4te: /usr/bin/m4 ...`.
(_AT_CHECK_AC_MACRO): Add AUTOCONF-FLAGS argument, passed to both
autoconf and autoheader.
(AT_CHECK_MACRO): Default AUTOCONF-FLAGS argument to empty.
Pass that argument to autoheader as well as autoconf.
(AT_CHECK_AU_MACRO): Expect a “macro ‘NAME’ is obsolete’ diagnostic
on the first run of autoconf. Pass -Wno-obsolete to autoconf on the
second run, and to autoheader on both runs.
* tests/base.at
* tests/c.at
* tests/compile.at
* tests/m4sh.at
* tests/m4sugar.at
* tests/semantics.at
* tests/tools.at
* tests/torture.at:
No need to pass -Wobsolete to autoconf.
Pass -Wno-obsolete to autoheader where needed to avoid handling
the same warning twice.
Update various expectations for diagnostics to match behavior
changes.
* tests/tools.at (autoupdating AU_ALIAS): Add an AC_CONFIG_HEADERS
line to the test configure.ac to eliminate an unrelated diagnostic.
2020-09-12 14:59:56 -04:00
|
|
|
AT_CHECK_AUTOCONF([], [0], [],
|
Consistently expand macros in whitespace-separated lists.
Several of the most commonly used Autoconf macros (starting with
AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list
of symbols as their primary argument. It would abstractly be best if
this list were _not_ subject to M4 macro expansion, in case there’s a
collision between a M4 macro name and something to be looked for.
However, we have historically not been careful about this, and there’s
been reports of configure scripts using ‘dnl’ to write comments inside
the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and
AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre
shell syntax errors.
Also, the macro expansion behavior is not consistent among all of the
macros that take whitespace-separated lists, nor is it consistent
between autoconf and autoheader.
Address this by introducing a new m4sugar macro, currently called
‘m4_validate_w’ (I’m open to suggestions for better names). Here’s
its documentation comment:
| m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])),
| but if that is not the same as just m4_normalize([STRING]),
| issue a warning.
The text of the warning is
| configure.ac:N: warning: whitespace-separated-list contains macros;
| configure.ac:N: in a future version of Autoconf they will not be expanded
If the unexpanded form of the string contains the token ‘dnl’ then
there’s an additional line:
| configure.ac:N: note: ‘dnl’ is a macro
All of the public macros that take a whitespace-separated list of
symbols are changed to pass that argument through m4_validate_w before
doing anything else with it, and the test suite is updated to verify
consistent behavior for every last one of them.
This addresses Savannah issues #110210 and #110211, and the harmless
but annoying autoheader behavior described at
https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html .
In order to avoid expanding relatively expensive m4sugar macros
multiple times per top-level macro invocation, several of the affected
Autoconf macros are restructured along the same lines as I did for
AC_REPLACE_FUNCS in the previous patch.
* lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE)
(AC_REPLACE_FUNCS)
* lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES)
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE)
* lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through
m4_validate_w before use.
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers
_AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C.
(AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE.
(AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers
_AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C.
* lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize.
* tests/semantics.at: Add tests for expansion of M4 macros in
whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
|
|
|
[configure.ac:8: warning: whitespace-separated list contains macros;
|
|
|
|
configure.ac:8: in a future version of Autoconf they will not be expanded
|
|
|
|
configure.ac:8: note: `dn@&t@l' is a macro
|
|
|
|
headers.m4: $1 is expanded from...
|
|
|
|
configure.ac:8: the top level
|
|
|
|
configure.ac:8: warning: $1($hs): you should use literals
|
|
|
|
headers.m4: $1 is expanded from...
|
|
|
|
configure.ac:8: the top level
|
|
|
|
])
|
Manually sync ChannelDefs.pm from automake.
ChannelDefs.pm *ought* to be kept in sync between automake and autoconf,
because it defines the set of valid -W options, and autoreconf assumes
that it can pass arbitrary -W options to all of the tools it invokes.
However, it isn’t covered by either project’s ‘make fetch’ and it hasn’t
actually *been* in sync for more than 17 years.
This patch manually brings over all of the changes made on the
automake side. Once the complementary patch is applied by the
automake team, both versions of the file will be the same, and then we
can add it to the list in fetch.pl and not have this problem any more
in the future.
There are some user-visible consequences to bringing this file back
into sync. The only one worth mentioning in NEWS is that the ‘obsolete’
category of warnings is now on by default. This had quite a bit of
fallout throughout the testsuite. There are also some new warning
categories that get mentioned in --help output, but we don’t actually
generate any warnings in those categories, so people using ‘-Wall’
won’t see any change. More diagnostics are automatically tagged with
‘warning:’ or ‘error:’, which also had some fallout in the testsuite.
Finally, ‘-Werror’ no longer causes complaints about unknown warning
categories to be treated as hard errors.
Internally, there are some small API changes: ‘parse_warnings’ is no
longer usable as a ‘getopt’ callback function, and we now have a stub
Autom4te/Config.pm to match the automake code’s expectations. (This
file *should* also be synced from automake by ‘make fetch’, but we
can’t quite do that yet because it’s a generated file and our build
system is not prepared to handle adding *two* directories to @INC when
running a not-yet-installed Perl script. I plan to fix that after 2.70.)
As a side-effect of adding a Config.pm, ‘prog_error’ now says to
report the bug to bug-autoconf, not bug-automake. If this is why we
mostly haven’t been using prog_error for internal errors, we can stop
avoiding it. (I did not change anything to use prog_error in this
patch.)
* lib/Autom4te/ChannelDefs.pm: Merge from automake.
* lib/Autom4te/Config.pm: New file.
* lib/local.mk (dist_perllib_DATA): Add Autom4te/Config.pm.
* bin/autoconf.as: Update list of warning categories to match
Autom4te::ChannelDefs::usage.
* bin/autoheader.in (@warnings): New global.
(parse_args): Don’t use parse_warnings as a getopt callback.
(main): Add warnings options from our command line to $autoconf.
No need to turn on 'obsolete' warnings explicitly.
No need to include "warning: " in warning messages.
* bin/autom4te.in (parse_args): Don’t use parse_warnings as a getopt callback.
(main): No need to include "warning: " in warning messages.
* bin/autoreconf.in (parse_args): parse_warnings now takes only one argument.
* bin/autoupdate.in: Set WARNINGS=none in environment for all child processes.
* tests/local.at
(AT_CHECK_M4): Handle `autom4te: error: /usr/bin/m4 ...` like
`autom4te: /usr/bin/m4 ...`.
(_AT_CHECK_AC_MACRO): Add AUTOCONF-FLAGS argument, passed to both
autoconf and autoheader.
(AT_CHECK_MACRO): Default AUTOCONF-FLAGS argument to empty.
Pass that argument to autoheader as well as autoconf.
(AT_CHECK_AU_MACRO): Expect a “macro ‘NAME’ is obsolete’ diagnostic
on the first run of autoconf. Pass -Wno-obsolete to autoconf on the
second run, and to autoheader on both runs.
* tests/base.at
* tests/c.at
* tests/compile.at
* tests/m4sh.at
* tests/m4sugar.at
* tests/semantics.at
* tests/tools.at
* tests/torture.at:
No need to pass -Wobsolete to autoconf.
Pass -Wno-obsolete to autoheader where needed to avoid handling
the same warning twice.
Update various expectations for diagnostics to match behavior
changes.
* tests/tools.at (autoupdating AU_ALIAS): Add an AC_CONFIG_HEADERS
line to the test configure.ac to eliminate an unrelated diagnostic.
2020-09-12 14:59:56 -04:00
|
|
|
AT_CHECK_AUTOHEADER([-W no-obsolete], [
|
Consistently expand macros in whitespace-separated lists.
Several of the most commonly used Autoconf macros (starting with
AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list
of symbols as their primary argument. It would abstractly be best if
this list were _not_ subject to M4 macro expansion, in case there’s a
collision between a M4 macro name and something to be looked for.
However, we have historically not been careful about this, and there’s
been reports of configure scripts using ‘dnl’ to write comments inside
the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and
AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre
shell syntax errors.
Also, the macro expansion behavior is not consistent among all of the
macros that take whitespace-separated lists, nor is it consistent
between autoconf and autoheader.
Address this by introducing a new m4sugar macro, currently called
‘m4_validate_w’ (I’m open to suggestions for better names). Here’s
its documentation comment:
| m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])),
| but if that is not the same as just m4_normalize([STRING]),
| issue a warning.
The text of the warning is
| configure.ac:N: warning: whitespace-separated-list contains macros;
| configure.ac:N: in a future version of Autoconf they will not be expanded
If the unexpanded form of the string contains the token ‘dnl’ then
there’s an additional line:
| configure.ac:N: note: ‘dnl’ is a macro
All of the public macros that take a whitespace-separated list of
symbols are changed to pass that argument through m4_validate_w before
doing anything else with it, and the test suite is updated to verify
consistent behavior for every last one of them.
This addresses Savannah issues #110210 and #110211, and the harmless
but annoying autoheader behavior described at
https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html .
In order to avoid expanding relatively expensive m4sugar macros
multiple times per top-level macro invocation, several of the affected
Autoconf macros are restructured along the same lines as I did for
AC_REPLACE_FUNCS in the previous patch.
* lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE)
(AC_REPLACE_FUNCS)
* lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES)
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE)
* lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through
m4_validate_w before use.
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers
_AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C.
(AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE.
(AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers
_AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C.
* lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize.
* tests/semantics.at: Add tests for expansion of M4 macros in
whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
|
|
|
HAVE_BLURF_H
|
|
|
|
HAVE_FOO_H
|
|
|
|
HAVE_INTTYPES_H
|
|
|
|
HAVE_NOCOMMENT_H
|
|
|
|
HAVE_QUUX_H
|
|
|
|
HAVE_STDINT_H
|
|
|
|
HAVE_STDLIB_H
|
|
|
|
HAVE_STRINGS_H
|
|
|
|
HAVE_STRING_H
|
|
|
|
HAVE_SYS_STAT_H
|
|
|
|
HAVE_SYS_TYPES_H
|
|
|
|
HAVE_UNISTD_H
|
|
|
|
STDC_HEADERS
|
|
|
|
], [], [],
|
|
|
|
[configure.ac:8: warning: $1($hs): you should use literals
|
|
|
|
headers.m4: $1 is expanded from...
|
|
|
|
configure.ac:8: the top level
|
|
|
|
])
|
|
|
|
AT_CHECK_CONFIGURE
|
|
|
|
AT_CLEANUP
|
|
|
|
])])
|
|
|
|
|
|
|
|
AT_CHECK_EXPANSION_IN_FUNCS([AC_CHECK_FUNCS])
|
|
|
|
AT_CHECK_EXPANSION_IN_FUNCS([AC_CHECK_FUNCS_ONCE], [literal])
|
|
|
|
AT_CHECK_EXPANSION_IN_FUNCS([AC_REPLACE_FUNCS])
|
|
|
|
|
|
|
|
AT_CHECK_EXPANSION_IN_HEADERS([AC_CHECK_HEADERS])
|
|
|
|
AT_CHECK_EXPANSION_IN_HEADERS([AC_CHECK_HEADERS_ONCE], [literal])
|
|
|
|
|
|
|
|
AT_SETUP([Macro expansion in AC_CHECK_FILES])
|
|
|
|
|
|
|
|
AT_CONFIGURE_AC([[
|
|
|
|
m4@&t@_define([f_bar], [f_quux])
|
|
|
|
AC_CHECK_FILES([dn@&t@l
|
|
|
|
/nonex/f_foo
|
|
|
|
/nonex/f_bar dn@&t@l Ordinary comment
|
|
|
|
/nonex/f_blurf dn@&t@l Apos'trophed comment
|
|
|
|
])
|
|
|
|
]])
|
Manually sync ChannelDefs.pm from automake.
ChannelDefs.pm *ought* to be kept in sync between automake and autoconf,
because it defines the set of valid -W options, and autoreconf assumes
that it can pass arbitrary -W options to all of the tools it invokes.
However, it isn’t covered by either project’s ‘make fetch’ and it hasn’t
actually *been* in sync for more than 17 years.
This patch manually brings over all of the changes made on the
automake side. Once the complementary patch is applied by the
automake team, both versions of the file will be the same, and then we
can add it to the list in fetch.pl and not have this problem any more
in the future.
There are some user-visible consequences to bringing this file back
into sync. The only one worth mentioning in NEWS is that the ‘obsolete’
category of warnings is now on by default. This had quite a bit of
fallout throughout the testsuite. There are also some new warning
categories that get mentioned in --help output, but we don’t actually
generate any warnings in those categories, so people using ‘-Wall’
won’t see any change. More diagnostics are automatically tagged with
‘warning:’ or ‘error:’, which also had some fallout in the testsuite.
Finally, ‘-Werror’ no longer causes complaints about unknown warning
categories to be treated as hard errors.
Internally, there are some small API changes: ‘parse_warnings’ is no
longer usable as a ‘getopt’ callback function, and we now have a stub
Autom4te/Config.pm to match the automake code’s expectations. (This
file *should* also be synced from automake by ‘make fetch’, but we
can’t quite do that yet because it’s a generated file and our build
system is not prepared to handle adding *two* directories to @INC when
running a not-yet-installed Perl script. I plan to fix that after 2.70.)
As a side-effect of adding a Config.pm, ‘prog_error’ now says to
report the bug to bug-autoconf, not bug-automake. If this is why we
mostly haven’t been using prog_error for internal errors, we can stop
avoiding it. (I did not change anything to use prog_error in this
patch.)
* lib/Autom4te/ChannelDefs.pm: Merge from automake.
* lib/Autom4te/Config.pm: New file.
* lib/local.mk (dist_perllib_DATA): Add Autom4te/Config.pm.
* bin/autoconf.as: Update list of warning categories to match
Autom4te::ChannelDefs::usage.
* bin/autoheader.in (@warnings): New global.
(parse_args): Don’t use parse_warnings as a getopt callback.
(main): Add warnings options from our command line to $autoconf.
No need to turn on 'obsolete' warnings explicitly.
No need to include "warning: " in warning messages.
* bin/autom4te.in (parse_args): Don’t use parse_warnings as a getopt callback.
(main): No need to include "warning: " in warning messages.
* bin/autoreconf.in (parse_args): parse_warnings now takes only one argument.
* bin/autoupdate.in: Set WARNINGS=none in environment for all child processes.
* tests/local.at
(AT_CHECK_M4): Handle `autom4te: error: /usr/bin/m4 ...` like
`autom4te: /usr/bin/m4 ...`.
(_AT_CHECK_AC_MACRO): Add AUTOCONF-FLAGS argument, passed to both
autoconf and autoheader.
(AT_CHECK_MACRO): Default AUTOCONF-FLAGS argument to empty.
Pass that argument to autoheader as well as autoconf.
(AT_CHECK_AU_MACRO): Expect a “macro ‘NAME’ is obsolete’ diagnostic
on the first run of autoconf. Pass -Wno-obsolete to autoconf on the
second run, and to autoheader on both runs.
* tests/base.at
* tests/c.at
* tests/compile.at
* tests/m4sh.at
* tests/m4sugar.at
* tests/semantics.at
* tests/tools.at
* tests/torture.at:
No need to pass -Wobsolete to autoconf.
Pass -Wno-obsolete to autoheader where needed to avoid handling
the same warning twice.
Update various expectations for diagnostics to match behavior
changes.
* tests/tools.at (autoupdating AU_ALIAS): Add an AC_CONFIG_HEADERS
line to the test configure.ac to eliminate an unrelated diagnostic.
2020-09-12 14:59:56 -04:00
|
|
|
AT_CHECK_AUTOCONF([], [0], [],
|
Consistently expand macros in whitespace-separated lists.
Several of the most commonly used Autoconf macros (starting with
AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list
of symbols as their primary argument. It would abstractly be best if
this list were _not_ subject to M4 macro expansion, in case there’s a
collision between a M4 macro name and something to be looked for.
However, we have historically not been careful about this, and there’s
been reports of configure scripts using ‘dnl’ to write comments inside
the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and
AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre
shell syntax errors.
Also, the macro expansion behavior is not consistent among all of the
macros that take whitespace-separated lists, nor is it consistent
between autoconf and autoheader.
Address this by introducing a new m4sugar macro, currently called
‘m4_validate_w’ (I’m open to suggestions for better names). Here’s
its documentation comment:
| m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])),
| but if that is not the same as just m4_normalize([STRING]),
| issue a warning.
The text of the warning is
| configure.ac:N: warning: whitespace-separated-list contains macros;
| configure.ac:N: in a future version of Autoconf they will not be expanded
If the unexpanded form of the string contains the token ‘dnl’ then
there’s an additional line:
| configure.ac:N: note: ‘dnl’ is a macro
All of the public macros that take a whitespace-separated list of
symbols are changed to pass that argument through m4_validate_w before
doing anything else with it, and the test suite is updated to verify
consistent behavior for every last one of them.
This addresses Savannah issues #110210 and #110211, and the harmless
but annoying autoheader behavior described at
https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html .
In order to avoid expanding relatively expensive m4sugar macros
multiple times per top-level macro invocation, several of the affected
Autoconf macros are restructured along the same lines as I did for
AC_REPLACE_FUNCS in the previous patch.
* lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE)
(AC_REPLACE_FUNCS)
* lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES)
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE)
* lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through
m4_validate_w before use.
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers
_AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C.
(AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE.
(AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers
_AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C.
* lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize.
* tests/semantics.at: Add tests for expansion of M4 macros in
whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
|
|
|
[configure.ac:6: warning: whitespace-separated list contains macros;
|
|
|
|
configure.ac:6: in a future version of Autoconf they will not be expanded
|
|
|
|
configure.ac:6: note: `dn@&t@l' is a macro
|
|
|
|
general.m4: AC_CHECK_FILES is expanded from...
|
|
|
|
configure.ac:6: the top level
|
|
|
|
])
|
Manually sync ChannelDefs.pm from automake.
ChannelDefs.pm *ought* to be kept in sync between automake and autoconf,
because it defines the set of valid -W options, and autoreconf assumes
that it can pass arbitrary -W options to all of the tools it invokes.
However, it isn’t covered by either project’s ‘make fetch’ and it hasn’t
actually *been* in sync for more than 17 years.
This patch manually brings over all of the changes made on the
automake side. Once the complementary patch is applied by the
automake team, both versions of the file will be the same, and then we
can add it to the list in fetch.pl and not have this problem any more
in the future.
There are some user-visible consequences to bringing this file back
into sync. The only one worth mentioning in NEWS is that the ‘obsolete’
category of warnings is now on by default. This had quite a bit of
fallout throughout the testsuite. There are also some new warning
categories that get mentioned in --help output, but we don’t actually
generate any warnings in those categories, so people using ‘-Wall’
won’t see any change. More diagnostics are automatically tagged with
‘warning:’ or ‘error:’, which also had some fallout in the testsuite.
Finally, ‘-Werror’ no longer causes complaints about unknown warning
categories to be treated as hard errors.
Internally, there are some small API changes: ‘parse_warnings’ is no
longer usable as a ‘getopt’ callback function, and we now have a stub
Autom4te/Config.pm to match the automake code’s expectations. (This
file *should* also be synced from automake by ‘make fetch’, but we
can’t quite do that yet because it’s a generated file and our build
system is not prepared to handle adding *two* directories to @INC when
running a not-yet-installed Perl script. I plan to fix that after 2.70.)
As a side-effect of adding a Config.pm, ‘prog_error’ now says to
report the bug to bug-autoconf, not bug-automake. If this is why we
mostly haven’t been using prog_error for internal errors, we can stop
avoiding it. (I did not change anything to use prog_error in this
patch.)
* lib/Autom4te/ChannelDefs.pm: Merge from automake.
* lib/Autom4te/Config.pm: New file.
* lib/local.mk (dist_perllib_DATA): Add Autom4te/Config.pm.
* bin/autoconf.as: Update list of warning categories to match
Autom4te::ChannelDefs::usage.
* bin/autoheader.in (@warnings): New global.
(parse_args): Don’t use parse_warnings as a getopt callback.
(main): Add warnings options from our command line to $autoconf.
No need to turn on 'obsolete' warnings explicitly.
No need to include "warning: " in warning messages.
* bin/autom4te.in (parse_args): Don’t use parse_warnings as a getopt callback.
(main): No need to include "warning: " in warning messages.
* bin/autoreconf.in (parse_args): parse_warnings now takes only one argument.
* bin/autoupdate.in: Set WARNINGS=none in environment for all child processes.
* tests/local.at
(AT_CHECK_M4): Handle `autom4te: error: /usr/bin/m4 ...` like
`autom4te: /usr/bin/m4 ...`.
(_AT_CHECK_AC_MACRO): Add AUTOCONF-FLAGS argument, passed to both
autoconf and autoheader.
(AT_CHECK_MACRO): Default AUTOCONF-FLAGS argument to empty.
Pass that argument to autoheader as well as autoconf.
(AT_CHECK_AU_MACRO): Expect a “macro ‘NAME’ is obsolete’ diagnostic
on the first run of autoconf. Pass -Wno-obsolete to autoconf on the
second run, and to autoheader on both runs.
* tests/base.at
* tests/c.at
* tests/compile.at
* tests/m4sh.at
* tests/m4sugar.at
* tests/semantics.at
* tests/tools.at
* tests/torture.at:
No need to pass -Wobsolete to autoconf.
Pass -Wno-obsolete to autoheader where needed to avoid handling
the same warning twice.
Update various expectations for diagnostics to match behavior
changes.
* tests/tools.at (autoupdating AU_ALIAS): Add an AC_CONFIG_HEADERS
line to the test configure.ac to eliminate an unrelated diagnostic.
2020-09-12 14:59:56 -04:00
|
|
|
AT_CHECK_AUTOHEADER([-W no-obsolete], [
|
Consistently expand macros in whitespace-separated lists.
Several of the most commonly used Autoconf macros (starting with
AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list
of symbols as their primary argument. It would abstractly be best if
this list were _not_ subject to M4 macro expansion, in case there’s a
collision between a M4 macro name and something to be looked for.
However, we have historically not been careful about this, and there’s
been reports of configure scripts using ‘dnl’ to write comments inside
the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and
AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre
shell syntax errors.
Also, the macro expansion behavior is not consistent among all of the
macros that take whitespace-separated lists, nor is it consistent
between autoconf and autoheader.
Address this by introducing a new m4sugar macro, currently called
‘m4_validate_w’ (I’m open to suggestions for better names). Here’s
its documentation comment:
| m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])),
| but if that is not the same as just m4_normalize([STRING]),
| issue a warning.
The text of the warning is
| configure.ac:N: warning: whitespace-separated-list contains macros;
| configure.ac:N: in a future version of Autoconf they will not be expanded
If the unexpanded form of the string contains the token ‘dnl’ then
there’s an additional line:
| configure.ac:N: note: ‘dnl’ is a macro
All of the public macros that take a whitespace-separated list of
symbols are changed to pass that argument through m4_validate_w before
doing anything else with it, and the test suite is updated to verify
consistent behavior for every last one of them.
This addresses Savannah issues #110210 and #110211, and the harmless
but annoying autoheader behavior described at
https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html .
In order to avoid expanding relatively expensive m4sugar macros
multiple times per top-level macro invocation, several of the affected
Autoconf macros are restructured along the same lines as I did for
AC_REPLACE_FUNCS in the previous patch.
* lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE)
(AC_REPLACE_FUNCS)
* lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES)
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE)
* lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through
m4_validate_w before use.
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers
_AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C.
(AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE.
(AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers
_AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C.
* lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize.
* tests/semantics.at: Add tests for expansion of M4 macros in
whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
|
|
|
HAVE__NONEX_F_BLURF
|
|
|
|
HAVE__NONEX_F_FOO
|
|
|
|
HAVE__NONEX_F_QUUX
|
|
|
|
])
|
|
|
|
|
|
|
|
AT_CHECK_CONFIGURE
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
AT_SETUP([Macro expansion in AC_CONFIG_MACRO_DIRS])
|
|
|
|
|
|
|
|
AT_CONFIGURE_AC([[
|
|
|
|
m4@&t@_define([d_bar], [d_quux])
|
|
|
|
AC_CONFIG_MACRO_DIRS([dn@&t@l
|
|
|
|
d_foo
|
|
|
|
d_bar dn@&t@l Ordinary comment
|
|
|
|
d_blurf dn@&t@l Apos'trophed comment
|
|
|
|
])
|
|
|
|
]])
|
Manually sync ChannelDefs.pm from automake.
ChannelDefs.pm *ought* to be kept in sync between automake and autoconf,
because it defines the set of valid -W options, and autoreconf assumes
that it can pass arbitrary -W options to all of the tools it invokes.
However, it isn’t covered by either project’s ‘make fetch’ and it hasn’t
actually *been* in sync for more than 17 years.
This patch manually brings over all of the changes made on the
automake side. Once the complementary patch is applied by the
automake team, both versions of the file will be the same, and then we
can add it to the list in fetch.pl and not have this problem any more
in the future.
There are some user-visible consequences to bringing this file back
into sync. The only one worth mentioning in NEWS is that the ‘obsolete’
category of warnings is now on by default. This had quite a bit of
fallout throughout the testsuite. There are also some new warning
categories that get mentioned in --help output, but we don’t actually
generate any warnings in those categories, so people using ‘-Wall’
won’t see any change. More diagnostics are automatically tagged with
‘warning:’ or ‘error:’, which also had some fallout in the testsuite.
Finally, ‘-Werror’ no longer causes complaints about unknown warning
categories to be treated as hard errors.
Internally, there are some small API changes: ‘parse_warnings’ is no
longer usable as a ‘getopt’ callback function, and we now have a stub
Autom4te/Config.pm to match the automake code’s expectations. (This
file *should* also be synced from automake by ‘make fetch’, but we
can’t quite do that yet because it’s a generated file and our build
system is not prepared to handle adding *two* directories to @INC when
running a not-yet-installed Perl script. I plan to fix that after 2.70.)
As a side-effect of adding a Config.pm, ‘prog_error’ now says to
report the bug to bug-autoconf, not bug-automake. If this is why we
mostly haven’t been using prog_error for internal errors, we can stop
avoiding it. (I did not change anything to use prog_error in this
patch.)
* lib/Autom4te/ChannelDefs.pm: Merge from automake.
* lib/Autom4te/Config.pm: New file.
* lib/local.mk (dist_perllib_DATA): Add Autom4te/Config.pm.
* bin/autoconf.as: Update list of warning categories to match
Autom4te::ChannelDefs::usage.
* bin/autoheader.in (@warnings): New global.
(parse_args): Don’t use parse_warnings as a getopt callback.
(main): Add warnings options from our command line to $autoconf.
No need to turn on 'obsolete' warnings explicitly.
No need to include "warning: " in warning messages.
* bin/autom4te.in (parse_args): Don’t use parse_warnings as a getopt callback.
(main): No need to include "warning: " in warning messages.
* bin/autoreconf.in (parse_args): parse_warnings now takes only one argument.
* bin/autoupdate.in: Set WARNINGS=none in environment for all child processes.
* tests/local.at
(AT_CHECK_M4): Handle `autom4te: error: /usr/bin/m4 ...` like
`autom4te: /usr/bin/m4 ...`.
(_AT_CHECK_AC_MACRO): Add AUTOCONF-FLAGS argument, passed to both
autoconf and autoheader.
(AT_CHECK_MACRO): Default AUTOCONF-FLAGS argument to empty.
Pass that argument to autoheader as well as autoconf.
(AT_CHECK_AU_MACRO): Expect a “macro ‘NAME’ is obsolete’ diagnostic
on the first run of autoconf. Pass -Wno-obsolete to autoconf on the
second run, and to autoheader on both runs.
* tests/base.at
* tests/c.at
* tests/compile.at
* tests/m4sh.at
* tests/m4sugar.at
* tests/semantics.at
* tests/tools.at
* tests/torture.at:
No need to pass -Wobsolete to autoconf.
Pass -Wno-obsolete to autoheader where needed to avoid handling
the same warning twice.
Update various expectations for diagnostics to match behavior
changes.
* tests/tools.at (autoupdating AU_ALIAS): Add an AC_CONFIG_HEADERS
line to the test configure.ac to eliminate an unrelated diagnostic.
2020-09-12 14:59:56 -04:00
|
|
|
AT_CHECK_AUTOCONF([-t AC_CONFIG_MACRO_DIR_TRACE], [0],
|
Consistently expand macros in whitespace-separated lists.
Several of the most commonly used Autoconf macros (starting with
AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list
of symbols as their primary argument. It would abstractly be best if
this list were _not_ subject to M4 macro expansion, in case there’s a
collision between a M4 macro name and something to be looked for.
However, we have historically not been careful about this, and there’s
been reports of configure scripts using ‘dnl’ to write comments inside
the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and
AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre
shell syntax errors.
Also, the macro expansion behavior is not consistent among all of the
macros that take whitespace-separated lists, nor is it consistent
between autoconf and autoheader.
Address this by introducing a new m4sugar macro, currently called
‘m4_validate_w’ (I’m open to suggestions for better names). Here’s
its documentation comment:
| m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])),
| but if that is not the same as just m4_normalize([STRING]),
| issue a warning.
The text of the warning is
| configure.ac:N: warning: whitespace-separated-list contains macros;
| configure.ac:N: in a future version of Autoconf they will not be expanded
If the unexpanded form of the string contains the token ‘dnl’ then
there’s an additional line:
| configure.ac:N: note: ‘dnl’ is a macro
All of the public macros that take a whitespace-separated list of
symbols are changed to pass that argument through m4_validate_w before
doing anything else with it, and the test suite is updated to verify
consistent behavior for every last one of them.
This addresses Savannah issues #110210 and #110211, and the harmless
but annoying autoheader behavior described at
https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html .
In order to avoid expanding relatively expensive m4sugar macros
multiple times per top-level macro invocation, several of the affected
Autoconf macros are restructured along the same lines as I did for
AC_REPLACE_FUNCS in the previous patch.
* lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE)
(AC_REPLACE_FUNCS)
* lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES)
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE)
* lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through
m4_validate_w before use.
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers
_AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C.
(AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE.
(AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers
_AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C.
* lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize.
* tests/semantics.at: Add tests for expansion of M4 macros in
whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
|
|
|
[configure.ac:6:AC_CONFIG_MACRO_DIR_TRACE:d_foo
|
|
|
|
configure.ac:6:AC_CONFIG_MACRO_DIR_TRACE:d_quux
|
|
|
|
configure.ac:6:AC_CONFIG_MACRO_DIR_TRACE:d_blurf
|
|
|
|
],
|
|
|
|
[configure.ac:6: warning: whitespace-separated list contains macros;
|
|
|
|
configure.ac:6: in a future version of Autoconf they will not be expanded
|
|
|
|
configure.ac:6: note: `dn@&t@l' is a macro
|
|
|
|
general.m4: AC_CONFIG_MACRO_DIRS is expanded from...
|
|
|
|
configure.ac:6: the top level
|
|
|
|
])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
AT_SETUP([Macro expansion in AC_CONFIG_SUBDIRS])
|
|
|
|
|
|
|
|
(set -ex
|
|
|
|
for d in d_foo d_bar d_blurf d_quux; do
|
|
|
|
mkdir $d
|
|
|
|
printf '%s\n%s\n' '#! /bin/sh' "echo entered $d/configure" \
|
|
|
|
> $d/configure
|
|
|
|
chmod +x $d/configure
|
|
|
|
done)
|
|
|
|
|
|
|
|
AT_CONFIGURE_AC([[
|
|
|
|
m4@&t@_define([d_bar], [d_quux])
|
|
|
|
AC_CONFIG_SUBDIRS([dn@&t@l
|
|
|
|
d_foo
|
|
|
|
d_bar dn@&t@l Ordinary comment
|
|
|
|
d_blurf dn@&t@l Apos'trophed comment
|
|
|
|
])
|
|
|
|
]])
|
Manually sync ChannelDefs.pm from automake.
ChannelDefs.pm *ought* to be kept in sync between automake and autoconf,
because it defines the set of valid -W options, and autoreconf assumes
that it can pass arbitrary -W options to all of the tools it invokes.
However, it isn’t covered by either project’s ‘make fetch’ and it hasn’t
actually *been* in sync for more than 17 years.
This patch manually brings over all of the changes made on the
automake side. Once the complementary patch is applied by the
automake team, both versions of the file will be the same, and then we
can add it to the list in fetch.pl and not have this problem any more
in the future.
There are some user-visible consequences to bringing this file back
into sync. The only one worth mentioning in NEWS is that the ‘obsolete’
category of warnings is now on by default. This had quite a bit of
fallout throughout the testsuite. There are also some new warning
categories that get mentioned in --help output, but we don’t actually
generate any warnings in those categories, so people using ‘-Wall’
won’t see any change. More diagnostics are automatically tagged with
‘warning:’ or ‘error:’, which also had some fallout in the testsuite.
Finally, ‘-Werror’ no longer causes complaints about unknown warning
categories to be treated as hard errors.
Internally, there are some small API changes: ‘parse_warnings’ is no
longer usable as a ‘getopt’ callback function, and we now have a stub
Autom4te/Config.pm to match the automake code’s expectations. (This
file *should* also be synced from automake by ‘make fetch’, but we
can’t quite do that yet because it’s a generated file and our build
system is not prepared to handle adding *two* directories to @INC when
running a not-yet-installed Perl script. I plan to fix that after 2.70.)
As a side-effect of adding a Config.pm, ‘prog_error’ now says to
report the bug to bug-autoconf, not bug-automake. If this is why we
mostly haven’t been using prog_error for internal errors, we can stop
avoiding it. (I did not change anything to use prog_error in this
patch.)
* lib/Autom4te/ChannelDefs.pm: Merge from automake.
* lib/Autom4te/Config.pm: New file.
* lib/local.mk (dist_perllib_DATA): Add Autom4te/Config.pm.
* bin/autoconf.as: Update list of warning categories to match
Autom4te::ChannelDefs::usage.
* bin/autoheader.in (@warnings): New global.
(parse_args): Don’t use parse_warnings as a getopt callback.
(main): Add warnings options from our command line to $autoconf.
No need to turn on 'obsolete' warnings explicitly.
No need to include "warning: " in warning messages.
* bin/autom4te.in (parse_args): Don’t use parse_warnings as a getopt callback.
(main): No need to include "warning: " in warning messages.
* bin/autoreconf.in (parse_args): parse_warnings now takes only one argument.
* bin/autoupdate.in: Set WARNINGS=none in environment for all child processes.
* tests/local.at
(AT_CHECK_M4): Handle `autom4te: error: /usr/bin/m4 ...` like
`autom4te: /usr/bin/m4 ...`.
(_AT_CHECK_AC_MACRO): Add AUTOCONF-FLAGS argument, passed to both
autoconf and autoheader.
(AT_CHECK_MACRO): Default AUTOCONF-FLAGS argument to empty.
Pass that argument to autoheader as well as autoconf.
(AT_CHECK_AU_MACRO): Expect a “macro ‘NAME’ is obsolete’ diagnostic
on the first run of autoconf. Pass -Wno-obsolete to autoconf on the
second run, and to autoheader on both runs.
* tests/base.at
* tests/c.at
* tests/compile.at
* tests/m4sh.at
* tests/m4sugar.at
* tests/semantics.at
* tests/tools.at
* tests/torture.at:
No need to pass -Wobsolete to autoconf.
Pass -Wno-obsolete to autoheader where needed to avoid handling
the same warning twice.
Update various expectations for diagnostics to match behavior
changes.
* tests/tools.at (autoupdating AU_ALIAS): Add an AC_CONFIG_HEADERS
line to the test configure.ac to eliminate an unrelated diagnostic.
2020-09-12 14:59:56 -04:00
|
|
|
AT_CHECK_AUTOCONF([], [0], [],
|
Consistently expand macros in whitespace-separated lists.
Several of the most commonly used Autoconf macros (starting with
AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list
of symbols as their primary argument. It would abstractly be best if
this list were _not_ subject to M4 macro expansion, in case there’s a
collision between a M4 macro name and something to be looked for.
However, we have historically not been careful about this, and there’s
been reports of configure scripts using ‘dnl’ to write comments inside
the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and
AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre
shell syntax errors.
Also, the macro expansion behavior is not consistent among all of the
macros that take whitespace-separated lists, nor is it consistent
between autoconf and autoheader.
Address this by introducing a new m4sugar macro, currently called
‘m4_validate_w’ (I’m open to suggestions for better names). Here’s
its documentation comment:
| m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])),
| but if that is not the same as just m4_normalize([STRING]),
| issue a warning.
The text of the warning is
| configure.ac:N: warning: whitespace-separated-list contains macros;
| configure.ac:N: in a future version of Autoconf they will not be expanded
If the unexpanded form of the string contains the token ‘dnl’ then
there’s an additional line:
| configure.ac:N: note: ‘dnl’ is a macro
All of the public macros that take a whitespace-separated list of
symbols are changed to pass that argument through m4_validate_w before
doing anything else with it, and the test suite is updated to verify
consistent behavior for every last one of them.
This addresses Savannah issues #110210 and #110211, and the harmless
but annoying autoheader behavior described at
https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html .
In order to avoid expanding relatively expensive m4sugar macros
multiple times per top-level macro invocation, several of the affected
Autoconf macros are restructured along the same lines as I did for
AC_REPLACE_FUNCS in the previous patch.
* lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE)
(AC_REPLACE_FUNCS)
* lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES)
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE)
* lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through
m4_validate_w before use.
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers
_AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C.
(AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE.
(AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers
_AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C.
* lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize.
* tests/semantics.at: Add tests for expansion of M4 macros in
whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
|
|
|
[configure.ac:6: warning: whitespace-separated list contains macros;
|
|
|
|
configure.ac:6: in a future version of Autoconf they will not be expanded
|
|
|
|
configure.ac:6: note: `dn@&t@l' is a macro
|
|
|
|
status.m4: AC_CONFIG_SUBDIRS is expanded from...
|
|
|
|
configure.ac:6: the top level
|
|
|
|
])
|
Manually sync ChannelDefs.pm from automake.
ChannelDefs.pm *ought* to be kept in sync between automake and autoconf,
because it defines the set of valid -W options, and autoreconf assumes
that it can pass arbitrary -W options to all of the tools it invokes.
However, it isn’t covered by either project’s ‘make fetch’ and it hasn’t
actually *been* in sync for more than 17 years.
This patch manually brings over all of the changes made on the
automake side. Once the complementary patch is applied by the
automake team, both versions of the file will be the same, and then we
can add it to the list in fetch.pl and not have this problem any more
in the future.
There are some user-visible consequences to bringing this file back
into sync. The only one worth mentioning in NEWS is that the ‘obsolete’
category of warnings is now on by default. This had quite a bit of
fallout throughout the testsuite. There are also some new warning
categories that get mentioned in --help output, but we don’t actually
generate any warnings in those categories, so people using ‘-Wall’
won’t see any change. More diagnostics are automatically tagged with
‘warning:’ or ‘error:’, which also had some fallout in the testsuite.
Finally, ‘-Werror’ no longer causes complaints about unknown warning
categories to be treated as hard errors.
Internally, there are some small API changes: ‘parse_warnings’ is no
longer usable as a ‘getopt’ callback function, and we now have a stub
Autom4te/Config.pm to match the automake code’s expectations. (This
file *should* also be synced from automake by ‘make fetch’, but we
can’t quite do that yet because it’s a generated file and our build
system is not prepared to handle adding *two* directories to @INC when
running a not-yet-installed Perl script. I plan to fix that after 2.70.)
As a side-effect of adding a Config.pm, ‘prog_error’ now says to
report the bug to bug-autoconf, not bug-automake. If this is why we
mostly haven’t been using prog_error for internal errors, we can stop
avoiding it. (I did not change anything to use prog_error in this
patch.)
* lib/Autom4te/ChannelDefs.pm: Merge from automake.
* lib/Autom4te/Config.pm: New file.
* lib/local.mk (dist_perllib_DATA): Add Autom4te/Config.pm.
* bin/autoconf.as: Update list of warning categories to match
Autom4te::ChannelDefs::usage.
* bin/autoheader.in (@warnings): New global.
(parse_args): Don’t use parse_warnings as a getopt callback.
(main): Add warnings options from our command line to $autoconf.
No need to turn on 'obsolete' warnings explicitly.
No need to include "warning: " in warning messages.
* bin/autom4te.in (parse_args): Don’t use parse_warnings as a getopt callback.
(main): No need to include "warning: " in warning messages.
* bin/autoreconf.in (parse_args): parse_warnings now takes only one argument.
* bin/autoupdate.in: Set WARNINGS=none in environment for all child processes.
* tests/local.at
(AT_CHECK_M4): Handle `autom4te: error: /usr/bin/m4 ...` like
`autom4te: /usr/bin/m4 ...`.
(_AT_CHECK_AC_MACRO): Add AUTOCONF-FLAGS argument, passed to both
autoconf and autoheader.
(AT_CHECK_MACRO): Default AUTOCONF-FLAGS argument to empty.
Pass that argument to autoheader as well as autoconf.
(AT_CHECK_AU_MACRO): Expect a “macro ‘NAME’ is obsolete’ diagnostic
on the first run of autoconf. Pass -Wno-obsolete to autoconf on the
second run, and to autoheader on both runs.
* tests/base.at
* tests/c.at
* tests/compile.at
* tests/m4sh.at
* tests/m4sugar.at
* tests/semantics.at
* tests/tools.at
* tests/torture.at:
No need to pass -Wobsolete to autoconf.
Pass -Wno-obsolete to autoheader where needed to avoid handling
the same warning twice.
Update various expectations for diagnostics to match behavior
changes.
* tests/tools.at (autoupdating AU_ALIAS): Add an AC_CONFIG_HEADERS
line to the test configure.ac to eliminate an unrelated diagnostic.
2020-09-12 14:59:56 -04:00
|
|
|
AT_CHECK_AUTOHEADER([-W no-obsolete])
|
Consistently expand macros in whitespace-separated lists.
Several of the most commonly used Autoconf macros (starting with
AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list
of symbols as their primary argument. It would abstractly be best if
this list were _not_ subject to M4 macro expansion, in case there’s a
collision between a M4 macro name and something to be looked for.
However, we have historically not been careful about this, and there’s
been reports of configure scripts using ‘dnl’ to write comments inside
the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and
AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre
shell syntax errors.
Also, the macro expansion behavior is not consistent among all of the
macros that take whitespace-separated lists, nor is it consistent
between autoconf and autoheader.
Address this by introducing a new m4sugar macro, currently called
‘m4_validate_w’ (I’m open to suggestions for better names). Here’s
its documentation comment:
| m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])),
| but if that is not the same as just m4_normalize([STRING]),
| issue a warning.
The text of the warning is
| configure.ac:N: warning: whitespace-separated-list contains macros;
| configure.ac:N: in a future version of Autoconf they will not be expanded
If the unexpanded form of the string contains the token ‘dnl’ then
there’s an additional line:
| configure.ac:N: note: ‘dnl’ is a macro
All of the public macros that take a whitespace-separated list of
symbols are changed to pass that argument through m4_validate_w before
doing anything else with it, and the test suite is updated to verify
consistent behavior for every last one of them.
This addresses Savannah issues #110210 and #110211, and the harmless
but annoying autoheader behavior described at
https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html .
In order to avoid expanding relatively expensive m4sugar macros
multiple times per top-level macro invocation, several of the affected
Autoconf macros are restructured along the same lines as I did for
AC_REPLACE_FUNCS in the previous patch.
* lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE)
(AC_REPLACE_FUNCS)
* lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES)
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE)
* lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through
m4_validate_w before use.
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers
_AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C.
(AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE.
(AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers
_AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C.
* lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize.
* tests/semantics.at: Add tests for expansion of M4 macros in
whitespace-separated list arguments to all of the above.
2020-06-29 19:13:23 -07:00
|
|
|
AT_CHECK_CONFIGURE([], [0], [stdout])
|
|
|
|
AT_CHECK([grep '^entered' stdout], [0],
|
|
|
|
[[entered d_foo/configure
|
|
|
|
entered d_quux/configure
|
|
|
|
entered d_blurf/configure
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CLEANUP
|