]> git.ipfire.org Git - thirdparty/autoconf.git/log
thirdparty/autoconf.git
8 months agoFix comment typo re malloc master
Paul Eggert [Tue, 5 Nov 2024 22:46:53 +0000 (14:46 -0800)] 
Fix comment typo re malloc

Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-11/msg00048.html

8 months agoFix use of $3 in _AC_FUNC_MALLOC_IF etc
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.

8 months agoAC_FUNC_MALLOC now guesses yes when cross-compiling
Bruno Haible [Fri, 1 Nov 2024 00:19:21 +0000 (17:19 -0700)] 
AC_FUNC_MALLOC now guesses yes when cross-compiling

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.

8 months agoSay malloc/realloc cache vars can have spaces
Paul Eggert [Fri, 1 Nov 2024 00:17:11 +0000 (17:17 -0700)] 
Say malloc/realloc cache vars can have spaces

8 months ago* functions.m4: Fix typos in previous change.
Paul Eggert [Tue, 29 Oct 2024 23:27:45 +0000 (16:27 -0700)] 
* functions.m4: Fix typos in previous change.

8 months agoUpdate ‘volatile’ doc for C23
Paul Eggert [Tue, 29 Oct 2024 20:37:19 +0000 (13:37 -0700)] 
Update ‘volatile’ doc for C23

* doc/autoconf.texi (Volatile Objects): Update for C23.

8 months agoMatch Gnulib INSTALL for quoting
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.

8 months agoMerge from Gnulib for malloc, realloc checking
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*.

8 months agoGo back to using “POSIX” not “Posix”
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”.

8 months agoRemove some doc for no-longer-used systems; update URLs
Paul Eggert [Sun, 27 Oct 2024 00:00:31 +0000 (17:00 -0700)] 
Remove some doc for no-longer-used systems; update URLs

8 months agoDocument realloc (p, 0) gotchas
Paul Eggert [Sat, 26 Oct 2024 23:29:49 +0000 (16:29 -0700)] 
Document realloc (p, 0) gotchas

* doc/autoconf.texi (Function Portability, Particular Functions):
Don’t recommend realloc-gnu as it doesn’t (and probably shouldn’t)
enforce glibc compatibility.  Document variance in glibc behavior.

8 months agoAvoid some echo '...\...' gotchas
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.

9 months agoMention autogen.sh sooner in doc
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

9 months agodoc: remove IRIX from manual
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.

10 months agoGive a URL for COPYING.EXCEPTION in notices
Paul Eggert [Fri, 6 Sep 2024 01:19:36 +0000 (18:19 -0700)] 
Give a URL for COPYING.EXCEPTION in notices

This can be useful if the file is copied elsewhere
but the COPYING.EXCEPTION file is not present at the destination.

11 months agoStop documenting Tru64
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.

11 months agoImprove coverage of ‘echo’ in manual
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).

11 months agoMore defense against bad echo
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.

11 months agoAllow shell metachars in CONFIG_STATUS
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 ‘/’.

11 months agoSupport more special chars in $(LIBDIR) etc
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.

11 months agoMinor AC_FUNC_SELECT_ARGTYPES speedups
Paul Eggert [Tue, 6 Aug 2024 06:05:53 +0000 (23:05 -0700)] 
Minor AC_FUNC_SELECT_ARGTYPES speedups

* lib/autoconf/functions.m4 (AC_FUNC_SELECT_ARGTYPES):
Don’t use ‘sed 's/\*/\*/g'’, which is a no-op.
Don’t use ‘echo’ either.

11 months agoDon’t mishandle ‘\’ in VERSION
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 ‘\’.

11 months agoFollow own advice about \ in shell double-quoted strings
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.

11 months agoFix typos in previous $@ doc change
Paul Eggert [Sat, 3 Aug 2024 15:44:18 +0000 (08:44 -0700)] 
Fix typos in previous $@ doc change

Problem reported in <https://savannah.gnu.org/support/?111102>.

