Home | History | Annotate | Download | only in unicode
      1 /*
      2 **********************************************************************
      3 *   Copyright (C) 2002-2014, 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 U_ENABLE_DYLOAD
    139  * Whether to enable Dynamic loading in ICU.
    140  * @internal
    141  */
    142 #ifndef U_ENABLE_DYLOAD
    143 #define U_ENABLE_DYLOAD 1
    144 #endif
    145 
    146 /**
    147  * \def U_CHECK_DYLOAD
    148  * Whether to test Dynamic loading as an OS capability.
    149  * @internal
    150  */
    151 #ifndef U_CHECK_DYLOAD
    152 #define U_CHECK_DYLOAD 1
    153 #endif
    154 
    155 
    156 /**
    157  * \def U_DEFAULT_SHOW_DRAFT
    158  * Do we allow ICU users to use the draft APIs by default?
    159  * @internal
    160  */
    161 #ifndef U_DEFAULT_SHOW_DRAFT
    162 #define U_DEFAULT_SHOW_DRAFT 1
    163 #endif
    164 
    165 /*===========================================================================*/
    166 /* Custom icu entry point renaming                                           */
    167 /*===========================================================================*/
    168 
    169 /**
    170  * \def U_HAVE_LIB_SUFFIX
    171  * 1 if a custom library suffix is set.
    172  * @internal
    173  */
    174 #ifdef U_HAVE_LIB_SUFFIX
    175     /* Use the predefined value. */
    176 #elif defined(U_LIB_SUFFIX_C_NAME)
    177 #   define U_HAVE_LIB_SUFFIX 1
    178 #endif
    179 
    180 /**
    181  * \def U_LIB_SUFFIX_C_NAME_STRING
    182  * Defines the library suffix as a string with C syntax.
    183  * @internal
    184  */
    185 #ifdef U_LIB_SUFFIX_C_NAME_STRING
    186     /* Use the predefined value. */
    187 #elif defined(U_LIB_SUFFIX_C_NAME)
    188 #   define CONVERT_TO_STRING(s) #s
    189 #   define U_LIB_SUFFIX_C_NAME_STRING CONVERT_TO_STRING(U_LIB_SUFFIX_C_NAME)
    190 #else
    191 #   define U_LIB_SUFFIX_C_NAME_STRING ""
    192 #endif
    193 
    194 /* common/i18n library switches --------------------------------------------- */
    195 
    196 /**
    197  * \def UCONFIG_ONLY_COLLATION
    198  * This switch turns off modules that are not needed for collation.
    199  *
    200  * It does not turn off legacy conversion because that is necessary
    201  * for ICU to work on EBCDIC platforms (for the default converter).
    202  * If you want "only collation" and do not build for EBCDIC,
    203  * then you can define UCONFIG_NO_LEGACY_CONVERSION 1 as well.
    204  *
    205  * @stable ICU 2.4
    206  */
    207 #ifndef UCONFIG_ONLY_COLLATION
    208 #   define UCONFIG_ONLY_COLLATION 0
    209 #endif
    210 
    211 #if UCONFIG_ONLY_COLLATION
    212     /* common library */
    213 #   define UCONFIG_NO_BREAK_ITERATION 1
    214 #   define UCONFIG_NO_IDNA 1
    215 
    216     /* i18n library */
    217 #   if UCONFIG_NO_COLLATION
    218 #       error Contradictory collation switches in uconfig.h.
    219 #   endif
    220 #   define UCONFIG_NO_FORMATTING 1
    221 #   define UCONFIG_NO_TRANSLITERATION 1
    222 #   define UCONFIG_NO_REGULAR_EXPRESSIONS 1
    223 #endif
    224 
    225 /* common library switches -------------------------------------------------- */
    226 
    227 /**
    228  * \def UCONFIG_NO_FILE_IO
    229  * This switch turns off all file access in the common library
    230  * where file access is only used for data loading.
    231  * ICU data must then be provided in the form of a data DLL (or with an
    232  * equivalent way to link to the data residing in an executable,
    233  * as in building a combined library with both the common library's code and
    234  * the data), or via udata_setCommonData().
    235  * Application data must be provided via udata_setAppData() or by using
    236  * "open" functions that take pointers to data, for example ucol_openBinary().
    237  *
    238  * File access is not used at all in the i18n library.
    239  *
    240  * File access cannot be turned off for the icuio library or for the ICU
    241  * test suites and ICU tools.
    242  *
    243  * @stable ICU 3.6
    244  */
    245 #ifndef UCONFIG_NO_FILE_IO
    246 #   define UCONFIG_NO_FILE_IO 0
    247 #endif
    248 
    249 /**
    250  * \def UCONFIG_NO_CONVERSION
    251  * ICU will not completely build with this switch turned on.
    252  * This switch turns off all converters.
    253  *
    254  * You may want to use this together with U_CHARSET_IS_UTF8 defined to 1
    255  * in utypes.h if char* strings in your environment are always in UTF-8.
    256  *
    257  * @stable ICU 3.2
    258  * @see U_CHARSET_IS_UTF8
    259  */
    260 #ifndef UCONFIG_NO_CONVERSION
    261 #   define UCONFIG_NO_CONVERSION 0
    262 #endif
    263 
    264 #if UCONFIG_NO_CONVERSION
    265 #   define UCONFIG_NO_LEGACY_CONVERSION 1
    266 #endif
    267 
    268 /**
    269  * \def UCONFIG_NO_LEGACY_CONVERSION
    270  * This switch turns off all converters except for
    271  * - Unicode charsets (UTF-7/8/16/32, CESU-8, SCSU, BOCU-1)
    272  * - US-ASCII
    273  * - ISO-8859-1
    274  *
    275  * Turning off legacy conversion is not possible on EBCDIC platforms
    276  * because they need ibm-37 or ibm-1047 default converters.
    277  *
    278  * @stable ICU 2.4
    279  */
    280 #ifndef UCONFIG_NO_LEGACY_CONVERSION
    281 #   define UCONFIG_NO_LEGACY_CONVERSION 0
    282 #endif
    283 
    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 
    301     /* i18n library */
    302 #   if UCONFIG_ONLY_COLLATION
    303 #       error Contradictory collation switches in uconfig.h.
    304 #   endif
    305 #   define UCONFIG_NO_COLLATION 1
    306 #   define UCONFIG_NO_TRANSLITERATION 1
    307 #endif
    308 
    309 /**
    310  * \def UCONFIG_NO_BREAK_ITERATION
    311  * This switch turns off break iteration.
    312  *
    313  * @stable ICU 2.4
    314  */
    315 #ifndef UCONFIG_NO_BREAK_ITERATION
    316 #   define UCONFIG_NO_BREAK_ITERATION 0
    317 #endif
    318 
    319 /**
    320  * \def UCONFIG_NO_IDNA
    321  * This switch turns off IDNA.
    322  *
    323  * @stable ICU 2.6
    324  */
    325 #ifndef UCONFIG_NO_IDNA
    326 #   define UCONFIG_NO_IDNA 0
    327 #endif
    328 
    329 /**
    330  * \def UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE
    331  * Determines the default UMessagePatternApostropheMode.
    332  * See the documentation for that enum.
    333  *
    334  * @stable ICU 4.8
    335  */
    336 #ifndef UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE
    337 #   define UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE UMSGPAT_APOS_DOUBLE_OPTIONAL
    338 #endif
    339 
    340 /* i18n library switches ---------------------------------------------------- */
    341 
    342 /**
    343  * \def UCONFIG_NO_COLLATION
    344  * This switch turns off collation and collation-based string search.
    345  *
    346  * @stable ICU 2.4
    347  */
    348 #ifndef UCONFIG_NO_COLLATION
    349 #   define UCONFIG_NO_COLLATION 0
    350 #endif
    351 
    352 /**
    353  * \def UCONFIG_NO_FORMATTING
    354  * This switch turns off formatting and calendar/timezone services.
    355  *
    356  * @stable ICU 2.4
    357  */
    358 #ifndef UCONFIG_NO_FORMATTING
    359 #   define UCONFIG_NO_FORMATTING 0
    360 #endif
    361 
    362 /**
    363  * \def UCONFIG_NO_TRANSLITERATION
    364  * This switch turns off transliteration.
    365  *
    366  * @stable ICU 2.4
    367  */
    368 #ifndef UCONFIG_NO_TRANSLITERATION
    369 #   define UCONFIG_NO_TRANSLITERATION 0
    370 #endif
    371 
    372 /**
    373  * \def UCONFIG_NO_REGULAR_EXPRESSIONS
    374  * This switch turns off regular expressions.
    375  *
    376  * @stable ICU 2.4
    377  */
    378 #ifndef UCONFIG_NO_REGULAR_EXPRESSIONS
    379 #   define UCONFIG_NO_REGULAR_EXPRESSIONS 0
    380 #endif
    381 
    382 /**
    383  * \def UCONFIG_NO_SERVICE
    384  * This switch turns off service registration.
    385  *
    386  * @stable ICU 3.2
    387  */
    388 #ifndef UCONFIG_NO_SERVICE
    389 #   define UCONFIG_NO_SERVICE 0
    390 #endif
    391 
    392 /**
    393  * \def UCONFIG_HAVE_PARSEALLINPUT
    394  * This switch turns on the "parse all input" attribute. Binary incompatible.
    395  *
    396  * @internal
    397  */
    398 #ifndef UCONFIG_HAVE_PARSEALLINPUT
    399 #   define UCONFIG_HAVE_PARSEALLINPUT 1
    400 #endif
    401 
    402 
    403 /**
    404  * \def UCONFIG_FORMAT_FASTPATHS_49
    405  * This switch turns on other formatting fastpaths. Binary incompatible in object DecimalFormat and DecimalFormatSymbols
    406  *
    407  * @internal
    408  */
    409 #ifndef UCONFIG_FORMAT_FASTPATHS_49
    410 #   define UCONFIG_FORMAT_FASTPATHS_49 1
    411 #endif
    412 
    413 /**
    414  * \def UCONFIG_NO_FILTERED_BREAK_ITERATION
    415  * This switch turns off filtered break iteration code.
    416  *
    417  * @internal
    418  */
    419 #ifndef UCONFIG_NO_FILTERED_BREAK_ITERATION
    420 #   define UCONFIG_NO_FILTERED_BREAK_ITERATION 1
    421 #endif
    422 
    423 #endif
    424