2 dnl Threading stuff for CUPS.
4 dnl Copyright © 2020-2024 by OpenPrinting.
5 dnl Copyright © 2007-2017 by Apple Inc.
6 dnl Copyright © 1997-2005 by Easy Software Products, all rights reserved.
8 dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information.
13 AC_SUBST([PTHREAD_FLAGS])
15 AC_CHECK_HEADER([pthread.h], [
16 AC_DEFINE([HAVE_PTHREAD_H], [1], [Do we have the <pthread.h> header?])
19 AS_IF([test x$ac_cv_header_pthread_h = xyes], [
20 dnl Check various threading options for the platforms we support
21 for flag in -lpthreads -lpthread -pthread; do
22 AC_MSG_CHECKING([for pthread_create using $flag])
26 AC_LANG_PROGRAM([[#include <pthread.h>]], [[
27 pthread_create(0, 0, 0, 0);
34 AC_MSG_RESULT([$have_pthread])
36 AS_IF([test $have_pthread = yes], [
37 PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT"
39 # Solaris requires -D_POSIX_PTHREAD_SEMANTICS to be POSIX-
41 AS_IF([test $host_os_name = sunos -o $host_os_name = solaris], [
42 PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS"
49 AS_IF([test $have_pthread = no], [
50 AC_MSG_ERROR([CUPS requires threading support.])