11 months agoPort to AIX 7.2 ksh93
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.

11 months agoFix syntax-check complaints
Zack Weinberg [Wed, 17 Jul 2024 20:26:26 +0000 (16:26 -0400)] 
Fix syntax-check complaints

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.

11 months agoAdjust set size correctly in all cases of m4_set_add_all.
Zack Weinberg [Mon, 8 Jul 2024 18:26:11 +0000 (14:26 -0400)] 
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.

11 months agoQuote separators in foreach.m4 version of m4_joinall.
Zack Weinberg [Mon, 8 Jul 2024 15:22:44 +0000 (11:22 -0400)] 
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.

11 months agoAdd a FLAGS argument to AT_CHECK_M4SUGAR_TEXT.
Zack Weinberg [Mon, 8 Jul 2024 18:43:53 +0000 (14:43 -0400)] 
Add a FLAGS argument to AT_CHECK_M4SUGAR_TEXT.

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.

11 months agoEmit compat shims less often for old AS_ECHO implementation details.
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.

11 months agoPort AC_PROG_OBJC to RHEL 9
Bruno Haible [Tue, 16 Jul 2024 15:56:21 +0000 (15:56 +0000)] 
Port AC_PROG_OBJC to RHEL 9

* lib/autoconf/c.m4 (AC_PROG_OBJC): Search for gobjc before gcc.
* NEWS: Mention the change.

11 months agoDetect Android 5.0 strnlen bug
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.

12 months agodoc: mention ACLOCAL_AMFLAGS and #
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

12 months agoautoconf.texi: Don’t say that Darwin is “derived from FreeBSD.”
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.

12 months agoautoconf.texi: Move ‘Systemology’ to ‘Portable Shell Programming’ section.
Zack Weinberg [Mon, 24 Jun 2024 00:59:35 +0000 (20:59 -0400)] 
autoconf.texi: Move ‘Systemology’ to ‘Portable Shell Programming’ section.

It’s not an ideal fit in this location, but it’s better here than
where it was (jammed in the middle of ‘Writing Tests’).

12 months agoAdd ‘shell.nix’ defining Autoconf’s build dependencies in NixOS terms.
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.

12 months agodoc/autoconf.texi (Systemology): Update Darwin.
Sevan Janiyan [Sat, 6 Jan 2024 21:49:59 +0000 (21:49 +0000)] 
doc/autoconf.texi (Systemology): Update Darwin.

Catch up with changes in Darwin since 2002 when the section was added.

12 months agobootstrap: Allow 'ln -s' to be overridden by the user.
KO Myung-Hun [Sun, 23 Jun 2024 17:39:16 +0000 (13:39 -0400)] 
bootstrap: Allow 'ln -s' to be overridden by the user.

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'.

12 months agoImprove wording for Y2038 and largefile probes
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.

12 months agoProcess C23 #elifdef and #elifndef
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.

13 months agoDocument Solaris ‘make’ glitch with ‘!’
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.

13 months agoAC_PROG_CXX no longer adjusts C++ language version
Paul Eggert [Tue, 28 May 2024 16:31:11 +0000 (09:31 -0700)] 
AC_PROG_CXX no longer adjusts C++ language version

* lib/autoconf/c.m4 (_AC_CXX_CXX98_TEST_GLOBALS)
(_AC_CXX_CXX98_TEST_MAIN, _AC_CXX_CXX11_TEST_GLOBALS)
(_AC_CXX_CXX11_TEST_MAIN, _AC_CXX_CXX98_TEST_PROGRAM)
(_AC_CXX_CXX11_TEST_PROGRAM, _AC_CXX_CXX14_TEST_PROGRAM)
(_AC_CXX_CXX17_TEST_PROGRAM, _AC_CXX_CXX20_TEST_PROGRAM)
(_AC_CXX_CXX23_TEST_PROGRAM, _AC_CXX_CXX98_OPTIONS)
(_AC_CXX_CXX11_OPTIONS, _AC_CXX_CXX14_OPTIONS)
(_AC_CXX_CXX17_OPTIONS, _AC_CXX_CXX20_OPTIONS)
(_AC_CXX_CXX23_OPTIONS, _AC_PROG_CXX_STDCXX_EDITION_TRY)
(_AC_PROG_CXX_STDCXX_EDITION_TRY): Remove.  All uses removed.

