uconfig.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. // © 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: UTF-8
  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 whether 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) || defined(U_IN_DOXYGEN)
  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 (compiling the tools fails) with this
  241. * switch turned on.
  242. * This switch turns off all converters.
  243. *
  244. * You may want to use this together with U_CHARSET_IS_UTF8 defined to 1
  245. * in utypes.h if char* strings in your environment are always in UTF-8.
  246. *
  247. * @stable ICU 3.2
  248. * @see U_CHARSET_IS_UTF8
  249. */
  250. #ifndef UCONFIG_NO_CONVERSION
  251. # define UCONFIG_NO_CONVERSION 0
  252. #endif
  253. #if UCONFIG_NO_CONVERSION
  254. # define UCONFIG_NO_LEGACY_CONVERSION 1
  255. #endif
  256. /**
  257. * \def UCONFIG_ONLY_HTML_CONVERSION
  258. * This switch turns off all of the converters NOT listed in
  259. * the HTML encoding standard:
  260. * http://www.w3.org/TR/encoding/#names-and-labels
  261. *
  262. * This is not possible on EBCDIC platforms
  263. * because they need ibm-37 or ibm-1047 default converters.
  264. *
  265. * @stable ICU 55
  266. */
  267. #ifndef UCONFIG_ONLY_HTML_CONVERSION
  268. # define UCONFIG_ONLY_HTML_CONVERSION 0
  269. #endif
  270. /**
  271. * \def UCONFIG_NO_LEGACY_CONVERSION
  272. * This switch turns off all converters except for
  273. * - Unicode charsets (UTF-7/8/16/32, CESU-8, SCSU, BOCU-1)
  274. * - US-ASCII
  275. * - ISO-8859-1
  276. *
  277. * Turning off legacy conversion is not possible on EBCDIC platforms
  278. * because they need ibm-37 or ibm-1047 default converters.
  279. *
  280. * @stable ICU 2.4
  281. */
  282. #ifndef UCONFIG_NO_LEGACY_CONVERSION
  283. # define UCONFIG_NO_LEGACY_CONVERSION 0
  284. #endif
  285. /**
  286. * \def UCONFIG_NO_NORMALIZATION
  287. * This switch turns off normalization.
  288. * It implies turning off several other services as well, for example
  289. * collation and IDNA.
  290. *
  291. * @stable ICU 2.6
  292. */
  293. #ifndef UCONFIG_NO_NORMALIZATION
  294. # define UCONFIG_NO_NORMALIZATION 0
  295. #endif
  296. /**
  297. * \def UCONFIG_USE_ML_PHRASE_BREAKING
  298. * This switch turns on BudouX ML phrase-based line breaking, rather than using the dictionary.
  299. *
  300. * @internal
  301. */
  302. #ifndef UCONFIG_USE_ML_PHRASE_BREAKING
  303. # define UCONFIG_USE_ML_PHRASE_BREAKING 0
  304. #endif
  305. #if UCONFIG_NO_NORMALIZATION
  306. /* common library */
  307. /* ICU 50 CJK dictionary BreakIterator uses normalization */
  308. # define UCONFIG_NO_BREAK_ITERATION 1
  309. /* IDNA (UTS #46) is implemented via normalization */
  310. # define UCONFIG_NO_IDNA 1
  311. /* i18n library */
  312. # if UCONFIG_ONLY_COLLATION
  313. # error Contradictory collation switches in uconfig.h.
  314. # endif
  315. # define UCONFIG_NO_COLLATION 1
  316. # define UCONFIG_NO_TRANSLITERATION 1
  317. #endif
  318. /**
  319. * \def UCONFIG_NO_BREAK_ITERATION
  320. * This switch turns off break iteration.
  321. *
  322. * @stable ICU 2.4
  323. */
  324. #ifndef UCONFIG_NO_BREAK_ITERATION
  325. # define UCONFIG_NO_BREAK_ITERATION 0
  326. #endif
  327. /**
  328. * \def UCONFIG_NO_IDNA
  329. * This switch turns off IDNA.
  330. *
  331. * @stable ICU 2.6
  332. */
  333. #ifndef UCONFIG_NO_IDNA
  334. # define UCONFIG_NO_IDNA 0
  335. #endif
  336. /**
  337. * \def UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE
  338. * Determines the default UMessagePatternApostropheMode.
  339. * See the documentation for that enum.
  340. *
  341. * @stable ICU 4.8
  342. */
  343. #ifndef UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE
  344. # define UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE UMSGPAT_APOS_DOUBLE_OPTIONAL
  345. #endif
  346. /**
  347. * \def UCONFIG_USE_WINDOWS_LCID_MAPPING_API
  348. * On platforms where U_PLATFORM_HAS_WIN32_API is true, this switch determines
  349. * if the Windows platform APIs are used for LCID<->Locale Name conversions.
  350. * Otherwise, only the built-in ICU tables are used.
  351. *
  352. * @internal ICU 64
  353. */
  354. #ifndef UCONFIG_USE_WINDOWS_LCID_MAPPING_API
  355. # define UCONFIG_USE_WINDOWS_LCID_MAPPING_API 1
  356. #endif
  357. /* i18n library switches ---------------------------------------------------- */
  358. /**
  359. * \def UCONFIG_NO_COLLATION
  360. * This switch turns off collation and collation-based string search.
  361. *
  362. * @stable ICU 2.4
  363. */
  364. #ifndef UCONFIG_NO_COLLATION
  365. # define UCONFIG_NO_COLLATION 0
  366. #endif
  367. /**
  368. * \def UCONFIG_NO_FORMATTING
  369. * This switch turns off formatting and calendar/timezone services.
  370. *
  371. * @stable ICU 2.4
  372. */
  373. #ifndef UCONFIG_NO_FORMATTING
  374. # define UCONFIG_NO_FORMATTING 0
  375. #endif
  376. /**
  377. * \def UCONFIG_NO_MF2
  378. * This switch turns off the experimental MessageFormat 2.0 API.
  379. *
  380. * @internal ICU 75 technology preview
  381. * @deprecated This API is for technology preview only.
  382. */
  383. #ifndef UCONFIG_NO_MF2
  384. # define UCONFIG_NO_MF2 0
  385. #endif
  386. /**
  387. * \def UCONFIG_NO_TRANSLITERATION
  388. * This switch turns off transliteration.
  389. *
  390. * @stable ICU 2.4
  391. */
  392. #ifndef UCONFIG_NO_TRANSLITERATION
  393. # define UCONFIG_NO_TRANSLITERATION 0
  394. #endif
  395. /**
  396. * \def UCONFIG_NO_REGULAR_EXPRESSIONS
  397. * This switch turns off regular expressions.
  398. *
  399. * @stable ICU 2.4
  400. */
  401. #ifndef UCONFIG_NO_REGULAR_EXPRESSIONS
  402. # define UCONFIG_NO_REGULAR_EXPRESSIONS 0
  403. #endif
  404. /**
  405. * \def UCONFIG_NO_SERVICE
  406. * This switch turns off service registration.
  407. *
  408. * @stable ICU 3.2
  409. */
  410. #ifndef UCONFIG_NO_SERVICE
  411. # define UCONFIG_NO_SERVICE 0
  412. #endif
  413. /**
  414. * \def UCONFIG_HAVE_PARSEALLINPUT
  415. * This switch turns on the "parse all input" attribute. Binary incompatible.
  416. *
  417. * @internal
  418. */
  419. #ifndef UCONFIG_HAVE_PARSEALLINPUT
  420. # define UCONFIG_HAVE_PARSEALLINPUT 1
  421. #endif
  422. /**
  423. * \def UCONFIG_NO_FILTERED_BREAK_ITERATION
  424. * This switch turns off filtered break iteration code.
  425. *
  426. * @internal
  427. */
  428. #ifndef UCONFIG_NO_FILTERED_BREAK_ITERATION
  429. # define UCONFIG_NO_FILTERED_BREAK_ITERATION 0
  430. #endif
  431. #endif // __UCONFIG_H__