From a32e738f7c77a45a42572ca9efc215d1fd1e1519 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Wed, 31 Aug 2011 16:59:04 +0100 Subject: [PATCH] Default to LLVM for Xcodes that default to LLVM --- Library/Homebrew/extend/ENV.rb | 6 +----- Library/Homebrew/utils.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb index 21c841caba..a34a318d2d 100644 --- a/Library/Homebrew/extend/ENV.rb +++ b/Library/Homebrew/extend/ENV.rb @@ -21,10 +21,6 @@ module HomebrewEnvExtension # llvm allows -O4 however it often fails to link and is very slow cflags = ['-O3'] - # If these aren't set, many formulae fail to build - self['CC'] = '/usr/bin/cc' - self['CXX'] = '/usr/bin/c++' - case self.compiler when :clang then self.clang when :llvm then self.llvm @@ -338,7 +334,7 @@ Please take one of the following actions: elsif self['HOMEBREW_USE_GCC'] :gcc else - :gcc + MacOS.default_compiler end end diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 08e6c52648..2a5a3a178c 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -246,6 +246,14 @@ module MacOS extend self Pathname.new("/usr/bin/cc").realpath.basename.to_s end + def default_compiler + case default_cc + when /^gcc/ then :gcc + when /^llvm/ then :llvm + when "clang" then :clang + end + end + def gcc_42_build_version `/usr/bin/gcc-4.2 -v 2>&1` =~ /build (\d{4,})/ if $1