tsrm.m4 2.8 KB

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