Home | History | Annotate | Line # | Download | only in cf
pthreads.m4 revision 1.1.1.3
      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   elric 		PTHREAD_CFLAGS=-pthreads
     16      1.1   elric 		PTHREAD_LIBADD=-pthreads
     17      1.1   elric 	else
     18      1.1   elric 		PTHREAD_CFLAGS=-mt
     19      1.1   elric 		PTHREAD_LDADD=-mt
     20      1.1   elric 		PTHREAD_LIBADD=-mt
     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   elric *-*-freebsd[[56789]]*)
     34      1.1   elric 	native_pthread_support=yes
     35      1.1   elric 	PTHREAD_LIBADD="-pthread"
     36      1.1   elric 	;;
     37      1.1   elric *-*-openbsd*)
     38      1.1   elric 	native_pthread_support=yes
     39      1.1   elric 	PTHREAD_CFLAGS=-pthread
     40      1.1   elric 	PTHREAD_LIBADD=-pthread
     41      1.1   elric 	;;
     42      1.1   elric *-*-linux* | *-*-linux-gnu)
     43      1.1   elric 	case `uname -r` in
     44  1.1.1.3  pettai 	2.*|3.*)
     45      1.1   elric 		native_pthread_support=yes
     46      1.1   elric 		PTHREAD_CFLAGS=-pthread
     47      1.1   elric 		PTHREAD_LIBADD=-pthread
     48      1.1   elric 		;;
     49      1.1   elric 	esac
     50      1.1   elric 	;;
     51      1.1   elric *-*-kfreebsd*-gnu*)
     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 *-*-aix*)
     57      1.1   elric 	dnl AIX is disabled since we don't handle the utmp/utmpx
     58      1.1   elric         dnl problems that aix causes when compiling with pthread support
     59      1.1   elric 	native_pthread_support=no
     60      1.1   elric 	;;
     61      1.1   elric mips-sgi-irix6.[[5-9]])  # maybe works for earlier versions too
     62      1.1   elric 	native_pthread_support=yes
     63      1.1   elric 	PTHREAD_LIBADD="-lpthread"
     64      1.1   elric 	;;
     65      1.1   elric *-*-darwin*)
     66      1.1   elric 	native_pthread_support=yes
     67      1.1   elric 	;;
     68      1.1   elric *)
     69      1.1   elric 	native_pthread_support=no
     70      1.1   elric 	;;
     71      1.1   elric esac
     72      1.1   elric 
     73      1.1   elric if test "$enable_pthread_support" = maybe ; then
     74      1.1   elric 	enable_pthread_support="$native_pthread_support"
     75      1.1   elric fi
     76      1.1   elric 	
     77      1.1   elric if test "$enable_pthread_support" != no; then
     78      1.1   elric     AC_DEFINE(ENABLE_PTHREAD_SUPPORT, 1,
     79      1.1   elric 	[Define if you want have a thread safe libraries])
     80      1.1   elric     dnl This sucks, but libtool doesn't save the depenecy on -pthread
     81      1.1   elric     dnl for libraries.
     82      1.1   elric     LIBS="$PTHREAD_LIBADD $LIBS"
     83      1.1   elric else
     84      1.1   elric   PTHREAD_CFLAGS=""
     85      1.1   elric   PTHREAD_LIBADD=""
     86      1.1   elric fi
     87      1.1   elric 
     88      1.1   elric AC_SUBST(PTHREAD_CFLAGS)
     89      1.1   elric AC_SUBST(PTHREAD_LDADD)
     90      1.1   elric AC_SUBST(PTHREAD_LIBADD)
     91      1.1   elric 
     92      1.1   elric AC_MSG_RESULT($enable_pthread_support)
     93      1.1   elric ])
     94