Signed-off-by: Pavel Hrdina <phrd...@redhat.com>
---
 config-post.h        |  4 ++--
 configure.ac         |  2 +-
 m4/virt-devmapper.m4 | 23 ++++++-----------------
 src/util/virutil.c   |  4 ++--
 4 files changed, 11 insertions(+), 22 deletions(-)

diff --git a/config-post.h b/config-post.h
index 6a91ff66b1..ffd0904dd2 100644
--- a/config-post.h
+++ b/config-post.h
@@ -26,7 +26,6 @@
  */
 
 #ifdef LIBVIRT_SETUID_RPC_CLIENT
-# undef HAVE_LIBDEVMAPPER_H
 # undef HAVE_LIBNL
 # undef HAVE_LIBNL3
 # undef HAVE_LIBSASL2
@@ -34,6 +33,7 @@
 # undef WITH_CAPNG
 # undef WITH_CURL
 # undef WITH_DBUS
+# undef WITH_DEVMAPPER
 # undef WITH_DTRACE_PROBES
 # undef WITH_GNUTLS
 # undef WITH_GNUTLS_GCRYPT
@@ -53,13 +53,13 @@
  * explanation above.
  */
 #ifdef LIBVIRT_NSS
-# undef HAVE_LIBDEVMAPPER_H
 # undef HAVE_LIBNL
 # undef HAVE_LIBNL3
 # undef HAVE_LIBSASL2
 # undef HAVE_SYS_ACL_H
 # undef WITH_CAPNG
 # undef WITH_CURL
+# undef WITH_DEVMAPPER
 # undef WITH_DTRACE_PROBES
 # undef WITH_GNUTLS
 # undef WITH_GNUTLS_GCRYPT
diff --git a/configure.ac b/configure.ac
index 12f3f2fff1..b2812833ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1420,7 +1420,7 @@ LIBVIRT_CHECK_DEVMAPPER
 
 if test "$with_storage_mpath" = "yes" ||
    test "$with_storage_disk" = "yes"; then
-   if test "$DEVMAPPER_FOUND" = "no" ; then
+   if test "$with_devmapper" = "no" ; then
      AC_MSG_ERROR([You must install device-mapper-devel/libdevmapper >= 
$DEVMAPPER_REQUIRED to compile libvirt])
    fi
 fi
diff --git a/m4/virt-devmapper.m4 b/m4/virt-devmapper.m4
index f0316ac434..2737b3eb2c 100644
--- a/m4/virt-devmapper.m4
+++ b/m4/virt-devmapper.m4
@@ -19,24 +19,13 @@ dnl
 
 AC_DEFUN([LIBVIRT_CHECK_DEVMAPPER], [
   DEVMAPPER_REQUIRED=1.0.0
-  DEVMAPPER_CFLAGS=
-  DEVMAPPER_LIBS=
 
-  PKG_CHECK_MODULES([DEVMAPPER], [devmapper >= $DEVMAPPER_REQUIRED], [], 
[DEVMAPPER_FOUND=no])
+  with_devmapper=check
 
-  if test "$DEVMAPPER_FOUND" = "no"; then
-    # devmapper is missing pkg-config files in ubuntu, suse, etc
-    save_LIBS="$LIBS"
-    save_CFLAGS="$CFLAGS"
-    DEVMAPPER_FOUND=yes
-    AC_CHECK_LIB([devmapper], [dm_task_run],,[DEVMAPPER_FOUND=no])
-    DEVMAPPER_LIBS="-ldevmapper"
-    LIBS="$save_LIBS"
-    CFLAGS="$save_CFLAGS"
-  fi
-
-  AC_CHECK_HEADERS([libdevmapper.h],,[DEVMAPPER_FOUND=no])
+  LIBVIRT_CHECK_PKG([DEVMAPPER], [devmapper], [$DEVMAPPER_REQUIRED], [])
 
-  AC_SUBST([DEVMAPPER_CFLAGS])
-  AC_SUBST([DEVMAPPER_LIBS])
+  if test "x$with_devmapper" = "xno"; then
+    with_devmapper=check
+    LIBVIRT_CHECK_LIB([DEVMAPPER], [devmapper], [dm_task_run], 
[libdevmapper.h])
+  fi
 ])
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 02913787da..933d5b06b4 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -48,7 +48,7 @@
 #include <termios.h>
 #include <locale.h>
 
-#if HAVE_LIBDEVMAPPER_H
+#if WITH_DEVMAPPER
 # include <libdevmapper.h>
 #endif
 
@@ -1608,7 +1608,7 @@ void virFileWaitForDevices(void)
 {}
 #endif
 
-#if HAVE_LIBDEVMAPPER_H
+#if WITH_DEVMAPPER
 bool
 virIsDevMapperDevice(const char *dev_name)
 {
-- 
2.11.0

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

Reply via email to