octo@huhu:~/collectd $ svn merge -r652:656 trunk tags/collectd-3.9.1
authorocto <octo>
Fri, 21 Apr 2006 15:21:47 +0000 (15:21 +0000)
committerocto <octo>
Fri, 21 Apr 2006 15:21:47 +0000 (15:21 +0000)
configure.in
src/Makefile.am
src/common.c
src/plugin.c
src/swap.c

index aae2a77..8ad0bc5 100644 (file)
@@ -177,6 +177,9 @@ AC_CHECK_HEADERS(IOKit/ps/IOPSKeys.h)
 # For load module
 AC_CHECK_HEADERS(sys/loadavg.h)
 
+# For the swap module
+AC_CHECK_HEADERS(sys/swap.h)
+
 # For users module
 AC_CHECK_HEADERS(utmp.h)
 AC_CHECK_HEADERS(utmpx.h)
@@ -260,12 +263,15 @@ AC_HEADER_TIME
 #
 AC_PROG_GCC_TRADITIONAL
 AC_CHECK_FUNCS(gettimeofday select strdup strtol)
-AC_CHECK_FUNCS(socket, , AC_CHECK_LIB(socket, socket))
 AC_CHECK_FUNCS(getaddrinfo getnameinfo)
 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
 AC_CHECK_FUNCS(strncasecmp strcasecmp)
 AC_CHECK_FUNCS(openlog syslog closelog)
 
+socket_needs_socket="no"
+AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
+AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
+
 nanosleep_needs_rt="no"
 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
@@ -396,14 +402,6 @@ case $host_os in
 esac
 AC_MSG_RESULT([$ac_system])
 
