Initial WIN64 support

This commit is contained in:
Dmitry Stogov 2007-04-10 06:22:28 +00:00
parent c61cbbdc9f
commit 08daab9d1c
2 changed files with 53 additions and 10 deletions

View file

@ -27,6 +27,24 @@ STDOUT.WriteLine("Detected MS compiler version " + VCVERS);
// 13 is vs.net 2003
// 14 is vs.net 2005
// do we use x64 or 80x86 version of compiler?
function probe_msvc_compiler_x64(CL)
{
// tricky escapes to get stderr redirection to work
var banner = execute('cmd /c ""' + CL + '" 2>&1"');
if (banner.match(/x64/)) {
return 1;
}
return 0;
}
X64 = probe_msvc_compiler_x64(CL);
if (X64) {
STDOUT.WriteLine("Detected 64-bit compiler");
} else {
STDOUT.WriteLine("Detected 32-bit compiler");
}
// cygwin now ships with link.exe. Avoid searching the cygwin path
// for this, as we want the MS linker, not the fileutil
PATH_PROG('link', WshShell.Environment("Process").Item("PATH"));
@ -59,6 +77,11 @@ if (PHP_OBJECT_OUT_DIR.length) {
ERROR('you chosen output directory ' + PHP_OBJECT_OUT_DIR + ' does not exist');
}
PHP_OBJECT_OUT_DIR += '\\';
} else if (X64) {
if (!FSO.FolderExists("x64")) {
FSO.CreateFolder("x64");
}
PHP_OBJECT_OUT_DIR = 'x64\\';
}
ARG_ENABLE('debug', 'Compile with debugging symbols', "no");
@ -102,7 +125,12 @@ if (VCVERS >= 14) {
// fun stuff: MS deprecated ANSI stdio and similar functions
// disable annoying warnings. In addition, time_t defaults
// to 64-bit. Ask for 32-bit.
ADD_FLAG('CFLAGS', ' /wd4996 /D_USE_32BIT_TIME_T=1 ');
if (X64) {
ADD_FLAG('CFLAGS', ' /wd4996 ');
// ADD_FLAG('CFLAGS', ' /wd4996 /Wp64 ');
} else {
ADD_FLAG('CFLAGS', ' /wd4996 /D_USE_32BIT_TIME_T=1 ');
}
if (PHP_DEBUG == "yes") {
// Set some debug/release specific options
@ -126,7 +154,8 @@ DEFINE("LIBS", "kernel32.lib ole32.lib user32.lib advapi32.lib shell32.lib ws2_3
// Set some debug/release specific options
if (PHP_DEBUG == "yes") {
ADD_FLAG("CFLAGS", "/LDd /MDd /Gm /ZI /Od /D _DEBUG /D ZEND_DEBUG=1");
ADD_FLAG("CFLAGS", "/LDd /MDd /Gm /Od /D _DEBUG /D ZEND_DEBUG=1 " +
(X64?"/Zi":"/ZI"));
ADD_FLAG("LDFLAGS", "/debug");
// Avoid problems when linking to release libraries that use the release
// version of the libc
@ -177,18 +206,28 @@ ARG_WITH('php-build', 'Path to where you extracted http://www.php.net/extra/win3
if (PHP_PHP_BUILD == 'no') {
if (FSO.FolderExists("..\\php_build")) {
PHP_PHP_BUILD = "..\\php_build";
} else if (FSO.FolderExists("..\\win32build")) {
PHP_PHP_BUILD = "..\\win32build";
} else if (FSO.FolderExists("..\\php-win32-dev\\php_build")) {
PHP_PHP_BUILD = "..\\php-win32-dev\\php_build";
} else {
if (X64) {
if (FSO.FolderExists("..\\win64build")) {
PHP_PHP_BUILD = "..\\win64build";
} else if (FSO.FolderExists("..\\php-win64-dev\\php_build")) {
PHP_PHP_BUILD = "..\\php-win64-dev\\php_build";
}
} else {
if (FSO.FolderExists("..\\win32build")) {
PHP_PHP_BUILD = "..\\win32build";
} else if (FSO.FolderExists("..\\php-win32-dev\\php_build")) {
PHP_PHP_BUILD = "..\\php-win32-dev\\php_build";
}
}
}
}
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_build\\include;..\\win32build\\include;..\\bindlib_w32";
var php_usual_lib_suspects = "..\\php_build\\lib;..\\win32build\\lib;..\\bindlib_w32";
var php_usual_include_suspects = PHP_PHP_BUILD+"\\include;..\\bindlib_w32";
var php_usual_lib_suspects = PHP_PHP_BUILD+"\\lib;..\\bindlib_w32";
// Poke around for some headers
function probe_basic_headers()
@ -312,7 +351,9 @@ ARG_WITH("snapshot-template", "Path to snapshot builder template dir", "no");
if (PHP_SNAPSHOT_TEMPLATE == "no") {
/* default is as a sibling of the php_build dir */
if (FSO.FolderExists(PHP_PHP_BUILD + "\\..\\template")) {
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");
}
}

View file

@ -151,6 +151,8 @@
/* vs.net 2005 has a 64-bit time_t. This will likely break
* 3rdParty libs that were built with older compilers; switch
* back to 32-bit */
#define _USE_32BIT_TIME_T 1
#ifndef _WIN64
# define _USE_32BIT_TIME_T 1
#endif
#define HAVE_STDLIB_H 1