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