• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 ******************************************************************************
3 *
4 *   Copyright (C) 1997-2011, International Business Machines
5 *   Corporation and others.  All Rights Reserved.
6 *
7 ******************************************************************************
8 *
9 * Note: autoconf creates platform.h from platform.h.in at configure time.
10 *
11 ******************************************************************************
12 *
13 *  FILE NAME : platform.h
14 *
15 *   Date        Name        Description
16 *   05/13/98    nos         Creation (content moved here from ptypes.h).
17 *   03/02/99    stephen     Added AS400 support.
18 *   03/30/99    stephen     Added Linux support.
19 *   04/13/99    stephen     Reworked for autoconf.
20 ******************************************************************************
21 */
22 
23 #ifndef _PLATFORM_H
24 #define _PLATFORM_H
25 
26 /**
27  * \file
28  * \brief Basic types for the platform
29  */
30 
31 /* This file should be included before uvernum.h. */
32 #if defined(UVERNUM_H)
33 # error Do not include unicode/uvernum.h before #including unicode/platform.h.  Instead of unicode/uvernum.h, #include unicode/uversion.h
34 #endif
35 
36 /**
37  * Determine wheter to enable auto cleanup of libraries.
38  * @internal
39  */
40 #ifndef UCLN_NO_AUTO_CLEANUP
41 #define UCLN_NO_AUTO_CLEANUP 1
42 #endif
43 
44 #if 0
45 #define CYGWINMSVC
46 #endif
47 
48 /* Need platform.h when using CYGWINMSVC to get definitions above. Ignore everything else. */
49 #ifndef CYGWINMSVC
50 
51 /** Define the platform we're on. */
52 #ifndef U_LINUX
53 #define U_LINUX
54 #endif
55 
56 /**
57  * \def U_HAVE_DIRENT_H
58  * Define whether dirent.h is available
59  * @internal
60  */
61 #ifndef U_HAVE_DIRENT_H
62 #define U_HAVE_DIRENT_H 1
63 #endif
64 
65 /** Define whether inttypes.h is available */
66 #ifndef U_HAVE_INTTYPES_H
67 #define U_HAVE_INTTYPES_H 1
68 #endif
69 
70 /**
71  * Define what support for C++ streams is available.
72  *     If U_IOSTREAM_SOURCE is set to 199711, then <iostream> is available
73  * (1997711 is the date the ISO/IEC C++ FDIS was published), and then
74  * one should qualify streams using the std namespace in ICU header
75  * files.
76  *     If U_IOSTREAM_SOURCE is set to 198506, then <iostream.h> is
77  * available instead (198506 is the date when Stroustrup published
78  * "An Extensible I/O Facility for C++" at the summer USENIX conference).
79  *     If U_IOSTREAM_SOURCE is 0, then C++ streams are not available and
80  * support for them will be silently suppressed in ICU.
81  *
82  */
83 
84 #ifndef U_IOSTREAM_SOURCE
85 #define U_IOSTREAM_SOURCE 199711
86 #endif
87 
88 /**
89  * \def U_HAVE_STD_STRING
90  * Define whether the standard C++ (STL) <string> header is available.
91  * For platforms that do not use platform.h and do not define this constant
92  * in their platform-specific headers, std_string.h defaults
93  * U_HAVE_STD_STRING to 1.
94  * @internal
95  */
96 #ifdef HAVE_ANDROID_OS
97 #define U_HAVE_STD_STRING 0
98 #else
99 #ifndef U_HAVE_STD_STRING
100 #define U_HAVE_STD_STRING 1
101 #endif
102 #endif
103 
104 /** @{ Determines whether specific types are available */
105 #ifndef U_HAVE_INT8_T
106 #define U_HAVE_INT8_T 1
107 #endif
108 
109 #ifndef U_HAVE_UINT8_T
110 #define U_HAVE_UINT8_T 1
111 #endif
112 
113 #ifndef U_HAVE_INT16_T
114 #define U_HAVE_INT16_T 1
115 #endif
116 
117 #ifndef U_HAVE_UINT16_T
118 #define U_HAVE_UINT16_T 1
119 #endif
120 
121 #ifndef U_HAVE_INT32_T
122 #define U_HAVE_INT32_T 1
123 #endif
124 
125 #ifndef U_HAVE_UINT32_T
126 #define U_HAVE_UINT32_T 1
127 #endif
128 
129 #ifndef U_HAVE_INT64_T
130 #define U_HAVE_INT64_T 1
131 #endif
132 
133 #ifndef U_HAVE_UINT64_T
134 #define U_HAVE_UINT64_T 1
135 #endif
136 
137 /** @} */
138 
139 /*===========================================================================*/
140 /** @{ Compiler and environment features                                     */
141 /*===========================================================================*/
142 
143 /* Define whether namespace is supported */
144 #ifndef U_HAVE_NAMESPACE
145 #define U_HAVE_NAMESPACE 1
146 #endif
147 
148 /* Determines the endianness of the platform
149    It's done this way in case multiple architectures are being built at once.
150    For example, Darwin supports fat binaries, which can be both PPC and x86 based. */
151 #if defined(BYTE_ORDER) && defined(BIG_ENDIAN)
152 #define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN)
153 #else
154 #define U_IS_BIG_ENDIAN 0
155 #endif
156 
157 /* 1 or 0 to enable or disable threads.  If undefined, default is: enable threads. */
158 #ifndef ICU_USE_THREADS
159 #define ICU_USE_THREADS 1
160 #endif
161 
162 #ifndef U_DEBUG
163 #define U_DEBUG 1
164 #endif
165 
166 #ifndef U_RELEASE
167 #define U_RELEASE 0
168 #endif
169 
170 /* Determine whether to disable renaming or not. This overrides the
171    setting in umachine.h which is for all platforms. */
172 #ifndef U_DISABLE_RENAMING
173 #define U_DISABLE_RENAMING 0
174 #endif
175 
176 /* Determine whether to override new and delete. */
177 #ifndef U_OVERRIDE_CXX_ALLOCATION
178 #define U_OVERRIDE_CXX_ALLOCATION 1
179 #endif
180 /* Determine whether to override placement new and delete for STL. */
181 #ifndef U_HAVE_PLACEMENT_NEW
182 #define U_HAVE_PLACEMENT_NEW 1
183 #endif
184 
185 /* Determine whether to enable tracing. */
186 #ifndef U_ENABLE_TRACING
187 #define U_ENABLE_TRACING 0
188 #endif
189 
190 /**
191  * Whether to enable Dynamic loading in ICU
192  * @internal
193  */
194 #ifndef U_ENABLE_DYLOAD
195 #define U_ENABLE_DYLOAD 1
196 #endif
197 
198 /**
199  * Whether to test Dynamic loading as an OS capabilty
200  * @internal
201  */
202 #ifndef U_CHECK_DYLOAD
203 #define U_CHECK_DYLOAD 1
204 #endif
205 
206 
207 /** Do we allow ICU users to use the draft APIs by default? */
208 #ifndef U_DEFAULT_SHOW_DRAFT
209 #define U_DEFAULT_SHOW_DRAFT 1
210 #endif
211 
212 /** @} */
213 
214 /*===========================================================================*/
215 /** @{ Character data types                                                      */
216 /*===========================================================================*/
217 
218 #if ((defined(OS390) && (!defined(__CHARSET_LIB) || !__CHARSET_LIB))) || defined(OS400)
219 #   define U_CHARSET_FAMILY 1
220 #endif
221 
222 /** @} */
223 
224 /*===========================================================================*/
225 /** @{ Information about wchar support                                           */
226 /*===========================================================================*/
227 /* BEGIN android-note
228 // We changed "ARM_FLAG" to "HAVE_ANDROID_OS" immediately below.
229 // Consensus seems to be that the intent of ARM_FLAG is actually that
230 // it represent whether we are compiling for Android, and if that's
231 // the case then we might as well use the standard definition instead.
232 // END android-note
233 */
234 #ifdef HAVE_ANDROID_OS
235 #define U_HAVE_WCHAR_H      0
236 #define U_SIZEOF_WCHAR_T    1
237 
238 #define U_HAVE_WCSCPY       0
239 
240 #else
241 
242 #ifndef U_HAVE_WCHAR_H
243 #define U_HAVE_WCHAR_H      1
244 #endif
245 
246 #ifndef U_SIZEOF_WCHAR_T
247 #define U_SIZEOF_WCHAR_T    4
248 #endif
249 
250 #ifndef U_HAVE_WCSCPY
251 #define U_HAVE_WCSCPY       1
252 #endif
253 
254 #endif
255 
256 /** @} */
257 
258 /**
259  * @{
260  * \def U_DECLARE_UTF16
261  * Do not use this macro. Use the UNICODE_STRING or U_STRING_DECL macros
262  * instead.
263  * @internal
264  *
265  * \def U_GNUC_UTF16_STRING
266  * @internal
267  */
268 #ifndef U_GNUC_UTF16_STRING
269 #define U_GNUC_UTF16_STRING 0
270 #endif
271 #if 1 || defined(U_CHECK_UTF16_STRING)
272 #if (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \
273     || (defined(__HP_aCC) && __HP_aCC >= 035000) \
274     || (defined(__HP_cc) && __HP_cc >= 111106) \
275     || U_GNUC_UTF16_STRING
276 #define U_DECLARE_UTF16(string) u ## string
277 #elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550)
278 /* || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x580) */
279 /* Sun's C compiler has issues with this notation, and it's unreliable. */
280 #define U_DECLARE_UTF16(string) U ## string
281 #elif U_SIZEOF_WCHAR_T == 2 \
282     && (U_CHARSET_FAMILY == 0 || ((defined(OS390) || defined(OS400)) && defined(__UCS2__)))
283 #define U_DECLARE_UTF16(string) L ## string
284 #endif
285 #endif
286 
287 /** @} */
288 
289 /*===========================================================================*/
290 /** @{ Information about POSIX support                                           */
291 /*===========================================================================*/
292 /*
293 // BEGIN android-note
294 // See Android comment above.
295 // END android-note
296 */
297 #if !HAVE_ANDROID_OS
298 #define U_HAVE_NL_LANGINFO          1
299 
300 #ifndef U_HAVE_NL_LANGINFO_CODESET
301 #define U_HAVE_NL_LANGINFO_CODESET  1
302 #endif
303 
304 #endif
305 
306 #ifndef U_NL_LANGINFO_CODESET
307 #define U_NL_LANGINFO_CODESET       CODESET
308 #endif
309 
310 #if !HAVE_ANDROID_OS
311 #if 1
312 #define U_TZSET         tzset
313 #endif
314 #if 1
315 #define U_TIMEZONE      __timezone
316 #endif
317 #if 1
318 #define U_TZNAME        tzname
319 #endif
320 #endif
321 
322 #define U_HAVE_MMAP     1
323 #define U_HAVE_POPEN    1
324 
325 /** @} */
326 
327 /*===========================================================================*/
328 /** @{ Symbol import-export control                                              */
329 /*===========================================================================*/
330 
331 #ifdef U_STATIC_IMPLEMENTATION
332 #define U_EXPORT
333 #elif 1
334 #define U_EXPORT __attribute__((visibility("default")))
335 #elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \
336    || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550)
337 #define U_EXPORT __global
338 /*#elif defined(__HP_aCC) || defined(__HP_cc)
339 #define U_EXPORT __declspec(dllexport)*/
340 #else
341 #define U_EXPORT
342 #endif
343 
344 /* U_CALLCONV is releated to U_EXPORT2 */
345 #define U_EXPORT2
346 
347 /* cygwin needs to export/import data */
348 #if defined(U_CYGWIN) && !defined(__GNUC__)
349 #define U_IMPORT __declspec(dllimport)
350 #else
351 #define U_IMPORT
352 #endif
353 
354 /* @} */
355 
356 /*===========================================================================*/
357 /** @{ Code alignment and C function inlining                                    */
358 /*===========================================================================*/
359 
360 #ifndef U_INLINE
361 #   ifdef __cplusplus
362 #       define U_INLINE inline
363 #   else
364 #       define U_INLINE __inline__
365 #   endif
366 #endif
367 
368 #ifndef U_ALIGN_CODE
369 #define U_ALIGN_CODE(n)
370 #endif
371 
372 /** @} */
373 
374 /*===========================================================================*/
375 /** @{ GCC built in functions for atomic memory operations                       */
376 /*===========================================================================*/
377 
378 /* BEGIN android-added */
379 #if !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
380 #define U_HAVE_GCC_ATOMICS 0
381 #endif
382 /* END android-added */
383 
384 /**
385  * \def U_HAVE_GCC_ATOMICS
386  * @internal
387  */
388 #ifndef U_HAVE_GCC_ATOMICS
389 #define U_HAVE_GCC_ATOMICS 1
390 #endif
391 
392 /** @} */
393 
394 /*===========================================================================*/
395 /** @{ Programs used by ICU code                                                 */
396 /*===========================================================================*/
397 
398 /**
399  * \def U_MAKE
400  * What program to execute to run 'make'
401  */
402 #ifndef U_MAKE
403 #define U_MAKE  "make"
404 #endif
405 
406 /** @} */
407 
408 #endif /* CYGWINMSVC */
409 
410 /*===========================================================================*/
411 /* Custom icu entry point renaming                                                  */
412 /*===========================================================================*/
413 
414 /**
415  * Define the library suffix with C syntax.
416  * @internal
417  */
418 # define U_LIB_SUFFIX_C_NAME
419 /**
420  * Define the library suffix as a string with C syntax
421  * @internal
422  */
423 # define U_LIB_SUFFIX_C_NAME_STRING ""
424 /**
425  * 1 if a custom library suffix is set
426  * @internal
427  */
428 # define U_HAVE_LIB_SUFFIX 0
429 
430 #if U_HAVE_LIB_SUFFIX
431 # ifndef U_ICU_ENTRY_POINT_RENAME
432 /* Renaming pattern:    u_strcpy_41_suffix */
433 #  define U_ICU_ENTRY_POINT_RENAME(x)    x ## _ ## 48 ##
434 #  define U_DEF_ICUDATA_ENTRY_POINT(major, minor) icudt####major##minor##_dat
435 
436 # endif
437 #endif
438 
439 #endif
440