[GRASS-dev] portable.h alternatives? [was: include/portable.h?]
Glynn Clements
glynn at gclements.plus.com
Sat Jul 1 14:58:24 EDT 2006
William Kyngesburye wrote:
> Speaking of portable.h, I had to mess with this recently so I could
> get a Universal Mac binary. It involves saving a copy configured on
> both platforms and creating a custom portable.h which is
> conditionalized on __BIG_ENDIAN__ (an OS X compiler def).
>
> Would it be possible to somehow make this so it doesn't need to be
> generated at compile time? or make it cross-compiler friendly? Or
> maybe there is already an option for that? Or some other way of
> handling this architecture endian/size thing. Something to make a
> Universal build on OS X simpler. Other than getting the universal
> build flags in the right place, this is the main sticky point for an
> easy universal build.
The ideal solution would be to re-write portable.c so that it doesn't
depend upon the host's byte order; i.e. [de]serialize in the correct
byte-order to start with, rather than assuming that the host's
byte-order matches that of the file then "byte-swap" if it doesn't.
Alternatively, most of portable.h could be generated by the configure
script, using the AC_CHECK_SIZEOF and AC_C_BIGENDIAN macros. However,
the latter only accounts for the simple cases; it doesn't handle
mixed-endian architectures (primarily some ARM-based platforms; I
don't think that the PDP-11 needs to be supported).
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list