2 dnl Threading stuff for CUPS.
4 dnl Copyright 2007-2017 by Apple Inc.
5 dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
7 dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information.
10 AC_ARG_ENABLE(threads, [ --disable-threads disable multi-threading support])
15 if test "x$enable_threads" != xno; then
16 AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))
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])
24 AC_TRY_LINK([#include <pthread.h>],
25 [pthread_create(0, 0, 0, 0);],
28 AC_MSG_RESULT([$have_pthread])
30 if test $have_pthread = yes; then
31 PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT"
33 # Solaris requires -D_POSIX_PTHREAD_SEMANTICS to
34 # be POSIX-compliant... :(
35 if test $host_os_name = sunos; then
36 PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS"
44 AC_SUBST(PTHREAD_FLAGS)