| 1 |
# zw_prog_perl.m4 -*- autoconf -*- |
| 2 |
# serial 1 |
| 3 |
# |
| 4 |
# inspired by, but shares no code with, ax_prog_perl_version.m4 by |
| 5 |
# Franceso Salvestrini |
| 6 |
# |
| 7 |
# SYNOPSIS |
| 8 |
# |
| 9 |
# zw_PROG_PERL([VERSION], [ACTION-IF-TRUE], |
| 10 |
# [ACTION-IF-FALSE = (error out)]) |
| 11 |
# |
| 12 |
# DESCRIPTION |
| 13 |
# |
| 14 |
# Locate a Perl interpreter, and then verify that its version number |
| 15 |
# is greater than or equal to VERSION. If it is, set output variable |
| 16 |
# PERL to the absolute path of that interpreter, and execute |
| 17 |
# ACTION-IF-TRUE, if present. Otherwise, execute ACTION-IF-FALSE. |
| 18 |
# If ACTION-IF-FALSE is not present it defaults to issuing an error |
| 19 |
# and stopping the configuration process. |
| 20 |
# |
| 21 |
# LICENSE |
| 22 |
# |
| 23 |
# Copyright (c) 2020 Zack Weinberg <[email protected]> |
| 24 |
# |
| 25 |
# Copying and distribution of this file, with or without modification, are |
| 26 |
# permitted in any medium without royalty provided the copyright notice |
| 27 |
# and this notice are preserved. This file is offered as-is, without any |
| 28 |
# warranty. |
| 29 |
|
| 30 |
#serial 13 |
| 31 |
|
| 32 |
AC_DEFUN([zw_PROG_PERL], |
| 33 |
[AC_PATH_PROG([PERL], [perl]) |
| 34 |
AC_MSG_CHECKING([whether $PERL is version $1 or later]) |
| 35 |
_AS_ECHO_LOG([$PERL -e 'use v$1;']) |
| 36 |
AS_IF(["$PERL" -e 'use v$1;' >&AS_MESSAGE_LOG_FD 2>&1], |
| 37 |
[AC_MSG_RESULT([yes])m4_ifnblank([$2], [ |
| 38 |
$2])], |
| 39 |
[AC_MSG_RESULT([no]) |
| 40 |
m4_default([$3], [AC_MSG_ERROR([Perl version $1 or later is required])])])]) |