On Thursday 09 September 2004 02:40 am, Larry Wall wrote:

> An interesting question would be whether we can bootstrap a Parrot
> cross-compile database using autoconf's *data* without buying into the
> shellism of autoconf.  Or give someone the tool to extract the data
> from the autoconf database themselves, so we don't have to ship it.

What autoconf database?  Autoconf uses probing for cross-compilation as well.  
i.e. it runs the cross-compiler and sees what succeeds and what fails.  Some 
things are tricky, like detecting type sizes and endianness, because you 
cannot run a program to printf the answer.  But there are ways around that 
described in the autoconf macro archive:

    http://www.gnu.org/software/ac-archive/

As an example, the size of a type can be determined by cross-compiling several 
test programs that contain this:

    switch (0)
    {
        case 0: case (sizeof ($type) == $size):;
    }

where "$size" is iterated over 1 2 4 8 16, etc.  All compilations will fail 
with a duplicate case error except the size you are looking for.  
Essentially, you use the cross-compiler's knowledge of the platform to act as 
the "database".  You just need to be clever in how you format the query.

Just an FYI.  It's possible that Parrot's probe system could use a similar 
mechanism for cross-compilation to avoid the need for platform databases.

Cheers,

Rhys Weatherley.
Autoconf victim for 5 years now.

Reply via email to