afslog.1: Remove documentation for removed no-v4 argument.
[heimdal.git] / cf / pthreads.m4
blobcdcab3a2c49431610212ec51648b511ea5cac6cc
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                 PTHREAD_CFLAGS="-D_REENTRANT -D_TS_ERRNO"
16                 PTHREAD_LIBADD=-lpthread
17         else
18                 PTHREAD_CFLAGS="-mt -D_REENTRANT -D_TS_ERRNO"
19                 PTHREAD_LDADD=-mt
20                 PTHREAD_LIBADD="-mt -lpthread"
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[[56789]]*)
34         native_pthread_support=yes
35         PTHREAD_LIBADD="-pthread"
36         ;;
37 *-*-openbsd*)
38         native_pthread_support=yes
39         PTHREAD_CFLAGS=-pthread
40         PTHREAD_LIBADD=-pthread
41         ;;
42 *-*-gnu*)
43         native_pthread_support=yes
44         PTHREADS_CFLAGS=-pthread
45         PTHREAD_LIBADD="-pthread -lpthread"
46         ;;
47 *-*-linux* | *-*-linux-gnu)
48         case `uname -r` in
49         2.*|3.*)
50                 native_pthread_support=yes
51                 PTHREAD_CFLAGS=-pthread
52                 PTHREAD_LIBADD=-pthread
53                 ;;
54         esac
55         ;;
56 *-*-kfreebsd*-gnu*)
57         native_pthread_support=yes
58         PTHREAD_CFLAGS=-pthread
59         PTHREAD_LIBADD=-pthread
60         ;;
61 *-*-aix*)
62         dnl AIX is disabled since we don't handle the utmp/utmpx
63         dnl problems that aix causes when compiling with pthread support
64         native_pthread_support=no
65         ;;
66 mips-sgi-irix6.[[5-9]])  # maybe works for earlier versions too
67         native_pthread_support=yes
68         PTHREAD_LIBADD="-lpthread"
69         ;;
70 *-*-darwin*)
71         native_pthread_support=yes
72         ;;
74         native_pthread_support=no
75         ;;
76 esac
78 if test "$enable_pthread_support" = maybe ; then
79         enable_pthread_support="$native_pthread_support"
81         
82 if test "$enable_pthread_support" != no; then
83     AC_DEFINE(ENABLE_PTHREAD_SUPPORT, 1,
84         [Define if you want have a thread safe libraries])
85     dnl This sucks, but libtool doesn't save the depenecy on -pthread
86     dnl for libraries.
87     LIBS="$PTHREAD_LIBADD $LIBS"
88 else
89   PTHREAD_CFLAGS=""
90   PTHREAD_LIBADD=""
93 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
94 LDADD="$LDADD $PTHREAD_LDADD"
95 LIBADD="$LIBADD $PTHREAD_LIBADD"
97 AC_SUBST(PTHREAD_CFLAGS)
98 AC_SUBST(PTHREAD_LDADD)
99 AC_SUBST(PTHREAD_LIBADD)
101 AC_MSG_RESULT($enable_pthread_support)