I want to set up my project so that I can cross compile, and I
thought autoconf would help me do that.

I put the AC_CANONICAL_HOST macro at the top of my configure.in file.

I built a cross compiler for cygwin and put it on my path.

But when I try to run ./configure with a target argument, it does not
use the right compiler.


% ../mini/configure --target=i586-cygwin32

checking host system type... i686-pc-linux-gnu
checking for c++... c++


After much banging of head on wall, I found this
note in the autoconf docs.


If you are cross-compiling, you still have to specify the names of the
cross-tools you use, in particular the C
compiler, on the configure command line, e.g., 

CC=m68k-coff-gcc configure --target=m68k-coff


So I tried that and it seemed to work.

% ../mini/configure --target=i586-cygwin32 CXX=i586-cygwin32-c++

checking host system type... i686-pc-linux-gnu
checking for c++... i586-cygwin32-c++
checking whether the C++ compiler (i586-cygwin32-c++   ) works... yes


My question is, why on earth do I need to give the name of
the compiler I want to use in the CC or CXX variable?

Why not have autoconf just take the --target argument
(i586-cygwin32) and slap a -c++ onto that? Why
will autoconf not check for the cross given in the
--target argument?


Mo Dejong
Red Hat Inc.

Reply via email to