Skip to content
Newer
Older
100644 114 lines (86 sloc) 2.27 KB
9aef667 Rewrite TSRM_CHECK_GCC_ARG to cache its result
Sascha Schumann authored Dec 30, 1999
1
2 dnl TSRM_CHECK_GCC_ARG(ARG, ACTION-IF-FOUND, ACTION-IF-NOT_FOUND)
aa3737e Improved check for GCC's -pthread and -pthreads flag
Sascha Schumann authored Dec 22, 1999
3 AC_DEFUN(TSRM_CHECK_GCC_ARG,[
9aef667 Rewrite TSRM_CHECK_GCC_ARG to cache its result
Sascha Schumann authored Dec 30, 1999
4 gcc_arg_name=[ac_cv_gcc_arg]translit($1,A-Z-,a-z_)
5 AC_CACHE_CHECK([whether $CC supports $1], [ac_cv_gcc_arg]translit($1,A-Z-,a-z_), [
6 echo 'void somefunc() { };' > conftest.c
aa3737e Improved check for GCC's -pthread and -pthreads flag
Sascha Schumann authored Dec 22, 1999
7 cmd='$CC $1 -c conftest.c'
8 if eval $cmd 2>&1 | egrep -e $1 >/dev/null ; then
9aef667 Rewrite TSRM_CHECK_GCC_ARG to cache its result
Sascha Schumann authored Dec 30, 1999
9 ac_result=no
aa3737e Improved check for GCC's -pthread and -pthreads flag
Sascha Schumann authored Dec 22, 1999
10 else
9aef667 Rewrite TSRM_CHECK_GCC_ARG to cache its result
Sascha Schumann authored Dec 30, 1999
11 ac_result=yes
aa3737e Improved check for GCC's -pthread and -pthreads flag
Sascha Schumann authored Dec 22, 1999
12 fi
9aef667 Rewrite TSRM_CHECK_GCC_ARG to cache its result
Sascha Schumann authored Dec 30, 1999
13 eval $gcc_arg_name=$ac_result
aa3737e Improved check for GCC's -pthread and -pthreads flag
Sascha Schumann authored Dec 22, 1999
14 rm -f conftest.*
9aef667 Rewrite TSRM_CHECK_GCC_ARG to cache its result
Sascha Schumann authored Dec 30, 1999
15 ])
16 if eval test "\$$gcc_arg_name" = "yes"; then
17 $2
18 else
19 :
20 $3
21 fi
aa3737e Improved check for GCC's -pthread and -pthreads flag
Sascha Schumann authored Dec 22, 1999
22 ])
91549cf Move config code into separate file
Sascha Schumann authored Dec 17, 1999
23
24 AC_DEFUN(TSRM_BASIC_CHECKS,[
25
26 AC_REQUIRE([AC_PROG_CC])dnl
27 dnl AC_REQUIRE([AM_PROG_CC_STDC])dnl
28 AC_REQUIRE([AC_PROG_CC_C_O])dnl
29 AC_REQUIRE([AC_PROG_RANLIB])dnl
30
31 AC_CHECK_HEADERS(stdarg.h)
32
33 ])
34
fa1f318 Enable TSRM to use Pth
Sascha Schumann authored Dec 21, 1999
35
36 AC_DEFUN(TSRM_CHECK_PTH,[
37
38 AC_MSG_CHECKING(for GNU Pth)
39 PTH_PREFIX="`$1 --prefix`"
40 if test -z "$PTH_PREFIX"; then
41 AC_MSG_RESULT(Please check your Pth installation)
42 fi
43
44 CPPFLAGS="$CPPFLAGS `$1 --cflags`"
45 LDFLAGS="$LDFLAGS `$1 --ldflags`"
46 LIBS="$LIBS `$1 --libs`"
47
48 AC_DEFINE(GNUPTH, 1, [Whether you use GNU Pth])
49 AC_MSG_RESULT(yes - installed in $PTH_PREFIX)
50
51 ])
52
53
54 AC_DEFUN(TSRM_CHECK_PTHREADS,[
91549cf Move config code into separate file
Sascha Schumann authored Dec 17, 1999
55
69f8907 Put -pthreads? into CFLAGS; libtool still filters it out during shared
Sascha Schumann authored Dec 24, 1999
56 old_CFLAGS="$CFLAGS"
aa3737e Improved check for GCC's -pthread and -pthreads flag
Sascha Schumann authored Dec 22, 1999
57
58 if test -n "$GCC"; then
9aef667 Rewrite TSRM_CHECK_GCC_ARG to cache its result
Sascha Schumann authored Dec 30, 1999
59 TSRM_CHECK_GCC_ARG(-pthread, [
60 CFLAGS="$CFLAGS -pthread"
61 ],[
62 TSRM_CHECK_GCC_ARG(-pthreads, [
63 CFLAGS="$CFLAGS -pthreads"
64 ])])
aa3737e Improved check for GCC's -pthread and -pthreads flag
Sascha Schumann authored Dec 22, 1999
65 fi
91549cf Move config code into separate file
Sascha Schumann authored Dec 17, 1999
66
85a5a28 Let check succeed on systems which don't need special flags for pthre…
Sascha Schumann authored Dec 30, 1999
67 AC_CHECK_FUNCS(pthread_kill)
68
91549cf Move config code into separate file
Sascha Schumann authored Dec 17, 1999
69 if test "$ac_cv_func_pthread_kill" != "yes"; then
69f8907 Put -pthreads? into CFLAGS; libtool still filters it out during shared
Sascha Schumann authored Dec 24, 1999
70 CFLAGS="$old_CFLAGS"
4fb1e27 Improve Pthreads check
Sascha Schumann authored Dec 21, 1999
71 AC_CHECK_LIB(pthread, pthread_kill)
72 unset ac_cv_func_pthread_kill
73 AC_CHECK_FUNCS(pthread_kill)
74 if test "$ac_cv_func_pthread_kill" != "yes"; then
85a5a28 Let check succeed on systems which don't need special flags for pthre…
Sascha Schumann authored Dec 30, 1999
75 AC_MSG_ERROR(Your system seems to lack POSIX threads.)
4fb1e27 Improve Pthreads check
Sascha Schumann authored Dec 21, 1999
76 fi
91549cf Move config code into separate file
Sascha Schumann authored Dec 17, 1999
77 fi
4fb1e27 Improve Pthreads check
Sascha Schumann authored Dec 21, 1999
78
85a5a28 Let check succeed on systems which don't need special flags for pthre…
Sascha Schumann authored Dec 30, 1999
79 AC_DEFINE(PTHREADS, 1, Whether to use Pthreads)
fa1f318 Enable TSRM to use Pth
Sascha Schumann authored Dec 21, 1999
80
81 AC_MSG_CHECKING(for POSIX threads)
82 AC_MSG_RESULT(yes)
83 ])
84
85
86 AC_DEFUN(TSRM_OTHER_CHECKS,[
87
88 dnl For the thread implementations, we always use --with-*
89 dnl to maintain consistency
90
91 AC_ARG_WITH(tsrm-pth,
92 [ --with-tsrm-pth[=pth-config] Use GNU Pth.],[
93 TSRM_PTH=$withval
94 ],[
95 TSRM_PTH=no
96 ])
97
98 AC_ARG_WITH(tsrm-pthreads,
99 [ --with-tsrm-pthreads Use POSIX threads (default)],[
100 TSRM_PTHREADS=$withval
101 ],[
102 TSRM_PTHREADS=yes
103 ])
104
105 test "$TSRM_PTH" = "yes" && TSRM_PTH=pth-config
106
107 if test "$TSRM_PTH" != "no"; then
108 TSRM_CHECK_PTH($TSRM_PTH)
109 elif test "$TSRM_PTHREADS" != "no"; then
110 TSRM_CHECK_PTHREADS
111 fi
112
91549cf Move config code into separate file
Sascha Schumann authored Dec 17, 1999
113 ])
Something went wrong with that request. Please try again.