File: pthreads.m4

package info (click to toggle)
heimdal 1.6~git20120403%2Bdfsg1-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 34,428 kB
  • sloc: ansic: 338,234; sh: 7,993; makefile: 4,671; yacc: 3,036; perl: 1,888; python: 748; lex: 731; awk: 465; java: 119; asm: 30; lisp: 29
file content (98 lines) | stat: -rw-r--r-- 2,210 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
Dnl $Id$

AC_DEFUN([KRB_PTHREADS], [
AC_MSG_CHECKING(if compiling threadsafe libraries)

AC_ARG_ENABLE(pthread-support,
	AS_HELP_STRING([--enable-pthread-support],
			[if you want thread safe libraries]),
	[],[enable_pthread_support=maybe])

case "$host" in 
*-*-solaris2*)
	native_pthread_support=yes
	if test "$GCC" = yes; then
		PTHREAD_CFLAGS=-pthreads
		PTHREAD_LIBADD=-pthreads
	else
		PTHREAD_CFLAGS=-mt
		PTHREAD_LDADD=-mt
		PTHREAD_LIBADD=-mt
	fi
	;;
*-*-netbsd[[12]]*)
	native_pthread_support="if running netbsd 1.6T or newer"
	dnl heim_threads.h knows this
	PTHREAD_LIBADD="-lpthread"
	;;
*-*-netbsd[[3456789]]*)
	native_pthread_support="netbsd 3 uses explict pthread"
	dnl heim_threads.h knows this
	PTHREAD_LIBADD="-lpthread"
	;;
*-*-freebsd[[56789]]*)
	native_pthread_support=yes
	PTHREAD_LIBADD="-pthread"
	;;
*-*-openbsd*)
	native_pthread_support=yes
	PTHREAD_CFLAGS=-pthread
	PTHREAD_LIBADD=-pthread
	;;
*-*-gnu*)
	native_pthread_support=yes
	PTHREADS_CFLAGS=-pthread
	PTHREAD_LIBADD="-pthread -lpthread"
	;;
*-*-linux* | *-*-linux-gnu)
	case `uname -r` in
	2.*|3.*)
		native_pthread_support=yes
		PTHREAD_CFLAGS=-pthread
		PTHREAD_LIBADD="-pthread -lpthread"
		;;
	esac
	;;
*-*-kfreebsd*-gnu*)
	native_pthread_support=yes
	PTHREAD_CFLAGS=-pthread
	PTHREAD_LIBADD=-pthread
	;;
*-*-aix*)
	dnl AIX is disabled since we don't handle the utmp/utmpx
        dnl problems that aix causes when compiling with pthread support
	native_pthread_support=no
	;;
mips-sgi-irix6.[[5-9]])  # maybe works for earlier versions too
	native_pthread_support=yes
	PTHREAD_LIBADD="-lpthread"
	;;
*-*-darwin*)
	native_pthread_support=yes
	;;
*)
	native_pthread_support=no
	;;
esac

if test "$enable_pthread_support" = maybe ; then
	enable_pthread_support="$native_pthread_support"
fi
	
if test "$enable_pthread_support" != no; then
    AC_DEFINE(ENABLE_PTHREAD_SUPPORT, 1,
	[Define if you want have a thread safe libraries])
    dnl This sucks, but libtool doesn't save the depenecy on -pthread
    dnl for libraries.
    LIBS="$PTHREAD_LIBADD $LIBS"
else
  PTHREAD_CFLAGS=""
  PTHREAD_LIBADD=""
fi

AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_LDADD)
AC_SUBST(PTHREAD_LIBADD)

AC_MSG_RESULT($enable_pthread_support)
])