[m-rev.] for review: Account for Winpthreads in configure.

Peter Wang novalazy at gmail.com
Wed Aug 13 14:45:28 AEST 2014


Branches: master, 14.01

configure.ac:
	Always build Boehm GC with GC_WIN32_PTHREADS when pthread.h is
	detected on MinGW* systems.  Otherwise we risk making pthread
	calls which are not intercepted by Boehm GC.

	Change `--with-gc-pthreads-win32' to `--with-gc-win32-pthreads',
	to mean either of pthreads-win32 or winpthreads.
---
 configure.ac | 42 ++++++++++++++++++++----------------------
 1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/configure.ac b/configure.ac
index 964650b..ea77d5a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2981,8 +2981,8 @@ AC_SUBST(CGIDIR)
 
 #-----------------------------------------------------------------------------#
 
-# Check if we are using the pthreads-win32 library.
-# NOTE: we currently only support this on MinGW.
+# Check if we are using a pthreads implementation on Win32.
+# NOTE: we currently only support this on MinGW or MinGW-w64.
 
 if test "$MR_HAVE_PTHREAD_H" = 1
 then
@@ -2992,39 +2992,37 @@ then
             if test $mercury_cv_have_pthreads_win32 = "yes"
             then
                 AC_DEFINE([MR_PTHREADS_WIN32])
-                WIN32_GC_THREADLIB="-DGC_WIN32_PTHREADS"
-            else
-                WIN32_GC_THREADLIB="-DGC_WIN32_THREADS"
             fi
-        ;;
-
+            WIN32_GC_THREADLIB="-DGC_WIN32_PTHREADS"
+            ;;
         *)
+            # XXX Building with GC_WIN32_THREADS instead of GC_WIN32_PTHREADS
+            # can lead to trouble if the Mercury implementation makes pthread
+            # calls which are not intercepted by Boehm GC.
             WIN32_GC_THREADLIB="-DGC_WIN32_THREADS"
-        ;;
+            ;;
     esac
 else
     WIN32_GC_THREADLIB="-DGC_WIN32_THREADS"
 fi
 
-AC_ARG_WITH([gc-pthreads-win32],
-   AC_HELP_STRING([--with-gc-pthreads-win32]
-                          [Force the use of the pthreads-win32 library with
-                          the Boehm GC.  This is the default for MinGW]),
-   [with_gc_pthreads_win32="$withval"],[with_gc_pthreads_win32="no"])
-
-case "$with_gc_pthreads_win32" in
+AC_ARG_WITH([gc-win32-pthreads],
+   AC_HELP_STRING([--with-gc-win32-pthreads]
+            [Force the use of pthreads-win32 or winpthreads with Boehm GC.
+             This is the default for MinGW if detected.]),
+   [with_gc_win32_pthreads="$withval"],
+   [with_gc_win32_pthreads="no"])
 
+case "$with_gc_win32_pthreads" in
     yes)
-        # Force the use of the pthreads-win32 library with the Boehm GC.
+        # Force the use of a MinGW* pthreads library with the Boehm GC.
         WIN32_GC_THREADLIB="-DGC_WIN32_PTHREADS"
-    ;;
-
+        ;;
     no)
-    ;;
-
+        ;;
     *)
-        AC_MSG_ERROR([unexpected argument to --with-gc-pthreads-win32])
-    ;;
+        AC_MSG_ERROR([unexpected argument to --with-gc-win32-pthreads])
+        ;;
 esac
 
 #-----------------------------------------------------------------------------#
-- 
1.8.4




More information about the reviews mailing list