Patchwork Fix build failure when coroutines need gthreads but guest agent is disabled

login
register
mail settings
Submitter Blue Swirl
Date Aug. 7, 2011, 9:29 a.m.
Message ID <CAAu8pHtF9FpB0WsLJCvtP5Bhmp9KMOWyGwT4KDBZk+ahEr8cRg@mail.gmail.com>
Download mbox | patch
Permalink /patch/108812/
State New
Headers show

Comments

Blue Swirl - Aug. 7, 2011, 9:29 a.m.
When coroutines use GThreads instead of Win32 threads or ucontexts,
glib and gthreads must be used.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 configure |   39 +++++++++++++++++++++------------------
 1 files changed, 21 insertions(+), 18 deletions(-)

     fi
 fi
@@ -2557,20 +2574,6 @@ EOF
 fi

 ##########################################
-# check if we have makecontext
-
-ucontext_coroutine=no
-if test "$darwin" != "yes"; then
-  cat > $TMPC << EOF
-#include <ucontext.h>
-int main(void) { makecontext(0, 0, 0); }
-EOF
-  if compile_prog "" "" ; then
-      ucontext_coroutine=yes
-  fi
-fi
-
-##########################################
 # End of CC checks
 # After here, no more $cc or $ld runs

Patch

diff --git a/configure b/configure
index 0c67a4a..a25e65c 100755
--- a/configure
+++ b/configure
@@ -1843,15 +1843,32 @@  EOF
 fi

 ##########################################
+# check if we have makecontext
+
+ucontext_coroutine=no
+if test "$darwin" != "yes"; then
+  cat > $TMPC << EOF
+#include <ucontext.h>
+int main(void) { makecontext(0, 0, 0); }
+EOF
+  if compile_prog "" "" ; then
+      ucontext_coroutine=yes
+  fi
+fi
+
+##########################################
 # glib support probe
-if test "$guest_agent" != "no" ; then
+if test "$guest_agent" != "no" -o "$ucontext_coroutine" != "yes" -a
"$mingw32" != "yes"; then
     if $pkg_config --modversion glib-2.0 > /dev/null 2>&1 ; then
         glib_cflags=`$pkg_config --cflags glib-2.0 2>/dev/null`
         glib_libs=`$pkg_config --libs glib-2.0 2>/dev/null`
-        libs_softmmu="$glib_libs $libs_softmmu"
-        libs_tools="$glib_libs $libs_tools"
+        gthread_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null`
+        gthread_libs=`$pkg_config --libs gthread-2.0 2>/dev/null`
+        glib_cflags="$glib_cflags $gthread_cflags"
+        libs_softmmu="$glib_libs $gthread_libs $libs_softmmu"
+        libs_tools="$glib_libs $gthread_libs $libs_tools"
     else
-        echo "glib-2.0 required to compile QEMU"
+        echo "glib-2.0 required to compile QEMU with guest agent or
gthread based coroutines"
         exit 1