83824352122d5c72335f5a37203bd726e9602a94
[m6w6/ext-psi] / config.m4
1 PHP_ARG_ENABLE(psi, whether to enable PHP System Interface support,
2 [ --enable-psi Enable PHP System Interface support])
3 PHP_ARG_WITH(psi-libjit, where to find libjit,
4 [ --with-psi-libjit=DIR PSI: path to libjit], [], no)
5 PHP_ARG_WITH(psi-libffi, where to find libjit,
6 [ --with-psi-libffi=DIR PSI: path to libffi], [], no)
7
8 if test "$PHP_PSI" != "no"; then
9 AC_ARG_VAR(LEMON, The lemon parser generator of the SQLite project)
10 AC_PATH_PROG(LEMON, lemon, ./lemon)
11 PHP_SUBST(LEMON)
12
13 if test -z "$PKG_CONFIG"
14 then
15 AC_PATH_PROG(PKG_CONFIG, pkg-config, false)
16 fi
17
18 export PKG_CONFIG_PATH="$PHP_PSI_LIBFFI/lib/pkgconfig:$PHP_PSI_LIBJIT/lib/pkgconfig:$PKG_CONFIG_PATH"
19
20 AC_CACHE_CHECK(for libffi through pkg-config, PSI_cv_LIBFFI, [
21 if $PKG_CONFIG --exists libffi
22 then
23 PSI_cv_LIBFFI=true
24 else
25 PSI_cv_LIBFFI=false
26 fi])
27 if $PSI_cv_LIBFFI
28 then
29 AC_MSG_CHECKING(for libffi)
30 PSI_cv_LIBFFI_DIR=`$PKG_CONFIG --variable=prefix libffi`
31 AC_MSG_RESULT($PSI_cv_LIBFFI_DIR)
32 PHP_EVAL_INCLINE(`$PKG_CONFIG --cflags libffi`)
33 PHP_EVAL_LIBLINE(`$PKG_CONFIG --libs libffi`, PSI_SHARED_LIBADD)
34 else
35 AC_CACHE_CHECK(for libffi, PSI_cv_LIBFFI_DIR, [
36 for PSI_cv_LIBFFI_DIR in $PHP_PSI_LIBFFI {/usr{,/local},/opt}{,/libffi}
37 do
38 if test -e $PSI_cv_LIBFFI_DIR/include/ffi/ffi.h
39 then
40 break
41 fi
42 PSI_cv_LIBFFI_DIR=
43 done])
44 if test -n "$PSI_cv_LIBFFI_DIR"
45 then
46 PHP_ADD_INCLUDE($PSI_cv_LIBFFI_DIR/include/ffi)
47 PHP_ADD_LIBRARY_WITH_PATH(ffi, $PSI_cv_LIBFFI_DIR/$PHP_LIBDIR, PSI_SHARED_LIBADD)
48 else
49 AC_MSG_WARN([Could not find libffi, please provide the base install path])
50 fi
51 fi
52 PHP_CHECK_LIBRARY(ffi, ffi_closure_alloc, [
53 PHP_CHECK_LIBRARY(ffi, ffi_prep_closure_loc, [
54 AC_DEFINE(PSI_HAVE_FFI_PREP_CLOSURE_LOC, 1, [ ])
55 ], [], -L$PSI_cv_LIBFFI_DIR/$PHP_LIBDIR)
56 AC_DEFINE(PSI_HAVE_FFI_CLOSURE_ALLOC, 1, [ ])
57 ], [
58 PHP_CHECK_LIBRARY(ffi, ffi_prep_closure, [
59 AC_CHECK_HEADERS(sys/mman.h)
60 PHP_CHECK_FUNC(mmap)
61 AC_DEFINE(PSI_HAVE_FFI_PREP_CLOSURE, 1, [ ])
62 ], [
63 ], -L$PSI_cv_LIBFFI_DIR/$PHP_LIBDIR)
64 ], -L$PSI_cv_LIBFFI_DIR/$PHP_LIBDIR)
65
66 AC_CACHE_CHECK(for libjit, PSI_cv_LIBJIT_DIR, [
67 for PSI_cv_LIBJIT_DIR in $PHP_PSI_LIBJIT {/usr{,/local},/opt}{,/libjit}
68 do
69 if test -e $PSI_cv_LIBJIT_DIR/include/jit/jit.h
70 then
71 break
72 fi
73 PSI_cv_LIBJIT_DIR=
74 done])
75 if test -n "$PSI_cv_LIBJIT_DIR"
76 then
77 PHP_ADD_INCLUDE($PSI_cv_LIBJIT_DIR/include)
78 PHP_ADD_LIBRARY_WITH_PATH(jit, $PSI_cv_LIBJIT_DIR/$PHP_LIBDIR, PSI_SHARED_LIBADD)
79 else
80 AC_MSG_WARN([Could not find libjit, please provide the base install path])
81 fi
82
83 PHP_SUBST(PSI_SHARED_LIBADD)
84
85 dnl PSI_INCLUDES_DEFAULT(include, defines)
86 AC_DEFUN(PSI_INCLUDES_DEFAULT, [
87 AC_INCLUDES_DEFAULT()
88 $2
89 m4_ifnblank($1,
90 m4_expand([#include <]$1[>])
91 )
92 ])
93
94 psi_type_pair() { # (type, size)
95 local psi_type_name=`tr -cd A-Za-z <<<$1`
96 local psi_type_lower=`tr A-Z a-z <<<$psi_type_name`
97 case $psi_type_lower in
98 int*|uint*)
99 local psi_type_upper=`tr a-z A-Z <<<$1`
100 local psi_type_bits=`expr $2 \* 8`
101 echo "PSI_T_${psi_type_upper}${psi_type_bits}, \"${psi_type_lower}${psi_type_bits}_t\""
102 ;;
103 struct*)
104 echo "PSI_T_STRUCT, \"$2\""
105 ;;
106 *)
107 echo "PSI_T_NAME, \"$psi_type_name\""
108 ;;
109 esac
110 }
111
112 PSI_TYPES=""
113 dnl PSI_TYPE(type name, basic type, includes)
114 AC_DEFUN(PSI_TYPE, [
115 ifdef(AC_TYPE_[]patsubst(translit($1,a-z,A-Z),\W,_),AC_TYPE_[]patsubst(translit($1,a-z,A-Z),\W,_))
116 AC_CHECK_SIZEOF($1, [], PSI_INCLUDES_DEFAULT($3))
117 if test "$2" && test "$ac_cv_sizeof_[]$1" -gt 0; then
118 PSI_TYPES="{`psi_type_pair $2 $ac_cv_sizeof_[]$1`, \""$1"\"}, $PSI_TYPES"
119 fi
120 ])
121
122
123 dnl PSI_COMPUTE_STR(variable, string or expression, includes)
124 AC_DEFUN(PSI_COMPUTE_STR, [
125 AC_TRY_RUN([
126 $3
127 int main() {
128 return EOF == fputs($2, fopen("conftest.out", "w"));
129 }
130 ], [
131 eval $1=\\\"`cat conftest.out`\\\"
132 ])
133 ])
134
135 PSI_CONSTS=""
136 dnl PSI_CONST(const name, type, headers to include)
137 AC_DEFUN(PSI_CONST, [
138 AC_CACHE_CHECK(value of $1, psi_cv_const_$1, [
139 psi_const_val=
140 case $2 in
141 str*|quoted_str*)
142 if test "$cross_compiling" = "yes"
143 then
144 AC_TRY_CPP(PSI_INCLUDES_DEFAULT($3)$1, psi_const_val=`eval "$ac_try|tail -n1"`, psi_const_val=)
145 else
146 PSI_COMPUTE_STR(psi_const_val, $1, PSI_INCLUDES_DEFAULT($3))
147 fi
148 ;;
149 *)
150 AC_COMPUTE_INT(psi_const_val, $1, PSI_INCLUDES_DEFAULT($3))
151 ;;
152 esac
153 psi_cv_const_$1=$psi_const_val
154 ])
155 if test "$psi_cv_const_$1"
156 then
157 case $2 in
158 str*|quoted_str*)
159 PSI_CONSTS="{PSI_T_STRING, \"string\", \"psi\\\\$1\", $psi_cv_const_$1, PSI_T_QUOTED_STRING}, $PSI_CONSTS"
160 ;;
161 *)
162 PSI_CONSTS="{PSI_T_INT, \"int\", \"psi\\\\$1\", \"$psi_cv_const_$1\", PSI_T_NUMBER}, $PSI_CONSTS"
163 ;;
164 esac
165 fi
166 ])
167
168 AC_DEFUN([AX_CHECK_SIGN], [
169 typename=`echo $1 | sed "s/@<:@^a-zA-Z0-9_@:>@/_/g"`
170 AC_CACHE_CHECK([whether $1 is signed], ax_cv_decl_${typename}_signed, [
171 AC_TRY_COMPILE([$4],
172 [ int foo @<:@ 1 - 2 * !((($1) -1) < 0) @:>@ ],
173 [ eval "ax_cv_decl_${typename}_signed=\"yes\"" ],
174 [ eval "ax_cv_decl_${typename}_signed=\"no\"" ])])
175 symbolname=`echo $1 | sed "s/@<:@^a-zA-Z0-9_@:>@/_/g" | tr "a-z" "A-Z"`
176 if eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"yes\""; then
177 $2
178 elif eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"no\""; then
179 $3
180 fi
181 ])
182 dnl PSI_CHECK_OFFSETOF(struct, member, include)
183 dnl[AS_LITERAL_IF([$1], [], [m4_fatal([$0: requires literal arguments])])]dnl
184 dnl[AS_LITERAL_IF([$2], [], [m4_fatal([$0: requires literal arguments])])]dnl
185 AC_DEFUN(PSI_CHECK_OFFSETOF, [
186 _AC_CACHE_CHECK_INT(
187 [offset of $2 in $1],
188 [AS_TR_SH([ac_cv_offsetof_$1_$2])],
189 [(long int) (offsetof ($1, $2))],
190 [AC_INCLUDES_DEFAULT([$3])],
191 [AC_MSG_FAILURE([cannot compute offsetof ($1, $2)])]
192 )
193 AC_DEFINE_UNQUOTED(
194 AS_TR_CPP(offsetof_$1_$2),
195 $AS_TR_SH([ac_cv_offsetof_$1_$2]),
196 [The offset of `$2' in `$1', as computed by offsetof.]
197 )
198 ])
199
200 dnl PSI_STRUCT(name, members, member type cases, includes)
201 PSI_STRUCTS=
202 AC_DEFUN(PSI_STRUCT, [
203 AC_CHECK_SIZEOF(struct $1, [], PSI_INCLUDES_DEFAULT($4))
204 psi_struct_size=$ac_cv_sizeof_struct_$1
205 psi_struct_members=
206 m4_foreach(member, [$2], [
207 AC_CHECK_MEMBER(struct $1.member, [
208 psi_member_name=member
209 AC_CHECK_SIZEOF(struct_$1[_]member, [], PSI_INCLUDES_DEFAULT($4,
210 [#define struct_$1_]member ((struct $1 *)0)->member
211 ))
212 psi_member_size=$ac_cv_sizeof_struct_$1[]_[]member
213 PSI_CHECK_OFFSETOF(struct $1, member, PSI_INCLUDES_DEFAULT($4))
214 psi_member_offset=$ac_cv_offsetof_struct_$1[]_[]member
215 # type
216 case member in
217 $3
218 *) psi_member_type=int ;;
219 esac
220 # pointer level
221 psi_struct_member_pl=`echo $psi_member_type | tr -cd '*' | wc -c`
222 # array size
223 psi_struct_member_as=`echo $psi_member_type | $AWK -F'\x5b\x5d\x5b\x5d' 'END {if(!found)print 0} /\\x5b\x5b\x5b:digit:\x5d\x5d+\\x5d/ {found=1; print$[]2}'`
224 if test $psi_struct_member_as -gt 0
225 then
226 psi_struct_member_pl=`expr $psi_struct_member_pl + 1`
227 fi
228 psi_struct_member="{`psi_type_pair $psi_member_type $psi_member_size`, \"$psi_member_name\", $psi_member_offset, $psi_member_size, $psi_struct_member_pl, $psi_struct_member_as}"
229 if test "$psi_struct_members"
230 then
231 psi_struct_members="$psi_struct_members, $psi_struct_member"
232 else
233 psi_struct_members="$psi_struct_member"
234 fi
235 ], [], PSI_INCLUDES_DEFAULT($4))
236 ])
237 PSI_STRUCTS="{\"$1\", $psi_struct_size, {$psi_struct_members}}, $PSI_STRUCTS"
238 ])
239
240 AC_PROG_NM
241 AC_PROG_AWK
242 PSI_FUNCS=
243 dnl PSI_FUNC(fn, decl)
244 AC_DEFUN(PSI_FUNC, [
245 AC_CHECK_FUNC($1, [
246 AC_MSG_CHECKING(for redirection of function $1)
247 psi_symbol=$1
248 psi_symbol_redirect=
249 AC_TRY_LINK_FUNC($1, [
250 psi_symbol_redirect=`$NM -g conftest$ac_exeext | $AWK -F" *|@" '/_main/ {next} / U / {print$[]3}'`
251 ])
252 AC_MSG_RESULT($psi_symbol_redirect)
253 if test "$psi_symbol_redirect" && test "$psi_symbol_redirect" != "$psi_symbol"
254 then
255 PSI_FUNCS="{\"$psi_symbol\", (void *) $psi_symbol}, $PSI_FUNCS"
256 fi
257 ])
258 ])
259
260 AC_TYPE_INT8_T
261 AC_CHECK_ALIGNOF(int8_t)
262 AC_TYPE_UINT8_T
263 AC_CHECK_ALIGNOF(uint8_t)
264 AC_TYPE_INT16_T
265 AC_CHECK_ALIGNOF(int16_t)
266 AC_TYPE_UINT16_T
267 AC_CHECK_ALIGNOF(uint16_t)
268 AC_TYPE_INT32_T
269 AC_CHECK_ALIGNOF(int32_t)
270 AC_TYPE_UINT32_T
271 AC_CHECK_ALIGNOF(uint32_t)
272 AC_TYPE_INT64_T
273 AC_CHECK_ALIGNOF(int64_t)
274 AC_TYPE_UINT64_T
275 AC_CHECK_ALIGNOF(uint64_t)
276
277 PSI_TYPE(char, int)
278 PSI_TYPE(short, int)
279 PSI_TYPE(int, int)
280 PSI_TYPE(long, int)
281 PSI_TYPE(float)
282 PSI_TYPE(double)
283 PSI_TYPE(void *)
284
285 dnl stdint.h
286 PSI_TYPE(int_least8_t, int)
287 PSI_TYPE(int_least16_t, int)
288 PSI_TYPE(int_least32_t, int)
289 PSI_TYPE(int_least64_t, int)
290 PSI_TYPE(uint_least8_t, uint)
291 PSI_TYPE(uint_least16_t, uint)
292 PSI_TYPE(uint_least32_t, uint)
293 PSI_TYPE(uint_least64_t, uint)
294 PSI_TYPE(int_fast8_t, int)
295 PSI_TYPE(int_fast16_t, int)
296 PSI_TYPE(int_fast32_t, int)
297 PSI_TYPE(int_fast64_t, int)
298 PSI_TYPE(uint_fast8_t, uint)
299 PSI_TYPE(uint_fast16_t, uint)
300 PSI_TYPE(uint_fast32_t, uint)
301 PSI_TYPE(uint_fast64_t, uint)
302 PSI_TYPE(intptr_t, int)
303 PSI_TYPE(uintptr_t, uint)
304 PSI_TYPE(intmax_t, int)
305 PSI_TYPE(uintmax_t, uint)
306
307 PSI_CONST(INT8_MIN, int)
308 PSI_CONST(INT8_MAX, int)
309 PSI_CONST(UINT8_MAX, int)
310 PSI_CONST(INT16_MIN, int)
311 PSI_CONST(INT16_MAX, int)
312 PSI_CONST(UINT16_MAX, int)
313 PSI_CONST(INT32_MIN, int)
314 PSI_CONST(INT32_MAX, int)
315 PSI_CONST(UINT32_MAX, int)
316 PSI_CONST(INT64_MIN, int)
317 PSI_CONST(INT64_MAX, int)
318 PSI_CONST(UINT64_MAX, int)
319
320 PSI_CONST(INT_LEAST8_MIN, int)
321 PSI_CONST(INT_LEAST8_MAX, int)
322 PSI_CONST(UINT_LEAST8_MAX, int)
323 PSI_CONST(INT_LEAST16_MIN, int)
324 PSI_CONST(INT_LEAST16_MAX, int)
325 PSI_CONST(UINT_LEAST16_MAX, int)
326 PSI_CONST(INT_LEAST32_MIN, int)
327 PSI_CONST(INT_LEAST32_MAX, int)
328 PSI_CONST(UINT_LEAST32_MAX, int)
329 PSI_CONST(INT_LEAST64_MIN, int)
330 PSI_CONST(INT_LEAST64_MAX, int)
331 PSI_CONST(UINT_LEAST64_MAX, int)
332
333 PSI_CONST(INT_FAST8_MIN, int)
334 PSI_CONST(INT_FAST8_MAX, int)
335 PSI_CONST(UINT_FAST8_MAX, int)
336 PSI_CONST(INT_FAST16_MIN, int)
337 PSI_CONST(INT_FAST16_MAX, int)
338 PSI_CONST(UINT_FAST16_MAX, int)
339 PSI_CONST(INT_FAST32_MIN, int)
340 PSI_CONST(INT_FAST32_MAX, int)
341 PSI_CONST(UINT_FAST32_MAX, int)
342 PSI_CONST(INT_FAST64_MIN, int)
343 PSI_CONST(INT_FAST64_MAX, int)
344 PSI_CONST(UINT_FAST64_MAX, int)
345
346 PSI_CONST(INTPTR_MIN, int)
347 PSI_CONST(INTPTR_MAX, int)
348 PSI_CONST(UINTPTR_MAX, int)
349 PSI_CONST(INTMAX_MIN, int)
350 PSI_CONST(INTMAX_MAX, int)
351 PSI_CONST(UINTMAX_MAX, int)
352
353 dnl stddef.h
354 PSI_TYPE(ptrdiff_t, int)
355 PSI_CONST(PTRDIFF_MIN, int)
356 PSI_CONST(PTRDIFF_MAX, int)
357 PSI_TYPE(size_t, uint)
358 PSI_CONST(SIZE_MAX, int)
359 AC_CHECK_TYPE(wchar_t, [
360 AX_CHECK_SIGN(wchar_t, psi_wchar_t=int, psi_wchar_t=uint)
361 PSI_TYPE(wchar_t, $psi_wchar_t)
362 PSI_CONST(WCHAR_MIN, int)
363 PSI_CONST(WCHAR_MAX, int)
364 ])
365
366 dnl stdio.h
367 PSI_CONST(BUFSIZ, int)
368 PSI_CONST(_IOFBF, int)
369 PSI_CONST(_IOLBF, int)
370 PSI_CONST(_IONBF, int)
371 PSI_CONST(SEEK_CUR, int)
372 PSI_CONST(SEEK_END, int)
373 PSI_CONST(SEEK_SET, int)
374 PSI_CONST(FILENAME_MAX, int)
375 PSI_CONST(FOPEN_MAX, int)
376 PSI_CONST(TMP_MAX, int)
377 PSI_CONST(EOF, int)
378 PSI_CONST(P_tmpdir, string)
379 PSI_CONST(L_ctermid, int)
380 PSI_CONST(L_tmpnam, int)
381 dnl stdlib.h
382 PSI_CONST(EXIT_FAILURE, int)
383 PSI_CONST(EXIT_SUCCESS, int)
384 PSI_CONST(RAND_MAX, int)
385 PSI_CONST(MB_CUR_MAX, int)
386 dnl sys/stat.h
387 PSI_FUNC(chmod)
388 PSI_FUNC(fchmod)
389 PSI_FUNC(fchmodat)
390 PSI_FUNC(fstat)
391 PSI_FUNC(fstatat)
392 PSI_FUNC(futimens)
393 PSI_FUNC(lstat)
394 PSI_FUNC(mkdir)
395 PSI_FUNC(mkdirat)
396 PSI_FUNC(mkfifo)
397 PSI_FUNC(mkfifoat)
398 PSI_FUNC(mknod)
399 PSI_FUNC(mknodat)
400 PSI_FUNC(stat)
401 PSI_FUNC(umask)
402 PSI_FUNC(utimensat)
403 PSI_STRUCT(stat, [
404 [st_dev],
405 [st_ino],
406 [st_mode],
407 [st_nlink],
408 [st_uid],
409 [st_gid],
410 [st_rdev],
411 [st_size],
412 [st_atim], [st_atimespec],
413 [st_mtim], [st_mtimespec],
414 [st_ctim], [st_ctimespec],
415 [st_birthtimespec],
416 [st_blksize],
417 [st_blocks],
418 [st_flags],
419 [st_gen]], [
420 st_?tim) psi_member_type="struct timespec" ;;
421 st_*timespec) psi_member_type="struct timespec" ;;
422 ], sys/stat.h)
423 PSI_CONST(S_IFMT, int, sys/stat.h)
424 PSI_CONST(S_IFBLK, int, sys/stat.h)
425 PSI_CONST(S_IFCHR, int, sys/stat.h)
426 PSI_CONST(S_IFIFO, int, sys/stat.h)
427 PSI_CONST(S_IFREG, int, sys/stat.h)
428 PSI_CONST(S_IFDIR, int, sys/stat.h)
429 PSI_CONST(S_IFLNK, int, sys/stat.h)
430 PSI_CONST(S_IFSOCK, int, sys/stat.h)
431 PSI_CONST(S_IRWXU, int, sys/stat.h)
432 PSI_CONST(S_IRUSR, int, sys/stat.h)
433 PSI_CONST(S_IWUSR, int, sys/stat.h)
434 PSI_CONST(S_IXUSR, int, sys/stat.h)
435 PSI_CONST(S_IRWXG, int, sys/stat.h)
436 PSI_CONST(S_IRGRP, int, sys/stat.h)
437 PSI_CONST(S_IWGRP, int, sys/stat.h)
438 PSI_CONST(S_IXGRP, int, sys/stat.h)
439 PSI_CONST(S_IRWXO, int, sys/stat.h)
440 PSI_CONST(S_IROTH, int, sys/stat.h)
441 PSI_CONST(S_IWOTH, int, sys/stat.h)
442 PSI_CONST(S_IXOTH, int, sys/stat.h)
443 PSI_CONST(S_ISUID, int, sys/stat.h)
444 PSI_CONST(S_ISGID, int, sys/stat.h)
445 PSI_CONST(UTIME_NOW, int, sys/stat.h)
446 PSI_CONST(UTIME_OMIT, int, sys/stat.h)
447 dnl sys/time.h
448 PSI_STRUCT(timeval, [
449 [tv_sec],
450 [tv_usec]], [
451 ], sys/time.h)
452 PSI_STRUCT(itimerval, [
453 [it_interval],
454 [it_value]], [
455 it_*) psi_member_type="struct timeval" ;;
456 ], sys/time.h)
457 PSI_STRUCT(timezone, [
458 [tz_minuteswest],
459 [tz_dsttime]], [
460 ], sys/time.h)
461 PSI_CONST(ITIMER_REAL, int, sys/time.h)
462 PSI_CONST(ITIMER_VIRTUAL, int, sys/time.h)
463 PSI_CONST(ITIMER_PROF, int, sys/time.h)
464 dnl sys/times.h
465 PSI_FUNC(times)
466 PSI_STRUCT(tms, [
467 [tms_utime],
468 [tms_stime],
469 [tms_cutime],
470 [tms_cstime]], [
471 ], sys/times.h)
472 dnl sys/types.h
473 PSI_TYPE(blkcnt_t, int)
474 PSI_TYPE(blksize_t, int)
475 PSI_TYPE(clock_t, int)
476 PSI_TYPE(clockid_t, int)
477 PSI_TYPE(dev_t, int)
478 PSI_TYPE(fsblkcnt_t, uint)
479 PSI_TYPE(fsfilcnt_t, uint)
480 PSI_TYPE(gid_t, int)
481 PSI_TYPE(id_t, int)
482 PSI_TYPE(ino_t, uint)
483 PSI_TYPE(key_t, int)
484 PSI_TYPE(mode_t, int)
485 PSI_TYPE(nlink_t, int)
486 PSI_TYPE(off_t, int)
487 PSI_TYPE(pid_t, int)
488 PSI_TYPE(ssize_t, int)
489 PSI_TYPE(suseconds_t, int)
490 PSI_TYPE(time_t, int)
491 PSI_TYPE(timer_t, int)
492 PSI_TYPE(uid_t)
493 dnl sys/utsname.h
494 PSI_FUNC(uname)
495 PSI_STRUCT(utsname, [
496 [sysname],
497 [nodename],
498 [release],
499 [version],
500 [machine],
501 [domainname]], [
502 *) psi_member_type="char@<:@$psi_member_size@:>@" ;;
503 ], sys/utsname.h)
504 dnl time.h
505 PSI_STRUCT(tm, [
506 [tm_sec],
507 [tm_min],
508 [tm_hour],
509 [tm_mday],
510 [tm_mon],
511 [tm_year],
512 [tm_wday],
513 [tm_yday],
514 [tm_isdst]], [
515 ], time.h)
516 PSI_STRUCT(timespec, [
517 [tv_sec],
518 [tv_nsec]], [
519 ], time.h)
520 PSI_CONST(CLOCKS_PER_SEC, int, time.h)
521 PSI_CONST(CLOCK_MONOTONIC, int, time.h)
522 PSI_CONST(CLOCK_PROCESS_CPUTIME_ID, int, time.h)
523 PSI_CONST(CLOCK_REALTIME, int, time.h)
524 PSI_CONST(CLOCK_THREAD_CPUTIME_ID, int, time.h)
525 PSI_CONST(TIMER_ABSTIME, int, time.h)
526 dnl wchar.h
527 AC_CHECK_TYPE(wint_t, [
528 AX_CHECK_SIGN(wint_t, psi_wint_t=int, psi_wint_t=uint)
529 PSI_TYPE(wint_t, $psi_wint_t, wchar.h)
530 PSI_CONST(WINT_MIN, int, wchar.h)
531 PSI_CONST(WINT_MAX, int, wchar.h)
532 PSI_CONST(WEOF, int, wchar.h)
533 ], [], [
534 AC_INCLUDES_DEFAULT()
535 #include <wchar.h>
536 ])
537
538
539 AC_DEFINE_UNQUOTED(PHP_PSI_FUNCS, $PSI_FUNCS, Redirected functions)
540 AC_DEFINE_UNQUOTED(PHP_PSI_TYPES, $PSI_TYPES, Predefined types)
541 AC_DEFINE_UNQUOTED(PHP_PSI_CONSTS, $PSI_CONSTS, Predefined constants)
542 AC_DEFINE_UNQUOTED(PHP_PSI_STRUCTS, $PSI_STRUCTS, Predefined structs)
543
544 PHP_PSI_SRCDIR=PHP_EXT_SRCDIR(psi)
545 PHP_PSI_BUILDDIR=PHP_EXT_BUILDDIR(psi)
546
547 PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src)
548 PHP_ADD_BUILD_DIR($PHP_PSI_BUILDDIR/src)
549
550 PHP_PSI_HEADERS=`(cd $PHP_PSI_SRCDIR/src && echo *.h)`
551 PHP_PSI_SOURCES="src/parser_proc.c src/parser.c src/module.c src/context.c"
552 PHP_PSI_SOURCES="$PHP_PSI_SOURCES src/libjit.c src/libffi.c"
553
554 PHP_NEW_EXTENSION(psi, $PHP_PSI_SOURCES, $ext_shared)
555 PHP_INSTALL_HEADERS(ext/psi, php_psi.h $PHP_PSI_HEADERS)
556
557 PHP_SUBST(PHP_PSI_HEADERS)
558 PHP_SUBST(PHP_PSI_SOURCES)
559
560 PHP_SUBST(PHP_PSI_SRCDIR)
561 PHP_SUBST(PHP_PSI_BUILDDIR)
562
563 PHP_ADD_MAKEFILE_FRAGMENT
564 fi