1 PSI_STDINC=$PHP_PSI_SRCDIR/php_psi_stdinc.h
2 PSI_TYPES=$PHP_PSI_SRCDIR/php_psi_types.h
3 PSI_STRUCTS=$PHP_PSI_SRCDIR/php_psi_structs.h
4 PSI_CONSTS=$PHP_PSI_SRCDIR/php_psi_consts.h
5 PSI_REDIRS=$PHP_PSI_SRCDIR/php_psi_redirs.h
6 PSI_MACROS=$PHP_PSI_SRCDIR/php_psi_macros.h
7 PSI_DECLS=$PHP_PSI_SRCDIR/php_psi_decls.h
8 PSI_VA_DECLS=$PHP_PSI_SRCDIR/php_psi_va_decls.h
10 AC_DEFUN(PSI_CONFIG_INIT, [
12 static struct psi_predef_type {
14 const char *type_name;
16 } psi_predef_types@<:@@:>@ = {
18 cat >$PSI_STRUCTS <<EOF
19 static struct psi_predef_struct {
21 const char *type_name;
27 } psi_predef_structs@<:@@:>@ = {
29 cat >$PSI_CONSTS <<EOF
30 static struct psi_predef_const {
32 const char *type_name;
36 } psi_predef_consts@<:@@:>@ = {
38 cat >$PSI_REDIRS <<EOF
39 static struct psi_func_redir {
42 } psi_func_redirs@<:@@:>@ = {
44 cat >$PSI_MACROS </dev/null
46 static struct psi_predef_decl {
48 const char *type_name;
52 } psi_predef_decls@<:@@:>@ = {
54 cat >$PSI_VA_DECLS <<EOF
55 static struct psi_predef_decl psi_predef_vararg_decls@<:@@:>@ = {
59 AC_DEFUN(PSI_CONFIG_DONE, [
60 cat >$PSI_STDINC <<EOF
63 for i in $PSI_TYPES $PSI_STRUCTS $PSI_CONSTS $PSI_REDIRS $PSI_DECLS $PSI_VA_DECLS; do
73 have_=`AS_ECHO($ac_header) | $as_tr_cpp`
76 # include <$ac_header>
81 AC_DEFUN(PSI_INCLUDES, [AC_INCLUDES_DEFAULT()
94 #ifdef HAVE_NETINET_IN_H
95 # include <netinet/in.h>
97 #ifdef HAVE_ARPA_NAMESER_H
98 # include <arpa/nameser.h>
106 #ifdef HAVE_SYS_SELECT_H
107 # include <sys/select.h>
109 #ifdef HAVE_SYS_SOCKET_H
110 # include <sys/socket.h>
112 #ifdef HAVE_SYS_TIME_H
113 # include <sys/time.h>
115 #ifdef HAVE_SYS_TIMES_H
116 # include <sys/times.h>
118 #ifdef HAVE_SYS_UIO_H
119 # include <sys/uio.h>
121 #ifdef HAVE_SYS_UTSNAME_H
122 # include <sys/utsname.h>
138 AC_DEFUN(PSI_LEMON, [
139 AC_ARG_VAR(LEMON, The lemon parser generator of the SQLite project)
140 AC_PATH_PROG(LEMON, lemon, ./lemon)
144 AC_DEFUN([PSI_PKG_CONFIG], [
145 if test -z "$PKG_CONFIG"
147 AC_PATH_PROG(PKG_CONFIG, pkg-config, false)
149 export PKG_CONFIG_PATH="$PHP_PSI_LIBFFI/lib/pkgconfig:$PHP_PSI_LIBJIT/lib/pkgconfig:$PKG_CONFIG_PATH"
152 AC_DEFUN(PSI_CHECK_SIZEOF, [
153 AC_CHECK_SIZEOF($1, [], $2)
154 if test "$AS_TR_SH([ac_cv_sizeof_]$1)"; then
155 add_int_const "AS_TR_CPP([SIZEOF_]$1)" "$AS_TR_SH([ac_cv_sizeof_]$1)"
159 AC_DEFUN(PSI_CHECK_OFFSETOF, [
161 [offset of $2 in $1],
162 [AS_TR_SH([ac_cv_offsetof_$1_$2])],
163 [(long int) (offsetof ($1, $2))],
165 [AC_MSG_FAILURE([cannot compute offsetof ($1, $2)])]
168 AS_TR_CPP(offsetof_$1_$2),
169 $AS_TR_SH([ac_cv_offsetof_$1_$2]),
170 [The offset of `$2' in `$1', as computed by offsetof.]
174 AC_DEFUN(PSI_CHECK_LIBJIT, [
175 PHP_ARG_WITH(psi-libjit, where to find libjit,
176 [ --with-psi-libjit=DIR PSI: path to libjit], [ ], [ ])
177 AC_CACHE_CHECK(for libjit, psi_cv_libjit_dir, [
178 for psi_cv_libjit_dir in $PHP_PSI_LIBJIT {/usr{,/local},/opt}{,/libjit}
180 if test -e $psi_cv_libjit_dir/include/jit/jit.h
187 if test -n "$psi_cv_libjit_dir"
189 PHP_ADD_INCLUDE($psi_cv_libjit_dir/include)
190 PHP_ADD_LIBRARY_WITH_PATH(jit, $psi_cv_libjit_dir/$PHP_LIBDIR, PSI_SHARED_LIBADD)
191 AC_DEFINE(HAVE_LIBJIT, 1, Have libjit)
193 AC_MSG_WARN([Could not find libjit, please provide the base install path])
197 PHP_ARG_WITH(psi-libffi, where to find libffi,
198 [ --with-psi-libffi=DIR PSI: path to libffi], [ ], [ ])
199 AC_DEFUN(PSI_CHECK_LIBFFI, [
200 AC_REQUIRE([PSI_PKG_CONFIG])dnl
202 AC_CACHE_CHECK(for libffi through pkg-config, psi_cv_libffi, [
203 if $PKG_CONFIG --exists libffi
211 AC_MSG_CHECKING(for libffi)
212 psi_cv_libffi_dir=`$PKG_CONFIG --variable=prefix libffi`
213 AC_MSG_RESULT($psi_cv_libffi_dir)
214 PHP_EVAL_INCLINE(`$PKG_CONFIG --cflags libffi`)
215 PHP_EVAL_LIBLINE(`$PKG_CONFIG --libs libffi`, PSI_SHARED_LIBADD)
216 AC_DEFINE(HAVE_LIBFFI, 1, Have libffi)
218 AC_CACHE_CHECK(for libffi, psi_cv_libffi_dir, [
219 for psi_cv_libffi_dir in $PHP_PSI_LIBFFI {/usr{,/local},/opt}{,/libffi}
221 if test -e $psi_cv_libffi_dir/include/ffi/ffi.h
227 if test -n "$psi_cv_libffi_dir"
229 PHP_ADD_INCLUDE($psi_cv_libffi_dir/include/ffi)
230 PHP_ADD_LIBRARY_WITH_PATH(ffi, $psi_cv_libffi_dir/$PHP_LIBDIR, PSI_SHARED_LIBADD)
231 AC_DEFINE(HAVE_LIBFFI, 1, Have libffi)
233 AC_MSG_WARN([Could not find libffi, please provide the base install path])
236 PHP_CHECK_LIBRARY(ffi, ffi_closure_alloc, [
237 PHP_CHECK_LIBRARY(ffi, ffi_prep_closure_loc, [
238 AC_DEFINE(PSI_HAVE_FFI_PREP_CLOSURE_LOC, 1, [ ])
239 ], [], -L$psi_cv_libffi_dir/$PHP_LIBDIR)
240 AC_DEFINE(PSI_HAVE_FFI_CLOSURE_ALLOC, 1, [ ])
242 PHP_CHECK_LIBRARY(ffi, ffi_prep_closure, [
243 AC_CHECK_HEADERS(sys/mman.h)
245 AC_DEFINE(PSI_HAVE_FFI_PREP_CLOSURE, 1, [ ])
247 ], -L$psi_cv_libffi_dir/$PHP_LIBDIR)
248 ], -L$psi_cv_libffi_dir/$PHP_LIBDIR)
249 PHP_CHECK_LIBRARY(ffi, ffi_prep_cif_var, [
250 AC_DEFINE(PSI_HAVE_FFI_PREP_CIF_VAR, 1, [ ])
252 ], -L$psi_cv_libffi_dir/$PHP_LIBDIR)
255 dnl PSI_COMPUTE_STR(variable, string or expression)
256 AC_DEFUN(PSI_COMPUTE_STR, [
260 return EOF == fputs($2, fopen("conftest.out", "w"));
263 eval $1=\\\"`cat conftest.out`\\\"