From: octo Date: Fri, 28 Apr 2006 17:56:23 +0000 (+0000) Subject: Changed the build system to X-Git-Tag: svn-trunk~36 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=0aa63f0c02299e5c6bf297ed464509e1debab5d8;p=collectd.git Changed the build system to - only check for libkvm and libdevstat if libstatgrab is installed - only link against the above libraries if libstatgrab is present. --- diff --git a/configure.in b/configure.in index 3f3e7de4..54c144b3 100644 --- a/configure.in +++ b/configure.in @@ -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,9 +609,7 @@ 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 @@ -616,6 +617,11 @@ then 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 collect_libstatgrab=0 @@ -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.])], [ diff --git a/src/Makefile.am b/src/Makefile.am index bd0f080f..b281232c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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