2006-05-24 07:52:48 +00:00
|
|
|
// vim:ft=javascript
|
|
|
|
|
|
|
|
|
|
|
|
ARG_ENABLE("xcache", "Include XCache support", "yes,shared");
|
|
|
|
|
|
|
|
if (PHP_XCACHE != "no") {
|
2006-07-16 11:07:57 +00:00
|
|
|
// {{{ 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") {
|
|
|
|
AC_DEFINE("HAVE_XCACHE_CONSTANT", 1, "Define to enable XCache handling of compile time constants");
|
|
|
|
}
|
|
|
|
// }}}
|
|
|
|
|
2006-05-24 07:52:48 +00:00
|
|
|
var xcache_sources = "processor.c \
|
|
|
|
xcache.c \
|
|
|
|
mmap.c \
|
|
|
|
mem.c \
|
2006-09-09 00:56:44 +00:00
|
|
|
xc_shm.c \
|
2006-05-24 07:52:48 +00:00
|
|
|
const_string.c \
|
|
|
|
opcode_spec.c \
|
|
|
|
stack.c \
|
|
|
|
utils.c \
|
|
|
|
lock.c \
|
|
|
|
";
|
|
|
|
// {{{ add sources on enabled
|
|
|
|
ARG_ENABLE("xcache-optimizer", "(N/A)", "no");
|
2006-05-27 10:47:50 +00:00
|
|
|
ARG_ENABLE("xcache-coverager", "Enable code coverage dumper, useful for testing php scripts", "no");
|
2006-05-24 07:52:48 +00:00
|
|
|
ARG_ENABLE("xcache-assembler", "(N/A)", "no");
|
|
|
|
ARG_ENABLE("xcache-disassembler", "Enable opcode to php variable dumper, NOT for production server", "no");
|
|
|
|
ARG_ENABLE("xcache-encoder", "(N/A)", "no");
|
|
|
|
ARG_ENABLE("xcache-decoder", "(N/A)", "no");
|
|
|
|
|
2006-05-26 02:28:17 +00:00
|
|
|
var XCACHE_MODULES = "cacher";
|
2006-05-24 07:52:48 +00:00
|
|
|
var options = ["optimizer",
|
2006-05-26 02:30:20 +00:00
|
|
|
"coverager",
|
2006-05-24 07:52:48 +00:00
|
|
|
"assembler", "disassembler",
|
|
|
|
"encoder", "decoder"];
|
|
|
|
for (var i in options) {
|
|
|
|
var name = options[i];
|
|
|
|
var uname = name.toUpperCase();
|
|
|
|
var withval = eval("PHP_XCACHE_" + uname);
|
|
|
|
if (withval != "no") {
|
|
|
|
xcache_sources += " " + name + ".c";
|
2006-05-26 02:28:17 +00:00
|
|
|
XCACHE_MODULES += " " + name;
|
2006-05-24 07:52:48 +00:00
|
|
|
STDOUT.WriteLine("Enabling XCache Module: " + name);
|
|
|
|
AC_DEFINE("HAVE_XCACHE_" + uname, 1, "Define for XCache: " + name)
|
|
|
|
}
|
|
|
|
}
|
2006-05-26 02:28:17 +00:00
|
|
|
AC_DEFINE("XCACHE_MODULES", XCACHE_MODULES);
|
2006-05-24 07:52:48 +00:00
|
|
|
// }}}
|
|
|
|
// {{{ check for programs needed
|
|
|
|
var apps = ["m4", "grep", "sed"];
|
|
|
|
for (var i in apps) {
|
|
|
|
if (!PATH_PROG(apps[i])) {
|
|
|
|
ERROR(apps[i] + " is currently required to build XCache");
|
|
|
|
}
|
|
|
|
}
|
2007-02-15 11:46:05 +00:00
|
|
|
PATH_PROG("gawk", null, "XCACHE_AWK") || PATH_PROG("awk", null, "XCACHE_AWK");
|
2006-05-24 07:52:48 +00:00
|
|
|
|
|
|
|
// the cygwin indent is known broken on our output
|
|
|
|
var indent = false; // PATH_PROG("indent");
|
|
|
|
if (indent) {
|
|
|
|
indent += " -kr --use-tabs --tab-size 4 -sob -nce";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
indent = PATH_PROG("cat");
|
|
|
|
if (!indent) {
|
|
|
|
indent = '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DEFINE("XCACHE_INDENT", indent);
|
|
|
|
// }}}
|
2007-09-17 10:45:07 +00:00
|
|
|
// {{{ check for xcache-test
|
|
|
|
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 += " xc_malloc.c";
|
|
|
|
AC_DEFINE("HAVE_XCACHE_TEST", 1, "Define to enable XCache self test");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ADD_FLAG("XCACHE_ENABLE_TEST", "");
|
|
|
|
}
|
|
|
|
// }}}
|
|
|
|
// {{{ check for xcache-test
|
|
|
|
ARG_ENABLE("xcache-dprint", "XCache: Enable self debug print functions - FOR DEVELOPERS ONLY!!", "no");
|
|
|
|
if (PHP_XCACHE_DPRINT != "no") {
|
|
|
|
AC_DEFINE("HAVE_XCACHE_DPRINT", 1, "Define to enable XCache debug print functions");
|
|
|
|
}
|
|
|
|
// }}}
|
2006-05-24 07:52:48 +00:00
|
|
|
// {{{ create extension
|
|
|
|
EXTENSION("xcache", xcache_sources);
|
|
|
|
var srcdir = configure_module_dirname;
|
|
|
|
// it's a bit harder to get builddir
|
|
|
|
var mfofile = "Makefile.objects";
|
|
|
|
MFO.Close();
|
|
|
|
|
|
|
|
var mfo = file_get_contents(mfofile);
|
2007-06-14 06:00:58 +00:00
|
|
|
mfo.match(/(.*)\\xcache.obj:/);
|
2006-05-24 07:52:48 +00:00
|
|
|
var builddir = RegExp.$1;
|
2007-06-14 06:00:58 +00:00
|
|
|
mfo.match(/(.*\$\(CC\).* )\/c.*\\xcache.c.*/i);
|
2006-05-24 07:52:48 +00:00
|
|
|
var ccrule = RegExp.$1;
|
|
|
|
|
|
|
|
MFO = FSO.OpenTextFile(mfofile, 8);
|
|
|
|
mfo = null;
|
|
|
|
// }}}
|
|
|
|
// {{{ add make fragments
|
|
|
|
var file = srcdir + "\\Makefile.frag";
|
|
|
|
STDOUT.WriteLine("Adding Makefile.frag: " + file);
|
|
|
|
var frag = file_get_contents(file);
|
|
|
|
frag = frag.replace(/\$\(srcdir\)\//g, srcdir + '\\');
|
|
|
|
frag = frag.replace(/\$\(srcdir\)/g, srcdir);
|
|
|
|
frag = frag.replace(/\$\(builddir\)\//g, builddir + '\\');
|
|
|
|
frag = frag.replace(/\$\(builddir\)/g, builddir);
|
|
|
|
frag = frag.replace(/processor\//g, "processor\\");
|
|
|
|
frag = frag.replace(/\.lo:/g, ".obj:");
|
|
|
|
frag = frag.replace(/.*\$\(CC\).* -E (.*) -o (.*)/, ccrule + " /E $1 > $2");
|
|
|
|
frag = frag.replace(/ -o /g, " /Fo");
|
|
|
|
frag = frag.replace(/mv -f /g, "move ");
|
2006-05-26 03:46:42 +00:00
|
|
|
frag = frag.replace(/ \|\| /g, "\r\n\tif errorlevel 1 ");
|
2006-05-26 03:32:40 +00:00
|
|
|
frag = frag.replace(/ && /g, "\r\n\tif not errorlevel 1 ");
|
2006-05-24 07:52:48 +00:00
|
|
|
if (indent == '') {
|
|
|
|
frag = frag.replace(/\| +\$\(XCACHE_INDENT\)/, '');
|
|
|
|
frag = frag.replace(/\$\(XCACHE_INDENT\) < /, 'type ');
|
|
|
|
}
|
|
|
|
MFO.WriteLine(frag);
|
|
|
|
ADD_FLAG("CFLAGS_XCACHE", "/I " + builddir);
|
|
|
|
/// }}}
|
|
|
|
XCACHE_PROC_SOURCES=glob(srcdir + "\\processor\\*.m4").join(' ');
|
|
|
|
ADD_FLAG("XCACHE_PROC_SOURCES", XCACHE_PROC_SOURCES);
|
|
|
|
// {{{ check for opcode_spec_def.h
|
|
|
|
STDOUT.Write("Checking if you have opcode_spec_def.h for XCache ... ");
|
|
|
|
var file = srcdir + "\\opcode_spec_def.h";
|
|
|
|
if (FSO.FileExists(file)) {
|
|
|
|
STDOUT.WriteLine("yes");
|
|
|
|
AC_DEFINE("HAVE_XCACHE_OPCODE_SPEC_DEF", 1, "Define if you have opcode_spec_def.h for XCache");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
STDOUT.WriteLine("no");
|
|
|
|
|
|
|
|
// check for features depend on opcode_spec_def.h
|
|
|
|
var xcache_require_opcode_spec_def = function(withval, name) {
|
|
|
|
if (withval != "no") {
|
|
|
|
ERROR(file + " is required to enable XCache " + name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
xcache_require_opcode_spec_def(PHP_XCACHE_DISASSEMBLER, "disassembler");
|
|
|
|
}
|
|
|
|
// }}}
|
|
|
|
}
|