This is a pretty good article to read about how to cross-compile: http://linux.bytesex.org/cross-compiler.html .
The bulk of the cross-compilation sets the configure flags for the compiler to determine the target architecture and platform:
./configure --target=sparc-linux --with-gnu-as i486-redhat-linux
It may be deprecated (modified copy and paste from this article), but the same concept still applies.
source share