fix depenecies for make-roken
[heimdal.git] / cf / pthreads.m4
blobf08a9fe1f0293cf49debd22c30876fa8aa1ce85c
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 *-*-freebsd5*)
33         native_pthread_support=yes
34         ;;
35 *-*-openbsd*)
36         native_pthread_support=yes
37         PTHREADS_CFLAGS=-pthread
38         PTHREADS_LIBS=-pthread
39         ;;
40 *-*-linux* | *-*-linux-gnu)
41         case `uname -r` in
42         2.*)
43                 native_pthread_support=yes
44                 PTHREADS_CFLAGS=-pthread
45                 PTHREADS_LIBS=-pthread
46                 ;;
47         esac
48         ;;
49 *-*-kfreebsd*-gnu*)
50         native_pthread_support=yes
51         PTHREADS_CFLAGS=-pthread
52         PTHREADS_LIBS=-pthread
53         ;;
54 *-*-aix*)
55         dnl AIX is disabled since we don't handle the utmp/utmpx
56         dnl problems that aix causes when compiling with pthread support
57         native_pthread_support=no
58         ;;
59 mips-sgi-irix6.[[5-9]])  # maybe works for earlier versions too
60         native_pthread_support=yes
61         PTHREADS_LIBS="-lpthread"
62         ;;
63 *-*-darwin*)
64         native_pthread_support=yes
65         ;;
67         native_pthread_support=no
68         ;;
69 esac
71 if test "$enable_pthread_support" = maybe ; then
72         enable_pthread_support="$native_pthread_support"
74         
75 if test "$enable_pthread_support" != no; then
76     AC_DEFINE(ENABLE_PTHREAD_SUPPORT, 1,
77         [Define if you want have a thread safe libraries])
78     dnl This sucks, but libtool doesn't save the depenecy on -pthread
79     dnl for libraries.
80     LIBS="$PTHREADS_LIBS $LIBS"
81 else
82   PTHREADS_CFLAGS=""
83   PTHREADS_LIBS=""
86 AC_SUBST(PTHREADS_CFLAGS)
87 AC_SUBST(PTHREADS_LIBS)
89 AC_MSG_RESULT($enable_pthread_support)