| @@ -1,29 +1,34 @@ | | | @@ -1,29 +1,34 @@ |
1 | $NetBSD: patch-ac,v 1.3 2015/02/23 18:24:00 joerg Exp $ | | 1 | $NetBSD: patch-ac,v 1.4 2015/11/09 05:26:40 dholland Exp $ |
| | | 2 | |
| | | 3 | Fix byte order detection. |
2 | | | 4 | |
3 | --- bytesex.h.orig 2001-03-13 13:46:18.000000000 +0000 | | 5 | --- bytesex.h.orig 2001-03-13 13:46:18.000000000 +0000 |
4 | +++ bytesex.h | | 6 | +++ bytesex.h |
5 | @@ -3,18 +3,15 @@ | | 7 | @@ -3,18 +3,18 @@ |
6 | #ifndef S10SH_BYTESEX_H | | 8 | #ifndef S10SH_BYTESEX_H |
7 | #define S10SH_BYTESEX_H | | 9 | #define S10SH_BYTESEX_H |
8 | | | 10 | |
9 | -#if defined(__i386__) \ | | 11 | -#if defined(__i386__) \ |
10 | - || defined(__alpha__) \ | | 12 | - || defined(__alpha__) \ |
11 | - || (defined(__mips__) && (defined(MIPSEL) || defined (__MIPSEL__))) | | 13 | - || (defined(__mips__) && (defined(MIPSEL) || defined (__MIPSEL__))) |
12 | +#include <sys/endian.h> | | 14 | +#include <sys/endian.h> |
13 | + | | 15 | + |
14 | +#if defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN) && (_BYTE_ORDER == _LITTLE_ENDIAN) | | 16 | +#if defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN) && (_BYTE_ORDER == _LITTLE_ENDIAN) |
| | | 17 | +#define BYTE_ORDER_LITTLE_ENDIAN |
| | | 18 | +#elif defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) && (_BYTE_ORDER == _BIG_ENDIAN) |
| | | 19 | +#define BYTE_ORDER_BIG_ENDIAN |
| | | 20 | +#elif defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && (__BYTE_ORDER == _LITTLE_ENDIAN) |
15 | #define BYTE_ORDER_LITTLE_ENDIAN | | 21 | #define BYTE_ORDER_LITTLE_ENDIAN |
16 | -#elif defined(__mc68000__) \ | | 22 | -#elif defined(__mc68000__) \ |
17 | - || defined (__sparc__) \ | | 23 | - || defined (__sparc__) \ |
18 | - || defined (__sparc) \ | | 24 | - || defined (__sparc) \ |
19 | - || defined (__PPC__) \ | | 25 | - || defined (__PPC__) \ |
20 | - || (defined(__mips__) && (defined(MIPSEB) || defined (__MIPSEB__))) | | 26 | - || (defined(__mips__) && (defined(MIPSEB) || defined (__MIPSEB__))) |
21 | +#elif defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && (__BYTE_ORDER == _LITTLE_ENDIAN) | | | |
22 | +#elif defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && (__BYTE_ORDER == _BIG_ENDIAN) | | 27 | +#elif defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && (__BYTE_ORDER == _BIG_ENDIAN) |
23 | #define BYTE_ORDER_BIG_ENDIAN | | 28 | #define BYTE_ORDER_BIG_ENDIAN |
24 | #else | | 29 | #else |
25 | -# error can not find the byte order for this architecture, fix bytesex.h | | 30 | -# error can not find the byte order for this architecture, fix bytesex.h |
26 | +#error can not find the byte order for this architecture, fix bytesex.h | | 31 | +#error can not find the byte order for this architecture, fix bytesex.h |
27 | #endif | | 32 | #endif |
28 | | | 33 | |
29 | #endif /* S10SH_BYTESEX_H */ | | 34 | #endif /* S10SH_BYTESEX_H */ |