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