Subject: Correctly determining endianess
To: None <email@example.com>
From: Martijn van Buul <firstname.lastname@example.org>
Date: 04/12/2002 22:07:19
I'm trying to add a package of 'gramofile' (A nifty signal processing tool,
which can remove ticks and scratches from WAV's made from vinyl records),
but I'm starting to "loose ground".
Gramofile doesn't have any configure script; all it has is a Makefile which
should be edited. One of the configuration options in there is the target
endianess. Big-endian platforms need an extra 'define'.
How do I go about correctly determining whether I need that? I could check
'sysctl hw.byteorder', but that would mean that things will break on a
cross-platform compile. I could detect the target platform, and figure out
myself which platforms are big-endian, but I run the risk of missing one out -
and so far, I've only managed to detect the *HOST* platform.
I'd like to do this in a neat way; any suggestions are would be welcome.
Martijn van Buul - Pino@dohd.org - http://www.stack.nl/~martijnb/
Geek code: G-- - Visit OuterSpace: mud.stack.nl 3333
Kees J. Bot: The sum of CPU power and user brain power is a constant.