[gtk-vnc] build: use #ifdef instead of #if for WITH_UCONTEXT check



commit 111c93b0c70740ae7c81259863c974ee78950007
Author: Daniel P. Berrangé <berrange redhat com>
Date:   Mon Aug 5 16:41:17 2019 +0100

    build: use #ifdef instead of #if for WITH_UCONTEXT check
    
    Signed-off-by: Daniel P. Berrangé <berrange redhat com>

 configure.ac    | 9 ++++-----
 src/coroutine.h | 4 ++--
 2 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d22bcc3..ff59d45 100644
--- a/configure.ac
+++ b/configure.ac
@@ -260,8 +260,6 @@ GTHREAD_LIBS=
 
 AC_CHECK_LIB(z, inflate, [], [AC_MSG_ERROR([zlib not found])])
 
-WITH_UCONTEXT=1
-
 AC_ARG_WITH(coroutine,
 [  --with-coroutine=ucontext/gthread  use ucontext or GThread for coroutines],
 [],[with_coroutine=ucontext])
@@ -283,12 +281,13 @@ fi
 
 if test "$with_coroutine" = "gthread"; then
   PKG_CHECK_MODULES(GTHREAD, gthread-2.0 > $GLIB_REQUIRED)
-  WITH_UCONTEXT=0
 fi
 AC_SUBST(GTHREAD_CFLAGS)
 AC_SUBST(GTHREAD_LIBS)
-AC_DEFINE_UNQUOTED([WITH_UCONTEXT],[$WITH_UCONTEXT], [Whether to use ucontext coroutine impl])
-AM_CONDITIONAL(WITH_UCONTEXT, [test "$WITH_UCONTEXT" != "0"])
+if test "$with_coroutine" = "ucontext"; then
+  AC_DEFINE_UNQUOTED([WITH_UCONTEXT],[1], [Whether to use ucontext coroutine impl])
+fi
+AM_CONDITIONAL(WITH_UCONTEXT, [test "$with_coroutine" = "ucontext"])
 
 # Needed for keycodemap generator
 AM_PATH_PYTHON()
diff --git a/src/coroutine.h b/src/coroutine.h
index a3a9b57..dc8981e 100644
--- a/src/coroutine.h
+++ b/src/coroutine.h
@@ -23,7 +23,7 @@
 
 #include "config.h"
 
-#if WITH_UCONTEXT
+#ifdef WITH_UCONTEXT
 #include "continuation.h"
 #else
 #include <glib.h>
@@ -42,7 +42,7 @@ struct coroutine
     struct coroutine *caller;
     void *data;
 
-#if WITH_UCONTEXT
+#ifdef WITH_UCONTEXT
     struct continuation cc;
 #else
     GThread *thread;


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