]>
Commit | Line | Data |
---|---|---|
b75a7d8f | 1 | /* |
374ca955 | 2 | ****************************************************************************** |
b75a7d8f | 3 | * |
46f4442e | 4 | * Copyright (C) 1997-2007, International Business Machines |
b75a7d8f A |
5 | * Corporation and others. All Rights Reserved. |
6 | * | |
374ca955 | 7 | ****************************************************************************** |
b75a7d8f A |
8 | * |
9 | * FILE NAME : platform.h | |
10 | * | |
11 | * Date Name Description | |
12 | * 05/13/98 nos Creation (content moved here from ptypes.h). | |
13 | * 03/02/99 stephen Added AS400 support. | |
14 | * 03/30/99 stephen Added Linux support. | |
15 | * 04/13/99 stephen Reworked for autoconf. | |
374ca955 | 16 | ****************************************************************************** |
b75a7d8f A |
17 | */ |
18 | ||
73c04bcf A |
19 | /** |
20 | * \file | |
21 | * \brief Basic types for the platform | |
22 | */ | |
23 | ||
b75a7d8f A |
24 | /* Define the platform we're on. */ |
25 | #ifndef @platform@ | |
26 | #define @platform@ | |
27 | #endif | |
28 | ||
29 | /* Define whether inttypes.h is available */ | |
30 | #ifndef U_HAVE_INTTYPES_H | |
31 | #define U_HAVE_INTTYPES_H @U_HAVE_INTTYPES_H@ | |
32 | #endif | |
33 | ||
34 | /* | |
35 | * Define what support for C++ streams is available. | |
36 | * If U_IOSTREAM_SOURCE is set to 199711, then <iostream> is available | |
37 | * (1997711 is the date the ISO/IEC C++ FDIS was published), and then | |
38 | * one should qualify streams using the std namespace in ICU header | |
39 | * files. | |
40 | * If U_IOSTREAM_SOURCE is set to 198506, then <iostream.h> is | |
41 | * available instead (198506 is the date when Stroustrup published | |
42 | * "An Extensible I/O Facility for C++" at the summer USENIX conference). | |
43 | * If U_IOSTREAM_SOURCE is 0, then C++ streams are not available and | |
44 | * support for them will be silently suppressed in ICU. | |
45 | * | |
46 | */ | |
47 | ||
48 | #ifndef U_IOSTREAM_SOURCE | |
49 | #define U_IOSTREAM_SOURCE @U_IOSTREAM_SOURCE@ | |
50 | #endif | |
51 | ||
52 | /* Determines whether specific types are available */ | |
53 | #ifndef U_HAVE_INT8_T | |
54 | #define U_HAVE_INT8_T @HAVE_INT8_T@ | |
55 | #endif | |
56 | ||
57 | #ifndef U_HAVE_UINT8_T | |
58 | #define U_HAVE_UINT8_T @HAVE_UINT8_T@ | |
59 | #endif | |
60 | ||
61 | #ifndef U_HAVE_INT16_T | |
62 | #define U_HAVE_INT16_T @HAVE_INT16_T@ | |
63 | #endif | |
64 | ||
65 | #ifndef U_HAVE_UINT16_T | |
66 | #define U_HAVE_UINT16_T @HAVE_UINT16_T@ | |
67 | #endif | |
68 | ||
69 | #ifndef U_HAVE_INT32_T | |
70 | #define U_HAVE_INT32_T @HAVE_INT32_T@ | |
71 | #endif | |
72 | ||
73 | #ifndef U_HAVE_UINT32_T | |
74 | #define U_HAVE_UINT32_T @HAVE_UINT32_T@ | |
75 | #endif | |
76 | ||
77 | #ifndef U_HAVE_INT64_T | |
78 | #define U_HAVE_INT64_T @HAVE_INT64_T@ | |
79 | #endif | |
80 | ||
81 | #ifndef U_HAVE_UINT64_T | |
82 | #define U_HAVE_UINT64_T @HAVE_UINT64_T@ | |
83 | #endif | |
84 | ||
b75a7d8f A |
85 | /*===========================================================================*/ |
86 | /* Generic data types */ | |
87 | /*===========================================================================*/ | |
88 | ||
374ca955 A |
89 | #include <sys/types.h> |
90 | ||
b75a7d8f A |
91 | /* If your platform does not have the <inttypes.h> header, you may |
92 | need to edit the typedefs below. */ | |
93 | #if U_HAVE_INTTYPES_H | |
94 | ||
95 | /* autoconf 2.13 sometimes can't properly find the data types in <inttypes.h> */ | |
96 | /* os/390 needs <inttypes.h>, but it doesn't have int8_t, and it sometimes */ | |
97 | /* doesn't have uint8_t depending on the OS version. */ | |
98 | /* So we have this work around. */ | |
99 | #ifdef OS390 | |
100 | /* The features header is needed to get (u)int64_t sometimes. */ | |
101 | #include <features.h> | |
102 | #if ! U_HAVE_INT8_T | |
103 | typedef signed char int8_t; | |
104 | #endif | |
105 | #if !defined(__uint8_t) | |
106 | #define __uint8_t 1 | |
107 | typedef unsigned char uint8_t; | |
108 | #endif | |
109 | #endif /* OS390 */ | |
110 | ||
111 | #include <inttypes.h> | |
112 | ||
113 | #else /* U_HAVE_INTTYPES_H */ | |
114 | ||
b75a7d8f A |
115 | #if ! U_HAVE_INT8_T |
116 | typedef signed char int8_t; | |
117 | #endif | |
118 | ||
119 | #if ! U_HAVE_UINT8_T | |
120 | typedef unsigned char uint8_t; | |
121 | #endif | |
122 | ||
123 | #if ! U_HAVE_INT16_T | |
124 | typedef signed short int16_t; | |
125 | #endif | |
126 | ||
127 | #if ! U_HAVE_UINT16_T | |
128 | typedef unsigned short uint16_t; | |
129 | #endif | |
130 | ||
131 | #if ! U_HAVE_INT32_T | |
374ca955 | 132 | typedef signed int int32_t; |
b75a7d8f A |
133 | #endif |
134 | ||
135 | #if ! U_HAVE_UINT32_T | |
374ca955 | 136 | typedef unsigned int uint32_t; |
b75a7d8f A |
137 | #endif |
138 | ||
139 | #if ! U_HAVE_INT64_T | |
140 | typedef signed long long int64_t; | |
141 | /* else we may not have a 64-bit type */ | |
142 | #endif | |
143 | ||
144 | #if ! U_HAVE_UINT64_T | |
145 | typedef unsigned long long uint64_t; | |
146 | /* else we may not have a 64-bit type */ | |
147 | #endif | |
148 | ||
149 | #endif | |
150 | ||
374ca955 A |
151 | /*===========================================================================*/ |
152 | /* Compiler and environment features */ | |
153 | /*===========================================================================*/ | |
154 | ||
155 | /* Define whether namespace is supported */ | |
156 | #ifndef U_HAVE_NAMESPACE | |
157 | #define U_HAVE_NAMESPACE @U_HAVE_NAMESPACE@ | |
158 | #endif | |
159 | ||
160 | /* Determines the endianness of the platform | |
161 | It's done this way in case multiple architectures are being built at once. | |
162 | For example, Darwin supports fat binaries, which can be both PPC and x86 based. */ | |
163 | #if defined(BYTE_ORDER) && defined(BIG_ENDIAN) | |
164 | #define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN) | |
165 | #else | |
166 | #define U_IS_BIG_ENDIAN @U_IS_BIG_ENDIAN@ | |
167 | #endif | |
168 | ||
169 | /* 1 or 0 to enable or disable threads. If undefined, default is: enable threads. */ | |
170 | #define ICU_USE_THREADS @ICU_USE_THREADS@ | |
171 | ||
46f4442e A |
172 | /* On strong memory model CPUs (e.g. x86 CPUs), we use a safe & quick double check lock. */ |
173 | #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) | |
174 | #define UMTX_STRONG_MEMORY_MODEL 1 | |
175 | #endif | |
176 | ||
374ca955 A |
177 | #ifndef U_DEBUG |
178 | #define U_DEBUG @ENABLE_DEBUG@ | |
179 | #endif | |
180 | ||
181 | #ifndef U_RELEASE | |
182 | #define U_RELEASE @ENABLE_RELEASE@ | |
183 | #endif | |
184 | ||
185 | /* Determine whether to disable renaming or not. This overrides the | |
186 | setting in umachine.h which is for all platforms. */ | |
187 | #ifndef U_DISABLE_RENAMING | |
188 | #define U_DISABLE_RENAMING @U_DISABLE_RENAMING@ | |
189 | #endif | |
190 | ||
191 | /* Determine whether to override new and delete. */ | |
192 | #ifndef U_OVERRIDE_CXX_ALLOCATION | |
193 | #define U_OVERRIDE_CXX_ALLOCATION @U_OVERRIDE_CXX_ALLOCATION@ | |
194 | #endif | |
195 | /* Determine whether to override placement new and delete for STL. */ | |
196 | #ifndef U_HAVE_PLACEMENT_NEW | |
197 | #define U_HAVE_PLACEMENT_NEW @U_HAVE_PLACEMENT_NEW@ | |
198 | #endif | |
199 | ||
200 | /* Determine whether to enable tracing. */ | |
201 | #ifndef U_ENABLE_TRACING | |
202 | #define U_ENABLE_TRACING @U_ENABLE_TRACING@ | |
203 | #endif | |
204 | ||
73c04bcf A |
205 | /* Do we allow ICU users to use the draft APIs by default? */ |
206 | #ifndef U_DEFAULT_SHOW_DRAFT | |
207 | #define U_DEFAULT_SHOW_DRAFT @U_DEFAULT_SHOW_DRAFT@ | |
208 | #endif | |
209 | ||
374ca955 A |
210 | /* Define the library suffix in a C syntax. */ |
211 | #define U_HAVE_LIB_SUFFIX @U_HAVE_LIB_SUFFIX@ | |
212 | #define U_LIB_SUFFIX_C_NAME @ICULIBSUFFIXCNAME@ | |
213 | #define U_LIB_SUFFIX_C_NAME_STRING "@ICULIBSUFFIXCNAME@" | |
214 | ||
b75a7d8f A |
215 | /*===========================================================================*/ |
216 | /* Character data types */ | |
217 | /*===========================================================================*/ | |
218 | ||
73c04bcf | 219 | #if ((defined(OS390) && (!defined(__CHARSET_LIB) || !__CHARSET_LIB))) || defined(OS400) |
b75a7d8f A |
220 | # define U_CHARSET_FAMILY 1 |
221 | #endif | |
222 | ||
223 | /*===========================================================================*/ | |
224 | /* Information about wchar support */ | |
225 | /*===========================================================================*/ | |
226 | ||
227 | #define U_HAVE_WCHAR_H @U_HAVE_WCHAR_H@ | |
228 | #define U_SIZEOF_WCHAR_T @U_SIZEOF_WCHAR_T@ | |
229 | ||
230 | #define U_HAVE_WCSCPY @U_HAVE_WCSCPY@ | |
231 | ||
46f4442e A |
232 | /** |
233 | * \def U_DECLARE_UTF16 | |
234 | * Do not use this macro. Use the UNICODE_STRING or U_STRING_DECL macros | |
235 | * instead. | |
236 | * @internal | |
237 | */ | |
238 | #if @U_CHECK_UTF16_STRING@ || defined(U_CHECK_UTF16_STRING) | |
239 | #if (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \ | |
240 | || (defined(__HP_aCC) && __HP_aCC >= 035000) \ | |
241 | || (defined(__HP_cc) && __HP_cc >= 111106) | |
242 | #define U_DECLARE_UTF16(string) u ## string | |
243 | #elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) | |
244 | /* || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x580) */ | |
245 | /* Sun's C compiler has issues with this notation, and it's unreliable. */ | |
246 | #define U_DECLARE_UTF16(string) U ## string | |
247 | #elif U_SIZEOF_WCHAR_T == 2 \ | |
248 | && (U_CHARSET_FAMILY == 0 || ((defined(OS390) || defined(OS400)) && defined(__UCS2__))) | |
249 | #define U_DECLARE_UTF16(string) L ## string | |
250 | #endif | |
251 | #endif | |
252 | ||
b75a7d8f A |
253 | /*===========================================================================*/ |
254 | /* Information about POSIX support */ | |
255 | /*===========================================================================*/ | |
256 | ||
b75a7d8f A |
257 | #define U_HAVE_NL_LANGINFO_CODESET @U_HAVE_NL_LANGINFO_CODESET@ |
258 | #define U_NL_LANGINFO_CODESET @U_NL_LANGINFO_CODESET@ | |
259 | ||
374ca955 | 260 | #if @U_HAVE_TZSET@ |
b75a7d8f | 261 | #define U_TZSET @U_TZSET@ |
b75a7d8f | 262 | #endif |
374ca955 A |
263 | #if @U_HAVE_TIMEZONE@ |
264 | #define U_TIMEZONE @U_TIMEZONE@ | |
265 | #endif | |
266 | #if @U_HAVE_TZNAME@ | |
b75a7d8f | 267 | #define U_TZNAME @U_TZNAME@ |
374ca955 | 268 | #endif |
b75a7d8f A |
269 | |
270 | #define U_HAVE_MMAP @HAVE_MMAP@ | |
271 | #define U_HAVE_POPEN @U_HAVE_POPEN@ | |
272 | ||
273 | /*===========================================================================*/ | |
274 | /* Symbol import-export control */ | |
275 | /*===========================================================================*/ | |
276 | ||
46f4442e | 277 | #if @U_USE_GCC_VISIBILITY_ATTRIBUTE@ |
73c04bcf | 278 | #define U_EXPORT __attribute__((visibility("default"))) |
46f4442e A |
279 | #elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \ |
280 | || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550) | |
281 | #define U_EXPORT __global | |
282 | /*#elif defined(__HP_aCC) || defined(__HP_cc) | |
283 | #define U_EXPORT __declspec(dllexport)*/ | |
73c04bcf | 284 | #else |
b75a7d8f | 285 | #define U_EXPORT |
73c04bcf A |
286 | #endif |
287 | ||
b75a7d8f A |
288 | /* U_CALLCONV is releated to U_EXPORT2 */ |
289 | #define U_EXPORT2 | |
290 | ||
291 | /* cygwin needs to export/import data */ | |
292 | #ifdef U_CYGWIN | |
293 | #define U_IMPORT __declspec(dllimport) | |
294 | #else | |
295 | #define U_IMPORT | |
296 | #endif | |
297 | ||
298 | /*===========================================================================*/ | |
299 | /* Code alignment and C function inlining */ | |
300 | /*===========================================================================*/ | |
301 | ||
302 | #ifndef U_INLINE | |
73c04bcf A |
303 | # ifdef __cplusplus |
304 | # define U_INLINE inline | |
305 | # else | |
306 | # define U_INLINE @U_INLINE@ | |
307 | # endif | |
b75a7d8f A |
308 | #endif |
309 | ||
310 | #define U_ALIGN_CODE(n) | |
311 | ||
312 | /*===========================================================================*/ | |
313 | /* Programs used by ICU code */ | |
314 | /*===========================================================================*/ | |
315 | ||
316 | #define U_MAKE "@U_MAKE@" |