• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
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 wheter 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 with this switch turned on.
266  * This switch turns off all converters.
267  *
268  * You may want to use this together with U_CHARSET_IS_UTF8 defined to 1
269  * in utypes.h if char* strings in your environment are always in UTF-8.
270  *
271  * @stable ICU 3.2
272  * @see U_CHARSET_IS_UTF8
273  */
274 #ifndef UCONFIG_NO_CONVERSION
275 #   define UCONFIG_NO_CONVERSION 0
276 #endif
277 
278 #if UCONFIG_NO_CONVERSION
279 #   define UCONFIG_NO_LEGACY_CONVERSION 1
280 #endif
281 
282 /**
283  * \def UCONFIG_ONLY_HTML_CONVERSION
284  * This switch turns off all of the converters NOT listed in
285  * the HTML encoding standard:
286  * http://www.w3.org/TR/encoding/#names-and-labels
287  *
288  * This is not possible on EBCDIC platforms
289  * because they need ibm-37 or ibm-1047 default converters.
290  *
291  * @stable ICU 55
292  */
293 #ifndef UCONFIG_ONLY_HTML_CONVERSION
294 #   define UCONFIG_ONLY_HTML_CONVERSION 0
295 #endif
296 
297 /**
298  * \def UCONFIG_NO_LEGACY_CONVERSION
299  * This switch turns off all converters except for
300  * - Unicode charsets (UTF-7/8/16/32, CESU-8, SCSU, BOCU-1)
301  * - US-ASCII
302  * - ISO-8859-1
303  *
304  * Turning off legacy conversion is not possible on EBCDIC platforms
305  * because they need ibm-37 or ibm-1047 default converters.
306  *
307  * @stable ICU 2.4
308  */
309 #ifndef UCONFIG_NO_LEGACY_CONVERSION
310 #   define UCONFIG_NO_LEGACY_CONVERSION 0
311 #endif
312 
313 /**
314  * \def UCONFIG_NO_NORMALIZATION
315  * This switch turns off normalization.
316  * It implies turning off several other services as well, for example
317  * collation and IDNA.
318  *
319  * @stable ICU 2.6
320  */
321 #ifndef UCONFIG_NO_NORMALIZATION
322 #   define UCONFIG_NO_NORMALIZATION 0
323 #elif UCONFIG_NO_NORMALIZATION
324     /* common library */
325     /* ICU 50 CJK dictionary BreakIterator uses normalization */
326 #   define UCONFIG_NO_BREAK_ITERATION 1
327     /* IDNA (UTS #46) is implemented via normalization */
328 #   define UCONFIG_NO_IDNA 1
329 
330     /* i18n library */
331 #   if UCONFIG_ONLY_COLLATION
332 #       error Contradictory collation switches in uconfig.h.
333 #   endif
334 #   define UCONFIG_NO_COLLATION 1
335 #   define UCONFIG_NO_TRANSLITERATION 1
336 #endif
337 
338 /**
339  * \def UCONFIG_NO_BREAK_ITERATION
340  * This switch turns off break iteration.
341  *
342  * @stable ICU 2.4
343  */
344 #ifndef UCONFIG_NO_BREAK_ITERATION
345 #   define UCONFIG_NO_BREAK_ITERATION 0
346 #endif
347 
348 /**
349  * \def UCONFIG_NO_IDNA
350  * This switch turns off IDNA.
351  *
352  * @stable ICU 2.6
353  */
354 #ifndef UCONFIG_NO_IDNA
355 #   define UCONFIG_NO_IDNA 0
356 #endif
357 
358 /**
359  * \def UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE
360  * Determines the default UMessagePatternApostropheMode.
361  * See the documentation for that enum.
362  *
363  * @stable ICU 4.8
364  */
365 #ifndef UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE
366 #   define UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE UMSGPAT_APOS_DOUBLE_OPTIONAL
367 #endif
368 
369 /* i18n library switches ---------------------------------------------------- */
370 
371 /**
372  * \def UCONFIG_NO_COLLATION
373  * This switch turns off collation and collation-based string search.
374  *
375  * @stable ICU 2.4
376  */
377 #ifndef UCONFIG_NO_COLLATION
378 #   define UCONFIG_NO_COLLATION 0
379 #endif
380 
381 /**
382  * \def UCONFIG_NO_FORMATTING
383  * This switch turns off formatting and calendar/timezone services.
384  *
385  * @stable ICU 2.4
386  */
387 #ifndef UCONFIG_NO_FORMATTING
388 #   define UCONFIG_NO_FORMATTING 0
389 #endif
390 
391 /**
392  * \def UCONFIG_NO_TRANSLITERATION
393  * This switch turns off transliteration.
394  *
395  * @stable ICU 2.4
396  */
397 #ifndef UCONFIG_NO_TRANSLITERATION
398 #   define UCONFIG_NO_TRANSLITERATION 0
399 #endif
400 
401 /**
402  * \def UCONFIG_NO_REGULAR_EXPRESSIONS
403  * This switch turns off regular expressions.
404  *
405  * @stable ICU 2.4
406  */
407 #ifndef UCONFIG_NO_REGULAR_EXPRESSIONS
408 #   define UCONFIG_NO_REGULAR_EXPRESSIONS 0
409 #endif
410 
411 /**
412  * \def UCONFIG_NO_SERVICE
413  * This switch turns off service registration.
414  *
415  * @stable ICU 3.2
416  */
417 #ifndef UCONFIG_NO_SERVICE
418 #   define UCONFIG_NO_SERVICE 0
419 #endif
420 
421 /**
422  * \def UCONFIG_HAVE_PARSEALLINPUT
423  * This switch turns on the "parse all input" attribute. Binary incompatible.
424  *
425  * @internal
426  */
427 #ifndef UCONFIG_HAVE_PARSEALLINPUT
428 #   define UCONFIG_HAVE_PARSEALLINPUT 1
429 #endif
430 
431 
432 /**
433  * \def UCONFIG_FORMAT_FASTPATHS_49
434  * This switch turns on other formatting fastpaths. Binary incompatible in object DecimalFormat and DecimalFormatSymbols
435  *
436  * @internal
437  */
438 #ifndef UCONFIG_FORMAT_FASTPATHS_49
439 #   define UCONFIG_FORMAT_FASTPATHS_49 1
440 #endif
441 
442 /**
443  * \def UCONFIG_NO_FILTERED_BREAK_ITERATION
444  * This switch turns off filtered break iteration code.
445  *
446  * @internal
447  */
448 #ifndef UCONFIG_NO_FILTERED_BREAK_ITERATION
449 #   define UCONFIG_NO_FILTERED_BREAK_ITERATION 0
450 #endif
451 
452 #endif
453