Ticket #44367: arb-PATCH-arb_compiler_version.pl.diff

File arb-PATCH-arb_compiler_version.pl.diff, 827 bytes (added by mattcottrell, 10 years ago)

Patch to resolve brittleness of arb_compiler_version.pl

  • SOURCE_TOOLS/arb_compiler_version.pl

     
    3838    if ($detectedCompiler eq 'unknown') {
    3939      if ($detailedVersion =~ /apple.*llvm.*clang/oi) { $detectedCompiler = 'clang'; }
     40      else {
     41        # check for clang according to #582
     42        my $cmd = "$compiler -dM -E -x c /dev/null";
     43        if (open(CMD,$cmd.'|')) {
     44        LINE: foreach (<CMD>) {
     45            if (/__clang__/) {
     46              $detectedCompiler = 'clang';
     47              last LINE;
     48            }
     49          }
     50          close(CMD);
     51        }
     52        else {
     53          print STDERR "failed to execute '$cmd'";
     54        }
     55      }
    4056    }
    4157