]> git.ipfire.org Git - thirdparty/cups.git/blame - config-scripts/cups-threads.m4
Changelog.
[thirdparty/cups.git] / config-scripts / cups-threads.m4
CommitLineData
ef416fc2 1dnl
503b54c9 2dnl Threading stuff for CUPS.
ef416fc2 3dnl
105922ec 4dnl Copyright 2007-2017 by Apple Inc.
503b54c9 5dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
ef416fc2 6dnl
e3101897 7dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information.
ef416fc2 8dnl
9
bf3816c7 10AC_ARG_ENABLE(threads, [ --disable-threads disable multi-threading support])
ef416fc2 11
12have_pthread=no
b423cd4c 13PTHREAD_FLAGS=""
ef416fc2 14
15if test "x$enable_threads" != xno; then
16 AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))
ef416fc2 17
b423cd4c 18 if test x$ac_cv_header_pthread_h = xyes; then
19 dnl Check various threading options for the platforms we support
20 for flag in -lpthreads -lpthread -pthread; do
21 AC_MSG_CHECKING([for pthread_create using $flag])
22 SAVELIBS="$LIBS"
23 LIBS="$flag $LIBS"
24 AC_TRY_LINK([#include <pthread.h>],
25 [pthread_create(0, 0, 0, 0);],
26 have_pthread=yes,
27 LIBS="$SAVELIBS")
28 AC_MSG_RESULT([$have_pthread])
29
30 if test $have_pthread = yes; then
31 PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT"
2abf387c 32
26d47ec6 33 # Solaris requires -D_POSIX_PTHREAD_SEMANTICS to
2abf387c 34 # be POSIX-compliant... :(
105922ec 35 if test $host_os_name = sunos; then
26d47ec6 36 PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS"
2abf387c 37 fi
b423cd4c 38 break
39 fi
40 done
ef416fc2 41 fi
42fi
43
b423cd4c 44AC_SUBST(PTHREAD_FLAGS)