Bug 714312 - Use <machine/endian.h> to get endianess on BSD systems, fixing the BSD build. r=ted
authorLandry Breuil <landry@openbsd.org>
Mon, 09 Jan 2012 17:32:00 -0600
changeset 85292 9cfdb612a026c1960ec27e2f99e7438ec9837513
parent 85291 0b102e74b3b8afbd8e0f970304d90696422c0d7f
child 85293 7dde51205d2481b9ea33a409043461172f620849
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs714312
milestone12.0a1
Bug 714312 - Use <machine/endian.h> to get endianess on BSD systems, fixing the BSD build. r=ted
js/src/configure.in
js/src/js-config.h.in
js/src/jscpucfg.h
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -2944,16 +2944,21 @@ fi
 MOZ_ALIGN_OF_TYPE(JS_ALIGN_OF_POINTER, void*, 2 4 8 16)
 MOZ_SIZE_OF_TYPE(JS_BYTES_PER_DOUBLE, double, 6 8 10 12 14)
 
 MOZ_CHECK_HEADERS(endian.h)
 if test "$ac_cv_header_endian_h" = yes; then
     AC_DEFINE(JS_HAVE_ENDIAN_H)
 fi
 
+MOZ_CHECK_HEADERS([machine/endian.h],[],[],[#include <sys/types.h>])
+if test "$ac_cv_header_machine_endian_h" = yes; then
+    AC_DEFINE(JS_HAVE_MACHINE_ENDIAN_H)
+fi
+
 MOZ_CHECK_HEADERS(sys/isa_defs.h)
 if test "$ac_cv_header_sys_isa_defs_h" = yes; then
     AC_DEFINE(JS_HAVE_SYS_ISA_DEFS_H)
 fi
 
 dnl Check for uint and uint_t.
 dnl ========================================================
 AC_MSG_CHECKING(for uint)
--- a/js/src/js-config.h.in
+++ b/js/src/js-config.h.in
@@ -54,16 +54,20 @@
 /* Define to 1 if SpiderMonkey should support the ability to perform
    entirely too much GC.  */
 #undef JS_GC_ZEAL
 
 /* Define to 1 if the <endian.h> header is present and
    useable.  See jscpucfg.h.  */
 #undef JS_HAVE_ENDIAN_H
 
+/* Define to 1 if the <machine/endian.h> header is present and
+   useable.  See jscpucfg.h.  */
+#undef JS_HAVE_MACHINE_ENDIAN_H
+
 /* Define to 1 if the <sys/isa_defs.h> header is present and
    useable.  See jscpucfg.h.  */
 #undef JS_HAVE_SYS_ISA_DEFS_H
 
 /* Define to 1 if the <sys/types.h> defines int8_t, etc. */
 #undef JS_SYS_TYPES_H_DEFINES_EXACT_SIZE_TYPES
 
 /* Define to 1 if the N-byte __intN types are defined by the
--- a/js/src/jscpucfg.h
+++ b/js/src/jscpucfg.h
@@ -87,16 +87,33 @@
 #  elif __BYTE_ORDER == __BIG_ENDIAN
 #   undef  IS_LITTLE_ENDIAN
 #   define IS_BIG_ENDIAN 1
 #  endif
 # else /* !defined(__BYTE_ORDER) */
 #  error "endian.h does not define __BYTE_ORDER. Cannot determine endianness."
 # endif
 
+/* BSDs */
+#elif defined(JS_HAVE_MACHINE_ENDIAN_H)
+# include <sys/types.h>
+# include <machine/endian.h>
+
+# if defined(_BYTE_ORDER)
+#  if _BYTE_ORDER == _LITTLE_ENDIAN
+#   define IS_LITTLE_ENDIAN 1
+#   undef  IS_BIG_ENDIAN
+#  elif _BYTE_ORDER == _BIG_ENDIAN
+#   undef  IS_LITTLE_ENDIAN
+#   define IS_BIG_ENDIAN 1
+#  endif
+# else /* !defined(_BYTE_ORDER) */
+#  error "machine/endian.h does not define _BYTE_ORDER. Cannot determine endianness."
+# endif
+
 #elif defined(JS_HAVE_SYS_ISA_DEFS_H)
 # include <sys/isa_defs.h>
 
 # if defined(_BIG_ENDIAN)
 #  undef IS_LITTLE_ENDIAN
 #  define IS_BIG_ENDIAN 1
 # elif defined(_LITTLE_ENDIAN)
 #  define IS_LITTLE_ENDIAN 1