1 2dnl TSRM_CHECK_GCC_ARG(ARG, ACTION-IF-FOUND, ACTION-IF-NOT_FOUND) 3AC_DEFUN([TSRM_CHECK_GCC_ARG],[ 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 7 cmd='$CC $1 -c conftest.c' 8 if eval $cmd 2>&1 | egrep -e $1 >/dev/null ; then 9 ac_result=no 10 else 11 ac_result=yes 12 fi 13 eval $gcc_arg_name=$ac_result 14 rm -f conftest.* 15 ]) 16 if eval test "\$$gcc_arg_name" = "yes"; then 17 $2 18 else 19 : 20 $3 21 fi 22]) 23 24AC_DEFUN([TSRM_BASIC_CHECKS],[ 25 26AC_REQUIRE([AC_PROG_CC])dnl 27dnl AC_REQUIRE([AM_PROG_CC_STDC])dnl 28AC_REQUIRE([AC_PROG_CC_C_O])dnl 29AC_REQUIRE([AC_PROG_RANLIB])dnl 30 31AC_CHECK_HEADERS(stdarg.h) 32 33]) 34 35 36AC_DEFUN([TSRM_CHECK_PTH],[ 37 38AC_MSG_CHECKING(for GNU Pth) 39PTH_PREFIX="`$1 --prefix`" 40if test -z "$PTH_PREFIX"; then 41 AC_MSG_RESULT(Please check your Pth installation) 42fi 43 44CPPFLAGS="$CPPFLAGS `$1 --cflags`" 45LDFLAGS="$LDFLAGS `$1 --ldflags`" 46LIBS="$LIBS `$1 --libs`" 47 48AC_DEFINE(GNUPTH, 1, [Whether you use GNU Pth]) 49AC_MSG_RESULT(yes - installed in $PTH_PREFIX) 50 51]) 52 53AC_DEFUN([TSRM_CHECK_ST],[ 54 if test -r "$1/include/st.h"; then 55 CPPFLAGS="$CPPFLAGS -I$1/include" 56 LDFLAGS="$LDFLAGS -L$1/lib" 57 elif test -r "$1/st.h"; then 58 CPPFLAGS="$CPPFLAGS -I$1" 59 LDFLAGS="$LDFLAGS -L$1" 60 fi 61 AC_CHECK_HEADERS(st.h,[],[ 62 AC_MSG_ERROR([Sorry[,] I was unable to locate the State Threads header file. Please specify the prefix using --with-tsrm-st=/prefix]) 63 ]) 64 LIBS="$LIBS -lst" 65 AC_MSG_CHECKING(for SGI's State Threads) 66 AC_MSG_RESULT(yes) 67 AC_DEFINE(TSRM_ST, 1, [ ]) 68]) 69 70sinclude(threads.m4) 71 72AC_DEFUN([TSRM_CHECK_PTHREADS],[ 73 74PTHREADS_CHECK 75 76if test "$beos_threads" = "1"; then 77 AC_DEFINE(BETHREADS, 1, Whether to use native BeOS threads) 78else 79 if test "$pthreads_working" != "yes"; then 80 AC_MSG_ERROR(Your system seems to lack POSIX threads.) 81 fi 82 83 AC_DEFINE(PTHREADS, 1, Whether to use Pthreads) 84 85 AC_MSG_CHECKING(for POSIX threads) 86 AC_MSG_RESULT(yes) 87fi 88]) 89 90 91AC_DEFUN([TSRM_THREADS_CHECKS],[ 92 93dnl For the thread implementations, we always use --with-* 94dnl to maintain consistency 95 96AC_ARG_WITH(tsrm-pth, 97[ --with-tsrm-pth[=pth-config] 98 Use GNU Pth],[ 99 TSRM_PTH=$withval 100],[ 101 TSRM_PTH=no 102]) 103 104AC_ARG_WITH(tsrm-st, 105[ --with-tsrm-st Use SGI's State Threads],[ 106 TSRM_ST=$withval 107],[ 108 TSRM_ST=no 109]) 110 111AC_ARG_WITH(tsrm-pthreads, 112[ --with-tsrm-pthreads Use POSIX threads (default)],[ 113 TSRM_PTHREADS=$withval 114],[ 115 TSRM_PTHREADS=yes 116]) 117 118test "$TSRM_PTH" = "yes" && TSRM_PTH=pth-config 119 120if test "$TSRM_PTH" != "no"; then 121 TSRM_CHECK_PTH($TSRM_PTH) 122elif test "$TSRM_ST" != "no"; then 123 TSRM_CHECK_ST($TSRM_ST) 124elif test "$TSRM_PTHREADS" != "no"; then 125 TSRM_CHECK_PTHREADS 126fi 127 128]) 129