fix symbol redirect detection
[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 AC_DEFINE(HAVE_LIBFFI, 1, Have libffi)
35 else
36 AC_CACHE_CHECK(for libffi, PSI_cv_LIBFFI_DIR, [
37 for PSI_cv_LIBFFI_DIR in $PHP_PSI_LIBFFI {/usr{,/local},/opt}{,/libffi}
38 do
39 if test -e $PSI_cv_LIBFFI_DIR/include/ffi/ffi.h
40 then
41 break
42 fi
43 PSI_cv_LIBFFI_DIR=
44 done])
45 if test -n "$PSI_cv_LIBFFI_DIR"
46 then
47 PHP_ADD_INCLUDE($PSI_cv_LIBFFI_DIR/include/ffi)
48 PHP_ADD_LIBRARY_WITH_PATH(ffi, $PSI_cv_LIBFFI_DIR/$PHP_LIBDIR, PSI_SHARED_LIBADD)
49 AC_DEFINE(HAVE_LIBFFI, 1, Have libffi)
50 else
51 AC_MSG_WARN([Could not find libffi, please provide the base install path])
52 fi
53 fi
54 PHP_CHECK_LIBRARY(ffi, ffi_closure_alloc, [
55 PHP_CHECK_LIBRARY(ffi, ffi_prep_closure_loc, [
56 AC_DEFINE(PSI_HAVE_FFI_PREP_CLOSURE_LOC, 1, [ ])
57 ], [], -L$PSI_cv_LIBFFI_DIR/$PHP_LIBDIR)
58 AC_DEFINE(PSI_HAVE_FFI_CLOSURE_ALLOC, 1, [ ])
59 ], [
60 PHP_CHECK_LIBRARY(ffi, ffi_prep_closure, [
61 AC_CHECK_HEADERS(sys/mman.h)
62 PHP_CHECK_FUNC(mmap)
63 AC_DEFINE(PSI_HAVE_FFI_PREP_CLOSURE, 1, [ ])
64 ], [
65 ], -L$PSI_cv_LIBFFI_DIR/$PHP_LIBDIR)
66 ], -L$PSI_cv_LIBFFI_DIR/$PHP_LIBDIR)
67
68 AC_CACHE_CHECK(for libjit, PSI_cv_LIBJIT_DIR, [
69 for PSI_cv_LIBJIT_DIR in $PHP_PSI_LIBJIT {/usr{,/local},/opt}{,/libjit}
70 do
71 if test -e $PSI_cv_LIBJIT_DIR/include/jit/jit.h
72 then
73 break
74 fi
75 PSI_cv_LIBJIT_DIR=
76 done])
77 if test -n "$PSI_cv_LIBJIT_DIR"
78 then
79 PHP_ADD_INCLUDE($PSI_cv_LIBJIT_DIR/include)
80 PHP_ADD_LIBRARY_WITH_PATH(jit, $PSI_cv_LIBJIT_DIR/$PHP_LIBDIR, PSI_SHARED_LIBADD)
81 AC_DEFINE(HAVE_LIBJIT, 1, Have libjit)
82 else
83 AC_MSG_WARN([Could not find libjit, please provide the base install path])
84 fi
85
86 PHP_SUBST(PSI_SHARED_LIBADD)
87
88 dnl PSI_INCLUDES_DEFAULT(include, defines)
89 AC_DEFUN(PSI_INCLUDES_DEFAULT, [
90 AC_INCLUDES_DEFAULT()
91 $2
92 m4_ifnblank($1,
93 m4_expand([#include <]$1[>])
94 )
95 ])
96
97 AC_DEFUN([AX_CHECK_SIGN], [
98 typename=`echo $1 | sed "s/@<:@^a-zA-Z0-9_@:>@/_/g"`
99 AC_CACHE_CHECK([whether $1 is signed], ax_cv_decl_${typename}_signed, [
100 AC_TRY_COMPILE([$4],
101 [ int foo @<:@ 1 - 2 * !((($1) -1) < 0) @:>@ ],
102 [ eval "ax_cv_decl_${typename}_signed=\"yes\"" ],
103 [ eval "ax_cv_decl_${typename}_signed=\"no\"" ])])
104 symbolname=`echo $1 | sed "s/@<:@^a-zA-Z0-9_@:>@/_/g" | tr "a-z" "A-Z"`
105 if eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"yes\""; then
106 $2
107 elif eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"no\""; then
108 $3
109 fi
110 ])
111
112 psi_type_pair() { # (type, size)
113 local psi_type_name=`tr -cd A-Za-z <<<$1`
114 local psi_type_lower=`tr A-Z a-z <<<$psi_type_name`
115 case $psi_type_lower in
116 int*|uint*)
117 local psi_type_upper=`tr a-z A-Z <<<$psi_type_name`
118 local psi_type_bits=`expr $2 \* 8`
119 echo "PSI_T_${psi_type_upper}${psi_type_bits}, \"${psi_type_lower}${psi_type_bits}_t\""
120 ;;
121 struct*)
122 echo "PSI_T_STRUCT, \"$2\""
123 ;;
124 *)
125 echo "PSI_T_NAME, \"$psi_type_name\""
126 ;;
127 esac
128 }
129
130 PSI_TYPES=""
131 dnl PSI_TYPE(type name, basic type, includes)
132 AC_DEFUN(PSI_TYPE, [
133 ifdef(AS_TR_CPP(AC_TYPE_$1), AS_TR_CPP(AC_TYPE_$1))
134 ifdef(AC_TYPE_[]patsubst(translit($1,a-z,A-Z),\W,_),AC_TYPE_[]patsubst(translit($1,a-z,A-Z),\W,_))
135 AC_CHECK_SIZEOF($1, [], PSI_INCLUDES_DEFAULT($3))
136 psi_basic_type=$2
137 case $psi_basic_type in
138 int)
139 AX_CHECK_SIGN($1, :, [
140 psi_basic_type=uint
141 ], PSI_INCLUDES_DEFAULT($3))
142 ;;
143 sint)
144 psi_basic_type=int
145 ;;
146 esac
147 if test "$2" && test "$ac_cv_sizeof_[]$1" -gt 0; then
148 AS_TR_SH(psi_basic_type_$1)=$psi_basic_type
149 PSI_TYPES="{`psi_type_pair $psi_basic_type $ac_cv_sizeof_[]$1`, \""$1"\"}, $PSI_TYPES"
150 fi
151 ])
152
153
154 dnl PSI_COMPUTE_STR(variable, string or expression, includes)
155 AC_DEFUN(PSI_COMPUTE_STR, [
156 AC_TRY_RUN([
157 $3
158 int main() {
159 return EOF == fputs($2, fopen("conftest.out", "w"));
160 }
161 ], [
162 eval $1=\\\"`cat conftest.out`\\\"
163 ])
164 ])
165
166 PSI_CONSTS=""
167 dnl PSI_CONST(const name, type, headers to include)
168 AC_DEFUN(PSI_CONST, [
169 AC_CACHE_CHECK(value of $1, psi_cv_const_$1, [
170 psi_const_val=
171 case $2 in
172 str*|quoted_str*)
173 if test "$cross_compiling" = "yes"
174 then
175 AC_TRY_CPP(PSI_INCLUDES_DEFAULT($3)$1, psi_const_val=`eval "$ac_try|tail -n1"`, psi_const_val=)
176 else
177 PSI_COMPUTE_STR(psi_const_val, $1, PSI_INCLUDES_DEFAULT($3))
178 fi
179 ;;
180 *)
181 AC_COMPUTE_INT(psi_const_val, $1, PSI_INCLUDES_DEFAULT($3))
182 ;;
183 esac
184 psi_cv_const_$1=$psi_const_val
185 ])
186 if test "$psi_cv_const_$1"
187 then
188 case $2 in
189 str*|quoted_str*)
190 PSI_CONSTS="{PSI_T_STRING, \"string\", \"psi\\\\$1\", $psi_cv_const_$1, PSI_T_QUOTED_STRING}, $PSI_CONSTS"
191 ;;
192 *)
193 PSI_CONSTS="{PSI_T_INT, \"int\", \"psi\\\\$1\", \"$psi_cv_const_$1\", PSI_T_NUMBER}, $PSI_CONSTS"
194 ;;
195 esac
196 fi
197 ])
198
199 dnl PSI_CHECK_OFFSETOF(struct, member, include)
200 dnl[AS_LITERAL_IF([$1], [], [m4_fatal([$0: requires literal arguments])])]dnl
201 dnl[AS_LITERAL_IF([$2], [], [m4_fatal([$0: requires literal arguments])])]dnl
202 AC_DEFUN(PSI_CHECK_OFFSETOF, [
203 _AC_CACHE_CHECK_INT(
204 [offset of $2 in $1],
205 [AS_TR_SH([ac_cv_offsetof_$1_$2])],
206 [(long int) (offsetof ($1, $2))],
207 [AC_INCLUDES_DEFAULT([$3])],
208 [AC_MSG_FAILURE([cannot compute offsetof ($1, $2)])]
209 )
210 AC_DEFINE_UNQUOTED(
211 AS_TR_CPP(offsetof_$1_$2),
212 $AS_TR_SH([ac_cv_offsetof_$1_$2]),
213 [The offset of `$2' in `$1', as computed by offsetof.]
214 )
215 ])
216
217 dnl PSI_STRUCT(struct name, members, member type cases, includes)
218 PSI_STRUCTS=
219 AC_DEFUN(PSI_STRUCT, [
220 AC_CHECK_SIZEOF($1, [], PSI_INCLUDES_DEFAULT($4))
221 psi_struct_name=`echo $1 | cut -d" " -f2`
222 psi_struct_size=$AS_TR_SH(ac_cv_sizeof_$1)
223 psi_struct_members=
224 m4_foreach(member, [$2], [
225 AC_CHECK_MEMBER($1.member, [
226 psi_member_name=member
227 AC_CHECK_SIZEOF(AS_TR_SH($1)[_]member, [], PSI_INCLUDES_DEFAULT($4,
228 [#define ]AS_TR_SH($1)[_]member (($1 *)0)->member
229 ))
230 psi_member_size=$AS_TR_SH(ac_cv_sizeof_$1[]_[]member)
231 PSI_CHECK_OFFSETOF($1, member, PSI_INCLUDES_DEFAULT($4))
232 psi_member_offset=$AS_TR_SH(ac_cv_offsetof_$1[]_[]member)
233 # type
234 case member in
235 $3
236 *) psi_member_type=int ;;
237 esac
238 # pointer level
239 psi_struct_member_pl=`echo $psi_member_type | tr -cd '*' | wc -c`
240 # array size
241 psi_struct_member_as=`echo $psi_member_type | $AWK -F'@<:@@:>@@<:@@:>@' 'END {if(!found)print 0} /\@<:@@<:@@<:@:digit:@:>@@:>@+\@:>@/ {found=1; print$[]2}'`
242 if test $psi_struct_member_as -gt 0
243 then
244 psi_struct_member_pl=`expr $psi_struct_member_pl + 1`
245 fi
246 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}"
247 if test "$psi_struct_members"
248 then
249 psi_struct_members="$psi_struct_members, $psi_struct_member"
250 else
251 psi_struct_members="$psi_struct_member"
252 fi
253 ], [], PSI_INCLUDES_DEFAULT($4))
254 ])
255 if test "$1" = "$psi_struct_name"
256 then
257 PSI_TYPES="{PSI_T_STRUCT, \"$psi_struct_name\", \"$psi_struct_name\"}, $PSI_TYPES"
258 fi
259 PSI_STRUCTS="{\"$psi_struct_name\", $psi_struct_size, {$psi_struct_members}}, $PSI_STRUCTS"
260 ])
261
262 PSI_INCLUDES=
263 AC_PROG_NM
264 AC_PROG_AWK
265 PSI_FUNCS=
266 dnl PSI_FUNC(fn, include)
267 AC_DEFUN(PSI_FUNC, [
268 psi_symbol=$1
269 AC_CACHE_CHECK(for $1, psi_cv_fn_$1, [
270 psi_symbol_redirect=
271 AC_TRY_LINK(PSI_INCLUDES_DEFAULT($2), [
272 void (*fn)(void) = (void (*)(void)) $psi_symbol;
273 ], [
274 psi_symbol_redirect=`$NM -g conftest$ac_exeext | $AWK -F" *|@" '/ U .*$1.*/ {print$[]3}'`
275 ])
276 psi_cv_fn_$1=$psi_symbol_redirect
277 ])
278 case "$psi_cv_fn_$1" in
279 "$psi_symbol"|"_$psi_symbol"|"")
280 ;;
281 *)
282 PSI_FUNCS="{\"$psi_symbol\", (void (*)(void)) $psi_symbol}, $PSI_FUNCS"
283 ;;
284 esac
285 ])
286
287 PSI_MACROS=
288 dnl PSI_MACRO(macro, return type, decl args, call args, include)
289 AC_DEFUN(PSI_MACRO, [
290 AC_CHECK_DECL($1$3, [
291 PSI_MACROS="static $2 psi_macro_$1$3 { ifelse($2,void,,return) $1$4;} $PSI_MACROS"
292 PSI_FUNCS="{\"$1\", (void (*)(void)) psi_macro_$1}, $PSI_FUNCS"
293 ], [], PSI_INCLUDES_DEFAULT($5))
294 ])
295
296 dnl PSI_DECL(var, type, include)
297 AC_DEFUN(PSI_DECL, [
298 AC_CHECK_DECL($1, [
299 PSI_MACROS="static $2 psi_macro_$1(void) {return $1;} $PSI_MACROS"
300 PSI_FUNCS="{\"$1\", (void (*)(void)) psi_macro_$1}, $PSI_FUNCS"
301 ], [], PSI_INCLUDES_DEFAULT($3))
302 ])
303
304 CPPFLAGS="$CPPFLAGS -D_DARWIN_USE_64_BIT_INODE"
305 AC_FUNC_FNMATCH
306 AC_HEADER_DIRENT
307
308 AC_TYPE_INT8_T
309 AC_CHECK_ALIGNOF(int8_t)
310 AC_TYPE_UINT8_T
311 AC_CHECK_ALIGNOF(uint8_t)
312 AC_TYPE_INT16_T
313 AC_CHECK_ALIGNOF(int16_t)
314 AC_TYPE_UINT16_T
315 AC_CHECK_ALIGNOF(uint16_t)
316 AC_TYPE_INT32_T
317 AC_CHECK_ALIGNOF(int32_t)
318 AC_TYPE_UINT32_T
319 AC_CHECK_ALIGNOF(uint32_t)
320 AC_TYPE_INT64_T
321 AC_CHECK_ALIGNOF(int64_t)
322 AC_TYPE_UINT64_T
323 AC_CHECK_ALIGNOF(uint64_t)
324
325 PSI_TYPE(char, int)
326 PSI_TYPE(short, int)
327 PSI_TYPE(int, int)
328 PSI_TYPE(long, int)
329 PSI_TYPE(float)
330 PSI_TYPE(double)
331 PSI_TYPE(void *)
332
333 dnl sys/types.h
334 AC_CHECK_HEADERS(sys/types.h)
335 PSI_TYPE(blkcnt_t, int)
336 PSI_TYPE(blksize_t, int)
337 PSI_TYPE(clock_t, int)
338 PSI_TYPE(clockid_t, int)
339 PSI_TYPE(dev_t, int)
340 PSI_TYPE(fsblkcnt_t, uint)
341 PSI_TYPE(fsfilcnt_t, uint)
342 PSI_TYPE(gid_t, int)
343 PSI_TYPE(id_t, int)
344 PSI_TYPE(ino_t, uint)
345 PSI_TYPE(key_t, int)
346 PSI_TYPE(mode_t, int)
347 PSI_TYPE(nlink_t, int)
348 PSI_TYPE(off_t, int)
349 PSI_TYPE(pid_t, int)
350 PSI_TYPE(ssize_t, int)
351 PSI_TYPE(suseconds_t, int)
352 PSI_TYPE(time_t, int)
353 PSI_TYPE(timer_t, int)
354 PSI_TYPE(uid_t, int)
355
356 dnl stdint.h
357 AC_CHECK_HEADERS(stdint.h)
358 PSI_TYPE(int_least8_t, int)
359 PSI_TYPE(int_least16_t, int)
360 PSI_TYPE(int_least32_t, int)
361 PSI_TYPE(int_least64_t, int)
362 PSI_TYPE(uint_least8_t, uint)
363 PSI_TYPE(uint_least16_t, uint)
364 PSI_TYPE(uint_least32_t, uint)
365 PSI_TYPE(uint_least64_t, uint)
366 PSI_TYPE(int_fast8_t, int)
367 PSI_TYPE(int_fast16_t, int)
368 PSI_TYPE(int_fast32_t, int)
369 PSI_TYPE(int_fast64_t, int)
370 PSI_TYPE(uint_fast8_t, uint)
371 PSI_TYPE(uint_fast16_t, uint)
372 PSI_TYPE(uint_fast32_t, uint)
373 PSI_TYPE(uint_fast64_t, uint)
374 PSI_TYPE(intptr_t, int)
375 PSI_TYPE(uintptr_t, uint)
376 PSI_TYPE(intmax_t, int)
377 PSI_TYPE(uintmax_t, uint)
378
379 PSI_CONST(INT8_MIN, int)
380 PSI_CONST(INT8_MAX, int)
381 PSI_CONST(UINT8_MAX, int)
382 PSI_CONST(INT16_MIN, int)
383 PSI_CONST(INT16_MAX, int)
384 PSI_CONST(UINT16_MAX, int)
385 PSI_CONST(INT32_MIN, int)
386 PSI_CONST(INT32_MAX, int)
387 PSI_CONST(UINT32_MAX, int)
388 PSI_CONST(INT64_MIN, int)
389 PSI_CONST(INT64_MAX, int)
390 PSI_CONST(UINT64_MAX, int)
391
392 PSI_CONST(INT_LEAST8_MIN, int)
393 PSI_CONST(INT_LEAST8_MAX, int)
394 PSI_CONST(UINT_LEAST8_MAX, int)
395 PSI_CONST(INT_LEAST16_MIN, int)
396 PSI_CONST(INT_LEAST16_MAX, int)
397 PSI_CONST(UINT_LEAST16_MAX, int)
398 PSI_CONST(INT_LEAST32_MIN, int)
399 PSI_CONST(INT_LEAST32_MAX, int)
400 PSI_CONST(UINT_LEAST32_MAX, int)
401 PSI_CONST(INT_LEAST64_MIN, int)
402 PSI_CONST(INT_LEAST64_MAX, int)
403 PSI_CONST(UINT_LEAST64_MAX, int)
404
405 PSI_CONST(INT_FAST8_MIN, int)
406 PSI_CONST(INT_FAST8_MAX, int)
407 PSI_CONST(UINT_FAST8_MAX, int)
408 PSI_CONST(INT_FAST16_MIN, int)
409 PSI_CONST(INT_FAST16_MAX, int)
410 PSI_CONST(UINT_FAST16_MAX, int)
411 PSI_CONST(INT_FAST32_MIN, int)
412 PSI_CONST(INT_FAST32_MAX, int)
413 PSI_CONST(UINT_FAST32_MAX, int)
414 PSI_CONST(INT_FAST64_MIN, int)
415 PSI_CONST(INT_FAST64_MAX, int)
416 PSI_CONST(UINT_FAST64_MAX, int)
417
418 PSI_CONST(INTPTR_MIN, int)
419 PSI_CONST(INTPTR_MAX, int)
420 PSI_CONST(UINTPTR_MAX, int)
421 PSI_CONST(INTMAX_MIN, int)
422 PSI_CONST(INTMAX_MAX, int)
423 PSI_CONST(UINTMAX_MAX, int)
424
425 dnl stddef.h
426 PSI_TYPE(ptrdiff_t, int)
427 PSI_CONST(PTRDIFF_MIN, int)
428 PSI_CONST(PTRDIFF_MAX, int)
429 PSI_TYPE(size_t, uint)
430 PSI_CONST(SIZE_MAX, int)
431 PSI_TYPE(wchar_t, int)
432 PSI_CONST(WCHAR_MIN, int)
433 PSI_CONST(WCHAR_MAX, int)
434
435 dnl errno.h
436 AC_CHECK_HEADERS(errno.h)
437 PSI_MACRO(errno, int, [()], [], errno.h)
438 PSI_CONST(E2BIG, int, errno.h)
439 PSI_CONST(EACCES, int, errno.h)
440 PSI_CONST(EADDRINUSE, int, errno.h)
441 PSI_CONST(EADDRNOTAVAIL, int, errno.h)
442 PSI_CONST(EAFNOSUPPORT, int, errno.h)
443 PSI_CONST(EAGAIN, int, errno.h)
444 PSI_CONST(EALREADY, int, errno.h)
445 PSI_CONST(EBADF, int, errno.h)
446 PSI_CONST(EBADMSG, int, errno.h)
447 PSI_CONST(EBUSY, int, errno.h)
448 PSI_CONST(ECANCELED, int, errno.h)
449 PSI_CONST(ECHILD, int, errno.h)
450 PSI_CONST(ECONNABORTED, int, errno.h)
451 PSI_CONST(ECONNREFUSED, int, errno.h)
452 PSI_CONST(ECONNRESET, int, errno.h)
453 PSI_CONST(EDEADLK, int, errno.h)
454 PSI_CONST(EDESTADDRREQ, int, errno.h)
455 PSI_CONST(EDOM, int, errno.h)
456 PSI_CONST(EDQUOT, int, errno.h)
457 PSI_CONST(EEXIST, int, errno.h)
458 PSI_CONST(EFAULT, int, errno.h)
459 PSI_CONST(EFBIG, int, errno.h)
460 PSI_CONST(EHOSTUNREACH, int, errno.h)
461 PSI_CONST(EIDRM, int, errno.h)
462 PSI_CONST(EILSEQ, int, errno.h)
463 PSI_CONST(EINPROGRESS, int, errno.h)
464 PSI_CONST(EINTR, int, errno.h)
465 PSI_CONST(EINVAL, int, errno.h)
466 PSI_CONST(EIO, int, errno.h)
467 PSI_CONST(EISCONN, int, errno.h)
468 PSI_CONST(EISDIR, int, errno.h)
469 PSI_CONST(ELOOP, int, errno.h)
470 PSI_CONST(EMFILE, int, errno.h)
471 PSI_CONST(EMLINK, int, errno.h)
472 PSI_CONST(EMSGSIZE, int, errno.h)
473 PSI_CONST(EMULTIHOP, int, errno.h)
474 PSI_CONST(ENAMETOOLONG, int, errno.h)
475 PSI_CONST(ENETDOWN, int, errno.h)
476 PSI_CONST(ENETRESET, int, errno.h)
477 PSI_CONST(ENETUNREACH, int, errno.h)
478 PSI_CONST(ENFILE, int, errno.h)
479 PSI_CONST(ENOBUFS, int, errno.h)
480 PSI_CONST(ENODATA, int, errno.h)
481 PSI_CONST(ENODEV, int, errno.h)
482 PSI_CONST(ENOENT, int, errno.h)
483 PSI_CONST(ENOEXEC, int, errno.h)
484 PSI_CONST(ENOLCK, int, errno.h)
485 PSI_CONST(ENOLINK, int, errno.h)
486 PSI_CONST(ENOMEM, int, errno.h)
487 PSI_CONST(ENOMSG, int, errno.h)
488 PSI_CONST(ENOPROTOOPT, int, errno.h)
489 PSI_CONST(ENOSPC, int, errno.h)
490 PSI_CONST(ENOSR, int, errno.h)
491 PSI_CONST(ENOSTR, int, errno.h)
492 PSI_CONST(ENOSYS, int, errno.h)
493 PSI_CONST(ENOTCONN, int, errno.h)
494 PSI_CONST(ENOTDIR, int, errno.h)
495 PSI_CONST(ENOTEMPTY, int, errno.h)
496 PSI_CONST(ENOTRECOVERABLE, int, errno.h)
497 PSI_CONST(ENOTSOCK, int, errno.h)
498 PSI_CONST(ENOTSUP, int, errno.h)
499 PSI_CONST(ENOTTY, int, errno.h)
500 PSI_CONST(ENXIO, int, errno.h)
501 PSI_CONST(EOPNOTSUPP, int, errno.h)
502 PSI_CONST(EOVERFLOW, int, errno.h)
503 PSI_CONST(EOWNERDEAD, int, errno.h)
504 PSI_CONST(EPERM, int, errno.h)
505 PSI_CONST(EPIPE, int, errno.h)
506 PSI_CONST(EPROTO, int, errno.h)
507 PSI_CONST(EPROTONOSUPPORT, int, errno.h)
508 PSI_CONST(EPROTOTYPE, int, errno.h)
509 PSI_CONST(ERANGE, int, errno.h)
510 PSI_CONST(EROFS, int, errno.h)
511 PSI_CONST(ESPIPE, int, errno.h)
512 PSI_CONST(ESRCH, int, errno.h)
513 PSI_CONST(ESTALE, int, errno.h)
514 PSI_CONST(ETIME, int, errno.h)
515 PSI_CONST(ETIMEDOUT, int, errno.h)
516 PSI_CONST(ETXTBSY, int, errno.h)
517 PSI_CONST(EWOULDBLOCK, int, errno.h)
518 PSI_CONST(EXDEV, int, errno.h)
519
520 dnl glob.h
521 AC_CHECK_HEADERS(glob.h)
522 PSI_FUNC(glob, glob.h)
523 PSI_FUNC(globfree, glob.h)
524 PSI_STRUCT(glob_t, [
525 [gl_pathc], [gl_matchc],
526 [gl_pathv],
527 [gl_offs],
528 [gl_flags]], [
529 gl_matchc|gl_pathc|gloffs) psi_member_type=uint ;;
530 gl_pathv) psi_member_type="char**" ;;
531 ], glob.h)
532 PSI_CONST(GLOB_APPEND, int, glob.h)
533 PSI_CONST(GLOB_BRACE, int, glob.h)
534 PSI_CONST(GLOB_DOOFFS, int, glob.h)
535 PSI_CONST(GLOB_ERR, int, glob.h)
536 PSI_CONST(GLOB_MARK, int, glob.h)
537 PSI_CONST(GLOB_NOCHECK, int, glob.h)
538 PSI_CONST(GLOB_NOESCAPE, int, glob.h)
539 PSI_CONST(GLOB_NOMAGIC, int, glob.h)
540 PSI_CONST(GLOB_NOSORT, int, glob.h)
541 PSI_CONST(GLOB_ONLYDIR, int, glob.h)
542 PSI_CONST(GLOB_PERIOD, int, glob.h)
543 PSI_CONST(GLOB_TILDE, int, glob.h)
544 PSI_CONST(GLOB_TILDE_CHECK, int, glob.h)
545 PSI_CONST(GLOB_ABORTED, int, glob.h)
546 PSI_CONST(GLOB_NOMATCH, int, glob.h)
547 PSI_CONST(GLOB_NOSPACE, int, glob.h)
548
549 dnl stdio.h
550 PSI_CONST(BUFSIZ, int)
551 PSI_CONST(_IOFBF, int)
552 PSI_CONST(_IOLBF, int)
553 PSI_CONST(_IONBF, int)
554 PSI_CONST(SEEK_CUR, int)
555 PSI_CONST(SEEK_END, int)
556 PSI_CONST(SEEK_SET, int)
557 PSI_CONST(FILENAME_MAX, int)
558 PSI_CONST(FOPEN_MAX, int)
559 PSI_CONST(TMP_MAX, int)
560 PSI_CONST(EOF, int)
561 PSI_CONST(P_tmpdir, string)
562 PSI_CONST(L_ctermid, int)
563 PSI_CONST(L_tmpnam, int)
564 PSI_FUNC(clearerr, stdio.h)
565 PSI_FUNC(ctermid, stdio.h)
566 PSI_FUNC(dprintf, stdio.h)
567 PSI_FUNC(fclose, stdio.h)
568 PSI_FUNC(fdopen, stdio.h)
569 PSI_FUNC(feof, stdio.h)
570 PSI_FUNC(ferror, stdio.h)
571 PSI_FUNC(fflush, stdio.h)
572 PSI_FUNC(fgetc, stdio.h)
573 PSI_FUNC(fgetpos, stdio.h)
574 PSI_FUNC(fgets, stdio.h)
575 PSI_FUNC(fileno, stdio.h)
576 PSI_FUNC(flockfile, stdio.h)
577 PSI_FUNC(fmemopen, stdio.h)
578 PSI_FUNC(fopen, stdio.h)
579 PSI_FUNC(fprintf, stdio.h)
580 PSI_FUNC(fputc, stdio.h)
581 PSI_FUNC(fputs, stdio.h)
582 PSI_FUNC(fread, stdio.h)
583 PSI_FUNC(freopen, stdio.h)
584 PSI_FUNC(fscanf, stdio.h)
585 PSI_FUNC(fseek, stdio.h)
586 PSI_FUNC(fseeko, stdio.h)
587 PSI_FUNC(fsetpos, stdio.h)
588 PSI_FUNC(ftell, stdio.h)
589 PSI_FUNC(ftello, stdio.h)
590 PSI_FUNC(ftrylockfile, stdio.h)
591 PSI_FUNC(funlockfile, stdio.h)
592 PSI_FUNC(fwrite, stdio.h)
593 PSI_FUNC(getc, stdio.h)
594 PSI_FUNC(getchar, stdio.h)
595 PSI_FUNC(getc_unlocked, stdio.h)
596 PSI_FUNC(getchar_unlocked, stdio.h)
597 PSI_FUNC(getdelim, stdio.h)
598 PSI_FUNC(getline, stdio.h)
599 PSI_FUNC(gets, stdio.h)
600 PSI_FUNC(open_memstream, stdio.h)
601 PSI_FUNC(pclose, stdio.h)
602 PSI_FUNC(perror, stdio.h)
603 PSI_FUNC(popen, stdio.h)
604 PSI_FUNC(printf, stdio.h)
605 PSI_FUNC(putc, stdio.h)
606 PSI_FUNC(putchar, stdio.h)
607 PSI_FUNC(putc_unlocked, stdio.h)
608 PSI_FUNC(putchar_unlocked, stdio.h)
609 PSI_FUNC(puts, stdio.h)
610 PSI_FUNC(remove, stdio.h)
611 PSI_FUNC(rename, stdio.h)
612 PSI_FUNC(renameat, stdio.h)
613 PSI_FUNC(rewind, stdio.h)
614 PSI_FUNC(scanf, stdio.h)
615 PSI_FUNC(setbuf, stdio.h)
616 PSI_FUNC(setvbuf, stdio.h)
617 PSI_FUNC(snprintf, stdio.h)
618 PSI_FUNC(sprintf, stdio.h)
619 PSI_FUNC(sscanf, stdio.h)
620 PSI_FUNC(tempnam, stdio.h)
621 PSI_FUNC(tmpfile, stdio.h)
622 PSI_FUNC(tmpnam, stdio.h)
623 PSI_FUNC(ungetc, stdio.h)
624 PSI_FUNC(vdprintf, stdio.h)
625 PSI_FUNC(vfprintf, stdio.h)
626 PSI_FUNC(vfscanf, stdio.h)
627 PSI_FUNC(vprintf, stdio.h)
628 PSI_FUNC(vscanf, stdio.h)
629 PSI_FUNC(vsnprintf, stdio.h)
630 PSI_FUNC(vsprintf, stdio.h)
631 PSI_FUNC(vsscanf, stdio.h)
632
633 dnl stdlib.h
634 PSI_FUNC(_Exit, stdlib.h)
635 PSI_FUNC(a64l, stdlib.h)
636 PSI_FUNC(abort, stdlib.h)
637 PSI_FUNC(abs, stdlib.h)
638 PSI_FUNC(atexit, stdlib.h)
639 PSI_FUNC(atof, stdlib.h)
640 PSI_FUNC(atoi, stdlib.h)
641 PSI_FUNC(atol, stdlib.h)
642 PSI_FUNC(atoll, stdlib.h)
643 PSI_FUNC(div, stdlib.h)
644 PSI_FUNC(drand48, stdlib.h)
645 PSI_FUNC(erand48, stdlib.h)
646 PSI_FUNC(exit, stdlib.h)
647 PSI_FUNC(free, stdlib.h)
648 PSI_FUNC(getsubopt, stdlib.h)
649 PSI_FUNC(grantpt, stdlib.h)
650 PSI_FUNC(jrand48, stdlib.h)
651 PSI_FUNC(labs, stdlib.h)
652 PSI_FUNC(lcong48, stdlib.h)
653 PSI_FUNC(ldiv, stdlib.h)
654 PSI_FUNC(llabs, stdlib.h)
655 PSI_FUNC(lldiv, stdlib.h)
656 PSI_FUNC(lrand48, stdlib.h)
657 PSI_FUNC(mblen, stdlib.h)
658 PSI_FUNC(mbstowcs, stdlib.h)
659 PSI_FUNC(mbtowc, stdlib.h)
660 PSI_FUNC(mkstemp, stdlib.h)
661 PSI_FUNC(mrand48, stdlib.h)
662 PSI_FUNC(nrand48, stdlib.h)
663 PSI_FUNC(posix_memalign, stdlib.h)
664 PSI_FUNC(posix_openpt, stdlib.h)
665 PSI_FUNC(putenv, stdlib.h)
666 PSI_FUNC(qsort, stdlib.h)
667 PSI_FUNC(rand, stdlib.h)
668 PSI_FUNC(rand_r, stdlib.h)
669 PSI_FUNC(random, stdlib.h)
670 PSI_FUNC(setenv, stdlib.h)
671 PSI_FUNC(setkey, stdlib.h)
672 PSI_FUNC(srand, stdlib.h)
673 PSI_FUNC(srand48, stdlib.h)
674 PSI_FUNC(srandom, stdlib.h)
675 PSI_FUNC(strtod, stdlib.h)
676 PSI_FUNC(strtof, stdlib.h)
677 PSI_FUNC(strtol, stdlib.h)
678 PSI_FUNC(strtold, stdlib.h)
679 PSI_FUNC(strtoll, stdlib.h)
680 PSI_FUNC(strtoul, stdlib.h)
681 PSI_FUNC(system, stdlib.h)
682 PSI_FUNC(unlockpt, stdlib.h)
683 PSI_FUNC(unsetenv, stdlib.h)
684 PSI_FUNC(wcstombs, stdlib.h)
685 PSI_FUNC(wctomb, stdlib.h)
686 PSI_CONST(EXIT_FAILURE, int)
687 PSI_CONST(EXIT_SUCCESS, int)
688 PSI_CONST(RAND_MAX, int)
689 PSI_CONST(MB_CUR_MAX, int)
690
691 dnl sys/stat.h
692 AC_CHECK_HEADERS(sys/stat.h)
693 PSI_FUNC(chmod, sys/stat.h)
694 PSI_FUNC(fchmod, sys/stat.h)
695 PSI_FUNC(fchmodat, sys/stat.h)
696 PSI_FUNC(fstat, sys/stat.h)
697 PSI_FUNC(fstatat, sys/stat.h)
698 PSI_FUNC(futimens, sys/stat.h)
699 PSI_FUNC(lstat, sys/stat.h)
700 PSI_FUNC(mkdir, sys/stat.h)
701 PSI_FUNC(mkdirat, sys/stat.h)
702 PSI_FUNC(mkfifo, sys/stat.h)
703 PSI_FUNC(mkfifoat, sys/stat.h)
704 PSI_FUNC(mknod, sys/stat.h)
705 PSI_FUNC(mknodat, sys/stat.h)
706 PSI_FUNC(stat, sys/stat.h)
707 PSI_FUNC(umask, sys/stat.h)
708 PSI_FUNC(utimensat, sys/stat.h)
709 PSI_STRUCT(struct stat, [
710 [st_dev],
711 [st_ino],
712 [st_mode],
713 [st_nlink],
714 [st_uid],
715 [st_gid],
716 [st_rdev],
717 [st_size],
718 [st_atim], [st_atimespec], [st_atime],
719 [st_mtim], [st_mtimespec], [st_mtime],
720 [st_ctim], [st_ctimespec], [st_ctime],
721 [st_birthtimespec], [st_birthtime],
722 [st_blksize],
723 [st_blocks],
724 [st_flags],
725 [st_gen],
726 [st_lspare]], [
727 st_dev) psi_member_type=$psi_basic_type_dev_t ;;
728 st_ino) psi_member_type=$psi_basic_type_ino_t ;;
729 st_mode) psi_member_type=$psi_basic_type_mode_t ;;
730 st_nlink) psi_member_type=$psi_basic_type_nlink_t ;;
731 st_uid) psi_member_type=$psi_basic_type_uid_t ;;
732 st_gid) psi_member_type=$psi_basic_type_gid_t ;;
733 st_rdev) psi_member_type=$psi_basic_type_dev_t ;;
734 st_size) psi_member_type=$psi_basic_type_off_t ;;
735 st_blksize) psi_member_type=$psi_basic_type_blksize_t ;;
736 st_blkcnt) psi_member_type=$psi_basic_type_blkcnt_t ;;
737 st_?tim) psi_member_type="struct timespec" ;;
738 st_*time) psi_member_type=$psi_basic_type_time_t ;;
739 st_*timespec) psi_member_type="struct timespec" ;;
740 ], sys/stat.h)
741 PSI_CONST(S_IFMT, int, sys/stat.h)
742 PSI_CONST(S_IFBLK, int, sys/stat.h)
743 PSI_CONST(S_IFCHR, int, sys/stat.h)
744 PSI_CONST(S_IFIFO, int, sys/stat.h)
745 PSI_CONST(S_IFREG, int, sys/stat.h)
746 PSI_CONST(S_IFDIR, int, sys/stat.h)
747 PSI_CONST(S_IFLNK, int, sys/stat.h)
748 PSI_CONST(S_IFSOCK, int, sys/stat.h)
749 PSI_CONST(S_IRWXU, int, sys/stat.h)
750 PSI_CONST(S_IRUSR, int, sys/stat.h)
751 PSI_CONST(S_IWUSR, int, sys/stat.h)
752 PSI_CONST(S_IXUSR, int, sys/stat.h)
753 PSI_CONST(S_IRWXG, int, sys/stat.h)
754 PSI_CONST(S_IRGRP, int, sys/stat.h)
755 PSI_CONST(S_IWGRP, int, sys/stat.h)
756 PSI_CONST(S_IXGRP, int, sys/stat.h)
757 PSI_CONST(S_IRWXO, int, sys/stat.h)
758 PSI_CONST(S_IROTH, int, sys/stat.h)
759 PSI_CONST(S_IWOTH, int, sys/stat.h)
760 PSI_CONST(S_IXOTH, int, sys/stat.h)
761 PSI_CONST(S_ISUID, int, sys/stat.h)
762 PSI_CONST(S_ISGID, int, sys/stat.h)
763 PSI_CONST(UTIME_NOW, int, sys/stat.h)
764 PSI_CONST(UTIME_OMIT, int, sys/stat.h)
765 PSI_MACRO(S_ISBLK, int, [(mode_t m)], [(m)], sys/stat.h)
766 PSI_MACRO(S_ISCHR, int, [(mode_t m)], [(m)], sys/stat.h)
767 PSI_MACRO(S_ISDIR, int, [(mode_t m)], [(m)], sys/stat.h)
768 PSI_MACRO(S_ISFIFO, int, [(mode_t m)], [(m)], sys/stat.h)
769 PSI_MACRO(S_ISREG, int, [(mode_t m)], [(m)], sys/stat.h)
770 PSI_MACRO(S_ISLNK, int, [(mode_t m)], [(m)], sys/stat.h)
771 PSI_MACRO(S_ISSOCK, int, [(mode_t m)], [(m)], sys/stat.h)
772 PSI_MACRO(S_TYPEISMQ, int, [(struct stat *s)], [(s)], sys/stat.h)
773 PSI_MACRO(S_TYPEISSEM, int, [(struct stat *s)], [(s)], sys/stat.h)
774 PSI_MACRO(S_TYPEISSHM, int, [(struct stat *s)], [(s)], sys/stat.h)
775 PSI_MACRO(S_TYPEISTMO, int, [(struct stat *s)], [(s)], sys/stat.h)
776
777 dnl sys/time.h
778 AC_CHECK_HEADERS(sys/time.h)
779 PSI_STRUCT(struct timeval, [
780 [tv_sec],
781 [tv_usec]], [
782 tv_sec) psi_member_type=$psi_basic_type_time_t ;;
783 tv_usec) psi_member_type=$psi_basic_type_suseconds_t ;;
784 ], sys/time.h)
785 PSI_STRUCT(struct itimerval, [
786 [it_interval],
787 [it_value]], [
788 it_*) psi_member_type="struct timeval" ;;
789 ], sys/time.h)
790 PSI_STRUCT(struct timezone, [
791 [tz_minuteswest],
792 [tz_dsttime]], [
793 ], sys/time.h)
794 PSI_FUNC(getitimer, sys/time.h)
795 PSI_FUNC(gettimeofday, sys/time.h)
796 PSI_FUNC(setitimer, sys/time.h)
797 PSI_FUNC(utimes, sys/time.h)
798 PSI_CONST(ITIMER_REAL, int, sys/time.h)
799 PSI_CONST(ITIMER_VIRTUAL, int, sys/time.h)
800 PSI_CONST(ITIMER_PROF, int, sys/time.h)
801
802 dnl sys/select.h
803 AC_CHECK_HEADERS(sys/select.h)
804 PSI_STRUCT(fd_set, [], [], sys/select.h)
805 PSI_FUNC(select, sys/select.h)
806 PSI_FUNC(pselect, sys/select.h)
807 PSI_CONST(FD_SETSIZE, int, sys/select.h)
808 PSI_MACRO(FD_CLEAR, void, [(int fd, fd_set *s)], [(fd, s)], sys/select.h)
809 PSI_MACRO(FD_COPY, void, [(fd_set *s1, fd_set *s2)], [(s1, s2)], sys/select.h)
810 PSI_MACRO(FD_CLR, void, [(int fd, fd_set *s)], [(fd, s)], sys/select.h)
811 PSI_MACRO(FD_SET, void, [(int fd, fd_set *s)], [(fd, s)], sys/select.h)
812 PSI_MACRO(FD_ISSET, int, [(int fd, fd_set *s)], [(fd, s)], sys/select.h)
813 PSI_MACRO(FD_ZERO, void, [(fd_set *s)], [(s)], sys/select.h)
814
815 dnl sys/times.h
816 AC_CHECK_HEADERS(sys/times.h)
817 PSI_FUNC(times, sys/times.h)
818 PSI_STRUCT(struct tms, [
819 [tms_utime],
820 [tms_stime],
821 [tms_cutime],
822 [tms_cstime]], [
823 tms_*) psi_member_type=$psi_basic_type_clock_t ;;
824 ], sys/times.h)
825
826 dnl sys/utsname.h
827 AC_CHECK_HEADERS(sys/utsname.h)
828 PSI_FUNC(uname, sys/utsname.h)
829 PSI_STRUCT(struct utsname, [
830 [sysname],
831 [nodename],
832 [release],
833 [version],
834 [machine],
835 [domainname]], [
836 *) psi_member_type="char@<:@$psi_member_size@:>@" ;;
837 ], sys/utsname.h)
838
839 dnl time.h
840 AC_CHECK_HEADERS(time.h)
841 PSI_STRUCT(struct tm, [
842 [tm_sec],
843 [tm_min],
844 [tm_hour],
845 [tm_mday],
846 [tm_mon],
847 [tm_year],
848 [tm_wday],
849 [tm_yday],
850 [tm_isdst]], [
851 ], time.h)
852 PSI_STRUCT(struct timespec, [
853 [tv_sec],
854 [tv_nsec]], [
855 tv_sec) psi_member_type=$psi_basic_type_time_t ;;
856 ], time.h)
857 PSI_FUNC(clock, time.h)
858 PSI_FUNC(clock_getcpuclockid, time.h)
859 PSI_FUNC(clock_getres, time.h)
860 PSI_FUNC(clock_gettime, time.h)
861 PSI_FUNC(clock_settime, time.h)
862 PSI_FUNC(difftime, time.h)
863 PSI_FUNC(mktime, time.h)
864 PSI_FUNC(nanosleep, time.h)
865 PSI_FUNC(time, time.h)
866 PSI_FUNC(timer_delete, time.h)
867 PSI_FUNC(timer_getoverrun, time.h)
868 PSI_FUNC(timer_gettime, time.h)
869 PSI_FUNC(tzset, time.h)
870 PSI_CONST(CLOCKS_PER_SEC, int, time.h)
871 PSI_CONST(CLOCK_MONOTONIC, int, time.h)
872 PSI_CONST(CLOCK_PROCESS_CPUTIME_ID, int, time.h)
873 PSI_CONST(CLOCK_REALTIME, int, time.h)
874 PSI_CONST(CLOCK_THREAD_CPUTIME_ID, int, time.h)
875 PSI_CONST(TIMER_ABSTIME, int, time.h)
876
877 dnl unistd.h
878 AC_CHECK_HEADERS(unistd.h)
879 PSI_CONST(F_LOCK, int, unistd.h)
880 PSI_CONST(F_OK, int, unistd.h)
881 PSI_CONST(F_TEST, int, unistd.h)
882 PSI_CONST(F_TLOCK, int, unistd.h)
883 PSI_CONST(F_ULOCK, int, unistd.h)
884 PSI_CONST(R_OK, int, unistd.h)
885 PSI_CONST(STDERR_FILENO, int, unistd.h)
886 PSI_CONST(STDIN_FILENO, int, unistd.h)
887 PSI_CONST(STDOUT_FILENO, int, unistd.h)
888 PSI_CONST(W_OK, int, unistd.h)
889 PSI_CONST(X_OK, int, unistd.h)
890 PSI_CONST(_CS_PATH, int, unistd.h)
891 PSI_CONST(_PC_ALLOC_SIZE_MIN, int, unistd.h)
892 PSI_CONST(_PC_ASYNC_IO, int, unistd.h)
893 PSI_CONST(_PC_CHOWN_RESTRICTED, int, unistd.h)
894 PSI_CONST(_PC_FILESIZEBITS, int, unistd.h)
895 PSI_CONST(_PC_LINK_MAX, int, unistd.h)
896 PSI_CONST(_PC_MAX_CANON, int, unistd.h)
897 PSI_CONST(_PC_MAX_INPUT, int, unistd.h)
898 PSI_CONST(_PC_NAME_MAX, int, unistd.h)
899 PSI_CONST(_PC_NO_TRUNC, int, unistd.h)
900 PSI_CONST(_PC_PATH_MAX, int, unistd.h)
901 PSI_CONST(_PC_PIPE_BUF, int, unistd.h)
902 PSI_CONST(_PC_PRIO_IO, int, unistd.h)
903 PSI_CONST(_PC_REC_INCR_XFER_SIZE, int, unistd.h)
904 PSI_CONST(_PC_REC_MAX_XFER_SIZE, int, unistd.h)
905 PSI_CONST(_PC_REC_MIN_XFER_SIZE, int, unistd.h)
906 PSI_CONST(_PC_REC_XFER_ALIGN, int, unistd.h)
907 PSI_CONST(_PC_SYMLINK_MAX, int, unistd.h)
908 PSI_CONST(_PC_SYNC_IO, int, unistd.h)
909 PSI_CONST(_PC_TIMESTAMP_RESOLUTION, int, unistd.h)
910 PSI_CONST(_PC_VDISABLE, int, unistd.h)
911 PSI_CONST(_POSIX_ADVISORY_INFO, int, unistd.h)
912 PSI_CONST(_POSIX_ASYNCHRONOUS_IO, int, unistd.h)
913 PSI_CONST(_POSIX_ASYNC_IO, int, unistd.h)
914 PSI_CONST(_POSIX_BARRIERS, int, unistd.h)
915 PSI_CONST(_POSIX_CHOWN_RESTRICTED, int, unistd.h)
916 PSI_CONST(_POSIX_CLOCK_SELECTION, int, unistd.h)
917 PSI_CONST(_POSIX_CPUTIME, int, unistd.h)
918 PSI_CONST(_POSIX_FSYNC, int, unistd.h)
919 PSI_CONST(_POSIX_JOB_CONTROL, int, unistd.h)
920 PSI_CONST(_POSIX_MAPPED_FILES, int, unistd.h)
921 PSI_CONST(_POSIX_MEMLOCK, int, unistd.h)
922 PSI_CONST(_POSIX_MEMLOCK_RANGE, int, unistd.h)
923 PSI_CONST(_POSIX_MEMORY_PROTECTION, int, unistd.h)
924 PSI_CONST(_POSIX_MESSAGE_PASSING, int, unistd.h)
925 PSI_CONST(_POSIX_MONOTONIC_CLOCK, int, unistd.h)
926 PSI_CONST(_POSIX_NO_TRUNC, int, unistd.h)
927 PSI_CONST(_POSIX_PRIORITIZED_IO, int, unistd.h)
928 PSI_CONST(_POSIX_PRIORITY_SCHEDULING, int, unistd.h)
929 PSI_CONST(_POSIX_PRIO_IO, int, unistd.h)
930 PSI_CONST(_POSIX_RAW_SOCKETS, int, unistd.h)
931 PSI_CONST(_POSIX_READER_WRITER_LOCKS, int, unistd.h)
932 PSI_CONST(_POSIX_REALTIME_SIGNALS, int, unistd.h)
933 PSI_CONST(_POSIX_REGEXP, int, unistd.h)
934 PSI_CONST(_POSIX_SAVED_IDS, int, unistd.h)
935 PSI_CONST(_POSIX_SEMAPHORES, int, unistd.h)
936 PSI_CONST(_POSIX_SHARED_MEMORY_OBJECTS, int, unistd.h)
937 PSI_CONST(_POSIX_SHELL, int, unistd.h)
938 PSI_CONST(_POSIX_SPAWN, int, unistd.h)
939 PSI_CONST(_POSIX_SPIN_LOCKS, int, unistd.h)
940 PSI_CONST(_POSIX_SPORADIC_SERVER, int, unistd.h)
941 PSI_CONST(_POSIX_SYNCHRONIZED_IO, int, unistd.h)
942 PSI_CONST(_POSIX_SYNC_IO, int, unistd.h)
943 PSI_CONST(_POSIX_THREADS, int, unistd.h)
944 PSI_CONST(_POSIX_THREAD_ATTR_STACKADDR, int, unistd.h)
945 PSI_CONST(_POSIX_THREAD_ATTR_STACKSIZE, int, unistd.h)
946 PSI_CONST(_POSIX_THREAD_CPUTIME, int, unistd.h)
947 PSI_CONST(_POSIX_THREAD_PRIORITY_SCHEDULING, int, unistd.h)
948 PSI_CONST(_POSIX_THREAD_PRIO_INHERIT, int, unistd.h)
949 PSI_CONST(_POSIX_THREAD_PRIO_PROTECT, int, unistd.h)
950 PSI_CONST(_POSIX_THREAD_PROCESS_SHARED, int, unistd.h)
951 PSI_CONST(_POSIX_THREAD_ROBUST_PRIO_INHERIT, int, unistd.h)
952 PSI_CONST(_POSIX_THREAD_ROBUST_PRIO_PROTECT, int, unistd.h)
953 PSI_CONST(_POSIX_THREAD_SAFE_FUNCTIONS, int, unistd.h)
954 PSI_CONST(_POSIX_THREAD_SPORADIC_SERVER, int, unistd.h)
955 PSI_CONST(_POSIX_TIMEOUTS, int, unistd.h)
956 PSI_CONST(_POSIX_TIMERS, int, unistd.h)
957 PSI_CONST(_POSIX_TIMESTAMP_RESOLUTION, int, unistd.h)
958 PSI_CONST(_POSIX_TRACE, int, unistd.h)
959 PSI_CONST(_POSIX_TRACE_EVENT_FILTER, int, unistd.h)
960 PSI_CONST(_POSIX_TRACE_INHERIT, int, unistd.h)
961 PSI_CONST(_POSIX_TRACE_LOG, int, unistd.h)
962 PSI_CONST(_POSIX_TYPED_MEMORY_OBJECTS, int, unistd.h)
963 PSI_CONST(_POSIX_VDISABLE, int, unistd.h)
964 PSI_CONST(_POSIX_VERSION, int, unistd.h)
965 PSI_CONST(_SC_ADVISORY_INFO, int, unistd.h)
966 PSI_CONST(_SC_AIO_LISTIO_MAX, int, unistd.h)
967 PSI_CONST(_SC_AIO_MAX, int, unistd.h)
968 PSI_CONST(_SC_AIO_PRIO_DELTA_MAX, int, unistd.h)
969 PSI_CONST(_SC_ARG_MAX, int, unistd.h)
970 PSI_CONST(_SC_ASYNCHRONOUS_IO, int, unistd.h)
971 PSI_CONST(_SC_ATEXIT_MAX, int, unistd.h)
972 PSI_CONST(_SC_BARRIERS, int, unistd.h)
973 PSI_CONST(_SC_BC_BASE_MAX, int, unistd.h)
974 PSI_CONST(_SC_BC_DIM_MAX, int, unistd.h)
975 PSI_CONST(_SC_BC_SCALE_MAX, int, unistd.h)
976 PSI_CONST(_SC_BC_STRING_MAX, int, unistd.h)
977 PSI_CONST(_SC_CHILD_MAX, int, unistd.h)
978 PSI_CONST(_SC_CLK_TCK, int, unistd.h)
979 PSI_CONST(_SC_CLOCK_SELECTION, int, unistd.h)
980 PSI_CONST(_SC_COLL_WEIGHTS_MAX, int, unistd.h)
981 PSI_CONST(_SC_CPUTIME, int, unistd.h)
982 PSI_CONST(_SC_DELAYTIMER_MAX, int, unistd.h)
983 PSI_CONST(_SC_EXPR_NEST_MAX, int, unistd.h)
984 PSI_CONST(_SC_FSYNC, int, unistd.h)
985 PSI_CONST(_SC_GETGR_R_SIZE_MAX, int, unistd.h)
986 PSI_CONST(_SC_GETPW_R_SIZE_MAX, int, unistd.h)
987 PSI_CONST(_SC_HOST_NAME_MAX, int, unistd.h)
988 PSI_CONST(_SC_IOV_MAX, int, unistd.h)
989 PSI_CONST(_SC_JOB_CONTROL, int, unistd.h)
990 PSI_CONST(_SC_LINE_MAX, int, unistd.h)
991 PSI_CONST(_SC_LOGIN_NAME_MAX, int, unistd.h)
992 PSI_CONST(_SC_MAPPED_FILES, int, unistd.h)
993 PSI_CONST(_SC_MEMLOCK, int, unistd.h)
994 PSI_CONST(_SC_MEMLOCK_RANGE, int, unistd.h)
995 PSI_CONST(_SC_MEMORY_PROTECTION, int, unistd.h)
996 PSI_CONST(_SC_MESSAGE_PASSING, int, unistd.h)
997 PSI_CONST(_SC_MONOTONIC_CLOCK, int, unistd.h)
998 PSI_CONST(_SC_MQ_OPEN_MAX, int, unistd.h)
999 PSI_CONST(_SC_MQ_PRIO_MAX, int, unistd.h)
1000 PSI_CONST(_SC_NGROUPS_MAX, int, unistd.h)
1001 PSI_CONST(_SC_OPEN_MAX, int, unistd.h)
1002 PSI_CONST(_SC_PAGESIZE, int, unistd.h)
1003 PSI_CONST(_SC_PAGE_SIZE, int, unistd.h)
1004 PSI_CONST(_SC_PRIORITIZED_IO, int, unistd.h)
1005 PSI_CONST(_SC_PRIORITY_SCHEDULING, int, unistd.h)
1006 PSI_CONST(_SC_RAW_SOCKETS, int, unistd.h)
1007 PSI_CONST(_SC_READER_WRITER_LOCKS, int, unistd.h)
1008 PSI_CONST(_SC_REALTIME_SIGNALS, int, unistd.h)
1009 PSI_CONST(_SC_REGEXP, int, unistd.h)
1010 PSI_CONST(_SC_RE_DUP_MAX, int, unistd.h)
1011 PSI_CONST(_SC_RTSIG_MAX, int, unistd.h)
1012 PSI_CONST(_SC_SAVED_IDS, int, unistd.h)
1013 PSI_CONST(_SC_SEMAPHORES, int, unistd.h)
1014 PSI_CONST(_SC_SEM_NSEMS_MAX, int, unistd.h)
1015 PSI_CONST(_SC_SEM_VALUE_MAX, int, unistd.h)
1016 PSI_CONST(_SC_SHARED_MEMORY_OBJECTS, int, unistd.h)
1017 PSI_CONST(_SC_SHELL, int, unistd.h)
1018 PSI_CONST(_SC_SIGQUEUE_MAX, int, unistd.h)
1019 PSI_CONST(_SC_SPAWN, int, unistd.h)
1020 PSI_CONST(_SC_SPIN_LOCKS, int, unistd.h)
1021 PSI_CONST(_SC_SPORADIC_SERVER, int, unistd.h)
1022 PSI_CONST(_SC_SS_REPL_MAX, int, unistd.h)
1023 PSI_CONST(_SC_STREAM_MAX, int, unistd.h)
1024 PSI_CONST(_SC_SYMLOOP_MAX, int, unistd.h)
1025 PSI_CONST(_SC_SYNCHRONIZED_IO, int, unistd.h)
1026 PSI_CONST(_SC_THREADS, int, unistd.h)
1027 PSI_CONST(_SC_THREAD_ATTR_STACKADDR, int, unistd.h)
1028 PSI_CONST(_SC_THREAD_ATTR_STACKSIZE, int, unistd.h)
1029 PSI_CONST(_SC_THREAD_CPUTIME, int, unistd.h)
1030 PSI_CONST(_SC_THREAD_DESTRUCTOR_ITERATIONS, int, unistd.h)
1031 PSI_CONST(_SC_THREAD_KEYS_MAX, int, unistd.h)
1032 PSI_CONST(_SC_THREAD_PRIORITY_SCHEDULING, int, unistd.h)
1033 PSI_CONST(_SC_THREAD_PRIO_INHERIT, int, unistd.h)
1034 PSI_CONST(_SC_THREAD_PRIO_PROTECT, int, unistd.h)
1035 PSI_CONST(_SC_THREAD_PROCESS_SHARED, int, unistd.h)
1036 PSI_CONST(_SC_THREAD_ROBUST_PRIO_INHERIT, int, unistd.h)
1037 PSI_CONST(_SC_THREAD_ROBUST_PRIO_PROTECT, int, unistd.h)
1038 PSI_CONST(_SC_THREAD_SAFE_FUNCTIONS, int, unistd.h)
1039 PSI_CONST(_SC_THREAD_SPORADIC_SERVER, int, unistd.h)
1040 PSI_CONST(_SC_THREAD_STACK_MIN, int, unistd.h)
1041 PSI_CONST(_SC_THREAD_THREADS_MAX, int, unistd.h)
1042 PSI_CONST(_SC_TIMEOUTS, int, unistd.h)
1043 PSI_CONST(_SC_TIMERS, int, unistd.h)
1044 PSI_CONST(_SC_TIMER_MAX, int, unistd.h)
1045 PSI_CONST(_SC_TRACE, int, unistd.h)
1046 PSI_CONST(_SC_TRACE_EVENT_FILTER, int, unistd.h)
1047 PSI_CONST(_SC_TRACE_EVENT_NAME_MAX, int, unistd.h)
1048 PSI_CONST(_SC_TRACE_INHERIT, int, unistd.h)
1049 PSI_CONST(_SC_TRACE_LOG, int, unistd.h)
1050 PSI_CONST(_SC_TRACE_NAME_MAX, int, unistd.h)
1051 PSI_CONST(_SC_TRACE_SYS_MAX, int, unistd.h)
1052 PSI_CONST(_SC_TRACE_USER_EVENT_MAX, int, unistd.h)
1053 PSI_CONST(_SC_TTY_NAME_MAX, int, unistd.h)
1054 PSI_CONST(_SC_TYPED_MEMORY_OBJECTS, int, unistd.h)
1055 PSI_CONST(_SC_TZNAME_MAX, int, unistd.h)
1056 PSI_CONST(_SC_VERSION, int, unistd.h)
1057 PSI_CONST(_SC_XOPEN_CRYPT, int, unistd.h)
1058 PSI_CONST(_SC_XOPEN_REALTIME, int, unistd.h)
1059 PSI_CONST(_SC_XOPEN_REALTIME_THREADS, int, unistd.h)
1060 PSI_CONST(_SC_XOPEN_SHM, int, unistd.h)
1061 PSI_CONST(_SC_XOPEN_STREAMS, int, unistd.h)
1062 PSI_CONST(_SC_XOPEN_UNIX, int, unistd.h)
1063 PSI_CONST(_SC_XOPEN_UUCP, int, unistd.h)
1064 PSI_CONST(_SC_XOPEN_VERSION, int, unistd.h)
1065 PSI_CONST(_XOPEN_CRYPT, int, unistd.h)
1066 PSI_CONST(_XOPEN_REALTIME, int, unistd.h)
1067 PSI_CONST(_XOPEN_REALTIME_THREADS, int, unistd.h)
1068 PSI_CONST(_XOPEN_SHM, int, unistd.h)
1069 PSI_CONST(_XOPEN_STREAMS, int, unistd.h)
1070 PSI_CONST(_XOPEN_UNIX, int, unistd.h)
1071 PSI_CONST(_XOPEN_UUCP, int, unistd.h)
1072 PSI_CONST(_XOPEN_VERSION, int, unistd.h)
1073 PSI_FUNC(access, unistd.h)
1074 PSI_FUNC(alarm, unistd.h)
1075 PSI_FUNC(chdir, unistd.h)
1076 PSI_FUNC(chown, unistd.h)
1077 PSI_FUNC(close, unistd.h)
1078 PSI_FUNC(confstr, unistd.h)
1079 PSI_FUNC(dup, unistd.h)
1080 PSI_FUNC(dup2, unistd.h)
1081 PSI_FUNC(_exit, unistd.h)
1082 PSI_FUNC(faccessat, unistd.h)
1083 PSI_FUNC(fchdir, unistd.h)
1084 PSI_FUNC(fchown, unistd.h)
1085 PSI_FUNC(fchownat, unistd.h)
1086 PSI_FUNC(fdatasync, unistd.h)
1087 PSI_FUNC(fork, unistd.h)
1088 PSI_FUNC(fpathconf, unistd.h)
1089 PSI_FUNC(fsync, unistd.h)
1090 PSI_FUNC(ftruncate, unistd.h)
1091 PSI_FUNC(getegid, unistd.h)
1092 PSI_FUNC(geteuid, unistd.h)
1093 PSI_FUNC(getgid, unistd.h)
1094 PSI_FUNC(gethostid, unistd.h)
1095 PSI_FUNC(gethostname, unistd.h)
1096 PSI_FUNC(getlogin_r, unistd.h)
1097 PSI_FUNC(getpgid, unistd.h)
1098 PSI_FUNC(getpgrp, unistd.h)
1099 PSI_FUNC(getpid, unistd.h)
1100 PSI_FUNC(getppid, unistd.h)
1101 PSI_FUNC(getsid, unistd.h)
1102 PSI_FUNC(getuid, unistd.h)
1103 PSI_FUNC(isatty, unistd.h)
1104 PSI_FUNC(lchown, unistd.h)
1105 PSI_FUNC(link, unistd.h)
1106 PSI_FUNC(linkat, unistd.h)
1107 PSI_FUNC(lockf, unistd.h)
1108 PSI_FUNC(lseek, unistd.h)
1109 PSI_FUNC(nice, unistd.h)
1110 PSI_FUNC(pathconf, unistd.h)
1111 PSI_FUNC(pause, unistd.h)
1112 PSI_FUNC(pread, unistd.h)
1113 PSI_FUNC(pwrite, unistd.h)
1114 PSI_FUNC(read, unistd.h)
1115 PSI_FUNC(readlink, unistd.h)
1116 PSI_FUNC(readlinkat, unistd.h)
1117 PSI_FUNC(rmdir, unistd.h)
1118 PSI_FUNC(setegid, unistd.h)
1119 PSI_FUNC(seteuid, unistd.h)
1120 PSI_FUNC(setgid, unistd.h)
1121 PSI_FUNC(setpgid, unistd.h)
1122 PSI_FUNC(setpgrp, unistd.h)
1123 PSI_FUNC(setregid, unistd.h)
1124 PSI_FUNC(setreuid, unistd.h)
1125 PSI_FUNC(setsid, unistd.h)
1126 PSI_FUNC(setuid, unistd.h)
1127 PSI_FUNC(sleep, unistd.h)
1128 PSI_FUNC(swab, unistd.h)
1129 PSI_FUNC(symlink, unistd.h)
1130 PSI_FUNC(symlinkat, unistd.h)
1131 PSI_FUNC(sync, unistd.h)
1132 PSI_FUNC(sysconf, unistd.h)
1133 PSI_FUNC(tcgetpgrp, unistd.h)
1134 PSI_FUNC(tcsetpgrp, unistd.h)
1135 PSI_FUNC(truncate, unistd.h)
1136 PSI_FUNC(ttyname_r, unistd.h)
1137 PSI_FUNC(unlink, unistd.h)
1138 PSI_FUNC(unlinkat, unistd.h)
1139 PSI_FUNC(write, unistd.h)
1140 PSI_DECL(optarg, char *, unistd.h)
1141 PSI_DECL(opterr, int, unistd.h)
1142 PSI_DECL(optind, int, unistd.h)
1143 PSI_DECL(optopt, int, unistd.h)
1144
1145 dnl wchar.h
1146 AC_CHECK_HEADERS(wchar.h)
1147 PSI_TYPE(wint_t, int, wchar.h)
1148 PSI_CONST(WINT_MIN, int, wchar.h)
1149 PSI_CONST(WINT_MAX, int, wchar.h)
1150 PSI_CONST(WEOF, int, wchar.h)
1151
1152 AC_DEFINE_UNQUOTED(PHP_PSI_FUNCS, $PSI_FUNCS, Redirected functions)
1153 AC_DEFINE_UNQUOTED(PHP_PSI_MACROS, $PSI_MACROS, Exported macros)
1154 AC_DEFINE_UNQUOTED(PHP_PSI_TYPES, $PSI_TYPES, Predefined types)
1155 AC_DEFINE_UNQUOTED(PHP_PSI_CONSTS, $PSI_CONSTS, Predefined constants)
1156 AC_DEFINE_UNQUOTED(PHP_PSI_STRUCTS, $PSI_STRUCTS, Predefined structs)
1157
1158 AC_DEFINE_UNQUOTED(PHP_PSI_SHLIB_SUFFIX, ["]$SHLIB_SUFFIX_NAME["], DL suffix)
1159
1160 PHP_PSI_SRCDIR=PHP_EXT_SRCDIR(psi)
1161 PHP_PSI_BUILDDIR=PHP_EXT_BUILDDIR(psi)
1162
1163 PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src)
1164 PHP_ADD_BUILD_DIR($PHP_PSI_BUILDDIR/src)
1165
1166 PHP_PSI_HEADERS=`(cd $PHP_PSI_SRCDIR/src && echo *.h)`
1167 PHP_PSI_SOURCES="src/parser_proc.c src/parser.c src/module.c src/context.c"
1168 PHP_PSI_SOURCES="$PHP_PSI_SOURCES src/libjit.c src/libffi.c"
1169
1170 PHP_NEW_EXTENSION(psi, $PHP_PSI_SOURCES, $ext_shared)
1171 PHP_INSTALL_HEADERS(ext/psi, php_psi.h $PHP_PSI_HEADERS)
1172
1173 PHP_SUBST(PHP_PSI_HEADERS)
1174 PHP_SUBST(PHP_PSI_SOURCES)
1175
1176 PHP_SUBST(PHP_PSI_SRCDIR)
1177 PHP_SUBST(PHP_PSI_BUILDDIR)
1178
1179 PHP_ADD_MAKEFILE_FRAGMENT
1180 fi