[collectd] [PATCH] configure: Build perl bindings only if a perl interpreter is available.

Sebastian Harl sh at tokkee.org
Wed Apr 16 18:53:30 CEST 2008


For this purpose a check for the perl interpreter has been added. As the
check for libperl requires a perl interpreter as well (to get the compiler
and linker flags) the perl module will be disabled as well if a perl
interpreter is not available.

Signed-off-by: Sebastian Harl <sh at tokkee.org>
---
 configure.in |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/configure.in b/configure.in
index 095509a..195fd3b 100644
--- a/configure.in
+++ b/configure.in
@@ -1375,9 +1375,19 @@ AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to l
 	with_libperl="yes"
 ])
 
+AC_MSG_CHECKING([for perl])
+perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
+if test -x "$perl_interpreter"
+then
+	AC_MSG_RESULT([yes])
+else
+	perl_interpreter=""
+	AC_MSG_RESULT([no])
+fi
+
 AC_SUBST(PERL, "$perl_interpreter")
 
-if test "x$with_libperl" = "xyes"
+if test "x$with_libperl" = "xyes" -a -n "$perl_interpreter"
 then
   SAVE_CFLAGS=$CFLAGS
   SAVE_LDFLAGS=$LDFLAGS
@@ -1417,7 +1427,10 @@ then
 
   CFLAGS=$SAVE_CFLAGS
   LDFLAGS=$SAVE_LDFLAGS
-fi
+else if test -z "$perl_interpreter"; then
+  with_libperl="no (no perl interpreter found)"
+  have_libperl="no"
+fi; fi
 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
 
 if test "x$with_libperl" = "xyes"
@@ -2354,7 +2367,12 @@ AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@
 ],
 [
 	PERL_BINDINGS_OPTIONS=""
-	with_perl_bindings="yes"
+	if test -n "$perl_interpreter"
+	then
+		with_perl_bindings="yes"
+	else
+		with_perl_bindings="no (no perl interpreter found)"
+	fi
 ])
 if test "x$with_perl_bindings" = "xyes"
 then
-- 
1.5.5.29.g7134

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20080416/92912a82/attachment.pgp 


More information about the collectd mailing list