Subject: | [PATCH] Fix ccversion detection for MSVC |
Test-Smoke-1.42 fails to detect the ccversion for my MSVC++
installations, which all reside under "C:\Program Files\...". It tries
to run a command like
"$map{ $CC }->{ccbin}" --version 2>&1
but the 'ccbin' there comes from whereis() and is already double-quoted
if it contains spaces, which causes an error like
'""C:\Program' is not recognized as an internal or external command,
operable program or batch file.
The attached patch fixes this.
Subject: | ccversion.patch |
diff -ruN Test-Smoke-1.42.orig/configsmoke.pl Test-Smoke-1.42/configsmoke.pl
--- Test-Smoke-1.42.orig/configsmoke.pl 2009-08-10 11:03:32.000000000 +0100
+++ Test-Smoke-1.42/configsmoke.pl 2010-02-12 10:41:52.233602100 +0000
@@ -2192,7 +2192,7 @@
my $CC = 'MSVC';
if ( $map{ $CC }->{ccbin} = whereis( $map{ $CC }->{ccname} ) ) {
# No, cl doesn't support --version (One can but try)
- my $output =`"$map{ $CC }->{ccbin}" --version 2>&1`;
+ my $output =`$map{ $CC }->{ccbin} --version 2>&1`;
my $ccvers = $output =~ /^.*Version\s+([\d.]+)/ ? $1 : '?';
$map{ $CC }->{ccversarg} = "ccversion=$ccvers";
my $mainvers = $ccvers =~ /^(\d+)/ ? $1 : 1;
@@ -2202,7 +2202,7 @@
$CC = 'BCC';
if ( $map{ $CC }->{ccbin} = whereis( $map{ $CC }->{ccname} ) ) {
# No, bcc32 doesn't support --version (One can but try)
- my $output = `"$map{ $CC }->{ccbin}" --version 2>&1`;
+ my $output = `$map{ $CC }->{ccbin} --version 2>&1`;
my $ccvers = $output =~ /([\d.]+)/ ? $1 : '?';
$map{ $CC }->{ccversarg} = "ccversion=$ccvers";
$map{ $CC }->{CCTYPE} = 'BORLAND';
@@ -2213,7 +2213,7 @@
local *STDERR;
open STDERR, ">&STDOUT"; #do we need an error?
select( (select( STDERR ), $|++ )[0] );
- my $output = `"$map{ $CC }->{ccbin}" --version`;
+ my $output = `$map{ $CC }->{ccbin} --version`;
my $ccvers = $output =~ /(\d+.*)/ ? $1 : '?';
$ccvers =~ s/\s+copyright.*//i;
$map{ $CC }->{ccversarg} = "gccversion=$ccvers";