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