marshal: allow casting from/to enum val
[m6w6/ext-psi] / config.m4
1 PHP_PSI_SRCDIR=PHP_EXT_SRCDIR(psi)
2
3 case "PHP_EXT_BUILDDIR(psi)" in
4 ""|.) PHP_PSI_BUILDDIR=$PHP_PSI_SRCDIR
5 ;;
6 *) PHP_PSI_BUILDDIR=PHP_EXT_BUILDDIR(psi)
7 ;;
8 esac
9
10 m4_foreach(incfile, [
11 [ax/ax_check_sign.m4],
12 [ax/ax_pthread.m4],
13 [psi/psi.m4],
14 [psi/psi_type.m4],
15 [psi/psi_const.m4],
16 [psi/psi_decl.m4],
17 [psi/psi_macro.m4],
18 [psi/psi_composite.m4],
19 [posix/arpa_inet.m4],
20 [posix/errno.m4],
21 [posix/fcntl.m4],
22 [posix/glob.m4],
23 [posix/locale.m4],
24 [posix/stddef.m4],
25 [posix/stdio.m4],
26 [posix/stdint.m4],
27 [posix/stdlib.m4],
28 [posix/sys_select.m4],
29 [posix/sys_socket.m4],
30 [posix/sys_stat.m4],
31 [posix/sys_time.m4],
32 [posix/sys_times.m4],
33 [posix/sys_types.m4],
34 [posix/sys_uio.m4],
35 [posix/sys_utsname.m4],
36 [posix/ndbm.m4],
37 [posix/netdb.m4],
38 [posix/netinet_in.m4],
39 [posix/netinet_tcp.m4],
40 [posix/poll.m4],
41 [posix/signal.m4],
42 [posix/syslog.m4],
43 [posix/time.m4],
44 [posix/unistd.m4],
45 [posix/wchar.m4],
46 [posix/wctype.m4]], [
47 dnl pecl build
48 sinclude([m4/]incfile)
49 dnl php-src build
50 sinclude([ext/psi/m4/]incfile)
51 ])
52
53 PHP_ARG_ENABLE(psi, whether to enable PHP System Interface support,
54 [ --enable-psi Enable PSI (PHP System Interface) support])
55
56 if test "$PHP_PSI" != no; then
57 PHP_ARG_ENABLE(psi-posix, whether to pre-define POSIX decls,
58 [ --enable-psi-posix=... PSI: pre-define POSIX decls], [all], [no])
59
60 PHP_ARG_ENABLE(psi-maintainer-mode, whether to enable maintainer mode,
61 [ --enable-psi-maintainer-mode
62 PSI: enable maintainer mode
63 . parallel configure
64 . make dependencies
65 . extra debug wrappers], [no], [no])
66
67 PHP_ARG_WITH(psi-libjit, where to find libjit,
68 [ --with-psi-libjit=DIR PSI: path to libjit], [ ], [ ])
69
70 PHP_ARG_WITH(psi-libffi, where to find libffi,
71 [ --with-psi-libffi=DIR PSI: path to libffi], [ ], [ ])
72
73 AC_HEADER_ASSERT dnl # adds --disable-assert to define NDEBUG
74
75 dnl we cannot use AC_USE_SYSTEM_EXTENSIONS here, because we're way too late
76 dnl in the game, and we're currently only targeting _GNU_SOURCE for now
77 AC_MSG_CHECKING([for _GNU_SOURCE])
78 AC_EGREP_CPP([gnu_source_not_defined], [
79 #ifndef _GNU_SOURCE
80 gnu_source_not_defined
81 #endif
82 ], [
83 AC_MSG_RESULT([needs define])
84 AC_DEFINE([_GNU_SOURCE], [1], [ ])
85 ], [
86 AC_MSG_RESULT([already defined])
87 ])
88
89 AC_MSG_CHECKING([psi source dir])
90 AC_MSG_RESULT([$PHP_PSI_SRCDIR])
91 AC_MSG_CHECKING([psi build dir])
92 AC_MSG_RESULT([$PHP_PSI_BUILDDIR])
93
94 PSI_CHECK_LIBJIT
95 PSI_CHECK_LIBFFI
96
97 AC_FUNC_FNMATCH
98 AC_FUNC_MMAP
99
100 PSI_CONFIG_INIT
101
102 dnl basics, one-by-one
103 PSI_CHECK_STD_TYPES
104 PSI_CHECK_STDINT
105 PSI_CHECK_SYS_TYPES
106 PSI_CHECK_STDDEF
107
108 dnl parallel
109 AC_MSG_CHECKING([for POSIX modules])
110 if ! $PSI_FAST_CONFIG; then
111 AC_MSG_RESULT([$PHP_PSI_POSIX])
112 fi
113
114 PSI_CONFIG_POSIX(signal, signal.h, [
115 PSI_CONFIG_POSIX(time, time.h, [
116 PSI_CONFIG_POSIX(sys/stat, sys/stat.h)
117 PSI_CONFIG_POSIX(wchar, wchar.h, [
118 PSI_CONFIG_POSIX(wctype, wctype.h)
119 ])
120 ])
121 PSI_CONFIG_POSIX(sys/select, sys/select.h)
122 ])
123 PSI_CONFIG_POSIX(poll, poll.h)
124 PSI_CONFIG_POSIX(syslog, syslog.h)
125 PSI_CONFIG_POSIX(errno, errno.h)
126 PSI_CONFIG_POSIX(fcntl, fcntl.h)
127 PSI_CONFIG_POSIX(glob, glob.h)
128 PSI_CONFIG_POSIX(locale, locale.h xlocale.h)
129 PSI_CONFIG_POSIX(stdio, stdio.h)
130 PSI_CONFIG_POSIX(stdlib, stdlib.h)
131 PSI_CONFIG_POSIX(unistd, unistd.h)
132 PSI_CONFIG_POSIX(sys/socket, sys/socket.h, [
133 PSI_CONFIG_POSIX(netinet/in, netinet/in.h, [
134 PSI_CONFIG_POSIX(arpa/inet, arpa/inet.h)
135 ])
136 PSI_CONFIG_POSIX(netdb, netdb.h)
137 ])
138 PSI_CONFIG_POSIX(netinet/tcp, netinet/tcp.h)
139 PSI_CONFIG_POSIX(sys/time, sys/time.h)
140 PSI_CONFIG_POSIX(sys/times, sys/times.h)
141 PSI_CONFIG_POSIX(sys/uio, sys/uio.h)
142 PSI_CONFIG_POSIX(sys/utsname, sys/utsname.h)
143 PSI_CONFIG_POSIX(ndbm, dnl
144 ndbm.h dnl posix
145 relic.h dnl qdbm
146 gdbm-ndbm.h dnl gdbm
147 )
148
149 PSI_CONFIG_DONE
150
151 PHP_SUBST(PSI_SHARED_LIBADD)
152
153 AC_DEFINE_UNQUOTED(PHP_PSI_SHLIB_SUFFIX, ["$SHLIB_SUFFIX_NAME"], DL suffix)
154
155 PHP_ADD_INCLUDE($PHP_PSI_SRCDIR)
156 PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src)
157 PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src/calc)
158 PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src/types)
159 PHP_ADD_INCLUDE($PHP_PSI_BUILDDIR)
160 PHP_ADD_BUILD_DIR($PHP_PSI_BUILDDIR/src)
161 PHP_ADD_BUILD_DIR($PHP_PSI_BUILDDIR/src/types)
162
163 PHP_PSI_HEADERS=" \
164 src/calc/basic.h src/calc/bin.h src/calc/bool.h src/calc/cast.h \
165 src/calc/cmp.h src/calc/oper.h \
166 `(cd $PHP_PSI_SRCDIR/src && ls *.h types/*.h)` \
167 "
168 # parser* should come first
169 PHP_PSI_SOURCES=" \
170 src/parser_proc.c src/parser.c \
171 `(cd $PHP_PSI_SRCDIR && ls src/*.c src/types/*.c \
172 | $EGREP -v '^src/parser' \
173 )` \
174 "
175 PHP_PSI_GENERATED=" \
176 src/parser_proc.c src/parser.c \
177 src/calc/basic.h src/calc/bin.h src/calc/bool.h src/calc/cast.h \
178 src/calc/cmp.h src/calc/oper.h \
179 "
180
181 PHP_NEW_EXTENSION(psi, $PHP_PSI_SOURCES, $ext_shared)
182 PHP_INSTALL_HEADERS(ext/psi, php_psi.h $PHP_PSI_HEADERS)
183
184 PHP_SUBST(PHP_PSI_GENERATED)
185 PHP_SUBST(PHP_PSI_HEADERS)
186 PHP_SUBST(PHP_PSI_SOURCES)
187
188 PHP_SUBST(PHP_PSI_SRCDIR)
189 PHP_SUBST(PHP_PSI_BUILDDIR)
190
191 PHP_ADD_MAKEFILE_FRAGMENT
192 AC_MSG_RESULT()
193 fi