Ticket #44367: patch-ARB-arb_compiler_version.pl.diff
File patch-ARB-arb_compiler_version.pl.diff, 11.5 KB (added by ryandesign (Ryan Carsten Schmidt), 10 years ago) |
---|
-
SOURCE_TOOLS/arb_compiler_version.pl
old new 26 26 if (not defined $dumpedVersion) { $dumpedVersion = $undetectable; } 27 27 if (not defined $detailedVersion) { $detailedVersion = $undetectable; } 28 28 29 if ($detailedVersion =~ /\s/) { 30 my $firstWord = $`; 31 if ($firstWord eq 'gcc' or $firstWord eq 'clang') { 32 $detectedCompiler = $firstWord; 29 my $cmd = "$compiler -dM -E -x c /dev/null"; 30 if (open(CMD,$cmd.'|')) { 31 LINE: foreach (<CMD>) { 32 if (/__GNUC__/) { 33 $detectedCompiler = 'gcc'; 34 # clang also defines __GNUC__ so don't "last" here 35 } 36 elsif (/__clang__/) { 37 $detectedCompiler = 'clang'; 38 last LINE; 39 } 33 40 } 34 elsif ($firstWord eq 'g++') { $detectedCompiler = 'gcc'; } 35 elsif ($firstWord eq 'clang++') { $detectedCompiler = 'clang'; } 41 close(CMD); 36 42 } 37 38 if ($detectedCompiler eq 'unknown') { 39 if ($detailedVersion =~ /apple.*llvm.*clang/oi) { $detectedCompiler = 'clang'; } 43 else { 44 print STDERR "failed to execute '$cmd'"; 40 45 } 41 46 42 47 if ($detectedCompiler eq 'unknown') { … … 45 50 print STDERR "detailedVersion='$detailedVersion'\n"; 46 51 } 47 52 48 if ($d umpedVersion =~ /\..*\./) {49 $detectedVersion = $ dumpedVersion;53 if ($detailedVersion =~ /\s([0-9]+(?:\.[0-9]+)+)\s/) { 54 $detectedVersion = $1; 50 55 } 51 else { # if version info does not contain patchlevel -> use detailedVersion 52 if ($detailedVersion =~ /\s([0-9]+\.[0-9]+\.[0-9]+)\s/) { 53 $detectedVersion = $1; 54 } 56 elsif ($dumpedVersion =~ /^([0-9]+(?:\.[0-9]+)+)$/) { 57 $detectedVersion = $dumpedVersion; 55 58 } 56 59 } 57 60