summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8822d7c)
raw | patch | inline | side by side (parent: 8822d7c)
author | octo <octo> | |
Fri, 21 Apr 2006 15:21:47 +0000 (15:21 +0000) | ||
committer | octo <octo> | |
Fri, 21 Apr 2006 15:21:47 +0000 (15:21 +0000) |
configure.in | patch | blob | history | |
src/Makefile.am | patch | blob | history | |
src/common.c | patch | blob | history | |
src/plugin.c | patch | blob | history | |
src/swap.c | patch | blob | history |
diff --git a/configure.in b/configure.in
index aae2a77113f51378c1e6c5f8ea425d89183c1242..8ad0bc54877742b59f871f611e0b9929ca0f2caa 100644 (file)
--- a/configure.in
+++ b/configure.in
# 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)
#
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")
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,
[
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"
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 1fa0c07cdd45aa36214f421ed2d2fb549455dc7c..9cafbbf50c3bbd88522fc1b28fa72a907a69860b 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
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
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
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
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
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
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
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
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 d1f15513409c137d3430eb3d2420c3f9ec4122dc..78be3afce48a6318336367b618c7660b0bad3034 100644 (file)
--- a/src/common.c
+++ b/src/common.c
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 570b6a224701d7ac829a7f44317a2daaa4d6c14f..2f52157082a0d0929428307999bae4551498fb04 100644 (file)
--- a/src/plugin.c
+++ b/src/plugin.c
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 5812b59c6f626465ec9ab38a017336baf26d403b..089150329bc3e59704e21e33b5344375b92cddb3 100644 (file)
--- a/src/swap.c
+++ b/src/swap.c
# 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))