From 063f9a1fb8d2beca9d4d6083313abd73692a9df5 Mon Sep 17 00:00:00 2001 From: Xuefer Date: Thu, 19 Jul 2012 15:11:16 +0000 Subject: [PATCH] fix win32 build git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1006 c26eb9a1-5813-0410-bd6c-c2e55f420ca7 --- config.m4 | 36 ++++++++++++++++++------------- config.w32 | 41 +++++++++++++++++++----------------- devel/run | 1 + mod_coverager/xc_coverager.c | 8 ++++--- util/xc_trace.h | 10 +++++++++ xcache/xc_utils.h | 2 +- 6 files changed, 60 insertions(+), 38 deletions(-) diff --git a/config.m4 b/config.m4 index d715fe5..8f58911 100644 --- a/config.m4 +++ b/config.m4 @@ -23,21 +23,27 @@ if test "$PHP_XCACHE" != "no"; then AC_DEFINE([HAVE_XCACHE_CONSTANT], 1, [Define to enable XCache handling of compile time constants]) fi - xcache_sources=" \ -util/xc_stack.c \ -util/xc_trace.c \ -xcache.c \ -xcache/xc_const_string.c \ -xcache/xc_compatibility.c \ -xcache/xc_lock.c \ -xcache/xc_mem.c \ -xcache/xc_opcode_spec.c \ -xcache/xc_processor.c \ -xcache/xc_sandbox.c \ -xcache/xc_shm.c \ -xcache/xc_shm_mmap.c \ -xcache/xc_utils.c \ -" + xcache_sources="xcache.c" + for i in \ +xc_stack.c \ +xc_trace.c \ +; do + xcache_sources="$xcache_sources util/$i" +done + for i in \ +xc_const_string.c \ +xc_compatibility.c \ +xc_lock.c \ +xc_mem.c \ +xc_opcode_spec.c \ +xc_processor.c \ +xc_sandbox.c \ +xc_shm.c \ +xc_shm_mmap.c \ +xc_utils.c \ +; do + xcache_sources="$xcache_sources xcache/$i" +done XCACHE_MODULES="cacher" XCACHE_MODULE([optimizer], [optimizer ], [XCACHE_OPTIMIZER], [(N/A)]) XCACHE_MODULE([coverager], [coverager ], [XCACHE_COVERAGER], [Enable code coverage dumper, useful for testing php scripts]) diff --git a/config.w32 b/config.w32 index 2f7a197..46b4822 100644 --- a/config.w32 +++ b/config.w32 @@ -4,6 +4,7 @@ ARG_ENABLE("xcache", "Include XCache support", "yes,shared"); if (PHP_XCACHE != "no") { + EXTENSION("xcache", "xcache.c", null, "/I " + configure_module_dirname); // {{{ check for xcache-constant ARG_ENABLE("xcache-constant", "XCache: Handle new constants made by php compiler (e.g.: for __halt_compiler)", "yes"); if (PHP_XCACHE_CONSTANT != "no") { @@ -11,21 +12,24 @@ if (PHP_XCACHE != "no") { } // }}} - var xcache_sources = " \ -util/xc_stack.c \ -util/xc_trace.c \ -xcache.c \ -xcache/xc_const_string.c \ -xcache/xc_compatibility.c \ -xcache/xc_lock.c \ -xcache/xc_mem.c \ -xcache/xc_opcode_spec.c \ -xcache/xc_processor.c \ -xcache/xc_sandbox.c \ -xcache/xc_shm.c \ -xcache/xc_shm_mmap.c \ -xcache/xc_utils.c \ -"; + ADD_SOURCES(configure_module_dirname + "/util", " \ +xc_stack.c \ +xc_trace.c \ +", "xcache"); + + ADD_SOURCES(configure_module_dirname + "/xcache", " \ +xc_const_string.c \ +xc_compatibility.c \ +xc_lock.c \ +xc_mem.c \ +xc_opcode_spec.c \ +xc_processor.c \ +xc_sandbox.c \ +xc_shm.c \ +xc_shm_mmap.c \ +xc_utils.c \ +", "xcache"); + // {{{ add sources on enabled ARG_ENABLE("xcache-optimizer", "(N/A)", "no"); ARG_ENABLE("xcache-coverager", "Enable code coverage dumper, useful for testing php scripts", "no"); @@ -44,7 +48,7 @@ xcache/xc_utils.c \ var uname = name.toUpperCase(); var withval = eval("PHP_XCACHE_" + uname); if (withval != "no") { - xcache_sources += " mod_" + name + "/xc_" + name + ".c"; + ADD_SOURCES(configure_module_dirname + "/mod_" + name, "xc_" + name + ".c", "xcache"); XCACHE_MODULES += " " + name; STDOUT.WriteLine("Enabling XCache Module: " + name); AC_DEFINE("HAVE_XCACHE_" + uname, 1, "Define for XCache: " + name) @@ -79,7 +83,7 @@ xcache/xc_utils.c \ ARG_ENABLE("xcache-test", "XCache: Enable self test - FOR DEVELOPERS ONLY!!", "no"); if (PHP_XCACHE_TEST != "no") { ADD_FLAG("XCACHE_ENABLE_TEST", "-DXCACHE_ENABLE_TEST"); - xcache_sources += " xcache/xc_malloc.c"; + ADD_SOURCES(configure_module_dirname + "/xcache", "xc_malloc.c", "xcache"); AC_DEFINE("HAVE_XCACHE_TEST", 1, "Define to enable XCache self test"); } else { @@ -92,8 +96,7 @@ xcache/xc_utils.c \ AC_DEFINE("HAVE_XCACHE_DPRINT", 1, "Define to enable XCache debug print functions"); } // }}} - // {{{ create extension - EXTENSION("xcache", xcache_sources); + // {{{ get ccrule var srcdir = configure_module_dirname; // it's a bit harder to get builddir var mfofile = "Makefile.objects"; diff --git a/devel/run b/devel/run index bd003ea..fe0cca4 100755 --- a/devel/run +++ b/devel/run @@ -86,6 +86,7 @@ reb*) --enable-xcache-encoder \ --enable-xcache-decoder \ --enable-xcache-disassembler \ + --enable-xcache-coverager \ --enable-xcache-test --enable-xcache-constant \ && make clean all exit diff --git a/mod_coverager/xc_coverager.c b/mod_coverager/xc_coverager.c index fbf570a..f57b4ea 100644 --- a/mod_coverager/xc_coverager.c +++ b/mod_coverager/xc_coverager.c @@ -12,10 +12,12 @@ #include #include -#include "stack.h" +#include "util/xc_stack.h" +#include "util/xc_trace.h" #include "xcache_globals.h" -#include "coverager.h" -#include "utils.h" +#include "xc_coverager.h" +#include "xcache/xc_utils.h" + typedef HashTable *coverager_t; #define PCOV_HEADER_MAGIC 0x564f4350 diff --git a/util/xc_trace.h b/util/xc_trace.h index 285aead..d2271b2 100644 --- a/util/xc_trace.h +++ b/util/xc_trace.h @@ -5,6 +5,16 @@ #pragma once #endif // _MSC_VER > 1000 +#ifdef ZEND_WIN32 +# ifndef inline +# ifdef ZEND_WIN32_FORCE_INLINE +# define inline __forceinline +# else +# define inline +# endif +# endif +#endif + #ifdef XCACHE_DEBUG # define IFDEBUG(x) (x) int xc_vtrace(const char *fmt, va_list args); diff --git a/xcache/xc_utils.h b/xcache/xc_utils.h index c4f2d3a..484c23c 100644 --- a/xcache/xc_utils.h +++ b/xcache/xc_utils.h @@ -1,5 +1,5 @@ #include "php.h" -#include "xcache.h" +#include "../xcache.h" typedef struct { zend_op_array *op_array;