summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c9db0c1)
raw | patch | inline | side by side (parent: c9db0c1)
author | Sebastian Harl <sh@tokkee.org> | |
Tue, 13 Nov 2007 22:58:20 +0000 (23:58 +0100) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Wed, 14 Nov 2007 10:37:22 +0000 (11:37 +0100) |
Disable the perl plugin if Perl does not support ithreads (introduced in Perl
5.6). The configure script will check, if USE_ITHREADS has been defined. Also,
the perl plugin won't build if it has not been defined.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
5.6). The configure script will check, if USE_ITHREADS has been defined. Also,
the perl plugin won't build if it has not been defined.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
configure.in | patch | blob | history | |
src/perl.c | patch | blob | history |
diff --git a/configure.in b/configure.in
index 2936058c071d00b8b6d7f027abb2bdf18341b710..d9bca160fc8fb3152740f0365d6b59b2265040f4 100644 (file)
--- a/configure.in
+++ b/configure.in
fi
AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
+if test "x$with_libperl" = "xyes"
+then
+ SAVE_CFLAGS=$CFLAGS
+ SAVE_LDFLAGS=$LDFLAGS
+ CFLAGS="$CFLAGS $PERL_CFLAGS"
+ LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
+
+ AC_CACHE_CHECK([if perl supports ithreads],
+ [have_perl_ithreads],
+ AC_LINK_IFELSE(
+ AC_LANG_PROGRAM(
+ [[
+#include <EXTERN.h>
+#include <perl.h>
+#include <XSUB.h>
+
+#if !defined(USE_ITHREADS)
+# error "Perl does not support ithreads!"
+#endif /* !defined(USE_ITHREADS) */
+ ]],
+ [[ ]]),
+ [have_perl_ithreads="yes"],
+ [have_perl_ithreads="no"]
+ )
+ )
+
+ if test "x$have_perl_ithreads" = "xyes"
+ then
+ AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
+ fi
+
+ CFLAGS=$SAVE_CFLAGS
+ LDFLAGS=$SAVE_LDFLAGS
+fi
+
AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
[
if test "x$withval" != "xno" && test "x$withval" != "xyes"
plugin_memory="no"
plugin_multimeter="no"
plugin_nfs="no"
+plugin_perl="no"
plugin_processes="no"
plugin_serial="no"
plugin_swap="no"
plugin_load="yes"
fi
+if test "x$have_libperl$have_perl_ithreads" = "xyesyes"
+then
+ plugin_perl="yes"
+fi
+
# Mac OS X memory interface
if test "x$have_host_statistics" = "xyes"
then
AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
AC_PLUGIN([ntpd], [yes], [NTPd statistics])
AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
-AC_PLUGIN([perl], [$with_libperl], [Embed a Perl interpreter])
+AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
diff --git a/src/perl.c b/src/perl.c
index 1ed9d003d12ad84d3ce105fd18bdca70f8c6931d..1a380feb64e5b8981e36cb45e26b10ed86b0d2cc 100644 (file)
--- a/src/perl.c
+++ b/src/perl.c
#include "plugin.h"
#include "common.h"
+#if !defined(USE_ITHREADS)
+# error "Perl does not support ithreads!"
+#endif /* !defined(USE_ITHREADS) */
+
#define PLUGIN_INIT 0
#define PLUGIN_READ 1
#define PLUGIN_WRITE 2