Paul Eggert [Thu, 7 Aug 2025 20:50:53 +0000 (13:50 -0700)]
Port _AC_C_C99_TEST_MAIN to -Wc++-compat
Problem reported by Vincent Lefevre in:
https://lists.gnu.org/r/autoconf-patches/2025-08/msg00004.html
* lib/autoconf/c.m4 (_AC_C_C99_TEST_MAIN):
Don’t use malloc.
Paul Eggert [Thu, 7 Aug 2025 20:27:29 +0000 (13:27 -0700)]
Port _AC_C_C99_TEST_GLOBALS to -Wc++-compat
Problem reported by Vincent Lefevre in:
https://lists.gnu.org/r/autoconf-patches/2025-08/msg00004.html
* lib/autoconf/c.m4 (_AC_C_C99_TEST_GLOBALS): and → aND.
Vincent Lefevre [Thu, 7 Aug 2025 15:22:25 +0000 (17:22 +0200)]
Make _AC_C_C99_TEST_MAIN more robust with -Werror
The current code fails with gcc r16-2729-g0d276cd378e and
-Werror=discarded-qualifiers -Werror=write-strings
(the -Werror=write-strings is useful to check compatibility of
user code with C++, and the -Werror=discarded-qualifiers is an
upgrade of a default warning to an error). Since this is a test
for C99, we may assume that const is supported by the compiler,
and adding const makes the code more robust in this context.
Paul Eggert [Thu, 7 Aug 2025 16:03:21 +0000 (09:03 -0700)]
Port AC_C_CONST to GCC 16 -Wunused-but-set-variable
Problem reported by Vincent Lefevre in:
https://lists.gnu.org/r/autoconf-patches/2025-08/msg00001.html
https://lists.gnu.org/r/autoconf-patches/2025-08/msg00002.html
* lib/autoconf/c.m4 (AC_C_CONST): Combine two tests, use
the set variable, and don’t try to add 1 to a null pointer.
Paul Eggert [Sun, 27 Jul 2025 17:29:42 +0000 (10:29 -0700)]
doc: update cd info
* doc/autoconf.texi: Modernize and update description
of cd gotchas. Prompted by email from Farblos in:
https://lists.gnu.org/r/autoconf/2025-07/msg00004.html
Paul Eggert [Fri, 18 Jul 2025 18:00:17 +0000 (11:00 -0700)]
doc: omit confusing space before paren
* doc/autoconf.texi: Set txidefnamenospace to avoid confusing spaces.
Problem reported by Gavin Smith in:
https://lists.gnu.org/r/autoconf/2025-07/msg00000.html
Paul Eggert [Wed, 25 Jun 2025 18:28:24 +0000 (11:28 -0700)]
Document s/a/\n/ etc
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/autoconf-patches/2025-06/msg00001.html
* doc/autoconf.texi (Limitations of Usual Tools):
Also mention escapes in replacement strings.
While we’re at it, update -e and -f concatenation doc.
Bruno Haible [Mon, 26 May 2025 13:17:57 +0000 (15:17 +0200)]
Fix trap quoting (regression 2024-08-04).
* lib/autoconf/general.m4 (_AC_INIT_PREPARE): Emit functions ac_cache_dump,
ac_dump_debugging_info. In the trap command, invoke ac_dump_debugging_info.
(AC_CACHE_SAVE): Invoke ac_cache_dump instead of expanding _AC_CACHE_DUMP a
second time.
Bruno Haible [Sat, 24 May 2025 10:22:28 +0000 (12:22 +0200)]
AC_CHECK_DECL now ignores future Darwin functions
* lib/autoconf/general.m4 (_AC_UNDECLARED_BUILTIN):
Use shorter diagnostic, to be consistent with other changes.
(_AC_FUTURE_DARWIN): New macro.
(AC_CHECK_DECL): Require per-language _AC_FUTURE_DARWIN.
Use $ac_c_future_darwin_options alongside with
$ac_c_undeclared_builtin_options.
* NEWS: Mention the fix. Co-authored-by: Paul Eggert <eggert@cs.ucla.edu>
Paul Eggert [Fri, 18 Apr 2025 21:01:38 +0000 (14:01 -0700)]
Avoid grep in minimal configure
* lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE):
Use ‘sed -n '$='’ instead of ‘grep -c’, since these
are the only uses of grep in a minimal ‘configure’
and we are already using sed elsewhere.
Paul Eggert [Thu, 17 Apr 2025 08:08:52 +0000 (01:08 -0700)]
Document that 'configure' needs awk etc
Problem reported by Simon Josefsson in:
https://lists.gnu.org/r/bug-gnulib/2025-04/msg00127.html
* doc/install.texi (Installation Prerequisites): New section.
Paul Eggert [Mon, 7 Apr 2025 18:01:59 +0000 (11:01 -0700)]
Fix AC_DEFINE_UNQUOTED regexp
Problem reported by Eric Blake in:
https://savannah.gnu.org/support/?111221
* lib/autoconf/general.m4 (_AC_DEFINE_UNQUOTED): Fix typo that
caused us to not use a here-document in some cases when we should.
* tests/torture.at (Substitute and define special characters):
Test for the bug.
Paul Eggert [Sun, 9 Feb 2025 18:00:11 +0000 (10:00 -0800)]
Port install_aux_file to OS/2
* bin/autoreconf.in (install_aux_file): Port to OS/2,
which does not allow file name operations on open files.
Problem reported by KO Myung-Hun in:
https://lists.gnu.org/r/autoconf-patches/2025-02/msg00001.html
Yann E. MORIN [Wed, 29 Jan 2025 22:29:18 +0000 (15:29 -0700)]
tests/local.mk: fix dependencies for generating the wrapper template
Generating the tests wrapper template currently depends on the
dependencies needed for the frozen lib/m4sugar/m4sh.m4f. However,
it also requires that frozen sugar to actually be generated, or the
build will fail if it is not (or at least if it is in the process of
being generated).
Change the dependency to actually depend on the generated file, rather
than on its dependencies.
This kind of failure has been noticed on highly parallel builds on very
loaded machines.
Markus Mützel [Sun, 5 Jan 2025 18:14:19 +0000 (18:14 +0000)]
Keep "-lmingwex" and "-lmoldname" in linker flags for MinGW
It is needed when building Octave targeting Windows. Without it, the
implementation of "casin" from the Windows runtime is used instead of
the replacement from MinGW-w64. That means that results for the
"casin" function are wrong without that change.
* lib/autoconf/fortran.m4: Do not remove "-lmingwex" or "-lmoldname"
from the linker flags when targeting MinGW. Removing "-lmingwex" causes
an incorrect linker resolution for functions like "casin" for projects
that consist of Fortran and C++ sources. Removing "-lmoldname" causes
issues for Fortran projects that try to use POSIX-like C functions
without a '_' symbol prefix when targeting MinGW.
Paul Eggert [Wed, 1 Jan 2025 21:30:26 +0000 (13:30 -0800)]
Fix test failure on macOS 15.1.1
Problem reported by Sean Denny in:
https://lists.gnu.org/r/bug-autoconf/2024-12/msg00001.html
* doc/autoconf.texi (Limitations of Builtins):
Document the macOS sh bug.
* tests/base.at (AC_CACHE_CHECK):
* tests/local.at: Use test -ot rather than ls -t, as POSIX
requires the former to work reliably, but does not require the
latter (POSIX does not require a stable sort for ls -t).
Somewhat ironically, this should work around the macOS bug
because the use of its buggy test -ot should increase the
timestamp resolution to 1 s.
Paul Eggert [Sun, 17 Nov 2024 17:00:49 +0000 (09:00 -0800)]
Further improvements for C23 tests
Problems reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-11/msg00140.html
https://lists.gnu.org/r/bug-gnulib/2024-11/msg00141.html
https://lists.gnu.org/r/bug-gnulib/2024-11/msg00145.html
* lib/autoconf/c.m4 (_AC_C_C23_TEST_GLOBALS):
In use_u8, add parens to pacify GCC 15 -Wbool-compare,
and use sizeof to make it a conforming integer constant expression.
Do not test stdbit.h, as some current sort-of-C23 environments
lack it and want to use options like -std=gnu23 on such platforms.
Use null_pointer to pacify GCC -Wunused-const-variable.
Paul Eggert [Fri, 1 Nov 2024 01:29:54 +0000 (18:29 -0700)]
Fix use of $3 in _AC_FUNC_MALLOC_IF etc
Use m4_default in case $3 is omitted.
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-10/msg00284.html
Also, use AS_CASE to defend against $3 containing macros
that might be expaned.
Paul Eggert [Tue, 29 Oct 2024 20:32:25 +0000 (13:32 -0700)]
Match Gnulib INSTALL for quoting
The manual was already using curved single quotes, so we
might as well use curved double quotes and en and em dashes too.
* doc/local.mk (AM_MAKEINFOFLAGS): Add ASCII_DASHES_AND_QUOTES=0,
CHECK_NORMAL_MENU_STRUCTURE=1.
* Makefile.am ($(srcdir)/INSTALL): Also use AM_MAKEINFOFLAGS.
This matches Gnulib INSTALL’s quoting practice.
Paul Eggert [Tue, 29 Oct 2024 04:27:35 +0000 (21:27 -0700)]
Merge from Gnulib for malloc, realloc checking
* lib/autoconf/functions.m4 (_AC_FUNC_MALLOC_IF, _AC_FUNC_REALLOC_IF):
Add 3rd argument for cross-guessing; all callers changed.
Use ‘volatile’ so that compilers don’t second-guess.
Also guess yes on gnu*, midipix*, midnightbsd*.
Paul Eggert [Sun, 27 Oct 2024 00:17:00 +0000 (17:17 -0700)]
Go back to using “POSIX” not “Posix”
In my Mon Oct 11 20:21:33 2004 +0000 commit when I standardized the
spelling of various acronyms in documentation and comments I spelled
it “Posix”. However, it seems that “POSIX” has won out in practice
(including my own practice!), so let’s change it back to “POSIX”.
Paul Eggert [Mon, 21 Oct 2024 17:49:30 +0000 (10:49 -0700)]
Avoid some echo '...\...' gotchas
Problem with AC_SUBST_FILE reported by Dylan Palauzov in:
https://lists.gnu.org/r/bug-autoconf/2024-10/msg00018.html
The other problems I found by a manual scan.
* bootstrap: Use printf, not echo.
* doc/autoconf.texi (Polymorphic Variables):
* lib/autoconf/fortran.m4 (_AC_PROG_FC_V_OUTPUT):
* lib/autoconf/general.m4 (_AC_CANONICAL_SPLIT):
* lib/autoconf/status.m4 (_AC_SUBST_FILES):
* lib/autotest/general.m4 (AT_FINISH):
Use AS_ECHO, not echo.
Paul Eggert [Sat, 28 Sep 2024 23:27:16 +0000 (16:27 -0700)]
Mention autogen.sh sooner in doc
* doc/install.texi (Basic Installation):
Be more explicit about bootstrapping scripts
not named ‘bootstrap’. Problem reported by Gavin Smith in:
https://lists.gnu.org/r/autoconf/2024-09/msg00003.html
Paul Eggert [Sun, 22 Sep 2024 05:56:14 +0000 (22:56 -0700)]
doc: remove IRIX from manual
* doc/autoconf.texi: Remove references to IRIX, except for the
obsolete macro AC_IRIX_SUN. IRIX has not been supported by its
vendor since 2013, and is no longer a documented Autoconf target.
Paul Eggert [Wed, 7 Aug 2024 00:57:32 +0000 (17:57 -0700)]
Stop documenting Tru64
* doc/autoconf.texi: Simplify manual by removing coverage of
Ultrix, OSF/1, Tru64, and DEC Alpha. HP stopped supporting the
last release at the end of 2012, so this platform is long dead.
(Long Lines in Makefiles, Tru64 Directory Magic): Remove.
Paul Eggert [Tue, 6 Aug 2024 17:13:05 +0000 (10:13 -0700)]
Improve coverage of ‘echo’ in manual
In manual, prefer AS_ECHO or printf instead of echo,
when that might make a difference.
Don’t use ‘date >timestamp’, to avoid spurious diffs.
* doc/autoconf.texi (Notices): No need to worry any more about
RCS or CVS being used to maintain Autoconf.
(Preset Output Variables): Say that ECHO_N etc. are obsolete.
(Automatic Remaking): Remove obsolescent mention of CVS.
(AS_ECHO): Mention that AS_ECHO expands to something involving “'”,
and how to work around this (rare) issue.
(Shell Substitutions, Slashes, Limitations of Builtins): Omit
no-longer-relevant discussion about ancient shell bugs that
involved a lot of ‘echo’s that would otherwise need to be
replaced.
(Limitations of Builtins): Don’t mention ‘echo "x$word"’ trick, as
it doesn’t resist backslashes. Just use printf. Expand on
discussion of ‘echo’ options. Say that even modernish shells (e.g.,
ksh93 on OmniOS) sometimes screw up with here-documents.
(Making testsuite Scripts): Simplify $(srcdir)/package.m4
rule by using printf instead of echo, and defend against
some shell metacharacters in $(srcdir).
Paul Eggert [Tue, 6 Aug 2024 17:00:26 +0000 (10:00 -0700)]
More defense against bad echo
* lib/autoconf/general.m4 (_AC_INIT_PARSE_ARGS)
(_AC_ARG_VAR_VALIDATE):
Defend against ‘echo’ interpreting ‘\’ or leading ‘-’.
(_AC_EVAL, _AC_EVAL_STDERR): Add to comment yet another reason
that these macros are obsolete and should be removed. There’s no
point trying to change them as that’s more likely to hurt than
help the (zero?) callers who still use them.
Paul Eggert [Tue, 6 Aug 2024 15:06:33 +0000 (08:06 -0700)]
Allow shell metachars in CONFIG_STATUS
* lib/autoconf/general.m4 (_AC_INIT_DEFAULTS, _AC_INIT_PREPARE):
* lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE)
(_AC_OUTPUT_FILE, _AC_OUTPUT_HEADERS_PREPARE, AC_OUTPUT)
(_AC_OUTPUT_CONFIG_STATUS):
Work even if $CONFIG_STATUS contains shell metacharacters,
leading ‘-’, or no ‘/’.
Paul Eggert [Tue, 6 Aug 2024 06:09:58 +0000 (23:09 -0700)]
Support more special chars in $(LIBDIR) etc
* lib/autoconf/libs.m4 (_AC_PATH_X_XMKMF):
* lib/autoconf/programs.m4 (AC_PROG_MAKE_SET):
Allow more special characters in ‘make’ macros like LIBDIR and MAKE.
Paul Eggert [Tue, 6 Aug 2024 03:43:36 +0000 (20:43 -0700)]
Don’t mishandle ‘\’ in VERSION
This is minor, it’s just allowing more chars (though not all)
in $(VERSION).
* Makefile.am (edit, top_srcdir.version, dist-hook)
(check-coverage-report):
* man/local.mk (VERSION):
Work even if VERSION contains ‘\’.
Paul Eggert [Sun, 4 Aug 2024 23:55:05 +0000 (16:55 -0700)]
Follow own advice about \ in shell double-quoted strings
* lib/autoconf/headers.m4 (_AC_HEADERS_EXPANSION):
* lib/m4sugar/m4sh.m4 (AS_ECHO):
Go back to using '%s\n' instead of "%s\n".
(AS_VAR_GET): Work around the quoting problem by using printf
directly with "%s\\n" instead of AS_ECHO; this is safe now that we
assume printf.
Paul Eggert [Sat, 3 Aug 2024 03:42:57 +0000 (20:42 -0700)]
Port to AIX 7.2 ksh93
Problem reported in <https://savannah.gnu.org/support/?111102>.
* lib/autotest/general.m4:
* lib/m4sugar/m4sh.m4 (_AS_REEXEC_WITH_SHELL):
* tests/wrapper.as:
Port to AIX 7.2 ksh93, whidh mishandles ${1+"$@"}, by not using
that construct.
One complaint is correct: house style is “file system” not “filesystem.”
The other one is bogus: sc_two_space_separator_in_usage gets a false
positive on gendocs.sh, which isn’t even our code. I tried to exclude
just that file using exclude_file_name_regexp but it didn’t immediately
work and my patience for debugging maint.mk is nil.
Adjust set size correctly in all cases of m4_set_add_all.
Both the recursive and the iterative versions of m4_set_add_all had a
bug where they did not update the set size correctly if the set
contained tombstones. I guess m4_set_remove isn’t used that often.
(I found this bug by accident while investigating an unrelated thing.)
The root cause of the bug was that in the tombstone case we had two
different layers quarreling over who got the last word on the size of
the set: m4_set_add, called for each value argument, was updating the
set size for each actual addition, and then the outer expansion of
m4_set_add_all was clobbering those updates with a calculation based
on the number of times the loop evaluated to a ‘-’ character, which
in the tombstone case was always zero.
The fix is to not mess with the set size on each actual addition,
relying on the outer calculation in all cases. Most of the volume
of the patch is refactoring to eliminate all the duplicate copies of
the “add this element only if it isn’t already there” logic which were
confusing the issue.
I also made m4_set_add_all not go into an infinite loop if invoked
with fewer than two arguments. Possibly it should error out in this
case instead of silently doing nothing, but I don’t think it matters
very much.
* lib/m4sugar/m4sugar.m4 (_m4_set_add, _m4_set_add_clean):
New macros, factoring out common “add element to set” logic.
(m4_set_add): Redefine using _m4_set_add.
(_m4_set_add_all): Rename to _m4_set_add_all_clean; use _m4_set_add_clean.
(_m4_set_add_check): Use _m4_set_add, not m4_set_add; emit a string
of dashes as _m4_set_add_all_clean does.
(m4_set_add_all): Update to match renamed _m4_set_add_all_clean.
Do nothing if invoked with fewer than two arguments.
* lib/m4sugar/foreach.m4: Define variants of _m4_set_add_all_clean and
_m4_set_add_all_check, matching the behavior of the definitions in
m4sugar.m4. Do not define m4_set_add_all here.
* tests/m4sugar.at (m4_set): Add more tests of interaction among
m4_set_add_all, m4_set_remove, and m4_set_size.
Quote separators in foreach.m4 version of m4_joinall.
The entire output of m4_joinall is supposed to be quoted, including
separators, but the foreach.m4 implementation (used with M4 1.4.x)
was missing some quotes, and we didn’t notice because the test suite
wasn’t thorough enough. Fix.
* lib/m4sugar/foreach.m4 (m4_joinall): Quote each separator as it’s
emitted.
* tests/m4sugar.at (m4_join test): Expand tests of both m4_join and
m4_joinall.
This is not actually used within the testsuite at present, but is
handy for troubleshooting m4sugar tests. For instance, you can pass
-v to a specific autom4te invocation and get told the underlying m4
invocation.
* tests/m4sugar.at (AT_CHECK_M4SUGAR_TEXT): Add fourth argument
FLAGS which specifies additional command line arguments to pass to
autom4te.
Zack Weinberg [Mon, 24 Jun 2024 17:51:07 +0000 (13:51 -0400)]
Emit compat shims less often for old AS_ECHO implementation details.
The shell variables $as_echo and $as_echo_n and the substitution
variables @ECHO_C@, @ECHO_N@, and @ECHO_T@ are implementation
details of the old implementation of AS_ECHO and AS_ECHO_N
(2.69-era; before the switch to use ‘printf’). We continue
to provide them for compatibility with various third-party macros and
Makefiles that used them, even though, as far as I can tell, they were
never documented. (Someone made ECHO_C etc. substitution variables on
purpose, though.)
For $as_echo and $as_echo_n, we can tell precisely when they are
needed, because all uses are exposed to M4 macro expansion.
Therefore, emit the necessary support code on first use and not
from AS_INIT. As a side effect this means the -Wobsolete warning
only appears on the first use of each, which IMHO is polite.
For @ECHO_C@, @ECHO_N@, and @ECHO_T@, we have no way of knowing
whether a substitution variable is used, but we *do* know that
substitution variables are exclusively a configure.ac thing, so their
support code can be moved to general.m4 and emitted from AC_INIT
rather than from AS_INIT.
(It’s faintly possible that someone decided to use $ECHO_C in an
Autotest script but considering how rare it is for people to use
Autotest at all, or any other non-Autoconf application of M4sh,
I think we can worry about that when we hear about it.)
* lib/m4sugar/m4sh.m4 (_AS_ECHO_N_PREPARE): Removed.
(AS_PREPARE, _AS_PREPARE): Don’t use _AS_ECHO_N_PREPARE.
(_as_echo_var_prepare, _as_echo_n_var_prepare): New macros which
emit the -Wobsolete warning and the support code for $as_echo and
$as_echo_n respectively.
(as_echo, as_echo_n): Move to bottom of the block that sets up
the current implementation of AS_ECHO. Invoke _as_echo_var_prepare
and _as_echo_n_var_prepare, respectively, on first use.
* lib/autoconf/general.m4 (_AC_INIT_ECHO_N): New internal macro,
contains the probe code that used to be in _AS_ECHO_N_PREPARE.
AC_SUBSTs ECHO_C, ECHO_N, and ECHO_T.
(AC_INIT): Don’t AC_SUBST ECHO_C, ECHO_N, and ECHO_T here.
Invoke _AC_INIT_ECHO_N.
Paul Eggert [Tue, 16 Jul 2024 15:25:36 +0000 (08:25 -0700)]
Detect Android 5.0 strnlen bug
This is useful for GNU Emacs, which still ports to that
old Android version. The change here is imported from Gnulib.
* lib/autoconf/functions.m4 (AC_FUNC_STRNLEN):
Also detect Android 5.0 bug. Use AC_COMPILE_IFELSE rather
than AC_CANONICAL_HOST for cross-compile test.
Paul Eggert [Fri, 5 Jul 2024 19:32:40 +0000 (20:32 +0100)]
doc: mention ACLOCAL_AMFLAGS and #
* doc/autoconf.texi: Mention that ACLOCAL_AMFLAGS
cannot use makefile comments. Problem reported by
Collin Funk in:
https://lists.gnu.org/r/bug-gnulib/2024-06/msg00005.html
Zack Weinberg [Mon, 24 Jun 2024 01:10:50 +0000 (21:10 -0400)]
autoconf.texi: Don’t say that Darwin is “derived from FreeBSD.”
This is an oversimplification and is probably going to cause
more confusion than it solves.
The commit which added this text was attributed to Sevan Janiyan,
but the text itself was written by me (Zack Weinberg); I revised
the patch but did not remember to also revise the commit message.
Zack Weinberg [Sun, 23 Jun 2024 19:11:35 +0000 (15:11 -0400)]
Add ‘shell.nix’ defining Autoconf’s build dependencies in NixOS terms.
Like the existing ‘manifest.scm’, which does the same job for GNU Guix,
the point of this file is to facilitate testing Autoconf itself on NixOS:
‘nix-shell --pure shell.nix’ gives you an interactive shell with all
the necessary tools in $PATH, and nothing else.
Paul Eggert [Tue, 18 Jun 2024 04:01:59 +0000 (21:01 -0700)]
Improve wording for Y2038 and largefile probes
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-06/msg00181.html
* lib/autoconf/specific.m4 (_AC_SYS_YEAR2038_PROBE)
(_AC_SYS_LARGEFILE_PROBE): Improve wording of chatter.
Paul Eggert [Sat, 15 Jun 2024 15:24:05 +0000 (08:24 -0700)]
Process C23 #elifdef and #elifndef
Inspired by Collin Funk’s suggestion in:
https://lists.gnu.org/r/autoconf-patches/2024-06/msg00000.html
* bin/autom4te.in (handle_output):
* bin/autoscan.in, bin/ifnames.in (scan_c_file):
Also recognize #elifdef and #elifndef.
* tests/tools.at (ifnames): Test it for ifnames.
Paul Eggert [Sat, 1 Jun 2024 16:07:38 +0000 (09:07 -0700)]
Document Solaris ‘make’ glitch with ‘!’
* doc/autoconf.texi (Failure in Make Rules):
Document that there are some complicated exceptions to
the idea that sh -e exits if any subcommand fails.
(Command Line Prefixes): New section.
Paul Eggert [Sun, 26 May 2024 16:20:56 +0000 (09:20 -0700)]
AC_PROG_CXX now tries C++23, C++20, C++17, C++14
The recent glitch with C++11 underscores the fact that it’s
long past time for Autoconf to catch up with the C++ standards.
Add simple tests for each iteration of the C++ standard.
They can be improved later as needed. When testing for these
newer standards, do not also test for features required by earlier
standards, as this isn’t all that helpful, leads to an O(N**2)
growth of ‘configure’, and can result in problems such as the
C++11 vs C++20 bug recently fixed.
* lib/autoconf/c.m4 (_AC_CXX_CXX14_TEST_PROGRAM)
(_AC_CXX_CXX17_TEST_PROGRAM, _AC_CXX_CXX20_TEST_PROGRAM)
(_AC_CXX_CXX23_TEST_PROGRAM, _AC_CXX_CXX14_OPTIONS)
(_AC_CXX_CXX17_OPTIONS, _AC_CXX_CXX20_OPTIONS)
(_AC_CXX_CXX23_OPTIONS): New macros.
(_AC_C_C23_TEST_PROGRAM, _AC_C_C23_OPTIONS): New macros.
(_AC_PROG_CC_STDC_EDITION): Try C23 first.
(_AC_PROG_CXX_STDCXX_EDITION): Use them.
Paul Eggert [Sun, 26 May 2024 14:04:19 +0000 (07:04 -0700)]
Port C11 test to C++20
Trivial fix suggested by Peter Johansson in:
https://lists.gnu.org/r/autoconf/2024-05/msg00004.html
* lib/autoconf/c.m4 (_AC_CXX_CXX11_TEST_MAIN):
Do not test assigning u8"..." to char const *, as this
runs afoul of C++20.
Paul Eggert [Tue, 30 Apr 2024 17:26:50 +0000 (10:26 -0700)]
AC_PROG_CC now tries C23 too
As C23 is now mostly supported by GCC, it's time for
AC_PROG_CC to prefer C23 if available.
* lib/autoconf/c.m4 (_AC_C_C23_TEST_GLOBALS, _AC_C_C23_TEST_MAIN):
(_AC_C_C23_TEST_PROGRAM, _AC_C_C23_OPTIONS): New macros.
(_AC_PROG_CC_STDC_EDITION): Try C23 first.
Paul Eggert [Thu, 25 Apr 2024 21:47:20 +0000 (14:47 -0700)]
Port better to MSVC
Problems reported by Antonin Décimo in:
https://lists.gnu.org/r/autoconf/2024-04/msg00001.html
* lib/autoconf/c.m4 (_AC_C_C89_TEST_GLOBALS):
Do not test the value of __STDC__.
(_AC_C_C99_TEST_MAIN): Do not test for VLAs.
(_AC_C_C11_OPTIONS): Also test -std:c11.
Paul Eggert [Wed, 24 Apr 2024 21:47:56 +0000 (14:47 -0700)]
Port AC_SYS_LARGEFILE to C++
Problem reported by Zack Weinberg
<https://savannah.gnu.org/support/?110983>.
* lib/autoconf/specific.m4 (_AC_SYS_YEAR2038_PROBE)
(_AC_SYS_LARGEFILE_PROBE):
In chatter, say it’s a CPPFLAGS option, not a CC option.
(_AC_SYS_LARGEFILE_OPTIONS): Omit -n32, as we no longer
need to worry about IRIX.
(_AC_SYS_LARGEFILE_PROBE): Fiddle with CPPFLAGS, not CC,
and don’t worry about -n32.
Paul Eggert [Sat, 6 Apr 2024 20:01:12 +0000 (13:01 -0700)]
Improve “possibly undefined macro” diagnostic
Simplified version of a suggestion by Reuben Thomas in:
https://lists.gnu.org/r/bug-autoconf/2024-04/msg00021.html
* bin/autom4te.in (warn_forbidden): Change message wording.
* tests/tools.at (autom4te and whitespace in file names)
(forbidden tokens, exceptions): Adjust tests to match new behavior.
Paul Eggert [Wed, 7 Feb 2024 20:42:04 +0000 (12:42 -0800)]
Remove incorrect check in AC_CHECK_SIZEOF
* lib/autoconf/types.m4 (AC_CHECK_SIZEOF, AC_CHECK_ALIGNOF):
When the size or alignment cannot be determined, do not fail if
ac_cv_type_$1 is yes, as there’s no guarantee that ac_cv_type_$1
is defined, and failure here would contradict the documentation
that the size or alignment is 0 when sizeof($1)/alignof($1) cannot
be compiled. The test for ac_cv_type_$1 made sense long ago when
it was checked for in these macros, but the test has not made
sense for many years.
Paul Eggert [Wed, 17 Jan 2024 04:20:06 +0000 (20:20 -0800)]
Fix ‘long long’ checks on ancient platforms
Problem reported by Nick Bowler in:
https://lists.gnu.org/r/bug-autoconf/2024-01/msg00018.html
* lib/autoconf/types.m4 (AC_TYPE_LONG_LONG_INT)
(AC_TYPE_UNSIGNED_LONG_LONG_INT): Test for these
when K&R or c89, not when neither K&R nor C89.
This fixes a thinko that I introduced in
commit cdef0d2dad57f92301cb4baf782f8c24b01d5f1d
dated Wed Feb 16 01:29:40 2011 -0800.
Zack Weinberg [Fri, 22 Dec 2023 17:39:49 +0000 (12:39 -0500)]
Finalize NEWS for release 2.72.
Since 2.72[abcde] did not get widely used, squash all the NEWS entries
since 2.71 together, and delete things that were only of interest to
people going from a,b,c to d to e. Finalize the release date.
Zack Weinberg [Fri, 22 Dec 2023 16:22:36 +0000 (11:22 -0500)]
Save/restore AC_LANG setting in AC_PROG_CC_C_O.
All of the AC_PROG_{compiler}_C_O macros, *except* AC_PROG_CC_C_O,
wrap their test in an AC_LANG_PUSH/POP pair for the appropriate
language. https://savannah.gnu.org/support/index.php?110987 reports
that AC_PROG_CC_C_O’s not doing this can cause a configure script to
malfunction. Specifically, if a script invokes AC_PROG_CC_C_O with
AC_LANG([C++]) in effect, AC_PROG_CC_C_O still runs $CC but it passes
a .cpp source file, possibly along with C-specific options. Either
of those can cause the test to mis-detect support for -c -o.
Add an AC_LANG_PUSH/POP pair to AC_PROG_CC_C_O, ensuring we are
testing the right compiler and giving it appropriate input.
* lib/autoconf/c.m4 (AC_PROG_CC_C_O): Wrap body of test in
AC_LANG_PUSH/POP to C.
This test failure has the same root cause as described in
commit 3fbfb13e7a846e98fa931b2bce373b5b2364a11b: autom4te
regenerates the output unexpectedly because the output has
the *same* file modification timestamp as the cache file it
was generated from. Apply the same stopgap fix.
* tests/tools.at (autom4te preselections): Immediately after
running autoconf the first time, delay and then touch configure.
Move the “echo newer > newer” line after the comment that explains
what it’s for. Insert additional blank lines for readability.
Zack Weinberg [Fri, 22 Dec 2023 13:47:36 +0000 (08:47 -0500)]
Avoid a spurious test failure with shells that ignore write errors.
In a surprisingly large number of cases, the ‘printf’ shell utility
doesn’t report errors caused by writing to stdout. This can cause
a spurious test failure on systems that have this bug in ‘printf’
and also have /dev/full. Detect such systems and skip that subtest.
Problem reported by Alan Coopersmith.
* tests/torture.at (AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS):
If /bin/sh’s printf doesn’t report an error on writing to /dev/full,
skip the subtests that write to /dev/full.