In documentation and comments, prefer the more-common “C89” to the
equivalent “C90”, and use 2-digit years for C standards as that’s
common usage. Remove some confusing old doc for pre-C89 systems,
as Autoconf assumes C89 or later. Mention C17 and C23 briefly.
Improve doc for malloc, realloc.
This fixes all of the remaining failures exposed by running the
testsuite with GCC 12 and
CC='cc -Wimplicit-function-declaration -Wold-style-definition
-Wimplicit-int -Werror'
.
* lib/autoconf/c.m4 (_AC_C_C89_TEST_GLOBALS): Don’t use K&R function
definitions.
* lib/autoconf/specific.m4 (AC_SYS_RESTARTABLE_SYSCALLS): Likewise.
(AC_FUNC_MKTIME): Declare functions taking no arguments as ‘fn (void)’
not ‘fn ()’.
* lib/autoconf/c.m4 (_AC_C_C99_TEST_GLOBALS): Declare free().
* lib/autoconf/programs.m4 (AC_PROG_MKDIR_P):
Fall back on mkdir -p instead of on a relative path to
install-sh, as the latter now seems to be more of a problem
than the former.
Bash v5.2 includes several new optimizations to the number of
subshells used for various constructs; as a side effect, the value of
SHLVL is less stable than it used to be. Add SHLVL to the list of
built-in shell variables with unstable values, to be ignored when
checking for inappropriate differences to the shell environment
before and after a macro invocation / between two configure runs.
Problem and solution reported by Xi Ruoyao in
https://lists.gnu.org/archive/html/autoconf/2022-09/msg00015.html
Problem also reported by Bruce Dubbs in
https://lists.gnu.org/archive/html/bug-autoconf/2022-09/msg00010.html
* tests/local.at (_AT_CHECK_ENV, AT_CONFIG_CMP): Ignore changes in
value of SHLVL.
Copyright-paperwork-exempt: yes
Problem and solution reported by Roger Crew in:
https://lists.gnu.org/r/bug-autoconf/2022-09/msg00005.html
* lib/m4sugar/m4sh.m4 (_m4_divert(BINSH)): Change from 0 to 1,
and add 2 to HEADER-REVISION, HEADER-COMMENT, HEADER-COPYRIGHT,
M4SH-SANITIZE, M4SH-INIT-FN, and M4SH-INIT.
Copyright-paperwork-exempt: yes
Notced unstable key order when debugging unrelated bug.
Data::Dumper's SortKeys() makes ordering stable and decreases
diffs from run to run. No functional change otherwise.
* lib/Autom4te/C4che.pm
* lib/Autom4te/Request.pm: Sort request keys in serialization.
Copyright-paperwork-exempt: yes
* 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.