[m-rev.] diff: allow for the use of pthreads-win32

Julien Fischer juliensf at csse.unimelb.edu.au
Mon Oct 25 13:06:33 AEDT 2010


Allow for the use of the pthreads-win32 library to provide threads on Windows
instead of using native Win32 threads.
(This is not currently supported with MSVC.)

configure.in:
 	Add a new option, --with-pthreads-win32, which configures Mercury
 	to use the pthreads-win32 library for threads on Windows.

Julien.

Index: configure.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/configure.in,v
retrieving revision 1.564
diff -u -r1.564 configure.in
--- configure.in	30 Sep 2010 07:23:30 -0000	1.564
+++ configure.in	25 Oct 2010 02:01:04 -0000
@@ -2841,6 +2841,34 @@

  #-----------------------------------------------------------------------------#

+# Allow the use of pthreads-win32 instead of native Win32 threads on Windows.
+# XXX it should also be possible to use pthreads-win32 with MSVC.
+
+AC_ARG_WITH([pthreads-win32],
+   AC_HELP_STRING([--with-pthreads-win32]
+      [use the pthreads-win32 library instead of Win32 threads (GCC only)]
+   ),
+   [with_pthreads_win32="$withval"],[with_pthreads_win32="no"])
+
+case "$with_pthreads_win32" in
+
+    yes)
+        # Use the pthreads-win32 library.
+        WIN32_GC_THREADLIB="-DGC_WIN32_PTHREADS"
+    ;;
+ 
+    no)
+        # Use native Win32 threads.
+        WIN32_GC_THREADLIB="-DGC_WIN32_THREADS"
+    ;;
+
+    *)
+        AC_MSG_ERROR([unexpected argument to --with-pthreads-win32])
+    ;;
+esac
+
+#-----------------------------------------------------------------------------#
+
  # Figure out which flavour of pthreads to use, since none of the
  # implementations seem to be exactly the same
  case "$host" in
@@ -2906,7 +2934,7 @@
                  LD_LIBFLAGS_FOR_THREADS="/MD"
                  ;;
              *)
-                CFLAGS_FOR_THREADS="-DGC_WIN32_THREADS -DMR_THREAD_SAFE" ;;
+                CFLAGS_FOR_THREADS="$WIN32_GC_THREADLIB -DMR_THREAD_SAFE" ;;
          esac
          ;;

@@ -2920,7 +2948,7 @@
                  LD_LIBFLAGS_FOR_THREADS="/MD"
                  ;;
              *)
-                CFLAGS_FOR_THREADS="-DGC_WIN32_THREADS -DMR_THREAD_SAFE" ;;
+                CFLAGS_FOR_THREADS="$WIN32_GC_THREADLIB -DMR_THREAD_SAFE" ;;
          esac
          ;;


--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list