From a432a981a00224528dcba09f82cc85f1fe58d9a4 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Tue, 10 Apr 2007 16:56:14 +0200 Subject: [PATCH] configure.in: Added check for `libperl'. --- configure.in | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/Makefile.am | 2 ++ 2 files changed, 59 insertions(+) diff --git a/configure.in b/configure.in index ebbf8a76..91d13e80 100644 --- a/configure.in +++ b/configure.in @@ -1073,6 +1073,57 @@ AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap], [Wether or not to use the pcap library]) AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes") +AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])], +[ + if test "x$withval" != "xno" && test "x$withval" != "xyes" + then + LDFLAGS="$LDFLAGS -L$withval/lib" + CPPFLAGS="$CPPFLAGS -I$withval/include" + with_libperl="yes" + fi +], +[ + with_libperl="yes" +]) +if test "x$with_libperl" = "xyes" +then + SAVE_CFLAGS=$CFLAGS + SAVE_LDFLAGS=$LDFLAGS + CFLAGS="$CFLAGS `perl -MExtUtils::Embed -e ccopts`" + LDFLAGS="$LDFLAGS `perl -MExtUtils::Embed -e ldopts`" + + AC_CACHE_CHECK([for libperl], + [have_libperl], + AC_LINK_IFELSE( + AC_LANG_PROGRAM( + [[ +#include +#include +#include + ]], + [[ + PerlInterpreter *perl = NULL; + Perl_load_module (perl, PERL_LOADMOD_NOIMPORT, + Perl_newSVpvf (perl, "Collectd::Plugin::%s", "foo"), + Nullsv); + ]]), + [have_libperl="yes"], + [have_libperl="no"] + ) + ) + + if test "x$have_libperl" = "xyes" + then + AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.]) + else + with_libperl="no" + fi + + CFLAGS=$SAVE_CFLAGS + LDFLAGS=$SAVE_LDFLAGS +fi +AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes") + AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])], [ if test "x$withval" != "xno" && test "x$withval" != "xyes" @@ -1253,6 +1304,11 @@ AC_COLLECTD([wireless], [disable], [module], [wireless link statistics]) AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile) +if test "x$with_libperl" != "xyes" +then + enable_perl="no (needs libperl)" +fi + cat <