com php-src: don't fail miserably, when an unknown vc version is used: win32/build/confutils.js

From: Date: Fri, 18 Nov 2016 17:19:47 +0000
Subject: com php-src: don't fail miserably, when an unknown vc version is used: win32/build/confutils.js
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-95877@lists.php.net to get a copy of this message
Commit: 5b9d7160c519a6d49a9d703a20c9c6104cd3b0bf Author: Anatol Belski <ab@php.net> Fri, 18 Nov 2016 18:19:47 +0100 Parents: c0b0e1b0c7d72b21ea888582b2a34d4aec50aa8f Branches: PHP-7.0 PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5b9d7160c519a6d49a9d703a20c9c6104cd3b0bf Log: don't fail miserably, when an unknown vc version is used Changed paths: M win32/build/confutils.js Diff: diff --git a/win32/build/confutils.js b/win32/build/confutils.js index 33771f0..d68655b 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -2610,9 +2610,20 @@ function toolset_setup_compiler() ERROR("Unsupported MS C++ Compiler, VC11 (2011) minimum is required"); } - AC_DEFINE('COMPILER', COMPILER_NAME, "Detected compiler version"); - DEFINE("PHP_COMPILER_SHORT", VC_VERSIONS_SHORT[VCVERS]); - AC_DEFINE('PHP_COMPILER_ID', VC_VERSIONS_SHORT[VCVERS], "Compiler compatibility ID"); + if (undefined == COMPILER_NAME) { + var tmp = probe_binary(PHP_CL); + COMPILER_NAME = "MSVC " + tmp + ", untested"; + + WARNING("Using unknown MSVC version " + tmp); + + AC_DEFINE('COMPILER', COMPILER_NAME, "Detected compiler version"); + DEFINE("PHP_COMPILER_SHORT", tmp); + AC_DEFINE('PHP_COMPILER_ID', tmp, "Compiler compatibility ID"); + } else { + AC_DEFINE('COMPILER', COMPILER_NAME, "Detected compiler version"); + DEFINE("PHP_COMPILER_SHORT", VC_VERSIONS_SHORT[VCVERS]); + AC_DEFINE('PHP_COMPILER_ID', VC_VERSIONS_SHORT[VCVERS], "Compiler compatibility ID"); + } } else if (CLANG_TOOLSET) { CLANGVERS = COMPILER_NUMERIC_VERSION; @@ -2732,8 +2743,15 @@ function toolset_get_compiler_name() var version; if (VS_TOOLSET) { + var name = undefined; + version = probe_binary(PHP_CL).substr(0, 5).replace('.', ''); - return VC_VERSIONS[version]; + + if (undefined != VC_VERSIONS[version]) { + name = VC_VERSIONS[version]; + } + + return name; } else if (CLANG_TOOLSET || ICC_TOOLSET) { var command = 'cmd /c ""' + PHP_CL + '" -v"'; var full = execute(command + '" 2>&1"');

« previous php.cvs (#95877) next »