summaryrefslogtreecommitdiff
path: root/driver_rtcm2.c
diff options
context:
space:
mode:
authorFred Wright <fw@fwright.net>2016-01-21 13:30:04 -0500
committerEric S. Raymond <esr@thyrsus.com>2016-01-21 13:30:04 -0500
commitd47101a2759b3af0ba2b56348d680d379b5e8362 (patch)
tree180b07d5ba347fff3b04398205f6fde829fb1a1c /driver_rtcm2.c
parent9ef2aa9991ee6fa243c9b43b2ad4f3110d770cab (diff)
downloadgpsd-d47101a2759b3af0ba2b56348d680d379b5e8362.tar.gz
OS/X build fix for RTCM2 driver.
OSX 10.5, when building for PPC, defines _BIG_ENDIAN as 1, which satisfies the BSD ifdef, but doesn't have the expected value. The result is an "endianness macros are not defined" error. This bug goes back at least as far as 3.14, but I don't think it was ever reported here. The fix is quite simple - moving the Darwin __BYTE_ORDER setup ahead of the BSD __BYTE_ORDER setup so that the Darwin definitions take precedence. This should have no effect on a platform that doesn't define the __DARWIN_xxx macros. The actual fix is from ryandesign@macports.org, though I added a comment line clarifying the reason that the order matters.
Diffstat (limited to 'driver_rtcm2.c')
-rw-r--r--driver_rtcm2.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/driver_rtcm2.c b/driver_rtcm2.c
index e491e19a..cfe96c87 100644
--- a/driver_rtcm2.c
+++ b/driver_rtcm2.c
@@ -88,20 +88,8 @@ BSD terms apply: see the file COPYING in the distribution root for details.
#endif
/*
- * BSD uses _BYTE_ORDER, and Linux uses __BYTE_ORDER.
- */
-#if !defined( __BYTE_ORDER) && defined(_BYTE_ORDER)
-#define __BYTE_ORDER _BYTE_ORDER
-#endif
-#if !defined( __BIG_ENDIAN) && defined(_BIG_ENDIAN)
-#define __BIG_ENDIAN _BIG_ENDIAN
-#endif
-#if !defined( __LITTLE_ENDIAN) && defined(_LITTLE_ENDIAN)
-#define __LITTLE_ENDIAN _LITTLE_ENDIAN
-#endif
-
-/*
* Darwin (Mac OS X) uses special defines.
+ * This must precede the BSD case, since _BIG_ENDIAN may be incorrectly defined
*/
#if !defined( __BYTE_ORDER) && defined(__DARWIN_BYTE_ORDER)
#define __BYTE_ORDER __DARWIN_BYTE_ORDER
@@ -113,6 +101,19 @@ BSD terms apply: see the file COPYING in the distribution root for details.
#define __LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN
#endif
+/*
+ * BSD uses _BYTE_ORDER, and Linux uses __BYTE_ORDER.
+ */
+#if !defined( __BYTE_ORDER) && defined(_BYTE_ORDER)
+#define __BYTE_ORDER _BYTE_ORDER
+#endif
+#if !defined( __BIG_ENDIAN) && defined(_BIG_ENDIAN)
+#define __BIG_ENDIAN _BIG_ENDIAN
+#endif
+#if !defined( __LITTLE_ENDIAN) && defined(_LITTLE_ENDIAN)
+#define __LITTLE_ENDIAN _LITTLE_ENDIAN
+#endif
+
#if !defined(__BYTE_ORDER) || !defined(__BIG_ENDIAN) || !defined(__LITTLE_ENDIAN)
#error endianness macros are not defined
#endif