From patchwork Thu Jan 7 14:00:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1423314 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=u7mHYtap; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DBSbd1nzJz9sWF for ; Fri, 8 Jan 2021 01:02:21 +1100 (AEDT) Received: from localhost ([::1]:51336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxVrn-0003y9-8e for incoming@patchwork.ozlabs.org; Thu, 07 Jan 2021 09:02:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxVqK-0003wR-RR for qemu-devel@nongnu.org; Thu, 07 Jan 2021 09:00:49 -0500 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]:38200) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxVqG-0006uj-2Y for qemu-devel@nongnu.org; Thu, 07 Jan 2021 09:00:47 -0500 Received: by mail-ej1-x62a.google.com with SMTP id 6so9819809ejz.5 for ; Thu, 07 Jan 2021 06:00:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oh9PCOgSakOP6BoAqkfwWAKJaRKuw2Mtd466eLx9XcU=; b=u7mHYtapDg61IM6VlwdGfyj2xIchWFnNRg4WXyEN+YKFbPVNzfMIqxZD2Bp7d+vqnV 48x3xuyHG27TuXs+92pnt0vRE1eKgEWzPyfNDc/7rsI5Ifec4INDA0xnTLGerJy+S1/D PkM+nQA3Y5Tj2XTMazv7plsu8pjaom4y1MEnzLXtih1z+DgsnnkR6mqbEr3bcA1mPd83 BsKaondHL9T/mDolZ948Rf3+J0PlEqmPIc+BW+61tbsRIiGVFTeb/RicBBOxt6kou8rE SAaI9T+SvElKYUmKMr520HLKCcgZFddPS3P85kITz332R0Gd5bybedZ45MxQbMuXX3nr jNBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=oh9PCOgSakOP6BoAqkfwWAKJaRKuw2Mtd466eLx9XcU=; b=X1oZSwbMkUWmGrb/nlNRjIf/6bUIfdLh3SSUrB/2odO27lmRotKZsNIh3TY4bj2CNu 7N0wDivgM/BPqMsUDC/rAP/eULWwzIHfe8DOg5NZMVkWdk7ODF1pqQlohW4yuC9mS1sc 1aeuwgIggVRjBH8zvcjWqZ6sUnPaoSPO1QFk7r2uKWhSGzmagAn1fa6icIePs99Amyik pSxHtCQ3+O7FRIdDoh4gQGdiJCASaLiPQEM4kMzb21st/XcsVcNIpAyn42C9xWbgwAVr Y4SDe4pyAI810OBNkhxU1VItivgJAnAhvM6SfWYZlqXctHhbUe0XzYfaGeLVpPDw6jFO 6/vw== X-Gm-Message-State: AOAM531RnE6yroq2JAzaGzrdmRU+Ct+Ws7uN3bj5cC019YIs1UuxVTO/ GVgDj9kUoFLjkAgFCx7SqEx9sYM2aEqYmg== X-Google-Smtp-Source: ABdhPJx4mazAi7AM6VWlXZKMRvjjmnxU5Jrpkbp2hgO+QFidG1IpGu/MeDy3b+dhvCV+lzGP5DRQ2Q== X-Received: by 2002:a17:906:22c7:: with SMTP id q7mr6405469eja.486.1610028042601; Thu, 07 Jan 2021 06:00:42 -0800 (PST) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id oq27sm2438523ejb.108.2021.01.07.06.00.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 06:00:42 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 1/8] build-system: clean up TCG/TCI configury Date: Thu, 7 Jan 2021 15:00:32 +0100 Message-Id: <20210107140039.467969-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210107140039.467969-1-pbonzini@redhat.com> References: <20210107140039.467969-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62a; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x62a.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, marcandre.lureau@redhat.com, berrange@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Make CONFIG_TCG_INTERPRETER a Meson option, and enable TCI (though with a warning) if the host CPU is unsupported, making it more similar to other --enable-* options. Remove TCG-specific include paths from !CONFIG_TCG builds. Signed-off-by: Paolo Bonzini --- configure | 11 +++-------- disas/meson.build | 2 -- meson.build | 50 ++++++++++++++++++++++++----------------------- meson_options.txt | 2 ++ 4 files changed, 31 insertions(+), 34 deletions(-) diff --git a/configure b/configure index 8e0de14aa6..81801a6fe0 100755 --- a/configure +++ b/configure @@ -355,7 +355,7 @@ sanitizers="no" tsan="no" fortify_source="$default_feature" strip_opt="yes" -tcg_interpreter="no" +tcg_interpreter="auto" bigendian="no" mingw32="no" gcov="no" @@ -1117,9 +1117,9 @@ for opt do ;; --enable-whpx) whpx="enabled" ;; - --disable-tcg-interpreter) tcg_interpreter="no" + --disable-tcg-interpreter) tcg_interpreter="disabled" ;; - --enable-tcg-interpreter) tcg_interpreter="yes" + --enable-tcg-interpreter) tcg_interpreter="enabled" ;; --disable-cap-ng) cap_ng="disabled" ;; @@ -5911,11 +5911,6 @@ fi if test "$optreset" = "yes" ; then echo "HAVE_OPTRESET=y" >> $config_host_mak fi -if test "$tcg" = "enabled"; then - if test "$tcg_interpreter" = "yes" ; then - echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak - fi -fi if test "$fdatasync" = "yes" ; then echo "CONFIG_FDATASYNC=y" >> $config_host_mak fi diff --git a/disas/meson.build b/disas/meson.build index 09a852742e..da341a511e 100644 --- a/disas/meson.build +++ b/disas/meson.build @@ -22,5 +22,3 @@ common_ss.add(when: 'CONFIG_SH4_DIS', if_true: files('sh4.c')) common_ss.add(when: 'CONFIG_SPARC_DIS', if_true: files('sparc.c')) common_ss.add(when: 'CONFIG_XTENSA_DIS', if_true: files('xtensa.c')) common_ss.add(when: capstone, if_true: files('capstone.c')) - -specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('tci.c')) diff --git a/meson.build b/meson.build index 2742b37e14..36f1d02190 100644 --- a/meson.build +++ b/meson.build @@ -109,25 +109,8 @@ if targetos == 'linux' language: ['c', 'cpp']) endif -if 'CONFIG_TCG_INTERPRETER' in config_host - tcg_arch = 'tci' -elif config_host['ARCH'] == 'sparc64' - tcg_arch = 'sparc' -elif config_host['ARCH'] == 's390x' - tcg_arch = 's390' -elif config_host['ARCH'] in ['x86_64', 'x32'] - tcg_arch = 'i386' -elif config_host['ARCH'] == 'ppc64' - tcg_arch = 'ppc' -elif config_host['ARCH'] in ['riscv32', 'riscv64'] - tcg_arch = 'riscv' -else - tcg_arch = config_host['ARCH'] -endif -add_project_arguments('-iquote', meson.current_source_dir() / 'tcg' / tcg_arch, - '-iquote', '.', +add_project_arguments('-iquote', '.', '-iquote', meson.current_source_dir(), - '-iquote', meson.current_source_dir() / 'accel/tcg', '-iquote', meson.current_source_dir() / 'include', '-iquote', meson.current_source_dir() / 'disas/libvixl', language: ['c', 'cpp', 'objc']) @@ -224,14 +207,31 @@ if not get_option('hax').disabled() accelerators += 'CONFIG_HAX' endif endif + +tcg_arch = config_host['ARCH'] if not get_option('tcg').disabled() - if cpu not in supported_cpus - if 'CONFIG_TCG_INTERPRETER' in config_host + if get_option('tcg_interpreter').enabled() or cpu not in supported_cpus + if get_option('tcg_interpreter').disabled() + error('TCG interpreter disabled but host CPU @0@ supported'.format(cpu)) + elif get_option('tcg_interpreter').auto() warning('Unsupported CPU @0@, will use TCG with TCI (experimental)'.format(cpu)) - else - error('Unsupported CPU @0@, try --enable-tcg-interpreter'.format(cpu)) endif + tcg_arch = 'tci' + elif config_host['ARCH'] == 'sparc64' + tcg_arch = 'sparc' + elif config_host['ARCH'] == 's390x' + tcg_arch = 's390' + elif config_host['ARCH'] in ['x86_64', 'x32'] + tcg_arch = 'i386' + elif config_host['ARCH'] == 'ppc64' + tcg_arch = 'ppc' + elif config_host['ARCH'] in ['riscv32', 'riscv64'] + tcg_arch = 'riscv' endif + add_project_arguments('-iquote', meson.current_source_dir() / 'tcg' / tcg_arch, + '-iquote', meson.current_source_dir() / 'accel/tcg', + language: ['c', 'cpp', 'objc']) + accelerators += 'CONFIG_TCG' config_host += { 'CONFIG_TCG': 'y' } endif @@ -1833,7 +1833,9 @@ specific_ss.add(when: 'CONFIG_TCG', if_true: files( 'tcg/tcg-op.c', 'tcg/tcg.c', )) -specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('disas/tci.c', 'tcg/tci.c')) +if tcg_arch == 'tci' + specific_ss.add(files('disas/tci.c', 'tcg/tci.c')) +endif subdir('backends') subdir('disas') @@ -2392,7 +2394,7 @@ summary_info += {'WHPX support': config_all.has_key('CONFIG_WHPX')} summary_info += {'TCG support': config_all.has_key('CONFIG_TCG')} if config_all.has_key('CONFIG_TCG') summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')} - summary_info += {'TCG interpreter': config_host.has_key('CONFIG_TCG_INTERPRETER')} + summary_info += {'TCG interpreter': tcg_arch == 'tci'} endif summary_info += {'malloc trim support': has_malloc_trim} summary_info += {'RDMA support': config_host.has_key('CONFIG_RDMA')} diff --git a/meson_options.txt b/meson_options.txt index 7948a8255c..41f9c2cf6c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -37,6 +37,8 @@ option('xen_pci_passthrough', type: 'feature', value: 'auto', description: 'Xen PCI passthrough support') option('tcg', type: 'feature', value: 'auto', description: 'TCG support') +option('tcg_interpreter', type: 'feature', value: 'auto', + description: 'TCG bytecode interpreter (TCI)') option('cfi', type: 'boolean', value: 'false', description: 'Control-Flow Integrity (CFI)') option('cfi_debug', type: 'boolean', value: 'false', From patchwork Thu Jan 7 14:00:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1423315 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=lUFDBMLU; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DBSfG0rNnz9sVk for ; Fri, 8 Jan 2021 01:04:37 +1100 (AEDT) Received: from localhost ([::1]:55728 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxVty-0005x6-Fr for incoming@patchwork.ozlabs.org; Thu, 07 Jan 2021 09:04:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42790) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxVqQ-0003xD-AR for qemu-devel@nongnu.org; Thu, 07 Jan 2021 09:00:54 -0500 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]:43309) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxVqK-0006uu-JY for qemu-devel@nongnu.org; Thu, 07 Jan 2021 09:00:51 -0500 Received: by mail-ed1-x529.google.com with SMTP id y24so7798238edt.10 for ; Thu, 07 Jan 2021 06:00:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HG328Qi5HtWYAOIyt/2mCFxalYOZsd7TEHBf+7m5bas=; b=lUFDBMLUCiNJ4CB/rk6miCovctQXBgyTBNP+ZLS5V6N/AXp4n17D9MS2DmG+7MgdMz C8/WSZHrxzthSo3kQZ5WEamAx5iHQ1prNBl6fiLRsjm8GI4idSFXNsz64HA7ui2bGAI8 pJ9rm9Bu1osjsb01jiORU8SF4xZZqLhzlN6dX5pw6AC79iqepcSEmaLP5TJ6r3G1hxQs 2Bklf7aJZCXsXwJfL/Gf4QNYgmbTsW/vQCbVM1oLqxHb8UD9ZbGcGrub0jgXqzAQsFIa uSV3JpqhRWYoxgkdn1/kxft91ZeVD2Zk3tZF3d4tmNkyVqMk3+NvbH3gfTQtd3CG15gh TLWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=HG328Qi5HtWYAOIyt/2mCFxalYOZsd7TEHBf+7m5bas=; b=BfuwWvnLIj901JeiyzLiHBCVu8BrRkWVni9zw8fESEBlhFicG7fBEjIRt8d7zQIIsz 7SwYKXFAzukDHD5venxkRyMm2A81sI/3RAZgu7v5SkbQvTWbNqXUpdrok8zk3OcIq0td eoxvo8WGrLWKIRStlz7NrXP7/M/0XVy3dIuh6SE96ge8YJ+xq6yZI4JNFT0YVm3XFoLJ tguBYuTtMCvBEjPFRVy8B8ZxGay2hB3h+J9B7ls2HO8PKv8oIa7J0VMqtohkG+CCd11u RBbLB49mW14tN1oqA3XlwmIBDZJKi6rW0OGvQU6IsLf0mA3pTHN/Ylgv7Y4jBR3x4jbr zn8A== X-Gm-Message-State: AOAM533rvUQE3VpybLzDef1kNFDr0SS51SnxH/GNgLyQNmrUfrSIpRl2 Ixsbyn0oUZI/KhSqnVEYuzGYl5WezFOrGA== X-Google-Smtp-Source: ABdhPJyPI65kQt6FQdKa1Ckcg0FRbnzf/zrlQvr81lNAtt2zbJrPUBDgSSTiN4uvkYR42E+Zkd3wxQ== X-Received: by 2002:aa7:d6d8:: with SMTP id x24mr1849744edr.105.1610028043513; Thu, 07 Jan 2021 06:00:43 -0800 (PST) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id oq27sm2438523ejb.108.2021.01.07.06.00.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 06:00:42 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 2/8] cocoa: do not enable coreaudio automatically Date: Thu, 7 Jan 2021 15:00:33 +0100 Message-Id: <20210107140039.467969-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210107140039.467969-1-pbonzini@redhat.com> References: <20210107140039.467969-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x529.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, marcandre.lureau@redhat.com, berrange@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Remove the automagic connection between --enable-cocoa and enabling coreaudio in audio_drv_list. It can be overridden anyway just by placing --enable-cocoa before --audio-drv-list. Signed-off-by: Paolo Bonzini --- configure | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/configure b/configure index 81801a6fe0..2dd772a60c 100755 --- a/configure +++ b/configure @@ -1149,9 +1149,7 @@ for opt do ;; --disable-cocoa) cocoa="disabled" ;; - --enable-cocoa) - cocoa="enabled" ; - audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)" + --enable-cocoa) cocoa="enabled" ;; --disable-system) softmmu="no" ;; From patchwork Thu Jan 7 14:00:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1423317 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=IImZSMoA; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DBShs10Tsz9sWC for ; Fri, 8 Jan 2021 01:06:53 +1100 (AEDT) Received: from localhost ([::1]:60178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxVwB-0007tr-5x for incoming@patchwork.ozlabs.org; Thu, 07 Jan 2021 09:06:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxVqQ-0003xB-A2 for qemu-devel@nongnu.org; Thu, 07 Jan 2021 09:00:54 -0500 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]:39697) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxVqK-0006vf-I3 for qemu-devel@nongnu.org; Thu, 07 Jan 2021 09:00:49 -0500 Received: by mail-ed1-x52f.google.com with SMTP id c7so7830110edv.6 for ; Thu, 07 Jan 2021 06:00:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cunFXnZMvk3CFCIa7DsUvUGnpCBzaF1o2EkKuHdWb5U=; b=IImZSMoATrwE2r1/wOJxrEGYuW8zBMlvw6O25E2uCPRG8L5T/DOJGeG2onKlNHVFoW 7fY809Dlak1E2NbiTuONLd/NcVLhFgzYCsBw0DncKljLzU9IvvDyH6OCVTqFj7hjQZlD 1faZDdTkbVNULsvXZ38QR6xdpa5fRI/B7jr9TtU5E3vkwRQaxKRklEu9crluvi3wwtXn TK9bmLHkE/XgyCmsAnHDdMH6VsXEfBgAxP79wOb9ZFEZkfWwiGy7/Uj7cCJRQY1GWlmT LKamZzehz93Q5iwnqDOq8WhD6O9XgR2tBYJS+9I7xAGjAAxvT/lKA80+tz+B2XAmnhG2 p1LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=cunFXnZMvk3CFCIa7DsUvUGnpCBzaF1o2EkKuHdWb5U=; b=e57S70bP/F2J/NHgYdkxAAhOzWdJhLJ+Iu8U6cCACK5or4it4OceiRafqv8EwNYKCc /3ldpik9I3d6WquwOGItm9Z4ZDXjWb9zla7vIrEeGXoHXzvjo1VIhl3sJvpST/hy826q z379V6De2fwwkfXHYqM6I9CltR3Yse9NkntO1l8jNBwMXFzjCmlxvMo0s5Qj3kRU+GkO UrDWKSnnGOtpvK4eDjFUXbL1cXi9WnfFO3wnAItrfIfGW2Cj+8+MqDyemsWFfQlwBhxg hmOmuX8BoWeCyuec1cvymPoJMdhkirkIBgQHUA+qipwvCu5qAejPTevG6UzFoJzXmlGl yRFQ== X-Gm-Message-State: AOAM531+m1v+QQ0Yfs96Uzbl+jl8j32K/Mo/kExZEKp50guG972SQuUH xKLus8+CDby0eILDc6pvXfNWeDZEWqzJKw== X-Google-Smtp-Source: ABdhPJyR2o8a8j39gKuGUeNnJFnJy9sLxvoBJ2UKtLSuKlyk3gjl4VDZRlvDhgnMj01TnEGuelCfGQ== X-Received: by 2002:a05:6402:1d0f:: with SMTP id dg15mr1768758edb.1.1610028044421; Thu, 07 Jan 2021 06:00:44 -0800 (PST) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id oq27sm2438523ejb.108.2021.01.07.06.00.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 06:00:43 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 3/8] gtk: remove CONFIG_GTK_GL Date: Thu, 7 Jan 2021 15:00:34 +0100 Message-Id: <20210107140039.467969-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210107140039.467969-1-pbonzini@redhat.com> References: <20210107140039.467969-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x52f.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, marcandre.lureau@redhat.com, berrange@redhat.com, Gerd Hoffmann , stefanha@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" CONFIG_GTK_GL is defined if OpenGL is present and GTK+ is 3.16 or newer. Since GTK+ 3.22 is the minimum supported version, just use CONFIG_OPENGL instead. Cc: Gerd Hoffmann Signed-off-by: Paolo Bonzini Acked-by: Gerd Hoffmann --- configure | 7 ------- meson.build | 1 - ui/gtk.c | 16 ++++++++-------- ui/meson.build | 3 +-- 4 files changed, 9 insertions(+), 18 deletions(-) diff --git a/configure b/configure index 2dd772a60c..c6d09b225e 100755 --- a/configure +++ b/configure @@ -415,7 +415,6 @@ cfi_debug="false" seccomp="auto" glusterfs="auto" gtk="$default_feature" -gtk_gl="no" tls_priority="NORMAL" gnutls="$default_feature" nettle="$default_feature" @@ -3626,9 +3625,6 @@ if test "$opengl" != "no" ; then opengl_cflags="$($pkg_config --cflags $opengl_pkgs)" opengl_libs="$($pkg_config --libs $opengl_pkgs)" opengl=yes - if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then - gtk_gl="yes" - fi else if test "$opengl" = "yes" ; then feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs" @@ -5781,9 +5777,6 @@ if test "$gtk" = "yes" ; then echo "CONFIG_GTK=y" >> $config_host_mak echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak echo "GTK_LIBS=$gtk_libs" >> $config_host_mak - if test "$gtk_gl" = "yes" ; then - echo "CONFIG_GTK_GL=y" >> $config_host_mak - fi fi if test "$gio" = "yes" ; then echo "CONFIG_GIO=y" >> $config_host_mak diff --git a/meson.build b/meson.build index 36f1d02190..a729a30d2f 100644 --- a/meson.build +++ b/meson.build @@ -2337,7 +2337,6 @@ summary_info += {'SDL support': sdl.found()} summary_info += {'SDL image support': sdl_image.found()} # TODO: add back version summary_info += {'GTK support': config_host.has_key('CONFIG_GTK')} -summary_info += {'GTK GL support': config_host.has_key('CONFIG_GTK_GL')} summary_info += {'pixman': pixman.found()} # TODO: add back version summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')} diff --git a/ui/gtk.c b/ui/gtk.c index a752aa22be..e8474456df 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -396,7 +396,7 @@ static void gd_update_full_redraw(VirtualConsole *vc) int ww, wh; ww = gdk_window_get_width(gtk_widget_get_window(area)); wh = gdk_window_get_height(gtk_widget_get_window(area)); -#if defined(CONFIG_GTK_GL) +#if defined(CONFIG_OPENGL) if (vc->gfx.gls && gtk_use_gl_area) { gtk_gl_area_queue_render(GTK_GL_AREA(vc->gfx.drawing_area)); return; @@ -625,7 +625,7 @@ static const DisplayChangeListenerOps dcl_ops = { /** DisplayState Callbacks (opengl version) **/ -#if defined(CONFIG_GTK_GL) +#if defined(CONFIG_OPENGL) static const DisplayChangeListenerOps dcl_gl_area_ops = { .dpy_name = "gtk-egl", @@ -644,7 +644,7 @@ static const DisplayChangeListenerOps dcl_gl_area_ops = { .dpy_gl_update = gd_gl_area_scanout_flush, }; -#endif /* CONFIG_GTK_GL */ +#endif /* CONFIG_OPENGL */ static const DisplayChangeListenerOps dcl_egl_ops = { .dpy_name = "gtk-egl", @@ -725,7 +725,7 @@ static void gd_set_ui_info(VirtualConsole *vc, gint width, gint height) dpy_set_ui_info(vc->gfx.dcl.con, &info); } -#if defined(CONFIG_GTK_GL) +#if defined(CONFIG_OPENGL) static gboolean gd_render_event(GtkGLArea *area, GdkGLContext *context, void *opaque) @@ -1865,7 +1865,7 @@ static void gd_connect_vc_gfx_signals(VirtualConsole *vc) { g_signal_connect(vc->gfx.drawing_area, "draw", G_CALLBACK(gd_draw_event), vc); -#if defined(CONFIG_GTK_GL) +#if defined(CONFIG_OPENGL) if (gtk_use_gl_area) { /* wire up GtkGlArea events */ g_signal_connect(vc->gfx.drawing_area, "render", @@ -1992,12 +1992,12 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc, #if defined(CONFIG_OPENGL) if (display_opengl) { -#if defined(CONFIG_GTK_GL) +#if defined(CONFIG_OPENGL) if (gtk_use_gl_area) { vc->gfx.drawing_area = gtk_gl_area_new(); vc->gfx.dcl.ops = &dcl_gl_area_ops; } else -#endif /* CONFIG_GTK_GL */ +#endif /* CONFIG_OPENGL */ { vc->gfx.drawing_area = gtk_drawing_area_new(); /* @@ -2314,7 +2314,7 @@ static void early_gtk_display_init(DisplayOptions *opts) assert(opts->type == DISPLAY_TYPE_GTK); if (opts->has_gl && opts->gl != DISPLAYGL_MODE_OFF) { #if defined(CONFIG_OPENGL) -#if defined(CONFIG_GTK_GL) && defined(GDK_WINDOWING_WAYLAND) +#if defined(GDK_WINDOWING_WAYLAND) if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) { gtk_use_gl_area = true; gtk_gl_area_init(); diff --git a/ui/meson.build b/ui/meson.build index 013258a01c..d805448c4e 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -63,8 +63,7 @@ if config_host.has_key('CONFIG_GTK') gtk_ss = ss.source_set() gtk_ss.add(gtk, vte, pixman, files('gtk.c')) gtk_ss.add(when: [x11, 'CONFIG_X11'], if_true: files('x_keymap.c')) - gtk_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true: files('gtk-egl.c')) - gtk_ss.add(when: [opengl, 'CONFIG_GTK_GL'], if_true: files('gtk-gl-area.c')) + gtk_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true: files('gtk-egl.c', 'gtk-gl-area.c')) ui_modules += {'gtk' : gtk_ss} endif From patchwork Thu Jan 7 14:00:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1423321 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=XAagg5dE; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DBSpt0c6vz9sVk for ; Fri, 8 Jan 2021 01:12:06 +1100 (AEDT) Received: from localhost ([::1]:43394 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxW1E-0004Qh-2L for incoming@patchwork.ozlabs.org; Thu, 07 Jan 2021 09:12:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42844) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxVqS-0003y4-Ft for qemu-devel@nongnu.org; Thu, 07 Jan 2021 09:01:01 -0500 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]:39699) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxVqK-0006vq-Ix for qemu-devel@nongnu.org; Thu, 07 Jan 2021 09:00:55 -0500 Received: by mail-ed1-x531.google.com with SMTP id c7so7830144edv.6 for ; Thu, 07 Jan 2021 06:00:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VlMbpwwRGUfyBr2oLxpRJNDE1UWwr1g5mMbRh1kMy5M=; b=XAagg5dE1NHdyclG9PMQ4ulSd1p4WqQ9cAPHhStyOENGD3PKM4z3IB2VcZtRrMm1oo 6etDvBAsuE/+XuzEOvcIfKwIQJTYPzK6hbMSij1quH53UYmInHHvEG9y68wvwYh7Y5Hk 2LxU+WYi6XE3Nl23n4wGKIs1YxxmkN5OOeflG4mKYiRG0FfjFjIoXbfD+KjKD5e1w5TA JEZWKUrVP2ToEaSB2NTvsOO3o6q+yZYo4uzNBmceQWFgVPO1Ly4MjDh39QBHM4fLKYAo DasCpOuT+CXo2pdo7VKYiJb7JmaD8/SWzsyOPPpiGuxfiOfVUlbuII12d+isXuDud+uK +iyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=VlMbpwwRGUfyBr2oLxpRJNDE1UWwr1g5mMbRh1kMy5M=; b=oWlifTGdXaGsgxekA0X0Yt9XAM1UQ89cd92LqdIgj2waViJVUSJmPh/qmP1cllcEbj Jw7KY9E/mUGgUJu788V9LWw3tPn8usAcUuwTw/27ZcOI2mOpjRseMxo8ZTheIoczDMQW yeSv7XLspIpufv1xSwOs8ei0rhW3VqepQ/iZDa77i2DYQyKjh9fUtMO7iZrthjJaAJeM L2Flk5UN6zgJYlJHb8yBIscYgrej2StA/V8XL7P8XK/eb2DWvk0BjNp7Kon3p1MdiiQ4 8TOF2XXVJJHqAaipzn1pnbqXwn+aCJWAyV4xmCSNEsWnkCV5ParONVoRn8IoN23pj6f4 WzPQ== X-Gm-Message-State: AOAM530dLAhDZ2UWl+qBK+qda699QIHF+M3LWc9Q4c3vaG/WW9MXqn9c YNqqu8Cw8ZsEhmaYQA76/q+oL+eN0drt2A== X-Google-Smtp-Source: ABdhPJxRlC7RpBXrDGuKPd82SadeXAARnLKQXndpiRA43H4HK8xd0H6w3m0OQ9zes6p2ihUbGCzOIQ== X-Received: by 2002:a50:9e8b:: with SMTP id a11mr1741146edf.276.1610028045355; Thu, 07 Jan 2021 06:00:45 -0800 (PST) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id oq27sm2438523ejb.108.2021.01.07.06.00.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 06:00:44 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 4/8] configure: move X11 detection to Meson Date: Thu, 7 Jan 2021 15:00:35 +0100 Message-Id: <20210107140039.467969-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210107140039.467969-1-pbonzini@redhat.com> References: <20210107140039.467969-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::531; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x531.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, marcandre.lureau@redhat.com, berrange@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" For now move the logic verbatim. GTK+ actually has a hard requirement on X11 if gtk+x11 is present, but we will sort that out later. Signed-off-by: Paolo Bonzini --- configure | 14 ++------------ meson.build | 9 +++++---- ui/meson.build | 4 ++-- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/configure b/configure index c6d09b225e..e9d76c2c13 100755 --- a/configure +++ b/configure @@ -2759,14 +2759,6 @@ EOF fi fi -########################################## -# X11 probe -if $pkg_config --exists "x11"; then - have_x11=yes - x11_cflags=$($pkg_config --cflags x11) - x11_libs=$($pkg_config --libs x11) -fi - ########################################## # GTK probe @@ -5681,10 +5673,8 @@ fi if test "$module_upgrades" = "yes"; then echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak fi -if test "$have_x11" = "yes" && test "$need_x11" = "yes"; then - echo "CONFIG_X11=y" >> $config_host_mak - echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak - echo "X11_LIBS=$x11_libs" >> $config_host_mak +if test "$need_x11" = "yes"; then + echo "CONFIG_NEED_X11=y" >> $config_host_mak fi if test "$pipe2" = "yes" ; then echo "CONFIG_PIPE2=y" >> $config_host_mak diff --git a/meson.build b/meson.build index a729a30d2f..fdd4312c71 100644 --- a/meson.build +++ b/meson.build @@ -783,9 +783,9 @@ if 'CONFIG_VTE' in config_host link_args: config_host['VTE_LIBS'].split()) endif x11 = not_found -if 'CONFIG_X11' in config_host - x11 = declare_dependency(compile_args: config_host['X11_CFLAGS'].split(), - link_args: config_host['X11_LIBS'].split()) +if config_host.has_key('CONFIG_NEED_X11') + x11 = dependency('x11', method: 'pkg-config', required: false, + static: enable_static) endif vnc = not_found png = not_found @@ -1081,6 +1081,7 @@ config_host_data.set('CONFIG_STATX', has_statx) config_host_data.set('CONFIG_ZSTD', zstd.found()) config_host_data.set('CONFIG_FUSE', fuse.found()) config_host_data.set('CONFIG_FUSE_LSEEK', fuse_lseek.found()) +config_host_data.set('CONFIG_X11', x11.found()) config_host_data.set('CONFIG_CFI', get_option('cfi')) config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version())) config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0]) @@ -1167,7 +1168,7 @@ host_kconfig = \ ('CONFIG_SPICE' in config_host ? ['CONFIG_SPICE=y'] : []) + \ ('CONFIG_IVSHMEM' in config_host ? ['CONFIG_IVSHMEM=y'] : []) + \ ('CONFIG_OPENGL' in config_host ? ['CONFIG_OPENGL=y'] : []) + \ - ('CONFIG_X11' in config_host ? ['CONFIG_X11=y'] : []) + \ + (x11.found() ? ['CONFIG_X11=y'] : []) + \ ('CONFIG_VHOST_USER' in config_host ? ['CONFIG_VHOST_USER=y'] : []) + \ ('CONFIG_VHOST_VDPA' in config_host ? ['CONFIG_VHOST_VDPA=y'] : []) + \ ('CONFIG_VHOST_KERNEL' in config_host ? ['CONFIG_VHOST_KERNEL=y'] : []) + \ diff --git a/ui/meson.build b/ui/meson.build index d805448c4e..afbdd78e97 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -62,7 +62,7 @@ if config_host.has_key('CONFIG_GTK') gtk_ss = ss.source_set() gtk_ss.add(gtk, vte, pixman, files('gtk.c')) - gtk_ss.add(when: [x11, 'CONFIG_X11'], if_true: files('x_keymap.c')) + gtk_ss.add(when: x11, if_true: files('x_keymap.c')) gtk_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true: files('gtk-egl.c', 'gtk-gl-area.c')) ui_modules += {'gtk' : gtk_ss} endif @@ -77,7 +77,7 @@ if sdl.found() 'sdl2.c', )) sdl_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true: files('sdl2-gl.c')) - sdl_ss.add(when: [x11, 'CONFIG_X11'], if_true: files('x_keymap.c')) + sdl_ss.add(when: x11, if_true: files('x_keymap.c')) ui_modules += {'sdl' : sdl_ss} endif From patchwork Thu Jan 7 14:00:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1423316 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=W1yPHQ5O; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DBSfQ3d7Zz9sVt for ; Fri, 8 Jan 2021 01:04:46 +1100 (AEDT) Received: from localhost ([::1]:55826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxVu8-0005zh-GD for incoming@patchwork.ozlabs.org; Thu, 07 Jan 2021 09:04:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42786) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxVqQ-0003xC-AZ for qemu-devel@nongnu.org; Thu, 07 Jan 2021 09:00:54 -0500 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]:46256) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxVqK-0006wf-Iw for qemu-devel@nongnu.org; Thu, 07 Jan 2021 09:00:50 -0500 Received: by mail-ed1-x530.google.com with SMTP id b73so7757197edf.13 for ; Thu, 07 Jan 2021 06:00:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=t+Pwn9LfFG65wvaIUQ2xmA9CpZnngkiMNkAxYZScHNk=; b=W1yPHQ5Oha1hAeKLvXQHAgiKuICQu+riwApI91ZUUBVPbJ7o65NJH3hyUGqDODElLX CvOBKWDgRQufTi2eQui4h8b4dsgMR4cqLcE7uy9QPnFwfiJtJgEZkGfXkFtMwbV7NVHV DtOlGOezv0Q3Aj9FhQm+51YrQ9Ksj6wGkkfF2lLOKYE3t+ZGtiJT2+murcUzAuqHJb/1 hic37pFtXU5nFBlGu20IEJ4fY5lmdeFqONygYY2jJu4lJWNAUday+vVKRXSP2efNTJO5 JZX32noBcbKRNg/KclBICVAhc+niVvzzCNrJ8yDY+aNU0AAsuXZqMT+BnGU1oIQoAWcy xFtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=t+Pwn9LfFG65wvaIUQ2xmA9CpZnngkiMNkAxYZScHNk=; b=dJBOGbGkF4luFLwUuvUVBYYilwvX/i4HEX1nrUuIBUkI7ToNvQTDyU7w3MuhzR2U9p iCLq2Y6E3T8RxS32f/JlygMmH8PfFNT6+kShbOuk3XQaldNgyHvbAe0kxr8Xowmu0DeP KdepGxvBlfJPO+XvrYrhdJgrViPcNx/K6plPAb+D6Cs3rIHG7Q2kPPeKIMDMqZNSFmZ+ vsdWs+iDY1q7FMKJiEC92soSQBzTDVDMlYPevWpyltjtCW9ra6Xes3evp2Ur2npC2rhz 41+idajXcHTv3ZwXmjuCqgiuR09Isi+5UkHVdQ4VQ3VDyQMbS6fVrVjlAIV/Vvoi/BW8 33DA== X-Gm-Message-State: AOAM531Ih7yFuf8G9E2u6o9SUmJlVlBAGEJ/SGCvA+O+Ahfqyhtn+4Kq WcxULAIsCxaQxjo7IThzBIiD+vyeYAxDpw== X-Google-Smtp-Source: ABdhPJxUR6lb4AqZY40lk7LNBEnrPdRIetEAryg+o6RJ1yfctKM4kdiXgN+51cCXKdZP8HjdWAq+aw== X-Received: by 2002:aa7:d919:: with SMTP id a25mr1707624edr.81.1610028046439; Thu, 07 Jan 2021 06:00:46 -0800 (PST) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id oq27sm2438523ejb.108.2021.01.07.06.00.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 06:00:45 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 5/8] configure: move GTK+ detection to Meson Date: Thu, 7 Jan 2021 15:00:36 +0100 Message-Id: <20210107140039.467969-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210107140039.467969-1-pbonzini@redhat.com> References: <20210107140039.467969-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x530.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, marcandre.lureau@redhat.com, berrange@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This also allows removing CONFIG_NEED_X11, all the ingredients can be computed easily in meson.build. Signed-off-by: Paolo Bonzini --- configure | 55 ++++++----------------------------------------- meson.build | 29 ++++++++++++++++++------- meson_options.txt | 2 ++ ui/meson.build | 2 +- 4 files changed, 30 insertions(+), 58 deletions(-) diff --git a/configure b/configure index e9d76c2c13..652cff7ba6 100755 --- a/configure +++ b/configure @@ -414,7 +414,7 @@ cfi="false" cfi_debug="false" seccomp="auto" glusterfs="auto" -gtk="$default_feature" +gtk="auto" tls_priority="NORMAL" gnutls="$default_feature" nettle="$default_feature" @@ -1377,9 +1377,9 @@ for opt do --enable-uuid|--disable-uuid) echo "$0: $opt is obsolete, UUID support is always built" >&2 ;; - --disable-gtk) gtk="no" + --disable-gtk) gtk="disabled" ;; - --enable-gtk) gtk="yes" + --enable-gtk) gtk="enabled" ;; --tls-priority=*) tls_priority="$optarg" ;; @@ -2329,10 +2329,10 @@ if test "$cocoa" = "enabled"; then if test "$sdl" = "enabled"; then error_exit "Cocoa and SDL UIs cannot both be enabled at once" fi - if test "$gtk" = "yes"; then + if test "$gtk" = "enabled"; then error_exit "Cocoa and GTK UIs cannot both be enabled at once" fi - gtk=no + gtk=disabled sdl=disabled fi @@ -2759,31 +2759,6 @@ EOF fi fi -########################################## -# GTK probe - -if test "$gtk" != "no"; then - gtkpackage="gtk+-3.0" - gtkx11package="gtk+-x11-3.0" - gtkversion="3.22.0" - if $pkg_config --exists "$gtkpackage >= $gtkversion"; then - gtk_cflags=$($pkg_config --cflags $gtkpackage) - gtk_libs=$($pkg_config --libs $gtkpackage) - gtk_version=$($pkg_config --modversion $gtkpackage) - if $pkg_config --exists "$gtkx11package >= $gtkversion"; then - need_x11=yes - gtk_cflags="$gtk_cflags $x11_cflags" - gtk_libs="$gtk_libs $x11_libs" - fi - gtk="yes" - elif test "$gtk" = "yes"; then - feature_not_found "gtk" "Install gtk3-devel" - else - gtk="no" - fi -fi - - ########################################## # GNUTLS probe @@ -3640,16 +3615,6 @@ EOF fi fi -if test "$opengl" = "yes" && test "$have_x11" = "yes"; then - for target in $target_list; do - case $target in - lm32-softmmu) # milkymist-tmu2 requires X11 and OpenGL - need_x11=yes - ;; - esac - done -fi - ########################################## # libxml2 probe if test "$libxml2" != "no" ; then @@ -5673,9 +5638,6 @@ fi if test "$module_upgrades" = "yes"; then echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak fi -if test "$need_x11" = "yes"; then - echo "CONFIG_NEED_X11=y" >> $config_host_mak -fi if test "$pipe2" = "yes" ; then echo "CONFIG_PIPE2=y" >> $config_host_mak fi @@ -5763,11 +5725,6 @@ fi if test "$bswap_h" = "yes" ; then echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak fi -if test "$gtk" = "yes" ; then - echo "CONFIG_GTK=y" >> $config_host_mak - echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak - echo "GTK_LIBS=$gtk_libs" >> $config_host_mak -fi if test "$gio" = "yes" ; then echo "CONFIG_GIO=y" >> $config_host_mak echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak @@ -6491,7 +6448,7 @@ NINJA=$ninja $meson setup \ -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \ -Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf \ -Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \ - -Dcocoa=$cocoa -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \ + -Dcocoa=$cocoa -Dgtk=$gtk -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \ -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \ -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f -Dvirtiofsd=$virtiofsd \ -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \ diff --git a/meson.build b/meson.build index fdd4312c71..a3a0958b4d 100644 --- a/meson.build +++ b/meson.build @@ -772,19 +772,31 @@ if 'CONFIG_OPENGL' in config_host opengl = declare_dependency(compile_args: config_host['OPENGL_CFLAGS'].split(), link_args: config_host['OPENGL_LIBS'].split()) endif + gtk = not_found -if 'CONFIG_GTK' in config_host - gtk = declare_dependency(compile_args: config_host['GTK_CFLAGS'].split(), - link_args: config_host['GTK_LIBS'].split()) +gtkx11 = not_found +if not get_option('gtk').auto() or have_system + gtk = dependency('gtk+-3.0', version: '>=3.22.0', + method: 'pkg-config', + required: get_option('gtk'), + static: enable_static) + if gtk.found() + gtkx11 = dependency('gtk+-x11-3.0', version: '>=3.22.0', + method: 'pkg-config', + required: false, + static: enable_static) + gtk = declare_dependency(dependencies: [gtk, gtkx11]) + endif endif + vte = not_found if 'CONFIG_VTE' in config_host vte = declare_dependency(compile_args: config_host['VTE_CFLAGS'].split(), link_args: config_host['VTE_LIBS'].split()) endif x11 = not_found -if config_host.has_key('CONFIG_NEED_X11') - x11 = dependency('x11', method: 'pkg-config', required: false, +if gtkx11.found() or 'lm32-softmmu' in target_dirs + x11 = dependency('x11', method: 'pkg-config', required: gtkx11.found(), static: enable_static) endif vnc = not_found @@ -1058,6 +1070,7 @@ if glusterfs.found() config_host_data.set('CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT', glusterfs_ftruncate_has_stat) config_host_data.set('CONFIG_GLUSTERFS_IOCB_HAS_STAT', glusterfs_iocb_has_stat) endif +config_host_data.set('CONFIG_GTK', gtk.found()) config_host_data.set('CONFIG_LIBATTR', have_old_libattr) config_host_data.set('CONFIG_LIBCAP_NG', libcap_ng.found()) config_host_data.set('CONFIG_LIBISCSI', libiscsi.found()) @@ -2229,7 +2242,7 @@ subdir('tools') subdir('pc-bios') subdir('docs') subdir('tests') -if 'CONFIG_GTK' in config_host +if gtk.found() subdir('po') endif @@ -2246,7 +2259,7 @@ if host_machine.system() == 'windows' if build_docs nsis_cmd += '-DCONFIG_DOCUMENTATION=y' endif - if 'CONFIG_GTK' in config_host + if gtk.found() nsis_cmd += '-DCONFIG_GTK=y' endif @@ -2337,7 +2350,7 @@ endif summary_info += {'SDL support': sdl.found()} summary_info += {'SDL image support': sdl_image.found()} # TODO: add back version -summary_info += {'GTK support': config_host.has_key('CONFIG_GTK')} +summary_info += {'GTK support': gtk.found()} summary_info += {'pixman': pixman.found()} # TODO: add back version summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')} diff --git a/meson_options.txt b/meson_options.txt index 41f9c2cf6c..b9b106675f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -76,6 +76,8 @@ option('lzo', type : 'feature', value : 'auto', description: 'lzo compression support') option('rbd', type : 'feature', value : 'auto', description: 'Ceph block device driver') +option('gtk', type : 'feature', value : 'auto', + description: 'GTK+ user interface') option('sdl', type : 'feature', value : 'auto', description: 'SDL user interface') option('sdl_image', type : 'feature', value : 'auto', diff --git a/ui/meson.build b/ui/meson.build index afbdd78e97..407e291ebe 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -57,7 +57,7 @@ if config_host.has_key('CONFIG_OPENGL_DMABUF') ui_modules += {'egl-headless' : egl_headless_ss} endif -if config_host.has_key('CONFIG_GTK') +if gtk.found() softmmu_ss.add(when: 'CONFIG_WIN32', if_true: files('win32-kbd-hook.c')) gtk_ss = ss.source_set() From patchwork Thu Jan 7 14:00:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1423319 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=hW230Leo; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DBSlz1qhwz9sVk for ; Fri, 8 Jan 2021 01:09:33 +1100 (AEDT) Received: from localhost ([::1]:37150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxVyk-0001gi-MI for incoming@patchwork.ozlabs.org; Thu, 07 Jan 2021 09:09:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42842) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxVqS-0003y3-Gc for qemu-devel@nongnu.org; Thu, 07 Jan 2021 09:01:01 -0500 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]:37597) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxVqK-0006wr-Ng for qemu-devel@nongnu.org; Thu, 07 Jan 2021 09:00:55 -0500 Received: by mail-ej1-x62f.google.com with SMTP id ga15so9844537ejb.4 for ; Thu, 07 Jan 2021 06:00:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FIDd9CoeqK0N6Tbm6H/NLOa+Nm0iRe/kCNkiUDvwvU0=; b=hW230Leo5qTDAyWCsKBYPGBAdM1Ah98XX8zpogxVKaycQameVX5BiimetouI5CL/Uj ky0NzC0NzqGLOrzX0L7hptj77u/0R8xAXBVP2/hk7h0vGe23dSL64vI7D0Ep4XmSoNHn F8aeP17m/nDLLAEWa34vpaEayoE4vbSIA97xkckzMlQl1V7oqd85RH1Nj1NCvQzU6bF4 R7wFF/ffk14ES4zcmtA8wvOMjPH1p+7B96r7oQ8zUdP70LsYFH7fKOxPynyxvZXXYf2A OFc8jh+GENvlFGlrptsLJkj0uQ4Qu0iwxNZWcVwg5Asq8XH6t8J0y3yWKtmxzpeEwUzC K7qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=FIDd9CoeqK0N6Tbm6H/NLOa+Nm0iRe/kCNkiUDvwvU0=; b=DxF1WAXLhFxugDUEFaTz6I/nlXU1hFFiwwsFDGfoZS/Y2rmieXIPsJdRQV/ES13S0r cRLowcwSh1sw6SnlWE0/Gr+Z/mcaO+oC7RNfmNNK2Lgr4Gj7N5EUMnvtft6DhWf7Na3M rIapQA04LVmYBI74d9ieN6QOEWxnPAgSPy2NeOjJMUQYsoB6+my3X1kXH2iwDHAFK+gt s4CKdybP7NC5JblpTDg2o+xBXiRfPZB1mFEYCQACQYZi2wSpJnvkhPhIJN8Dqld8BJV1 eE8aFQ2h6IE3siXJCtWA2GFX3+1JZSgVgojah65CZw2dhrTNhh5PF5qwdeZc2Mmew7II 4ZWQ== X-Gm-Message-State: AOAM532OpJUAgVYvKQS71mCLoZttJoZEQwYEw91R72K/Puh2YDnJGb8L HJzpkFlFaIbPVilkra7ZGi2vYs6hgZvO3Q== X-Google-Smtp-Source: ABdhPJwYVmUul650kYF+zZNR8iko/wNpaDR0cGWUm2PrXesFnvFgCHDC24qfOf07YRImOqCR0y4VzQ== X-Received: by 2002:a17:906:cd14:: with SMTP id oz20mr5876426ejb.99.1610028047343; Thu, 07 Jan 2021 06:00:47 -0800 (PST) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id oq27sm2438523ejb.108.2021.01.07.06.00.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 06:00:46 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 6/8] configure: move Cocoa incompatibility checks to Meson Date: Thu, 7 Jan 2021 15:00:37 +0100 Message-Id: <20210107140039.467969-7-pbonzini@redhat.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210107140039.467969-1-pbonzini@redhat.com> References: <20210107140039.467969-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x62f.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, marcandre.lureau@redhat.com, berrange@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The cocoa UI code currently assumes it is always the active UI and does not interact well with other UI frontend code. Move the relevant checks to Meson now that all other frontends have become Meson options. This way, SDL/GTK+/Cocoa can be parsed entirely by scripts/configure-parse-buildoptions.pl. Signed-off-by: Paolo Bonzini --- configure | 15 --------------- meson.build | 17 ++++++++++------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/configure b/configure index 652cff7ba6..d573058b16 100755 --- a/configure +++ b/configure @@ -772,7 +772,6 @@ Darwin) QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS" fi - cocoa="enabled" audio_drv_list="coreaudio try-sdl" audio_possible_drivers="coreaudio sdl" QEMU_LDFLAGS="-framework CoreFoundation -framework IOKit $QEMU_LDFLAGS" @@ -2322,20 +2321,6 @@ if test -z "$want_tools"; then fi ########################################## -# cocoa implies not SDL or GTK -# (the cocoa UI code currently assumes it is always the active UI -# and doesn't interact well with other UI frontend code) -if test "$cocoa" = "enabled"; then - if test "$sdl" = "enabled"; then - error_exit "Cocoa and SDL UIs cannot both be enabled at once" - fi - if test "$gtk" = "enabled"; then - error_exit "Cocoa and GTK UIs cannot both be enabled at once" - fi - gtk=disabled - sdl=disabled -fi - # Some versions of Mac OS X incorrectly define SIZE_MAX cat > $TMPC << EOF #include diff --git a/meson.build b/meson.build index a3a0958b4d..5a8efd2316 100644 --- a/meson.build +++ b/meson.build @@ -148,7 +148,6 @@ version_res = [] coref = [] iokit = [] emulator_link_args = [] -cocoa = not_found hvf = not_found if targetos == 'windows' socket = cc.find_library('ws2_32') @@ -161,7 +160,6 @@ if targetos == 'windows' elif targetos == 'darwin' coref = dependency('appleframeworks', modules: 'CoreFoundation') iokit = dependency('appleframeworks', modules: 'IOKit') - cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa')) elif targetos == 'sunos' socket = [cc.find_library('socket'), cc.find_library('nsl'), @@ -252,9 +250,6 @@ if not have_xen_pci_passthrough and get_option('xen_pci_passthrough').enabled() error('Xen PCI passthrough requested but Xen not enabled') endif endif -if not cocoa.found() and get_option('cocoa').enabled() - error('Cocoa not available on this platform') -endif ################ # Dependencies # @@ -358,6 +353,14 @@ if not get_option('attr').disabled() endif endif +cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa')) +if cocoa.found() and get_option('sdl').enabled() + error('Cocoa and SDL cannot be enabled at the same time') +endif +if cocoa.found() and get_option('gtk').enabled() + error('Cocoa and GTK+ cannot be enabled at the same time') +endif + seccomp = not_found if not get_option('seccomp').auto() or have_system or have_tools seccomp = dependency('libseccomp', version: '>=2.3.0', @@ -643,7 +646,7 @@ if not get_option('brlapi').auto() or have_system endif sdl = not_found -if have_system +if not get_option('sdl').auto() or (have_system and not cocoa.found()) sdl = dependency('sdl2', required: get_option('sdl'), static: enable_static) sdl_image = not_found endif @@ -775,7 +778,7 @@ endif gtk = not_found gtkx11 = not_found -if not get_option('gtk').auto() or have_system +if not get_option('gtk').auto() or (have_system and not cocoa.found()) gtk = dependency('gtk+-3.0', version: '>=3.22.0', method: 'pkg-config', required: get_option('gtk'), From patchwork Thu Jan 7 14:00:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1423318 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=bELg9N3B; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DBShw232bz9sVk for ; Fri, 8 Jan 2021 01:06:56 +1100 (AEDT) Received: from localhost ([::1]:60418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxVwE-0007zu-A0 for incoming@patchwork.ozlabs.org; Thu, 07 Jan 2021 09:06:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42840) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxVqS-0003y2-GC for qemu-devel@nongnu.org; Thu, 07 Jan 2021 09:01:01 -0500 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]:45102) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxVqQ-0006wz-1Z for qemu-devel@nongnu.org; Thu, 07 Jan 2021 09:00:55 -0500 Received: by mail-ej1-x634.google.com with SMTP id qw4so9716274ejb.12 for ; Thu, 07 Jan 2021 06:00:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q0WxjNIuPF+6aWJPxAfV1RhO2xpwQzcsT3F2ChtwrVo=; b=bELg9N3BCHQXO/bKw0hubIfaADChs2zWdeQqFCsQ5kgd3uPjhnJKTFhmrKHlkA4utP Y3LkO5RiB/mSiFc6+T6gQ97bO1YTsM6DHPwdQt/XbRNd928DiM56h3WoVQDbdf4GKH6J GvnPXSqYUjq/MrbBcWLmDYcByH6zaWb9wUDO7CreEO5KYaVEp+JthpIIH/zEwF4xiQjb n/4q6XF6XuQLbxf3RbBXos0iByDcQUGEqcucDX1sQpI1749iZH/F1zxOlN9trfHy95ui P962ghY7tileUqe4viHAryHPFrcutac8XIq1xCRhmWUm/btmFPYm++hJ6pGD9e2+vdah 5vnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Q0WxjNIuPF+6aWJPxAfV1RhO2xpwQzcsT3F2ChtwrVo=; b=k6j0I0ZqrOZSAi0YlsDVbI+Nhh0Cw+qIWl7iSwCltl+F72WnIeVJT0ES/K5jUTpdXt AxojIFTh6uESpBWVU3ls6wbK4xby5UrduC9TZHYeQDVE7YcabpUBqAERkS2XYRVYgQc9 +H36NE65aS3WeS8YioFB8rlA72wahkknWkiThEt/cWJZ16K5nrk1ZMrh9040pRjUVQn3 FnCfbJ+7K/wT6Lr8PPQ0uY5PZlYmQLBqpff369buYXoy/rReezkbpxbFfRwoez3nNd5N 1BdbOX8AhzOo5xJmCww3g/zU3KmGkppewkjDRcn/Ce40bkZkefA3RwBrfcVxIzrWfWrR RyXA== X-Gm-Message-State: AOAM532jsObPgIqqGnBm9Kc7RiDDaZuh83QVlUi4+UZsKpZRNCHwytO3 tF0p4axD5nqMWh5bJX+OYs7umMs1D/ML7Q== X-Google-Smtp-Source: ABdhPJxSGkeYJXzARQiz0+ceQUGHYaDR8J/4Ac/DQtPpBufkbiMuPAh+ULbo8BlJmYf3cf0V6nSfJA== X-Received: by 2002:a17:906:447:: with SMTP id e7mr6375021eja.172.1610028048315; Thu, 07 Jan 2021 06:00:48 -0800 (PST) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id oq27sm2438523ejb.108.2021.01.07.06.00.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 06:00:47 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 7/8] configure: quote command line arguments in config.status Date: Thu, 7 Jan 2021 15:00:38 +0100 Message-Id: <20210107140039.467969-8-pbonzini@redhat.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210107140039.467969-1-pbonzini@redhat.com> References: <20210107140039.467969-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x634.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, marcandre.lureau@redhat.com, berrange@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Make config.status generation a bit more robust. (The quote_sh function will also be reused to parse configure's command line arguments in an external script driven by Meson build option introspection). Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake --- configure | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure b/configure index d573058b16..41866cc38e 100755 --- a/configure +++ b/configure @@ -89,6 +89,10 @@ printf " '%s'" "$0" "$@" >> config.log echo >> config.log echo "#" >> config.log +quote_sh() { + printf "%s" "$1" | sed "s,','\\\\'',g; s,.*,'&'," +} + print_error() { (echo echo "ERROR: $1" @@ -6509,7 +6513,7 @@ preserve_env WINDRES printf "exec" >>config.status for i in "$0" "$@"; do - test "$i" = --skip-meson || printf " '%s'" "$i" >>config.status + test "$i" = --skip-meson || printf " %s" "$(quote_sh "$i")" >>config.status done echo ' "$@"' >>config.status chmod +x config.status From patchwork Thu Jan 7 14:00:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1423320 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=WOZn9t9V; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DBSm83rTXz9sVk for ; Fri, 8 Jan 2021 01:09:44 +1100 (AEDT) Received: from localhost ([::1]:36854 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxVyv-0001Xz-DZ for incoming@patchwork.ozlabs.org; Thu, 07 Jan 2021 09:09:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxVqW-0003yN-Cm for qemu-devel@nongnu.org; Thu, 07 Jan 2021 09:01:01 -0500 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]:36383) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxVqQ-0006xq-29 for qemu-devel@nongnu.org; Thu, 07 Jan 2021 09:00:58 -0500 Received: by mail-ej1-x635.google.com with SMTP id lt17so9848481ejb.3 for ; Thu, 07 Jan 2021 06:00:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qP2nGPMj7ejX87GrrmtKQKOPPcyw21Ka8nzCNxMJ8kQ=; b=WOZn9t9VcThGHKdsNbKeVD0IGqpqy04H8PcPxWNyn93vw1h0J3YzZ3blVN+zi6ng74 KO4zbkinELobhd7IYdkCe0oeNfmBP8Z+pdSeQdWHZ8dSt6VcCOdHS6fKRsWL+0jjQ6eP xPEc/hg5tksNYlVykIkqBgVvDeXJL0bBtkLRqPasf5vefq5hAl1G44UEorrie9gtZh3a T9IELQS0HbxLJnb5xJ1s5Y/7REpv77Xk1DA9eg2W0QBWweWzbxwwIlhdtl+/MeRpGaQo vL/XuUXjeeT2rCSbcRziytRLg4xuQ6i/S3Cj6qolHb0+stsoDA9T2Y7rcitCYy2yGAn3 EpPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=qP2nGPMj7ejX87GrrmtKQKOPPcyw21Ka8nzCNxMJ8kQ=; b=iPr28/v5yfYWUlcjMxEYXfn7hqz7qCdicTMxPZruQ1Fh1wttJ/au5tXh4cOre2Bro9 MzkKBVIUXI0wbuEw6sStO1wbY2VXDbwsxi2xaX5Ndlnqb9Q6nouxA7VdTrQ03a1U0u3y lbtHLnYwU001g5X2rD9hZVHYBz6OfvkTubGXH6NUJPr2dx+05bgwAGCVJ6XFK8NeBGYk 65Of7v61S2P9BH30kIoQrHqV05Ncv5exkGRSt9Q+6emMlfXnkamgrKSTyQ1wluIZDgsk jIl4zN3pMNIe3d6g2e5DWifu6MCcGg0FztdnNrBdH6Jq5ydInq15HZ66neOgn3aMfi9t Lv4w== X-Gm-Message-State: AOAM531oul6+rHmhHhbMzy37M2CYEpqpSnWlp2NZWAjJklSa9Ycg+svO evLr4krf1iDpLDNCy27OHq8RQhNfDJ9URQ== X-Google-Smtp-Source: ABdhPJyQQzRPUMKsNN6116QU0Md9gB2P+FIhmw+qcmnuYV3VWAsLbDZu166vIHF4ceVWdl2f1UOs8A== X-Received: by 2002:a17:906:f85:: with SMTP id q5mr6621363ejj.105.1610028049676; Thu, 07 Jan 2021 06:00:49 -0800 (PST) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id oq27sm2438523ejb.108.2021.01.07.06.00.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 06:00:48 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 8/8] configure: automatically parse command line for meson -D options Date: Thu, 7 Jan 2021 15:00:39 +0100 Message-Id: <20210107140039.467969-9-pbonzini@redhat.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210107140039.467969-1-pbonzini@redhat.com> References: <20210107140039.467969-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x635.google.com X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, LONGWORDS=2.035, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, marcandre.lureau@redhat.com, berrange@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Right now meson_options.txt lists almost 60 options. Each option needs code in configure to parse it and pass the option down to Meson as a -D command-line argument; in addition the default must be duplicated between configure and meson_options.txt. This series tries to remove the code duplication by passing unknown --enable and --disable options to a Perl program, and using Meson's introspection support to match those to meson_options.txt. About 80% of the options can be handled completely by the new mechanism. Five meson options are not of the --enable/--disable kind. Six more need to be parsed in configure for various reasons documented in the patch, but they still have their help automatically generated. The advantages are simple to explain, and are basically what you can expect from an introspection-based system: - there is obviously much less code in configure. About 1000 lines of the script deal with command line parsing, and the patch removes a quarter of them. - the script is higher quality than the repetitive code in configure. Help is generally more complete and useful, for example it consistently lists defaults as well as the possible choices if they are not just enabled/disabled/auto. Parsing is more consistent too, for example --enable-slirp and --enable-blobs were not supported. - new Meson options do not need any change to the configure script. This increases the attractiveness of converting options from hand-crafted parsing and config-host.mak to Meson. The disadvantages are: - a few options change name: --enable-tcmalloc and --enable-jemalloc become --enable-malloc={tcmalloc,jemalloc}; --disable-blobs becomes --disable-install-blobs. - because we need to run the script to generate the full help, we cannot rely on the user supplying the path to a Python interpreter with --python. For this reason, the script is written in Perl. Perl 5 is universally available as "/usr/bin/env perl", while (even ignoring the Python 2/3 difference) some systems do not have a "python" or "python3" binary on the path. - because we parse command-line options before meson is available, the introspection output is stored in the source tree. This is the reason for the unattractive diffstat; the number of JSON lines added is higher than the number of configure lines removed. Of course the latter are code that must be maintained manually and the former is not. Note that the output of "meson introspect --buildoptions" is massaged slightly, in order to make it more stable and avoid horrible conflicts on every modification to meson_options.txt. Signed-off-by: Paolo Bonzini --- Makefile | 11 + configure | 371 ++---------- docs/devel/build-system.rst | 49 +- meson-buildoptions.json | 717 ++++++++++++++++++++++++ meson_options.txt | 9 +- scripts/configure-parse-buildoptions.pl | 205 +++++++ 6 files changed, 993 insertions(+), 369 deletions(-) create mode 100644 meson-buildoptions.json create mode 100755 scripts/configure-parse-buildoptions.pl diff --git a/Makefile b/Makefile index fb9923ff22..eca42f08d3 100644 --- a/Makefile +++ b/Makefile @@ -142,6 +142,17 @@ ifneq ($(MESON),) Makefile.mtest: build.ninja scripts/mtest2make.py $(MESON) introspect --targets --tests --benchmarks | $(PYTHON) scripts/mtest2make.py > $@ -include Makefile.mtest + +# python is used to keep the result stable +.PHONY: update-buildoptions +all update-buildoptions: $(SRC_PATH)/meson-buildoptions.json +$(SRC_PATH)/meson-buildoptions.json: $(SRC_PATH)/meson_options.txt + $(MESON) introspect --buildoptions $(SRC_PATH)/meson.build | $(PYTHON) -c \ + 'import json, sys; print( \ + json.dumps(sorted([x for x in json.loads(sys.stdin.read()) \ + if x["section"] == "user"], \ + key=lambda x: x["name"]), \ + indent=2))' > $@ endif # 4. Rules to bridge to other makefiles diff --git a/configure b/configure index 41866cc38e..64e19026f3 100755 --- a/configure +++ b/configure @@ -309,47 +309,19 @@ for opt do esac done -brlapi="auto" -curl="auto" -iconv="auto" -curses="auto" -docs="auto" -fdt="auto" netmap="no" -sdl="auto" -sdl_image="auto" -virtiofsd="auto" -virtfs="auto" -libudev="auto" -mpath="auto" -vnc="enabled" -sparse="auto" vde="$default_feature" -vnc_sasl="auto" -vnc_jpeg="auto" -vnc_png="auto" -xkbcommon="auto" -xen="$default_feature" xen_ctrl_version="$default_feature" -xen_pci_passthrough="auto" linux_aio="$default_feature" linux_io_uring="$default_feature" -cap_ng="auto" -attr="auto" xfs="$default_feature" -tcg="enabled" membarrier="$default_feature" vhost_net="$default_feature" vhost_crypto="$default_feature" vhost_scsi="$default_feature" vhost_vsock="$default_feature" vhost_user="no" -vhost_user_blk_server="auto" vhost_user_fs="$default_feature" -kvm="auto" -hax="auto" -hvf="auto" -whpx="auto" rdma="$default_feature" pvrdma="$default_feature" gprof="no" @@ -359,7 +331,6 @@ sanitizers="no" tsan="no" fortify_source="$default_feature" strip_opt="yes" -tcg_interpreter="auto" bigendian="no" mingw32="no" gcov="no" @@ -369,38 +340,27 @@ modules="no" module_upgrades="no" prefix="/usr/local" qemu_suffix="qemu" -slirp="auto" oss_lib="" bsd="no" linux="no" solaris="no" profiler="no" -cocoa="auto" softmmu="yes" linux_user="no" bsd_user="no" -blobs="true" pkgversion="" pie="" qom_cast_debug="yes" trace_backends="log" trace_file="trace" spice="$default_feature" -rbd="auto" smartcard="$default_feature" -u2f="auto" libusb="$default_feature" usb_redir="$default_feature" opengl="$default_feature" opengl_dmabuf="no" cpuid_h="no" avx2_opt="$default_feature" -capstone="auto" -lzo="auto" -snappy="auto" -bzip2="auto" -lzfse="auto" -zstd="auto" guest_agent="$default_feature" guest_agent_with_vss="no" guest_agent_ntddscsi="no" @@ -408,8 +368,6 @@ guest_agent_msi="$default_feature" vss_win32_sdk="$default_feature" win_sdk="no" want_tools="$default_feature" -libiscsi="auto" -libnfs="auto" coroutine="" coroutine_pool="$default_feature" debug_stack_usage="no" @@ -418,7 +376,6 @@ cfi="false" cfi_debug="false" seccomp="auto" glusterfs="auto" -gtk="auto" tls_priority="NORMAL" gnutls="$default_feature" nettle="$default_feature" @@ -449,20 +406,32 @@ sheepdog="no" libxml2="$default_feature" debug_mutex="no" libpmem="$default_feature" -default_devices="true" plugins="no" fuzzing="no" rng_none="no" secret_keyring="$default_feature" libdaxctl="$default_feature" meson="" +meson_args="" ninja="" skip_meson=no -gettext="auto" -fuse="auto" -fuse_lseek="auto" -malloc_trim="auto" +# The following Meson options are handled manually (still they +# are included in the automatically generated help message) + +# 1. Change "git" to "internal" +capstone="auto" +fdt="auto" +slirp="auto" + +# 2. Support --with/--without option +default_devices="true" + +# 3. Automatically enable LTO +cfi="false" + +# 4. Detection partly done in configure +xen="$default_feature" # parse CC options second for opt do @@ -993,42 +962,10 @@ for opt do # configure to be used by RPM and similar macros that set # lots of directory switches by default. ;; - --disable-sdl) sdl="disabled" - ;; - --enable-sdl) sdl="enabled" - ;; - --disable-sdl-image) sdl_image="disabled" - ;; - --enable-sdl-image) sdl_image="enabled" - ;; --disable-qom-cast-debug) qom_cast_debug="no" ;; --enable-qom-cast-debug) qom_cast_debug="yes" ;; - --disable-virtfs) virtfs="disabled" - ;; - --enable-virtfs) virtfs="enabled" - ;; - --disable-libudev) libudev="disabled" - ;; - --enable-libudev) libudev="enabled" - ;; - --disable-virtiofsd) virtiofsd="disabled" - ;; - --enable-virtiofsd) virtiofsd="enabled" - ;; - --disable-mpath) mpath="disabled" - ;; - --enable-mpath) mpath="enabled" - ;; - --disable-vnc) vnc="disabled" - ;; - --enable-vnc) vnc="enabled" - ;; - --disable-gettext) gettext="disabled" - ;; - --enable-gettext) gettext="enabled" - ;; --oss-lib=*) oss_lib="$optarg" ;; --audio-drv-list=*) audio_drv_list="$optarg" @@ -1057,24 +994,8 @@ for opt do ;; --disable-tsan) tsan="no" ;; - --enable-sparse) sparse="enabled" - ;; - --disable-sparse) sparse="disabled" - ;; --disable-strip) strip_opt="no" ;; - --disable-vnc-sasl) vnc_sasl="disabled" - ;; - --enable-vnc-sasl) vnc_sasl="enabled" - ;; - --disable-vnc-jpeg) vnc_jpeg="disabled" - ;; - --enable-vnc-jpeg) vnc_jpeg="enabled" - ;; - --disable-vnc-png) vnc_png="disabled" - ;; - --enable-vnc-png) vnc_png="enabled" - ;; --disable-slirp) slirp="disabled" ;; --enable-slirp) slirp="enabled" @@ -1095,64 +1016,12 @@ for opt do ;; --enable-xen) xen="enabled" ;; - --disable-xen-pci-passthrough) xen_pci_passthrough="disabled" - ;; - --enable-xen-pci-passthrough) xen_pci_passthrough="enabled" - ;; - --disable-brlapi) brlapi="disabled" - ;; - --enable-brlapi) brlapi="enabled" - ;; - --disable-kvm) kvm="disabled" - ;; - --enable-kvm) kvm="enabled" - ;; - --disable-hax) hax="disabled" - ;; - --enable-hax) hax="enabled" - ;; - --disable-hvf) hvf="disabled" - ;; - --enable-hvf) hvf="enabled" - ;; - --disable-whpx) whpx="disabled" - ;; - --enable-whpx) whpx="enabled" - ;; - --disable-tcg-interpreter) tcg_interpreter="disabled" - ;; - --enable-tcg-interpreter) tcg_interpreter="enabled" - ;; - --disable-cap-ng) cap_ng="disabled" - ;; - --enable-cap-ng) cap_ng="enabled" - ;; - --disable-tcg) tcg="disabled" - ;; - --enable-tcg) tcg="enabled" - ;; - --disable-malloc-trim) malloc_trim="disabled" - ;; - --enable-malloc-trim) malloc_trim="enabled" - ;; --disable-spice) spice="no" ;; --enable-spice) spice="yes" ;; - --disable-libiscsi) libiscsi="disabled" - ;; - --enable-libiscsi) libiscsi="enabled" - ;; - --disable-libnfs) libnfs="disabled" - ;; - --enable-libnfs) libnfs="enabled" - ;; --enable-profiler) profiler="yes" ;; - --disable-cocoa) cocoa="disabled" - ;; - --enable-cocoa) cocoa="enabled" - ;; --disable-system) softmmu="no" ;; --enable-system) softmmu="yes" @@ -1196,22 +1065,6 @@ for opt do ;; --disable-cfi) cfi="false" ;; - --enable-cfi-debug) cfi_debug="true" - ;; - --disable-cfi-debug) cfi_debug="false" - ;; - --disable-curses) curses="disabled" - ;; - --enable-curses) curses="enabled" - ;; - --disable-iconv) iconv="disabled" - ;; - --enable-iconv) iconv="enabled" - ;; - --disable-curl) curl="disabled" - ;; - --enable-curl) curl="enabled" - ;; --disable-fdt) fdt="disabled" ;; --enable-fdt) fdt="enabled" @@ -1228,16 +1081,10 @@ for opt do ;; --enable-linux-io-uring) linux_io_uring="yes" ;; - --disable-attr) attr="disabled" - ;; - --enable-attr) attr="enabled" - ;; --disable-membarrier) membarrier="no" ;; --enable-membarrier) membarrier="yes" ;; - --disable-blobs) blobs="false" - ;; --with-pkgversion=*) pkgversion="$optarg" ;; --with-coroutine=*) coroutine="$optarg" @@ -1252,10 +1099,6 @@ for opt do ;; --disable-crypto-afalg) crypto_afalg="no" ;; - --disable-docs) docs="disabled" - ;; - --enable-docs) docs="enabled" - ;; --disable-vhost-net) vhost_net="no" ;; --enable-vhost-net) vhost_net="yes" @@ -1272,10 +1115,6 @@ for opt do ;; --enable-vhost-vsock) vhost_vsock="yes" ;; - --disable-vhost-user-blk-server) vhost_user_blk_server="disabled" - ;; - --enable-vhost-user-blk-server) vhost_user_blk_server="enabled" - ;; --disable-vhost-user-fs) vhost_user_fs="no" ;; --enable-vhost-user-fs) vhost_user_fs="yes" @@ -1284,10 +1123,6 @@ for opt do ;; --enable-opengl) opengl="yes" ;; - --disable-rbd) rbd="disabled" - ;; - --enable-rbd) rbd="enabled" - ;; --disable-xfsctl) xfs="no" ;; --enable-xfsctl) xfs="yes" @@ -1296,10 +1131,6 @@ for opt do ;; --enable-smartcard) smartcard="yes" ;; - --disable-u2f) u2f="disabled" - ;; - --enable-u2f) u2f="enabled" - ;; --disable-libusb) libusb="no" ;; --enable-libusb) libusb="yes" @@ -1310,26 +1141,6 @@ for opt do ;; --disable-zlib-test) ;; - --disable-lzo) lzo="disabled" - ;; - --enable-lzo) lzo="enabled" - ;; - --disable-snappy) snappy="disabled" - ;; - --enable-snappy) snappy="enabled" - ;; - --disable-bzip2) bzip2="disabled" - ;; - --enable-bzip2) bzip2="enabled" - ;; - --enable-lzfse) lzfse="enabled" - ;; - --disable-lzfse) lzfse="disabled" - ;; - --disable-zstd) zstd="disabled" - ;; - --enable-zstd) zstd="enabled" - ;; --enable-guest-agent) guest_agent="yes" ;; --disable-guest-agent) guest_agent="no" @@ -1354,12 +1165,6 @@ for opt do ;; --disable-tools) want_tools="no" ;; - --enable-seccomp) seccomp="enabled" - ;; - --disable-seccomp) seccomp="disabled" - ;; - --disable-glusterfs) glusterfs="disabled" - ;; --disable-avx2) avx2_opt="no" ;; --enable-avx2) avx2_opt="yes" @@ -1368,9 +1173,6 @@ for opt do ;; --enable-avx512f) avx512f_opt="yes" ;; - - --enable-glusterfs) glusterfs="enabled" - ;; --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 ;; @@ -1380,10 +1182,6 @@ for opt do --enable-uuid|--disable-uuid) echo "$0: $opt is obsolete, UUID support is always built" >&2 ;; - --disable-gtk) gtk="disabled" - ;; - --enable-gtk) gtk="enabled" - ;; --tls-priority=*) tls_priority="$optarg" ;; --disable-gnutls) gnutls="no" @@ -1438,14 +1236,6 @@ for opt do ;; --enable-libxml2) libxml2="yes" ;; - --disable-tcmalloc) tcmalloc="no" - ;; - --enable-tcmalloc) tcmalloc="yes" - ;; - --disable-jemalloc) jemalloc="no" - ;; - --enable-jemalloc) jemalloc="yes" - ;; --disable-replication) replication="no" ;; --enable-replication) replication="yes" @@ -1520,10 +1310,6 @@ for opt do ;; --disable-libpmem) libpmem=no ;; - --enable-xkbcommon) xkbcommon="enabled" - ;; - --disable-xkbcommon) xkbcommon="disabled" - ;; --enable-plugins) plugins="yes" ;; --disable-plugins) plugins="no" @@ -1550,13 +1336,8 @@ for opt do ;; --disable-libdaxctl) libdaxctl=no ;; - --enable-fuse) fuse="enabled" - ;; - --disable-fuse) fuse="disabled" - ;; - --enable-fuse-lseek) fuse_lseek="enabled" - ;; - --disable-fuse-lseek) fuse_lseek="disabled" + --enable-* | --disable-*) + meson_args="$meson_args $(quote_sh "$opt")" ;; *) echo "ERROR: unknown option $opt" @@ -1566,6 +1347,15 @@ for opt do esac done +# Convert unknown --enable/--disable arguments to Meson build options. +meson_options=$(eval \ + perl \$source_path/scripts/configure-parse-buildoptions.pl \ + \< \$source_path/meson-buildoptions.json $meson_args) +if test $? = 1; then + echo "Try '$0 --help' for more information" + exit 1 +fi + libdir="${libdir:-$prefix/lib}" libexecdir="${libexecdir:-$prefix/libexec}" includedir="${includedir:-$prefix/include}" @@ -1752,15 +1542,11 @@ Advanced options (experts only): Available backends: $trace_backend_list --with-trace-file=NAME Full PATH,NAME of file to store traces Default:trace- - --disable-slirp disable SLIRP userspace network connectivity - --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI) - --enable-malloc-trim enable libc malloc_trim() for memory optimization --oss-lib path to OSS library --cpu=CPU Build for host CPU [$cpu] --with-coroutine=BACKEND coroutine backend. Supported options: ucontext, sigaltstack, windows --enable-gcov enable test coverage analysis with gcov - --disable-blobs disable installing provided firmware blobs --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) --tls-priority default TLS protocol/cipher priority string @@ -1772,16 +1558,13 @@ Advanced options (experts only): enable plugins via shared library loading --disable-containers don't use containers for cross-building --gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin] - -Optional features, enabled with --enable-FEATURE and -disabled with --disable-FEATURE, default is enabled if available -(unless built with --without-default-features): - +EOF + perl $source_path/scripts/configure-parse-buildoptions.pl --print-help < $source_path/meson-buildoptions.json +cat << EOF system all system emulation targets user supported user emulation targets linux-user all linux usermode emulation targets bsd-user all BSD usermode emulation targets - docs build documentation guest-agent build the QEMU Guest Agent guest-agent-msi build guest agent Windows MSI installation package pie Position Independent Executables @@ -1793,84 +1576,35 @@ disabled with --disable-FEATURE, default is enabled if available sparse sparse checker safe-stack SafeStack Stack Smash Protection. Depends on clang/llvm >= 3.7 and requires coroutine backend ucontext. - cfi Enable Control-Flow Integrity for indirect function calls. - In case of a cfi violation, QEMU is terminated with SIGILL - Depends on lto and is incompatible with modules - Automatically enables Link-Time Optimization (lto) - cfi-debug In case of a cfi violation, a message containing the line that - triggered the error is written to stderr. After the error, - QEMU is still terminated with SIGILL gnutls GNUTLS cryptography support nettle nettle cryptography support gcrypt libgcrypt cryptography support auth-pam PAM access control - sdl SDL UI - sdl-image SDL Image support for icons - gtk gtk UI vte vte support for the gtk UI - curses curses UI - iconv font glyph conversion support - vnc VNC UI support - vnc-sasl SASL encryption for VNC server - vnc-jpeg JPEG lossy compression for VNC server - vnc-png PNG compression for VNC server - cocoa Cocoa UI (Mac OS X only) - virtfs VirtFS - virtiofsd build virtiofs daemon (virtiofsd) - libudev Use libudev to enumerate host devices - mpath Multipath persistent reservation passthrough - xen xen backend driver support - xen-pci-passthrough PCI passthrough support for Xen - brlapi BrlAPI (Braile) - curl curl connectivity membarrier membarrier system call (for Linux 4.14+ or Windows) - fdt fdt device tree - kvm KVM acceleration support - hax HAX acceleration support - hvf Hypervisor.framework acceleration support - whpx Windows Hypervisor Platform acceleration support rdma Enable RDMA-based migration pvrdma Enable PVRDMA support vde support for vde network netmap support for netmap network linux-aio Linux AIO support linux-io-uring Linux io_uring support - cap-ng libcap-ng support - attr attr and xattr support vhost-net vhost-net kernel acceleration support vhost-vsock virtio sockets device support vhost-scsi vhost-scsi kernel target support vhost-crypto vhost-user-crypto backend support vhost-kernel vhost kernel backend support vhost-user vhost-user backend support - vhost-user-blk-server vhost-user-blk server support vhost-vdpa vhost-vdpa kernel backend support spice spice - rbd rados block device (rbd) - libiscsi iscsi support - libnfs nfs support smartcard smartcard support (libcacard) - u2f U2F support (u2f-emu) libusb libusb (for usb passthrough) live-block-migration Block migration in the main migration stream usb-redir usb network redirection support - lzo support of lzo compression library - snappy support of snappy compression library - bzip2 support of bzip2 compression library - (for reading bzip2-compressed dmg images) - lzfse support of lzfse compression library - (for reading lzfse-compressed dmg images) - zstd support for zstd compression library - (for migration compression and qcow2 cluster compression) - seccomp seccomp support coroutine-pool coroutine freelist (better performance) - glusterfs GlusterFS backend tpm TPM support libssh ssh block device support numa libnuma support libxml2 for Parallels image format - tcmalloc tcmalloc support - jemalloc jemalloc support avx2 AVX2 optimization support avx512f AVX512F optimization support replication replication support @@ -1889,14 +1623,10 @@ disabled with --disable-FEATURE, default is enabled if available parallels parallels image format support sheepdog sheepdog block driver support (deprecated) crypto-afalg Linux AF_ALG crypto backend driver - capstone capstone disassembler support debug-mutex mutex debugging support libpmem libpmem support - xkbcommon xkbcommon support rng-none dummy RNG, avoid using /dev/(u)random and getrandom() libdaxctl libdaxctl support - fuse FUSE block device export - fuse-lseek SEEK_HOLE/SEEK_DATA support for FUSE exports NOTE: The object files are built at the place where configure is launched EOF @@ -3725,16 +3455,6 @@ EOF fi fi -malloc=system -if test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then - echo "ERROR: tcmalloc && jemalloc can't be used at the same time" - exit 1 -elif test "$tcmalloc" = "yes" ; then - malloc=tcmalloc -elif test "$jemalloc" = "yes" ; then - malloc=jemalloc -fi - ########################################## # signalfd probe signalfd="no" @@ -6413,7 +6133,8 @@ fi mv $cross config-meson.cross rm -rf meson-private meson-info meson-logs -NINJA=$ninja $meson setup \ +run_meson() { + NINJA=$ninja $meson setup \ --prefix "$prefix" \ --libdir "$libdir" \ --libexecdir "$libexecdir" \ @@ -6427,32 +6148,20 @@ NINJA=$ninja $meson setup \ -Ddocdir="$docdir" \ -Dqemu_firmwarepath="$firmwarepath" \ -Dqemu_suffix="$qemu_suffix" \ + -Dsphinx_build="$sphinx_build" \ -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \ -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo false; fi) \ -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \ -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \ -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \ -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \ - -Db_lto=$lto -Dcfi=$cfi -Dcfi_debug=$cfi_debug \ - -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \ - -Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf \ - -Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \ - -Dcocoa=$cocoa -Dgtk=$gtk -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \ - -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \ - -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f -Dvirtiofsd=$virtiofsd \ - -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \ - -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \ - -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\ - -Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -Dlzfse=$lzfse \ - -Dzstd=$zstd -Dseccomp=$seccomp -Dvirtfs=$virtfs -Dcap_ng=$cap_ng \ - -Dattr=$attr -Ddefault_devices=$default_devices \ - -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \ - -Dvhost_user_blk_server=$vhost_user_blk_server \ - -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \ + -Db_lto=$lto -Dcfi=$cfi \ + -Dcapstone=$capstone -Dfdt=$fdt -Dslirp=$slirp \ + -Ddefault_devices=$default_devices -Dxen=$xen \ $(if test "$default_features" = no; then echo "-Dauto_features=disabled"; fi) \ - $cross_arg \ - "$PWD" "$source_path" - + "$@" $cross_arg "$PWD" "$source_path" +} +eval run_meson $meson_options if test "$?" -ne 0 ; then error_exit "meson setup failed" fi diff --git a/docs/devel/build-system.rst b/docs/devel/build-system.rst index 31f4dced2a..3ada0b878e 100644 --- a/docs/devel/build-system.rst +++ b/docs/devel/build-system.rst @@ -42,22 +42,17 @@ perform a build: ../configure make -For now, checks on the compilation environment are found in configure -rather than meson.build, though this is expected to change. The command -line is parsed in the configure script and, whenever needed, converted -into the appropriate options to Meson. +Many checks on the compilation environment are still found in configure +rather than `meson.build`, but new checks should be added directly to +`meson.build`. The configure script automatically recognizes +command line options for which a same-named Meson option exists; +dashes in the command line are replaced with underscores. New checks should be added to Meson, which usually comprises the following tasks: - Add a Meson build option to meson_options.txt. - - Add support to the command line arg parser to handle any new - `--enable-XXX`/`--disable-XXX` flags required by the feature. - - - Add information to the help output message to report on the new - feature flag. - - Add code to perform the actual feature check. - Add code to include the feature status in `config-host.h` @@ -66,36 +61,13 @@ following tasks: upon completion. -Taking the probe for SDL2_Image as an example, we have the following pieces -in configure:: - - # Initial variable state - sdl_image=auto - - ..snip.. - - # Configure flag processing - --disable-sdl-image) sdl_image=disabled - ;; - --enable-sdl-image) sdl_image=enabled - ;; - - ..snip.. - - # Help output feature message - sdl-image SDL Image support for icons - - ..snip.. - - # Meson invocation - -Dsdl_image=$sdl_image - -In meson_options.txt:: +Taking the probe for SDL2_Image as an example, we have the following +in ``meson_options.txt``:: - option('sdl', type : 'feature', value : 'auto', + option('sdl_image', type : 'feature', value : 'auto', description: 'SDL Image support for icons') -In meson.build:: +And the detection code in ``meson.build``:: # Detect dependency sdl_image = dependency('SDL2_image', required: get_option('sdl_image'), @@ -108,6 +80,9 @@ In meson.build:: # Summary summary_info += {'SDL image support': sdl_image.found()} +For the configure script to parse the option, the ``meson-buildoptions.json`` +file in the root source directory must be up-to-date; ``make +update-buildoptions`` (or just `make`) will take care of updating it. Helper functions diff --git a/meson-buildoptions.json b/meson-buildoptions.json new file mode 100644 index 0000000000..8e245e0d79 --- /dev/null +++ b/meson-buildoptions.json @@ -0,0 +1,717 @@ +[ + { + "name": "attr", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "attr/xattr support" + }, + { + "name": "brlapi", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "brlapi character device driver" + }, + { + "name": "bzip2", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "bzip2 support for DMG images" + }, + { + "name": "cap_ng", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "cap_ng support" + }, + { + "name": "capstone", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "disabled", + "enabled", + "auto", + "system", + "internal" + ], + "type": "combo", + "description": "Whether and how to find the capstone library" + }, + { + "name": "cfi", + "value": false, + "section": "user", + "machine": "any", + "type": "boolean", + "description": "Control-Flow Integrity (CFI)" + }, + { + "name": "cfi_debug", + "value": false, + "section": "user", + "machine": "any", + "type": "boolean", + "description": "Verbose errors in case of CFI violation" + }, + { + "name": "cocoa", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "Cocoa user interface (macOS only)" + }, + { + "name": "curl", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "CURL block device driver" + }, + { + "name": "curses", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "curses UI" + }, + { + "name": "default_devices", + "value": true, + "section": "user", + "machine": "any", + "type": "boolean", + "description": "Include a default selection of devices in emulators" + }, + { + "name": "docdir", + "value": "doc", + "section": "user", + "machine": "any", + "type": "string", + "description": "Base directory for documentation installation (can be empty)" + }, + { + "name": "docs", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "Documentations build support" + }, + { + "name": "fdt", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "disabled", + "enabled", + "auto", + "system", + "internal" + ], + "type": "combo", + "description": "Whether and how to find the libfdt library" + }, + { + "name": "fuse", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "FUSE block device export" + }, + { + "name": "fuse_lseek", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "SEEK_HOLE/SEEK_DATA support for FUSE exports" + }, + { + "name": "gettext", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "Localization of the GTK+ user interface" + }, + { + "name": "glusterfs", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "Glusterfs block device driver" + }, + { + "name": "gtk", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "GTK+ user interface" + }, + { + "name": "hax", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "HAX acceleration support" + }, + { + "name": "hvf", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "HVF acceleration support" + }, + { + "name": "iconv", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "Font glyph conversion support" + }, + { + "name": "install_blobs", + "value": true, + "section": "user", + "machine": "any", + "type": "boolean", + "description": "install provided firmware blobs" + }, + { + "name": "kvm", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "KVM acceleration support" + }, + { + "name": "libiscsi", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "libiscsi userspace initiator" + }, + { + "name": "libnfs", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "libnfs block device driver" + }, + { + "name": "libslirp:version_suffix", + "value": "", + "section": "user", + "machine": "any", + "type": "string", + "description": "Suffix to append to SLIRP_VERSION_STRING" + }, + { + "name": "libudev", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "Use libudev to enumerate host devices" + }, + { + "name": "lzfse", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "lzfse support for DMG images" + }, + { + "name": "lzo", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "lzo compression support" + }, + { + "name": "malloc", + "value": "system", + "section": "user", + "machine": "any", + "choices": [ + "system", + "tcmalloc", + "jemalloc" + ], + "type": "combo", + "description": "choose memory allocator to use" + }, + { + "name": "malloc_trim", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "enable libc malloc_trim() for memory optimization" + }, + { + "name": "mpath", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "Multipath persistent reservation passthrough" + }, + { + "name": "qemu_firmwarepath", + "value": "", + "section": "user", + "machine": "any", + "type": "string", + "description": "search PATH for firmware files" + }, + { + "name": "qemu_suffix", + "value": "qemu", + "section": "user", + "machine": "any", + "type": "string", + "description": "Suffix for QEMU data/modules/config directories (can be empty)" + }, + { + "name": "rbd", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "Ceph block device driver" + }, + { + "name": "sdl", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "SDL user interface" + }, + { + "name": "sdl_image", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "SDL Image support for icons" + }, + { + "name": "seccomp", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "seccomp support" + }, + { + "name": "slirp", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "disabled", + "enabled", + "auto", + "system", + "internal" + ], + "type": "combo", + "description": "Whether and how to find the slirp library" + }, + { + "name": "snappy", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "snappy compression support" + }, + { + "name": "sparse", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "sparse checker" + }, + { + "name": "sphinx_build", + "value": "", + "section": "user", + "machine": "any", + "type": "string", + "description": "Use specified sphinx-build [$sphinx_build] for building document (default to be empty)" + }, + { + "name": "tcg", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "TCG support" + }, + { + "name": "tcg_interpreter", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "TCG bytecode interpreter (TCI)" + }, + { + "name": "u2f", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "U2F emulation support" + }, + { + "name": "vhost_user_blk_server", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "build vhost-user-blk server" + }, + { + "name": "virtfs", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "virtio-9p support" + }, + { + "name": "virtiofsd", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "build virtiofs daemon (virtiofsd)" + }, + { + "name": "vnc", + "value": "enabled", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "VNC server" + }, + { + "name": "vnc_jpeg", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "JPEG lossy compression for VNC server" + }, + { + "name": "vnc_png", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "PNG compression for VNC server" + }, + { + "name": "vnc_sasl", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "SASL authentication for VNC server" + }, + { + "name": "whpx", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "WHPX acceleration support" + }, + { + "name": "xen", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "Xen backend support" + }, + { + "name": "xen_pci_passthrough", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "Xen PCI passthrough support" + }, + { + "name": "xkbcommon", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "xkbcommon support" + }, + { + "name": "zstd", + "value": "auto", + "section": "user", + "machine": "any", + "choices": [ + "enabled", + "disabled", + "auto" + ], + "type": "combo", + "description": "zstd compression support" + } +] diff --git a/meson_options.txt b/meson_options.txt index b9b106675f..08d02498ac 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,3 +1,7 @@ +# These options do not correspond to a --enable/--disable-* option +# on the configure script command line. If you add more, list them in +# scripts/configure-parse-buildoptions.pl's SKIP_OPTIONS constant too. + option('qemu_suffix', type : 'string', value: 'qemu', description: 'Suffix for QEMU data/modules/config directories (can be empty)') option('docdir', type : 'string', value : 'doc', @@ -6,9 +10,12 @@ option('qemu_firmwarepath', type : 'string', value : '', description: 'search PATH for firmware files') option('sphinx_build', type : 'string', value : '', description: 'Use specified sphinx-build [$sphinx_build] for building document (default to be empty)') - option('default_devices', type : 'boolean', value : true, description: 'Include a default selection of devices in emulators') + +# Everything else can be set via --enable/--disable-* option +# on the configure script command line. + option('docs', type : 'feature', value : 'auto', description: 'Documentations build support') option('gettext', type : 'feature', value : 'auto', diff --git a/scripts/configure-parse-buildoptions.pl b/scripts/configure-parse-buildoptions.pl new file mode 100755 index 0000000000..33402b0583 --- /dev/null +++ b/scripts/configure-parse-buildoptions.pl @@ -0,0 +1,205 @@ +#! /usr/bin/env perl + +# Parse configure command line options based on Meson's user build options +# introspection data (passed on stdin). +# +# Copyright (C) 2021 Red Hat, Inc. +# +# Author: Paolo Bonzini +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +use warnings FATAL => 'all'; +use strict; +use JSON::PP; + +# Meson options that do not correspond to a --enable/--disable option +# in configure +use constant SKIP_OPTIONS => ('docdir', 'qemu_firmwarepath', 'sphinx_build', 'qemu_suffix', + 'default_devices'); + +use constant FEATURE_CHOICES => 'auto/disabled/enabled'; +use constant LINE_WIDTH => 74; + +# Convert the default value of an option to the string used in +# the help message +sub value_to_help ($) +{ + my ($value) = @_; + return $value if not JSON::PP::is_bool($value); + return $value ? 'enabled' : 'disabled'; +} + +# Print an entry of a two-column table, wrapping the text +# to LINE_WIDTH characters. +sub wrap($$$) +{ + my ($left, $text, $indent) = @_; + my $length = LINE_WIDTH - $indent; + my $line_re = qr/^(\s*) (.{1,$length}|\S+?) (?=\s|$)/x; + my $spaces = ' ' x $indent; + + if (length ($left) >= $indent) { + print "$left\n"; + $left = $spaces; + } else { + $left = substr ($left . $spaces, 0, $indent); +} + while ($text =~ $line_re) { + print "$left$2\n"; + $text = substr($text, (length $1) + (length $2)); + $left = $spaces; + } +} + +sub choices($) +{ + my ($opt) = @_; + my $choices = $opt->{'choices'}; + return join('/', sort @$choices); +} + +# Print the help for the option dictionary in the second argument. +# The first argument is the left column in the table, the third +# is the width of the first column. +sub print_help_line($$$) +{ + my ($left, $opt, $indent) = @_; + my $help = value_to_help($opt->{'value'}); + my $value = $opt->{'description'} . " [$help]"; + + $left =~ s/_/-/g; + wrap(" $left", $value, $indent); + if ($opt->{'type'} eq 'combo') { + my $list = choices($opt); + wrap('', "(choices: $list)", $indent) + if $list ne FEATURE_CHOICES; + } +} + +# Return whether the option (a dictionary) can be used without +# arguments. Booleans can always be used without arguments; +# combos allow no argument only if "enabled" and "disabled" +# are valid values. +sub allow_no_arg($) +{ + my ($opt) = @_; + return 1 if $opt->{'type'} eq 'boolean'; + return 0 if $opt->{'type'} ne 'combo'; + + my $choices = $opt->{'choices'}; + return (grep {$_ eq 'enabled'} @$choices) && + (grep {$_ eq 'disabled'} @$choices); +} + +# Return whether the option (a dictionary) can be used with +# arguments. Booleans can never be used without arguments; +# combos allow an argument only if they accept other values +# than "auto", "enabled", and "disabled". +sub allow_arg($) +{ + my ($opt) = @_; + return 0 if $opt->{'type'} eq 'boolean'; + return 1 if $opt->{'type'} ne 'combo'; + return choices($opt) ne FEATURE_CHOICES; +} + +sub print_help(%) +{ + my (%options) = @_; + # The first section includes options that have an arguments, + # and booleans (i.e., only one of enable/disable makes sense) + foreach my $opt (sort keys %options) { + my $item = $options{$opt}; + my $left; + next if allow_no_arg($item) and $item->{'type'} ne 'boolean'; + + if ($item->{'type'} eq 'boolean') { + $left = $item->{'value'} ? "--disable-$opt" : "--enable-$opt"; + } else { + $left = "--enable-$opt=CHOICE"; + } + print_help_line($left, $item, 27); + } + print("\n"); + print("Optional features, enabled with --enable-FEATURE and\n"); + print("disabled with --disable-FEATURE:\n"); + + foreach my $opt (sort keys %options) { + my $item = $options{$opt}; + print_help_line($opt, $item, 18) + if allow_no_arg($item); + } + exit 0; +} + +sub error($) +{ + my ($msg) = @_; + print STDERR "ERROR: $msg\n"; + exit 1; +} + +sub shell_quote($) +{ + my ($word) = @_; + $word =~ s/'/'\\''/g; + return "'$word'"; +} + + +# Read Meson introspection data and convert it to a dictionary + +my $input = do { local $/; }; +my $json = decode_json $input; +my %options = (); + +foreach my $item (@$json) { + next if $item->{'section'} ne 'user'; + next if $item->{'name'} =~ /:/; + next if grep {$_ eq $item->{'name'}} SKIP_OPTIONS; + $options{$item->{'name'}} = $item; +} + +exit if ! @ARGV; +print_help(%options) if ($ARGV[0] eq '--print-help'); + +my @args = (); +foreach my $arg (@ARGV) { + my ($before, $opt, $value) = $arg =~ /--(enable|disable)-([^=]*)(?:=(.*))?/; + die "internal error parsing command line" + if ! defined $before ; + my ($key, $option); + + $key = $opt; + $key =~ s/-/_/g; + $option = $options{$key}; + error("Unknown option --$before-$opt") + if ! defined $option || ($before eq 'disable' && ! allow_no_arg ($option)); + + if (! defined $value) { + error("option --$before-$opt requires an argument") + if (! allow_no_arg ($option)); + if ($option->{'type'} eq 'combo') { + $value = "${before}d"; + } else { + $value = $before eq 'enable' ? 'true' : 'false'; + } + } else { + error("option --$before-$opt does not take an argument") + if ($before eq 'disable' || ! allow_arg ($option)); + } + push @args, shell_quote("-D$key=$value"); +} +print join(' ', @args);