[PATCH 18/18] scripts: compiler.h: support BSDs as well

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

 



The BSDs have their endianness changing functions in <sys/endian.h> and
define both _BYTE_ORDER as well as BYTE_ORDER (if strict POSIX conformance
isn't requested). Extend the header to compile, so it supports these
platforms as well.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 scripts/compiler.h | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/scripts/compiler.h b/scripts/compiler.h
index 01b0de44f18a..0ad25f9e8da9 100644
--- a/scripts/compiler.h
+++ b/scripts/compiler.h
@@ -56,16 +56,22 @@
 # else /* non apple __MACH__ */
 #  include <machine/endian.h>
 # endif /* __APPLE__ */
-# define __BYTE_ORDER    BYTE_ORDER
-# define __LITTLE_ENDIAN LITTLE_ENDIAN
-# define __BIG_ENDIAN    BIG_ENDIAN
 typedef unsigned long ulong;
 typedef unsigned int  uint;
+#elif defined(__OpenBSD__) || defined(__FreeBSD__) || \
+      defined(__NetBSD__) || defined(__DragonFly__)
+# include <sys/endian.h>
 #else /* assume Linux */
 # include <endian.h>
 # include <byteswap.h>
 #endif
 
+#if defined(__BYTE_ORDER) && !defined(BYTE_ORDER)
+# define __BYTE_ORDER    BYTE_ORDER
+# define __BIG_ENDIAN    BIG_ENDIAN
+# define __LITTLE_ENDIAN LITTLE_ENDIAN
+#endif
+
 typedef uint8_t __u8;
 typedef uint16_t __u16;
 typedef uint32_t __u32;
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux