]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Require Perl 5.10.0 or later.
authorZack Weinberg <zackw@panix.com>
Sun, 10 Jul 2022 14:52:33 +0000 (10:52 -0400)
committerZack Weinberg <zackw@panix.com>
Sun, 10 Jul 2022 14:52:33 +0000 (10:52 -0400)
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”.

16 files changed:
NEWS
build-aux/fetch.pl
build-aux/help-extract.pl
configure.ac
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
m4/perl-time-hires.m4 [new file with mode: 0644]
tests/mktests.pl

diff --git a/NEWS b/NEWS
index 91164390717459d86af81de97328393ca3a0dc80..a84757073c8d8c53ec16001bf966b9ee3c4a93fa 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,7 +4,7 @@ GNU Autoconf NEWS - User visible changes.
 
 ** Backward incompatibilities
 
-*** Autoconf now requires perl 5.8 (2002) or later.
+*** Autoconf now requires perl 5.10 (2007) or later.
   Generated 'configure' scripts continue to run without perl.
 
 *** Autoconf now requires GNU M4 1.4.8 (2006) or later.
index e4a4a484d05fd37d6adb5a492911e6777f3a7ecc..3dc9bc78d5f5cda6f5c8f3e6bbbc4e602d762cbd 100755 (executable)
@@ -240,6 +240,7 @@ sub fetch ($$$$$$)
   # don't use \s here or it will eat blank lines
   $content =~ s/[ \t]+$//gm;
   $content =~ s/\bAutomake::/Autom4te::/g if $edit;
+  $content =~ s/^use 5\.006;$/use 5.010;/mg if $edit;
 
   replace_if_change ($destpath, $content, $quiet);
 }
index bcec850407626171e7faf51412e8deae99dfab56..931331e302e124b6f4fe1ad0b2c7f665e1b7f701 100644 (file)
@@ -16,6 +16,7 @@
 
 # Written by Zack Weinberg.
 
+use 5.010;
 use strict;
 use warnings;
 
index 9362ddf3038740a9e4e389fd7f5643a93a0bf457..3d849ac4fd22df0a703626d3dbf40607cbf0c6ed 100644 (file)
@@ -153,14 +153,7 @@ AM_MISSING_PROG([HELP2MAN], [help2man])
 ## ------ ##
 
 # We use an absolute name for perl so the #! line in autoscan will work.
-AC_PATH_PROG([PERL], [perl], [no])
-AC_SUBST([PERL])dnl
-if test "$PERL" = no; then
-  AC_MSG_ERROR([perl is not found])
-fi
-$PERL -e 'require 5.006;' || {
-   AC_MSG_ERROR([Perl 5.006 or better is required])
-}
+AC_PATH_PERL_WITH_TIME_HIRES_STAT
 
 # Find out whether the system supports flock
 # Note this test does not try to find out whether it works with this
index 9276eb60fa9437fe9844379ebb7cc2ed285d8be6..8b7c3c117cf7fc308985e8750bc44ee45f1d4e46 100644 (file)
@@ -31,7 +31,7 @@ This Perl module handles the cache of M4 runs used by autom4te.
 
 =cut
 
-use 5.006;
+use 5.010;
 use strict;
 use warnings FATAL => 'all';
 
index 62e693239797768159c92bde3965f7db6e14aeb3..6b60f2054b123c1964f6dfd31bf3bd60d11d6121 100644 (file)
@@ -44,7 +44,7 @@ shorthand function to output on specific channels.
 
 =cut
 
-use 5.006;
+use 5.010;
 use strict;
 use warnings FATAL => 'all';
 
index 83090e8627758306a53f072b65db7094c03318cf..0dc397493c07d22f3d40238c2826175a611593a3 100644 (file)
@@ -66,7 +66,7 @@ etc.) that can also be overridden on a per-message basis.
 
 =cut
 
-use 5.006;
+use 5.010;
 use strict;
 use warnings FATAL => 'all';
 
index 405c671f460c04dbbeede81fe9b0dc5a56bb3f19..9d4c3d833722f418a357ee64158c9ddd2a63295a 100644 (file)
@@ -25,7 +25,7 @@ package Autom4te::Config;
 # and autoconf's build machinery is not prepared to do that.
 # Revisit after 2.70.
 
-use 5.006;
+use 5.010;
 use strict;
 use warnings FATAL => 'all';
 
index 78b161bce88871fe598ac88a6fe7877e91c92bbb..5d6d80cb5eac9dddad26e9b0e98bf54cf5b4d7aa 100644 (file)
@@ -20,7 +20,7 @@
 
 package Autom4te::Configure_ac;
 
-use 5.006;
+use 5.010;
 use strict;
 use warnings FATAL => 'all';
 
index 60b66cd67bea2ec7e3382a6c0c5c2dbe8936257a..14982a4aa806ac450ceca4fde865bc42db50a03e 100644 (file)
@@ -34,7 +34,7 @@ This perl module provides various general purpose file handling functions.
 
 =cut
 
-use 5.008;
+use 5.010;
 use strict;
 use warnings FATAL => 'all';
 
index 727f29758903a0141e3ce678e31eaee7ea0553b4..a0f29043497aa1c96011612067cbc6e6385ec39a 100644 (file)
@@ -32,7 +32,7 @@ used in several executables of the Autoconf package.
 
 =cut
 
