--- embedaddon/php/win32/build/confutils.js 2012/02/21 23:48:06 1.1.1.1 +++ embedaddon/php/win32/build/confutils.js 2014/06/15 20:04:03 1.1.1.4 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -// $Id: confutils.js,v 1.1.1.1 2012/02/21 23:48:06 misho Exp $ +// $Id: confutils.js,v 1.1.1.4 2014/06/15 20:04:03 misho Exp $ var STDOUT = WScript.StdOut; var STDERR = WScript.StdErr; @@ -46,6 +46,8 @@ VC_VERSIONS[1310] = 'MSVC7.1 (Visual C++ 2003)'; VC_VERSIONS[1400] = 'MSVC8 (Visual C++ 2005)'; VC_VERSIONS[1500] = 'MSVC9 (Visual C++ 2008)'; VC_VERSIONS[1600] = 'MSVC10 (Visual C++ 2010)'; +VC_VERSIONS[1700] = 'MSVC11 (Visual C++ 2012)'; +VC_VERSIONS[1800] = 'MSVC12 (Visual C++ 2013)'; var VC_VERSIONS_SHORT = new Array(); VC_VERSIONS_SHORT[1200] = 'VC6'; @@ -54,6 +56,8 @@ VC_VERSIONS_SHORT[1310] = 'VC7.1'; VC_VERSIONS_SHORT[1400] = 'VC8'; VC_VERSIONS_SHORT[1500] = 'VC9'; VC_VERSIONS_SHORT[1600] = 'VC10'; +VC_VERSIONS_SHORT[1700] = 'VC11'; +VC_VERSIONS_SHORT[1800] = 'VC12'; if (PROGRAM_FILES == null) { PROGRAM_FILES = "C:\\Program Files"; @@ -65,7 +69,7 @@ if (MODE_PHPIZE) { WScript.Quit(10); } } else { - if (!FSO.FileExists("README.SVN-RULES")) { + if (!FSO.FileExists("README.GIT-RULES")) { STDERR.WriteLine("Must be run from the root of the php source"); WScript.Quit(10); } @@ -74,7 +78,7 @@ if (MODE_PHPIZE) { var CWD = WshShell.CurrentDirectory; if (typeof(CWD) == "undefined") { - CWD = FSO.GetParentFolderName(FSO.GetAbsolutePathName("README.SVN-RULES")); + CWD = FSO.GetParentFolderName(FSO.GetAbsolutePathName("README.GIT-RULES")); } /* defaults; we pick up the precise versions from configure.in */ @@ -414,7 +418,8 @@ can be built that way. \ 'php-build', 'snapshot-template', 'ereg', 'pcre-regex', 'fastcgi', 'force-cgi-redirect', 'path-info-check', 'zts', 'ipv6', 'memory-limit', - 'zend-multibyte', 'fd-setsize', 'memory-manager', 't1lib' + 'zend-multibyte', 'fd-setsize', 'memory-manager', + 't1lib', 'pgi', 'pgo' ); var force; @@ -1010,6 +1015,21 @@ function generate_version_info_resource(makefiletarget return resname; } +/* Check if PGO is enabled for given module. To disable PGO for a particular module, +define a global variable by the following name scheme before SAPI() or EXTENSION() call + var PHP_MYMODULE_PGO = false; */ +function is_pgo_desired(mod) +{ + var varname = "PHP_" + mod.toUpperCase() + "_PGO"; + + /* don't disable if there's no mention of the varname */ + if (eval("typeof " + varname + " == 'undefined'")) { + return true; + } + + return eval("!!" + varname); +} + function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir) { var SAPI = sapiname.toUpperCase(); @@ -1060,7 +1080,21 @@ function SAPI(sapiname, file_list, makefiletarget, cfl ldflags = "$(LDFLAGS)"; manifest = "-@$(_VC_MANIFEST_EMBED_EXE)"; } + + if(is_pgo_desired(sapiname) && (PHP_PGI == "yes" || PHP_PGO != "no")) { + // Add compiler and link flags if PGO options are selected + if (PHP_DEBUG != "yes" && PHP_PGI == "yes") { + ADD_FLAG('CFLAGS_' + SAPI, "/GL /O2"); + ADD_FLAG('LDFLAGS_' + SAPI, "/LTCG:PGINSTRUMENT"); + } + else if (PHP_DEBUG != "yes" && PHP_PGO != "no") { + ADD_FLAG('CFLAGS_' + SAPI, "/GL /O2"); + ADD_FLAG('LDFLAGS_' + SAPI, "/LTCG:PGUPDATE"); + } + ldflags += " /PGD:$(PGOPGD_DIR)\\" + makefiletarget.substring(0, makefiletarget.indexOf(".")) + ".pgd"; + } + if (MODE_PHPIZE) { if (ld) { MFO.WriteLine("\t" + ld + " /nologo /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(" + SAPI + "_GLOBAL_OBJS) $(PHPLIB) $(LDFLAGS_" + SAPI + ") $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname); @@ -1199,6 +1233,7 @@ function EXTENSION(extname, file_list, shared, cflags, var objs = null; var EXT = extname.toUpperCase(); var extname_for_printing; + var ldflags; if (shared == null) { eval("shared = PHP_" + EXT + "_SHARED;"); @@ -1228,7 +1263,6 @@ function EXTENSION(extname, file_list, shared, cflags, MFO.WriteLine("# objects for EXT " + extname); MFO.WriteBlankLines(1); - ADD_SOURCES(configure_module_dirname, file_list, extname, obj_dir); MFO.WriteBlankLines(1); @@ -1242,6 +1276,21 @@ function EXTENSION(extname, file_list, shared, cflags, var resname = generate_version_info_resource(dllname, extname, configure_module_dirname, false); var ld = "@$(CC)"; + ldflags = ""; + if (is_pgo_desired(extname) && (PHP_PGI == "yes" || PHP_PGO != "no")) { + // Add compiler and link flags if PGO options are selected + if (PHP_DEBUG != "yes" && PHP_PGI == "yes") { + ADD_FLAG('LDFLAGS_' + EXT, "/LTCG:PGINSTRUMENT"); + } + else if (PHP_DEBUG != "yes" && PHP_PGO != "no") { + ADD_FLAG('LDFLAGS_' + EXT, "/LTCG:PGUPDATE"); + } + + ADD_FLAG('CFLAGS_' + EXT, "/GL /O2"); + + ldflags = " /PGD:$(PGOPGD_DIR)\\" + dllname.substring(0, dllname.indexOf(".")) + ".pgd"; + } + MFO.WriteLine("$(BUILD_DIR)\\" + libname + ": $(BUILD_DIR)\\" + dllname); MFO.WriteBlankLines(1); if (MODE_PHPIZE) { @@ -1249,7 +1298,7 @@ function EXTENSION(extname, file_list, shared, cflags, MFO.WriteLine("\t" + ld + " $(" + EXT + "_GLOBAL_OBJS) $(PHPLIB) $(LIBS_" + EXT + ") $(LIBS) $(BUILD_DIR)\\" + resname + " /link /out:$(BUILD_DIR)\\" + dllname + " $(DLL_LDFLAGS) $(LDFLAGS) $(LDFLAGS_" + EXT + ")"); } else { MFO.WriteLine("$(BUILD_DIR)\\" + dllname + ": $(DEPS_" + EXT + ") $(" + EXT + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(BUILD_DIR)\\" + resname); - MFO.WriteLine("\t" + ld + " $(" + EXT + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LIBS_" + EXT + ") $(LIBS) $(BUILD_DIR)\\" + resname + " /link /out:$(BUILD_DIR)\\" + dllname + " $(DLL_LDFLAGS) $(LDFLAGS) $(LDFLAGS_" + EXT + ")"); + MFO.WriteLine("\t" + ld + " $(" + EXT + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LIBS_" + EXT + ") $(LIBS) $(BUILD_DIR)\\" + resname + " /link /out:$(BUILD_DIR)\\" + dllname + ldflags + " $(DLL_LDFLAGS) $(LDFLAGS) $(LDFLAGS_" + EXT + ")"); } MFO.WriteLine("\t-@$(_VC_MANIFEST_EMBED_DLL)"); MFO.WriteBlankLines(1);