Add accessor for HOMEBREW_CC

This commit is contained in:
Jack Nagel 2014-05-18 14:34:31 -05:00
parent ff9bbe941b
commit 930cf4c768
2 changed files with 10 additions and 6 deletions

View File

@ -101,8 +101,8 @@ module SharedEnvExtension
:llvm
elsif ARGV.include? '--use-clang'
:clang
elsif self['HOMEBREW_CC']
cc = COMPILER_ALIASES.fetch(self['HOMEBREW_CC'], self['HOMEBREW_CC'])
elsif homebrew_cc
cc = COMPILER_ALIASES.fetch(homebrew_cc, homebrew_cc)
COMPILER_SYMBOL_MAP.fetch(cc) { MacOS.default_compiler }
else
MacOS.default_compiler
@ -245,4 +245,8 @@ module SharedEnvExtension
def cxx= val
self["CXX"] = self["OBJCXX"] = val.to_s
end
def homebrew_cc
self["HOMEBREW_CC"]
end
end

View File

@ -87,7 +87,7 @@ module Superenv
# s - apply fix for sed's Unicode support
# a - apply fix for apr-1-config path
warn_about_non_apple_gcc($1) if self["HOMEBREW_CC"] =~ GNU_GCC_REGEXP
warn_about_non_apple_gcc($1) if homebrew_cc =~ GNU_GCC_REGEXP
end
private
@ -125,7 +125,7 @@ module Superenv
# Homebrew's apple-gcc42 will be outside the PATH in superenv,
# so xcrun may not be able to find it
case self["HOMEBREW_CC"]
case homebrew_cc
when "gcc-4.2"
begin
apple_gcc42 = Formulary.factory('apple-gcc42')
@ -272,14 +272,14 @@ module Superenv
end
def cxx11
case self["HOMEBREW_CC"]
case homebrew_cc
when "clang"
append 'HOMEBREW_CCCFG', "x", ''
append 'HOMEBREW_CCCFG', "g", ''
when /gcc-4\.(8|9)/
append 'HOMEBREW_CCCFG', "x", ''
else
raise "The selected compiler doesn't support C++11: #{self['HOMEBREW_CC']}"
raise "The selected compiler doesn't support C++11: #{homebrew_cc}"
end
end