aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils.rb
diff options
context:
space:
mode:
authorMisty De Meo2011-11-25 19:30:42 -0600
committerAdam Vandenberg2011-11-25 17:50:14 -0800
commitf017f2d2f5225ee4dc0b477b6e5184073ab57455 (patch)
treefcf5396b9e58670f3e527cf8f52b8704fbaa0866 /Library/Homebrew/utils.rb
parent0fd47f2014c3b192170d0d039f87315bd55bb530 (diff)
downloadbrew-f017f2d2f5225ee4dc0b477b6e5184073ab57455.tar.bz2
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 <flangy@gmail.com>
Diffstat (limited to 'Library/Homebrew/utils.rb')
-rw-r--r--Library/Homebrew/utils.rb18
1 files changed, 4 insertions, 14 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 02f286a94..8eca952de 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