PageRenderTime 12ms CodeModel.GetById 10ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/tools/autotools/m4/perl-autofrisk.m4

#
m4 | 57 lines | 25 code | 4 blank | 28 comment | 0 complexity | 2ffaee245ed31e7657879201b8cb31a1 MD5 | raw file
 1#
 2# SYNOPSIS
 3#
 4#   PERL_AUTOFRISK_MODULES(MODULES,[ACTION-IF-TRUE],[ACTION-IF-FALSE])
 5#
 6# This macro looks if the supplied MODULES are available under the perl
 7# interpreter supplied into the PERL environment variable.
 8# All log message will be dumped to config.log.
 9#
10# COPYLEFT
11#
12#  Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>
13#
14#   This program is free software; you can redistribute it and/or
15#   modify it under the terms of the GNU General Public License as
16#   published by the Free Software Foundation; either version 2 of the
17#   License, or (at your option) any later version.
18#
19#   This program is distributed in the hope that it will be useful, but
20#   WITHOUT ANY WARRANTY; without even the implied warranty of
21#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22#   General Public License for more details.
23#
24#   You should have received a copy of the GNU General Public License
25#   along with this program; if not, write to the Free Software
26#   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27#   02111-1307, USA.
28
29AC_DEFUN([PERL_AUTOFRISK_MODULES],[
30  pa_perl_modules="$1"
31
32  AS_IF([test -n "$PERL"],[
33    pa_perl_modules_failed=0
34    for pa_perl_module in $pa_perl_modules; do
35      AC_MSG_CHECKING(for perl module $pa_perl_module)
36
37      # Perform check and log its output to config.log
38      AS_IF([AC_TRY_COMMAND($PERL "-M$pa_perl_module" -e exit 1>&AS_MESSAGE_LOG_FD)],[
39        AC_MSG_RESULT([yes]);
40      ],[
41        AC_MSG_RESULT([no]);
42        pa_perl_modules_failed=1
43      ])
44    done
45
46    AS_IF([test "$pa_perl_modules_failed" = 0],[
47      :
48      $2
49    ],[
50      :
51      $3
52    ])
53  ],[
54    :
55    $3
56  ])
57])