1// vim:ft=javascript 2// "Master" config file; think of it as a configure.ac 3// equivalent. 4 5ARG_WITH("verbosity", "Output verbosity, 0-2.", "1"); 6setup_verbosity(); 7 8ARG_WITH("toolset", "Toolset to use for the compilation, give: vs, clang, icc. " + 9 "The only recommended and supported toolset for production use " + 10 "is Visual Studio. Use others at your own risk.", "vs"); 11toolset_option_handle() 12 13var PHP_CYGWIN="notset"; 14 15toolset_setup_compiler(); 16 17HOST_ARCH = toolset_host_arch(); 18TARGET_ARCH = toolset_target_arch(); 19// for compatible only 20X64 = TARGET_ARCH != 'x86'; 21toolset_setup_arch(); 22 23toolset_setup_linker(); 24toolset_setup_project_tools(); 25 26// stick objects somewhere outside of the source tree 27ARG_ENABLE('object-out-dir', 'Alternate location for binary objects during build', ''); 28object_out_dir_option_handle(); 29 30ARG_ENABLE('debug', 'Compile with debugging symbols', PHP_DEBUG); 31ARG_ENABLE('debug-pack', 'Release binaries with external debug symbols (--enable-debug must not be specified)', 'no'); 32if (PHP_DEBUG == "yes" && PHP_DEBUG_PACK == "yes") { 33 ERROR("Use of both --enable-debug and --enable-debug-pack not allowed."); 34} 35 36if (PHP_PREFIX == '') { 37 PHP_PREFIX = "C:\\php"; 38 if (PHP_DEBUG == "yes") 39 PHP_PREFIX += "\\debug"; 40} 41DEFINE('PHP_PREFIX', PHP_PREFIX); 42 43DEFINE("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 "); 44 45toolset_setup_common_cflags(); 46 47ARG_WITH('prefix', 'PHP installation prefix', PHP_PREFIX); 48ARG_WITH('mp', 'Tell Visual Studio use up to [n,auto,disable] processes for compilation', 'auto'); 49var PHP_MP_DISABLED = true; 50if (VS_TOOLSET && PHP_MP != 'disable') { 51 // no from disable-all 52 if(PHP_MP == 'auto' || PHP_MP == 'no') { 53 ADD_FLAG('CFLAGS', ' /MP '); 54 PHP_MP_DISABLED = false; 55 } else { 56 if(parseInt(PHP_MP) != 0) { 57 ADD_FLAG('CFLAGS', ' /MP'+ PHP_MP +' '); 58 PHP_MP_DISABLED = false; 59 } else { 60 STDOUT.WriteLine('WARNING: Invalid argument for MP: ' + PHP_MP); 61 } 62 } 63} 64 65/* For snapshot builders, where can we find the additional 66 * files that make up the snapshot template? */ 67ARG_WITH("snapshot-template", "Path to snapshot builder template dir", "no"); 68 69// General link flags 70toolset_setup_common_ldlags(); 71 72// General libs 73toolset_setup_common_libs(); 74 75// Set some debug/release specific options 76toolset_setup_build_mode(); 77 78setup_zts_stuff(); 79 80if (MODE_PHPIZE) { 81 DEFINE("PHPDLL", PHP_DLL); 82 DEFINE("PHPLIB", PHP_DLL_LIB); 83} 84 85// Find the php_build dir - it contains headers and libraries 86// that we need 87ARG_WITH('php-build', 'Path to where you extracted the development libraries (https://wiki.php.net/internals/windows/libs). Assumes that it is a sibling of this source dir (..\\deps) if not specified', 'no'); 88php_build_option_handle(); 89 90ARG_WITH('extra-includes', 'Extra include path to use when building everything', ''); 91ARG_WITH('extra-libs', 'Extra library path to use when linking everything', ''); 92 93var php_usual_include_suspects = PHP_PHP_BUILD+"\\include"; 94var php_usual_lib_suspects = PHP_PHP_BUILD+"\\lib"; 95 96ADD_FLAG("CFLAGS", '/I "' + php_usual_include_suspects + '" '); 97ADD_FLAG("LDFLAGS", '/libpath:"\\"' + php_usual_lib_suspects + '\\"" '); 98ADD_FLAG("ARFLAGS", '/libpath:"\\"' + php_usual_lib_suspects + '\\"" '); 99 100probe_basic_headers(); 101add_extra_dirs(); 102 103//DEFINE("PHP_BUILD", PHP_PHP_BUILD); 104 105STDOUT.WriteBlankLines(1); 106STDOUT.WriteLine("Build dir: " + get_define('BUILD_DIR')); 107STDOUT.WriteLine("PHP Core: " + get_define('PHPDLL') + " and " + get_define('PHPLIB')); 108 109/* XXX inspect this for other toolsets */ 110//AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1); 111 112AC_DEFINE('HAVE_STRNLEN', 1); 113 114STDOUT.WriteBlankLines(1); 115 116if (PHP_SNAPSHOT_TEMPLATE == "no") { 117 /* default is as a sibling of the php_build dir */ 118 if (FSO.FolderExists(PHP_PHP_BUILD + "\\template")) { 119 PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\template"); 120 } else if (FSO.FolderExists(PHP_PHP_BUILD + "\\..\\template")) { 121 PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\..\\template"); 122 } 123} 124 125DEFINE('SNAPSHOT_TEMPLATE', PHP_SNAPSHOT_TEMPLATE); 126 127AC_DEFINE("PHP_DIR", PHP_DIR); 128DEFINE("PHP_DIR", PHP_DIR); 129 130ARG_WITH("codegen-arch", "Architecture for code generation", "no"); 131toolset_setup_codegen_arch(); 132 133ARG_ENABLE("test-ini", "Enable automatic php.ini generation. The test.ini will be put \ 134 into the build dir and used to automatically load the shared extensions.", "no"); 135 136ARG_WITH("test-ini-ext-exclude", "Comma separated list of shared extensions to \ 137 be excluded from the test.ini", "no"); 138 139ARG_ENABLE("native-intrinsics", "Comma separated list of intrinsic optimizations to enable. \ 140 Available optimization names are sse, sse2, sse3, ssse3, sse4.1, sse4.2, avx, avx2. \ 141 SSE and SSE2 are enabled by default. The best optimization specified will \ 142 automatically enable all the older optimizations. Note, that the produced binary \ 143 might not work properly, if the optimizations are not available on the target \ 144 processor.", "no"); 145toolset_setup_intrinsic_cflags(); 146