Skip to content

Commit dcc7e9b

Browse files
author
David Reiss
committed
THRIFT-850. Use AX_PROG_PERL_MODULES to test for Bit::Vector
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@991249 13f79535-47bb-0310-9956-ffa450edef68
1 parent ea4c981 commit dcc7e9b

File tree

2 files changed

+81
-4
lines changed

2 files changed

+81
-4
lines changed

aclocal/ax_prog_perl_modules.m4

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# ===========================================================================
2+
# http://www.gnu.org/software/autoconf-archive/ax_prog_perl_modules.html
3+
# ===========================================================================
4+
#
5+
# SYNOPSIS
6+
#
7+
# AX_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+
# MODULES is a space separated list of module names. To check for a
18+
# minimum version of a module, append the version number to the module
19+
# name, separated by an equals sign.
20+
#
21+
# Example:
22+
#
23+
# AX_PROG_PERL_MODULES( Text::Wrap Net::LDAP=1.0.3, ,
24+
# AC_MSG_WARN(Need some Perl modules)
25+
#
26+
# LICENSE
27+
#
28+
# Copyright (c) 2009 Dean Povey <[email protected]>
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. This file is offered as-is, without any
33+
# warranty.
34+
35+
#serial 7
36+
37+
AU_ALIAS([AC_PROG_PERL_MODULES], [AX_PROG_PERL_MODULES])
38+
AC_DEFUN([AX_PROG_PERL_MODULES],[dnl
39+
40+
m4_define([ax_perl_modules])
41+
m4_foreach([ax_perl_module], m4_split(m4_normalize([$1])),
42+
[
43+
m4_append([ax_perl_modules],
44+
[']m4_bpatsubst(ax_perl_module,=,[ ])[' ])
45+
])
46+
47+
# Make sure we have perl
48+
if test -z "$PERL"; then
49+
AC_CHECK_PROG(PERL,perl,perl)
50+
fi
51+
52+
if test "x$PERL" != x; then
53+
ax_perl_modules_failed=0
54+
for ax_perl_module in ax_perl_modules; do
55+
AC_MSG_CHECKING(for perl module $ax_perl_module)
56+
57+
# Would be nice to log result here, but can't rely on autoconf internals
58+
$PERL -e "use $ax_perl_module; exit" > /dev/null 2>&1
59+
if test $? -ne 0; then
60+
AC_MSG_RESULT(no);
61+
ax_perl_modules_failed=1
62+
else
63+
AC_MSG_RESULT(ok);
64+
fi
65+
done
66+
67+
# Run optional shell commands
68+
if test "$ax_perl_modules_failed" = 0; then
69+
:
70+
$2
71+
else
72+
:
73+
$3
74+
fi
75+
else
76+
AC_MSG_WARN(could not find perl)
77+
fi])dnl

configure.ac

+4-4
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ AM_CONDITIONAL(WITH_PYTHON, [test "$have_python" = "yes"])
153153
AX_THRIFT_LIB(perl, [Perl], yes)
154154
if test "$with_perl" = "yes"; then
155155
AC_PATH_PROG([PERL], [perl])
156-
if test -n "`$PERL -MBit::Vector -e exit 2>&1`"; then
157-
AC_MSG_WARN([Perl Bit::Vector module not installed, skipping perl])
158-
have_perl_bit_vector="no"
156+
if test -n "$PERL" ; then
157+
AC_PROG_PERL_MODULES([Bit::Vector], success="yes", success="no")
158+
have_perl_bit_vector="$success"
159159
fi
160-
if test -n "$PERL" -a -z "$have_perl_bit_vector" ; then
160+
if test -n "$PERL" -a "$have_perl_bit_vector" = "yes" ; then
161161
have_perl="yes"
162162
fi
163163
fi

0 commit comments

Comments
 (0)