autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AC_PROG_PERL (macro, docs, used in configure.in)


From: Tim Van Holder
Subject: AC_PROG_PERL (macro, docs, used in configure.in)
Date: Tue, 23 Jan 2001 22:11:07 +0100

Note: sincy my local tree has many as-of-yet-unsubmitted
patches, I do not include a patch for 'configure'.
BTW - any particular reason we use AC_OUTPUT(...) for our
own configure.in, while autoupdate tells the world to use
AC_CONFIG_FILES?

2001-01-23      Tim Van Holder <address@hidden>

        * acscpecific.m4 (AC_PROG_PERL): New macro. Adapted
        for autoconf 2.50 from a macro by Jim Meyering.
        * doc/autoconf.texi: Document it.
        * configure.in: Use it.

Index: configure.in
===================================================================
RCS file: /cvs/autoconf/configure.in,v
retrieving revision 1.38
diff -u -r1.38 configure.in
--- configure.in        2001/01/23 12:53:53     1.38
+++ configure.in        2001/01/23 20:54:57
@@ -27,13 +27,12 @@
 AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir)
 
 # We use a path for perl so the #! line in autoscan will work.
-AC_PATH_PROG(PERL, perl, no)
-AC_SUBST(PERL)dnl
+AC_PROG_PERL(5.004)
 AC_SUBST(PERLSCRIPTS)dnl
-if test "$PERL" != no; then
+if test -n "$PERL"; then
   PERLSCRIPTS=autoscan
 else
-  AC_MSG_WARN([autoscan will not be built since perl is not found])
+  AC_MSG_WARN([autoscan will not be built since perl >= 5.004 was not found])
 fi
 
 AC_PROG_INSTALL
Index: acspecific.m4
===================================================================
RCS file: /cvs/autoconf/acspecific.m4,v
retrieving revision 1.331
diff -u -r1.331 acspecific.m4
--- acspecific.m4       2001/01/23 17:04:36     1.331
+++ acspecific.m4       2001/01/23 20:54:54
@@ -297,6 +297,39 @@
 ])# AC_PROG_LN_S
 
 
+# AC_PROG_PERL([MIN-VERSION])
+# ---------------------------
+AC_DEFUN(AC_PROG_PERL,
+[# find perl binary
+AC_MSG_CHECKING([for perl])
+AC_CACHE_VAL(ac_cv_prog_PERL,
+[ifelse([$1],,,
+        [echo "configure:__oline__: ...version $1 required" 
>&AS_MESSAGE_LOG_FD])
+  # allow user to override
+  if test -n "$PERL"; then
+    ac_try="$PERL"
+  else
+    ac_try="perl perl5"
+  fi
+
+  for ac_prog in $ac_try; do
+    echo "configure:__oline__: trying $ac_prog" >&AS_MESSAGE_LOG_FD
+    if ($ac_prog -e 'printf "found version %g\n",$[@:>@];' ifelse([$1],,,
+        [-e 'require $1;'])) 1>&AS_MESSAGE_LOG_FD 2>&1; then
+      ac_cv_prog_PERL=$ac_prog
+      break
+    fi
+  done])dnl
+PERL="$ac_cv_prog_PERL"
+if test -n "$PERL"; then
+  AC_MSG_RESULT($PERL)
+else
+  AC_MSG_RESULT(no)
+fi
+AC_SUBST(PERL)dnl
+])# AC_PROG_PERL
+
+
 # AC_RSH
 # ------
 # I don't know what it used to do, but it no longer does.
Index: doc/autoconf.texi
===================================================================
RCS file: /cvs/autoconf/doc/autoconf.texi,v
retrieving revision 1.421
diff -u -r1.421 autoconf.texi
--- doc/autoconf.texi   2001/01/22 19:21:58     1.421
+++ doc/autoconf.texi   2001/01/23 20:55:06
@@ -2811,6 +2811,35 @@
 @end example
 @end defmac
 
address@hidden AC_PROG_PERL
address@hidden PROG_PERL
address@hidden PERL
+If @code{perl} is found, set output variable @code{PERL} to the name of its
+executable.  Otherwise, leave it empty.
+By default, @code{perl} and @code{perl5} are tried, but you can use the
address@hidden variable to override the list of executables to check.
+
+The optional argument to this macro specifies a minimum version to find;
address@hidden will not be set if too old a perl is found. Make sure you use
+perl's version numbering conventions though: '5.6' is seen as version 5,
+subversion 600 (not 6); you need to use 5.006 to require perl 5.6.0.
+
address@hidden
+PERL="perl myperl"
+AC_PROG_PERL
+if test -n "$PERL"; then
+  AC_DEFINE(HAVE_PERL, 1, [Define if you have perl or myperl.])
+fi
address@hidden example
+
address@hidden
+AC_PROG_PERL([5.006])
+if test -z "$PERL"; then
+  AC_MSG_ERROR([This package requires at least version 5.6 of perl.])
+fi
address@hidden example
address@hidden defmac
+
 @defmac AC_PROG_RANLIB
 @maindex PROG_RANLIB
 @ovindex RANLIB




reply via email to

[Prev in Thread] Current Thread [Next in Thread]