Merge branch 'collectd-4.5' into collectd-4.6
[collectd.git] / configure.in
index 2344cdb..795a9e1 100644 (file)
@@ -80,8 +80,9 @@ AC_SUBST(pkgconfigdir)
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
 AC_HEADER_DIRENT
+AC_HEADER_STDBOOL
 
-AC_CHECK_HEADERS(stdio.h stdint.h stdbool.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h sys/isa_defs.h)
+AC_CHECK_HEADERS(stdio.h stdint.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h sys/isa_defs.h)
 
 # For ping library
 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
@@ -250,7 +251,7 @@ AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
 
 # For the swap module
 have_sys_swap_h="yes"
-AC_CHECK_HEADERS(sys/swap.h, [], [have_sys_swap_h="no"],
+AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
 [
 #if HAVE_SYS_TYPES_H
 #  include <sys/types.h>
@@ -262,7 +263,14 @@ AC_CHECK_HEADERS(sys/swap.h, [], [have_sys_swap_h="no"],
 
 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
 then
-       AC_MSG_NOTICE([Solaris detected and sys/swap.h not found: Try building a 64bit binary.])
+       hint_64=""
+       if test "x$GCC" = "xyes"
+       then
+               hint_64="CFLAGS='-m64'"
+       else
+               hint_64="CFLAGS='-xarch=v9'"
+       fi
+       AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
 fi
 
 # For load module
@@ -799,7 +807,6 @@ if test "x$have_getmntent" = "xc"; then
                [c_cv_have_one_getmntent],
                AC_COMPILE_IFELSE(
                        AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
-#include <mntent.h>
 #include "$srcdir/src/utils_mount.h"]],
                                [[
                                 FILE *fh;
@@ -816,7 +823,6 @@ if test "x$have_getmntent" = "xc"; then
                [c_cv_have_two_getmntent],
                AC_COMPILE_IFELSE(
                        AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
-#include <sys/mnttab.h>
 #include "$srcdir/src/utils_mount.h"]],
                                [[
                                 FILE *fh;
@@ -876,6 +882,37 @@ AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_p
        #include <linux/netdevice.h>
        ])
 
+AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
+       [
+               AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
+                       [Define if struct kinfo_proc exists in the FreeBSD variant.])
+               have_struct_kinfo_proc_freebsd="yes"
+       ],
+       [
+               have_struct_kinfo_proc_freebsd="no"
+       ],
+       [
+#include <kvm.h>
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+       ])
+
+AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
+       [
+               AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
+                       [Define if struct kinfo_proc exists in the OpenBSD variant.])
+               have_struct_kinfo_proc_openbsd="yes"
+       ],
+       [
+               have_struct_kinfo_proc_openbsd="no"
+       ],
+       [
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <kvm.h>
+       ])
+
 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
 [#if HAVE_STDINT_H
 # include <stdint.h>
@@ -1322,6 +1359,11 @@ then
                 [with_libmysql="yes"],
                 [with_libmysql="no (symbol 'mysql_init' not found)"],
                 [$with_mysql_libs])
+
+               AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
+                [with_libmysql="yes"],
+                [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
+                [$with_mysql_libs])
        fi
 fi
 if test "x$with_libmysql" = "xyes"
@@ -2962,15 +3004,41 @@ then
        plugin_tcpconns="yes"
 fi
 
-if test "x$have_statfs" = "xyes"
+# Df plugin: Check if we know how to determine mount points first.
+#if test "x$have_listmntent" = "xyes"; then
+#      plugin_df="yes"
+#fi
+if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
 then
        plugin_df="yes"
 fi
-if test "x$have_statvfs" = "xyes"
+if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
+then
+       plugin_df="yes"
+fi
+#if test "x$have_getmntent" = "xseq"
+#then
+#      plugin_df="yes"
+#fi
+if test "x$c_cv_have_one_getmntent" = "xyes"
 then
        plugin_df="yes"
 fi
 
+# Df plugin: Check if we have either `statfs' or `statvfs' second.
+if test "x$plugin_df" = "xyes"
+then
+       plugin_df="no"
+       if test "x$have_statfs" = "xyes"
+       then
+               plugin_df="yes"
+       fi
+       if test "x$have_statvfs" = "xyes"
+       then
+               plugin_df="yes"
+       fi
+fi
+
 if test "x$have_getifaddrs" = "xyes"
 then
        plugin_interface="yes"
@@ -3007,7 +3075,7 @@ then
        plugin_processes="yes"
 fi
 
-if test "x$with_kvm_getprocs" = "xyes"
+if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
 then
        plugin_processes="yes"
 fi