diff options
author | Greg Troxel <gdt@ir.bbn.com> | 2013-11-11 21:57:00 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-11-12 03:03:20 -0500 |
commit | 25c4f44f42a2fa9a43042edb1ca0e7f27797735e (patch) | |
tree | 8864183eef266e087fcd6d75973e23a3e8f671b0 /driver_rtcm2.c | |
parent | c585c2d4bdc19147f746cd41b0e634df23bb26f7 (diff) | |
download | gpsd-25c4f44f42a2fa9a43042edb1ca0e7f27797735e.tar.gz |
Detect endianness on OS X.
This commit adds recognizing Darwin-specific endianness defines, and
mapping them to the values used on Linux. Tested on OS X 10.7.
Signed-off-by: Greg Troxel <gdt@ir.bbn.com>
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
Diffstat (limited to 'driver_rtcm2.c')
-rw-r--r-- | driver_rtcm2.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/driver_rtcm2.c b/driver_rtcm2.c index cb0c2663..3a53e8be 100644 --- a/driver_rtcm2.c +++ b/driver_rtcm2.c @@ -83,6 +83,8 @@ BSD terms apply: see the file COPYING in the distribution root for details. #include <endian.h> #elif defined(HAVE_SYS_ENDIAN_H) #include <sys/endian.h> +#elif defined(HAVE_MACHINE_ENDIAN_H) +#include <machine/endian.h> #endif /* @@ -98,6 +100,19 @@ BSD terms apply: see the file COPYING in the distribution root for details. #define __LITTLE_ENDIAN _LITTLE_ENDIAN #endif +/* + * Darwin (Mac OS X) uses special defines. + */ +#if !defined( __BYTE_ORDER) && defined(__DARWIN_BYTE_ORDER) +#define __BYTE_ORDER __DARWIN_BYTE_ORDER +#endif +#if !defined( __BIG_ENDIAN) && defined(__DARWIN_BIG_ENDIAN) +#define __BIG_ENDIAN __DARWIN_BIG_ENDIAN +#endif +#if !defined( __LITTLE_ENDIAN) && defined(__DARWIN_LITTLE_ENDIAN) +#define __LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN +#endif + #if !defined(__BYTE_ORDER) || !defined(__BIG_ENDIAN) || !defined(__LITTLE_ENDIAN) #error endianness macros are not defined #endif |