Commit 61901a1a14 dated 2022-07-10
bumped the Perl requirement to 5.10 or later, because
commit 3a9802d601 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.
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.
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.
The minimum Perl version was raised to 5.8.0 from 5.6.0 in commit
3a9802d601 (but not documented as
such until e8c2d79ec4, 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”.
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.
Several of the files updated by make fetch have made this change, so
we follow suit for consistency:
* README-hacking
* build-aux/fetch.pl
* doc/autoconf.texi: Replace all git.savannah.gnu.org/gitweb URLs with
equivalent /cgit URLs.
As pointed out in sr #110368, since install-sh is now being installed
as part of autoconf, we should make sure to ship the latest version
rather than the version shipped by the automake that was used to
bootstrap the autoconf release tarball.
The build-aux/fetch.pl script is already supposed to fetch the latest
version, but install-sh is listed in .gitignore so any updates are
discarded when starting from a clean tree. Correct this.
At the same time, since mdate-sh is *not* installed by autoconf nor is
it directly referenced in any code maintained in the autoconf
repository, remove it from the list of files to fetch and keep it in
.gitignore.
This change exposed a bug in fetch.pl where it would crash when
there was no old copy of a file being updated.
* .gitignore: Remove /build-aux/install-sh.
* build-aux/fetch.pl (%to_fetch): Remove build-aux/mdate-sh.
(slurp): Don’t die on ENOENT, return undef.
(replace_if_change): Handle $oldcontents being undef.
* build-aux/install-sh: Is now checked in.
‘make fetch’ was updating several auxiliary files from the copy
embedded in Gnulib instead of from their official home. This patch
teaches fetch.pl to update as many as possible of them from their
official homes. The remaining exception is GNU license files, which,
except for fdl.texi, do not appear to have a public version control
system. Gnulib has a script for updating them, but it appears one
must be logged into some specific FSF-operated shell host for it to
work.
The files affected, and their official homes, are:
build-aux/install-sh automake
build-aux/mdate-sh automake
build-aux/config.guess config
build-aux/config.sub config
doc/fdl.texi gnustandards
doc/gnu-oids.texi gnustandards
doc/make-stds.texi gnustandards
doc/standards.texi gnustandards
doc/texinfo.tex texinfo
This change exposed a bug in fetch.sh: there is a subtle difference
between File::Spec->catpath and ->catfile and I should have been using
the latter.
* build-aux/fetch.pl: Can now fetch from arbitrary Savannah
repositories, not just from gnulib and automake. Fetch as
many files as possible from their official home, instead of
from gnulib. Use File::Spec->catfile, not ->catpath.
Strip trailing whitespace from all files.
Using HTTP::Tiny to talk to the network, instead of wget, means that
we can make just one TCP connection to git.savannah.gnu.org to do the
whole job, which is quite a bit faster. It should also be more
robust against weird characters in filenames / URLs and stuff.
The script has a higher requirement for Perl than is the standard in
autoconf -- 5.14 (first version with HTTP::Tiny), with IO::Socket::SSL
installed -- but that’s ok, I hope, because it’s maintainer-only and
not installed.
fetch.sh was the sole user of move-if-change, and the Perl script does
that job itself, but I left move-if-change in build-aux and on the fetch
list anyway, in case we discover another use for it in the future.
* build-aux/fetch.sh: Replace with...
* build-aux/fetch.pl: ... reimplementation in Perl.
* cfg.mk (fetch): Update to match.
This file seems to have been accidentally left off of the list of .pm
files that should be kept the same between automake and autom4te.
It’s already almost identical in both codebases.
It would make sense to sync ChannelDefs.pm too, but the copies of that
file in the two codebases have diverged; they would need to be
reconciled by hand first.
* build-aux/fetch.sh (automake_files): Add lib/Automake/Configure_ac.pm.
‘make fetch’ pulls the files maintained by Automake from gitweb, so we
always get the HEAD revision at the time of the operation. The files
maintained by Gnulib, on the other hand, are just copied from whatever
local gnulib checkout you happen to have on your hard drive at the
time, which might not have been updated recently and might not even be
checked out from gnulib trunk.
This patch makes us use the same logic for Gnulib that we do for
Automake. It also pulls all of the code out of cfg.mk to a separate
shell script. The lists of files to update from each repository are
also moved to that file.
* build-aux/fetch.sh: New script. Lists of files to fetch from
Gnulib and Automake are now kept here.
* cfg.mk (fetch): Run fetch.sh, it does all the work.
(gnulib-update, autom4te-update, WGETFLAGS, automake_gitweb)
(autom4te_files, move_if_change): Delete.
We generate manpages for autoconf’s installed programs (autoconf,
autoheader, etc.) using help2man, which runs each program in order to
learn its --help output. Each manpage therefore has a dependency on
the existence of the corresponding program, but this dependency is
intentionally left out of the Makefile so that one can build from a
tarball release (which will include prebuilt manpages) without having
help2man installed.
But when building from a git checkout with high levels of
parallelism (-j20 or so), the missing dependency can lead to build
failures, because help2man will try to run the program before it
exists. In an earlier patch I tried to work around this with a
recursive make invocation in the ‘.x.1’ rule, to ensure the existence
of the program. That only traded one concurrency bug for another, now
we could have two jobs trying to build the same program simultaneously
and they would clobber each other’s work and the build would still
fail.
Instead, this patch introduces a utility script ‘help-extract.pl’ that
reads --help and --version information directly from the source code
for each program. This utility, wrapped appropriately for each
program, is what help2man now runs. Usage is a little weird because
help2man doesn’t let you specify any arguments to the “executable”
that it runs, but it works, and lets us write all of the true
dependencies of each manpage into the Makefile without naming any file
that would be created during a build from a tarball. help-extract.pl
is a Perl script, so it introduces no new build-time requirements.
A downside is that we have to make sure each of the script sources in
bin/, and also part of lib/Autom4te/ChannelDefs.pm, are parseable by
help-extract. The most important constraints are that the text output
by --help must be defined in a global variable named ‘help’, and its
definition has to be formatted just the way these definitions are
currently formatted. Similarly for --version. Furthermore, only some
non-literal substitutions are possible in these texts; each has to be
explicitly supported in help-extract.pl. The current list of supported
substitutions is $0, @PACKAGE_NAME@, @VERSION@, @RELEASE_YEAR@, and
Autom4te::ChannelDefs::usage.
The generated manpages themselves are character-for-character
identical before and after this patch.
* build-aux/help-extract.pl: New build script that extracts --help
and --version output from manpages.
* man/autoconf.w, man/autoheader.w, man/autom4te.w, man/autoreconf.w
* man/autoscan.w, man/autoupdate.w, man/ifnames.w: New shell scripts
which wrap build-aux/help-extract.pl.
* man/local.mk: Generate each manpage by running help2man on the
corresponding .w script, not on the built utility itself.
Revise all dependencies to match.
* bin/autoconf.as: Rename ‘usage’ variable to ‘help’ and
‘help’ variable to ‘usage_err’.
* bin/autoheader.in: Call Autom4te::ChannelDefs::usage with no
function-call parentheses, matching all the other scripts.
* bin/autom4te.in: Initialize $version with a regular double-quoted
string, not a heredoc, matching all the other scripts.
* bin/autoscan.in: Remove global variable $configure_scan.
* build-aux/config.guess: This file.
* lib/Autom4te/Channels.pm: And this one.
* maint.mk: And this one.
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
'make syntax-check' complained about something that was already
fixed upstream in doc/standards.texi, so I ran 'make update', and
omitted lib/Autom4te as that still has some issues to be sorted out.
* GNUmakefile: Resync from upstream.
* build-aux/announce-gen: Likewise.
* build-aux/config.guess: Likewise.
* build-aux/config.sub: Likewise.
* build-aux/git-version-gen: Likewise.
* build-aux/gitlog-to-changelog: Likewise.
* build-aux/gnupload: Likewise.
* build-aux/move-if-change: Likewise.
* build-aux/texinfo.tex: Likewise.
* build-aux/update-copyright: Likewise.
* build-aux/useless-if-before-free: Likewise.
* build-aux/vc-list-files: Likewise.
* doc/gendocs_template: Likewise.
* doc/standards.texi: Likewise.
* m4/autobuild.m4: Likewise.
* maint.mk: Likewise.
The files in lib/Autom4te/ are intentionally not synced at this point,
since automake commit v1.11-2114-g2d671e1 "perl refactor: use modern
semantics of 'open'":
<http://lists.gnu.org/archive/html/automake-patches/2012-03/msg00111.html>
would require wider adaptation of our scripts to the new XFile API, and
also exposes some latent bugs in autoconf where we use raw 'open' instead
of XFile::open. We'll take care of that in a later patches (maybe).
* build-aux/announce-gen: Resync via 'make fetch'.
* build-aux/config.guess: Likewise.
* build-aux/config.sub: Likewise.
* build-aux/gendocs.sh: Likewise.
* build-aux/gitlog-to-changelog: Likewise.
* build-aux/gnupload: Likewise.
* build-aux/texinfo.tex: Likewise.
* doc/make-stds.texi: Likewise.
* doc/standards.texi: Likewise.
* maint.mk: Likewise.
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
The files in lib/Autom4te/ are intentionally not synced at this
point, since this recent Automake patch:
https://lists.gnu.org/archive/html/automake-patches/2012-03/msg00111.html
was buggy regarding '-' as stdout, and also exposes some latent
bugs in autoconf where we use raw 'open' instead of XFile::open.
* build-aux/announce-gen: Resync via 'make fetch'.
* build-aux/config.sub: Likewise.
* build-aux/git-version-gen: Likewise.
* build-aux/gnupload: Likewise.
* build-aux/move-if-change: Likewise.
* build-aux/texinfo.tex: Likewise.
* doc/standards.texi: Likewise.
* maint.mk: Likewise.
* cfg.mk (gnulib-update): Add them to the list.
* maint.mk: Update from gnulib.
* build-aux/gitlog-to-changelog: Likewise.
* build-aux/useless-if-before-free: New file, from gnulib.
* doc/gnu-oids.texi: Update.
Following the practice set by various other GNU projects, we start
to automatically generate the ChangeLog file from the git commit
messages. This will avoid duplication (as the ChangeLog entries
were always inserted both in the git commit message and in the
version-controlled ChangeLog file), and potential problems with
spurious merge conflicts (which, although greatly mitigated by
Bruno Haible's `git-merge-changelog' helper program, have never
been completely solved).
* ChangeLog: Moved ...
* ChangeLog.3: ... to this.
* build-aux/gitlog-to-changelog: New script, synced from gnulib.
* cfg.mk (gnulib-update): Also sync gitlog-to-changelog.
* Makefile.am (gen-ChangeLog): New .PHONY rule, generate the
ChangeLog for distribution.
(dist-hook): Depend on it.
($(srcdir)/ChangeLog): New dummy rule, to pacify automake "gnu"
strictness. Creates a dummy ChangeLog, that will be overridden
by the proper one at distribution time.
(gen_start_date): New variable, the date starting from which the
git log entries are to be copied in the generated ChangeLog.
(EXTRA_DIST): Add ChangeLog.3 and gitlog-to-changelog.
* configure.ac (AC_CONFIG_SRCDIR): Use 'lib/autoconf/autoconf.m4'
instead of 'ChangeLog' as the sentinel file.
* .gitignore: Add ChangeLog.
* maint.mk (PREV_VERSION_REGEXP): New macro, missed when
backporting update-NEWS_hash from gnulib.
* cfg.mk (old_NEWS_hash): Correctly generate.
* build-aux/gendocs.sh: Temporarily break sync from upstream, to
avoid including spurious directories in info source tarball.
Signed-off-by: Eric Blake <eblake@redhat.com>