From f017f2d2f5225ee4dc0b477b6e5184073ab57455 Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Fri, 25 Nov 2011 19:30:42 -0600 Subject: [PATCH] Utils: update gcc version detection logic Homebrew was attempting to check the version of gcc-4.0 and gcc-4.2 even if they don't exist, causing `doctor` and `--config` to throw nasty errors. Also fixes the broken missing gcc-4.2 detection, which was confusing Xcode 4.2 users. Signed-off-by: Adam Vandenberg --- Library/Homebrew/utils.rb | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 02f286a946..8eca952de9 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -261,26 +261,16 @@ module MacOS extend self end def gcc_42_build_version - `/usr/bin/gcc-4.2 --version` =~ /build (\d{4,})/ - if $1 + @gcc_42_build_version ||= if File.exist? "/usr/bin/gcc-4.2" + `/usr/bin/gcc-4.2 --version` =~ /build (\d{4,})/ $1.to_i - elsif system "/usr/bin/which gcc" - # Xcode 3.0 didn't come with gcc-4.2 - # We can't change the above regex to use gcc because the version numbers - # are different and thus, not useful. - # FIXME I bet you 20 quid this causes a side effect — magic values tend to - 401 - else - nil end end def gcc_40_build_version - `/usr/bin/gcc-4.0 --version` =~ /build (\d{4,})/ - if $1 + @gcc_40_build_version ||= if File.exist? "/usr/bin/gcc-4.0" + `/usr/bin/gcc-4.0 --version` =~ /build (\d{4,})/ $1.to_i - else - nil end end