23224: x
[heimdal.git] / cf / pthreads.m4
blob57d7dacba4483b14b0a21340b9e475991a52ea3a
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*)
23         native_pthread_support="if running netbsd 1.6T or newer"
24         dnl heim_threads.h knows this
25         PTHREADS_LIBS=""
26         ;;
27 *-*-freebsd5*)
28         native_pthread_support=yes
29         ;;
30 *-*-openbsd*)
31         native_pthread_support=yes
32         PTHREADS_CFLAGS=-pthread
33         PTHREADS_LIBS=-pthread
34         ;;
35 *-*-linux* | *-*-linux-gnu)
36         case `uname -r` in
37         2.*)
38                 native_pthread_support=yes
39                 PTHREADS_CFLAGS=-pthread
40                 PTHREADS_LIBS=-pthread
41                 ;;
42         esac
43         ;;
44 *-*-aix*)
45         dnl AIX is disabled since we don't handle the utmp/utmpx
46         dnl problems that aix causes when compiling with pthread support
47         native_pthread_support=no
48         ;;
49 mips-sgi-irix6.[[5-9]])  # maybe works for earlier versions too
50         native_pthread_support=yes
51         PTHREADS_LIBS="-lpthread"
52         ;;
53 *-*-darwin*)
54         native_pthread_support=yes
55         ;;
57         native_pthread_support=no
58         ;;
59 esac
61 if test "$enable_pthread_support" = maybe ; then
62         enable_pthread_support="$native_pthread_support"
64         
65 if test "$enable_pthread_support" != no; then
66     AC_DEFINE(ENABLE_PTHREAD_SUPPORT, 1,
67         [Define if you want have a thread safe libraries])
68     dnl This sucks, but libtool doesn't save the depenecy on -pthread
69     dnl for libraries.
70     LIBS="$PTHREADS_LIBS $LIBS"
71 else
72   PTHREADS_CFLAGS=""
73   PTHREADS_LIBS=""
76 AC_SUBST(PTHREADS_CFLAGS)
77 AC_SUBST(PTHREADS_LIBS)
79 AC_MSG_RESULT($enable_pthread_support)