source: trunk/build_support/ac_prog_perl_modules.m4 @ 1637

Last change on this file since 1637 was 1558, checked in by Peter, 13 years ago

svn-clean target - see README.developer - is handy for the RM

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
1# ===========================================================================
2#          http://autoconf-archive.cryp.to/ac_prog_perl_modules.html
3# ===========================================================================
4#
5# SYNOPSIS
6#
7#   AC_PROG_PERL_MODULES([MODULES], [ACTION-IF-TRUE], [ACTION-IF-FALSE])
8#
9# DESCRIPTION
10#
11#   Checks to see if the given perl modules are available. If true the shell
12#   commands in ACTION-IF-TRUE are executed. If not the shell commands in
13#   ACTION-IF-FALSE are run. Note if $PERL is not set (for example by
14#   calling AC_CHECK_PROG, or AC_PATH_PROG), AC_CHECK_PROG(PERL, perl, perl)
15#   will be run.
16#
17#   Example:
18#
19#     AC_CHECK_PERL_MODULES(Text::Wrap Net::LDAP, ,
20#                           AC_MSG_WARN(Need some Perl modules)
21#
22# LAST MODIFICATION
23#
24#   2008-04-12
25#
26# COPYLEFT
27#
28#   Copyright (c) 2008 Dean Povey <povey@wedgetail.com>
29#
30#   Copying and distribution of this file, with or without modification, are
31#   permitted in any medium without royalty provided the copyright notice
32#   and this notice are preserved.
33
34AC_DEFUN([AC_PROG_PERL_MODULES],[dnl
35ac_perl_modules="$1"
36# Make sure we have perl
37if test -z "$PERL"; then
38AC_CHECK_PROG(PERL,perl,perl)
39fi
40
41if test "x$PERL" != x; then
42  ac_perl_modules_failed=0
43  for ac_perl_module in $ac_perl_modules; do
44    AC_MSG_CHECKING(for perl module $ac_perl_module)
45
46    # Would be nice to log result here, but can't rely on autoconf internals
47    $PERL "-M$ac_perl_module" -e exit > /dev/null 2>&1
48    if test $? -ne 0; then
49      AC_MSG_RESULT(no);
50      ac_perl_modules_failed=1
51   else
52      AC_MSG_RESULT(ok);
53    fi
54  done
55
56  # Run optional shell commands
57  if test "$ac_perl_modules_failed" = 0; then
58    :
59    $2
60  else
61    :
62    $3
63  fi
64else
65  AC_MSG_WARN(could not find perl)
66fi])dnl
Note: See TracBrowser for help on using the repository browser.