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
This commit is contained in:
parent
1c61b1297d
commit
47fb93aa3c
33
configure.in
33
configure.in
@ -540,29 +540,40 @@ AC_EXEEXT
|
|||||||
|
|
||||||
dnl Check for pthreads for multi-threaded apps...
|
dnl Check for pthreads for multi-threaded apps...
|
||||||
have_pthread=no
|
have_pthread=no
|
||||||
|
PTHREAD_FLAGS=""
|
||||||
|
|
||||||
if test "x$enable_threads" = xyes; then
|
if test "x$enable_threads" = xyes; then
|
||||||
AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))
|
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
|
if test x$ac_cv_header_pthread_h = xyes; then
|
||||||
have_pthread=yes
|
dnl Check various threading options for the platforms we support
|
||||||
else
|
for flag in -lpthreads -lpthread -pthread; do
|
||||||
dnl *BSD uses -pthread option...
|
AC_MSG_CHECKING([for pthread_create using $flag])
|
||||||
AC_MSG_CHECKING([for pthread_create using -pthread])
|
|
||||||
SAVELIBS="$LIBS"
|
SAVELIBS="$LIBS"
|
||||||
LIBS="-pthread $LIBS"
|
LIBS="$flag $LIBS"
|
||||||
AC_TRY_LINK([#include <pthread.h>],
|
AC_TRY_LINK([#include <pthread.h>],
|
||||||
[pthread_create(0, 0, 0, 0);],
|
[pthread_create(0, 0, 0, 0);],
|
||||||
LIBS="-pthread $SAVELIBS"
|
|
||||||
have_pthread=yes,
|
have_pthread=yes,
|
||||||
LIBS="$SAVELIBS")
|
LIBS="$SAVELIBS")
|
||||||
AC_MSG_RESULT([$have_pthread])
|
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
|
fi
|
||||||
|
|
||||||
|
AC_SUBST(PTHREAD_FLAGS)
|
||||||
|
|
||||||
dnl Define OS-specific stuff...
|
dnl Define OS-specific stuff...
|
||||||
HLINKS=
|
HLINKS=
|
||||||
POSTBUILD=:
|
POSTBUILD=:
|
||||||
|
@ -54,8 +54,8 @@ POSTBUILD="@POSTBUILD@"
|
|||||||
|
|
||||||
# flags for C++ compiler:
|
# flags for C++ compiler:
|
||||||
ARCHFLAGS="@ARCHFLAGS@"
|
ARCHFLAGS="@ARCHFLAGS@"
|
||||||
CFLAGS="@CFLAGS@ @LARGEFILE@"
|
CFLAGS="@CFLAGS@ @LARGEFILE@ @PTHREAD_FLAGS@"
|
||||||
CXXFLAGS="@CXXFLAGS@ @LARGEFILE@"
|
CXXFLAGS="@CXXFLAGS@ @LARGEFILE@ @PTHREAD_FLAGS@"
|
||||||
LDFLAGS="@LDFLAGS@"
|
LDFLAGS="@LDFLAGS@"
|
||||||
LDLIBS="@LIBS@"
|
LDLIBS="@LIBS@"
|
||||||
|
|
||||||
|
@ -56,8 +56,8 @@ MAKEDEPEND = @MAKEDEPEND@
|
|||||||
# flags for C++ compiler:
|
# flags for C++ compiler:
|
||||||
ARCHFLAGS = @ARCHFLAGS@
|
ARCHFLAGS = @ARCHFLAGS@
|
||||||
OPTIM = @OPTIM@
|
OPTIM = @OPTIM@
|
||||||
CFLAGS = $(OPTIM) @LARGEFILE@ @CPPFLAGS@ @CFLAGS@
|
CFLAGS = $(OPTIM) @LARGEFILE@ @PTHREAD_FLAGS@ @CPPFLAGS@ @CFLAGS@
|
||||||
CXXFLAGS = $(OPTIM) @LARGEFILE@ @CPPFLAGS@ @CXXFLAGS@
|
CXXFLAGS = $(OPTIM) @LARGEFILE@ @PTHREAD_FLAGS@ @CPPFLAGS@ @CXXFLAGS@
|
||||||
|
|
||||||
# program to make the archive:
|
# program to make the archive:
|
||||||
LIBNAME = @LIBNAME@
|
LIBNAME = @LIBNAME@
|
||||||
|
Loading…
x
Reference in New Issue
Block a user