From: Steve Hay <SteveHay@planit.com>
Date: Mon, 17 Jan 2005 16:57:10 +0000 (+0000)
Subject: Get $Config{ccversion} or $Config{gccversion} filled in on Win32
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2018b34778e5bd6adb24a41e62ec81aa880a20ff;p=p5sagit%2Fp5-mst-13.2.git

Get $Config{ccversion} or $Config{gccversion} filled in on Win32

p4raw-id: //depot/perl@23806
---

diff --git a/win32/config_sh.PL b/win32/config_sh.PL
index e1bc2dd..6381cc9 100644
--- a/win32/config_sh.PL
+++ b/win32/config_sh.PL
@@ -72,6 +72,22 @@ $opt{'version_patchlevel_string'} .= " patchlevel $opt{PERL_PATCHLEVEL}" if exis
 
 $opt{'osvers'} = join '.', (Win32::GetOSVersion())[1,2];
 
+if (exists $opt{cc}) {
+    # cl and bcc32 version detection borrowed from Test::Smoke's configsmoke.pl
+    if ($opt{cc} eq 'cl') {
+        my $output = `cl --version 2>&1`;
+        $opt{ccversion} = $output =~ /^.*Version\s+([\d.]+)/ ? $1 : '?';
+    }
+    elsif ($opt{cc} eq 'bcc32') {
+        my $output = `bcc32 --version 2>&1`;
+        $opt{ccversion} = $output =~ /(\d+.*)/ ? $1 : '?';
+        $opt{ccversion} =~ s/\s+copyright.*//i;
+    }
+    elsif ($opt{cc} eq 'gcc') {
+        chomp($opt{gccversion} = `gcc -dumpversion`);
+    }
+}
+
 $opt{'cf_by'} = $ENV{USERNAME} unless $opt{'cf_by'};
 $opt{'cf_email'} = $opt{'cf_by'} . '@' . (gethostbyname('localhost'))[0]
 	unless $opt{'cf_email'};