13 months agoAC_PROG_CXX now tries C++23, C++20, C++17, C++14
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.

13 months agoPort C11 test to C++20
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.

13 months agoAC_FUNC_MALLOC: fix cross compilation to musl
Alyssa Ross [Wed, 15 May 2024 11:49:08 +0000 (13:49 +0200)] 
AC_FUNC_MALLOC: fix cross compilation to musl

This check returned yes for me on musl 1.2.3 on
aarch64-unknown-linux-musl.

14 months agoImprove VLA wording in NEWS
Paul Eggert [Tue, 30 Apr 2024 18:48:31 +0000 (11:48 -0700)] 
Improve VLA wording in NEWS

Thanks to a suggestion by Werner Lemberg in:
https://lists.gnu.org/r/autoconf/2024-04/msg00009.html

14 months agoMention C keywords in NEWS
Paul Eggert [Tue, 30 Apr 2024 18:41:36 +0000 (11:41 -0700)] 
Mention C keywords in NEWS

Thanks to Alan Coopersmith for mentioning this in:
https://lists.gnu.org/r/autoconf/2024-04/msg00011.html

14 months agoAC_PROG_CC now tries C23 too
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.

14 months agoPort better to MSVC
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.

14 months agoFix doc typo with " {"
Paul Eggert [Tue, 30 Apr 2024 16:06:03 +0000 (09:06 -0700)] 
Fix doc typo with " {"

Problem reported by Brad Smith
<https://savannah.gnu.org/support/?111054>.

14 months agoAdjust tests to match new Automake files
Paul Eggert [Thu, 25 Apr 2024 15:26:17 +0000 (08:26 -0700)] 
Adjust tests to match new Automake files

* tests/m4sugar.at (bad categories): Adjust test cases
to match changed behavior of files copied from Automake.

14 months agomake fetch
Paul Eggert [Thu, 25 Apr 2024 15:24:22 +0000 (08:24 -0700)] 
make fetch

14 months agoPort AC_SYS_LARGEFILE to C++
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.

15 months agoImprove “possibly undefined macro” diagnostic
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.

16 months agoRemove incorrect check in AC_CHECK_SIZEOF
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.

17 months agoDocument ‘cp’ limitations better
Paul Eggert [Sun, 4 Feb 2024 05:37:49 +0000 (21:37 -0800)] 
Document ‘cp’ limitations better

* doc/autoconf.texi (Limitations of Usual Tools):
Modernize discussion of ‘cp’.

17 months agoFix typo in previous patch
Paul Eggert [Wed, 17 Jan 2024 05:19:31 +0000 (21:19 -0800)] 
Fix typo in previous patch

17 months agoFix ‘long long’ checks on ancient platforms
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.

17 months agomake fetch
Paul Eggert [Wed, 17 Jan 2024 03:54:17 +0000 (19:54 -0800)] 
make fetch

17 months agodoc: mention join bug
Paul Eggert [Thu, 11 Jan 2024 01:45:34 +0000 (17:45 -0800)] 
doc: mention join bug

* doc/autoconf.texi: Mention BSD ‘join’ bug
<https://lists.gnu.org/r/bug-gnulib/2024-01/msg00028.html>.

18 months agomaint: update all copyright dates via "make update-copyright"
Jim Meyering [Fri, 5 Jan 2024 17:11:48 +0000 (09:11 -0800)] 
maint: update all copyright dates via "make update-copyright"

18 months agomaint: post-release administrivia
Zack Weinberg [Fri, 22 Dec 2023 18:45:16 +0000 (13:45 -0500)] 
maint: post-release administrivia

* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.

18 months agoFinalize NEWS for release 2.72. v2.72
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.

18 months agoSave/restore AC_LANG setting in AC_PROG_CC_C_O.
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.

18 months agoRemove bashism from tests/local.at.
Zack Weinberg [Fri, 22 Dec 2023 15:05:27 +0000 (10:05 -0500)] 
Remove bashism from tests/local.at.

I regret doing development on a machine where /bin/sh is bash.

* tests/local.at: Don’t use test ==.

18 months agoRevert debugging change committed by mistake
Zack Weinberg [Fri, 22 Dec 2023 14:56:44 +0000 (09:56 -0500)] 
Revert debugging change committed by mistake

Commit 3fbfb13e7a846e98fa931b2bce373b5b2364a11b includes a debugging
hack that was not intended to be committed.  Revert it.

* tests/tools.at (autoconf: forbidden tokens, basic): Remove --verbose
  from second invocation of autoconf.

18 months agoAddress “autom4te preselections” testsuite failure
Zack Weinberg [Fri, 22 Dec 2023 14:48:30 +0000 (09:48 -0500)] 
Address “autom4te preselections” testsuite failure

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.

18 months agoAvoid a spurious test failure with shells that ignore write errors.
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.

18 months agoAddress “autoconf: forbidden tokens, basic” testsuite failure
Zack Weinberg [Thu, 21 Dec 2023 21:30:17 +0000 (16:30 -0500)] 
Address “autoconf: forbidden tokens, basic” testsuite failure

On file systems with coarse-grained timestamps, this test was broken by
<https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=713d9822bbfb2923115065efaefed34a0113f8a1>,
which changed autom4te's logic for deciding whether its output file is
newer than its cache file.  After that commit, if their modification
times are equal, the output is considered out of date.  Since both
files are created in quick succession, on file systems with coarse
timestamps (1 or 2s resolution), it is very easy for their
modification times to be equal.

As a stopgap for 2.72, in this test, force the generated configure
script’s mtime to be newer than the cache file.

* tests/tools.at (autoconf: forbidden tokens, basic): After the
  second AT_MTIME_DELAY, touch configure.

18 months agotestsuite: Skip tests that use aclocal or automake if they’re too old.
Zack Weinberg [Thu, 21 Dec 2023 16:48:40 +0000 (11:48 -0500)] 
testsuite: Skip tests that use aclocal or automake if they’re too old.

Old versions of aclocal and/or automake can cause several tests to
fail, for two unrelated reasons:

 - when used with sufficiently new Perl they might print a “your code
   has a minor bug” message on every invocation, causing tests that
   check for specific output to choke
 - aclocal prior to 1.11.2 does not support --system-acdir

We already had code (in each individual test) to skip tests that depend
on aclocal and/or automake when those programs were *unavailable*, or
when buggy wrapper scripts were detected (apparently some BSDs once
shipped with a wrapper that required you to set an environment variable
before ‘automake’ would do anything at all).  Consolidate all of that
code into local.at and augment it to detect the above two problems.

Individual tests that require automake and/or aclocal should now
just say AT_REQUIRE_AUTOMAKE and/or AT_REQUIRE_ACLOCAL at the top.
Individual tests that run autoreconf but *don’t* need a real aclocal
should instead start with AT_SUPPRESS_ACLOCAL, which sets ACLOCAL=true
and creates a dummy aclocal.m4.

While I was at it I noticed that AT_TESTED malfunctions if you have a
shell variable in there that expands to more than one shell word, so I
removed the AT_TESTED line for $M4 $PERL etc and replaced it with a
custom report for the most important system-provided programs that the
testsuite uses.  That report now also includes automake and aclocal.

This should fix the problems reported by Sevan Janiyan in
<https://lists.gnu.org/archive/html/bug-autoconf/2023-12/msg00159.html>.
Tested on x86_64-linux against automake 1.11.1, 1.11.2, 1.13.0, and 1.16.5.

