At 3:32 PM -0700 9/8/04, Gregory Keeney wrote:
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.

Right, but we'll be using the C compiler. The only way to probe for this sort of stuff is to emit little test programs and compile them. (Which can be problematic when cross-compiling, thought the tricks in the archive are pretty nifty)
--
Dan


--------------------------------------it's like this-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to