| 1 | This patch is borrowed from Debian's patches for plink
|
| 2 |
|
| 3 | Author: Peter Green <[email protected]>
|
| 4 | Puropose: Fallback to endian.h if all else fails on 64bit machines
|
| 5 | Closes: #528659
|
| 6 | Forwarded: Shaun Purcell <[email protected]>
|
| 7 | License: same as plink itself.
|
| 8 | ===================================================================
|
| 9 | |
| 10 | |
| 11 | @@ -313,7 +313,18 @@
|
| 12 | #define __BIG_ENDIAN__ 1
|
| 13 | #define SWAPEND 1
|
| 14 | #elif ! defined Win32 /* Windows is little-endian is most cases, anywhere else we're stuck */
|
| 15 | -#error "Cannot determine endianness. Make sure config.h is included or __{BIG|LITTLE}_ENDIAN__ is defined ."
|
| 16 | + //try endian.h before we finally bail out
|
| 17 | + #include <endian.h>
|
| 18 | + #if __BYTE_ORDER == __LITTLE_ENDIAN
|
| 19 | + #warning using little endian based on information from endian.h
|
| 20 | + #define __LITTLE_ENDIAN__ 1
|
| 21 | + #elif __BYTE_ORDER == __BIG_ENDIAN
|
| 22 | + #warning using big endian based on information from endian.h
|
| 23 | + #define __BIG_ENDIAN__ 1
|
| 24 | + #define SWAPEND 1
|
| 25 | + #else
|
| 26 | + #error "Cannot determine endianness. Make sure config.h is included or __{BIG|LITTLE}_ENDIAN__ is defined ."
|
| 27 | + #endif
|
| 28 | #endif
|
| 29 |
|
| 30 | /* FIXME: all the mess below needs more efficient implementation - the current one is so messy to work around alignment problems on some platforms like Sun and HP 9000 */
|