From 3544c44faea665bfd98119ef6b98592cf203f680 Mon Sep 17 00:00:00 2001 From: octo Date: Fri, 21 Apr 2006 15:21:47 +0000 Subject: [PATCH] octo@huhu:~/collectd $ svn merge -r652:656 trunk tags/collectd-3.9.1 --- configure.in | 24 +++++++++++++----------- src/Makefile.am | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/common.c | 2 +- src/plugin.c | 2 +- src/swap.c | 6 +++--- 5 files changed, 63 insertions(+), 16 deletions(-) diff --git a/configure.in b/configure.in index aae2a771..8ad0bc54 100644 --- a/configure.in +++ b/configure.in @@ -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" diff --git a/src/Makefile.am b/src/Makefile.am index 1fa0c07c..9cafbbf5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 diff --git a/src/common.c b/src/common.c index d1f15513..78be3afc 100644 --- a/src/common.c +++ b/src/common.c @@ -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) diff --git a/src/plugin.c b/src/plugin.c index 570b6a22..2f521570 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -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 ()); diff --git a/src/swap.c b/src/swap.c index 5812b59c..08915032 100644 --- a/src/swap.c +++ b/src/swap.c @@ -32,9 +32,9 @@ # define SWAP_HAVE_READ 0 #endif -#ifdef KERNEL_SOLARIS -#include -#endif /* KERNEL_SOLARIS */ +#if HAVE_SYS_SWAP_H +# include +#endif #undef MAX #define MAX(x,y) ((x) > (y) ? (x) : (y)) -- 2.30.2