contrib/exec-nagios.px: Added a Perl script which handles Nagios plugins.
[collectd.git] / configure.in
index 88323f3..04ba0f8 100644 (file)
@@ -698,6 +698,8 @@ AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to r
                librrd_cflags="-I$withval/include"
                librrd_ldflags="-L$withval/lib"
                with_rrdtool="yes"
+       else
+               with_rrdtool="$withval"
        fi
 ], [with_rrdtool="yes"])
 if test "x$with_rrdtool" = "xyes"
@@ -900,6 +902,8 @@ AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [P
                LDFLAGS="$LDFLAGS -L$withval/lib"
                CPPFLAGS="$CPPFLAGS -I$withval/include"
                with_libstatgrab="yes"
+       else
+               with_libstatgrab="$withval"
        fi
 ],
 [
@@ -1138,7 +1142,10 @@ AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to
        then
                with_liboping="no"
                with_own_liboping="no"
-       fi
+       else if test "x$withval" = "xyes"
+       then
+               with_liboping="yes"
+       fi; fi
 ],
 [
        with_liboping="yes"
@@ -1172,6 +1179,8 @@ AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to l
                LDFLAGS="$LDFLAGS -L$withval/lib"
                CPPFLAGS="$CPPFLAGS -I$withval/include"
                with_libpcap="yes"
+       else
+               with_libpcap="$withval"
        fi
 ],
 [
@@ -1210,6 +1219,8 @@ AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to l
                CPPFLAGS="$CPPFLAGS -I$withval/include"
                perl_interpreter="$withval/bin/perl"
                with_libperl="yes"
+       else
+               with_libperl="$withval"
        fi
 ],
 [
@@ -1261,6 +1272,41 @@ then
 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"
@@ -1268,6 +1314,8 @@ AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to l
                LDFLAGS="$LDFLAGS -L$withval/lib"
                CPPFLAGS="$CPPFLAGS -I$withval/include"
                with_libiptc="yes"
+       else
+               with_libiptc="$withval"
        fi
 ],
 [
@@ -1843,11 +1891,12 @@ plugin_entropy="no"
 plugin_interface="no"
 plugin_ipvs="no"
 plugin_irq="no"
-plugin_libvirtstats="no"
+plugin_libvirt="no"
 plugin_load="no"
 plugin_memory="no"
 plugin_multimeter="no"
 plugin_nfs="no"
+plugin_perl="no"
 plugin_processes="no"
 plugin_serial="no"
 plugin_swap="no"
@@ -1937,7 +1986,7 @@ fi
 
 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
 then
-       plugin_libvirtstats="yes"
+       plugin_libvirt="yes"
 fi
 
 if test "x$have_getloadavg" = "xyes"
@@ -1945,6 +1994,11 @@ then
        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
@@ -1998,7 +2052,7 @@ AC_PLUGIN([interface],   [$plugin_interface],  [Interface traffic statistics])
 AC_PLUGIN([iptables],    [$with_libiptc],      [IPTables rule counters])
 AC_PLUGIN([ipvs],        [$plugin_ipvs],       [IPVS connection statistics])
 AC_PLUGIN([irq],         [$plugin_irq],        [IRQ statistics])
-AC_PLUGIN([libvirtstats],[$plugin_libvirtstats], [Virtual machine statistics])
+AC_PLUGIN([libvirt],     [$plugin_libvirt],    [Virtual machine statistics])
 AC_PLUGIN([load],        [$plugin_load],       [System load])
 AC_PLUGIN([logfile],     [yes],                [File logging plugin])
 AC_PLUGIN([mbmon],       [yes],                [Query mbmond])
@@ -2012,7 +2066,7 @@ AC_PLUGIN([nfs],         [$plugin_nfs],        [NFS statistics])
 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])
@@ -2043,6 +2097,9 @@ AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@
        then
                PERL_BINDINGS_OPTIONS="$withval"
                with_perl_bindings="yes"
+       else
+               PERL_BINDINGS_OPTIONS=""
+               with_perl_bindings="$withval"
        fi
 ],
 [
@@ -2060,6 +2117,11 @@ AC_SUBST(PERL_BINDINGS_OPTIONS)
 
 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
 
+if test "x$with_rrdtool" = "xyes" -a "x$librrd_threadsafe" != "xyes"
+then
+       with_rrdtool="yes (warning: librrd is not thread-safe)"
+fi
+
 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
 then
        with_liboping="yes (shipped version)"
@@ -2128,7 +2190,7 @@ Configuration:
     iptables  . . . . . $enable_iptables
     ipvs  . . . . . . . $enable_ipvs
     irq . . . . . . . . $enable_irq
-    libvirtstats  . . . $enable_libvirtstats
+    libvirt . . . . . . $enable_libvirt
     load  . . . . . . . $enable_load
     logfile . . . . . . $enable_logfile
     mbmon . . . . . . . $enable_mbmon