uconfig.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. // Copyright (C) 2016 and later: Unicode, Inc. and others.
  2. // License & terms of use: http://www.unicode.org/copyright.html
  3. /*
  4. **********************************************************************
  5. * Copyright (C) 2002-2016, International Business Machines
  6. * Corporation and others. All Rights Reserved.
  7. **********************************************************************
  8. * file name: uconfig.h
  9. * encoding: US-ASCII
  10. * tab size: 8 (not used)
  11. * indentation:4
  12. *
  13. * created on: 2002sep19
  14. * created by: Markus W. Scherer
  15. */
  16. #ifndef __UCONFIG_H__
  17. #define __UCONFIG_H__
  18. /*!
  19. * \file
  20. * \brief User-configurable settings
  21. *
  22. * Miscellaneous switches:
  23. *
  24. * A number of macros affect a variety of minor aspects of ICU.
  25. * Most of them used to be defined elsewhere (e.g., in utypes.h or platform.h)
  26. * and moved here to make them easier to find.
  27. *
  28. * Switches for excluding parts of ICU library code modules:
  29. *
  30. * Changing these macros allows building partial, smaller libraries for special purposes.
  31. * By default, all modules are built.
  32. * The switches are fairly coarse, controlling large modules.
  33. * Basic services cannot be turned off.
  34. *
  35. * Building with any of these options does not guarantee that the
  36. * ICU build process will completely work. It is recommended that
  37. * the ICU libraries and data be built using the normal build.
  38. * At that time you should remove the data used by those services.
  39. * After building the ICU data library, you should rebuild the ICU
  40. * libraries with these switches customized to your needs.
  41. *
  42. * @stable ICU 2.4
  43. */
  44. /**
  45. * If this switch is defined, ICU will attempt to load a header file named "uconfig_local.h"
  46. * prior to determining default settings for uconfig variables.
  47. *
  48. * @internal ICU 4.0
  49. */
  50. #if defined(UCONFIG_USE_LOCAL)
  51. #include "uconfig_local.h"
  52. #endif
  53. /**
  54. * \def U_DEBUG
  55. * Determines whether to include debugging code.
  56. * Automatically set on Windows, but most compilers do not have
  57. * related predefined macros.
  58. * @internal
  59. */
  60. #ifdef U_DEBUG
  61. /* Use the predefined value. */
  62. #elif defined(_DEBUG)
  63. /*
  64. * _DEBUG is defined by Visual Studio debug compilation.
  65. * Do *not* test for its NDEBUG macro: It is an orthogonal macro
  66. * which disables assert().
  67. */
  68. # define U_DEBUG 1
  69. # else
  70. # define U_DEBUG 0
  71. #endif
  72. /**
  73. * Determines wheter to enable auto cleanup of libraries.
  74. * @internal
  75. */
  76. #ifndef UCLN_NO_AUTO_CLEANUP
  77. #define UCLN_NO_AUTO_CLEANUP 1
  78. #endif
  79. /**
  80. * \def U_DISABLE_RENAMING
  81. * Determines whether to disable renaming or not.
  82. * @internal
  83. */
  84. #ifndef U_DISABLE_RENAMING
  85. #define U_DISABLE_RENAMING 0
  86. #endif
  87. /**
  88. * \def U_NO_DEFAULT_INCLUDE_UTF_HEADERS
  89. * Determines whether utypes.h includes utf.h, utf8.h, utf16.h and utf_old.h.
  90. * utypes.h includes those headers if this macro is defined to 0.
  91. * Otherwise, each those headers must be included explicitly when using one of their macros.
  92. * Defaults to 0 for backward compatibility, except inside ICU.
  93. * @stable ICU 49
  94. */
  95. #ifdef U_NO_DEFAULT_INCLUDE_UTF_HEADERS
  96. /* Use the predefined value. */
  97. #elif defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || \
  98. defined(U_IO_IMPLEMENTATION) || defined(U_LAYOUT_IMPLEMENTATION) || defined(U_LAYOUTEX_IMPLEMENTATION) || \
  99. defined(U_TOOLUTIL_IMPLEMENTATION)
  100. # define U_NO_DEFAULT_INCLUDE_UTF_HEADERS 1
  101. #else
  102. # define U_NO_DEFAULT_INCLUDE_UTF_HEADERS 0
  103. #endif
  104. /**
  105. * \def U_OVERRIDE_CXX_ALLOCATION
  106. * Determines whether to override new and delete.
  107. * ICU is normally built such that all of its C++ classes, via their UMemory base,
  108. * override operators new and delete to use its internal, customizable,
  109. * non-exception-throwing memory allocation functions. (Default value 1 for this macro.)
  110. *
  111. * This is especially important when the application and its libraries use multiple heaps.
  112. * For example, on Windows, this allows the ICU DLL to be used by
  113. * applications that statically link the C Runtime library.
  114. *
  115. * @stable ICU 2.2
  116. */
  117. #ifndef U_OVERRIDE_CXX_ALLOCATION
  118. #define U_OVERRIDE_CXX_ALLOCATION 1
  119. #endif
  120. /**
  121. * \def U_ENABLE_TRACING
  122. * Determines whether to enable tracing.
  123. * @internal
  124. */
  125. #ifndef U_ENABLE_TRACING
  126. #define U_ENABLE_TRACING 0
  127. #endif
  128. /**
  129. * \def UCONFIG_ENABLE_PLUGINS
  130. * Determines whether to enable ICU plugins.
  131. * @internal
  132. */
  133. #ifndef UCONFIG_ENABLE_PLUGINS
  134. #define UCONFIG_ENABLE_PLUGINS 0
  135. #endif
  136. /**
  137. * \def U_ENABLE_DYLOAD
  138. * Whether to enable Dynamic loading in ICU.
  139. * @internal
  140. */
  141. #ifndef U_ENABLE_DYLOAD
  142. #define U_ENABLE_DYLOAD 1
  143. #endif
  144. /**
  145. * \def U_CHECK_DYLOAD
  146. * Whether to test Dynamic loading as an OS capability.
  147. * @internal
  148. */
  149. #ifndef U_CHECK_DYLOAD
  150. #define U_CHECK_DYLOAD 1
  151. #endif
  152. /**
  153. * \def U_DEFAULT_SHOW_DRAFT
  154. * Do we allow ICU users to use the draft APIs by default?
  155. * @internal
  156. */
  157. #ifndef U_DEFAULT_SHOW_DRAFT
  158. #define U_DEFAULT_SHOW_DRAFT 1
  159. #endif
  160. /*===========================================================================*/
  161. /* Custom icu entry point renaming */
  162. /*===========================================================================*/
  163. /**
  164. * \def U_HAVE_LIB_SUFFIX
  165. * 1 if a custom library suffix is set.
  166. * @internal
  167. */
  168. #ifdef U_HAVE_LIB_SUFFIX
  169. /* Use the predefined value. */
  170. #elif defined(U_LIB_SUFFIX_C_NAME)
  171. # define U_HAVE_LIB_SUFFIX 1
  172. #endif
  173. /**
  174. * \def U_LIB_SUFFIX_C_NAME_STRING
  175. * Defines the library suffix as a string with C syntax.
  176. * @internal
  177. */
  178. #ifdef U_LIB_SUFFIX_C_NAME_STRING
  179. /* Use the predefined value. */
  180. #elif defined(U_LIB_SUFFIX_C_NAME)
  181. # define CONVERT_TO_STRING(s) #s
  182. # define U_LIB_SUFFIX_C_NAME_STRING CONVERT_TO_STRING(U_LIB_SUFFIX_C_NAME)
  183. #else
  184. # define U_LIB_SUFFIX_C_NAME_STRING ""
  185. #endif
  186. /* common/i18n library switches --------------------------------------------- */
  187. /**
  188. * \def UCONFIG_ONLY_COLLATION
  189. * This switch turns off modules that are not needed for collation.
  190. *
  191. * It does not turn off legacy conversion because that is necessary
  192. * for ICU to work on EBCDIC platforms (for the default converter).
  193. * If you want "only collation" and do not build for EBCDIC,
  194. * then you can define UCONFIG_NO_CONVERSION or UCONFIG_NO_LEGACY_CONVERSION to 1 as well.
  195. *
  196. * @stable ICU 2.4
  197. */
  198. #ifndef UCONFIG_ONLY_COLLATION
  199. # define UCONFIG_ONLY_COLLATION 0
  200. #endif
  201. #if UCONFIG_ONLY_COLLATION
  202. /* common library */
  203. # define UCONFIG_NO_BREAK_ITERATION 1
  204. # define UCONFIG_NO_IDNA 1
  205. /* i18n library */
  206. # if UCONFIG_NO_COLLATION
  207. # error Contradictory collation switches in uconfig.h.
  208. # endif
  209. # define UCONFIG_NO_FORMATTING 1
  210. # define UCONFIG_NO_TRANSLITERATION 1
  211. # define UCONFIG_NO_REGULAR_EXPRESSIONS 1
  212. #endif
  213. /* common library switches -------------------------------------------------- */
  214. /**
  215. * \def UCONFIG_NO_FILE_IO
  216. * This switch turns off all file access in the common library
  217. * where file access is only used for data loading.
  218. * ICU data must then be provided in the form of a data DLL (or with an
  219. * equivalent way to link to the data residing in an executable,
  220. * as in building a combined library with both the common library's code and
  221. * the data), or via udata_setCommonData().
  222. * Application data must be provided via udata_setAppData() or by using
  223. * "open" functions that take pointers to data, for example ucol_openBinary().
  224. *
  225. * File access is not used at all in the i18n library.
  226. *
  227. * File access cannot be turned off for the icuio library or for the ICU
  228. * test suites and ICU tools.
  229. *
  230. * @stable ICU 3.6
  231. */
  232. #ifndef UCONFIG_NO_FILE_IO
  233. # define UCONFIG_NO_FILE_IO 0
  234. #endif
  235. #if UCONFIG_NO_FILE_IO && defined(U_TIMEZONE_FILES_DIR)
  236. # error Contradictory file io switches in uconfig.h.
  237. #endif
  238. /**
  239. * \def UCONFIG_NO_CONVERSION
  240. * ICU will not completely build with this switch turned on.
  241. * This switch turns off all converters.
  242. *
  243. * You may want to use this together with U_CHARSET_IS_UTF8 defined to 1
  244. * in utypes.h if char* strings in your environment are always in UTF-8.
  245. *
  246. * @stable ICU 3.2
  247. * @see U_CHARSET_IS_UTF8
  248. */
  249. #ifndef UCONFIG_NO_CONVERSION
  250. # define UCONFIG_NO_CONVERSION 0
  251. #endif
  252. #if UCONFIG_NO_CONVERSION
  253. # define UCONFIG_NO_LEGACY_CONVERSION 1
  254. #endif
  255. /**
  256. * \def UCONFIG_ONLY_HTML_CONVERSION
  257. * This switch turns off all of the converters NOT listed in
  258. * the HTML encoding standard:
  259. * http://www.w3.org/TR/encoding/#names-and-labels
  260. *
  261. * This is not possible on EBCDIC platforms
  262. * because they need ibm-37 or ibm-1047 default converters.
  263. *
  264. * @stable ICU 55
  265. */
  266. #ifndef UCONFIG_ONLY_HTML_CONVERSION
  267. # define UCONFIG_ONLY_HTML_CONVERSION 0
  268. #endif
  269. /**
  270. * \def UCONFIG_NO_LEGACY_CONVERSION
  271. * This switch turns off all converters except for
  272. * - Unicode charsets (UTF-7/8/16/32, CESU-8, SCSU, BOCU-1)
  273. * - US-ASCII
  274. * - ISO-8859-1
  275. *
  276. * Turning off legacy conversion is not possible on EBCDIC platforms
  277. * because they need ibm-37 or ibm-1047 default converters.
  278. *
  279. * @stable ICU 2.4
  280. */
  281. #ifndef UCONFIG_NO_LEGACY_CONVERSION
  282. # define UCONFIG_NO_LEGACY_CONVERSION 0
  283. #endif
  284. /**
  285. * \def UCONFIG_NO_NORMALIZATION
  286. * This switch turns off normalization.
  287. * It implies turning off several other services as well, for example
  288. * collation and IDNA.
  289. *
  290. * @stable ICU 2.6
  291. */
  292. #ifndef UCONFIG_NO_NORMALIZATION
  293. # define UCONFIG_NO_NORMALIZATION 0
  294. #elif UCONFIG_NO_NORMALIZATION
  295. /* common library */
  296. /* ICU 50 CJK dictionary BreakIterator uses normalization */
  297. # define UCONFIG_NO_BREAK_ITERATION 1
  298. /* IDNA (UTS #46) is implemented via normalization */
  299. # define UCONFIG_NO_IDNA 1
  300. /* i18n library */
  301. # if UCONFIG_ONLY_COLLATION
  302. # error Contradictory collation switches in uconfig.h.
  303. # endif
  304. # define UCONFIG_NO_COLLATION 1
  305. # define UCONFIG_NO_TRANSLITERATION 1
  306. #endif
  307. /**
  308. * \def UCONFIG_NO_BREAK_ITERATION
  309. * This switch turns off break iteration.
  310. *
  311. * @stable ICU 2.4
  312. */
  313. #ifndef UCONFIG_NO_BREAK_ITERATION
  314. # define UCONFIG_NO_BREAK_ITERATION 0
  315. #endif
  316. /**
  317. * \def UCONFIG_NO_IDNA
  318. * This switch turns off IDNA.
  319. *
  320. * @stable ICU 2.6
  321. */
  322. #ifndef UCONFIG_NO_IDNA
  323. # define UCONFIG_NO_IDNA 0
  324. #endif
  325. /**
  326. * \def UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE
  327. * Determines the default UMessagePatternApostropheMode.
  328. * See the documentation for that enum.
  329. *
  330. * @stable ICU 4.8
  331. */
  332. #ifndef UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE
  333. # define UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE UMSGPAT_APOS_DOUBLE_OPTIONAL
  334. #endif
  335. /* i18n library switches ---------------------------------------------------- */
  336. /**
  337. * \def UCONFIG_NO_COLLATION
  338. * This switch turns off collation and collation-based string search.
  339. *
  340. * @stable ICU 2.4
  341. */
  342. #ifndef UCONFIG_NO_COLLATION
  343. # define UCONFIG_NO_COLLATION 0
  344. #endif
  345. /**
  346. * \def UCONFIG_NO_FORMATTING
  347. * This switch turns off formatting and calendar/timezone services.
  348. *
  349. * @stable ICU 2.4
  350. */
  351. #ifndef UCONFIG_NO_FORMATTING
  352. # define UCONFIG_NO_FORMATTING 0
  353. #endif
  354. /**
  355. * \def UCONFIG_NO_TRANSLITERATION
  356. * This switch turns off transliteration.
  357. *
  358. * @stable ICU 2.4
  359. */
  360. #ifndef UCONFIG_NO_TRANSLITERATION
  361. # define UCONFIG_NO_TRANSLITERATION 0
  362. #endif
  363. /**
  364. * \def UCONFIG_NO_REGULAR_EXPRESSIONS
  365. * This switch turns off regular expressions.
  366. *
  367. * @stable ICU 2.4
  368. */
  369. #ifndef UCONFIG_NO_REGULAR_EXPRESSIONS
  370. # define UCONFIG_NO_REGULAR_EXPRESSIONS 0
  371. #endif
  372. /**
  373. * \def UCONFIG_NO_SERVICE
  374. * This switch turns off service registration.
  375. *
  376. * @stable ICU 3.2
  377. */
  378. #ifndef UCONFIG_NO_SERVICE
  379. # define UCONFIG_NO_SERVICE 0
  380. #endif
  381. /**
  382. * \def UCONFIG_HAVE_PARSEALLINPUT
  383. * This switch turns on the "parse all input" attribute. Binary incompatible.
  384. *
  385. * @internal
  386. */
  387. #ifndef UCONFIG_HAVE_PARSEALLINPUT
  388. # define UCONFIG_HAVE_PARSEALLINPUT 1
  389. #endif
  390. /**
  391. * \def UCONFIG_FORMAT_FASTPATHS_49
  392. * This switch turns on other formatting fastpaths. Binary incompatible in object DecimalFormat and DecimalFormatSymbols
  393. *
  394. * @internal
  395. */
  396. #ifndef UCONFIG_FORMAT_FASTPATHS_49
  397. # define UCONFIG_FORMAT_FASTPATHS_49 1
  398. #endif
  399. /**
  400. * \def UCONFIG_NO_FILTERED_BREAK_ITERATION
  401. * This switch turns off filtered break iteration code.
  402. *
  403. * @internal
  404. */
  405. #ifndef UCONFIG_NO_FILTERED_BREAK_ITERATION
  406. # define UCONFIG_NO_FILTERED_BREAK_ITERATION 0
  407. #endif
  408. #endif