[Spice-devel] [PATCH spice-gtk 27/34] meson: choose a better default coroutine
marcandre.lureau at redhat.com
marcandre.lureau at redhat.com
Mon Jan 7 08:00:56 UTC 2019
From: Marc-André Lureau <marcandre.lureau at redhat.com>
Let's have a new 'auto' default value, and use winfibers on Windows.
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
meson.build | 23 ++++++++++++++++-------
meson_options.txt | 3 ++-
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/meson.build b/meson.build
index bbfd8d0..9896151 100644
--- a/meson.build
+++ b/meson.build
@@ -241,17 +241,26 @@ endif
# coroutine
spice_gtk_coroutine = get_option('coroutine')
-if spice_gtk_coroutine == 'ucontext'
- if compiler.has_function('makecontext') and compiler.has_function('swapcontext') and compiler.has_function('getcontext')
- spice_gtk_config_data.set('WITH_UCONTEXT', '1')
- if host_machine.system() == 'darwin'
- spice_gtk_config_data.set('_XOPEN_SOURCE', '1')
- endif
+if spice_gtk_coroutine == 'auto'
+ if host_machine.system() == 'windows'
+ spice_gtk_coroutine = 'winfiber'
else
- spice_gtk_coroutine = 'gthread'
+ spice_gtk_coroutine = 'ucontext'
endif
endif
+if spice_gtk_coroutine == 'ucontext'
+ foreach f : ['makecontext', 'swapcontext', 'getcontext']
+ if not compiler.has_function(f)
+ error('Function missing:' + f)
+ endif
+ endforeach
+ spice_gtk_config_data.set('WITH_UCONTEXT', '1')
+ if host_machine.system() == 'darwin'
+ spice_gtk_config_data.set('_XOPEN_SOURCE', '1')
+ endif
+ endif
+
if spice_gtk_coroutine == 'gthread'
spice_gtk_config_data.set('WITH_GTHREAD', '1')
endif
diff --git a/meson_options.txt b/meson_options.txt
index ff4654d..84c596f 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -40,7 +40,8 @@ option('usb-ids-path',
option('coroutine',
type : 'combo',
- choices : ['ucontext', 'gthread', 'winfiber'],
+ value : 'auto',
+ choices : ['auto', 'ucontext', 'gthread', 'winfiber'],
description : 'Use ucontext or GThread for coroutines')
option('introspection',
--
2.20.1.2.gb21ebb671b
More information about the Spice-devel
mailing list