| 1 |
dnl Source: |
| 2 |
dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_prog_perl_modules.html |
| 3 |
dnl |
| 4 |
dnl AC_PROG_PERL_MODULES([MODULES], [ACTION-IF-TRUE], [ACTION-IF-FALSE]) |
| 5 |
dnl |
| 6 |
dnl Checks to see if the the given perl modules are available. If |
| 7 |
dnl true the shell commands in ACTION-IF-TRUE are executed. If not |
| 8 |
dnl the shell commands in ACTION-IF-FALSE are run. Note if $PERL is |
| 9 |
dnl not set (for example by calling AC_CHECK_PROG, or AC_PATH_PROG), |
| 10 |
dnl AC_CHECK_PROG(PERL, perl, perl) will be run. |
| 11 |
dnl |
| 12 |
dnl Example: |
| 13 |
dnl |
| 14 |
dnl AC_CHECK_PERL_MODULES(Text::Wrap Net::LDAP, , |
| 15 |
dnl AC_MSG_WARN(Need some Perl modules) |
| 16 |
dnl |
| 17 |
|
| 18 |
|
| 19 |
AC_DEFUN([AC_PROG_PERL_MODULES],[dnl |
| 20 |
ac_perl_modules="$1" |
| 21 |
# Make sure we have perl |
| 22 |
if test -z "$PERL"; then |
| 23 |
AC_CHECK_PROG(PERL,perl,perl) |
| 24 |
fi |
| 25 |
|
| 26 |
if test "x$PERL" != x; then |
| 27 |
ac_perl_modules_failed=0 |
| 28 |
for ac_perl_module in $ac_perl_modules; do |
| 29 |
AC_MSG_CHECKING(for perl module $ac_perl_module) |
| 30 |
|
| 31 |
# Would be nice to log result here, but can't rely on autoconf internals |
| 32 |
$PERL "-M$ac_perl_module" -e exit > /dev/null 2>&1 |
| 33 |
if test $? -ne 0; then |
| 34 |
AC_MSG_RESULT(no); |
| 35 |
ac_perl_modules_failed=1 |
| 36 |
else |
| 37 |
AC_MSG_RESULT(ok); |
| 38 |
fi |
| 39 |
done |
| 40 |
|
| 41 |
# Run optional shell commands |
| 42 |
if test "$ac_perl_modules_failed" = 0; then |
| 43 |
: |
| 44 |
$2 |
| 45 |
else |
| 46 |
: |
| 47 |
$3 |
| 48 |
fi |
| 49 |
else |
| 50 |
AC_MSG_WARN(could not find perl) |
| 51 |
fi])dnl |
| 52 |
|
| 53 |
|