]> git.saurik.com Git - apple/icu.git/blob - icuSources/common/unicode/uconfig.h
ICU-66108.tar.gz
[apple/icu.git] / icuSources / common / unicode / uconfig.h
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 * (Apple modifies the default to be 1, not 0)
90 * @internal
91 */
92 #ifndef U_DISABLE_RENAMING
93 #define U_DISABLE_RENAMING 1
94 #endif
95
96 /**
97 * \def U_NO_DEFAULT_INCLUDE_UTF_HEADERS
98 * Determines whether utypes.h includes utf.h, utf8.h, utf16.h and utf_old.h.
99 * utypes.h includes those headers if this macro is defined to 0.
100 * Otherwise, each those headers must be included explicitly when using one of their macros.
101 * Defaults to 0 for backward compatibility, except inside ICU.
102 * @stable ICU 49
103 */
104 #ifdef U_NO_DEFAULT_INCLUDE_UTF_HEADERS
105 /* Use the predefined value. */
106 #elif defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || \
107 defined(U_IO_IMPLEMENTATION) || defined(U_LAYOUT_IMPLEMENTATION) || defined(U_LAYOUTEX_IMPLEMENTATION) || \
108 defined(U_TOOLUTIL_IMPLEMENTATION)
109 # define U_NO_DEFAULT_INCLUDE_UTF_HEADERS 1
110 #else
111 # define U_NO_DEFAULT_INCLUDE_UTF_HEADERS 0
112 #endif
113
114 /**
115 * \def U_OVERRIDE_CXX_ALLOCATION
116 * Determines whether to override new and delete.
117 * ICU is normally built such that all of its C++ classes, via their UMemory base,
118 * override operators new and delete to use its internal, customizable,
119 * non-exception-throwing memory allocation functions. (Default value 1 for this macro.)
120 *
121 * This is especially important when the application and its libraries use multiple heaps.
122 * For example, on Windows, this allows the ICU DLL to be used by
123 * applications that statically link the C Runtime library.
124 *
125 * @stable ICU 2.2
126 */
127 #ifndef U_OVERRIDE_CXX_ALLOCATION
128 #define U_OVERRIDE_CXX_ALLOCATION 1
129 #endif
130
131 /**
132 * \def U_ENABLE_TRACING
133 * Determines whether to enable tracing.
134 * @internal
135 */
136 #ifndef U_ENABLE_TRACING
137 #define U_ENABLE_TRACING 0
138 #endif
139
140 /**
141 * \def UCONFIG_ENABLE_PLUGINS
142 * Determines whether to enable ICU plugins.
143 * @internal
144 */
145 #ifndef UCONFIG_ENABLE_PLUGINS
146 #define UCONFIG_ENABLE_PLUGINS 0
147 #endif
148
149 /**
150 * \def U_ENABLE_DYLOAD
151 * Whether to enable Dynamic loading in ICU.
152 * @internal
153 */
154 #ifndef U_ENABLE_DYLOAD
155 #define U_ENABLE_DYLOAD 1
156 #endif
157
158 /**
159 * \def U_CHECK_DYLOAD
160 * Whether to test Dynamic loading as an OS capability.
161 * @internal
162 */
163 #ifndef U_CHECK_DYLOAD
164 #define U_CHECK_DYLOAD 1
165 #endif
166
167 /**
168 * \def U_DEFAULT_SHOW_DRAFT
169 * Do we allow ICU users to use the draft APIs by default?
170 * @internal
171 */
172 #ifndef U_DEFAULT_SHOW_DRAFT
173 #define U_DEFAULT_SHOW_DRAFT 1
174 #endif
175
176 /*===========================================================================*/
177 /* Custom icu entry point renaming */
178 /*===========================================================================*/
179
180 /**
181 * \def U_HAVE_LIB_SUFFIX
182 * 1 if a custom library suffix is set.
183 * @internal
184 */
185 #ifdef U_HAVE_LIB_SUFFIX
186 /* Use the predefined value. */
187 #elif defined(U_LIB_SUFFIX_C_NAME) || defined(U_IN_DOXYGEN)
188 # define U_HAVE_LIB_SUFFIX 1
189 #endif
190
191 /**
192 * \def U_LIB_SUFFIX_C_NAME_STRING
193 * Defines the library suffix as a string with C syntax.
194 * @internal
195 */
196 #ifdef U_LIB_SUFFIX_C_NAME_STRING
197 /* Use the predefined value. */
198 #elif defined(U_LIB_SUFFIX_C_NAME)
199 # define CONVERT_TO_STRING(s) #s
200 # define U_LIB_SUFFIX_C_NAME_STRING CONVERT_TO_STRING(U_LIB_SUFFIX_C_NAME)
201 #else
202 # define U_LIB_SUFFIX_C_NAME_STRING ""
203 #endif
204
205 /* common/i18n library switches --------------------------------------------- */
206
207 /**
208 * \def UCONFIG_ONLY_COLLATION
209 * This switch turns off modules that are not needed for collation.
210 *
211 * It does not turn off legacy conversion because that is necessary
212 * for ICU to work on EBCDIC platforms (for the default converter).
213 * If you want "only collation" and do not build for EBCDIC,
214 * then you can define UCONFIG_NO_CONVERSION or UCONFIG_NO_LEGACY_CONVERSION to 1 as well.
215 *
216 * @stable ICU 2.4
217 */
218 #ifndef UCONFIG_ONLY_COLLATION
219 # define UCONFIG_ONLY_COLLATION 0
220 #endif
221
222 #if UCONFIG_ONLY_COLLATION
223 /* common library */
224 # define UCONFIG_NO_BREAK_ITERATION 1
225 # define UCONFIG_NO_IDNA 1
226
227 /* i18n library */
228 # if UCONFIG_NO_COLLATION
229 # error Contradictory collation switches in uconfig.h.
230 # endif
231 # define UCONFIG_NO_FORMATTING 1
232 # define UCONFIG_NO_TRANSLITERATION 1
233 # define UCONFIG_NO_REGULAR_EXPRESSIONS 1
234 #endif
235
236 /* common library switches -------------------------------------------------- */
237
238 /**
239 * \def UCONFIG_NO_FILE_IO
240 * This switch turns off all file access in the common library
241 * where file access is only used for data loading.
242 * ICU data must then be provided in the form of a data DLL (or with an
243 * equivalent way to link to the data residing in an executable,
244 * as in building a combined library with both the common library's code and
245 * the data), or via udata_setCommonData().
246 * Application data must be provided via udata_setAppData() or by using
247 * "open" functions that take pointers to data, for example ucol_openBinary().
248 *
249 * File access is not used at all in the i18n library.
250 *
251 * File access cannot be turned off for the icuio library or for the ICU
252 * test suites and ICU tools.
253 *
254 * @stable ICU 3.6
255 */
256 #ifndef UCONFIG_NO_FILE_IO
257 # define UCONFIG_NO_FILE_IO 0
258 #endif
259
260 #if UCONFIG_NO_FILE_IO && defined(U_TIMEZONE_FILES_DIR)
261 # error Contradictory file io switches in uconfig.h.
262 #endif
263
264 /**
265 * \def UCONFIG_NO_CONVERSION
266 * ICU will not completely build (compiling the tools fails) with this
267 * switch turned on.
268 * This switch turns off all converters.
269 *
270 * You may want to use this together with U_CHARSET_IS_UTF8 defined to 1
271 * in utypes.h if char* strings in your environment are always in UTF-8.
272 *
273 * @stable ICU 3.2
274 * @see U_CHARSET_IS_UTF8
275 */
276 #ifndef UCONFIG_NO_CONVERSION
277 # define UCONFIG_NO_CONVERSION 0
278 #endif
279
280 #if UCONFIG_NO_CONVERSION
281 # define UCONFIG_NO_LEGACY_CONVERSION 1
282 #endif
283
284 /**
285 * \def UCONFIG_ONLY_HTML_CONVERSION
286 * This switch turns off all of the converters NOT listed in
287 * the HTML encoding standard:
288 * http://www.w3.org/TR/encoding/#names-and-labels
289 *
290 * This is not possible on EBCDIC platforms
291 * because they need ibm-37 or ibm-1047 default converters.
292 *
293 * @stable ICU 55
294 */
295 #ifndef UCONFIG_ONLY_HTML_CONVERSION
296 # define UCONFIG_ONLY_HTML_CONVERSION 0
297 #endif
298
299 /**
300 * \def UCONFIG_NO_LEGACY_CONVERSION
301 * This switch turns off all converters except for
302 * - Unicode charsets (UTF-7/8/16/32, CESU-8, SCSU, BOCU-1)
303 * - US-ASCII
304 * - ISO-8859-1
305 *
306 * Turning off legacy conversion is not possible on EBCDIC platforms
307 * because they need ibm-37 or ibm-1047 default converters.
308 *
309 * @stable ICU 2.4
310 */
311 #ifndef UCONFIG_NO_LEGACY_CONVERSION
312 # define UCONFIG_NO_LEGACY_CONVERSION 0
313 #endif
314
315 /**
316 * \def UCONFIG_NO_NORMALIZATION
317 * This switch turns off normalization.
318 * It implies turning off several other services as well, for example
319 * collation and IDNA.
320 *
321 * @stable ICU 2.6
322 */
323 #ifndef UCONFIG_NO_NORMALIZATION
324 # define UCONFIG_NO_NORMALIZATION 0
325 #endif
326
327 #if UCONFIG_NO_NORMALIZATION
328 /* common library */
329 /* ICU 50 CJK dictionary BreakIterator uses normalization */
330 # define UCONFIG_NO_BREAK_ITERATION 1
331 /* IDNA (UTS #46) is implemented via normalization */
332 # define UCONFIG_NO_IDNA 1
333
334 /* i18n library */
335 # if UCONFIG_ONLY_COLLATION
336 # error Contradictory collation switches in uconfig.h.
337 # endif
338 # define UCONFIG_NO_COLLATION 1
339 # define UCONFIG_NO_TRANSLITERATION 1
340 #endif
341
342 /**
343 * \def UCONFIG_NO_BREAK_ITERATION
344 * This switch turns off break iteration.
345 *
346 * @stable ICU 2.4
347 */
348 #ifndef UCONFIG_NO_BREAK_ITERATION
349 # define UCONFIG_NO_BREAK_ITERATION 0
350 #endif
351
352 /**
353 * \def UCONFIG_NO_IDNA
354 * This switch turns off IDNA.
355 *
356 * @stable ICU 2.6
357 */
358 #ifndef UCONFIG_NO_IDNA
359 # define UCONFIG_NO_IDNA 0
360 #endif
361
362 /**
363 * \def UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE
364 * Determines the default UMessagePatternApostropheMode.
365 * See the documentation for that enum.
366 *
367 * @stable ICU 4.8
368 */
369 #ifndef UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE
370 # define UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE UMSGPAT_APOS_DOUBLE_OPTIONAL
371 #endif
372
373 /**
374 * \def UCONFIG_USE_WINDOWS_LCID_MAPPING_API
375 * On platforms where U_PLATFORM_HAS_WIN32_API is true, this switch determines
376 * if the Windows platform APIs are used for LCID<->Locale Name conversions.
377 * Otherwise, only the built-in ICU tables are used.
378 *
379 * @internal ICU 64
380 */
381 #ifndef UCONFIG_USE_WINDOWS_LCID_MAPPING_API
382 # define UCONFIG_USE_WINDOWS_LCID_MAPPING_API 1
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 * (Apple modifies the default to be 1, not 0)
431 *
432 * @stable ICU 3.2
433 */
434 #ifndef UCONFIG_NO_SERVICE
435 # define UCONFIG_NO_SERVICE 1
436 #endif
437
438 /**
439 * \def UCONFIG_HAVE_PARSEALLINPUT
440 * This switch turns on the "parse all input" attribute. Binary incompatible.
441 *
442 * @internal
443 */
444 #ifndef UCONFIG_HAVE_PARSEALLINPUT
445 # define UCONFIG_HAVE_PARSEALLINPUT 1
446 #endif
447
448 /**
449 * \def UCONFIG_NO_FILTERED_BREAK_ITERATION
450 * This switch turns off filtered break iteration code.
451 *
452 * @internal
453 */
454 #ifndef UCONFIG_NO_FILTERED_BREAK_ITERATION
455 # define UCONFIG_NO_FILTERED_BREAK_ITERATION 0
456 #endif
457
458 #endif // __UCONFIG_H__