Skip to content

Commit

Permalink
Allow for the use of the pthreads-win32 library to provide threads on…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
Julien Fischer committed Oct 25, 2010
1 parent 6370da2 commit 97cd495
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions configure.in
Expand Up @@ -2841,6 +2841,34 @@ AC_SUBST(CGIDIR)

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

# 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
Expand Down Expand Up @@ -2906,7 +2934,7 @@ case "$host" in
LD_LIBFLAGS_FOR_THREADS="/MD"
;;
*)
CFLAGS_FOR_THREADS="-DGC_WIN32_THREADS -DMR_THREAD_SAFE" ;;
CFLAGS_FOR_THREADS="$WIN32_GC_THREADLIB -DMR_THREAD_SAFE" ;;
esac
;;

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

Expand Down

0 comments on commit 97cd495

Please sign in to comment.