3 AC_DEFUN([KRB_PTHREADS], [
4 AC_MSG_CHECKING(if compiling threadsafe libraries)
6 AC_ARG_ENABLE(pthread-support,
7 AS_HELP_STRING([--enable-pthread-support],
8 [if you want thread safe libraries]),
9 [],[enable_pthread_support=maybe])
13 native_pthread_support=yes
14 if test "$GCC" = yes; then
15 PTHREAD_CFLAGS="-D_REENTRANT -D_TS_ERRNO"
16 PTHREAD_LIBADD=-lpthread
18 PTHREAD_CFLAGS="-mt -D_REENTRANT -D_TS_ERRNO"
20 PTHREAD_LIBADD="-mt -lpthread"
24 native_pthread_support="if running netbsd 1.6T or newer"
25 dnl heim_threads.h knows this
26 PTHREAD_LIBADD="-lpthread"
28 *-*-netbsd[[3456789]]*)
29 native_pthread_support="netbsd 3 uses explict pthread"
30 dnl heim_threads.h knows this
31 PTHREAD_LIBADD="-lpthread"
36 native_pthread_support=yes
37 PTHREAD_LIBADD="-pthread"
40 native_pthread_support=yes
41 PTHREAD_CFLAGS=-pthread
42 PTHREAD_LIBADD=-pthread
45 native_pthread_support=yes
46 PTHREADS_CFLAGS=-pthread
47 PTHREAD_LIBADD="-pthread -lpthread"
49 *-*-linux* | *-*-linux-gnu)
52 native_pthread_support=yes
53 PTHREAD_CFLAGS=-pthread
54 PTHREAD_LIBADD=-pthread
59 native_pthread_support=yes
60 PTHREAD_CFLAGS=-pthread
61 PTHREAD_LIBADD=-pthread
64 dnl AIX is disabled since we don't handle the utmp/utmpx
65 dnl problems that aix causes when compiling with pthread support
66 native_pthread_support=no
68 mips-sgi-irix6.[[5-9]]) # maybe works for earlier versions too
69 native_pthread_support=yes
70 PTHREAD_LIBADD="-lpthread"
73 native_pthread_support=yes
76 native_pthread_support=no
80 if test "$enable_pthread_support" = maybe ; then
81 enable_pthread_support="$native_pthread_support"
84 if test "$enable_pthread_support" != no; then
85 AC_DEFINE(ENABLE_PTHREAD_SUPPORT, 1,
86 [Define if you want have a thread safe libraries])
87 dnl This sucks, but libtool doesn't save the depenecy on -pthread
89 LIBS="$PTHREAD_LIBADD $LIBS"
95 AM_CONDITIONAL(ENABLE_PTHREAD_SUPPORT, test "$enable_pthread_support" != no)
97 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
98 LDADD="$LDADD $PTHREAD_LDADD"
99 LIBADD="$LIBADD $PTHREAD_LIBADD"
101 AC_SUBST(PTHREAD_CFLAGS)
102 AC_SUBST(PTHREAD_LDADD)
103 AC_SUBST(PTHREAD_LIBADD)
105 AC_MSG_RESULT($enable_pthread_support)