Using GCCSDK to compile autoconf based packages
alex at alexwaugh.com
Thu Jan 3 14:29:08 PST 2002
In message <8c2e39f34a.peter at moo.chocky.org>
Peter Naulls <peter at chocky.org> wrote:
> In message <Pine.LNX.4.33.0201032053001.9232-100000 at door.acad.cai.cam.ac.uk>
> Theo Markettos <atm26 at cam.ac.uk> wrote:
> > I'm trying to build a quite large package (tetex) with GCCSDK on a Linux
> > i686 box. The trouble is I don't know what options to supply to
> > autoconf to tell it to use GCCSDK. I've tried doing
> > CC=gccsdkpath/bin/gcc ./configure --target=arm-riscos-gcc --blah
> > but it seems to use the native compiler for most things (which is
> > unsurprising given it doesn't understand arm-riscos-gcc). Does anyone
> > have a formula for convincing it to use the cross compiler?
> You want to set --host=blah. It doesn't particulary seem to care what
> that is it seems, but try to use something sensible. Sometimes you
> don't even need to set it at all.
If you rename or symlink the sdk gcc to (say) arm-riscos-aof-gcc and
then add --host=arm-riscos-aof then configure might search for
Alternatively, the way I do it is
setenv PATH /home/riscos/cross/bin:$PATH
then when configure searches for gcc it will always find the sdk one.
You will still need the --host set to something for some scripts though
(I think it depends on which version of autoconf was used to create the
> Most other things are hit and miss, and may or may not require hacking
> the configure script. Some scripts aren't at all suitable for cross
> compilation. I understand there's a proper way to set this up, but I've
> not been able to find any docs on it.
AFAIK, the majority of macros provided with autoconf are suitable for
cross compiling. The ones that cause problems are ones that try to
compile a test program, then run it, such as AC_TRY_RUN. This macro
takes four parameters; the test program to compile, a command to execute
if the test program was successful, a command to execute if the test
program failed, and a command to execute if cross compiling. Usually you
would set the latter command to the pessimistic option, ie if you were
testing for a particular function then you would have to assume that it
wasn't available if cross compiling. However, the final parameter to the
macro is optional, and if the person writing the configure script leaves
it out then the script will fail with a "can't run test program while
cross compiling" error.
If the script author creates any custom macros then they may or may not
bother to check for cross compiling.
Alex Waugh alex at alexwaugh.com
PHP, Roots, WebJames and more from http://www.alexwaugh.com/
More information about the gcc