summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.in33
-rwxr-xr-xfltk-config.in4
-rw-r--r--makeinclude.in4
3 files changed, 26 insertions, 15 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=:
diff --git a/fltk-config.in b/fltk-config.in
index ab70c6788..37eb6a069 100755
--- a/fltk-config.in
+++ b/fltk-config.in
@@ -54,8 +54,8 @@ POSTBUILD="@POSTBUILD@"
# flags for C++ compiler:
ARCHFLAGS="@ARCHFLAGS@"
-CFLAGS="@CFLAGS@ @LARGEFILE@"
-CXXFLAGS="@CXXFLAGS@ @LARGEFILE@"
+CFLAGS="@CFLAGS@ @LARGEFILE@ @PTHREAD_FLAGS@"
+CXXFLAGS="@CXXFLAGS@ @LARGEFILE@ @PTHREAD_FLAGS@"
LDFLAGS="@LDFLAGS@"
LDLIBS="@LIBS@"
diff --git a/makeinclude.in b/makeinclude.in
index 3a08796ab..9d169e9a5 100644
--- a/makeinclude.in
+++ b/makeinclude.in
@@ -56,8 +56,8 @@ MAKEDEPEND = @MAKEDEPEND@
# flags for C++ compiler:
ARCHFLAGS = @ARCHFLAGS@
OPTIM = @OPTIM@
-CFLAGS = $(OPTIM) @LARGEFILE@ @CPPFLAGS@ @CFLAGS@
-CXXFLAGS = $(OPTIM) @LARGEFILE@ @CPPFLAGS@ @CXXFLAGS@
+CFLAGS = $(OPTIM) @LARGEFILE@ @PTHREAD_FLAGS@ @CPPFLAGS@ @CFLAGS@
+CXXFLAGS = $(OPTIM) @LARGEFILE@ @PTHREAD_FLAGS@ @CPPFLAGS@ @CXXFLAGS@
# program to make the archive:
LIBNAME = @LIBNAME@