summaryrefslogtreecommitdiff
path: root/config-scripts/cups-threads.m4
diff options
context:
space:
mode:
Diffstat (limited to 'config-scripts/cups-threads.m4')
-rw-r--r--config-scripts/cups-threads.m432
1 files changed, 19 insertions, 13 deletions
diff --git a/config-scripts/cups-threads.m4 b/config-scripts/cups-threads.m4
index 788ce838c..639eb7414 100644
--- a/config-scripts/cups-threads.m4
+++ b/config-scripts/cups-threads.m4
@@ -25,26 +25,32 @@ dnl
AC_ARG_ENABLE(threads, [ --enable-threads enable multi-threading support])
have_pthread=no
+PTHREAD_FLAGS=""
if test "x$enable_threads" != xno; then
AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))
- 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])
- SAVELIBS="$LIBS"
- LIBS="-pthread $LIBS"
- AC_TRY_LINK([#include <pthread.h>],
- [pthread_create(0, 0, 0, 0);],
- have_pthread=yes,
- LIBS="$SAVELIBS")
- AC_MSG_RESULT([$have_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="$flag $LIBS"
+ AC_TRY_LINK([#include <pthread.h>],
+ [pthread_create(0, 0, 0, 0);],
+ have_pthread=yes,
+ LIBS="$SAVELIBS")
+ AC_MSG_RESULT([$have_pthread])
+
+ if test $have_pthread = yes; then
+ PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT"
+ break
+ fi
+ done
fi
fi
+AC_SUBST(PTHREAD_FLAGS)
dnl
dnl End of "$Id$".