The only platform that had this problem was native Windows,
and MSVC's malloc sets errno since 2015 at least.
* lib/autoconf/functions.m4 (AC_FUNC_MALLOC): Guess yes when
cross-compiling.
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.
* 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*.
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”.
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.
* 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.
* 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.
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).
* 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.
* 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 ‘/’.
* 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.
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 ‘\’.
* 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.
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.
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.
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.
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.
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.
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.
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.
For example, one might set LN_S=cp when working on an
OS or filesystem that does not support symbolic links.
* bootstrap: Honor $LN_S environment variable, defaulting
to 'ln -s'.
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.
* 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.
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.
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.
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.
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.