bits
[heimdal.git] / cf / pthreads.m4
blob3b36047b5673ca9d1e08c51c03f881a48a3304e1
1 Dnl $Id$
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])
11 case "$host" in 
12 *-*-solaris2*)
13         native_pthread_support=yes
14         if test "$GCC" = yes; then
15                 PTHREADS_CFLAGS=-pthreads
16                 PTHREAD_LIBADD=-pthreads
17         else
18                 PTHREADS_CFLAGS=-mt
19                 PTHREAD_LDADD=-mt
20                 PTHREAD_LIBADD=-mt
21         fi
22         ;;
23 *-*-netbsd[[12]]*)
24         native_pthread_support="if running netbsd 1.6T or newer"
25         dnl heim_threads.h knows this
26         PTHREAD_LIBADD="-lpthread"
27         ;;
28 *-*-netbsd[[3456789]]*)
29         native_pthread_support="netbsd 3 uses explict pthread"
30         dnl heim_threads.h knows this
31         PTHREAD_LIBADD="-lpthread"
32         ;;
33 *-*-freebsd[[56]]*)
34         native_pthread_support=yes
35         ;;
36 *-*-freebsd[[789]]*)
37         native_pthread_support=yes
38         PTHREADS_LIBADD="-lpthread"
39         ;;
40 *-*-openbsd*)
41         native_pthread_support=yes
42         PTHREADS_CFLAGS=-pthread
43         PTHREAD_LIBADD=-pthread
44         ;;
45 *-*-linux* | *-*-linux-gnu)
46         case `uname -r` in
47         2.*)
48                 native_pthread_support=yes
49                 PTHREADS_CFLAGS=-pthread
50                 PTHREAD_LIBADD=-pthread
51                 ;;
52         esac
53         ;;
54 *-*-kfreebsd*-gnu*)
55         native_pthread_support=yes
56         PTHREADS_CFLAGS=-pthread
57         PTHREAD_LIBADD=-pthread
58         ;;
59 *-*-aix*)
60         dnl AIX is disabled since we don't handle the utmp/utmpx
61         dnl problems that aix causes when compiling with pthread support
62         native_pthread_support=no
63         ;;
64 mips-sgi-irix6.[[5-9]])  # maybe works for earlier versions too
65         native_pthread_support=yes
66         PTHREAD_LIBADD="-lpthread"
67         ;;
68 *-*-darwin*)
69         native_pthread_support=yes
70         ;;
72         native_pthread_support=no
73         ;;
74 esac
76 if test "$enable_pthread_support" = maybe ; then
77         enable_pthread_support="$native_pthread_support"
79         
80 if test "$enable_pthread_support" != no; then
81     AC_DEFINE(ENABLE_PTHREAD_SUPPORT, 1,
82         [Define if you want have a thread safe libraries])
83     dnl This sucks, but libtool doesn't save the depenecy on -pthread
84     dnl for libraries.
85     LIBS="$PTHREAD_LIBADD $LIBS"
86 else
87   PTHREADS_CFLAGS=""
88   PTHREAD_LIBADD=""
89   PTHREADS_LIBADD=""
92 AC_SUBST(PTHREADS_CFLAGS)
93 AC_SUBST(PTHREAD_LDADD)
94 AC_SUBST(PTHREADS_LIBADD)
96 AC_MSG_RESULT($enable_pthread_support)