sfox Tue Mar 18 17:10:20 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/win32/build config.w32 Log: Generic function for binary probes, kill the other two. And get rid of the annoying double check for CL. http://cvs.php.net/viewvc.cgi/php-src/win32/build/config.w32?r1=1.40.2.8.2.10.2.10&r2=1.40.2.8.2.10.2.11&diff_format=u Index: php-src/win32/build/config.w32 diff -u php-src/win32/build/config.w32:1.40.2.8.2.10.2.10 php-src/win32/build/config.w32:1.40.2.8.2.10.2.11 --- php-src/win32/build/config.w32:1.40.2.8.2.10.2.10 Tue Mar 18 03:12:42 2008 +++ php-src/win32/build/config.w32 Tue Mar 18 17:10:20 2008 @@ -1,44 +1,44 @@ // vim:ft=javascript -// $Id: config.w32,v 1.40.2.8.2.10.2.10 2008/03/18 03:12:42 sfox Exp $ +// $Id: config.w32,v 1.40.2.8.2.10.2.11 2008/03/18 17:10:20 sfox Exp $ // "Master" config file; think of it as a configure.in // equivalent. 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) + +function probe_binary(EXE, what) { // 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; + var command = 'cmd /c ""' + EXE; + if (what == "version") { + command = command + '" -v"'; + } + var version = execute(command + '" 2>&1"'); + + if (what == "64") { + if (version.match(/x64/)) { + return 1; + } + } else { + if (version.match(/(\d+\.\d+\.\d+(\.\d+)?)/)) { + return RegExp.$1; + } } return 0; } -VCVERS = probe_msvc_compiler_version(CL); +// Which version of the compiler do we have? +VCVERS = probe_binary(CL).substr(0, 2); STDOUT.WriteLine("Detected MS compiler version " + VCVERS); - // 12 is VC6 // 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); +X64 = probe_binary(CL, 64); if (X64) { STDOUT.WriteLine("Detected 64-bit compiler"); } else { @@ -48,7 +48,6 @@ // 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")); - PATH_PROG('nmake'); // we don't want to define LIB, as that will override the default library path @@ -61,23 +60,12 @@ // There's a minimum requirement for re2c.. MINRE2C = "0.13.3"; -function probe_re2c_version(RE2C) -{ - var command = "cmd /c " + RE2C + " -v"; - var version = execute(command + '" 2>&1"'); - - if (version.match(/((\d+)\.(\d+)\.(\d+))/)) { - return RegExp.$1; - } - return 0; -} - RE2C = PATH_PROG('re2c'); if (RE2C) { var intvers, intmin; var pattern = /\./g; - RE2CVERS = probe_re2c_version(RE2C); + RE2CVERS = probe_binary(RE2C, "version"); intvers = RE2CVERS.replace(pattern, '') - 0; intmin = MINRE2C.replace(pattern, '') - 0;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php