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