From: Florian Forster Date: Tue, 19 Aug 2008 07:24:33 +0000 (+0200) Subject: build system: Define which version of libkvm has been checked for. X-Git-Tag: collectd-4.3.4~16 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=aac435a16a547dd0a7621d0cda75b2918b24b515;p=collectd.git build system: Define which version of libkvm has been checked for. The used `kvm_getswapinfo' is apparently an extension not all versions of the kvm library support. --- diff --git a/configure.in b/configure.in index e6e2531d..e8fe287b 100644 --- a/configure.in +++ b/configure.in @@ -1215,12 +1215,13 @@ then AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS) fi -AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"]) -if test "x$with_libkvm" = "xyes" +AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"]) +if test "x$with_kvm_getswapinfo" = "xyes" then - AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)]) + AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1, + [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)]) fi -AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes") +AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes") with_sensors_cflags="" with_sensors_ldflags="" diff --git a/src/Makefile.am b/src/Makefile.am index 02b85fcd..7dad3401 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -537,7 +537,7 @@ endif if BUILD_WITH_LIBDEVINFO swap_la_LIBADD += -ldevinfo endif -if BUILD_WITH_LIBKVM +if BUILD_WITH_LIBKVM_GETSWAPINFO swap_la_LIBADD += -lkvm endif if BUILD_WITH_LIBSTATGRAB diff --git a/src/swap.c b/src/swap.c index 4d1f24de..7fa72dc9 100644 --- a/src/swap.c +++ b/src/swap.c @@ -56,10 +56,10 @@ static kstat_t *ksp; /* No global variables */ /* #endif defined(VM_SWAPUSAGE) */ -#elif HAVE_LIBKVM +#elif HAVE_LIBKVM_GETSWAPINFO static kvm_t *kvm_obj = NULL; int kvm_pagesize; -/* #endif HAVE_LIBKVM */ +/* #endif HAVE_LIBKVM_GETSWAPINFO */ #elif HAVE_LIBSTATGRAB /* No global variables */ @@ -86,7 +86,7 @@ static int swap_init (void) /* No init stuff */ /* #endif defined(VM_SWAPUSAGE) */ -#elif HAVE_LIBKVM +#elif HAVE_LIBKVM_GETSWAPINFO if (kvm_obj != NULL) { kvm_close (kvm_obj); @@ -105,7 +105,7 @@ static int swap_init (void) ERROR ("swap plugin: kvm_open failed."); return (-1); } -/* #endif HAVE_LIBKVM */ +/* #endif HAVE_LIBKVM_GETSWAPINFO */ #elif HAVE_LIBSTATGRAB /* No init stuff */ @@ -259,7 +259,7 @@ static int swap_read (void) swap_submit ("free", sw_usage.xsu_avail); /* #endif VM_SWAPUSAGE */ -#elif HAVE_LIBKVM +#elif HAVE_LIBKVM_GETSWAPINFO struct kvm_swap data_s; int status; @@ -285,7 +285,7 @@ static int swap_read (void) swap_submit ("used", used); swap_submit ("free", free); -/* #endif HAVE_LIBKVM */ +/* #endif HAVE_LIBKVM_GETSWAPINFO */ #elif HAVE_LIBSTATGRAB sg_swap_stats *swap;