Imported Upstream version 2.6.0
[debian/amanda] / config / macro-archive / ac_prog_perl_version.m4
1 ##### http://autoconf-archive.cryp.to/ac_prog_perl_version.html
2 #
3 # SYNOPSIS
4 #
5 #   AC_PROG_PERL_VERSION(VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
6 #
7 # DESCRIPTION
8 #
9 #   Makes sure that perl supports the version indicated. If true the
10 #   shell commands in ACTION-IF-TRUE are executed. If not the shell
11 #   commands in ACTION-IF-FALSE are run. Note if $PERL is not set (for
12 #   example by running AC_CHECK_PROG or AC_PATH_PROG),
13 #   AC_CHECK_PROG(PERL, perl, perl) will be run.
14 #
15 #   Example:
16 #
17 #     AC_PROG_PERL_VERSION(5.6.0)
18 #
19 #   This will check to make sure that the perl you have supports at
20 #   least version 5.6.0.
21 #
22 # LAST MODIFICATION
23 #
24 #   2002-09-25
25 #
26 # COPYLEFT
27 #
28 #   Copyright (c) 2002 Dean Povey <povey@wedgetail.com>
29 #
30 #   Copying and distribution of this file, with or without
31 #   modification, are permitted in any medium without royalty provided
32 #   the copyright notice and this notice are preserved.
33
34 AC_DEFUN([AC_PROG_PERL_VERSION],[dnl
35 # Make sure we have perl
36 if test -z "$PERL"; then
37 AC_CHECK_PROG(PERL,perl,perl)
38 fi
39
40 # Check if version of Perl is sufficient
41 ac_perl_version="$1"
42
43 if test "x$PERL" != "x"; then
44   AC_MSG_CHECKING(for perl version greater than or equal to $ac_perl_version)
45   # NB: It would be nice to log the error if there is one, but we cannot rely
46   # on autoconf internals
47   $PERL -e "use $ac_perl_version;" > /dev/null 2>&1
48   if test $? -ne 0; then
49     AC_MSG_RESULT(no);
50     $3
51   else
52     AC_MSG_RESULT(ok);
53     $2
54   fi
55 else
56   AC_MSG_WARN(could not find perl)
57 fi
58 ])dnl
59