]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
configure: move devmapper check to its own file
authorPavel Hrdina <phrdina@redhat.com>
Sun, 11 Dec 2016 15:00:39 +0000 (16:00 +0100)
committerPavel Hrdina <phrdina@redhat.com>
Wed, 21 Dec 2016 14:39:39 +0000 (15:39 +0100)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
configure.ac
m4/virt-devmapper.m4 [new file with mode: 0644]

index 7d42027d60e2cc1a621473d22e26a00928992db1..7c6031d1375dc8bdd0ec724679e0820d17494474 100644 (file)
@@ -111,7 +111,6 @@ fi
 
 dnl Required minimum versions of all libs we depend on
 PARTED_REQUIRED="1.8.0"
-DEVMAPPER_REQUIRED=1.0.0
 PARALLELS_SDK_REQUIRED="7.0.22"
 dnl Where we look for daemons and admin binaries during configure
 LIBVIRT_SBIN_PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin"
@@ -1417,29 +1416,14 @@ AM_CONDITIONAL([WITH_STORAGE_DISK], [test "$with_storage_disk" = "yes"])
 AC_SUBST([LIBPARTED_CFLAGS])
 AC_SUBST([LIBPARTED_LIBS])
 
+LIBVIRT_CHECK_DEVMAPPER
+
 if test "$with_storage_mpath" = "yes" ||
    test "$with_storage_disk" = "yes"; then
-   DEVMAPPER_CFLAGS=
-   DEVMAPPER_LIBS=
-   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_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])
    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])
 
 with_storage=no
 for backend in dir fs lvm iscsi scsi mpath rbd disk; do
diff --git a/m4/virt-devmapper.m4 b/m4/virt-devmapper.m4
new file mode 100644 (file)
index 0000000..f0316ac
--- /dev/null
@@ -0,0 +1,42 @@
+dnl The devmapper library
+dnl
+dnl Copyright (C) 2016 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_DEVMAPPER], [
+  DEVMAPPER_REQUIRED=1.0.0
+  DEVMAPPER_CFLAGS=
+  DEVMAPPER_LIBS=
+
+  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_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])
+
+  AC_SUBST([DEVMAPPER_CFLAGS])
+  AC_SUBST([DEVMAPPER_LIBS])
+])