author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sat, 9 May 2009 10:39:12 +0000 (12:39 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sat, 9 May 2009 10:39:12 +0000 (12:39 +0200) |
configure.in | patch | blob | history | |
src/Makefile.am | patch | blob | history | |
src/collectd.h | patch | blob | history | |
src/swap.c | patch | blob | history | |
src/utils_mount.c | patch | blob | history | |
src/utils_mount.h | patch | blob | history |
diff --git a/configure.in b/configure.in
index e86eab6d0f8be8b3062f65abe1474491074ff6a7..287a9e569bc011adf5d6462feee220aaceb5cd95 100644 (file)
--- a/configure.in
+++ b/configure.in
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, [], [],
# 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>
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
[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;
[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;
[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"
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"
diff --git a/src/Makefile.am b/src/Makefile.am
index 489673656c829b442d157db3b59ec61c18b5e22c..55ab2ca79e8095c6a9e2741b5c6038da012ebcc3 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
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 \
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
diff --git a/src/collectd.h b/src/collectd.h
index 18052ba3980130caa048b3b5768de5915c0f9f93..3d8998fddbeab2f14f21cc0c6e98aef9bb4ad036 100644 (file)
--- a/src/collectd.h
+++ b/src/collectd.h
#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>
diff --git a/src/swap.c b/src/swap.c
index ca3b5efa342da9bc66abaf78513699a655966b8b..1779f861b9b91b88d86e3fbfef6423a3d5bfbb57 100644 (file)
--- a/src/swap.c
+++ b/src/swap.c
#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
diff --git a/src/utils_mount.c b/src/utils_mount.c
index c53431f1a6458e8902b25ff2537f545e536b6269..cae3706794737fe438c79132cea13121c22b7ad9 100644 (file)
--- a/src/utils_mount.c
+++ b/src/utils_mount.c
#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)
diff --git a/src/utils_mount.h b/src/utils_mount.h
index cab5c01ea5ea2c783629826cbb361eb9f6f3050f..1f2403c3aa26412acd36046c790db290b0610ff0 100644 (file)
--- a/src/utils_mount.h
+++ b/src/utils_mount.h
/* 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