| 1 | |
|---|
| 2 | |
|---|
| 3 | AC_DEFUN([XCACHE_OPTION], [ |
|---|
| 4 | PHP_ARG_ENABLE(xcache-$1, for XCache $1, |
|---|
| 5 | [ --enable-xcache-$2 XCache: $4], no, no) |
|---|
| 6 | if test "$PHP_$3" != "no"; then |
|---|
| 7 | xcache_sources="$xcache_sources $1.c" |
|---|
| 8 | XCACHE_MODULES="$XCACHE_MODULES $1" |
|---|
| 9 | HAVE_$3=1 |
|---|
| 10 | AC_DEFINE([HAVE_$3], 1, [Define for XCache: $4]) |
|---|
| 11 | else |
|---|
| 12 | HAVE_$3= |
|---|
| 13 | fi |
|---|
| 14 | ]) |
|---|
| 15 | |
|---|
| 16 | PHP_ARG_ENABLE(xcache, for XCache support, |
|---|
| 17 | [ --enable-xcache Include XCache support.]) |
|---|
| 18 | |
|---|
| 19 | if test "$PHP_XCACHE" != "no"; then |
|---|
| 20 | PHP_ARG_ENABLE(xcache-constant, for XCache handle of compile time constant, |
|---|
| 21 | [ --enable-xcache-constant XCache: Handle new constants made by php compiler (e.g.: for __halt_compiler)], yes, no) |
|---|
| 22 | if test "$PHP_XCACHE_CONSTANT" != "no"; then |
|---|
| 23 | AC_DEFINE([HAVE_XCACHE_CONSTANT], 1, [Define to enable XCache handling of compile time constants]) |
|---|
| 24 | fi |
|---|
| 25 | |
|---|
| 26 | xcache_sources="processor.c \ |
|---|
| 27 | xcache.c \ |
|---|
| 28 | mmap.c \ |
|---|
| 29 | mem.c \ |
|---|
| 30 | xc_malloc.c \ |
|---|
| 31 | xc_shm.c \ |
|---|
| 32 | const_string.c \ |
|---|
| 33 | opcode_spec.c \ |
|---|
| 34 | stack.c \ |
|---|
| 35 | utils.c \ |
|---|
| 36 | lock.c \ |
|---|
| 37 | " |
|---|
| 38 | XCACHE_MODULES="cacher" |
|---|
| 39 | XCACHE_OPTION([optimizer], [optimizer ], [XCACHE_OPTIMIZER], [(N/A)]) |
|---|
| 40 | XCACHE_OPTION([coverager], [coverager ], [XCACHE_COVERAGER], [Enable code coverage dumper, useful for testing php scripts]) |
|---|
| 41 | XCACHE_OPTION([assembler], [assembler ], [XCACHE_ASSEMBLER], [(N/A)]) |
|---|
| 42 | XCACHE_OPTION([disassembler], [disassembler], [XCACHE_DISASSEMBLER], [Enable opcode to php variable dumper, NOT for production server]) |
|---|
| 43 | XCACHE_OPTION([encoder], [encoder ], [XCACHE_ENCODER], [(N/A)]) |
|---|
| 44 | XCACHE_OPTION([decoder], [decoder ], [XCACHE_DECODER], [(N/A)]) |
|---|
| 45 | AC_DEFINE_UNQUOTED([XCACHE_MODULES], "$XCACHE_MODULES", [Define what modules is built with XCache]) |
|---|
| 46 | |
|---|
| 47 | PHP_NEW_EXTENSION(xcache, $xcache_sources, $ext_shared) |
|---|
| 48 | PHP_ADD_MAKEFILE_FRAGMENT() |
|---|
| 49 | |
|---|
| 50 | PHP_ARG_ENABLE(xcache-test, for XCache self test, |
|---|
| 51 | [ --enable-xcache-test XCache: Enable self test - FOR DEVELOPERS ONLY!!], no, no) |
|---|
| 52 | if test "$PHP_XCACHE_TEST" != "no"; then |
|---|
| 53 | XCACHE_ENABLE_TEST=-DXCACHE_ENABLE_TEST |
|---|
| 54 | AC_DEFINE([HAVE_XCACHE_TEST], 1, [Define to enable XCache self test]) |
|---|
| 55 | else |
|---|
| 56 | XCACHE_ENABLE_TEST= |
|---|
| 57 | fi |
|---|
| 58 | PHP_SUBST([XCACHE_ENABLE_TEST]) |
|---|
| 59 | |
|---|
| 60 | PHP_ARG_ENABLE(xcache-dprint, for XCache self test, |
|---|
| 61 | [ --enable-xcache-dprint XCache: Enable debug print functions - FOR DEVELOPERS ONLY!!], no, no) |
|---|
| 62 | if test "$PHP_XCACHE_DPRINT" != "no"; then |
|---|
| 63 | AC_DEFINE([HAVE_XCACHE_DPRINT], 1, [Define to enable XCache debug print functions]) |
|---|
| 64 | fi |
|---|
| 65 | |
|---|
| 66 | AC_PATH_PROGS([AWK], [gawk awk]) |
|---|
| 67 | |
|---|
| 68 | if echo | LANG=C "$AWK" -- '' > /dev/null 2>&1 ; then |
|---|
| 69 | AWK="LANG=C $AWK" |
|---|
| 70 | else |
|---|
| 71 | if echo | /usr/bin/env - "$AWK" -- '' > /dev/null 2>&1 ; then |
|---|
| 72 | AWK="/usr/bin/env - $AWK" |
|---|
| 73 | fi |
|---|
| 74 | fi |
|---|
| 75 | PHP_SUBST([AWK]) |
|---|
| 76 | AC_PATH_PROGS([M4], [m4]) |
|---|
| 77 | if echo | "$M4" -E > /dev/null 2>&1 ; then |
|---|
| 78 | M4="$M4 -E" |
|---|
| 79 | fi |
|---|
| 80 | PHP_SUBST([M4]) |
|---|
| 81 | AC_PATH_PROGS([GREP], [grep]) |
|---|
| 82 | PHP_SUBST([GREP]) |
|---|
| 83 | AC_PATH_PROGS([SED], [sed]) |
|---|
| 84 | PHP_SUBST([SED]) |
|---|
| 85 | |
|---|
| 86 | AC_PATH_PROGS([INDENT], [indent cat]) |
|---|
| 87 | XCACHE_INDENT=cat |
|---|
| 88 | case $INDENT in |
|---|
| 89 | */indent[)] |
|---|
| 90 | opts="-kr --use-tabs --tab-size 4 -sob -nce" |
|---|
| 91 | if echo | $INDENT $opts > /dev/null 2>&1 ; then |
|---|
| 92 | XCACHE_INDENT="$INDENT $opts" |
|---|
| 93 | else |
|---|
| 94 | opts="-sob -nce" |
|---|
| 95 | if echo | $INDENT $opts > /dev/null 2>&1 ; then |
|---|
| 96 | XCACHE_INDENT="$INDENT $opts" |
|---|
| 97 | else |
|---|
| 98 | if echo | $INDENT > /dev/null 2>&1 ; then |
|---|
| 99 | XCACHE_INDENT="$INDENT" |
|---|
| 100 | fi |
|---|
| 101 | fi |
|---|
| 102 | fi |
|---|
| 103 | ;; |
|---|
| 104 | esac |
|---|
| 105 | PHP_SUBST([XCACHE_INDENT]) |
|---|
| 106 | |
|---|
| 107 | |
|---|
| 108 | XCACHE_PROC_SOURCES=`ls $ac_srcdir/processor/*.m4` |
|---|
| 109 | PHP_SUBST([XCACHE_PROC_SOURCES]) |
|---|
| 110 | |
|---|
| 111 | AC_MSG_CHECKING(if you have opcode_spec_def.h for XCache) |
|---|
| 112 | if test -e "$ac_srcdir/opcode_spec_def.h" ; then |
|---|
| 113 | AC_DEFINE([HAVE_XCACHE_OPCODE_SPEC_DEF], 1, [Define if you have opcode_spec_def.h for XCache]) |
|---|
| 114 | AC_MSG_RESULT(yes) |
|---|
| 115 | else |
|---|
| 116 | |
|---|
| 117 | AC_MSG_RESULT(no) |
|---|
| 118 | define([ERROR], [ |
|---|
| 119 | AC_MSG_ERROR([cannot build with $1, $ac_srcdir/opcode_spec_def.h required]) |
|---|
| 120 | ]) |
|---|
| 121 | if test "$PHP_XCACHE_DISASSEMBLER" != "no" ; then |
|---|
| 122 | ERROR(disassembler) |
|---|
| 123 | fi |
|---|
| 124 | undefine([ERROR]) |
|---|
| 125 | fi |
|---|
| 126 | fi |
|---|