Browse Source

when on OpenBSD we include the correct headers for endianess and check the apropriate defines

ramrunner 9 years ago
parent
commit
4cc160e196
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/google/protobuf/stubs/port.h

+ 5 - 1
src/google/protobuf/stubs/port.h

@@ -60,8 +60,12 @@
   #endif
 #else
   #include <sys/param.h>   // __BYTE_ORDER
+  #if defined(__OpenBSD__)
+    #include <endian.h>
+  #endif
   #if ((defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)) || \
-         (defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN)) && \
+         (defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN) || \
+         (defined(BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN)) && \
       !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
     #define PROTOBUF_LITTLE_ENDIAN 1
   #endif