summary refs log tree commit diff stats
path: root/tools/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'tools/meson.build')
-rw-r--r--tools/meson.build31
1 files changed, 9 insertions, 22 deletions
diff --git a/tools/meson.build b/tools/meson.build
index 3e5a0abfa2..46977af84f 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -1,25 +1,12 @@
-have_virtiofsd = (targetos == 'linux' and
-    have_tools and
-    seccomp.found() and
-    libcap_ng.found() and
-    'CONFIG_VHOST_USER' in config_host)
-
-if get_option('virtiofsd').enabled()
-  if not have_virtiofsd
-    if targetos != 'linux'
-      error('virtiofsd requires Linux')
-    elif not seccomp.found() or not libcap_ng.found()
-      error('virtiofsd requires libcap-ng-devel and seccomp-devel')
-    elif 'CONFIG_VHOST_USER' not in config_host
-      error('virtiofsd needs vhost-user support')
-    else
-      # Disabled all the tools but virtiofsd.
-      have_virtiofsd = true
-    endif
-  endif
-elif get_option('virtiofsd').disabled() or not have_system
-  have_virtiofsd = false
-endif
+have_virtiofsd = get_option('virtiofsd') \
+    .require(targetos == 'linux',
+             error_message: 'virtiofsd requires Linux') \
+    .require(seccomp.found() and libcap_ng.found(),
+             error_message: 'virtiofsd requires libcap-ng-devel and seccomp-devel') \
+    .require('CONFIG_VHOST_USER' in config_host,
+             error_message: 'virtiofsd needs vhost-user-support') \
+    .disable_auto_if(not have_tools and not have_system) \
+    .allowed()
 
 if have_virtiofsd
   subdir('virtiofsd')