[11] | 1 | // vim:ft=javascript |
---|
| 2 | |
---|
| 3 | |
---|
| 4 | ARG_ENABLE("xcache", "Include XCache support", "yes,shared"); |
---|
| 5 | |
---|
| 6 | if (PHP_XCACHE != "no") { |
---|
[95] | 7 | // {{{ check for xcache-constant |
---|
| 8 | ARG_ENABLE("xcache-constant", "XCache: Handle new constants made by php compiler (e.g.: for __halt_compiler)", "yes"); |
---|
| 9 | if (PHP_XCACHE_CONSTANT != "no") { |
---|
| 10 | AC_DEFINE("HAVE_XCACHE_CONSTANT", 1, "Define to enable XCache handling of compile time constants"); |
---|
| 11 | } |
---|
| 12 | // }}} |
---|
| 13 | |
---|
[1004] | 14 | var xcache_sources = " \ |
---|
| 15 | util/xc_stack.c \ |
---|
| 16 | util/xc_trace.c \ |
---|
| 17 | xcache.c \ |
---|
| 18 | xcache/xc_const_string.c \ |
---|
| 19 | xcache/xc_compatibility.c \ |
---|
| 20 | xcache/xc_lock.c \ |
---|
| 21 | xcache/xc_mem.c \ |
---|
| 22 | xcache/xc_opcode_spec.c \ |
---|
| 23 | xcache/xc_processor.c \ |
---|
| 24 | xcache/xc_sandbox.c \ |
---|
| 25 | xcache/xc_shm.c \ |
---|
| 26 | xcache/xc_shm_mmap.c \ |
---|
| 27 | xcache/xc_utils.c \ |
---|
| 28 | "; |
---|
[11] | 29 | // {{{ add sources on enabled |
---|
| 30 | ARG_ENABLE("xcache-optimizer", "(N/A)", "no"); |
---|
[37] | 31 | ARG_ENABLE("xcache-coverager", "Enable code coverage dumper, useful for testing php scripts", "no"); |
---|
[11] | 32 | ARG_ENABLE("xcache-assembler", "(N/A)", "no"); |
---|
[1004] | 33 | ARG_ENABLE("xcache-disassembler", "Enable opcode to php variable dumper, not for server usage", "no"); |
---|
[11] | 34 | ARG_ENABLE("xcache-encoder", "(N/A)", "no"); |
---|
| 35 | ARG_ENABLE("xcache-decoder", "(N/A)", "no"); |
---|
| 36 | |
---|
[26] | 37 | var XCACHE_MODULES = "cacher"; |
---|
[11] | 38 | var options = ["optimizer", |
---|
[27] | 39 | "coverager", |
---|
[11] | 40 | "assembler", "disassembler", |
---|
| 41 | "encoder", "decoder"]; |
---|
| 42 | for (var i in options) { |
---|
| 43 | var name = options[i]; |
---|
| 44 | var uname = name.toUpperCase(); |
---|
| 45 | var withval = eval("PHP_XCACHE_" + uname); |
---|
| 46 | if (withval != "no") { |
---|
[1003] | 47 | xcache_sources += " mod_" + name + "/xc_" + name + ".c"; |
---|
[26] | 48 | XCACHE_MODULES += " " + name; |
---|
[11] | 49 | STDOUT.WriteLine("Enabling XCache Module: " + name); |
---|
| 50 | AC_DEFINE("HAVE_XCACHE_" + uname, 1, "Define for XCache: " + name) |
---|
| 51 | } |
---|
| 52 | } |
---|
[26] | 53 | AC_DEFINE("XCACHE_MODULES", XCACHE_MODULES); |
---|
[11] | 54 | // }}} |
---|
| 55 | // {{{ check for programs needed |
---|
| 56 | var apps = ["m4", "grep", "sed"]; |
---|
| 57 | for (var i in apps) { |
---|
| 58 | if (!PATH_PROG(apps[i])) { |
---|
| 59 | ERROR(apps[i] + " is currently required to build XCache"); |
---|
| 60 | } |
---|
| 61 | } |
---|
[694] | 62 | DEFINE("XCACHE_BACKTICK", "`") |
---|
[355] | 63 | PATH_PROG("gawk", null, "XCACHE_AWK") || PATH_PROG("awk", null, "XCACHE_AWK"); |
---|
[11] | 64 | |
---|
| 65 | // the cygwin indent is known broken on our output |
---|
| 66 | var indent = false; // PATH_PROG("indent"); |
---|
| 67 | if (indent) { |
---|
| 68 | indent += " -kr --use-tabs --tab-size 4 -sob -nce"; |
---|
| 69 | } |
---|
| 70 | else { |
---|
| 71 | indent = PATH_PROG("cat"); |
---|
| 72 | if (!indent) { |
---|
| 73 | indent = ''; |
---|
| 74 | } |
---|
| 75 | } |
---|
| 76 | DEFINE("XCACHE_INDENT", indent); |
---|
| 77 | // }}} |
---|
[478] | 78 | // {{{ check for xcache-test |
---|
| 79 | ARG_ENABLE("xcache-test", "XCache: Enable self test - FOR DEVELOPERS ONLY!!", "no"); |
---|
| 80 | if (PHP_XCACHE_TEST != "no") { |
---|
| 81 | ADD_FLAG("XCACHE_ENABLE_TEST", "-DXCACHE_ENABLE_TEST"); |
---|
[987] | 82 | xcache_sources += " xcache/xc_malloc.c"; |
---|
[478] | 83 | AC_DEFINE("HAVE_XCACHE_TEST", 1, "Define to enable XCache self test"); |
---|
| 84 | } |
---|
| 85 | else { |
---|
| 86 | ADD_FLAG("XCACHE_ENABLE_TEST", ""); |
---|
| 87 | } |
---|
| 88 | // }}} |
---|
| 89 | // {{{ check for xcache-test |
---|
| 90 | ARG_ENABLE("xcache-dprint", "XCache: Enable self debug print functions - FOR DEVELOPERS ONLY!!", "no"); |
---|
| 91 | if (PHP_XCACHE_DPRINT != "no") { |
---|
| 92 | AC_DEFINE("HAVE_XCACHE_DPRINT", 1, "Define to enable XCache debug print functions"); |
---|
| 93 | } |
---|
| 94 | // }}} |
---|
[11] | 95 | // {{{ create extension |
---|
| 96 | EXTENSION("xcache", xcache_sources); |
---|
| 97 | var srcdir = configure_module_dirname; |
---|
| 98 | // it's a bit harder to get builddir |
---|
| 99 | var mfofile = "Makefile.objects"; |
---|
| 100 | MFO.Close(); |
---|
| 101 | |
---|
| 102 | var mfo = file_get_contents(mfofile); |
---|
[412] | 103 | mfo.match(/(.*)\\xcache.obj:/); |
---|
[11] | 104 | var builddir = RegExp.$1; |
---|
[412] | 105 | mfo.match(/(.*\$\(CC\).* )\/c.*\\xcache.c.*/i); |
---|
[11] | 106 | var ccrule = RegExp.$1; |
---|
| 107 | |
---|
| 108 | MFO = FSO.OpenTextFile(mfofile, 8); |
---|
| 109 | mfo = null; |
---|
| 110 | // }}} |
---|
| 111 | // {{{ add make fragments |
---|
| 112 | var file = srcdir + "\\Makefile.frag"; |
---|
| 113 | STDOUT.WriteLine("Adding Makefile.frag: " + file); |
---|
| 114 | var frag = file_get_contents(file); |
---|
| 115 | frag = frag.replace(/\$\(srcdir\)\//g, srcdir + '\\'); |
---|
| 116 | frag = frag.replace(/\$\(srcdir\)/g, srcdir); |
---|
| 117 | frag = frag.replace(/\$\(builddir\)\//g, builddir + '\\'); |
---|
| 118 | frag = frag.replace(/\$\(builddir\)/g, builddir); |
---|
| 119 | frag = frag.replace(/processor\//g, "processor\\"); |
---|
| 120 | frag = frag.replace(/\.lo:/g, ".obj:"); |
---|
| 121 | frag = frag.replace(/.*\$\(CC\).* -E (.*) -o (.*)/, ccrule + " /E $1 > $2"); |
---|
| 122 | frag = frag.replace(/ -o /g, " /Fo"); |
---|
[642] | 123 | frag = frag.replace(/cp /g, "copy "); |
---|
| 124 | frag = frag.replace(/mv /g, "move "); |
---|
[31] | 125 | frag = frag.replace(/ \|\| /g, "\r\n\tif errorlevel 1 "); |
---|
[30] | 126 | frag = frag.replace(/ && /g, "\r\n\tif not errorlevel 1 "); |
---|
[11] | 127 | if (indent == '') { |
---|
| 128 | frag = frag.replace(/\| +\$\(XCACHE_INDENT\)/, ''); |
---|
| 129 | frag = frag.replace(/\$\(XCACHE_INDENT\) < /, 'type '); |
---|
| 130 | } |
---|
| 131 | MFO.WriteLine(frag); |
---|
| 132 | ADD_FLAG("CFLAGS_XCACHE", "/I " + builddir); |
---|
| 133 | /// }}} |
---|
| 134 | XCACHE_PROC_SOURCES=glob(srcdir + "\\processor\\*.m4").join(' '); |
---|
| 135 | ADD_FLAG("XCACHE_PROC_SOURCES", XCACHE_PROC_SOURCES); |
---|
| 136 | } |
---|