* tests/local.at (AT_PREPARE_TESTS): Consolidate code to detect
  availability of automake and aclocal here.  Also detect Perl
  warning messages that will interfere with matching on the output,
  and aclocal too old to understand --system-acdir.  Produce a custom
  report of the versions of system-provided programs we need:
  m4, perl, sh, make, and optionally automake and aclocal.
  (AT_TESTED): Only list programs that are part of this package.
  (AT_REQUIRE_AUTOMAKE, AT_REQUIRE_ACLOCAL, AT_SUPPRESS_ACLOCAL):
  New helper macros.
  * tests/fortran.at, tests/tools.at, tests/torture.at:
  Use AT_REQUIRE_AUTOMAKE, AT_REQUIRE_ACLOCAL, AT_SUPPRESS_ACLOCAL
  throughout, as appropriate.

18 months agoupdate NEWS for 2.72e release candidate v2.72e
Zack Weinberg [Wed, 20 Dec 2023 14:15:55 +0000 (09:15 -0500)] 
update NEWS for 2.72e release candidate

18 months agospelling errors reported by “make syntax-check”
Zack Weinberg [Wed, 20 Dec 2023 14:19:19 +0000 (09:19 -0500)] 
spelling errors reported by “make syntax-check”

18 months agoAdjust --help and manpages to make it easier to find the Web manual.
Zack Weinberg [Tue, 19 Dec 2023 21:13:43 +0000 (16:13 -0500)] 
Adjust --help and manpages to make it easier to find the Web manual.

Today it came to my attention that, if you don’t already know that all
the GNU manuals are readable in HTML format on gnu.org, it’s not easy
to find one starting from typical --help output and/or help2man-
generated manpages.  Let’s do a little to make this easier, and have
“https://www.gnu.org/software/autoconf/manual/” appear prominently in
both the --help output and the trailer text of our generated manpages.

This uses the extended tmac.an “.MT” and “.UR” directives, which are
not universal, but I suspect anyone who’s actively using Autoconf on
an old system does not need the advice, and they can get it from
--help regardless.

* bin/autoconf.in, bin/autoheader.in, bin/autom4te.in, bin/autoreconf.in
* bin/autoscan.in, bin/autoupdate.in, bin/ifnames.in:
  Refer specifically to https://www.gnu.org/software/autoconf/manual/
  for the web version of the complete Autoconf manual.
* man/common.x: Likewise; also, suggest the Savannah tracker as
  well as bug-autoconf for bug reports.

18 months agoRun gitlog-to-changelog in source directory.
Zack Weinberg [Tue, 19 Dec 2023 15:07:15 +0000 (10:07 -0500)] 
Run gitlog-to-changelog in source directory.

gitlog-to-changelog needs to run in the source directory so it can
find the git metadata.  This was masked in many cases because “git log”
will look in parent directories for .git, but if you have your build
directory completely outside the source tree then it can’t find it.

* Makefile.am (gen-ChangeLog): Execute gitlog-to-changelog in $(top_srcdir).

18 months agoSkip test of AC_SYS_YEAR2038_RECOMMENDED if system doesn’t support 64-bit time_t.
Zack Weinberg [Tue, 19 Dec 2023 14:50:30 +0000 (09:50 -0500)] 
Skip test of AC_SYS_YEAR2038_RECOMMENDED if system doesn’t support 64-bit time_t.

AC_SYS_YEAR2038_RECOMMENDED causes configure to fail if we can’t find
a way to activate support for 64-bit time_t.  This makes its
mktests.pl test fail on systems that don’t support 64-bit time_t.
Switch to a hand-written test that’s skipped on those systems.
While I was in there I added slightly more testing of the closely
related macros AC_SYS_LARGEFILE and AC_SYS_YEAR2038.

