[Spice-devel] [PATCH spice-gtk v2 12/15] meson: choose a better default coroutine
Frediano Ziglio
fziglio at redhat.com
Wed Jan 9 10:09:32 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 a3eca829..8f8b9f85 100644
--- a/meson.build
+++ b/meson.build
@@ -243,17 +243,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 ff4654d1..84c596f4 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
More information about the Spice-devel
mailing list