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