Code

Changed the build system to
authorocto <octo>
Fri, 28 Apr 2006 17:56:23 +0000 (17:56 +0000)
committerocto <octo>
Fri, 28 Apr 2006 17:56:23 +0000 (17:56 +0000)
- only check for libkvm and libdevstat if libstatgrab is installed
- only link against the above libraries if libstatgrab is present.

configure.in
src/Makefile.am

index 3f3e7de43c33fadfa5e53c24c7d837a2fa602a3c..54c144b3ef25ac9df6aa240d7d76688ecf995226 100644 (file)
@@ -587,6 +587,9 @@ AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
 
+with_libstatgrab="yes"
+with_libdevstat="no"
+with_libkvm="no"
 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
 [
        if test "x$withval" != "xno" -a "x$withval" != "xyes"
@@ -606,15 +609,18 @@ AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [P
 ])
 if test "x$with_libstatgrab" = "xyes"
 then
-       AC_CHECK_LIB(devstat, getdevs)
-       AC_CHECK_LIB(kvm, kvm_getargv)
-       AC_CHECK_LIB(statgrab, sg_init,, [with_libstatgrab="no (libstatgrab not found)"])
+       AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
 fi
 if test "x$with_libstatgrab" = "xyes"
 then
        AC_CHECK_HEADERS(statgrab.h,,    [with_libstatgrab="no (statgrab.h not found)"])
 fi
 if test "x$with_libstatgrab" = "xyes"
+then
+       AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
+       AC_CHECK_LIB(kvm, kvm_getargv, [with_libkvm="yes"],     [with_libkvm="no"])
+fi
+if test "x$with_libstatgrab" = "xyes"
 then
        collect_libstatgrab=1
 else
@@ -623,6 +629,8 @@ fi
 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
        [Wether or not to use statgrab library])
 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
+AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT,  test "x$with_libdevstat"  = "xyes")
+AM_CONDITIONAL(BUILD_WITH_LIBKVM,      test "x$with_libkvm"      = "xyes")
 
 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
 [
index bd0f080fd11fad9cdf2426d2b72263af3c9a684c..b281232ce0c2782703126f4a7d4554e1cc66aa78 100644 (file)
@@ -48,6 +48,17 @@ if BUILD_WITH_LIBDEVINFO
 collectd_LDFLAGS += -ldevinfo
 endif
 
+if BUILD_WITH_LIBSTATGRAB
+if BUILD_WITH_LIBKVM
+collectd_LDFLAGS += -lkvm
+endif
+if BUILD_WITH_LIBDEVSTAT
+collectd_LDFLAGS += -ldevstat
+endif
+collectd_LDFLAGS += -lstatgrab
+endif
+
+
 collectd_LDADD = $(LIBLTDL) libconfig/libconfig.la "-dlopen" self
 collectd_DEPENDENCIES = $(LIBLTDL) libconfig/libconfig.la
 
@@ -161,20 +172,38 @@ load_la_SOURCES = load.c
 load_la_LDFLAGS = -module -avoid-version
 collectd_LDADD += "-dlopen" load.la
 collectd_DEPENDENCIES += load.la
+if BUILD_WITH_LIBSTATGRAB
+if BUILD_WITH_LIBKVM
+load_la_LDFLAGS += -lkvm
+endif
+if BUILD_WITH_LIBDEVSTAT
+load_la_LDFLAGS += -ldevstat
+endif
+load_la_LDFLAGS += -lstatgrab
+endif
 endif
 
 if BUILD_MODULE_MEMORY
 pkglib_LTLIBRARIES += memory.la
 memory_la_SOURCES = memory.c
 memory_la_LDFLAGS = -module -avoid-version
+collectd_LDADD += "-dlopen" memory.la
+collectd_DEPENDENCIES += memory.la
 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
+if BUILD_WITH_LIBSTATGRAB
+if BUILD_WITH_LIBKVM
+memory_la_LDFLAGS += -lkvm
+endif
+if BUILD_WITH_LIBDEVSTAT
+memory_la_LDFLAGS += -ldevstat
+endif
+memory_la_LDFLAGS += -lstatgrab
+endif
 endif
 
 if BUILD_MODULE_MYSQL
@@ -237,14 +266,23 @@ if BUILD_MODULE_SWAP
 pkglib_LTLIBRARIES += swap.la
 swap_la_SOURCES = swap.c
 swap_la_LDFLAGS = -module -avoid-version
+collectd_LDADD += "-dlopen" swap.la
+collectd_DEPENDENCIES += swap.la
 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
+if BUILD_WITH_LIBSTATGRAB
+if BUILD_WITH_LIBKVM
+swap_la_LDFLAGS += -lkvm
+endif
+if BUILD_WITH_LIBDEVSTAT
+swap_la_LDFLAGS += -ldevstat
+endif
+swap_la_LDFLAGS += -lstatgrab
+endif
 endif
 
 if BUILD_MODULE_TAPE
@@ -265,14 +303,23 @@ if BUILD_MODULE_TRAFFIC
 pkglib_LTLIBRARIES += traffic.la
 traffic_la_SOURCES = traffic.c
 traffic_la_LDFLAGS = -module -avoid-version
+collectd_LDADD += "-dlopen" traffic.la
+collectd_DEPENDENCIES += traffic.la
 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
+if BUILD_WITH_LIBSTATGRAB
+if BUILD_WITH_LIBKVM
+traffic_la_LDFLAGS += -lkvm
+endif
+if BUILD_WITH_LIBDEVSTAT
+traffic_la_LDFLAGS += -ldevstat
+endif
+traffic_la_LDFLAGS += -lstatgrab
+endif
 endif
 
 if BUILD_MODULE_USERS