Search code examples
cross-compilingautotoolsconfigure

What is the sense of the word "host" in 'HOSTCC' and ./configure --host?


Suppose I have the source for some program, the source uses GNU autotools, and to keep it simple, let's say the program is in no way a development tool of any kind. If I have a cross-toolchain handy, I can configure to cross-compile for the platform fooproc-barvendor-bazos using the --host option:

./configure --host=fooproc-barvendor-bazos

However, in the quiet(er) style of output adopted by various source builds including Linux 2.6,

HOSTCC foo.c

means that foo.c is being built with a native compiler for system I'm building on, to differentiate from

CC bar.c

which means that bar.c is being build with the cross compiler for the system I'm building the program for.

Did I get confused somewhere there, or does the 'host' in HOSTCC just not mean host in the sense of ./configure --host?


Solution

  • autoconf/automake do not really have a notion of host compiler. $CC is always the target compiler. If you ever see $HOSTCC, it is a manual addition by the developer of the package you are looking at.

    --host specifies on what host type the produced program is intended to be run on.