1dnl 2dnl Threading stuff for CUPS. 3dnl 4dnl Copyright 2007-2017 by Apple Inc. 5dnl Copyright 1997-2005 by Easy Software Products, all rights reserved. 6dnl 7dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information. 8dnl 9 10AC_ARG_ENABLE(threads, [ --disable-threads disable multi-threading support]) 11 12have_pthread=no 13PTHREAD_FLAGS="" 14 15if test "x$enable_threads" != xno; then 16 AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H)) 17 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" 32 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" 37 fi 38 break 39 fi 40 done 41 fi 42fi 43 44AC_SUBST(PTHREAD_FLAGS) 45