gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] endianness on mac os x


From: Greg Troxel
Subject: [gpsd-dev] endianness on mac os x
Date: Mon, 11 Nov 2013 20:28:59 -0500
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/23.4 (berkeley-unix)

The endianness code fails on mac os x 10.7, at least as of

commit 7edf502c0fa7eb9615061fc7b916737dd4aaa58a
Author: Greg Troxel <address@hidden>
Date:   Sun Nov 10 09:24:03 2013 -0500

The following is not an adequate fix.  On Darwin, the symbols are

#define __DARWIN_LITTLE_ENDIAN  1234    /* LSB first: i386, vax */
#define __DARWIN_BIG_ENDIAN     4321    /* MSB first: 68000, ibm, net */
#define __DARWIN_PDP_ENDIAN     3412    /* LSB first in word, MSW first #in 
long */


and I haven't finished the patch. But I post the partial patch (which
I'm pretty sure isn't wrong) in case it helps anyone else.


diff --git a/SConstruct b/SConstruct
index 768437c..a54239c 100644
--- a/SConstruct
+++ b/SConstruct
@@ -588,12 +588,19 @@ else:
     if config.CheckHeader("endian.h"):
         confdefs.append("#define HAVE_ENDIAN_H 1\n")
         confdefs.append("/* #undef HAVE_SYS_ENDIAN_H */\n")
+        confdefs.append("/* #undef HAVE_MACHINE_ENDIAN_H */\n")
     elif config.CheckHeader("sys/endian.h"):
         confdefs.append("/* #undef HAVE_ENDIAN_H */\n")
         confdefs.append("#define HAVE_SYS_ENDIAN_H 1\n")
+        confdefs.append("/* #undef HAVE_MACHINE_ENDIAN_H */\n")
+    elif config.CheckHeader("machine/endian.h"):
+        confdefs.append("/* #undef HAVE_ENDIAN_H */\n")
+        confdefs.append("/* #undef HAVE_SYS_ENDIAN_H */\n")
+        confdefs.append("#define HAVE_MACHINE_ENDIAN_H 1\n")
     else:
         confdefs.append("/* #undef HAVE_ENDIAN_H */\n")
         confdefs.append("/* #undef HAVE_SYS_ENDIAN_H */\n")
+        confdefs.append("/* #undef HAVE_MACHINE_ENDIAN_H */\n")
         announce("You do not have the endian.h header file. RTCM V2 support 
disabled.")
         env["rtcm104v2"] = False
 
diff --git a/driver_rtcm2.c b/driver_rtcm2.c
index f86ef64..25c7cb4 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
 
 /*

Attachment: pgpEPYO7HIO2e.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]