1ebfedea0SLionel SambucDnl Id 2ebfedea0SLionel Sambuc 3ebfedea0SLionel SambucAC_DEFUN([KRB_PTHREADS], [ 4ebfedea0SLionel SambucAC_MSG_CHECKING(if compiling threadsafe libraries) 5ebfedea0SLionel Sambuc 6ebfedea0SLionel SambucAC_ARG_ENABLE(pthread-support, 7ebfedea0SLionel Sambuc AS_HELP_STRING([--enable-pthread-support], 8ebfedea0SLionel Sambuc [if you want thread safe libraries]), 9ebfedea0SLionel Sambuc [],[enable_pthread_support=maybe]) 10ebfedea0SLionel Sambuc 11ebfedea0SLionel Sambuccase "$host" in 12ebfedea0SLionel Sambuc*-*-solaris2*) 13ebfedea0SLionel Sambuc native_pthread_support=yes 14ebfedea0SLionel Sambuc if test "$GCC" = yes; then 15ebfedea0SLionel Sambuc PTHREAD_CFLAGS=-pthreads 16ebfedea0SLionel Sambuc PTHREAD_LIBADD=-pthreads 17ebfedea0SLionel Sambuc else 18ebfedea0SLionel Sambuc PTHREAD_CFLAGS=-mt 19ebfedea0SLionel Sambuc PTHREAD_LDADD=-mt 20ebfedea0SLionel Sambuc PTHREAD_LIBADD=-mt 21ebfedea0SLionel Sambuc fi 22ebfedea0SLionel Sambuc ;; 23ebfedea0SLionel Sambuc*-*-netbsd[[12]]*) 24ebfedea0SLionel Sambuc native_pthread_support="if running netbsd 1.6T or newer" 25ebfedea0SLionel Sambuc dnl heim_threads.h knows this 26ebfedea0SLionel Sambuc PTHREAD_LIBADD="-lpthread" 27ebfedea0SLionel Sambuc ;; 28ebfedea0SLionel Sambuc*-*-netbsd[[3456789]]*) 29ebfedea0SLionel Sambuc native_pthread_support="netbsd 3 uses explict pthread" 30ebfedea0SLionel Sambuc dnl heim_threads.h knows this 31ebfedea0SLionel Sambuc PTHREAD_LIBADD="-lpthread" 32ebfedea0SLionel Sambuc ;; 33ebfedea0SLionel Sambuc*-*-freebsd[[56789]]*) 34ebfedea0SLionel Sambuc native_pthread_support=yes 35ebfedea0SLionel Sambuc PTHREAD_LIBADD="-pthread" 36ebfedea0SLionel Sambuc ;; 37ebfedea0SLionel Sambuc*-*-openbsd*) 38ebfedea0SLionel Sambuc native_pthread_support=yes 39ebfedea0SLionel Sambuc PTHREAD_CFLAGS=-pthread 40ebfedea0SLionel Sambuc PTHREAD_LIBADD=-pthread 41ebfedea0SLionel Sambuc ;; 42ebfedea0SLionel Sambuc*-*-linux* | *-*-linux-gnu) 43ebfedea0SLionel Sambuc case `uname -r` in 44*0a6a1f1dSLionel Sambuc 2.*|3.*) 45ebfedea0SLionel Sambuc native_pthread_support=yes 46ebfedea0SLionel Sambuc PTHREAD_CFLAGS=-pthread 47ebfedea0SLionel Sambuc PTHREAD_LIBADD=-pthread 48ebfedea0SLionel Sambuc ;; 49ebfedea0SLionel Sambuc esac 50ebfedea0SLionel Sambuc ;; 51ebfedea0SLionel Sambuc*-*-kfreebsd*-gnu*) 52ebfedea0SLionel Sambuc native_pthread_support=yes 53ebfedea0SLionel Sambuc PTHREAD_CFLAGS=-pthread 54ebfedea0SLionel Sambuc PTHREAD_LIBADD=-pthread 55ebfedea0SLionel Sambuc ;; 56ebfedea0SLionel Sambuc*-*-aix*) 57ebfedea0SLionel Sambuc dnl AIX is disabled since we don't handle the utmp/utmpx 58ebfedea0SLionel Sambuc dnl problems that aix causes when compiling with pthread support 59ebfedea0SLionel Sambuc native_pthread_support=no 60ebfedea0SLionel Sambuc ;; 61ebfedea0SLionel Sambucmips-sgi-irix6.[[5-9]]) # maybe works for earlier versions too 62ebfedea0SLionel Sambuc native_pthread_support=yes 63ebfedea0SLionel Sambuc PTHREAD_LIBADD="-lpthread" 64ebfedea0SLionel Sambuc ;; 65ebfedea0SLionel Sambuc*-*-darwin*) 66ebfedea0SLionel Sambuc native_pthread_support=yes 67ebfedea0SLionel Sambuc ;; 68ebfedea0SLionel Sambuc*) 69ebfedea0SLionel Sambuc native_pthread_support=no 70ebfedea0SLionel Sambuc ;; 71ebfedea0SLionel Sambucesac 72ebfedea0SLionel Sambuc 73ebfedea0SLionel Sambucif test "$enable_pthread_support" = maybe ; then 74ebfedea0SLionel Sambuc enable_pthread_support="$native_pthread_support" 75ebfedea0SLionel Sambucfi 76ebfedea0SLionel Sambuc 77ebfedea0SLionel Sambucif test "$enable_pthread_support" != no; then 78ebfedea0SLionel Sambuc AC_DEFINE(ENABLE_PTHREAD_SUPPORT, 1, 79ebfedea0SLionel Sambuc [Define if you want have a thread safe libraries]) 80ebfedea0SLionel Sambuc dnl This sucks, but libtool doesn't save the depenecy on -pthread 81ebfedea0SLionel Sambuc dnl for libraries. 82ebfedea0SLionel Sambuc LIBS="$PTHREAD_LIBADD $LIBS" 83ebfedea0SLionel Sambucelse 84ebfedea0SLionel Sambuc PTHREAD_CFLAGS="" 85ebfedea0SLionel Sambuc PTHREAD_LIBADD="" 86ebfedea0SLionel Sambucfi 87ebfedea0SLionel Sambuc 88ebfedea0SLionel SambucAC_SUBST(PTHREAD_CFLAGS) 89ebfedea0SLionel SambucAC_SUBST(PTHREAD_LDADD) 90ebfedea0SLionel SambucAC_SUBST(PTHREAD_LIBADD) 91ebfedea0SLionel Sambuc 92ebfedea0SLionel SambucAC_MSG_RESULT($enable_pthread_support) 93ebfedea0SLionel Sambuc]) 94