diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2017-11-15 14:07:42 +0000 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2018-03-12 13:07:02 +0000 |
commit | b37fd1311f03d76dec190d5b6aa6ae08cb9d8448 (patch) | |
tree | b55ced1e2003453827a631fab49ab442928ee87d /win32 | |
parent | 7f3a25031960e76803f35775e9c5835432af5c1c (diff) | |
download | perl-b37fd1311f03d76dec190d5b6aa6ae08cb9d8448.tar.gz |
Improve cl version detection
Drop the use of the word "Version" so it works on non-English systems.
Instead, simply look for a number of the form X.Y (or X.Y.Z etc) with word
boundaries around it. Thus, we can find numbers like 12.00.8804 or
19.00.24213.1, but not accidentally pick up things like x86 or 1984-1998.
Also, drop the "--version" argument since it doesn't really exist and
causes warnings/errors to be output. A bare "cl" command suffices to get a
usage message including the version number to be output.
Finally, the Windows version detection can be similarly improved.
This fixes perl #132421.
(cherry picked from commit 43b354f1e14ddf43aa09cd475560e87eb8b1e2e9)
Diffstat (limited to 'win32')
-rw-r--r-- | win32/config_sh.PL | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/win32/config_sh.PL b/win32/config_sh.PL index 8d6f7383fa..2afd65513c 100644 --- a/win32/config_sh.PL +++ b/win32/config_sh.PL @@ -84,18 +84,13 @@ $opt{version_patchlevel_string} = "version $opt{PERL_VERSION} subversion $opt{PE $opt{version_patchlevel_string} .= " patch $opt{PERL_PATCHLEVEL}" if exists $opt{PERL_PATCHLEVEL}; my $ver = `ver 2>nul`; -if ($ver =~ /Version (\d+\.\d+)/) { - $opt{osvers} = $1; -} -else { - $opt{osvers} = '4.0'; -} +$opt{osvers} = $ver =~ /\b(\d+(?:\.\d+)+)\b/ ? $1 : '4.0'; if (exists $opt{cc}) { # cl version detection borrowed from Test::Smoke's configsmoke.pl if ($opt{cc} =~ /\b(?:cl|icl)/) { #MSVC can come as clarm.exe, icl=Intel C - my $output = `$opt{cc} --version 2>&1`; - $opt{ccversion} = $output =~ /^.*Version\s+([\d.]+)/ ? $1 : '?'; + my $output = `$opt{cc} 2>&1`; + $opt{ccversion} = $output =~ /\b(\d+(?:\.\d+)+)\b/ ? $1 : '?'; } elsif ($opt{cc} =~ /\bgcc\b/) { chomp($opt{gccversion} = `$opt{cc} -dumpversion`); @@ -274,7 +269,7 @@ if ($opt{cc} =~ /\bcl/ and $opt{ccversion} =~ /^(\d+)/) { $opt{sGMTIME_max} = 32535291599; $opt{sLOCALTIME_max} = 32535244799; } - if($ccversion < 13) { #VC6 + if ($ccversion < 13) { #VC6 $opt{ar} ='lib'; } if ($ccversion >= 19) { # VC14 @@ -287,9 +282,9 @@ if ($opt{cc} =~ /\bcl/ and $opt{ccversion} =~ /^(\d+)/) { } #find out which MSVC this ICC is using elsif ($opt{cc} =~ /\bicl/) { - my $output = `cl --version 2>&1`; - my $num_ver = $output =~ /^.*Version\s+([\d.]+)/ ? $1 : '?'; - if($num_ver =~ /^(\d+)/ && $1 >= 14) { + my $output = `cl 2>&1`; + my $num_ver = $output =~ /\b(\d+(?:\.\d+)+)\b/ ? $1 : '?'; + if ($num_ver =~ /^(\d+)/ && $1 >= 14) { $opt{sGMTIME_max} = 32535291599; $opt{sLOCALTIME_max} = 32535244799; } |