From 3f0a5d55ae1cd47149bf11bd984e54fc03ad6cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 7 Oct 2021 15:08:23 +0200 Subject: [PATCH] configure, meson: move Spice configure handling to meson MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add meson feature options for Spice and Spice protocol, and move detection logic out of configure. Signed-off-by: Marc-André Lureau Message-Id: <20211007102453.978041-1-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini Message-Id: <20211007130829.632254-13-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini --- chardev/meson.build | 2 +- configure | 47 +-------------------------------------------- meson.build | 29 +++++++++++++++++----------- meson_options.txt | 4 ++++ ui/meson.build | 4 ++-- 5 files changed, 26 insertions(+), 60 deletions(-) diff --git a/chardev/meson.build b/chardev/meson.build index 32377af383..325ba2bdb9 100644 --- a/chardev/meson.build +++ b/chardev/meson.build @@ -35,7 +35,7 @@ if brlapi.found() chardev_modules += { 'baum': module_ss } endif -if config_host.has_key('CONFIG_SPICE') +if spice.found() module_ss = ss.source_set() module_ss.add(when: [spice], if_true: files('spice.c')) chardev_modules += { 'spice': module_ss } diff --git a/configure b/configure index 3544024166..5ad1b5194e 100755 --- a/configure +++ b/configure @@ -369,7 +369,7 @@ pie="" qom_cast_debug="yes" trace_backends="log" trace_file="trace" -spice="$default_feature" +spice="auto" spice_protocol="auto" rbd="auto" smartcard="auto" @@ -3231,41 +3231,6 @@ EOF fi fi -########################################## -# spice probe -if test "$spice_protocol" != "no" ; then - spice_protocol_cflags=$($pkg_config --cflags spice-protocol 2>/dev/null) - if $pkg_config --atleast-version=0.12.3 spice-protocol; then - spice_protocol="yes" - else - if test "$spice_protocol" = "yes" ; then - feature_not_found "spice_protocol" \ - "Install spice-protocol(>=0.12.3) devel" - fi - spice_protocol="no" - fi -fi - -if test "$spice" != "no" ; then - cat > $TMPC << EOF -#include -int main(void) { spice_server_new(); return 0; } -EOF - spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) - spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) - if $pkg_config --atleast-version=0.12.5 spice-server && \ - test "$spice_protocol" = "yes" && \ - compile_prog "$spice_cflags" "$spice_libs" ; then - spice="yes" - else - if test "$spice" = "yes" ; then - feature_not_found "spice" \ - "Install spice-server(>=0.12.5) devel" - fi - spice="no" - fi -fi - ########################################## # check if we have VSS SDK headers for win @@ -4235,16 +4200,6 @@ if test "$tcg" = "enabled" -a "$tcg_interpreter" = "true" ; then echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak fi -if test "$spice_protocol" = "yes" ; then - echo "CONFIG_SPICE_PROTOCOL=y" >> $config_host_mak - echo "SPICE_PROTOCOL_CFLAGS=$spice_protocol_cflags" >> $config_host_mak -fi -if test "$spice" = "yes" ; then - echo "CONFIG_SPICE=y" >> $config_host_mak - echo "SPICE_CFLAGS=$spice_cflags $spice_protocol_cflags" >> $config_host_mak - echo "SPICE_LIBS=$spice_libs" >> $config_host_mak -fi - if test "$opengl" = "yes" ; then echo "CONFIG_OPENGL=y" >> $config_host_mak echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak diff --git a/meson.build b/meson.build index 40563e3c24..6bf43e6d30 100644 --- a/meson.build +++ b/meson.build @@ -540,17 +540,20 @@ if not get_option('jack').auto() or have_system method: 'pkg-config', kwargs: static_kwargs) endif -spice = not_found -spice_headers = not_found spice_protocol = not_found -if 'CONFIG_SPICE' in config_host - spice = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split(), - link_args: config_host['SPICE_LIBS'].split()) - spice_headers = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split()) +if not get_option('spice_protocol').auto() or have_system + spice_protocol = dependency('spice-protocol', version: '>=0.12.3', + required: get_option('spice_protocol'), + method: 'pkg-config', kwargs: static_kwargs) endif -if 'CONFIG_SPICE_PROTOCOL' in config_host - spice_protocol = declare_dependency(compile_args: config_host['SPICE_PROTOCOL_CFLAGS'].split()) +spice = not_found +if not get_option('spice').auto() or have_system + spice = dependency('spice-server', version: '>=0.12.5', + required: get_option('spice'), + method: 'pkg-config', kwargs: static_kwargs) endif +spice_headers = spice.partial_dependency(compile_args: true, includes: true) + rt = cc.find_library('rt', required: false) libdl = not_found if 'CONFIG_PLUGIN' in config_host @@ -1481,6 +1484,8 @@ 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_SPICE_PROTOCOL', spice_protocol.found()) +config_host_data.set('CONFIG_SPICE', spice.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())) @@ -1761,7 +1766,7 @@ have_ivshmem = config_host_data.get('CONFIG_EVENTFD') host_kconfig = \ (get_option('fuzzing') ? ['CONFIG_FUZZ=y'] : []) + \ ('CONFIG_TPM' in config_host ? ['CONFIG_TPM=y'] : []) + \ - ('CONFIG_SPICE' in config_host ? ['CONFIG_SPICE=y'] : []) + \ + (spice.found() ? ['CONFIG_SPICE=y'] : []) + \ (have_ivshmem ? ['CONFIG_IVSHMEM=y'] : []) + \ ('CONFIG_OPENGL' in config_host ? ['CONFIG_OPENGL=y'] : []) + \ (x11.found() ? ['CONFIG_X11=y'] : []) + \ @@ -3337,8 +3342,10 @@ summary_info += {'PVRDMA support': config_host.has_key('CONFIG_PVRDMA')} summary_info += {'fdt support': fdt_opt == 'disabled' ? false : fdt_opt} summary_info += {'libcap-ng support': libcap_ng} summary_info += {'bpf support': libbpf} -# TODO: add back protocol and server version -summary_info += {'spice support': config_host.has_key('CONFIG_SPICE')} +summary_info += {'spice protocol support': spice_protocol} +if spice_protocol.found() + summary_info += {' spice server support': spice} +endif summary_info += {'rbd support': rbd} summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')} summary_info += {'smartcard support': cacard} diff --git a/meson_options.txt b/meson_options.txt index d8e67ae481..5a140af7f7 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -125,6 +125,10 @@ option('smartcard', type : 'feature', value : 'auto', description: 'CA smartcard emulation support') option('snappy', type : 'feature', value : 'auto', description: 'snappy compression support') +option('spice', type : 'feature', value : 'auto', + description: 'Spice server support') +option('spice_protocol', type : 'feature', value : 'auto', + description: 'Spice protocol support') option('u2f', type : 'feature', value : 'auto', description: 'U2F emulation support') option('usb_redir', type : 'feature', value : 'auto', diff --git a/ui/meson.build b/ui/meson.build index a73beb0e54..ee8ef27714 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -89,7 +89,7 @@ if sdl.found() ui_modules += {'sdl' : sdl_ss} endif -if config_host.has_key('CONFIG_SPICE') +if spice.found() spice_core_ss = ss.source_set() spice_core_ss.add(spice, pixman, files( 'spice-core.c', @@ -99,7 +99,7 @@ if config_host.has_key('CONFIG_SPICE') ui_modules += {'spice-core' : spice_core_ss} endif -if config_host.has_key('CONFIG_SPICE') and config_host.has_key('CONFIG_GIO') +if spice.found() and config_host.has_key('CONFIG_GIO') spice_ss = ss.source_set() spice_ss.add(spice, gio, pixman, files('spice-app.c')) ui_modules += {'spice-app': spice_ss}