[libvirt] [PATCH 5/5] Use pkg_config in configure.in to detect presence of libnetcf and

Laine Stump laine at laine.org
Mon May 18 20:07:34 UTC 2009


From: Laine Stump <laine at redhat.com>

---
 configure.in    |   35 ++++++++++++++++++++++++++++++++---
 src/Makefile.am |    5 +++++
 2 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/configure.in b/configure.in
index 1cdb64c..4ce4342 100644
--- a/configure.in
+++ b/configure.in
@@ -28,6 +28,7 @@ GNUTLS_REQUIRED="1.0.25"
 AVAHI_REQUIRED="0.6.0"
 POLKIT_REQUIRED="0.6"
 PARTED_REQUIRED="1.8.0"
+NETCF_REQUIRED="0.0.1"
 
 dnl Checks for C compiler.
 AC_PROG_CC
@@ -789,9 +790,31 @@ if test "$with_qemu:$with_lxc:$with_network" != "no:no:no"; then
 fi
 AM_CONDITIONAL([WITH_BRIDGE], [test "$with_bridge" = "yes"])
 
-dnl
-dnl Storage driver checks
-dnl
+dnl netcf library
+AC_ARG_WITH([netcf],
+[  --with-netcf         libnetcf support to configure physical host network interfaces],
+[], [with_netcf=check])
+
+NETCF_CFLAGS=
+NETCF_LIBS=
+if test "$with_netcf" = "yes" -o "$with_netcf" = "check"; then
+  PKG_CHECK_MODULES(NETCF, netcf >= $NETCF_REQUIRED,
+    [with_netcf=yes], [
+    if test "$with_netcf" = "check" ; then
+       with_netcf=no
+    else
+       AC_MSG_ERROR(
+         [You must install libnetcf >= $NETCF_REQUIRED to compile libvirt])
+    fi
+  ])
+  if test "$with_netcf" = "yes" ; then
+    AC_DEFINE_UNQUOTED([WITH_NETCF], 1,
+      [whether libnetcf is available to configure physical host network interfaces])
+  fi
+fi
+AM_CONDITIONAL([WITH_NETCF], [test "$with_netcf" = "yes"])
+AC_SUBST([NETCF_CFLAGS])
+AC_SUBST([NETCF_LIBS])
 
 AC_ARG_WITH([storage-fs],
 [  --with-storage-fs           with FileSystem backend for the storage driver (on)],[],[with_storage_fs=check])
@@ -1376,6 +1399,7 @@ AC_MSG_NOTICE([    Test: $with_test])
 AC_MSG_NOTICE([  Remote: $with_remote])
 AC_MSG_NOTICE([ Network: $with_network])
 AC_MSG_NOTICE([Libvirtd: $with_libvirtd])
+AC_MSG_NOTICE([   netcf: $with_netcf])
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Storage Drivers])
 AC_MSG_NOTICE([])
@@ -1443,6 +1467,11 @@ AC_MSG_NOTICE([  devkit: $DEVKIT_CFLAGS $DEVKIT_LIBS])
 else
 AC_MSG_NOTICE([  devkit: no])
 fi
+if test "$with_netcf" = "yes" ; then
+AC_MSG_NOTICE([   netcf: $NETCF_CFLAGS $NETCF_LIBS])
+else
+AC_MSG_NOTICE([   netcf: no])
+fi
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Test suite])
 AC_MSG_NOTICE([])
diff --git a/src/Makefile.am b/src/Makefile.am
index fd692b4..7d7ef74 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -351,6 +351,11 @@ endif
 libvirt_driver_network_la_SOURCES = $(NETWORK_DRIVER_SOURCES)
 endif
 
+if WITH_NETCF
+libvirt_driver_interface_la_CFLAGS = $(NETCF_CFLAGS)
+libvirt_driver_interface_la_LDFLAGS = $(NETCF_LIBS)
+endif
+
 # Needed to keep automake quiet about conditionals
 libvirt_driver_storage_la_SOURCES =
 if WITH_STORAGE_DIR
-- 
1.6.0.6




More information about the libvir-list mailing list