]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | dnl |
503b54c9 | 2 | dnl Threading stuff for CUPS. |
ef416fc2 | 3 | dnl |
76b6aade | 4 | dnl Copyright © 2020-2024 by OpenPrinting. |
82529ea0 MS |
5 | dnl Copyright © 2007-2017 by Apple Inc. |
6 | dnl Copyright © 1997-2005 by Easy Software Products, all rights reserved. | |
ef416fc2 | 7 | dnl |
e3101897 | 8 | dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information. |
ef416fc2 | 9 | dnl |
10 | ||
82529ea0 | 11 | have_pthread="no" |
b423cd4c | 12 | PTHREAD_FLAGS="" |
a356bbb0 | 13 | AC_SUBST([PTHREAD_FLAGS]) |
ef416fc2 | 14 | |
a356bbb0 MS |
15 | AC_CHECK_HEADER([pthread.h], [ |
16 | AC_DEFINE([HAVE_PTHREAD_H], [1], [Do we have the <pthread.h> header?]) | |
17 | ]) | |
ef416fc2 | 18 | |
a356bbb0 MS |
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]) | |
23 | SAVELIBS="$LIBS" | |
24 | LIBS="$flag $LIBS" | |
25 | AC_LINK_IFELSE([ | |
26 | AC_LANG_PROGRAM([[#include <pthread.h>]], [[ | |
27 | pthread_create(0, 0, 0, 0); | |
28 | ]]) | |
29 | ], [ | |
30 | have_pthread="yes" | |
31 | ], [ | |
32 | LIBS="$SAVELIBS" | |
33 | ]) | |
34 | AC_MSG_RESULT([$have_pthread]) | |
b423cd4c | 35 | |
61b0f4a2 | 36 | AS_IF([test $have_pthread = yes], [ |
a356bbb0 | 37 | PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT" |
2abf387c | 38 | |
a356bbb0 MS |
39 | # Solaris requires -D_POSIX_PTHREAD_SEMANTICS to be POSIX- |
40 | # compliant... :( | |
e1cfb900 | 41 | AS_IF([test $host_os_name = sunos -o $host_os_name = solaris], [ |
a356bbb0 | 42 | PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS" |
82529ea0 | 43 | ]) |
a356bbb0 MS |
44 | break |
45 | ]) | |
46 | done | |
82529ea0 | 47 | ]) |
ef416fc2 | 48 | |
a356bbb0 MS |
49 | AS_IF([test $have_pthread = no], [ |
50 | AC_MSG_ERROR([CUPS requires threading support.]) | |
51 | ]) |