]>
Commit | Line | Data |
---|---|---|
1 | dnl --------------------------------------------------------------------------- | |
2 | dnl Author: wxWidgets development team, | |
3 | dnl Francesco Montorsi, | |
4 | dnl Bob McCown (Mac-testing) | |
5 | dnl Creation date: 24/11/2001 | |
6 | dnl --------------------------------------------------------------------------- | |
7 | ||
8 | dnl =========================================================================== | |
9 | dnl Table of Contents of this macro file: | |
10 | dnl ------------------------------------- | |
11 | dnl | |
12 | dnl SECTION A: wxWidgets main macros | |
13 | dnl - WX_CONFIG_OPTIONS | |
14 | dnl - WX_CONFIG_CHECK | |
15 | dnl - WXRC_CHECK | |
16 | dnl - WX_STANDARD_OPTIONS | |
17 | dnl - WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS | |
18 | dnl - WX_DETECT_STANDARD_OPTION_VALUES | |
19 | dnl | |
20 | dnl SECTION B: wxWidgets-related utilities | |
21 | dnl - WX_LIKE_LIBNAME | |
22 | dnl - WX_ARG_ENABLE_YESNOAUTO | |
23 | dnl - WX_ARG_WITH_YESNOAUTO | |
24 | dnl | |
25 | dnl SECTION C: messages to the user | |
26 | dnl - WX_STANDARD_OPTIONS_SUMMARY_MSG | |
27 | dnl - WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN | |
28 | dnl - WX_STANDARD_OPTIONS_SUMMARY_MSG_END | |
29 | dnl - WX_BOOLOPT_SUMMARY | |
30 | dnl | |
31 | dnl The special "WX_DEBUG_CONFIGURE" variable can be set to 1 to enable extra | |
32 | dnl debug output on stdout from these macros. | |
33 | dnl =========================================================================== | |
34 | ||
35 | ||
36 | dnl --------------------------------------------------------------------------- | |
37 | dnl Macros for wxWidgets detection. Typically used in configure.in as: | |
38 | dnl | |
39 | dnl AC_ARG_ENABLE(...) | |
40 | dnl AC_ARG_WITH(...) | |
41 | dnl ... | |
42 | dnl WX_CONFIG_OPTIONS | |
43 | dnl ... | |
44 | dnl ... | |
45 | dnl WX_CONFIG_CHECK([2.6.0], [wxWin=1]) | |
46 | dnl if test "$wxWin" != 1; then | |
47 | dnl AC_MSG_ERROR([ | |
48 | dnl wxWidgets must be installed on your system | |
49 | dnl but wx-config script couldn't be found. | |
50 | dnl | |
51 | dnl Please check that wx-config is in path, the directory | |
52 | dnl where wxWidgets libraries are installed (returned by | |
53 | dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or | |
54 | dnl equivalent variable and wxWidgets version is 2.3.4 or above. | |
55 | dnl ]) | |
56 | dnl fi | |
57 | dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" | |
58 | dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY" | |
59 | dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY" | |
60 | dnl | |
61 | dnl LIBS="$LIBS $WX_LIBS" | |
62 | dnl | |
63 | dnl If you want to support standard --enable-debug/unicode/shared options, you | |
64 | dnl may do the following: | |
65 | dnl | |
66 | dnl ... | |
67 | dnl AC_CANONICAL_SYSTEM | |
68 | dnl | |
69 | dnl # define configure options | |
70 | dnl WX_CONFIG_OPTIONS | |
71 | dnl WX_STANDARD_OPTIONS([debug,unicode,shared,toolkit,wxshared]) | |
72 | dnl | |
73 | dnl # basic configure checks | |
74 | dnl ... | |
75 | dnl | |
76 | dnl # we want to always have DEBUG==WX_DEBUG and UNICODE==WX_UNICODE | |
77 | dnl WX_DEBUG=$DEBUG | |
78 | dnl WX_UNICODE=$UNICODE | |
79 | dnl | |
80 | dnl WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS | |
81 | dnl WX_CONFIG_CHECK([2.8.0], [wxWin=1],,[html,core,net,base],[$WXCONFIG_FLAGS]) | |
82 | dnl WX_DETECT_STANDARD_OPTION_VALUES | |
83 | dnl | |
84 | dnl # write the output files | |
85 | dnl AC_CONFIG_FILES([Makefile ...]) | |
86 | dnl AC_OUTPUT | |
87 | dnl | |
88 | dnl # optional: just to show a message to the user | |
89 | dnl WX_STANDARD_OPTIONS_SUMMARY_MSG | |
90 | dnl | |
91 | dnl --------------------------------------------------------------------------- | |
92 | ||
93 | ||
94 | dnl --------------------------------------------------------------------------- | |
95 | dnl WX_CONFIG_OPTIONS | |
96 | dnl | |
97 | dnl adds support for --wx-prefix, --wx-exec-prefix, --with-wxdir and | |
98 | dnl --wx-config command line options | |
99 | dnl --------------------------------------------------------------------------- | |
100 | ||
101 | AC_DEFUN([WX_CONFIG_OPTIONS], | |
102 | [ | |
103 | AC_ARG_WITH(wxdir, | |
104 | [ --with-wxdir=PATH Use uninstalled version of wxWidgets in PATH], | |
105 | [ wx_config_name="$withval/wx-config" | |
106 | wx_config_args="--inplace"]) | |
107 | AC_ARG_WITH(wx-config, | |
108 | [ --with-wx-config=CONFIG wx-config script to use (optional)], | |
109 | wx_config_name="$withval" ) | |
110 | AC_ARG_WITH(wx-prefix, | |
111 | [ --with-wx-prefix=PREFIX Prefix where wxWidgets is installed (optional)], | |
112 | wx_config_prefix="$withval", wx_config_prefix="") | |
113 | AC_ARG_WITH(wx-exec-prefix, | |
114 | [ --with-wx-exec-prefix=PREFIX | |
115 | Exec prefix where wxWidgets is installed (optional)], | |
116 | wx_config_exec_prefix="$withval", wx_config_exec_prefix="") | |
117 | ]) | |
118 | ||
119 | dnl Helper macro for checking if wx version is at least $1.$2.$3, set's | |
120 | dnl wx_ver_ok=yes if it is: | |
121 | AC_DEFUN([_WX_PRIVATE_CHECK_VERSION], | |
122 | [ | |
123 | wx_ver_ok="" | |
124 | if test "x$WX_VERSION" != x ; then | |
125 | if test $wx_config_major_version -gt $1; then | |
126 | wx_ver_ok=yes | |
127 | else | |
128 | if test $wx_config_major_version -eq $1; then | |
129 | if test $wx_config_minor_version -gt $2; then | |
130 | wx_ver_ok=yes | |
131 | else | |
132 | if test $wx_config_minor_version -eq $2; then | |
133 | if test $wx_config_micro_version -ge $3; then | |
134 | wx_ver_ok=yes | |
135 | fi | |
136 | fi | |
137 | fi | |
138 | fi | |
139 | fi | |
140 | fi | |
141 | ]) | |
142 | ||
143 | dnl --------------------------------------------------------------------------- | |
144 | dnl WX_CONFIG_CHECK(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND | |
145 | dnl [, WX-LIBS [, ADDITIONAL-WX-CONFIG-FLAGS]]]]) | |
146 | dnl | |
147 | dnl Test for wxWidgets, and define WX_C*FLAGS, WX_LIBS and WX_LIBS_STATIC | |
148 | dnl (the latter is for static linking against wxWidgets). Set WX_CONFIG_NAME | |
149 | dnl environment variable to override the default name of the wx-config script | |
150 | dnl to use. Set WX_CONFIG_PATH to specify the full path to wx-config - in this | |
151 | dnl case the macro won't even waste time on tests for its existence. | |
152 | dnl | |
153 | dnl Optional WX-LIBS argument contains comma- or space-separated list of | |
154 | dnl wxWidgets libraries to link against. If it is not specified then WX_LIBS | |
155 | dnl and WX_LIBS_STATIC will contain flags to link with all of the core | |
156 | dnl wxWidgets libraries. | |
157 | dnl | |
158 | dnl Optional ADDITIONAL-WX-CONFIG-FLAGS argument is appended to wx-config | |
159 | dnl invocation command in present. It can be used to fine-tune lookup of | |
160 | dnl best wxWidgets build available. | |
161 | dnl | |
162 | dnl Example use: | |
163 | dnl WX_CONFIG_CHECK([2.6.0], [wxWin=1], [wxWin=0], [html,core,net] | |
164 | dnl [--unicode --debug]) | |
165 | dnl --------------------------------------------------------------------------- | |
166 | ||
167 | dnl | |
168 | dnl Get the cflags and libraries from the wx-config script | |
169 | dnl | |
170 | AC_DEFUN([WX_CONFIG_CHECK], | |
171 | [ | |
172 | dnl do we have wx-config name: it can be wx-config or wxd-config or ... | |
173 | if test x${WX_CONFIG_NAME+set} != xset ; then | |
174 | WX_CONFIG_NAME=wx-config | |
175 | fi | |
176 | ||
177 | if test "x$wx_config_name" != x ; then | |
178 | WX_CONFIG_NAME="$wx_config_name" | |
179 | fi | |
180 | ||
181 | dnl deal with optional prefixes | |
182 | if test x$wx_config_exec_prefix != x ; then | |
183 | wx_config_args="$wx_config_args --exec-prefix=$wx_config_exec_prefix" | |
184 | WX_LOOKUP_PATH="$wx_config_exec_prefix/bin" | |
185 | fi | |
186 | if test x$wx_config_prefix != x ; then | |
187 | wx_config_args="$wx_config_args --prefix=$wx_config_prefix" | |
188 | WX_LOOKUP_PATH="$WX_LOOKUP_PATH:$wx_config_prefix/bin" | |
189 | fi | |
190 | if test "$cross_compiling" = "yes"; then | |
191 | wx_config_args="$wx_config_args --host=$host_alias" | |
192 | fi | |
193 | ||
194 | dnl don't search the PATH if WX_CONFIG_NAME is absolute filename | |
195 | if test -x "$WX_CONFIG_NAME" ; then | |
196 | AC_MSG_CHECKING(for wx-config) | |
197 | WX_CONFIG_PATH="$WX_CONFIG_NAME" | |
198 | AC_MSG_RESULT($WX_CONFIG_PATH) | |
199 | else | |
200 | AC_PATH_PROG(WX_CONFIG_PATH, $WX_CONFIG_NAME, no, "$WX_LOOKUP_PATH:$PATH") | |
201 | fi | |
202 | ||
203 | if test "$WX_CONFIG_PATH" != "no" ; then | |
204 | WX_VERSION="" | |
205 | ||
206 | min_wx_version=ifelse([$1], ,2.2.1,$1) | |
207 | if test -z "$5" ; then | |
208 | AC_MSG_CHECKING([for wxWidgets version >= $min_wx_version]) | |
209 | else | |
210 | AC_MSG_CHECKING([for wxWidgets version >= $min_wx_version ($5)]) | |
211 | fi | |
212 | ||
213 | dnl don't add the libraries ($4) to this variable as this would result in | |
214 | dnl an error when it's used with --version below | |
215 | WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args $5" | |
216 | ||
217 | WX_VERSION=`$WX_CONFIG_WITH_ARGS --version 2>/dev/null` | |
218 | wx_config_major_version=`echo $WX_VERSION | \ | |
219 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
220 | wx_config_minor_version=`echo $WX_VERSION | \ | |
221 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
222 | wx_config_micro_version=`echo $WX_VERSION | \ | |
223 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
224 | ||
225 | wx_requested_major_version=`echo $min_wx_version | \ | |
226 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
227 | wx_requested_minor_version=`echo $min_wx_version | \ | |
228 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
229 | wx_requested_micro_version=`echo $min_wx_version | \ | |
230 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
231 | ||
232 | _WX_PRIVATE_CHECK_VERSION([$wx_requested_major_version], | |
233 | [$wx_requested_minor_version], | |
234 | [$wx_requested_micro_version]) | |
235 | ||
236 | if test -n "$wx_ver_ok"; then | |
237 | AC_MSG_RESULT(yes (version $WX_VERSION)) | |
238 | WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs $4` | |
239 | ||
240 | dnl is this even still appropriate? --static is a real option now | |
241 | dnl and WX_CONFIG_WITH_ARGS is likely to contain it if that is | |
242 | dnl what the user actually wants, making this redundant at best. | |
243 | dnl For now keep it in case anyone actually used it in the past. | |
244 | AC_MSG_CHECKING([for wxWidgets static library]) | |
245 | WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs $4 2>/dev/null` | |
246 | if test "x$WX_LIBS_STATIC" = "x"; then | |
247 | AC_MSG_RESULT(no) | |
248 | else | |
249 | AC_MSG_RESULT(yes) | |
250 | fi | |
251 | ||
252 | dnl starting with version 2.2.6 wx-config has --cppflags argument | |
253 | wx_has_cppflags="" | |
254 | if test $wx_config_major_version -gt 2; then | |
255 | wx_has_cppflags=yes | |
256 | else | |
257 | if test $wx_config_major_version -eq 2; then | |
258 | if test $wx_config_minor_version -gt 2; then | |
259 | wx_has_cppflags=yes | |
260 | else | |
261 | if test $wx_config_minor_version -eq 2; then | |
262 | if test $wx_config_micro_version -ge 6; then | |
263 | wx_has_cppflags=yes | |
264 | fi | |
265 | fi | |
266 | fi | |
267 | fi | |
268 | fi | |
269 | ||
270 | dnl starting with version 2.7.0 wx-config has --rescomp option | |
271 | wx_has_rescomp="" | |
272 | if test $wx_config_major_version -gt 2; then | |
273 | wx_has_rescomp=yes | |
274 | else | |
275 | if test $wx_config_major_version -eq 2; then | |
276 | if test $wx_config_minor_version -ge 7; then | |
277 | wx_has_rescomp=yes | |
278 | fi | |
279 | fi | |
280 | fi | |
281 | if test "x$wx_has_rescomp" = x ; then | |
282 | dnl cannot give any useful info for resource compiler | |
283 | WX_RESCOMP= | |
284 | else | |
285 | WX_RESCOMP=`$WX_CONFIG_WITH_ARGS --rescomp` | |
286 | fi | |
287 | ||
288 | if test "x$wx_has_cppflags" = x ; then | |
289 | dnl no choice but to define all flags like CFLAGS | |
290 | WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags $4` | |
291 | WX_CPPFLAGS=$WX_CFLAGS | |
292 | WX_CXXFLAGS=$WX_CFLAGS | |
293 | ||
294 | WX_CFLAGS_ONLY=$WX_CFLAGS | |
295 | WX_CXXFLAGS_ONLY=$WX_CFLAGS | |
296 | else | |
297 | dnl we have CPPFLAGS included in CFLAGS included in CXXFLAGS | |
298 | WX_CPPFLAGS=`$WX_CONFIG_WITH_ARGS --cppflags $4` | |
299 | WX_CXXFLAGS=`$WX_CONFIG_WITH_ARGS --cxxflags $4` | |
300 | WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags $4` | |
301 | ||
302 | WX_CFLAGS_ONLY=`echo $WX_CFLAGS | sed "s@^$WX_CPPFLAGS *@@"` | |
303 | WX_CXXFLAGS_ONLY=`echo $WX_CXXFLAGS | sed "s@^$WX_CFLAGS *@@"` | |
304 | fi | |
305 | ||
306 | ifelse([$2], , :, [$2]) | |
307 | ||
308 | else | |
309 | ||
310 | if test "x$WX_VERSION" = x; then | |
311 | dnl no wx-config at all | |
312 | AC_MSG_RESULT(no) | |
313 | else | |
314 | AC_MSG_RESULT(no (version $WX_VERSION is not new enough)) | |
315 | fi | |
316 | ||
317 | WX_CFLAGS="" | |
318 | WX_CPPFLAGS="" | |
319 | WX_CXXFLAGS="" | |
320 | WX_LIBS="" | |
321 | WX_LIBS_STATIC="" | |
322 | WX_RESCOMP="" | |
323 | ||
324 | if test ! -z "$5"; then | |
325 | ||
326 | wx_error_message=" | |
327 | The configuration you asked for $PACKAGE_NAME requires a wxWidgets | |
328 | build with the following settings: | |
329 | $5 | |
330 | but such build is not available. | |
331 | ||
332 | To see the wxWidgets builds available on this system, please use | |
333 | 'wx-config --list' command. To use the default build, returned by | |
334 | 'wx-config --selected-config', use the options with their 'auto' | |
335 | default values." | |
336 | ||
337 | fi | |
338 | ||
339 | wx_error_message=" | |
340 | The requested wxWidgets build couldn't be found. | |
341 | $wx_error_message | |
342 | ||
343 | If you still get this error, then check that 'wx-config' is | |
344 | in path, the directory where wxWidgets libraries are installed | |
345 | (returned by 'wx-config --libs' command) is in LD_LIBRARY_PATH | |
346 | or equivalent variable and wxWidgets version is $1 or above." | |
347 | ||
348 | ifelse([$3], , AC_MSG_ERROR([$wx_error_message]), [$3]) | |
349 | ||
350 | fi | |
351 | else | |
352 | ||
353 | WX_CFLAGS="" | |
354 | WX_CPPFLAGS="" | |
355 | WX_CXXFLAGS="" | |
356 | WX_LIBS="" | |
357 | WX_LIBS_STATIC="" | |
358 | WX_RESCOMP="" | |
359 | ||
360 | ifelse([$3], , :, [$3]) | |
361 | ||
362 | fi | |
363 | ||
364 | AC_SUBST(WX_CPPFLAGS) | |
365 | AC_SUBST(WX_CFLAGS) | |
366 | AC_SUBST(WX_CXXFLAGS) | |
367 | AC_SUBST(WX_CFLAGS_ONLY) | |
368 | AC_SUBST(WX_CXXFLAGS_ONLY) | |
369 | AC_SUBST(WX_LIBS) | |
370 | AC_SUBST(WX_LIBS_STATIC) | |
371 | AC_SUBST(WX_VERSION) | |
372 | AC_SUBST(WX_RESCOMP) | |
373 | ||
374 | dnl need to export also WX_VERSION_MINOR and WX_VERSION_MAJOR symbols | |
375 | dnl to support wxpresets bakefiles (we export also WX_VERSION_MICRO for completeness): | |
376 | WX_VERSION_MAJOR="$wx_config_major_version" | |
377 | WX_VERSION_MINOR="$wx_config_minor_version" | |
378 | WX_VERSION_MICRO="$wx_config_micro_version" | |
379 | AC_SUBST(WX_VERSION_MAJOR) | |
380 | AC_SUBST(WX_VERSION_MINOR) | |
381 | AC_SUBST(WX_VERSION_MICRO) | |
382 | ]) | |
383 | ||
384 | dnl --------------------------------------------------------------------------- | |
385 | dnl Get information on the wxrc program for making C++, Python and xrs | |
386 | dnl resource files. | |
387 | dnl | |
388 | dnl AC_ARG_ENABLE(...) | |
389 | dnl AC_ARG_WITH(...) | |
390 | dnl ... | |
391 | dnl WX_CONFIG_OPTIONS | |
392 | dnl ... | |
393 | dnl WX_CONFIG_CHECK(2.6.0, wxWin=1) | |
394 | dnl if test "$wxWin" != 1; then | |
395 | dnl AC_MSG_ERROR([ | |
396 | dnl wxWidgets must be installed on your system | |
397 | dnl but wx-config script couldn't be found. | |
398 | dnl | |
399 | dnl Please check that wx-config is in path, the directory | |
400 | dnl where wxWidgets libraries are installed (returned by | |
401 | dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or | |
402 | dnl equivalent variable and wxWidgets version is 2.6.0 or above. | |
403 | dnl ]) | |
404 | dnl fi | |
405 | dnl | |
406 | dnl WXRC_CHECK([HAVE_WXRC=1], [HAVE_WXRC=0]) | |
407 | dnl if test "x$HAVE_WXRC" != x1; then | |
408 | dnl AC_MSG_ERROR([ | |
409 | dnl The wxrc program was not installed or not found. | |
410 | dnl | |
411 | dnl Please check the wxWidgets installation. | |
412 | dnl ]) | |
413 | dnl fi | |
414 | dnl | |
415 | dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" | |
416 | dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY" | |
417 | dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY" | |
418 | dnl | |
419 | dnl LDFLAGS="$LDFLAGS $WX_LIBS" | |
420 | dnl --------------------------------------------------------------------------- | |
421 | ||
422 | dnl --------------------------------------------------------------------------- | |
423 | dnl WXRC_CHECK([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) | |
424 | dnl | |
425 | dnl Test for wxWidgets' wxrc program for creating either C++, Python or XRS | |
426 | dnl resources. The variable WXRC will be set and substituted in the configure | |
427 | dnl script and Makefiles. | |
428 | dnl | |
429 | dnl Example use: | |
430 | dnl WXRC_CHECK([wxrc=1], [wxrc=0]) | |
431 | dnl --------------------------------------------------------------------------- | |
432 | ||
433 | dnl | |
434 | dnl wxrc program from the wx-config script | |
435 | dnl | |
436 | AC_DEFUN([WXRC_CHECK], | |
437 | [ | |
438 | AC_ARG_VAR([WXRC], [Path to wxWidget's wxrc resource compiler]) | |
439 | ||
440 | if test "x$WX_CONFIG_NAME" = x; then | |
441 | AC_MSG_ERROR([The wxrc tests must run after wxWidgets test.]) | |
442 | else | |
443 | ||
444 | AC_MSG_CHECKING([for wxrc]) | |
445 | ||
446 | if test "x$WXRC" = x ; then | |
447 | dnl wx-config --utility is a new addition to wxWidgets: | |
448 | _WX_PRIVATE_CHECK_VERSION(2,5,3) | |
449 | if test -n "$wx_ver_ok"; then | |
450 | WXRC=`$WX_CONFIG_WITH_ARGS --utility=wxrc` | |
451 | fi | |
452 | fi | |
453 | ||
454 | if test "x$WXRC" = x ; then | |
455 | AC_MSG_RESULT([not found]) | |
456 | ifelse([$2], , :, [$2]) | |
457 | else | |
458 | AC_MSG_RESULT([$WXRC]) | |
459 | ifelse([$1], , :, [$1]) | |
460 | fi | |
461 | ||
462 | AC_SUBST(WXRC) | |
463 | fi | |
464 | ]) | |
465 | ||
466 | dnl --------------------------------------------------------------------------- | |
467 | dnl WX_LIKE_LIBNAME([output-var] [prefix], [name]) | |
468 | dnl | |
469 | dnl Sets the "output-var" variable to the name of a library named with same | |
470 | dnl wxWidgets rule. | |
471 | dnl E.g. for output-var=='lib', name=='test', prefix='mine', sets | |
472 | dnl the $lib variable to: | |
473 | dnl 'mine_gtk2ud_test-2.8' | |
474 | dnl if WX_PORT=gtk2, WX_UNICODE=1, WX_DEBUG=1 and WX_RELEASE=28 | |
475 | dnl --------------------------------------------------------------------------- | |
476 | AC_DEFUN([WX_LIKE_LIBNAME], | |
477 | [ | |
478 | wx_temp="$2""_""$WX_PORT" | |
479 | ||
480 | dnl add the [u][d] string | |
481 | if test "$WX_UNICODE" = "1"; then | |
482 | wx_temp="$wx_temp""u" | |
483 | fi | |
484 | if test "$WX_DEBUG" = "1"; then | |
485 | wx_temp="$wx_temp""d" | |
486 | fi | |
487 | ||
488 | dnl complete the name of the lib | |
489 | wx_temp="$wx_temp""_""$3""-$WX_VERSION_MAJOR.$WX_VERSION_MINOR" | |
490 | ||
491 | dnl save it in the user's variable | |
492 | $1=$wx_temp | |
493 | ]) | |
494 | ||
495 | dnl --------------------------------------------------------------------------- | |
496 | dnl WX_ARG_ENABLE_YESNOAUTO/WX_ARG_WITH_YESNOAUTO | |
497 | dnl | |
498 | dnl Two little custom macros which define the ENABLE/WITH configure arguments. | |
499 | dnl Macro arguments: | |
500 | dnl $1 = the name of the --enable / --with feature | |
501 | dnl $2 = the name of the variable associated | |
502 | dnl $3 = the description of that feature | |
503 | dnl $4 = the default value for that feature | |
504 | dnl $5 = additional action to do in case option is given with "yes" value | |
505 | dnl --------------------------------------------------------------------------- | |
506 | AC_DEFUN([WX_ARG_ENABLE_YESNOAUTO], | |
507 | [AC_ARG_ENABLE($1, | |
508 | AC_HELP_STRING([--enable-$1], [$3 (default is $4)]), | |
509 | [], [enableval="$4"]) | |
510 | ||
511 | dnl Show a message to the user about this option | |
512 | AC_MSG_CHECKING([for the --enable-$1 option]) | |
513 | if test "$enableval" = "yes" ; then | |
514 | AC_MSG_RESULT([yes]) | |
515 | $2=1 | |
516 | $5 | |
517 | elif test "$enableval" = "no" ; then | |
518 | AC_MSG_RESULT([no]) | |
519 | $2=0 | |
520 | elif test "$enableval" = "auto" ; then | |
521 | AC_MSG_RESULT([will be automatically detected]) | |
522 | $2="auto" | |
523 | else | |
524 | AC_MSG_ERROR([ | |
525 | Unrecognized option value (allowed values: yes, no, auto) | |
526 | ]) | |
527 | fi | |
528 | ]) | |
529 | ||
530 | AC_DEFUN([WX_ARG_WITH_YESNOAUTO], | |
531 | [AC_ARG_WITH($1, | |
532 | AC_HELP_STRING([--with-$1], [$3 (default is $4)]), | |
533 | [], [withval="$4"]) | |
534 | ||
535 | dnl Show a message to the user about this option | |
536 | AC_MSG_CHECKING([for the --with-$1 option]) | |
537 | if test "$withval" = "yes" ; then | |
538 | AC_MSG_RESULT([yes]) | |
539 | $2=1 | |
540 | $5 | |
541 | dnl NB: by default we don't allow --with-$1=no option | |
542 | dnl since it does not make much sense ! | |
543 | elif test "$6" = "1" -a "$withval" = "no" ; then | |
544 | AC_MSG_RESULT([no]) | |
545 | $2=0 | |
546 | elif test "$withval" = "auto" ; then | |
547 | AC_MSG_RESULT([will be automatically detected]) | |
548 | $2="auto" | |
549 | else | |
550 | AC_MSG_ERROR([ | |
551 | Unrecognized option value (allowed values: yes, auto) | |
552 | ]) | |
553 | fi | |
554 | ]) | |
555 | ||
556 | ||
557 | dnl --------------------------------------------------------------------------- | |
558 | dnl WX_STANDARD_OPTIONS([options-to-add]) | |
559 | dnl | |
560 | dnl Adds to the configure script one or more of the following options: | |
561 | dnl --enable-[debug|unicode|shared|wxshared|wxdebug] | |
562 | dnl --with-[gtk|msw|motif|x11|mac|dfb] | |
563 | dnl --with-wxversion | |
564 | dnl Then checks for their presence and eventually set the DEBUG, UNICODE, SHARED, | |
565 | dnl PORT, WX_SHARED, WX_DEBUG, variables to one of the "yes", "no", "auto" values. | |
566 | dnl | |
567 | dnl Note that e.g. UNICODE != WX_UNICODE; the first is the value of the | |
568 | dnl --enable-unicode option (in boolean format) while the second indicates | |
569 | dnl if wxWidgets was built in Unicode mode (and still is in boolean format). | |
570 | dnl --------------------------------------------------------------------------- | |
571 | AC_DEFUN([WX_STANDARD_OPTIONS], | |
572 | [ | |
573 | ||
574 | dnl the following lines will expand to WX_ARG_ENABLE_YESNOAUTO calls if and only if | |
575 | dnl the $1 argument contains respectively the debug,unicode or shared options. | |
576 | ||
577 | dnl be careful here not to set debug flag if only "wxdebug" was specified | |
578 | ifelse(regexp([$1], [\bdebug]), [-1],, | |
579 | [WX_ARG_ENABLE_YESNOAUTO([debug], [DEBUG], [Build in debug mode], [auto])]) | |
580 | ||
581 | ifelse(index([$1], [unicode]), [-1],, | |
582 | [WX_ARG_ENABLE_YESNOAUTO([unicode], [UNICODE], [Build in Unicode mode], [auto])]) | |
583 | ||
584 | ifelse(regexp([$1], [\bshared]), [-1],, | |
585 | [WX_ARG_ENABLE_YESNOAUTO([shared], [SHARED], [Build as shared library], [auto])]) | |
586 | ||
587 | dnl WX_ARG_WITH_YESNOAUTO cannot be used for --with-toolkit since it's an option | |
588 | dnl which must be able to accept the auto|gtk1|gtk2|msw|... values | |
589 | ifelse(index([$1], [toolkit]), [-1],, | |
590 | [ | |
591 | AC_ARG_WITH([toolkit], | |
592 | AC_HELP_STRING([--with-toolkit], | |
593 | [Build against a specific wxWidgets toolkit (default is auto)]), | |
594 | [], [withval="auto"]) | |
595 | ||
596 | dnl Show a message to the user about this option | |
597 | AC_MSG_CHECKING([for the --with-toolkit option]) | |
598 | if test "$withval" = "auto" ; then | |
599 | AC_MSG_RESULT([will be automatically detected]) | |
600 | TOOLKIT="auto" | |
601 | else | |
602 | TOOLKIT="$withval" | |
603 | ||
604 | dnl PORT must be one of the allowed values | |
605 | if test "$TOOLKIT" != "gtk1" -a "$TOOLKIT" != "gtk2" -a \ | |
606 | "$TOOLKIT" != "msw" -a "$TOOLKIT" != "motif" -a \ | |
607 | "$TOOLKIT" != "osx_carbon" -a "$TOOLKIT" != "osx_cocoa" -a \ | |
608 | "$TOOLKIT" != "dfb" -a "$TOOLKIT" != "x11"; then | |
609 | AC_MSG_ERROR([ | |
610 | Unrecognized option value (allowed values: auto, gtk1, gtk2, msw, motif, osx_carbon, osx_cocoa, dfb, x11) | |
611 | ]) | |
612 | fi | |
613 | ||
614 | AC_MSG_RESULT([$TOOLKIT]) | |
615 | fi | |
616 | ]) | |
617 | ||
618 | dnl ****** IMPORTANT ******* | |
619 | dnl Unlike for the UNICODE setting, you can build your program in | |
620 | dnl shared mode against a static build of wxWidgets. Thus we have the | |
621 | dnl following option which allows these mixtures. E.g. | |
622 | dnl | |
623 | dnl ./configure --disable-shared --with-wxshared | |
624 | dnl | |
625 | dnl will build your library in static mode against the first available | |
626 | dnl shared build of wxWidgets. | |
627 | dnl | |
628 | dnl Note that's not possible to do the viceversa: | |
629 | dnl | |
630 | dnl ./configure --enable-shared --without-wxshared | |
631 | dnl | |
632 | dnl Doing so you would try to build your library in shared mode against a static | |
633 | dnl build of wxWidgets. This is not possible (you would mix PIC and non PIC code) ! | |
634 | dnl A check for this combination of options is in WX_DETECT_STANDARD_OPTION_VALUES | |
635 | dnl (where we know what 'auto' should be expanded to). | |
636 | dnl | |
637 | dnl If you try to build something in ANSI mode against a UNICODE build | |
638 | dnl of wxWidgets or in RELEASE mode against a DEBUG build of wxWidgets, | |
639 | dnl then at best you'll get ton of linking errors ! | |
640 | dnl ************************ | |
641 | ||
642 | ifelse(index([$1], [wxshared]), [-1],, | |
643 | [ | |
644 | WX_ARG_WITH_YESNOAUTO( | |
645 | [wxshared], [WX_SHARED], | |
646 | [Force building against a shared build of wxWidgets, even if --disable-shared is given], | |
647 | [auto], [], [1]) | |
648 | ]) | |
649 | ||
650 | dnl Just like for SHARED and WX_SHARED it may happen that some adventurous | |
651 | dnl peoples will want to mix a wxWidgets release build with a debug build of | |
652 | dnl his app/lib. So, we have both DEBUG and WX_DEBUG variables. | |
653 | ifelse(index([$1], [wxdebug]), [-1],, | |
654 | [ | |
655 | WX_ARG_WITH_YESNOAUTO( | |
656 | [wxdebug], [WX_DEBUG], | |
657 | [Force building against a debug build of wxWidgets, even if --disable-debug is given], | |
658 | [auto], [], [1]) | |
659 | ]) | |
660 | ||
661 | dnl WX_ARG_WITH_YESNOAUTO cannot be used for --with-wxversion since it's an option | |
662 | dnl which accepts the "auto|2.6|2.7|2.8|2.9|3.0" etc etc values | |
663 | ifelse(index([$1], [wxversion]), [-1],, | |
664 | [ | |
665 | AC_ARG_WITH([wxversion], | |
666 | AC_HELP_STRING([--with-wxversion], | |
667 | [Build against a specific version of wxWidgets (default is auto)]), | |
668 | [], [withval="auto"]) | |
669 | ||
670 | dnl Show a message to the user about this option | |
671 | AC_MSG_CHECKING([for the --with-wxversion option]) | |
672 | if test "$withval" = "auto" ; then | |
673 | AC_MSG_RESULT([will be automatically detected]) | |
674 | WX_RELEASE="auto" | |
675 | else | |
676 | ||
677 | wx_requested_major_version=`echo $withval | \ | |
678 | sed 's/\([[0-9]]*\).\([[0-9]]*\).*/\1/'` | |
679 | wx_requested_minor_version=`echo $withval | \ | |
680 | sed 's/\([[0-9]]*\).\([[0-9]]*\).*/\2/'` | |
681 | ||
682 | dnl both vars above must be exactly 1 digit | |
683 | if test "${#wx_requested_major_version}" != "1" -o \ | |
684 | "${#wx_requested_minor_version}" != "1" ; then | |
685 | AC_MSG_ERROR([ | |
686 | Unrecognized option value (allowed values: auto, 2.6, 2.7, 2.8, 2.9, 3.0) | |
687 | ]) | |
688 | fi | |
689 | ||
690 | WX_RELEASE="$wx_requested_major_version"".""$wx_requested_minor_version" | |
691 | AC_MSG_RESULT([$WX_RELEASE]) | |
692 | fi | |
693 | ]) | |
694 | ||
695 | if test "$WX_DEBUG_CONFIGURE" = "1"; then | |
696 | echo "[[dbg]] DEBUG: $DEBUG, WX_DEBUG: $WX_DEBUG" | |
697 | echo "[[dbg]] UNICODE: $UNICODE, WX_UNICODE: $WX_UNICODE" | |
698 | echo "[[dbg]] SHARED: $SHARED, WX_SHARED: $WX_SHARED" | |
699 | echo "[[dbg]] TOOLKIT: $TOOLKIT, WX_TOOLKIT: $WX_TOOLKIT" | |
700 | echo "[[dbg]] VERSION: $VERSION, WX_RELEASE: $WX_RELEASE" | |
701 | fi | |
702 | ]) | |
703 | ||
704 | ||
705 | dnl --------------------------------------------------------------------------- | |
706 | dnl WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS | |
707 | dnl | |
708 | dnl Sets the WXCONFIG_FLAGS string using the SHARED,DEBUG,UNICODE variable values | |
709 | dnl which are different from "auto". | |
710 | dnl Thus this macro needs to be called only once all options have been set. | |
711 | dnl --------------------------------------------------------------------------- | |
712 | AC_DEFUN([WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS], | |
713 | [ | |
714 | if test "$WX_SHARED" = "1" ; then | |
715 | WXCONFIG_FLAGS="--static=no " | |
716 | elif test "$WX_SHARED" = "0" ; then | |
717 | WXCONFIG_FLAGS="--static=yes " | |
718 | fi | |
719 | ||
720 | if test "$WX_DEBUG" = "1" ; then | |
721 | WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--debug=yes " | |
722 | elif test "$WX_DEBUG" = "0" ; then | |
723 | WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--debug=no " | |
724 | fi | |
725 | ||
726 | dnl The user should have set WX_UNICODE=UNICODE | |
727 | if test "$WX_UNICODE" = "1" ; then | |
728 | WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--unicode=yes " | |
729 | elif test "$WX_UNICODE" = "0" ; then | |
730 | WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--unicode=no " | |
731 | fi | |
732 | ||
733 | if test "$TOOLKIT" != "auto" ; then | |
734 | WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--toolkit=$TOOLKIT " | |
735 | fi | |
736 | ||
737 | if test "$WX_RELEASE" != "auto" ; then | |
738 | WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--version=$WX_RELEASE " | |
739 | fi | |
740 | ||
741 | dnl strip out the last space of the string | |
742 | WXCONFIG_FLAGS=${WXCONFIG_FLAGS% } | |
743 | ||
744 | if test "$WX_DEBUG_CONFIGURE" = "1"; then | |
745 | echo "[[dbg]] WXCONFIG_FLAGS: $WXCONFIG_FLAGS" | |
746 | fi | |
747 | ]) | |
748 | ||
749 | ||
750 | dnl --------------------------------------------------------------------------- | |
751 | dnl _WX_SELECTEDCONFIG_CHECKFOR([RESULTVAR], [STRING], [MSG] | |
752 | dnl [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) | |
753 | dnl | |
754 | dnl Outputs the given MSG. Then searches the given STRING in the wxWidgets | |
755 | dnl additional CPP flags and put the result of the search in WX_$RESULTVAR | |
756 | dnl also adding the "yes" or "no" message result to MSG. | |
757 | dnl --------------------------------------------------------------------------- | |
758 | AC_DEFUN([_WX_SELECTEDCONFIG_CHECKFOR], | |
759 | [ | |
760 | if test "$$1" = "auto" ; then | |
761 | ||
762 | dnl The user does not have particular preferences for this option; | |
763 | dnl so we will detect the wxWidgets relative build setting and use it | |
764 | AC_MSG_CHECKING([$3]) | |
765 | ||
766 | dnl set WX_$1 variable to 1 if the $WX_SELECTEDCONFIG contains the $2 | |
767 | dnl string or to 0 otherwise. | |
768 | dnl NOTE: 'expr match STRING REGEXP' cannot be used since on Mac it | |
769 | dnl doesn't work; we use 'expr STRING : REGEXP' instead | |
770 | WX_$1=$(expr "$WX_SELECTEDCONFIG" : ".*$2.*") | |
771 | ||
772 | if test "$WX_$1" != "0"; then | |
773 | WX_$1=1 | |
774 | AC_MSG_RESULT([yes]) | |
775 | ifelse([$4], , :, [$4]) | |
776 | else | |
777 | WX_$1=0 | |
778 | AC_MSG_RESULT([no]) | |
779 | ifelse([$5], , :, [$5]) | |
780 | fi | |
781 | else | |
782 | ||
783 | dnl Use the setting given by the user | |
784 | WX_$1=$$1 | |
785 | fi | |
786 | ]) | |
787 | ||
788 | dnl --------------------------------------------------------------------------- | |
789 | dnl WX_DETECT_STANDARD_OPTION_VALUES | |
790 | dnl | |
791 | dnl Detects the values of the following variables: | |
792 | dnl 1) WX_RELEASE | |
793 | dnl 2) WX_UNICODE | |
794 | dnl 3) WX_DEBUG | |
795 | dnl 4) WX_SHARED (and also WX_STATIC) | |
796 | dnl 5) WX_PORT | |
797 | dnl from the previously selected wxWidgets build; this macro in fact must be | |
798 | dnl called *after* calling the WX_CONFIG_CHECK macro. | |
799 | dnl | |
800 | dnl Note that the WX_VERSION_MAJOR, WX_VERSION_MINOR symbols are already set | |
801 | dnl by WX_CONFIG_CHECK macro | |
802 | dnl --------------------------------------------------------------------------- | |
803 | AC_DEFUN([WX_DETECT_STANDARD_OPTION_VALUES], | |
804 | [ | |
805 | dnl IMPORTANT: WX_VERSION contains all three major.minor.micro digits, | |
806 | dnl while WX_RELEASE only the major.minor ones. | |
807 | WX_RELEASE="$WX_VERSION_MAJOR""$WX_VERSION_MINOR" | |
808 | if test $WX_RELEASE -lt 26 ; then | |
809 | ||
810 | AC_MSG_ERROR([ | |
811 | Cannot detect the wxWidgets configuration for the selected wxWidgets build | |
812 | since its version is $WX_VERSION < 2.6.0; please install a newer | |
813 | version of wxWidgets. | |
814 | ]) | |
815 | fi | |
816 | ||
817 | dnl The wx-config we are using understands the "--selected_config" | |
818 | dnl option which returns an easy-parseable string ! | |
819 | WX_SELECTEDCONFIG=$($WX_CONFIG_WITH_ARGS --selected_config) | |
820 | ||
821 | if test "$WX_DEBUG_CONFIGURE" = "1"; then | |
822 | echo "[[dbg]] Using wx-config --selected-config" | |
823 | echo "[[dbg]] WX_SELECTEDCONFIG: $WX_SELECTEDCONFIG" | |
824 | fi | |
825 | ||
826 | ||
827 | dnl we could test directly for WX_SHARED with a line like: | |
828 | dnl _WX_SELECTEDCONFIG_CHECKFOR([SHARED], [shared], | |
829 | dnl [if wxWidgets was built in SHARED mode]) | |
830 | dnl but wx-config --selected-config DOES NOT outputs the 'shared' | |
831 | dnl word when wx was built in shared mode; it rather outputs the | |
832 | dnl 'static' word when built in static mode. | |
833 | if test $WX_SHARED = "1"; then | |
834 | STATIC=0 | |
835 | elif test $WX_SHARED = "0"; then | |
836 | STATIC=1 | |
837 | elif test $WX_SHARED = "auto"; then | |
838 | STATIC="auto" | |
839 | fi | |
840 | ||
841 | dnl Now set the WX_UNICODE, WX_DEBUG, WX_STATIC variables | |
842 | _WX_SELECTEDCONFIG_CHECKFOR([UNICODE], [unicode], | |
843 | [if wxWidgets was built with UNICODE enabled]) | |
844 | _WX_SELECTEDCONFIG_CHECKFOR([DEBUG], [debug], | |
845 | [if wxWidgets was built in DEBUG mode]) | |
846 | _WX_SELECTEDCONFIG_CHECKFOR([STATIC], [static], | |
847 | [if wxWidgets was built in STATIC mode]) | |
848 | ||
849 | dnl init WX_SHARED from WX_STATIC | |
850 | if test "$WX_STATIC" != "0"; then | |
851 | WX_SHARED=0 | |
852 | else | |
853 | WX_SHARED=1 | |
854 | fi | |
855 | ||
856 | AC_SUBST(WX_UNICODE) | |
857 | AC_SUBST(WX_DEBUG) | |
858 | AC_SUBST(WX_SHARED) | |
859 | ||
860 | dnl detect the WX_PORT to use | |
861 | if test "$TOOLKIT" = "auto" ; then | |
862 | ||
863 | dnl The user does not have particular preferences for this option; | |
864 | dnl so we will detect the wxWidgets relative build setting and use it | |
865 | AC_MSG_CHECKING([which wxWidgets toolkit was selected]) | |
866 | ||
867 | WX_GTKPORT1=$(expr "$WX_SELECTEDCONFIG" : ".*gtk1.*") | |
868 | WX_GTKPORT2=$(expr "$WX_SELECTEDCONFIG" : ".*gtk2.*") | |
869 | WX_MSWPORT=$(expr "$WX_SELECTEDCONFIG" : ".*msw.*") | |
870 | WX_MOTIFPORT=$(expr "$WX_SELECTEDCONFIG" : ".*motif.*") | |
871 | WX_OSXCOCOAPORT=$(expr "$WX_SELECTEDCONFIG" : ".*osx_cocoa.*") | |
872 | WX_OSXCARBONPORT=$(expr "$WX_SELECTEDCONFIG" : ".*osx_carbon.*") | |
873 | WX_X11PORT=$(expr "$WX_SELECTEDCONFIG" : ".*x11.*") | |
874 | WX_DFBPORT=$(expr "$WX_SELECTEDCONFIG" : ".*dfb.*") | |
875 | ||
876 | WX_PORT="unknown" | |
877 | if test "$WX_GTKPORT1" != "0"; then WX_PORT="gtk1"; fi | |
878 | if test "$WX_GTKPORT2" != "0"; then WX_PORT="gtk2"; fi | |
879 | if test "$WX_MSWPORT" != "0"; then WX_PORT="msw"; fi | |
880 | if test "$WX_MOTIFPORT" != "0"; then WX_PORT="motif"; fi | |
881 | if test "$WX_OSXCOCOAPORT" != "0"; then WX_PORT="osx_cocoa"; fi | |
882 | if test "$WX_OSXCARBONPORT" != "0"; then WX_PORT="osx_carbon"; fi | |
883 | if test "$WX_X11PORT" != "0"; then WX_PORT="x11"; fi | |
884 | if test "$WX_DFBPORT" != "0"; then WX_PORT="dfb"; fi | |
885 | ||
886 | dnl NOTE: backward-compatible check for wx2.8; in wx2.9 the mac | |
887 | dnl ports are called 'osx_cocoa' and 'osx_carbon' (see above) | |
888 | WX_MACPORT=$(expr "$WX_SELECTEDCONFIG" : ".*mac.*") | |
889 | if test "$WX_MACPORT" != "0"; then WX_PORT="mac"; fi | |
890 | ||
891 | dnl check at least one of the WX_*PORT has been set ! | |
892 | ||
893 | if test "$WX_PORT" = "unknown" ; then | |
894 | AC_MSG_ERROR([ | |
895 | Cannot detect the currently installed wxWidgets port ! | |
896 | Please check your 'wx-config --cxxflags'... | |
897 | ]) | |
898 | fi | |
899 | ||
900 | AC_MSG_RESULT([$WX_PORT]) | |
901 | else | |
902 | ||
903 | dnl Use the setting given by the user | |
904 | if test -z "$TOOLKIT" ; then | |
905 | WX_PORT=$TOOLKIT | |
906 | else | |
907 | dnl try with PORT | |
908 | WX_PORT=$PORT | |
909 | fi | |
910 | fi | |
911 | ||
912 | AC_SUBST(WX_PORT) | |
913 | ||
914 | if test "$WX_DEBUG_CONFIGURE" = "1"; then | |
915 | echo "[[dbg]] Values of all WX_* options after final detection:" | |
916 | echo "[[dbg]] WX_DEBUG: $WX_DEBUG" | |
917 | echo "[[dbg]] WX_UNICODE: $WX_UNICODE" | |
918 | echo "[[dbg]] WX_SHARED: $WX_SHARED" | |
919 | echo "[[dbg]] WX_RELEASE: $WX_RELEASE" | |
920 | echo "[[dbg]] WX_PORT: $WX_PORT" | |
921 | fi | |
922 | ||
923 | dnl Avoid problem described in the WX_STANDARD_OPTIONS which happens when | |
924 | dnl the user gives the options: | |
925 | dnl ./configure --enable-shared --without-wxshared | |
926 | dnl or just do | |
927 | dnl ./configure --enable-shared | |
928 | dnl but there is only a static build of wxWidgets available. | |
929 | if test "$WX_SHARED" = "0" -a "$SHARED" = "1"; then | |
930 | AC_MSG_ERROR([ | |
931 | Cannot build shared library against a static build of wxWidgets ! | |
932 | This error happens because the wxWidgets build which was selected | |
933 | has been detected as static while you asked to build $PACKAGE_NAME | |
934 | as shared library and this is not possible. | |
935 | Use the '--disable-shared' option to build $PACKAGE_NAME | |
936 | as static library or '--with-wxshared' to use wxWidgets as shared library. | |
937 | ]) | |
938 | fi | |
939 | ||
940 | dnl now we can finally update the DEBUG,UNICODE,SHARED options | |
941 | dnl to their final values if they were set to 'auto' | |
942 | if test "$DEBUG" = "auto"; then | |
943 | DEBUG=$WX_DEBUG | |
944 | fi | |
945 | if test "$UNICODE" = "auto"; then | |
946 | UNICODE=$WX_UNICODE | |
947 | fi | |
948 | if test "$SHARED" = "auto"; then | |
949 | SHARED=$WX_SHARED | |
950 | fi | |
951 | if test "$TOOLKIT" = "auto"; then | |
952 | TOOLKIT=$WX_PORT | |
953 | fi | |
954 | ||
955 | dnl in case the user needs a BUILD=debug/release var... | |
956 | if test "$DEBUG" = "1"; then | |
957 | BUILD="debug" | |
958 | elif test "$DEBUG" = "0" -o "$DEBUG" = ""; then | |
959 | BUILD="release" | |
960 | fi | |
961 | ||
962 | dnl respect the DEBUG variable adding the optimize/debug flags | |
963 | dnl NOTE: the CXXFLAGS are merged together with the CPPFLAGS so we | |
964 | dnl don't need to set them, too | |
965 | if test "$DEBUG" = "1"; then | |
966 | CXXFLAGS="$CXXFLAGS -g -O0" | |
967 | CFLAGS="$CFLAGS -g -O0" | |
968 | else | |
969 | CXXFLAGS="$CXXFLAGS -O2" | |
970 | CFLAGS="$CFLAGS -O2" | |
971 | fi | |
972 | ]) | |
973 | ||
974 | dnl --------------------------------------------------------------------------- | |
975 | dnl WX_BOOLOPT_SUMMARY([name of the boolean variable to show summary for], | |
976 | dnl [what to print when var is 1], | |
977 | dnl [what to print when var is 0]) | |
978 | dnl | |
979 | dnl Prints $2 when variable $1 == 1 and prints $3 when variable $1 == 0. | |
980 | dnl This macro mainly exists just to make configure.ac scripts more readable. | |
981 | dnl | |
982 | dnl NOTE: you need to use the [" my message"] syntax for 2nd and 3rd arguments | |
983 | dnl if you want that m4 avoid to throw away the spaces prefixed to the | |
984 | dnl argument value. | |
985 | dnl --------------------------------------------------------------------------- | |
986 | AC_DEFUN([WX_BOOLOPT_SUMMARY], | |
987 | [ | |
988 | if test "x$$1" = "x1" ; then | |
989 | echo $2 | |
990 | elif test "x$$1" = "x0" ; then | |
991 | echo $3 | |
992 | else | |
993 | echo "$1 is $$1" | |
994 | fi | |
995 | ]) | |
996 | ||
997 | dnl --------------------------------------------------------------------------- | |
998 | dnl WX_STANDARD_OPTIONS_SUMMARY_MSG | |
999 | dnl | |
1000 | dnl Shows a summary message to the user about the WX_* variable contents. | |
1001 | dnl This macro is used typically at the end of the configure script. | |
1002 | dnl --------------------------------------------------------------------------- | |
1003 | AC_DEFUN([WX_STANDARD_OPTIONS_SUMMARY_MSG], | |
1004 | [ | |
1005 | echo | |
1006 | echo " The wxWidgets build which will be used by $PACKAGE_NAME $PACKAGE_VERSION" | |
1007 | echo " has the following settings:" | |
1008 | WX_BOOLOPT_SUMMARY([WX_DEBUG], [" - DEBUG build"], [" - RELEASE build"]) | |
1009 | WX_BOOLOPT_SUMMARY([WX_UNICODE], [" - UNICODE mode"], [" - ANSI mode"]) | |
1010 | WX_BOOLOPT_SUMMARY([WX_SHARED], [" - SHARED mode"], [" - STATIC mode"]) | |
1011 | echo " - VERSION: $WX_VERSION" | |
1012 | echo " - PORT: $WX_PORT" | |
1013 | ]) | |
1014 | ||
1015 | ||
1016 | dnl --------------------------------------------------------------------------- | |
1017 | dnl WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN, WX_STANDARD_OPTIONS_SUMMARY_MSG_END | |
1018 | dnl | |
1019 | dnl Like WX_STANDARD_OPTIONS_SUMMARY_MSG macro but these two macros also gives info | |
1020 | dnl about the configuration of the package which used the wxpresets. | |
1021 | dnl | |
1022 | dnl Typical usage: | |
1023 | dnl WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN | |
1024 | dnl echo " - Package setting 1: $SETTING1" | |
1025 | dnl echo " - Package setting 2: $SETTING1" | |
1026 | dnl ... | |
1027 | dnl WX_STANDARD_OPTIONS_SUMMARY_MSG_END | |
1028 | dnl | |
1029 | dnl --------------------------------------------------------------------------- | |
1030 | AC_DEFUN([WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN], | |
1031 | [ | |
1032 | echo | |
1033 | echo " ----------------------------------------------------------------" | |
1034 | echo " Configuration for $PACKAGE_NAME $PACKAGE_VERSION successfully completed." | |
1035 | echo " Summary of main configuration settings for $PACKAGE_NAME:" | |
1036 | WX_BOOLOPT_SUMMARY([DEBUG], [" - DEBUG build"], [" - RELEASE build"]) | |
1037 | WX_BOOLOPT_SUMMARY([UNICODE], [" - UNICODE mode"], [" - ANSI mode"]) | |
1038 | WX_BOOLOPT_SUMMARY([SHARED], [" - SHARED mode"], [" - STATIC mode"]) | |
1039 | ]) | |
1040 | ||
1041 | AC_DEFUN([WX_STANDARD_OPTIONS_SUMMARY_MSG_END], | |
1042 | [ | |
1043 | WX_STANDARD_OPTIONS_SUMMARY_MSG | |
1044 | echo | |
1045 | echo " Now, just run make." | |
1046 | echo " ----------------------------------------------------------------" | |
1047 | echo | |
1048 | ]) | |
1049 | ||
1050 | ||
1051 | dnl --------------------------------------------------------------------------- | |
1052 | dnl Deprecated macro wrappers | |
1053 | dnl --------------------------------------------------------------------------- | |
1054 | ||
1055 | AC_DEFUN([AM_OPTIONS_WXCONFIG], [WX_CONFIG_OPTIONS]) | |
1056 | AC_DEFUN([AM_PATH_WXCONFIG], [ | |
1057 | WX_CONFIG_CHECK([$1],[$2],[$3],[$4],[$5]) | |
1058 | ]) | |
1059 | AC_DEFUN([AM_PATH_WXRC], [WXRC_CHECK([$1],[$2])]) |