michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * vim: set ts=8 sts=4 et sw=4 tw=99: michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef jscpucfg_h michael@0: #define jscpucfg_h michael@0: michael@0: #define JS_HAVE_LONG_LONG michael@0: michael@0: #if defined(_WIN64) michael@0: michael@0: # if defined(_M_X64) || defined(_M_AMD64) || defined(_AMD64_) michael@0: # define IS_LITTLE_ENDIAN 1 michael@0: # undef IS_BIG_ENDIAN michael@0: # else /* !(defined(_M_X64) || defined(_M_AMD64) || defined(_AMD64_)) */ michael@0: # error "CPU type is unknown" michael@0: # endif /* !(defined(_M_X64) || defined(_M_AMD64) || defined(_AMD64_)) */ michael@0: michael@0: #elif defined(_WIN32) michael@0: michael@0: # ifdef __WATCOMC__ michael@0: # define HAVE_VA_LIST_AS_ARRAY 1 michael@0: # endif michael@0: michael@0: # define IS_LITTLE_ENDIAN 1 michael@0: # undef IS_BIG_ENDIAN michael@0: michael@0: #elif defined(__APPLE__) || defined(__powerpc__) || defined(__ppc__) michael@0: # if __LITTLE_ENDIAN__ michael@0: # define IS_LITTLE_ENDIAN 1 michael@0: # undef IS_BIG_ENDIAN michael@0: # elif __BIG_ENDIAN__ michael@0: # undef IS_LITTLE_ENDIAN michael@0: # define IS_BIG_ENDIAN 1 michael@0: # endif michael@0: michael@0: #elif defined(JS_HAVE_ENDIAN_H) michael@0: # include michael@0: michael@0: # if defined(__BYTE_ORDER) michael@0: # if __BYTE_ORDER == __LITTLE_ENDIAN michael@0: # define IS_LITTLE_ENDIAN 1 michael@0: # undef IS_BIG_ENDIAN michael@0: # elif __BYTE_ORDER == __BIG_ENDIAN michael@0: # undef IS_LITTLE_ENDIAN michael@0: # define IS_BIG_ENDIAN 1 michael@0: # endif michael@0: # else /* !defined(__BYTE_ORDER) */ michael@0: # error "endian.h does not define __BYTE_ORDER. Cannot determine endianness." michael@0: # endif michael@0: michael@0: /* BSDs */ michael@0: #elif defined(JS_HAVE_MACHINE_ENDIAN_H) michael@0: # include michael@0: # include michael@0: michael@0: # if defined(_BYTE_ORDER) michael@0: # if _BYTE_ORDER == _LITTLE_ENDIAN michael@0: # define IS_LITTLE_ENDIAN 1 michael@0: # undef IS_BIG_ENDIAN michael@0: # elif _BYTE_ORDER == _BIG_ENDIAN michael@0: # undef IS_LITTLE_ENDIAN michael@0: # define IS_BIG_ENDIAN 1 michael@0: # endif michael@0: # else /* !defined(_BYTE_ORDER) */ michael@0: # error "machine/endian.h does not define _BYTE_ORDER. Cannot determine endianness." michael@0: # endif michael@0: michael@0: #elif defined(JS_HAVE_SYS_ISA_DEFS_H) michael@0: # include michael@0: michael@0: # if defined(_BIG_ENDIAN) michael@0: # undef IS_LITTLE_ENDIAN michael@0: # define IS_BIG_ENDIAN 1 michael@0: # elif defined(_LITTLE_ENDIAN) michael@0: # define IS_LITTLE_ENDIAN 1 michael@0: # undef IS_BIG_ENDIAN michael@0: # else /* !defined(_LITTLE_ENDIAN) */ michael@0: # error "sys/isa_defs.h does not define _BIG_ENDIAN or _LITTLE_ENDIAN. Cannot determine endianness." michael@0: # endif michael@0: # if !defined(JS_STACK_GROWTH_DIRECTION) michael@0: # if defined(_STACK_GROWS_UPWARD) michael@0: # define JS_STACK_GROWTH_DIRECTION (1) michael@0: # elif defined(_STACK_GROWS_DOWNWARD) michael@0: # define JS_STACK_GROWTH_DIRECTION (-1) michael@0: # endif michael@0: # endif michael@0: michael@0: #elif defined(__sparc) || defined(__sparc__) || \ michael@0: defined(_POWER) || defined(__hppa) || \ michael@0: defined(_MIPSEB) || defined(_BIG_ENDIAN) michael@0: /* IA64 running HP-UX will have _BIG_ENDIAN defined. michael@0: * IA64 running Linux will have endian.h and be handled above. michael@0: */ michael@0: # undef IS_LITTLE_ENDIAN michael@0: # define IS_BIG_ENDIAN 1 michael@0: michael@0: #else /* !defined(__sparc) && !defined(__sparc__) && ... */ michael@0: # error "Cannot determine endianness of your platform. Please add support to jscpucfg.h." michael@0: #endif michael@0: michael@0: #ifndef JS_STACK_GROWTH_DIRECTION michael@0: # ifdef __hppa michael@0: # define JS_STACK_GROWTH_DIRECTION (1) michael@0: # else michael@0: # define JS_STACK_GROWTH_DIRECTION (-1) michael@0: # endif michael@0: #endif michael@0: michael@0: #endif /* jscpucfg_h */