Bug 696957 - Add Sparc, POWER/PPC, IA64 big-endian detection to jscpucfg.h. r=ted.mielczarek.

This commit is contained in:
Andrew Paprocki 2011-10-27 14:02:20 +08:00
parent 435f33242f
commit 74e88cc52c
3 changed files with 40 additions and 1 deletions

View File

@ -2723,6 +2723,11 @@ if test "$ac_cv_header_endian_h" = yes; then
AC_DEFINE(JS_HAVE_ENDIAN_H)
fi
AC_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 int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
dnl ========================================================
AC_MSG_CHECKING(for int16_t)

View File

@ -63,6 +63,10 @@
useable. See jscpucfg.h. */
#undef JS_HAVE_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

View File

@ -92,7 +92,37 @@
#error "endian.h does not define __BYTE_ORDER. Cannot determine endianness."
#endif
#else /* !defined(HAVE_ENDIAN_H) */
#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
#undef IS_BIG_ENDIAN
#else /* !defined(_LITTLE_ENDIAN) */
#error "sys/isa_defs.h does not define _BIG_ENDIAN or _LITTLE_ENDIAN. Cannot determine endianness."
#endif
#if !defined(JS_STACK_GROWTH_DIRECTION)
#if defined(_STACK_GROWS_UPWARD)
#define JS_STACK_GROWTH_DIRECTION (1)
#elif defined(_STACK_GROWS_DOWNWARD)
#define JS_STACK_GROWTH_DIRECTION (-1)
#endif
#endif
#elif defined(__sparc) || defined(__sparc__) || \
defined(_POWER) || defined(__powerpc__) || \
defined(__ppc__) || defined(__hppa) || \
defined(_MIPSEB) || defined(_BIG_ENDIAN)
/* IA64 running HP-UX will have _BIG_ENDIAN defined.
* IA64 running Linux will have endian.h and be handled above.
*/
#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1
#else /* !defined(__sparc) && !defined(__sparc__) && ... */
#error "Cannot determine endianness of your platform. Please add support to jscpucfg.h."
#endif