|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
|
2 * vim: set ts=8 sts=4 et sw=4 tw=99: |
|
3 * This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #ifndef jscpucfg_h |
|
8 #define jscpucfg_h |
|
9 |
|
10 #define JS_HAVE_LONG_LONG |
|
11 |
|
12 #if defined(_WIN64) |
|
13 |
|
14 # if defined(_M_X64) || defined(_M_AMD64) || defined(_AMD64_) |
|
15 # define IS_LITTLE_ENDIAN 1 |
|
16 # undef IS_BIG_ENDIAN |
|
17 # else /* !(defined(_M_X64) || defined(_M_AMD64) || defined(_AMD64_)) */ |
|
18 # error "CPU type is unknown" |
|
19 # endif /* !(defined(_M_X64) || defined(_M_AMD64) || defined(_AMD64_)) */ |
|
20 |
|
21 #elif defined(_WIN32) |
|
22 |
|
23 # ifdef __WATCOMC__ |
|
24 # define HAVE_VA_LIST_AS_ARRAY 1 |
|
25 # endif |
|
26 |
|
27 # define IS_LITTLE_ENDIAN 1 |
|
28 # undef IS_BIG_ENDIAN |
|
29 |
|
30 #elif defined(__APPLE__) || defined(__powerpc__) || defined(__ppc__) |
|
31 # if __LITTLE_ENDIAN__ |
|
32 # define IS_LITTLE_ENDIAN 1 |
|
33 # undef IS_BIG_ENDIAN |
|
34 # elif __BIG_ENDIAN__ |
|
35 # undef IS_LITTLE_ENDIAN |
|
36 # define IS_BIG_ENDIAN 1 |
|
37 # endif |
|
38 |
|
39 #elif defined(JS_HAVE_ENDIAN_H) |
|
40 # include <endian.h> |
|
41 |
|
42 # if defined(__BYTE_ORDER) |
|
43 # if __BYTE_ORDER == __LITTLE_ENDIAN |
|
44 # define IS_LITTLE_ENDIAN 1 |
|
45 # undef IS_BIG_ENDIAN |
|
46 # elif __BYTE_ORDER == __BIG_ENDIAN |
|
47 # undef IS_LITTLE_ENDIAN |
|
48 # define IS_BIG_ENDIAN 1 |
|
49 # endif |
|
50 # else /* !defined(__BYTE_ORDER) */ |
|
51 # error "endian.h does not define __BYTE_ORDER. Cannot determine endianness." |
|
52 # endif |
|
53 |
|
54 /* BSDs */ |
|
55 #elif defined(JS_HAVE_MACHINE_ENDIAN_H) |
|
56 # include <sys/types.h> |
|
57 # include <machine/endian.h> |
|
58 |
|
59 # if defined(_BYTE_ORDER) |
|
60 # if _BYTE_ORDER == _LITTLE_ENDIAN |
|
61 # define IS_LITTLE_ENDIAN 1 |
|
62 # undef IS_BIG_ENDIAN |
|
63 # elif _BYTE_ORDER == _BIG_ENDIAN |
|
64 # undef IS_LITTLE_ENDIAN |
|
65 # define IS_BIG_ENDIAN 1 |
|
66 # endif |
|
67 # else /* !defined(_BYTE_ORDER) */ |
|
68 # error "machine/endian.h does not define _BYTE_ORDER. Cannot determine endianness." |
|
69 # endif |
|
70 |
|
71 #elif defined(JS_HAVE_SYS_ISA_DEFS_H) |
|
72 # include <sys/isa_defs.h> |
|
73 |
|
74 # if defined(_BIG_ENDIAN) |
|
75 # undef IS_LITTLE_ENDIAN |
|
76 # define IS_BIG_ENDIAN 1 |
|
77 # elif defined(_LITTLE_ENDIAN) |
|
78 # define IS_LITTLE_ENDIAN 1 |
|
79 # undef IS_BIG_ENDIAN |
|
80 # else /* !defined(_LITTLE_ENDIAN) */ |
|
81 # error "sys/isa_defs.h does not define _BIG_ENDIAN or _LITTLE_ENDIAN. Cannot determine endianness." |
|
82 # endif |
|
83 # if !defined(JS_STACK_GROWTH_DIRECTION) |
|
84 # if defined(_STACK_GROWS_UPWARD) |
|
85 # define JS_STACK_GROWTH_DIRECTION (1) |
|
86 # elif defined(_STACK_GROWS_DOWNWARD) |
|
87 # define JS_STACK_GROWTH_DIRECTION (-1) |
|
88 # endif |
|
89 # endif |
|
90 |
|
91 #elif defined(__sparc) || defined(__sparc__) || \ |
|
92 defined(_POWER) || defined(__hppa) || \ |
|
93 defined(_MIPSEB) || defined(_BIG_ENDIAN) |
|
94 /* IA64 running HP-UX will have _BIG_ENDIAN defined. |
|
95 * IA64 running Linux will have endian.h and be handled above. |
|
96 */ |
|
97 # undef IS_LITTLE_ENDIAN |
|
98 # define IS_BIG_ENDIAN 1 |
|
99 |
|
100 #else /* !defined(__sparc) && !defined(__sparc__) && ... */ |
|
101 # error "Cannot determine endianness of your platform. Please add support to jscpucfg.h." |
|
102 #endif |
|
103 |
|
104 #ifndef JS_STACK_GROWTH_DIRECTION |
|
105 # ifdef __hppa |
|
106 # define JS_STACK_GROWTH_DIRECTION (1) |
|
107 # else |
|
108 # define JS_STACK_GROWTH_DIRECTION (-1) |
|
109 # endif |
|
110 #endif |
|
111 |
|
112 #endif /* jscpucfg_h */ |