[libvirt] [PATCH 1/3] storage: Add mkfs and libblkid to build system

Osier Yang jyang at redhat.com
Fri Apr 8 08:51:54 UTC 2011


New changes:
* Define LIBBLKID_REQUIRED, which is missed in previous posts.
* Remove libblkid requires per Eric's feedback.

---
 configure.ac    |   26 ++++++++++++++++++++++++++
 libvirt.spec.in |    4 ++++
 src/Makefile.am |    4 ++++
 3 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 190bf40..184236c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,6 +68,7 @@ DEVMAPPER_REQUIRED=1.0.0
 LIBCURL_REQUIRED="7.18.0"
 LIBPCAP_REQUIRED="1.0.0"
 LIBNL_REQUIRED="1.1"
+LIBBLKID_REQUIRED="2.18"
 
 dnl Checks for C compiler.
 AC_PROG_CC
@@ -1593,12 +1594,15 @@ fi
 if test "$with_storage_fs" = "yes" || test "$with_storage_fs" = "check"; then
   AC_PATH_PROG([MOUNT], [mount], [], [$PATH:/sbin:/usr/sbin])
   AC_PATH_PROG([UMOUNT], [umount], [], [$PATH:/sbin:/usr/sbin])
+  AC_PATH_PROG([MKFS], [mkfs], [], [$PATH:/sbin:/usr/sbin])
   if test "$with_storage_fs" = "yes" ; then
     if test -z "$MOUNT" ; then AC_MSG_ERROR([We need mount for FS storage driver]) ; fi
     if test -z "$UMOUNT" ; then AC_MSG_ERROR([We need umount for FS storage driver]) ; fi
+    if test -z "$MKFS" ; then AC_MSG_ERROR([We need mkfs for FS storage driver]) ; fi
   else
     if test -z "$MOUNT" ; then with_storage_fs=no ; fi
     if test -z "$UMOUNT" ; then with_storage_fs=no ; fi
+    if test -z "$MKFS" ; then with_storage_fs=no ; fi
 
     if test "$with_storage_fs" = "check" ; then with_storage_fs=yes ; fi
   fi
@@ -1609,6 +1613,8 @@ if test "$with_storage_fs" = "yes" || test "$with_storage_fs" = "check"; then
         [Location or name of the mount program])
     AC_DEFINE_UNQUOTED([UMOUNT],["$UMOUNT"],
         [Location or name of the mount program])
+    AC_DEFINE_UNQUOTED([MKFS],["$MKFS"],
+        [Location or name of the mkfs program])
   fi
 fi
 AM_CONDITIONAL([WITH_STORAGE_FS], [test "$with_storage_fs" = "yes"])
@@ -2238,6 +2244,26 @@ if test "$with_nwfilter" = "yes" ; then
 fi
 AM_CONDITIONAL([WITH_NWFILTER], [test "$with_nwfilter" = "yes"])
 
+dnl libblkid is used by several storage drivers; therefore we probe
+dnl for it unconditionally.
+AC_ARG_WITH([libblkid],
+  [AS_HELP_STRING([--with-libblkid],
+    [use libblkid to scan for filesystems and partitions @<:@default=check@:>@])],
+  [],
+  [with_libblkid=check])
+
+if test "x$with_libblkid" = "xyes" || test "x$with_libblkid" = "xcheck"; then
+   PKG_CHECK_MODULES([BLKID],
+     [blkid >= $LIBBLKID_REQUIRED],
+     [with_libblkid="yes"],
+     [with_libblkid="no"])
+fi
+
+if test "x$with_libblkid" = "xyes"; then
+  AC_DEFINE([HAVE_LIBBLKID], [1], [libblkid is present])
+fi
+AM_CONDITIONAL([HAVE_LIBBLKID], [test "x$with_libblkid" = "xyes"])
+
 AC_ARG_WITH([qemu-user],
   AC_HELP_STRING([--with-qemu-user], [username to run QEMU system instance as @<:@default=root@:>@]),
   [QEMU_USER=${withval}],
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 4162fba..88f65da 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -265,6 +265,10 @@ Requires: PolicyKit >= 0.6
 %endif
 %if %{with_storage_fs}
 Requires: nfs-utils
+# For mkfs
+Requires: nfs-utils
+# For pool-build probing for existing pools
+BuildRequires: libblkid-devel >= 2.17
 # For glusterfs
 %if 0%{?fedora} >= 11
 Requires: glusterfs-client >= 2.0.1
diff --git a/src/Makefile.am b/src/Makefile.am
index 3649106..f6cb52d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -900,6 +900,10 @@ if WITH_DRIVER_MODULES
 libvirt_driver_storage_la_LIBADD += ../gnulib/lib/libgnu.la
 libvirt_driver_storage_la_LDFLAGS += -module -avoid-version
 endif
+if HAVE_LIBBLKID
+libvirt_driver_storage_la_CFLAGS += $(BLKID_CFLAGS)
+libvirt_driver_storage_la_LIBADD += $(BLKID_LIBS)
+endif
 libvirt_driver_storage_la_SOURCES += $(STORAGE_DRIVER_SOURCES)
 libvirt_driver_storage_la_SOURCES += $(STORAGE_DRIVER_FS_SOURCES)
 endif
-- 
1.7.4




More information about the libvir-list mailing list