[PATCH spice-gtk v2 12/15] meson: choose a better default coroutine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>

Let's have a new 'auto' default value, and use winfibers on Windows.

Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
---
 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

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]