In cross-compiling the latest nmap, which uses a recent autoconf, I noticed that it uses CC both for target stuff and for build-time-only stuff. Looking around via google, I was surprised to see that autoconf doesn't seem to have a standard macro to set BUILD_CC!
A proposal was posted four years ago ( see http://sources.redhat.com/ml/autoconf/1999-07/msg00089.html ) but doesn't seem to have been popular.
glibc uses the very simple
if test $host != $build; then AC_CHECK_PROGS(BUILD_CC, gcc cc) fi
which is pretty good (it's as good as the assumption that you can tell you're cross-compiling by comparing build and host; I've run into situations where that's false, but that assumption is made in a lot of places, so I just grin and mangle my host identifier to make it true).
Octave also grabs BUILD_CFLAGS at the same time, which is a pretty good idea, and it doesn't suffer from the above assumption: http://www.mit.edu/afs/sipb/project/octave/src/octave-2.1.44/configure.in
So what's the preferred solution?
- Dan
p.s. For nmap, we're going to kludge it by touching two files to keep the Makefile from thinking it needs to regenerate any of its source... so this isn't an urgent question.