From 6ab751a49b1a4336c7f2f109c407fb31c9b69b02 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 11 Feb 2013 10:15:33 +0200 Subject: Detect POSIX threads on MinGW-W64 --- m4/threads.m4 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/m4/threads.m4 b/m4/threads.m4 index 9a7da53..1609a04 100644 --- a/m4/threads.m4 +++ b/m4/threads.m4 @@ -22,7 +22,16 @@ if test x$threads = xcheck; then CXXFLAGS="$CXXFLAGS -mthreads" ;; esac - threads=win32 + + # Newer versions of GCC can be configured to use either Win32 or POSIX + # threads. It appears that -mthreads should be used in both cases but + # if the model is POSIX then GCC will also link -lpthread by default. + # Use that fact to test which model we have. + # + AC_TRY_LINK([#include ], + [pthread_create(0,0,0,0);], + [threads=posix], + [threads=win32]) ;; *) ACX_PTHREAD -- cgit v1.1