* lib/autoconf/functions.m4 (AC_FUNC_ALLOCA): Simplify and use
AS_IF. Had I done it this way originally I would have avoided the
bug that Jim just fixed.
"autoconf quoting is a pain"
* lib/autoconf/functions.m4 (AC_FUNC_ALLOCA): Its AC_CACHE_CHECK
contains an if/else block, but the closing "fi" lay just after its ")".
Before, this error didn't trigger any failure because the if/else code was
in the "else" block of AC_CACHE_CHECK's AS_IF invocation and AS_IF was also
implemented using an if..fi block. So the ostensibly-"outer" "fi" provided
by AS_IF matched the inner "if/else", and that stray-after-end "fi" served
to close the AS_IF block. However, when AS_IF switched from if..fi to
case..esac, this became a nesting error: no matching "fi".
Initially-harmless error introduced by v2.69-52-gfd29dbd7 in 2012.
Error exposed by v2.72a-30-gc8d6d6eb.
* tests/mktests.pl (scan_m4_files): Do not elide direct test
of AC_FUNC_ALLOCA.
FTR, here's the list of macros whose direct tests were being suppressed:
AC_CANONICAL_BUILD AC_CANONICAL_HOST AC_CANONICAL_TARGET
AC_CHECK_INCLUDES_DEFAULT AC_DISABLE_OPTION_CHECKING
AC_ERLANG_NEED_ERL AC_ERLANG_NEED_ERLC AC_ERLANG_SUBST_ERTS_VER
AC_ERLANG_SUBST_INSTALL_LIB_DIR AC_ERLANG_SUBST_LIB_DIR AC_F77_DUMMY_MAIN
AC_F77_LIBRARY_LDFLAGS AC_FC_DUMMY_MAIN AC_FC_LIBRARY_LDFLAGS
AC_FUNC_ALLOCA AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK AC_GNU_SOURCE
AC_HEADER_DIRENT AC_HEADER_SYS_WAIT AC_PATH_X AC_PROG_CPP AC_PROG_CXX
AC_PROG_CXXCPP AC_PROG_F77 AC_PROG_FC AC_PROG_GO AC_PROG_GREP
AC_PROG_OBJC AC_PROG_OBJCPP AC_PROG_OBJCXX AC_PROG_OBJCXXCPP
AC_STRUCT_TM AC_TYPE_GETGROUPS AC_TYPE_LONG_LONG_INT AC_TYPE_MBSTATE_T
AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_UID_T AC_TYPE_UNSIGNED_LONG_LONG_INT
AC_USE_SYSTEM_EXTENSIONS
Some tests require that filtered pre- and post-test
environments be identical. The filtering removes assignments
to known (set-by-test) envvar names, like GREP, SED, YACC.
* tests/local.at (_AT_CHECK_ENV): Also filter out assignments to
EGREP_TRADITIONAL, added in v2.72a-35-g0c762675.
Also, port AC_EGREP_CPP to AT&T UnixPC.
Latter problem reported by Alain Knaff [sr #110657].
* lib/autoconf/general.m4 (AC_EGREP_CPP): Use new _AC_PROG_GREP.
Work even if the pattern starts with "-".
* lib/autoconf/programs.m4 (_AC_PROG_GREP):
New optional arg ACTION-IF-NOT-FOUND.
(_AC_PROG_EGREP_TRADITIONAL): New macro.
* lib/m4sugar/m4sh.m4: Work around bug in ancient sed.
Problem reported by Alain Knaff [sr#110654] for AT&T 3b1.
The Autoconf manual says this sed bug also occurs for
RISC/OS and IRIX 5.3.
* doc/autoconf.texi (Running the Preprocessor)
(Running the Compiler, Running the Linker, Runtime):
Document that the _IFELSE macros reuse an existing input file
if their input is empty.
Problem reported by Raphael Isemann in:
https://lists.gnu.org/r/autoconf-patches/2022-03/msg00007.html
* lib/autoconf/c.m4 (_AC_C_C99_TEST_MAIN, AC_C_FLEXIBLE_ARRAY_MEMBER):
* tests/data/gnulib_std_gnu11_2020_08_17.m4 (_AC_C_C99_TEST_HEADER):
Free storage allocated via malloc, to pacify overly-picky
implementations that issue false alarms about memory leaks.
Problem reported by Peter Johansson in:
https://lists.gnu.org/r/bug-autoconf/2022-03/msg00009.html
The bug was introduced in 2020-11-15T18:56:18Z!zackw@panix.com
with commit message saying “If anyone has a better idea for how to
make this work I will be glad to hear it”, and this patch uses a
trick with ‘case’ that should be a better idea.
* lib/m4sugar/m4sh.m4 (as_nop, as_fn_nop, _AS_EMPTY_ELSE_PREPARE):
Remove. All uses removed.
(_AS_IF_ELSE): Wrap the non-blank IF-ELSE inside a no-op case,
which works since a case branch can be empty in the shell.
* tests/m4sh.at (AS_IF and AS_CASE): Test the fix.
Problem reported by mirabilos via Eric Blake in:
https://www.austingroupbugs.net/view.php?id=1558https://lists.gnu.org/r/bug-autoconf/2022-02/msg00003.html
* lib/m4sugar/m4sh.m4 (_AS_TR_SH_PREPARE):
Define as_sed_sh as the sed script. All uses of as_tr_sh changed.
Define as_tr_sh as before, but only for compatibility with scripts
that mistakenly use as_tr_sh directly.
(AS_TR_CPP_PREPARE): Likewise for as_sed_cpp and as_tr_cpp.
This mirrors the existing RANLIB and related toolchain macros that
autoconf already exports. Some projects assume `ar` is available
which isn't always safe, so provide a macro that probes the full
toolchain settings.
This also makes it easier to use AC_REQUIRE with the macro instead
of duplicating the AC_CHECK_TOOL call in projects.
* lib/autoconf/programs.m4 (AC_PROG_AR): New macro.
* doc/autoconf.texi: Document it.
* tests/local.at (_AT_CHECK_ENV): Allow $AR output variable.
The bootstrap script generates the same files ‘autoreconf -vi’ would,
in a normal package, but it uses autoconf *from the git sources* to do
it. This means people building from git do not need autoconf to be
installed already. More importantly, it eliminates the extra steps
when building from git, of re-generating autoconf’s own configure
script with the just-built autoconf, then rebuilding the entire tree.
(This process still requires Automake to be installed already, and
Automake’s bootstrap script requires Autoconf to be installed already,
so there is still a dependency loop between Autoconf and Automake when
building from git—you need at least one of them installed from a
tarball to get started.)
The bootstrap script works by creating a partial installation tree in
a temporary directory, containing bin/autoconf, bin/autom4te, and just
enough of the usual contents of $(pkgdatadir) for autoconf and
autom4te to work. It then runs a hardcoded list of commands,
corresponding to what ‘autoreconf -i -Wall,error’ would run, but
setting environment variables AUTOCONF and AUTOM4TE to ensure the
bootstrap versions of these tools are used. (We have to create both,
because automake runs autoconf, not autom4te, to trace configure.ac.)
The ‘Autom4te’, ‘autoconf’, and ‘m4sugar’ subdirectories of the
partial installation tree are symlinked back to the source tree; this
is why version.m4 needed to be moved out of the m4sugar subdirectory,
so the bootstrap script can create it without scribbling on the source
tree. autom4te is run in --melt mode, so we don’t need to create
freeze files in any subdirectories either. All of the substitution
variables that are needed for autoconf and autom4te to both run, and
create the same output that they would have if fully configured, are
honored (unfortunately this does involve digging around in
configure.ac with sed expressions).
Of all the installed programs (autoconf, autoheader, autom4te,
autoreconf, autoscan, autoupdate, ifnames) autoconf is the only one
that is a shell script instead of a Perl script. This means it has to
do a lot of fiddly quoting and requoting to assemble an autom4te
command line, it doesn’t get to use the shared option handling code in
Autom4te/{General,Getopt}.pm, and it has to duplicate usage text that
properly should only be in Autom4te/ChannelDefs.pm. It also means
there’s extra code in build-aux/help-extract.pl just for it, and a
special two-phase generation process in bin/local.mk.
This also paves the way for the bootstrap script mentioned in the
previous commit; it will only have to know how to deal with
substitution variables, not generation of m4sh scripts.
The new script winds up being slightly longer on disk but that’s
because our boilerplate for Perl scripts is quite long. The code is
visibly simpler.
* bin/autoconf.as: Rename to bin/autoconf.in and rewrite in Perl.
* bin/local.mk (EXTRA_DIST): Change autoconf.as to autoconf.in.
(MOSTLYCLEANFILES): Don’t delete autoconf.in.
(bin/autoconf.in): Delete rule.
(ETAGS_PERL): Add autoconf.in and sort list.
(ETAGS_SH): Delete, no longer needed.
* tests/tools.at: Syntax-check autoconf as a Perl script.
* build-aux/help-extract.pl: Remove all code for extracting usage text
from shell scripts.
* man/autoconf.w, man/local.mk: Refer to autoconf.in, not autoconf.as.
This simplifies the Makefile a bit and also paves the way for a
bootstrap script (replacing the process of re-running autoreconf with
the just-built autoconf) which will be able to cope with generated
files that get installed in @pkgdatadir@ but not in @pkgdatadir@/m4sugar.
* lib/version.in: New file, contents extracted from lib/local.mk.
* lib/local.mk: Do not generate version.m4 here.
* configure.ac: Generate lib/version.m4 from lib/version.in via
config.status.
* lib/freeze.mk, lib/local.mk, lib/m4sugar/m4sugar.m4:
version.m4 now lives in @pkgdatadir@ rather than @pkgdatadir@/m4sugar.
* 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.
The typo causes "ac_prog_cxx_stdcxx" to be always set to "cxx11",
regardless of whether the C++ compiler supports C++11.
Message-Id: <YJ4TXAeJcvU0oSec@FSAPPLE2215.fi.f-secure.com>
(tiny change)
* README: Add section to attract more people towards the GNU project.
Inspired by a suggestion from Jose E. Marchesi <jemarch@gnu.org> on
the gnu-prog-discuss mailing list.
Fairly obvious - be gender neutral in who gets thanked.
* HACKING: Tweak pronouns.
Message-Id: <20151125100819.GA29844@air.net.au>
Signed-off-by: Eric Blake <eblake@redhat.com>
Matching the commits on the release branch:
* NEWS: Bring over record of release notes.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
Some projects intentionally don't call AM_GNU_GETTEXT_(REQUIRE_)VERSION
because they have all of the gettext infrastructure checked into version
control and they want autoreconf to _not_ run autopoint. Therefore, make
the “AM_GNU_GETTEXT is used, but not AM_GNU_GETTEXT_(REQUIRE_)VERSION”
and “AM_GNU_GETTEXT_(REQUIRE_)VERSION is used, but not AM_GNU_GETTEXT”
diagnostics be warnings again, as they were in 2.69.
(Technically these diagnostics were always errors, in the sense that
they were reported with a call to Autom4te::Channels::error(), but
prior to 2.70, error() calls made by autoreconf did not cause
autoreconf to exit unsuccessfully, due to an unrelated bug. So people
came to depend on these diagnostics not being fatal.)
Automake generates a Makefile rule for regenerating the configure
script, that relies on an invocation of ‘autoconf’ always bumping the
timestamp on the configure script, even if it hasn’t changed.
The patch to make autom4te update the output file atomically
(1725c94714) broke this.
Fixes several failures in automake’s test suite.
* bin/autom4te.in (handle_output): Always call update_file with force=1.
* tests/tools.at (autoconf: timestamp changes): New test.
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.
While testing something else, I noticed that autom4te may print a
nonsensical error message when it fails to create autom4te.cache,
because it checks again whether the directory already exists before
giving up, and this clobbers errno.
Instead of doing (the perl equivalent of)
test -d $cache || mkdir $cache || test -d $cache
call mkdir unconditionally. If it fails with an errno code other than
EEXIST, consider that a hard failure; if it fails with EEXIST, check
whether the thing that exists is in fact a directory. (A symlink to
a directory qualifies; I wouldn’t be surprised if people are moving
autom4te.cache around with symlinks.)
Either way, if we fail, report strerror(errno) from the original
mkdir failure. Also, print the current working directory as part
of the error message; this aids debugging when you’re working with a
big hairy nested tree.
* bin/autom4te.in: Don’t check whether autom4te.cache exists before
attempting to create it. Only stat autom4te.cache if mkdir fails
with EEXIST, otherwise fail immediately. Make sure to report the
errno code from mkdir, not the subsequent stat (if any). Report
the current working directory as part of the error message.
* tests/tools.at: Verify that autom4te reports the actual reason when
it fails to create autom4te.cache. Verify that failure to create
autom4te.cache because that name exists, but isn’t a directory,
is detected.