Subject: Re: Correctly determining endianess
To: Martijn van Buul <pino@dohd.org>
From: Dr. Lex Wennmacher <wennmach@geo.Uni-Koeln.DE>
List: tech-pkg
Date: 04/12/2002 22:40:58
On Fri, Apr 12, 2002 at 10:07:19PM +0200, Martijn van Buul wrote:
> I'd like to do this in a neat way; any suggestions are would be welcome.

#include <sys/endian.h>

#if _BYTE_ORDER == _BIG_ENDIAN
#define whatever
#endif 

If you need that in a Makefile, replace the #define in the snippet above with
a printf("BIG_ENDIAN\n"), or an exit(1) and check for the exit value.

--Lex