Skip to content

Commit

Permalink
Fix detection of pthreads-win32.
Browse files Browse the repository at this point in the history
The check for the pthreads-win32 implementation did not work because it
compiled a test program that was designed to be run, but did not run it.
Running a test program is undesirable for cross-compilation anyway.

m4/mercury.m4:
	Replace MERCURY_HAVE_PTHREADS_WIN32 test with one based only on
	successful compilation.
  • Loading branch information
wangp committed Mar 25, 2014
1 parent 6bae4e4 commit ce1b598
Showing 1 changed file with 12 additions and 28 deletions.
40 changes: 12 additions & 28 deletions m4/mercury.m4
Original file line number Diff line number Diff line change
Expand Up @@ -774,38 +774,22 @@ fi
#

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_TRY_COMPILE([#include <pthread.h>],
[
#ifndef PTW32_VERSION
#error I suppose not
#endif
int self_id(void)
{
return (int) pthread_self().p;
}
],
[mercury_cv_have_pthreads_win32=yes],
[mercury_cv_have_pthreads_win32=no])
AC_MSG_RESULT($mercury_cv_have_pthreads_win32)
])

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

0 comments on commit ce1b598

Please sign in to comment.