aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2011-08-31 16:59:04 +0100
committerMax Howell2011-08-31 17:36:41 +0100
commita32e738f7c77a45a42572ca9efc215d1fd1e1519 (patch)
treeb22fb35bf346afff1c992fada364e570e57ddcae /Library
parentcf1a6e185c7ce3c02c676590efb49a43063e9aa1 (diff)
downloadbrew-a32e738f7c77a45a42572ca9efc215d1fd1e1519.tar.bz2
Default to LLVM for Xcodes that default to LLVM
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/extend/ENV.rb6
-rw-r--r--Library/Homebrew/utils.rb8
2 files changed, 9 insertions, 5 deletions
diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb
index 21c841cab..a34a318d2 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 08e6c5264..2a5a3a178 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