ENV: only set fortran flags in one place

This commit is contained in:
Jack Nagel 2013-08-30 19:07:10 -05:00
parent 8828187b4c
commit 6b79a4e714

View File

@ -120,15 +120,15 @@ module SharedEnvExtension
end end
def fortran def fortran
flags = []
if fc if fc
ohai "Building with an alternative Fortran compiler" ohai "Building with an alternative Fortran compiler"
puts "This is unsupported." puts "This is unsupported."
self['F77'] ||= fc self['F77'] ||= fc
if ARGV.include? '--default-fortran-flags' if ARGV.include? '--default-fortran-flags'
flags_to_set = FC_FLAG_VARS.reject { |key| self[key] } flags = FC_FLAG_VARS.reject { |key| self[key] }
flags_to_set.each {|key| self[key] = cflags}
set_cpu_flags(flags_to_set)
elsif values_at(*FC_FLAG_VARS).compact.empty? elsif values_at(*FC_FLAG_VARS).compact.empty?
opoo <<-EOS.undent opoo <<-EOS.undent
No Fortran optimization information was provided. You may want to consider No Fortran optimization information was provided. You may want to consider
@ -144,9 +144,10 @@ module SharedEnvExtension
ohai "Using Homebrew-provided fortran compiler." ohai "Using Homebrew-provided fortran compiler."
puts "This may be changed by setting the FC environment variable." puts "This may be changed by setting the FC environment variable."
self['FC'] = self['F77'] = gfortran self['FC'] = self['F77'] = gfortran
flags = FC_FLAG_VARS
FC_FLAG_VARS.each {|key| self[key] = cflags}
set_cpu_flags(FC_FLAG_VARS)
end end
flags.each { |key| self[key] = cflags }
set_cpu_flags(flags)
end end
end end