]> git.ipfire.org Git - thirdparty/autoconf.git/log
thirdparty/autoconf.git
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

4 years agoAutoconf now quotes 'like this' instead of `like this'
Paul Eggert [Tue, 20 Jul 2021 21:01:43 +0000 (16:01 -0500)] 
Autoconf now quotes 'like this' instead of `like this'

Autoconf’s diagnostics now follow current GNU coding standards,
which say that diagnostics in the C locale should quote 'like this'
with plain apostrophes instead of the older GNU style `like this'
with grave accent and apostrophe.

4 years agoDocument unquoted here-documents better
Paul Eggert [Mon, 19 Jul 2021 04:54:19 +0000 (23:54 -0500)] 
Document unquoted here-documents better

Problem reported by Bruno Haible (sr #110518).
* doc/autoconf.texi (Generating Sources)
(Running the Preprocessor, Running the Compiler)
(Running the Linker, Runtime): Briefly mention that the program
snippets are expanded as unquoted here-documents.
(Here-Documents): Document escaping needed in unquoted
here-documents.  Remove mention of \" glitch in OpenBSD 2.7 sh;
that old system has not been supported for many years.
Remove advice that every \ must be quoted, as that sort
of quoting (though harmless) is not needed and is rarely done.
* lib/autoconf/c.m4 (AC_C_BIGENDIAN, _AC_LANG_OPENMP(Fortran 77)):
* lib/autoconf/types.m4 (AC_TYPE_LONG_LONG_INT): Properly quote
code snippets.  The backslash-newline typos were harmless, and the
backslash-$ typo has unspecified behavior as per POSIX though the
typo is harmless on all shells I know of.  However, Autoconf
should follow its own quoting advice.

4 years agodoc: fix typo in variable name
Emanuele Giaquinta [Fri, 14 May 2021 06:07:23 +0000 (09:07 +0300)] 
doc: fix typo in variable name

Message-Id: <YJ4Tm3WEkv86L/YV@FSAPPLE2215.fi.f-secure.com>
(tiny change)

4 years ago_AC_PROG_CXX_STDCXX_EDITION_TRY: fix typo in variable name
Emanuele Giaquinta [Fri, 14 May 2021 06:06:20 +0000 (09:06 +0300)] 
_AC_PROG_CXX_STDCXX_EDITION_TRY: fix typo in variable name

The typo causes "ac_prog_cxx_stdcxx" to be always set to "cxx11",
regardless of whether the C++ compiler supports C++11.
Message-Id: <YJ4TXAeJcvU0oSec@FSAPPLE2215.fi.f-secure.com>
(tiny change)

4 years agomaint: advertise GNU in README
Eric Blake [Mon, 10 May 2021 20:50:42 +0000 (15:50 -0500)] 
maint: advertise GNU in README

* README: Add section to attract more people towards the GNU project.
Inspired by a suggestion from Jose E. Marchesi <jemarch@gnu.org> on
the gnu-prog-discuss mailing list.

4 years agomaint: ensure autoconf-latest.* links stay up-to-date
Eric Blake [Mon, 10 May 2021 20:45:24 +0000 (15:45 -0500)] 
maint: ensure autoconf-latest.* links stay up-to-date

* cfg.mk (GNUPLOADFLAGS): New.
https://lists.gnu.org/archive/html/autoconf/2021-05/msg00006.html

4 years agomaint: Add names to THANKS
Eric Blake [Thu, 22 Dec 2016 20:28:59 +0000 (14:28 -0600)] 
maint: Add names to THANKS

* THANKS: Add names that resulted in several recent commits. Also
tweak addresses per owner requests.
Signed-off-by: Eric Blake <eblake@redhat.com>
4 years agoupdate HACKING file
Ben Elliston [Wed, 25 Nov 2015 10:08:19 +0000 (21:08 +1100)] 
update HACKING file

Fairly obvious - be gender neutral in who gets thanked.
* HACKING: Tweak pronouns.
Message-Id: <20151125100819.GA29844@air.net.au>
Signed-off-by: Eric Blake <eblake@redhat.com>
4 years agotrunk post-release administrivia v2.72a
Zack Weinberg [Thu, 28 Jan 2021 22:54:10 +0000 (17:54 -0500)] 
trunk post-release administrivia

Matching the commits on the release branch:

* NEWS: Bring over record of release notes.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.

4 years agomake fetch
Zack Weinberg [Thu, 28 Jan 2021 20:21:49 +0000 (15:21 -0500)] 
make fetch

4 years agomake update-copyright
Zack Weinberg [Thu, 28 Jan 2021 20:19:21 +0000 (15:19 -0500)] 
make update-copyright

4 years agoautoreconf: don’t error out when AM_GNU_GETTEXT is used alone.
Zack Weinberg [Mon, 4 Jan 2021 22:27:37 +0000 (17:27 -0500)] 
autoreconf: don’t error out when AM_GNU_GETTEXT is used alone.

Some projects intentionally don't call AM_GNU_GETTEXT_(REQUIRE_)VERSION
because they have all of the gettext infrastructure checked into version
control and they want autoreconf to _not_ run autopoint.  Therefore, make
the “AM_GNU_GETTEXT is used, but not AM_GNU_GETTEXT_(REQUIRE_)VERSION”
and “AM_GNU_GETTEXT_(REQUIRE_)VERSION is used, but not AM_GNU_GETTEXT”
diagnostics be warnings again, as they were in 2.69.

(Technically these diagnostics were always errors, in the sense that
they were reported with a call to Autom4te::Channels::error(), but
prior to 2.70, error() calls made by autoreconf did not cause
autoreconf to exit unsuccessfully, due to an unrelated bug.  So people
came to depend on these diagnostics not being fatal.)

4 years agodoc: Document another portability problem of 'od'.
Bruno Haible [Wed, 30 Dec 2020 15:21:48 +0000 (10:21 -0500)] 
doc: Document another portability problem of 'od'.

* doc/autoconf.texi (Limitations of Usual Tools): Document that decimal output
is not portable.

4 years agodoc: modernize grep discussion
Paul Eggert [Wed, 30 Dec 2020 06:48:02 +0000 (22:48 -0800)] 
doc: modernize grep discussion

4 years agoautom4te: always update the output file, even if it hasn’t changed
Zack Weinberg [Tue, 29 Dec 2020 20:33:33 +0000 (15:33 -0500)] 
autom4te: always update the output file, even if it hasn’t changed

Automake generates a Makefile rule for regenerating the configure
script, that relies on an invocation of ‘autoconf’ always bumping the
timestamp on the configure script, even if it hasn’t changed.
The patch to make autom4te update the output file atomically
(1725c947144d9bebfe7817c2c5f0d53d884b1297) broke this.

Fixes several failures in automake’s test suite.

 * bin/autom4te.in (handle_output): Always call update_file with force=1.
 * tests/tools.at (autoconf: timestamp changes): New test.

4 years agoRestore compatibility with older std-gnu11.m4.
Zack Weinberg [Mon, 21 Dec 2020 19:04:22 +0000 (14:04 -0500)] 
Restore compatibility with older std-gnu11.m4.

Gnulib’s std-gnu11.m4 backports C11 and C++11 detection to autoconf
2.69.  It does this by replacing the definitions of AC_PROC_CC and
AC_PROG_CXX and most of their subroutines.  In particular, it replaces
the definitions of _AC_PROG_CC_C11, _AC_PROG_CC_C99, and _AC_C_STD_TRY,
but it does *not* replace the definition of _AC_PROG_CC_C89.

Autoconf commit 131d8c69f31dc6fc8dc93abe1096d52d1fe19fd3 changed the
calling convention of _AC_C_STD_TRY, and changed the internal
definitions of _AC_PROG_CC_C{11,99,89} to match.  If std-gnu11.m4 is
in use, our _AC_PROG_CC_C89 calls their _AC_C_STD_TRY with the new
calling convention, and this produces a syntactically invalid
configure script.  (This is is fortunate: it could easily have been a
runtime malfunction that only manifested with compilers that only
implement C89, and then we might not have noticed the problem for
years.)

Gnulib commit a3b3fc85e3e632374811b27cb2111e50fa177e36 makes
std-gnu11.m4 do nothing when used with autoconf >=2.70, but older
versions of the file will circulate for years to come, so this patch
works around the problem in autoconf.  It does this by renaming all of
the internal macros involved with C and C++ standard edition
detection, *except* _AC_PROG_CC_C89.  AC_PROG_CC now calls
_AC_PROG_CC_STDC_EDITION, which loops over all supported editions
calling _AC_PROG_CC_STDC_EDITION_TRY, which uses the data provided by
the existing _AC_C_C${edition}_TEST_PROGRAM macros and a new set of
macros called _AC_C_C${edition}_OPTIONS to perform the test for that
edition of the standard.  Similarly, AC_PROG_CXX calls
_AC_PROG_CXX_STDCXX_EDITION, which loops calling
_AC_PROG_CXX_STDCXX_EDITION_TRY, which uses data from
_AC_CXX_CXX${edition}_TEST_PROGRAM and _AC_CXX_CXX${edition}_OPTIONS.

_AC_PROG_CC_C89 is the only macro from the old set that we still
define, and its definition is reverted to what std-gnu11.m4 expects it
to be.  Nothing in Autoconf proper uses it anymore.

foreign.at grows a test to verify that the compatibility stub version
of _AC_PROG_CC_C89 does its job.  Since this is now the third test
involving an embedded copy of a third-party macro, I broke them all
out of foreign.at to separate files in test/data/.

In addition to fixing the breakage, this patch should make it easier
to extend C / C++ standard edition detection in the future, by getting
rid of the if-else chains in AC_PROG_CC/CXX and by disentangling the
lists of command-line options to test from the logic.

I also changed the manual to suggest people refer to the variables
‘ac_prog_cc_stdc’ and ‘ac_prog_cxx_stdcxx’ to learn which edition
of the C and C++ standards are selected; these are much easier to
work with than the ac_cv_prog_cc_cNN cache variables.

* lib/autoconf/c.m4 (_AC_C_STD_TRY, _AC_PROG_CC_C99, _AC_PROG_CC_C11)
  (_AC_CXX_STD_TRY, _AC_PROG_CXX_CXX98, _AC_PROG_CXX_CXX11): Remove macro.

  (_AC_C_C89_OPTIONS, _AC_C_C99_OPTIONS, _AC_C_C11_OPTIONS)
  (_AC_PROG_CC_STDC_EDITION, _AC_PROG_CC_STDC_EDITION_TRY)
  (_AC_CXX_CXX98_OPTIONS, _AC_CXX_CXX11_OPTIONS)
  (_AC_PROG_CXX_STDCXX_EDITION, _AC_PROG_CXX_STDCXX_EDITION_TRY): New macros.

  (_AC_PROG_CC_C89): Convert to compatibility stub for std-gnu11.m4.

  (AC_PROG_CC): Use _AC_PROG_CC_STDC_EDITION.
  (AC_PROG_CXX): Use _AC_PROG_CXX_STDCXX_EDITION.

* tests/data/ax_prog_cc_for_build_v18.m4
* tests/data/ax_prog_cxx_for_build_v3.m4
* tests/data/gnulib_std_gnu11_2020_08_17.m4: New files.
* tests/foreign.at (AX_PROG_CC_FOR_BUILD, AX_PROG_CXX_FOR_BUILD):
  Remove embedded copy of ax_prog_cc_for_build_v18.m4,
  ax_prog_cxx_for_build_v3.m4 respectively.
  (gnulib-std-gnu11.m4): New test.
* tests/local.mk: Distribute tests/data/*.m4.

* doc/autoconf.texi (AC_PROG_CC, AC_PROG_CXX): Document use of
  ac_prog_cc_stdc / ac_prog_cxx_stdcxx, respectively, to tell which
  edition of the C / C++ standards are selected, instead of looking
  through a series of cache variables with awkward definitions.

4 years agoUse -fno-builtin, not -Werror, in AC_CHECK_DECLS (#110400)
Zack Weinberg [Wed, 23 Dec 2020 17:14:06 +0000 (12:14 -0500)] 
Use -fno-builtin, not -Werror, in AC_CHECK_DECLS (#110400)

clang issues only a warning, not an error, when an undeclared
identifier that names a built-in function is used: for instance

    char *(*p)(const char *, int) = strchr;

(with no `#include <string.h>`) is an error with most compilers,
a warning with clang.  This broke the 2.69 implementation of
AC_CHECK_DECL.  In commit 82ef7805faffa151e724aa76c245ec590d174580,
we tried to work around this quirk by using -Werror, but that put us
at risk of being tripped up by other warnings.  Bug 110400 reports,
for instance, that this fragment (which is roughly what you get, after
preprocessing, when AC_CHECK_DECL is applied to a function that *is*
properly declared)

    extern void ac_decl (int, char *);
    int main (void)
    {
      (void) ac_decl;
      ;
      return 0;
    }

