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