[virt-tools-list] [PATCH glib] Fix check for libvirt optional functions
Daniel P. Berrange
berrange at redhat.com
Thu Jul 28 12:30:12 UTC 2016
The checks for virDomainOpenGraphicsFD and
virNetworkGetDHCPLeases in configure are simply trying
to compile and link a test program. This was assuming
that libvirt was installed in /usr/lib & /usr/include,
which is not always the case. Using a pkg-config version
check avoids needing to compile and thus avoids the
bad assumptions about install locations.
Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
Pushed as a broken build fix
configure.ac | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac
index f71e5cf..b2848f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -92,13 +92,19 @@ LIBVIRT_GLIB_COMPILE_WARNINGS
PKG_CHECK_MODULES(LIBVIRT, libvirt >= $LIBVIRT_REQUIRED)
# virDomainOpenGraphicsFD was introduced in libvirt 1.2.8
-AC_CHECK_LIB([virt],
- [virDomainOpenGraphicsFD],
- [AC_DEFINE([HAVE_VIR_DOMAIN_OPEN_GRAPHICS_FD], 1, [Have virDomainOpenGraphicsFD?])])
+AC_MSG_CHECKING([for virDomainOpenGraphicsFD])
+PKG_CHECK_EXISTS(libvirt >= 21.2.8,
+ [
+ AC_DEFINE([HAVE_VIR_DOMAIN_OPEN_GRAPHICS_FD], 1, [Have virDomainOpenGraphicsFD?])
+ AC_MSG_RESULT([yes])
+ ],[AC_MSG_RESULT([no])])
# virNetworkGetDHCPLeases was introduced in libvirt 1.2.6
-AC_CHECK_LIB([virt],
- [virNetworkGetDHCPLeases],
- [AC_DEFINE([HAVE_VIR_NETWORK_GET_DHCP_LEASES], 1, [Have virNetworkGetDHCPLeases?])])
+AC_MSG_CHECKING([for virNetworkGetDHCPLeases])
+PKG_CHECK_EXISTS(libvirt >= 21.2.6,
+ [
+ AC_DEFINE([HAVE_VIR_NETWORK_GET_DHCP_LEASES], 1, [Have virNetworkGetDHCPLeases?])
+ AC_MSG_RESULT([yes])
+ ],[AC_MSG_RESULT([no])])
enable_tests=no
PKG_CHECK_MODULES(GLIB2, glib-2.0 >= $GLIB2_TEST_REQUIRED,
[enable_tests=yes],
--
2.7.4
More information about the virt-tools-list
mailing list