Subject: Is there a way to tell default types from include files?
To: None <email@example.com>
From: Bill Studenmund <firstname.lastname@example.org>
Date: 08/08/1998 16:04:05
I'm trying to rig things up for cross-compiling the tree for my PowerMac
from my i386 box. egcs seems to be compiling its little self, and I'm
trying to fix the one snafu I know I'll hit.
In order to build some programs, we compile and run programs on the build
machine. That's what HOST_CC and friends are for. Unfortunatly some
programs need to know about behaviors of the target machine in this
program. Like are char's signed or unsigned on the target.
In bin/sh, the mksyntax.c command, one of these build machine helper
programs, explicitly tests to see if characters are unsigned or not:
/* Determine the characteristics of chars. */
c = -1;
if (c <= 0)
sign = 1;
sign = 0;
The problem is this will determine if the build machine's char's are
signed or not, not if the targets are (Wolfgang Solfrank pointed this one
out to me a while ago).
Does anyone have any suggestions on what to do? Not cross-compiling isn't
a happy answer. :-)
My thought would be to somehow let the cross-cpp make decisions which we
then pass to the host helper. I.E. get some of this target information
into a position where cross-cpp could use it in #ifdef structures. We then
cross-cpp a header file, which the build helper then includes. I.E. for
the above, it'd be:
#define MY_CHARS int8_t
#define MY_CHARS u_int8_t
Or are there better ways to do this type of thing? Especially as we start
moving to 64 bit architectures, we're going to need to do something about
these helper programs.