forked from eaccelerator/eaccelerator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.m4
317 lines (283 loc) · 9.12 KB
/
config.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
AC_DEFUN([EA_REMOVE_IPC_TEST], [
# for cygwin ipc error
if test -f conftest* ; then
echo $ECHO_N "Wait for conftest* to exit$ECHO_C"
while ! rm -f conftest* 2>/dev/null ; do
echo $ECHO_N ".$ECHO_C"
sleep 1
done
echo
fi
])
dnl
dnl configure options for eAccelerator
dnl
AC_ARG_WITH(eaccelerator,[],[enable_eaccelerator=$withval])
PHP_ARG_ENABLE(eaccelerator, whether to enable eaccelerator support,
[ --enable-eaccelerator Enable eaccelerator support])
AC_ARG_WITH(eaccelerator-crash-detection,
[ --without-eaccelerator-crash-detection Do not include eAccelerator crash detection],[
eaccelerator_crash_detection=$withval
],[
eaccelerator_crash_detection=yes
])
AC_ARG_WITH(eaccelerator-optimizer,
[ --without-eaccelerator-optimizer Do not include the eAccelerator optimizer],[
eaccelerator_optimizer=$withval
],[
eaccelerator_optimizer=yes
])
AC_ARG_WITH(eaccelerator-info,
[ --without-eaccelerator-info Do not compile the eAccelerator information functions],[
eaccelerator_info=$withval
],[
eaccelerator_info=yes
])
AC_ARG_WITH(eaccelerator-doc-comment-inclusion,
[ --without-eaccelerator-doc-comment-inclusion If you want eAccelerator to strip doc-comments from internal php structures.],[
enable_doc_comment_inclusion=$withval
],[
enable_doc_comment_inclusion=yes
])
AC_ARG_WITH(eaccelerator-disassembler,
[ --with-eaccelerator-disassembler Include disassembler],[
eaccelerator_disassembler=$withval
],[
eaccelerator_disassemmbler=no
])
AC_ARG_WITH(eaccelerator-debug,
[ --with-eaccelerator-debug Enable the debug code so eAccelerator logs verbose.],[
eaccelerator_debug=$withval
],[
eaccelerator_debug=no
])
AC_ARG_WITH(eaccelerator-userid,
[ --with-eaccelerator-userid eAccelerator runs under this userid, only needed when using sysvipc semaphores.],[
ea_userid=$withval
],[
ea_userid=0
])
dnl PHP_BUILD_SHARED
if test "$PHP_EACCELERATOR" != "no"; then
PHP_EXTENSION(eaccelerator, $ext_shared)
AC_DEFINE(HAVE_EACCELERATOR, 1, [Define if you like to use eAccelerator])
AC_DEFINE(WITH_EACCELERATOR_INFO, 1, [Define to be able to get information about eAccelerator])
AC_DEFINE_UNQUOTED(EA_USERID, $ea_userid, [The userid eAccelerator will be running under.])
if test "$enable_doc_comment_inclusion" = "yes"; then
AC_DEFINE(INCLUDE_DOC_COMMENTS, 1, [If you want eAccelerator to retain doc-comments in internal php structures (meta-programming)])
fi
if test "$eaccelerator_crash_detection" = "yes"; then
AC_DEFINE(WITH_EACCELERATOR_CRASH_DETECTION, 1, [Define if you like to release eAccelerator resources on PHP crash])
fi
if test "$eaccelerator_optimizer" = "yes"; then
AC_DEFINE(WITH_EACCELERATOR_OPTIMIZER, 1, [Define if you like to use peephole opcode optimization])
fi
if test "$eaccelerator_disassembler" = "yes"; then
AC_DEFINE(WITH_EACCELERATOR_DISASSEMBLER, 1, [Define if you like to explore Zend bytecode])
fi
if test "$eaccelerator_debug" = "yes"; then
AC_DEFINE(DEBUG, 1, [Undef when you want to enable eaccelerator debug code])
fi
AC_REQUIRE_CPP()
dnl
dnl Do some tests for OS support
dnl
AC_HAVE_HEADERS(unistd.h limits.h sys/param.h sched.h)
AC_MSG_CHECKING(mandatory system headers)
AC_TRY_CPP([#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>],msg=yes,msg=no)
AC_MSG_RESULT([$msg])
dnl Test for union semun
AC_MSG_CHECKING(whether union semun is defined in sys/sem.h)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
],[
union semun arg;
semctl(0, 0, 0, arg);
],
AC_DEFINE(HAVE_UNION_SEMUN, 1, [Define if you have semun union in sys/sem.h])
msg=yes,msg=no)
AC_MSG_RESULT([$msg])
mm_shm_ipc=no
mm_shm_mmap_anon=no
mm_shm_mmap_zero=no
mm_shm_mmap_file=no
mm_shm_mmap_posix=no
dnl sysvipc shared memory
AC_MSG_CHECKING(for sysvipc shared memory support)
AC_TRY_RUN([#define MM_SEM_NONE
#define MM_SHM_IPC
#define MM_TEST_SHM
#include "$ext_srcdir/mm.c"
],dnl
mm_shm_ipc=yes
msg=yes,msg=no,msg=no)
AC_MSG_RESULT([$msg])
EA_REMOVE_IPC_TEST()
dnl mmap shared memory
AC_MSG_CHECKING(for mmap shared memory support)
AC_TRY_RUN([#define MM_SEM_NONE
#define MM_SHM_MMAP_FILE
#define MM_TEST_SHM
#include "$ext_srcdir/mm.c"
],dnl
mm_shm_mmap_file=yes
msg=yes,msg=no,msg=no)
AC_MSG_RESULT([$msg])
dnl mmap zero shared memory
AC_MSG_CHECKING(for mmap on /dev/zero shared memory support)
AC_TRY_RUN([#define MM_SEM_NONE
#define MM_SHM_MMAP_ZERO
#define MM_TEST_SHM
#include "$ext_srcdir/mm.c"
],dnl
mm_shm_mmap_zero=yes
msg=yes,msg=no,msg=no)
AC_MSG_RESULT([$msg])
dnl mmap anonymous shared memory
AC_MSG_CHECKING(for anonymous mmap shared memory support)
AC_TRY_RUN([#define MM_SEM_NONE
#define MM_SHM_MMAP_ANON
#define MM_TEST_SHM
#include "$ext_srcdir/mm.c"
],dnl
mm_shm_mmap_anon=yes
msg=yes,msg=no,msg=no)
AC_MSG_RESULT([$msg])
dnl posix mmap shared memory support
AC_MSG_CHECKING(for posix mmap shared memory support)
AC_TRY_RUN([#define MM_SEM_NONE
#define MM_SHM_MMAP_POSIX
#define MM_TEST_SHM
#include "$ext_srcdir/mm.c"
],dnl
mm_shm_mmap_posix=yes
msg=yes,msg=no,msg=no)
AC_MSG_RESULT([$msg])
dnl determine the best type
AC_MSG_CHECKING(for best shared memory type)
if test "$mm_shm_ipc" = "yes"; then
AC_DEFINE(MM_SHM_IPC, 1, [Define if you like to use sysvipc based shared memory])
msg="sysvipc"
elif test "$mm_shm_mmap_anon" = "yes"; then
AC_DEFINE(MM_SHM_MMAP_ANON, 1, [Define if you like to use anonymous mmap based shared memory])
msg="anonymous mmap"
elif test "$mm_shm_mmap_zero" = "yes"; then
AC_DEFINE(MM_SHM_MMAP_ZERO, 1, [Define if you like to use mmap on /dev/zero based shared memory])
msg="mmap on /dev/zero"
elif test "$mm_shm_mmap_posix" = "yes"; then
AC_DEFINE(MM_SHM_MMAP_POSIX, 1, [Define if you like to use posix mmap based shared memory])
msg="posix mmap"
elif test "$mm_shm_mmap_file" = "yes"; then
AC_DEFINE(MM_SHM_MMAP_FILE, 1, [Define if you like to use mmap on temporary file shared memory])
msg="mmap"
else
msg="no"
fi
AC_MSG_RESULT([$msg])
if test "$msg" = "no" ; then
AC_MSG_ERROR([eaccelerator couldn't detect the shared memory type])
fi
dnl
dnl
dnl spinlock test
AC_MSG_CHECKING(for spinlock semaphores support)
AC_TRY_RUN([#define MM_SEM_SPINLOCK
#define MM_TEST_SEM
#include "$ext_srcdir/mm.c"
],dnl
mm_sem_spinlock=yes
msg=yes,msg=no,msg=no)
AC_MSG_RESULT([$msg])
oldLIBS="$LIBS"
LIBS="-lpthread"
dnl pthread support
AC_MSG_CHECKING(for pthread semaphores support)
AC_TRY_RUN([#define MM_SEM_PTHREAD
#define MM_TEST_SEM
#include "$ext_srcdir/mm.c"
],dnl
mm_sem_pthread=yes
msg=yes,msg=no,msg=no)
AC_MSG_RESULT([$msg])
dnl posix semaphore support
AC_MSG_CHECKING(for posix semaphores support)
AC_TRY_RUN([#define MM_SEM_POSIX
#define MM_TEST_SEM
#include "$ext_srcdir/mm.c"
],dnl
mm_sem_posix=yes
msg=yes,msg=no,msg=no)
AC_MSG_RESULT([$msg])
LIBS="$oldLIBS"
dnl sysvipc semaphore support
AC_MSG_CHECKING(for sysvipc semaphores support)
AC_TRY_RUN([#define MM_SEM_IPC
#define MM_TEST_SEM
#include "$ext_srcdir/mm.c"
],dnl
mm_sem_ipc=yes
msg=yes,msg=no,msg=no)
AC_MSG_RESULT([$msg])
EA_REMOVE_IPC_TEST()
dnl fnctl semaphore support
AC_MSG_CHECKING(for fcntl semaphores support)
AC_TRY_RUN([#define MM_SEM_FCNTL
#define MM_TEST_SEM
#include "$ext_srcdir/mm.c"
],dnl
mm_sem_fcntl=yes
msg=yes,msg=no,msg=no)
AC_MSG_RESULT([$msg])
dnl flock semaphore support
AC_MSG_CHECKING(for flock semaphores support)
AC_TRY_RUN([#define MM_SEM_FLOCK
#define MM_TEST_SEM
#include "$ext_srcdir/mm.c"
],dnl
mm_sem_flock=yes
msg=yes,msg=no,msg=no)
AC_MSG_RESULT([$msg])
dnl Determine the best type
AC_MSG_CHECKING(for best semaphores type)
if test "$mm_sem_spinlock" = "yes"; then
AC_DEFINE(MM_SEM_SPINLOCK, 1, [Define if you like to use spinlock based semaphores])
msg="spinlock"
elif test "$mm_sem_ipc" = "yes"; then
if test $ea_userid = 0; then
AC_MSG_ERROR("You need to pass the user id eaccelerator will be running under when using sysvipc semaphores")
else
AC_DEFINE(MM_SEM_IPC, 1, [Define if you like to use sysvipc based semaphores])
msg="sysvipc"
fi
elif test "$mm_sem_fcntl" = "yes"; then
AC_DEFINE(MM_SEM_FCNTL, 1, [Define if you like to use fcntl based semaphores])
msg="fcntl"
elif test "$mm_sem_flock" = "yes"; then
AC_DEFINE(MM_SEM_FLOCK, 1, [Define if you like to use flock based semaphores])
msg="flock"
elif test "$mm_sem_pthread" = "yes"; then
AC_DEFINE(MM_SEM_PTHREAD, 1, [Define if you like to use pthread based semaphores])
msg="pthread"
elif test "$mm_sem_posix" = "yes"; then
AC_DEFINE(MM_SEM_POSIX, 1, [Define if you like to use posix based semaphores])
msg="posix"
else
msg="no"
fi
AC_MSG_RESULT([$msg])
if test "$msg" = "no" ; then
AC_MSG_ERROR([eaccelerator cannot determine semaphore type, which is required])
fi
AC_CHECK_FUNC(mprotect,[
AC_DEFINE(HAVE_MPROTECT, 1, [Define if you have mprotect function])
])
fi