* doc/autoconf.texi (Integer Overflow, Integer Overflow Basics)
(Signed Overflow Examples, Optimization and Wraparound):
Modernize discussion to take current compiler and Gnulib
technology into account.
This patch adds the AC_F77_CRAY_POINTERS and AC_FC_CRAY_POINTERS macros,
which test if the Fortran compiler supports Cray pointers.
The macros are written such that the tests share a common backend
(_AC_FC_CRAY_POINTERS) which works on both F77 and FC compilers.
Wrappers are provided to address any future potential compatibility
issues.
The macros include additional tests for particular flags required by
GFortran and PGI compilers. The current set of flags is sparse, but can
be extended for other compilers if needed.
Documentation and a minimal test of the macro have been included.
Two minor variable name typos (@EXEEXT@ as @EEXEXT@) were also fixed in
two of the other Fortran tests.
Autoconf’s diagnostics now follow current GNU coding standards,
which say that diagnostics in the C locale should quote 'like this'
with plain apostrophes instead of the older GNU style `like this'
with grave accent and apostrophe.
Problem reported by Bruno Haible (sr #110518).
* doc/autoconf.texi (Generating Sources)
(Running the Preprocessor, Running the Compiler)
(Running the Linker, Runtime): Briefly mention that the program
snippets are expanded as unquoted here-documents.
(Here-Documents): Document escaping needed in unquoted
here-documents. Remove mention of \" glitch in OpenBSD 2.7 sh;
that old system has not been supported for many years.
Remove advice that every \ must be quoted, as that sort
of quoting (though harmless) is not needed and is rarely done.
* lib/autoconf/c.m4 (AC_C_BIGENDIAN, _AC_LANG_OPENMP(Fortran 77)):
* lib/autoconf/types.m4 (AC_TYPE_LONG_LONG_INT): Properly quote
code snippets. The backslash-newline typos were harmless, and the
backslash-$ typo has unspecified behavior as per POSIX though the
typo is harmless on all shells I know of. However, Autoconf
should follow its own quoting advice.
Gnulib’s std-gnu11.m4 backports C11 and C++11 detection to autoconf
2.69. It does this by replacing the definitions of AC_PROC_CC and
AC_PROG_CXX and most of their subroutines. In particular, it replaces
the definitions of _AC_PROG_CC_C11, _AC_PROG_CC_C99, and _AC_C_STD_TRY,
but it does *not* replace the definition of _AC_PROG_CC_C89.
Autoconf commit 131d8c69f3 changed the
calling convention of _AC_C_STD_TRY, and changed the internal
definitions of _AC_PROG_CC_C{11,99,89} to match. If std-gnu11.m4 is
in use, our _AC_PROG_CC_C89 calls their _AC_C_STD_TRY with the new
calling convention, and this produces a syntactically invalid
configure script. (This is is fortunate: it could easily have been a
runtime malfunction that only manifested with compilers that only
implement C89, and then we might not have noticed the problem for
years.)
Gnulib commit a3b3fc85e3e632374811b27cb2111e50fa177e36 makes
std-gnu11.m4 do nothing when used with autoconf >=2.70, but older
versions of the file will circulate for years to come, so this patch
works around the problem in autoconf. It does this by renaming all of
the internal macros involved with C and C++ standard edition
detection, *except* _AC_PROG_CC_C89. AC_PROG_CC now calls
_AC_PROG_CC_STDC_EDITION, which loops over all supported editions
calling _AC_PROG_CC_STDC_EDITION_TRY, which uses the data provided by
the existing _AC_C_C${edition}_TEST_PROGRAM macros and a new set of
macros called _AC_C_C${edition}_OPTIONS to perform the test for that
edition of the standard. Similarly, AC_PROG_CXX calls
_AC_PROG_CXX_STDCXX_EDITION, which loops calling
_AC_PROG_CXX_STDCXX_EDITION_TRY, which uses data from
_AC_CXX_CXX${edition}_TEST_PROGRAM and _AC_CXX_CXX${edition}_OPTIONS.
_AC_PROG_CC_C89 is the only macro from the old set that we still
define, and its definition is reverted to what std-gnu11.m4 expects it
to be. Nothing in Autoconf proper uses it anymore.
foreign.at grows a test to verify that the compatibility stub version
of _AC_PROG_CC_C89 does its job. Since this is now the third test
involving an embedded copy of a third-party macro, I broke them all
out of foreign.at to separate files in test/data/.
In addition to fixing the breakage, this patch should make it easier
to extend C / C++ standard edition detection in the future, by getting
rid of the if-else chains in AC_PROG_CC/CXX and by disentangling the
lists of command-line options to test from the logic.
I also changed the manual to suggest people refer to the variables
‘ac_prog_cc_stdc’ and ‘ac_prog_cxx_stdcxx’ to learn which edition
of the C and C++ standards are selected; these are much easier to
work with than the ac_cv_prog_cc_cNN cache variables.
* lib/autoconf/c.m4 (_AC_C_STD_TRY, _AC_PROG_CC_C99, _AC_PROG_CC_C11)
(_AC_CXX_STD_TRY, _AC_PROG_CXX_CXX98, _AC_PROG_CXX_CXX11): Remove macro.
(_AC_C_C89_OPTIONS, _AC_C_C99_OPTIONS, _AC_C_C11_OPTIONS)
(_AC_PROG_CC_STDC_EDITION, _AC_PROG_CC_STDC_EDITION_TRY)
(_AC_CXX_CXX98_OPTIONS, _AC_CXX_CXX11_OPTIONS)
(_AC_PROG_CXX_STDCXX_EDITION, _AC_PROG_CXX_STDCXX_EDITION_TRY): New macros.
(_AC_PROG_CC_C89): Convert to compatibility stub for std-gnu11.m4.
(AC_PROG_CC): Use _AC_PROG_CC_STDC_EDITION.
(AC_PROG_CXX): Use _AC_PROG_CXX_STDCXX_EDITION.
* tests/data/ax_prog_cc_for_build_v18.m4
* tests/data/ax_prog_cxx_for_build_v3.m4
* tests/data/gnulib_std_gnu11_2020_08_17.m4: New files.
* tests/foreign.at (AX_PROG_CC_FOR_BUILD, AX_PROG_CXX_FOR_BUILD):
Remove embedded copy of ax_prog_cc_for_build_v18.m4,
ax_prog_cxx_for_build_v3.m4 respectively.
(gnulib-std-gnu11.m4): New test.
* tests/local.mk: Distribute tests/data/*.m4.
* doc/autoconf.texi (AC_PROG_CC, AC_PROG_CXX): Document use of
ac_prog_cc_stdc / ac_prog_cxx_stdcxx, respectively, to tell which
edition of the C / C++ standards are selected, instead of looking
through a series of cache variables with awkward definitions.
clang issues only a warning, not an error, when an undeclared
identifier that names a built-in function is used: for instance
char *(*p)(const char *, int) = strchr;
(with no `#include <string.h>`) is an error with most compilers,
a warning with clang. This broke the 2.69 implementation of
AC_CHECK_DECL. In commit 82ef7805fa,
we tried to work around this quirk by using -Werror, but that put us
at risk of being tripped up by other warnings. Bug 110400 reports,
for instance, that this fragment (which is roughly what you get, after
preprocessing, when AC_CHECK_DECL is applied to a function that *is*
properly declared)
extern void ac_decl (int, char *);
int main (void)
{
(void) ac_decl;
;
return 0;
}
provokes a warning from clang (and thus an error) when -Wextra-semi-stmt
has been added to CFLAGS earlier in the configure script. The extra
semicolon comes from AC_LANG_PROGRAM, and we can’t get rid of it
because we have no way of telling reliably when someone wrote
something like
AC_LANG_PROGRAM([[#include <stdio.h>]],
[[puts("hello world")]])
with no semicolon at the end of the statement; this has been
acceptable for decades. Besides, that’s just one warning, who knows
what compilers will start complaining about tomorrow?
So: change AC_CHECK_DECL to compile its programs with -fno-builtin,
instead, when the default compilation mode fails to detect an
undeclared strchr. The code is restructured so that we can try other
options as well, if we find another compiler with the same quirk but
different command-line syntax.
(All of this logic is very C-family specific, but it appears to me
that AC_CHECK_DECL has never worked with other languages, so we can
continue to live with that for now.)
Fixes bug 110400; partially reverts 82ef7805fa.
* lib/autoconf/general.m4 (_AC_UNDECLARED_WARNING): Rename to
_AC_UNDECLARED_BUILTIN. Instead of looking at diagnostic output,
loop trying to find a command-line option that makes the compiler
error out on undeclared builtins.
(_AC_CHECK_DECL_BODY): Don’t AC_REQUIRE anything here.
Make shell code language-agnostic, except for the actual test program.
Add arguments to the shell function for additional compiler options
to use.
(AC_CHECK_DECL): AC_REQUIRE _AC_UNDECLARED_BUILTIN here.
Supply $ac_{AC_LANG_ABBREV}_undeclared_builtin_options to
ac_fn_check_decl.
* tests/local.at (AT_CONFIG_CMP): Update list of variables to ignore
when comparing C and C++ configure runs.
* tests/semantics.at (AC_CHECK_DECLS): Add memcpy and strchr to
AC_CHECK_DECLS call for functions that may be known to the compiler.
* doc/autoconf.texi (AC_CHECK_DECL, AC_CHECK_DECLS): Remove note
about compiler warnings.
The list of macros documented as being defined by
AC_USE_SYSTEM_EXTENSIONS had gotten out of sync with the actual list.
Update it thoroughly.
Also, I introduced an error into the commentary when I merged Julien
ÉLIE’s patch to define _NETBSD_SOURCE and _OPENBSD_SOURCE in
AC_USE_SYSTEM_EXTENSIONS. _OPENBSD_SOURCE does something on NetBSD
and *doesn’t* do anything on OpenBSD. This is corrected.
Clean up the code in AC_USE_SYSTEM_EXTENSIONS a bit while I’m in
there; we now had a redundant definition of _NETBSD_SOURCE (one
unconditional and one conditional on minix/config.h existing).
Reorganize the macro to make it easier to catch problems like this in
the future.
* lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS): Reorganize;
remove redundant AC_DEFINE of _NETBSD_SOURCE; add some missing
AC_BEFOREs; use _AC_CHECK_HEADER_ONCE for header checks;
revise all commentary.
* doc/autoconf.texi (AC_USE_SYSTEM_EXTENSIONS): Update.
Makes the documentation of AC_PROG_CC consistent with the
documentation of AC_PROG_CXX. Also removes a bunch of redundant text
from c.m4 and adds lists of the headers that *can* be used in the
conformance tests, so future hackers don’t have to look them up.
* doc/autoconf.texi (AC_PROG_CC): Make description consistent with
description of AC_PROG_CXX.
* lib/autoconf/c.m4: Clean up some outdated or repetitive commentary
and add lists of the freestanding headers above the code that needs
to avoid using non-freestanding headers.
Since 1993, Autoconf has been assuming that it is safe to include any
of the headers defined by ISO C90 without checking for them; this is
inaccurate, since only a subset are necessarily available in a
C90 *freestanding* environment.
It is OK to assume the presence of a header in a macro that checks
specifically for something declared by that header (if the header is
not present, we will think the specific declaration is unavailable,
which is probably accurate for modern embedded environments). It is
also OK to continue recommending that user code use these headers
unconditionally—anyone working with a freestanding environment knows
it. But it is not OK for very generic code within Autoconf itself,
such as AC_INCLUDES_DEFAULT, to make this assumption.
Note that the set of headers that are not always available includes
stdio.h, which we have been assuming can be included unconditionally
for even longer.
In AC_INCLUDES_DEFAULT, revert to checking for string.h and stdlib.h
before including them. Also revert to defining STDC_HEADERS only when
string.h and stdlib.h are available (but do not check for float.h and
stdarg.h, as these are part of the freestanding set). Add a new check
for stdio.h. Sort the inclusion list by standard (C90 freestanding;
C90 hosted; C99; POSIX) and alphabetically within each group. Revise
all the documentation and update the testsuite.
This partially reverts commit 86c213d0e3
and is a partial fix for bug #110393.
* lib/autoconf/headers.m4 (AC_CHECK_INCLUDES_DEFAULT): Check for
stdio.h, stdlib.h, and string.h before including them. Define
STDC_HEADERS only when string.h and stdlib.h are both available.
Organize includes list by standard, then alphabetically.
* doc/autoconf.texi, NEWS: Update to match.
* tests/local.at (AT_CHECK_DEFINES): Make regexes more specific.
Also expect a definition of HAVE_STDIO_H.
* tests/c.at, tests/semantics.at, tests/tools.at: Use <float.h>,
not <stdio.h>, as a header that we expect always to exist.
Add HAVE_STDIO_H to various lists of macros that are expected to
appear in config.h.
Revert commit 18c140b50b, restoring
AC_PROG_CC to being defined as an ordinary AC_DEFUN. This broke
third-party macros (e.g. the Autoconf Macro Archive’s
AX_PROG_CC_FOR_BUILD) that intentionally invoked AC_PROG_CC a second
time with its guts redefined via a whole bunch of ‘pushdef’s. I don’t
think we want to support this long-term, but needing access to a
build-native compiler in cross-compilation is common enough that we
should have *some* supported way to do it, and it may as well be
AX_PROG_CC_FOR_BUILD until we come up with something better.
If we go back to AC_DEFUN_ONCE for AC_PROG_CC in the future, we should
do it consistently for all the “find me a compiler” macros -- it
was *only* done for AC_PROG_CC in 18c140b5.
The rationale for AC_DEFUN_ONCE seems to have been to reduce the size
of the generated configure script. The bulk of the size accountable to
AC_PROG_CC is the test programs for figuring out which version of the
C standard is available, so I tweaked _AC_C_STD_TRY (and _AC_CXX_STD_TRY)
to emit that text only once per program, into shell variables which
can then be referenced repeatedly.
Fixes bug #110350.
* NEWS, doc/autoconf.texi: Revert documentation changes associated
with AC_PROG_CC being a one-shot macro.
* lib/autoconf/c.m4 (AC_PROG_CC): Revert to defining with AC_DEFUN.
(_AC_C_STD_TRY, _AC_CXX_STD_TRY): Emit the test program only once,
even if invoked multiple times with the same arguments.
* tests/foreign.at (AX_PROG_CC_FOR_BUILD, AX_PROG_CXX_FOR_BUILD):
New tests.
Currently, there isn’t any documented way for an Autotest testsuite to
add custom code to be run either right before the main driver loop, or
at the point of each AT_SETUP. For instance, there’s no good place to
put environment variable sanitization that should apply to the entire
testsuite (but isn’t universally relevant), or shell function
definitions to be used by custom test macros.
Autoconf’s test suite is poking shell functions directly into the
PREPARE_TESTS diversion, and doing environment variable sanitization
in each individual test. Both of these are obviously undesirable.
This patch adds three new AT_* macros that can be used to do these
things in an officially-supported way: AT_PREPARE_TESTS adds code to
be run right before the main driver loop, AT_PREPARE_EACH_TEST adds
code to be run at the beginning of each test, and AT_TEST_HELPER_FN
defines a shell function that will be available to each test. In
Autoconf’s test suite, I use AT_PREPARE_TESTS to factor out
environment variable sanitization that *ought* to apply across the
board, and AT_TEST_HELPER_FN for the helper function used by
AT_CHECK_ENV.
(This fixes the testsuite bug reported by Jannick at
https://lists.gnu.org/archive/html/autoconf/2020-10/msg00052.html :
CONFIG_SITE in the parent environment will no longer be visible to tests.)
It would be nice to give an example of when AT_PREPARE_EACH_TEST is
useful, in the documentation, but I didn’t find one in the autoconf
test suite.
* lib/autotest/general.m4 (AT_PREPARE_TESTS, AT_PREPARE_EACH_TEST)
(AT_TEST_HELPER_FN): New macros.
(AT_INIT, AT_TESTED): Emit the code to report tested programs only
if it’s needed, and make sure it’s after any code added by
AT_PREPARE_TESTS.
* tests/local.at: Add AT_PREPARE_TESTS block that ensures
$MAKE is set sensibly and $MAKEFLAGS and $CONFIG_SITE are unset.
Use AT_TEST_HELPER_FN for the helper function needed by AT_CHECK_ENV.
(AT_CHECK_MAKE): No need to sanitize $MAKE or $MAKEFLAGS here.
* tests/base.at, tests/compile.at, tests/m4sh.at, tests/torture.at:
No need to unset or neutralize $CONFIG_SITE in individual tests.
* tests/autotest.at: Add tests for new macros.
* doc/autoconf.texi, NEWS: Document new macros.
* doc/autoconf.texi (Preset Output Variables): Clarify that options -m32 or -m64
must go into CC, not CFLAGS and not CPPFLAGS either. This is needed because on
bi-arch platforms, config.guess runs $CC without $CFLAGS nor $CPPFLAGS.
AC_FUNC_SETPGRP determines whether you have the historic BSD setpgrp,
which takes two arguments and returns int, or the historic POSIX
setpgrp, which takes no arguments and returns int. Solaris has yet a
third variant, which takes no arguments and returns a pid_t (the new
process group ID). This difference causes AC_FUNC_SETPGRP’s test
program to fail to compile under AC_LANG([C++]), which in turn causes
the macro to report that setpgrp does take arguments, which is wrong.
It is not worth adding a new result #define for this variant,
since *all* forms of setpgrp are deprecated in favor of setpgid, which
is old enough that it can be used unconditionally. However, it is
worth documenting that this variant exists, and fixing AC_FUNC_SETPGRP
to produce the right value for its existing result #define on Solaris
with C++.
* lib/autoconf/functions.m4 (AC_FUNC_SETPGRP): Redesign test program to
not depend on the return type of setpgrp.
* doc/autoconf.texi (AC_FUNC_SETPGRP): Mention that the macro does not
check for the Solaris variant of setpgrp that returns pid_t. Change
programming advice to recommend use of setpgid.
Several of the files updated by make fetch have made this change, so
we follow suit for consistency:
* README-hacking
* build-aux/fetch.pl
* doc/autoconf.texi: Replace all git.savannah.gnu.org/gitweb URLs with
equivalent /cgit URLs.
Fix some subtle quotation bugs in _AC_INIT_PACKAGE that made it
impossible to put ‘,’ or an unbalanced close parenthesis in some of
the arguments to AC_INIT. Document that arguments to AC_INIT
containing parentheses, square brackets, ‘,’ or ‘#’ may need to be
double-quoted. Provide more detailed examples and exposition re
computing the arguments to AC_INIT when autoconf is run (e.g. with
git-version-gen). Add a whole bunch more tests for unusual arguments
to AC_INIT, and a test that the backward-compatibility behavior of
AC_INIT with only one argument is still correct.
This may still break some of the existing configure scripts described
in the threads at
https://lists.gnu.org/r/autoconf/2020-10/msg00013.html and
https://lists.gnu.org/r/bug-autoconf/2020-10/msg00012.html
but, I hope, only in ways covered by the existing warning in NEWS
about pickier M4 quotation.
* lib/autoconf/general.m4 (_AC_INIT_PACKAGE): Redo argument
normalization and default value selection in a simpler, less
error-prone fashion.
(_AC_INIT_PACKAGE_N): New helper subroutine.
(AC_INIT): Always call _AC_INIT_PACKAGE, but supply no arguments if
we were called with only one argument.
* tests/base.at (AC_INIT (obsolete invocation)): New test.
(AC_INIT with unusual version strings): Expand test.
* doc/autoconf.texi (AC_INIT): Revise.
AS_IF can emit a syntactically invalid shell if-then-else,
if CONDITION
then :
# ...
else
fi
when its IF-FALSE argument consists of macros that don’t produce any
shell code. This was a documented limitation in AS_IF, but it’s a bad
limitation to have, because macros that *used* to expand to shell
commands might start expanding to nothing in future releases. For
instance, this broke the libzmq configure script, which did
AC_PROG_CC
AX_CHECK_COMPILE_FLAG([-std=gnu11],
[CFLAGS+=" -std=gnu11"],
[AC_PROG_CC_C99])
Perfectly valid in 2.69, but in 2.70 AC_PROG_CC_C99 doesn’t produce
any shell code and the script crashes.
We had that limitation for good reason: we can’t just put ‘:’ at the
beginning of the else-clause, like we do for the then-clause, because
that would clobber $? and the IF-FALSE commands might want to inspect
it. (This doesn’t matter for the then-clause, because $? is always
zero at the beginning of a then-clause anyway.) The simplest and
least inefficient shell construct I can find that works in this
context is a shell function that does ‘return $?’. Due to awkward
M4sh initialization ordering constraints (AS_IF gets used before we
can safely use shell functions) an indirection through a shell
variable is necessary. The structure of a m4sh script is now
#! /bin/sh
## M4sh Initialization
as_nop=:
...
## M4sh Shell Functions
as_fn_nop () { return $?; }
as_nop=as_fn_nop
...
and AS_IF emits
if CONDITION
then :
# ...
else $as_nop
# ...
fi
The uses of AS_IF that appear before the beginning of the M4sh Shell
Functions section are all under our control and they don’t need to
look at $?.
If anyone has a better idea for how to make this work I will be glad
to hear it.
Fixes bug #110369.
* lib/m4sugar/m4sh.m4
(_AS_IF_ELSE): When $1 is nonempty, invoke _AS_EMPTY_ELSE_PREPARE.
Emit $as_nop at beginning of else clause.
(_AS_BOURNE_COMPATIBLE): Initialize as_nop to ‘:’.
(_AS_EMPTY_ELSE_PREPARE): New macro which emits a definition of
as_fn_nop and resets as_nop to as_fn_nop.
(AS_PREPARE, _AS_PREPARE): Invoke _AS_EMPTY_ELSE_PREPARE.
(_AS_UNSET_PREPARE): Tweak white space.
* tests/m4sh.at (AS_IF and AS_CASE): Test AS_IF’s IF-FALSE argument
being empty after macro expansion.
* doc/autoconf.texi (AS_IF): Remove warning about use with
‘run-if-false’ argument empty after macro expansion.
Instead of treating CONFIG_SITE as a single path, treat it as a
space-separated list of paths and load them in order.
Also remove the special-casing of entries starting with a dash, this is
redundant as they'll be caught by the wildcard case.
Finally add a test case to verify that multiple files are loaded
correctly.
* lib/autoconf/general.m4 (AC_SITE_LOAD): Treat CONFIG_SITE as a
space-separated list of scripts to be sourced. Simplify handling
of default config.site locations using this capability.
* tests/base.at (AC_CACHE_CHECK): Test loading of multiple site files.
* doc/autoconf.texi (Site Defaults): Update documentation of CONFIG_SITE.
As reported in https://github.com/gentoo/gentoo/pull/163, gettext 0.19.6
supports using AM_GNU_GETTEXT_REQUIRE_VERSION (specifying a *minimum*
required version of gettext) instead of AM_GNU_GETTEXT_VERSION
(which specifies a *fixed* required version of gettext).
Update autoreconf to support both.
* bin/autoreconf.in (autoreconf_current_directory): Check for
AM_GNU_GETTEXT_REQUIRE_VERSION as well as AM_GNU_GETTEXT_VERSION.
Update diagnostics about using AM_GNU_GETTEXT_VERSION but not
AM_GNU_GETTEXT, or vice versa, to match.
* doc/autoconf.texi (autoreconf Invocation): Update to match.
Commit 29ede6b96f caused AC_PROG_LEX to
stop looking for a library that provides yywrap. This broke several
packages in a Debian archive rebuild.
Revert all the way to the 2.69 behavior, which was to set LEXLIB to
-ll or -lfl if that library defines yywrap, but allow AC_PROG_LEX to
succeed if neither -ll nor -lfl exists on the system, even if a lex
program that doesn't define yywrap would need it.
(This behavior was a bug, but people have come to depend on it.
See https://savannah.gnu.org/support/index.php?110269 and the
thread starting from
https://lists.gnu.org/r/autoconf-patches/2020-07/msg00013.html
for gory details.)
To provide a path away from bug-compatibility, AC_PROG_LEX now takes
one argument, documented as a whitespace-separated list of options.
Two options are defined: ‘yywrap’ means to look for yywrap and behave
as if lex is unavailable if it isn’t found; ‘noyywrap’ means to not
look for yywrap at all. These are mutually exclusive.
Fixes bug #110346.
* lib/autoconf/programs.m4 (AC_PROG_LEX): Add an argument which
can be either ‘yywrap’, meaning to look for yywrap in -ll, or
‘noyywrap’, meaning to not look for yywrap at all. In the
absence of either option, issue an obsoletion warning and
revert to behavior bug-compatible with 2.69.
* tests/semantics.at: Add more tests of AC_PROG_LEX.
* tests/mktests.sh: Exclude AC_PROG_LEX from autogenerated tests.
* doc/autoconf.texi: Update documentation of AC_PROG_LEX.
* NEWS: Update notes on AC_PROG_LEX.
Some of the compiler options that AC_OPENMP tests, mean “enable
OpenMP” to one compiler, but “write output to a file named ‘mp’ or
‘penmp’” to other compilers. The author of AC_OPENMP believed that
this could only happen if compilation was *successful*, but didn’t
realize that one of the options means “write *preprocessed* output to
a file named ‘penmp’” to SunPRO C, and that this *would* succeed on
the test program. (AC_LINK_IFELSE fails anyway, because the
compilation didn’t create conftest$exeext.)
The option that actually means “enable OpenMP” to SunPRO C is earlier
in the list than the option that means “write preprocessed output to a
file named ‘penmp’”, so we might never have noticed this, but for a
second bug: if you have a bad combination of Solaris operating system
patches installed, it’s possible for this compiler to
successfully *compile* a program that uses OpenMP, but then fail
to *link* it because the OpenMP runtime library is out of sync with
the core C library. AC_OPENMP doesn’t distinguish this case from
“that option doesn’t mean ‘enable OpenMP’” so it goes on to other
entries in the list and hits the “write preprocessed output” one.
Implement four layers of defensive measures against this mess:
- Use an #error directive instead of a compile-time syntax error
to halt compilation when _OPENMP is not defined.
- For each option that might mean “enable OpenMP”, first do an
AC_COMPILE_IFELSE to find out whether it really means that, and
then an AC_LINK_IFELSE to find out whether it works. If the
compilation succeeds but the link fails, bail out of the loop and
declare OpenMP to be unsupported.
- If a file named ‘mp’ or ‘openmp’ exists in configure’s working
directory when AC_OPENMP begins, error out. This means it is safe
to delete any file named ‘mp’ or ‘openmp’ that exists at the *end*
of AC_OPENMP.
- If a file named ‘mp’ or ‘openmp’ exists in the top level of the
source tree with a configure.ac that uses AC_OPENMP, have autoconf
error out, too.
Fixes bug #110353. Problem reported by Dagobert Michelsen.
* lib/autoconf/c.m4 (_AC_LANG_OPENMP(C)): Change ‘choke me’ to
‘#error "OpenMP not supported"’.
(AC_OPENMP): AC_REQUIRE _AC_OPENMP_SAFE_WD. For each option, do
both a compile test and a link test; if the compile test succeeds
but the link fails, don’t go on to other candidate options.
Delete files named ‘mp’ and ‘penmp’ after the loop.
(_AC_OPENMP_SAFE_WD): New macro, subroutine of AC_OPENMP. If files
named ‘mp’ or ‘penmp’ exist, error out both at autoconf time and at
configure time.
* tests/torture.at (Files clobbered by AC_OPENMP): New test.
* doc/autoconf.texi: Document requirement not to have files
named ‘mp’ or ‘penmp’ next to a configure.ac that uses AC_OPENMP.
Make ‘autoreconf --install’ add config.sub, config.guess, and
install-sh to the source tree when necessary. This is only relevant
for packages that don’t use Automake, because ‘automake --add-missing’
already adds these scripts to the source tree, but apparently there
are plenty of packages out there that don’t use Automake, didn’t need
config.{sub,guess} with autoconf 2.69, and do need them with 2.70.
Such packages will need to have their equivalent of ‘make dist’
manually updated to ship the new files, of course.
This patch also has ‘autoreconf’ issue an error if aux files are
missing and ‘--install’ *wasn’t* used, or if --install *was* used but
could not install all the missing files. This error is more likely to
be caught by maintainers than the configure-time error added in the
previous patch. It is not currently practical to make autoconf itself
issue this error message, because of how the autoconf wrapper script
is different from all the other wrapper scripts. Also, autoreconf
runs automake *after* autoconf, so we’d get spurious errors from
packages that do use automake.
* bin/autoreconf.in ($buildauxdir): New package global, initialized
to $pkgdatadir/build-aux, or to $ENV{autom4te_buildauxdir} if that’s set.
(find_missing_aux_files, can_install_aux_files, try_install_aux_files)
(install_aux_file, make_executable): New subs.
(autoreconf_current_directory): Trace AC_REQUIRE_AUX_FILE.
After running all tools that might install aux files, try to
install aux files ourself if --install was given.
After that, report on any that are still missing.
* lib/autom4te.in (Autoreconf-preselections): Add AC_REQUIRE_AUX_FILE.
Make list order consistent with list order in autoreconf.in.
* tests/wrapper.as: Set autom4te_buildauxdir to point to location of
config.guess, config.sub, and install-sh within the source tree.
* lib/local.mk: Install config.guess, config.sub, and install-sh
into $(pkgdatadir)/build-aux.
* doc/autoconf.texi: Document that autoreconf can now install
config.guess, config.sub, and install-sh itself without help from
automake, but packages not using automake will need to arrange for
tarball distribution of these files by hand.
* tests/torture.at (Missing auxiliary files): Test autoreconf as well.
Another regression identified by the Debian archive rebuild was that
more macros require the presence of config.sub and config.guess now.
‘autoreconf --install’ doesn’t install these itself, it relies on
‘automake --add-missing’ to do that; so, packages that don’t use
Automake will fail at the configure stage after configure is
regenerated. To make matters worse, AC_CONFIG_AUX_DIRS assumes that
everyone who needs config.sub and config.guess also needs install-sh,
so in about half of the affected packages, the failure manifested as a
complaint about install-sh being missing -- technically true but
adding install-sh wouldn’t have resolved the problem by itself.
This patch overhauls the AC_CONFIG_AUX_DIR(S) mechanism so that a
configure script knows the complete set of aux scripts that were
AC_REQUIRE_AUX_FILE’d for it, checks for the existence of all of
them, and not any others. Thus, this configure script
AC_INIT([test], [1.0])
AC_FUNC_MALLOC
AC_CONFIG_HEADERS([config.h])
AC_OUTPUT
will work fine in a directory that contains config.sub and
config.guess but not install-sh. Also, if it’s in a directory
that *doesn’t* contain config.sub and config.guess, it will print an
accurate error message
configure: error: cannot find required auxiliary files: config.guess config.sub
instead of the misleading
configure: error: cannot find install-sh, install.sh, or shtool in "." "./.." "./../.."
A side-effect: it doesn’t make sense for AC_CONFIG_SUBDIRS to demand
the presence of Cygnus configure in the aux dir, on the off-chance
that one of the subdirectories *might* be using it -- I have no idea
where someone would even get a copy of that nowadays -- so I dropped
that feature. I rather suspect nobody has needed it in over a decade.
I also documented the expanded need for config.sub and config.guess in
NEWS as well as the manual.
* NEWS: Document expanded need for config.sub and config.guess.
Document removed support for Cygnus configure in subdirectories.
* doc/autoconf.texi: Clarify exactly when install-sh, config.sub,
and/or config.guess are required. Document canonical online sources
for these scripts. Revise documentation of AC_CONFIG_AUX_DIR and
AC_REQUIRE_AUX_FILE. Minor improvements to documentation of
AC_CONFIG_SRCDIR. Remove mentions of Cygnus configure in
subdirectories.
* lib/autoconf/general.m4
(_AC_INIT_PARSE_ARGS): Remove mention of Cygnus configure;
clarify function of configure.gnu.
(AC_CONFIG_AUX_DIR): Support multiple invocations.
(AC_CONFIG_AUX_DIRS): Now an undocumented compatibility interface
rather than an internal subroutine; just runs AC_CONFIG_AUX_DIR on
each of its arguments.
(AC_CONFIG_AUX_DIR_DEFAULT): Now a backward compatibility stub that
requires _AC_INIT_AUX_DIR without adding anything to _AC_AUX_FILES.
(AC_REQUIRE_AUX_FILE): Now adds the named aux file to _AC_AUX_FILES
and requires _AC_INIT_AUX_DIR, as well as being a trace hook.
(_AC_INIT_AUX_DIR): New home of the loop searching for necessary aux
files (formerly in AC_CONFIG_AUX_DIRS). Looks for all the necessary
aux files, not just for install-sh.
(ac_config_guess, ac_config_sub, ac_configure): Issue deprecation
warnings if these undocumented shell variables are actually used.
(AC_CANONICAL_BUILD, AC_CANONICAL_HOST, AC_CANONICAL_TARGET):
No need to require AC_CONFIG_AUX_DIR_DEFAULT.
Can rely on $ac_aux_dir ending with a slash.
* lib/autoconf/programs.m4 (AC_PROG_INSTALL, AC_PROG_MKDIR_P):
No need to require AC_CONFIG_AUX_DIR_DEFAULT.
* lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS):
No need to require AC_CONFIG_AUX_DIR_DEFAULT.
Remove check for Cygnus configure; clarify function of configure.gnu.
* lib/autotest/general.m4: Remove mention of Cygnus configure.
* tests/torture.at (Missing auxiliary files): New test.
See the thread containing:
https://lists.gnu.org/r/bug-gnulib/2020-10/msg00033.html
* doc/autoconf.texi: Distinguish between Solaris 10 and later.
(Balancing Parentheses): Mention the Posix syntax for ‘case’,
typically a better solution nowadays.
(AS_CASE, AS_IF): Mention AC_REQUIRE, portability, parens.
(Prerequisite Macros): Tighten up example and make it less dated.
Say that AS_CASE and AS_IF are not needed outside macros.
* NEWS: Don’t mention AS_FOR. It’s not documented, and for
good reason since it is so ... quirky.
AC_DIAGNOSE is used in several extremely popular add-on macros,
notably AM_INIT_AUTOMAKE, AM_GNU_GETTEXT, and AC_LIBTOOL_DLOPEN.
Until newer versions of these macros are available, -Wobsolete
warnings for AC_DIAGNOSE will be unhelpful noise.
Therefore, make it so AC_DIAGNOSE(...) will still be replaced with
m4_warn(...) by autoupdate, but autoconf runs will not complain about
AC_DIAGNOSE. The bulk of the patch is augmenting AU_DEFUN so that it
can define a “silent” autoupdate replacement, and documenting the new
feature.
* lib/autoconf/autoupdate.m4 (AU_DEFUN): Add a fourth argument, SILENT,
which must be either empty or the word ‘silent’. If it is ‘silent’,
the macro being defined will *not* issue a -Wobsolete warning when
expanded by autoconf.
Tweak quotation to prevent emacs’ parenthesis matching from getting
confused.
(AU_ALIAS): Add the SILENT argument here as well.
* lib/autoconf/general.m4 (AC_DIAGNOSE): Define as a silent AU_DEFUN.
Add commentary explaining why this was done and when it can be
changed back.
* doc/autoconf.texi (AU_DEFUN, AU_ALIAS): Revise; document new SILENT
argument.
This makes the Texinfo documentation consistent with the previous
changes. --help output regarding warnings is already drawn directly
from ChannelDefs.pm and thus does not need to be updated.
* doc/autoconf.texi: Update all ‘invocation’ sections to describe
-W/--warnings consistently, and to refer to m4_warn for the list
of categories.
(m4_warn): Document the complete current list of categories.
(Reporting Messages): Delete section.
(AC_DIAGNOSE, AC_WARNING, AC_FATAL): Move to Obsolete Macros.
The documentation for AC_TRY_LINK has a cross-reference to "Running
the Compiler". This should be "Running the Linker" instead. Also
make the link in AC_TRY_LINK_FUNC consistent.
All of the AC_PROG_*CPP macros fall back to ‘/lib/cpp’ if invoking the
relevant compiler with ‘-E’ doesn’t work. This is an obsolete
location to find the C preprocessor. Linux distributions tend to ship
a compatibility symlink, as do Solaris and AIX (as of the versions in the
GCC compile farm, anyway), but the BSDs no longer do.
The tests for this fallback are already expecting ‘cpp’ to be a
command findable via $PATH, so make the probe macros do the same
thing. (We still try ‘/lib/cpp’ if ‘cpp’ _isn’t_ in $PATH.)
* lib/autoconf/c.m4
(AC_PROG_CPP, AC_PROG_CXXCPP, AC_PROG_OBJCPP, AC_PROG_OBJCXXCPP):
If $CC / $CXX / $OBJC / $OBJCXX -E (respectively) does not run the
preprocessor, look for ‘cpp’ in $PATH before falling back to ‘/lib/cpp’.
* doc/autoconf.texi
(AC_PROG_CPP, AC_PROG_CXXCPP, AC_PROG_OBJCPP, AC_PROG_OBJCXXCPP):
Update to match.
In addition to the gtkdocize tool, gtk-related software may utilize the
IT_PROG_INTLTOOL macro in order to require the intltoolize tool. So too
here should the tool be run by autoreconf itself, in order to guarantee
its initialization via the unified frontend for all autotools projects.
When the GTK_DOC_CHECK macro is in use, this flags a given configure.ac
as belonging the the common class of gtk-related software that requires
the gtkdocize tool to be run before autoreconf, in order to install the
gtk-doc macro and Makefile fragment. Make this easier to accomplish via
teaching autoreconf how to detect and run this tool automatically; this
gets us one step closer to a world in which `autoreconf -fi` on its own
is enough to bootstrap any autotools project into a configurable state.
Specifically, all five arguments, if present, are passed through
m4_normalize before doing anything else with them. For instance,
AC_INIT([ GNU Hello ], [1.0]) is now equivalent to
AC_INIT([GNU Hello], [1.0]).
As a consequence, newlines in the arguments to AC_INIT are now
converted to spaces and no longer trigger warnings.
Also, diagnose inappropriate contents of the fourth and fifth
arguments as well as the first three. The fifth argument should be
“usable as-is in single- and double-quoted strings and quoted and
unquoted here-docs,” like the first three. (This is the check
performed by _AC_INIT_LITERAL.) The fourth argument (TARNAME) is used
to construct filenames, so apply an even more stringent test, namely
AS_LITERAL_WORD_IF.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code.
* lib/autoconf/general.m4 (_AC_INIT_LITERAL): Not necessary to check
for newlines anymore.
(_AC_INIT_PACKAGE): Pass all five arguments through m4_normalize
before doing anything else with them. New warning: apply
_AC_INIT_LITERAL to fifth argument (URL). New warning: complain
if fourth argument (TARNAME) is not a literal word according to
AS_LITERAL_WORD_IF. Simplify a conditional by using m4_default.
* tests/base.at (AC_INIT with unusual version strings): Adjust to
match above changes, add more subtests.
The test programs used by _AC_PROG_CXX_CXX98 and _AC_PROG_CXX_CXX11
can take several seconds to compile, even on current-generation CPUs.
Each of them may be test-compiled up to six times as the configure
script searches for appropriate command-line switches. This is
reported to cancel out all of the other performance gains made since
2.69.
Replace these programs with simpler ones that do not exercise the C++
standard *library* and can be compiled in less than a second each.
On my computer, which is quite new, the minimal configure script
AC_INIT
AC_PROG_CXX
executes in 4.5 seconds (wall-clock) before this change and 0.5
seconds after.
* lib/autoconf/c.m4 (_AC_CXX_CXX98_TEST_HEADER, _AC_CXX_CXX98_TEST_BODY):
Rewrite to test only C++ 1998 language features, not library features.
(_AC_CXX_CXX11_TEST_HEADER, _AC_CXX_CXX11_TEST_BODY):
Similarly for C++ 2011.
* doc/autoconf.texi (AC_PROG_CXX): Document this change.
Problem reported by Ken Moffat (sr#110287); the problem was
introduced in 2016-12-21T16:15:46Z!daniel.kitta@gmail.com.
* bin/autoheader.in (templates_for_header):
When generating warnings about symbols lacking templates,
downgrade template read failure from a fatal error to a warning.
Also, don’t even try to read from a template file whose name has
shell metavariables (which Autoconf 2.50 withdrew support for);
just warn about that, too. These changes cause the Automake
tests to merely generate warnings that are ignored, instead
of failing.
* doc/autoconf.texi (Configuration Files, Configuration Headers)
(Configuration Commands, Configuration Links):
Also document here that the file names should not contain
shell metacharacters, to make this constraint more obvious.
* doc/autoconf.texi (Particular Functions): Point to Gnulib wherever Gnulib has
more workarounds than mentioned for the particular macro, namely for
AC_FUNC_CHOWN, AC_FUNC_FSEEKO, AC_FUNC_GETGROUPS, AC_FUNC_GETMNTENT,
AC_FUNC_MBRTOWC, AC_FUNC_STRERROR_R, AC_FUNC_STRTOLD.
* doc/autoconf.texi (Particular Functions): Point to Gnulib for all macros that
may call AC_LIBOBJ, namely AC_FUNC_ALLOCA, AC_FUNC_MALLOC, AC_FUNC_OBSTACK,
AC_FUNC_REALLOC, AC_FUNC_STRNLEN.
* NEWS, doc/autoconf.texi, lib/autoconf/fortran.m4:
Document 250, not 254.
* tests/fortran.at (AC_FC_LINE_LENGTH): Test lines with 250
columns not 253, since Oracle Studio 12.6 Fortran 95 8.8
2017/05/30 goes up only to 250.
- Better explanation of the additional tests performed by this macro,
once the tool has been located.
- Update advice re using Flex to generate a bundled lex.yy.c.
- Remove text describing a bug in Automake that has long since been
corrected.