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