While testing this change I noticed that AC_SYS_LARGEFILE and
AC_SYS_YEAR2038 malfunction if AC_LANG([C++]) is in effect.
The cause is too hairy to fix before the release; add a mention
to NEWS instead.  (Bug <https://savannah.gnu.org/support/index.php?110983>.)

* tests/mktests.pl: Exclude AC_SYS_LARGEFILE, AC_SYS_YEAR2038, and
  AC_SYS_YEAR2038_RECOMMENDED from automatic test generation.
* tests/semantics.at: Add manual tests of those macros.

18 months agoRevert "config.status: handle CRLF line endings in AC_CONFIG_HEADERS input"
Zack Weinberg [Mon, 18 Dec 2023 23:25:27 +0000 (18:25 -0500)] 
Revert "config.status: handle CRLF line endings in AC_CONFIG_HEADERS input"

Solaris 10 /usr/bin/awk doesn't implement sub().  Let's defer this
change until after the release and I have time to think about it
some more.

This reverts commit bfd3894367e4d1c36c514e02c62173cde157f06b.
This reopens bug <https://savannah.gnu.org/support/?110554>.

18 months agoFix AC_FUNC_MMAP on CheriBSD
Paul Eggert [Sat, 16 Dec 2023 02:21:39 +0000 (18:21 -0800)] 
Fix AC_FUNC_MMAP on CheriBSD

Problem reported by Brooks Davis in:
https://lists.gnu.org/r/autoconf/2023-12/msg00022.html
* lib/autoconf/functions.m4: Don’t unmap, since we
want to test remapping something already mapped,
and unmapping breaks on CheriBSD.

18 months agoClarify error messages for misuse of m4_warn and --help for -W.
Zack Weinberg [Fri, 15 Dec 2023 20:19:31 +0000 (15:19 -0500)] 
Clarify error messages for misuse of m4_warn and --help for -W.

m4_warn([category], [message]) passes its arguments directly to
Autom4te::Channels::msg.  If the category argument is not a recognized
“channel”, that function will crash and emit a *Perl* stack trace,
which makes it look like there’s something wrong with autoconf or
autom4te, rather than something wrong with the script.

Making matters worse, in autoconf 2.69, the manual said you could
use “all” and the empty string as the first argument to m4_warn.
As far as I can tell, neither of those was ever a valid message
channel, and the manual was corrected in 2.70, but we still got
a bug report from someone who tried it.

This patch makes us issue a nice helpful user error, instead of a
confusing internal error, when Autom4te::Channels::msg is called with
a bogus channel argument.  If the bogus channel is “all” or the empty
string, that error is demoted to a -Wobsolete warning.  If it is one
of the other special tokens recognized by -W, we customize the error
message, since someone might’ve thought that “none” being acceptable
to -W meant it was also acceptable to m4_warn.  The --help output for
autoconf, autoheader, autom4te, and autoreconf is also adjusted to
clarify that not all of the tokens recognized by -W count as
warning categories.

(Oddly enough, the lack of filtration at the autom4te level means
m4_warn([error], […]) actually does issue an error.  There’s no other
way to get exactly that effect — m4_errprintn(…)  and m4_fatal(…)
both do something a little different — so I I propose to leave that
alone for now and promote it to a proper, documented feature, probably
spelled m4_error(…), post-2.72.)

Channels.pm and ChannelDefs.pm are shared with Automake.  I believe
there is nothing you can write in a Makefile.am that will cause
Automake::Channels::msg to be called with an arbitrary user-supplied
channel argument, so these changes should have no visible effect on
that side of the fence.

Addresses <https://savannah.gnu.org/support/?110872>.

 * lib/Autom4te/Channels.pm (msg): If the channel argument is invalid,
   don’t crash; report the mistake and use the ‘syntax’ channel.
   (report_bad_channel): New function for reporting invalid channels.

 * lib/Autom4te/ChannelDefs.pm (usage): Clarify that the list of
   warning categories is exhaustive, and that “all”, “none”,
   “no-CATEGORY”, and “error” are not warning categories.

 * bin/autoconf.in, bin/autoheader.in, bin/autom4te.in,
   bin/autoreconf.in: Tweak --help text.

 * tests/m4sugar.at (m4@&t@_warn (bad categories)): New test.

18 months agoconfig.status: handle CRLF line endings in AC_CONFIG_HEADERS input
Zack Weinberg [Fri, 15 Dec 2023 15:59:38 +0000 (10:59 -0500)] 
config.status: handle CRLF line endings in AC_CONFIG_HEADERS input

On systems that normally use Unix line endings, if config.h.in has
somehow been generated with DOS line endings, then awk will treat
each CR character as part of the line.  This breaks the regular
expressions used to edit config.h.in into config.h

To fix, manually strip trailing CRs from each “input record” before
any other processing.  For consistency I also made this change to the
code dealing with AC_CONFIG_FILES substitutions.  On systems that use
DOS line endings, both changes should be no-ops.

Reported by David Allsopp in <https://savannah.gnu.org/support/?110554>.
He offered a different patch, which also worked on my machine, but it
used a regular expression as the third argument to ‘split’, which
might not be portable across awk implementations (the gawk manual is
unclear).  Also, it could produce a config.h with _inconsistent_ line
endings.

* lib/autoconf/status.m4 (_AC_OUTPUT_HEADERS_PREPARE): In the awk
  script, strip a trailing CR from each record as the first action.
  (_AC_OUTPUT_FILES_PREPARE): Likewise.
* tests/torture.at (CRLF line endings in .in files): New test.

Co-authored-by: David Allsopp <david@davidallsopp.com>
18 months agoAC_PROG_MKDIR_P: Fix detection of busybox mkdir.
Paul Eggert [Wed, 13 Dec 2023 13:48:15 +0000 (08:48 -0500)] 
AC_PROG_MKDIR_P: Fix detection of busybox mkdir.

Some versions of BusyBox mkdir respond to ‘mkdir --version’ by
printing “mkdir: unrecognized option: --version” to stderr, and then
the version message we’re looking for, also to stderr.  Adjust the
pattern matching in AC_PROG_MKDIR_P to account for this.

Problem reported by Valery Ushakov.
Resolves <https://savannah.gnu.org/support/?110971>.

* lib/autoconf/programs.m4 (AC_PROG_MKDIR_P): Fix detection of busybox mkdir.

18 months agoConsistently use block comments at beginning of C99 and C11 tests
Detlef Riekenberg [Sat, 3 Sep 2022 23:57:25 +0000 (01:57 +0200)] 
Consistently use block comments at beginning of C99 and C11 tests

Purely cosmetic improvement to the C standard version tests: Use /* */
comments above all three checks of __STDC__ and/or __STDC_VERSION__,
and make “// See if C++-style comments work” the very first // comment.

Resolves issue #110713.

* c.m4 (_AC_C_C99_TEST_GLOBALS, _AC_C_C11_TEST_GLOBALS):
  Improve stylistic consistency with _AC_C_C89_TEST_GLOBALS.
  Move explicit test of C++-style comments earlier.

18 months agoautom4te: Don’t crash if Data::Dumper::Sortkeys is unavailable.
Zack Weinberg [Mon, 11 Dec 2023 16:25:54 +0000 (11:25 -0500)] 
autom4te: Don’t crash if Data::Dumper::Sortkeys is unavailable.

Commit c2ab755698db245898a4cc89149eb5df256e4bd0 added an unconditional
use of Data::Dumper’s Sortkeys method, which was added in version
2.12_01 of that module.  In terms of Perl versions, it is available in
5.8.x and later, and in 5.6.2, but not in 5.6.1 or earlier. At the
time, our minimum Perl version was 5.10, but we lowered it to 5.6.0
again in 05e295b60cfdf378b7ed8c1f8563a5644d5d4689.  It seems that
commit was not actually tested with 5.6.1 or earlier.

As we are only using Sortkeys to facilitate manual comparison of
autom4te.cache/requests files, we can just ignore the method lookup
failure with 5.6.[01] and everything will work fine without it.

Tested on x86_64-unknown-netbsd9.3 with perl 5.6.1.

* lib/Autom4te/C4che.pm (marshall): Ignore method lookup failure for
  Data::Dumper::Sortkeys with very old perl.
* lib/Autom4te/Request.pm (marshall): Likewise.

19 months agoautom4te: report subsecond timestamp support in --version
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.

19 months agoBe more conservative about cache timestamps
Paul Eggert [Fri, 1 Dec 2023 17:58:37 +0000 (09:58 -0800)] 
Be more conservative about cache timestamps

* bin/autom4te.in (up_to_date): Fix thinko by using the
minimum of the cache files’ timestamps, not the maximum.

19 months agoTweak Annex K doc
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.

19 months ago* bin/autom4te.in: Fix comments.
Paul Eggert [Fri, 1 Dec 2023 17:34:39 +0000 (09:34 -0800)] 
* bin/autom4te.in: Fix comments.

19 months agotestsuite: log version of shell and make as well
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.

$ make check TESTSUITEFLAGS=1 SHELL=/bin/dash; grep dash tests/testsuite.log
../../tests/local.at:25: /bin/dash --version
/bin/dash: 0: Illegal option --

* tests/local.at: Add ${CONFIG_SHELL-$SHELL} and $MAKE to AT_TESTED.

19 months agoRecognize the *-*-windows* config triplets introduced on 2023-06-26.
Bruno Haible [Thu, 17 Aug 2023 13:44:05 +0000 (15:44 +0200)] 
Recognize the *-*-windows* config triplets introduced on 2023-06-26.

* lib/autoconf/fortran.m4 (_AC_FC_LIBRARY_LDFLAGS): Treat windows* as
equivalent to mingw*.
* lib/autoconf/functions.m4 (_AC_FUNC_MALLOC_IF, _AC_FUNC_REALLOC_IF):
Likewise.
* lib/autoconf/specific.m4 (_AC_SYS_LARGEFILE_PROBE): Likewise.

19 months agomaint: post-release administrivia
Zack Weinberg [Thu, 30 Nov 2023 21:24:50 +0000 (16:24 -0500)] 
maint: post-release administrivia

* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.

19 months agoRelease 2.72d [beta] v2.72d
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.

19 months agomake fetch
Zack Weinberg [Thu, 30 Nov 2023 15:53:09 +0000 (10:53 -0500)] 
make fetch

19 months agoRemove m4_file_append
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).