-use 5.006;
+use 5.010;
 use strict;
 use warnings FATAL => 'all';
 
index c32c2cce5f9f98284b1d40dd2a578b80773d8520..1ef2f99c564e1e2bf4bf9835c825981ab97b9d36 100644 (file)
@@ -30,7 +30,7 @@ line options in conformance to the GNU Coding standards.
 
 =cut
 
-use 5.006;
+use 5.010;
 use strict;
 use warnings FATAL => 'all';
 
index 1641666d9aac9a23004c7620f1faf6140c02cd95..c137ef2162fae924cd2c01f4961cc379b128048b 100644 (file)
@@ -32,7 +32,7 @@ used in several executables of the Autoconf and Automake packages.
 
 =cut
 
-use 5.006;
+use 5.010;
 use strict;
 use warnings FATAL => 'all';
 
index fcc0e68ba2516508b62457e85e1049cf299cbaf6..3b385c57f1a688e8c28b6b581eb9f2c9c4d481a0 100644 (file)
@@ -69,7 +69,7 @@ and C<getlines> methods to translate C<\r\n> to C<\n>.
 
 =cut
 
-use 5.006;
+use 5.010;
 use strict;
 use warnings FATAL => 'all';
 
diff --git a/m4/perl-time-hires.m4 b/m4/perl-time-hires.m4
new file mode 100644 (file)
index 0000000..87e3dff
--- /dev/null
@@ -0,0 +1,74 @@
+# perl-time-hires.m4 serial 1
+
+# Copyright (C) 2022 Free Software Foundation, Inc.
+
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.  This file is offered as-is,
+# without warranty of any kind.
+
+# AClocal_PATH_PROG_GLOBS_FEATURE_CHECK
+# ---------------------------------
+# Like AC_PATH_PROGS_FEATURE_CHECK, but each of 'progs-to-check-for' may
+# be a shell glob, which is expanded once for each path entry.
+# That is, AClocal_PATH_PROG_GLOBS_FEATURE_CHECK([PERL], [perl-*]) will
+# test each program named something like 'perl-*' found anywhere on the
+# path.  Due to the syntax conflict with Autoconf string quoting,
+# character sets (e.g. perl-[56]*) are not supported.
+m4_define([AClocal_PATH_PROG_GLOBS_FEATURE_CHECK],
+[if test -z "$$1"; then
+  ac_path_$1_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  dnl AS_ESCAPE has been excessively optimized and does not work for anything
+  dnl other than constructing strings.  I have not been able to figure out how
+  dnl to get [ and ] through this process without mangling them, so
+  dnl character sets are not supported for now.
+  _AS_PATH_WALK([$5],
+  [for ac_prog in m4_bpatsubst([$2], [[!?*]], [\\\&])
+   do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_pathglob_$1="$as_dir$ac_prog$ac_exec_ext"
+      for ac_path_$1 in $ac_pathglob_$1; do
+        AS_EXECUTABLE_P(["$ac_path_$1"]) || continue
+$3
+        $ac_path_$1_found && break 4
+      done
+    done
+  done])dnl
+  if test -z "$ac_cv_path_$1"; then
+    m4_default([$4],
+      [AC_MSG_ERROR([no acceptable m4_bpatsubst([$2], [ .*]) could be dnl
+found in m4_default([$5], [\$PATH])])])
+  fi
+else
+  ac_cv_path_$1=$$1
+fi
+])
+
+# AC_PATH_PERL_WITH_TIME_HIRES_STAT
+# ---------------------------------
+# Check for a version of perl that supports Time::HiRes::stat.
+# This was added to perl core in 5.10 and it's convenient to
+# have a consistent 'use 5.0xx' baseline for all the perl scripts,
+# so that is the version we require, even though technically we
+# could be getting away with 5.8 or even 5.6 in many of the scripts.
+# (Note: Files shared with Automake do not necessarily use our baseline.)
+AC_DEFUN([AC_PATH_PERL_WITH_TIME_HIRES_STAT],
+  [AC_ARG_VAR([PERL], [Location of Perl 5.10 or later.  Defaults to
+    the first program named 'perl', 'perl5*', or 'perl-5.*' on the PATH
+    that meets Autoconf's needs.])
+  AC_CACHE_CHECK([for Perl >=5.10.0 with Time::HiRes::stat],
+                 [ac_cv_path_PERL],
+    [AClocal_PATH_PROG_GLOBS_FEATURE_CHECK(
+        [PERL], [perl perl5* perl-5.*],
+        [AS_ECHO("$as_me:${as_lineno-$LINENO}: trying $ac_path_PERL") \
+             >&AS_MESSAGE_LOG_FD
+         $ac_path_PERL >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD -e '
+  use 5.010;
+  use Time::HiRes qw(stat);
+  1;' \
+         && ac_cv_path_PERL=$ac_path_PERL ac_path_PERL_found=:],
+    [AC_MSG_ERROR([no acceptable perl could be found in \$PATH.
+Perl 5.10.0 or later is required, with Time::HiRes::stat.])])])
+  PERL=$ac_cv_path_PERL
+])
index b68426820ddeb94ea15afef5003d549c4d5220d1..f4acfb80b175a8400afb42b052456cadefdcc159 100644 (file)
@@ -17,7 +17,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
-use 5.006;
+use 5.010;
 use strict;
 use warnings FATAL => 'all';