mirror of
https://github.com/php/php-src.git
synced 2024-11-24 18:34:21 +08:00
MFH, compiler detection
This commit is contained in:
parent
e46cd60d89
commit
812c1e0475
@ -5,7 +5,28 @@
|
||||
|
||||
ARG_WITH('cygwin', 'Path to cygwin utilities on your system', '\\cygwin');
|
||||
PATH_PROG('cl');
|
||||
CL = PATH_PROG('cl');
|
||||
if (!CL) {
|
||||
ERROR("MS C++ compiler is required");
|
||||
}
|
||||
// Which version of the compiler do we have ?
|
||||
function probe_msvc_compiler_version(CL)
|
||||
{
|
||||
// tricky escapes to get stderr redirection to work
|
||||
var banner = execute('cmd /c ""' + CL + '" 2>&1"');
|
||||
if (banner.match(/(\d+)\.(\d+)\.(\d+)(\.(\d+))?/)) {
|
||||
return RegExp.$1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
VCVERS = probe_msvc_compiler_version(CL);
|
||||
STDOUT.WriteLine("Detected MS compiler version " + VCVERS);
|
||||
|
||||
// 12 is VC6
|
||||
// 13 is vs.net 2003
|
||||
// 14 is vs.net 2005
|
||||
|
||||
// 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"));
|
||||
@ -61,9 +82,20 @@ DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP5DLLTS_EXPORTS /D PHP_EXPORTS \
|
||||
DEFINE('CFLAGS_PHP_OBJ', '$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS)');
|
||||
|
||||
// General CFLAGS for building objects
|
||||
DEFINE("CFLAGS", "/nologo /YX /FD $(BASE_INCLUDES) /D _WINDOWS \
|
||||
DEFINE("CFLAGS", "/nologo /FD $(BASE_INCLUDES) /D _WINDOWS \
|
||||
/D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS");
|
||||
|
||||
if (VCVERS < 14) {
|
||||
// Enable automatic precompiled headers
|
||||
ADD_FLAG('CFLAGS', ' /YX ');
|
||||
}
|
||||
|
||||
if (VCVERS >= 14) {
|
||||
// fun stuff: MS deprecated ANSI stdio and similar functions
|
||||
// disable annoying warnings
|
||||
ADD_FLAG('CFLAGS', ' /wd4996 ');
|
||||
}
|
||||
|
||||
// General link flags
|
||||
DEFINE("LDFLAGS", "/nologo /version:" +
|
||||
PHP_VERSION + "." + PHP_MINOR_VERSION + "." + PHP_RELEASE_VERSION);
|
||||
@ -93,7 +125,7 @@ if (PHP_DEBUG == "yes") {
|
||||
}
|
||||
// Equivalent to Release_TSInline build -> best optimization
|
||||
ADD_FLAG("CFLAGS", "/LD /MD /W3 /Ox /D NDebug /D NDEBUG \
|
||||
/D ZEND_WIN32_FORCE_INLINE /GB /GF /D ZEND_DEBUG=0");
|
||||
/D ZEND_WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0");
|
||||
// if you have VS.Net /GS hardens the binary against buffer overruns
|
||||
// ADD_FLAG("CFLAGS", "/GS");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user