(jm_PERL): Use $am_missing_run, not undefined $missing_dir.
[gnulib.git] / m4 / perl.m4
1 #serial 5
2
3 dnl From Jim Meyering.
4 dnl Find a new-enough version of Perl.
5 dnl
6
7 AC_DEFUN([jm_PERL],
8 [
9   dnl FIXME: don't hard-code 5.003
10   dnl FIXME: should we cache the result?
11   AC_MSG_CHECKING([for perl5.003 or newer])
12   if test "${PERL+set}" = set; then
13     # `PERL' is set in the user's environment.
14     candidate_perl_names="$PERL"
15     perl_specified=yes
16   else
17     candidate_perl_names='perl perl5'
18     perl_specified=no
19   fi
20
21   found=no
22   AC_SUBST(PERL)
23   PERL="$am_missing_run perl"
24   for perl in $candidate_perl_names; do
25     # Run test in a subshell; some versions of sh will print an error if
26     # an executable is not found, even if stderr is redirected.
27     if ( $perl -e 'require 5.003; use File::Compare' ) > /dev/null 2>&1; then
28       PERL=$perl
29       found=yes
30       break
31     fi
32   done
33
34   AC_MSG_RESULT($found)
35   test $found = no && AC_MSG_WARN([
36 WARNING: You don't seem to have perl5.003 or newer installed, or you lack
37          a usable version of the Perl File::Compare module.  As a result,
38          you may be unable to run a few tests or to regenerate certain
39          files if you modify the sources from which they are derived.
40 ] )
41 ])