a8c95b0155cde19bf5d2ee0e905d7198e87cfbc5
[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_DONE
116
117 PHP_SUBST(PSI_SHARED_LIBADD)
118
119 AC_DEFINE_UNQUOTED(PHP_PSI_SHLIB_SUFFIX, ["$SHLIB_SUFFIX_NAME"], DL suffix)
120
121 PHP_ADD_INCLUDE($PHP_PSI_SRCDIR)
122 PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src)
123 PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src/calc)
124 PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src/types)
125 PHP_ADD_INCLUDE($PHP_PSI_BUILDDIR)
126 PHP_ADD_BUILD_DIR($PHP_PSI_BUILDDIR/src)
127 PHP_ADD_BUILD_DIR($PHP_PSI_BUILDDIR/src/types)
128
129 PHP_PSI_HEADERS=" \
130 src/calc/basic.h src/calc/bin.h src/calc/bool.h src/calc/cast.h \
131 src/calc/unary.h src/calc/cmp.h src/calc/oper.h \
132 `(cd $PHP_PSI_SRCDIR/src && ls *.h types/*.h)` \
133 "
134 # parser* should come first
135 PHP_PSI_SOURCES=" \
136 src/parser_proc.c src/parser.c \
137 `(cd $PHP_PSI_SRCDIR && ls src/*.c src/types/*.c \
138 | $EGREP -v '^src/parser' \
139 )` \
140 "
141 PHP_PSI_GENERATED=" \
142 src/parser_proc.c src/parser.c \
143 src/calc/basic.h src/calc/bin.h src/calc/bool.h src/calc/cast.h \
144 src/calc/unary.h src/calc/cmp.h src/calc/oper.h \
145 "
146
147 PHP_NEW_EXTENSION(psi, $PHP_PSI_SOURCES, $ext_shared)
148 PHP_INSTALL_HEADERS(ext/psi, php_psi.h $PHP_PSI_HEADERS)
149
150 PHP_SUBST(PHP_PSI_GENERATED)
151 PHP_SUBST(PHP_PSI_HEADERS)
152 PHP_SUBST(PHP_PSI_SOURCES)
153
154 PHP_SUBST(PHP_PSI_SRCDIR)
155 PHP_SUBST(PHP_PSI_BUILDDIR)
156
157 PHP_ADD_MAKEFILE_FRAGMENT
158 AC_MSG_RESULT()
159 fi