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