mxcl/homebrew — Issue #10632: bug - clang CFLAGS in ENV.fortran
Author: 2bits
Created: 2012-03-02 02:05:08+00:00
State: open

`ENV.fortran` sets a few flags [in the ENV.rb file](https://github.com/mxcl/homebrew/blob/master/Library/Homebrew/extend/ENV.rb#L173)

self['FC'] = `/usr/bin/which gfortran`.chomp
self['F77'] = self['FC']

self['FCFLAGS'] = self['CFLAGS']
self['FFLAGS'] = self['CFLAGS']

and I end up with this config during a build:

CC=/usr/bin/clang
CFLAGS='-Os -w -pipe -march=native -Xclang -target-feature -Xclang -aes -Qunused-arguments'
CXX=/usr/bin/clang++
CXXFLAGS='-Os -w -pipe -march=native -Xclang -target-feature -Xclang -aes -Qunused-arguments'
F77=/usr/local/bin/gfortran
FC=/usr/local/bin/gfortran
FCFLAGS='-Os -w -pipe -march=native -Xclang -target-feature -Xclang -aes -Qunused-arguments'
FFLAGS='-Os -w -pipe -march=native -Xclang -target-feature -Xclang -aes -Qunused-arguments'

That's a bug when ENV.compiler == :clang

configure:4578: checking whether the Fortran compiler works
configure:4600: /usr/local/bin/gfortran -Os -w -pipe -march=native -Xclang -target-feature -Xclang -aes -Qunused-arguments -L/usr/local/Cellar/libffi/3.0.10/lib -L/usr/local/Cellar/texinfo/4.13a/lib -L/usr/local/Cellar/gettext/0.18.1.1/lib conftest.f >&5
f951: error: unrecognized command line option "-aes"
conftest.f:0: error: bad value (native) for -march= switch
conftest.f:0: error: bad value (native) for -mtune= switch
configure:4604: $? = 1
configure:4642: result: no

I'd prefer to let the pros craft a patch. :+1:
gfortran: 4.2.4-5666.3
Homebrew: dda2034ee57f399d