]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix configure detection of device mapper
authorPritesh Kothari <Pritesh.Kothari@Sun.COM>
Fri, 30 Oct 2009 13:44:50 +0000 (14:44 +0100)
committerDaniel Veillard <veillard@redhat.com>
Fri, 30 Oct 2009 13:44:50 +0000 (14:44 +0100)
* configure.in: the PKG_CHECK_MODULES() for it would not work on
  Ubuntu and SuSE, so add a direct check fallback

configure.in

index 2f9db72ce926d7fc95ded30bae667d71512a7b45..04f6dfe155c1c358344e5f5fd09ffa8da37d5c1a 100644 (file)
@@ -1304,11 +1304,22 @@ if test "$with_storage_mpath" = "yes"; then
    DEVMAPPER_REQUIRED=0.0
    DEVMAPPER_CFLAGS=
    DEVMAPPER_LIBS=
-   PKG_CHECK_MODULES(DEVMAPPER, devmapper >= $DEVMAPPER_REQUIRED,
-    [], [
-    AC_MSG_ERROR(
-    [You must install device-mapper-devel >= $DEVMAPPER_REQUIRED to compile libvirt])
-    ])
+   PKG_CHECK_MODULES([DEVMAPPER], [devmapper >= $DEVMAPPER_REQUIRED], [], [DEVMAPPER_FOUND=no])
+   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_HEADER([libdevmapper.h],,[DEVMAPPER_FOUND=no])
+     AC_CHECK_LIB([devmapper], [dm_task_run],,[DEVMAPPER_FOUND=no])
+     DEVMAPPER_LIBS="-ldevmapper"
+     LIBS="$save_LIBS"
+     CFLAGS="$save_CFLAGS"
+   fi
+   if test "$DEVMAPPER_FOUND" = "no" ; then
+     AC_MSG_ERROR([You must install device-mapper-devel/libdevmapper >= $DEVMAPPER_REQUIRED to compile libvirt])
+   fi
+
 fi
 AC_SUBST([DEVMAPPER_CFLAGS])
 AC_SUBST([DEVMAPPER_LIBS])