[RFC] [PATCH 1/5] add configure option --with-fuse for libvirt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



add a configure option --with-fuse to prepare introduction
of fuse support for libvirt lxc.

Signed-off-by: Gao feng <gaofeng@xxxxxxxxxxxxxx>
---
 configure.ac    |   45 +++++++++++++++++++++++++++++++++++++++++++++
 libvirt.spec.in |    9 +++++++++
 2 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index d45f4f1..d5cf45f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1694,7 +1694,47 @@ AM_CONDITIONAL([HAVE_CAPNG], [test "$with_capng" != "no"])
 AC_SUBST([CAPNG_CFLAGS])
 AC_SUBST([CAPNG_LIBS])
 
+dnl libfuse
+AC_ARG_WITH([fuse],
+    AC_HELP_STRING([--with-fuse], [use libfuse to proivde fuse filesystem support for libvirt lxc]),
+    [],
+    [with_fuse=check])
 
+dnl
+dnl This check looks for 'fuse'
+dnl
+FUSE_CFLAGS=
+FUSE_LIBS=
+if test "$with_fuse" != "no"; then
+    old_cflags="$CFLAGS"
+    old_libs="$LIBS"
+    old_cppflags="$CPPFLAGS"
+    CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64"
+    if test "$with_fuse" = "check"; then
+        AC_CHECK_HEADER([fuse.h], [], [with_fuse=no])
+        AC_CHECK_LIB([fuse], [fuse_main], [], [with_fuse=no])
+        if test "$with_fuse" != "no"; then
+            with_fuse="yes"
+        fi
+    else
+        fail=0
+        AC_CHECK_HEADER([fuse.h], [], [fail=1])
+        AC_CHECK_LIB([fuse], [fuse_main], [], [fail=1])
+        test $fail = 1 &&
+             AC_MSG_ERROR([You must install the fuse >= 2.9.0 development package in order to compile and run libvirt])
+    fi
+    CFLAGS="$old_cflags"
+    LIBS="$old_libs"
+    CPPFLAGS="$old_cppflags"
+fi
+if test "$with_fuse" = "yes"; then
+    FUSE_LIBS="-lfuse"
+    FUSE_CFLAGS="-D_FILE_OFFSET_BITS=64"
+    AC_DEFINE_UNQUOTED([HAVE_FUSE], 1, [Whether fuse is available for privilege reduction])
+fi
+AM_CONDITIONAL([HAVE_FUSE], [test "$with_fuse" != "no"])
+AC_SUBST([FUSE_CFLAGS])
+AC_SUBST([FUSE_LIBS])
 
 dnl virsh libraries
 AC_CHECK_HEADERS([readline/readline.h])
@@ -2912,6 +2952,11 @@ AC_MSG_NOTICE([   capng: $CAPNG_CFLAGS $CAPNG_LIBS])
 else
 AC_MSG_NOTICE([   capng: no])
 fi
+if test "$with_fuse" = "yes" ; then
+AC_MSG_NOTICE([    fuse: $FUSE_CFLAGS $FUSE_LIBS])
+else
+AC_MSG_NOTICE([    fuse: no])
+fi
 if test "$with_xen" = "yes" ; then
 AC_MSG_NOTICE([     xen: $XEN_CFLAGS $XEN_LIBS])
 else
diff --git a/libvirt.spec.in b/libvirt.spec.in
index ec2b3b4..8cb2291 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -86,6 +86,7 @@
 # A few optional bits off by default, we enable later
 %define with_polkit        0%{!?_without_polkit:0}
 %define with_capng         0%{!?_without_capng:0}
+%define with_fuse          0%{!?_without_fuse:0}
 %define with_netcf         0%{!?_without_netcf:0}
 %define with_udev          0%{!?_without_udev:0}
 %define with_hal           0%{!?_without_hal:0}
@@ -450,6 +451,9 @@ BuildRequires: numactl-devel
 %if %{with_capng}
 BuildRequires: libcap-ng-devel >= 0.5.0
 %endif
+%if %{with_fuse}
+BuildRequires: fuse-devel >= 2.9.0
+%endif
 %if %{with_phyp}
 BuildRequires: libssh2-devel
 %endif
@@ -1092,6 +1096,10 @@ of recent versions of Linux (and other OSes).
 %define _without_capng --without-capng
 %endif
 
+%if ! %{with_fuse}
+%define _without_fuse --without-fuse
+%endif
+
 %if ! %{with_netcf}
 %define _without_netcf --without-netcf
 %endif
@@ -1181,6 +1189,7 @@ autoreconf -if
            %{?_without_numactl} \
            %{?_without_numad} \
            %{?_without_capng} \
+           %{?_without_fuse} \
            %{?_without_netcf} \
            %{?_without_selinux} \
            %{?_without_hal} \
-- 
1.7.7.6

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


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]