]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/chkconf.h
link unicows.lib implicitely when using MSVC and wxUSE_UNICODE_MSLU==1 (thi is used...
[wxWidgets.git] / include / wx / msw / chkconf.h
1 /*
2 * Name: wx/msw/chkconf.h
3 * Purpose: Compiler-specific configuration checking
4 * Author: Julian Smart
5 * Modified by:
6 * Created: 01/02/97
7 * RCS-ID: $Id$
8 * Copyright: (c) Julian Smart
9 * Licence: wxWindows licence
10 */
11
12 /* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
13
14 #ifndef _WX_MSW_CHKCONF_H_
15 #define _WX_MSW_CHKCONF_H_
16
17 /* ensure that MSW-specific settings are defined */
18 #ifndef wxUSE_DC_CACHEING
19 # ifdef wxABORT_ON_CONFIG_ERROR
20 # error "wxUSE_DC_CACHEING must be defined"
21 # else
22 # define wxUSE_DC_CACHEING 1
23 # endif
24 #endif /* wxUSE_DC_CACHEING */
25
26
27 /*
28 * disable the settings which don't work for some compilers
29 */
30
31 /*
32 * If using PostScript-in-MSW in Univ, must enable PostScript
33 */
34 #if defined(__WXUNIVERSAL__) && wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW && !wxUSE_POSTSCRIPT
35 # undef wxUSE_POSTSCRIPT
36 # define wxUSE_POSTSCRIPT 1
37 #endif
38
39 #ifndef wxUSE_NORLANDER_HEADERS
40 # if (defined(__WATCOMC__) && (__WATCOMC__ >= 1200)) || defined(__WINE__) || ((defined(__MINGW32__) || defined(__CYGWIN__)) && ((__GNUC__>2) ||((__GNUC__==2) && (__GNUC_MINOR__>=95))))
41 # define wxUSE_NORLANDER_HEADERS 1
42 # else
43 # define wxUSE_NORLANDER_HEADERS 0
44 # endif
45 #endif
46
47 /*
48 * We don't want to give an error if wxUSE_UNICODE_MSLU is enabled but
49 * wxUSE_UNICODE is not as this would make it impossible to simply set the
50 * former in wx/setup.h as then the library wouldn't compile in non-Unicode
51 * configurations, so instead simply unset it silently when it doesn't make
52 * sense.
53 */
54 #if wxUSE_UNICODE_MSLU && !wxUSE_UNICODE
55 # undef wxUSE_UNICODE_MSLU
56 # define wxUSE_UNICODE_MSLU 0
57 #endif
58
59 /*
60 * All of the settings below require SEH support (__try/__catch) and can't work
61 * without it.
62 */
63 #if !defined(_MSC_VER) && \
64 (!defined(__BORLANDC__) || __BORLANDC__ < 0x0550)
65 # undef wxUSE_ON_FATAL_EXCEPTION
66 # define wxUSE_ON_FATAL_EXCEPTION 0
67
68 # undef wxUSE_CRASHREPORT
69 # define wxUSE_CRASHREPORT 0
70
71 # undef wxUSE_STACKWALKER
72 # define wxUSE_STACKWALKER 0
73 #endif // compiler doesn't support SEH
74
75 /* wxUSE_DEBUG_NEW_ALWAYS doesn't work with CodeWarrior */
76 #if defined(__MWERKS__)
77 # undef wxUSE_DEBUG_NEW_ALWAYS
78 # define wxUSE_DEBUG_NEW_ALWAYS 0
79 #endif
80
81 #if defined(__GNUWIN32__)
82 /* These don't work as expected for mingw32 and cygwin32 */
83 # undef wxUSE_MEMORY_TRACING
84 # define wxUSE_MEMORY_TRACING 0
85
86 # undef wxUSE_GLOBAL_MEMORY_OPERATORS
87 # define wxUSE_GLOBAL_MEMORY_OPERATORS 0
88
89 # undef wxUSE_DEBUG_NEW_ALWAYS
90 # define wxUSE_DEBUG_NEW_ALWAYS 0
91
92 /* some Cygwin versions don't have wcslen */
93 # if defined(__CYGWIN__) || defined(__CYGWIN32__)
94 # if ! ((__GNUC__>2) ||((__GNUC__==2) && (__GNUC_MINOR__>=95)))
95 # undef wxUSE_WCHAR_T
96 # define wxUSE_WCHAR_T 0
97 # endif
98 #endif
99
100 #endif /* __GNUWIN32__ */
101
102 /* wxUSE_MFC is not defined when using configure as it doesn't make sense for
103 gcc or mingw32 anyhow */
104 #ifndef wxUSE_MFC
105 #define wxUSE_MFC 0
106 #endif /* !defined(wxUSE_MFC) */
107
108 /* MFC duplicates these operators */
109 #if wxUSE_MFC
110 # undef wxUSE_GLOBAL_MEMORY_OPERATORS
111 # define wxUSE_GLOBAL_MEMORY_OPERATORS 0
112
113 # undef wxUSE_DEBUG_NEW_ALWAYS
114 # define wxUSE_DEBUG_NEW_ALWAYS 0
115 #endif /* wxUSE_MFC */
116
117 #if (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS)
118 /* GnuWin32 doesn't have appropriate headers for e.g. IUnknown. */
119 # undef wxUSE_DRAG_AND_DROP
120 # define wxUSE_DRAG_AND_DROP 0
121 #endif
122
123 #if !wxUSE_OWNER_DRAWN && !defined(__WXUNIVERSAL__)
124 # undef wxUSE_CHECKLISTBOX
125 # define wxUSE_CHECKLISTBOX 0
126 #endif
127
128 #if wxUSE_SPINCTRL
129 # if !wxUSE_SPINBTN
130 # ifdef wxABORT_ON_CONFIG_ERROR
131 # error "wxSpinCtrl requires wxSpinButton on MSW"
132 # else
133 # undef wxUSE_SPINBTN
134 # define wxUSE_SPINBTN 1
135 # endif
136 # endif
137 #endif
138
139 /*
140 Win64-specific checks.
141 */
142 #ifdef __WIN64__
143 # if wxUSE_STACKWALKER
144 /* this is not currently supported under Win64, volunteers needed to
145 make it work */
146 # undef wxUSE_STACKWALKER
147 # define wxUSE_STACKWALKER 0
148
149 # undef wxUSE_CRASHREPORT
150 # define wxUSE_CRASHREPORT 0
151 # endif
152 #endif /* __WIN64__ */
153
154
155 /*
156 Compiler-specific checks.
157 */
158 #if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
159 /* BC++ 4.0 can't compile JPEG library */
160 # undef wxUSE_LIBJPEG
161 # define wxUSE_LIBJPEG 0
162 #endif
163
164 /* wxUSE_DEBUG_NEW_ALWAYS = 1 not compatible with BC++ in DLL mode */
165 #if defined(__BORLANDC__) && (defined(WXMAKINGDLL) || defined(WXUSINGDLL))
166 # undef wxUSE_DEBUG_NEW_ALWAYS
167 # define wxUSE_DEBUG_NEW_ALWAYS 0
168 #endif
169
170 /* Early Watcom version don't have good enough wide char support */
171 #if defined(__WXMSW__) && (defined(__WATCOMC__) && __WATCOMC__ < 1200)
172 # undef wxUSE_WCHAR_T
173 # define wxUSE_WCHAR_T 0
174 #endif
175
176 /* DMC++ doesn't have definitions for date picker control, so use generic control
177 */
178 #ifdef __DMC__
179 # if wxUSE_DATEPICKCTRL
180 # undef wxUSE_DATEPICKCTRL_GENERIC
181 # undef wxUSE_DATEPICKCTRL
182 # endif
183 # define wxUSE_DATEPICKCTRL 0
184 # define wxUSE_DATEPICKCTRL_GENERIC 1
185 #endif
186
187 #ifndef wxUSE_UNICODE_MSLU
188 # ifdef wxABORT_ON_CONFIG_ERROR
189 # error "wxUSE_UNICODE_MSLU must be defined."
190 # else
191 # define wxUSE_UNICODE_MSLU 0
192 # endif
193 #endif /* wxUSE_UNICODE_MSLU */
194
195 #ifndef wxUSE_UXTHEME
196 # ifdef wxABORT_ON_CONFIG_ERROR
197 # error "wxUSE_UXTHEME must be defined."
198 # else
199 # define wxUSE_UXTHEME 0
200 # endif
201 #endif /* wxUSE_UXTHEME */
202
203 #ifndef wxUSE_UXTHEME_AUTO
204 # ifdef wxABORT_ON_CONFIG_ERROR
205 # error "wxUSE_UXTHEME_AUTO must be defined."
206 # else
207 # define wxUSE_UXTHEME_AUTO 0
208 # endif
209 #endif /* wxUSE_UXTHEME_AUTO */
210
211 #ifndef wxUSE_MS_HTML_HELP
212 # ifdef wxABORT_ON_CONFIG_ERROR
213 # error "wxUSE_MS_HTML_HELP must be defined."
214 # else
215 # define wxUSE_MS_HTML_HELP 0
216 # endif
217 #endif /* !defined(wxUSE_MS_HTML_HELP) */
218
219 #ifndef wxUSE_DIALUP_MANAGER
220 # ifdef wxABORT_ON_CONFIG_ERROR
221 # error "wxUSE_DIALUP_MANAGER must be defined."
222 # else
223 # define wxUSE_DIALUP_MANAGER 0
224 # endif
225 #endif /* !defined(wxUSE_DIALUP_MANAGER) */
226
227 #if !wxUSE_DYNAMIC_LOADER
228 # if wxUSE_MS_HTML_HELP
229 # ifdef wxABORT_ON_CONFIG_ERROR
230 # error "wxUSE_MS_HTML_HELP requires wxUSE_DYNAMIC_LOADER."
231 # else
232 # define wxUSE_DYNAMIC_LOADER 1
233 # endif
234 # endif
235 # if wxUSE_DIALUP_MANAGER
236 # ifdef wxABORT_ON_CONFIG_ERROR
237 # error "wxUSE_DIALUP_MANAGER requires wxUSE_DYNAMIC_LOADER."
238 # else
239 # define wxUSE_DYNAMIC_LOADER 1
240 # endif
241 # endif
242 #endif /* wxUSE_DYNAMIC_LOADER */
243
244
245 /*
246 Finally, although this is not really a configuration check, do it here for
247 now as we'll supplement it with a real consistency check verifying that
248 wxUSE_UNICODE_MSLU corresponds to USE_MSLU in the makefiles. But for MSVC
249 we can do even better: not just check for consistency but even link in the
250 lib ourselves if needed.
251
252 Notice that this is used for DLL wx build, as otherwise we have to do the
253 same for the main executable and not the (static) library. It is done in
254 msvc/wx/setup.h in that case.
255 */
256 #if wxUSE_UNICODE_MSLU && \
257 (defined(WXMAKINGDLL) || \
258 defined(WXMAKINGDLL_NET) || \
259 defined(WXMAKINGDLL_CORE) || \
260 defined(WXMAKINGDLL_ADV) || \
261 defined(WXMAKINGDLL_ODBC) || \
262 defined(WXMAKINGDLL_DBGRID) || \
263 defined(WXMAKINGDLL_HTML) || \
264 defined(WXMAKINGDLL_GL) || \
265 defined(WXMAKINGDLL_XML) || \
266 defined(WXMAKINGDLL_XRC) || \
267 defined(WXMAKINGDLL_MEDIA))
268 // first remove all default libraries
269 #pragma comment(linker, "/nod:kernel32.lib /nod:advapi32.lib /nod:user32.lib /nod:gdi32.lib /nod:shell32.lib /nod:comdlg32.lib /nod:version.lib /nod:mpr.lib /nod:rasapi32.lib /nod:winmm.lib /nod:winspool.lib /nod:vfw32.lib /nod:secur32.lib /nod:oleacc.lib /nod:oledlg.lib /nod:sensapi.lib")
270
271 // then add unicows.lib as the first library
272 #pragma comment(lib, "unicows.lib")
273
274 // and only then re-add back all the other ones
275 #pragma comment(lib, "kernel32.lib")
276 #pragma comment(lib, "user32.lib")
277 #pragma comment(lib, "gdi32.lib")
278 #pragma comment(lib, "winspool.lib")
279 #pragma comment(lib, "comdlg32.lib")
280 #pragma comment(lib, "advapi32.lib")
281 #pragma comment(lib, "shell32.lib")
282 #pragma comment(lib, "oleacc.lib")
283 #endif
284
285 #endif /* _WX_MSW_CHKCONF_H_ */
286