[PATCH 08/28] Convert netcf check to use LIBVIRT_CHECK_PKG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 configure.ac     | 42 ++----------------------------------------
 m4/virt-netcf.m4 | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 40 deletions(-)
 create mode 100644 m4/virt-netcf.m4

diff --git a/configure.ac b/configure.ac
index afcfd8b..074e64d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,7 +101,6 @@ GNUTLS_REQUIRED="1.0.25"
 AVAHI_REQUIRED="0.6.0"
 POLKIT_REQUIRED="0.6"
 PARTED_REQUIRED="1.8.0"
-NETCF_REQUIRED="0.1.4"
 UDEV_REQUIRED=145
 PCIACCESS_REQUIRED=0.10.0
 XMLRPC_REQUIRED=1.14.0
@@ -158,6 +157,7 @@ LIBVIRT_COMPILE_WARNINGS
 LIBVIRT_CHECK_APPARMOR
 LIBVIRT_CHECK_AUDIT
 LIBVIRT_CHECK_CAPNG
+LIBVIRT_CHECK_NETCF
 LIBVIRT_CHECK_NUMACTL
 LIBVIRT_CHECK_SANLOCK
 LIBVIRT_CHECK_SASL
@@ -1574,40 +1574,6 @@ if test "$with_qemu:$with_lxc:$with_network" != "no:no:no"; then
 fi
 AM_CONDITIONAL([WITH_BRIDGE], [test "$with_bridge" = "yes"])
 
-dnl netcf library
-AC_ARG_WITH([netcf],
-  AC_HELP_STRING([--with-netcf], [libnetcf support to configure physical host network interfaces @<:@default=check@:>@]),
-[], [with_netcf=check])
-
-NETCF_CFLAGS=
-NETCF_LIBS=
-if test "$with_libvirtd" = "no" ; then
-  with_netcf=no
-fi
-if test "$with_netcf" = "yes" || test "$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])
-    AC_CHECK_LIB([netcf], [ncf_change_begin], [netcf_transactions=1], [netcf_transactions=0])
-    if test "$netcf_transactions" = "1" ; then
-        AC_DEFINE_UNQUOTED([HAVE_NETCF_TRANSACTIONS], 1,
-          [we have sufficiently new version of netcf for transaction network API])
-    fi
-  fi
-fi
-AM_CONDITIONAL([WITH_NETCF], [test "$with_netcf" = "yes"])
-AC_SUBST([NETCF_CFLAGS])
-AC_SUBST([NETCF_LIBS])
-
 
 AC_ARG_WITH([secrets],
   AC_HELP_STRING([--with-secrets], [with local secrets management driver @<:@default=yes@:>@]),[],[with_secrets=yes])
@@ -2753,6 +2719,7 @@ AC_MSG_NOTICE([])
 LIBVIRT_RESULT_APPARMOR
 LIBVIRT_RESULT_AUDIT
 LIBVIRT_RESULT_CAPNG
+LIBVIRT_RESULT_NETCF
 LIBVIRT_RESULT_NUMACTL
 LIBVIRT_RESULT_SANLOCK
 LIBVIRT_RESULT_SASL
@@ -2825,11 +2792,6 @@ AC_MSG_NOTICE([    udev: $UDEV_CFLAGS $UDEV_LIBS $PCIACCESS_CFLAGS $PCIACCESS_LI
 else
 AC_MSG_NOTICE([    udev: no])
 fi
-if test "$with_netcf" = "yes" ; then
-AC_MSG_NOTICE([   netcf: $NETCF_CFLAGS $NETCF_LIBS])
-else
-AC_MSG_NOTICE([   netcf: no])
-fi
 if test "$with_qemu" = "yes" && test "$LIBPCAP_FOUND" != "no"; then
 AC_MSG_NOTICE([    pcap: $LIBPCAP_CFLAGS $LIBPCAP_LIBS])
 else
diff --git a/m4/virt-netcf.m4 b/m4/virt-netcf.m4
new file mode 100644
index 0000000..49c1f2f
--- /dev/null
+++ b/m4/virt-netcf.m4
@@ -0,0 +1,40 @@
+dnl The libnetcf.so library
+dnl
+dnl Copyright (C) 2012-2013 Red Hat, Inc.
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License, or (at your option) any later version.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library.  If not, see
+dnl <http://www.gnu.org/licenses/>.
+dnl
+
+AC_DEFUN([LIBVIRT_CHECK_NETCF],[
+  LIBVIRT_CHECK_PKG([NETCF], [netcf], [0.1.4])
+
+  if test "$with_netcf" = "yes" ; then
+    old_CFLAGS="$CFLAGS"
+    old_LIBS="$CFLAGS"
+    CFLAGS="$CFLAGS $NETCF_CFLAGS"
+    LIBS="$LIBS $NETCF_LIBS"
+    AC_CHECK_FUNC([ncf_change_begin], [netcf_transactions=1], [netcf_transactions=0])
+    if test "$netcf_transactions" = "1" ; then
+        AC_DEFINE_UNQUOTED([HAVE_NETCF_TRANSACTIONS], 1,
+          [we have sufficiently new version of netcf for transaction network API])
+    fi
+    CFLAGS="$old_CFLAGS"
+    LIBS="$old_LIBS"
+  fi
+])
+
+AC_DEFUN([LIBVIRT_RESULT_NETCF],[
+  LIBVIRT_RESULT_LIB([NETCF])
+])
-- 
1.7.11.7

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]