[libxml2] prefer native threads on win32



commit 115581ae2d3e35ddb7c43c50aacfa98193be6b72
Author: Sam Thursfield <ssssam gmail com>
Date:   Wed May 9 18:46:56 2012 +0800

    prefer native threads on win32
    
    For https://bugzilla.gnome.org/show_bug.cgi?id=665526
    
    When building on Win32 configure the suport to use native Windows
    threads since there is support for it unless pthreads are found
    and asked for explicitely

 configure.in |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/configure.in b/configure.in
index 5a6f5b7..e71f00a 100644
--- a/configure.in
+++ b/configure.in
@@ -944,22 +944,30 @@ if test "$with_threads" = "no" ; then
     echo Disabling multithreaded support
 else
     echo Enabling multithreaded support
-    dnl Use pthread by default
-    if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then
-        AC_CHECK_HEADER(pthread.h,
-	    AC_CHECK_LIB(pthread, pthread_join,[
-	       THREAD_LIBS="-lpthread"
-	       AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)])
-	       AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there])
-	       WITH_THREADS="1"]))
-    fi
+
+    dnl Default to native threads on Win32
     case $host_os in
-       *mingw32*) if test "$THREAD_LIBS" != "-lpthread"; then
+       *mingw32*) if test "$with_threads" != "pthread" && test "$with_threads" != "no"; then
                WITH_THREADS="1"
                THREADS_W32="Win32"
-	       THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS"
+               THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS"
            fi
        ;;
+    esac
+
+    dnl Use pthread by default in other cases
+    if test -z "$THREADS_W32"; then
+        if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then
+            AC_CHECK_HEADER(pthread.h,
+                AC_CHECK_LIB(pthread, pthread_join,[
+                THREAD_LIBS="-lpthread"
+                AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)])
+                AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there])
+                WITH_THREADS="1"]))
+        fi
+    fi
+
+    case $host_os in
        *cygwin*) THREAD_LIBS=""
        ;;
        *beos*) WITH_THREADS="1"



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