From 1ed22ff1c34a99e48feea77af39b05e6b9d00ce4 Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Mon, 2 Jan 2012 17:20:30 -0600 Subject: [PATCH] ENV.gcc: search HOMEBREW_PREFIX/bin for gcc-4.2 Allow the use of a Homebrewed gcc-4.2 in order to support homebrew-alt's apple-gcc42 formula. This also removes the :force filtering for the gcc-4.2 check error. Closes Homebrew/homebrew#9384. Signed-off-by: Misty De Meo --- Library/Homebrew/extend/ENV.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb index b1ff5d9cfe..60d6e05d04 100644 --- a/Library/Homebrew/extend/ENV.rb +++ b/Library/Homebrew/extend/ENV.rb @@ -83,13 +83,15 @@ module HomebrewEnvExtension alias_method :gcc_4_0, :gcc_4_0_1 def gcc args = {} - self['CC'] = "/usr/bin/gcc-4.2" - self['CXX'] = "/usr/bin/g++-4.2" + gcc_path = Pathname.new "/usr/bin/gcc-4.2" + gxx_path = Pathname.new "/usr/bin/g++-4.2" + self['CC'] = gcc_path.exist? ? gcc_path : HOMEBREW_PREFIX+'bin/gcc-4.2' + self['CXX'] = gxx_path.exist? ? gxx_path : HOMEBREW_PREFIX+'bin/g++-4.2' replace_in_cflags '-O4', '-O3' set_cpu_cflags 'core2 -msse4', :penryn => 'core2 -msse4.1', :core2 => 'core2', :core => 'prescott' @compiler = :gcc - raise "GCC could not be found" if args[:force] and not File.exist? ENV['CC'] \ + raise "GCC could not be found" if not File.exist? ENV['CC'] \ or (Pathname.new(ENV['CC']).realpath.to_s =~ /llvm/) end alias_method :gcc_4_2, :gcc