]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | dnl |
503b54c9 | 2 | dnl Threading stuff for CUPS. |
ef416fc2 | 3 | dnl |
503b54c9 MS |
4 | dnl Copyright 2007-2011 by Apple Inc. |
5 | dnl Copyright 1997-2005 by Easy Software Products, all rights reserved. | |
ef416fc2 | 6 | dnl |
503b54c9 MS |
7 | dnl These coded instructions, statements, and computer programs are the |
8 | dnl property of Apple Inc. and are protected by Federal copyright | |
9 | dnl law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
10 | dnl which should have been included with this file. If this file is | |
57b7b66b | 11 | dnl missing or damaged, see the license at "http://www.cups.org/". |
ef416fc2 | 12 | dnl |
13 | ||
bf3816c7 | 14 | AC_ARG_ENABLE(threads, [ --disable-threads disable multi-threading support]) |
ef416fc2 | 15 | |
16 | have_pthread=no | |
b423cd4c | 17 | PTHREAD_FLAGS="" |
ef416fc2 | 18 | |
19 | if test "x$enable_threads" != xno; then | |
20 | AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H)) | |
ef416fc2 | 21 | |
b423cd4c | 22 | if test x$ac_cv_header_pthread_h = xyes; then |
23 | dnl Check various threading options for the platforms we support | |
24 | for flag in -lpthreads -lpthread -pthread; do | |
25 | AC_MSG_CHECKING([for pthread_create using $flag]) | |
26 | SAVELIBS="$LIBS" | |
27 | LIBS="$flag $LIBS" | |
28 | AC_TRY_LINK([#include <pthread.h>], | |
29 | [pthread_create(0, 0, 0, 0);], | |
30 | have_pthread=yes, | |
31 | LIBS="$SAVELIBS") | |
32 | AC_MSG_RESULT([$have_pthread]) | |
33 | ||
34 | if test $have_pthread = yes; then | |
35 | PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT" | |
2abf387c | 36 | |
26d47ec6 | 37 | # Solaris requires -D_POSIX_PTHREAD_SEMANTICS to |
2abf387c | 38 | # be POSIX-compliant... :( |
39 | if test $uname = SunOS; then | |
26d47ec6 | 40 | PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS" |
2abf387c | 41 | fi |
b423cd4c | 42 | break |
43 | fi | |
44 | done | |
ef416fc2 | 45 | fi |
46 | fi | |
47 | ||
b423cd4c | 48 | AC_SUBST(PTHREAD_FLAGS) |