Skip to content

Commit 3f0a5d5

Browse files
elmarcobonzini
authored andcommitted
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 <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 837b84b commit 3f0a5d5

File tree

5 files changed

+26
-60
lines changed

5 files changed

+26
-60
lines changed

chardev/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ if brlapi.found()
3535
chardev_modules += { 'baum': module_ss }
3636
endif
3737

38-
if config_host.has_key('CONFIG_SPICE')
38+
if spice.found()
3939
module_ss = ss.source_set()
4040
module_ss.add(when: [spice], if_true: files('spice.c'))
4141
chardev_modules += { 'spice': module_ss }

configure

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ pie=""
369369
qom_cast_debug="yes"
370370
trace_backends="log"
371371
trace_file="trace"
372-
spice="$default_feature"
372+
spice="auto"
373373
spice_protocol="auto"
374374
rbd="auto"
375375
smartcard="auto"
@@ -3231,41 +3231,6 @@ EOF
32313231
fi
32323232
fi
32333233

3234-
##########################################
3235-
# spice probe
3236-
if test "$spice_protocol" != "no" ; then
3237-
spice_protocol_cflags=$($pkg_config --cflags spice-protocol 2>/dev/null)
3238-
if $pkg_config --atleast-version=0.12.3 spice-protocol; then
3239-
spice_protocol="yes"
3240-
else
3241-
if test "$spice_protocol" = "yes" ; then
3242-
feature_not_found "spice_protocol" \
3243-
"Install spice-protocol(>=0.12.3) devel"
3244-
fi
3245-
spice_protocol="no"
3246-
fi
3247-
fi
3248-
3249-
if test "$spice" != "no" ; then
3250-
cat > $TMPC << EOF
3251-
#include <spice.h>
3252-
int main(void) { spice_server_new(); return 0; }
3253-
EOF
3254-
spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
3255-
spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
3256-
if $pkg_config --atleast-version=0.12.5 spice-server && \
3257-
test "$spice_protocol" = "yes" && \
3258-
compile_prog "$spice_cflags" "$spice_libs" ; then
3259-
spice="yes"
3260-
else
3261-
if test "$spice" = "yes" ; then
3262-
feature_not_found "spice" \
3263-
"Install spice-server(>=0.12.5) devel"
3264-
fi
3265-
spice="no"
3266-
fi
3267-
fi
3268-
32693234
##########################################
32703235
# check if we have VSS SDK headers for win
32713236

@@ -4235,16 +4200,6 @@ if test "$tcg" = "enabled" -a "$tcg_interpreter" = "true" ; then
42354200
echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
42364201
fi
42374202

4238-
if test "$spice_protocol" = "yes" ; then
4239-
echo "CONFIG_SPICE_PROTOCOL=y" >> $config_host_mak
4240-
echo "SPICE_PROTOCOL_CFLAGS=$spice_protocol_cflags" >> $config_host_mak
4241-
fi
4242-
if test "$spice" = "yes" ; then
4243-
echo "CONFIG_SPICE=y" >> $config_host_mak
4244-
echo "SPICE_CFLAGS=$spice_cflags $spice_protocol_cflags" >> $config_host_mak
4245-
echo "SPICE_LIBS=$spice_libs" >> $config_host_mak
4246-
fi
4247-
42484203
if test "$opengl" = "yes" ; then
42494204
echo "CONFIG_OPENGL=y" >> $config_host_mak
42504205
echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak

meson.build

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -540,17 +540,20 @@ if not get_option('jack').auto() or have_system
540540
method: 'pkg-config', kwargs: static_kwargs)
541541
endif
542542

