]> Savannah Git Hosting - gnulib.git/commitdiff
perl: let caller see whether perl was found
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 28 Dec 2021 09:51:56 +0000 (01:51 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 28 Dec 2021 09:52:18 +0000 (01:52 -0800)
Problem reported for coreutils by Serge Belyshev (Bug#52844).
* m4/perl.m4 (gl_PERL): Use AC_CACHE_CHECK, so that
an invoker of gl_PERL can later inspect gl_cv_prog_perl
to see whether perl was found.

ChangeLog
m4/perl.m4

index 7402d0ca4ebe7bbc4c84936bfa9f1dc5f0a0c7a8..44f69d394a337e51e1764c94c58a9fb714d7abd1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2021-12-28  Paul Eggert  <eggert@cs.ucla.edu>
+
+       perl: let caller see whether perl was found
+       Problem reported for coreutils by Serge Belyshev (Bug#52844).
+       * m4/perl.m4 (gl_PERL): Use AC_CACHE_CHECK, so that
+       an invoker of gl_PERL can later inspect gl_cv_prog_perl
+       to see whether perl was found.
+
 2021-12-28  Bruno Haible  <bruno@clisp.org>
 
        Fix --automake-subdir breakage (regression 2021-12-24).
index 0d551017a6a8986c7cd4b6010ccd48363e979ae1..1e3fdeb5e501291925a24a650ece32186ed39956 100644 (file)
@@ -1,4 +1,4 @@
-# serial 10
+# serial 11
 
 dnl From Jim Meyering.
 dnl Find a new-enough version of Perl.
@@ -13,7 +13,9 @@ dnl Find a new-enough version of Perl.
 AC_DEFUN([gl_PERL],
 [
   dnl FIXME: don't hard-code 5.005
-  AC_MSG_CHECKING([for perl5.005 or newer])
+AC_CACHE_CHECK([for Perl 5.005 or newer],
+ [gl_cv_prog_perl],
+ [
   if test "${PERL+set}" = set; then
     # 'PERL' is set in the user's environment.
     candidate_perl_names="$PERL"
@@ -23,24 +25,29 @@ AC_DEFUN([gl_PERL],
     perl_specified=no
   fi
 
-  found=no
-  AC_SUBST([PERL])
-  PERL="$am_missing_run perl"
+  gl_cv_prog_perl=no
   for perl in $candidate_perl_names; do
     # Run test in a subshell; some versions of sh will print an error if
     # an executable is not found, even if stderr is redirected.
     if ( $perl -e 'require 5.005; use File::Compare; use warnings;' ) > /dev/null 2>&1; then
-      PERL=$perl
-      found=yes
+      gl_cv_prog_perl=$perl
       break
     fi
   done
+ ])
 
-  AC_MSG_RESULT([$found])
-  test $found = no && AC_MSG_WARN([
+if test "$gl_cv_prog_perl" != no; then
+  PERL=$gl_cv_prog_perl
+else
+  PERL="$am_missing_run perl"
+  AC_MSG_WARN([
 WARNING: You don't seem to have perl5.005 or newer installed, or you lack
          a usable version of the Perl File::Compare module.  As a result,
          you may be unable to run a few tests or to regenerate certain
          files if you modify the sources from which they are derived.
 ] )
+fi
+
+AC_SUBST([PERL])
+
 ])