Rhys Weatherley wrote:

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.


I don't think Parrot's probe system can help us here. Autoconf (as described above) uses the target architecture compiler's knowledge of the target system. We don't have anything equivalent, as we want to bootstrap the cross compiler through Parrot, not the C compiler.

Maybe we can harvest some data from gcc's target database (though I am not sure what licensing issues may be involved) for Parrot â that may be more work than it is worth, however. I dug down in there once. It's kind of scary.

I feel like I am missing something here, but I am not sure whatâ

Gregory Keeney

Reply via email to