xref: /PHP-7.3/TSRM/tsrm.m4 (revision 902d39a3)
1m4_include([TSRM/m4/ax_func_which_gethostbyname_r.m4])
2
3AC_DEFUN([TSRM_BASIC_CHECKS],[
4
5AC_REQUIRE([AC_PROG_CC])dnl
6dnl AC_REQUIRE([AM_PROG_CC_STDC])dnl
7AC_REQUIRE([AC_PROG_CC_C_O])dnl
8AC_REQUIRE([AC_PROG_RANLIB])dnl
9
10AC_CHECK_HEADERS(stdarg.h)
11
12AC_CHECK_FUNCS(sigprocmask)
13
14AX_FUNC_WHICH_GETHOSTBYNAME_R()
15
16])
17
18
19AC_DEFUN([TSRM_CHECK_PTH],[
20
21AC_MSG_CHECKING(for GNU Pth)
22PTH_PREFIX="`$1 --prefix`"
23if test -z "$PTH_PREFIX"; then
24  AC_MSG_RESULT(Please check your Pth installation)
25fi
26
27CPPFLAGS="$CPPFLAGS `$1 --cflags`"
28LDFLAGS="$LDFLAGS `$1 --ldflags`"
29LIBS="$LIBS `$1 --libs`"
30
31AC_DEFINE(GNUPTH, 1, [Whether you use GNU Pth])
32AC_MSG_RESULT(yes - installed in $PTH_PREFIX)
33
34])
35
36AC_DEFUN([TSRM_CHECK_ST],[
37  if test -r "$1/include/st.h"; then
38    CPPFLAGS="$CPPFLAGS -I$1/include"
39    LDFLAGS="$LDFLAGS -L$1/lib"
40  elif test -r "$1/st.h"; then
41    CPPFLAGS="$CPPFLAGS -I$1"
42    LDFLAGS="$LDFLAGS -L$1"
43  fi
44  AC_CHECK_HEADERS(st.h,[],[
45    AC_MSG_ERROR([Sorry[,] I was unable to locate the State Threads header file.  Please specify the prefix using --with-tsrm-st=/prefix])
46  ])
47  LIBS="$LIBS -lst"
48  AC_MSG_CHECKING(for SGI's State Threads)
49  AC_MSG_RESULT(yes)
50  AC_DEFINE(TSRM_ST, 1, [ ])
51])
52
53sinclude(threads.m4)
54
55AC_DEFUN([TSRM_CHECK_PTHREADS],[
56
57PTHREADS_CHECK
58
59if test "$pthreads_working" != "yes"; then
60  AC_MSG_ERROR(Your system seems to lack POSIX threads.)
61fi
62
63AC_DEFINE(PTHREADS, 1, Whether to use Pthreads)
64
65AC_MSG_CHECKING(for POSIX threads)
66AC_MSG_RESULT(yes)
67])
68
69AC_DEFUN([TSRM_THREADS_CHECKS],[
70
71dnl For the thread implementations, we always use --with-*
72dnl to maintain consistency
73
74AC_ARG_WITH(tsrm-pth,
75[  --with-tsrm-pth[=pth-config]
76                          Use GNU Pth],[
77  TSRM_PTH=$withval
78],[
79  TSRM_PTH=no
80])
81
82AC_ARG_WITH(tsrm-st,
83[  --with-tsrm-st          Use SGI's State Threads],[
84  TSRM_ST=$withval
85],[
86  TSRM_ST=no
87])
88
89AC_ARG_WITH(tsrm-pthreads,
90[  --with-tsrm-pthreads    Use POSIX threads (default)],[
91  TSRM_PTHREADS=$withval
92],[
93  TSRM_PTHREADS=yes
94])
95
96test "$TSRM_PTH" = "yes" && TSRM_PTH=pth-config
97
98if test "$TSRM_PTH" != "no"; then
99  TSRM_CHECK_PTH($TSRM_PTH)
100elif test "$TSRM_ST" != "no"; then
101  TSRM_CHECK_ST($TSRM_ST)
102elif test "$TSRM_PTHREADS" != "no"; then
103  TSRM_CHECK_PTHREADS
104fi
105
106])
107