root/eaccelerator/trunk/config.m4

Revision 269, 11.5 kB (checked in by bart, 2 years ago)

Reverse changeset 205 (doc-comment exclusion) from Tom Regner

<t.regner at librics.de>.

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