tools: add option to explicitly enable VirtFS in QEMU build
authorPaul Durrant <paul.durrant@citrix.com>
Tue, 11 Sep 2018 15:01:08 +0000 (16:01 +0100)
committerWei Liu <wei.liu2@citrix.com>
Wed, 19 Sep 2018 17:03:43 +0000 (18:03 +0100)
9pfs support has been a documented feature since Xen 4.9, but QEMU will
not be built with backend support unless VirtFS is enabled, which is
predicated on the libcap and libattr dev packages being installed. This is
not obvious to anyone intending to use 9pfs.

This patch adds an 'enable-9pfs' option to configure which, if specified,
will cause '--enable-virtfs' to be passed to QEMU's configure. This will
cause the dependency on libcap and libattr to be called out if the packages
are not in installed.

For completeness, specifying 'disable-9pfs' will cause '--disable-virtfs' to
be passed to QEMU's confgure and not specifying an option will keep the
previous behaviour of predicating VirtFS on whether the libcap and libattr
packages are installed.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Wei Liu <wei.liu2@citrix.com>
config/Tools.mk.in
tools/Makefile
tools/configure
tools/configure.ac

index 0964f6f9e9ec28d9270cbc4eced16052861d161e..bdba087af02f6149eef997d80e442703c2d7a22c 100644 (file)
@@ -62,6 +62,7 @@ SYSTEMD_CFLAGS      := @SYSTEMD_CFLAGS@
 SYSTEMD_LIBS        := @SYSTEMD_LIBS@
 XEN_SYSTEMD_DIR     := @SYSTEMD_DIR@
 XEN_SYSTEMD_MODULES_LOAD := @SYSTEMD_MODULES_LOAD@
+CONFIG_9PFS         := @ninepfs@
 
 LINUX_BACKEND_MODULES := @LINUX_BACKEND_MODULES@
 
index 67977ad850ab43b3dc8af68bc387f67be82f000a..c903d6a63eb369a803edbf909dbecc5aa35f777e 100644 (file)
@@ -232,6 +232,13 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
        else \
                enable_trace_backend='' ; \
        fi ; \
+       if [ "$(CONFIG_9PFS)" = "y" ]; then \
+               virtfs='--enable-virtfs' ; \
+       elif [ "$(CONFIG_9PFS)" = "n" ]; then \
+               virtfs='--disable-virtfs' ; \
+       else \
+               virtfs='' ; \
+       fi ; \
        PKG_CONFIG_PATH=$(XEN_ROOT)/tools/pkg-config$${PKG_CONFIG_PATH:+:$${PKG_CONFIG_PATH}} \
        $$source/configure --enable-xen --target-list=i386-softmmu \
                $(QEMU_XEN_ENABLE_DEBUG) \
@@ -279,7 +286,8 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
                --python=$(PYTHON) \
                $(CONFIG_QEMUU_EXTRA_ARGS) \
                --cpu=$(IOEMU_CPU_ARCH) \
-               $(IOEMU_CONFIGURE_CROSS); \
+               $(IOEMU_CONFIGURE_CROSS) \
+               $$virtfs; \
        $(MAKE) all
 
 subdir-install-qemu-xen-dir: subdir-all-qemu-xen-dir
index 27c8d054abc72e5615256bbb151d0fa4168e0f42..acbcf9eb3eea11875a4cf67066fa0f23433e28d4 100755 (executable)
@@ -624,6 +624,7 @@ ac_includes_default="\
 
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+ninepfs
 SYSTEMD_LIBS
 SYSTEMD_CFLAGS
 SYSTEMD_MODULES_LOAD
@@ -820,6 +821,7 @@ with_xenstored
 enable_systemd
 with_systemd
 with_systemd_modules_load
+enable_9pfs
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1500,6 +1502,8 @@ Optional Features:
   --disable-ipxe          Enable in-tree IPXE, (DEFAULT is on if rombios is
                           enabled, otherwise off, see also --with-system-ipxe)
   --enable-systemd        Enable systemd support (default is DISABLED)
+  --enable-9pfs           Explicitly enable 9pfs support in QEMU build
+                          (default is to defer to QEMU configure default)
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -9799,6 +9803,18 @@ if test "x$systemd" = "xy"; then :
 
 fi
 
+# Check whether --enable-9pfs was given.
+if test "${enable_9pfs+set}" = set; then :
+  enableval=$enable_9pfs; if test "x$enable_9pfs" = "xyes"; then :
+  ninepfs=y
+else
+  ninepfs=n
+fi
+fi
+
+
+
+
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
@@ -11103,4 +11119,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
-
index bca25452800036ba93475197df44ce508e24a949..e7d2e6f4ffe944c80751d5c28012fe3b4838524d 100644 (file)
@@ -486,5 +486,12 @@ AS_IF([test "x$systemd" = "xy"], [
     ])
 ])
 
-AC_OUTPUT()
+AC_ARG_ENABLE([9pfs],
+    AS_HELP_STRING([--enable-9pfs],
+                   [Explicitly enable 9pfs support in QEMU build (default is to defer to QEMU configure default)]),
+    [AS_IF([test "x$enable_9pfs" = "xyes"], [ninepfs=y], [ninepfs=n])],[
+])
 
+AC_SUBST(ninepfs)
+
+AC_OUTPUT()