[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cross compiling -- building programs to run on build system
From: |
Stewart Brodie |
Subject: |
Re: cross compiling -- building programs to run on build system |
Date: |
Tue, 08 Oct 2002 10:11:28 +0100 |
User-agent: |
Messenger-Pro/2.59beta2 (Newsbase/0.61b) (RISC-OS/4.00-Ursula002f) |
In message <address@hidden>
"John W. Eaton" <address@hidden> wrote:
> What is the right way to use autoconf to determine the compiler and
> system characteristics for tools that are written in C and must be run
> as part of a larger build that is cross compiled?
>
> For example, Octave has some programs that are written in C++ that are
> compiled and run during the build process to generate some
> documentation. Thse programs should not be compiled by the cross
> compiler tools, but by the normal build system tools so they will run
> on the build system (they are not needed on the host system). This is
> a simple case because the programs are also simple, and don't rely on
> any OS-specific features.
>
> In a more general case, I suppose you would also need to check
> features for the two systems (host and build) separately, and try to
> keep track of the results separately.
>
> If necessary, I could put these tools in a separate directory with an
> independent configure script, but then what is the correct way to tell
> configure that it should ignore any setting of host and not set up for
> cross compiling?
This is the approach that I have taken:
AC_MSG_NOTICE([configuring the tools for *native* builds])
cd tools && \
./configure --build=$build_alias --host=$build_alias --target=$host_alias
There were no options I needed to pass down to the subdirectory, so this is a
gigantic hack - but it works enough for what I needed to do. The key is to
base --host and --target on the build and host aliases respectively.
You could pass all the configure scripts parameters as long as you put those
in front of the explicit --build --host and --target parameters so that these
ones take precedence.
Another approach I have seen is software relying on a separate environment
variable to indicate the native C compiler to use. Various names are used
for this CC_FOR_BUILD or BUILD_CC.
--
Stewart Brodie, Senior Software Engineer
Pace Micro Technology PLC
Cambridge, CB5 8PB, United Kingdom
http://www.pace.co.uk