summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2007-02-05 18:39:27 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2007-02-05 18:39:27 +0000
commit47fb93aa3c3c55e986dd771657abad8b4efd8e65 (patch)
tree0c1edded0e6a172e4a18f90c2496c1a9d33f4d5d /configure.in
parent1c61b1297d761c2f536a48f98fce7e6c2746f258 (diff)
Update pthreads configure test to work on more platforms.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5661 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in33
1 files changed, 22 insertions, 11 deletions
diff --git a/configure.in b/configure.in
index c7afef0a2..46579d4da 100644
--- a/configure.in
+++ b/configure.in
@@ -540,29 +540,40 @@ AC_EXEEXT
dnl Check for pthreads for multi-threaded apps...
have_pthread=no
+PTHREAD_FLAGS=""
if test "x$enable_threads" = xyes; then
AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))
- AC_CHECK_FUNC(pthread_create,
- have_pthread=yes,
- [AC_CHECK_LIB(pthread, pthread_create)
- if test "x$ac_cv_lib_pthread_pthread_create" = xyes -a x$ac_cv_header_pthread_h = xyes; then
- have_pthread=yes
- else
- dnl *BSD uses -pthread option...
- AC_MSG_CHECKING([for pthread_create using -pthread])
+ if test x$ac_cv_header_pthread_h = xyes; then
+ dnl Check various threading options for the platforms we support
+ for flag in -lpthreads -lpthread -pthread; do
+ AC_MSG_CHECKING([for pthread_create using $flag])
SAVELIBS="$LIBS"
- LIBS="-pthread $LIBS"
+ LIBS="$flag $LIBS"
AC_TRY_LINK([#include <pthread.h>],
[pthread_create(0, 0, 0, 0);],
- LIBS="-pthread $SAVELIBS"
have_pthread=yes,
LIBS="$SAVELIBS")
AC_MSG_RESULT([$have_pthread])
- fi])
+
+ if test $have_pthread = yes; then
+ AC_DEFINE(HAVE_PTHREAD)
+ PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT"
+
+ # Solaris requires -D_POSIX_PTHREAD_SEMANTICS to
+ # be POSIX-compliant... :(
+ if test $uname = SunOS; then
+ PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS"
+ fi
+ break
+ fi
+ done
+ fi
fi
+AC_SUBST(PTHREAD_FLAGS)
+
dnl Define OS-specific stuff...
HLINKS=
POSTBUILD=: