]> git.ipfire.org Git - thirdparty/cups.git/blob - config-scripts/cups-threads.m4
Remove all of the Subversion keywords from various source files.
[thirdparty/cups.git] / config-scripts / cups-threads.m4
1 dnl
2 dnl Threading stuff for CUPS.
3 dnl
4 dnl Copyright 2007-2011 by Apple Inc.
5 dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
6 dnl
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
11 dnl file is missing or damaged, see the license at "http://www.cups.org/".
12 dnl
13
14 AC_ARG_ENABLE(threads, [ --disable-threads disable multi-threading support])
15
16 have_pthread=no
17 PTHREAD_FLAGS=""
18
19 if test "x$enable_threads" != xno; then
20 AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))
21
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"
36
37 # Solaris requires -D_POSIX_PTHREAD_SEMANTICS to
38 # be POSIX-compliant... :(
39 if test $uname = SunOS; then
40 PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS"
41 fi
42 break
43 fi
44 done
45 fi
46 fi
47
48 AC_SUBST(PTHREAD_FLAGS)