2
0
mirror of git://git.sv.gnu.org/autoconf synced 2025-04-18 15:30:24 +08:00

7024 Commits

Author SHA1 Message Date
Zack Weinberg
58e31c89cf 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.
2024-06-23 21:10:50 -04:00
Zack Weinberg
e75caa5ff1 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’).
2024-06-23 20:59:35 -04:00
Zack Weinberg
8b13394605 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.
2024-06-23 15:11:35 -04:00
Sevan Janiyan
b025a3cc37 doc/autoconf.texi (Systemology): Update Darwin.
Catch up with changes in Darwin since 2002 when the section was added.
2024-06-23 15:11:22 -04:00
KO Myung-Hun
7cdd728122 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'.
2024-06-23 13:39:16 -04:00
Paul Eggert
c5b83b2613 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.
2024-06-17 21:06:43 -07:00
Paul Eggert
7feeafdf2f 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.
2024-06-15 08:27:03 -07:00
Paul Eggert
e51e789ac9 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.
2024-06-01 09:08:01 -07:00
Paul Eggert
056518b94e 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.
2024-05-28 09:44:25 -07:00
Paul Eggert
f6522328c7 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.
2024-05-26 09:24:02 -07:00
Paul Eggert
e6c9cb69c8 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.
2024-05-26 07:18:32 -07:00
Alyssa Ross
605ba028a7 AC_FUNC_MALLOC: fix cross compilation to musl
This check returned yes for me on musl 1.2.3 on
aarch64-unknown-linux-musl.
2024-05-15 10:57:14 -04:00
Paul Eggert
02f232c671 Improve VLA wording in NEWS
Thanks to a suggestion by Werner Lemberg in:
https://lists.gnu.org/r/autoconf/2024-04/msg00009.html
2024-04-30 11:49:16 -07:00
Paul Eggert
76ac2c1d73 Mention C keywords in NEWS
Thanks to Alan Coopersmith for mentioning this in:
https://lists.gnu.org/r/autoconf/2024-04/msg00011.html
2024-04-30 11:42:01 -07:00
Paul Eggert
653956f446 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.
2024-04-30 10:33:37 -07:00
Paul Eggert
e9fee73dba 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.
2024-04-30 10:33:37 -07:00
Paul Eggert
75fe83f9d6 Fix doc typo with " {"
Problem reported by Brad Smith
<https://savannah.gnu.org/support/?111054>.
2024-04-30 10:33:37 -07:00
Paul Eggert
a6a47a2ff7 Adjust tests to match new Automake files
* tests/m4sugar.at (bad categories): Adjust test cases
to match changed behavior of files copied from Automake.
2024-04-25 09:14:23 -07:00
Paul Eggert
2ca664d96d make fetch 2024-04-25 09:14:23 -07:00
Paul Eggert
b711437385 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.
2024-04-24 14:48:17 -07:00
Paul Eggert
7a6347d1d7 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.
2024-04-06 13:01:50 -07:00
Paul Eggert
51dec81849 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.
2024-02-07 12:43:11 -08:00
Paul Eggert
163dade069 Document ‘cp’ limitations better
* doc/autoconf.texi (Limitations of Usual Tools):
Modernize discussion of ‘cp’.
2024-02-03 21:38:30 -08:00
Paul Eggert
3a813b3b2f Fix typo in previous patch 2024-01-16 21:20:03 -08:00
Paul Eggert
e5fae45ae3 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.
2024-01-16 20:20:36 -08:00
Paul Eggert
b553b19bff make fetch 2024-01-16 20:20:36 -08:00
Paul Eggert
d8f27addf9 doc: mention join bug
* doc/autoconf.texi: Mention BSD ‘join’ bug
<https://lists.gnu.org/r/bug-gnulib/2024-01/msg00028.html>.
2024-01-10 17:46:11 -08:00
Jim Meyering
9ae8d7f61f maint: update all copyright dates via "make update-copyright" 2024-01-05 09:11:48 -08:00
Zack Weinberg
d87b2ece37 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2023-12-22 13:45:16 -05:00
Zack Weinberg
6199cff290 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.
v2.72
2023-12-22 12:42:09 -05:00
Zack Weinberg
e544a32384 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.
2023-12-22 11:22:36 -05:00
Zack Weinberg
634fb3e729 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 ==.
2023-12-22 10:05:27 -05:00
Zack Weinberg
4fbe643660 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.
2023-12-22 09:56:44 -05:00
Zack Weinberg
8794cd1c25 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.
2023-12-22 09:48:30 -05:00
Zack Weinberg
e5d98f4c74 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.
2023-12-22 08:47:36 -05:00
Zack Weinberg
3fbfb13e7a 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.
2023-12-21 16:30:17 -05:00
Zack Weinberg
fdb58df6bb 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.
2023-12-21 12:14:56 -05:00
Zack Weinberg
ba087b38f8 update NEWS for 2.72e release candidate v2.72e 2023-12-20 09:19:43 -05:00
Zack Weinberg
115e38aee2 spelling errors reported by “make syntax-check” 2023-12-20 09:19:43 -05:00
Zack Weinberg
abe8af2047 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.
2023-12-19 16:13:43 -05:00
Zack Weinberg
9800e2e34a 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).
2023-12-19 13:55:27 -05:00
Zack Weinberg
226f37bdba 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.
2023-12-19 13:53:24 -05:00
Zack Weinberg
2d36f11a52 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>.
2023-12-18 18:25:27 -05:00
Paul Eggert
5d3f81d4b3 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.
2023-12-18 14:33:25 -05:00
Zack Weinberg
725652b0d8 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.
2023-12-18 14:13:58 -05:00
Zack Weinberg
bfd3894367 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>
2023-12-15 10:59:38 -05:00
Paul Eggert
dec7b457b6 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.
2023-12-13 08:54:58 -05:00
Detlef Riekenberg
ba719bedba 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 .

* 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.
2023-12-12 15:23:16 -05:00
Zack Weinberg
185d1db28b 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.
2023-12-11 11:40:11 -05:00
Zack Weinberg
39d96e6fff 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.
2023-12-06 15:57:05 -05:00