Default to LLVM for Xcodes that default to LLVM

This commit is contained in:
Max Howell 2011-08-31 16:59:04 +01:00
parent cf1a6e185c
commit a32e738f7c
2 changed files with 9 additions and 5 deletions

View File

@ -21,10 +21,6 @@ module HomebrewEnvExtension
# llvm allows -O4 however it often fails to link and is very slow # llvm allows -O4 however it often fails to link and is very slow
cflags = ['-O3'] 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 case self.compiler
when :clang then self.clang when :clang then self.clang
when :llvm then self.llvm when :llvm then self.llvm
@ -338,7 +334,7 @@ Please take one of the following actions:
elsif self['HOMEBREW_USE_GCC'] elsif self['HOMEBREW_USE_GCC']
:gcc :gcc
else else
:gcc MacOS.default_compiler
end end
end end

View File

@ -246,6 +246,14 @@ module MacOS extend self
Pathname.new("/usr/bin/cc").realpath.basename.to_s Pathname.new("/usr/bin/cc").realpath.basename.to_s
end 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 def gcc_42_build_version
`/usr/bin/gcc-4.2 -v 2>&1` =~ /build (\d{4,})/ `/usr/bin/gcc-4.2 -v 2>&1` =~ /build (\d{4,})/
if $1 if $1