# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1196970729 28800
# Node ID 0a1c811ef3bdc9651166a6259562b7b95f4f7838
# 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.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 25193cc30daf -r 0a1c811ef3bd acinclude.m4
--- a/acinclude.m4 Thu Dec 06 10:18:26 2007 -0800
+++ b/acinclude.m4 Thu Dec 06 11:52:09 2007 -0800
@@ -297,67 +297,12 @@ AC_DEFUN([CHECK_LIBCU],
]
)
-dnl
-dnl The check for the libvirt library
-dnl Sets the LIBVIRTDIR variable
-dnl
-
-AC_DEFUN([_CHECK_LIBVIRT],
-[
- AC_MSG_CHECKING($1)
- AC_TRY_LINK(
- [
- #include <libvirt.h>
- #include <virterror.h>
- ],
- [
- virConnectPtr connectPtr;
- ],
- [
- have_LIBVIRT=yes
- dnl AC_MSG_RESULT(yes)
- ],
- [
- have_LIBVIRT=no
- dnl AC_MSG_RESULT(no)
- ])
-])
-
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
diff -r 25193cc30daf -r 0a1c811ef3bd autoconfiscate.sh
--- a/autoconfiscate.sh Thu Dec 06 10:18:26 2007 -0800
+++ b/autoconfiscate.sh Thu Dec 06 11:52:09 2007 -0800
@@ -18,5 +18,3 @@ autoconf --force &&
autoconf --force &&
echo "You may now run ./configure"
-echo "You may now run ./configure LIBVIRTDIR=/usr/local"
-
diff -r 25193cc30daf -r 0a1c811ef3bd configure.ac
--- a/configure.ac Thu Dec 06 10:18:26 2007 -0800
+++ b/configure.ac Thu Dec 06 11:52:09 2007 -0800
@@ -31,7 +31,6 @@ AC_ARG_VAR([CIMSERVER],[the target CIM s
])
AC_ARG_VAR([PROVIDERDIR],[the directory where the CMPI providers will be install
ed.])
-AC_ARG_VAR([LIBVIRTDIR],[the directory where the libvirt package is installed.])
AC_ARG_VAR([TESTSUITEDIR],[the directory where the SBLIM testsuite is installed.
])
@@ -179,7 +178,6 @@ echo "The following configuration option
echo "The following configuration options have been selected:"
echo " CIMSERVER: " $CIMSERVER
echo " PROVIDERDIR: " $PROVIDERDIR
-echo " LIBVIRTDIR: " $LIBVIRTDIR
echo " TESTSUITE_SUPPORT: " $TESTSUITE_SUPPORT
if test x"$TESTSUITEDIR" != x; then
echo " TESTSUITEDIR: " $TESTSUITEDIR