-with_libsocket="yes"
-AC_CHECK_LIB(socket, socket,
-[
-       AC_DEFINE(HAVE_LIBSOCKET, 1, [Define to 1 if you have the 'socket' library (-lsocket).])
-],
-[with_libsocket="no"])
-AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$with_libsocket" = "xyes")
-
 with_libresolv="yes"
 AC_CHECK_LIB(resolv, res_search,
 [
@@ -476,16 +474,19 @@ AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
 if test "$ac_system" = "Solaris"
 then
        with_kstat="yes"
+       with_devinfo="yes"
 else
        with_kstat="no (Solaris only)"
+       with_devinfo="no (Solaris only)"
 fi
+
 if test "x$with_kstat" = "xyes"
 then
        AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (libkstat not found)"])
 fi
 if test "x$with_kstat" = "xyes"
 then
-       AC_CHECK_LIB(devinfo, di_init)
+       AC_CHECK_LIB(devinfo, di_init,, [with_devinfo="no (not found)"])
        AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
 fi
 if test "x$with_kstat" = "xyes"
@@ -496,7 +497,8 @@ else
 fi
 AC_DEFINE_UNQUOTED(COLLECT_KSTAT, [$collect_kstat],
        [Wether or not to use kstat library (Solaris)])
-AM_CONDITIONAL(BUILD_WITH_KSTAT, test "x$with_kstat" = "xyes")
+AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
+AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
 
 ### BEGIN of check for libcurl ###
 with_curl_config="curl-config"
index 1fa0c07..9cafbbf 100644 (file)
@@ -41,6 +41,12 @@ endif
 if BUILD_WITH_LIBRESOLV
 collectd_LDFLAGS += -lresolv
 endif
+if BUILD_WITH_LIBKSTAT
+collectd_LDFLAGS += -lkstat
+endif
+if BUILD_WITH_LIBDEVINFO
+collectd_LDFLAGS += -ldevinfo
+endif
 
 collectd_LDADD = $(LIBLTDL) libconfig/libconfig.la "-dlopen" self
 collectd_DEPENDENCIES = $(LIBLTDL) libconfig/libconfig.la
@@ -84,6 +90,12 @@ if BUILD_MODULE_CPU
 pkglib_LTLIBRARIES += cpu.la
 cpu_la_SOURCES = cpu.c
 cpu_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LIBKSTAT
+cpu_la_LDFLAGS += -lkstat
+endif
+if BUILD_WITH_LIBDEVINFO
+cpu_la_LDFLAGS += -ldevinfo
+endif
 collectd_LDADD += "-dlopen" cpu.la
 collectd_DEPENDENCIES += cpu.la
 endif
@@ -108,6 +120,12 @@ if BUILD_MODULE_DISK
 pkglib_LTLIBRARIES += disk.la
 disk_la_SOURCES = disk.c
 disk_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LIBKSTAT
+disk_la_LDFLAGS += -lkstat
+endif
+if BUILD_WITH_LIBDEVINFO
+disk_la_LDFLAGS += -ldevinfo
+endif
 collectd_LDADD += "-dlopen" disk.la
 collectd_DEPENDENCIES += disk.la
 endif
@@ -127,6 +145,9 @@ if BUILD_MODULE_HDDTEMP
 pkglib_LTLIBRARIES += hddtemp.la
 hddtemp_la_SOURCES = hddtemp.c
 hddtemp_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LIBSOCKET
+hddtemp_la_LDFLAGS += -lsocket
+endif
 collectd_LDADD += "-dlopen" hddtemp.la
 collectd_DEPENDENCIES += hddtemp.la
 endif
@@ -143,6 +164,12 @@ if BUILD_MODULE_MEMORY
 pkglib_LTLIBRARIES += memory.la
 memory_la_SOURCES = memory.c
 memory_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LIBKSTAT
+memory_la_LDFLAGS += -lkstat
+endif
+if BUILD_WITH_LIBDEVINFO
+memory_la_LDFLAGS += -ldevinfo
+endif
 collectd_LDADD += "-dlopen" memory.la
 collectd_DEPENDENCIES += memory.la
 endif
@@ -207,6 +234,12 @@ if BUILD_MODULE_SWAP
 pkglib_LTLIBRARIES += swap.la
 swap_la_SOURCES = swap.c
 swap_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LIBKSTAT
+swap_la_LDFLAGS += -lkstat
+endif
+if BUILD_WITH_LIBDEVINFO
+swap_la_LDFLAGS += -ldevinfo
+endif
 collectd_LDADD += "-dlopen" swap.la
 collectd_DEPENDENCIES += swap.la
 endif
@@ -215,6 +248,12 @@ if BUILD_MODULE_TAPE
 pkglib_LTLIBRARIES += tape.la
 tape_la_SOURCES = tape.c
 tape_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LIBKSTAT
+tape_la_LDFLAGS += -lkstat
+endif
+if BUILD_WITH_LIBDEVINFO
+tape_la_LDFLAGS += -ldevinfo
+endif
 collectd_LDADD += "-dlopen" tape.la
 collectd_DEPENDENCIES += tape.la
 endif
@@ -223,6 +262,12 @@ if BUILD_MODULE_TRAFFIC
 pkglib_LTLIBRARIES += traffic.la
 traffic_la_SOURCES = traffic.c
 traffic_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LIBKSTAT
+traffic_la_LDFLAGS += -lkstat
+endif
+if BUILD_WITH_LIBDEVINFO
+traffic_la_LDFLAGS += -ldevinfo
+endif
 collectd_LDADD += "-dlopen" traffic.la
 collectd_DEPENDENCIES += traffic.la
 endif
index d1f1551..78be3af 100644 (file)
@@ -522,7 +522,7 @@ static int log_update_file (char *host, char *file, char *values,
        strncpy (full_file, file, 1024);
 
        tmp = full_file + strlen (full_file) - 4;
-       assert (tmp > 0);
+       assert ((tmp != NULL) && (tmp > full_file));
 
        /* Change the filename for logfiles. */
        if (strncmp (tmp, ".rrd", 4) == 0)
index 570b6a2..2f52157 100644 (file)
@@ -129,7 +129,7 @@ int plugin_load_file (char *file)
                return (1);
        }
 
-       if ((reg_handle = lt_dlsym (dlh, "module_register")) == NULL)
+       if ((reg_handle = (void (*) (void)) lt_dlsym (dlh, "module_register")) == NULL)
        {
                syslog (LOG_WARNING, "Couldn't find symbol ``module_register'' in ``%s'': %s\n",
                                file, lt_dlerror ());
index 5812b59..0891503 100644 (file)
@@ -32,9 +32,9 @@
 # define SWAP_HAVE_READ 0
 #endif
 
-#ifdef KERNEL_SOLARIS
-#include <sys/swap.h>
-#endif /* KERNEL_SOLARIS */
+#if HAVE_SYS_SWAP_H
+# include <sys/swap.h>
+#endif
 
 #undef  MAX
 #define MAX(x,y) ((x) > (y) ? (x) : (y))