From cbd14fde1e7392424decea54f0d8caf16df01260 Mon Sep 17 00:00:00 2001 From: Camillo Lugaresi Date: Sun, 2 Feb 2014 12:57:46 -0600 Subject: [PATCH] Correctly find Homebrew-installed fortran Fixes Homebrew/homebrew#26338. Closes Homebrew/homebrew#26352. Signed-off-by: Jack Nagel --- Library/Homebrew/extend/ENV/shared.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb index f26fdb4abc..fec709ffbc 100644 --- a/Library/Homebrew/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/ENV/shared.rb @@ -161,11 +161,17 @@ module SharedEnvExtension EOS end - elsif (gfortran = which('gfortran', ORIGINAL_PATHS.join(File::PATH_SEPARATOR))) - ohai "Using Homebrew-provided fortran compiler." - puts "This may be changed by setting the FC environment variable." - self['FC'] = self['F77'] = gfortran - flags = FC_FLAG_VARS + else + if (gfortran = which('gfortran', (HOMEBREW_PREFIX/'bin').to_s)) + ohai "Using Homebrew-provided fortran compiler." + elsif (gfortran = which('gfortran', ORIGINAL_PATHS.join(File::PATH_SEPARATOR))) + ohai "Using a fortran compiler found at #{gfortran}." + end + if gfortran + puts "This may be changed by setting the FC environment variable." + self['FC'] = self['F77'] = gfortran + flags = FC_FLAG_VARS + end end flags.each { |key| self[key] = cflags }