I know Allegro will tell you what the endianness is, as will SDL, and probably autoconf or something. But for code that doesn't use any special installers or libraries with special installers, what's the best way to detect endianness at compile time?
SDL uses this as a backup detector for big endianness:
#if defined(__hppa__) || \
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
(defined(__MIPS__) && defined(__MISPEB__)) || \
defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
but according to wikipedia, some (rare?) PPC, Sparc, and MIPS systems are little endian instead of big endian.
Some documentation says that windows in little-endian only; if that's correct I could check for _WIN32 and _WIN64.
A google search suggests that on some unix systems there is an endian.h, and on some others there's a sys/endian.h or machine/endian.h. My DJGPP install has a machine/endian.h, but my MINGW install has nothing like it that I see (rpcndr.h includes a line "#define NDR_LOCAL_ENDIAN NDR_LITTLE_ENDIAN", but what is rpcndr.h?).
I think, for my purposes, working on x86 or windows or linux and producing an informative error at compile-time for unrecognized platforms would be good enough. Can anyone tell me how I'm supposed to detect endianness at compile time on linux? Googling mostly produces confusing patches, mailing list archives of arguments (which leave out important details), and articles that deal with the issue at runtime instead.