ENV: Ensure @compiler is set

If @compiler isn't set/checked by ENV.compiler and the ENV.clang/etc.
methods, ENV.compiler may return unexpected results after fails_with
picks a fallback compiler.

See Homebrew/homebrew#22674.
This commit is contained in:
Misty De Meo 2013-09-19 23:35:53 -07:00
parent bda0a3102f
commit 497ccdc41c
2 changed files with 5 additions and 2 deletions

View File

@ -82,7 +82,7 @@ module SharedEnvExtension
def fcflags; self['FCFLAGS']; end
def compiler
if (cc = ARGV.cc)
@compiler ||= if (cc = ARGV.cc)
COMPILER_SYMBOL_MAP.fetch(cc) do |other|
if other =~ GNU_GCC_REGEXP then other
else

View File

@ -263,16 +263,19 @@ module Superenv
alias_method :j1, :deparallelize
def gcc
self['HOMEBREW_CC'] = "gcc-4.2"
@compiler = :gcc
end
def llvm
self['HOMEBREW_CC'] = "llvm-gcc"
@compiler = :llvm
end
def clang
self['HOMEBREW_CC'] = "clang"
@compiler = :clang
end
GNU_GCC_VERSIONS.each do |n|
define_method(:"gcc-4.#{n}") do
self['HOMEBREW_CC'] = "gcc-4.#{n}"
@compiler = self['HOMEBREW_CC'] = "gcc-4.#{n}"
end
end
def make_jobs