Build from source fails with variables passed to configure
I'm trying to bootstrap ghc compiler with downloaded ghc binary distribution (6.10.4). Passing some variables to ./configure for example:
./configure LDFLAGS="-Wl,--as-needed -Wl,-z,relro -Wl,-z,combreloc" CFLAGS="-O2 -fno-strict-aliasing -fwrapv -march=i686" ...
results in running configure scripts in libraries with incorrect options:
(for base library)
configure --with-compiler=/home/users/atler/rpm/BUILD/ghc-6.10.4/ghc/stage1-inplace/ghc --with-hc-pkg=/home/users/atler/rpm/BUILD/ghc-6.10.4/utils/ghc-pkg/install-inplace/bin/ghc-pkg --prefix=/NONEXISTENT --bindir=/NONEXISTENT --libdir=/NONEXISTENT --libexecdir=/NONEXISTENT --datadir=/NONEXISTENT LDFLAGS=-Wl,--as-needed -Wl,-z,relro -Wl,-z,combreloc --configure-option= CFLAGS=-O2 -fno-strict-aliasing -fwrapv -march=i686 ...
Notice that --configure-option (added in mk/cabal-flags.mk) was not stripped for CFLAGS, actually it's stripped only for the first variable. This further results in passing --configure-option to gcc when testing gcc usability which obviously fails. Another interesting part is though compilation of base fails, compilation process still continues and ends with some mysterious error about not met dependecies.