diff --git a/configure.ac b/configure.ac
index 66130deb10..724f172e63 100644
--- a/configure.ac
+++ b/configure.ac
@@ -134,7 +134,6 @@ dnl
dnl Storage driver checks
dnl
-LIBVIRT_STORAGE_ARG_FS
LIBVIRT_STORAGE_ARG_LVM
LIBVIRT_STORAGE_ARG_ISCSI
LIBVIRT_STORAGE_ARG_ISCSI_DIRECT
@@ -147,7 +146,6 @@ LIBVIRT_STORAGE_ARG_ZFS
LIBVIRT_STORAGE_ARG_VSTORAGE
if test "$with_libvirtd" = "no"; then
- with_storage_fs=no
with_storage_lvm=no
with_storage_iscsi=no
with_storage_iscsi_direct=no
@@ -160,13 +158,6 @@ if test "$with_libvirtd" = "no"; then
with_storage_vstorage=no
fi
-dnl storage-fs does not work on macOS
-
-if test "$with_macos" = "yes"; then
- with_storage_fs=no
-fi
-
-LIBVIRT_STORAGE_CHECK_FS
LIBVIRT_STORAGE_CHECK_LVM
LIBVIRT_STORAGE_CHECK_ISCSI
LIBVIRT_STORAGE_CHECK_ISCSI_DIRECT
@@ -234,7 +225,6 @@ AC_MSG_NOTICE([=====================])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Storage Drivers])
AC_MSG_NOTICE([])
-LIBVIRT_STORAGE_RESULT_FS
LIBVIRT_STORAGE_RESULT_LVM
LIBVIRT_STORAGE_RESULT_ISCSI
LIBVIRT_STORAGE_RESULT_ISCSI_DIRECT
diff --git a/m4/virt-storage-fs.m4 b/m4/virt-storage-fs.m4
deleted file mode 100644
index 6c61e61fa7..0000000000
--- a/m4/virt-storage-fs.m4
+++ /dev/null
@@ -1,89 +0,0 @@
-dnl The storage fs check
-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 .
-dnl
-
-AC_DEFUN([LIBVIRT_STORAGE_ARG_FS], [
- LIBVIRT_ARG_WITH_FEATURE([STORAGE_FS], [FileSystem backend for the storage driver],
- [check])
-])
-
-AC_DEFUN([LIBVIRT_STORAGE_CHECK_FS], [
- if test "$with_storage_fs" = "yes" || test "$with_storage_fs" = "check"; then
- AC_CHECK_HEADER([mntent.h], , [
- if test "$with_storage_fs" = "check"; then
- with_storage_fs=no
- AC_MSG_NOTICE([ is required for the FS storage driver, disabling it])
- else
- AC_MSG_ERROR([ is required for the FS storage driver])
- fi
- ])
- fi
-
- if test "$with_storage_fs" = "yes" || test "$with_storage_fs" = "check"; then
- AC_PATH_PROG([MOUNT], [mount], [], [$LIBVIRT_SBIN_PATH])
- AC_PATH_PROG([UMOUNT], [umount], [], [$LIBVIRT_SBIN_PATH])
- AC_PATH_PROG([MKFS], [mkfs], [], [$LIBVIRT_SBIN_PATH])
- 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
-
- if test "$with_storage_fs" = "yes" ; then
- AC_DEFINE_UNQUOTED([WITH_STORAGE_FS], 1,
- [whether FS backend for storage driver is enabled])
- AC_DEFINE_UNQUOTED([MOUNT], ["$MOUNT"],
- [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"])
- if test "$with_storage_fs" = "yes"; then
- AC_PATH_PROG([SHOWMOUNT], [showmount], [], [$LIBVIRT_SBIN_PATH])
- AC_DEFINE_UNQUOTED([SHOWMOUNT], ["$SHOWMOUNT"],
- [Location or name of the showmount program])
- fi
-])
-
-AC_DEFUN([LIBVIRT_STORAGE_RESULT_FS], [
- LIBVIRT_RESULT([FS], [$with_storage_fs])
- LIBVIRT_RESULT([NetFS], [$with_storage_fs])
-])
diff --git a/meson.build b/meson.build
index 6d26f29ba3..1d49452837 100644
--- a/meson.build
+++ b/meson.build
@@ -1895,6 +1895,49 @@ if conf.has('WITH_LIBVIRTD')
elif get_option('storage_disk').enabled()
error('You must install libparted and libdevmapper to compile libvirt with disk storage driver')
endif
+
+ if not get_option('storage_fs').disabled()
+ fs_enable = true
+
+ # storage-fs does not work on macOS
+ if host_machine.system() == 'darwin'
+ fs_enable = false
+ endif
+
+ if fs_enable and not cc.has_header('mntent.h')
+ if get_option('storage_fs').enabled()
+ error(' is required for the FS storage driver')
+ else
+ fs_enable = false
+ endif
+ endif
+
+ if fs_enable
+ mount_prog = find_program('mount', required: get_option('storage_fs'), dirs: libvirt_sbin_path)
+ umount_prog = find_program('umount', required: get_option('storage_fs'), dirs: libvirt_sbin_path)
+ mkfs_prog = find_program('mkfs', required: get_option('storage_fs'), dirs: libvirt_sbin_path)
+
+ if not mount_prog.found() or not umount_prog.found() or not mkfs_prog.found()
+ fs_enable = false
+ endif
+ endif
+
+ if fs_enable
+ use_storage = true
+
+ conf.set('WITH_STORAGE_FS', 1)
+ conf.set_quoted('MOUNT', mount_prog.path())
+ conf.set_quoted('UMOUNT', umount_prog.path())
+ conf.set_quoted('MKFS', mkfs_prog.path())
+
+ showmount_prog = find_program('showmount', required: false, dirs: libvirt_sbin_path)
+ showmount_path = ''
+ if showmount_prog.found()
+ showmount_path = showmount_prog.path()
+ endif
+ conf.set_quoted('SHOWMOUNT', showmount_path)
+ endif
+ endif
endif
if use_storage
@@ -1941,6 +1984,8 @@ summary(driver_summary, section: 'Drivers', bool_yn: true)
storagedriver_summary = {
'Dir': conf.has('WITH_STORAGE_DIR'),
+ 'FS': conf.has('WITH_STORAGE_FS'),
+ 'NetFS': conf.has('WITH_STORAGE_FS'),
'Disk': conf.has('WITH_STORAGE_DISK'),
}
summary(storagedriver_summary, section: 'Storage Drivers', bool_yn: true)
diff --git a/meson_options.txt b/meson_options.txt
index 83558be806..62b2394d47 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -77,3 +77,4 @@ option('secdriver_selinux', type: 'feature', value: 'auto', description: 'use SE
# storage driver options
option('storage_dir', type: 'feature', value: 'auto', description: 'directory backand for the storage driver')
option('storage_disk', type: 'feature', value: 'auto', description: 'GPartd Disk backend for the storage driver')
+option('storage_fs', type: 'feature', value: 'auto', description: 'FileSystem backend for the storage driver')