From: "Daniel P. Berrange" <berra...@redhat.com>

Signed-off-by: Daniel P. Berrange <berra...@redhat.com>
---
 configure.ac         | 55 ++--------------------------------------------------
 m4/virt-pciaccess.m4 |  9 +++++++++
 m4/virt-udev.m4      | 15 ++++++++++++++
 3 files changed, 26 insertions(+), 53 deletions(-)
 create mode 100644 m4/virt-pciaccess.m4
 create mode 100644 m4/virt-udev.m4

diff --git a/configure.ac b/configure.ac
index e1c8635..3172063 100644
--- a/configure.ac
+++ b/configure.ac
@@ -100,8 +100,6 @@ LIBXML_REQUIRED="2.6.0"
 GNUTLS_REQUIRED="1.0.25"
 POLKIT_REQUIRED="0.6"
 PARTED_REQUIRED="1.8.0"
-UDEV_REQUIRED=145
-PCIACCESS_REQUIRED=0.10.0
 XMLRPC_REQUIRED=1.14.0
 HAL_REQUIRED=0.5.0
 DEVMAPPER_REQUIRED=1.0.0
@@ -156,6 +154,7 @@ LIBVIRT_CHECK_NUMACTL
 LIBVIRT_CHECK_SANLOCK
 LIBVIRT_CHECK_SASL
 LIBVIRT_CHECK_SELINUX
+LIBVIRT_CHECK_UDEV
 LIBVIRT_CHECK_YAJL
 
 AC_MSG_CHECKING([for CPUID instruction])
@@ -2215,52 +2214,6 @@ AC_SUBST([HAL_CFLAGS])
 AC_SUBST([HAL_LIBS])
 
 
-dnl udev/libpciaccess library check for alternate host device enumeration
-UDEV_CFLAGS=
-UDEV_LIBS=
-PCIACCESS_CFLAGS=
-PCIACCESS_LIBS=
-AC_ARG_WITH([udev],
-  AC_HELP_STRING([--with-udev], [use libudev for host device enumeration 
@<:@default=check@:>@]),
-  [],
-  [with_udev=check])
-
-if test "$with_libvirtd" = "no" ; then
-  with_udev=no
-fi
-if test "x$with_udev" = "xyes" || test "x$with_udev" = "xcheck"; then
-  PKG_CHECK_MODULES(UDEV, libudev >= $UDEV_REQUIRED,
-    [], [
-    if test "x$with_udev" = "xcheck" ; then
-       with_udev=no
-    else
-       AC_MSG_ERROR(
-         [You must install libudev-devel >= $UDEV_REQUIRED to compile libvirt])
-    fi
-  ])
-  if test "x$with_udev" != "xno"; then
-    PKG_CHECK_MODULES(PCIACCESS, pciaccess >= $PCIACCESS_REQUIRED,
-      [with_udev=yes],
-      [
-        if test "x$with_udev" = "xcheck" ; then
-          with_udev=no
-        else
-          AC_MSG_ERROR(
-           [You must install libpciaccess-devel >= $PCIACCESS_REQUIRED to 
compile libvirt])
-        fi
-      ])
-  fi
-  if test "x$with_udev" = "xyes" ; then
-    AC_DEFINE_UNQUOTED([WITH_UDEV], 1,
-      [use UDEV for host device enumeration])
-  fi
-fi
-AM_CONDITIONAL([WITH_UDEV], [test "x$with_udev" = "xyes"])
-AC_SUBST([UDEV_CFLAGS])
-AC_SUBST([UDEV_LIBS])
-AC_SUBST([PCIACCESS_CFLAGS])
-AC_SUBST([PCIACCESS_LIBS])
-
 with_nodedev=no;
 if test "$with_hal" = "yes" || test "$with_udev" = "yes";
 then
@@ -2585,6 +2538,7 @@ LIBVIRT_RESULT_NUMACTL
 LIBVIRT_RESULT_SANLOCK
 LIBVIRT_RESULT_SASL
 LIBVIRT_RESULT_SELINUX
+LIBVIRT_RESULT_UDEV
 LIBVIRT_RESULT_YAJL
 AC_MSG_NOTICE([  libxml: $LIBXML_CFLAGS $LIBXML_LIBS])
 AC_MSG_NOTICE([  dlopen: $DLOPEN_LIBS])
@@ -2634,11 +2588,6 @@ AC_MSG_NOTICE([     hal: $HAL_CFLAGS $HAL_LIBS])
 else
 AC_MSG_NOTICE([     hal: no])
 fi
-if test "$with_udev" = "yes" ; then
-AC_MSG_NOTICE([    udev: $UDEV_CFLAGS $UDEV_LIBS $PCIACCESS_CFLAGS 
$PCIACCESS_LIBS])
-else
-AC_MSG_NOTICE([    udev: 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-pciaccess.m4 b/m4/virt-pciaccess.m4
new file mode 100644
index 0000000..e40316f
--- /dev/null
+++ b/m4/virt-pciaccess.m4
@@ -0,0 +1,9 @@
+dnl The libpciaccess.so library
+
+AC_DEFUN([LIBVIRT_CHECK_PCIACCESS],[
+  LIBVIRT_CHECK_PKG([PCIACCESS], [pciaccess], [pciaccess], [0.10.0])
+])
+
+AC_DEFUN([LIBVIRT_RESULT_PCIACCESS],[
+  LIBVIRT_RESULT_LIB([PCIACCESS], [pciaccess])
+])
diff --git a/m4/virt-udev.m4 b/m4/virt-udev.m4
new file mode 100644
index 0000000..6020c67
--- /dev/null
+++ b/m4/virt-udev.m4
@@ -0,0 +1,15 @@
+dnl The libudev.so library
+
+AC_DEFUN([LIBVIRT_CHECK_UDEV],[
+  AC_REQUIRE([LIBVIRT_CHECK_PCIACCESS])
+  LIBVIRT_CHECK_PKG([UDEV], [udev], [libudev], [145])
+
+  if test "$with_udev" = "yes" && test "$with_pciaccess" != "yes" ; then
+    AC_MSG_ERROR([You must install the pciaccesss module to build with udev])
+  fi
+])
+
+AC_DEFUN([LIBVIRT_RESULT_UDEV],[
+  AC_REQUIRE([LIBVIRT_RESULT_PCIACCESS])
+  LIBVIRT_RESULT_LIB([UDEV], [udev])
+])
-- 
1.7.11.4

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

Reply via email to