blob: 624f13440f2fef4b2d85854c21a5681da36854fd [file] [log] [blame]
Emeric Vigier2f625822012-08-06 11:09:52 -04001dnl Copyright (C) 1999-2005 Open Source Telecom Corporation.
2dnl Copyright (C) 2006-2010 David Sugar, Tycho Softworks.
3dnl
4dnl This program is free software; you can redistribute it and/or modify
5dnl it under the terms of the GNU General Public License as published by
6dnl the Free Software Foundation; either version 2 of the License, or
7dnl (at your option) any later version.
8dnl
9dnl This program is distributed in the hope that it will be useful,
10dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12dnl GNU General Public License for more details.
13dnl
14dnl You should have received a copy of the GNU General Public License
15dnl along with this program; if not, write to the Free Software
16dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17dnl
18dnl As a special exception to the GNU General Public License, if you
19dnl distribute this file as part of a program that contains a configuration
20dnl script generated by Autoconf, you may include it under the same
21dnl distribution terms that you use for the rest of that program.
22
23AC_DEFUN([OST_LIB_PTHREAD],
24[
25 AC_REQUIRE([OST_SYS_POSIX])
26 AC_REQUIRE([OST_CC_SYSTIME])
27 THREAD_FLAGS=""
28 THREAD_LIBS=""
29 ost_cv_thread_library="none"
30 ost_cv_rt_library="none"
31 ost_cv_cxx_mode=false
32
33 AC_ARG_WITH(pthread, [ --with-pthread[=lib] using specified pthread library],
34 [if test "$withval" != "" ; then ost_cv_thread_library=$withval ; fi]
35 )
36
37 AC_ARG_WITH(linuxthreads, [ --with-linuxthreads use linux kernel mode library
38 ],[
39 ost_cv_thread_library=lthread
40 AC_DEFINE(WITH_LINUXTHREADS, [1], [bsd system using linuxthreads])
41 if test "$withval" != "yes" ; then
42 THREAD_FLAGS="-D__USE_GNU -D__USE_UNIX98 -I$withval $THREAD_FLAGS"
43 CFLAGS="-D__USE_GNU -D__USE_UNIX98 -I$withval $CFLAGS"
44 else
45 THREAD_FLAGS="-D__USE_GNU -D__USE_UNIX98 -I/usr/local/include/pthread/linuxthreads $THREAD_FLAGS"
46 CFLAGS="-D__USE_GNU -D__USE_UNIX98 -I/usr/local/include/pthread/linuxthreads $CFLAGS"
47 fi
48 ])
49
50 AC_CHECK_HEADERS(pthread.h, [
51 AC_DEFINE(HAVE_PTHREAD_H, [1], [posix thread header])
52 ost_cv_posix_threads=yes],
53 ost_cv_posix_threads=no)
54
55 if test $ost_cv_posix_threads = no ; then
56 AC_LANG_SAVE
57 ac_save_CXXFLAGS="$CXXFLAGS"
58 AC_LANG_CPLUSPLUS
59 CXXFLAGS="$CXXFLAGS -pthread"
60 AC_TRY_COMPILE([#include <pthread.h>],[],
61 AC_DEFINE(HAVE_PTHREAD_H, [1])
62 ost_cv_cxx_mode=true
63 ost_cv_posix_threads=yes)
64 CXXFLAGS="$ac_save_CXXFLAGS"
65 AC_LANG_RESTORE
66 fi
67
68 AC_LANG_SAVE
69 ac_save_CXXFLAGS="$CXXFLAGS"
70 CXXFLAGS=""
71 AC_LANG_CPLUSPLUS
72
73 ost_cv_posix_atomic=no
74 AC_CHECK_HEADERS(sys/atomic_op.h,[
75 AC_DEFINE(HAVE_ATOMIC_AIX, [1], [atomic aix operations])
76 ])
77 AC_CHECK_HEADERS([sys/atomic.h],
78 ost_cv_posix_sys_atomic=yes,
79 ost_cv_posix_sys_atomic=no)
80 if test $ost_cv_posix_sys_atomic = yes ; then
81 AC_MSG_CHECKING([for atomic_t])
82 AC_TRY_COMPILE([#include <sys/atomic.h>],[
83 atomic_t at; at.counter = 1;
84 atomic_dec_and_test(&at);
85 atomic_sub(4, &at);
86 atomic_inc(&at);
87 atomic_add(3, &at);
88 ],[
89 ost_cv_posix_atomic=yes
90 AC_DEFINE(HAVE_WORKING_SYS_ATOMIC_H, [1], [has usable atomic functions])],
91 [ost_cv_posix_atomic=no])
92 AC_MSG_RESULT($ost_cv_posix_atomic)
93 fi
94
95 if test 0 = 1 ; then
96 dnl check for gcc's bits/atomicity and the atomic functions therein
97 AC_CHECK_HEADERS([bits/atomicity.h],
98 ost_cv_bits_atomicity=yes,
99 ost_cv_bits_atomicity=no)
100 if test $ost_cv_bits_atomicity = yes ; then
101 AC_MSG_CHECKING([for _Atomic_word])
102 AC_TRY_COMPILE([#include <bits/atomicity.h>],[
103 _Atomic_word i = 0;
104 __atomic_add(&i, 1);
105 __exchange_and_add(&i, 1);
106 ],
107 [ost_cv_gcc_atomic=yes
108 AC_DEFINE(HAVE_GCC_BITS_ATOMIC, [1], [has gcc atomic functions])],
109 [ost_cv_gcc_atomic=no])
110 AC_MSG_RESULT($ost_cv_gcc_atomic)
111
112 AC_MSG_CHECKING([for __gnu_cxx::_Atomic_word])
113 AC_TRY_COMPILE([#include <bits/atomicity.h>],[
114 using namespace __gnu_cxx;
115 _Atomic_word i = 0;
116 __atomic_add(&i, 1);
117 __exchange_and_add(&i, 1);
118 ],[
119 ost_cv_gcc_cxx_atomic=yes
120 AC_DEFINE(HAVE_GCC_CXX_BITS_ATOMIC, [1],
121 [has __gnu_cxx atomic functions])
122 ],[
123 ost_cv_gcc_cxx_atomic=no
124 ])
125 AC_MSG_RESULT($ost_cv_gcc_cxx_atomic)
126 fi
127 fi
128
129 AC_LANG_RESTORE
130 CXXFLAGS="$ac_save_CXXFLAGS"
131
132 if test "$target" = NONE ; then
133 targetdir=""
134 else
135 targetdir="$target"
136 fi
137
138 AC_CHECK_HEADERS(thread.h)
139 if test "$prefix" = NONE ; then
140 thrprefix="/usr/$targetdir/include"
141 if test -d /usr/$targetdir/sys-include ; then
142 thrprefix="$prefix/$targetdir/sys-include" ; fi
143 else
144 thrprefix="$prefix/$targetdir/include"
145 if test -d "$prefix/$targetdir/sys-include" ; then
146 thrprefix="$prefix/$targetdir/sys-include" ; fi
147 fi
148
149 if test ! -f $thrprefix/thread.h ; then
150 thrprefix=/usr/include
151 fi
152
153 AC_SUBST(thrprefix)
154
155 if test $ost_cv_posix_threads = yes ; then
156 if test "$ost_cv_thread_library" = "none" ; then
157 ost_cv_thread_flags=""
158 for flags in -kthread -pthread -mthreads -pthreads -Kthread --threadsafe -mt ; do
159
160 AC_MSG_CHECKING(whether ${CC-cc} accepts $flags)
161 echo 'void f(){}' >conftest.c
162 if test -z "`${CC-cc} $flags -c conftest.c 2>&1`"; then
163 ost_cv_thread_flags=$flags
164 AC_MSG_RESULT(yes)
165 else
166 AC_MSG_RESULT(no)
167 fi
168 rm -f conftest*
169 if test ! -z "$ost_cv_thread_flags" ; then break ; fi
170 done
171 # if test "$ost_cv_prog_cc_pthread" = "no" ; then
172 # AC_CACHE_CHECK(whether ${CC-cc} accepts -mthreads,
173 # ost_cv_prog_cc_mthreads,
174 # [echo 'void f(){}' >conftest.c
175 # if test -z "`${CC-cc} -mthreads -c conftest.c 2>&1`"; then
176 # ost_cv_prog_cc_mthreads=yes
177 # else
178 # ost_cv_prog_cc_mthreads=no
179 # fi
180 # rm -f conftest*
181 # ])
182 # fi
183 ost_cv_thread_library=none
184 AC_CHECK_LIB(pthread, pthread_self,
185 ost_cv_thread_library=pthread,
186 AC_CHECK_LIB(c_r, pthread_self,
187 ost_cv_thread_library=c_r,
188 AC_CHECK_LIB(pthread, pthread_kill,
189 ost_cv_thread_library=pthread,
190 AC_CHECK_LIB(pthreads, pthread_self,
191 ost_cv_thread_library=pthreads,
192 AC_CHECK_LIB(thread, pthread_self,
193 ost_cv_thread_library=thread)))))
194
195 if test $ost_cv_thread_library = none ; then
196 AC_CHECK_LIB(gthreads, pthread_self,[
197 AC_CHECK_LIB(malloc, malloc)
198 ost_cv_thread_library=gthreads])
199 fi
200 if test $ost_cv_thread_library = none ; then
201 AC_CHECK_LIB(cma, pthread_self,
202 ost_cv_thread_library=cma)
203 fi
204
205 if test $ost_cv_thread_library = none ; then
206 AC_CHECK_LIB(c, pthread_self,
207 ost_cv_thread_library=c)
208 fi
209
210 if test $ost_cv_thread_library = none ; then
211 AC_MSG_ERROR(no library for posix threads found!)
212 fi
213 else
214 # ost_cv_prog_cc_pthread=no
215 # ost_cv_prog_cc_mthreads=no
216 ost_cv_thread_flags=""
217 fi
218
219 AC_CHECK_LIB(${ost_cv_thread_library}, pthread_mach_thread_np,
220 AC_DEFINE(HAVE_PTHREAD_MACH_THREAD_NP, [1], [has mach link])
221 )
222
223 AC_CHECK_LIB(${ost_cv_thread_library}, nanosleep,
224 AC_DEFINE(HAVE_PTHREAD_NANOSLEEP, [1], [has nanosleep]),[
225 AC_CHECK_LIB(posix4, nanosleep,[
226 AC_DEFINE(HAVE_PTHREAD_NANOSLEEP, [1])
227 THREAD_LIBS="$THREAD_LIBS -lposix4"
228 ],[
229 AC_CHECK_LIB(rt, nanosleep,[
230 AC_DEFINE(HAVE_PTHREAD_NANOSLEEP, [1])
231 ost_cv_rt_library="-lrt"])
232 ])
233
234 ])
235
236 AC_CHECK_LIB(rt, clock_gettime,[
237 ost_cv_rt_library="-lrt"
238 AC_DEFINE(HAVE_HIRES_TIMER, [1], [have hires])
239 ],[
240 AC_CHECK_FUNCS(clock_gettime,[
241 AC_DEFINE(HAVE_HIRES_TIMER, [1], [have hires])
242 ])
243 ])
244
245 AC_CHECK_LIB(rt, mlockall,[
246 AC_DEFINE(HAVE_MLOCK, [1], [have mlock])
247 AC_DEFINE(HAVE_MLOCKALL, [1], [have memlockall])
248 ost_cv_rt_library="-lrt"],
249 [
250 AC_CHECK_FUNCS(mlock)
251 AC_CHECK_FUNCS(mlockall)
252 ])
253
254 if test "$ost_cv_rt_library" != "none" ; then
255 THREAD_LIBS="$THREAD_LIBS $ost_cv_rt_library" ; fi
256
257 if test ! -z "$ost_cv_thread_flags" ; then
258 THREAD_LIBS="$THREAD_LIBS $ost_cv_thread_flags" ; fi
259 if test "$ost_cv_thread_library" != "none" -a "$ost_cv_thread_library" != "c" ; then
260 THREAD_LIBS="$THREAD_LIBS -l$ost_cv_thread_library" ; fi
261
262 AC_MSG_CHECKING([if more special flags are required for pthreads])
263 flag=no
264 case "${host_cpu}-${host_os}" in
265 *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";;
266 *solaris* | alpha*-osf*) flag="-D_REENTRANT";;
267 esac
268 AC_MSG_RESULT(${flag})
269 if test "x$flag" != xno; then
270 THREAD_FLAGS="$flag"
271 fi
272
273 AC_SUBST(THREAD_FLAGS)
274 AC_SUBST(THREAD_LIBS)
275# LIBS="$THREAD_LIBS $LIBS"
276 if test "$ost_cv_thread_library" != "lthread" ; then
277 AC_CHECK_HEADERS(pthread_np.h)
278 fi
279 AC_CHECK_HEADERS(semaphore.h)
280 AC_CHECK_HEADERS(sched.h)
281 AC_CHECK_HEADERS(sys/sched.h)
282 AC_CHECK_FUNCS(sched_getscheduler)
283 AC_CACHE_CHECK([for recursive mutex type support], ost_cv_mutex_recursive,
284 [
285 ost_cv_mutex_recursive="none"
286
287 if test "$ost_cv_cxx_mode" = true ; then
288 AC_LANG_SAVE
289 AC_LANG_CPLUSPLUS
290 ac_save_CXXFLAGS="$CXXFLAGS"
291 CXXFLAGS="$CXXFLAGS -pthread"
292 fi
293
294 AC_TRY_COMPILE(
295 [#include <pthread.h>],
296 [
297 #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
298 #ifdef PTHREAD_MUTEX_RECURSIVE
299 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE
300 #endif
301 #endif
302 return (int)PTHREAD_MUTEXTYPE_RECURSIVE;
303 ],
304 ost_cv_mutex_recursive="portable",
305 [
306 AC_EGREP_HEADER(PTHREAD_MUTEXTYPE_RECURSIVE_NP,pthread.h,
307 ost_cv_mutex_recursive=non-portable)
308 AC_EGREP_HEADER(PTHREAD_MUTEX_RECURSIVE_INITIALIZER_NP, pthread.h,
309 ost_cv_mutex_recursive=lthread)
310 AC_EGREP_HEADER(PTHREAD_MUTEX_RECURSIVE_NP,pthread.h,
311 ost_cv_mutex_recursive=linux)
312 AC_EGREP_HEADER(MUTEX_TYPE_COUNTING_FAST,pthread.h,
313 ost_cv_mutex_recursive=counting)
314 ])
315 if test $ost_cv_mutex_recursive = "none" ; then
316 if test $ost_cv_thread_library = "lthread" ; then
317 ost_cv_mutex_recursive=linux
318 fi
319 fi
320 rm -f conftest*
321 ])
322
323 if test $ost_cv_mutex_recursive = "none" ; then
324 AC_TRY_COMPILE(
325 [#include <pthread.h>],
326 [return MUTEX_TYPE_COUNTING_FAST;],
327 ost_cv_mutex_recursive=counting)
328 fi
329
330 if test "$ost_cv_cxx_mode" = true ; then
331 CXXFLAGS="$ac_save_CXXFLAGS"
332 AC_LANG_RESTORE
333 fi
334
335
336 case $ost_cv_mutex_recursive in
337 non-portable)
338 AC_DEFINE(PTHREAD_MUTEXTYPE_RECURSIVE,
339 PTHREAD_MUTEXTYPE_RECURSIVE_NP, [mutex type])
340 ;;
341 linux)
342 AC_DEFINE(PTHREAD_MUTEXTYPE_RECURSIVE,
343 PTHREAD_MUTEX_RECURSIVE_NP)
344 ;;
345 counting)
346 AC_DEFINE(PTHREAD_MUTEXTYPE_RECURSIVE,
347 MUTEX_TYPE_COUNTING_FAST)
348 ;;
349 esac
350
351 AC_CHECK_LIB(${ost_cv_thread_library}, pthread_mutexattr_settype,
352 AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_SETTYPE, [1], [has setttype]),
353 [
354 AC_CHECK_LIB(${ost_cv_thread_library}, pthread_mutexattr_settype_np,
355 AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_SETTYPE_NP,
356 [1], [has non portable settype]))
357 AC_CHECK_LIB(${ost_cv_thread_library}, pthread_mutexattr_setkind_np,
358 AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_SETKIND_NP,
359 [1], [has non portable setkind]))
360 ]
361 )
362
363 ost_cv_thread_rwlock=false
364 AC_CHECK_LIB(${ost_cv_thread_library}, pthread_rwlock_init,[
365 ost_cv_thread_rwlock=true
366 AC_DEFINE(HAVE_PTHREAD_RWLOCK, [1], [has rwlock support])])
367
368 AC_CHECK_LIB(c, pread,[
369 AC_DEFINE(HAVE_PREAD_PWRITE, [1], [has pwrite])],[
370 AC_CHECK_LIB(${ost_cv_thread_library}, pread,[
371 AC_DEFINE(HAVE_PREAD_PWRITE, [1])],[
372 AC_CHECK_LIB(c_r, pread,[AC_DEFINE(HAVE_PREAD_PWRITE)])
373 ])
374 ])
375
376 AC_CHECK_LIB(${ost_cv_thread_library}, pthread_suspend,
377 AC_DEFINE(HAVE_PTHREAD_SUSPEND, [1], [has suspend]))
378
379 AC_CHECK_LIB(${ost_cv_thread_library}, pthread_attr_setstacksize,
380 AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE, [1], [has stack size]))
381
382 AC_CHECK_LIB(${ost_cv_thread_library}, pthread_yield_np,
383 AC_DEFINE(HAVE_PTHREAD_YIELD_NP, [1], [has np yield]),[
384 AC_CHECK_LIB(${ost_cv_thread_library}, pthread_yield,
385 AC_DEFINE(HAVE_PTHREAD_YIELD, [1], [has yield]),[
386 AC_CHECK_LIB(${ost_cv_thread_library}, sched_yield,
387 AC_DEFINE(HAVE_PTHREAD_SCHED_YIELD, [1], [has sched yield]))
388 ])
389 ])
390
391 AC_CHECK_LIB(${ost_cv_thread_library}, pthread_cancel,[
392 AC_DEFINE(HAVE_PTHREAD_CANCEL, [1], [has cancel])
393 AC_CHECK_LIB(${ost_cv_thread_library},
394 pthread_setcanceltype,
395 AC_DEFINE(HAVE_PTHREAD_SETCANCELTYPE, [1], [has setcanceltype]),
396 AC_CHECK_LIB($ost_cv_thread_library, pthread_setcanel,
397 AC_DEFINE(HAVE_PTHREAD_SETCANCEL, [1], [has setcancel])))
398 ],[
399 AC_CHECK_LIB(${ost_cv_thread_library},
400 pthread_setcanceltype,[
401 AC_DEFINE(HAVE_PTHREAD_CANCEL)
402 AC_DEFINE(HAVE_PTHREAD_SETCANCELTYPE)])
403
404 ])
405
406 AC_CHECK_LIB(${ost_cv_thread_library}, pthread_delay_np,
407 AC_DEFINE(HAVE_PTHREAD_DELAY_NP, [1], [has non portable delay]))
408
409 fi
410
411 UNAME=`uname`
412 if test "$UNAME" = "AIX" ; then
413 AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
414 CC=$PTHREAD_CC
415 AC_DEFINE(COMMON_AIX_FIXES, [1], [aix fixes needed])
416 fi
417
418 AH_BOTTOM([
419#ifdef HAVE_THREAD_H
420#include "@thrprefix@/thread.h"
421#if defined(i386) && defined(__svr4__) && !defined(__sun)
422#define _THR_UNIXWARE
423#endif
424#if defined(__SVR4) && defined(__sun)
425#define _THR_SUNOS5
426#else
427#if defined(__SVR4__) && defined(__SUN__)
428#define _THR_SUNOS5
429#endif
430#endif
431#endif
432
433#ifdef HAVE_WORKING_SYS_ATOMIC_H
434#include <sys/atomic.h>
435#define HAVE_ATOMIC
436#elif defined(HAVE_ATOMIC_AIX)
437#include <sys/atomic_op.h>
438#ifndef HAVE_ATOMIC
439#define HAVE_ATOMIC
440#endif
441#endif
442
443#if defined(__cplusplus)
444#if defined(HAVE_GCC_BITS_ATOMIC) || defined(HAVE_GCC_CXX_BITS_ATOMIC)
445#include <bits/atomicity.h>
446#define HAVE_ATOMIC
447#endif
448#endif
449
450#if defined(HAVE_PTHREAD_H) && ( defined(_THREAD_SAFE) || defined(_REENTRANT) )
451
452#ifdef __QNX__
453#define __EXT_QNX
454#endif
455
456#include <pthread.h>
457
458#ifdef HAVE_PTHREAD_NP_H
459#include <pthread_np.h>
460#endif
461
462#ifdef HAVE_SEMAPHORE_H
463#include <semaphore.h>
464#endif
465#ifdef _POSIX_PRIORITY_SCHEDULING
466#ifdef HAVE_SCHED_H
467#include <sched.h>
468#else
469#ifdef HAVE_SYS_SCHED_H
470#include <sys/sched.h>
471#endif
472#endif
473#endif
474
475#define __PTHREAD_H__
476#ifndef PTHREAD_MUTEXTYPE_RECURSIVE
477#ifdef MUTEX_TYPE_COUNTING_FAST
478#define PTHREAD_MUTEXTYPE_RECURSIVE MUTEX_TYPE_COUNTING_FAST
479#endif
480#endif
481#ifndef PTHREAD_MUTEXTYPE_RECURSIVE
482#ifdef PTHREAD_MUTEX_RECURSIVE
483#define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE
484#endif
485#endif
486#ifndef HAVE_PTHREAD_MUTEXATTR_SETTYPE
487#if HAVE_PTHREAD_MUTEXATTR_SETKIND_NP
488#ifndef PTHREAD_MUTEXTYPE_RECURSIVE
489#define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
490#endif
491#define pthread_mutexattr_gettype(x, y) pthread_mutexattr_getkind_np(x, y)
492#define pthread_mutexattr_settype(x, y) pthread_mutexattr_setkind_np(x, y)
493#endif
494#if HAVE_PTHREAD_MUTEXATTR_SETTYPE_NP
495#ifndef PTHREAD_MUTEXTYPE_RECURSIVE
496#define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEXTYPE_RECURSIVE_NP
497#endif
498#define pthread_mutexattr_settype(x, y) pthread_mutexattr_settype_np(x, y)
499#define pthread_mutexattr_gettype(x, y) pthread_mutexattr_gettype_np(x, y)
500#endif
501#endif
502
503#ifdef HAVE_PTHREAD_MACH_THREAD_NP
504#define _THR_MACH
505#endif
506
507#ifndef HAVE_PTHREAD_YIELD
508#ifdef HAVE_PTHREAD_YIELD_NP
509#define pthread_yield() pthread_yield_np()
510#define HAVE_PTHREAD_YIELD
511#endif
512#endif
513
514#ifndef HAVE_PTHREAD_YIELD
515#ifdef HAVE_PTHREAD_SCHED_YIELD
516#define pthread_yield() sched_yield()
517#define HAVE_PTHREAD_YIELD
518#endif
519#endif
520
521#ifndef HAVE_PTHREAD_DELAY
522#ifdef HAVE_PTHREAD_DELAY_NP
523#define HAVE_PTHREAD_DELAY
524#define pthread_delay(x) pthread_delay_np(x)
525#endif
526#if defined(HAVE_PTHREAD_NANOSLEEP)
527#ifndef HAVE_PTHREAD_DELAY
528#define HAVE_PTHREAD_DELAY
529#ifdef __FreeBSD__
530#ifdef __cplusplus
531extern "C" int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
532#endif
533#endif
534#define pthread_delay(x) nanosleep(x, NULL)
535#endif
536#endif
537#endif
538
539#ifdef HAVE_PTHREAD_ATTR_SETSTACK
540#ifndef PTHREAD_STACK_MIN
541#define PTHREAD_STACK_MIN 32768
542#endif
543#endif
544
545#ifndef HAVE_PTHREAD_CANCEL
546#ifdef SIGCANCEL
547#define CCXX_SIG_THREAD_CANCEL SIGCANCEL
548#else
549#define CCXX_SIG_THREAD_CANCEL SIGQUIT
550#endif
551#define pthread_cancel(x) pthread_kill(x, CCXX_SIG_THREAD_CANCEL)
552#define pthread_setcanceltype(x, y)
553#define pthread_setcancelstate(x, y)
554#endif
555
556#ifndef HAVE_PTHREAD_SETCANCELTYPE
557#ifdef HAVE_PTHREAD_SETCANCEL
558enum
559{ PTHREAD_CANCEL_ASYNCHRONOUS = CANCEL_ON,
560 PTHREAD_CANCEL_DEFERRED = CANCEL_OFF};
561enum
562{ PTHREAD_CANCEL_ENABLE = CANCEL_ON,
563 PTHREAD_CANCEL_DISABLE = CANCEL_OFF};
564#define pthread_setcancelstate(x, y) \
565 (y == NULL) ? pthread_setcancel(x) : *y = pthread_setcancel
566#define pthread_setcanceltype(x, y) \
567 (y == NULL) ? pthread_setasynccancel(x) | *y = pthread_setasynccancel(x)
568#else
569#define pthread_setcanceltype(x, y)
570#define pthread_setcancelstate(x, y)
571#endif
572#endif
573
574#ifdef _AIX
575#ifdef HAVE_PTHREAD_SUSPEND
576#undef HAVE_PTHREAD_SUSPEND
577#endif
578#endif
579
580#endif
581
582
583 ])
584
585])
586