From 2e23e9a22dc43b7fb4a52cd1976169f60513c9c0 Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Tue, 22 Jan 2013 18:28:13 -0600 Subject: superenv: --use-gcc should specify gcc-4.2 Since 'gcc' is a symlink to 'llvm-gcc' on Xcode 4.3+, --use-gcc and --use-llvm were doing exactly the same thing. Combined with the previous commit, this allows users with either a leftover /usr/bin/gcc-4.2 or a homebrewed apple-gcc42 to build with gcc. This doesn't however fix Xcode-only systems with apple-gcc42. Fixes Homebrew/homebrew#17243.--- Library/ENV/4.3/cc | 4 +++- Library/ENV/4.3/g++-4.2 | 1 + Library/ENV/4.3/gcc-4.2 | 1 + Library/Homebrew/superenv.rb | 4 +++- 4 files changed, 8 insertions(+), 2 deletions(-) create mode 120000 Library/ENV/4.3/g++-4.2 create mode 120000 Library/ENV/4.3/gcc-4.2 (limited to 'Library') diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc index 69c1dd764..1f79602ff 100755 --- a/Library/ENV/4.3/cc +++ b/Library/ENV/4.3/cc @@ -60,8 +60,10 @@ class Cmd # the work since Makefiles are dumb and include a lot of excess flags. ENV['HOMEBREW_CC'] when 'c++' - if ENV['HOMEBREW_CC'] =~ /gcc/ + if ENV['HOMEBREW_CC'] =~ /llvm-gcc/ 'g++' + elsif ENV['HOMEBREW_CC'] =~ /gcc-4.2/ + 'g++-4.2' else 'clang++' end diff --git a/Library/ENV/4.3/g++-4.2 b/Library/ENV/4.3/g++-4.2 new file mode 120000 index 000000000..2652f5f42 --- /dev/null +++ b/Library/ENV/4.3/g++-4.2 @@ -0,0 +1 @@ +cc \ No newline at end of file diff --git a/Library/ENV/4.3/gcc-4.2 b/Library/ENV/4.3/gcc-4.2 new file mode 120000 index 000000000..2652f5f42 --- /dev/null +++ b/Library/ENV/4.3/gcc-4.2 @@ -0,0 +1 @@ +cc \ No newline at end of file diff --git a/Library/Homebrew/superenv.rb b/Library/Homebrew/superenv.rb index 0e8c3789e..79e8a396b 100644 --- a/Library/Homebrew/superenv.rb +++ b/Library/Homebrew/superenv.rb @@ -77,7 +77,8 @@ class << ENV def determine_cc if ARGV.include? '--use-gcc' - "gcc" + # fall back to something else on systems without Apple gcc + MacOS.locate('gcc-4.2') ? "gcc-4.2" : raise("gcc-4.2 not found!") elsif ARGV.include? '--use-llvm' "llvm-gcc" elsif ARGV.include? '--use-clang' @@ -219,6 +220,7 @@ class << ENV def compiler case ENV['HOMEBREW_CC'] when "llvm-gcc" then :llvm + when "gcc-4.2" then :gcc when "gcc", "clang" then ENV['HOMEBREW_CC'].to_sym else raise -- cgit v1.2.3