543-
spice = not_found
544-
spice_headers = not_found
545543
spice_protocol = not_found
546-
if 'CONFIG_SPICE' in config_host
547-
spice = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split(),
548-
link_args: config_host['SPICE_LIBS'].split())
549-
spice_headers = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split())
544+
if not get_option('spice_protocol').auto() or have_system
545+
spice_protocol = dependency('spice-protocol', version: '>=0.12.3',
546+
required: get_option('spice_protocol'),
547+
method: 'pkg-config', kwargs: static_kwargs)
550548
endif
551-
if 'CONFIG_SPICE_PROTOCOL' in config_host
552-
spice_protocol = declare_dependency(compile_args: config_host['SPICE_PROTOCOL_CFLAGS'].split())
549+
spice = not_found
550+
if not get_option('spice').auto() or have_system
551+
spice = dependency('spice-server', version: '>=0.12.5',
552+
required: get_option('spice'),
553+
method: 'pkg-config', kwargs: static_kwargs)
553554
endif
555+
spice_headers = spice.partial_dependency(compile_args: true, includes: true)
556+
554557
rt = cc.find_library('rt', required: false)
555558
libdl = not_found
556559
if 'CONFIG_PLUGIN' in config_host
@@ -1481,6 +1484,8 @@ config_host_data.set('CONFIG_STATX', has_statx)
14811484
config_host_data.set('CONFIG_ZSTD', zstd.found())
14821485
config_host_data.set('CONFIG_FUSE', fuse.found())
14831486
config_host_data.set('CONFIG_FUSE_LSEEK', fuse_lseek.found())
1487+
config_host_data.set('CONFIG_SPICE_PROTOCOL', spice_protocol.found())
1488+
config_host_data.set('CONFIG_SPICE', spice.found())
14841489
config_host_data.set('CONFIG_X11', x11.found())
14851490
config_host_data.set('CONFIG_CFI', get_option('cfi'))
14861491
config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
@@ -1761,7 +1766,7 @@ have_ivshmem = config_host_data.get('CONFIG_EVENTFD')
17611766
host_kconfig = \
17621767
(get_option('fuzzing') ? ['CONFIG_FUZZ=y'] : []) + \
17631768
('CONFIG_TPM' in config_host ? ['CONFIG_TPM=y'] : []) + \
1764-
('CONFIG_SPICE' in config_host ? ['CONFIG_SPICE=y'] : []) + \
1769+
(spice.found() ? ['CONFIG_SPICE=y'] : []) + \
17651770
(have_ivshmem ? ['CONFIG_IVSHMEM=y'] : []) + \
17661771
('CONFIG_OPENGL' in config_host ? ['CONFIG_OPENGL=y'] : []) + \
17671772
(x11.found() ? ['CONFIG_X11=y'] : []) + \
@@ -3337,8 +3342,10 @@ summary_info += {'PVRDMA support': config_host.has_key('CONFIG_PVRDMA')}
33373342
summary_info += {'fdt support': fdt_opt == 'disabled' ? false : fdt_opt}
33383343
summary_info += {'libcap-ng support': libcap_ng}
33393344
summary_info += {'bpf support': libbpf}
3340-
# TODO: add back protocol and server version
3341-
summary_info += {'spice support': config_host.has_key('CONFIG_SPICE')}
3345+
summary_info += {'spice protocol support': spice_protocol}
3346+
if spice_protocol.found()
3347+
summary_info += {' spice server support': spice}
3348+
endif
33423349
summary_info += {'rbd support': rbd}
33433350
summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')}
33443351
summary_info += {'smartcard support': cacard}

meson_options.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ option('smartcard', type : 'feature', value : 'auto',
125125
description: 'CA smartcard emulation support')
126126
option('snappy', type : 'feature', value : 'auto',
127127
description: 'snappy compression support')
128+
option('spice', type : 'feature', value : 'auto',
129+
description: 'Spice server support')
130+
option('spice_protocol', type : 'feature', value : 'auto',
131+
description: 'Spice protocol support')
128132
option('u2f', type : 'feature', value : 'auto',
129133
description: 'U2F emulation support')
130134
option('usb_redir', type : 'feature', value : 'auto',

ui/meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ if sdl.found()
8989
ui_modules += {'sdl' : sdl_ss}
9090
endif
9191

92-
if config_host.has_key('CONFIG_SPICE')
92+
if spice.found()
9393
spice_core_ss = ss.source_set()
9494
spice_core_ss.add(spice, pixman, files(
9595
'spice-core.c',
@@ -99,7 +99,7 @@ if config_host.has_key('CONFIG_SPICE')
9999
ui_modules += {'spice-core' : spice_core_ss}
100100
endif
101101

102-
if config_host.has_key('CONFIG_SPICE') and config_host.has_key('CONFIG_GIO')
102+
if spice.found() and config_host.has_key('CONFIG_GIO')
103103
spice_ss = ss.source_set()
104104
spice_ss.add(spice, gio, pixman, files('spice-app.c'))
105105
ui_modules += {'spice-app': spice_ss}

0 commit comments

Comments
 (0)