Zack Weinberg [Thu, 7 Dec 2023 19:06:26 +0000 (14:06 -0500)]
Reduce overhead of tests/wrapper.as
tests/wrapper.as is a wrapper script that enables the test suite to
run Autoconf’s command line tools (autoconf, autoheader, etc.) without
having installed them first. It’s written in m4sh. All of the
programs it wraps are written in Perl. Therefore, we can make the
wrapper more efficient by rewriting it in Perl and having it invoke
the real program with the ‘do’ builtin. This cuts out the cost of
starting up a shell and crunching through m4sh initialization (order
of 400 lines of code). Using ‘do’ means we only have to start up Perl
once.
‘make check TESTSUITEFLAGS="-j24"’ speeds up a small but consistently
measurable amount on my workstation. The wall-clock time difference
would be bigger at lower levels of parallelism.
before:
wall 1m16.716s
user 16m44.847s
sys 12m6.452s
Zack Weinberg [Mon, 4 Dec 2023 16:22:24 +0000 (11:22 -0500)]
autom4te: report subsecond timestamp support in --version
The Automake test suite wants this in order to know if it’s safe to
reduce the length of various delays for the purpose of ensuring files
in autom4te.cache are newer than the corresponding source files. We
can also take advantage of this to speed up a couple of tests in our
own testsuite.
* lib/Autom4te/FileUtils.pm: Provide (but do not export) a flag
$subsecond_mtime, indicating whether the ‘mtime’ function reports
modification time with precision greater than one second.
Reorganize commentary and import logic for clarity. Add
configuration for emacs’ perl-mode to the bottom of the file.
* bin/autom4te.in ($version): If $Autom4te::FileUtils::subsecond_mtime
is true, print “Features: subsecond-mtime” as the second line
of --version output.
* lib/autotest/general.m4: Move definitions of AS_MESSAGE_LOG_FD,
AT_JOB_FIFO_IN_FD, and AT_JOB_FIFO_OUT_FD to top level and change
the latter two to be defined using _AT_DEFINE_INIT. This enables
use of AS_MESSAGE_LOG_FD in AT_TESTS_PREPARE code.
* tests/local.at (AT_MTIME_DELAY): New utility that delays a test for
an appropriate time to ensure all files created before its use are
considered older than all files created afterward. The delay will
be as short as possible.
(AT_TESTS_PREPARE): Calculate and log the delay used by AT_MTIME_DELAY.
Only use a delay shorter than one second if the build filesystem,
our autom4te, and the automake on the PATH all support this.
(AT_CMP): En passant removal of unnecessary blank lines.
* tests/tools.at: Use AT_MTIME_DELAY, instead of sleeping for a
hardcoded interval, everywhere the delay was to control file
timestamps.
Paul Eggert [Fri, 1 Dec 2023 17:36:36 +0000 (09:36 -0800)]
Tweak Annex K doc
* doc/autoconf.texi (C and Posix Variants):
Don’t insist on C11 when talking about Annex K, as
Annex K is also present in later versions of the C standard.
Zack Weinberg [Fri, 1 Dec 2023 13:44:55 +0000 (08:44 -0500)]
testsuite: log version of shell and make as well
A lot of bugs recently have been due to unexpected changes in shell
and/or make behavior, so let’s log their versions in testsuite.log
to make it easier to figure out when that’s the problem.
Some shells don’t recognize --version but we still get an indication
in the logfile of which shell it is, e.g.
Zack Weinberg [Thu, 30 Nov 2023 20:25:45 +0000 (15:25 -0500)]
Release 2.72d [beta]
Revise all NEWS entries since 2.71 for clarity. Add an entry
to the compatibility section about the macros that no longer
have AC_PROG_{EGREP,CPP} as a side effect.
Paul Eggert [Sun, 26 Nov 2023 17:04:05 +0000 (09:04 -0800)]
Remove m4_file_append
* lib/m4sugar/m4sugar.m4 (m4_file_append): Remove.
In 2000, this undocumented macro was left in by mistake
even though all its callers were removed.
Inspired by a bug report by Ally Petitt (sr#110961).
KO Myung-Hun [Wed, 18 Oct 2023 18:00:11 +0000 (14:00 -0400)]
m4/m4.m4: Quote argument to AS_ECHO correctly.
AS_ECHO’s argument is required to be “a single shell word,”
and this more precisely means it must not be altered by shell
word splitting. In particular, if the argument contains shell
variables whose values contain whitespace then it needs to be
wrapped in "shell double quotes".
The absence of these quotes caused one of the embedded M4 scripts
to be mangled by the Autoconf 2.69 implementation of AS_ECHO.
We don’t officially support bootstrapping with an older version
of Autoconf (use the ./bootstrap script instead) but the absence
of quotes is still incorrect.
For consistency add [M4 quotes] to the use of AS_ECHO that was
shell-quoted but not M4-quoted.
* m4/m4.m4 (AC_PROG_GNU_M4): Quote argument to AS_ECHO correctly.
Zack Weinberg [Wed, 18 Oct 2023 17:23:36 +0000 (13:23 -0400)]
autom4te: OS/2 compat: Do not attempt to chmod an open file.
On OS/2, chmod(2) cannot be applied to an open file.
Instead set the desired permissions when the file is initially
created, using the PERMS argument to File::Temp::tempfile if
possible, or by manually emulating that feature if the system
perl does not provide a new enough version of File::Temp.
This has the nice side effect that we no longer need to handle
the umask manually.
* autom4te.in (tempfile_with_mode): New function.
(handle_output): Use tempfile_with_mode instead of directly using
File::Temp plus chmod.
Paul Eggert [Sat, 19 Aug 2023 02:47:06 +0000 (19:47 -0700)]
Improve INSTALL format
* doc/install.texi (Compilers and Options): Fix two @ref
instances that don’t work well when making INSTALL.
Problem noted by Gavin Smith in:
https://lists.gnu.org/r/autoconf/2023-08/msg00004.html
Fix _AC_LANG_IO_PROGRAM(C) to work with glibc 2.38 headers
Following the glibc commit glibc-2.38~268 ("libio: Add __nonnull
for FILE * arguments of fclose and freopen"), the utilization of the gcc
-fanalyzer flag in combination with the -Werror flag leads to an error
within the _AC_LANG_IO_PROGRAM(C) function:
conftest.c:14:23: error: use of possibly-NULL 'f' where non-null expected [CWE-690] [-Werror=analyzer-possible-null-argument]
* lib/autoconf/c.m4 (_AC_LANG_IO_PROGRAM): Exit upon encountering
fopen() error.
Paul Eggert [Sat, 24 Jun 2023 21:39:34 +0000 (14:39 -0700)]
Shorten and improve INSTALL
Rewrite install.texi so that INSTALL is shorter and hopefully
more useful for new installers.
* doc/install.texi: When not building the Autoconf manual, put
copyright notice at the end, and omit external references as they
do not work in INSTALL.
Avoid long URLs as they do not work well in INSTALL or
in info files. Be more consistent (though not entirely
consistent) about “system” vs “architecture”.
(System Types, Building for a different system type)
(Troubleshooting the Build Type): Coalesce into a single section
and rewrite for clarity and brevity. Mention build-aux. Do not
mention --target here as it’s too rare to make the cut.
Bruno Haible [Fri, 23 Jun 2023 15:37:35 +0000 (17:37 +0200)]
INSTALL: Clarify --build, --host, --target, and the system types.
* doc/install.texi (Compilers and Options): Add another reference.
(System Types): Renamed from System Type. Explain how to canonicalize
and how to validate a system type. Don't explain --build, --host,
--target here.
(Building for a different system type): New section.
(Troubleshooting the Build Type): New section.
(Configuring a Compiler): New section.
(configure Invocation): Mention the --host option, not the --build
option, since --build is so rarely needed.
Paul Eggert [Tue, 20 Jun 2023 20:23:19 +0000 (13:23 -0700)]
Modernize INSTALL
Problem reported for gettext bootstrap by Julien Palard in:
https://savannah.gnu.org/bugs/?62196
* doc/install.texi: Give a brief info as to how to bootstrap,
on packages built from Git rather from a distribution tarball.
Remove aging details about c99, macOS, X, HP-UX, OSF/1, Solaris,
Haiku, sun4. Improve documentation for enable/disable and
with/without options.
Paul Eggert [Mon, 19 Jun 2023 21:04:29 +0000 (14:04 -0700)]
Fix AC_SYS_LARGEFILE on GNU/Linux alpha, s390x
Problem reported by Matoro <https://bugs.gnu.org/64123>.
* lib/autoconf/specific.m4 (_AC_SYS_LARGEFILE_TEST_CODE):
New overridable macro FTYPE, to test types other than off_t.
(_AC_SYS_LARGEFILE_TEST_CODE): Test ino_t for
-D_FILE_OFFSETBITS=64 too, if no flags are needed for off_t.
Needed for GNU/Linux on alpha and s390x.
Paul Eggert [Sat, 13 May 2023 16:56:33 +0000 (09:56 -0700)]
Improve AC_SYS_YEAR2038_RECOMMENDED diagnostic
* lib/autoconf/specific.m4 (AC_SYS_YEAR2038_RECOMMENDED):
Do not recommend gcc -m64, as that likely will not work.
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2023-05/msg00060.html
Instead, mention that 32-bit time_t is not recommended
for this package, before telling the builder how
to configure with 32-bit time_t anyway.
Paul Eggert [Thu, 11 May 2023 05:57:27 +0000 (22:57 -0700)]
Fix port of AC_FUNC_MMAP
Problem reported by Matt Turner in:
https://lists.gnu.org/r/bug-autoconf/2023-05/msg00005.html
* lib/autoconf/functions.m4 (AC_FUNC_MMAP): Go back to getting the
page size, since the zero-fill test needs this after all.
However, prefer sysconf (_SC_PAGESIZE) or sysconf (_SC_PAGE_SIZE)
to getpagesize (), and use ‘long’ not ‘int’ to store the page size.
Also, declare getpagesize if it is used as a function.
Paul Eggert [Thu, 11 May 2023 00:20:49 +0000 (17:20 -0700)]
Port AC_FUNC_MMAP to more-modern systems
* lib/autoconf/functions.m4 (AC_FUNC_MMAP): Don’t call
getpagesize, as it’s tricky to configure, modern POSIX doesn’t
require it, and calling it without including <unistd.h> provokes a
compile-time error on modern systems. Instead, rework the test
to not need getpagesize. Add a FIXME comment for unnecessary
tests; I don't want to remove them now as we're too close to
a release. Remove long-obsolete comment about GNU grep.
Paul Eggert [Thu, 27 Apr 2023 01:21:48 +0000 (18:21 -0700)]
Tone down year-2038 changes
New macro AC_SYS_YEAR2038_RECOMMENDED replaces new macro
AC_SYS_YEAR2038_REQUIRED, and gives the builder an out of
specifying --disable-year2038. Remove new macro
AC_SYS_LARGEFILE_REQUIRED, which was added only for symmetry and
does not seem to have a great need.
* NEWS, doc/autoconf.texi: Document this.
* lib/autoconf/specific.m4:
Be more specific about mid-January 2038 than just Jan 2038.
(_AC_SYS_YEAR2038_PROBE): Ignore IF-NOT-DETECTED arg.
If support is not detected, merely set ac_have_year2038=no instead
of erroring out. All callers changed.
(_AC_SYS_YEAR2038_OPT_IN): Remove. All callers removed.
(AC_SYS_YEAR2038): Simplify by requiring AC_SYS_LARGEFILE
and then testing the result.
(AC_SYS_YEAR2038_REQUIRED, AC_SYS_LARGEFILE_REQUIRED): Remove.
(AC_SYS_YEAR2038_RECOMMENDED): New macro.
(_AC_SYS_LARGEFILE_PROBE): If support is not detected, merely set
ac_have_largefile=no instead of erroring out. All callers changed.
Take on the burden of invoking year2038 probe as needed.
(AC_SYS_LARGEFILE): Simplify.
Bruno Haible [Wed, 19 Apr 2023 21:17:24 +0000 (14:17 -0700)]
AC_SYS_YEAR2038_REQUIRED: Fix configure failure with MSVC.
* lib/autoconf/specific.m4 (_AC_SYS_LARGEFILE_PROBE): Distinguish the results
"support not detected" and "supported through gnulib". If the result is
"supported through gnulib", don't fail.
Paul Eggert [Sun, 9 Apr 2023 18:41:57 +0000 (11:41 -0700)]
Improve year2038, largefile option processing
* lib/autoconf/specific.m4 (_AC_SYS_YEAR2038_PROBE)
(_AC_SYS_YEAR2038_ENABLE, _AC_SYS_YEAR2038_OPT_IN)
(AC_SYS_YEAR2038, _AC_SYS_LARGEFILE_PROBE)
(_AC_SYS_LARGEFILE_ENABLE): Do not use enable_largefile to record
whether largefile is required, as ‘./configure
--disable-largefile’ sets enable_largefile=no even if largefile is
required and this disables largefile. Instead, use a separate
shell variable ac_largefile_required and test it as well.
Similarly for enable_year2038.
(_AC_SYS_LARGEFILE_ENABLE): Omit --disable-largefile help string
if year2038 is required, since largefile is a prereq for year2038.
Paul Eggert [Mon, 3 Apr 2023 16:12:40 +0000 (09:12 -0700)]
Support circa early 2022 Gnulib
Problem reported by Frederic Berat in:
https://lists.gnu.org/r/bug-rcs/2023-04/msg00001.html
* lib/autoconf/specific.m4 (_AC_SYS_LARGEFILE_TEST_INCLUDES):
Bring back for compatibility with post-2.71, pre-2.73 Gnulib.
Remove the last few internal uses of AC_EGREP_CPP.
Most of the remaining uses were converted to AC_COMPILE_IFELSE.
The use in AC_FUNC_LOADAVG becomes an AC_PREPROC_IFELSE because
we can’t be sure getloadavg.c can be _compiled_ at this point in
the build. The use in AC_C_VARARRAYS could be either _PREPROC_ or
_COMPILE_; we use _COMPILE_ because, _PREPROC_ is never used, then
we don’t have to do the “checking how to run the C preprocessor” test.
* lib/autoconf/c.m4 (AC_C_VARARRAYS): Use AC_COMPILE_IFELSE instead of
AC_EGREP_CPP.
* lib/autoconf/headers.m4 (_AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H)
(_AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL_H): Likewise.
* lib/autoconf/functions.m4 (AC_FUNC_GETLOADAVG): Use AC_PREPROC_IFELSE
instead of AC_EGREP_CPP.
Another of the last few uses of AC_EGREP_CPP is to check for the ISO C
“stringification” operator. As this is a feature of C89, let’s fold
the test into the extensive C89 tests we already have, and make
AC_C_STRINGIZE just lean on AC_PROG_CC, in the same way
AC_C_PROTOTYPES does.
* lib/autoconf/c.m4 (_AC_C_C89_TEST_GLOBALS): Add test of preprocessor
stringification and token pasting.
(AC_C_STRINGIZE): Just check ac_prog_cc_stdc.
AC_TYPE_GETGROUPS is the last remaining use of AC_EGREP_HEADER in
stock Autoconf macros. It uses it only when cross compiling, as a
fallback from an AC_RUN_IFELSE check, testing for a bug in system
headers from the late 1980s or early 1990s, where gid_t *existed*
but the second argument to getgroups needed to be an array of int,
and this didn’t cause a compile error (i.e. the system headers
declare getgroups with no prototype or an incorrect prototype).
AC_FUNC_GETGROUPS also uses AC_RUN_IFELSE to test for obscure
problems specific to long-obsolete Unixes.
The downsides of AC_RUN_IFELSE and AC_EGREP_HEADER seem more severe
than the chances of someone compiling a current-generation program,
that uses getgroups, on an OS old enough to have one of the really
nasty bugs. Accordingly, this patch changes AC_FUNC_GETGROUPS to use
a host_os-based *blacklist* both in native and cross compilation.
This is limited to the two host_os values for which either our old
code, or Gnulib, documented a serious bug: ultrix* and nextstep*.
Currently it does not try to pin down the exact version ranges subject
to the bugs — that would require research by someone with access to
the full history of these OSes.
An incorrect guess by this blacklist can be overridden by setting
ac_cv_func_getgroups_works in config.site. AC_TYPE_GETGROUPS, for its
part, now does a series of regular old AC_COMPILE_IFELSE checks to
probe the prototype of getgroups, and considers that good enough.
While I was in there I noticed that AC_FUNC_GETGROUPS does not
AC_SUBST a documented output variable, and that the name of this
variable is misspelled in the manual.
* lib/autoconf/functions.m4 (AC_FUNC_GETGROUPS): Use AC_SEARCH_LIBS
to probe for getgroups. Use an AC_CANONICAL_HOST-based blacklist
for bug detection, not AC_RUN_IFELSE. AC_SUBST the GETGROUPS_LIB
output variable.
* lib/autoconf/types.m4 (AC_TYPE_GETGROUPS): Check only the prototype
of getgroups, using AC_COMPILE_IFELSE; do not use either AC_RUN_IFELSE
or AC_EGREP_HEADER.
* doc/autoconf.texi: Update to match. Correct misspelling of
GETGROUPS_LIB.
* tests.local.at (_AT_CHECK_ENV): Allow GETGROUPS_LIB output variable.
Make AC_PROG_GCC_TRADITIONAL a compatibility alias for AC_PROG_CC.
This macro is one of the last remaining internal uses of AC_EGREP_CPP.
It has only ever done anything useful with GCC, and GCC dropped
support for ‘traditional’ compilation in version 3.3 (released 2003)
so I do not think it is worth trying to preserve.
* lib/autoconf/c.m4 (AC_PROG_GCC_TRADITIONAL): Make into a
compatibility alias for AC_PROG_CC, similar to AC_PROG_CC_STDC.
* lib/autoconf/general.m4 (AC_EGREP_CPP): Remove stale comment.
* doc/autoconf.texi, NEWS: Document this change.
* tests/mktests.pl: Exclude AC_PROG_GCC_TRADITIONAL from
autoupdate tests.
AC_TYPE_UID_T uses AC_EGREP_HEADER to search sys/types.h for
occurrences of the string ‘uid_t’ and, if found, assumes both
uid_t and gid_t are available. This would be better done using
a pair of AC_CHECK_TYPE operations.
I also converted two uses of old-style AC_CHECK_TYPE, immediately
below, to new-style. (There are probably other old-style uses in
this file, I only did the ones I happened to see.)
* lib/autoconf/types.m4 (AC_TYPE_UID_T): Check for uid_t and gid_t,
separately, using AC_CHECK_TYPE, instead of grepping sys/types.h.
(AC_TYPE_SIZE_T, AC_TYPE_SSIZE_T): Use new-style AC_CHECK_TYPE.
AC_XENIX_DIR is an obsolete macro, defined as AC_HEADER_DIRENT plus
code to make absolutely sure configure scripts that depended on a
shell variable internal to the original (2.13 era) definition of
AC_XENIX_DIR are not broken by autoupdate. (That variable had the
temptingly public-sounding name “XENIX.”) This compatibility code
uses AC_EGREP_CPP, which is itself discouraged for use in new
configure scripts.
(N.B. codesearch.debian.net does not find any uses whatsoever of
this macro, nor any code in an .ac or .m4 file that depends on the
XENIX variable.)
Change the compatibility code to use AC_CANONICAL_HOST instead,
and clarify which pieces of the code inserted by autoupdate are
probably still necessary.
* lib/autoconf/specific.m4 (AC_XENIX_DIR): Set XENIX variable
based on value of host_os. Clarify what manual cleanup is
recommended after autoupdate replaces this obsolete macro.
Paul Eggert [Sun, 2 Apr 2023 03:25:13 +0000 (20:25 -0700)]
Support underquoted callers better
Problem reported bh Khem Raj for mcpp 2.7.2 (2008) in:
https://lists.gnu.org/r/autoconf/2023-04/msg00001.html
* lib/autoconf/programs.m4 (_AC_PATH_PROG_FLAVOR_GNU):
Add two ‘@%:@(’s to cater to underquoted callers.
* lib/m4sugar/m4sh.m4 (_AS_PATH_WALK): Use quadrigraph instead of
‘#’, for underquoted callers.
Paul Eggert [Sat, 1 Apr 2023 23:44:03 +0000 (16:44 -0700)]
Fix timing bug on high-speed builds
Problem reported by Bogdan via Jacob Bachmeyer in:
https://lists.gnu.org/r/autoconf/2023-04/msg00002.html
* bin/autom4te.in: If a file timestamp equals a dependency’s
timestamp, consider the file to be out of date. Although this may
result in extra work, it fixes some rare timing bugs.
Paul Eggert [Fri, 31 Mar 2023 17:55:29 +0000 (10:55 -0700)]
Go back to requiring only Perl 5.6+ for users
Commit 61901a1a14fd50c03cfb1529d091554376fef286 dated 2022-07-10
bumped the Perl requirement to 5.10 or later, because
commit 3a9802d60156809c139e9b4620bf04917e143ee2 dated 2021-08-31
added code using Time::HiRes’s ‘stat’ function, a feature
added in Perl 5.8.9+ or Perl 5.10+, and it was hard
to find Perl 5.8.9 hosts to test with. Also, requiring Perl 5.10
meant that we could then use operators like Digest::SHA, the // and
//= operators, the regexp \K escape, and ‘state’ variables.
However, that Time::HiRes code, which was taken from Automake, has
recently been made optional by Automake, and it now works again with
Perl 5.6. And Autoconf is not yet using any other post-5.6 feature,
except when developers run help-extract.pl (something Autoconf users
do not use). So relax the Autoconf user requirement back to 5.6 as it
was in Autoconf 2.71; although Autoconf developers will need 5.10 or
better, Autoconf users can get by with 5.6.
I ran into this problem when testing the Autoconf release candidate on
Solaris 10, which has Perl 5.8.4. Oracle says Solaris 10’s
end-of-life is January 2024, so it’s still (barely) a viable porting
target. Of course with Solaris 10 one must install a recent-enough
GNU m4, but adding a requirement to also install a recent-enough Perl
is a new barrier, and if it’s not needed then it might be better to
wait until it is needed (or until 2024 arrives).
* NEWS: Update news item about Perl 5.6 vs 5.10.
* README-hacking: Bump Perl recommendation to 5.10.
* build-aux/fetch.pl: Do not munge imported code to require 5.10.
Paul Eggert [Fri, 31 Mar 2023 17:46:20 +0000 (10:46 -0700)]
Cater to programs misusing AC_EGREP_HEADER
Problem reported by Frederic Berat in:
https://lists.gnu.org/archive/html/autoconf/2022-11/msg00127.html
* lib/autoconf/programs.m4 (AC_PROG_EGREP): Also set
EGREP_TRADITIONAL and ac_cv_path_EGREP_TRADITIONAL.
* tests/c.at (AC_PROG_EGREP and AC_EGREP_HEADER):
New test, taken from Frederic Berat’s email in:
https://lists.gnu.org/r/autoconf/2023-03/msg00043.html
Jim Meyering [Mon, 27 Mar 2023 05:08:02 +0000 (22:08 -0700)]
tests: avoid an unwarranted test failure
* tests/autotest.at (parallel autotest and signal handling): This
test would consistently fail due to an exit status of 0. That was
considered failure because the test required a SIGHUP-indicating
exit status. However, an status of 0 is perfectly fine, too, so
accept that.
Jim Meyering [Sun, 26 Mar 2023 05:07:19 +0000 (22:07 -0700)]
build: run "make fetch", which updated these:
Preparing to make a pre-release snapshot, update these:
* build-aux/announce-gen: Update from gnulib
* build-aux/gnupload: Likewise.
* build-aux/texinfo.tex: Update from texinfo.
Zack Weinberg [Mon, 13 Mar 2023 00:06:53 +0000 (20:06 -0400)]
Add experimental manifest.scm for testing Autoconf under guix shell.
‘guix shell’ is a utility for constructing isolated environments
for development; I’ve put together a “manifest” stating the
build and test requirements for autoconf, starting from a git
checkout.
Zack Weinberg [Sun, 12 Mar 2023 23:39:47 +0000 (19:39 -0400)]
bootstrap: Use an absolute path for ACBOOTDIR.
If we use a relative path for ACBOOTDIR, Automake can’t tell the
difference between Autoconf’s configure script’s aclocal.m4
inclusions (…/m4/*.m4) and the guts of Autoconf
itself (…/lib/autoconf/*.m4) so it puts both of them into
$(am__aclocal_m4_deps). This would be harmless, except that the
guts-of-Autoconf files are named *relative to $ACBOOTDIR*, which
means Make can’t find them later. And this is why a build from a
clean git checkout always starts by regenerating aclocal.m4 and
configure again.
Using an absolute path for ACBOOTDIR gives automake enough of a clue
what’s going on (see the heuristic circa 5500 of current automake.in,
commented “Some modified versions of autoconf don’t use frozen files…”)
for it to produce the same value for $(am__aclocal_m4) that it would
if we were running an installed Autoconf.
Zack Weinberg [Sun, 12 Mar 2023 23:08:03 +0000 (19:08 -0400)]
Skip all Autotest parallelism tests if using Guix’s bash.
It is not clear to me why, but the “parallel autotest and signal
handling” test malfunctions if the active shell is Guix bash. I don’t
think it’s worth investigating in detail, considering I intend to
reimplement parallel autotest using the same technique that Automake’s
parallel test driver uses, i.e. make -j, which should eliminate this
entire class of problems.
Zack Weinberg [Sun, 12 Mar 2023 20:59:27 +0000 (16:59 -0400)]
Fix ‘make syntax-check’ complaints.
* cfg.mk (local-checks-to-skip): Add sc_unportable_grep_q, which has
too many false positives to bother with; for instance, it triggers
on autoconf.texi’s discussion of why grep -q is unportable, and on
the code in maint.mk that implements the check!
(old_NEWS_hash): Update for commit b751bf49496ea3f0054533cfd63f977640abb07a,
which fixed spelling errors in old NEWS.
* doc/autoconf.texi: Remove a doubled word.
* lib/autoconf/programs.m4: Remove a space immediately before a tab.
* lib/m4sugar/m4sh.m4 (_AS_IF): Rephrase documentation to avoid saying
“if IF-FALSE” which triggers the prohibit_doubled_word check.
Paul Eggert [Fri, 3 Feb 2023 20:25:08 +0000 (12:25 -0800)]
Clarify NEWS
* NEWS: Clarify recent items about AC_SYS_LARGEFILE_REQUIRED,
AC_SYS_YEAR2038_REQUIRED, AC_PROG_MKDIR_P. Reported by Bruno Haible in:
https://lists.gnu.org/r/bug-autoconf/2023-02/msg00005.html
Paul Eggert [Thu, 2 Feb 2023 21:18:24 +0000 (13:18 -0800)]
Improve year-2038 documentation
* NEWS, doc/autoconf.texi (System Services):
Improve documentation for behavior of largefile and year-2038 support.
Say that in the current implementation, year-2038 support
requires largefile support. Say that year-2038 support
matters only for GNU/Linux glibc 2.34+ on 32-bit x86 and ARM.
Prefer brevity when this does not hurt understandability;
for example, prefer active to passive voice.
Prefer “wider” to “larger” when talking about the number of
bits in an integer, as this terminology is more standard.
Tone down the wording in warnings about enabling year-2038 support,
use similar wording in warnings about enabling largefile support,
and warn also about disabling largefile and year-2038 support.
No need for @emph. Also mention rlim_t.
Be a bit more careful about saying “2 GiB” rather than “2 GB”.
Mention that a future version of Autoconf might change
AC_SYS_LARGEFILE to default to --enable-year2038, since
something has gotta happen before 2038.
Coalesce descriptions of --enable-largefile and --enable-year2038
to simplify documentation. Mention that the only system where
AC_SYS_LARGEFILE changes CC is IRIX and that these systems
are obsolete. Say that ‘stat’ can fail due to time_t
overflow. Say that you can’t portably print time_t with %ld.
Say that binary compatibilty problems also can occur when one
library is linking to amother; it’s not just apps vs libraries.
Mention the possibility of modifying libraries to support both
32- and 64-bit interfaces. Warn more consistently about
ABI compatibility issues, but put the bulk of this text
in one location that the other locations refer to.
Todd C. Miller [Mon, 26 Dec 2022 17:35:39 +0000 (10:35 -0700)]
fix AC_CHECK_HEADER_STDBOOL regression
Commit 6dcecb780a69bd208088d666b299e92aa7ae7e80 "Port
AC_CHECK_HEADER_STDBOOL to C23" causes AC_CHECK_HEADER_STDBOOL to
always fail, even on systems with a conforming stdbool.h.
There is no longer an 'a' variable so it should not be referenced
in the return statement.
Paul Eggert [Sun, 25 Dec 2022 07:24:54 +0000 (23:24 -0800)]
Omit just-added *_REQUIRED macros
They are not needed for Gnulib, and users have an easy way to get
their effect, so for now omit them and just document the easy way.
Also, redo documentation to make it clear that AC_YEAR_2038 is
like AC_SYS_LARGEFILE except with a different year-2038 default.
* NEWS, doc/autoconf.texi: Document the above.
* lib/autoconf/specific.m4 (AC_SYS_YEAR2038_REQUIRED):
(AC_SYS_LARGEFILE_REQUIRED): Remove. Remove some support code.
Perhaps further simplification could be done but I quit while
I was ahead.
Zack Weinberg [Sun, 25 Dec 2022 07:24:51 +0000 (23:24 -0800)]
AC_SYS_LARGEFILE: Don’t enlarge time_t by default
Having AC_SYS_LARGEFILE enlarge time_t means that any program that has
already requested large file support will be abruptly migrated to
64-bit time_t (on 32-bit systems) as soon as its configure script is
regenerated with a sufficiently new Autoconf. We’ve received reports
of several widely used programs and libraries that are not prepared
for this migration, with breakage ranging from annoying (garbage
timestamps in messages) through serious (binary compatibility break
in security-critical shared library) to catastrophic (on-disk data
corruption).
Partially revert f6657256a37da44c987c04bf9cd75575dfca3b60: in the
absence of AC_SYS_YEAR2038, AC_SYS_LARGEFILE will now only add an
--enable-year2038 command line option to configure. If this option is
used, time_t will be enlarged, allowing people to experiment with the
migration without needing to *edit* the configure script in question,
only regenerate it.
In the process, AC_SYS_LARGEFILE and AC_SYS_YEAR2038 were drastically
overhauled for modularity; it should now be much easier to add support
for platforms that offer large off_t / time_t but not with the standard
feature selection macros. Also, new macros AC_SYS_LARGEFILE_REQUIRED and
AC_SYS_YEAR2038_REQUIRED can be used by programs for which large off_t /
time_t are essential.
The implementation is a little messy because it needs to gracefully
handle the case where AC_SYS_LARGEFILE and AC_SYS_LARGEFILE_REQUIRED
are both used in the same configure script — or, probably more common,
AC_SYS_LARGEFILE (which invokes _AC_SYS_YEAR2038_OPT_IN) followed by
AC_SYS_YEAR2038 — but if macro B is invoked after macro A, there’s no
way for B to change *what macro A expanded to*. The best kludge I
managed to find is to AC_CONFIG_COMMANDS_PRE as a m4-level hook that
sets shell variables in an early diversion.
* lib/autoconf/functions.m4 (AC_FUNC_FSEEKO): Rewrite to avoid dependency
on internal subroutines of AC_SYS_LARGEFILE.
* lib/autoconf/specific.m4 (_AC_SYS_YEAR2038_TEST_INCLUDES): Renamed to
_AC_SYS_YEAR2038_TEST_CODE.
(_AC_SYS_YEAR2038): Refactor into subroutines: _AC_SYS_YEAR2038_OPTIONS,
_AC_SYS_YEAR2038_PROBE, _AC_SYS_YEAR2038_ENABLE.
(AC_SYS_YEAR2038): Update for refactoring.
(_AC_SYS_YEAR2038_OPT_IN): New sorta-top-level macro, for use by
AC_SYS_LARGEFILE, that probes for large time_t only if the
--enable-year2038 option is given.
(AC_SYS_YEAR2038_REQUIRED): New top-level macro that insists on
support for large time_t.
(_AC_SYS_LARGEFILE_TEST_INCLUDES): Renamed to _AC_SYS_LARGEFILE_TEST_CODE.
(_AC_SYS_LARGEFILE_MACRO_VALUE, AC_SYS_LARGEFILE): Refactor along same
lines as above: _AC_SYS_LARGEFILE_OPTIONS, _AC_SYS_LARGEFILE_PROBE,
_AC_SYS_LARGEFILE_ENABLE. Invoke _AC_SYS_YEAR2038_OPT_IN at end of
_AC_SYS_LARGEFILE_PROBE. MinGW-specific logic moved to YEAR2038
macros as it has nothing to do with large file support.
(AC_SYS_LARGEFILE_REQUIRED): New top-level macro that insists on
support for large off_t.
* tests/local.at (_AT_CHECK_ENV): Also allow changes in CPPFLAGS,
enableval, enable_*, withval, with_*.
* doc/autoconf.texi, NEWS: Update documentation to match above changes.
Fix typo in definition of @dvarv.
Paul Eggert [Wed, 16 Nov 2022 18:19:43 +0000 (10:19 -0800)]
Cater better to underquoted callers
Problem reported by Frederic Berat in:
https://lists.gnu.org/r/autoconf/2022-11/msg00092.html
* lib/autoconf/c.m4 (AC_LANG_CALL(C)): Omit comma in comment,
which triggers bugs in underquoted callers.
Paul Eggert [Fri, 11 Nov 2022 08:28:49 +0000 (00:28 -0800)]
Modernize and regularize doc for C89 etc.
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.
Zack Weinberg [Thu, 10 Nov 2022 17:05:30 +0000 (12:05 -0500)]
More fixes for compilers that reject K&R function definitions.
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().
Paul Eggert [Fri, 28 Oct 2022 22:19:16 +0000 (15:19 -0700)]
Warn about TMPDIR
* doc/autoconf.texi (Initialization Macros): Warn about
setting TMPDIR, following up on this Paul Smith remark:
https://lists.gnu.org/r/autoconf/2022-10/msg00024.html
Paul Eggert [Wed, 12 Oct 2022 19:01:50 +0000 (12:01 -0700)]
MKDIR_P now falls back on mkdir -p
* 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.
Xi Ruoyao [Fri, 30 Sep 2022 15:36:03 +0000 (11:36 -0400)]
Fix testsuite failures with bash 5.2.
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
Paul Eggert [Sun, 18 Sep 2022 02:43:04 +0000 (19:43 -0700)]
Allow users to clear BINSH
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
autoconf: store autom4te request keys in sorted order
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.
Paul Eggert [Fri, 9 Sep 2022 21:54:11 +0000 (16:54 -0500)]
Port to GNU make 4.4
* cfg.mk (PATH): Assign eagerly, and simplify shell use, avoiding
use of the shell entirely if PWD is set, as it should be.
Problem reported by Sergei Trofimovich in:
https://lists.gnu.org/r/autoconf-patches/2022-09/msg00007.html
Paul Eggert [Thu, 1 Sep 2022 21:19:50 +0000 (16:19 -0500)]
Port to compilers that moan about K&R func decls
* 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.
Paul Eggert [Mon, 8 Aug 2022 21:20:41 +0000 (14:20 -0700)]
AC_SYS_LARGEFILE now widens time_t if possible
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.
Paul Eggert [Mon, 8 Aug 2022 16:08:20 +0000 (09:08 -0700)]
Fix compilation errors in 32-bit C++ mode on HP-UX 11/ia64
This should render unnecessary Gnulib’s gl_SET_LARGEFILE_SOURCE hack
https://lists.gnu.org/r/bug-gnulib/2019-12/msg00046.html
* lib/autoconf/functions.m4 (AC_FUNC_FSEEKO):
On that platform, simply set _LARGEFILE_SOURCE.
Paul Eggert [Wed, 27 Jul 2022 15:53:35 +0000 (08:53 -0700)]
Port AC_C_BIGENDIAN to cross gcc -std=c11 -flto
* 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).
Paul Eggert [Thu, 14 Jul 2022 19:24:20 +0000 (12:24 -0700)]
Handle z/OS Unix ‘set’ output
Problem and fix reported by Jeff Shimoda in:
https://lists.gnu.org/r/autoconf-patches/2022-06/msg00007.html
* tests/local.at (AT_CONFIG_CMP): Treat ‘var=""’ like ‘var=''’.
Copyright-paperwork-exempt: Yes
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.
Remove ancient backward compatibility code from m4/m4.m4.
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.
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”.
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.
Paul Eggert [Tue, 28 Jun 2022 22:46:33 +0000 (17:46 -0500)]
Port _AC_COMPILER_EXEEXT to IBM z/OS Unix
Problem reported by Jeff Shimoda in:
https://lists.gnu.org/r/autoconf-patches/2022-06/msg00001.html
* lib/autoconf/lang.m4 (_AC_COMPILER_EXEEXT):
Also remove conftest.o and conftest.obj.
We can't use $ac_objext as it might not be defined yet.