-// vim:ft=javascript\r
-// $Id: config.w32 306241 2010-12-11 22:18:10Z pajoye $\r
-// "Master" config file; think of it as a configure.in\r
-// equivalent.\r
-\r
-ARG_WITH("toolset", "Toolset to use for the compilation, give: vs, clang, icc. " +\r
- "The only recommended and supported toolset for production use " +\r
- "is Visual Studio. Use others at your own risk.", "vs");\r
-toolset_option_handle()\r
-\r
-var PHP_CYGWIN="notset";\r
-\r
-toolset_setup_compiler();\r
-\r
-// do we use x64 or 80x86 version of compiler?\r
-X64 = toolset_is_64();\r
-toolset_setup_arch();\r
-\r
-toolset_setup_linker();\r
-toolset_setup_project_tools();\r
-\r
-// stick objects somewhere outside of the source tree\r
-ARG_ENABLE('object-out-dir', 'Alternate location for binary objects during build', '');\r
-object_out_dir_option_handle();\r
-\r
-ARG_ENABLE('debug', 'Compile with debugging symbols', PHP_DEBUG);\r
-ARG_ENABLE('debug-pack', 'Release binaries with external debug symbols (--enable-debug must not be specified)', 'no');\r
-if (PHP_DEBUG == "yes" && PHP_DEBUG_PACK == "yes") {\r
- ERROR("Use of both --enable-debug and --enable-debug-pack not allowed.");\r
-}\r
-\r
-if (PHP_PREFIX == '') {\r
- PHP_PREFIX = "C:\\php";\r
- if (PHP_DEBUG == "yes")\r
- PHP_PREFIX += "\\debug";\r
-}\r
-DEFINE('PHP_PREFIX', PHP_PREFIX);\r
-\r
-DEFINE("BASE_INCLUDES", "/I " + PHP_DIR + "/include /I " + PHP_DIR + "/include/main /I " + PHP_DIR + "/include/Zend /I " + PHP_DIR + "/include/TSRM /I " + PHP_DIR + "/include/ext ");\r
-\r
-toolset_setup_common_cflags();\r
-\r
+// vim:ft=javascript
+// $Id: config.w32 306241 2010-12-11 22:18:10Z pajoye $
+// "Master" config file; think of it as a configure.in
+// equivalent.
+
+ARG_WITH("toolset", "Toolset to use for the compilation, give: vs, clang, icc. " +
+ "The only recommended and supported toolset for production use " +
+ "is Visual Studio. Use others at your own risk.", "vs");
+toolset_option_handle()
+
+var PHP_CYGWIN="notset";
+
+toolset_setup_compiler();
+
+// do we use x64 or 80x86 version of compiler?
+X64 = toolset_is_64();
+toolset_setup_arch();
+
+toolset_setup_linker();
+toolset_setup_project_tools();
+
+// stick objects somewhere outside of the source tree
+ARG_ENABLE('object-out-dir', 'Alternate location for binary objects during build', '');
+object_out_dir_option_handle();
+
+ARG_ENABLE('debug', 'Compile with debugging symbols', PHP_DEBUG);
+ARG_ENABLE('debug-pack', 'Release binaries with external debug symbols (--enable-debug must not be specified)', 'no');
+if (PHP_DEBUG == "yes" && PHP_DEBUG_PACK == "yes") {
+ ERROR("Use of both --enable-debug and --enable-debug-pack not allowed.");
+}
+
+if (PHP_PREFIX == '') {
+ PHP_PREFIX = "C:\\php";
+ if (PHP_DEBUG == "yes")
+ PHP_PREFIX += "\\debug";
+}
+DEFINE('PHP_PREFIX', PHP_PREFIX);
+
+DEFINE("BASE_INCLUDES", "/I " + PHP_DIR + "/include /I " + PHP_DIR + "/include/main /I " + PHP_DIR + "/include/Zend /I " + PHP_DIR + "/include/TSRM /I " + PHP_DIR + "/include/ext ");
+
+toolset_setup_common_cflags();
+
ARG_WITH('prefix', 'PHP installation prefix', PHP_PREFIX);
-ARG_WITH('mp', 'Tell Visual Studio use up to [n,auto,disable] processes for compilation', 'auto');\r
-var PHP_MP_DISABLED = true;\r
-if (VS_TOOLSET && PHP_MP != 'disable') {\r
- // no from disable-all \r
- if(PHP_MP == 'auto' || PHP_MP == 'no') {\r
- ADD_FLAG('CFLAGS', ' /MP ');\r
- PHP_MP_DISABLED = false;\r
- } else {\r
- if(parseInt(PHP_MP) != 0) {\r
- ADD_FLAG('CFLAGS', ' /MP'+ PHP_MP +' ');\r
- PHP_MP_DISABLED = false;\r
- } else {\r
- STDOUT.WriteLine('WARNING: Invalid argument for MP: ' + PHP_MP);\r
- }\r
- }\r
-}\r
-\r
-/* For snapshot builders, where can we find the additional\r
- * files that make up the snapshot template? */\r
-ARG_WITH("snapshot-template", "Path to snapshot builder template dir", "no");\r
-\r
-// General link flags\r
-toolset_setup_common_ldlags();\r
-\r
-// General libs\r
-toolset_setup_common_libs();\r
-\r
-// Set some debug/release specific options\r
-toolset_setup_build_mode();\r
-\r
-setup_zts_stuff();\r
-\r
-if (MODE_PHPIZE) {\r
- DEFINE("PHPDLL", PHP_DLL);\r
- DEFINE("PHPLIB", PHP_DLL_LIB);\r
-}\r
-\r
-// Find the php_build dir - it contains headers and libraries\r
-// that we need\r
-ARG_WITH('php-build', 'Path to where you extracted the development libraries (http://wiki.php.net/internals/windows/libs). Assumes that it is a sibling of this source dir (..\\deps) if not specified', 'no');\r
-php_build_option_handle();\r
-\r
-ARG_WITH('extra-includes', 'Extra include path to use when building everything', '');\r
-ARG_WITH('extra-libs', 'Extra library path to use when linking everything', '');\r
-\r
-var php_usual_include_suspects = PHP_PHP_BUILD+"\\include";\r
-var php_usual_lib_suspects = PHP_PHP_BUILD+"\\lib";\r
-\r
-ADD_FLAG("CFLAGS", '/I "' + php_usual_include_suspects + '" ');\r
-ADD_FLAG("LDFLAGS", '/libpath:"\\"' + php_usual_lib_suspects + '\\"" ');\r
-ADD_FLAG("ARFLAGS", '/libpath:"\\"' + php_usual_lib_suspects + '\\"" ');\r
-\r
-probe_basic_headers();\r
-add_extra_dirs();\r
-\r
-//DEFINE("PHP_BUILD", PHP_PHP_BUILD);\r
-\r
-STDOUT.WriteBlankLines(1);\r
-STDOUT.WriteLine("Build dir: " + get_define('BUILD_DIR'));\r
-STDOUT.WriteLine("PHP Core: " + get_define('PHPDLL') + " and " + get_define('PHPLIB'));\r
-\r
-/* XXX inspect this for other toolsets */\r
-//AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1);\r
-\r
-AC_DEFINE('HAVE_STRNLEN', 1);\r
-\r
-STDOUT.WriteBlankLines(1);\r
-\r
-if (PHP_SNAPSHOT_TEMPLATE == "no") {\r
- /* default is as a sibling of the php_build dir */\r
- if (FSO.FolderExists(PHP_PHP_BUILD + "\\template")) {\r
- PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\template");\r
- } else if (FSO.FolderExists(PHP_PHP_BUILD + "\\..\\template")) {\r
- PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\..\\template");\r
- }\r
-}\r
-\r
-DEFINE('SNAPSHOT_TEMPLATE', PHP_SNAPSHOT_TEMPLATE);\r
-\r
-AC_DEFINE("PHP_DIR", PHP_DIR);\r
-DEFINE("PHP_DIR", PHP_DIR);\r
-\r
-ARG_WITH("codegen-arch", "Architecture for code generation", "no");\r
-toolset_setup_codegen_arch();\r
-\r
+ARG_WITH('mp', 'Tell Visual Studio use up to [n,auto,disable] processes for compilation', 'auto');
+var PHP_MP_DISABLED = true;
+if (VS_TOOLSET && PHP_MP != 'disable') {
+ // no from disable-all
+ if(PHP_MP == 'auto' || PHP_MP == 'no') {
+ ADD_FLAG('CFLAGS', ' /MP ');
+ PHP_MP_DISABLED = false;
+ } else {
+ if(parseInt(PHP_MP) != 0) {
+ ADD_FLAG('CFLAGS', ' /MP'+ PHP_MP +' ');
+ PHP_MP_DISABLED = false;
+ } else {
+ STDOUT.WriteLine('WARNING: Invalid argument for MP: ' + PHP_MP);
+ }
+ }
+}
+
+/* For snapshot builders, where can we find the additional
+ * files that make up the snapshot template? */
+ARG_WITH("snapshot-template", "Path to snapshot builder template dir", "no");
+
+// General link flags
+toolset_setup_common_ldlags();
+
+// General libs
+toolset_setup_common_libs();
+
+// Set some debug/release specific options
+toolset_setup_build_mode();
+
+setup_zts_stuff();
+
+if (MODE_PHPIZE) {
+ DEFINE("PHPDLL", PHP_DLL);
+ DEFINE("PHPLIB", PHP_DLL_LIB);
+}
+
+// Find the php_build dir - it contains headers and libraries
+// that we need
+ARG_WITH('php-build', 'Path to where you extracted the development libraries (http://wiki.php.net/internals/windows/libs). Assumes that it is a sibling of this source dir (..\\deps) if not specified', 'no');
+php_build_option_handle();
+
+ARG_WITH('extra-includes', 'Extra include path to use when building everything', '');
+ARG_WITH('extra-libs', 'Extra library path to use when linking everything', '');
+
+var php_usual_include_suspects = PHP_PHP_BUILD+"\\include";
+var php_usual_lib_suspects = PHP_PHP_BUILD+"\\lib";
+
+ADD_FLAG("CFLAGS", '/I "' + php_usual_include_suspects + '" ');
+ADD_FLAG("LDFLAGS", '/libpath:"\\"' + php_usual_lib_suspects + '\\"" ');
+ADD_FLAG("ARFLAGS", '/libpath:"\\"' + php_usual_lib_suspects + '\\"" ');
+
+probe_basic_headers();
+add_extra_dirs();
+
+//DEFINE("PHP_BUILD", PHP_PHP_BUILD);
+
+STDOUT.WriteBlankLines(1);
+STDOUT.WriteLine("Build dir: " + get_define('BUILD_DIR'));
+STDOUT.WriteLine("PHP Core: " + get_define('PHPDLL') + " and " + get_define('PHPLIB'));
+
+/* XXX inspect this for other toolsets */
+//AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1);
+
+AC_DEFINE('HAVE_STRNLEN', 1);
+
+STDOUT.WriteBlankLines(1);
+
+if (PHP_SNAPSHOT_TEMPLATE == "no") {
+ /* default is as a sibling of the php_build dir */
+ if (FSO.FolderExists(PHP_PHP_BUILD + "\\template")) {
+ PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\template");
+ } else if (FSO.FolderExists(PHP_PHP_BUILD + "\\..\\template")) {
+ PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\..\\template");
+ }
+}
+
+DEFINE('SNAPSHOT_TEMPLATE', PHP_SNAPSHOT_TEMPLATE);
+
+AC_DEFINE("PHP_DIR", PHP_DIR);
+DEFINE("PHP_DIR", PHP_DIR);
+
+ARG_WITH("codegen-arch", "Architecture for code generation", "no");
+toolset_setup_codegen_arch();
+
-/*\r
- +----------------------------------------------------------------------+\r
- | PHP Version 7 |\r
- +----------------------------------------------------------------------+\r
- | Copyright (c) 1997-2018 The PHP Group |\r
- +----------------------------------------------------------------------+\r
- | This source file is subject to version 3.01 of the PHP license, |\r
- | that is bundled with this package in the file LICENSE, and is |\r
- | available through the world-wide-web at the following url: |\r
- | http://www.php.net/license/3_01.txt |\r
- | If you did not receive a copy of the PHP license and are unable to |\r
- | obtain it through the world-wide-web, please send a note to |\r
- | license@php.net so we can mail you a copy immediately. |\r
- +----------------------------------------------------------------------+\r
- | Author: Pierre Joye <pierre1@php.net> |\r
- +----------------------------------------------------------------------+\r
-*/\r
-\r
-/* $Id$ */\r
-// This generates a configure script for win32 build\r
-\r
-var STDOUT = WScript.StdOut;\r
-\r
-var FSO = WScript.CreateObject("Scripting.FileSystemObject");\r
-var C = FSO.CreateTextFile("configure.js", true);\r
-var B = FSO.CreateTextFile("configure.bat", true);\r
-re = /\\script/i;\r
-var PHP_DIR=FSO.GetParentFolderName(WScript.ScriptFullName).replace(re,"");\r
-\r
-var modules = "";\r
-var MODULES = WScript.CreateObject("Scripting.Dictionary");\r
-var module_dirs = new Array();\r
-\r
-function ERROR(msg)\r
-{\r
- STDERR.WriteLine("ERROR: " + msg);\r
- WScript.Quit(3);\r
-}\r
-\r
-function file_get_contents(filename)\r
-{\r
- var t = "";\r
- var F = FSO.OpenTextFile(filename, 1);\r
-\r
- if (!F.AtEndOfStream) {\r
- t = F.ReadAll();\r
- F.Close();\r
- }\r
- return t;\r
-}\r
-\r
-function Module_Item(module_name, config_path, dir_line, deps, content)\r
-{\r
- this.module_name = module_name;\r
- this.config_path = config_path;\r
- this.dir_line = dir_line;\r
- this.deps = deps;\r
- this.content = content;\r
-}\r
-\r
-function get_module_dep(contents)\r
-{\r
- var re_dep_line = new RegExp("ADD_EXTENSION_DEP\\([^,]*\\s*,\\s*['\"]([^'\"]+)['\"].*\\)", "gm");\r
- var calls = contents.match(re_dep_line);\r
- var deps = new Array();\r
- if (calls != null) {\r
- for (i = 0; i < calls.length; i++) {\r
- // now we need the extension name out of this thing\r
- if (calls[i].match(re_dep_line)) {\r
- deps[deps.length] = RegExp.$1;\r
-\r
- }\r
- }\r
- }\r
- return deps;\r
-}\r
-\r
-function find_config_w32(dirname)\r
-{\r
- if (!FSO.FolderExists(dirname)) {\r
- return;\r
- }\r
-\r
- var f = FSO.GetFolder(dirname);\r
- var fc = new Enumerator(f.SubFolders);\r
- var c, i, ok, n;\r
- var item = null;\r
-\r
- c = dirname + "\\config.w32";\r
- if (FSO.FileExists(c)) {\r
- var dir_line = "configure_module_dirname = condense_path(FSO.GetParentFolderName('"\r
- + c.replace(new RegExp('(["\\\\])', "g"), '\\$1') + "'));\r\n";\r
- var contents = file_get_contents(c);\r
-\r
- deps = get_module_dep(contents);\r
-\r
- item = new Module_Item(n, c, dir_line, deps, contents);\r
- MODULES.Add(n, item);\r
- }\r
-\r
- for (; !fc.atEnd(); fc.moveNext()) {\r
- /* check if we already picked up a module with the same dirname;\r
- * if we have, don't include it here */\r
- n = FSO.GetFileName(fc.item());\r
- if (n == '.svn' || n == 'tests' || n == '.git') {\r
- continue;\r
- }\r
-\r
- c = FSO.BuildPath(fc.item(), "config.w32");\r
- if (FSO.FileExists(c)) {\r
- var dir_line = "configure_module_dirname = condense_path(FSO.GetParentFolderName('"\r
- + c.replace(new RegExp('(["\\\\])', "g"), '\\$1') + "'));\r\n";\r
- var contents = file_get_contents(c);\r
-\r
- deps = get_module_dep(contents);\r
-\r
- item = new Module_Item(n, c, dir_line, deps, contents);\r
- MODULES.Add(n, item);\r
- }\r
- }\r
-}\r
-\r
-function emit_module(item)\r
-{\r
- return item.dir_line + item.content;\r
-}\r
-\r
-function emit_dep_modules(module_names)\r
-{\r
- var i, mod_name, j;\r
- var output = "";\r
- var item = null;\r
-\r
- for (i in module_names) {\r
- mod_name = module_names[i];\r
-\r
- if (MODULES.Exists(mod_name)) {\r
- item = MODULES.Item(mod_name);\r
- MODULES.Remove(mod_name);\r
- if (item.deps.length) {\r
- output += emit_dep_modules(item.deps);\r
- }\r
- output += emit_module(item);\r
- }\r
- }\r
-\r
- return output;\r
-}\r
-\r
-function gen_modules()\r
-{\r
- var module_names = (new VBArray(MODULES.Keys())).toArray();\r
- var i, mod_name, j;\r
- var item;\r
- var output = "";\r
-\r
- // first, look for modules with empty deps; emit those first\r
- for (i in module_names) {\r
- STDOUT.WriteLine("module ... " + module_names);\r
- mod_name = module_names[i];\r
- item = MODULES.Item(mod_name);\r
- if (item.deps.length == 0) {\r
- MODULES.Remove(mod_name);\r
- output += emit_module(item);\r
- }\r
- }\r
-\r
- // now we are left with modules that have dependencies on other modules\r
- module_names = (new VBArray(MODULES.Keys())).toArray();\r
- output += emit_dep_modules(module_names);\r
-\r
- return output;\r
-}\r
-\r
-// Process buildconf arguments\r
-function buildconf_process_args()\r
-{\r
- args = WScript.Arguments;\r
-\r
- for (i = 0; i < args.length; i++) {\r
- arg = args(i);\r
- // If it is --foo=bar, split on the equals sign\r
- arg = arg.split("=", 2);\r
- argname = arg[0];\r
- if (arg.length > 1) {\r
- argval = arg[1];\r
- } else {\r
- argval = null;\r
- }\r
-\r
- if (argname == '--clean' && argval != null) {\r
- STDOUT.WriteLine("Cleaning...");\r
- return 0;\r
- }\r
-\r
- if (argname == '--help') {\r
- STDOUT.WriteLine("Usage: phpize [--clean|--help|--version|-v]");\r
- return 0;\r
- }\r
- return 1;\r
- }\r
-}\r
-\r
-if (buildconf_process_args() == 0) {\r
- WScript.Quit(3);\r
-}\r
-STDOUT.WriteLine("Rebuilding configure.js");\r
-STDOUT.WriteLine(PHP_DIR);\r
-\r
-// Write the head of the configure script\r
-C.WriteLine("/* This file automatically generated from script/confutils.js */");\r
-C.WriteLine("var MODE_PHPIZE = true;");\r
-C.WriteLine("var PHP_DIR = " + '"' + PHP_DIR.replace(new RegExp('(["\\\\])', "g"), '\\$1') + '"');\r
-C.WriteLine("var PHP_PREFIX = " + '"' + PHP_PREFIX.replace(new RegExp('(["\\\\])', "g"), '\\$1') + '"');\r
-\r
-/* XXX this needs to be implemented for the phpize mode yet, a quick fix just to disable it for now */\r
-C.WriteLine("var PHP_ANALYZER = 'disabled';");\r
-C.WriteLine("var PHP_PGO = 'no';");\r
-C.WriteLine("var PHP_PGI = 'no';");\r
-\r
-C.Write(file_get_contents(PHP_DIR + "//script//ext_deps.js"));\r
-if (FSO.FileExists(PHP_DIR + "/script/ext_pickle.js")) {\r
- C.Write(file_get_contents(PHP_DIR + "//script//ext_pickle.js"));\r
-}\r
-\r
-C.Write(file_get_contents(PHP_DIR + "/script/confutils.js"));\r
-C.Write(file_get_contents(PHP_DIR + "/script/config.phpize.js"));\r
-\r
-// Pull in code for the base detection\r
-modules = file_get_contents(PHP_DIR + "/script/config.w32.phpize.in");\r
-\r
-C.WriteLine("ARG_ENABLE('debug', 'Compile with debugging symbols', PHP_DEBUG);");\r
-find_config_w32(".");\r
-\r
-// Now generate contents of module based on MODULES, chasing dependencies\r
-// to ensure that dependent modules are emitted first\r
-modules += gen_modules();\r
-\r
-// Look for ARG_ENABLE or ARG_WITH calls\r
-re = new RegExp("(ARG_(ENABLE|WITH)\([^;]+\);)", "gm");\r
-calls = modules.match(re);\r
-for (i = 0; i < calls.length; i++) {\r
- item = calls[i];\r
- C.WriteLine("try {");\r
- C.WriteLine(item);\r
- C.WriteLine("} catch (e) {");\r
- C.WriteLine('\tSTDOUT.WriteLine("problem: " + e);');\r
- C.WriteLine("}");\r
-}\r
-\r
-C.WriteBlankLines(1);\r
-C.WriteLine("conf_process_args();");\r
-C.WriteBlankLines(1);\r
-\r
-// Comment out the calls from their original positions\r
-modules = modules.replace(re, "/* $1 */");\r
-C.Write(modules);\r
-\r
-\r
-C.WriteBlankLines(1);\r
-C.Write(file_get_contents(PHP_DIR + "\\script\\configure.tail"));\r
-\r
-B.WriteLine("@echo off");\r
-B.WriteLine("cscript /nologo configure.js %*");\r
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 7 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2018 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Pierre Joye <pierre1@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+// This generates a configure script for win32 build
+
+var STDOUT = WScript.StdOut;
+
+var FSO = WScript.CreateObject("Scripting.FileSystemObject");
+var C = FSO.CreateTextFile("configure.js", true);
+var B = FSO.CreateTextFile("configure.bat", true);
+re = /\\script/i;
+var PHP_DIR=FSO.GetParentFolderName(WScript.ScriptFullName).replace(re,"");
+
+var modules = "";
+var MODULES = WScript.CreateObject("Scripting.Dictionary");
+var module_dirs = new Array();
+
+function ERROR(msg)
+{
+ STDERR.WriteLine("ERROR: " + msg);
+ WScript.Quit(3);
+}
+
+function file_get_contents(filename)
+{
+ var t = "";
+ var F = FSO.OpenTextFile(filename, 1);
+
+ if (!F.AtEndOfStream) {
+ t = F.ReadAll();
+ F.Close();
+ }
+ return t;
+}
+
+function Module_Item(module_name, config_path, dir_line, deps, content)
+{
+ this.module_name = module_name;
+ this.config_path = config_path;
+ this.dir_line = dir_line;
+ this.deps = deps;
+ this.content = content;
+}
+
+function get_module_dep(contents)
+{
+ var re_dep_line = new RegExp("ADD_EXTENSION_DEP\\([^,]*\\s*,\\s*['\"]([^'\"]+)['\"].*\\)", "gm");
+ var calls = contents.match(re_dep_line);
+ var deps = new Array();
+ if (calls != null) {
+ for (i = 0; i < calls.length; i++) {
+ // now we need the extension name out of this thing
+ if (calls[i].match(re_dep_line)) {
+ deps[deps.length] = RegExp.$1;
+
+ }
+ }
+ }
+ return deps;
+}
+
+function find_config_w32(dirname)
+{
+ if (!FSO.FolderExists(dirname)) {
+ return;
+ }
+
+ var f = FSO.GetFolder(dirname);
+ var fc = new Enumerator(f.SubFolders);
+ var c, i, ok, n;
+ var item = null;
+
+ c = dirname + "\\config.w32";
+ if (FSO.FileExists(c)) {
+ var dir_line = "configure_module_dirname = condense_path(FSO.GetParentFolderName('"
+ + c.replace(new RegExp('(["\\\\])', "g"), '\\$1') + "'));\r\n";
+ var contents = file_get_contents(c);
+
+ deps = get_module_dep(contents);
+
+ item = new Module_Item(n, c, dir_line, deps, contents);
+ MODULES.Add(n, item);
+ }
+
+ for (; !fc.atEnd(); fc.moveNext()) {
+ /* check if we already picked up a module with the same dirname;
+ * if we have, don't include it here */
+ n = FSO.GetFileName(fc.item());
+ if (n == '.svn' || n == 'tests' || n == '.git') {
+ continue;
+ }
+
+ c = FSO.BuildPath(fc.item(), "config.w32");
+ if (FSO.FileExists(c)) {
+ var dir_line = "configure_module_dirname = condense_path(FSO.GetParentFolderName('"
+ + c.replace(new RegExp('(["\\\\])', "g"), '\\$1') + "'));\r\n";
+ var contents = file_get_contents(c);
+
+ deps = get_module_dep(contents);
+
+ item = new Module_Item(n, c, dir_line, deps, contents);
+ MODULES.Add(n, item);
+ }
+ }
+}
+
+function emit_module(item)
+{
+ return item.dir_line + item.content;
+}
+
+function emit_dep_modules(module_names)
+{
+ var i, mod_name, j;
+ var output = "";
+ var item = null;
+
+ for (i in module_names) {
+ mod_name = module_names[i];
+
+ if (MODULES.Exists(mod_name)) {
+ item = MODULES.Item(mod_name);
+ MODULES.Remove(mod_name);
+ if (item.deps.length) {
+ output += emit_dep_modules(item.deps);
+ }
+ output += emit_module(item);
+ }
+ }
+
+ return output;
+}
+
+function gen_modules()
+{
+ var module_names = (new VBArray(MODULES.Keys())).toArray();
+ var i, mod_name, j;
+ var item;
+ var output = "";
+
+ // first, look for modules with empty deps; emit those first
+ for (i in module_names) {
+ STDOUT.WriteLine("module ... " + module_names);
+ mod_name = module_names[i];
+ item = MODULES.Item(mod_name);
+ if (item.deps.length == 0) {
+ MODULES.Remove(mod_name);
+ output += emit_module(item);
+ }
+ }
+
+ // now we are left with modules that have dependencies on other modules
+ module_names = (new VBArray(MODULES.Keys())).toArray();
+ output += emit_dep_modules(module_names);
+
+ return output;
+}
+
+// Process buildconf arguments
+function buildconf_process_args()
+{
+ args = WScript.Arguments;
+
+ for (i = 0; i < args.length; i++) {
+ arg = args(i);
+ // If it is --foo=bar, split on the equals sign
+ arg = arg.split("=", 2);
+ argname = arg[0];
+ if (arg.length > 1) {
+ argval = arg[1];
+ } else {
+ argval = null;
+ }
+
+ if (argname == '--clean' && argval != null) {
+ STDOUT.WriteLine("Cleaning...");
+ return 0;
+ }
+
+ if (argname == '--help') {
+ STDOUT.WriteLine("Usage: phpize [--clean|--help|--version|-v]");
+ return 0;
+ }
+ return 1;
+ }
+}
+
+if (buildconf_process_args() == 0) {
+ WScript.Quit(3);
+}
+STDOUT.WriteLine("Rebuilding configure.js");
+STDOUT.WriteLine(PHP_DIR);
+
+// Write the head of the configure script
+C.WriteLine("/* This file automatically generated from script/confutils.js */");
+C.WriteLine("var MODE_PHPIZE = true;");
+C.WriteLine("var PHP_DIR = " + '"' + PHP_DIR.replace(new RegExp('(["\\\\])', "g"), '\\$1') + '"');
+C.WriteLine("var PHP_PREFIX = " + '"' + PHP_PREFIX.replace(new RegExp('(["\\\\])', "g"), '\\$1') + '"');
+
+/* XXX this needs to be implemented for the phpize mode yet, a quick fix just to disable it for now */
+C.WriteLine("var PHP_ANALYZER = 'disabled';");
+C.WriteLine("var PHP_PGO = 'no';");
+C.WriteLine("var PHP_PGI = 'no';");
+
+C.Write(file_get_contents(PHP_DIR + "//script//ext_deps.js"));
+if (FSO.FileExists(PHP_DIR + "/script/ext_pickle.js")) {
+ C.Write(file_get_contents(PHP_DIR + "//script//ext_pickle.js"));
+}
+
+C.Write(file_get_contents(PHP_DIR + "/script/confutils.js"));
+C.Write(file_get_contents(PHP_DIR + "/script/config.phpize.js"));
+
+// Pull in code for the base detection
+modules = file_get_contents(PHP_DIR + "/script/config.w32.phpize.in");
+
+C.WriteLine("ARG_ENABLE('debug', 'Compile with debugging symbols', PHP_DEBUG);");
+find_config_w32(".");
+
+// Now generate contents of module based on MODULES, chasing dependencies
+// to ensure that dependent modules are emitted first
+modules += gen_modules();
+
+// Look for ARG_ENABLE or ARG_WITH calls
+re = new RegExp("(ARG_(ENABLE|WITH)\([^;]+\);)", "gm");
+calls = modules.match(re);
+for (i = 0; i < calls.length; i++) {
+ item = calls[i];
+ C.WriteLine("try {");
+ C.WriteLine(item);
+ C.WriteLine("} catch (e) {");
+ C.WriteLine('\tSTDOUT.WriteLine("problem: " + e);');
+ C.WriteLine("}");
+}
+
+C.WriteBlankLines(1);
+C.WriteLine("conf_process_args();");
+C.WriteBlankLines(1);
+
+// Comment out the calls from their original positions
+modules = modules.replace(re, "/* $1 */");
+C.Write(modules);
+
+
+C.WriteBlankLines(1);
+C.Write(file_get_contents(PHP_DIR + "\\script\\configure.tail"));
+
+B.WriteLine("@echo off");
+B.WriteLine("cscript /nologo configure.js %*");
FSO.CopyFile(PHP_DIR + "\\script\\run-tests.php", "run-tests.php", true);