platform.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. /*
  2. ******************************************************************************
  3. *
  4. * Copyright (C) 1997-2010, 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. #ifndef _PLATFORM_H
  23. #define _PLATFORM_H
  24. /**
  25. * \file
  26. * \brief Basic types for the platform
  27. */
  28. /* This file should be included before uvernum.h. */
  29. #if defined(UVERNUM_H)
  30. # error Do not include unicode/uvernum.h before #including unicode/platform.h. Instead of unicode/uvernum.h, #include unicode/uversion.h
  31. #endif
  32. /**
  33. * Determine wheter to enable auto cleanup of libraries.
  34. * @internal
  35. */
  36. #ifndef UCLN_NO_AUTO_CLEANUP
  37. #define UCLN_NO_AUTO_CLEANUP 1
  38. #endif
  39. /* Need platform.h when using CYGWINMSVC to get definitions above. Ignore everything else. */
  40. #ifndef CYGWINMSVC
  41. /** Define the platform we're on. */
  42. #ifndef U_DARWIN
  43. #define U_DARWIN
  44. #endif
  45. /**
  46. * \def U_HAVE_DIRENT_H
  47. * Define whether dirent.h is available
  48. * @internal
  49. */
  50. #ifndef U_HAVE_DIRENT_H
  51. #define U_HAVE_DIRENT_H 1
  52. #endif
  53. /** Define whether inttypes.h is available */
  54. #ifndef U_HAVE_INTTYPES_H
  55. #define U_HAVE_INTTYPES_H 1
  56. #endif
  57. /**
  58. * Define what support for C++ streams is available.
  59. * If U_IOSTREAM_SOURCE is set to 199711, then <iostream> is available
  60. * (1997711 is the date the ISO/IEC C++ FDIS was published), and then
  61. * one should qualify streams using the std namespace in ICU header
  62. * files.
  63. * If U_IOSTREAM_SOURCE is set to 198506, then <iostream.h> is
  64. * available instead (198506 is the date when Stroustrup published
  65. * "An Extensible I/O Facility for C++" at the summer USENIX conference).
  66. * If U_IOSTREAM_SOURCE is 0, then C++ streams are not available and
  67. * support for them will be silently suppressed in ICU.
  68. *
  69. */
  70. #ifndef U_IOSTREAM_SOURCE
  71. #define U_IOSTREAM_SOURCE 199711
  72. #endif
  73. /**
  74. * \def U_HAVE_STD_STRING
  75. * Define whether the standard C++ (STL) <string> header is available.
  76. * For platforms that do not use platform.h and do not define this constant
  77. * in their platform-specific headers, std_string.h defaults
  78. * U_HAVE_STD_STRING to 1.
  79. * @internal
  80. */
  81. #ifndef U_HAVE_STD_STRING
  82. #define U_HAVE_STD_STRING 1
  83. #endif
  84. /** @{ Determines whether specific types are available */
  85. #ifndef U_HAVE_INT8_T
  86. #define U_HAVE_INT8_T 1
  87. #endif
  88. #ifndef U_HAVE_UINT8_T
  89. #define U_HAVE_UINT8_T 0
  90. #endif
  91. #ifndef U_HAVE_INT16_T
  92. #define U_HAVE_INT16_T 1
  93. #endif
  94. #ifndef U_HAVE_UINT16_T
  95. #define U_HAVE_UINT16_T 0
  96. #endif
  97. #ifndef U_HAVE_INT32_T
  98. #define U_HAVE_INT32_T 1
  99. #endif
  100. #ifndef U_HAVE_UINT32_T
  101. #define U_HAVE_UINT32_T 0
  102. #endif
  103. #ifndef U_HAVE_INT64_T
  104. #define U_HAVE_INT64_T 1
  105. #endif
  106. #ifndef U_HAVE_UINT64_T
  107. #define U_HAVE_UINT64_T 0
  108. #endif
  109. /** @} */
  110. /*===========================================================================*/
  111. /** @{ Compiler and environment features */
  112. /*===========================================================================*/
  113. /* Define whether namespace is supported */
  114. #ifndef U_HAVE_NAMESPACE
  115. #define U_HAVE_NAMESPACE 1
  116. #endif
  117. /* Determines the endianness of the platform
  118. It's done this way in case multiple architectures are being built at once.
  119. For example, Darwin supports fat binaries, which can be both PPC and x86 based. */
  120. #if defined(BYTE_ORDER) && defined(BIG_ENDIAN)
  121. #define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN)
  122. #else
  123. #define U_IS_BIG_ENDIAN 1
  124. #endif
  125. /* 1 or 0 to enable or disable threads. If undefined, default is: enable threads. */
  126. #ifndef ICU_USE_THREADS
  127. #define ICU_USE_THREADS 1
  128. #endif
  129. /* On strong memory model CPUs (e.g. x86 CPUs), we use a safe & quick double check lock. */
  130. #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
  131. #define UMTX_STRONG_MEMORY_MODEL 1
  132. #endif
  133. #ifndef U_DEBUG
  134. #define U_DEBUG 0
  135. #endif
  136. #ifndef U_RELEASE
  137. #define U_RELEASE 1
  138. #endif
  139. /* Determine whether to disable renaming or not. This overrides the
  140. setting in umachine.h which is for all platforms. */
  141. #ifndef U_DISABLE_RENAMING
  142. #define U_DISABLE_RENAMING 1
  143. #endif
  144. /* Determine whether to override new and delete. */
  145. #ifndef U_OVERRIDE_CXX_ALLOCATION
  146. #define U_OVERRIDE_CXX_ALLOCATION 1
  147. #endif
  148. /* Determine whether to override placement new and delete for STL. */
  149. #ifndef U_HAVE_PLACEMENT_NEW
  150. #define U_HAVE_PLACEMENT_NEW 1
  151. #endif
  152. /* Determine whether to enable tracing. */
  153. #ifndef U_ENABLE_TRACING
  154. #define U_ENABLE_TRACING 1
  155. #endif
  156. /**
  157. * Whether to enable Dynamic loading in ICU
  158. * @internal
  159. */
  160. #ifndef U_ENABLE_DYLOAD
  161. #define U_ENABLE_DYLOAD 1
  162. #endif
  163. /**
  164. * Whether to test Dynamic loading as an OS capabilty
  165. * @internal
  166. */
  167. #ifndef U_CHECK_DYLOAD
  168. #define U_CHECK_DYLOAD 1
  169. #endif
  170. /** Do we allow ICU users to use the draft APIs by default? */
  171. #ifndef U_DEFAULT_SHOW_DRAFT
  172. #define U_DEFAULT_SHOW_DRAFT 1
  173. #endif
  174. /** @} */
  175. /*===========================================================================*/
  176. /** @{ Character data types */
  177. /*===========================================================================*/
  178. #if ((defined(OS390) && (!defined(__CHARSET_LIB) || !__CHARSET_LIB))) || defined(OS400)
  179. # define U_CHARSET_FAMILY 1
  180. #endif
  181. /** @} */
  182. /*===========================================================================*/
  183. /** @{ Information about wchar support */
  184. /*===========================================================================*/
  185. #ifndef U_HAVE_WCHAR_H
  186. #define U_HAVE_WCHAR_H 1
  187. #endif
  188. #ifndef U_SIZEOF_WCHAR_T
  189. #define U_SIZEOF_WCHAR_T 4
  190. #endif
  191. #ifndef U_HAVE_WCSCPY
  192. #define U_HAVE_WCSCPY 1
  193. #endif
  194. /** @} */
  195. /**
  196. * @{
  197. * \def U_DECLARE_UTF16
  198. * Do not use this macro. Use the UNICODE_STRING or U_STRING_DECL macros
  199. * instead.
  200. * @internal
  201. *
  202. * \def U_GNUC_UTF16_STRING
  203. * @internal
  204. */
  205. #ifndef U_GNUC_UTF16_STRING
  206. #define U_GNUC_UTF16_STRING 0
  207. #endif
  208. #if 1 || defined(U_CHECK_UTF16_STRING)
  209. #if (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \
  210. || (defined(__HP_aCC) && __HP_aCC >= 035000) \
  211. || (defined(__HP_cc) && __HP_cc >= 111106) \
  212. || U_GNUC_UTF16_STRING
  213. #define U_DECLARE_UTF16(string) u ## string
  214. #elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550)
  215. /* || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x580) */
  216. /* Sun's C compiler has issues with this notation, and it's unreliable. */
  217. #define U_DECLARE_UTF16(string) U ## string
  218. #elif U_SIZEOF_WCHAR_T == 2 \
  219. && (U_CHARSET_FAMILY == 0 || ((defined(OS390) || defined(OS400)) && defined(__UCS2__)))
  220. #define U_DECLARE_UTF16(string) L ## string
  221. #endif
  222. #endif
  223. /** @} */
  224. /*===========================================================================*/
  225. /** @{ Information about POSIX support */
  226. /*===========================================================================*/
  227. #ifndef U_HAVE_NL_LANGINFO_CODESET
  228. #define U_HAVE_NL_LANGINFO_CODESET 1
  229. #endif
  230. #ifndef U_NL_LANGINFO_CODESET
  231. #define U_NL_LANGINFO_CODESET CODESET
  232. #endif
  233. #if 1
  234. #define U_TZSET tzset
  235. #endif
  236. #if 0
  237. #define U_TIMEZONE timezone
  238. #endif
  239. #if 1
  240. #define U_TZNAME tzname
  241. #endif
  242. #define U_HAVE_MMAP 1
  243. #define U_HAVE_POPEN 1
  244. /** @} */
  245. /*===========================================================================*/
  246. /** @{ Symbol import-export control */
  247. /*===========================================================================*/
  248. #if 1
  249. #define U_EXPORT __attribute__((visibility("default")))
  250. #elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \
  251. || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550)
  252. #define U_EXPORT __global
  253. /*#elif defined(__HP_aCC) || defined(__HP_cc)
  254. #define U_EXPORT __declspec(dllexport)*/
  255. #else
  256. #define U_EXPORT
  257. #endif
  258. /* U_CALLCONV is releated to U_EXPORT2 */
  259. #define U_EXPORT2
  260. /* cygwin needs to export/import data */
  261. #if defined(U_CYGWIN) && !defined(__GNUC__)
  262. #define U_IMPORT __declspec(dllimport)
  263. #else
  264. #define U_IMPORT
  265. #endif
  266. /* @} */
  267. /*===========================================================================*/
  268. /** @{ Code alignment and C function inlining */
  269. /*===========================================================================*/
  270. #ifndef U_INLINE
  271. # ifdef __cplusplus
  272. # define U_INLINE inline
  273. # else
  274. # define U_INLINE __inline__
  275. # endif
  276. #endif
  277. #ifndef U_ALIGN_CODE
  278. #define U_ALIGN_CODE(n)
  279. #endif
  280. /** @} */
  281. /*===========================================================================*/
  282. /** @{ GCC built in functions for atomic memory operations */
  283. /*===========================================================================*/
  284. /**
  285. * \def U_HAVE_GCC_ATOMICS
  286. * @internal
  287. */
  288. #ifndef U_HAVE_GCC_ATOMICS
  289. #define U_HAVE_GCC_ATOMICS 1
  290. #endif
  291. /** @} */
  292. /*===========================================================================*/
  293. /** @{ Programs used by ICU code */
  294. /*===========================================================================*/
  295. /**
  296. * \def U_MAKE
  297. * What program to execute to run 'make'
  298. */
  299. #ifndef U_MAKE
  300. #define U_MAKE "/usr/bin/gnumake"
  301. #endif
  302. /** @} */
  303. #endif /* CYGWINMSVC */
  304. /*===========================================================================*/
  305. /* Custom icu entry point renaming */
  306. /*===========================================================================*/
  307. /**
  308. * Define the library suffix with C syntax.
  309. * @internal
  310. */
  311. # define U_LIB_SUFFIX_C_NAME
  312. /**
  313. * Define the library suffix as a string with C syntax
  314. * @internal
  315. */
  316. # define U_LIB_SUFFIX_C_NAME_STRING ""
  317. /**
  318. * 1 if a custom library suffix is set
  319. * @internal
  320. */
  321. # define U_HAVE_LIB_SUFFIX 0
  322. #if U_HAVE_LIB_SUFFIX
  323. # ifndef U_ICU_ENTRY_POINT_RENAME
  324. /* Renaming pattern: u_strcpy_41_suffix */
  325. # define U_ICU_ENTRY_POINT_RENAME(x) x ## _ ## 46 ##
  326. # define U_DEF_ICUDATA_ENTRY_POINT(major, minor) icudt####major##minor##_dat
  327. # endif
  328. #endif
  329. #endif