* lib/autoconf/c.m4 (AC_LANG_CALL, AC_LANG_FUNC_LINK_TRY):
Use '(void)' rather than '()' in function prototypes, as the latter
provokes fatal errors in some compilers nowadays.
* lib/autoconf/functions.m4 (AC_FUNC_STRTOD):
* tests/fortran.at (AC_F77_DUMMY_MAIN usage):
* tests/semantics.at (AC_CHECK_DECLS):
Don’t use () in a function decl.
This change is taken from Gnulib, and is needed for apps like GDB.
* lib/autoconf/specific.m4 (_AC_SYS_YEAR2038_TEST_INCLUDES)
(_AC_SYS_YEAR2038, AC_SYS_YEAR2038): New macros, taken (with
renaming) from Gnulib.
(_AC_SYS_LARGEFILE_MACRO_VALUE): #undef before #define.
(AC_SYS_LARGEFILE): Prefer AS_IF and AS_CASE to doing it by hand.
Widen time_t if possible, too. Define __MINGW_USE_VC2005_COMPAT
early if needed.
* lib/autoconf/c.m4 (AC_C_BIGENDIAN): Improve the
inherently-unportable grep trick well enough to survive gcc
-std=c11 -flto when cross-compiling (sr#110687).
Tests of AC_{CHECK_,}HEADER_STDBOOL were failing on Darwin for two
reasons: an m4 quoting bug in tests/local.at causing Darwin sed to
throw syntax errors, and an excessively precise interpretation of how
C99 and C++11 interact. The latter is worth mentioning in NEWS.
* tests/local.at (_AT_DEFINES_CMP_PRUNE): Insert [] before ‘dnl’ in
two places to keep it separate from the result of the m4_bpatsubsts
operation that immediately precedes it.
* lib/autoconf/headers.m4 (AC_CHECK_HEADER_STDBOOL): Allow ‘bool’,
‘true’, and ‘false’ not to be macros, after including stdbool.h,
whenever __cplusplus is defined.
* NEWS: Document change to AC_{CHECK_,}HEADER_STDBOOL.
The main issue was use of s///r; the /r modifier was added in 5.14.
Since the baseline is now 5.10.0 instead of 5.6.0, a couple places
can be tidied up using slightly newer constructs.
* help-extract.pl: Use File::Spec::Functions instead of File::Spec
for reduced clunkiness.
(eval_qq_no_interpolation): Don’t use s///r. Do use \K and (?=...)
to match the empty string (but only in just the right locations),
so we don’t need to use $& in the replacement.
(main): Don’t use s///r.
We have had AC_PREREQ([2.69]) in our own configure.ac since 2021,
and before that it was AC_PREREQ([2.62]) since 2012, so backcompat
code for 2.61 is not necessary anymore.
Also add logging of the name of each candidate executable and bump the
serial number.
The minimum Perl version was raised to 5.8.0 from 5.6.0 in commit
3a9802d601 (but not documented as
such until e8c2d79ec4, and not
actually *enforced* by our own configure script until, er, now)
in order to use Time::HiRes::stat.
Unfortunately, while the Time::HiRes *module* was added in 5.8.0, it
did not export a ‘stat’ function until 5.8.9. More precisely, this
feature was added to Time::HiRes in version 1.92 of that module; Perl
core 5.8.8 shipped Time::HiRes 1.86, 5.8.9 shipped 1.9715. The only
system I have convenient access to, that has older Perls installed,
offers me a choice of 5.8.8 or 5.10.1, so the new requirement means
I cannot test with 5.8.x anymore.
Per https://perldoc.perl.org/perlhist the release history of these
versions of Perl is, in chronological order,
5.8.0 2002-Jul-18
5.8.8 2006-Jan-31
5.10.0 2007-Dec-18
5.8.9 2008-Dec-14 <-- almost a year later than 5.10.0
5.10.1 2009-Aug-22
5.12.0 2010-Apr-12
Per https://perldoc.perl.org/perl5101delta the differences between
5.10.0 and 5.10.1 are small, and do not make me worry about
accidentally introducing code that works on my test boxes but not for
our users, unlike the gulf between 5.8.x and 5.10.x.
Requiring 5.10 will mean that we have access to Digest::SHA, the //
and //= operators, the regexp \K escape, and ‘state’ variables
(lexical scope, persistent value) all of which I can think
of uses for (but none of them are actually used in this patch).
Putting it all together, I think a requirement bump to version 5.10.0
is justified. We are already chopping off the trailing edge at 2006
due to the requirement for M4 1.4.8 (/de facto/ since 2.70) and late
2007 is still 15 years ago.
This patch also makes configure search $PATH for executables named
‘perl5*’ and ‘perl-5.*’ if bare ‘perl’ is too old. To do this, it
introduces a helper macro AClocal_PATH_PROG_GLOBS_FEATURE_CHECK, which
I would *like* to promote to a new Autoconf feature, but I got stuck
on quoting issues — see comments in m4/perl-time-hires.m4.
* NEWS: Document requirement for Perl 5.10.
* m4/perl-time-hires.m4: New file.
* configure.ac: Use AC_PATH_PERL_WITH_TIME_HIRES_STAT to probe for
perl.
* build-aux/fetch.pl (fetch): For .pm files fetched from Automake,
rewrite “use 5.006” to “use 5.010”.
* build-aux/help-extract.pl
* lib/Autom4te/C4che.pm
* lib/Autom4te/ChannelDefs.pm
* lib/Autom4te/Channels.pm
* lib/Autom4te/Config.pm
* lib/Autom4te/Configure_ac.pm
* lib/Autom4te/FileUtils.pm
* lib/Autom4te/General.pm
* lib/Autom4te/Getopt.pm
* lib/Autom4te/Request.pm
* lib/Autom4te/XFile.pm
* tests/mktests.pl: Change “use 5.006” to “use 5.010”.
The former minimum version was 1.4.6. 1.4.6 and 1.4.7 do not track
the original location of text fed to ‘m4wrap’, which breaks autom4te’s
ability to trace macros invoked from _AC_FINALIZE.
Right now, the only _user_ visible effect of this is that autoconf
running on M4 1.4.6 or 1.4.7 will emit an internal error, instead of
the intended warning message, when it processes a configure.ac that
neglects to invoke AC_INIT or AC_OUTPUT. Perhaps more importantly,
it causes a bunch of scary-sounding failures in our own testsuite,
which deliberately doesn’t use AC_OUTPUT sometimes.
M4 1.4.6 and 1.4.7 also have bugs in location tracking of macro
invocations spread over multiple lines, which, guess what, causes
even more testsuite failures.
1.4.8 came out in 2006. As a practical matter, this change to our
requirements means that people using macOS *to run autoconf* (not just
to run generated configure scripts) cannot use the system-provided m4
anymore. {Free,Net,Open}BSD already don’t ship GNU M4 as their system
m4, so users of those OSes should not be affected.
AT_CHECK_M4 was _documented_ to convert
m4: cannot open `foo': No such file or directory
to
m4: cannot open 'foo': No such file or directory
but the regexp that was supposed to do this didn’t work.
Fix the regexp, and remove a workaround for the bug in one test
(yes, we had code in our own testsuite to work around bugs in our
own testsuite!)
* tests/local.at (AT_CHECK_M4): Fix regex for “cannot open” messages.
* tests/tools.at (autom4te cache): Remove workaround for buggy regex
in AT_CHECK_M4.
* 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.