[Bug 94570] Use BYTE_ORDER to determine byte order

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Mar 16 15:38:47 UTC 2016


https://bugs.freedesktop.org/show_bug.cgi?id=94570

--- Comment #1 from Eduardo Lima (Etrunko) <eblima at gmail.com> ---
--- spice/macros.h.orig    Thu Mar 10 15:14:49 2016
+++ spice/macros.h    Wed Mar 16 14:18:03 2016
@@ -381,6 +381,17 @@
 #define SPICE_ENDIAN_BIG    1234
 #define SPICE_ENDIAN_PDP    2143

+/* Lets see if we can use a standard header first... */
+#if defined(BYTE_ORDER) && defined(LITTLE_ENDIAN) \
+    && defined(BIG_ENDIAN)
+#  include <machine/endian.h>
+#  if BYTE_ORDER == LITTLE_ENDIAN
+#    define SPICE_ENDIAN SPICE_ENDIAN_LITTLE
+#  elif BYTE_ORDER == BIG_ENDIAN
+#    define SPICE_ENDIAN SPICE_ENDIAN_BIG
+#  endif
+#endif
+

So, instead of relying on those defined macros to include that header, why
don't you check for it in configure.ac with AC_CHECK_HEADERS macro?

You would end with something like:

#if HAVE_MACHINE_ENDIAN_H
   #include <machine/endian.h>
...
#endif

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/spice-bugs/attachments/20160316/ff8bdc41/attachment.html>


More information about the spice-bugs mailing list