File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
Zend /
Zend.m4
Revision
1.1.1.2 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue May 29 12:34:35 2012 UTC (12 years, 4 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
HEAD
php 5.4.3+patches
1: dnl
2: dnl $Id: Zend.m4,v 1.1.1.2 2012/05/29 12:34:35 misho Exp $
3: dnl
4: dnl This file contains Zend specific autoconf functions.
5: dnl
6:
7: AC_DEFUN([LIBZEND_CHECK_INT_TYPE],[
8: AC_MSG_CHECKING(for $1)
9: AC_TRY_COMPILE([
10: #if HAVE_SYS_TYPES_H
11: #include <sys/types.h>
12: #endif
13: #if HAVE_INTTYPES_H
14: #include <inttypes.h>
15: #elif HAVE_STDINT_H
16: #include <stdint.h>
17: #endif],
18: [if (($1 *) 0)
19: return 0;
20: if (sizeof ($1))
21: return 0;
22: ],[
23: AC_DEFINE_UNQUOTED([HAVE_]translit($1,a-z_-,A-Z__), 1,[Define if $1 type is present. ])
24: AC_MSG_RESULT(yes)
25: ], AC_MSG_RESULT(no)
26: )dnl
27: ])
28:
29: AC_DEFUN([LIBZEND_BASIC_CHECKS],[
30:
31: AC_REQUIRE([AC_PROG_YACC])
32: AC_REQUIRE([AC_PROG_CC])
33: AC_REQUIRE([AC_PROG_CC_C_O])
34: AC_REQUIRE([AC_HEADER_STDC])
35:
36: LIBZEND_BISON_CHECK
37:
38: dnl Ugly hack to get around a problem with gcc on AIX.
39: if test "$CC" = "gcc" -a "$ac_cv_prog_cc_g" = "yes" -a \
40: "`uname -sv`" = "AIX 4"; then
41: CFLAGS=`echo $CFLAGS | sed -e 's/-g//'`
42: fi
43:
44: dnl Hack to work around a Mac OS X cpp problem
45: dnl Known versions needing this workaround are 5.3 and 5.4
46: if test "$ac_cv_prog_gcc" = "yes" -a "`uname -s`" = "Rhapsody"; then
47: CPPFLAGS="$CPPFLAGS -traditional-cpp"
48: fi
49:
50: AC_CHECK_HEADERS(
51: inttypes.h \
52: stdint.h \
53: limits.h \
54: malloc.h \
55: string.h \
56: unistd.h \
57: stdarg.h \
58: sys/types.h \
59: sys/time.h \
60: signal.h \
61: unix.h \
62: stdlib.h \
63: dlfcn.h)
64:
65: AC_TYPE_SIZE_T
66: AC_TYPE_SIGNAL
67:
68: AC_DEFUN([LIBZEND_LIBDL_CHECKS],[
69: AC_CHECK_LIB(dl, dlopen, [LIBS="-ldl $LIBS"])
70: AC_CHECK_FUNC(dlopen,[AC_DEFINE(HAVE_LIBDL, 1,[ ])])
71: ])
72:
73: AC_DEFUN([LIBZEND_DLSYM_CHECK],[
74: dnl
75: dnl Ugly hack to check if dlsym() requires a leading underscore in symbol name.
76: dnl
77: AC_MSG_CHECKING([whether dlsym() requires a leading underscore in symbol names])
78: _LT_AC_TRY_DLOPEN_SELF([
79: AC_MSG_RESULT(no)
80: ], [
81: AC_MSG_RESULT(yes)
82: AC_DEFINE(DLSYM_NEEDS_UNDERSCORE, 1, [Define if dlsym() requires a leading underscore in symbol names. ])
83: ], [
84: AC_MSG_RESULT(no)
85: ], [])
86: ])
87:
88: dnl This is required for QNX and may be some BSD derived systems
89: AC_CHECK_TYPE( uint, unsigned int )
90: AC_CHECK_TYPE( ulong, unsigned long )
91:
92: dnl Check if int32_t and uint32_t are defined
93: LIBZEND_CHECK_INT_TYPE(int32_t)
94: LIBZEND_CHECK_INT_TYPE(uint32_t)
95:
96: dnl Checks for library functions.
97: AC_FUNC_VPRINTF
98: AC_FUNC_MEMCMP
99: AC_FUNC_ALLOCA
100: AC_CHECK_FUNCS(memcpy strdup getpid kill strtod strtol finite fpclass sigsetjmp)
101: AC_ZEND_BROKEN_SPRINTF
102:
103: AC_CHECK_FUNCS(finite isfinite isinf isnan)
104:
105: ZEND_FP_EXCEPT
106:
107: ZEND_CHECK_FLOAT_PRECISION
108:
109: dnl test whether double cast to long preserves least significant bits
110: AC_MSG_CHECKING(whether double cast to long preserves least significant bits)
111:
112: AC_TRY_RUN([
113: #include <limits.h>
114:
115: int main()
116: {
117: if (sizeof(long) == 4) {
118: double d = (double) LONG_MIN * LONG_MIN + 2e9;
119:
120: if ((long) d == 2e9 && (long) -d == -2e9) {
121: exit(0);
122: }
123: } else if (sizeof(long) == 8) {
124: double correct = 18e18 - ((double) LONG_MIN * -2); /* Subtract ULONG_MAX + 1 */
125:
126: if ((long) 18e18 == correct) { /* On 64-bit, only check between LONG_MAX and ULONG_MAX */
127: exit(0);
128: }
129: }
130: exit(1);
131: }
132: ], [
133: AC_DEFINE([ZEND_DVAL_TO_LVAL_CAST_OK], 1, [Define if double cast to long preserves least significant bits])
134: AC_MSG_RESULT(yes)
135: ], [
136: AC_MSG_RESULT(no)
137: ], [
138: AC_MSG_RESULT(no)
139: ])
140:
141: ])
142:
143: AC_DEFUN([LIBZEND_ENABLE_DEBUG],[
144:
145: AC_ARG_ENABLE(debug,
146: [ --enable-debug Compile with debugging symbols],[
147: ZEND_DEBUG=$enableval
148: ],[
149: ZEND_DEBUG=no
150: ])
151:
152: ])
153:
154: AC_DEFUN([LIBZEND_OTHER_CHECKS],[
155:
156: AC_ARG_WITH(zend-vm,
157: [ --with-zend-vm=TYPE Set virtual machine dispatch method. Type is
158: one of "CALL", "SWITCH" or "GOTO" [TYPE=CALL]],[
159: PHP_ZEND_VM=$withval
160: ],[
161: PHP_ZEND_VM=CALL
162: ])
163:
164: AC_ARG_ENABLE(maintainer-zts,
165: [ --enable-maintainer-zts Enable thread safety - for code maintainers only!!],[
166: ZEND_MAINTAINER_ZTS=$enableval
167: ],[
168: ZEND_MAINTAINER_ZTS=no
169: ])
170:
171: AC_ARG_ENABLE(inline-optimization,
172: [ --disable-inline-optimization
173: If building zend_execute.lo fails, try this switch],[
174: ZEND_INLINE_OPTIMIZATION=$enableval
175: ],[
176: ZEND_INLINE_OPTIMIZATION=yes
177: ])
178:
179: AC_MSG_CHECKING([virtual machine dispatch method])
180: AC_MSG_RESULT($PHP_ZEND_VM)
181:
182: AC_MSG_CHECKING(whether to enable thread-safety)
183: AC_MSG_RESULT($ZEND_MAINTAINER_ZTS)
184:
185: AC_MSG_CHECKING(whether to enable inline optimization for GCC)
186: AC_MSG_RESULT($ZEND_INLINE_OPTIMIZATION)
187:
188: AC_MSG_CHECKING(whether to enable Zend debugging)
189: AC_MSG_RESULT($ZEND_DEBUG)
190:
191: case $PHP_ZEND_VM in
192: SWITCH)
193: AC_DEFINE(ZEND_VM_KIND,ZEND_VM_KIND_SWITCH,[virtual machine dispatch method])
194: ;;
195: GOTO)
196: AC_DEFINE(ZEND_VM_KIND,ZEND_VM_KIND_GOTO,[virtual machine dispatch method])
197: ;;
198: *)
199: PHP_ZEND_VM=CALL
200: AC_DEFINE(ZEND_VM_KIND,ZEND_VM_KIND_CALL,[virtual machine dispatch method])
201: ;;
202: esac
203:
204: if test "$ZEND_DEBUG" = "yes"; then
205: AC_DEFINE(ZEND_DEBUG,1,[ ])
206: echo " $CFLAGS" | grep ' -g' >/dev/null || DEBUG_CFLAGS="-g"
207: if test "$CFLAGS" = "-g -O2"; then
208: CFLAGS=-g
209: fi
210: test -n "$GCC" && DEBUG_CFLAGS="$DEBUG_CFLAGS -Wall"
211: test -n "$GCC" && test "$USE_MAINTAINER_MODE" = "yes" && \
212: DEBUG_CFLAGS="$DEBUG_CFLAGS -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations"
213: else
214: AC_DEFINE(ZEND_DEBUG,0,[ ])
215: fi
216:
217: test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
218:
219: if test "$ZEND_MAINTAINER_ZTS" = "yes"; then
220: AC_DEFINE(ZTS,1,[ ])
221: CFLAGS="$CFLAGS -DZTS"
222: LIBZEND_CPLUSPLUS_CHECKS
223: fi
224:
225: changequote({,})
226: if test -n "$GCC" && test "$ZEND_INLINE_OPTIMIZATION" != "yes"; then
227: INLINE_CFLAGS=`echo $ac_n "$CFLAGS $ac_c" | sed s/-O[0-9s]*//`
228: else
229: INLINE_CFLAGS="$CFLAGS"
230: fi
231: changequote([,])
232:
233: AC_C_INLINE
234:
235: AC_SUBST(INLINE_CFLAGS)
236:
237: AC_MSG_CHECKING(target system is Darwin)
238: if echo "$target" | grep "darwin" > /dev/null; then
239: AC_DEFINE([DARWIN], 1, [Define if the target system is darwin])
240: AC_MSG_RESULT(yes)
241: else
242: AC_MSG_RESULT(no)
243: fi
244:
245: dnl test and set the alignment define for ZEND_MM
246: dnl this also does the logarithmic test for ZEND_MM.
247: AC_MSG_CHECKING(for MM alignment and log values)
248:
249: AC_TRY_RUN([
250: #include <stdio.h>
251:
252: typedef union _mm_align_test {
253: void *ptr;
254: double dbl;
255: long lng;
256: } mm_align_test;
257:
258: #if (defined (__GNUC__) && __GNUC__ >= 2)
259: #define ZEND_MM_ALIGNMENT (__alignof__ (mm_align_test))
260: #else
261: #define ZEND_MM_ALIGNMENT (sizeof(mm_align_test))
262: #endif
263:
264: int main()
265: {
266: int i = ZEND_MM_ALIGNMENT;
267: int zeros = 0;
268: FILE *fp;
269:
270: while (i & ~0x1) {
271: zeros++;
272: i = i >> 1;
273: }
274:
275: fp = fopen("conftest.zend", "w");
276: fprintf(fp, "%d %d\n", ZEND_MM_ALIGNMENT, zeros);
277: fclose(fp);
278:
279: exit(0);
280: }
281: ], [
282: LIBZEND_MM_ALIGN=`cat conftest.zend | cut -d ' ' -f 1`
283: LIBZEND_MM_ALIGN_LOG2=`cat conftest.zend | cut -d ' ' -f 2`
284: AC_DEFINE_UNQUOTED(ZEND_MM_ALIGNMENT, $LIBZEND_MM_ALIGN, [ ])
285: AC_DEFINE_UNQUOTED(ZEND_MM_ALIGNMENT_LOG2, $LIBZEND_MM_ALIGN_LOG2, [ ])
286: ], [], [
287: dnl cross-compile needs something here
288: LIBZEND_MM_ALIGN=8
289: ])
290:
291: AC_MSG_RESULT(done)
292:
293: dnl test for memory allocation using mmap(MAP_ANON)
294: AC_MSG_CHECKING(for memory allocation using mmap(MAP_ANON))
295:
296: AC_TRY_RUN([
297: #include <sys/types.h>
298: #include <sys/stat.h>
299: #include <fcntl.h>
300: #include <sys/mman.h>
301: #include <stdlib.h>
302: #include <stdio.h>
303: #ifndef MAP_ANON
304: # ifdef MAP_ANONYMOUS
305: # define MAP_ANON MAP_ANONYMOUS
306: # endif
307: #endif
308: #ifndef MREMAP_MAYMOVE
309: # define MREMAP_MAYMOVE 0
310: #endif
311: #ifndef MAP_FAILED
312: # define MAP_FAILED ((void*)-1)
313: #endif
314:
315: #define SEG_SIZE (256*1024)
316:
317: int main()
318: {
319: void *seg = mmap(NULL, SEG_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
320: if (seg == MAP_FAILED) {
321: return 1;
322: }
323: if (munmap(seg, SEG_SIZE) != 0) {
324: return 2;
325: }
326: return 0;
327: }
328: ], [
329: AC_DEFINE([HAVE_MEM_MMAP_ANON], 1, [Define if the target system has support for memory allocation using mmap(MAP_ANON)])
330: AC_MSG_RESULT(yes)
331: ], [
332: AC_MSG_RESULT(no)
333: ], [
334: dnl cross-compile needs something here
335: AC_MSG_RESULT(no)
336: ])
337:
338: dnl test for memory allocation using mmap("/dev/zero")
339: AC_MSG_CHECKING(for memory allocation using mmap("/dev/zero"))
340:
341: AC_TRY_RUN([
342: #include <sys/types.h>
343: #include <sys/stat.h>
344: #include <fcntl.h>
345: #include <sys/mman.h>
346: #include <stdlib.h>
347: #include <stdio.h>
348: #ifndef MAP_ANON
349: # ifdef MAP_ANONYMOUS
350: # define MAP_ANON MAP_ANONYMOUS
351: # endif
352: #endif
353: #ifndef MREMAP_MAYMOVE
354: # define MREMAP_MAYMOVE 0
355: #endif
356: #ifndef MAP_FAILED
357: # define MAP_FAILED ((void*)-1)
358: #endif
359:
360: #define SEG_SIZE (256*1024)
361:
362: int main()
363: {
364: int fd;
365: void *seg;
366:
367: fd = open("/dev/zero", O_RDWR, S_IRUSR | S_IWUSR);
368: if (fd < 0) {
369: return 1;
370: }
371: seg = mmap(NULL, SEG_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
372: if (seg == MAP_FAILED) {
373: return 2;
374: }
375: if (munmap(seg, SEG_SIZE) != 0) {
376: return 3;
377: }
378: if (close(fd) != 0) {
379: return 4;
380: }
381: return 0;
382: }
383: ], [
384: AC_DEFINE([HAVE_MEM_MMAP_ZERO], 1, [Define if the target system has support for memory allocation using mmap("/dev/zero")])
385: AC_MSG_RESULT(yes)
386: ], [
387: AC_MSG_RESULT(no)
388: ], [
389: dnl cross-compile needs something here
390: AC_MSG_RESULT(no)
391: ])
392:
393: AC_CHECK_FUNCS(mremap)
394:
395:
396: AC_ARG_ENABLE(zend-signals,
397: [ --enable-zend-signals Use zend signal handling],[
398: ZEND_SIGNALS=$enableval
399: ],[
400: ZEND_SIGNALS=no
401: ])
402:
403: AC_CHECK_FUNC(sigaction, [
404: AC_DEFINE(HAVE_SIGACTION, 1, [Whether sigaction() is available])
405: ], [
406: ZEND_SIGNALS=no
407: ])
408: if test "$ZEND_SIGNALS" = "yes"; then
409: AC_DEFINE(ZEND_SIGNALS, 1, [Use zend signal handling])
410: CFLAGS="$CFLAGS -DZEND_SIGNALS"
411: fi
412:
413: AC_MSG_CHECKING(whether to enable zend signal handling)
414: AC_MSG_RESULT($ZEND_SIGNALS)
415:
416: ])
417:
418: AC_DEFUN([LIBZEND_CPLUSPLUS_CHECKS],[
419:
420: ])
421:
422: AC_MSG_CHECKING(whether /dev/urandom exists)
423: if test -r "/dev/urandom" && test -c "/dev/urandom"; then
424: AC_DEFINE([HAVE_DEV_URANDOM], 1, [Define if the target system has /dev/urandom device])
425: AC_MSG_RESULT(yes)
426: else
427: AC_MSG_RESULT(no)
428: AC_MSG_CHECKING(whether /dev/arandom exists)
429: if test -r "/dev/arandom" && test -c "/dev/arandom"; then
430: AC_DEFINE([HAVE_DEV_ARANDOM], 1, [Define if the target system has /dev/arandom device])
431: AC_MSG_RESULT(yes)
432: else
433: AC_MSG_RESULT(no)
434: fi
435: fi
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>