Home | History | Annotate | Line # | Download | only in cf
      1  1.1.1.2     elric Dnl Id
      2      1.1     elric 
      3      1.1     elric AC_DEFUN([KRB_PTHREADS], [
      4      1.1     elric AC_MSG_CHECKING(if compiling threadsafe libraries)
      5      1.1     elric 
      6      1.1     elric AC_ARG_ENABLE(pthread-support,
      7      1.1     elric 	AS_HELP_STRING([--enable-pthread-support],
      8      1.1     elric 			[if you want thread safe libraries]),
      9      1.1     elric 	[],[enable_pthread_support=maybe])
     10      1.1     elric 
     11      1.1     elric case "$host" in 
     12      1.1     elric *-*-solaris2*)
     13      1.1     elric 	native_pthread_support=yes
     14      1.1     elric 	if test "$GCC" = yes; then
     15  1.1.1.4  christos 		PTHREAD_CFLAGS="-D_REENTRANT -D_TS_ERRNO"
     16  1.1.1.4  christos 		PTHREAD_LIBADD=-lpthread
     17      1.1     elric 	else
     18  1.1.1.4  christos 		PTHREAD_CFLAGS="-mt -D_REENTRANT -D_TS_ERRNO"
     19      1.1     elric 		PTHREAD_LDADD=-mt
     20  1.1.1.4  christos 		PTHREAD_LIBADD="-mt -lpthread"
     21      1.1     elric 	fi
     22      1.1     elric 	;;
     23      1.1     elric *-*-netbsd[[12]]*)
     24      1.1     elric 	native_pthread_support="if running netbsd 1.6T or newer"
     25      1.1     elric 	dnl heim_threads.h knows this
     26      1.1     elric 	PTHREAD_LIBADD="-lpthread"
     27      1.1     elric 	;;
     28      1.1     elric *-*-netbsd[[3456789]]*)
     29      1.1     elric 	native_pthread_support="netbsd 3 uses explict pthread"
     30      1.1     elric 	dnl heim_threads.h knows this
     31      1.1     elric 	PTHREAD_LIBADD="-lpthread"
     32      1.1     elric 	;;
     33  1.1.1.4  christos *-*-freebsd[[1234]])
     34  1.1.1.4  christos     ;;
     35  1.1.1.4  christos *-*-freebsd*)
     36      1.1     elric 	native_pthread_support=yes
     37      1.1     elric 	PTHREAD_LIBADD="-pthread"
     38      1.1     elric 	;;
     39      1.1     elric *-*-openbsd*)
     40      1.1     elric 	native_pthread_support=yes
     41      1.1     elric 	PTHREAD_CFLAGS=-pthread
     42      1.1     elric 	PTHREAD_LIBADD=-pthread
     43      1.1     elric 	;;
     44  1.1.1.4  christos *-*-gnu*)
     45  1.1.1.4  christos 	native_pthread_support=yes
     46  1.1.1.4  christos 	PTHREADS_CFLAGS=-pthread
     47  1.1.1.4  christos 	PTHREAD_LIBADD="-pthread -lpthread"
     48  1.1.1.4  christos 	;;
     49      1.1     elric *-*-linux* | *-*-linux-gnu)
     50      1.1     elric 	case `uname -r` in
     51  1.1.1.3    pettai 	2.*|3.*)
     52      1.1     elric 		native_pthread_support=yes
     53      1.1     elric 		PTHREAD_CFLAGS=-pthread
     54      1.1     elric 		PTHREAD_LIBADD=-pthread
     55      1.1     elric 		;;
     56      1.1     elric 	esac
     57      1.1     elric 	;;
     58      1.1     elric *-*-kfreebsd*-gnu*)
     59      1.1     elric 	native_pthread_support=yes
     60      1.1     elric 	PTHREAD_CFLAGS=-pthread
     61      1.1     elric 	PTHREAD_LIBADD=-pthread
     62      1.1     elric 	;;
     63      1.1     elric *-*-aix*)
     64      1.1     elric 	dnl AIX is disabled since we don't handle the utmp/utmpx
     65      1.1     elric         dnl problems that aix causes when compiling with pthread support
     66  1.1.1.4  christos         dnl (2016-11-14, we longer use utmp).  Original logic was:
     67  1.1.1.4  christos         dnl     if test "$GCC" = yes; then
     68  1.1.1.4  christos         dnl             native_pthread_support=yes
     69  1.1.1.4  christos         dnl             PTHREADS_LIBS="-pthread"
     70  1.1.1.4  christos         dnl     elif expr "$CC" : ".*_r" > /dev/null ; then
     71  1.1.1.4  christos         dnl             native_pthread_support=yes
     72  1.1.1.4  christos         dnl             PTHREADS_CFLAGS=""
     73  1.1.1.4  christos         dnl             PTHREADS_LIBS=""
     74  1.1.1.4  christos         dnl     else
     75  1.1.1.4  christos         dnl             native_pthread_support=no
     76  1.1.1.4  christos         dnl     fi
     77      1.1     elric 	native_pthread_support=no
     78      1.1     elric 	;;
     79      1.1     elric mips-sgi-irix6.[[5-9]])  # maybe works for earlier versions too
     80      1.1     elric 	native_pthread_support=yes
     81      1.1     elric 	PTHREAD_LIBADD="-lpthread"
     82      1.1     elric 	;;
     83      1.1     elric *-*-darwin*)
     84      1.1     elric 	native_pthread_support=yes
     85      1.1     elric 	;;
     86      1.1     elric *)
     87      1.1     elric 	native_pthread_support=no
     88      1.1     elric 	;;
     89      1.1     elric esac
     90      1.1     elric 
     91      1.1     elric if test "$enable_pthread_support" = maybe ; then
     92      1.1     elric 	enable_pthread_support="$native_pthread_support"
     93      1.1     elric fi
     94      1.1     elric 	
     95      1.1     elric if test "$enable_pthread_support" != no; then
     96      1.1     elric     AC_DEFINE(ENABLE_PTHREAD_SUPPORT, 1,
     97      1.1     elric 	[Define if you want have a thread safe libraries])
     98      1.1     elric     dnl This sucks, but libtool doesn't save the depenecy on -pthread
     99      1.1     elric     dnl for libraries.
    100      1.1     elric     LIBS="$PTHREAD_LIBADD $LIBS"
    101      1.1     elric else
    102      1.1     elric   PTHREAD_CFLAGS=""
    103      1.1     elric   PTHREAD_LIBADD=""
    104      1.1     elric fi
    105      1.1     elric 
    106  1.1.1.4  christos AM_CONDITIONAL(ENABLE_PTHREAD_SUPPORT, test "$enable_pthread_support" != no)
    107  1.1.1.4  christos 
    108  1.1.1.4  christos CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
    109  1.1.1.4  christos LDADD="$LDADD $PTHREAD_LDADD"
    110  1.1.1.4  christos LIBADD="$LIBADD $PTHREAD_LIBADD"
    111  1.1.1.4  christos 
    112      1.1     elric AC_SUBST(PTHREAD_CFLAGS)
    113      1.1     elric AC_SUBST(PTHREAD_LDADD)
    114      1.1     elric AC_SUBST(PTHREAD_LIBADD)
    115      1.1     elric 
    116      1.1     elric AC_MSG_RESULT($enable_pthread_support)
    117      1.1     elric ])
    118