1219019Sgabordnl $Id: pthreads.m4 20295 2007-04-11 11:08:08Z lha $
2219019Sgabor
3219019SgaborAC_DEFUN([KRB_PTHREADS], [
4219019SgaborAC_MSG_CHECKING(if compiling threadsafe libraries)
5219019Sgabor
6219019SgaborAC_ARG_ENABLE(pthread-support,
7219019Sgabor	AS_HELP_STRING([--enable-pthread-support],
8219019Sgabor			[if you want thread safe libraries]),
9219019Sgabor	[],[enable_pthread_support=maybe])
10219019Sgabor
11219019Sgaborcase "$host" in 
12219019Sgabor*-*-solaris2*)
13219019Sgabor	native_pthread_support=yes
14219019Sgabor	if test "$GCC" = yes; then
15219019Sgabor		PTHREADS_CFLAGS=-pthreads
16219019Sgabor		PTHREADS_LIBS=-pthreads
17219019Sgabor	else
18219019Sgabor		PTHREADS_CFLAGS=-mt
19219019Sgabor		PTHREADS_LIBS=-mt
20219019Sgabor	fi
21219019Sgabor	;;
22219019Sgabor*-*-netbsd*)
23219019Sgabor	native_pthread_support="if running netbsd 1.6T or newer"
24219019Sgabor	dnl heim_threads.h knows this
25219019Sgabor	PTHREADS_LIBS=""
26219019Sgabor	;;
27219019Sgabor*-*-freebsd5*)
28219019Sgabor	native_pthread_support=yes
29219019Sgabor	;;
30219019Sgabor*-*-linux* | *-*-linux-gnu)
31219019Sgabor	case `uname -r` in
32219019Sgabor	2.*)
33219019Sgabor		native_pthread_support=yes
34219019Sgabor		PTHREADS_CFLAGS=-pthread
35219019Sgabor		PTHREADS_LIBS=-pthread
36219019Sgabor		;;
37219019Sgabor	esac
38219019Sgabor	;;
39219019Sgabor*-*-aix*)
40219019Sgabor	dnl AIX is disabled since we don't handle the utmp/utmpx
41219019Sgabor        dnl problems that aix causes when compiling with pthread support
42219019Sgabor	native_pthread_support=no
43219019Sgabor	;;
44219019Sgabormips-sgi-irix6.[[5-9]])  # maybe works for earlier versions too
45219019Sgabor	native_pthread_support=yes
46219019Sgabor	PTHREADS_LIBS="-lpthread"
47219019Sgabor	;;
48219019Sgabor*-*-darwin*)
49219019Sgabor	native_pthread_support=yes
50219019Sgabor	;;
51219019Sgabor*)
52219019Sgabor	native_pthread_support=no
53219019Sgabor	;;
54219019Sgaboresac
55219019Sgabor
56219019Sgaborif test "$enable_pthread_support" = maybe ; then
57219019Sgabor	enable_pthread_support="$native_pthread_support"
58219019Sgaborfi
59219019Sgabor	
60219019Sgaborif test "$enable_pthread_support" != no; then
61219019Sgabor    AC_DEFINE(ENABLE_PTHREAD_SUPPORT, 1,
62219019Sgabor	[Define if you want have a thread safe libraries])
63219019Sgabor    dnl This sucks, but libtool doesn't save the depenecy on -pthread
64219019Sgabor    dnl for libraries.
65    LIBS="$PTHREADS_LIBS $LIBS"
66else
67  PTHREADS_CFLAGS=""
68  PTHREADS_LIBS=""
69fi
70
71AC_SUBST(PTHREADS_CFLAGS)
72AC_SUBST(PTHREADS_LIBS)
73
74AC_MSG_RESULT($enable_pthread_support)
75])
76