Zack Weinberg [Tue, 24 Feb 2026 21:00:03 +0000 (16:00 -0500)]
autoheader: preserve hand-written template files
Consistent with the existing behavior of autoreconf regarding
hand-maintained aclocal.m4, make both autoheader and autoreconf
check for the /* Generated from configure.ac by autoheader */
line that autoheader emits at the beginning of its generated
configuration header templates. If the file exists but the
marker line is not there, they will now leave the file alone
unless given the new command line option --replace-handwritten.
I’m looking for feedback regarding whether the new option should
also cause autoreconf to clobber a hand-written aclocal.m4, or any
other files that _could_ be generated but aren’t always. (aclocal.m4
in particular may need coordination with Automake, since the ‘aclocal’
tool belongs to them.)
* bin/autoheader.in: Add option --replace-handwritten. If the
primary template file already exists and doesn’t begin with a
marker comment indicating it was generated by autoheader, don’t
modify it unless --replace-handwritten was given.
* bin/autoreconf.in: Similarly.
* doc/autoconf.texi: Document new option for autoheader and
autoreconf.
* tests/tools.at: Test new behavior.
Zack Weinberg [Wed, 18 Feb 2026 18:18:37 +0000 (13:18 -0500)]
Update documentation for building Autoconf from a Git checkout.
* Clarify that you need a full Git clone, not a shallow clone, because
the build scripts inspect the Git history.
* Remove all references to CVS and the CVS mirror of the Git repo.
pserver.git.sv.gnu.org doesn’t exist anymore, and I suspect building
from a CVS-based working copy wouldn’t work anyway, for the same
reason a shallow clone doesn’t work.
* Add a note to the paragraph about copyright assignments for patches,
explaining that that Signed-off-by: is useless to us.
Zack Weinberg [Mon, 9 Feb 2026 14:25:15 +0000 (09:25 -0500)]
Go: do not clobber GOFLAGS in AC_PROG_GO (sr #111383)
The AC_PROG_GO macro should honor the GOFLAGS set by the user at
configure time.
Fixes <https://savannah.gnu.org/support/?111382>.
* lib/autoconf/go.m4: Do not clobber GOFLAGS in AC_PROG_GO.
Simplify sequence of AC_CHECK_TOOL/AC_CHECK_PROGS operations;
this macro does not have the backward compatibility constraints
that AC_PROG_CC does.
Algol68: do not clobber A68FLAGS in AC_PROG_A68 (sr #111382)
The AC_PROG_A68 macro should honor the A68FLAGS set by the user at
configure time.
Fixes <https://savannah.gnu.org/support/?111382>.
* lib/autoconf/a68.m4: Do not clobber A68FLAGS in AC_PROG_A68.
Simplify sequence of AC_CHECK_TOOL/AC_CHECK_PROGS operations;
this macro does not have the backward compatibility constraints
that AC_PROG_CC does.
Zack Weinberg [Wed, 4 Feb 2026 18:36:06 +0000 (13:36 -0500)]
AC_PROG_LEX: Be compatible with Solaris 10 lex’s handling of C++.
Solaris 10 lex (Software Generation Utilities (SGU) Solaris-ELF (4.0))
provides its own declaration of yywrap. When the generated scanner is
compiled as C++, that declaration will *not* be tagged with `extern "C"`
unless the preprocessor macro __EXTERN_C__ is defined using -D.
The %{ %} block of the .l file is too late.
Our test .l file also declares yywrap, and it unconditionally tags it
with `extern "C"` when compiling as C++. Thus, we need to define
__EXTERN_C__ or we’ll get a spurious compile error with this
implementation of lex. This macro should be harmless with other
implementations.
sr #111381
* lib/autoconf/programs.m4 (_AC_PROG_LEX_YYTEXT_DECL): Add -D__EXTERN_C__=1
to CPPFLAGS while compiling test programs, for improved compatibility
with Solaris 10 lex.
Zack Weinberg [Wed, 4 Feb 2026 17:10:41 +0000 (12:10 -0500)]
tests: AC_C_FLEXIBLE_ARRAY_MEMBER result can vary between C and C++.
For example, the native C compiler for Solaris 10 (Sun C in, at least,
the version 5.9 .. 5.15 range) supports C99 flexible array members,
but the matching C++ compiler doesn’t.
Zack Weinberg [Tue, 3 Feb 2026 20:29:08 +0000 (15:29 -0500)]
maint.mk: remove overquotation in ‘announcement’ rule
If $(bootstrap-tools) *doesn’t* include “gnulib”, a nested shell
command is supposed to expand to nothing, but instead it expands to
an empty argument, causing announce-gen to barf.
Zack Weinberg [Tue, 3 Feb 2026 19:31:36 +0000 (14:31 -0500)]
NEWS: Briefly mention a few more improvements.
Specifically, this is meant to cover these commits:
2b56e8c2 autoreconf: don’t fail if gtkdocize is unavailable (#110503) 912567e9 autoreconf: require word boundaries when grepping for macros (#111271) 4774e6bb autoreconf: Adapt to the on-disk situation after autopoint has run. f0d97fb5 autoreconf: Invoke autopoint in more situations.
and
9a6c58cf Rename version.m4 to autoconf_version.m4.
Zack Weinberg [Tue, 3 Feb 2026 17:31:55 +0000 (12:31 -0500)]
fetch.pl: get GNU standards documents from gnulib
Pulling these files from gnulib, instead of getting them directly
from their official home, means that all the files fetched by fetch.pl
come from Savannah Git repositories, which is particularly important
right now as Savannah CVS repositories are currently inaccessible via
the web, see
https://lists.gnu.org/archive/html/savannah-hackers/2026-02/msg00024.html
et seq.
* fetch.pl (to_fetch): Get all gnustandards files from gnulib instead.
(savannah_url): Remove special case for gnustandards.
Zack Weinberg [Tue, 3 Feb 2026 16:34:15 +0000 (11:34 -0500)]
syntax-check: avoid unsigned_* false positive on maint.mk
* maint.mk (sc_unsigned_char, sc_unsigned_short, sc_unsigned_int)
(sc_unsigned_log): Add ‘exclude’ patterns so that these tests do
not throw a false positive on their own commentary.
Zack Weinberg [Tue, 3 Feb 2026 15:56:12 +0000 (10:56 -0500)]
make fetch
Right now, Savannah’s HTTP interface to CVS repositories (viewvc) is
responding to all queries with a 429 Too Many Requests error code,
so those files were updated manually. (The actual CVS server is
still working fine.)
Zack Weinberg [Tue, 27 Jan 2026 21:17:43 +0000 (16:17 -0500)]
autoreconf: don’t fail if gtkdocize is unavailable (#110503)
Since 2.70, autoreconf has run gtkdocize when it detects a use of the
macro GTK_DOC_CHECK in the configure.ac. Some projects (e.g. per the
bug report, gnutls and harfbuzz) were using a clever hack with
m4_ifdef to allow people to build the project without having gtkdocize
installed, if they didn’t care about building the documentation; the
change to autoreconf broke this hack.
Attempt to make the hack work again, by only running gtkdocize if that
command is actually installed; autoreconf will not error out if the
macro is detected but the command is unavailable, similar to the
existing treatment of autopoint.
Problem reported by Marvin Scholz.
* bin/autoreconf.in (autoreconf_current_directory): Do not error out
if gtkdocize is wanted but unavailable.
Zack Weinberg [Tue, 27 Jan 2026 21:00:08 +0000 (16:00 -0500)]
autoreconf: require word boundaries when grepping for macros (#111271)
autoreconf’s first pass over configure.ac is effectively a grep
operation for a number of macros that almost always appear directly
in that file, if they’re going to appear at all. All but one of the
regular expressions made no attempt to check for word boundaries, and
the one that did was doing it incorrectly (using ^ rather than \b),
leading to issue #111271.
Fix all the regexps to surround each identifier with \b…\b and not
to use ^.
Reported by Kip, originally as gettext bug #52424.
* bin/autoreconf.in (autoreconf_current_directory): In the first pass,
require each of the macros we look for to be a complete word.
Ignore target feature flags in _AC_FC_LIBRARY_LDFLAGS (#111353)
Ignore target specific feature flags passed via '-target-feature'.
When encountered, ignore the flag passed after. These flags might
contain a '-l', e.g. '-target-feature -lwp', causing non-existent
libraries to be picked up, failing later checks, or the build of
the application.
This can e.g. be encountered when '-march=native' is passed to
configure during a build with LLVM on Zen 4 machines.
Reported by, and patch written by, Jan André Reuter <j.reuter@fz-juelich.de>.
* lib/autoconf/fortran.m4 (_AC_FC_LIBRARY_LDFLAGS): Skip arguments
immediately following ‘-target-feature’.
Luke Mewburn [Sat, 3 Jun 2023 15:10:30 +0000 (01:10 +1000)]
doc: cross-reference m4 manual for regex syntax (#111095)
The documentation of the various M4sugar macros that take regex
arguments did not explain GNU M4’s idiosyncratic regex syntax, which
resembles POSIX basic regexes but is not actually the same, nor is it
the same as Emacs regexes. Add cross-references to the GNU M4 manual
to rectify this.
Reported by Luke Mewburn <Luke@Mewburn.net>.
Patch originally by Luke Mewburn, revised by Zack Weinberg.
* doc/autoconf.texi: Add cross-references from the documentation of
‘m4_bpatsubst’ and ‘m4_bregexp’ to the GNU M4 manual sections that
explain ‘patsubst’ and ‘regexp’. Also add cross-references from
‘m4_bmatch’ and ‘m4_bpatsubsts’ to ‘m4_bregexp’ and ‘m4_bpatsubst’
respectively.
Paul Eggert [Tue, 27 Jan 2026 20:41:00 +0000 (12:41 -0800)]
Avoid trailing whitespace in config.h
Problem (and earlier patch) reported by Collin Funk in:
https://lists.gnu.org/archive/html/autoconf-patches/2025-10/msg00002.html
* NEWS: Mention this.
* lib/autoconf/status.m4 (_AC_OUTPUT_HEADERS_PREPARE):
Omit trailing white space from C macro definitions.
* tests/torture.at (No trailing white space in macro definitions):
New test.
Zack Weinberg [Mon, 26 Jan 2026 21:03:52 +0000 (16:03 -0500)]
Rename version.m4 to autoconf_version.m4.
Many existing projects have their own version.m4, and in some cases
having one is recommended by the Automake manual. As of 2.72, the
name collision causes a spurious warning about including ‘version.m4’
multiple times, because the “has this been included before” machinery
does not track full pathnames.
A proper fix is more complicated than anyone has time to develop;
let’s just rename our version.m4 to autoconf_version.m4, which should
be sufficiently distinctive.
Reported in <https://savannah.gnu.org/support/?111007>.
* lib/version.in: Rename to lib/autoconf_version.in.
* bootstrap, configure.ac, lib/freeze.mk, lib/local.mk,
lib/m4sugar/m4sugar.m4: Change all uses of version.m4 to
autoconf_version.m4, and all uses of version.in to
autoconf_version.in.
Bruno Haible [Tue, 20 Jan 2026 18:34:16 +0000 (19:34 +0100)]
autoreconf: Adapt to the on-disk situation after autopoint has run.
Reported in <https://savannah.gnu.org/support/?111273>.
* bin/autoreconf.in (autoreconf_current_directory): After invoking autopoint,
rerun aclocal. When doing so, pass extra options "-I m4" if the configure.ac
does not specify a macro dir.
Bruno Haible [Tue, 20 Jan 2026 16:52:17 +0000 (17:52 +0100)]
autoreconf: Invoke autopoint in more situations.
Reported in <https://savannah.gnu.org/support/?111272>.
* bin/autoreconf.in (autoreconf_current_directory): Invoke autopoint also when
the package uses AM_GNU_GETTEXT (without AM_GNU_GETTEXT_VERSION), AM_PO_SUBDIRS,
AM_ICONV, AC_LIB_LINKFLAGS, AC_LIB_HAVE_LINKFLAGS, AC_LIB_LINKFLAGS_FROM_LIBS,
or GUILE_FLAGS.
Jose E. Marchesi [Thu, 28 Aug 2025 19:30:16 +0000 (21:30 +0200)]
Support for the Algol 68 language
This patch adds support for the Algol 68 programming language to
Autoconf. It is based on the Algol 68 GCC front-end, which is
currently under development [1]. The front-end is temporarily hosted
in the sourceware forge until integration in GCC is completed [3].
Note that the GCC Algol 68 front-end is not yet integrated in the main
compiler, so it is developed and distributed off-tree. See
https://gcc.gnu.org/wiki/Algol68FrontEnd. Additional information
about the Algol 68 programming language, and how it is being evolved
by the GNU Algol 68 Working Group can be found at
https://algol68-lang.org.
Automake support for Algol 68 has been already pushed as of 2 February
2025.
Paul Eggert [Sat, 30 Aug 2025 21:51:43 +0000 (14:51 -0700)]
doc: improve sed doc
* src/autoconf.texi: Modernize description of sed limitations.
Prompted by a bug report by Daniel Locks in:
https://lists.gnu.org/r/bug-autoconf/2025-08/msg00001.html
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.