File: use_byte_order_of_sys_param.patch

package info (click to toggle)
oolite 1.84-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 124,644 kB
  • ctags: 3,975
  • sloc: objc: 132,132; ansic: 3,138; sh: 559; perl: 359; makefile: 276; php: 5
file content (34 lines) | stat: -rw-r--r-- 1,211 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Description: find endianness on every Debian architecture
 src/Core/OOCPUInfo.h maintains a hand-made list of architectures of each
 endianness. It uses environment variables when available, I guess this is
 used when hardware supports both. This build process fails for unknown
 architectures (alpha ia64 s390).
 .
 Some systems provide sys/param.h, and among them some define __BYTE_ORDER.
 Upstream avoids this solution as-is since it fails on some of their systems.

Bug-debian: http://bugs.debian.org/614277
Author: Michael Werle <micha@michaelwerle.com>
Author: Nicolas Boulenguez <nicolas@debian.org>
Forwarded: Michael Werle <micha@michaelwerle.com>

--- a/src/Core/OOCPUInfo.h
+++ b/src/Core/OOCPUInfo.h
@@ -82,6 +82,17 @@
 #define OOLITE_LITTLE_ENDIAN	0
 #endif
 
+#if (! OOLITE_BIG_ENDIAN) && (! OOLITE_LITTLE_ENDIAN)
+#  include <sys/param.h>
+#  if defined(__BYTE_ORDER)
+#    if __BYTE_ORDER == __BIG_ENDIAN
+#      define OOLITE_BIG_ENDIAN 1
+#    endif
+#    if __BYTE_ORDER == __LITTLE_ENDIAN
+#      define OOLITE_LITTLE_ENDIAN 1
+#    endif
+#  endif
+#endif
 
 #if !OOLITE_BIG_ENDIAN && !OOLITE_LITTLE_ENDIAN
 #error Neither OOLITE_BIG_ENDIAN nor OOLITE_LITTLE_ENDIAN is defined as nonzero!