diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-02-11 07:29:11 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-02-11 07:29:11 +0200 |
commit | 16192beb8262828291b0edb8fca44b2c89a5498a (patch) | |
tree | 04a03a6f9bb572c4ddaea21baf1e6cb951707ad2 /m4/threads.m4 | |
parent | d557d4717fe12449b134f4f5ff4a2ba6291be6ee (diff) |
Add support for POSIX threading model on MinWG
Diffstat (limited to 'm4/threads.m4')
-rw-r--r-- | m4/threads.m4 | 11 |
1 files changed, 10 insertions, 1 deletions
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.h>], + [pthread_create(0,0,0,0);], + [threads=posix], + [threads=win32]) ;; *) ACX_PTHREAD |