]> git.ipfire.org Git - thirdparty/autoconf.git/log
thirdparty/autoconf.git
2 years agoRemove the last few internal uses of AC_EGREP_CPP. zack/no-internal-egrep-cpp
Zack Weinberg [Mon, 3 Apr 2023 02:17:55 +0000 (22:17 -0400)] 
Remove the last few internal uses of AC_EGREP_CPP.

Most of the remaining uses were converted to AC_COMPILE_IFELSE.
The use in AC_FUNC_LOADAVG becomes an AC_PREPROC_IFELSE because
we can’t be sure getloadavg.c can be _compiled_ at this point in
the build.  The use in AC_C_VARARRAYS could be either _PREPROC_ or
_COMPILE_; we use _COMPILE_ because, _PREPROC_ is never used, then
we don’t have to do the “checking how to run the C preprocessor” test.

* lib/autoconf/c.m4 (AC_C_VARARRAYS): Use AC_COMPILE_IFELSE instead of
  AC_EGREP_CPP.
* lib/autoconf/headers.m4 (_AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H)
  (_AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL_H): Likewise.
* lib/autoconf/functions.m4 (AC_FUNC_GETLOADAVG): Use AC_PREPROC_IFELSE
  instead of AC_EGREP_CPP.

2 years agoFold AC_C_STRINGIZE into AC_PROG_CC.
Zack Weinberg [Mon, 3 Apr 2023 01:54:31 +0000 (21:54 -0400)] 
Fold AC_C_STRINGIZE into AC_PROG_CC.

Another of the last few uses of AC_EGREP_CPP is to check for the ISO C
“stringification” operator.  As this is a feature of C89, let’s fold
the test into the extensive C89 tests we already have, and make
AC_C_STRINGIZE just lean on AC_PROG_CC, in the same way
AC_C_PROTOTYPES does.

* lib/autoconf/c.m4 (_AC_C_C89_TEST_GLOBALS): Add test of preprocessor
  stringification and token pasting.
  (AC_C_STRINGIZE): Just check ac_prog_cc_stdc.

2 years agoOverhaul AC_TYPE_GETGROUPS and AC_FUNC_GETGROUPS.
Zack Weinberg [Sun, 2 Apr 2023 19:07:58 +0000 (15:07 -0400)] 
Overhaul AC_TYPE_GETGROUPS and AC_FUNC_GETGROUPS.

AC_TYPE_GETGROUPS is the last remaining use of AC_EGREP_HEADER in
stock Autoconf macros.  It uses it only when cross compiling, as a
fallback from an AC_RUN_IFELSE check, testing for a bug in system
headers from the late 1980s or early 1990s, where gid_t *existed*
but the second argument to getgroups needed to be an array of int,
and this didn’t cause a compile error (i.e. the system headers
declare getgroups with no prototype or an incorrect prototype).
AC_FUNC_GETGROUPS also uses AC_RUN_IFELSE to test for obscure
problems specific to long-obsolete Unixes.

The downsides of AC_RUN_IFELSE and AC_EGREP_HEADER seem more severe
than the chances of someone compiling a current-generation program,
that uses getgroups, on an OS old enough to have one of the really
nasty bugs.  Accordingly, this patch changes AC_FUNC_GETGROUPS to use
a host_os-based *blacklist* both in native and cross compilation.
This is limited to the two host_os values for which either our old
code, or Gnulib, documented a serious bug: ultrix* and nextstep*.
Currently it does not try to pin down the exact version ranges subject
to the bugs — that would require research by someone with access to
the full history of these OSes.

An incorrect guess by this blacklist can be overridden by setting
ac_cv_func_getgroups_works in config.site.  AC_TYPE_GETGROUPS, for its
part, now does a series of regular old AC_COMPILE_IFELSE checks to
probe the prototype of getgroups, and considers that good enough.

While I was in there I noticed that AC_FUNC_GETGROUPS does not
AC_SUBST a documented output variable, and that the name of this
variable is misspelled in the manual.

* lib/autoconf/functions.m4 (AC_FUNC_GETGROUPS): Use AC_SEARCH_LIBS
  to probe for getgroups.  Use an AC_CANONICAL_HOST-based blacklist
  for bug detection, not AC_RUN_IFELSE.  AC_SUBST the GETGROUPS_LIB
  output variable.
* lib/autoconf/types.m4 (AC_TYPE_GETGROUPS): Check only the prototype
  of getgroups, using AC_COMPILE_IFELSE; do not use either AC_RUN_IFELSE
  or AC_EGREP_HEADER.
* doc/autoconf.texi: Update to match. Correct misspelling of
  GETGROUPS_LIB.
* tests.local.at (_AT_CHECK_ENV): Allow GETGROUPS_LIB output variable.

2 years agoMake AC_PROG_GCC_TRADITIONAL a compatibility alias for AC_PROG_CC.
Zack Weinberg [Mon, 3 Apr 2023 01:03:30 +0000 (21:03 -0400)] 
Make AC_PROG_GCC_TRADITIONAL a compatibility alias for AC_PROG_CC.

This macro is one of the last remaining internal uses of AC_EGREP_CPP.
It has only ever done anything useful with GCC, and GCC dropped
support for ‘traditional’ compilation in version 3.3 (released 2003)
so I do not think it is worth trying to preserve.

* lib/autoconf/c.m4 (AC_PROG_GCC_TRADITIONAL): Make into a
  compatibility alias for AC_PROG_CC, similar to AC_PROG_CC_STDC.
* lib/autoconf/general.m4 (AC_EGREP_CPP): Remove stale comment.
* doc/autoconf.texi, NEWS: Document this change.
* tests/mktests.pl: Exclude AC_PROG_GCC_TRADITIONAL from
  autoupdate tests.

2 years agoAC_TYPE_UID_T: Rewrite using AC_CHECK_TYPE.
Zack Weinberg [Sun, 2 Apr 2023 14:43:51 +0000 (10:43 -0400)] 
AC_TYPE_UID_T: Rewrite using AC_CHECK_TYPE.

AC_TYPE_UID_T uses AC_EGREP_HEADER to search sys/types.h for
occurrences of the string ‘uid_t’ and, if found, assumes both
uid_t and gid_t are available.  This would be better done using
a pair of AC_CHECK_TYPE operations.

I also converted two uses of old-style AC_CHECK_TYPE, immediately
below, to new-style.  (There are probably other old-style uses in
this file, I only did the ones I happened to see.)

* lib/autoconf/types.m4 (AC_TYPE_UID_T): Check for uid_t and gid_t,
  separately, using AC_CHECK_TYPE, instead of grepping sys/types.h.
  (AC_TYPE_SIZE_T, AC_TYPE_SSIZE_T): Use new-style AC_CHECK_TYPE.

2 years agoAC_XENIX_DIR: Rewrite using AC_CANONICAL_HOST.
Zack Weinberg [Sun, 2 Apr 2023 14:27:08 +0000 (10:27 -0400)] 
AC_XENIX_DIR: Rewrite using AC_CANONICAL_HOST.

AC_XENIX_DIR is an obsolete macro, defined as AC_HEADER_DIRENT plus
code to make absolutely sure configure scripts that depended on a
shell variable internal to the original (2.13 era) definition of
AC_XENIX_DIR are not broken by autoupdate.  (That variable had the
temptingly public-sounding name “XENIX.”)  This compatibility code
uses AC_EGREP_CPP, which is itself discouraged for use in new
configure scripts.

(N.B. codesearch.debian.net does not find any uses whatsoever of
this macro, nor any code in an .ac or .m4 file that depends on the
XENIX variable.)

Change the compatibility code to use AC_CANONICAL_HOST instead,
and clarify which pieces of the code inserted by autoupdate are
probably still necessary.

* lib/autoconf/specific.m4 (AC_XENIX_DIR): Set XENIX variable
  based on value of host_os. Clarify what manual cleanup is
  recommended after autoupdate replaces this obsolete macro.

2 years agoNew script for building inside Guix containers.
Zack Weinberg [Thu, 30 Mar 2023 14:50:36 +0000 (10:50 -0400)] 
New script for building inside Guix containers.

