Merge branch 'collectd-4.7'
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Sat, 9 May 2009 10:59:50 +0000 (12:59 +0200)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Sat, 9 May 2009 10:59:50 +0000 (12:59 +0200)
configure.in
src/Makefile.am
src/collectd.h
src/swap.c
src/utils_mount.c
src/utils_mount.h

index 07a4e29..1d9ef93 100644 (file)
@@ -94,8 +94,9 @@ AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
 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, [], [],
@@ -264,7 +265,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>
@@ -276,7 +277,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
@@ -813,7 +821,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;
@@ -830,7 +837,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;
@@ -1383,6 +1389,10 @@ then
        AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
                [with_libgcrypt="yes"],
                [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
+
+       if test "$with_libgcrypt" != "no"; then
+               AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
+       fi
 fi
 
 CPPFLAGS="$SAVE_CPPFLAGS"
@@ -1691,6 +1701,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"
@@ -3412,15 +3427,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$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_statvfs" = "xyes"
+#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"
index 04dec41..8b5fa54 100644 (file)
@@ -38,7 +38,6 @@ collectd_SOURCES = collectd.c collectd.h \
                   utils_parse_option.c utils_parse_option.h \
                   utils_tail_match.c utils_tail_match.h \
                   utils_match.c utils_match.h \
-                  utils_mount.c utils_mount.h \
                   utils_subst.c utils_subst.h \
                   utils_tail.c utils_tail.h \
                   utils_threshold.c utils_threshold.h \
@@ -252,7 +251,7 @@ endif
 
 if BUILD_PLUGIN_DF
 pkglib_LTLIBRARIES += df.la
-df_la_SOURCES = df.c
+df_la_SOURCES = df.c utils_mount.c utils_mount.h
 df_la_LDFLAGS = -module -avoid-version
 collectd_LDADD += "-dlopen" df.la
 collectd_DEPENDENCIES += df.la
index 18052ba..3d8998f 100644 (file)
 #endif
 #if HAVE_STDBOOL_H
 # include <stdbool.h>
+#else
+# ifndef HAVE__BOOL
+#  ifdef __cplusplus
+typedef bool _Bool;
+#  else
+#   define _Bool signed char
+#  endif
+# endif
+# define bool _Bool
+# define false 0
+# define true 1
+# define __bool_true_false_are_defined 1
 #endif
 #if HAVE_UNISTD_H
 # include <unistd.h>
index ca3b5ef..1779f86 100644 (file)
@@ -26,6 +26,9 @@
 #if HAVE_SYS_SWAP_H
 # include <sys/swap.h>
 #endif
+#if HAVE_VM_ANON_H
+# include <vm/anon.h>
+#endif
 #if HAVE_SYS_PARAM_H
 #  include <sys/param.h>
 #endif
index c53431f..cae3706 100644 (file)
@@ -659,11 +659,11 @@ cu_mount_t *cu_mount_getlist(cu_mount_t **list)
 #elif HAVE_TWO_GETMNTENT || HAVE_GEN_GETMNTENT || HAVE_SUN_GETMNTENT
        new = cu_mount_gen_getmntent ();
 #elif HAVE_SEQ_GETMNTENT
-# warn "This version of `getmntent' hat not yet been implemented!"
+# error "This version of `getmntent' hat not yet been implemented!"
 #elif HAVE_ONE_GETMNTENT
        new = cu_mount_getmntent ();
 #else
-       new = NULL;
+# error "Could not determine how to find mountpoints."
 #endif
 
        if (first != NULL)
index cab5c01..1f2403c 100644 (file)
 
 /* See below for instructions how to use the public functions. */
 
-#if !COLLECTD_UTILS_MOUNT_H
+#ifndef COLLECTD_UTILS_MOUNT_H
 #define COLLECTD_UTILS_MOUNT_H 1
 
-#include "common.h"
-
 #if HAVE_FS_INFO_H
 # include <fs_info.h>
 #endif