summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c08f0b0)
raw | patch | inline | side by side (parent: c08f0b0)
author | Florian Forster <octo@huhu.verplant.org> | |
Thu, 8 Nov 2007 09:03:16 +0000 (10:03 +0100) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Thu, 8 Nov 2007 09:03:16 +0000 (10:03 +0100) |
configure.in | patch | blob | history | |
src/Makefile.am | patch | blob | history |
diff --git a/configure.in b/configure.in
index 8838b5d66fc6a92c6a455257eef7ee9dc166945b..88323f30ff619366a0dc3b241fe7c11af3d9be02 100644 (file)
--- a/configure.in
+++ b/configure.in
AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
dnl Check for libvirt and libxml2 libraries.
-AC_CHECK_LIB(xml2,xmlXPathEval,
- [with_libxml2="yes"],
- [with_libxml2="no"])
-
-with_libvirt="no"
+with_libxml2="no (pkg-config isn't available)"
+with_libxml2_cflags=""
+with_libxml2_ldflags=""
+with_libvirt="no (pkg-config isn't available)"
with_libvirt_cflags=""
with_libvirt_ldflags=""
+PKG_PROG_PKG_CONFIG
+if test "x$PKG_CONFIG" != "x"
+then
+ pkg-config --exists 'libxml-2.0' 2>/dev/null
+ if test "$?" = "0"
+ then
+ with_libxml2="yes"
+ else
+ with_libxml2="no (pkg-config doesn't know library)"
+ fi
+
+ pkg-config --exists libvirt 2>/dev/null
+ if test "$?" = "0"
+ then
+ with_libvirt="yes"
+ else
+ with_libvirt="no (pkg-config doesn't know library)"
+ fi
+fi
if test "x$with_libxml2" = "xyes"
then
- with_libvirt="yes"
+ with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
+ if test $? -ne 0
+ then
+ with_libxml2="no"
+ fi
+ with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
+ if test $? -ne 0
+ then
+ with_libxml2="no"
+ fi
+fi
+if test "x$with_libxml2" = "xyes"
+then
+ SAVE_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
+
+ AC_CHECK_HEADERS(libxml/parser.h, [],
+ [with_libxml2="no (libxml/parser.h not found)"])
+
+ CPPFLAGS="$SAVE_CPPFLAGS"
+fi
+if test "x$with_libxml2" = "xyes"
+then
+ SAVE_CFLAGS="$CFLAGS"
+ SAVE_LD_FLAGS="$LDFLAGS"
+
+ CFLAGS="$CFLAGS $with_libxml2_cflags"
+ LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
+
+ AC_CHECK_LIB(xml2, xmlXPathEval,
+ [with_libxml2="yes"],
+ [with_libxml2="no (symbol xmlXPathEval not found)"])
+
+ CFLAGS="$SAVE_CFLAGS"
+ LDFLAGS="$SAVE_LDFLAGS"
+fi
+dnl Add the right compiler flags and libraries.
+if test "x$with_libxml2" = "xyes"; then
+ BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
+ BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
+ AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
+ AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
+fi
+if test "x$with_libvirt" = "xyes"
+then
with_libvirt_cflags="`pkg-config --cflags libvirt`"
if test $? -ne 0
then
fi
fi
if test "x$with_libvirt" = "xyes"
+then
+ SAVE_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
+
+ AC_CHECK_HEADERS(libvirt/libvirt.h, [],
+ [with_libvirt="no (libvirt/libvirt.h not found)"])
+
+ CPPFLAGS="$SAVE_CPPFLAGS"
+fi
+if test "x$with_libvirt" = "xyes"
then
SAVE_CFLAGS="$CFLAGS"
SAVE_LD_FLAGS="$LDFLAGS"
CFLAGS="$CFLAGS $with_libvirt_cflags"
LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
- AC_CHECK_LIB(virt,virDomainBlockStats,
+ AC_CHECK_LIB(virt, virDomainBlockStats,
[with_libvirt="yes"],
[with_libvirt="no (symbol virDomainBlockStats not found)"])
fi
dnl Add the right compiler flags and libraries.
if test "x$with_libvirt" = "xyes"; then
- PKG_PROG_PKG_CONFIG
- if test "x$PKG_CONFIG" != "x"; then
- BUILD_WITH_LIBVIRTSTATS_CFLAGS="`pkg-config --cflags libvirt` `pkg-config --cflags libxml-2.0`"
- BUILD_WITH_LIBVIRTSTATS_LIBS="`pkg-config --libs libvirt` `pkg-config --libs libxml-2.0`"
- AC_SUBST(BUILD_WITH_LIBVIRTSTATS_CFLAGS)
- AC_SUBST(BUILD_WITH_LIBVIRTSTATS_LIBS)
- fi
+ BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
+ BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
+ AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
+ AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
fi
dnl End of check for libvirt and libxml2 libraries.
plugin_interface="no"
plugin_ipvs="no"
plugin_irq="no"
+plugin_libvirtstats="no"
plugin_load="no"
plugin_memory="no"
plugin_multimeter="no"
plugin_interface="yes"
fi
+if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
+then
+ plugin_libvirtstats="yes"
+fi
+
if test "x$have_getloadavg" = "xyes"
then
plugin_load="yes"
AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
-AC_PLUGIN([libvirtstats],[$with_libvirt], [Virtual machine statistics])
+AC_PLUGIN([libvirtstats],[$plugin_libvirtstats], [Virtual machine statistics])
AC_PLUGIN([load], [$plugin_load], [System load])
AC_PLUGIN([logfile], [yes], [File logging plugin])
AC_PLUGIN([mbmon], [yes], [Query mbmond])
diff --git a/src/Makefile.am b/src/Makefile.am
index 8841db41c409c798a22df2a11a097686e3909d47..bc78912cecf60dc914bf615f24d31a9e4f42c64b 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
if BUILD_PLUGIN_LIBVIRTSTATS
pkglib_LTLIBRARIES += libvirtstats.la
libvirtstats_la_SOURCES = libvirtstats.c
-libvirtstats_la_CFLAGS = $(BUILD_WITH_LIBVIRTSTATS_CFLAGS)
-libvirtstats_la_LIBADD = $(BUILD_WITH_LIBVIRTSTATS_LIBS)
+libvirtstats_la_CFLAGS = $(BUILD_WITH_LIBVIRT_CFLAGS) $(BUILD_WITH_LIBXML2_CFLAGS)
+libvirtstats_la_LIBADD = $(BUILD_WITH_LIBVIRT_LIBS) $(BUILD_WITH_LIBXML2_LIBS)
libvirtstats_la_LDFLAGS = -module -avoid-version
collectd_LDADD += "-dlopen" libvirtstats.la
collectd_DEPENDENCIES += libvirtstats.la