autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cross compiling newbie questions


From: Eric Blake
Subject: Re: cross compiling newbie questions
Date: Sat, 06 Sep 2008 13:43:42 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080708 Thunderbird/2.0.0.16 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Steffen DETTMER on 9/2/2008 3:16 AM:
> Hi,
> 
> we use autoconf (and automake) with self-written configure.in/ac
> scripts since a long time but probably wrong in several aspects.
> 
> I hope this is the right place to ask, otherwise please tell!

Yes, this is the right place.

> 
> If I understood correctly, passing --host in general enables
> cross compiling.

Yes (and you should also specify --build).

> My question in short:
> 
>   How to correctly set mandatory default options like -isystem
>   and -nostdlib -lmylibc?

The same as for non-cross-compilation:

./configure CC='my-cross-cc -nostdlib' CFLAGS='-isystem path/to/dir' \
  LIBS='-lmylibc'

In other words, ./configure should NOT encode these defaults (because they
are not necessarily mandatory defaults for all users), rather, the user
should be responsible for specifying them.

> 
> We `defined' a name for this, lets say `arm-ingenico-elf_device'
> (the value of `device' depends) and use this in configure.in case
> statements to select options. Is this wrong and how would it be
> correct?

In general, writing platform-name-specific tests in configure.ac (the name
configure.in is obsolete) is not the autoconf way.  Rather, you should
test for features that a platform either provides or lacks, independently
of the platform's name.  Unfortunately, for cross-compilation, this
doesn't always work (since you can't run test binaries, and not all
features can be tested solely at link time), but even then, you are better
off using only names provided in config.guess (patches to add host
triplets to config.guess should be sent to the list mentioned in that file).

> How to check compilers/environments with mandatory parameters?

I still think that the easiest way is writing your cross-compiler in such
a way that you don't need those parameters to be mandatory.  In other
words, write a wrapper script that does all the work:

#!/bin/sh
exec real-cross-cc -isystem path/to/dir "$@"

and install it on PATH ahead of the cross-compiler.

> 
> Another way could be to have arm-ingenico-elf_device-gcc etc
> being a wrapper passing -isystem etc, but I think this is ugly.

How is that ugly?  It actually sounds the cleanest to me, because you can
then use the wrapper as your cross-compiler without having to worry about
all the details of how to make it work.
>  
> This message may contain confidential and/or privileged information.

It is considered poor netiquette to post email to a publicly archived
mailing list which contains an unenforceable disclaimer.  Some people
refuse to reply to such mail on principle.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjC3W4ACgkQ84KuGfSFAYD13ACfavqbjdLAk5DtsvKF97HETmIV
GQcAn382v3WlEBDojyVM2M5TlM6uE1l1
=iXYF
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]