1dnl $Id: pthreads.m4 20295 2007-04-11 11:08:08Z lha $ 2 3AC_DEFUN([KRB_PTHREADS], [ 4AC_MSG_CHECKING(if compiling threadsafe libraries) 5 6AC_ARG_ENABLE(pthread-support, 7 AS_HELP_STRING([--enable-pthread-support], 8 [if you want thread safe libraries]), 9 [],[enable_pthread_support=maybe]) 10 11case "$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*-*-linux* | *-*-linux-gnu) 31 case `uname -r` in 32 2.*) 33 native_pthread_support=yes 34 PTHREADS_CFLAGS=-pthread 35 PTHREADS_LIBS=-pthread 36 ;; 37 esac 38 ;; 39*-*-aix*) 40 dnl AIX is disabled since we don't handle the utmp/utmpx 41 dnl problems that aix causes when compiling with pthread support 42 native_pthread_support=no 43 ;; 44mips-sgi-irix6.[[5-9]]) # maybe works for earlier versions too 45 native_pthread_support=yes 46 PTHREADS_LIBS="-lpthread" 47 ;; 48*-*-darwin*) 49 native_pthread_support=yes 50 ;; 51*) 52 native_pthread_support=no 53 ;; 54esac 55 56if test "$enable_pthread_support" = maybe ; then 57 enable_pthread_support="$native_pthread_support" 58fi 59 60if test "$enable_pthread_support" != no; then 61 AC_DEFINE(ENABLE_PTHREAD_SUPPORT, 1, 62 [Define if you want have a thread safe libraries]) 63 dnl This sucks, but libtool doesn't save the depenecy on -pthread 64 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