build-aux/test-build-guix, goes with the top level manifest.scm.
See the top of the file for usage instructions.

2 years agoSupport underquoted callers better
Paul Eggert [Sun, 2 Apr 2023 03:25:13 +0000 (20:25 -0700)] 
Support underquoted callers better

Problem reported bh Khem Raj for mcpp 2.7.2 (2008) in:
https://lists.gnu.org/r/autoconf/2023-04/msg00001.html
* lib/autoconf/programs.m4 (_AC_PATH_PROG_FLAVOR_GNU):
Add two ‘@%:@(’s to cater to underquoted callers.
* lib/m4sugar/m4sh.m4 (_AS_PATH_WALK): Use quadrigraph instead of
‘#’, for underquoted callers.

2 years agoFix timing bug on high-speed builds
Paul Eggert [Sat, 1 Apr 2023 23:44:03 +0000 (16:44 -0700)] 
Fix timing bug on high-speed builds

Problem reported by Bogdan via Jacob Bachmeyer in:
https://lists.gnu.org/r/autoconf/2023-04/msg00002.html
* bin/autom4te.in: If a file timestamp equals a dependency’s
timestamp, consider the file to be out of date.  Although this may
result in extra work, it fixes some rare timing bugs.

2 years agoGo back to requiring only Perl 5.6+ for users
Paul Eggert [Fri, 31 Mar 2023 17:55:29 +0000 (10:55 -0700)] 
Go back to requiring only Perl 5.6+ for users

Commit 61901a1a14fd50c03cfb1529d091554376fef286 dated 2022-07-10
bumped the Perl requirement to 5.10 or later, because
commit 3a9802d60156809c139e9b4620bf04917e143ee2 dated 2021-08-31
added code using Time::HiRes’s ‘stat’ function, a feature
added in Perl 5.8.9+ or Perl 5.10+, and it was hard
to find Perl 5.8.9 hosts to test with.  Also, requiring Perl 5.10
meant that we could then use operators like Digest::SHA, the // and
//= operators, the regexp \K escape, and ‘state’ variables.

However, that Time::HiRes code, which was taken from Automake, has
recently been made optional by Automake, and it now works again with
Perl 5.6.  And Autoconf is not yet using any other post-5.6 feature,
except when developers run help-extract.pl (something Autoconf users
do not use).  So relax the Autoconf user requirement back to 5.6 as it
was in Autoconf 2.71; although Autoconf developers will need 5.10 or
better, Autoconf users can get by with 5.6.

I ran into this problem when testing the Autoconf release candidate on
Solaris 10, which has Perl 5.8.4.  Oracle says Solaris 10’s
end-of-life is January 2024, so it’s still (barely) a viable porting
target.  Of course with Solaris 10 one must install a recent-enough
GNU m4, but adding a requirement to also install a recent-enough Perl
is a new barrier, and if it’s not needed then it might be better to
wait until it is needed (or until 2024 arrives).

* NEWS: Update news item about Perl 5.6 vs 5.10.
* README-hacking: Bump Perl recommendation to 5.10.
* build-aux/fetch.pl: Do not munge imported code to require 5.10.

2 years agoCater to programs misusing AC_EGREP_HEADER
Paul Eggert [Fri, 31 Mar 2023 17:46:20 +0000 (10:46 -0700)] 
Cater to programs misusing AC_EGREP_HEADER

Problem reported by Frederic Berat in:
https://lists.gnu.org/archive/html/autoconf/2022-11/msg00127.html
* lib/autoconf/programs.m4 (AC_PROG_EGREP): Also set
EGREP_TRADITIONAL and ac_cv_path_EGREP_TRADITIONAL.
* tests/c.at (AC_PROG_EGREP and AC_EGREP_HEADER):
New test, taken from Frederic Berat’s email in:
https://lists.gnu.org/r/autoconf/2023-03/msg00043.html

2 years ago* NEWS: Tighten up wording.
Paul Eggert [Fri, 31 Mar 2023 17:37:57 +0000 (10:37 -0700)] 
* NEWS: Tighten up wording.

2 years agobuild: run "make fetch", which updated these:
Paul Eggert [Wed, 29 Mar 2023 19:59:09 +0000 (12:59 -0700)] 
build: run "make fetch", which updated these:

* build-aux/texinfo.tex: Update from texinfo.
* lib/Autom4te/FileUtils.pm: Update from automake.

2 years agomention prototypes more prominently in NEWS
Paul Eggert [Tue, 28 Mar 2023 01:10:36 +0000 (18:10 -0700)] 
mention prototypes more prominently in NEWS

* NEWS: Mention the function prototype issue early.
(From a suggestion by Zack Weinberg.)

2 years agotests: avoid an unwarranted test failure v2.72c
Jim Meyering [Mon, 27 Mar 2023 05:08:02 +0000 (22:08 -0700)] 
tests: avoid an unwarranted test failure

* tests/autotest.at (parallel autotest and signal handling): This
test would consistently fail due to an exit status of 0. That was
considered failure because the test required a SIGHUP-indicating
exit status. However, an status of 0 is perfectly fine, too, so
accept that.

2 years agobuild: run "make fetch", which updated these:
Jim Meyering [Sun, 26 Mar 2023 05:07:19 +0000 (22:07 -0700)] 
build: run "make fetch", which updated these:

Preparing to make a pre-release snapshot, update these:
* build-aux/announce-gen: Update from gnulib
* build-aux/gnupload: Likewise.
* build-aux/texinfo.tex: Update from texinfo.

2 years agoAdd experimental manifest.scm for testing Autoconf under guix shell.
Zack Weinberg [Mon, 13 Mar 2023 00:06:53 +0000 (20:06 -0400)] 
Add experimental manifest.scm for testing Autoconf under guix shell.

‘guix shell’ is a utility for constructing isolated environments
for development; I’ve put together a “manifest” stating the
build and test requirements for autoconf, starting from a git
checkout.

2 years agobootstrap: Use an absolute path for ACBOOTDIR.
Zack Weinberg [Sun, 12 Mar 2023 23:39:47 +0000 (19:39 -0400)] 
bootstrap: Use an absolute path for ACBOOTDIR.

If we use a relative path for ACBOOTDIR, Automake can’t tell the
difference between Autoconf’s configure script’s aclocal.m4
inclusions (…/m4/*.m4) and the guts of Autoconf
itself (…/lib/autoconf/*.m4) so it puts both of them into
$(am__aclocal_m4_deps).  This would be harmless, except that the
guts-of-Autoconf files are named *relative to $ACBOOTDIR*, which
means Make can’t find them later.  And this is why a build from a
clean git checkout always starts by regenerating aclocal.m4 and
configure again.

Using an absolute path for ACBOOTDIR gives automake enough of a clue
what’s going on (see the heuristic circa 5500 of current automake.in,
commented “Some modified versions of autoconf don’t use frozen files…”)
for it to produce the same value for $(am__aclocal_m4) that it would
if we were running an installed Autoconf.

2 years agoSkip all Autotest parallelism tests if using Guix’s bash.
Zack Weinberg [Sun, 12 Mar 2023 23:08:03 +0000 (19:08 -0400)] 
Skip all Autotest parallelism tests if using Guix’s bash.

It is not clear to me why, but the “parallel autotest and signal
handling” test malfunctions if the active shell is Guix bash.  I don’t
think it’s worth investigating in detail, considering I intend to
reimplement parallel autotest using the same technique that Automake’s
parallel test driver uses, i.e. make -j, which should eliminate this
entire class of problems.

2 years agoFix ‘make syntax-check’ complaints.
Zack Weinberg [Sun, 12 Mar 2023 20:59:27 +0000 (16:59 -0400)] 
Fix ‘make syntax-check’ complaints.

* cfg.mk (local-checks-to-skip): Add sc_unportable_grep_q, which has
  too many false positives to bother with; for instance, it triggers
  on autoconf.texi’s discussion of why grep -q is unportable, and on
  the code in maint.mk that implements the check!
  (old_NEWS_hash): Update for commit b751bf49496ea3f0054533cfd63f977640abb07a,
  which fixed spelling errors in old NEWS.

* doc/autoconf.texi: Remove a doubled word.
* lib/autoconf/programs.m4: Remove a space immediately before a tab.
* lib/m4sugar/m4sh.m4 (_AS_IF): Rephrase documentation to avoid saying
  “if IF-FALSE” which triggers the prohibit_doubled_word check.

2 years agodoc: improve AS_IF doc
Paul Eggert [Mon, 6 Feb 2023 05:48:15 +0000 (21:48 -0800)] 
doc: improve AS_IF doc

* doc/autoconf.texi: Improve documentation of AS_IF, AS_CASE, etc.
Clarify the advice about when AS_IF is needed, and follow that
advice in examples.

2 years agoUpdate doc slightly for C23.
Paul Eggert [Sun, 5 Feb 2023 03:11:23 +0000 (19:11 -0800)] 
Update doc slightly for C23.

2 years agoClarify NEWS
Paul Eggert [Fri, 3 Feb 2023 20:25:08 +0000 (12:25 -0800)] 
Clarify NEWS

* NEWS: Clarify recent items about AC_SYS_LARGEFILE_REQUIRED,
AC_SYS_YEAR2038_REQUIRED, AC_PROG_MKDIR_P. Reported by Bruno Haible in:
https://lists.gnu.org/r/bug-autoconf/2023-02/msg00005.html

2 years agomake fetch
Paul Eggert [Thu, 2 Feb 2023 23:07:36 +0000 (15:07 -0800)] 
make fetch

2 years agoImprove year-2038 documentation
Paul Eggert [Thu, 2 Feb 2023 21:18:24 +0000 (13:18 -0800)] 
Improve year-2038 documentation

* NEWS, doc/autoconf.texi (System Services):
Improve documentation for behavior of largefile and year-2038 support.
Say that in the current implementation, year-2038 support
requires largefile support.  Say that year-2038 support
matters only for GNU/Linux glibc 2.34+ on 32-bit x86 and ARM.
Prefer brevity when this does not hurt understandability;
for example, prefer active to passive voice.
Prefer “wider” to “larger” when talking about the number of
bits in an integer, as this terminology is more standard.
Tone down the wording in warnings about enabling year-2038 support,
use similar wording in warnings about enabling largefile support,
and warn also about disabling largefile and year-2038 support.
No need for @emph.  Also mention rlim_t.
Be a bit more careful about saying “2 GiB” rather than “2 GB”.
Mention that a future version of Autoconf might change
AC_SYS_LARGEFILE to default to --enable-year2038, since
something has gotta happen before 2038.
Coalesce descriptions of --enable-largefile and --enable-year2038
to simplify documentation.  Mention that the only system where
AC_SYS_LARGEFILE changes CC is IRIX and that these systems
are obsolete.  Say that ‘stat’ can fail due to time_t
overflow.  Say that you can’t portably print time_t with %ld.
Say that binary compatibilty problems also can occur when one
library is linking to amother; it’s not just apps vs libraries.
Mention the possibility of modifying libraries to support both
32- and 64-bit interfaces.  Warn more consistently about
ABI compatibility issues, but put the bulk of this text
in one location that the other locations refer to.

2 years agoRestore lib/Autom4te/FileUtils.pm local fixes
Paul Eggert [Sat, 21 Jan 2023 07:15:19 +0000 (01:15 -0600)] 
Restore lib/Autom4te/FileUtils.pm local fixes

These were lost by 'make fetch'.

2 years agospelling fixes
Paul Eggert [Sat, 21 Jan 2023 06:54:33 +0000 (00:54 -0600)] 
spelling fixes

2 years agomake update-copyright
Paul Eggert [Sat, 21 Jan 2023 05:35:08 +0000 (23:35 -0600)] 
make update-copyright

2 years agomake fetch
Paul Eggert [Sat, 21 Jan 2023 05:35:08 +0000 (23:35 -0600)] 
make fetch

2 years agoImprove OS version commentary
Paul Eggert [Fri, 30 Dec 2022 20:47:53 +0000 (12:47 -0800)] 
Improve OS version commentary

* lib/autoconf/specific.m4: Improve comments about which
OS releases need -D_LARGE_FILES, -n32, _ALL_SOURCE.

2 years agoRestore *_REQUIRED macros
Paul Eggert [Thu, 29 Dec 2022 07:37:42 +0000 (23:37 -0800)] 
Restore *_REQUIRED macros

As per:
https://lists.gnu.org/r/autoconf-patches/2022-12/msg00004.html

2 years agofix AC_CHECK_HEADER_STDBOOL regression
Todd C. Miller [Mon, 26 Dec 2022 17:35:39 +0000 (10:35 -0700)] 
fix AC_CHECK_HEADER_STDBOOL regression

Commit 6dcecb780a69bd208088d666b299e92aa7ae7e80 "Port
AC_CHECK_HEADER_STDBOOL to C23" causes AC_CHECK_HEADER_STDBOOL to
always fail, even on systems with a conforming stdbool.h.

There is no longer an 'a' variable so it should not be referenced
in the return statement.

Copyright-paperwork-exempt: yes

2 years agoOmit just-added *_REQUIRED macros
Paul Eggert [Sun, 25 Dec 2022 07:24:54 +0000 (23:24 -0800)] 
Omit just-added *_REQUIRED macros

They are not needed for Gnulib, and users have an easy way to get
their effect, so for now omit them and just document the easy way.
Also, redo documentation to make it clear that AC_YEAR_2038 is
like AC_SYS_LARGEFILE except with a different year-2038 default.
* NEWS, doc/autoconf.texi: Document the above.
* lib/autoconf/specific.m4 (AC_SYS_YEAR2038_REQUIRED):
(AC_SYS_LARGEFILE_REQUIRED): Remove.  Remove some support code.
Perhaps further simplification could be done but I quit while
I was ahead.

2 years agoAC_SYS_LARGEFILE: Don’t enlarge time_t by default
Zack Weinberg [Sun, 25 Dec 2022 07:24:51 +0000 (23:24 -0800)] 
AC_SYS_LARGEFILE: Don’t enlarge time_t by default

Having AC_SYS_LARGEFILE enlarge time_t means that any program that has
already requested large file support will be abruptly migrated to
64-bit time_t (on 32-bit systems) as soon as its configure script is
regenerated with a sufficiently new Autoconf.  We’ve received reports
of several widely used programs and libraries that are not prepared
for this migration, with breakage ranging from annoying (garbage
timestamps in messages) through serious (binary compatibility break
in security-critical shared library) to catastrophic (on-disk data
corruption).

Partially revert f6657256a37da44c987c04bf9cd75575dfca3b60: in the
absence of AC_SYS_YEAR2038, AC_SYS_LARGEFILE will now only add an
--enable-year2038 command line option to configure.  If this option is
used, time_t will be enlarged, allowing people to experiment with the
migration without needing to *edit* the configure script in question,
only regenerate it.

In the process, AC_SYS_LARGEFILE and AC_SYS_YEAR2038 were drastically
overhauled for modularity; it should now be much easier to add support
for platforms that offer large off_t / time_t but not with the standard
feature selection macros.  Also, new macros AC_SYS_LARGEFILE_REQUIRED and
AC_SYS_YEAR2038_REQUIRED can be used by programs for which large off_t /
time_t are essential.

The implementation is a little messy because it needs to gracefully
handle the case where AC_SYS_LARGEFILE and AC_SYS_LARGEFILE_REQUIRED
are both used in the same configure script — or, probably more common,
AC_SYS_LARGEFILE (which invokes _AC_SYS_YEAR2038_OPT_IN) followed by
AC_SYS_YEAR2038 — but if macro B is invoked after macro A, there’s no
way for B to change *what macro A expanded to*.  The best kludge I
managed to find is to AC_CONFIG_COMMANDS_PRE as a m4-level hook that
sets shell variables in an early diversion.

* lib/autoconf/functions.m4 (AC_FUNC_FSEEKO): Rewrite to avoid dependency
  on internal subroutines of AC_SYS_LARGEFILE.

* lib/autoconf/specific.m4 (_AC_SYS_YEAR2038_TEST_INCLUDES): Renamed to
  _AC_SYS_YEAR2038_TEST_CODE.
  (_AC_SYS_YEAR2038): Refactor into subroutines: _AC_SYS_YEAR2038_OPTIONS,
  _AC_SYS_YEAR2038_PROBE, _AC_SYS_YEAR2038_ENABLE.
  (AC_SYS_YEAR2038): Update for refactoring.
  (_AC_SYS_YEAR2038_OPT_IN): New sorta-top-level macro, for use by
  AC_SYS_LARGEFILE, that probes for large time_t only if the
  --enable-year2038 option is given.
  (AC_SYS_YEAR2038_REQUIRED): New top-level macro that insists on
  support for large time_t.

  (_AC_SYS_LARGEFILE_TEST_INCLUDES): Renamed to _AC_SYS_LARGEFILE_TEST_CODE.
  (_AC_SYS_LARGEFILE_MACRO_VALUE, AC_SYS_LARGEFILE): Refactor along same
  lines as above: _AC_SYS_LARGEFILE_OPTIONS, _AC_SYS_LARGEFILE_PROBE,
  _AC_SYS_LARGEFILE_ENABLE.  Invoke _AC_SYS_YEAR2038_OPT_IN at end of
  _AC_SYS_LARGEFILE_PROBE.  MinGW-specific logic moved to YEAR2038
  macros as it has nothing to do with large file support.
  (AC_SYS_LARGEFILE_REQUIRED): New top-level macro that insists on
  support for large off_t.

* tests/local.at (_AT_CHECK_ENV): Also allow changes in CPPFLAGS,
  enableval, enable_*, withval, with_*.

* doc/autoconf.texi, NEWS: Update documentation to match above changes.
  Fix typo in definition of @dvarv.

2 years agoMove NEWS entry to better location
Paul Eggert [Sun, 25 Dec 2022 07:15:56 +0000 (23:15 -0800)] 
Move NEWS entry to better location

2 years agoDocument C23 <stdckdint.h>
Paul Eggert [Sat, 24 Dec 2022 22:38:16 +0000 (14:38 -0800)] 
Document C23 <stdckdint.h>

2 years agoUse UTF-8 and spell "François" correctly
Paul Eggert [Sat, 24 Dec 2022 22:09:05 +0000 (14:09 -0800)] 
Use UTF-8 and spell "François" correctly

2 years agoAC_USE_SYSTEM_EXTENSIONS now enables C23 Annex F
Paul Eggert [Sat, 24 Dec 2022 21:41:23 +0000 (13:41 -0800)] 
AC_USE_SYSTEM_EXTENSIONS now enables C23 Annex F

* lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS):
Also define __STDC_WANT_IEC_60559_EXT__, for C23.

2 years agoCater better to underquoted callers
Paul Eggert [Wed, 16 Nov 2022 18:19:43 +0000 (10:19 -0800)] 
Cater better to underquoted callers

Problem reported by Frederic Berat in:
https://lists.gnu.org/r/autoconf/2022-11/msg00092.html
* lib/autoconf/c.m4 (AC_LANG_CALL(C)): Omit comma in comment,
which triggers bugs in underquoted callers.

2 years agoFix misspelled NEWS entry
Bruno Haible [Sat, 12 Nov 2022 16:06:36 +0000 (11:06 -0500)] 
Fix misspelled NEWS entry

2 years agoModernize and regularize doc for C89 etc.
Paul Eggert [Fri, 11 Nov 2022 08:28:49 +0000 (00:28 -0800)] 
Modernize and regularize doc for C89 etc.

In documentation and comments, prefer the more-common “C89” to the
equivalent “C90”, and use 2-digit years for C standards as that’s
common usage.  Remove some confusing old doc for pre-C89 systems,
as Autoconf assumes C89 or later.  Mention C17 and C23 briefly.
Improve doc for malloc, realloc.

2 years agoMore fixes for compilers that reject K&R function definitions.
Zack Weinberg [Thu, 10 Nov 2022 17:05:30 +0000 (12:05 -0500)] 
More fixes for compilers that reject K&R function definitions.

This fixes all of the remaining failures exposed by running the
testsuite with GCC 12 and
CC='cc -Wimplicit-function-declaration -Wold-style-definition
       -Wimplicit-int -Werror'
.

* lib/autoconf/c.m4 (_AC_C_C89_TEST_GLOBALS): Don’t use K&R function
  definitions.
* lib/autoconf/specific.m4 (AC_SYS_RESTARTABLE_SYSCALLS): Likewise.
  (AC_FUNC_MKTIME): Declare functions taking no arguments as ‘fn (void)’
  not ‘fn ()’.
* lib/autoconf/c.m4 (_AC_C_C99_TEST_GLOBALS): Declare free().

2 years agoWarn about TMPDIR
Paul Eggert [Fri, 28 Oct 2022 22:19:16 +0000 (15:19 -0700)] 
Warn about TMPDIR

* doc/autoconf.texi (Initialization Macros): Warn about
setting TMPDIR, following up on this Paul Smith remark:
https://lists.gnu.org/r/autoconf/2022-10/msg00024.html

2 years agoMKDIR_P now falls back on mkdir -p
Paul Eggert [Wed, 12 Oct 2022 19:01:50 +0000 (12:01 -0700)] 
MKDIR_P now falls back on mkdir -p

* lib/autoconf/programs.m4 (AC_PROG_MKDIR_P):
Fall back on mkdir -p instead of on a relative path to
install-sh, as the latter now seems to be more of a problem
than the former.

2 years agoUpdate M4 version numbers in documentation
Paul Eggert [Thu, 6 Oct 2022 01:06:20 +0000 (18:06 -0700)] 
Update M4 version numbers in documentation

2 years agoFix testsuite failures with bash 5.2.
Xi Ruoyao [Fri, 30 Sep 2022 15:36:03 +0000 (11:36 -0400)] 
Fix testsuite failures with bash 5.2.

Bash v5.2 includes several new optimizations to the number of
subshells used for various constructs; as a side effect, the value of
SHLVL is less stable than it used to be.  Add SHLVL to the list of
built-in shell variables with unstable values, to be ignored when
checking for inappropriate differences to the shell environment
before and after a macro invocation / between two configure runs.

Problem and solution reported by Xi Ruoyao in
https://lists.gnu.org/archive/html/autoconf/2022-09/msg00015.html
Problem also reported by Bruce Dubbs in
https://lists.gnu.org/archive/html/bug-autoconf/2022-09/msg00010.html

* tests/local.at (_AT_CHECK_ENV, AT_CONFIG_CMP): Ignore changes in
  value of SHLVL.
Copyright-paperwork-exempt: yes

2 years agoMention latest change in NEWS
Paul Eggert [Sun, 18 Sep 2022 18:52:04 +0000 (11:52 -0700)] 
Mention latest change in NEWS

2 years agoImprove comment in previous change
Paul Eggert [Sun, 18 Sep 2022 02:43:46 +0000 (19:43 -0700)] 
Improve comment in previous change

2 years agoAllow users to clear BINSH
Paul Eggert [Sun, 18 Sep 2022 02:43:04 +0000 (19:43 -0700)] 
Allow users to clear BINSH

Problem and solution reported by Roger Crew in:
https://lists.gnu.org/r/bug-autoconf/2022-09/msg00005.html
* lib/m4sugar/m4sh.m4 (_m4_divert(BINSH)): Change from 0 to 1,
and add 2 to HEADER-REVISION, HEADER-COMMENT, HEADER-COPYRIGHT,
M4SH-SANITIZE, M4SH-INIT-FN, and M4SH-INIT.
Copyright-paperwork-exempt: yes

2 years agoautoconf: store autom4te request keys in sorted order
Sergei Trofimovich [Fri, 9 Sep 2022 22:04:02 +0000 (17:04 -0500)] 
autoconf: store autom4te request keys in sorted order

Notced unstable key order when debugging unrelated bug.
Data::Dumper's SortKeys() makes ordering stable and decreases
diffs from run to run. No functional change otherwise.

* lib/Autom4te/C4che.pm
* lib/Autom4te/Request.pm: Sort request keys in serialization.

Copyright-paperwork-exempt: yes

2 years agoPort to GNU make 4.4
Paul Eggert [Fri, 9 Sep 2022 21:54:11 +0000 (16:54 -0500)] 
Port to GNU make 4.4

* cfg.mk (PATH): Assign eagerly, and simplify shell use, avoiding
use of the shell entirely if PWD is set, as it should be.
Problem reported by Sergei Trofimovich in:
https://lists.gnu.org/r/autoconf-patches/2022-09/msg00007.html

2 years agoPort to compilers that moan about K&R func decls
Paul Eggert [Thu, 1 Sep 2022 21:19:50 +0000 (16:19 -0500)] 
Port to compilers that moan about K&R func decls

* lib/autoconf/c.m4 (AC_LANG_CALL, AC_LANG_FUNC_LINK_TRY):
Use '(void)' rather than '()' in function prototypes, as the latter
provokes fatal errors in some compilers nowadays.
* lib/autoconf/functions.m4 (AC_FUNC_STRTOD):
* tests/fortran.at (AC_F77_DUMMY_MAIN usage):
* tests/semantics.at (AC_CHECK_DECLS):
Don’t use () in a function decl.

2 years agoRemove obsolete Solaris info from manual
Paul Eggert [Thu, 25 Aug 2022 19:21:09 +0000 (14:21 -0500)] 
Remove obsolete Solaris info from manual

Don't mention anything about Solaris 9 or older,
as Oracle no longer supports those old versions
and the obsolete info merely clutters the manual.

2 years agoImprove doc for AC_SYS_LARGEFILE etc.
Paul Eggert [Thu, 18 Aug 2022 22:20:06 +0000 (15:20 -0700)] 
Improve doc for AC_SYS_LARGEFILE etc.

2 years agoPort AC_CHECK_HEADER_STDBOOL to C23
Paul Eggert [Sun, 14 Aug 2022 02:38:54 +0000 (19:38 -0700)] 
Port AC_CHECK_HEADER_STDBOOL to C23

Modernize the bool documentation a bit too.
* lib/autoconf/headers.m4 (AC_CHECK_HEADER_STDBOOL):
Allow C23 too.

2 years agoAC_SYS_LARGEFILE now widens time_t if possible
Paul Eggert [Mon, 8 Aug 2022 21:20:41 +0000 (14:20 -0700)] 
AC_SYS_LARGEFILE now widens time_t if possible

This change is taken from Gnulib, and is needed for apps like GDB.
* lib/autoconf/specific.m4 (_AC_SYS_YEAR2038_TEST_INCLUDES)
(_AC_SYS_YEAR2038, AC_SYS_YEAR2038): New macros, taken (with
renaming) from Gnulib.
(_AC_SYS_LARGEFILE_MACRO_VALUE): #undef before #define.
(AC_SYS_LARGEFILE): Prefer AS_IF and AS_CASE to doing it by hand.
Widen time_t if possible, too.  Define  __MINGW_USE_VC2005_COMPAT
early if needed.

2 years agoFix compilation errors in 32-bit C++ mode on HP-UX 11/ia64
Paul Eggert [Mon, 8 Aug 2022 16:08:20 +0000 (09:08 -0700)] 
Fix compilation errors in 32-bit C++ mode on HP-UX 11/ia64

This should render unnecessary Gnulib’s gl_SET_LARGEFILE_SOURCE hack
https://lists.gnu.org/r/bug-gnulib/2019-12/msg00046.html
* lib/autoconf/functions.m4 (AC_FUNC_FSEEKO):
On that platform, simply set _LARGEFILE_SOURCE.

3 years agoPort AC_C_BIGENDIAN to cross gcc -std=c11 -flto
Paul Eggert [Wed, 27 Jul 2022 15:53:35 +0000 (08:53 -0700)] 
Port AC_C_BIGENDIAN to cross gcc -std=c11 -flto

* lib/autoconf/c.m4 (AC_C_BIGENDIAN): Improve the
inherently-unportable grep trick well enough to survive gcc
-std=c11 -flto when cross-compiling (sr#110687).

3 years agobasename and dirname are portable now
Paul Eggert [Thu, 21 Jul 2022 19:49:50 +0000 (12:49 -0700)] 
basename and dirname are portable now

* doc/autoconf.texi (Limitations of Usual Tools):
basename and dirname are portable shell commands now.

3 years agoHandle z/OS Unix ‘set’ output
Paul Eggert [Thu, 14 Jul 2022 19:24:20 +0000 (12:24 -0700)] 
Handle z/OS Unix ‘set’ output

Problem and fix reported by Jeff Shimoda in:
https://lists.gnu.org/r/autoconf-patches/2022-06/msg00007.html
* tests/local.at (AT_CONFIG_CMP): Treat ‘var=""’ like ‘var=''’.
Copyright-paperwork-exempt: Yes

3 years agoFix testsuite failures on Darwin (aka macOS).
Zack Weinberg [Sun, 10 Jul 2022 16:06:11 +0000 (12:06 -0400)] 
Fix testsuite failures on Darwin (aka macOS).

Tests of AC_{CHECK_,}HEADER_STDBOOL were failing on Darwin for two
reasons: an m4 quoting bug in tests/local.at causing Darwin sed to
throw syntax errors, and an excessively precise interpretation of how
C99 and C++11 interact.  The latter is worth mentioning in NEWS.

 * tests/local.at (_AT_DEFINES_CMP_PRUNE): Insert [] before ‘dnl’ in
   two places to keep it separate from the result of the m4_bpatsubsts
   operation that immediately precedes it.
 * lib/autoconf/headers.m4 (AC_CHECK_HEADER_STDBOOL): Allow ‘bool’,
   ‘true’, and ‘false’ not to be macros, after including stdbool.h,
   whenever __cplusplus is defined.
 * NEWS: Document change to AC_{CHECK_,}HEADER_STDBOOL.

3 years agoMake help-extract.pl work with Perl 5.10.x.
Zack Weinberg [Sun, 10 Jul 2022 15:47:45 +0000 (11:47 -0400)] 
Make help-extract.pl work with Perl 5.10.x.

The main issue was use of s///r; the /r modifier was added in 5.14.
Since the baseline is now 5.10.0 instead of 5.6.0, a couple places
can be tidied up using slightly newer constructs.

* help-extract.pl: Use File::Spec::Functions instead of File::Spec
  for reduced clunkiness.
  (eval_qq_no_interpolation): Don’t use s///r.  Do use \K and (?=...)
  to match the empty string (but only in just the right locations),
  so we don’t need to use $& in the replacement.
  (main): Don’t use s///r.

3 years agoRemove ancient backward compatibility code from m4/m4.m4.
Zack Weinberg [Sun, 10 Jul 2022 15:42:25 +0000 (11:42 -0400)] 
Remove ancient backward compatibility code from m4/m4.m4.

We have had AC_PREREQ([2.69]) in our own configure.ac since 2021,
and before that it was AC_PREREQ([2.62]) since 2012, so backcompat
code for 2.61 is not necessary anymore.

Also add logging of the name of each candidate executable and bump the
serial number.

3 years agomake fetch
Zack Weinberg [Sun, 10 Jul 2022 15:40:50 +0000 (11:40 -0400)] 
make fetch

Our local patches to lib/Autom4te/FileUtils.pm and maint.mk were
manually reapplied.

3 years agoRequire Perl 5.10.0 or later.
Zack Weinberg [Sun, 10 Jul 2022 14:52:33 +0000 (10:52 -0400)] 
Require Perl 5.10.0 or later.

The minimum Perl version was raised to 5.8.0 from 5.6.0 in commit
3a9802d60156809c139e9b4620bf04917e143ee2 (but not documented as
such until e8c2d79ec42c70b6e4fa282bc0c024bf42f0585f, and not
actually *enforced* by our own configure script until, er, now)
in order to use Time::HiRes::stat.

Unfortunately, while the Time::HiRes *module* was added in 5.8.0, it
did not export a ‘stat’ function until 5.8.9.  More precisely, this
feature was added to Time::HiRes in version 1.92 of that module; Perl
core 5.8.8 shipped Time::HiRes 1.86, 5.8.9 shipped 1.9715.  The only
system I have convenient access to, that has older Perls installed,
offers me a choice of 5.8.8 or 5.10.1, so the new requirement means
I cannot test with 5.8.x anymore.

Per https://perldoc.perl.org/perlhist the release history of these
versions of Perl is, in chronological order,

  5.8.0         2002-Jul-18
  5.8.8         2006-Jan-31
  5.10.0        2007-Dec-18
  5.8.9         2008-Dec-14  <-- almost a year later than 5.10.0
  5.10.1        2009-Aug-22
  5.12.0        2010-Apr-12

Per https://perldoc.perl.org/perl5101delta the differences between
5.10.0 and 5.10.1 are small, and do not make me worry about
accidentally introducing code that works on my test boxes but not for
our users, unlike the gulf between 5.8.x and 5.10.x.

Requiring 5.10 will mean that we have access to Digest::SHA, the //
and //= operators, the regexp \K escape, and ‘state’ variables
(lexical scope, persistent value) all of which I can think
of uses for (but none of them are actually used in this patch).

Putting it all together, I think a requirement bump to version 5.10.0
is justified.  We are already chopping off the trailing edge at 2006
due to the requirement for M4 1.4.8 (/de facto/ since 2.70) and late
2007 is still 15 years ago.

This patch also makes configure search $PATH for executables named
‘perl5*’ and ‘perl-5.*’ if bare ‘perl’ is too old.  To do this, it
introduces a helper macro AClocal_PATH_PROG_GLOBS_FEATURE_CHECK, which
I would *like* to promote to a new Autoconf feature, but I got stuck
on quoting issues — see comments in m4/perl-time-hires.m4.

* NEWS: Document requirement for Perl 5.10.
* m4/perl-time-hires.m4: New file.
* configure.ac: Use AC_PATH_PERL_WITH_TIME_HIRES_STAT to probe for
  perl.
* build-aux/fetch.pl (fetch): For .pm files fetched from Automake,
  rewrite “use 5.006” to “use 5.010”.

* build-aux/help-extract.pl
* lib/Autom4te/C4che.pm
* lib/Autom4te/ChannelDefs.pm
* lib/Autom4te/Channels.pm
* lib/Autom4te/Config.pm
* lib/Autom4te/Configure_ac.pm
* lib/Autom4te/FileUtils.pm
* lib/Autom4te/General.pm
* lib/Autom4te/Getopt.pm
* lib/Autom4te/Request.pm
* lib/Autom4te/XFile.pm
* tests/mktests.pl: Change “use 5.006” to “use 5.010”.

3 years agoRequire GNU M4 1.4.8 or later.
Zack Weinberg [Wed, 6 Jul 2022 20:11:43 +0000 (16:11 -0400)] 
Require GNU M4 1.4.8 or later.

The former minimum version was 1.4.6.  1.4.6 and 1.4.7 do not track
the original location of text fed to ‘m4wrap’, which breaks autom4te’s
ability to trace macros invoked from _AC_FINALIZE.

Right now, the only _user_ visible effect of this is that autoconf
running on M4 1.4.6 or 1.4.7 will emit an internal error, instead of
the intended warning message, when it processes a configure.ac that
neglects to invoke AC_INIT or AC_OUTPUT.  Perhaps more importantly,
it causes a bunch of scary-sounding failures in our own testsuite,
which deliberately doesn’t use AC_OUTPUT sometimes.

M4 1.4.6 and 1.4.7 also have bugs in location tracking of macro
invocations spread over multiple lines, which, guess what, causes
even more testsuite failures.

1.4.8 came out in 2006.  As a practical matter, this change to our
requirements means that people using macOS *to run autoconf* (not just
to run generated configure scripts) cannot use the system-provided m4
anymore.  {Free,Net,Open}BSD already don’t ship GNU M4 as their system
m4, so users of those OSes should not be affected.

3 years agotestsuite: Handle `balanced ASCII quotes' correctly in m4 errors.
Zack Weinberg [Wed, 6 Jul 2022 20:05:42 +0000 (16:05 -0400)] 
testsuite: Handle `balanced ASCII quotes' correctly in m4 errors.

AT_CHECK_M4 was _documented_ to convert

   m4: cannot open `foo': No such file or directory

to

   m4: cannot open 'foo': No such file or directory

but the regexp that was supposed to do this didn’t work.

Fix the regexp, and remove a workaround for the bug in one test
(yes, we had code in our own testsuite to work around bugs in our
own testsuite!)

* tests/local.at (AT_CHECK_M4): Fix regex for “cannot open” messages.
* tests/tools.at (autom4te cache): Remove workaround for buggy regex
  in AT_CHECK_M4.

3 years agoPort _AC_COMPILER_EXEEXT to IBM z/OS Unix
Paul Eggert [Tue, 28 Jun 2022 22:46:33 +0000 (17:46 -0500)] 
Port _AC_COMPILER_EXEEXT to IBM z/OS Unix

Problem reported by Jeff Shimoda in:
https://lists.gnu.org/r/autoconf-patches/2022-06/msg00001.html
* lib/autoconf/lang.m4 (_AC_COMPILER_EXEEXT):
Also remove conftest.o and conftest.obj.
We can't use $ac_objext as it might not be defined yet.

3 years agoAvoid \] in BREs and EREs
Paul Eggert [Tue, 28 Jun 2022 22:26:07 +0000 (17:26 -0500)] 
Avoid \] in BREs and EREs

* bootstrap (PACKAGE_NAME, PACKAGE_BUGREPORT):
* lib/autoconf/status.m4 (AC_OUTPUT_MAKE_DEFS):
* maint.mk (longopt_re, gpg_key_ID):
* tests/m4sugar.at (m4_dumpdef):
Avoid \] in POSIX-specified regular expressions, as POSIX says \]
produces undefined results in BREs and EREs.

3 years agoRefactor recent AC_FUNC_ALLOCA fix
Paul Eggert [Tue, 28 Jun 2022 22:10:53 +0000 (17:10 -0500)] 
Refactor recent AC_FUNC_ALLOCA fix

* lib/autoconf/functions.m4 (AC_FUNC_ALLOCA): Simplify and use
AS_IF.  Had I done it this way originally I would have avoided the
bug that Jim just fixed.

3 years agoAC_FUNC_ALLOCA: fix a misplaced (now fatal) closing "fi"
Jim Meyering [Mon, 27 Jun 2022 05:38:04 +0000 (22:38 -0700)] 
AC_FUNC_ALLOCA: fix a misplaced (now fatal) closing "fi"

"autoconf quoting is a pain"
* lib/autoconf/functions.m4 (AC_FUNC_ALLOCA): Its AC_CACHE_CHECK
contains an if/else block, but the closing "fi" lay just after its ")".
Before, this error didn't trigger any failure because the if/else code was
in the "else" block of AC_CACHE_CHECK's AS_IF invocation and AS_IF was also
implemented using an if..fi block. So the ostensibly-"outer" "fi" provided
by AS_IF matched the inner "if/else", and that stray-after-end "fi" served
to close the AS_IF block. However, when AS_IF switched from if..fi to
case..esac, this became a nesting error: no matching "fi".
Initially-harmless error introduced by v2.69-52-gfd29dbd7 in 2012.
Error exposed by v2.72a-30-gc8d6d6eb.
* tests/mktests.pl (scan_m4_files): Do not elide direct test
of AC_FUNC_ALLOCA.

FTR, here's the list of macros whose direct tests were being suppressed:
AC_CANONICAL_BUILD AC_CANONICAL_HOST AC_CANONICAL_TARGET
AC_CHECK_INCLUDES_DEFAULT AC_DISABLE_OPTION_CHECKING
AC_ERLANG_NEED_ERL AC_ERLANG_NEED_ERLC AC_ERLANG_SUBST_ERTS_VER
AC_ERLANG_SUBST_INSTALL_LIB_DIR AC_ERLANG_SUBST_LIB_DIR AC_F77_DUMMY_MAIN
AC_F77_LIBRARY_LDFLAGS AC_FC_DUMMY_MAIN AC_FC_LIBRARY_LDFLAGS
AC_FUNC_ALLOCA AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK AC_GNU_SOURCE
AC_HEADER_DIRENT AC_HEADER_SYS_WAIT AC_PATH_X AC_PROG_CPP AC_PROG_CXX
AC_PROG_CXXCPP AC_PROG_F77 AC_PROG_FC AC_PROG_GO AC_PROG_GREP
AC_PROG_OBJC AC_PROG_OBJCPP AC_PROG_OBJCXX AC_PROG_OBJCXXCPP
AC_STRUCT_TM AC_TYPE_GETGROUPS AC_TYPE_LONG_LONG_INT AC_TYPE_MBSTATE_T
AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_UID_T AC_TYPE_UNSIGNED_LONG_LONG_INT
AC_USE_SYSTEM_EXTENSIONS

3 years agotests: avoid test failures due to new EGREP_TRADITIONAL
Jim Meyering [Sun, 26 Jun 2022 22:37:51 +0000 (15:37 -0700)] 
tests: avoid test failures due to new EGREP_TRADITIONAL

Some tests require that filtered pre- and post-test
environments be identical. The filtering removes assignments
to known (set-by-test) envvar names, like GREP, SED, YACC.
* tests/local.at (_AT_CHECK_ENV): Also filter out assignments to
EGREP_TRADITIONAL, added in v2.72a-35-g0c762675.

3 years agoImprove regex documentation
Paul Eggert [Wed, 22 Jun 2022 05:02:12 +0000 (00:02 -0500)] 
Improve regex documentation

* doc/autoconf.texi (Running the Preprocessor)
(Limitations of Usual Tools):
Improve comments on limitations of regular expressions.

3 years agoFix bug: AC_EGREP_CPP with leading '-' in pattern
Paul Eggert [Sun, 5 Jun 2022 21:19:21 +0000 (14:19 -0700)] 
Fix bug: AC_EGREP_CPP with leading '-' in pattern

Also, port AC_EGREP_CPP to AT&T UnixPC.
Latter problem reported by Alain Knaff [sr #110657].
* lib/autoconf/general.m4 (AC_EGREP_CPP): Use new _AC_PROG_GREP.
Work even if the pattern starts with "-".
* lib/autoconf/programs.m4 (_AC_PROG_GREP):
New optional arg ACTION-IF-NOT-FOUND.
(_AC_PROG_EGREP_TRADITIONAL): New macro.

3 years agomake update-copyright
Paul Eggert [Thu, 19 May 2022 20:57:10 +0000 (13:57 -0700)] 
make update-copyright

3 years agoWork around AT&T 3b1 bug
Paul Eggert [Mon, 16 May 2022 05:14:57 +0000 (22:14 -0700)] 
Work around AT&T 3b1 bug

* lib/m4sugar/m4sh.m4: Work around bug in ancient sed.
Problem reported by Alain Knaff [sr#110654] for AT&T 3b1.
The Autoconf manual says this sed bug also occurs for
RISC/OS and IRIX 5.3.

3 years agoDocument AC_RUN_IFELSE([], ...) etc.
Paul Eggert [Tue, 10 May 2022 21:23:06 +0000 (14:23 -0700)] 
Document AC_RUN_IFELSE([], ...) etc.

* doc/autoconf.texi (Running the Preprocessor)
(Running the Compiler, Running the Linker, Runtime):
Document that the _IFELSE macros reuse an existing input file
if their input is empty.

3 years agoWork around memory-leak false alarms
Paul Eggert [Fri, 1 Apr 2022 06:25:35 +0000 (23:25 -0700)] 
Work around memory-leak false alarms

Problem reported by Raphael Isemann in:
https://lists.gnu.org/r/autoconf-patches/2022-03/msg00007.html
* lib/autoconf/c.m4 (_AC_C_C99_TEST_MAIN, AC_C_FLEXIBLE_ARRAY_MEMBER):
* tests/data/gnulib_std_gnu11_2020_08_17.m4 (_AC_C_C99_TEST_HEADER):
Free storage allocated via malloc, to pacify overly-picky
implementations that issue false alarms about memory leaks.

3 years agoFix bug with AS_IF and ‘set -e’
Paul Eggert [Fri, 1 Apr 2022 05:29:05 +0000 (22:29 -0700)] 
Fix bug with AS_IF and ‘set -e’

Problem reported by Peter Johansson in:
https://lists.gnu.org/r/bug-autoconf/2022-03/msg00009.html
The bug was introduced in 2020-11-15T18:56:18Z!zackw@panix.com
with commit message saying “If anyone has a better idea for how to
make this work I will be glad to hear it”, and this patch uses a
trick with ‘case’ that should be a better idea.
* lib/m4sugar/m4sh.m4 (as_nop, as_fn_nop, _AS_EMPTY_ELSE_PREPARE):
Remove.  All uses removed.
(_AS_IF_ELSE): Wrap the non-blank IF-ELSE inside a no-op case,
which works since a case branch can be empty in the shell.
* tests/m4sh.at (AS_IF and AS_CASE): Test the fix.

3 years agodoc: update Manthey name+email
Paul Eggert [Sat, 12 Mar 2022 19:32:35 +0000 (11:32 -0800)] 
doc: update Manthey name+email

3 years agoFix unwanted globbing of sed script
Paul Eggert [Fri, 18 Feb 2022 23:03:00 +0000 (15:03 -0800)] 
Fix unwanted globbing of sed script

Problem reported by mirabilos via Eric Blake in:
https://www.austingroupbugs.net/view.php?id=1558
https://lists.gnu.org/r/bug-autoconf/2022-02/msg00003.html
* lib/m4sugar/m4sh.m4 (_AS_TR_SH_PREPARE):
Define as_sed_sh as the sed script.  All uses of as_tr_sh changed.
Define as_tr_sh as before, but only for compatibility with scripts
that mistakenly use as_tr_sh directly.
(AS_TR_CPP_PREPARE): Likewise for as_sed_cpp and as_tr_cpp.

3 years agoClarify documentation of number format
Paul Eggert [Sat, 12 Feb 2022 22:47:52 +0000 (14:47 -0800)] 
Clarify documentation of number format

Problem reported by Mike Frysinger in:
https://lists.gnu.org/r/autoconf-patches/2022-02/msg00007.html

3 years agoadd new AC_PROG_AR helper
Mike Frysinger [Mon, 22 Feb 2021 16:09:16 +0000 (11:09 -0500)] 
add new AC_PROG_AR helper

This mirrors the existing RANLIB and related toolchain macros that
autoconf already exports.  Some projects assume `ar` is available
which isn't always safe, so provide a macro that probes the full
toolchain settings.

This also makes it easier to use AC_REQUIRE with the macro instead
of duplicating the AC_CHECK_TOOL call in projects.

  * lib/autoconf/programs.m4 (AC_PROG_AR): New macro.
  * doc/autoconf.texi: Document it.
  * tests/local.at (_AT_CHECK_ENV): Allow $AR output variable.

3 years agodoc: Document how to deal with missing 'join'.
Bruno Haible [Sat, 8 Jan 2022 21:31:58 +0000 (22:31 +0100)] 
doc: Document how to deal with missing 'join'.

* doc/autoconf.texi (Limitations of Usual Tools): Mention that 'join' is missing
in BusyBox.

3 years agodoc: document BusyBox sed w bug
Paul Eggert [Sun, 2 Jan 2022 02:08:15 +0000 (18:08 -0800)] 
doc: document BusyBox sed w bug

3 years agodoc: update ‘find’ info
Paul Eggert [Sun, 10 Oct 2021 01:38:25 +0000 (18:38 -0700)] 
doc: update ‘find’ info

* doc/autoconf.texi (Limitations of Usual Tools):
Mention a few more GNU ‘find’ options that are not portable.
Modernize a bit.

3 years agoUpdate .gitignore for move of version.m4.
Zack Weinberg [Sun, 3 Oct 2021 22:15:20 +0000 (18:15 -0400)] 
Update .gitignore for move of version.m4.

Commit af5c11ed moved version.m4 from lib/m4sugar to lib, but did not
update .gitignore to match.

3 years agoAdd a bootstrap script like Automake has.
Zack Weinberg [Thu, 4 Feb 2021 18:11:28 +0000 (13:11 -0500)] 
Add a bootstrap script like Automake has.

The bootstrap script generates the same files ‘autoreconf -vi’ would,
in a normal package, but it uses autoconf *from the git sources* to do
it.  This means people building from git do not need autoconf to be
installed already.  More importantly, it eliminates the extra steps
when building from git, of re-generating autoconf’s own configure
script with the just-built autoconf, then rebuilding the entire tree.

(This process still requires Automake to be installed already, and
Automake’s bootstrap script requires Autoconf to be installed already,
so there is still a dependency loop between Autoconf and Automake when
building from git—you need at least one of them installed from a
tarball to get started.)

The bootstrap script works by creating a partial installation tree in
a temporary directory, containing bin/autoconf, bin/autom4te, and just
enough of the usual contents of $(pkgdatadir) for autoconf and
autom4te to work.  It then runs a hardcoded list of commands,
corresponding to what ‘autoreconf -i -Wall,error’ would run, but
setting environment variables AUTOCONF and AUTOM4TE to ensure the
bootstrap versions of these tools are used.  (We have to create both,
because automake runs autoconf, not autom4te, to trace configure.ac.)

The ‘Autom4te’, ‘autoconf’, and ‘m4sugar’ subdirectories of the
partial installation tree are symlinked back to the source tree; this
is why version.m4 needed to be moved out of the m4sugar subdirectory,
so the bootstrap script can create it without scribbling on the source
tree.  autom4te is run in --melt mode, so we don’t need to create
freeze files in any subdirectories either.  All of the substitution
variables that are needed for autoconf and autom4te to both run, and
create the same output that they would have if fully configured, are
honored (unfortunately this does involve digging around in
configure.ac with sed expressions).

3 years agoRewrite bin/autoconf in Perl.
Zack Weinberg [Thu, 4 Feb 2021 16:14:37 +0000 (11:14 -0500)] 
Rewrite bin/autoconf in Perl.

Of all the installed programs (autoconf, autoheader, autom4te,
autoreconf, autoscan, autoupdate, ifnames) autoconf is the only one
that is a shell script instead of a Perl script.  This means it has to
do a lot of fiddly quoting and requoting to assemble an autom4te
command line, it doesn’t get to use the shared option handling code in
Autom4te/{General,Getopt}.pm, and it has to duplicate usage text that
properly should only be in Autom4te/ChannelDefs.pm.  It also means
there’s extra code in build-aux/help-extract.pl just for it, and a
special two-phase generation process in bin/local.mk.

This also paves the way for the bootstrap script mentioned in the
previous commit; it will only have to know how to deal with
substitution variables, not generation of m4sh scripts.

The new script winds up being slightly longer on disk but that’s
because our boilerplate for Perl scripts is quite long.  The code is
visibly simpler.

* bin/autoconf.as: Rename to bin/autoconf.in and rewrite in Perl.
* bin/local.mk (EXTRA_DIST): Change autoconf.as to autoconf.in.
  (MOSTLYCLEANFILES): Don’t delete autoconf.in.
  (bin/autoconf.in): Delete rule.
  (ETAGS_PERL): Add autoconf.in and sort list.
  (ETAGS_SH): Delete, no longer needed.
* tests/tools.at: Syntax-check autoconf as a Perl script.

* build-aux/help-extract.pl: Remove all code for extracting usage text
  from shell scripts.
* man/autoconf.w, man/local.mk: Refer to autoconf.in, not autoconf.as.

3 years agoGenerate version.m4 from config.status, in lib/ not lib/m4sugar/.
Zack Weinberg [Thu, 4 Feb 2021 15:48:36 +0000 (10:48 -0500)] 
Generate version.m4 from config.status, in lib/ not lib/m4sugar/.

This simplifies the Makefile a bit and also paves the way for a
bootstrap script (replacing the process of re-running autoreconf with
the just-built autoconf) which will be able to cope with generated
files that get installed in @pkgdatadir@ but not in @pkgdatadir@/m4sugar.

* lib/version.in: New file, contents extracted from lib/local.mk.
* lib/local.mk: Do not generate version.m4 here.
* configure.ac: Generate lib/version.m4 from lib/version.in via
  config.status.

* lib/freeze.mk, lib/local.mk, lib/m4sugar/m4sugar.m4:
  version.m4 now lives in @pkgdatadir@ rather than @pkgdatadir@/m4sugar.

3 years agofortran: *mingw* → mingw* in previous patch
Paul Eggert [Thu, 2 Sep 2021 02:07:32 +0000 (19:07 -0700)] 
fortran: *mingw* → mingw* in previous patch

* lib/autoconf/fortran.m4 (_AC_FC_LIBRARY_LDFLAGS): Omit a ‘*’.

3 years agofortran.m4: Filter mingw intrinsic libraries
Keno Fischer [Wed, 1 Sep 2021 23:39:32 +0000 (19:39 -0400)] 
fortran.m4: Filter mingw intrinsic libraries

* lib/autoconf/fortran.m4 (_AC_FC_LIBRARY_LDFLAGS):
Filter out mingw libraries too.
Problem and fix reported by Keno Fischer in
https://lists.gnu.org/r/autoconf-patches/2021-09/msg00000.html
Copyright-paperwork-exempt: Yes

3 years agofix a typo
Jim Meyering [Wed, 1 Sep 2021 06:50:30 +0000 (08:50 +0200)] 
fix a typo

* doc/autoconf.texi (Integer Overflow): Fix typo: s/many/may/

3 years agoAdd commentary for Time::HiRes patches
Paul Eggert [Wed, 1 Sep 2021 00:34:46 +0000 (17:34 -0700)] 
Add commentary for Time::HiRes patches

3 years agoFix bug when autom4te updates too quickly
Andreas K. Hüttel [Wed, 1 Sep 2021 00:01:47 +0000 (17:01 -0700)] 
Fix bug when autom4te updates too quickly

Use stat from Time::HiRes (instead of File::stat).

Problem reported by Ionen Wolkens <https://bugs.gentoo.org/782985>.

3 years agoPort AC_LANG_CALL(C) to C++
Paul Eggert [Tue, 31 Aug 2021 23:30:46 +0000 (16:30 -0700)] 
Port AC_LANG_CALL(C) to C++

* lib/autoconf/c.m4 (AC_LANG_CALL(C)): Add an extern "C" if C++.
Problem reported by Vincent Lefèvre (sr #110532).

3 years agoModernize discussion of integer overflow
Paul Eggert [Tue, 31 Aug 2021 20:08:10 +0000 (13:08 -0700)] 
Modernize discussion of integer overflow

* doc/autoconf.texi (Integer Overflow, Integer Overflow Basics)
(Signed Overflow Examples, Optimization and Wraparound):
Modernize discussion to take current compiler and Gnulib
technology into account.

3 years agoPort test to next m4 version
Paul Eggert [Tue, 31 Aug 2021 17:11:04 +0000 (10:11 -0700)] 
Port test to next m4 version

* tests/tools.at (autom4te cache):
Allow m4 to quote 'like this' as well as 'like this'.

3 years agoFortran Cray pointer macro support
Marshall Ward [Thu, 12 Aug 2021 00:43:36 +0000 (20:43 -0400)] 
Fortran Cray pointer macro support

This patch adds the AC_F77_CRAY_POINTERS and AC_FC_CRAY_POINTERS macros,
which test if the Fortran compiler supports Cray pointers.

The macros are written such that the tests share a common backend
(_AC_FC_CRAY_POINTERS) which works on both F77 and FC compilers.
Wrappers are provided to address any future potential compatibility
issues.

The macros include additional tests for particular flags required by
GFortran and PGI compilers.  The current set of flags is sparse, but can
be extended for other compilers if needed.

Documentation and a minimal test of the macro have been included.

Two minor variable name typos (@EXEEXT@ as @EEXEXT@) were also fixed in
two of the other Fortran tests.

3 years agotests: typo fix
Eric Blake [Thu, 12 Aug 2021 18:05:42 +0000 (13:05 -0500)] 
tests: typo fix

* tests/base.at: Fix typo.
Spotted by anonymous in https://savannah.gnu.org/support/?110526