20 months agom4/m4.m4: Quote argument to AS_ECHO correctly.
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.

20 months agoautom4te: OS/2 compat: Do not attempt to chmod an open file.
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.

Co-authored-by: KO Myung-Hun <komh78@gmail.com>
22 months agoImprove INSTALL format
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

22 months agoMention ./bootstrap privacy implications
Paul Eggert [Wed, 16 Aug 2023 00:21:03 +0000 (17:21 -0700)] 
Mention ./bootstrap privacy implications

* doc/install.texi: Fix some problems noted by Gavin Smith in:
https://lists.gnu.org/r/autoconf/2023-08/msg00000.html

22 months agoFix _AC_LANG_IO_PROGRAM(C) to work with glibc 2.38 headers
Gleb Fotengauer-Malinovskiy [Tue, 15 Aug 2023 16:00:00 +0000 (16:00 +0000)] 
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.

See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109570 and
https://gcc.gnu.org/g:c9a19621a07e246385ae075b61283140b23c3b5a .

Tiny-change: yes

2 years agoShorten and improve INSTALL
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.

2 years agoINSTALL: Clarify --build, --host, --target, and the system types.
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.

2 years agodoc: fix broken cross-refs
Paul Eggert [Tue, 20 Jun 2023 20:39:15 +0000 (13:39 -0700)] 
doc: fix broken cross-refs