]> git.ipfire.org Git - thirdparty/cups.git/blame - config-scripts/cups-threads.m4
Import CUPS v2.0b1
[thirdparty/cups.git] / config-scripts / cups-threads.m4
CommitLineData
ef416fc2 1dnl
1a18c85c 2dnl "$Id: cups-threads.m4 11324 2013-10-04 03:11:42Z msweet $"
ef416fc2 3dnl
321d8d57 4dnl Threading stuff for CUPS.
ef416fc2 5dnl
321d8d57 6dnl Copyright 2007-2011 by Apple Inc.
ef416fc2 7dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
8dnl
9dnl These coded instructions, statements, and computer programs are the
bc44d920 10dnl property of Apple Inc. and are protected by Federal copyright
11dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
12dnl which should have been included with this file. If this file is
13dnl file is missing or damaged, see the license at "http://www.cups.org/".
ef416fc2 14dnl
15
bf3816c7 16AC_ARG_ENABLE(threads, [ --disable-threads disable multi-threading support])
ef416fc2 17
18have_pthread=no
b423cd4c 19PTHREAD_FLAGS=""
ef416fc2 20
21if 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
48fi
49
b423cd4c 50AC_SUBST(PTHREAD_FLAGS)
ef416fc2 51
52dnl
1a18c85c 53dnl End of "$Id: cups-threads.m4 11324 2013-10-04 03:11:42Z msweet $".
ef416fc2 54dnl