Parse compiler --version instead of -v

For GCC and LLVM-GCC, '-v' is not a synonym for --version. When run
without any other options or arguments, it gives similar output, but it
is better to just parse the (terser) --version output.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Jack Nagel 2011-11-03 21:10:57 -05:00
parent e04e23492c
commit a99b745935

View File

@ -261,7 +261,7 @@ module MacOS extend self
end
def gcc_42_build_version
`/usr/bin/gcc-4.2 -v 2>&1` =~ /build (\d{4,})/
`/usr/bin/gcc-4.2 --version` =~ /build (\d{4,})/
if $1
$1.to_i
elsif system "/usr/bin/which gcc"
@ -276,7 +276,7 @@ module MacOS extend self
end
def gcc_40_build_version
`/usr/bin/gcc-4.0 -v 2>&1` =~ /build (\d{4,})/
`/usr/bin/gcc-4.0 --version` =~ /build (\d{4,})/
if $1
$1.to_i
else
@ -335,7 +335,7 @@ module MacOS extend self
# for Xcode 3 on OS X 10.5 this will not exist
# NOTE may not be true anymore but we can't test
@llvm_build_version ||= if File.exist? "/usr/bin/llvm-gcc"
`/usr/bin/llvm-gcc -v 2>&1` =~ /LLVM build (\d{4,})/
`/usr/bin/llvm-gcc --version` =~ /LLVM build (\d{4,})/
$1.to_i
end
end