Code

build system: Use the prefix given to --with-libperl to set the path to the perl...
authorFlorian Forster <octo@crystal.wlan.home.verplant.org>
Fri, 20 Apr 2007 06:19:18 +0000 (08:19 +0200)
committerFlorian Forster <octo@crystal.wlan.home.verplant.org>
Fri, 20 Apr 2007 06:19:18 +0000 (08:19 +0200)
configure.in
src/Makefile.am

index 3d8cf403b2d31736f4a8428045a1b1a4038df064..2cb067b7c6ddabd679022956c9e084455eb6f231 100644 (file)
@@ -1073,12 +1073,14 @@ 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")
 
+perl_interpreter="perl"
 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"
+               perl_interpreter="$withval/bin/perl"
                with_libperl="yes"
        fi
 ],
@@ -1089,8 +1091,10 @@ 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`"
+  PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
+  PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
+  CFLAGS="$CFLAGS $PERL_CFLAGS"
+  LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
 
   AC_CACHE_CHECK([for libperl],
     [have_libperl],
@@ -1104,7 +1108,7 @@ then
       [[
        PerlInterpreter *perl = NULL;
        Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
-                        Perl_newSVpvf (perl, "Collectd::Plugin::%s", "foo"),
+                        newSVpv ("Collectd::Plugin::FooBar", 24),
                         Nullsv);
       ]]),
       [have_libperl="yes"],
@@ -1115,6 +1119,8 @@ then
   if test "x$have_libperl" = "xyes"
   then
          AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
+         AC_SUBST(PERL_CFLAGS)
+         AC_SUBST(PERL_LDFLAGS)
   else
          with_libperl="no"
   fi
index 99a8de2d05061a557f2efd5230963c0e19e4cb2b..72d67b3be3c0410015048ef75c409009b0a3979d 100644 (file)
@@ -401,10 +401,10 @@ if BUILD_MODULE_PERL
 pkglib_LTLIBRARIES += perl.la
 perl_la_SOURCES = perl.c
 perl_la_CFLAGS  = $(AM_CFLAGS) \
-                 $(shell perl -MExtUtils::Embed -e ccopts) \
+                 $(PERL_CFLAGS) \
                  -DXS_VERSION=\"$(VERSION)\" -DVERSION=\"$(VERSION)\"
 perl_la_LDFLAGS = -module -avoid-version \
-                 $(shell perl -MExtUtils::Embed -e ldopts)
+                 $(PERL_LDFLAGS)
 collectd_LDADD += "-dlopen" perl.la
 collectd_DEPENDENCIES += perl.la
 endif