1 #ifndef NU_BUILD_CONFIG_H
2 #define NU_BUILD_CONFIG_H
3 
4 // Hardcoded defines for vendored copy
5 #define NU_WITH_UTF8
6 #define NU_WITH_TOUPPER
7 #define NU_WITH_TOLOWER
8 #define NU_WITH_UNACCENT
9 #define NU_WITH_Z_COLLATION
10 
11 /** @file config.h
12  *
13  * This file list available build options and provide some shortcuts,
14  * like NU_WITH_UTF16 will enable NU_WITH_UTF16LE + NU_WITH_UTF16BE.
15  *
16  * At build time you might set either particular option or shortcut. Either
17  * way you don't have to and shouldn't modify this file, just set build flags
18  * at the environment.
19  *
20  * This file will also enable several dependencies for you: case-mapping
21  * depends on NU_WITH_UDB, NU_UTF8_READER and so.
22  */
23 
24 /* Definitions not covered in this file which should be defined
25  * externally.
26  *
27  * NU_BUILD_STATIC: will change functions visibility to "hidden" (GCC).
28  * @see defines.h
29  *
30  * NU_DISABLE_CONTRACTIONS: disables forward-reading during collation,
31  * only weights of a single codepoints will be compared (enabled in release build)
32  */
33 
34 /* Enable everything, see below for details on a specific option */
35 #ifdef NU_WITH_EVERYTHING
36 # define NU_WITH_UTF8
37 # define NU_WITH_CESU8
38 # define NU_WITH_UTF16
39 # define NU_WITH_UTF16HE
40 # define NU_WITH_UTF32
41 # define NU_WITH_UTF32HE
42 # define NU_WITH_STRINGS
43 # define NU_WITH_EXTRA
44 # define NU_WITH_REVERSE_READ
45 # define NU_WITH_VALIDATION
46 # define NU_WITH_COLLATION
47 # define NU_WITH_CASEMAP
48 # define NU_WITH_UNACCENT
49 #endif /* NU_WITH_EVERYTHING */
50 
51 /* Enable UTF-8 decoding and encoding */
52 #ifdef NU_WITH_UTF8
53 # define NU_WITH_UTF8_READER /* UTF-8 decoding functions */
54 # define NU_WITH_UTF8_WRITER /* UTF-8 encoding functions */
55 #endif /* NU_WITH_UTF8 */
56 
57 /* Enable CESU-8 decoding and encoding */
58 #ifdef NU_WITH_CESU8
59 # define NU_WITH_CESU8_READER
60 # define NU_WITH_CESU8_WRITER
61 #endif /* NU_WITH_CESU8 */
62 
63 /* Enable UTF-16LE decoding and encoding */
64 #ifdef NU_WITH_UTF16LE
65 # define NU_WITH_UTF16LE_READER
66 # define NU_WITH_UTF16LE_WRITER
67 #endif /* NU_WITH_UTF16LE */
68 
69 /* Enable UTF-16BE decoding and encoding */
70 #ifdef NU_WITH_UTF16BE
71 # define NU_WITH_UTF16BE_READER
72 # define NU_WITH_UTF16BE_WRITER
73 #endif /* NU_WITH_UTF16BE */
74 
75 /* Enable UTF-16HE decoding and encoding */
76 #ifdef NU_WITH_UTF16HE
77 # define NU_WITH_UTF16HE_READER
78 # define NU_WITH_UTF16HE_WRITER
79 #endif /* NU_WITH_UTF16HE */
80 
81 /* Enable all UTF-16 options */
82 #ifdef NU_WITH_UTF16
83 # define NU_WITH_UTF16_READER
84 # define NU_WITH_UTF16_WRITER
85 #endif /* NU_WITH_UTF16 */
86 
87 /* Enable UTF-16LE and BE decoders of UTF-16 decoder is requested */
88 #ifdef NU_WITH_UTF16_READER
89 # define NU_WITH_UTF16LE_READER
90 # define NU_WITH_UTF16BE_READER
91 #endif /* NU_WITH_UTF16_READER */
92 
93 /* Enable UTF-16LE and BE encoders of UTF-16 encoder is requested */
94 #ifdef NU_WITH_UTF16_WRITER
95 # define NU_WITH_UTF16LE_WRITER
96 # define NU_WITH_UTF16BE_WRITER
97 #endif /* NU_WITH_UTF16_WRITER */
98 
99 /* Enable UTF-32LE decoding and encoding */
100 #ifdef NU_WITH_UTF32LE
101 # define NU_WITH_UTF32LE_READER
102 # define NU_WITH_UTF32LE_WRITER
103 #endif /* NU_WITH_UTF32LE */
104 
105 /* Enable UTF-32BE decoding and encoding */
106 #ifdef NU_WITH_UTF32BE
107 # define NU_WITH_UTF32BE_READER
108 # define NU_WITH_UTF32BE_WRITER
109 #endif /* NU_WITH_UTF32BE */
110 
111 /* Enable UTF-32HE decoding and encoding */
112 #ifdef NU_WITH_UTF32HE
113 # define NU_WITH_UTF32HE_READER
114 # define NU_WITH_UTF32HE_WRITER
115 #endif /* NU_WITH_UTF32HE */
116 
117 /* Enable all UTF-32 options */
118 #ifdef NU_WITH_UTF32
119 # define NU_WITH_UTF32_READER
120 # define NU_WITH_UTF32_WRITER
121 #endif /* NU_WITH_UTF32 */
122 
123 /* Enable UTF-32LE and BE decoders of UTF-32 decoder is requested */
124 #ifdef NU_WITH_UTF32_READER
125 # define NU_WITH_UTF32LE_READER
126 # define NU_WITH_UTF32BE_READER
127 #endif /* NU_WITH_UTF32_READER */
128 
129 /* Enable UTF-32LE and BE encoders of UTF-32 encoder is requested */
130 #ifdef NU_WITH_UTF32_WRITER
131 # define NU_WITH_UTF32LE_WRITER
132 # define NU_WITH_UTF32BE_WRITER
133 #endif /* NU_WITH_UTF32_WRITER */
134 
135 /* Shortcut for all string functions */
136 #ifdef NU_WITH_STRINGS
137 # define NU_WITH_Z_STRINGS /* 0-terminated string functions */
138 # define NU_WITH_N_STRINGS /* unterminated string functions */
139 #endif /* NU_WITH_STRINGS */
140 
141 /* Shortcut for extra string functions */
142 #ifdef NU_WITH_EXTRA
143 # define NU_WITH_Z_EXTRA /* extra functions for 0-terminated strings */
144 # define NU_WITH_N_EXTRA /* extra functions for unterminated strings */
145 #endif /* NU_WITH_STRINGS */
146 
147 /* Enable collation functions */
148 #ifdef NU_WITH_COLLATION
149 # define NU_WITH_Z_COLLATION /* collation functions for 0-terminated strings */
150 # define NU_WITH_N_COLLATION /* collation functions for unterminated strings */
151 #endif /* NU_WITH_COLLATION */
152 
153 /* Requirements for collation functions on 0-terminated strings */
154 #ifdef NU_WITH_Z_COLLATION
155 # define NU_WITH_Z_STRINGS
156 # define NU_WITH_TOUPPER /* nu_toupper() */
157 #endif
158 
159 /* Requirements for collation functions
160  * on unterminated strings */
161 #ifdef NU_WITH_N_COLLATION
162 # define NU_WITH_N_STRINGS
163 # define NU_WITH_TOUPPER
164 #endif
165 
166 /* Requirements for casemap functions */
167 #ifdef NU_WITH_CASEMAP
168 # define NU_WITH_TOLOWER /* nu_tolower() */
169 # define NU_WITH_TOUPPER
170 # define NU_WITH_TOFOLD
171 #endif /* NU_WITH_CASEMAP */
172 
173 /* More requirements for collation functions all collation functions depends
174  * on NU_WITH_DUCET */
175 #if (defined NU_WITH_Z_COLLATION) || (defined NU_WITH_N_COLLATION)
176 # ifndef NU_WITH_DUCET
177 #  define NU_WITH_DUCET
178 # endif
179 #endif
180 
181 /* All collation and casemapping functions depends on NU_WITH_UDB */
182 #if (defined NU_WITH_Z_COLLATION) || (defined NU_WITH_N_COLLATION) \
183 || (defined NU_WITH_TOLOWER) || (defined NU_WITH_TOUPPER) || (defined NU_WITH_TOFOLD) \
184 || (defined NU_WITH_UNACCENT)
185 # ifndef NU_WITH_UDB
186 #  define NU_WITH_UDB /* nu_udb_* functions, pretty much internal stuff */
187 # endif /* NU_WITH_UDB */
188 #endif
189 
190 /* DUCET implementation depends on NU_WITH_UDB */
191 #ifdef NU_WITH_DUCET
192 #  define NU_WITH_UDB
193 #endif /* NU_WITH_DUCET */
194 
195 /* NU_WITH_UDB depends on NU_WITH_UTF8_READER because internal encoding
196  * of UDB is UTF-8 */
197 #ifdef NU_WITH_UDB
198 #  define NU_WITH_UTF8_READER
199 #endif /* NU_WITH_UDB */
200 
201 #endif /* NU_BUILD_CONFIG_H */
202