From nobody Tue Feb 10 17:34:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16449180987661015.3950042106667; Tue, 15 Feb 2022 01:41:38 -0800 (PST) Received: from localhost ([::1]:52208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nJuL4-0002ek-RR for importer@patchew.org; Tue, 15 Feb 2022 04:41:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54716) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJuCG-0003pV-4g for qemu-devel@nongnu.org; Tue, 15 Feb 2022 04:32:32 -0500 Received: from [2a00:1450:4864:20::632] (port=39608 helo=mail-ej1-x632.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nJuCE-0008Pm-1I for qemu-devel@nongnu.org; Tue, 15 Feb 2022 04:32:31 -0500 Received: by mail-ej1-x632.google.com with SMTP id p9so20020774ejd.6 for ; Tue, 15 Feb 2022 01:32:29 -0800 (PST) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id m4sm6634308ejl.45.2022.02.15.01.32.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 01:32:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=43tWTC/QmGlzNc8eErt+KiOBhEr8qRUI8niGq88khb4=; b=ps4JRhbA9nE/+gDREjIusWiQQXjB753unQI57s4BK72qFTixRnYcth3QIJPUJzxkoE Bx0QINIiypR3G00+M9b8uFZE2NDZexfSfYbSZcL4Agi8wjIBu/MI61++X8/nZjCQMdTn QYLXYeo4Nmn66pjuoTB/mz49RpYIer73f8epLtHI9aql9D0kKCSq6D2gN1LLlz72x1e3 TYYpMYCo9JlXaw9FaNJEsMpkiRiEfWCErFSJVAy3a/bvKdhYYG+pD0wI51KxI4hRCEZ3 FnjZQ77WssIATTOYK+0Pa9BAGsmknt75PIofYst1NAW9LHVJc9TikZnsATWWtPcBCtwc xNBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=43tWTC/QmGlzNc8eErt+KiOBhEr8qRUI8niGq88khb4=; b=Ryw2NeS+EcnDSqBAO5v6APIfv7WKAjY6x2FQ7hboCVQCHLgCdoS7dZb7vlHboOKjuC wzdC2Zr3DlQTuXR61DiFs0Ht4oLyXwfIy0Vuq55JFAFhbd/txsC0smAHDzUghHQqJm+F DszpniJZ8TA50gshMLhFzXGSR3bDtRz9h7I7SmdOTm50H5AXLn49xfNWYfhnbqpgWuUl QTfLVtAYxLBvSUbgg0MszD4PqDniW1p3pCzXIKctdiV8K1nOqHJIu1o+Ke5loo6lKRid CRGoCQz6qihTeOP+sgCjOm5oQeYo1g+d7wVFD+IYAVi+0L7PagDni0gNeTmuhNC21w9n fCsQ== X-Gm-Message-State: AOAM530ViaGksqUPc/iDNN2NBsjhz39QSBFO6N/RFVh2nxymYtWyKp70 3H2iazfhiuvLU/kpqw0vPa98aiso08k= X-Google-Smtp-Source: ABdhPJyszuqNOgUwsxWQ+TKMtl/YJYlc+NfisqyzeEavOfV0lbyRQMg8I8/1siXiG8u42omeRtXQsg== X-Received: by 2002:a17:906:190d:: with SMTP id a13mr2170033eje.339.1644917548737; Tue, 15 Feb 2022 01:32:28 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 05/30] meson: use .require() and .disable_auto_if() method for features Date: Tue, 15 Feb 2022 10:31:58 +0100 Message-Id: <20220215093223.110827-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220215093223.110827-1-pbonzini@redhat.com> References: <20220215093223.110827-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::632 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::632; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x632.google.com X-Spam_score_int: 2 X-Spam_score: 0.2 X-Spam_bar: / X-Spam_report: (0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, PDS_HP_HELO_NORDNS=0.904, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644918119819100001 Content-Type: text/plain; charset="utf-8" The method is now in 0.59, using it simplifies some conditionals. There is a small change, which is to build virtfs-proxy-helper in a tools-only build. This is done for consistency with other tools, which are not culled by the absence of system emulator binaries. .disable_auto_if() would also be useful to check for packages, for example -linux_io_uring =3D not_found -if not get_option('linux_io_uring').auto() or have_block - linux_io_uring =3D dependency('liburing', required: get_option('linux_io= _uring'), - method: 'pkg-config', kwargs: static_kwargs) -endif +linux_io_uring =3D dependency('liburing', + required: get_option('linux_io_uring').disable_auto_if(not have_block), + method: 'pkg-config', kwargs: static_kwargs) This change however is much larger and I am not sure about the improved readability, so I am not performing it right now. Signed-off-by: Paolo Bonzini --- meson.build | 74 ++++++++++++++++++----------------------------- tools/meson.build | 31 ++++++-------------- 2 files changed, 37 insertions(+), 68 deletions(-) diff --git a/meson.build b/meson.build index af136b780d..15dfd66a3e 100644 --- a/meson.build +++ b/meson.build @@ -269,14 +269,12 @@ if 'syslog' in get_option('trace_backends') and not c= c.compiles(''' endif =20 # Miscellaneous Linux-only features -if targetos !=3D 'linux' and get_option('mpath').enabled() - error('Multipath is supported only on Linux') -endif +get_option('mpath') \ + .require(targetos =3D=3D 'linux', error_message: 'Multipath is supported= only on Linux') =20 -if targetos !=3D 'linux' and get_option('multiprocess').enabled() - error('Multiprocess QEMU is supported only on Linux') -endif -multiprocess_allowed =3D targetos =3D=3D 'linux' and get_option('multiproc= ess').allowed() +multiprocess_allowed =3D get_option('multiprocess') \ + .require(targetos =3D=3D 'linux', error_message: 'Multiprocess QEMU is s= upported only on Linux') \ + .allowed() =20 # Target-specific libraries and flags libm =3D cc.find_library('m', required: false) @@ -1268,19 +1266,13 @@ statx_test =3D gnu_source_prefix + ''' =20 has_statx =3D cc.links(statx_test) =20 -have_vhost_user_blk_server =3D (targetos =3D=3D 'linux' and - 'CONFIG_VHOST_USER' in config_host) - -if get_option('vhost_user_blk_server').enabled() - if targetos !=3D 'linux' - error('vhost_user_blk_server requires linux') - elif 'CONFIG_VHOST_USER' not in config_host - error('vhost_user_blk_server requires vhost-user support') - endif -elif get_option('vhost_user_blk_server').disabled() or not have_system - have_vhost_user_blk_server =3D false -endif - +have_vhost_user_blk_server =3D get_option('vhost_user_blk_server') \ + .require(targetos =3D=3D 'linux', + error_message: 'vhost_user_blk_server requires linux') \ + .require('CONFIG_VHOST_USER' in config_host, + error_message: 'vhost_user_blk_server requires vhost-user suppo= rt') \ + .disable_auto_if(not have_system) \ + .allowed() =20 if get_option('fuse').disabled() and get_option('fuse_lseek').enabled() error('Cannot enable fuse-lseek while fuse is disabled') @@ -1407,36 +1399,26 @@ endif have_host_block_device =3D (targetos !=3D 'darwin' or cc.has_header('IOKit/storage/IOMedia.h')) =20 -dbus_display =3D false -if not get_option('dbus_display').disabled() - # FIXME enable_modules shouldn't be necessary, but: https://github.com/m= esonbuild/meson/issues/8333 - dbus_display =3D gio.version().version_compare('>=3D2.64') and config_ho= st.has_key('GDBUS_CODEGEN') and enable_modules - if get_option('dbus_display').enabled() and not dbus_display - error('Requirements missing to enable -display dbus (glib>=3D2.64 && -= -enable-modules)') - endif -endif +# FIXME enable_modules shouldn't be necessary, but: https://github.com/mes= onbuild/meson/issues/8333 +dbus_display =3D get_option('dbus_display') \ + .require(gio.version().version_compare('>=3D2.64'), + error_message: '-display dbus requires glib>=3D2.64') \ + .require(enable_modules, + error_message: '-display dbus requires --enable-modules') \ + .require(config_host.has_key('GDBUS_CODEGEN'), + error_message: '-display dbus requires gdbus-codegen') \ + .allowed() =20 -have_virtfs =3D (targetos =3D=3D 'linux' and - have_system and - libattr.found() and - libcap_ng.found()) +have_virtfs =3D get_option('virtfs') \ + .require(targetos =3D=3D 'linux', + error_message: 'virtio-9p (virtfs) requires Linux') \ + .require(libattr.found() and libcap_ng.found(), + error_message: 'virtio-9p (virtfs) requires libcap-ng-devel a= nd libattr-devel') \ + .disable_auto_if(not have_tools and not have_system) \ + .allowed() =20 have_virtfs_proxy_helper =3D have_virtfs and have_tools =20 -if get_option('virtfs').enabled() - if not have_virtfs - if targetos !=3D 'linux' - error('virtio-9p (virtfs) requires Linux') - elif not libcap_ng.found() or not libattr.found() - error('virtio-9p (virtfs) requires libcap-ng-devel and libattr-devel= ') - elif not have_system - error('virtio-9p (virtfs) needs system emulation support') - endif - endif -elif get_option('virtfs').disabled() - have_virtfs =3D false -endif - foreach k : get_option('trace_backends') config_host_data.set('CONFIG_TRACE_' + k.to_upper(), true) endforeach 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 =3D (targetos =3D=3D '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 !=3D '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 =3D true - endif - endif -elif get_option('virtiofsd').disabled() or not have_system - have_virtiofsd =3D false -endif +have_virtiofsd =3D get_option('virtiofsd') \ + .require(targetos =3D=3D 'linux', + error_message: 'virtiofsd requires Linux') \ + .require(seccomp.found() and libcap_ng.found(), + error_message: 'virtiofsd requires libcap-ng-devel and seccom= p-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() =20 if have_virtiofsd subdir('virtiofsd') --=20 2.34.1