
# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1196967953 28800 # Node ID 3c54117986d7f346f42edd1fd3f0d2b90a1c68d7 # Parent 25193cc30daf4db213e989ee04573b7765785405 [RFC] Cleanup libvirt checks in acinclude.m4 This changes the existing (hard to follow, debug, and change) libvirt detection code with the standard pkg-config method. This gives us an easy version check, as well as access to the package-specified information about CPPFLAGS and LDFLAGS. It also makes us obey the system package search path. This will require a change to any source file that includes libvirt.h, to #include <libvirt/libvirt.h>, which is the proper way anyway. If people like this, I'll resubmit with the necessary changes. Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r 25193cc30daf -r 3c54117986d7 acinclude.m4 --- a/acinclude.m4 Thu Dec 06 10:18:26 2007 -0800 +++ b/acinclude.m4 Thu Dec 06 11:05:53 2007 -0800 @@ -325,39 +325,10 @@ AC_DEFUN([_CHECK_LIBVIRT], AC_DEFUN([CHECK_LIBVIRT], [ - AC_MSG_CHECKING(for libvirt package) - LIBVIRT_CPP_FLAGS="$CPPFLAGS" - dnl The standard include paths worked. - _CHECK_LIBVIRT(standard) - if test x"$LIBVIRTDIR" == x ; then - _DIRS_="/usr/include/libvirt \ - /usr/local/include/libvirt" - else - _DIRS_="$LIBVIRTDIR/include/libvirt" - fi - for _DIR_ in $_DIRS_ - do - _cppflags=$CPPFLAGS - _include_LIBVIRT="$_DIR_" - CPPFLAGS="$CPPFLAGS -I$_include_LIBVIRT" - _CHECK_LIBVIRT($_DIR_) - if test "$have_LIBVIRT" == "yes"; then - dnl Found it - AC_MSG_RESULT(yes) - dnl Save the new -I parameter - LIBVIRT_CPP_FLAGS="$CPPFLAGS" - LIBLIBVIRT=-lvirt - break - fi - CPPFLAGS=$_cppflags - done - CPPFLAGS=$LIBVIRT_CPP_FLAGS - AC_SUBST(LIBLIBVIRT) - if test "$have_LIBVIRT" == "no"; then - AC_MSG_ERROR(no. The required libvirt package is missing.) - fi - ] -) + PKG_CHECK_MODULES([LIBVIRT], [libvirt >= 0.3.2]) + CPPFLAGS="$CPPFLAGS $LIBVIRT_CFLAGS" + LDFLAGS="$LDFLAGS $LIBVIRT_LIBS" + ]) dnl dnl The check for the SBLIM test suite