]> git.ipfire.org Git - thirdparty/cups.git/blob - config-scripts/cups-threads.m4
Load cups into easysw/current.
[thirdparty/cups.git] / config-scripts / cups-threads.m4
1 dnl
2 dnl "$Id: cups-threads.m4 6649 2007-07-11 21:46:42Z mike $"
3 dnl
4 dnl Threading stuff for the Common UNIX Printing System (CUPS).
5 dnl
6 dnl Copyright 2007 by Apple Inc.
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
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/".
14 dnl
15
16 AC_ARG_ENABLE(threads, [ --enable-threads enable multi-threading support])
17
18 have_pthread=no
19 PTHREAD_FLAGS=""
20
21 if test "x$enable_threads" != xno; then
22 AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))
23
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"
38
39 # Solaris requires -D_POSIX_PTHREAD_SEMANTICS to
40 # be POSIX-compliant... :(
41 if test $uname = SunOS; then
42 PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS"
43 fi
44 break
45 fi
46 done
47 fi
48 fi
49
50 AC_SUBST(PTHREAD_FLAGS)
51
52 dnl
53 dnl End of "$Id: cups-threads.m4 6649 2007-07-11 21:46:42Z mike $".
54 dnl