curl_json plugin: Add compatibility code for libyajl v2.
[collectd.git] / configure.in
index ac07f00..88cdb50 100644 (file)
@@ -47,6 +47,9 @@ AC_PROG_LEX
 AC_PROG_YACC
 PKG_PROG_PKG_CONFIG
 
+AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no])
+AM_CONDITIONAL(HAVE_PROTOC_C, test "x$have_protoc_c" = "xyes")
+
 AC_MSG_CHECKING([for kernel type ($host_os)])
 case $host_os in
        *linux*)
@@ -88,6 +91,10 @@ if test "x$ac_system" = "xSolaris"
 then
        AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
 fi
+if test "x$ac_system" = "xAIX"
+then
+       AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.])
+fi
 
 # Where to install .pc files.
 pkgconfigdir="${libdir}/pkgconfig"
@@ -481,6 +488,13 @@ AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr
 
 AC_FUNC_STRERROR_R
 
+SAVE_CFLAGS="$CFLAGS"
+# Emulate behavior of src/Makefile.am
+if test "x$GCC" = "xyes"
+then
+       CFLAGS="$CFLAGS -Wall -Werror"
+fi
+
 AC_CACHE_CHECK([for strtok_r],
   [c_cv_have_strtok_r_default],
   AC_LINK_IFELSE(
@@ -511,7 +525,6 @@ AC_CACHE_CHECK([for strtok_r],
 
 if test "x$c_cv_have_strtok_r_default" = "xno"
 then
-  SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -D_REENTRANT=1"
 
   AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
@@ -543,6 +556,12 @@ then
   )
 fi
 
+CFLAGS="$SAVE_CFLAGS"
+if test "x$c_cv_have_strtok_r_reentrant" = "xyes"
+then
+       CFLAGS="$CFLAGS -D_REENTRANT=1"
+fi
+
 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
 
 socket_needs_socket="no"
@@ -952,7 +971,7 @@ fi
 AC_MSG_CHECKING([if have htonll defined])
 
     have_htonll="no"
-    AC_RUN_IFELSE([
+    AC_LINK_IFELSE([
        AC_LANG_PROGRAM([
 #include <sys/types.h>
 #include <netinet/in.h>
@@ -2537,19 +2556,13 @@ then
 fi
 if test "x$with_libpcap" = "xyes"
 then
-       AC_CHECK_HEADERS(pcap.h,
-       [
-               AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
-       ], [with_libpcap="no (pcap.h not found)"])
+       AC_CHECK_HEADERS(pcap.h,,
+                        [with_libpcap="no (pcap.h not found)"])
 fi
 if test "x$with_libpcap" = "xyes"
 then
-       collect_libpcap=1
-else
-       collect_libpcap=0
+       AC_CHECK_HEADERS(pcap-bpf.h)
 fi
-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")
 # }}}
 
@@ -3372,7 +3385,7 @@ AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
 with_libupsclient_config=""
 with_libupsclient_cflags=""
 with_libupsclient_libs=""
-AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
+AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
 [
        if test "x$withval" = "xno"
        then
@@ -3594,6 +3607,7 @@ then
        CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
 
        AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
+       AC_CHECK_HEADERS(yajl/yajl_version.h)
 
        CPPFLAGS="$SAVE_CPPFLAGS"
 fi
@@ -4015,7 +4029,7 @@ then
        plugin_vserver="yes"
        plugin_wireless="yes"
 
-       if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
+       if test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
        then
                plugin_ipvs="yes"
        fi
@@ -4304,6 +4318,8 @@ AC_PLUGIN([onewire],     [$with_libowcapi],    [OneWire sensor statistics])
 AC_PLUGIN([openvpn],     [yes],                [OpenVPN client statistics])
 AC_PLUGIN([oracle],      [$with_oracle],       [Oracle plugin])
 AC_PLUGIN([perl],        [$plugin_perl],       [Embed a Perl interpreter])
+# FIXME: Check for libevent, too.
+AC_PLUGIN([pinba],       [$have_protoc_c],     [Pinba statistics])
 AC_PLUGIN([ping],        [$with_liboping],     [Network latency statistics])
 AC_PLUGIN([postgresql],  [$with_libpq],        [PostgreSQL database statistics])
 AC_PLUGIN([powerdns],    [yes],                [PowerDNS statistics])
@@ -4483,7 +4499,7 @@ then
        with_librrd="yes (warning: librrd is not thread-safe)"
 fi
 
-if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
+if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xyes"
 then
        with_libiptc="yes (shipped version)"
 fi
@@ -4545,6 +4561,8 @@ Configuration:
     libxml2 . . . . . . . $with_libxml2
     libxmms . . . . . . . $with_libxmms
     libyajl . . . . . . . $with_libyajl
+    libevent  . . . . . . $with_libevent
+    protobuf-c  . . . . . $have_protoc_c
     oracle  . . . . . . . $with_oracle
     python  . . . . . . . $with_python
 
@@ -4617,6 +4635,7 @@ Configuration:
     openvpn . . . . . . . $enable_openvpn
     oracle  . . . . . . . $enable_oracle
     perl  . . . . . . . . $enable_perl
+    pinba . . . . . . . . $enable_pinba
     ping  . . . . . . . . $enable_ping
     postgresql  . . . . . $enable_postgresql
     powerdns  . . . . . . $enable_powerdns