Have configure check for the use of the pthreads-win32 library on MinGW.

Branches: main, 10.04

Have configure check for the use of the pthreads-win32 library on MinGW.  (In
the future we may also want to do this in the case where Cygwin is being used
to cross-compile a native Windows version of Mercury, although this change
doesn't handle that case.)

runtime/mercury_conf.h.in:
	Add a new configuration macro that is defined if the threads
	library is pthreads-win32.

configure.in:
	If POSIX threads are available and we are on MinGW check if we are
	using pthreads-win32 (which should be the case sice AFAIK there
	isn't a readily available alternative).

aclocal.m4:
	Add a new macro that checks if the threads library is
	pthreads-win32.
This commit is contained in:
Julien Fischer
2010-12-09 06:14:15 +00:00
parent 352316e290
commit 81ca0a5572
3 changed files with 57 additions and 0 deletions

40
aclocal.m4 vendored
View File

@@ -524,3 +524,43 @@ fi
])
#-----------------------------------------------------------------------------#
#
# Check if the POSIX threads library is pthreads-win32.
#
AC_DEFUN([MERCURY_HAVE_PTHREADS_WIN32], [
AC_MSG_CHECKING([if we are using pthreads-win32])
cat > conftest.c << EOF
#include <pthread.h>
#include <stdio.h>
int main(int argc, char **argv)
{
#if defined(PTW32_VERSION)
return 0;
#else
return 1;
#endif
}
EOF
echo "$CC -o conftest contest.c" >&AC_FD_CC 2>&1
if
$CC -o conftest conftest.c
then
mercury_cv_have_pthreads_win32="yes"
else
mercury_cv_have_pthreads_win32="no"
fi
AC_MSG_RESULT($mercury_cv_have_pthreads_win32)
])
#-----------------------------------------------------------------------------#

View File

@@ -59,6 +59,7 @@ AC_PREREQ(2.58)
# Strip out any site or system specific configuration files since their
# presence when reconfiguring will result in the command line used to invoke
# configure being invalid.
# Also quote any args containing shell metacharacters.
#
# NOTE: Some macros, e.g. AC_CHECK_PROG, overwrite the argument list,
@@ -1222,6 +1223,19 @@ if test "$MR_HAVE_UCONTEXT_H" != 1; then
MERCURY_CHECK_FOR_HEADERS(sys/ucontext.h)
fi
if test "$MR_HAVE_PTHREAD_H" = 1
then
case "$host" in
*mingw*)
MERCURY_HAVE_PTHREADS_WIN32
if test $mercury_cv_have_pthreads_win32 = "yes"
then
AC_DEFINE([MR_PTHREADS_WIN32])
fi
;;
esac
fi
#-----------------------------------------------------------------------------#
#
# Check whether we can set the FP rounding mode

View File

@@ -409,9 +409,12 @@
** MR_THREAD_LOCAL_STORAGE is defined if the thread-local storage extension
** is supported. That is, the compiler extends the C language with the
** `__thread' specifier.
**
** MR_PTHREADS_WIN32 is defined if we are using the pthreads-win32 library.
*/
#undef MR_DIGITAL_UNIX_PTHREADS
#undef MR_THREAD_LOCAL_STORAGE
#undef MR_PTHREADS_WIN32
/*
** The bytecode files represent floats in 64-bit IEEE format.