configure, meson: move Spice configure handling to meson
Add meson feature options for Spice and Spice protocol, and move
detection logic out of configure.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20211007102453.978041-1-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20211007130829.632254-13-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/meson.build b/meson.build
index 40563e3..6bf43e6 100644
--- a/meson.build
+++ b/meson.build
@@ -540,17 +540,20 @@
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_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 @@
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 += {'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}