aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/extend/ENV/shared.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb
index 2964fbd16..f4aac1d4e 100644
--- a/Library/Homebrew/extend/ENV/shared.rb
+++ b/Library/Homebrew/extend/ENV/shared.rb
@@ -187,10 +187,18 @@ module SharedEnvExtension
def gcc_version_formula(version)
gcc_formula = Formulary.factory("gcc")
- return gcc_formula if gcc_formula.version.to_s.include?(version)
-
gcc_name = 'gcc' + version.delete('.')
- Formulary.factory(gcc_name)
+ gcc_versions_formula = Formulary.factory(gcc_name)
+
+ if gcc_formula.opt_prefix.exist?
+ gcc_formula
+ elsif gcc_versions_formula.opt_prefix.exist?
+ gcc_versions_formula
+ elsif gcc_formula.version.to_s.include?(version)
+ gcc_formula
+ else
+ gcc_versions_formula
+ end
end
def warn_about_non_apple_gcc(gcc)