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