On Sun, 26 Oct 2003, Austin wrote: > I assume that not all of our platforms little endian... > Is there a simple test I can run in bash to determine the endianness at > build-time?
In bash, i don't think it is possible. Well, you could do it like autoconf does it. In configure, it checks for sys/param.h if it defines the byte order, if not, it uses a little c-program: main () { /* Are we little or big endian? From Harbison&Steele. */ union { long l; char c[sizeof (long)]; } u; u.l = 1; exit (u.c[sizeof (long) - 1] == 1); } But why do you need it? A program probably already uses this in configure if it matters? d.