diff --git a/config.m4 b/config.m4 index 59b91d2..b76b997 100644 --- a/config.m4 +++ b/config.m4 @@ -7,7 +7,10 @@ AC_DEFUN([XCACHE_OPTION], [ [ --enable-xcache-$2 XCACHE: $4], no, no) if test "$PHP_$3" = "yes"; then xcache_sources="$xcache_sources $1.c" + HAVE_$3=1 AC_DEFINE([HAVE_$3], 1, [Define for XCACHE: $4]) + else + HAVE_$3= fi ])dnl @@ -56,6 +59,23 @@ if test "$PHP_XCACHE" != "no"; then esac PHP_SUBST([XCACHE_INDENT]) + dnl $ac_srcdir etc require PHP_NEW_EXTENSION XCACHE_PROC_SOURCES=`ls $ac_srcdir/processor/*.m4` PHP_SUBST([XCACHE_PROC_SOURCES]) + + AC_MSG_CHECKING(if you have opcode_spec_def.h for xcache) + if test -e "$ac_srcdir/opcode_spec_def.h" ; then + AC_DEFINE([HAVE_XCACHE_OPCODE_SPEC_DEF], 1, [Define if you have opcode_spec_def.h for xcache]) + AC_MSG_RESULT(yes) + else + dnl check for features depend on opcode_spec_def.h + AC_MSG_RESULT(no) + define([ERROR], [ + AC_MSG_ERROR([cannot build with $1, $ac_srcdir/opcode_spec_def.h required]) + ]) + if test "$HAVE_XCACHE_DISASSEMBLER" = "1" ; then + ERROR(disassembler) + fi + undefine([ERROR]) + fi fi diff --git a/disassembler.c b/disassembler.c index 17cfc2d..832f30e 100644 --- a/disassembler.c +++ b/disassembler.c @@ -5,6 +5,9 @@ #define return_value dst +#ifndef HAVE_XCACHE_OPCODE_SPEC_DEF +#error disassembler cannot be built without xcache/opcode_spec_def.h +#endif static void xc_dasm(zval *dst, zend_op_array *op_array TSRMLS_DC) /* {{{ */ { Bucket *b; diff --git a/opcode_spec.c b/opcode_spec.c index d0af327..02be534 100644 --- a/opcode_spec.c +++ b/opcode_spec.c @@ -2,6 +2,7 @@ #include "opcode_spec.h" #include "const_string.h" +#ifdef HAVE_XCACHE_OPCODE_SPEC_DEF /* {{{ opcode_spec */ #define OPSPEC(ext, op1, op2, res) { OPSPEC_##ext, OPSPEC_##op1, OPSPEC_##op2, OPSPEC_##res }, #ifdef ZEND_ENGINE_2 @@ -23,6 +24,7 @@ const xc_opcode_spec_t *xc_get_opcode_spec(zend_uchar opcode) return &xc_opcode_spec[opcode]; } /* }}} */ +#endif /* {{{ op_spec */ #define OPSPECS_DEF_NAME(name) #name, diff --git a/utils.c b/utils.c index c306aec..1bb8210 100644 --- a/utils.c +++ b/utils.c @@ -197,6 +197,7 @@ int xc_redo_pass_two(zend_op_array *op_array TSRMLS_DC) /* {{{ */ } /* }}} */ +#ifdef HAVE_XCACHE_OPCODE_SPEC_DEF static void xc_fix_opcode_ex_znode(int tofix, xc_op_spec_t spec, znode *znode, int type TSRMLS_DC) /* {{{ */ { #ifdef ZEND_ENGINE_2 @@ -261,6 +262,7 @@ int xc_undo_fix_opcode(zend_op_array *op_array TSRMLS_DC) /* {{{ */ return 0; } /* }}} */ +#endif void xc_install_function(char *filename, zend_function *func, zend_uchar type, char *key, uint len TSRMLS_DC) /* {{{ */ { diff --git a/xcache.c b/xcache.c index b8d41b7..8a6a3f2 100644 --- a/xcache.c +++ b/xcache.c @@ -1505,6 +1505,7 @@ PHP_FUNCTION(xcache_get_op_spec) xc_call_getter(xc_get_op_spec, xc_get_op_spec_count(), INTERNAL_FUNCTION_PARAM_PASSTHRU); } /* }}} */ +#ifdef HAVE_XCACHE_OPCODE_SPEC_DEF /* {{{ proto string xcache_get_opcode_spec(int opcode) */ PHP_FUNCTION(xcache_get_opcode_spec) { @@ -1528,6 +1529,7 @@ PHP_FUNCTION(xcache_get_opcode_spec) RETURN_NULL(); } /* }}} */ +#endif /* {{{ proto mixed xcache_get_special_value(zval value) */ PHP_FUNCTION(xcache_get_special_value) { @@ -1600,7 +1602,9 @@ static function_entry xcache_functions[] = /* {{{ */ PHP_FE(xcache_get_op_type, NULL) PHP_FE(xcache_get_data_type, NULL) PHP_FE(xcache_get_opcode, NULL) +#ifdef HAVE_XCACHE_OPCODE_SPEC_DEF PHP_FE(xcache_get_opcode_spec, NULL) +#endif PHP_FE(xcache_is_autoglobal, NULL) PHP_FE(xcache_inc, NULL) PHP_FE(xcache_dec, NULL)