provokes a warning from clang (and thus an error) when -Wextra-semi-stmt
has been added to CFLAGS earlier in the configure script.  The extra
semicolon comes from AC_LANG_PROGRAM, and we can’t get rid of it
because we have no way of telling reliably when someone wrote
something like

    AC_LANG_PROGRAM([[#include <stdio.h>]],
                    [[puts("hello world")]])

with no semicolon at the end of the statement; this has been
acceptable for decades.  Besides, that’s just one warning, who knows
what compilers will start complaining about tomorrow?

So: change AC_CHECK_DECL to compile its programs with -fno-builtin,
instead, when the default compilation mode fails to detect an
undeclared strchr.  The code is restructured so that we can try other
options as well, if we find another compiler with the same quirk but
different command-line syntax.

(All of this logic is very C-family specific, but it appears to me
that AC_CHECK_DECL has never worked with other languages, so we can
continue to live with that for now.)

Fixes bug 110400; partially reverts 82ef7805faffa151e724aa76c245ec590d174580.

 * lib/autoconf/general.m4 (_AC_UNDECLARED_WARNING): Rename to
   _AC_UNDECLARED_BUILTIN.  Instead of looking at diagnostic output,
   loop trying to find a command-line option that makes the compiler
   error out on undeclared builtins.
   (_AC_CHECK_DECL_BODY): Don’t AC_REQUIRE anything here.
   Make shell code language-agnostic, except for the actual test program.
   Add arguments to the shell function for additional compiler options
   to use.
   (AC_CHECK_DECL): AC_REQUIRE _AC_UNDECLARED_BUILTIN here.
   Supply $ac_{AC_LANG_ABBREV}_undeclared_builtin_options to
   ac_fn_check_decl.

 * tests/local.at (AT_CONFIG_CMP): Update list of variables to ignore
   when comparing C and C++ configure runs.
 * tests/semantics.at (AC_CHECK_DECLS): Add memcpy and strchr to
   AC_CHECK_DECLS call for functions that may be known to the compiler.

 * doc/autoconf.texi (AC_CHECK_DECL, AC_CHECK_DECLS): Remove note
   about compiler warnings.

4 years agoautom4te: correct error message when we can’t create autom4te.cache.
Zack Weinberg [Mon, 21 Dec 2020 20:29:32 +0000 (15:29 -0500)] 
autom4te: correct error message when we can’t create autom4te.cache.

While testing something else, I noticed that autom4te may print a
nonsensical error message when it fails to create autom4te.cache,
because it checks again whether the directory already exists before
giving up, and this clobbers errno.

Instead of doing (the perl equivalent of)
    test -d $cache || mkdir $cache || test -d $cache
call mkdir unconditionally.  If it fails with an errno code other than
EEXIST, consider that a hard failure; if it fails with EEXIST, check
whether the thing that exists is in fact a directory.  (A symlink to
a directory qualifies; I wouldn’t be surprised if people are moving
autom4te.cache around with symlinks.)

Either way, if we fail, report strerror(errno) from the original
mkdir failure.  Also, print the current working directory as part
of the error message; this aids debugging when you’re working with a
big hairy nested tree.

* bin/autom4te.in: Don’t check whether autom4te.cache exists before
  attempting to create it.  Only stat autom4te.cache if mkdir fails
  with EEXIST, otherwise fail immediately.  Make sure to report the
  errno code from mkdir, not the subsequent stat (if any).  Report
  the current working directory as part of the error message.

* tests/tools.at: Verify that autom4te reports the actual reason when
  it fails to create autom4te.cache.  Verify that failure to create
  autom4te.cache because that name exists, but isn’t a directory,
  is detected.

4 years agoMerge branch 'branch-2.70' into master
Paul Eggert [Sun, 13 Dec 2020 00:10:28 +0000 (16:10 -0800)] 
Merge branch 'branch-2.70' into master

4 years agoImprove AC_USE_SYSTEM_EXTENSIONS port to HP-UX 11.11
Paul Eggert [Fri, 11 Dec 2020 23:23:53 +0000 (15:23 -0800)] 
Improve AC_USE_SYSTEM_EXTENSIONS port to HP-UX 11.11

* lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS):
Define _HPUX_ALT_XOPEN_SOCKET_API, for HP-UX 11.11.
This patch is adapted from Gnulib.

4 years agoPort minor AC_HEADER_MAJOR fixes from Gnulib
Paul Eggert [Fri, 11 Dec 2020 23:22:02 +0000 (15:22 -0800)] 
Port minor AC_HEADER_MAJOR fixes from Gnulib

* lib/autoconf/headers.m4 (AC_HEADER_MAJOR):
Improve m4 quoting.

4 years agoPort minor AC_FUNC_ALLOCA fixes from Gnulib
Paul Eggert [Fri, 11 Dec 2020 23:18:41 +0000 (15:18 -0800)] 
Port minor AC_FUNC_ALLOCA fixes from Gnulib

* lib/autoconf/functions.m4 (_AC_LIBOBJ_ALLOCA, AC_FUNC_ALLOCA):
Use ' not ` in generated comments, as per current GNU coding style.
(_AC_LIBOBJ_ALLOCA): Use plain # instead of unnecessary quadrigraph.
This patch is adapted from Gnulib.

4 years agoImprove port of AC_C_RESTRICT to Oracle C++
Paul Eggert [Fri, 11 Dec 2020 23:15:28 +0000 (15:15 -0800)] 
Improve port of AC_C_RESTRICT to Oracle C++

Problem reported by Christian Biesinger in:
https://lists.gnu.org/r/bug-gnulib/2019-12/msg00159.html
* lib/autoconf/c.m4 (AC_C_RESTRICT): Port better to
Oracle Developer Studio C++ 12.5 or later.
This patch is adapted from Gnulib.

4 years ago_AC_PROG_CC_C99: fix typo (#110396)
Zack Weinberg [Wed, 9 Dec 2020 02:35:45 +0000 (21:35 -0500)] 
_AC_PROG_CC_C99: fix typo (#110396)

_AC_PROG_CC_C99 was using the wrong test program.

Fixes #110396, reported anonymously.

* lib/autoconf/c.m4 (_AC_PROG_CC_C99): Use the C99 test program, not
  the C89 test program.

4 years agomaint: add outline for future NEWS (release branch).
Zack Weinberg [Wed, 9 Dec 2020 02:47:13 +0000 (21:47 -0500)] 
maint: add outline for future NEWS (release branch).

4 years ago_AC_PROG_CC_C99: fix typo (#110396)
Zack Weinberg [Wed, 9 Dec 2020 02:35:45 +0000 (21:35 -0500)] 
_AC_PROG_CC_C99: fix typo (#110396)

_AC_PROG_CC_C99 was using the wrong test program.

Fixes #110396, reported anonymously.

* lib/autoconf/c.m4 (_AC_PROG_CC_C99): Use the C99 test program, not
  the C89 test program.

4 years agomaint: add outline for future NEWS
Zack Weinberg [Wed, 9 Dec 2020 01:53:13 +0000 (20:53 -0500)] 
maint: add outline for future NEWS

4 years agomaint: post-release administrivia
Zack Weinberg [Tue, 8 Dec 2020 18:04:16 +0000 (13:04 -0500)] 
maint: post-release administrivia

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

4 years agoRelease 2.70. v2.70
Zack Weinberg [Tue, 8 Dec 2020 16:31:19 +0000 (11:31 -0500)] 
Release 2.70.

4 years agoRemove obsolete instructions from HACKING.
Zack Weinberg [Tue, 8 Dec 2020 16:29:05 +0000 (11:29 -0500)] 
Remove obsolete instructions from HACKING.

configure CC=g++ is no longer supported, so don’t tell maintainers to
test that.

4 years agotestsuite: log version of M4 and Perl
Zack Weinberg [Tue, 8 Dec 2020 16:14:19 +0000 (11:14 -0500)] 
testsuite: log version of M4 and Perl

Jannick reported problems on OSX for which the most plausible
explanation is that the system-provided M4 is emitting error messages
with different line numbers than we expect, perhaps because Apple
froze their copy of GNU M4 to the last GPLv2 release.  To test this
hypothesis, add $PERL and $M4 to AT_TESTED in our testsuite.

* tests/atlocal.in: Also set $M4 from configure.
* tests/local.at: Add AT_TESTED([$PERL $M4]).

4 years agolib/autotest/general.m4: typo fix
Zack Weinberg [Tue, 8 Dec 2020 16:12:04 +0000 (11:12 -0500)] 
lib/autotest/general.m4: typo fix

The absolute-path case in AT_TESTED had a typo in it, causing bizarre
error messages and preventing programs identified by absolute path
from being logged properly.

* lib/autotest/general.m4 (AT_TESTED): Fix typoed shell syntax in
  handling of programs identified by absolute path.

4 years agoThree minor testsuite fixes.
Zack Weinberg [Tue, 8 Dec 2020 15:36:28 +0000 (10:36 -0500)] 
Three minor testsuite fixes.

1. To insulate the test suite from a system-provided config.site file,
set the CONFIG_SITE environment variable to a file that is known not
to exist.  Problem reported by Jannick.

2. AC_PROG_CC, AC_PROG_CXX, AC_PROG_CPP, and AC_PROG_CXXCPP may set
cache variables named ‘ac_cv_prog_$tool’ or ‘ac_cv_prog_ac_ct_$tool’,
depending on system conditions; _AT_CONFIG_CMP_PRUNE needs to handle
both possibilities.  Found by testing on FreeBSD 12; I have no idea
why it didn’t show up on _any_ of my other test platforms.

3. The ‘AC_PROG_LEX with yywrap’ test needs to be skipped on systems
that don’t provide libl.a nor libfl.a.  This change needed yet another
hook for AT_CHECK_MACRO.  Found by testing on Alpine Linux.

(Ideally, instead of skipping this test, we would test that this
configure script *errors out* on these systems, but that would involve
much more invasive changes to AT_CHECK_MACRO, which I don’t want to
hold the release for.)

* tests/local.at (AT_PREPARE_TESTS): Set CONFIG_SITE to refer to
  a file that is known not to exist, and export it.
  (_AT_CONFIG_CMP_PRUNE): Prune all variables matching the
  ERE ‘ac_cv_prog_(ac_ct_)?(CC|CXX|CPP|CXXCPP)’.
  (AT_CHECK_MACRO): Add PRETEST-CMDS argument which takes commands to
  execute immediately after AT_SETUP.
* tests/semantics.at (AC_PROG_LEX with yywrap): Using PRETEST-CMDS,
  skip this test on OSes where neither -ll nor -lfl provides a
  definition of yywrap.

4 years agoautoreconf --install --force: replace install-sh with no timestamp
Zack Weinberg [Tue, 8 Dec 2020 15:32:04 +0000 (10:32 -0500)] 
autoreconf --install --force: replace install-sh with no timestamp

Old versions of install-sh did not have a timestamp line.  Therefore,
treat the absence of a timestamp line as indicating a very old file
(that --install --force should replace), not as an error.

Problem reported by Pascal Terjan.

* bin/autoreconf.in (extract_time_stamp): Return 1970-01-01 when
  no timestamp line is found.
* tests/torture.at (Missing auxiliary files (--force)):
  Test replacement of old install-sh with no timestamp line.

4 years agomake fetch
Zack Weinberg [Mon, 7 Dec 2020 22:23:37 +0000 (17:23 -0500)] 
make fetch

4 years agoUpdate documentation of AC_USE_SYSTEM_EXTENSIONS.
Zack Weinberg [Mon, 7 Dec 2020 22:17:40 +0000 (17:17 -0500)] 
Update documentation of AC_USE_SYSTEM_EXTENSIONS.

The list of macros documented as being defined by
AC_USE_SYSTEM_EXTENSIONS had gotten out of sync with the actual list.
Update it thoroughly.

Also, I introduced an error into the commentary when I merged Julien
ÉLIE’s patch to define _NETBSD_SOURCE and _OPENBSD_SOURCE in
AC_USE_SYSTEM_EXTENSIONS.  _OPENBSD_SOURCE does something on NetBSD
and *doesn’t* do anything on OpenBSD.  This is corrected.

Clean up the code in AC_USE_SYSTEM_EXTENSIONS a bit while I’m in
there; we now had a redundant definition of _NETBSD_SOURCE (one
unconditional and one conditional on minix/config.h existing).
Reorganize the macro to make it easier to catch problems like this in
the future.

* lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS): Reorganize;
  remove redundant AC_DEFINE of _NETBSD_SOURCE; add some missing
  AC_BEFOREs; use _AC_CHECK_HEADER_ONCE for header checks;
  revise all commentary.
* doc/autoconf.texi (AC_USE_SYSTEM_EXTENSIONS): Update.

4 years agoRevise documentation of AT_CHECK.
Zack Weinberg [Mon, 7 Dec 2020 18:24:46 +0000 (13:24 -0500)] 
Revise documentation of AT_CHECK.

Patch originally by Jannick but then about 10x more words added by me.

4 years agoRevise documentation of AC_PROG_CC and comments on conformance checks.
Zack Weinberg [Mon, 7 Dec 2020 16:53:06 +0000 (11:53 -0500)] 
Revise documentation of AC_PROG_CC and comments on conformance checks.

Makes the documentation of AC_PROG_CC consistent with the
documentation of AC_PROG_CXX.  Also removes a bunch of redundant text
from c.m4 and adds lists of the headers that *can* be used in the
conformance tests, so future hackers don’t have to look them up.

* doc/autoconf.texi (AC_PROG_CC): Make description consistent with
  description of AC_PROG_CXX.
* lib/autoconf/c.m4: Clean up some outdated or repetitive commentary
  and add lists of the freestanding headers above the code that needs
  to avoid using non-freestanding headers.

4 years agoAdd checks of __STDC__ and __STDC_VERSION__ to C conformance tests.
Zack Weinberg [Mon, 7 Dec 2020 16:49:52 +0000 (11:49 -0500)] 
Add checks of __STDC__ and __STDC_VERSION__ to C conformance tests.

This makes the C conformance tests more consistent with the C++
conformance tests, and should also speed up cycling through the
possible options to turn on C99/C11.

Tested with gcc, clang, SunPRO C, and AIX xlc.

* lib/autoconf/c.m4 (_AC_C_C89_TEST_GLOBALS): Add preprocessor test
  for __STDC__ being defined (to any value).
  (_AC_C_C99_TEST_GLOBALS, _AC_C_C11_TEST_GLOBALS): Add preprocessor
  test of the value of __STDC_VERSION__.

4 years agoautom4te: don’t crash when warnings have no stacktrace
Zack Weinberg [Mon, 7 Dec 2020 16:32:55 +0000 (11:32 -0500)] 
autom4te: don’t crash when warnings have no stacktrace

In testing on Darwin (OSX), sometimes warnings reported from M4 code
reach autom4te with no stack trace at all, causing the perl script to
crash with a “use of uninitialized value” error.  The root cause of
the problem is not clear to me, but the script certainly shouldn’t
crash.

Problem found by Jannick <thirdedition@gmx.net>.

* bin/autom4te.in: When processing warnings, make sure $stacktrace is
  defined.

4 years agoSmall bug fixes for the test suite.
Jannick [Mon, 7 Dec 2020 16:28:57 +0000 (11:28 -0500)] 
Small bug fixes for the test suite.

* tests/atlocal.in: Also set AWK to value detected by configure.
  Alphabetize list of shell variables set by config.status.
* tests/local.mk: Add a rule to recreate tests/atconfig when
  config.status changes.

4 years agoDon’t use hosted headers when testing for C(++) standard level (#110393)
Zack Weinberg [Sun, 6 Dec 2020 17:23:41 +0000 (12:23 -0500)] 
Don’t use hosted headers when testing for C(++) standard level (#110393)

The tests for the level of the C and C++ standard supported by their
respective compilers should also avoid using any headers that are not
guaranteed to be available in the respective freestanding environment.

Unlike the previous change, the only user-visible consequence of this
one should be that C11/C99/C89/C++11/C++98 *compiler* support is now
correctly detected when the compilation target is a freestanding
environment.

This patch also refactors how we “emit [the text of the C/C++
standard-conformance test programs] only once per [configure script],
into shell variables which can then be referenced repeatedly,” from
c3853873, because editing them just a little made the M4 quotation
break.  Clearly too fragile.

I believe this completes the fix for bug #110393.

* lib/autoconf/c.m4 (_AC_PROG_CC_C89, _AC_PROG_CC_C99, _AC_PROG_CC_C11)
  _AC_C_C99_TEST_HEADER, _AC_C_C99_TEST_BODY): Move all test program
  fragments into new macros that can be AC_REQUIREd individually:
  _AC_C_C89_TEST_GLOBALS, _AC_C_C89_TEST_MAIN, _AC_C_C89_TEST_PROGRAM,
  _AC_C_C99_TEST_GLOBALS, _AC_C_C99_TEST_MAIN, _AC_C_C99_TEST_PROGRAM,
  _AC_C_C11_TEST_GLOBALS, _AC_C_C11_TEST_MAIN, _AC_C_C11_TEST_PROGRAM.
  Each emits test code at most once, into a shell variable in the
  INIT_PREPARE diversion.
  Revise each test program to use only library features of the
  respective standard’s freestanding environment.
  (_AC_C_STD_TRY): Take the *name* of the shell variable holding the
  complete test program as an argument, not the code itself.  All
  callers adjusted to match.

  (_AC_PROG_CXX_CXX98, _AC_PROG_CXX_CXX11, _AC_CXX_STD_TRY)
  (_AC_CXX_CXX98_TEST_HEADER, _AC_CXX_CXX98_TEST_BODY)
  (_AC_CXX_CXX11_TEST_HEADER, _AC_CXX_CXX11_TEST_BODY): Similarly.
  New macros are:
  _AC_CXX_CXX98_TEST_GLOBALS, _AC_CXX_CXX98_TEST_MAIN,
  _AC_CXX_CXX98_TEST_PROGRAM,
  _AC_CXX_CXX11_TEST_GLOBALS, _AC_CXX_CXX11_TEST_MAIN,
  _AC_CXX_CXX11_TEST_PROGRAM.

4 years agoAC_INCLUDES_DEFAULT: Check for presence of C90 hosted headers (#110393)
Zack Weinberg [Sun, 6 Dec 2020 16:40:39 +0000 (11:40 -0500)] 
AC_INCLUDES_DEFAULT: Check for presence of C90 hosted headers (#110393)

Since 1993, Autoconf has been assuming that it is safe to include any
of the headers defined by ISO C90 without checking for them; this is
inaccurate, since only a subset are necessarily available in a
C90 *freestanding* environment.

It is OK to assume the presence of a header in a macro that checks
specifically for something declared by that header (if the header is
not present, we will think the specific declaration is unavailable,
which is probably accurate for modern embedded environments).  It is
also OK to continue recommending that user code use these headers
unconditionally—anyone working with a freestanding environment knows
it.  But it is not OK for very generic code within Autoconf itself,
such as AC_INCLUDES_DEFAULT, to make this assumption.

Note that the set of headers that are not always available includes
stdio.h, which we have been assuming can be included unconditionally
for even longer.

In AC_INCLUDES_DEFAULT, revert to checking for string.h and stdlib.h
before including them.  Also revert to defining STDC_HEADERS only when
string.h and stdlib.h are available (but do not check for float.h and
stdarg.h, as these are part of the freestanding set).  Add a new check
for stdio.h.  Sort the inclusion list by standard (C90 freestanding;
C90 hosted; C99; POSIX) and alphabetically within each group.  Revise
all the documentation and update the testsuite.

This partially reverts commit 86c213d0e355296f026a36e3203c0813041aae89
and is a partial fix for bug #110393.

* lib/autoconf/headers.m4 (AC_CHECK_INCLUDES_DEFAULT): Check for
  stdio.h, stdlib.h, and string.h before including them.  Define
  STDC_HEADERS only when string.h and stdlib.h are both available.
  Organize includes list by standard, then alphabetically.

* doc/autoconf.texi, NEWS: Update to match.

* tests/local.at (AT_CHECK_DEFINES): Make regexes more specific.
  Also expect a definition of HAVE_STDIO_H.
* tests/c.at, tests/semantics.at, tests/tools.at: Use <float.h>,
  not <stdio.h>, as a header that we expect always to exist.
  Add HAVE_STDIO_H to various lists of macros that are expected to
  appear in config.h.

4 years agoDefine _NETBSD_SOURCE and _OPENBSD_SOURCE in AC_USE_SYSTEM_EXTENSIONS (#110392)
Julien ÉLIE [Sun, 6 Dec 2020 15:45:35 +0000 (10:45 -0500)] 
Define _NETBSD_SOURCE and _OPENBSD_SOURCE in AC_USE_SYSTEM_EXTENSIONS (#110392)

These expose additional extensions specific to those operating
systems, similar to _DARWIN_C_SOURCE, _GNU_SOURCE, etc.

(DragonflyBSD and FreeBSD currently do not have any equivalent
macros.)

Fixes bug #110392.  See also
https://git.savannah.gnu.org/cgit/gnulib.git/tree/m4/extensions.m4
https://git.eyrie.org/?p=devel/rra-c-util.git;a=commitdiff;h=f8a922cf31804dcc25ac176dcc22fdcdffcb5fdf

* lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS): Also define
  _NETBSD_SOURCE and _OPENBSD_SOURCE.  Add comment explaining that
  there are (currently) no equivalent macros on DragonflyBSD and
  FreeBSD.  Put macro list in alphabetical order.

4 years agoRevert "AC_PROG_CC: define via AC_DEFUN_ONCE". (#110350)
Zack Weinberg [Fri, 4 Dec 2020 21:32:35 +0000 (16:32 -0500)] 
Revert "AC_PROG_CC: define via AC_DEFUN_ONCE". (#110350)

Revert commit 18c140b50b0619454d4da50d58a318cc257d580a, restoring
AC_PROG_CC to being defined as an ordinary AC_DEFUN.  This broke
third-party macros (e.g. the Autoconf Macro Archive’s
AX_PROG_CC_FOR_BUILD) that intentionally invoked AC_PROG_CC a second
time with its guts redefined via a whole bunch of ‘pushdef’s.  I don’t
think we want to support this long-term, but needing access to a
build-native compiler in cross-compilation is common enough that we
should have *some* supported way to do it, and it may as well be
AX_PROG_CC_FOR_BUILD until we come up with something better.

If we go back to AC_DEFUN_ONCE for AC_PROG_CC in the future, we should
do it consistently for all the “find me a compiler” macros -- it
was *only* done for AC_PROG_CC in 18c140b5.

The rationale for AC_DEFUN_ONCE seems to have been to reduce the size
of the generated configure script.  The bulk of the size accountable to
AC_PROG_CC is the test programs for figuring out which version of the
C standard is available, so I tweaked _AC_C_STD_TRY (and _AC_CXX_STD_TRY)
to emit that text only once per program, into shell variables which
can then be referenced repeatedly.

Fixes bug #110350.

* NEWS, doc/autoconf.texi: Revert documentation changes associated
  with AC_PROG_CC being a one-shot macro.
* lib/autoconf/c.m4 (AC_PROG_CC): Revert to defining with AC_DEFUN.
  (_AC_C_STD_TRY, _AC_CXX_STD_TRY): Emit the test program only once,
  even if invoked multiple times with the same arguments.

* tests/foreign.at (AX_PROG_CC_FOR_BUILD, AX_PROG_CXX_FOR_BUILD):
  New tests.

4 years agoAutotest: add official way to execute code before all/each test.
Zack Weinberg [Wed, 28 Oct 2020 21:04:22 +0000 (17:04 -0400)] 
Autotest: add official way to execute code before all/each test.

Currently, there isn’t any documented way for an Autotest testsuite to
add custom code to be run either right before the main driver loop, or
at the point of each AT_SETUP.  For instance, there’s no good place to
put environment variable sanitization that should apply to the entire
testsuite (but isn’t universally relevant), or shell function
definitions to be used by custom test macros.

Autoconf’s test suite is poking shell functions directly into the
PREPARE_TESTS diversion, and doing environment variable sanitization
in each individual test.  Both of these are obviously undesirable.

This patch adds three new AT_* macros that can be used to do these
things in an officially-supported way: AT_PREPARE_TESTS adds code to
be run right before the main driver loop, AT_PREPARE_EACH_TEST adds
code to be run at the beginning of each test, and AT_TEST_HELPER_FN
defines a shell function that will be available to each test.  In
Autoconf’s test suite, I use AT_PREPARE_TESTS to factor out
environment variable sanitization that *ought* to apply across the
board, and AT_TEST_HELPER_FN for the helper function used by
AT_CHECK_ENV.

(This fixes the testsuite bug reported by Jannick at
https://lists.gnu.org/archive/html/autoconf/2020-10/msg00052.html :
CONFIG_SITE in the parent environment will no longer be visible to tests.)

It would be nice to give an example of when AT_PREPARE_EACH_TEST is
useful, in the documentation, but I didn’t find one in the autoconf
test suite.

* lib/autotest/general.m4 (AT_PREPARE_TESTS, AT_PREPARE_EACH_TEST)
  (AT_TEST_HELPER_FN): New macros.
  (AT_INIT, AT_TESTED): Emit the code to report tested programs only
  if it’s needed, and make sure it’s after any code added by
  AT_PREPARE_TESTS.

* tests/local.at: Add AT_PREPARE_TESTS block that ensures
  $MAKE is set sensibly and $MAKEFLAGS and $CONFIG_SITE are unset.
  Use AT_TEST_HELPER_FN for the helper function needed by AT_CHECK_ENV.
  (AT_CHECK_MAKE): No need to sanitize $MAKE or $MAKEFLAGS here.
* tests/base.at, tests/compile.at, tests/m4sh.at, tests/torture.at:
  No need to unset or neutralize $CONFIG_SITE in individual tests.
* tests/autotest.at: Add tests for new macros.

* doc/autoconf.texi, NEWS: Document new macros.

4 years agoDocument better where to put -m32 or -m64 compiler options.
Bruno Haible [Tue, 1 Dec 2020 21:42:17 +0000 (22:42 +0100)] 
Document better where to put -m32 or -m64 compiler options.

* doc/autoconf.texi (Preset Output Variables): Clarify that options -m32 or -m64
must go into CC, not CFLAGS and not CPPFLAGS either. This is needed because on
bi-arch platforms, config.guess runs $CC without $CFLAGS nor $CPPFLAGS.

4 years agoAdd a note to NEWS about ac_cv_header_stdlib_h not being set... v2.69e
Zack Weinberg [Tue, 1 Dec 2020 14:04:26 +0000 (09:04 -0500)] 
Add a note to NEWS about ac_cv_header_stdlib_h not being set...

... even though HAVE_STDLIB_H is.