Add Fortran configuration to ENV.rb
This provides a uniform way for formulae to indicate a Fortran compiler is required. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
This commit is contained in:
parent
ddb8d1cd95
commit
8991d9bf15
@ -131,6 +131,54 @@ module HomebrewEnvExtension
|
|||||||
self.O4
|
self.O4
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def fortran
|
||||||
|
if self['FC']
|
||||||
|
ohai "Building with an alternative Fortran compiler. This is unsupported."
|
||||||
|
self['F77'] = self['FC'] unless self['F77']
|
||||||
|
|
||||||
|
if ARGV.include? '--default-fortran-flags'
|
||||||
|
self['FCFLAGS'] = self['CFLAGS'] unless self['FCFLAGS']
|
||||||
|
self['FFFLAGS'] = self['CFLAGS'] unless self['FFFLAGS']
|
||||||
|
elsif not self['FCFLAGS'] or self['FFLAGS']
|
||||||
|
opoo <<-EOS
|
||||||
|
No Fortran optimization information was provided. You may want to consider
|
||||||
|
setting FCFLAGS and FFLAGS or pass the `--default-fortran-flags` option to
|
||||||
|
`brew install` if your compiler is compatible with GCC.
|
||||||
|
|
||||||
|
If you like the default optimization level of your compiler, ignore this
|
||||||
|
warning.
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
|
||||||
|
elsif `/usr/bin/which gfortran`.chomp.size > 0
|
||||||
|
ohai <<-EOS
|
||||||
|
Using Homebrew-provided fortran compiler.
|
||||||
|
This may be changed by setting the FC environment variable.
|
||||||
|
EOS
|
||||||
|
self['FC'] = `/usr/bin/which gfortran`.chomp
|
||||||
|
self['F77'] = self['FC']
|
||||||
|
|
||||||
|
self['FCFLAGS'] = self['CFLAGS']
|
||||||
|
self['FFLAGS'] = self['CFLAGS']
|
||||||
|
|
||||||
|
else
|
||||||
|
onoe <<-EOS
|
||||||
|
This formula requires a fortran compiler, but we could not find one by
|
||||||
|
looking at the FC environment variable or searching your PATH for `gfortran`.
|
||||||
|
Please take one of the following actions:
|
||||||
|
|
||||||
|
- Decide to use the build of gfortran 4.2.x provided by Homebrew using
|
||||||
|
`brew install gfortran`
|
||||||
|
|
||||||
|
- Choose another Fortran compiler by setting the FC environment variable:
|
||||||
|
export FC=/path/to/some/fortran/compiler
|
||||||
|
Using an alternative compiler may produce more efficient code, but we will
|
||||||
|
not be able to provide support for build errors.
|
||||||
|
EOS
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def osx_10_4
|
def osx_10_4
|
||||||
self['MACOSX_DEPLOYMENT_TARGET']="10.4"
|
self['MACOSX_DEPLOYMENT_TARGET']="10.4"
|
||||||
remove_from_cflags(/ ?-mmacosx-version-min=10\.\d/)
|
remove_from_cflags(/ ?-mmacosx-version-min=10\.\d/)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user