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