Add osx configure support for wxWebView.
[wxWidgets.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION($Id$)dnl
3
4 AC_PREREQ(2.58)
5
6 dnl ---------------------------------------------------------------------------
7 dnl
8 dnl Top-level configure.in for wxWidgets by Robert Roebling, Phil Blecker,
9 dnl Vadim Zeitlin and Ron Lee
10 dnl
11 dnl This script is under the wxWindows licence.
12 dnl
13 dnl Version: $Id$
14 dnl ---------------------------------------------------------------------------
15
16 dnl ---------------------------------------------------------------------------
17 dnl initialization
18 dnl ---------------------------------------------------------------------------
19
20 AC_INIT([wxWidgets], [2.9.2], [wx-dev@lists.wxwidgets.org])
21
22 dnl the file passed to AC_CONFIG_SRCDIR should be specific to our package
23 AC_CONFIG_SRCDIR([wx-config.in])
24
25 dnl sets build, host variables and the same with _alias
26 AC_CANONICAL_BUILD
27 AC_CANONICAL_HOST
28
29 dnl notice that if --host was given but --build was not, cross_compiling is
30 dnl only set to "maybe" and not "yes" and will be either set to "yes" later or
31 dnl configure will exit with error in AC_PROG_CC so don't test for = "yes" here
32 if test "$cross_compiling" != "no"; then
33     HOST_PREFIX="${host_alias}-"
34     HOST_SUFFIX="-$host_alias"
35 else
36     HOST_PREFIX=
37     HOST_SUFFIX=
38 fi
39
40 dnl When making releases do:
41 dnl
42 dnl wx_release_number += 1
43
44 wx_major_version_number=2
45 wx_minor_version_number=9
46 wx_release_number=2
47 wx_subrelease_number=0
48
49 WX_RELEASE=$wx_major_version_number.$wx_minor_version_number
50 WX_VERSION=$WX_RELEASE.$wx_release_number
51 WX_SUBVERSION=$WX_VERSION.$wx_subrelease_number
52
53 WX_MSW_VERSION=$wx_major_version_number$wx_minor_version_number$wx_release_number
54
55
56 dnl Autoconf-2.60 changed the meaning of top_builddir variable, so we have
57 dnl to use our own replacement that will work with both 2.5x and 2.60+:
58 wx_top_builddir="`pwd`"
59 AC_SUBST(wx_top_builddir)
60
61
62 dnl ------------------------------------------------------------------------
63 dnl Check platform (host system)
64 dnl ------------------------------------------------------------------------
65
66 dnl OS (assume Unix)
67 USE_UNIX=1
68 USE_OS2=0
69 USE_WIN32=0
70 USE_DOS=0
71 USE_BEOS=0
72 USE_MAC=0
73
74 dnl Unix kind
75 USE_AIX=
76 USE_BSD=                            dnl any BSD
77 USE_DARWIN=                         dnl a.k.a. Mac OS X
78 USE_FREEBSD=
79 USE_GNU=                            dnl GNU/Hurd
80 USE_HPUX=
81 USE_LINUX=
82 USE_NETBSD=
83 USE_OPENBSD=
84 USE_OSF=                            dnl OSF/1 (obsolete?)
85 USE_SGI=
86 USE_SOLARIS=                        dnl Solaris ("SunOS" >= 5)
87 USE_SUN=                            dnl SunOS or Solaris
88 USE_SUNOS=                          dnl old/real SunOS (obsolete)
89 USE_SVR4=                           dnl SysV R4
90 USE_SYSV=                           dnl any System V
91 USE_VMS=
92 USE_ULTRIX=
93 USE_UNIXWARE=
94
95 dnl hardware platform
96 USE_ALPHA=
97
98 dnl on some platforms xxx_r() functions are declared inside "#ifdef
99 dnl _REENTRANT" and it's easier to just define this symbol for these platforms
100 dnl than checking it during run-time
101 NEEDS_D_REENTRANT_FOR_R_FUNCS=0
102
103 dnl the list of all available toolkits
104 dnl
105 dnl update NUM_TOOLKITS calculation below when adding a new toolkit here!
106 ALL_TOOLKITS="COCOA GTK OSX_CARBON OSX_COCOA OSX_IPHONE MGL MICROWIN MOTIF MSW PM X11 DFB"
107
108 dnl NB: these wxUSE_XXX constants have value of 0 or 1 unlike all the other ones
109 dnl     which are either yes or no
110 DEFAULT_wxUSE_OLD_COCOA=0
111 DEFAULT_wxUSE_GTK=0
112 DEFAULT_wxUSE_OSX_CARBON=0
113 DEFAULT_wxUSE_OSX_COCOA=0
114 DEFAULT_wxUSE_OSX_IPHONE=0
115 DEFAULT_wxUSE_MGL=0
116 DEFAULT_wxUSE_MICROWIN=0
117 DEFAULT_wxUSE_MOTIF=0
118 DEFAULT_wxUSE_MSW=0
119 DEFAULT_wxUSE_PM=0
120 DEFAULT_wxUSE_X11=0
121 DEFAULT_wxUSE_DFB=0
122
123 dnl these are the values which are really default for the given platform:
124 dnl they're used if no --with-<toolkit> options were given to detect the
125 dnl toolkit to use by default for the target platform
126 DEFAULT_DEFAULT_wxUSE_OLD_COCOA=0
127 DEFAULT_DEFAULT_wxUSE_GTK=0
128 DEFAULT_DEFAULT_wxUSE_OSX_CARBON=0
129 DEFAULT_DEFAULT_wxUSE_OSX_COCOA=0
130 DEFAULT_DEFAULT_wxUSE_OSX_IPHONE=0
131 DEFAULT_DEFAULT_wxUSE_MGL=0
132 DEFAULT_DEFAULT_wxUSE_MICROWIN=0
133 DEFAULT_DEFAULT_wxUSE_MOTIF=0
134 DEFAULT_DEFAULT_wxUSE_MSW=0
135 DEFAULT_DEFAULT_wxUSE_PM=0
136 DEFAULT_DEFAULT_wxUSE_X11=0
137 DEFAULT_DEFAULT_wxUSE_DFB=0
138
139 PROGRAM_EXT=
140 SAMPLES_RPATH_FLAG=
141 DYLIB_RPATH_INSTALL=
142 DYLIB_RPATH_POSTLINK=
143
144 DEFAULT_STD_FLAG=yes
145
146 dnl to support a new system, you need to add its canonical name (as determined
147 dnl by config.sub or specified by the configure command line) to this "case"
148 dnl and also define the shared library flags below - search for
149 dnl SHARED_LIB_SETUP to find the exact place
150 case "${host}" in
151   *-hp-hpux* )
152     USE_HPUX=1
153     DEFAULT_DEFAULT_wxUSE_MOTIF=1
154     NEEDS_D_REENTRANT_FOR_R_FUNCS=1
155     AC_DEFINE(__HPUX__)
156
157     dnl many standard declarations in HP-UX headers are only included if either
158     dnl _HPUX_SOURCE is defined, see stdsyms(5)
159     CPPFLAGS="-D_HPUX_SOURCE $CPPFLAGS"
160   ;;
161   *-*-linux* )
162     USE_LINUX=1
163     AC_DEFINE(__LINUX__)
164     TMP=`uname -m`
165     if test "x$TMP" = "xalpha"; then
166       USE_ALPHA=1
167       AC_DEFINE(__ALPHA__)
168     fi
169     DEFAULT_DEFAULT_wxUSE_GTK=1
170   ;;
171   *-*-gnu* | *-*-k*bsd*-gnu )
172     USE_GNU=1
173     TMP=`uname -m`
174     if test "x$TMP" = "xalpha"; then
175       USE_ALPHA=1
176       AC_DEFINE(__ALPHA__)
177     fi
178     DEFAULT_DEFAULT_wxUSE_GTK=1
179   ;;
180   *-*-irix5* | *-*-irix6* )
181     USE_SGI=1
182     USE_SVR4=1
183     AC_DEFINE(__SGI__)
184     AC_DEFINE(__SVR4__)
185     DEFAULT_DEFAULT_wxUSE_MOTIF=1
186   ;;
187   *-*-qnx*)
188     USE_QNX=1
189     AC_DEFINE(__QNX__)
190     DEFAULT_DEFAULT_wxUSE_X11=1
191   ;;
192   *-*-solaris2* )
193     USE_SUN=1
194     USE_SOLARIS=1
195     USE_SVR4=1
196     AC_DEFINE(__SUN__)
197     AC_DEFINE(__SOLARIS__)
198     AC_DEFINE(__SVR4__)
199     DEFAULT_DEFAULT_wxUSE_MOTIF=1
200     NEEDS_D_REENTRANT_FOR_R_FUNCS=1
201   ;;
202   *-*-sunos4* )
203     USE_SUN=1
204     USE_SUNOS=1
205     USE_BSD=1
206     AC_DEFINE(__SUN__)
207     AC_DEFINE(__SUNOS__)
208     AC_DEFINE(__BSD__)
209     DEFAULT_DEFAULT_wxUSE_MOTIF=1
210   ;;
211   *-*-freebsd*)
212     USE_BSD=1
213     USE_FREEBSD=1
214     AC_DEFINE(__FREEBSD__)
215     AC_DEFINE(__BSD__)
216     DEFAULT_DEFAULT_wxUSE_GTK=1
217   ;;
218   *-*-openbsd*|*-*-mirbsd*)
219     USE_BSD=1
220     USE_OPENBSD=1
221     AC_DEFINE(__OPENBSD__)
222     AC_DEFINE(__BSD__)
223     DEFAULT_DEFAULT_wxUSE_GTK=1
224   ;;
225   *-*-netbsd*)
226     USE_BSD=1
227     USE_NETBSD=1
228     AC_DEFINE(__NETBSD__)
229     AC_DEFINE(__BSD__)
230     DEFAULT_DEFAULT_wxUSE_GTK=1
231     NEEDS_D_REENTRANT_FOR_R_FUNCS=1
232
233     dnl some standard declarations in NetBSD headers are only included if
234     dnl _NETBSD_SOURCE and _LIBC are defined, e.g. getservbyname_r in netdb.h
235     CPPFLAGS="-D_NETBSD_SOURCE -D_LIBC $CPPFLAGS"
236   ;;
237   *-*-osf* )
238     USE_ALPHA=1
239     USE_OSF=1
240     AC_DEFINE(__ALPHA__)
241     AC_DEFINE(__OSF__)
242     DEFAULT_DEFAULT_wxUSE_MOTIF=1
243     NEEDS_D_REENTRANT_FOR_R_FUNCS=1
244   ;;
245   *-*-dgux5* )
246     USE_ALPHA=1
247     USE_SVR4=1
248     AC_DEFINE(__ALPHA__)
249     AC_DEFINE(__SVR4__)
250     DEFAULT_DEFAULT_wxUSE_MOTIF=1
251   ;;
252   *-*-sysv5* )
253     USE_SYSV=1
254     USE_SVR4=1
255     AC_DEFINE(__SYSV__)
256     AC_DEFINE(__SVR4__)
257     DEFAULT_DEFAULT_wxUSE_MOTIF=1
258   ;;
259   *-*-aix* )
260     USE_AIX=1
261     USE_SYSV=1
262     USE_SVR4=1
263     AC_DEFINE(__AIX__)
264     AC_DEFINE(__SYSV__)
265     AC_DEFINE(__SVR4__)
266     DEFAULT_DEFAULT_wxUSE_MOTIF=1
267   ;;
268
269   *-*-*UnixWare*)
270     USE_SYSV=1
271     USE_SVR4=1
272     USE_UNIXWARE=1
273     AC_DEFINE(__UNIXWARE__)
274   ;;
275
276   *-*-cygwin* | *-*-mingw32* )
277     dnl MBN: some of the defines have been moved after toolkit detection
278     dnl      because for wxMotif/wxGTK/wxX11 to build on Cygwin
279     dnl      USE_UNIX  must be set and not USE_WIN32
280     PROGRAM_EXT=".exe"
281     DEFAULT_DEFAULT_wxUSE_MSW=1
282   ;;
283
284   *-pc-msdosdjgpp )
285     USE_UNIX=0
286     USE_DOS=1
287     AC_DEFINE(__DOS__)
288     PROGRAM_EXT=".exe"
289     DEFAULT_DEFAULT_wxUSE_MGL=1
290   ;;
291
292   *-pc-os2_emx | *-pc-os2-emx )
293     AC_DEFINE(__EMX__)
294     USE_OS2=1
295     AC_DEFINE(__OS2__)
296     PROGRAM_EXT=".exe"
297     DEFAULT_DEFAULT_wxUSE_PM=1
298     dnl "c++" wrapper is not always available, so always use plain gcc.
299     CXX=gcc
300     LDFLAGS="$LDFLAGS -Zcrtdll"
301     dnl
302     dnl Some special code that's automatically added by autoconf-2.57 for OS/2
303     dnl and hopefully also by autoconf-2.58 and newer on all other platforms.
304     dnl For now however, we still need it to make sure the configure script
305     dnl works on OS/2 no matter what platform it is generated on.
306     ac_executable_extensions=".exe"
307     export ac_executable_extensions
308     dnl This strange code is necessary to deal with handling of
309     dnl backslashes by ksh and pdksh's sh variant.
310     ac_save_IFS="$IFS"
311     IFS='\\'
312     ac_TEMP_PATH=
313     for ac_dir in $PATH; do
314       IFS=$ac_save_IFS
315       if test -z "$ac_TEMP_PATH"; then
316         ac_TEMP_PATH="$ac_dir"
317       else
318         ac_TEMP_PATH="$ac_TEMP_PATH/$ac_dir"
319       fi
320     done
321     export PATH="$ac_TEMP_PATH"
322     unset ac_TEMP_PATH
323     DEFAULT_STD_FLAG=no
324   ;;
325
326   arm-apple-darwin*)
327     dnl iPhone
328     USE_BSD=1
329     USE_DARWIN=1
330     AC_DEFINE(__BSD__)
331     AC_DEFINE(__DARWIN__)
332     DEFAULT_DEFAULT_wxUSE_OSX_IPHONE=1
333   ;;
334
335   *-*-darwin* )
336     dnl Darwin based distributions (including Mac OS X)
337     USE_BSD=1
338     USE_DARWIN=1
339     AC_DEFINE(__BSD__)
340     AC_DEFINE(__DARWIN__)
341     AC_DEFINE(TARGET_CARBON)
342     DEFAULT_DEFAULT_wxUSE_OSX_CARBON=1
343   ;;
344
345   *-*-beos* )
346     dnl leave USE_UNIX on - BeOS is sufficiently Unix-like for this
347     USE_BEOS=1
348     AC_DEFINE(__BEOS__)
349   ;;
350
351   *)
352     AC_MSG_WARN([*** System type ${host} is unknown, assuming generic Unix and continuing nevertheless.])
353     AC_MSG_WARN([*** Please report the build results to wx-dev@lists.wxwidgets.org.])
354
355     DEFAULT_DEFAULT_wxUSE_X11=1
356     DEFAULT_wxUSE_SHARED=no
357 esac
358
359 dnl ---------------------------------------------------------------------------
360 dnl command line options for configure
361 dnl ---------------------------------------------------------------------------
362
363 dnl the default values for all options - we collect them all here to simplify
364 dnl modification of the default values (for example, if the defaults for some
365 dnl platform should be changed, it can be done here too)
366 dnl
367 dnl NB: see also DEFAULT_wxUSE<toolkit> variables defined above
368
369 dnl it's only necessary to list the options which should be disabled by
370 dnl default, all the rest have default value of "yes" (or, rather, of
371 dnl wxUSE_ALL_FEATURES which is the only which has to be set to "yes" by
372 dnl default)
373 DEFAULT_wxUSE_ALL_FEATURES=yes
374
375 DEFAULT_wxUSE_STD_CONTAINERS=$DEFAULT_STD_FLAG
376 DEFAULT_wxUSE_STD_IOSTREAM=$DEFAULT_STD_FLAG
377 DEFAULT_wxUSE_STD_STRING=$DEFAULT_STD_FLAG
378
379 dnl libraries disabled by default
380 DEFAULT_wxUSE_DMALLOC=no
381 DEFAULT_wxUSE_LIBGNOMEVFS=no
382 DEFAULT_wxUSE_LIBHILDON=no
383 DEFAULT_wxUSE_LIBHILDON2=no
384 DEFAULT_wxUSE_LIBMSPACK=no
385 DEFAULT_wxUSE_LIBSDL=no
386
387 dnl features disabled by default
388 DEFAULT_wxUSE_ACCESSIBILITY=no
389 DEFAULT_wxUSE_IPV6=no
390 DEFAULT_wxUSE_GSTREAMER8=no
391
392 dnl automatic features
393 DEFAULT_wxUSE_ARTPROVIDER_TANGO=auto
394 DEFAULT_wxUSE_UNICODE_UTF8=auto
395 DEFAULT_wxUSE_OPENGL=auto
396 DEFAULT_wxUSE_MEDIACTRL=auto
397 DEFAULT_wxUSE_COMPILER_TLS=auto
398
399 DEFAULT_wxUSE_UNICODE_UTF8_LOCALE=no
400
401 dnl Mac/Cocoa users need to enable building universal binaries explicitly
402 DEFAULT_wxUSE_UNIVERSAL_BINARY=no
403 DEFAULT_wxUSE_MAC_ARCH=no
404
405 DEFAULT_wxUSE_OFFICIAL_BUILD=no
406
407 dnl Applicable only when --with-gtk was used:
408 DEFAULT_wxUSE_GTK2=yes
409
410 dnl Always default to no. Only special cases require this.
411 DEFAULT_wxUSE_OBJC_UNIQUIFYING=no
412
413 dnl ===========================
414 dnl deal with configure options
415 dnl ===========================
416
417 dnl we use several macros here:
418 dnl     - AC_ARG_WITH/AC_ARG_ENABLE are the standard autoconf macros, see
419 dnl       autoconf manual for details about them
420 dnl     - WX_ARG_WITH/WX_ARG_ENABLE are their wx counterparts which perform
421 dnl       the caching of the command line options and also use DEFAULT_foo
422 dnl       variable as the default value for "foo" if neither --enable-foo nor
423 dnl       --disable-foo is specified
424 dnl     - WX_ARG_SYS_WITH is a special version of WX_ARG_WITH which allows
425 dnl       to choose not only whether an external library is used but also if we
426 dnl       use the copy of it included with wxWidgets or an already installed
427 dnl       system version
428 dnl     - WX_ARG_WITHOUT/WX_ARG_DISABLE mirror WX_ARG_WITH/WX_ARG_ENABLE but
429 dnl       should be used for the options which are enabled by default
430 dnl     - WX_ARG_FEATURE is a version of WX_ARG_ENABLE which should be used for
431 dnl       optional features, i.e. options which should be disabled if
432 dnl       --disable-all-features is specified (WX_ARG_WITH/WX_ARG_SYS_WITH are
433 dnl       also affected by this)
434
435 dnl ---------------------------------------------------------------------------
436 dnl global build options
437 dnl ---------------------------------------------------------------------------
438
439 WX_ARG_DISABLE(gui,        [  --disable-gui           don't build GUI parts of the library], wxUSE_GUI)
440 WX_ARG_ENABLE(monolithic,  [  --enable-monolithic     build wxWidgets as single library], wxUSE_MONOLITHIC)
441 WX_ARG_ENABLE(plugins,     [  --enable-plugins        build parts of wxWidgets as loadable components], wxUSE_PLUGINS)
442 WX_ARG_WITHOUT(subdirs,    [  --without-subdirs       don't generate makefiles for samples/demos/...], wxWITH_SUBDIRS)
443 AC_ARG_WITH(flavour,       [  --with-flavour=NAME     specify a name to identify this build], [WX_FLAVOUR="$withval"])
444 WX_ARG_ENABLE(official_build,  [  --enable-official_build official build of wxWidgets (win32 DLL only)], wxUSE_OFFICIAL_BUILD)
445 AC_ARG_ENABLE(vendor,  [  --enable-vendor=VENDOR  vendor name (win32 DLL only)], [VENDOR="$enableval"])
446 if test "x$VENDOR" = "x"; then
447     VENDOR="custom"
448 fi
449
450 WX_ARG_DISABLE(all-features,[  --disable-all-features  disable all optional features to build minimal library], wxUSE_ALL_FEATURES)
451
452 if test "$wxUSE_ALL_FEATURES" = "no"; then
453     dnl this is a bit ugly but currently we have no choice but to manually
454     dnl reset all the options with default value of auto if all features are to
455     dnl be disabled because we can't have an option with default value of
456     dnl "auto-or-no-if-wxUSE_ALL_FEATURES-is-disabled"
457     DEFAULT_wxUSE_ARTPROVIDER_TANGO=no
458     DEFAULT_wxUSE_MEDIACTRL=no
459 fi
460
461 dnl ---------------------------------------------------------------------------
462 dnl port selection
463 dnl ---------------------------------------------------------------------------
464
465 if test "$wxUSE_GUI" = "yes"; then
466
467 WX_ARG_ENABLE(universal,   [  --enable-universal      use wxWidgets GUI controls instead of native ones], wxUSE_UNIVERSAL)
468 if test "$wxUSE_UNIVERSAL" = "yes"; then
469     AC_ARG_WITH(themes,    [  --with-themes=all|list  use only the specified comma-separated list of wxUniversal themes], [wxUNIV_THEMES="$withval"])
470 fi
471
472 dnl we use AC_ARG_WITH and not WX_ARG_WITH for the toolkit options as they
473 dnl shouldn't default to wxUSE_ALL_FEATURES
474 AC_ARG_WITH(gtk,          [[  --with-gtk[=VERSION]    use GTK+, VERSION can be 2 (default), 1 or "any"]], [wxUSE_GTK="$withval" CACHE_GTK=1 TOOLKIT_GIVEN=1])
475 AC_ARG_WITH(motif,         [  --with-motif            use Motif/Lesstif], [wxUSE_MOTIF="$withval" CACHE_MOTIF=1 TOOLKIT_GIVEN=1])
476 AC_ARG_WITH(osx_carbon,    [  --with-osx_carbon       use Mac OS X (Carbon)], [wxUSE_OSX_CARBON="$withval" CACHE_OSX_CARBON=1 TOOLKIT_GIVEN=1])
477 AC_ARG_WITH(osx_cocoa,     [  --with-osx_cocoa        use Mac OS X (Cocoa)], [wxUSE_OSX_COCOA="$withval" CACHE_OSX_COCOA=1 TOOLKIT_GIVEN=1])
478 AC_ARG_WITH(osx_iphone,    [  --with-osx_iphone       use iPhone OS X port], [wxUSE_OSX_IPHONE="$withval" CACHE_OSX_IPHONE=1 TOOLKIT_GIVEN=1])
479 AC_ARG_WITH(osx,           [  --with-osx              use Mac OS X (default port, currently Carbon)], [wxUSE_OSX_CARBON="$withval" CACHE_OSX_CARBON=1 TOOLKIT_GIVEN=1])
480 AC_ARG_WITH(carbon,        [  --with-carbon           same as --with-osx_carbon], [wxUSE_OSX_CARBON="$withval" CACHE_OSX_CARBON=1 TOOLKIT_GIVEN=1])
481 AC_ARG_WITH(cocoa,         [  --with-cocoa            same as --with-osx_cocoa], [wxUSE_OSX_COCOA="$withval" CACHE_OSX_COCOA=1 TOOLKIT_GIVEN=1])
482 AC_ARG_WITH(iphone,        [  --with-iphone           same as --with-osx_iphone], [wxUSE_OSX_IPHONE="$withval" CACHE_OSX_IPHONE=1 TOOLKIT_GIVEN=1])
483 AC_ARG_WITH(mac,           [  --with-mac              same as --with-osx], [wxUSE_OSX_CARBON="$withval" CACHE_OSX_CARBON=1 TOOLKIT_GIVEN=1])
484 AC_ARG_WITH(old_cocoa,     [  --with-old_cocoa        use old, deprecated, Cocoa port], [wxUSE_OLD_COCOA="$withval" CACHE_OLD_COCOA=1 TOOLKIT_GIVEN=1])
485 AC_ARG_WITH(wine,          [  --with-wine             use Wine], [wxUSE_WINE="$withval" CACHE_WINE=1])
486 AC_ARG_WITH(msw,           [  --with-msw              use MS-Windows], [wxUSE_MSW="$withval" CACHE_MSW=1 TOOLKIT_GIVEN=1])
487 AC_ARG_WITH(pm,            [  --with-pm               use OS/2 Presentation Manager], [wxUSE_PM="$withval" CACHE_PM=1 TOOLKIT_GIVEN=1])
488 AC_ARG_WITH(mgl,           [  --with-mgl              use SciTech MGL], [wxUSE_MGL="$withval" wxUSE_UNIVERSAL="yes" CACHE_MGL=1 TOOLKIT_GIVEN=1])
489 AC_ARG_WITH(directfb,      [  --with-directfb         use DirectFB], [wxUSE_DFB="$withval" wxUSE_UNIVERSAL="yes" CACHE_DFB=1 TOOLKIT_GIVEN=1])
490 AC_ARG_WITH(microwin,      [  --with-microwin         use MicroWindows], [wxUSE_MICROWIN="$withval" CACHE_MICROWIN=1 TOOLKIT_GIVEN=1])
491 AC_ARG_WITH(x11,           [  --with-x11              use X11], [wxUSE_X11="$withval" wxUSE_UNIVERSAL="yes" CACHE_X11=1 TOOLKIT_GIVEN=1])
492 WX_ARG_ENABLE(nanox,       [  --enable-nanox          use NanoX], wxUSE_NANOX)
493
494 AC_ARG_ENABLE(gtk2,        [  --disable-gtk2          use GTK+ 1.2 instead of 2.0], [wxUSE_GTK2="$enableval"])
495 WX_ARG_ENABLE(gpe,         [  --enable-gpe            use GNOME PDA Environment features if possible], wxUSE_GPE)
496
497 dnl check that no more than one toolkit is given and that if none are given that
498 dnl we have a default one
499
500 AC_MSG_CHECKING(for toolkit)
501
502
503
504 # In Wine, we need to default to MSW, not GTK or MOTIF
505 if test "$wxUSE_WINE" = "yes"; then
506     DEFAULT_DEFAULT_wxUSE_GTK=0
507     DEFAULT_DEFAULT_wxUSE_MOTIF=0
508     DEFAULT_DEFAULT_wxUSE_MSW=1
509     wxUSE_SHARED=no
510     CC=${CC:-winegcc}
511     CXX=${CXX:-wineg++}
512 fi
513
514
515 if test "$wxUSE_GUI" = "yes"; then
516
517     if test "$USE_BEOS" = 1; then
518         AC_MSG_ERROR([BeOS GUI is not supported yet, use --disable-gui])
519     fi
520
521     if test "$TOOLKIT_GIVEN" = 1; then
522       dnl convert "yes", "any" or a number to 1 and "no" to 0
523       for toolkit in $ALL_TOOLKITS; do
524         var=wxUSE_$toolkit
525         eval "value=\$${var}"
526         if test "x$value" = "xno"; then
527           eval "$var=0"
528         elif test "x$value" != "x"; then
529           eval "$var=1"
530         fi
531
532         if test "x$value" != "x" -a "x$value" != "xyes" -a "x$value" != "xno"; then
533           eval "wx${toolkit}_VERSION=$value"
534         fi
535       done
536     else
537       dnl try to guess the most appropriate toolkit for this platform
538       for toolkit in $ALL_TOOLKITS; do
539         var=DEFAULT_DEFAULT_wxUSE_$toolkit
540         eval "wxUSE_$toolkit=\$${var}"
541       done
542     fi
543
544     dnl we suppose that expr is available (maybe there is a better way to do
545     dnl this? what about using ALL_TOOLKITS? TODO)
546     NUM_TOOLKITS=`expr ${wxUSE_OLD_COCOA:-0} + ${wxUSE_GTK:-0} + ${wxUSE_OSX_CARBON:-0} \
547                   + ${wxUSE_OSX_COCOA:-0} + ${wxUSE_OSX_IPHONE:-0} + ${wxUSE_MGL:-0} + ${wxUSE_DFB:-0} \
548                   + ${wxUSE_MICROWIN:-0} + ${wxUSE_MOTIF:-0} + ${wxUSE_MSW:-0} + ${wxUSE_X11:-0}`
549
550     dnl Allow wxUSE_PM only for OS/2 with EMX.
551     case "${host}" in
552       *-pc-os2_emx | *-pc-os2-emx )
553         NUM_TOOLKITS=`expr ${NUM_TOOLKITS} + ${wxUSE_PM:-0}`
554     esac
555
556     case "$NUM_TOOLKITS" in
557       1)
558       ;;
559       0)
560         AC_MSG_ERROR(Please specify a toolkit -- cannot determine the default for ${host})
561       ;;
562       *)
563         AC_MSG_ERROR(Please specify at most one toolkit)
564     esac
565
566     # to be removed when --disable-gtk2 isn't needed
567     if test "x$wxUSE_GTK2" = "xyes"; then
568         wxGTK_VERSION=2
569         wxUSE_GTK1=0
570     elif test "x$wxUSE_GTK2" = "xno"; then
571         wxGTK_VERSION=1
572         wxUSE_GTK1=1
573     fi
574
575     for toolkit in $ALL_TOOLKITS; do
576         var=wxUSE_$toolkit
577         eval "value=\$${var}"
578         if test "$value" = 1; then
579           toolkit_echo=`echo $toolkit | tr '[[A-Z]]' '[[a-z]]'`
580           AC_MSG_RESULT($toolkit_echo)
581         fi
582     done
583 else
584     if test "x$host_alias" != "x"; then
585         AC_MSG_RESULT(base ($host_alias hosted) only)
586     else
587         AC_MSG_RESULT(base only)
588     fi
589 fi
590
591 wxUSE_MAC=0
592 if test "$wxUSE_OSX_CARBON" = 1 \
593        -o "$wxUSE_OSX_COCOA" = 1 \
594        -o "$wxUSE_OSX_IPHONE" = 1; then
595     wxUSE_MAC=1
596 fi
597
598 dnl ---------------------------------------------------------------------------
599 dnl external libraries
600 dnl ---------------------------------------------------------------------------
601
602 WX_ARG_SYS_WITH(libpng,    [  --with-libpng           use libpng (PNG image format)], wxUSE_LIBPNG)
603 WX_ARG_SYS_WITH(libjpeg,   [  --with-libjpeg          use libjpeg (JPEG file format)], wxUSE_LIBJPEG)
604 WX_ARG_SYS_WITH(libtiff,   [  --with-libtiff          use libtiff (TIFF file format)], wxUSE_LIBTIFF)
605 WX_ARG_SYS_WITH(libxpm,    [  --with-libxpm           use libxpm (XPM file format)], wxUSE_LIBXPM)
606 WX_ARG_WITH(libiconv,      [  --with-libiconv         use libiconv (character conversion)], wxUSE_LIBICONV)
607 WX_ARG_WITH(libmspack,     [  --with-libmspack        use libmspack (CHM help files loading)], wxUSE_LIBMSPACK)
608 WX_ARG_WITHOUT(gtkprint,   [  --without-gtkprint      don't use GTK printing support], wxUSE_GTKPRINT)
609 WX_ARG_WITHOUT(gnomeprint, [  --without-gnomeprint    don't use GNOME printing libraries], wxUSE_LIBGNOMEPRINT)
610 WX_ARG_WITH(gnomevfs,      [  --with-gnomevfs         use GNOME VFS for associating MIME types], wxUSE_LIBGNOMEVFS)
611 WX_ARG_WITH(hildon,        [  --with-hildon           use Hildon framework for Nokia 770/800/810], wxUSE_LIBHILDON)
612 WX_ARG_WITH(opengl,        [  --with-opengl           use OpenGL (or Mesa)], wxUSE_OPENGL)
613
614 fi
615 dnl for GUI only
616
617 WX_ARG_WITH(dmalloc,       [  --with-dmalloc          use dmalloc library (http://dmalloc.com/)], wxUSE_DMALLOC)
618 WX_ARG_WITH(sdl,           [  --with-sdl              use SDL for audio on Unix], wxUSE_LIBSDL)
619 WX_ARG_SYS_WITH(regex,     [  --with-regex            enable support for wxRegEx class], wxUSE_REGEX)
620 WX_ARG_SYS_WITH(zlib,      [  --with-zlib             use zlib for LZW compression], wxUSE_ZLIB)
621 WX_ARG_SYS_WITH(expat,     [  --with-expat            enable XML support using expat parser], wxUSE_EXPAT)
622
623 AC_MSG_CHECKING([for --with-macosx-sdk])
624 AC_ARG_WITH(macosx-sdk,    [  --with-macosx-sdk=PATH  use an OS X SDK at PATH], [
625         wxUSE_MACOSX_SDK=$withval
626         wx_cv_use_macosx_sdk="wxUSE_MACOSX_SDK=$withval"
627     ])
628 AC_MSG_RESULT([$wxUSE_MACOSX_SDK])
629
630 AC_MSG_CHECKING([for --with-macosx-version-min])
631 AC_ARG_WITH(macosx-version-min,    [  --with-macosx-version-min=VER   build binaries which require at least this OS X version], [
632         wxUSE_MACOSX_VERSION_MIN=$withval
633         wx_cv_use_macosx_version_min="wxUSE_MACOSX_VERSION_MIN=$withval"
634     ])
635 AC_MSG_RESULT([$wxUSE_MACOSX_VERSION_MIN])
636
637 dnl ---------------------------------------------------------------------------
638 dnl debugging options
639 dnl ---------------------------------------------------------------------------
640
641 dnl don't use WX_ARG_ENABLE as it just gets in the way instead of helping with
642 dnl this rather unusual option
643 AC_MSG_CHECKING([for --enable-debug])
644 AC_ARG_ENABLE(debug,       [  --enable-debug          build library for debugging],
645     [
646         if test "$enableval" = yes; then
647             wxUSE_DEBUG=yes
648         elif test "$enableval" = no; then
649             wxUSE_DEBUG=no
650         elif test "$enableval" = max; then
651             wxUSE_DEBUG=yes
652             WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS -DwxDEBUG_LEVEL=2"
653         else
654             AC_MSG_ERROR([Invalid --enable-debug value, must be yes, no or max])
655         fi
656     ],
657     wxUSE_DEBUG=default
658 )
659
660 case "$wxUSE_DEBUG" in
661     yes)
662         dnl build the library for debugging: enable debugging code and generate
663         dnl the debug information for the library itself
664         DEFAULT_wxUSE_DEBUG_FLAG=yes
665         DEFAULT_wxUSE_DEBUG_INFO=yes
666
667         dnl also disable optimizations by default if --enable-debug was used
668         dnl (this can still be overridden by an explicit --enable-optimise)
669         DEFAULT_wxUSE_OPTIMISE=no
670         ;;
671
672     no)
673         dnl --disable-debug is equivalent to both --disable-debug_flag and
674         dnl --disable-debug_info
675         DEFAULT_wxUSE_DEBUG_FLAG=no
676         DEFAULT_wxUSE_DEBUG_INFO=no
677         ;;
678
679     default)
680         dnl the library is built with debugging support by default but without
681         dnl debug information as this requires much, much more disk space
682         DEFAULT_wxUSE_DEBUG_FLAG=yes
683         DEFAULT_wxUSE_DEBUG_INFO=no
684         ;;
685 esac
686
687 WX_ARG_DISABLE(debug_flag,   [  --disable-debug_flag    disable all debugging support], wxUSE_DEBUG_FLAG)
688 WX_ARG_ENABLE(debug_info,    [  --enable-debug_info     generate debug information], wxUSE_DEBUG_INFO)
689
690 dnl enabled if just --enable-debug_{flag,info} was
691 dnl
692 dnl in any case, only set the default value and allow overriding it with an
693
694 WX_ARG_ENABLE(debug_gdb,     [  --enable-debug_gdb      create code with extra GDB debugging information], wxUSE_DEBUG_GDB)
695 WX_ARG_ENABLE(debug_cntxt,   [  --enable-debug_cntxt    obsolete, don't use: use wxDebugContext], wxUSE_DEBUG_CONTEXT)
696 WX_ARG_ENABLE(mem_tracing,   [  --enable-mem_tracing    obsolete, don't use: create code with memory tracing], wxUSE_MEM_TRACING)
697
698 dnl ---------------------------------------------------------------------------
699 dnl global compile options
700 dnl ---------------------------------------------------------------------------
701
702 WX_ARG_DISABLE(shared,     [  --disable-shared        create static library instead of shared], wxUSE_SHARED)
703 WX_ARG_ENABLE(stl,         [  --enable-stl            use standard C++ classes for everything], wxUSE_STL)
704 WX_ARG_ENABLE(std_containers,[  --enable-std_containers use standard C++ container classes], wxUSE_STD_CONTAINERS)
705 WX_ARG_ENABLE(std_iostreams, [  --enable-std_iostreams  use standard C++ stream classes], wxUSE_STD_IOSTREAM)
706 WX_ARG_ENABLE(std_string,    [  --enable-std_string     use standard C++ string classes], wxUSE_STD_STRING)
707 WX_ARG_ENABLE(std_string_conv_in_wxstring, [ --enable-std_string_conv_in_wxstring     provide implicit conversion to std::string in wxString], wxUSE_STD_STRING_CONV_IN_WXSTRING)
708 WX_ARG_DISABLE(unicode,      [  --disable-unicode       compile without Unicode support], wxUSE_UNICODE)
709 WX_ARG_ENABLE(mslu,          [  --enable-mslu           use MS Layer for Unicode on Windows 9x (Win32 only)], wxUSE_UNICODE_MSLU)
710 WX_ARG_ENABLE_PARAM(utf8,    [  --enable-utf8           use UTF-8 representation for strings (Unix only)], wxUSE_UNICODE_UTF8)
711 WX_ARG_ENABLE(utf8only,      [  --enable-utf8only       only support UTF-8 locales in UTF-8 build (Unix only)], wxUSE_UNICODE_UTF8_LOCALE)
712 WX_ARG_ENABLE(extended_rtti, [  --enable-extended_rtti  use extended RTTI (XTI)], wxUSE_EXTENDED_RTTI)
713 if test "$USE_OS2" = 1; then
714     DEFAULT_wxUSE_OMF=no
715     WX_ARG_ENABLE(omf,     [  --enable-omf            use OMF object format], wxUSE_OMF)
716 fi
717
718 WX_ARG_DISABLE(optimise,   [  --disable-optimise      compile without optimisations], wxUSE_OPTIMISE)
719
720 WX_ARG_ENABLE(profile,       [  --enable-profile        create code with profiling information], wxUSE_PROFILE)
721 WX_ARG_ENABLE(no_rtti,       [  --enable-no_rtti        create code without RTTI information], wxUSE_NO_RTTI)
722 WX_ARG_ENABLE(no_exceptions, [  --enable-no_exceptions  create code without C++ exceptions handling], wxUSE_NO_EXCEPTIONS)
723 WX_ARG_ENABLE(permissive,    [  --enable-permissive     compile code disregarding strict ANSI], wxUSE_PERMISSIVE)
724 WX_ARG_ENABLE(no_deps,       [  --enable-no_deps        create code without dependency information], wxUSE_NO_DEPS)
725 WX_ARG_DISABLE(vararg_macros,[  --disable-vararg_macros don't use vararg macros, even if they are supported], wxUSE_VARARG_MACROS)
726
727 WX_ARG_ENABLE_PARAM(universal_binary, [[  --enable-universal_binary  create universal binary with Mac PPC and i386 (and x86_64 if using Cocoa) architectures ]], wxUSE_UNIVERSAL_BINARY)
728 WX_ARG_ENABLE_PARAM(macosx_arch,      [[  --enable-macosx_arch=ARCH  build for just the specified architecture]], wxUSE_MAC_ARCH)
729
730 WX_ARG_ENABLE(compat26,      [  --enable-compat26       enable wxWidgets 2.6 compatibility], WXWIN_COMPATIBILITY_2_6)
731 WX_ARG_DISABLE(compat28,     [  --disable-compat28      disable wxWidgets 2.8 compatibility], WXWIN_COMPATIBILITY_2_8)
732
733 WX_ARG_DISABLE(rpath,        [  --disable-rpath         disable use of rpath for uninstalled builds], wxUSE_RPATH)
734
735 WX_ARG_ENABLE(objc_uniquifying,[  --enable-objc_uniquifying enable Objective-C class name uniquifying], wxUSE_OBJC_UNIQUIFYING)
736
737 WX_ARG_DISABLE(visibility,   [  --disable-visibility    disable use of ELF symbols visibility even if supported], wxUSE_VISIBILITY)
738 WX_ARG_DISABLE(tls,          [  --disable-tls           disable use of compiler TLS support], wxUSE_COMPILER_TLS)
739
740 dnl ---------------------------------------------------------------------------
741 dnl optional non GUI features
742 dnl ---------------------------------------------------------------------------
743
744 WX_ARG_FEATURE(intl,          [  --enable-intl           use internationalization system], wxUSE_INTL)
745 WX_ARG_FEATURE(xlocale,       [  --enable-xlocale        use x-locale support (requires wxLocale)], wxUSE_XLOCALE)
746 WX_ARG_FEATURE(config,        [  --enable-config         use wxConfig (and derived) classes], wxUSE_CONFIG)
747
748 WX_ARG_FEATURE(protocols,     [  --enable-protocols      use wxProtocol and derived classes], wxUSE_PROTOCOL)
749 WX_ARG_FEATURE(ftp,           [  --enable-ftp            use wxFTP (requires wxProtocol], wxUSE_PROTOCOL_FTP)
750 WX_ARG_FEATURE(http,          [  --enable-http           use wxHTTP (requires wxProtocol], wxUSE_PROTOCOL_HTTP)
751 WX_ARG_FEATURE(fileproto,     [  --enable-fileproto      use wxFileProto class (requires wxProtocol], wxUSE_PROTOCOL_FILE)
752 WX_ARG_FEATURE(sockets,       [  --enable-sockets        use socket/network classes], wxUSE_SOCKETS)
753 WX_ARG_FEATURE(ipv6,          [  --enable-ipv6           enable IPv6 support in wxSocket], wxUSE_IPV6)
754 WX_ARG_FEATURE(ole,           [  --enable-ole            use OLE classes (Win32 only)], wxUSE_OLE)
755 WX_ARG_FEATURE(dataobj,       [  --enable-dataobj        use data object classes], wxUSE_DATAOBJ)
756
757 WX_ARG_FEATURE(ipc,           [  --enable-ipc            use interprocess communication (wxSocket etc.)], wxUSE_IPC)
758
759 WX_ARG_FEATURE(baseevtloop,   [  --enable-baseevtloop    use event loop in console programs too], wxUSE_CONSOLE_EVENTLOOP)
760 WX_ARG_FEATURE(epollloop,     [  --enable-epollloop      use wxEpollDispatcher class (Linux only)], wxUSE_EPOLL_DISPATCHER)
761 WX_ARG_FEATURE(selectloop,    [  --enable-selectloop     use wxSelectDispatcher class], wxUSE_SELECT_DISPATCHER)
762
763 dnl please keep the settings below in alphabetical order
764 WX_ARG_FEATURE(any,           [  --enable-any            use wxAny class], wxUSE_ANY)
765 WX_ARG_FEATURE(apple_ieee,    [  --enable-apple_ieee     use the Apple IEEE codec], wxUSE_APPLE_IEEE)
766 WX_ARG_FEATURE(arcstream,     [  --enable-arcstream      use wxArchive streams], wxUSE_ARCHIVE_STREAMS)
767 WX_ARG_FEATURE(base64,        [  --enable-base64         use base64 encoding/decoding functions], wxUSE_BASE64)
768 WX_ARG_FEATURE(backtrace,     [  --enable-backtrace      use wxStackWalker class for getting backtraces], wxUSE_STACKWALKER)
769 WX_ARG_FEATURE(catch_segvs,   [  --enable-catch_segvs    catch signals in wxApp::OnFatalException (Unix only)], wxUSE_ON_FATAL_EXCEPTION)
770 WX_ARG_FEATURE(cmdline,       [  --enable-cmdline        use wxCmdLineParser class], wxUSE_CMDLINE_PARSER)
771 WX_ARG_FEATURE(datetime,      [  --enable-datetime       use wxDateTime class], wxUSE_DATETIME)
772 WX_ARG_FEATURE(debugreport,   [  --enable-debugreport    use wxDebugReport class], wxUSE_DEBUGREPORT)
773 WX_ARG_FEATURE(dialupman,     [  --enable-dialupman      use dialup network classes], wxUSE_DIALUP_MANAGER)
774 WX_ARG_FEATURE(dynlib,        [  --enable-dynlib         use wxLibrary class for DLL loading], wxUSE_DYNLIB_CLASS)
775 WX_ARG_FEATURE(dynamicloader, [  --enable-dynamicloader  use (new) wxDynamicLibrary class], wxUSE_DYNAMIC_LOADER)
776 WX_ARG_FEATURE(exceptions,    [  --enable-exceptions     build exception-safe library], wxUSE_EXCEPTIONS)
777 WX_ARG_FEATURE(ffile,         [  --enable-ffile          use wxFFile class], wxUSE_FFILE)
778 WX_ARG_FEATURE(file,          [  --enable-file           use wxFile class], wxUSE_FILE)
779 WX_ARG_FEATURE(filehistory,   [  --enable-filehistory    use wxFileHistory class], wxUSE_FILE_HISTORY)
780 WX_ARG_FEATURE(filesystem,    [  --enable-filesystem     use virtual file systems classes], wxUSE_FILESYSTEM)
781 WX_ARG_FEATURE(fontenum,      [  --enable-fontenum       use wxFontEnumerator class], wxUSE_FONTENUM)
782 WX_ARG_FEATURE(fontmap,       [  --enable-fontmap        use font encodings conversion classes], wxUSE_FONTMAP)
783 WX_ARG_FEATURE(fs_archive,    [  --enable-fs_archive     use virtual archive filesystems], wxUSE_FS_ARCHIVE)
784 WX_ARG_FEATURE(fs_inet,       [  --enable-fs_inet        use virtual HTTP/FTP filesystems], wxUSE_FS_INET)
785 WX_ARG_FEATURE(fs_zip,        [  --enable-fs_zip         now replaced by fs_archive], wxUSE_FS_ZIP)
786 WX_ARG_FEATURE(fswatcher,     [  --enable-fswatcher      use wxFileSystemWatcher class], wxUSE_FSWATCHER)
787 WX_ARG_FEATURE(geometry,      [  --enable-geometry       use geometry class], wxUSE_GEOMETRY)
788 WX_ARG_FEATURE(log,           [  --enable-log            use logging system], wxUSE_LOG)
789 WX_ARG_FEATURE(longlong,      [  --enable-longlong       use wxLongLong class], wxUSE_LONGLONG)
790 WX_ARG_FEATURE(mimetype,      [  --enable-mimetype       use wxMimeTypesManager], wxUSE_MIMETYPE)
791 WX_ARG_FEATURE(printfposparam,[  --enable-printfposparam use wxVsnprintf() which supports positional parameters], wxUSE_PRINTF_POS_PARAMS)
792 WX_ARG_FEATURE(snglinst,      [  --enable-snglinst       use wxSingleInstanceChecker class], wxUSE_SNGLINST_CHECKER)
793 WX_ARG_FEATURE(sound,         [  --enable-sound          use wxSound class], wxUSE_SOUND)
794 WX_ARG_FEATURE(stdpaths,      [  --enable-stdpaths       use wxStandardPaths class], wxUSE_STDPATHS)
795 WX_ARG_FEATURE(stopwatch,     [  --enable-stopwatch      use wxStopWatch class], wxUSE_STOPWATCH)
796 WX_ARG_FEATURE(streams,       [  --enable-streams        use wxStream etc classes], wxUSE_STREAMS)
797 WX_ARG_FEATURE(sysoptions,    [  --enable-sysoptions     use wxSystemOptions], wxUSE_SYSTEM_OPTIONS)
798 WX_ARG_FEATURE(tarstream,     [  --enable-tarstream      use wxTar streams], wxUSE_TARSTREAM)
799 WX_ARG_FEATURE(textbuf,       [  --enable-textbuf        use wxTextBuffer class], wxUSE_TEXTBUFFER)
800 WX_ARG_FEATURE(textfile,      [  --enable-textfile       use wxTextFile class], wxUSE_TEXTFILE)
801 WX_ARG_FEATURE(timer,         [  --enable-timer          use wxTimer class], wxUSE_TIMER)
802 WX_ARG_FEATURE(variant,       [  --enable-variant        use wxVariant class], wxUSE_VARIANT)
803 WX_ARG_FEATURE(zipstream,     [  --enable-zipstream      use wxZip streams], wxUSE_ZIPSTREAM)
804
805 dnl URL-related classes
806 WX_ARG_FEATURE(url,           [  --enable-url            use wxURL class], wxUSE_URL)
807 WX_ARG_FEATURE(protocol,      [  --enable-protocol       use wxProtocol class], wxUSE_PROTOCOL)
808 WX_ARG_FEATURE(protocol_http, [  --enable-protocol-http  HTTP support in wxProtocol], wxUSE_PROTOCOL_HTTP)
809 WX_ARG_FEATURE(protocol_ftp,  [  --enable-protocol-ftp   FTP support in wxProtocol], wxUSE_PROTOCOL_FTP)
810 WX_ARG_FEATURE(protocol_file, [  --enable-protocol-file  FILE support in wxProtocol], wxUSE_PROTOCOL_FILE)
811
812 WX_ARG_FEATURE(threads,     [  --enable-threads        use threads], wxUSE_THREADS)
813
814 WX_ARG_ENABLE(iniconf,      [  --enable-iniconf        use wxIniConfig (Win32 only)], wxUSE_INICONF)
815 WX_ARG_FEATURE(regkey,      [  --enable-regkey         use wxRegKey class (Win32 only)], wxUSE_REGKEY)
816
817 if test "$wxUSE_GUI" = "yes"; then
818
819 dnl ---------------------------------------------------------------------------
820 dnl optional "big" GUI features
821 dnl ---------------------------------------------------------------------------
822
823 WX_ARG_FEATURE(docview,     [  --enable-docview        use document view architecture], wxUSE_DOC_VIEW_ARCHITECTURE)
824 WX_ARG_FEATURE(help,        [  --enable-help           use help subsystem], wxUSE_HELP)
825 WX_ARG_FEATURE(mshtmlhelp,  [  --enable-mshtmlhelp     use MS HTML Help (win32)], wxUSE_MS_HTML_HELP)
826 WX_ARG_FEATURE(html,        [  --enable-html           use wxHTML sub-library], wxUSE_HTML)
827 WX_ARG_FEATURE(htmlhelp,    [  --enable-htmlhelp       use wxHTML-based help], wxUSE_WXHTML_HELP)
828 WX_ARG_FEATURE(xrc,         [  --enable-xrc            use XRC resources sub-library], wxUSE_XRC)
829 WX_ARG_FEATURE(aui,         [  --enable-aui            use AUI docking library], wxUSE_AUI)
830 WX_ARG_FEATURE(propgrid,    [  --enable-propgrid       use wxPropertyGrid library], wxUSE_PROPGRID)
831 WX_ARG_FEATURE(ribbon,      [  --enable-ribbon         use wxRibbon library], wxUSE_RIBBON)
832 WX_ARG_FEATURE(stc,         [  --enable-stc            use wxStyledTextCtrl library], wxUSE_STC)
833 WX_ARG_FEATURE(constraints, [  --enable-constraints    use layout-constraints system], wxUSE_CONSTRAINTS)
834 WX_ARG_FEATURE(loggui,      [  --enable-loggui         use standard GUI logger], wxUSE_LOGGUI)
835 WX_ARG_FEATURE(logwin,      [  --enable-logwin         use wxLogWindow], wxUSE_LOGWINDOW)
836 WX_ARG_FEATURE(logdialog,   [  --enable-logdialog      use wxLogDialog], wxUSE_LOGDIALOG)
837 WX_ARG_FEATURE(mdi,         [  --enable-mdi            use multiple document interface architecture], wxUSE_MDI)
838 WX_ARG_FEATURE(mdidoc,      [  --enable-mdidoc         use docview architecture with MDI], wxUSE_MDI_ARCHITECTURE)
839 WX_ARG_FEATURE(mediactrl,   [  --enable-mediactrl      use wxMediaCtrl class], wxUSE_MEDIACTRL)
840 WX_ARG_FEATURE(gstreamer8,  [  --enable-gstreamer8     force GStreamer 0.8 instead of 0.10 with the wxMediaCtrl class on unix], wxUSE_GSTREAMER8)
841 WX_ARG_FEATURE(webkit,      [  --enable-webkit         use wxWebKitCtrl (Mac)], wxUSE_WEBKIT)
842 WX_ARG_FEATURE(richtext,    [  --enable-richtext       use wxRichTextCtrl], wxUSE_RICHTEXT)
843 WX_ARG_FEATURE(postscript,  [  --enable-postscript     use wxPostscriptDC device context (default for gtk+)], wxUSE_POSTSCRIPT)
844 WX_ARG_FEATURE(printarch,   [  --enable-printarch      use printing architecture], wxUSE_PRINTING_ARCHITECTURE)
845 WX_ARG_FEATURE(svg,         [  --enable-svg            use wxSVGFileDC device context], wxUSE_SVG)
846 WX_ARG_FEATURE(web,         [  --enable-web            use wxWeb library], wxUSE_WEB)
847
848 dnl wxDC is implemented in terms of wxGraphicsContext in wxOSX so the latter
849 dnl can't be disabled, don't even provide an option to do it
850 if test "$wxUSE_MAC" != 1; then
851 WX_ARG_FEATURE(graphics_ctx,[  --enable-graphics_ctx   use graphics context 2D drawing API], wxUSE_GRAPHICS_CONTEXT)
852 fi
853
854 dnl ---------------------------------------------------------------------------
855 dnl IPC &c
856 dnl ---------------------------------------------------------------------------
857
858 WX_ARG_FEATURE(clipboard,   [  --enable-clipboard      use wxClipboard class], wxUSE_CLIPBOARD)
859 WX_ARG_FEATURE(dnd,         [  --enable-dnd            use Drag'n'Drop classes], wxUSE_DRAG_AND_DROP)
860 WX_ARG_FEATURE(metafile,    [  --enable-metafile       use win32 metafiles], wxUSE_METAFILE)
861
862 dnl ---------------------------------------------------------------------------
863 dnl optional GUI controls (in alphabetical order except the first one)
864 dnl ---------------------------------------------------------------------------
865
866 dnl don't set DEFAULT_wxUSE_XXX below if the option is not specified
867 DEFAULT_wxUSE_CONTROLS=none
868 WX_ARG_DISABLE(controls,    [  --disable-controls      disable compilation of all standard controls], wxUSE_CONTROLS)
869
870 dnl even with --disable-controls, some may be enabled by an explicit
871 dnl --enable-<control> later on the command line -- but by default all will be
872 dnl disabled
873 if test "$wxUSE_CONTROLS" = "no"; then
874     DEFAULT_wxUSE_ACCEL=no
875     DEFAULT_wxUSE_ANIMATIONCTRL=no
876     DEFAULT_wxUSE_BMPBUTTON=no
877     DEFAULT_wxUSE_BUTTON=no
878     DEFAULT_wxUSE_CALCTRL=no
879     DEFAULT_wxUSE_CARET=no
880     DEFAULT_wxUSE_CHECKBOX=no
881     DEFAULT_wxUSE_CHECKLISTBOX=no
882     DEFAULT_wxUSE_CHOICE=no
883     DEFAULT_wxUSE_CHOICEBOOK=no
884     DEFAULT_wxUSE_COLLPANE=no
885     DEFAULT_wxUSE_COLOURPICKERCTRL=no
886     DEFAULT_wxUSE_COMBOBOX=no
887     DEFAULT_wxUSE_COMBOBOX=no
888     DEFAULT_wxUSE_COMMANDLINKBUTTON=no
889     DEFAULT_wxUSE_DATAVIEWCTRL=no
890     DEFAULT_wxUSE_DATEPICKCTRL=no
891     DEFAULT_wxUSE_DETECT_SM=no
892     DEFAULT_wxUSE_DIRPICKERCTRL=no
893     DEFAULT_wxUSE_DISPLAY=no
894     DEFAULT_wxUSE_FILECTRL=no
895     DEFAULT_wxUSE_FILEPICKERCTRL=no
896     DEFAULT_wxUSE_FONTPICKERCTRL=no
897     DEFAULT_wxUSE_GAUGE=no
898     DEFAULT_wxUSE_GRID=no
899     DEFAULT_wxUSE_HEADERCTRL=no
900     DEFAULT_wxUSE_HYPERLINKCTRL=no
901     DEFAULT_wxUSE_IMAGLIST=no
902     DEFAULT_wxUSE_LISTBOOK=no
903     DEFAULT_wxUSE_LISTBOX=no
904     DEFAULT_wxUSE_LISTCTRL=no
905     DEFAULT_wxUSE_MARKUP=no
906     DEFAULT_wxUSE_NOTEBOOK=no
907     DEFAULT_wxUSE_POPUPWIN=no
908     DEFAULT_wxUSE_RADIOBOX=no
909     DEFAULT_wxUSE_RADIOBTN=no
910     DEFAULT_wxUSE_RICHMSGDLG=no
911     DEFAULT_wxUSE_REARRANGECTRL=no
912     DEFAULT_wxUSE_SASH=no
913     DEFAULT_wxUSE_SCROLLBAR=no
914     DEFAULT_wxUSE_SEARCHCTRL=no
915     DEFAULT_wxUSE_SLIDER=no
916     DEFAULT_wxUSE_SPINBTN=no
917     DEFAULT_wxUSE_SPINCTRL=no
918     DEFAULT_wxUSE_SPLITTER=no
919     DEFAULT_wxUSE_STATBMP=no
920     DEFAULT_wxUSE_STATBOX=no
921     DEFAULT_wxUSE_STATLINE=no
922     DEFAULT_wxUSE_STATUSBAR=no
923     DEFAULT_wxUSE_TIPWINDOW=no
924     DEFAULT_wxUSE_TOGGLEBTN=no
925     DEFAULT_wxUSE_TOOLBAR=no
926     DEFAULT_wxUSE_TOOLBAR_NATIVE=no
927     DEFAULT_wxUSE_TOOLBOOK=no
928     DEFAULT_wxUSE_TOOLTIPS=no
929     DEFAULT_wxUSE_TREEBOOK=no
930     DEFAULT_wxUSE_TREECTRL=no
931 fi
932
933 dnl features affecting multiple controls
934 WX_ARG_FEATURE(markup,      [  --enable-markup         support wxControl::SetLabelMarkup], wxUSE_MARKUP)
935
936 dnl please keep the settings below in alphabetical order
937 WX_ARG_FEATURE(accel,       [  --enable-accel          use accelerators], wxUSE_ACCEL)
938 WX_ARG_FEATURE(animatectrl, [  --enable-animatectrl    use wxAnimationCtrl class], wxUSE_ANIMATIONCTRL)
939 WX_ARG_FEATURE(artstd,      [  --enable-artstd         use standard XPM icons in wxArtProvider], wxUSE_ARTPROVIDER_STD)
940 WX_ARG_FEATURE(arttango,    [  --enable-arttango       use Tango icons in wxArtProvider], wxUSE_ARTPROVIDER_TANGO)
941 WX_ARG_FEATURE(bmpbutton,   [  --enable-bmpbutton      use wxBitmapButton class], wxUSE_BMPBUTTON)
942 WX_ARG_FEATURE(bmpcombobox, [  --enable-bmpcombobox    use wxBitmapComboBox class], wxUSE_BITMAPCOMBOBOX)
943 WX_ARG_FEATURE(button,      [  --enable-button         use wxButton class], wxUSE_BUTTON)
944 WX_ARG_FEATURE(calendar,    [  --enable-calendar       use wxCalendarCtrl class], wxUSE_CALCTRL)
945 WX_ARG_FEATURE(caret,       [  --enable-caret          use wxCaret class], wxUSE_CARET)
946 WX_ARG_FEATURE(checkbox,    [  --enable-checkbox       use wxCheckBox class], wxUSE_CHECKBOX)
947 WX_ARG_FEATURE(checklst,    [  --enable-checklst       use wxCheckListBox (listbox with checkboxes) class], wxUSE_CHECKLST)
948 WX_ARG_FEATURE(choice,      [  --enable-choice         use wxChoice class], wxUSE_CHOICE)
949 WX_ARG_FEATURE(choicebook,  [  --enable-choicebook     use wxChoicebook class], wxUSE_CHOICEBOOK)
950 WX_ARG_FEATURE(collpane,    [  --enable-collpane       use wxCollapsiblePane class], wxUSE_COLLPANE)
951 WX_ARG_FEATURE(colourpicker,[  --enable-colourpicker   use wxColourPickerCtrl class], wxUSE_COLOURPICKERCTRL)
952 WX_ARG_FEATURE(combobox,    [  --enable-combobox       use wxComboBox class], wxUSE_COMBOBOX)
953 WX_ARG_FEATURE(comboctrl,   [  --enable-comboctrl      use wxComboCtrl class], wxUSE_COMBOCTRL)
954 WX_ARG_FEATURE(commandlinkbutton, [  --enable-commandlinkbutton      use wxCommmandLinkButton class], wxUSE_COMMANDLINKBUTTON)
955 WX_ARG_FEATURE(dataviewctrl,[  --enable-dataviewctrl   use wxDataViewCtrl class], wxUSE_DATAVIEWCTRL)
956 WX_ARG_FEATURE(datepick,    [  --enable-datepick       use wxDatePickerCtrl class], wxUSE_DATEPICKCTRL)
957 WX_ARG_FEATURE(detect_sm,   [  --enable-detect_sm      use code to detect X11 session manager], wxUSE_DETECT_SM)
958 WX_ARG_FEATURE(dirpicker,   [  --enable-dirpicker      use wxDirPickerCtrl class], wxUSE_DIRPICKERCTRL)
959 WX_ARG_FEATURE(display,     [  --enable-display        use wxDisplay class], wxUSE_DISPLAY)
960 WX_ARG_FEATURE(editablebox, [  --enable-editablebox    use wxEditableListBox class], wxUSE_EDITABLELISTBOX)
961 WX_ARG_FEATURE(filectrl,    [  --enable-filectrl       use wxFileCtrl class], wxUSE_FILECTRL)
962 WX_ARG_FEATURE(filepicker,  [  --enable-filepicker     use wxFilePickerCtrl class], wxUSE_FILEPICKERCTRL)
963 WX_ARG_FEATURE(fontpicker,  [  --enable-fontpicker     use wxFontPickerCtrl class], wxUSE_FONTPICKERCTRL)
964 WX_ARG_FEATURE(gauge,       [  --enable-gauge          use wxGauge class], wxUSE_GAUGE)
965 WX_ARG_FEATURE(grid,        [  --enable-grid           use wxGrid class], wxUSE_GRID)
966 WX_ARG_FEATURE(headerctrl,  [  --enable-headerctrl     use wxHeaderCtrl class], wxUSE_HEADERCTRL)
967 WX_ARG_FEATURE(hyperlink,   [  --enable-hyperlink      use wxHyperlinkCtrl class], wxUSE_HYPERLINKCTRL)
968 WX_ARG_FEATURE(imaglist,    [  --enable-imaglist       use wxImageList class], wxUSE_IMAGLIST)
969 WX_ARG_FEATURE(infobar,     [  --enable-infobar        use wxInfoBar class], wxUSE_INFOBAR)
970 WX_ARG_FEATURE(listbook,    [  --enable-listbook       use wxListbook class], wxUSE_LISTBOOK)
971 WX_ARG_FEATURE(listbox,     [  --enable-listbox        use wxListBox class], wxUSE_LISTBOX)
972 WX_ARG_FEATURE(listctrl,    [  --enable-listctrl       use wxListCtrl class], wxUSE_LISTCTRL)
973 WX_ARG_FEATURE(notebook,    [  --enable-notebook       use wxNotebook class], wxUSE_NOTEBOOK)
974 WX_ARG_FEATURE(notifmsg,    [  --enable-notifmsg       use wxNotificationMessage class], wxUSE_NOTIFICATION_MESSAGE)
975 WX_ARG_FEATURE(odcombobox,  [  --enable-odcombobox     use wxOwnerDrawnComboBox class], wxUSE_ODCOMBOBOX)
976 WX_ARG_FEATURE(popupwin,    [  --enable-popupwin       use wxPopUpWindow class], wxUSE_POPUPWIN)
977 WX_ARG_FEATURE(radiobox,    [  --enable-radiobox       use wxRadioBox class], wxUSE_RADIOBOX)
978 WX_ARG_FEATURE(radiobtn,    [  --enable-radiobtn       use wxRadioButton class], wxUSE_RADIOBTN)
979 WX_ARG_FEATURE(richmsgdlg,  [  --enable-richmsgdlg     use wxRichMessageDialog class], wxUSE_RICHMSGDLG)
980 WX_ARG_FEATURE(rearrangectrl,[  --enable-rearrangectrl  use wxRearrangeList/Ctrl/Dialog], wxUSE_REARRANGECTRL)
981 WX_ARG_FEATURE(sash,        [  --enable-sash           use wxSashWindow class], wxUSE_SASH)
982 WX_ARG_FEATURE(scrollbar,   [  --enable-scrollbar      use wxScrollBar class and scrollable windows], wxUSE_SCROLLBAR)
983 WX_ARG_FEATURE(searchctrl,  [  --enable-searchctrl     use wxSearchCtrl class], wxUSE_SEARCHCTRL)
984 WX_ARG_FEATURE(slider,      [  --enable-slider         use wxSlider class], wxUSE_SLIDER)
985 WX_ARG_FEATURE(spinbtn,     [  --enable-spinbtn        use wxSpinButton class], wxUSE_SPINBTN)
986 WX_ARG_FEATURE(spinctrl,    [  --enable-spinctrl       use wxSpinCtrl class], wxUSE_SPINCTRL)
987 WX_ARG_FEATURE(splitter,    [  --enable-splitter       use wxSplitterWindow class], wxUSE_SPLITTER)
988 WX_ARG_FEATURE(statbmp,     [  --enable-statbmp        use wxStaticBitmap class], wxUSE_STATBMP)
989 WX_ARG_FEATURE(statbox,     [  --enable-statbox        use wxStaticBox class], wxUSE_STATBOX)
990 WX_ARG_FEATURE(statline,    [  --enable-statline       use wxStaticLine class], wxUSE_STATLINE)
991 WX_ARG_FEATURE(stattext,    [  --enable-stattext       use wxStaticText class], wxUSE_STATTEXT)
992 WX_ARG_FEATURE(statusbar,   [  --enable-statusbar      use wxStatusBar class], wxUSE_STATUSBAR)
993 WX_ARG_FEATURE(taskbaricon, [  --enable-taskbaricon    use wxTaskBarIcon class], wxUSE_TASKBARICON)
994 WX_ARG_FEATURE(tbarnative,  [  --enable-tbarnative     use native wxToolBar class], wxUSE_TOOLBAR_NATIVE)
995 WX_ARG_FEATURE(textctrl,    [  --enable-textctrl       use wxTextCtrl class], wxUSE_TEXTCTRL)
996 WX_ARG_FEATURE(tipwindow,   [  --enable-tipwindow      use wxTipWindow class], wxUSE_TIPWINDOW)
997 WX_ARG_FEATURE(togglebtn,   [  --enable-togglebtn      use wxToggleButton class], wxUSE_TOGGLEBTN)
998 WX_ARG_FEATURE(toolbar,     [  --enable-toolbar        use wxToolBar class], wxUSE_TOOLBAR)
999 WX_ARG_FEATURE(toolbook,    [  --enable-toolbook       use wxToolbook class], wxUSE_TOOLBOOK)
1000 WX_ARG_FEATURE(treebook,    [  --enable-treebook       use wxTreebook class], wxUSE_TREEBOOK)
1001 WX_ARG_FEATURE(treectrl,    [  --enable-treectrl       use wxTreeCtrl class], wxUSE_TREECTRL)
1002
1003 dnl ---------------------------------------------------------------------------
1004 dnl common dialogs
1005 dnl ---------------------------------------------------------------------------
1006
1007 WX_ARG_FEATURE(commondlg,   [  --enable-commondlg      use all common dialogs], wxUSE_COMMONDLGS)
1008 WX_ARG_FEATURE(aboutdlg,    [  --enable-aboutdlg       use wxAboutBox], wxUSE_ABOUTDLG)
1009 WX_ARG_FEATURE(choicedlg,   [  --enable-choicedlg      use wxChoiceDialog], wxUSE_CHOICEDLG)
1010 WX_ARG_FEATURE(coldlg,      [  --enable-coldlg         use wxColourDialog], wxUSE_COLOURDLG)
1011 WX_ARG_FEATURE(filedlg,     [  --enable-filedlg        use wxFileDialog], wxUSE_FILEDLG)
1012 WX_ARG_FEATURE(finddlg,     [  --enable-finddlg        use wxFindReplaceDialog], wxUSE_FINDREPLDLG)
1013 WX_ARG_FEATURE(fontdlg,     [  --enable-fontdlg        use wxFontDialog], wxUSE_FONTDLG)
1014 WX_ARG_FEATURE(dirdlg,      [  --enable-dirdlg         use wxDirDialog], wxUSE_DIRDLG)
1015 WX_ARG_FEATURE(msgdlg,      [  --enable-msgdlg         use wxMessageDialog], wxUSE_MSGDLG)
1016 WX_ARG_FEATURE(numberdlg,   [  --enable-numberdlg      use wxNumberEntryDialog], wxUSE_NUMBERDLG)
1017 WX_ARG_FEATURE(splash,      [  --enable-splash         use wxSplashScreen], wxUSE_SPLASH)
1018 WX_ARG_FEATURE(textdlg,     [  --enable-textdlg        use wxTextDialog], wxUSE_TEXTDLG)
1019 WX_ARG_FEATURE(tipdlg,      [  --enable-tipdlg         use startup tips], wxUSE_STARTUP_TIPS)
1020 WX_ARG_FEATURE(progressdlg, [  --enable-progressdlg    use wxProgressDialog], wxUSE_PROGRESSDLG)
1021 WX_ARG_FEATURE(wizarddlg,   [  --enable-wizarddlg      use wxWizard], wxUSE_WIZARDDLG)
1022
1023 dnl ---------------------------------------------------------------------------
1024 dnl misc GUI options
1025 dnl ---------------------------------------------------------------------------
1026
1027 WX_ARG_FEATURE(menus,       [  --enable-menus          use wxMenu/wxMenuBar/wxMenuItem classes], wxUSE_MENUS)
1028 WX_ARG_FEATURE(miniframe,   [  --enable-miniframe      use wxMiniFrame class], wxUSE_MINIFRAME)
1029 WX_ARG_FEATURE(tooltips,    [  --enable-tooltips       use wxToolTip class], wxUSE_TOOLTIPS)
1030 WX_ARG_FEATURE(splines,     [  --enable-splines        use spline drawing code], wxUSE_SPLINES)
1031 WX_ARG_FEATURE(mousewheel,  [  --enable-mousewheel     use mousewheel], wxUSE_MOUSEWHEEL)
1032 WX_ARG_FEATURE(validators,  [  --enable-validators     use wxValidator and derived classes], wxUSE_VALIDATORS)
1033 WX_ARG_FEATURE(busyinfo,    [  --enable-busyinfo       use wxBusyInfo], wxUSE_BUSYINFO)
1034 WX_ARG_FEATURE(joystick,    [  --enable-joystick       use wxJoystick], wxUSE_JOYSTICK)
1035 WX_ARG_FEATURE(metafile,    [  --enable-metafiles      use wxMetaFile (Win32 only)], wxUSE_METAFILE)
1036 WX_ARG_FEATURE(dragimage,   [  --enable-dragimage      use wxDragImage], wxUSE_DRAGIMAGE)
1037 WX_ARG_FEATURE(accessibility,[  --enable-accessibility  enable accessibility support], wxUSE_ACCESSIBILITY)
1038 WX_ARG_FEATURE(uiactionsim,  [  --enable-uiactionsim    use wxUIActionSimulator (experimental)], wxUSE_UIACTIONSIMULATOR)
1039 WX_ARG_FEATURE(dctransform,  [  --enable-dctransform    use wxDC::SetTransformMatrix and related], wxUSE_DC_TRANSFORM_MATRIX)
1040 WX_ARG_FEATURE(webviewwebkit,[  --enable-webview-webkit use wxWebView WebKit backend], wxUSE_WEBVIEW_WEBKIT)
1041
1042 dnl ---------------------------------------------------------------------------
1043 dnl support for image formats that do not rely on external library
1044 dnl ---------------------------------------------------------------------------
1045
1046 WX_ARG_FEATURE(palette,     [  --enable-palette        use wxPalette class], wxUSE_PALETTE)
1047 WX_ARG_FEATURE(image,       [  --enable-image          use wxImage class], wxUSE_IMAGE)
1048 WX_ARG_FEATURE(gif,         [  --enable-gif            use gif images (GIF file format)], wxUSE_GIF)
1049 WX_ARG_FEATURE(pcx,         [  --enable-pcx            use pcx images (PCX file format)], wxUSE_PCX)
1050 WX_ARG_FEATURE(tga,         [  --enable-tga            use tga images (TGA file format)], wxUSE_TGA)
1051 WX_ARG_FEATURE(iff,         [  --enable-iff            use iff images (IFF file format)], wxUSE_IFF)
1052 WX_ARG_FEATURE(pnm,         [  --enable-pnm            use pnm images (PNM file format)], wxUSE_PNM)
1053 WX_ARG_FEATURE(xpm,         [  --enable-xpm            use xpm images (XPM file format)], wxUSE_XPM)
1054 WX_ARG_FEATURE(ico_cur,     [  --enable-ico_cur        use Windows ICO and CUR formats], wxUSE_ICO_CUR)
1055
1056 dnl ---------------------------------------------------------------------------
1057 dnl wxMSW-only options
1058 dnl ---------------------------------------------------------------------------
1059
1060 WX_ARG_FEATURE(dccache,     [  --enable-dccache        cache temporary wxDC objects (Win32 only)], wxUSE_DC_CACHEING)
1061 WX_ARG_FEATURE(ps-in-msw,   [  --enable-ps-in-msw      use PS printing in wxMSW (Win32 only)], wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW)
1062 WX_ARG_FEATURE(ownerdrawn,  [  --enable-ownerdrawn     use owner drawn controls (Win32 and OS/2 only)], wxUSE_OWNER_DRAWN)
1063 WX_ARG_FEATURE(uxtheme,     [  --enable-uxtheme        enable support for Windows XP themed look (Win32 only)], wxUSE_UXTHEME)
1064 WX_ARG_FEATURE(wxdib,       [  --enable-wxdib          use wxDIB class (Win32 only)], wxUSE_DIB)
1065 WX_ARG_FEATURE(webviewie,   [  --enable-webview-ie     use wxWebView IE backend (Win32 only)], wxUSE_WEBVIEW_IE)
1066
1067 dnl this one is not really MSW-specific but it exists mainly to be turned off
1068 dnl under MSW, it should be off by default on the other platforms
1069 if test "$wxUSE_MSW" != 1; then
1070     DEFAULT_wxUSE_AUTOID_MANAGEMENT=no
1071 fi
1072
1073 WX_ARG_FEATURE(autoidman,   [  --enable-autoidman      use automatic ids management], wxUSE_AUTOID_MANAGEMENT)
1074
1075 fi
1076 dnl for GUI only
1077
1078 dnl ---------------------------------------------------------------------------
1079 dnl Checks for programs
1080 dnl ---------------------------------------------------------------------------
1081
1082 dnl flush the cache because checking for programs might abort
1083 AC_CACHE_SAVE
1084
1085 dnl C-compiler checks
1086 dnl   defines CC with the compiler to use
1087 dnl   defines GCC with yes if using gcc
1088 dnl   defines GCC empty if not using gcc
1089 dnl   defines CFLAGS
1090 dnl
1091 dnl this magic incantation is needed to prevent AC_PROG_CC from setting the
1092 dnl default CFLAGS (something like "-g -O2") -- we don't need this as we add
1093 dnl (if not already present in C*FLAGS) the -g and -O flags ourselves below
1094 CFLAGS=${CFLAGS:=}
1095 AC_BAKEFILE_PROG_CC
1096
1097 dnl is -traditional needed for correct compilations
1098 dnl   adds -traditional for gcc if needed
1099 AC_PROG_GCC_TRADITIONAL
1100
1101 dnl C++-compiler checks
1102 dnl   defines CXX with the compiler to use
1103 dnl   defines GXX with yes if using gxx
1104 dnl   defines GXX empty if not using gxx
1105 dnl   defines CXXFLAGS
1106 dnl
1107 dnl see CFLAGS line above
1108 CXXFLAGS=${CXXFLAGS:=}
1109 AC_BAKEFILE_PROG_CXX
1110
1111 dnl configure always sets CXX to something as it falls back to g++ even if no
1112 dnl C++ compiler was found, but we prefer to abort now with a clear error
1113 dnl message rather than give errors about all tests failures below
1114 if test "$CXX" = "g++" -a "$GXX" != "yes"; then
1115     AC_MSG_ERROR([C++ compiler is needed to build wxWidgets])
1116 fi
1117
1118 dnl ar command
1119 dnl   defines AR with the appropriate command
1120 dnl
1121 dnl For Sun CC AC_BAKEFILE below sets AR to the compiler itself.
1122 if test "x$SUNCXX" != xyes; then
1123     AC_CHECK_TOOL(AR, ar)
1124     if test "x$AR" = "x" ; then
1125         AC_MSG_ERROR([ar is needed to build wxWidgets])
1126     fi
1127 fi
1128
1129 dnl ---------------------------------------------------------------------------
1130 dnl Mac-specific SDK/architectures checks
1131 dnl ---------------------------------------------------------------------------
1132
1133 if test "$wxUSE_MAC" = 1; then
1134
1135 retest_macosx_linking=no
1136
1137 OSX_ARCH_OPTS=""
1138 if test "x$wxUSE_MAC_ARCH" != xno; then
1139     OSX_ARCH_OPTS="-arch $wxUSE_MAC_ARCH"
1140 fi
1141
1142 dnl Support the old --enable-universal_binary in case anyone was using it.
1143     if test "x$wxUSE_UNIVERSAL_BINARY" != xno ; then
1144         dnl --enable-universal_binary uses a default SDK (currently 10.4u)
1145         dnl --enable-universal_binary=SDK names a path to an SDK
1146         if test "x$wxUSE_UNIVERSAL_BINARY" == xyes; then
1147             # Implicitly turn on the new --with-macosx-sdk using the default
1148             # SDK which provides the behaviour this option has always had.
1149             if test "x$wxUSE_MACOSX_SDK" = "x"; then
1150                 AC_MSG_WARN([Enabling default SDK due to --enable-universal_binary.])
1151                 AC_MSG_WARN([If you don't want this, specify --without-macosx-sdk])
1152                 wxUSE_MACOSX_SDK=yes
1153             fi
1154         else
1155             # Complain to user if he specified an argument to --enable-universal_binary
1156             # and also 1) specified --with-macosx-sdk using the default (yes) or
1157             # 2) specified --with-macosx-sdk using a path or 3) specified
1158             # --without-macosx-sdk (no).
1159             if test "x$wxUSE_MACOSX_SDK" != "x" ; then
1160                 AC_MSG_FAILURE([Please specify the new --with-macosx-sdk=PATH and do not specify an arg to --enable-universal_binary])
1161             else
1162                 # Put the SDK path into the wxUSE_MACOSX_SDK.  We don't have to
1163                 # special-case the empty string because the below test simply
1164                 # converts "no" to the empty string anyway.
1165                 wxUSE_MACOSX_SDK="$wxUSE_UNIVERSAL_BINARY"
1166                 dnl Warn about deprecated usage.
1167                 AC_MSG_WARN([Please use --with-macosx-sdk=PATH and --enable-universal_binary without an argument])
1168             fi
1169         fi
1170         dnl FIXME: I think it would be better to put this into CC, CXX, and LD rather than the flags.
1171         OSX_ARCH_OPTS="-arch ppc -arch i386"
1172         if test "$wxUSE_OSX_COCOA" = 1; then
1173             OSX_ARCH_OPTS="$OSX_ARCH_OPTS -arch x86_64"
1174         fi
1175         AC_MSG_CHECKING([for universal binary architectures])
1176         AC_MSG_RESULT([$OSX_ARCH_OPTS])
1177
1178         dnl NOTE: Only the compiler driver needs arch flags.  The link editor
1179         dnl is incapable of using them but the compiler driver (which we use
1180         dnl as LD when building dynamic libraries) uses them to invoke the
1181         dnl real ld multiple times.  If we moved to libtool -dynamic we would
1182         dnl need no arch flags because libtool automatically invokes ld for
1183         dnl every architecture found in the fat input files.
1184         dnl
1185         dnl For static library builds, AR/RANLIB automatically create proper
1186         dnl fat archives although AR is unable to update them once RANLIB has
1187         dnl made them into proper fat archives.  Fortunately, our link process
1188         dnl simply removes the .a file before using ar to create a new one.
1189         dnl If we did move to libtool -static we still wouldn't need arch flags
1190         dnl because libtool automatically figures it out based on input.
1191         retest_macosx_linking=yes
1192
1193         dnl HACK: PCH could be made to work by precompiling for each architecture into separate directories
1194         dnl and including all architecture directories with each compiler invocation.
1195         dnl That would require a major rework of Bakefile and at the same time it would be nice to have
1196         dnl Objective-C++ precompiled headers.
1197         AC_MSG_WARN([Disabling precompiled headers due to universal binary build.])
1198         bk_use_pch=no
1199     fi
1200
1201 CXXFLAGS="$OSX_ARCH_OPTS $CXXFLAGS"
1202 CFLAGS="$OSX_ARCH_OPTS $CFLAGS"
1203 OBJCXXFLAGS="$OSX_ARCH_OPTS $OBJCXXFLAGS"
1204 OBJCFLAGS="$OSX_ARCH_OPTS $OBJCFLAGS"
1205 LDFLAGS="$OSX_ARCH_OPTS $LDFLAGS"
1206
1207 dnl Set up the Mac OS X SDK.  We do this early so configure tests will occur
1208 dnl with the SDK in place.
1209 dnl NOTE: We clobber wxUSE_MACOSX_SDK with the SDK path
1210 if test "x$wxUSE_MACOSX_SDK" = "xno"; then
1211     wxUSE_MACOSX_SDK=
1212 elif test "x$wxUSE_MACOSX_SDK" = "xyes"; then
1213     # TODO: Search for most recent SDK and use it.
1214     wxUSE_MACOSX_SDK="/Developer/SDKs/MacOSX10.4u.sdk"
1215 fi
1216
1217
1218 if test "x$wxUSE_MACOSX_SDK" != "x"; then
1219     AC_MSG_CHECKING([for SDK directory $wxUSE_MACOSX_SDK])
1220     if ! test -d "$wxUSE_MACOSX_SDK"; then
1221         AC_MSG_FAILURE([not found])
1222     else
1223         AC_MSG_RESULT([exists])
1224     fi
1225     dnl CC and CXX will have these flags added below, after the compiler has been chosen
1226     MACOSX_SDK_OPTS="-isysroot $wxUSE_MACOSX_SDK"
1227     retest_macosx_linking=yes
1228     dnl NOTE: When libtool is used in lieu of AR/RANLIB (i.e. in static mode)
1229     dnl the syslibroot makes no difference.  We aren't using libtool now but
1230     dnl if we ever did, be aware that you don't need to worry about it.
1231 fi
1232
1233 dnl Set up the deployment target
1234 dnl No   : Don't specify a min version even if using an SDK
1235 dnl Yes  : Use the version from the SDK if used, otherwise same as no
1236 dnl Param: Use the specified version
1237 if test "x$wxUSE_MACOSX_VERSION_MIN" = "xno"; then
1238     wxUSE_MACOSX_VERSION_MIN=
1239 elif test "x$wxUSE_MACOSX_VERSION_MIN" = "xyes"; then
1240     if test "x$wxUSE_MACOSX_SDK" != "x"; then
1241         AC_MSG_CHECKING([SDK deployment version])
1242 dnl We need to quote the next line where we don't need macros and do need [] in the regex
1243 [
1244         MACOSX_SDK_PLIST_VERSION_MIN=`defaults read "$wxUSE_MACOSX_SDK/SDKSettings" buildSettings | grep '^ *"\{0,1\}MACOSX_DEPLOYMENT_TARGET"\{0,1\} *= *"\{0,1\}[^"]*"\{0,1\}; *$' | sed 's/^ *"\{0,1\}MACOSX_DEPLOYMENT_TARGET"\{0,1\} *= *"\{0,1\}\([^"]*\)"\{0,1\} *; *$/\1/'`
1245 ]
1246         # If that failed, try again with the new key
1247         if test "x$MACOSX_SDK_PLIST_VERSION_MIN" == "x"; then
1248 [
1249             MACOSX_SDK_PLIST_VERSION_MIN=`defaults read "$wxUSE_MACOSX_SDK/SDKSettings" DefaultProperties | grep '^ *"\{0,1\}MACOSX_DEPLOYMENT_TARGET"\{0,1\} *= *"\{0,1\}[^"]*"\{0,1\}; *$' | sed 's/^ *"\{0,1\}MACOSX_DEPLOYMENT_TARGET"\{0,1\} *= *"\{0,1\}\([^"]*\)"\{0,1\} *; *$/\1/'`
1250 ]
1251         fi
1252
1253         if test "x$MACOSX_SDK_PLIST_VERSION_MIN" != "x"; then
1254             wxUSE_MACOSX_VERSION_MIN=$MACOSX_SDK_PLIST_VERSION_MIN
1255             AC_MSG_RESULT([$wxUSE_MACOSX_VERSION_MIN])
1256         else
1257             AC_MSG_WARN([Could not determine deployment target from SDKSettings.plist])
1258             wxUSE_MACOSX_VERSION_MIN=
1259         fi
1260     else
1261         wxUSE_MACOSX_VERSION_MIN=
1262     fi
1263 elif test "x$wxUSE_MACOSX_VERSION_MIN" = "x"; then
1264     AC_CHECK_PROGS(OSX_SW_VERS, sw_vers)
1265     if test "$OSX_SW_VERS" != ""; then
1266         OSX_VERSION=`sw_vers -productVersion | grep 10.[[0-9]]`
1267     else
1268         dnl can't determine it (happens e.g. when cross-compiling) so use a
1269         dnl conservative default
1270         AC_MSG_WARN([Assuming OS X 10.4, use --with-macosx-version-min to override.])
1271         OSX_VERSION="10.4"
1272     fi
1273
1274     case "$OSX_VERSION" in
1275         10.4* )
1276             wxUSE_MACOSX_VERSION_MIN=10.4
1277             ;;
1278
1279         * )
1280             if test "$wxUSE_OSX_CARBON" = 1; then
1281                 # otherwise configure stops on leopard for universal_binary
1282                 wxUSE_MACOSX_VERSION_MIN=10.4
1283             else
1284                 # for Cocoa, use 10.5 to be able to compile it in 64 bits too
1285                 wxUSE_MACOSX_VERSION_MIN=10.5
1286             fi
1287             ;;
1288     esac
1289 fi
1290
1291 NEEDS_GCC40="no"
1292 if test "x$wxUSE_MACOSX_VERSION_MIN" == "x10.4"; then
1293     NEEDS_GCC40="yes"
1294 fi
1295
1296 if test "$wxUSE_OSX_CARBON" = 1; then
1297     NEEDS_GCC40="yes"
1298 fi
1299
1300 if test "x$NEEDS_GCC40" == "xyes"; then
1301     # gcc 4.2 cannot compile 10.4 compatible code, so if the user is using it
1302     # and wants 10.4 compatible code, then 'downgrade' to 4.0
1303     # This is also the simplest way to get 32-bit binaries on Snow Leopard.
1304     if test "x$CC" = "xgcc"; then
1305         CCVERSION=`$CC --version | grep 4.[[2-9]].`
1306         if test "x$CCVERSION" != "x"; then
1307             echo "$as_me:$LINENO: WARNING: gcc >= 4.2 cannot compile 10.4 compatible code. Using gcc 4.0 instead."
1308             CC="gcc-4.0"
1309         fi
1310     fi
1311
1312     if test "x$CXX" = "xg++"; then
1313         CCVERSION=`$CXX --version | grep 4.[[2-9]].`
1314         if test "x$CCVERSION" != "x"; then
1315             CXX="g++-4.0"
1316         fi
1317     fi
1318 fi
1319
1320 if test "x$MACOSX_SDK_OPTS" != "x"; then 
1321     eval "CC=\"$CC $MACOSX_SDK_OPTS\""
1322     eval "CXX=\"$CXX $MACOSX_SDK_OPTS\""
1323     eval "LD=\"$LD $MACOSX_SDK_OPTS\""
1324 fi
1325
1326 if test "x$wxUSE_MACOSX_VERSION_MIN" != "x"; then
1327     if test "$wxUSE_OSX_IPHONE" = 1; then
1328         MACOSX_VERSION_MIN_OPTS="-miphoneos-version-min=$wxUSE_MACOSX_VERSION_MIN"
1329     else
1330         MACOSX_VERSION_MIN_OPTS="-mmacosx-version-min=$wxUSE_MACOSX_VERSION_MIN"
1331     fi
1332     eval "CC=\"$CC $MACOSX_VERSION_MIN_OPTS\""
1333     eval "CXX=\"$CXX $MACOSX_VERSION_MIN_OPTS\""
1334     eval "LD=\"$LD $MACOSX_VERSION_MIN_OPTS\""
1335     retest_macosx_linking=yes
1336 fi
1337
1338 dnl If either an SDK or a version option was added, make sure that we can
1339 dnl still compile and link both C and C++.  If we didn't do this, then most
1340 dnl of the remaining tests would fail.
1341 if test "x$retest_macosx_linking" = "xyes"; then
1342     AC_LANG_PUSH(C)
1343     AC_MSG_CHECKING([if C compiler works with SDK/version options])
1344     AC_TRY_LINK([],[],[AC_MSG_RESULT([yes])],[AC_MSG_FAILURE([no.  Try a different SDK]); exit 1])
1345     AC_LANG_POP()
1346
1347     AC_LANG_PUSH(C++)
1348     AC_MSG_CHECKING([if C++ compiler works with SDK/version options])
1349     AC_TRY_LINK([],[],[AC_MSG_RESULT([yes])],[AC_MSG_FAILURE([no.  Try a different SDK]); exit 1])
1350     AC_LANG_POP()
1351 fi
1352
1353 fi dnl wxUSE_MAC
1354
1355 case "${host}" in
1356
1357     dnl The other BSD's should probably go in here too, since this is
1358     dnl to workaround a strange static lib BSDism.
1359     dnl Mac OS X install seems to ignore -p option...
1360     *-*-darwin* )
1361         INSTALL_PROGRAM="cp -fp"
1362         INSTALL_DATA="cp -fp"
1363         ;;
1364     *)
1365         ;;
1366 esac
1367
1368 dnl ------------------------------------------------------------------------
1369 dnl Platform specific tests
1370 dnl ------------------------------------------------------------------------
1371
1372 dnl xlC needs -qunique under AIX so that one source file can be
1373 dnl compiled to multiple object files and safely linked together.
1374 if test "x$XLCXX" = "xyes" -a "x$USE_AIX" = "x1"; then
1375     CXXFLAGS="-qunique $CXXFLAGS"
1376 fi
1377
1378 dnl This case is for PowerPC OS X vs. everything else
1379 case "${host}" in
1380   powerpc-*-darwin* )
1381     AC_MSG_CHECKING([if __POWERPC__ is already defined])
1382     AC_TRY_COMPILE([],[#ifndef __POWERPC__
1383         choke me for lack of PowerPC
1384 #endif
1385 ],
1386         [AC_MSG_RESULT([yes])],
1387         [AC_MSG_RESULT([no])
1388         AC_DEFINE(__POWERPC__)
1389     ])
1390   ;;
1391 esac
1392
1393 dnl This case is for OS X vs. everything else
1394 case "${host}" in
1395   *-*-darwin* )
1396     AC_MSG_CHECKING([if CoreFoundation/CFBase.h is usable])
1397     AC_TRY_COMPILE([#include <CoreFoundation/CFBase.h>
1398 ],[],
1399         [AC_MSG_RESULT([yes])],
1400         [AC_MSG_RESULT([no])
1401         AC_MSG_CHECKING([if __CF_USE_FRAMEWORK_INCLUDES__ is required])
1402         AC_TRY_COMPILE([#define __CF_USE_FRAMEWORK_INCLUDES__
1403 #include <CoreFoundation/CFBase.h>
1404         ],[],
1405         [AC_MSG_RESULT([yes])
1406         dnl We must use -D so source files that don't include wx/setup.h
1407         dnl but do include CFBase will work.
1408         CPPFLAGS="-D__CF_USE_FRAMEWORK_INCLUDES__ $CPPFLAGS"],
1409         [AC_MSG_FAILURE([no.  CoreFoundation not available.])]
1410         )
1411         ]
1412     )
1413   ;;
1414 esac
1415
1416 dnl Determine whether we want to use Cygwin as Windows or POSIX platform: the
1417 dnl latter makes more sense for wxGTK/Motif/X11 ports
1418 wants_win32=0
1419 doesnt_want_win32=0
1420 case "${host}" in
1421   *-*-cygwin*)
1422       if test "$wxUSE_MSW" = 1 ; then
1423         wants_win32=1
1424       else
1425         dnl when we use cygwin compiler with -mno-cygwin option it uses mingw32
1426         dnl headers and libraries, so it's Windows-like in this case
1427         AC_CACHE_CHECK([if -mno-cygwin is in effect], wx_cv_nocygwin,
1428             [
1429                 AC_TRY_COMPILE(
1430                     [],
1431                     [
1432                         #ifdef __MINGW32__
1433                             choke me
1434                         #endif
1435                     ],
1436                     wx_cv_nocygwin=no,
1437                     wx_cv_nocygwin=yes
1438                 )
1439             ]
1440         )
1441
1442         if test "$wx_cv_nocygwin" = "yes"; then
1443             wants_win32=1
1444         else
1445             doesnt_want_win32=1
1446         fi
1447       fi
1448       if test "$wants_win32" = 1 ; then
1449         BAKEFILE_FORCE_PLATFORM=win32
1450       fi
1451   ;;
1452   *-*-mingw*)
1453       wants_win32=1
1454   ;;
1455 esac
1456
1457 if test "$wxUSE_WINE" = "yes"; then
1458     wants_win32=1
1459     LDFLAGS_GUI="-mwindows"
1460 fi
1461
1462 dnl NB: The two tests below are *NOT* mutually exclusive! They should only
1463 dnl     take effect on Cygwin/Mingw and not other platforms.
1464 if test "$wants_win32" = 1 ; then
1465     USE_UNIX=0
1466     USE_WIN32=1
1467     AC_DEFINE(__WIN32__)
1468     AC_DEFINE(__WIN95__)
1469     AC_DEFINE(__WINDOWS__)
1470     AC_DEFINE(__GNUWIN32__)
1471     AC_DEFINE(STRICT)
1472 fi
1473 if test "$doesnt_want_win32" = 1 ; then
1474     USE_UNIX=1
1475     USE_WIN32=0
1476 fi
1477 dnl (end of Windows-only piece)
1478
1479 if test "$USE_UNIX" = 1 ; then
1480     wxUSE_UNIX=yes
1481     AC_DEFINE(__UNIX__)
1482 fi
1483
1484 dnl This case is for OS/2 vs. everything else
1485 case "${host}" in
1486   *-pc-os2_emx | *-pc-os2-emx )
1487       dnl ---------------------------------------------------------------------
1488       dnl When we are using gcc on OS/2, we want to be either using resources
1489       dnl (PM) or a more complete POSIX emulation for Motif/GTK+/X11.
1490       dnl Moreover we need to link explicitly against either stdcpp.a or
1491       dnl stdcxx.a (depending on compiler version), since we are using "gcc",
1492       dnl not "g++/c++".
1493       dnl ---------------------------------------------------------------------
1494       dnl (OS/2-only piece)
1495       if test "$wxUSE_MOTIF" = 1 -o "$wxUSE_GTK" = 1 -o "$wxUSE_X11" = 1; then
1496           dnl More complete Unix emulation for unix-like ports
1497           dnl by linking in POSIX/2's cExt (if available).
1498           AC_CHECK_LIB(cExt, drand48, LIBS="$LIBS -lcExt")
1499       else
1500           dnl Include resources for the "native" port (wxPM).
1501           RESPROGRAMOBJ="\${top_srcdir}/include/wx/os2/wx.res"
1502       fi
1503       dnl Check for the gcc version (and thereby for the C runtime library).
1504       dnl wx_cv_gccversion = EMX2 -> Standard EMX environment
1505       dnl wx_cv_gccversion = EMX3 -> EMX with gcc-3.0.3 or gcc-3.2.1
1506       dnl wx_cv_gccversion = Innotek5 -> gcc-3.2.2 with Innotek libc5
1507       dnl wx_cv_gccversion = Innotek6 -> gcc-3.3.5 with Innotek libc6.
1508       AC_CACHE_CHECK([for gcc/libc version], wx_cv_gccversion,[
1509           AC_TRY_RUN(
1510               dnl Check the gcc version macro.
1511               [
1512                   #include <stdio.h>
1513
1514                   int main()
1515                   {
1516                       FILE *f=fopen("conftestval", "w");
1517                       if (!f) exit(1);
1518                       fprintf(f,
1519                   #if (__GNUC__ < 3)
1520                               "EMX2"
1521                   #elif (__GNUC__==3) && ((__GNUC_MINOR__ < 2) || ((__GNUC_MINOR__==2) && (__GNUC_PATCHLEVEL__<2)))
1522                               "EMX3"
1523                   #elif (__GNUC__==3) && (__GNUC_MINOR__==2) && (__GNUC_PATCHLEVEL__==2)
1524                               "Innotek5"
1525                   #else
1526                               "Innotek6"
1527                   #endif
1528                       );
1529                       exit(0);
1530                   }
1531               ],
1532               wx_cv_gccversion=`cat conftestval`,
1533               wx_cv_gccversion="EMX2",
1534               dnl Compilation error: Assuming standard EMX environment
1535               wx_cv_gccversion="EMX2"
1536           )
1537       ])
1538       if test "$wx_cv_gccversion" = "EMX2"; then
1539           LIBS="$LIBS -lstdcpp"
1540           LDFLAGS="$LDFLAGS -Zsysv-signals"
1541       else
1542           if test "$wx_cv_gccversion" = "EMX3"; then
1543               LIBS="$LIBS -lstdcxx -lgcc"
1544               LDFLAGS="$LDFLAGS -Zsysv-signals"
1545           else
1546               LIBS="$LIBS -lstdc++"
1547           fi
1548       fi
1549       if test "$wxUSE_SHARED" = "yes" -a "$wxUSE_OMF" = "no"; then
1550         AC_MSG_WARN([Building DLLs requires OMF mode, enabled])
1551         wxUSE_OMF=yes
1552         enable_omf=yes
1553       fi
1554       dnl (end of OS/2-only piece)
1555   ;;
1556   *)
1557       dnl ---------------------------------------------------------------------
1558       dnl look for strcasecmp() in string.h and then strings.h if it's not
1559       dnl there. Don't do this on OS/2, where "stricmp" is the function to be
1560       dnl used.
1561       dnl ---------------------------------------------------------------------
1562       dnl (non-OS/2-only piece)
1563
1564       AC_CACHE_CHECK([for strcasecmp() in string.h], ac_cv_string_strcasecmp, [
1565           AC_TRY_LINK([
1566               #include <string.h>
1567               ],
1568               [
1569                   strcasecmp("foo", "bar");
1570               ],
1571               ac_cv_string_strcasecmp=yes,
1572               ac_cv_string_strcasecmp=no
1573           )
1574       ])
1575
1576       if test x"$ac_cv_string_strcasecmp" = "xyes"; then
1577           AC_DEFINE(HAVE_STRCASECMP_IN_STRING_H)
1578       else
1579           AC_CACHE_CHECK([for strcasecmp() in strings.h], ac_cv_strings_strcasecmp, [
1580               AC_TRY_LINK([
1581                   #include <strings.h>
1582                   ],
1583                   [
1584                       strcasecmp("foo", "bar");
1585                   ],
1586                   ac_cv_strings_strcasecmp=yes,
1587                   ac_cv_strings_strcasecmp=no
1588               )
1589           ])
1590
1591           if test x"$ac_cv_strings_strcasecmp" = "xyes"; then
1592               AC_DEFINE(HAVE_STRCASECMP_IN_STRINGS_H)
1593           else
1594               AC_MSG_ERROR([No case-insensitive string comparison function found.])
1595           fi
1596       fi
1597
1598       dnl (end of non-OS/2-only piece)
1599   ;;
1600 esac
1601
1602 dnl ------------------------------------------------------------------------
1603 dnl Check for headers
1604 dnl ------------------------------------------------------------------------
1605
1606 dnl Note: non-empty last parameter makes check compile-only,
1607 dnl   skipping worthless preprocessing check
1608 AC_CHECK_HEADERS(langinfo.h wchar.h,,, [AC_INCLUDES_DEFAULT])
1609
1610 dnl maybe wchar_t is in wcstr.h if we don't have wchar.h?
1611 if test "$ac_cv_header_wchar_h" != "yes"; then
1612     AC_CHECK_HEADERS([wcstr.h],,, [AC_INCLUDES_DEFAULT()])
1613 fi
1614
1615 case "${host}" in
1616   *-pc-os2_emx | *-pc-os2-emx )
1617       dnl Explicitly link -lintl if langinfo.h is available
1618       dnl and intl not yet included in libc
1619       if test $ac_cv_header_langinfo_h = "yes" \
1620                 -a \(   "$wx_cv_gccversion" = "EMX2" \
1621                      -o "$wx_cv_gccversion" = "EMX3" \
1622                      -o "$wx_cv_gccversion" = "Innotek5" \); then
1623           LIBS="$LIBS -lintl"
1624       fi
1625   ;;
1626 esac
1627
1628 dnl POSIX needs this for select(), but old systems don't have it
1629 if test "$USE_UNIX" = 1 ; then
1630     AC_CHECK_HEADERS([sys/select.h],,, [AC_INCLUDES_DEFAULT()])
1631 fi
1632
1633 dnl ---------------------------------------------------------------------------
1634 dnl Checks for compiler characteristics
1635 dnl ---------------------------------------------------------------------------
1636
1637 dnl defines const to be empty if c-compiler does not support const fully
1638 AC_C_CONST
1639 dnl defines inline to a sensible value for the c-compiler
1640 AC_C_INLINE
1641
1642 dnl check the sizes of integral types (give some reasonable default values for
1643 dnl cross-compiling)
1644 dnl   defines the size of certain types of variables in SIZEOF_<TYPE>
1645 AC_CHECK_SIZEOF(short, 2)
1646 AC_CHECK_SIZEOF(void *, 4)
1647 AC_CHECK_SIZEOF(int, 4)
1648 AC_CHECK_SIZEOF(long, 4)
1649 AC_CHECK_SIZEOF(size_t, 4)
1650
1651 case "${host}" in
1652     arm-*-linux* )
1653         AC_CHECK_SIZEOF(long long, 8)
1654     ;;
1655     *-hp-hpux* )
1656         AC_CHECK_SIZEOF(long long, 0)
1657         if test "$ac_cv_sizeof_long_long" != 0; then
1658             dnl HPUX 10.20 headers need this define in order to use long long definitions
1659             CPPFLAGS="-D_INCLUDE_LONGLONG $CPPFLAGS"
1660         fi
1661     ;;
1662     * )
1663         AC_CHECK_SIZEOF(long long, 0)
1664 esac
1665
1666 dnl SGI/Irix's stdio.h does not include wchar_t. Mac OS X does not provide
1667 dnl wchar.h and wchar_t is defined by stdlib.h (GD)
1668 AC_CHECK_SIZEOF(wchar_t, 0,
1669     [
1670         /* DJGPP's wchar_t is now a keyword in C++ (still not C though) */
1671         #if defined(__DJGPP__) && !( (__GNUC_MINOR__ >= 8 && __GNUC__ == 2 ) || __GNUC__ >= 3 )
1672         #  error "fake wchar_t"
1673         #endif
1674         #ifdef HAVE_WCHAR_H
1675         #  ifdef __CYGWIN__
1676         #    include <stddef.h>
1677         #  endif
1678         #  include <wchar.h>
1679         #endif
1680         #ifdef HAVE_STDLIB_H
1681         #  include <stdlib.h>
1682         #endif
1683         #include <stdio.h>
1684     ]
1685 )
1686 if test "$ac_cv_sizeof_wchar_t" = 0; then
1687     AC_MSG_ERROR([wxWidgets requires wchar_t support.])
1688 fi
1689 AC_DEFINE(wxUSE_WCHAR_T)
1690
1691 dnl checks needed to define wxVaCopy
1692 AC_CACHE_CHECK([for va_copy],
1693     wx_cv_func_va_copy,
1694     [
1695         AC_LANG_PUSH(C++)
1696         AC_LINK_IFELSE([
1697             #include <stdarg.h>
1698             void foo(char *f, ...)
1699             {
1700                 va_list ap1, ap2;
1701                 va_start(ap1, f);
1702                 va_copy(ap2, ap1);
1703                 va_end(ap2);
1704                 va_end(ap1);
1705             }
1706             int main()
1707             {
1708                 foo("hi", 17);
1709                 return 0;
1710             }],
1711             wx_cv_func_va_copy=yes,
1712             wx_cv_func_va_copy=no
1713         )
1714         AC_LANG_POP()
1715     ]
1716 )
1717
1718 if test $wx_cv_func_va_copy = "yes"; then
1719     AC_DEFINE(HAVE_VA_COPY)
1720 else
1721     dnl try to understand how can we copy va_lists
1722     AC_CACHE_CHECK([if va_list can be copied by value],
1723         wx_cv_type_va_list_lvalue,
1724         [
1725             AC_RUN_IFELSE([
1726                 #include <stdarg.h>
1727                 int foo(char *f, ...)
1728                 {
1729                     va_list ap1, ap2;
1730                     va_start(ap1, f);
1731                     ap2 = ap1;
1732                     if ( va_arg(ap1, int) != 17 || va_arg(ap2, int) != 17 )
1733                         return 1;
1734                     va_end(ap2);
1735                     va_end(ap1);
1736                     return 0;
1737                 }
1738                 int main()
1739                 {
1740                     return foo("hi", 17);
1741                 }],
1742                 wx_cv_type_va_list_lvalue=yes,
1743                 wx_cv_type_va_list_lvalue=no,
1744                 dnl assume most common case for cross-compiling...
1745                 wx_cv_type_va_list_lvalue=yes
1746             )
1747         ]
1748     )
1749
1750     if test $wx_cv_type_va_list_lvalue != "yes"; then
1751         dnl we suppose that the only thing which can't be copied like this
1752         dnl are arrays... only experience will show whether this is really true
1753         AC_DEFINE(VA_LIST_IS_ARRAY)
1754     fi
1755 fi
1756
1757 dnl don't check for vararg macros if they're explicitly disabled: this is
1758 dnl useful if the user code using the library wants to limit itself to standard
1759 dnl C++ only (e.g. is compiled with g++ -std=c++98)
1760 if test "$wxUSE_VARARG_MACROS" = "yes"; then
1761
1762 dnl Check if variadic macros (C99 feature) are supported:
1763 AC_CACHE_CHECK(
1764     [whether the compiler supports variadic macros],
1765     [wx_cv_have_variadic_macros],
1766     [
1767         dnl C compiler might support variadic macros when C++ one doesn't
1768         dnl (happens with gcc/g++ 2.95.4), so must use C++ one explicitly
1769         AC_LANG_PUSH(C++)
1770         AC_COMPILE_IFELSE(
1771             AC_LANG_PROGRAM(
1772                 [
1773                     #include <stdio.h>
1774                     #define test(fmt, ...) printf(fmt, __VA_ARGS__)
1775                 ],
1776                 [
1777                     test("%s %d %p", "test", 1, 0);
1778                 ]
1779             ),
1780             [wx_cv_have_variadic_macros=yes],
1781             [wx_cv_have_variadic_macros=no]
1782             )
1783         AC_LANG_POP()
1784     ]
1785 )
1786
1787 if test $wx_cv_have_variadic_macros = "yes"; then
1788     AC_DEFINE(HAVE_VARIADIC_MACROS)
1789 fi
1790
1791 fi dnl wxUSE_VARARG_MACROS == yes
1792
1793
1794 dnl check for large file support
1795 LARGEFILE_CPPFLAGS=
1796 AC_SYS_LARGEFILE
1797 if test "$ac_cv_sys_file_offset_bits" = "64"; then
1798     LARGEFILE_CPPFLAGS="-D_FILE_OFFSET_BITS=64"
1799 elif test "$ac_cv_sys_large_files" = 1; then
1800     LARGEFILE_CPPFLAGS="-D_LARGE_FILES"
1801 fi
1802
1803 dnl we need to define _FILE_OFFSET_BITS or _LARGE_FILES on the compiler command
1804 dnl line because otherwise the system headers risk being included before
1805 dnl wx/defs.h which defines these constants leading to inconsistent
1806 dnl sizeof(off_t) in different source files of the same program and linking
1807 dnl problems
1808 if test -n "$LARGEFILE_CPPFLAGS"; then
1809     WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS $LARGEFILE_CPPFLAGS"
1810
1811     dnl We get "Large Files (ILP32) not supported in strict ANSI mode."
1812     dnl #error from HP standard headers unless __STDC_EXT__ is defined.
1813     dnl The compiler should define it automatically, but some old g++
1814     dnl versions don't define it, so test and add it if necessary. AFAIK
1815     dnl the problem only affects the C++ compiler so it is added to
1816     dnl CXXFLAGS only.
1817     if test "$USE_HPUX" = 1 -a "$GXX" = "yes"; then
1818         AC_CACHE_CHECK(
1819             [if -D__STDC_EXT__ is required],
1820             wx_cv_STDC_EXT_required,
1821             [
1822                 AC_LANG_PUSH(C++)
1823                 AC_TRY_COMPILE(
1824                     [],
1825                     [
1826                         #ifndef __STDC_EXT__
1827                             choke me
1828                         #endif
1829                     ],
1830                     wx_cv_STDC_EXT_required=no,
1831                     wx_cv_STDC_EXT_required=yes
1832                 )
1833                 AC_LANG_POP()
1834             ]
1835         )
1836         if test "x$wx_cv_STDC_EXT_required" = "xyes"; then
1837             WXCONFIG_CXXFLAGS="$WXCONFIG_CXXFLAGS -D__STDC_EXT__"
1838         fi
1839     fi
1840 fi
1841
1842 dnl AC_FUNC_FSEEKO sets HAVE_FSEEKO and $ac_cv_sys_largefile_source
1843 dnl
1844 dnl it may be affected by large file flags (this happens under HP-UX 11 for
1845 dnl example) so set them before using it and also use C++ to ensure that we get
1846 dnl errors, not warnings, about the missing functions
1847 AC_LANG_PUSH(C++)
1848 old_CPPFLAGS="$CPPFLAGS"
1849 CPPFLAGS="$CPPFLAGS $LARGEFILE_CPPFLAGS"
1850 AC_FUNC_FSEEKO
1851 CPPFLAGS="$old_CPPFLAGS"
1852 AC_LANG_POP()
1853 if test "$ac_cv_sys_largefile_source" != no; then
1854     WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS -D_LARGEFILE_SOURCE=$ac_cv_sys_largefile_source"
1855 fi
1856
1857 dnl check for bytesex stuff (don't use AC_C_BIGENDIAN to allow cross-compiling)
1858 WX_C_BIGENDIAN
1859
1860 dnl check for iostream (as opposed to iostream.h) standard header
1861 WX_CPP_NEW_HEADERS(, AC_DEFINE(wxUSE_IOSTREAMH))
1862
1863 dnl check whether C++ compiler supports explicit keyword
1864 WX_CPP_EXPLICIT
1865
1866 dnl With Sun CC, temporaries have block scope by default. This flag is needed
1867 dnl to get the expression scope behaviour that conforms to the standard.
1868 if test "x$SUNCXX" = xyes; then
1869     CXXFLAGS="-features=tmplife $CXXFLAGS"
1870 fi
1871
1872 dnl Sun X11 headers are (still, in 2005!) non-ANSI and the best they could do
1873 dnl was to hack their C++ compiler to accept them silently -- but C compiler
1874 dnl still spits out dozens of warnings for each X include file, so suppress
1875 dnl them
1876 if test "x$SUNCC" = xyes; then
1877     CFLAGS="-erroff=E_NO_EXPLICIT_TYPE_GIVEN $CFLAGS"
1878 fi
1879
1880 dnl SGI mipsPro compiler version 7.4.4 and later (and maybe some earlier
1881 dnl versions too but it's known that 7.4.2 doesn't give this warning but does
1882 dnl instead warn about "unknown warning number 3970" which explains that we
1883 dnl don't want to do this for it) gives this warning for "conversion from
1884 dnl pointer to same-sized integral type" even when there is an explicit cast
1885 dnl and as there is no way to turn it off and there are hundreds of these
1886 dnl warnings in wx sources, just turn it off for now
1887 dnl
1888 dnl a better long term solution would be to use #pragma set/reset woff in
1889 dnl wxPtrToUInt() and use it instead of casts elsewhere
1890 if test "x$SGICC" = "xyes"; then
1891     AC_CACHE_CHECK([if cc version is 7.4.4 or greater],
1892         wx_cv_prog_sgicc744,
1893         [
1894             AC_TRY_COMPILE([],
1895                 [
1896                     #if _SGI_COMPILER_VERSION >= 744
1897                     chock me: mipsPro is 7.4.4 or later
1898                     #endif
1899                 ],
1900                 wx_cv_prog_sgicc744=no,
1901                 wx_cv_prog_sgicc744=yes
1902             )
1903         ]
1904     )
1905
1906     if test "x$wx_cv_prog_sgicc744" = "xyes"; then
1907         CFLAGS="-woff 3970 $CFLAGS"
1908     fi
1909 fi
1910 if test "x$SGICXX" = "xyes"; then
1911     AC_CACHE_CHECK([if CC version is 7.4.4 or greater],
1912         wx_cv_prog_sgicxx744,
1913         [
1914             AC_LANG_PUSH(C++)
1915             AC_TRY_COMPILE([],
1916                 [
1917                     #if _SGI_COMPILER_VERSION >= 744
1918                     chock me: mipsPro is 7.4.4 or later
1919                     #endif
1920                 ],
1921                 wx_cv_prog_sgicxx744=no,
1922                 wx_cv_prog_sgicxx744=yes
1923             )
1924             AC_LANG_POP()
1925         ]
1926     )
1927
1928     if test "x$wx_cv_prog_sgicxx744" = "xyes"; then
1929         CXXFLAGS="-woff 3970 $CXXFLAGS"
1930     fi
1931 fi
1932
1933 dnl HP-UX c89/aCC compiler warnings
1934 if test "x$HPCC" = "xyes"; then
1935     dnl 2011: "unrecognized preprocessor directive": nice warning but it's given
1936     dnl       even for directives inside #if which is not true (i.e. which are
1937     dnl       used for other compilers/OS) and so we have no way to get rid of it
1938     dnl 2450: "long long is non standard" -- yes, we know
1939     CFLAGS="+W 2011,2450 $CFLAGS"
1940 fi
1941 if test "x$HPCXX" = "xyes"; then
1942     dnl 2340: "value copied to temporary, reference to temporary used": very
1943     dnl       painful as triggered by any occurrence of user-defined conversion
1944     dnl 4232: "conversion from 'Foo *' to a more strictly aligned type 'Bar *'
1945     dnl       may cause misaligned access": this might indicate a real problem
1946     dnl       but any use of GTK+ cast macros results in it so it's unusable
1947     dnl       for wxGTK code
1948     CXXFLAGS="+W 2340,4232 $CXXFLAGS"
1949 fi
1950
1951 dnl DEC/Compaq/HP cxx warnings
1952 if test "x$COMPAQCXX" = "xyes"; then
1953     dnl -w0 enables all warnings, then we disable some of them:
1954     dnl basclsnondto: base class dtor non virtual (sometimes we do want this)
1955     dnl unrimpret:  "end of routine block may be unreachable" is given for
1956     dnl             every "if ( ) return ...; else return ...;"
1957     dnl intconlosbit: "conversion to integral type of smaller size could lose
1958     dnl               data" this is a useful warning but there are too many of
1959     dnl               them for now
1960     CXXFLAGS="-w0 -msg_disable basclsnondto,unrimpret,intconlosbit"
1961 fi
1962
1963 dnl the next few tests are all for C++ features and so need to be done using
1964 dnl C++ compiler
1965 AC_LANG_PUSH(C++)
1966
1967 dnl check for std::string or std::wstring
1968 if test "$wxUSE_STD_STRING" = "yes" -o "$wxUSE_STL" = "yes"; then
1969     if test "$wxUSE_UNICODE" = "yes"; then
1970         std_string="std::wstring"
1971         char_type="wchar_t"
1972     else
1973         std_string="std::string"
1974         char_type="char"
1975     fi
1976
1977     dnl check if <string> declares std::[w]string
1978     AC_CACHE_CHECK([for $std_string in <string>],
1979         wx_cv_class_stdstring,
1980         [
1981             AC_TRY_COMPILE([#include <string>],
1982                 [$std_string foo;],
1983                 wx_cv_class_stdstring=yes,
1984                 wx_cv_class_stdstring=no
1985             )
1986         ]
1987     )
1988
1989     if test "$wx_cv_class_stdstring" = yes; then
1990         if test "$wxUSE_UNICODE" = "yes"; then
1991             AC_DEFINE(HAVE_STD_WSTRING)
1992         fi
1993         dnl we don't need HAVE_STD_STRING, we just suppose it's available if
1994         dnl wxUSE_STD_STRING==yes
1995     else
1996         AC_CACHE_CHECK([if std::basic_string<$char_type> works],
1997             wx_cv_class_stdbasicstring,
1998             [
1999                 AC_TRY_COMPILE([
2000                     #ifdef HAVE_WCHAR_H
2001                     #  ifdef __CYGWIN__
2002                     #    include <stddef.h>
2003                     #  endif
2004                     #  include <wchar.h>
2005                     #endif
2006                     #ifdef HAVE_STDLIB_H
2007                     #  include <stdlib.h>
2008                     #endif
2009                     #include <stdio.h>
2010                     #include <string>
2011                     ],
2012                     [std::basic_string<$char_type> foo;
2013                      const $char_type* dummy = foo.c_str();],
2014                     wx_cv_class_stdbasicstring=yes,
2015                     wx_cv_class_stdbasicstring=no
2016                 )
2017             ]
2018         )
2019
2020         if test "$wx_cv_class_stdbasicstring" != yes; then
2021             if test "$wxUSE_STL" = "yes"; then
2022                 AC_MSG_ERROR([Can't use --enable-stl without $std_string or std::basic_string<$char_type>])
2023             elif test "$wxUSE_STD_STRING" = "yes"; then
2024                 AC_MSG_ERROR([Can't use --enable-std_string without $std_string or std::basic_string<$char_type>])
2025             else
2026                 AC_MSG_WARN([No $std_string or std::basic_string<$char_type>, switching to --disable-std_string])
2027                 wxUSE_STD_STRING=no
2028             fi
2029         fi
2030     fi
2031 fi
2032
2033 if test "$wxUSE_STD_IOSTREAM" = "yes"; then
2034     AC_CHECK_TYPES([std::istream, std::ostream],,
2035                    [wxUSE_STD_IOSTREAM=no],
2036                    [#include <iostream>])
2037
2038     if test "$wxUSE_STD_IOSTREAM" != "yes"; then
2039         if test "$wxUSE_STD_IOSTREAM" = "yes"; then
2040             AC_MSG_ERROR([Can't use --enable-std_iostreams without std::istream and std::ostream])
2041         else
2042             AC_MSG_WARN([No std::iostreams, switching to --disable-std_iostreams])
2043         fi
2044     fi
2045 fi
2046
2047 if test "$wxUSE_STL" = "yes"; then
2048     dnl check for basic STL functionality
2049     AC_CACHE_CHECK([for basic STL functionality],
2050         wx_cv_lib_stl,
2051         [AC_TRY_COMPILE([#include <string>
2052             #include <functional>
2053             #include <algorithm>
2054             #include <vector>
2055             #include <list>],
2056             [std::vector<int> moo;
2057              std::list<int> foo;
2058              std::vector<int>::iterator it =
2059                  std::find_if(moo.begin(), moo.end(),
2060                               std::bind2nd(std::less<int>(), 3));],
2061             wx_cv_lib_stl=yes,
2062             wx_cv_lib_stl=no
2063         )]
2064     )
2065
2066     if test "$wx_cv_lib_stl" != yes; then
2067          AC_MSG_ERROR([Can't use --enable-stl as basic STL functionality is missing])
2068     fi
2069
2070     dnl check for compliant std::string::compare
2071     AC_CACHE_CHECK([for compliant std::string::compare],
2072         wx_cv_func_stdstring_compare,
2073         [AC_TRY_COMPILE([#include <string>],
2074             [std::string foo, bar;
2075             foo.compare(bar);
2076             foo.compare(1, 1, bar);
2077             foo.compare(1, 1, bar, 1, 1);
2078             foo.compare("");
2079             foo.compare(1, 1, "");
2080             foo.compare(1, 1, "", 2);],
2081             wx_cv_func_stdstring_compare=yes,
2082             wx_cv_func_stdstring_compare=no
2083         )]
2084     )
2085
2086     if test "$wx_cv_func_stdstring_compare" = yes; then
2087         AC_DEFINE(HAVE_STD_STRING_COMPARE)
2088     fi
2089
2090     if test "$wx_cv_class_gnuhashmapset" = yes; then
2091          AC_DEFINE(HAVE_EXT_HASH_MAP)
2092          AC_DEFINE(HAVE_GNU_CXX_HASH_MAP)
2093     fi
2094
2095     AC_CHECK_HEADER([unordered_map],
2096         [AC_CACHE_CHECK([for unordered_map and unordered_set in std],
2097             wx_cv_class_stdunorderedmapset,
2098             [AC_TRY_COMPILE([#include <unordered_map>
2099                 #include <unordered_set>],
2100                 [std::unordered_map<double*, char*> test1;
2101                  std::unordered_set<char*> test2;],
2102                 wx_cv_class_stdunorderedmapset=yes,
2103                 wx_cv_class_stdunorderedmapset=no)
2104             ]
2105         )],
2106         [],
2107         [ ]
2108     )
2109
2110     if test "$wx_cv_class_stdunorderedmapset" = yes; then
2111          AC_DEFINE(HAVE_STD_UNORDERED_MAP)
2112          AC_DEFINE(HAVE_STD_UNORDERED_SET)
2113     else
2114         AC_CHECK_HEADER([tr1/unordered_map],
2115             [AC_CACHE_CHECK([for unordered_map and unordered_set in std::tr1],
2116                 wx_cv_class_tr1unorderedmapset,
2117                 [AC_TRY_COMPILE([#include <tr1/unordered_map>
2118                     #include <tr1/unordered_set>],
2119                     [std::tr1::unordered_map<double*, char*> test1;
2120                      std::tr1::unordered_set<char*> test2;
2121             #if defined(__GNUC__) && (__GNUC__==4) && (__GNUC_MINOR__<2)
2122             #error can't use unordered_{map,set} with gcc-4.[01]: http://gcc.gnu.org/PR24389
2123             #endif],
2124                     wx_cv_class_tr1unorderedmapset=yes,
2125                     wx_cv_class_tr1unorderedmapset=no)
2126                 ]
2127             )],
2128             [],
2129             [ ]
2130         )
2131
2132         if test "$wx_cv_class_tr1unorderedmapset" = yes; then
2133             AC_DEFINE(HAVE_TR1_UNORDERED_MAP)
2134             AC_DEFINE(HAVE_TR1_UNORDERED_SET)
2135         else
2136             dnl check for hash_map and hash_set headers
2137             AC_CHECK_HEADER([hash_map],
2138                 [AC_CACHE_CHECK([for std::hash_map and hash_set],
2139                     wx_cv_class_stdhashmapset,
2140                     [AC_TRY_COMPILE([#include <hash_map>
2141                         #include <hash_set>],
2142                         [std::hash_map<double*, char*, std::hash<double*>, std::equal_to<double*> > test1;
2143                          std::hash_set<char*, std::hash<char*>, std::equal_to<char*> > test2;],
2144                         wx_cv_class_stdhashmapset=yes,
2145                         wx_cv_class_stdhashmapset=no)
2146                     ]
2147                 )],
2148                 [],
2149                 [ ]
2150             )
2151
2152             if test "$wx_cv_class_stdhashmapset" = yes; then
2153                 AC_DEFINE(HAVE_HASH_MAP)
2154                 AC_DEFINE(HAVE_STD_HASH_MAP)
2155             fi
2156
2157             AC_CHECK_HEADER([ext/hash_map],
2158                 [AC_CACHE_CHECK([for GNU hash_map and hash_set],
2159                     wx_cv_class_gnuhashmapset,
2160                     [AC_TRY_COMPILE([#include <ext/hash_map>
2161                         #include <ext/hash_set>],
2162                         [__gnu_cxx::hash_map<double*, char*, __gnu_cxx::hash<double*>, std::equal_to<double*> > test1;
2163                          __gnu_cxx::hash_set<char*, __gnu_cxx::hash<char*>, std::equal_to<char*> > test2;],
2164                         wx_cv_class_gnuhashmapset=yes,
2165                         wx_cv_class_gnuhashmapset=no)
2166                     ]
2167                 )],
2168                 [],
2169                 [ ]
2170             )
2171
2172         fi
2173     fi
2174 fi
2175
2176 AC_CHECK_HEADERS([type_traits tr1/type_traits])
2177
2178 dnl check for atomic operations builtins for wx/atomic.h:
2179 WX_ATOMIC_BUILTINS
2180
2181 dnl pop C++
2182 AC_LANG_POP()
2183
2184 dnl ---------------------------------------------------------------------------
2185 dnl Define search path for includes and libraries: all headers and libs will be
2186 dnl looked for in all directories of this path
2187 dnl ---------------------------------------------------------------------------
2188
2189 dnl Notice that /usr/include should *not* be in this list, otherwise it breaks
2190 dnl compilation on Solaris/AIX/... with gcc because standard (non ANSI C)
2191 dnl headers are included instead of the "fixed" (ANSI-fied) gcc ones.
2192 dnl
2193 dnl Also try to put all directories which may contain X11R6 before those which
2194 dnl may contain X11R5/4 - we want to use R6 on machines which have both!
2195 dnl
2196 dnl In the same vein. Motif 2.1 should be tried before Motif 1.2 for the
2197 dnl systems which have both (AIX 4.x does)
2198 SEARCH_INCLUDE="\
2199     /usr/local/include        \
2200     /usr/local/X11/include    \
2201     /usr/local/include/X11    \
2202     /usr/local/X11R7/include  \
2203     /usr/local/X11R6/include  \
2204     /usr/local/include/X11R7  \
2205     /usr/local/include/X11R6  \
2206                               \
2207     /usr/Motif-2.1/include    \
2208     /usr/Motif-1.2/include    \
2209     /usr/include/Motif1.2     \
2210                               \
2211     /usr/dt/include           \
2212     /usr/openwin/include      \
2213                               \
2214     /usr/include/Xm           \
2215                               \
2216     /usr/X11R7/include        \
2217     /usr/X11R6/include        \
2218     /usr/X11R6.4/include      \
2219                               \
2220     /usr/include/X11R7        \
2221     /usr/include/X11R6        \
2222                               \
2223     /usr/X11/include          \
2224     /usr/include/X11          \
2225                               \
2226     /usr/XFree86/include/X11  \
2227     /usr/pkg/include          \
2228                               \
2229     /usr/local/X1R5/include  \
2230     /usr/local/include/X11R5  \
2231     /usr/X11R5/include        \
2232     /usr/include/X11R5        \
2233                               \
2234     /usr/local/X11R4/include  \
2235     /usr/local/include/X11R4  \
2236     /usr/X11R4/include        \
2237     /usr/include/X11R4        \
2238                               \
2239     /usr/openwin/share/include"
2240
2241 dnl try to find out the standard lib locations for the systems with multiple
2242 dnl ABIs
2243 AC_MSG_CHECKING([for libraries directory])
2244
2245 case "${host}" in
2246     *-*-irix6* )
2247         AC_CACHE_VAL(
2248             wx_cv_std_libpath,
2249             [
2250                 for d in WX_STD_LIBPATH(); do
2251                     for e in a so sl dylib dll.a; do
2252                         libc="$d/libc.$e"
2253                         if test -f $libc; then
2254                             save_LIBS="$LIBS"
2255                             LIBS="$libc"
2256                             AC_LINK_IFELSE([int main() { return 0; }],
2257                                 wx_cv_std_libpath=`echo $d | sed s@/usr/@@`)
2258                             LIBS="$save_LIBS"
2259                             if test "x$wx_cv_std_libpath" != "x"; then
2260                                 break 2
2261                             fi
2262                         fi
2263                     done
2264                 done
2265                 if test "x$wx_cv_std_libpath" = "x"; then
2266                     wx_cv_std_libpath="lib"
2267                 fi
2268             ]
2269         )
2270         ;;
2271
2272     *-*-solaris2* )
2273         dnl use ../lib or ../lib/64 depending on the size of void*
2274         if test "$ac_cv_sizeof_void_p" = 8 -a -d "/usr/lib/64"; then
2275             wx_cv_std_libpath="lib/64"
2276         else
2277             wx_cv_std_libpath="lib"
2278         fi
2279         ;;
2280
2281     *-*-linux* )
2282         dnl use ../lib or ../lib64 depending on the size of void*
2283         if test "$ac_cv_sizeof_void_p" = 8 -a \
2284                 -d "/usr/lib64" -a ! -h "/usr/lib64"; then
2285             wx_cv_std_libpath="lib64"
2286         else
2287             wx_cv_std_libpath="lib"
2288         fi
2289         ;;
2290
2291     *)
2292         wx_cv_std_libpath="lib";
2293         ;;
2294 esac
2295
2296 AC_MSG_RESULT($wx_cv_std_libpath)
2297
2298 SEARCH_LIB="`echo "$SEARCH_INCLUDE" | sed s@include@$wx_cv_std_libpath@g` /usr/$wx_cv_std_libpath"
2299
2300 dnl Cross compiling with gcc?
2301 if test "$build" != "$host" -a "$GCC" = yes; then
2302     dnl for gcc cross-compilers "$CC -print-prog-name=ld" prints the path to
2303     dnl the linker. Stripping off the trailing '/bin/ld' gives us a candiate
2304     dnl for a 'root' below which libraries and headers for the target system
2305     dnl might be installed.
2306     if cross_root=`$CC -print-prog-name=ld 2>/dev/null`; then
2307         cross_root=`dirname $cross_root`
2308         cross_root=`dirname $cross_root`
2309
2310         dnl substitute this candiate root for '^/usr' in the search lists,
2311         dnl strip out any that don't start '^/usr'.
2312         SEARCH_LIB=`for x in $SEARCH_LIB; do echo $x; done | sed -ne "s|^/usr|$cross_root|p"`
2313         SEARCH_INCLUDE=`for x in $SEARCH_INCLUDE; do echo $x; done | sed -ne "s|^/usr|$cross_root|p"`
2314         SEARCH_INCLUDE="$SEARCH_INCLUDE $cross_root/include"
2315
2316         dnl also have pkg-config search for *.pc files under this 'root'
2317         if test -z "$PKG_CONFIG_PATH"; then
2318             PKG_CONFIG_PATH="$cross_root/local/lib/pkgconfig:$cross_root/lib/pkgconfig"
2319             export PKG_CONFIG_PATH
2320         fi
2321
2322         dnl AC_PATH_XTRA doesn't work currently unless -x-includes and
2323         dnl -x-libraries are given on the command line. So if they are not
2324         dnl set then set them here to plausible defaults.
2325         if test -z "$x_includes" -o "$x_includes" = NONE; then
2326             WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, X11/Intrinsic.h)
2327             x_includes=$ac_find_includes
2328         fi
2329         if test -z "$x_libraries" -o "$x_libraries" = NONE; then
2330             WX_PATH_FIND_LIBRARIES($SEARCH_LIB, Xt)
2331             x_libraries=$ac_find_libraries
2332         fi
2333     fi
2334 fi
2335
2336 dnl ------------------------------------------------------------------------
2337 dnl Check for libraries
2338 dnl ------------------------------------------------------------------------
2339
2340 dnl flush the cache because checking for libraries below might abort
2341 AC_CACHE_SAVE
2342
2343 dnl check for glibc version
2344 dnl
2345 dnl VZ: I have no idea why had this check been there originally, but now
2346 dnl     we could probably do without it by just always adding _GNU_SOURCE
2347 if test "$USE_LINUX" = 1 -o "$USE_GNU" = 1; then
2348     AC_CACHE_CHECK([for glibc 2.1 or later], wx_cv_lib_glibc21,[
2349         AC_TRY_COMPILE([#include <features.h>],
2350             [
2351                 #if (__GLIBC__ < 2) || (__GLIBC_MINOR__ < 1)
2352                 not glibc 2.1
2353                 #endif
2354             ],
2355             [
2356                 wx_cv_lib_glibc21=yes
2357             ],
2358             [
2359                 wx_cv_lib_glibc21=no
2360             ]
2361         )
2362     ])
2363     if test "$wx_cv_lib_glibc21" = "yes"; then
2364         AC_DEFINE(wxHAVE_GLIBC2)
2365     fi
2366 fi
2367
2368 dnl we may need _GNU_SOURCE for 2 things:
2369 dnl
2370 dnl  1. to get PTHREAD_MUTEX_RECURSIVE with glibc 2.1+ (strictly speaking we
2371 dnl  only need _XOPEN_SOURCE=500 but just defining this disables _BSD_SOURCE
2372 dnl  which breaks libtiff compilation, so it is simpler to just define
2373 dnl  _GNU_SOURCE to get everything)
2374 dnl
2375 dnl  2. for Unicode functions
2376 if test "x$wx_cv_lib_glibc21" = "xyes"; then
2377     if test "$wxUSE_UNICODE" = "yes" -o "$wxUSE_THREADS" = "yes"; then
2378         AC_DEFINE(_GNU_SOURCE)
2379     fi
2380 fi
2381
2382 dnl Only add the -lm library if floating point functions cannot be used
2383 dnl without it.  This check is important on cygwin because of the bizarre
2384 dnl way that they have organized functions into libraries.  On cygwin, both
2385 dnl libc.a and libm.a are symbolic links to a single lib libcygwin.a.  This
2386 dnl means that
2387 dnl   1) linking with -lm is not necessary, and
2388 dnl   2) linking with -lm is dangerous if the order of libraries is wrong
2389 dnl In particular, if you compile any program with -mno-cygwin and link with
2390 dnl -lm, it will crash instantly when it is run.  This happens because the
2391 dnl linker incorrectly links the Cygwin libm.a (==libcygwin.a), which replaces
2392 dnl the ___main function instead of allowing it to be defined by
2393 dnl /usr/lib/mingw/libmingw32.a as it should be.
2394 dnl
2395 dnl On MacOS X, this test will find that -lm is unnecessary and leave it out.
2396 dnl
2397 dnl Just check a few floating point functions. If they are all found without
2398 dnl -lm, then we must not need -lm.
2399 have_cos=0
2400 have_floor=0
2401 AC_CHECK_FUNCS(cos, have_cos=1)
2402 AC_CHECK_FUNCS(floor, have_floor=1)
2403 AC_MSG_CHECKING(if floating point functions link without -lm)
2404 if test "$have_cos" = 1 -a "$have_floor" = 1; then
2405     AC_MSG_RESULT(yes)
2406 else
2407     AC_MSG_RESULT(no)
2408     LIBS="$LIBS -lm"
2409     # use different functions to avoid configure caching
2410     have_sin=0
2411     have_ceil=0
2412     AC_CHECK_FUNCS(sin, have_sin=1)
2413     AC_CHECK_FUNCS(ceil, have_ceil=1)
2414     AC_MSG_CHECKING(if floating point functions link with -lm)
2415     if test "$have_sin" = 1 -a "$have_ceil" = 1; then
2416         AC_MSG_RESULT(yes)
2417     else
2418         AC_MSG_RESULT(no)
2419         # not sure we should warn the user, crash, etc.
2420     fi
2421 fi
2422
2423 dnl check for C99 string to long long conversion functions, assume that if we
2424 dnl have the unsigned variants, then we have the signed ones as well
2425 dnl
2426 dnl at least under SGI these functions are only available in C99 code and not
2427 dnl in C++ so do these tests using C++ compiler
2428 AC_LANG_PUSH(C++)
2429 if test "wxUSE_UNICODE" = "yes"; then
2430     WX_CHECK_FUNCS(wcstoull)
2431 else
2432     WX_CHECK_FUNCS(strtoull)
2433 fi
2434 AC_LANG_POP()
2435
2436 dnl ---------------------------------------------------------------------------
2437 dnl Optional libraries
2438 dnl
2439 dnl   --with-<lib>=sys
2440 dnl       looks for system library and fails if not found
2441 dnl
2442 dnl   --with-<lib>
2443 dnl   --with-<lib>=yes
2444 dnl       looks for system library and, if not found, prints a warning,
2445 dnl       falls back to the builtin wx version, and continues configuration
2446 dnl
2447 dnl   --with-<lib>=builtin
2448 dnl       uses builtin wx version without searching for system library
2449 dnl
2450 dnl   --with-<lib>=no
2451 dnl   --without-<lib>
2452 dnl       do not use library (neither system nor builtin wx version)
2453 dnl
2454 dnl ---------------------------------------------------------------------------
2455
2456 dnl ------------------------------------------------------------------------
2457 dnl Check for regex libraries
2458 dnl ------------------------------------------------------------------------
2459
2460 if test "$wxUSE_REGEX" != "no"; then
2461     AC_DEFINE(wxUSE_REGEX)
2462
2463     if test "$wxUSE_UNICODE" = "yes" -a "$wxUSE_REGEX" = "yes"; then
2464         AC_MSG_WARN([Defaulting to the builtin regex library for Unicode build.])
2465         wxUSE_REGEX=builtin
2466     fi
2467
2468     if test "$wxUSE_REGEX" = "sys" -o "$wxUSE_REGEX" = "yes" ; then
2469         dnl according to Unix 98 specs, regcomp() is in libc but I believe that
2470         dnl on some old systems it may be in libregex - check for it too?
2471         AC_CHECK_HEADER(regex.h, [AC_CHECK_FUNCS(regcomp re_search)],, [ ])
2472
2473         if test "x$ac_cv_func_regcomp" != "xyes"; then
2474             if test "$wxUSE_REGEX" = "sys" ; then
2475                 AC_MSG_ERROR([system regex library not found! Use --with-regex to use built-in version])
2476             else
2477                 AC_MSG_WARN([system regex library not found, will use built-in instead])
2478                 wxUSE_REGEX=builtin
2479             fi
2480         else
2481             dnl we are using the system library
2482             wxUSE_REGEX=sys
2483             dnl only the built-in supports advanced REs
2484             AC_DEFINE(WX_NO_REGEX_ADVANCED)
2485         fi
2486     fi
2487 fi
2488
2489 dnl ------------------------------------------------------------------------
2490 dnl Check for zlib compression library
2491 dnl ------------------------------------------------------------------------
2492
2493 ZLIB_LINK=
2494 if test "$wxUSE_ZLIB" != "no" ; then
2495     AC_DEFINE(wxUSE_ZLIB)
2496
2497     if test "$wxUSE_ZLIB" = "sys" -o "$wxUSE_ZLIB" = "yes" ; then
2498         dnl don't test for zlib under Mac -- its verson there is 1.1.3 but we
2499         dnl should still use it because hopefully (can someone confirm this?)
2500         dnl Apple did fix the security problem in it and not using the system
2501         dnl library results in a whole bunch of warnings when linking with
2502         dnl Carbon framework
2503         if test "$USE_DARWIN" = 1; then
2504             system_zlib_h_ok="yes"
2505         else
2506             dnl we have troubles with ancient zlib versions (e.g. 1.0.4 is
2507             dnl known to not work) and although I don't know which is
2508             dnl the minimal required version it's safer to test for 1.1.4 as
2509             dnl it fixes a security problem in 1.1.3 -- and hopefully nobody
2510             dnl has anything more ancient (1.1.3 was released in July 1998)
2511             dnl anyhow
2512             AC_CACHE_CHECK([for zlib.h >= 1.1.4], ac_cv_header_zlib_h,
2513                 [AC_TRY_RUN(
2514                     dnl zlib.h defines ZLIB_VERSION="x.y.z"
2515                     [
2516                         #include <zlib.h>
2517                         #include <stdio.h>
2518
2519                         int main()
2520                         {
2521                             FILE *f=fopen("conftestval", "w");
2522                             if (!f) exit(1);
2523                             fprintf(f, "%s",
2524                                     ZLIB_VERSION[0] == '1' &&
2525                                     (ZLIB_VERSION[2] > '1' ||
2526                                     (ZLIB_VERSION[2] == '1' &&
2527                                      ZLIB_VERSION[4] >= '4')) ? "yes" : "no");
2528                             exit(0);
2529                         }
2530                     ],
2531                     ac_cv_header_zlib_h=`cat conftestval`,
2532                     ac_cv_header_zlib_h=no,
2533                     dnl cross-compiling: don't have an answer, try later
2534                     unset ac_cv_header_zlib_h
2535                 )]
2536             )
2537             dnl If the test above did not come up with a value (e.g. cross
2538             dnl compiling) then this should give a definitive answer
2539             AC_CHECK_HEADER(zlib.h,,, [ ])
2540
2541             system_zlib_h_ok=$ac_cv_header_zlib_h
2542         fi
2543
2544         if test "$system_zlib_h_ok" = "yes"; then
2545             AC_CHECK_LIB(z, deflate, ZLIB_LINK=" -lz")
2546         fi
2547
2548         if test "x$ZLIB_LINK" = "x" ; then
2549             if test "$wxUSE_ZLIB" = "sys" ; then
2550                 AC_MSG_ERROR([zlib library not found or too old! Use --with-zlib=builtin to use built-in version])
2551             else
2552                 AC_MSG_WARN([zlib library not found or too old, will use built-in instead])
2553                 wxUSE_ZLIB=builtin
2554             fi
2555         else
2556             dnl we are using the system library
2557             wxUSE_ZLIB=sys
2558         fi
2559     fi
2560 fi
2561
2562 dnl ------------------------------------------------------------------------
2563 dnl Check for png library
2564 dnl ------------------------------------------------------------------------
2565
2566 PNG_LINK=
2567 if test "$wxUSE_LIBPNG" != "no" ; then
2568     AC_DEFINE(wxUSE_LIBPNG)
2569
2570     if test "$wxUSE_MGL" = 1 -a "$wxUSE_LIBPNG" = "builtin" ; then
2571         AC_MSG_WARN([wxMGL doesn't work with builtin png library, will use MGL one instead])
2572         wxUSE_LIBPNG=sys
2573     fi
2574
2575     dnl for the check below to have a chance to succeed, we must already have
2576     dnl libz somewhere (don't do this when bulding wxMGL since its libpng
2577     dnl doesn't depend on zlib)
2578     if test "$wxUSE_MGL" != 1 -a "$wxUSE_LIBPNG" = "sys" -a "$wxUSE_ZLIB" != "sys" ; then
2579         AC_MSG_WARN([system png library doesn't work without system zlib, will use built-in instead])
2580         wxUSE_LIBPNG=builtin
2581     fi
2582
2583     if test "$wxUSE_MGL" != 1 ; then
2584         dnl Don't check for libpng when building wxMGL, libmgl contains it
2585         if test "$wxUSE_LIBPNG" = "sys" -o "$wxUSE_LIBPNG" = "yes" ; then
2586             dnl libpng version 0.9 is known to not work, if an even newer
2587             dnl version is required, just bump it up in the test below
2588             AC_CACHE_CHECK([for png.h > 0.90], ac_cv_header_png_h,
2589                 [AC_TRY_RUN(
2590                     dnl png.h defines PNG_LIBPNG_VER=number
2591                     [
2592                         #include <png.h>
2593                         #include <stdio.h>
2594
2595                         int main()
2596                         {
2597                             FILE *f=fopen("conftestval", "w");
2598                             if (!f) exit(1);
2599                             fprintf(f, "%s",
2600                                      PNG_LIBPNG_VER > 90 ? "yes" : "no");
2601                             exit(0);
2602                         }
2603                     ],
2604                     ac_cv_header_png_h=`cat conftestval`,
2605                     ac_cv_header_png_h=no,
2606                     dnl cross-compiling: test (later) if we have any png.h
2607                     unset ac_cv_header_png_h
2608                 )]
2609             )
2610             AC_CHECK_HEADER(png.h,,, [ ])
2611
2612             if test "$ac_cv_header_png_h" = "yes"; then
2613                 AC_CHECK_LIB(png, png_sig_cmp, PNG_LINK=" -lpng -lz", , [-lz -lm])
2614             fi
2615
2616             if test "x$PNG_LINK" = "x" ; then
2617                 if test "$wxUSE_LIBPNG" = "sys" ; then
2618                     AC_MSG_ERROR([system png library not found or too old! Use --with-libpng=builtin to use built-in version])
2619                 else
2620                     AC_MSG_WARN([system png library not found or too old, will use built-in instead])
2621                     wxUSE_LIBPNG=builtin
2622                 fi
2623             else
2624                 dnl we are using the system library
2625                 wxUSE_LIBPNG=sys
2626             fi
2627         fi
2628     fi
2629 fi
2630
2631 dnl ------------------------------------------------------------------------
2632 dnl Check for jpeg library
2633 dnl ------------------------------------------------------------------------
2634
2635 dnl this check must be done before the check for libtiff as libtiff uses
2636 dnl libjpeg itself
2637 JPEG_LINK=
2638 if test "$wxUSE_LIBJPEG" != "no" ; then
2639     AC_DEFINE(wxUSE_LIBJPEG)
2640
2641     if test "$wxUSE_MGL" = 1 -a "$wxUSE_LIBJPEG" = "builtin" ; then
2642         AC_MSG_WARN([wxMGL doesn't work with builtin jpeg library, will use MGL one instead])
2643         wxUSE_LIBJPEG=sys
2644     fi
2645
2646     if test "$wxUSE_MGL" != 1 ; then
2647         dnl Don't check for libjpeg when building wxMGL, libmgl contains it
2648         if test "$wxUSE_LIBJPEG" = "sys" -o "$wxUSE_LIBJPEG" = "yes" ; then
2649             dnl can't use AC_CHECK_HEADER as jconfig.h defines things like
2650             dnl HAVE_STDLIB_H which are already defined and this provokes
2651             dnl a compiler warning which configure considers as an error...
2652             AC_MSG_CHECKING(for jpeglib.h)
2653             AC_CACHE_VAL(ac_cv_header_jpeglib_h,
2654                 AC_TRY_COMPILE(
2655                     [
2656                         #undef HAVE_STDLIB_H
2657                         #include <stdio.h>
2658                         #include <jpeglib.h>
2659                     ],
2660                     [
2661                     ],
2662                     ac_cv_header_jpeglib_h=yes,
2663                     ac_cv_header_jpeglib_h=no
2664                 )
2665             )
2666             AC_MSG_RESULT($ac_cv_header_jpeglib_h)
2667
2668             if test "$ac_cv_header_jpeglib_h" = "yes"; then
2669                 AC_CHECK_LIB(jpeg, jpeg_read_header, JPEG_LINK=" -ljpeg")
2670             fi
2671
2672             if test "x$JPEG_LINK" = "x" ; then
2673                 if test "$wxUSE_LIBJPEG" = "sys" ; then
2674                     AC_MSG_ERROR([system jpeg library not found! Use --with-libjpeg=builtin to use built-in version])
2675                 else
2676                     AC_MSG_WARN([system jpeg library not found, will use built-in instead])
2677                     wxUSE_LIBJPEG=builtin
2678                 fi
2679             else
2680                 dnl we are using the system library
2681                 wxUSE_LIBJPEG=sys
2682
2683                 if test "$wxUSE_MSW" = 1; then
2684                     dnl boolean is defined by the jpeg headers and also by the
2685                     dnl Windows headers of some compilers. This type has been
2686                     dnl renamed in the builtin, so it is only an issue when
2687                     dnl using an external jpeg lib on Windows.
2688                     AC_CHECK_TYPES(
2689                         [boolean],
2690                         [
2691                             AC_CHECK_SIZEOF(
2692                                 [boolean],
2693                                 [],
2694                                 [
2695                                     #undef HAVE_BOOLEAN
2696                                     #include <stdio.h>
2697                                     #include <jpeglib.h>
2698                                 ])
2699                             AC_DEFINE_UNQUOTED(
2700                                 [wxHACK_BOOLEAN],
2701                                 [wxInt`expr 8 \* $ac_cv_sizeof_boolean`])
2702                         ],
2703                         [],
2704                         [#include <windows.h>])
2705                 fi
2706             fi
2707         fi
2708     fi
2709 fi
2710
2711 dnl ------------------------------------------------------------------------
2712 dnl Check for tiff library
2713 dnl ------------------------------------------------------------------------
2714
2715 TIFF_LINK=
2716 TIFF_PREREQ_LINKS=-lm
2717 if test "$wxUSE_LIBTIFF" != "no" ; then
2718     AC_DEFINE(wxUSE_LIBTIFF)
2719
2720     if test "$wxUSE_LIBTIFF" = "sys" -o "$wxUSE_LIBTIFF" = "yes" ; then
2721         dnl libtiff may depend on libjpeg and libz so use them in the test
2722         dnl below or it would fail
2723         if test "$wxUSE_LIBJPEG" = "sys"; then
2724             TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $JPEG_LINK"
2725         fi
2726         if test "$wxUSE_ZLIB" = "sys"; then
2727             TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $ZLIB_LINK"
2728         fi
2729         AC_CHECK_HEADER(tiffio.h,
2730                         [
2731                             AC_CHECK_LIB(tiff, TIFFError,
2732                                          TIFF_LINK=" -ltiff",
2733                                          ,
2734                                          $TIFF_PREREQ_LINKS)
2735                         ],
2736                         [],
2737                         [ ]
2738                        )
2739
2740         if test "x$TIFF_LINK" = "x" ; then
2741             if test "$wxUSE_LIBTIFF" = "sys" ; then
2742                 AC_MSG_ERROR([system tiff library not found! Use --with-libtiff=builtin to use built-in version])
2743             else
2744                 AC_MSG_WARN([system tiff library not found, will use built-in instead])
2745                 wxUSE_LIBTIFF=builtin
2746             fi
2747         else
2748             dnl we are using the system library
2749             wxUSE_LIBTIFF=sys
2750         fi
2751     fi
2752     if test "$wxUSE_LIBTIFF" = "builtin" ; then
2753         if test "$wxUSE_LIBJPEG" = "no"; then
2754             dnl we have to prevent the builtin libtiff configure from building the
2755             dnl library with JPEG support as this was explicitly disabled by user,
2756             dnl but unfortunately it needs --disable-jpeg and not --without-libjpeg
2757             dnl (which will be passed to it anyhow as configure passes arguments to
2758             dnl the top-level script to all the other ones called recursively), so
2759             dnl we need to hack around this
2760             ac_configure_args="$ac_configure_args --disable-jpeg"
2761         fi
2762         AC_CONFIG_SUBDIRS([src/tiff])
2763     fi
2764 fi
2765
2766 dnl ------------------------------------------------------------------------
2767 dnl Check for expat libraries
2768 dnl ------------------------------------------------------------------------
2769
2770 if test "$wxUSE_EXPAT" != "no"; then
2771     wxUSE_XML=yes
2772     AC_DEFINE(wxUSE_EXPAT)
2773     AC_DEFINE(wxUSE_XML)
2774
2775     if test "$wxUSE_EXPAT" = "sys" -o "$wxUSE_EXPAT" = "yes" ; then
2776         AC_CHECK_HEADER([expat.h], [found_expat_h=1],, [ ])
2777         if test "x$found_expat_h" = "x1"; then
2778             dnl Expat 1.95.6 comes with broken expat.h:
2779             AC_CACHE_CHECK([if expat.h is valid C++ header],
2780                 wx_cv_expat_is_not_broken,
2781                 [
2782                 AC_LANG_PUSH(C++)
2783                 AC_TRY_COMPILE([#include <expat.h>],[],
2784                     wx_cv_expat_is_not_broken=yes,
2785                     wx_cv_expat_is_not_broken=no
2786                 )
2787                 AC_LANG_POP()
2788                 ]
2789             )
2790             if test "$wx_cv_expat_is_not_broken" = "yes" ; then
2791                 AC_CHECK_LIB(expat, XML_ParserCreate, EXPAT_LINK=" -lexpat")
2792             fi
2793         fi
2794         if test "x$EXPAT_LINK" = "x" ; then
2795             if test "$wxUSE_EXPAT" = "sys" ; then
2796                 AC_MSG_ERROR([system expat library not found! Use --with-expat=builtin to use built-in version])
2797             else
2798                 AC_MSG_WARN([system expat library not found, will use built-in instead])
2799                 wxUSE_EXPAT=builtin
2800             fi
2801         else
2802             dnl we are using the system library
2803             wxUSE_EXPAT=sys
2804         fi
2805     fi
2806     if test "$wxUSE_EXPAT" = "builtin" ; then
2807         dnl Expat needs this:
2808         AC_CONFIG_SUBDIRS([src/expat])
2809     fi
2810 fi
2811
2812
2813 dnl ------------------------------------------------------------------------
2814 dnl Check for libmspack
2815 dnl ------------------------------------------------------------------------
2816
2817 if test "$wxUSE_LIBMSPACK" != "no"; then
2818     AC_CHECK_HEADER([mspack.h], [found_mspack_h=1],, [ ])
2819     if test "x$found_mspack_h" = "x1"; then
2820         AC_CHECK_LIB(mspack, mspack_create_chm_decompressor,
2821                      MSPACK_LINK=" -lmspack")
2822     fi
2823     if test "x$MSPACK_LINK" = "x" ; then
2824         wxUSE_LIBMSPACK=no
2825     fi
2826 fi
2827
2828 if test "$wxUSE_LIBMSPACK" != "no"; then
2829     AC_DEFINE(wxUSE_LIBMSPACK)
2830 fi
2831
2832
2833 dnl ----------------------------------------------------------------
2834 dnl search for toolkit (widget sets)
2835 dnl ----------------------------------------------------------------
2836
2837 AFMINSTALL=
2838 WIN32INSTALL=
2839
2840 TOOLKIT=
2841 TOOLKIT_INCLUDE=
2842 WIDGET_SET=
2843
2844 dnl are we building for a win32 target environment?
2845 dnl If so, setup common stuff needed for both GUI and Base libs.
2846 if test "$USE_WIN32" = 1 ; then
2847     AC_CHECK_HEADERS(w32api.h,,, [ ])
2848     AC_CHECK_HEADER(windows.h,,
2849     [
2850         AC_MSG_ERROR(please set CFLAGS to contain the location of windows.h)
2851     ],
2852     [ ])
2853
2854     LIBS="$LIBS -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -ladvapi32 -lwsock32 -lgdi32"
2855     case "${host}" in
2856         x86_64-*-mingw32* )
2857             dnl we need to define this to embed the manifest for correct
2858             dnl platform from wx/msw/wx.rc (this is not needed for x86 which is
2859             dnl the default in wx/msw/rcdefs.h)
2860             WINDRES_CPU_DEFINE="--define WX_CPU_AMD64"
2861         ;;
2862     esac
2863     if test "$wxUSE_ACCESSIBILITY" = "yes" ; then
2864         LIBS="$LIBS -loleacc"
2865     fi
2866
2867     case "${host}" in
2868         *-*-cygwin* )
2869             dnl Cygwin doesn't include these by default
2870             LIBS="$LIBS -lkernel32 -luser32"
2871     esac
2872
2873     dnl This one is still used by some sample makefiles.
2874     RESFLAGS="--include-dir \$(top_srcdir)/include --include-dir \$(top_srcdir)/\$(program_dir) --define __WIN32__ --define __WIN95__ --define __GNUWIN32__ $WINDRES_CPU_DEFINE"
2875     RESPROGRAMOBJ="\$(PROGRAM)_resources.o"
2876
2877     dnl This lot we export to wx-config.  It must add the relevant
2878     dnl include directories at the point when they can be known.
2879     dnl (but are these (still) required anyway?)
2880     WXCONFIG_RESFLAGS="--define __WIN32__ --define __WIN95__ --define __GNUWIN32__ $WINDRES_CPU_DEFINE"
2881
2882     dnl install Win32-specific files in "make install"
2883     WIN32INSTALL=win32install
2884
2885     dnl pbt.h is missing on Wine at least
2886     AC_CHECK_HEADER([pbt.h],, [AC_DEFINE(NEED_PBT_H)], [ ])
2887 fi
2888
2889 if test "$wxUSE_GUI" = "yes"; then
2890     USE_GUI=1
2891
2892     GUI_TK_LIBRARY=
2893
2894     WXGTK12=
2895     WXGTK127=
2896     WXGTK2=
2897     WXGPE=
2898
2899     if test "$wxUSE_OLD_COCOA" = 1 ; then
2900         if test "$wxUSE_PRINTING_ARCHITECTURE" = "yes"; then
2901             AC_MSG_WARN([Printing not supported under wxCocoa yet, disabled])
2902             wxUSE_PRINTING_ARCHITECTURE=no
2903         fi
2904         if test "$wxUSE_DRAG_AND_DROP" = "yes"; then
2905             AC_MSG_WARN([Drag and Drop not supported under wxCocoa yet, disabled])
2906             wxUSE_DRAG_AND_DROP=no
2907         fi
2908         if test "$wxUSE_DRAGIMAGE" = "yes"; then
2909             AC_MSG_WARN([wxDragImage not supported under wxCocoa yet, disabled])
2910             wxUSE_DRAGIMAGE=no
2911         fi
2912     fi
2913
2914     if test "$wxUSE_MSW" = 1 ; then
2915         TOOLKIT=MSW
2916         GUIDIST=MSW_DIST
2917
2918         dnl -mwindows causes a heap of other default gui libs to be linked in.
2919         case "${host}" in
2920             *-*-mingw32* )
2921                 WXCONFIG_LDFLAGS_GUI="$LDFLAGS -Wl,--subsystem,windows -mwindows"
2922         esac
2923     fi
2924
2925     if test "$wxUSE_GTK" = 1; then
2926         dnl GTK+ test program must be compiled with C compiler
2927         AC_MSG_CHECKING([for GTK+ version])
2928
2929         gtk_version_cached=1
2930         AC_CACHE_VAL(wx_cv_lib_gtk,
2931             [
2932                 dnl stupid GTK+ AM macros produce their own messages, so we
2933                 dnl have to pass to the next line
2934                 gtk_version_cached=0
2935                 AC_MSG_RESULT()
2936
2937                 dnl we must link against lgthread unless the user
2938                 dnl used --disable-threads
2939                 GTK_MODULES=
2940                 if test "$wxUSE_THREADS" = "yes"; then
2941                     GTK_MODULES=gthread
2942                 fi
2943
2944                 dnl detect GTK2
2945                 wx_cv_lib_gtk=
2946                 if test "x$wxGTK_VERSION" != "x1"
2947                 then
2948                     dnl The gthread.pc that ships with Solaris returns '-mt',
2949                     dnl it's correct for Sun CC, but gcc requires '-pthreads'.
2950                     dnl So disable the compile check and remove the -mt below.
2951                     case "${host}" in
2952                         *-*-solaris2* )
2953                             if test "$wxUSE_THREADS" = "yes" -a "$GCC" = yes; then
2954                                 enable_gtktest=no
2955                             fi
2956                     esac
2957
2958                     AM_PATH_GTK_2_0(2.4.0, wx_cv_lib_gtk=2.0, , $GTK_MODULES)
2959
2960                     dnl we use symbols from X11 directly so we should link with it
2961                     GTK_LIBS="$GTK_LIBS -lX11"
2962                 fi
2963
2964                 dnl detect GTK1.x
2965                 if test -z "$wx_cv_lib_gtk"; then
2966                     if test "x$wxGTK_VERSION" = "x1" -o "x$wxGTK_VERSION" = "xany" ; then
2967                         AM_PATH_GTK(1.2.7, wx_cv_lib_gtk=1.2.7, , $GTK_MODULES)
2968
2969                         if test -z "$wx_cv_lib_gtk"; then
2970                             AM_PATH_GTK(1.2.3, wx_cv_lib_gtk=1.2.3, , $GTK_MODULES)
2971                         fi
2972                     fi
2973                 fi
2974
2975                 if test -z "$wx_cv_lib_gtk"; then
2976                     dnl looks better in AC_MSG_RESULT
2977                     wx_cv_lib_gtk=none
2978                 else
2979                     dnl we need to cache GTK_CFLAGS and GTK_LIBS for the
2980                     dnl subsequent runs
2981                     wx_cv_cflags_gtk=$GTK_CFLAGS
2982                     wx_cv_libs_gtk=$GTK_LIBS
2983                 fi
2984             ]
2985         )
2986
2987         dnl if it wasn't cached, the messages from AM_PATH_GTK() above are
2988         dnl enough
2989         if test "$gtk_version_cached" = 1; then
2990             AC_MSG_RESULT($wx_cv_lib_gtk)
2991         fi
2992
2993         case "$wx_cv_lib_gtk" in
2994             2.0)    WXGTK2=1
2995                     TOOLKIT_VERSION=2
2996                     ;;
2997             1.2.7)  WXGTK127=1
2998                     WXGTK12=1
2999                     ;;
3000             1.2.3)  WXGTK12=1
3001                     ;;
3002             *)      AC_MSG_ERROR([
3003 The development files for GTK+ were not found. For GTK+ 2, please
3004 ensure that pkg-config is in the path and that gtk+-2.0.pc is
3005 installed. For GTK+ 1.2 please check that gtk-config is in the path,
3006 and that the version is 1.2.3 or above. Also check that the
3007 libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
3008 --libs' are in the LD_LIBRARY_PATH or equivalent.
3009                             ])
3010                     ;;
3011         esac
3012
3013         if test "$WXGTK2" = 1; then
3014             save_CFLAGS="$CFLAGS"
3015             save_LIBS="$LIBS"
3016             CFLAGS="$wx_cv_cflags_gtk $CFLAGS"
3017             LIBS="$LIBS $wx_cv_libs_gtk"
3018
3019             dnl test if we have at least GTK+ 2.18:
3020             AC_MSG_CHECKING([if GTK+ is version >= 2.18])
3021             AC_TRY_COMPILE([
3022                             #include <gtk/gtk.h>
3023                            ],
3024                            [
3025                             #if !GTK_CHECK_VERSION(2,18,0)
3026                             Not GTK+ 2.18
3027                             #endif
3028                            ],
3029                            [
3030                             AC_DEFINE(__WXGTK218__)
3031                             AC_DEFINE(__WXGTK210__)
3032                             AC_DEFINE(__WXGTK26__)
3033                             AC_MSG_RESULT([yes])
3034                             ac_wxgtk218=1
3035                            ],
3036                            [
3037                             AC_MSG_RESULT([no])
3038                             ac_wxgtk218=0
3039                            ])
3040
3041             if test "$ac_wxgtk218" = 0; then
3042                 dnl test if we have at least GTK+ 2.10:
3043                 AC_MSG_CHECKING([if GTK+ is version >= 2.10])
3044                 AC_TRY_COMPILE([
3045                                 #include <gtk/gtk.h>
3046                                ],
3047                                [
3048                                 #if !GTK_CHECK_VERSION(2,10,0)
3049                                 Not GTK+ 2.10
3050                                 #endif
3051                                ],
3052                                [
3053                                 AC_DEFINE(__WXGTK210__)
3054                                 AC_DEFINE(__WXGTK26__)
3055                                 AC_MSG_RESULT([yes])
3056                                 ac_wxgtk210=1
3057                                ],
3058                                [
3059                                 AC_MSG_RESULT([no])
3060                                 ac_wxgtk210=0
3061                                ])
3062
3063                 if test "$ac_wxgtk210" = 0; then
3064                     dnl test if we have at least GTK+ 2.6:
3065                     AC_MSG_CHECKING([if GTK+ is version >= 2.6])
3066                     AC_TRY_COMPILE([
3067                                     #include <gtk/gtk.h>
3068                                 ],
3069                                 [
3070                                     #if !GTK_CHECK_VERSION(2,6,0)
3071                                     Not GTK+ 2.6
3072                                     #endif
3073                                 ],
3074                                 [
3075                                     AC_DEFINE(__WXGTK26__)
3076                                     AC_MSG_RESULT([yes])
3077                                     ac_wxgtk26=1
3078                                 ],
3079                                 [
3080                                     AC_MSG_RESULT([no])
3081                                     ac_wxgtk26=0
3082                                 ])
3083                 fi
3084             fi
3085
3086             CFLAGS="$save_CFLAGS"
3087             LIBS="$save_LIBS"
3088         else
3089             if test "$wxUSE_UNICODE" = "yes"; then
3090                 AC_MSG_WARN([Unicode configuration not supported with GTK+ 1.x])
3091                 wxUSE_UNICODE=no
3092             fi
3093
3094             dnl test for XIM support in libgdk
3095             AC_CHECK_LIB(gdk, gdk_im_open, AC_DEFINE(HAVE_XIM))
3096
3097             dnl we need poll() in src/gtk1/app.cpp (we know that Darwin doesn't
3098             dnl have it but we do the check for the others)
3099             if test "$USE_DARWIN" != 1; then
3100                 AC_CHECK_FUNCS(poll)
3101             fi
3102         fi
3103
3104         TOOLKIT_INCLUDE="$wx_cv_cflags_gtk"
3105         GUI_TK_LIBRARY="$wx_cv_libs_gtk $GUI_TK_LIBRARY"
3106
3107         dnl disable GTK runtime type checks
3108         TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE -DG_DISABLE_CAST_CHECKS"
3109
3110         AFMINSTALL=afminstall
3111         TOOLKIT=GTK
3112         GUIDIST=GTK_DIST
3113
3114         dnl test for external libxpm if we're configured to use it
3115         if test "$wxUSE_GPE" = "yes"; then
3116             AC_MSG_CHECKING(for gpewidget library)
3117             WX_PATH_FIND_LIBRARIES($SEARCH_LIB,gpewidget)
3118             if test "$ac_find_libraries" != "" ; then
3119                 WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
3120                 dnl -lgpewidget must be before all GTK libs and
3121                 dnl we guess its path from the prefix
3122                 GUI_TK_LIBRARY="-L${prefix}/lib -lgpewidget $GUI_TK_LIBRARY"
3123                 WXGPE=1
3124                 AC_MSG_RESULT([found in $ac_find_libraries])
3125             else
3126                 AC_MSG_RESULT(not found)
3127             fi
3128
3129             dnl AC_MSG_CHECKING(for gpe library)
3130             dnl WX_PATH_FIND_LIBRARIES($SEARCH_LIB,gpe)
3131             dnl if test "$ac_find_libraries" != "" ; then
3132             dnl     WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
3133             dnl     GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lgpe"
3134             dnl     AC_MSG_RESULT(found in $ac_find_libraries)
3135             dnl else
3136             dnl     AC_MSG_RESULT(not found)
3137             dnl fi
3138         fi
3139     fi
3140
3141     if test "$wxUSE_MGL" = 1; then
3142        AC_MSG_CHECKING(for SciTech MGL library)
3143         if test "x$MGL_ROOT" = x ; then
3144             AC_MSG_RESULT(not found)
3145             AC_MSG_ERROR([Cannot find MGL library. Make sure MGL_ROOT is set.])
3146         else
3147             AC_MSG_RESULT($MGL_ROOT)
3148         fi
3149
3150         AC_MSG_CHECKING(for libmgl location)
3151         dnl Find MGL library that we want
3152         dnl FIXME_MGL - test for MGL variants for freebsd etc.;
3153         dnl             and for non-x86 versions
3154         case "${host}" in
3155             *-*-linux* )
3156               dnl glibc.so, glibc are for older versions of MGL,
3157               dnl x86/a, x86/so are used by >= 5.0 R11
3158               if test "x$wxUSE_SHARED" = xyes ; then
3159                   mgl_os_candidates="linux/gcc/x86/so linux/gcc/x86/a linux/gcc/glibc.so linux/gcc/glibc"
3160               else
3161                   mgl_os_candidates="linux/gcc/x86/a linux/gcc/x86/so linux/gcc/glibc linux/gcc/glibc.so"
3162               fi
3163               ;;
3164             *-pc-msdosdjgpp )
3165               mgl_os_candidates="dos32/dj2"
3166               ;;
3167             *)
3168               AC_MSG_ERROR(This system type ${host} is not yet supported by wxMGL.)
3169         esac
3170
3171         mgl_lib_type=""
3172         mgl_os=""
3173
3174         for mgl_os_i in $mgl_os_candidates ; do
3175             if test "x$mgl_os" = x ; then
3176                 if test "$wxUSE_DEBUG_FLAG" = yes ; then
3177                     if test -f $MGL_ROOT/lib/debug/$mgl_os_i/libmgl.a -o \
3178                             -f $MGL_ROOT/lib/debug/$mgl_os_i/libmgl.so; then
3179                         mgl_lib_type=debug
3180                         mgl_os=$mgl_os_i
3181                     fi
3182                 fi
3183                 if test "x$mgl_lib_type" = x ; then
3184                     if test -f $MGL_ROOT/lib/release/$mgl_os_i/libmgl.a -o \
3185                             -f $MGL_ROOT/lib/release/$mgl_os_i/libmgl.so; then
3186                         mgl_lib_type=release
3187                         mgl_os=$mgl_os_i
3188                     fi
3189                 fi
3190             fi
3191         done
3192
3193         if test "x$mgl_os" = x ; then
3194             AC_MSG_RESULT(not found)
3195             AC_MSG_ERROR([Cannot find MGL libraries, make sure they are compiled.])
3196         fi
3197         AC_MSG_RESULT("$MGL_ROOT/lib/$mgl_lib_type/$mgl_os")
3198
3199         wxUSE_UNIVERSAL="yes"
3200
3201         TOOLKIT_INCLUDE="-I$MGL_ROOT/include"
3202         GUI_TK_LIBRARY="-L$MGL_ROOT/lib/$mgl_lib_type/$mgl_os -lmgl -lmglcpp -lpm"
3203
3204         AFMINSTALL=afminstall
3205         TOOLKIT=MGL
3206         GUIDIST=MGL_DIST
3207     fi
3208
3209     if test "$wxUSE_DFB" = 1; then
3210        PKG_PROG_PKG_CONFIG()
3211
3212        PKG_CHECK_MODULES(DIRECTFB,
3213                          [directfb >= 0.9.23],
3214                          [
3215                            wxUSE_UNIVERSAL="yes"
3216                            TOOLKIT_INCLUDE="$DIRECTFB_CFLAGS"
3217                            GUI_TK_LIBRARY="$DIRECTFB_LIBS"
3218                            TOOLKIT=DFB
3219                            GUIDIST=DFB_DIST
3220                          ],
3221                          [
3222                            AC_MSG_ERROR([DirectFB not found.])
3223                          ]
3224                          )
3225     fi
3226
3227     if test "$wxUSE_MICROWIN" = 1; then
3228         AC_MSG_CHECKING(for MicroWindows)
3229         if test "x$MICROWINDOWS" = x ; then
3230             AC_MSG_RESULT(not found)
3231             AC_MSG_ERROR([Cannot find MicroWindows library. Make sure MICROWINDOWS is set.])
3232         else
3233             AC_MSG_RESULT($MICROWINDOWS)
3234         fi
3235
3236         if test -f $MICROWINDOWS/lib/libmwin.a; then
3237             AC_MSG_RESULT(MicroWindows' libraries found.)
3238         else
3239             AC_MSG_ERROR([Cannot find MicroWindows libraries, make sure they are compiled.])
3240         fi
3241
3242         TOOLKIT_INCLUDE="-I$MICROWINDOWS/include"
3243         GUI_TK_LIBRARY="-L$MICROWINDOWS/lib -lmwin -lmwengine -mwfonts -mwdrivers -mwinlib"
3244
3245         wxUSE_UNIVERSAL="yes"
3246
3247         AFMINSTALL=afminstall
3248         TOOLKIT=MICROWIN
3249         GUIDIST=MICROWIN_DIST
3250
3251         TOOLCHAIN_DEFS="${TOOLCHAIN_DEFS} -D__WXMSW__ -D__WIN95__ -D__WIN32__ -DMWIN -DMICROWIN_NOCONTROLS -DMICROWIN_TODO=1"
3252     fi
3253
3254     dnl common part of X11 and Motif port checks
3255     if test "$wxUSE_X11" = 1 -o "$wxUSE_MOTIF" = 1; then
3256         dnl use standard macros to check for X headers/libs, this brings
3257         dnl support for the standard configure options --x-includes,
3258         dnl --x-libraries and --no-x
3259         AC_PATH_XTRA
3260
3261         if test "$no_x" = "yes"; then
3262           AC_MSG_ERROR([X11 not found, please use --x-includes and/or --x-libraries options (see config.log for details)])
3263         fi
3264
3265         dnl for some reason AC_PATH_XTRA seems to add -INONE and -LNONE (and
3266         dnl also sometimes -RNONE) to X_CFLAGS and X_LIBS respectively, filter
3267         dnl this junk out
3268         GUI_TK_LIBRARY=`echo $X_LIBS | sed 's/ -LNONE//' | sed 's/ -RNONE//'`
3269         TOOLKIT_INCLUDE=`echo $X_CFLAGS | sed 's/ -INONE//'`
3270         AFMINSTALL=afminstall
3271         COMPILED_X_PROGRAM=0
3272
3273     fi
3274
3275     if test "$wxUSE_X11" = 1; then
3276         if test "$wxUSE_NANOX" = "yes"; then
3277             AC_MSG_CHECKING(for MicroWindows/NanoX distribution)
3278             if test "x$MICROWIN" = x ; then
3279                 AC_MSG_RESULT(not found)
3280                 AC_MSG_ERROR([Cannot find MicroWindows library. Make sure MICROWIN is set.])
3281             else
3282                 AC_MSG_RESULT($MICROWIN)
3283                 AC_DEFINE(wxUSE_NANOX)
3284             fi
3285         fi
3286
3287         if test "$wxUSE_UNICODE" = "yes"; then
3288             PKG_PROG_PKG_CONFIG()
3289
3290             PKG_CHECK_MODULES(PANGOX, pangox,
3291                 [
3292                     CFLAGS="$PANGOX_CFLAGS $CFLAGS"
3293                     CXXFLAGS="$PANGOX_CFLAGS $CXXFLAGS"
3294                     GUI_TK_LIBRARY="$GUI_TK_LIBRARY $PANGOX_LIBS"
3295                 ],
3296                 [
3297                     AC_MSG_ERROR([pangox library not found, library cannot be compiled in Unicode mode])
3298                 ]
3299             )
3300             PKG_CHECK_MODULES(PANGOFT2, pangoft2,
3301                 [
3302                     CFLAGS="$PANGOFT2_CFLAGS $CFLAGS"
3303                     CXXFLAGS="$PANGOFT2_CFLAGS $CXXFLAGS"
3304                     GUI_TK_LIBRARY="$GUI_TK_LIBRARY $PANGOFT2_LIBS"
3305                 ],
3306                 [
3307                     AC_MSG_WARN([pangoft2 library not found, library will be compiled without printing support])
3308                     wxUSE_PRINTING_ARCHITECTURE="no"
3309                 ]
3310             )
3311             PKG_CHECK_MODULES(PANGOXFT, pangoxft,
3312                 [
3313                     AC_DEFINE(HAVE_PANGO_XFT)
3314                     CFLAGS="$PANGOXFT_CFLAGS $CFLAGS"
3315                     CXXFLAGS="$PANGOXFT_CFLAGS $CXXFLAGS"
3316                     GUI_TK_LIBRARY="$GUI_TK_LIBRARY $PANGOXFT_LIBS"
3317                 ],
3318                 [
3319                     AC_MSG_WARN([pangoxft library not found, library will be compiled without anti-aliasing support])
3320                 ]
3321             )
3322             save_LIBS="$LIBS"
3323             LIBS="$LIBS $PANGOX_LIBS"
3324             AC_CHECK_FUNCS([pango_font_family_is_monospace])
3325             LIBS="$save_LIBS"
3326         fi
3327
3328         wxUSE_UNIVERSAL="yes"
3329
3330         if test "$wxUSE_NANOX" = "yes"; then
3331             TOOLKIT_INCLUDE="-I\$(top_srcdir)/include/wx/x11/nanox -I\$(MICROWIN)/src/include $TOOLKIT_INCLUDE"
3332             TOOLCHAIN_DEFS="${TOOLCHAIN_DEFS} -D__NANOX__ -DMWPIXEL_FORMAT=MWPF_TRUECOLOR0888 -DHAVE_FILEIO -DHAVE_BMP_SUPPORT=1 -DHAVE_GIF_SUPPORT=1 -DHAVE_PNM_SUPPORT=1 -DHAVE_XPM_SUPPORT=1 -DUNIX=1 -DUSE_EXPOSURE -DSCREEN_HEIGHT=480 -DSCREEN_WIDTH=640 -DSCREEN_DEPTH=4 -DX11=1"
3333             GUI_TK_LIBRARY="$GUI_TK_LIBRARY \$(MICROWIN)/src/lib/libnano-X.a"
3334         else
3335             GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lX11"
3336         fi
3337
3338         TOOLKIT=X11
3339         GUIDIST=X11_DIST
3340     fi
3341
3342     if test "$wxUSE_MOTIF" = 1; then
3343         AC_MSG_CHECKING(for Motif/Lesstif headers)
3344         WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, Xm/Xm.h)
3345         if test "$ac_find_includes" != "" ; then
3346             AC_MSG_RESULT(found in $ac_find_includes)
3347             WX_INCLUDE_PATH_EXIST($ac_find_includes, $TOOLKIT_INCLUDE)
3348             TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE$ac_path_to_include"
3349         else
3350             save_CFLAGS=$CFLAGS
3351             CFLAGS="$TOOLKIT_INCLUDE $CFLAGS"
3352
3353             AC_TRY_COMPILE(
3354                 [
3355                     #include <Xm/Xm.h>
3356                 ],
3357                 [
3358                     int version;
3359                     version = xmUseVersion;
3360                 ],
3361                 [
3362                     AC_MSG_RESULT(found in default search path)
3363                     COMPILED_X_PROGRAM=1
3364                 ],
3365                 [
3366                     AC_MSG_RESULT(no)
3367                     AC_MSG_ERROR(please set CPPFLAGS to contain the location of Xm/Xm.h)
3368                 ]
3369             )
3370
3371             CFLAGS=$save_CFLAGS
3372         fi
3373
3374
3375         AC_MSG_CHECKING(for Motif/Lesstif library)
3376         WX_PATH_FIND_LIBRARIES($SEARCH_LIB, Xm)
3377
3378         if test "x$ac_find_libraries" != "x" ; then
3379             AC_MSG_RESULT(found in $ac_find_libraries)
3380
3381             WX_LINK_PATH_EXIST($ac_find_libraries, $GUI_TK_LIBRARY)
3382             GUI_TK_LIBRARY="$GUI_TK_LIBRARY$ac_path_to_link"
3383         else
3384             dnl it might happen that we found headers in one of the standard
3385             dnl paths but the libs are elsewhere but still in default (linker)
3386             dnl path -- try to compile a test program to check for this
3387             save_CFLAGS=$CFLAGS
3388             CFLAGS="$TOOLKIT_INCLUDE $CFLAGS"
3389             save_LIBS="$LIBS"
3390             LIBS="$GUI_TK_LIBRARY -lXm -lXmu -lXext -lX11"
3391
3392             AC_TRY_LINK(
3393                 [
3394                     #include <Xm/Xm.h>
3395                 ],
3396                 [
3397                     int version;
3398                     version = xmUseVersion;
3399                 ],
3400                 [
3401                     AC_MSG_RESULT(found in default search path)
3402                     COMPILED_X_PROGRAM=1
3403                 ],
3404                 [
3405                     AC_MSG_RESULT(no)
3406                     AC_MSG_ERROR(please set LDFLAGS to contain the location of libXm)
3407                 ]
3408             )
3409
3410             CFLAGS=$save_CFLAGS
3411             LIBS="$save_LIBS"
3412         fi
3413
3414         AC_MSG_CHECKING([if we need -lXp and/or -lSM -lICE])
3415         libp_link=""
3416         libsm_ice_link=""
3417         libs_found=0
3418         for libp in "" " -lXp"; do
3419             if test "$libs_found" = 0; then
3420                 for libsm_ice in "" " -lSM -lICE"; do
3421                     if test "$libs_found" = 0; then
3422                         save_LIBS="$LIBS"
3423                         LIBS="$GUI_TK_LIBRARY -lXm ${libp} -lXmu -lXext -lXt${libsm_ice} -lX11"
3424                         save_CFLAGS=$CFLAGS
3425                         CFLAGS="$TOOLKIT_INCLUDE $CFLAGS"
3426
3427                         AC_TRY_LINK(
3428                             [
3429                                 #include <Xm/Xm.h>
3430                                 #include <Xm/List.h>
3431                             ],
3432                             [
3433                                 XmString string = NULL;
3434                                 Widget w = NULL;
3435                                 int position = 0;
3436                                 XmListAddItem(w, string, position);
3437                             ],
3438                             [
3439                                 libp_link="$libp"
3440                                 libsm_ice_link="$libsm_ice"
3441                                 AC_MSG_RESULT(
3442                                     [need${libp_link}${libsm_ice_link}])
3443                                 libs_found=1
3444                             ], []
3445                         )
3446
3447                         LIBS="$save_LIBS"
3448                         CFLAGS=$save_CFLAGS
3449                     fi
3450                 done
3451             fi
3452         done
3453
3454         if test "$libs_found" = 0; then
3455             AC_MSG_RESULT([can't find the right libraries])
3456             AC_MSG_ERROR([can't link a simple motif program])
3457         fi
3458
3459         dnl this seems to be needed under IRIX and shouldn't do any harm
3460         dnl elsewhere
3461         AC_CHECK_LIB(Sgm, [SgCreateList], [libsgm_link=" -lSgm"])
3462
3463         save_CFLAGS=$CFLAGS
3464         CFLAGS="$TOOLKIT_INCLUDE $CFLAGS"
3465
3466         AC_CACHE_CHECK([for Motif 2],
3467             wx_cv_lib_motif2,
3468             AC_TRY_COMPILE([
3469                             #include <Xm/Xm.h>
3470                            ],
3471                            [
3472                             #if XmVersion < 2000
3473                             Not Motif 2
3474                             #endif
3475                            ],
3476                            wx_cv_lib_motif2="yes",
3477                            wx_cv_lib_motif2="no"))
3478         if test "$wx_cv_lib_motif2" = "yes"; then
3479             AC_DEFINE(__WXMOTIF20__,1)
3480         else
3481             AC_DEFINE(__WXMOTIF20__,0)
3482         fi
3483
3484         AC_CACHE_CHECK([whether Motif is Lesstif],
3485             wx_cv_lib_lesstif,
3486             AC_TRY_COMPILE([
3487                             #include <Xm/Xm.h>
3488                            ],
3489                            [
3490                             #if !defined(LesstifVersion) || LesstifVersion <= 0
3491                             Not Lesstif
3492                             #endif
3493                            ],
3494                            wx_cv_lib_lesstif="yes",
3495                            wx_cv_lib_lesstif="no")
3496         )
3497         if test "$wx_cv_lib_lesstif" = "yes"; then
3498             AC_DEFINE(__WXLESSTIF__,1)
3499         else
3500             AC_DEFINE(__WXLESSTIF__,0)
3501         fi
3502
3503         CFLAGS=$save_CFLAGS
3504
3505         GUI_TK_LIBRARY="$GUI_TK_LIBRARY${libsgm_link} -lXm${libp_link} -lXmu -lXext -lXt${libsm_ice_link} -lX11"
3506         TOOLKIT=MOTIF
3507         GUIDIST=MOTIF_DIST
3508     fi
3509
3510     dnl more tests common to X11 and Motif:
3511     if test "$wxUSE_X11" = 1 -o "$wxUSE_MOTIF" = 1; then
3512         dnl test for external libxpm if we're configured to use it
3513         if test "$wxUSE_LIBXPM" = "sys"; then
3514             AC_MSG_CHECKING(for Xpm library)
3515             WX_PATH_FIND_LIBRARIES($SEARCH_LIB,Xpm)
3516             if test "$ac_find_libraries" != "" ; then
3517                 WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
3518                 GUI_TK_LIBRARY="$GUI_TK_LIBRARY$ac_path_to_link"
3519                 AC_MSG_RESULT(found in $ac_find_libraries)
3520
3521                 AC_CACHE_CHECK([for X11/xpm.h],
3522                     wx_cv_x11_xpm_h,
3523                     [
3524                         save_CFLAGS=$CFLAGS
3525                         CFLAGS="$TOOLKIT_INCLUDE $CFLAGS"
3526
3527                         AC_TRY_COMPILE(
3528                             [
3529                                 #include <X11/xpm.h>
3530                             ],
3531                             [
3532                                 int version;
3533                                 version = XpmLibraryVersion();
3534                             ],
3535                             wx_cv_x11_xpm_h=yes,
3536                             wx_cv_x11_xpm_h=no
3537                         )
3538
3539                         CFLAGS=$save_CFLAGS
3540                     ]
3541                 )
3542
3543                 if test $wx_cv_x11_xpm_h = "yes"; then
3544                     GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXpm"
3545                     AC_DEFINE(wxHAVE_LIB_XPM)
3546                 else
3547                     AC_MSG_WARN([built-in less efficient XPM decoder will be used])
3548                 fi
3549             fi
3550
3551         fi
3552
3553         dnl XShapeQueryExtension checks: first the library, then prototype
3554         AC_CHECK_LIB([Xext], [XShapeQueryExtension],
3555                      [
3556                       GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXext"
3557                       wxHAVE_XEXT_LIB=1
3558                      ],
3559                      [], [$GUI_TK_LIBRARY -lX11])
3560
3561         if test "$wxHAVE_XEXT_LIB" = 1; then
3562             save_CFLAGS="$CFLAGS"
3563             CFLAGS="$TOOLKIT_INCLUDE $CFLAGS"
3564
3565             AC_MSG_CHECKING([for X11/extensions/shape.h])
3566             AC_TRY_COMPILE([
3567                             #include <X11/Xlib.h>
3568                             #include <X11/extensions/shape.h>
3569                            ],
3570                            [
3571                             int dummy1, dummy2;
3572                             XShapeQueryExtension((Display*)NULL,
3573                                                  (int*)NULL, (int*)NULL);
3574                            ],
3575                            [
3576                             AC_DEFINE(HAVE_XSHAPE)
3577                             AC_MSG_RESULT([found])
3578                            ],
3579                            [
3580                             AC_MSG_RESULT([not found])
3581                            ])
3582             CFLAGS="$save_CFLAGS"
3583
3584         fi
3585     fi
3586
3587     if test "$wxUSE_OSX_CARBON" = 1; then
3588         AC_MSG_CHECKING([for compiler syntax to enable Pascal strings])
3589         if test "$GCC" = yes; then
3590             AC_MSG_RESULT([gcc])
3591             CPPFLAGS_PASCAL="-fpascal-strings"
3592         elif test "`echo $CXX | sed -e 's@.*/@@'`" = "xlC"; then
3593             AC_MSG_RESULT([xlc])
3594             CPPFLAGS_PASCAL="-qmacpstr"
3595         else
3596             AC_MSG_RESULT([none])
3597         fi
3598
3599         if test "x$wxUSE_UNIX" = "xyes"; then
3600             CPPFLAGS="$CPPFLAGS_PASCAL -I/Developer/Headers/FlatCarbon $CPPFLAGS"
3601         else
3602             dnl platform.h needs TARGET_CARBON before setup.h
3603             CPPFLAGS="$CPPFLAGS_PASCAL -DTARGET_CARBON $CPPFLAGS"
3604         fi
3605
3606         TOOLKIT=OSX_CARBON
3607         dnl we can't call this MAC_DIST or autoconf thinks its a macro
3608         GUIDIST=OSX_CARBON_DIST
3609         dnl wxMac version of wxBase and wxCocoa or wxBase-only built on Darwin
3610         dnl are different, so they need different names:
3611         WXBASEPORT="_carbon"
3612
3613         dnl in addition to defining __WXOSX_CARBON__ for this toolkit we want
3614         dnl to also define these extra symbols to make it possible to test for
3615         dnl any Mac port (__WXMAC__ is for backwards compatibility, __WXOSX__
3616         dnl is a new name)
3617         TOOLCHAIN_DEFS="${TOOLCHAIN_DEFS} -D__WXMAC__ -D__WXOSX__"
3618     fi
3619
3620     if test "$wxUSE_OSX_COCOA" = 1; then
3621         TOOLKIT=OSX_COCOA
3622         GUIDIST=OSX_COCOA_DIST
3623
3624         dnl see the comment above in wxUSE_OSX_CARBON branch
3625         TOOLCHAIN_DEFS="${TOOLCHAIN_DEFS} -D__WXMAC__ -D__WXOSX__"
3626     fi
3627
3628     if test "$wxUSE_OSX_IPHONE" = 1; then
3629         TOOLKIT=OSX_IPHONE
3630     fi
3631
3632     if test "$wxUSE_OLD_COCOA" = 1; then
3633         TOOLKIT=COCOA
3634         GUIDIST=COCOA_DIST
3635     fi
3636
3637     if test "$wxUSE_PM" = 1; then
3638         TOOLKIT=PM
3639         GUIDIST=PM_DIST
3640         AC_CACHE_CHECK([for type SPBCDATA],
3641             wx_cv_spbcdata,
3642             [
3643                 AC_TRY_COMPILE(
3644                     [
3645                         #define INCL_PM
3646                         #include <os2.h>
3647                     ],
3648                     [
3649                         SPBCDATA test;
3650                     ],
3651                     wx_cv_spbcdata=yes,
3652                     wx_cv_spbcdata=no
3653                 )
3654             ]
3655         )
3656
3657         if test $wx_cv_spbcdata = "yes"; then
3658             AC_DEFINE(HAVE_SPBCDATA)
3659         fi
3660     fi
3661
3662     dnl the name of the directory where the files for this toolkit live
3663     if test "$TOOLKIT" = "PM" ; then
3664         TOOLKIT_DIR="os2"
3665     else
3666         TOOLKIT_DIR=`echo ${TOOLKIT} | tr '[[A-Z]]' '[[a-z]]'`
3667     fi
3668
3669     if test "$wxUSE_UNIVERSAL" = "yes"; then
3670         TOOLCHAIN_DEFS="${TOOLCHAIN_DEFS} -D__WXUNIVERSAL__"
3671         WIDGET_SET=univ
3672     fi
3673
3674     dnl distribute samples/demos/utils with GUI versions
3675     GUIDIST="${GUIDIST} SAMPLES_DIST DEMOS_DIST UTILS_DIST MISC_DIST"
3676     DISTDIR="wx\$(TOOLKIT)"
3677 else
3678     USE_GUI=0
3679
3680     dnl this doesn't quite work right for wxBase, but the places
3681     dnl where it is wrong aren't fatal (yet) though.
3682     TOOLKIT_DIR="base"
3683
3684     dnl the sources, their dependenices and the headers
3685     if test "$USE_WIN32" = 1 ; then
3686         dnl yes, the toolkit for wxBase on win32 is actually MSW
3687         dnl wxBase on unix does not need a 'TOOLKIT' defined.
3688         TOOLKIT="MSW"
3689     fi
3690
3691     dnl distribute only wxBase sources/headers
3692     GUIDIST="BASE_DIST"
3693     DISTDIR="wxBase"
3694 fi
3695
3696
3697 dnl ---------------------------------------------------------------------------
3698 dnl UTF-8 support
3699 dnl ---------------------------------------------------------------------------
3700
3701 dnl If UTF-8 support wasn't explicitly enabled or disabled, enable it only
3702 dnl for ports where it makes sense by default (GTK+, DirectFB):
3703 if test "$wxUSE_UNICODE" = "yes" -a "$wxUSE_UNICODE_UTF8" = "auto" ; then
3704     if test "$USE_UNIX" = 1 -a "$wxUSE_DARWIN" != 1 ; then
3705         wxUSE_UNICODE_UTF8=yes
3706     elif test "$USE_OS2" = 1 ; then
3707         dnl wide char support is quite incomplete in libc;
3708         dnl UTF-8 might actually work when evaluating/setting
3709         dnl code pages correctly, even for ports other than GTK20.
3710         wxUSE_UNICODE_UTF8=yes
3711     else
3712         wxUSE_UNICODE_UTF8=no
3713     fi
3714 fi
3715
3716 dnl ---------------------------------------------------------------------------
3717 dnl Optional libraries included when system library is not used
3718 dnl ---------------------------------------------------------------------------
3719
3720 dnl do this after test for X11 above so that we have a chance of finding Xlib.h
3721 if test "$wxUSE_GUI" = "yes"; then
3722     if test "$wxUSE_UNIX" = "yes" -a "$wxUSE_PM" != 1; then
3723         dnl defines HAVE_X11_XKBLIB_H
3724         AC_CHECK_HEADERS([X11/Xlib.h],,, [ ])
3725         AC_CHECK_HEADERS([X11/XKBlib.h],,,
3726                          [
3727                           #if HAVE_X11_XLIB_H
3728                             #include <X11/Xlib.h>
3729                           #endif
3730                          ])
3731     fi
3732 fi
3733
3734
3735 dnl ---------------------------------------------------------------------------
3736 dnl wxDisplay checks
3737 dnl ---------------------------------------------------------------------------
3738
3739 USE_XINERAMA=0
3740 if test "$wxUSE_DISPLAY" = "yes"; then
3741     dnl Xinerama is used for wxGTK1/wxX11/wxMotif only
3742     if test "$wxUSE_MOTIF" = 1 -o "$wxUSE_X11" = 1 -o "$wxUSE_GTK1" = 1; then
3743         AC_MSG_CHECKING([for Xinerama])
3744         WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],Xinerama)
3745         if test "$ac_find_libraries" != "" ; then
3746             WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
3747             if test "$ac_path_to_link" != " -L/usr/lib" ; then
3748                 LDFLAGS="$LDFLAGS $ac_path_to_link"
3749             fi
3750             USE_XINERAMA=1
3751             GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXinerama"
3752             AC_MSG_RESULT([yes])
3753         else
3754             AC_MSG_RESULT([no])
3755             AC_MSG_WARN([Xinerama not found; disabling wxDisplay])
3756             wxUSE_DISPLAY="no"
3757         fi
3758     elif test "$wxUSE_MSW" = 1; then
3759         dnl DirectDraw for MSW - optionally used by WxDisplay.
3760         AC_CHECK_HEADER([ddraw.h], [], [], [#include <windows.h>])
3761     fi
3762 fi
3763
3764 if test "$wxUSE_DISPLAY" = "yes"; then
3765     dnl wxGTK2 needs Xxf86vm as well as Xinerama-using ports from above
3766     if test "$USE_XINERAMA" = 1 -o "$wxUSE_GTK" = 1; then
3767         AC_MSG_CHECKING([for Xxf86vm extension])
3768         WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],Xxf86vm)
3769         if test "$ac_find_libraries" != "" ; then
3770             AC_MSG_RESULT([yes])
3771             AC_CHECK_HEADERS([X11/extensions/xf86vmode.h],
3772                              [
3773                               GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXxf86vm"
3774                              ],
3775                              [],
3776                              [
3777                                   #if HAVE_X11_XLIB_H
3778                                     #include <X11/Xlib.h>
3779                                   #endif
3780                              ])
3781         else
3782             AC_MSG_RESULT([no])
3783         fi
3784     fi
3785 fi
3786
3787 dnl ---------------------------------------------------------------------------
3788 dnl X11 session management
3789 dnl ---------------------------------------------------------------------------
3790 if test "$wxUSE_DETECT_SM" = "yes"; then
3791     if test "$wxUSE_UNIX" = "yes" -a "$wxUSE_MAC" != 1 -a "$wxUSE_OLD_COCOA" != 1; then
3792         AC_MSG_CHECKING([for -lSM - X11 session management])
3793         WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],SM)
3794         if test "$ac_find_libraries" != "" ; then
3795             WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
3796             if test "$ac_path_to_link" != " -L/usr/lib" ; then
3797                 LDFLAGS="$LDFLAGS $ac_path_to_link"
3798             fi
3799             GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lSM"
3800             AC_MSG_RESULT([yes])
3801         else
3802             AC_MSG_RESULT([no])
3803             AC_MSG_WARN([libSM not found; disabling session management detection])
3804             wxUSE_DETECT_SM="no"
3805         fi
3806     else
3807         wxUSE_DETECT_SM="no"
3808     fi
3809 fi
3810
3811
3812 dnl ---------------------------------------------------------------------------
3813 dnl OpenGL libraries
3814 dnl ---------------------------------------------------------------------------
3815
3816 USE_OPENGL=0
3817 if test "$wxUSE_OPENGL" = "yes" -o "$wxUSE_OPENGL" = "auto"; then
3818
3819     dnl look in glcanvas.h for the list of platforms supported by wxGlCanvas:
3820
3821     if test "$wxUSE_OSX_CARBON" = 1 -o "$wxUSE_OSX_COCOA" = 1 -o "$wxUSE_OLD_COCOA" = 1; then
3822         OPENGL_LIBS="-framework OpenGL -framework AGL"
3823     elif test "$wxUSE_MSW" = 1; then
3824         OPENGL_LIBS="-lopengl32 -lglu32"
3825     elif test "$wxUSE_MOTIF" = 1 -o "$wxUSE_X11" = 1 -o "$wxUSE_GTK2" = 1 -o "$wxUSE_GTK" = 1; then
3826
3827         dnl adjust CPPFLAGS to include GL/gl.h location if necessary
3828         dnl (/opt/graphics/OpenGL is for HP-UX systems, bug 925307)
3829         AC_MSG_CHECKING([for OpenGL headers])
3830         WX_PATH_FIND_INCLUDES([$SEARCH_INCLUDE /opt/graphics/OpenGL/include], GL/gl.h)
3831         if test "$ac_find_includes" != "" ; then
3832             AC_MSG_RESULT(found in $ac_find_includes)
3833             WX_INCLUDE_PATH_EXIST($ac_find_includes, $CPPFLAGS)
3834             CPPFLAGS="$ac_path_to_include $CPPFLAGS"
3835         else
3836             AC_MSG_RESULT([not found])
3837         fi
3838
3839         AC_CHECK_HEADER(GL/gl.h, [
3840             AC_CHECK_HEADER(GL/glu.h, [
3841                 found_gl=0
3842
3843                 AC_MSG_CHECKING([for -lGL])
3844                 WX_PATH_FIND_LIBRARIES([$SEARCH_LIB /opt/graphics/OpenGL/lib],GL)
3845                 if test "$ac_find_libraries" != "" ; then
3846                     AC_MSG_RESULT([found in $ac_find_libraries])
3847
3848                     WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
3849                     if test "$ac_path_to_link" != " -L/usr/lib" ; then
3850                         LDFLAGS_GL="$ac_path_to_link"
3851                     fi
3852
3853                     dnl don't suppose that libGL and libGLU are always in the
3854                     dnl same directory -- this is not true for some common
3855                     dnl distributions
3856                     AC_MSG_CHECKING([for -lGLU])
3857                     WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],GLU)
3858                     if test "$ac_find_libraries" != "" ; then
3859                         WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
3860                         if test "$ac_path_to_link" != " -L/usr/lib" -a \
3861                                     "$ac_path_to_link" != "$LDFLAGS_GL"; then
3862                             LDFLAGS_GL="$LDFLAGS_GL$ac_path_to_link"
3863                         fi
3864
3865                         found_gl=1
3866                         OPENGL_LIBS="-lGL -lGLU"
3867                         AC_MSG_RESULT([yes])
3868                     else
3869                         AC_MSG_RESULT([no])
3870                     fi
3871                 else
3872                     AC_MSG_RESULT([no])
3873                 fi
3874
3875                 if test "$found_gl" != 1; then
3876                     AC_MSG_CHECKING([for -lMesaGL])
3877                     WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],MesaGL)
3878                     if test "$ac_find_libraries" != "" ; then
3879                         WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
3880                         LDFLAGS_GL="$LDFLAGS$ac_path_to_link"
3881                         OPENGL_LIBS="-lMesaGL -lMesaGLU"
3882                         AC_MSG_RESULT([yes])
3883                     else
3884                         AC_MSG_RESULT([no])
3885                     fi
3886                 fi
3887             ],, [ ])
3888         ],
3889         [],
3890         [ ])
3891
3892         if test "x$OPENGL_LIBS" = "x"; then
3893             if test "$wxUSE_OPENGL" = "yes"; then
3894                 AC_MSG_ERROR([OpenGL libraries not available])
3895             else
3896                 dnl case wxUSE_OPENGL=auto
3897                 AC_MSG_WARN([OpenGL libraries not available, disabling support for OpenGL])
3898                 wxUSE_OPENGL=no
3899                 USE_OPENGL=0
3900             fi
3901         fi
3902     else
3903         AC_MSG_WARN([wxGLCanvas not implemented for this port, library will be compiled without it.])
3904         wxUSE_OPENGL="no"
3905     fi
3906
3907     if test "$wxUSE_OPENGL" = "auto"; then
3908         dnl if the OpenGL libraries were unavailable, this would have been
3909         dnl changed to "no" above, if it wasn't, change it to "yes" as we've
3910         dnl verified that we can indeed use OpenGL
3911         wxUSE_OPENGL=yes
3912     fi
3913
3914     if test "$wxUSE_OPENGL" = "yes"; then
3915         USE_OPENGL=1
3916         AC_DEFINE(wxUSE_OPENGL)
3917         AC_DEFINE(wxUSE_GLCANVAS)
3918         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS opengl opengl/cube opengl/penguin opengl/isosurf"
3919     fi
3920 fi
3921
3922
3923 dnl the symbol which allows conditional compilation for the given toolkit
3924 if test -n "$TOOLKIT" ; then
3925     TOOLCHAIN_DEFS="${TOOLCHAIN_DEFS} -D__WX${TOOLKIT}__"
3926 fi
3927
3928
3929 dnl --- the marker for quick search, leave it here: SHARED_LIB_SETUP ---
3930
3931 if test "$wxUSE_SHARED" = "yes"; then
3932     case "${host}" in
3933       *-pc-msdosdjgpp )
3934         dnl only static for now
3935         wxUSE_SHARED=no
3936         AC_MSG_WARN([Host system doesn't support shared libraries, disabling])
3937       ;;
3938     esac
3939 fi
3940
3941 if test "$wxUSE_SHARED" = "yes"; then
3942
3943     dnl use versioned symbols if available on the platform
3944     WX_VERSIONED_SYMBOLS([\$(wx_top_builddir)/version-script])
3945
3946     dnl test for GCC's visibility support (sets CFLAGS_VISIBILITY, which is
3947     dnl assigned to CFLAGS and CXXFLAGS below)
3948     if test "$wxUSE_VISIBILITY" != "no"; then
3949         WX_VISIBILITY
3950     fi
3951
3952     dnl test for Sun CC which can be used under both Solaris and Linux
3953     if test "x$SUNCXX" = xyes; then
3954         SAMPLES_RPATH_FLAG="-R\$(wx_top_builddir)/lib"
3955         WXCONFIG_RPATH="-R\$libdir"
3956     else
3957     case "${host}" in
3958       *-*-linux* | *-*-gnu* )
3959         SAMPLES_RPATH_FLAG="-Wl,-rpath,\$(wx_top_builddir)/lib"
3960         WXCONFIG_RPATH="-Wl,-rpath,\$libdir"
3961         ;;
3962
3963       *-*-solaris2* )
3964         dnl here we know that Sun CC is not used as we tested for it above,
3965         dnl hence we must be using gcc
3966
3967         dnl newer versions of gcc need -isystem to compile X headers on
3968         dnl Solaris (which use old style C syntax)
3969         CPPFLAGS="-isystem /usr/openwin/include $CPPFLAGS"
3970
3971         dnl gcc may use Sun's ld, in which case -rpath gives a confusing
3972         dnl error message. We have to try both -Wl,-rpath and -Wl,-R:
3973         saveLdflags="$LDFLAGS"
3974         LDFLAGS="$saveLdflags -Wl,-rpath,/"
3975         AC_MSG_CHECKING([if the linker accepts -rpath])
3976         AC_TRY_LINK(
3977             [],[],
3978             [
3979                 AC_MSG_RESULT([yes])
3980                 SAMPLES_RPATH_FLAG="-Wl,-rpath,\$(wx_top_builddir)/lib"
3981                 WXCONFIG_RPATH="-Wl,-rpath,\$libdir"
3982             ],[
3983                 AC_MSG_RESULT([no])
3984                 AC_MSG_CHECKING([if the linker accepts -R])
3985                 LDFLAGS="$saveLdflags -Wl,-R,/"
3986                 AC_TRY_LINK(
3987                     [],[],
3988                     [
3989                         AC_MSG_RESULT([yes])
3990                         SAMPLES_RPATH_FLAG="-Wl,-R,\$(wx_top_builddir)/lib"
3991                         WXCONFIG_RPATH="-Wl,-R,\$libdir"
3992                     ],[
3993                         AC_MSG_RESULT([no])
3994                     ])
3995             ])
3996         LDFLAGS="$saveLdflags"
3997       ;;
3998
3999       *-*-darwin* )
4000         install_name_tool=`which ${HOST_PREFIX}install_name_tool`
4001         if test "$install_name_tool" -a -x "$install_name_tool"; then
4002             DYLIB_RPATH_POSTLINK="${HOST_PREFIX}install_name_tool -id \$@ \$@"
4003             cat <<EOF >change-install-names
4004 #!/bin/sh
4005 libnames=\`cd \${2} ; ls -1 | grep '\.[[0-9]][[0-9]]*\.dylib\$'\`
4006 for i in \${libnames} ; do
4007     ${HOST_PREFIX}install_name_tool -id \${3}/\${i} \${1}/\${i}
4008     for dep in \${libnames} ; do
4009         ${HOST_PREFIX}install_name_tool -change \${2}/\${dep} \${3}/\${dep} \${1}/\${i}
4010     done
4011 done
4012 EOF
4013             chmod +x change-install-names
4014             DYLIB_RPATH_INSTALL="\$(wx_top_builddir)/change-install-names \${DESTDIR}\${libdir} \$(wx_top_builddir)/lib \${libdir}"
4015         fi
4016
4017         dnl the HEADER_PAD_OPTION is required by some wx samples to avoid the error:
4018         dnl "install_name_tool: changing install names can't be redone for: the_exe_name
4019         dnl (for architecture ppc) because larger updated load commands do not fit
4020         dnl (the program must be relinked)"
4021         HEADER_PAD_OPTION="-headerpad_max_install_names"
4022       ;;
4023
4024       *-*-cygwin* | *-*-mingw32* )
4025         ;;
4026
4027       *-*-hpux* )
4028         SAMPLES_RPATH_FLAG="-Wl,+b,\$(wx_top_builddir)/lib"
4029         WXCONFIG_RPATH="-Wl,+b,\$libdir"
4030         ;;
4031
4032     esac
4033     fi
4034
4035     dnl this one shouldn't be used for the library build so put it in a
4036     dnl separate variable from WXCONFIG_CPPFLAGS
4037     WXCONFIG_ONLY_CPPFLAGS="$WXCONFIG_ONLY_CPPFLAGS -DWXUSINGDLL"
4038
4039     if test $wxUSE_RPATH = "no"; then
4040         SAMPLES_RPATH_FLAG=''
4041         DYLIB_PATH_POSTLINK=''
4042         WXCONFIG_RPATH=''
4043     fi
4044
4045     SHARED=1
4046
4047 else
4048
4049     config_linkage_component="-static"
4050     SHARED=0
4051
4052 fi
4053
4054
4055 UNICODE=0
4056 lib_unicode_suffix=
4057 WX_CHARTYPE="ansi"
4058 if test "$wxUSE_UNICODE" = "yes"; then
4059     lib_unicode_suffix=u
4060     WX_CHARTYPE="unicode"
4061     UNICODE=1
4062 fi
4063
4064 WX_FLAVOUR=${WX_FLAVOUR:+-$WX_FLAVOUR}
4065 WX_LIB_FLAVOUR=`echo $WX_FLAVOUR | tr '-' '_'`
4066
4067 DEBUG_INFO=0
4068 if test "$wxUSE_DEBUG_INFO" = "yes"; then
4069     DEBUG_INFO=1
4070 fi
4071
4072 WX_VERSION_TAG=`echo WX${lib_unicode_suffix}${WX_LIB_FLAVOUR}_${WX_RELEASE} | tr '[[a-z]]' '[[A-Z]]'`
4073
4074 TOOLCHAIN_NAME="${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_unicode_suffix}${WX_LIB_FLAVOUR}-${WX_RELEASE}${HOST_SUFFIX}"
4075
4076 TOOLCHAIN_FULLNAME="${HOST_PREFIX}${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}-${WX_CHARTYPE}${config_linkage_component}-${WX_RELEASE}${WX_FLAVOUR}"
4077
4078 dnl library link name
4079 dnl These just save us from exporting lib_{unicode,flavour}_suffix.
4080 dnl If we ever need to do that, we won't need to keep these.
4081
4082 if test "$wxUSE_OSX_CARBON" = 1 -o "$wxUSE_OSX_COCOA" = 1 -o "$wxUSE_OLD_COCOA" = 1; then
4083     WX_LIBRARY_BASENAME_NOGUI="wx_base${lib_unicode_suffix}${WX_LIB_FLAVOUR}"
4084 else
4085     WX_LIBRARY_BASENAME_NOGUI="wx_base${WXBASEPORT}${lib_unicode_suffix}${WX_LIB_FLAVOUR}"
4086 fi
4087 if test "${TOOLKIT_DIR}" = "os2"; then
4088     WX_LIBRARY_BASENAME_GUI="wx_pm${WIDGET_SET}${lib_unicode_suffix}${WX_LIB_FLAVOUR}"
4089 else
4090     WX_LIBRARY_BASENAME_GUI="wx_${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_unicode_suffix}${WX_LIB_FLAVOUR}"
4091 fi
4092
4093
4094
4095 if test "$wxUSE_OLD_COCOA" = 1; then
4096     AC_LANG_SAVE
4097     AC_WX_LANG_OBJECTIVEC
4098 dnl Recent AppKit/NSEvent.h include parts of IOKit which eventually
4099 dnl gets IOKit/graphics/IOGraphicsTypes.h included which typedefs
4100 dnl Point but only if MacTypes.h was not included first.  Of course,
4101 dnl if MacTypes.h is included later then you're screwed when it
4102 dnl tries to typedef Point.  Defining __Point__ will cause IOGraphicsTypes.h
4103 dnl to not typedef Point and thus fix the problem.
4104     AC_MSG_CHECKING([if AppKit/NSEvent.h conflicts with CoreFoundation])
4105     AC_TRY_COMPILE([#include <AppKit/NSEvent.h>
4106 #include <CoreFoundation/CoreFoundation.h>
4107         ],[],
4108         [AC_MSG_RESULT([no])],
4109         [AC_MSG_RESULT([yes])
4110         AC_MSG_CHECKING([if defining __Point__ will fix it])
4111         AC_TRY_COMPILE([#define __Point__ 1
4112 #include <AppKit/NSEvent.h>
4113 #include <CoreFoundation/CoreFoundation.h>
4114             ],[],
4115             [AC_MSG_RESULT([yes])
4116             AC_DEFINE(__Point__)
4117             ],
4118             [AC_MSG_FAILURE([no])]
4119         )]
4120     )
4121     AC_LANG_RESTORE
4122 fi
4123
4124 dnl ---------------------------------------------------------------------------
4125 dnl Checks for typedefs
4126 dnl ---------------------------------------------------------------------------
4127
4128 dnl   defines mode_t if not already defined
4129 AC_TYPE_MODE_T
4130 dnl   defines off_t if not already defined
4131 AC_TYPE_OFF_T
4132 dnl   defines pid_t if not already defined
4133 AC_TYPE_PID_T
4134 dnl   defines size_t if not already defined
4135 AC_TYPE_SIZE_T
4136
4137 dnl sets HAVE_SSIZE_T if ssize_t is defined
4138 AC_CHECK_TYPES(ssize_t)
4139
4140 dnl check what exactly size_t is on this machine - this is necessary to avoid
4141 dnl ambiguous overloads in several places, notably wx/string.h and wx/array.h
4142 AC_LANG_PUSH(C++) dnl tests below use overloaded functions and so need C++
4143 AC_CACHE_CHECK([if size_t is unsigned int],
4144     wx_cv_size_t_is_uint,
4145     [
4146     dnl an obvious check like AC_TRY_COMPILE[struct Foo { ... };] doesn't work
4147     dnl with egcs (at least) up to 1.1.1 as it allows you to compile duplicate
4148     dnl methods in a local class (i.e. class inside a function) declaration
4149     dnl without any objections!!
4150     dnl
4151     dnl hence the hack below: we must have Foo at global scope!
4152     AC_TRY_COMPILE([#include <stddef.h>],
4153         [
4154             return 0; }
4155
4156             struct Foo { void foo(size_t); void foo(unsigned int); };
4157
4158             int bar() {
4159         ],
4160         wx_cv_size_t_is_uint=no,
4161         wx_cv_size_t_is_uint=yes
4162     )
4163     ]
4164 )
4165
4166 if test "$wx_cv_size_t_is_uint" = "yes"; then
4167     AC_DEFINE(wxSIZE_T_IS_UINT)
4168 else
4169     AC_CACHE_CHECK([if size_t is unsigned long],
4170         wx_cv_size_t_is_ulong,
4171         AC_TRY_COMPILE([#include <stddef.h>],
4172             [
4173                 return 0; }
4174
4175                 struct Foo { void foo(size_t); void foo(unsigned long); };
4176
4177                 int bar() {
4178             ],
4179             wx_cv_size_t_is_ulong=no,
4180             wx_cv_size_t_is_ulong=yes
4181         )
4182     )
4183
4184     if test "$wx_cv_size_t_is_ulong" = "yes"; then
4185         AC_DEFINE(wxSIZE_T_IS_ULONG)
4186     fi
4187 fi
4188
4189 AC_CACHE_CHECK([if wchar_t is separate type],
4190     wx_cv_wchar_t_is_separate_type,
4191     AC_TRY_COMPILE([#include <wchar.h>],
4192         [
4193             return 0; }
4194
4195             struct Foo { void foo(wchar_t);
4196                          void foo(unsigned short);
4197                          void foo(unsigned int);
4198                          void foo(unsigned long); };
4199
4200             int bar() {
4201         ],
4202         wx_cv_wchar_t_is_separate_type=yes,
4203         wx_cv_wchar_t_is_separate_type=no
4204     )
4205 )
4206
4207 if test "$wx_cv_wchar_t_is_separate_type" = "yes"; then
4208     AC_DEFINE(wxWCHAR_T_IS_REAL_TYPE, 1)
4209 else
4210     AC_DEFINE(wxWCHAR_T_IS_REAL_TYPE, 0)
4211 fi
4212
4213 AC_LANG_POP() dnl C++
4214
4215 dnl ---------------------------------------------------------------------------
4216 dnl Checks for structures
4217 dnl ---------------------------------------------------------------------------
4218
4219 dnl does passwd struct has the pw_gecos field?
4220 AC_CACHE_CHECK([for pw_gecos in struct passwd], wx_cv_struct_pw_gecos,
4221     [
4222         AC_TRY_COMPILE([#include <pwd.h>],
4223              [
4224                 char *p;
4225                 struct passwd *pw;
4226                 p = pw->pw_gecos;
4227              ],
4228              [
4229                 wx_cv_struct_pw_gecos=yes
4230              ],
4231              [
4232                 wx_cv_struct_pw_gecos=no
4233              ]
4234         )
4235     ]
4236 )
4237
4238 if test "$wx_cv_struct_pw_gecos" = "yes"; then
4239     AC_DEFINE(HAVE_PW_GECOS)
4240 fi
4241
4242 dnl ---------------------------------------------------------------------------
4243 dnl Check for functions
4244 dnl ---------------------------------------------------------------------------
4245
4246 dnl check for wcslen in all possible places
4247 WCSLEN_FOUND=0
4248 WCHAR_LINK=
4249 AC_CHECK_FUNCS(wcslen, WCSLEN_FOUND=1)
4250
4251 if test "$WCSLEN_FOUND" = 0; then
4252     if test "$TOOLKIT" = "MSW"; then
4253         AC_CHECK_LIB(msvcrt, wcslen, WCHAR_OK=1)
4254     else
4255         AC_CHECK_LIB(w, wcslen, [
4256                         WCHAR_LINK=" -lw"
4257                         WCSLEN_FOUND=1
4258                     ])
4259     fi
4260 fi
4261
4262 if test "$WCSLEN_FOUND" = 1; then
4263     AC_DEFINE(HAVE_WCSLEN)
4264 fi
4265
4266 AC_CHECK_FUNCS([wcsdup wcsftime strnlen wcsnlen wcscasecmp wcsncasecmp])
4267
4268 dnl On HP-UX aCC need this define to find mbstrtowcs() &c
4269 dnl Can't be used for g++ since the mbstate_t in wchar.h can conflict
4270 dnl with g++'s in <cwchar> (unless -D_INCLUDE__STDC_A1_SOURCE is in the
4271 dnl flags when g++ is configured, it will declare its own).
4272 if test "$USE_HPUX" = 1 -a "$GCC" != "yes"; then
4273     CPPFLAGS="-D_INCLUDE__STDC_A1_SOURCE $CPPFLAGS"
4274 fi
4275
4276 dnl Try to use wcsrtombs instead of wcstombs which is buggy in old GNU
4277 dnl libc versions if possible. AC_CHECK_FUNCS only checks it's in the
4278 dnl library, not the header, so do a header check for mbstate_t first.
4279 AC_CHECK_TYPES([mbstate_t],
4280                [AC_CHECK_FUNCS(wcsrtombs)],
4281                [],
4282                [#include <wchar.h>])
4283
4284 dnl check for vsnprintf() -- a safe version of vsprintf())
4285 dnl
4286 dnl the trouble here is that on some systems (e.g. HP-UX 10) this function is
4287 dnl present in libc but not in the system headers and so AC_CHECK_FUNCS (which,
4288 dnl stupidly, provides a dummy function declaration inside its extension)
4289 dnl succeeds, even with C++ compiler, but the compilation of wxWidgets fails
4290 dnl
4291 dnl so we first check if the function is in the library
4292 dnl
4293 dnl FIXME: replace this mess with WX_CHECK_FUNCS()
4294 AC_CHECK_FUNCS(snprintf vsnprintf vsscanf)
4295
4296 AC_LANG_PUSH(C++)
4297 if test "$ac_cv_func_vsnprintf" = "yes"; then
4298     dnl yes it is -- now check if it is in the headers
4299     AC_CACHE_CHECK([for vsnprintf declaration], wx_cv_func_vsnprintf_decl,
4300         [
4301             dnl our troubles are not over: HP-UX 11 prototypes vsnprintf() as
4302             dnl taking "char *" and not "const char *" while Metrowerks does
4303             dnl provide a correct vsnprintf declaration but in C++ mode it's
4304             dnl always in std namespace and so we have to bring it in scope
4305             AC_TRY_COMPILE(
4306                 [
4307                     #include <stdio.h>
4308                     #include <stdarg.h>
4309                     #ifdef __MSL__
4310                     #if __MSL__ >= 0x6000
4311                     namespace std {}
4312                     using namespace std;
4313                     #endif
4314                     #endif
4315                 ],
4316                 [
4317                     char *buf;
4318                     va_list ap;
4319                     vsnprintf(buf, 10u, "%s", ap);
4320                 ],
4321                 wx_cv_func_vsnprintf_decl=yes,
4322                 wx_cv_func_vsnprintf_decl=no
4323             )
4324         ]
4325     )
4326
4327     if test "$wx_cv_func_vsnprintf_decl" = "yes"; then
4328         AC_DEFINE(HAVE_VSNPRINTF_DECL)
4329
4330         dnl we know there is a vsnprintf declaration, but some old headers
4331         dnl may have one taking a "char *" format instead of "const char *"
4332         AC_CACHE_CHECK([if vsnprintf declaration is broken], wx_cv_func_broken_vsnprintf_decl,
4333             [
4334                 AC_TRY_COMPILE(
4335                     [
4336                         #include <stdio.h>
4337                         #include <stdarg.h>
4338                         #ifdef __MSL__
4339                         #if __MSL__ >= 0x6000
4340                         namespace std {}
4341                         using namespace std;
4342                         #endif
4343                         #endif
4344                     ],
4345                     [
4346                         char *buf;
4347                         va_list ap;
4348                         const char *fmt = "%s";
4349                         vsnprintf(buf, 10u, fmt, ap);
4350                     ],
4351                     wx_cv_func_broken_vsnprintf_decl=no,
4352                     wx_cv_func_broken_vsnprintf_decl=yes
4353                 )
4354             ]
4355         )
4356
4357         if test "$wx_cv_func_broken_vsnprintf_decl" = "yes"; then
4358             AC_DEFINE(HAVE_BROKEN_VSNPRINTF_DECL)
4359         fi
4360     fi
4361 fi
4362
4363 dnl the same as above but for snprintf() now: it's not present in at least AIX
4364 dnl 4.2 headers
4365 if test "$ac_cv_func_snprintf" = "yes"; then
4366     AC_CACHE_CHECK([for snprintf declaration], wx_cv_func_snprintf_decl,
4367         [
4368             AC_TRY_COMPILE(
4369                 [
4370                     #include <stdio.h>
4371                     #include <stdarg.h>
4372                     #ifdef __MSL__
4373                     #if __MSL__ >= 0x6000
4374                     namespace std {}
4375                     using namespace std;
4376                     #endif
4377                     #endif
4378                 ],
4379                 [
4380                     char *buf;
4381                     snprintf(buf, 10u, "%s", "wx");
4382                 ],
4383                 wx_cv_func_snprintf_decl=yes,
4384                 wx_cv_func_snprintf_decl=no
4385             )
4386         ]
4387     )
4388
4389     if test "$wx_cv_func_snprintf_decl" = "yes"; then
4390         AC_DEFINE(HAVE_SNPRINTF_DECL)
4391     fi
4392
4393     if test "$wxUSE_PRINTF_POS_PARAMS" = "yes"; then
4394
4395         dnl check if snprintf() has support for positional arguments
4396         dnl NB: if snprintf() has positional support we can safely suppose that also
4397         dnl     other *printf() functions support them as they all belong to the same
4398         dnl     family and they all fallback to the same implementation
4399         AC_CACHE_CHECK([if snprintf supports positional arguments], wx_cv_func_snprintf_pos_params,
4400             [
4401                 AC_TRY_RUN(
4402                     [
4403                         #include <stdio.h>
4404
4405                         int main (void)
4406                         {
4407                             char buffer[128];
4408                             snprintf (buffer, 128, "%2$d %3$d %1$d", 1, 2, 3);
4409                             if (strcmp ("2 3 1", buffer) == 0)
4410                                 exit (0);
4411                             exit (1);
4412                         }
4413                     ],
4414                     wx_cv_func_snprintf_pos_params=no,
4415                     wx_cv_func_snprintf_pos_params=yes,
4416                     dnl be pessimistic when cross-compiling
4417                     [
4418                         AC_MSG_WARN([Assuming Unix98 printf() is not available,
4419 define HAVE_UNIX98_PRINTF as 1 in setup.h if it is available.])
4420                         wx_cv_func_snprintf_pos_params=no
4421                     ]
4422                 )
4423             ]
4424         )
4425
4426         if test "$wx_cv_func_snprintf_pos_params" = "yes"; then
4427             AC_DEFINE(HAVE_UNIX98_PRINTF)
4428         fi
4429     fi
4430 fi
4431
4432 dnl the same as above but for vsscanf() now: it's not present in at least
4433 dnl Solaris 9 headers for gcc-3.4 (due to fixinclude's processing of stdio.h)
4434 if test "$ac_cv_func_vsscanf" = "yes"; then
4435     AC_CACHE_CHECK([for vsscanf declaration], wx_cv_func_vsscanf_decl,
4436         [
4437             AC_TRY_COMPILE(
4438                 [
4439                     #include <stdio.h>
4440                     #include <stdarg.h>
4441                     #ifdef __MSL__
4442                     #if __MSL__ >= 0x6000
4443                     namespace std {}
4444                     using namespace std;
4445                     #endif
4446                     #endif
4447                 ],
4448                 [
4449                     char *buf;
4450                     va_list args;
4451                     vsscanf(buf, "%s", args);
4452                 ],
4453                 wx_cv_func_vsscanf_decl=yes,
4454                 wx_cv_func_vsscanf_decl=no
4455             )
4456         ]
4457     )
4458
4459     if test "$wx_cv_func_vsscanf_decl" = "yes"; then
4460         AC_DEFINE(HAVE_VSSCANF_DECL)
4461     fi
4462 fi
4463 AC_LANG_POP()
4464
4465 if test "$wxUSE_UNICODE" = yes; then
4466
4467     dnl also look if we have wide char IO functions, notice that [f]putws are
4468     dnl declared in special widec.h under Solaris
4469     wchar_headers="#include <stdio.h>
4470 #include <wchar.h>"
4471     case "${host}" in
4472         *-*-solaris2* )
4473             AC_CHECK_HEADERS(widec.h,,, [AC_INCLUDES_DEFAULT()])
4474             if test "$ac_cv_header_widec_h" = "yes"; then
4475                 wchar_headers="$wchar_headers
4476 #include <widec.h>"
4477             fi
4478     esac
4479
4480     WX_CHECK_FUNCS(putws fputws wprintf vswprintf vswscanf,,,
4481                    [$wchar_headers])
4482
4483     dnl MinGW has a vswprintf with a different prototype, and
4484     dnl a _vsnwprintf with the correct prototype, but AC_CHECK_FUNCS
4485     dnl finds it even if it is not declared in some versions...
4486     AC_MSG_CHECKING([for _vsnwprintf])
4487     AC_TRY_COMPILE([#include <wchar.h>],
4488                    [&_vsnwprintf;],
4489                    [AC_MSG_RESULT([yes])
4490                     AC_DEFINE(HAVE__VSNWPRINTF)],
4491                    [AC_MSG_RESULT([no])]);
4492 fi
4493
4494 if test "$wxUSE_FILE" = "yes"; then
4495     WX_CHECK_FUNCS(fsync)
4496 fi
4497
4498 dnl at least under IRIX with mipsPro the C99 round() function is available when
4499 dnl building using the C compiler but not when using C++ one
4500 AC_LANG_PUSH(C++)
4501 WX_CHECK_FUNCS(round,,,[#include <math.h>])
4502 AC_LANG_POP()
4503
4504 dnl the following tests are for Unix(like) systems only
4505 if test "$TOOLKIT" != "MSW"; then
4506
4507 dnl check for available version of iconv()
4508 if test "$wxUSE_LIBICONV" != "no" ; then
4509     AM_ICONV
4510     LIBS="$LIBICONV $LIBS"
4511 fi
4512
4513 dnl check for POSIX signals if we need them
4514 if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes" -a "$wxUSE_UNIX" = "yes"; then
4515     AC_CHECK_FUNCS(sigaction)
4516
4517     if test "$ac_cv_func_sigaction" = "no"; then
4518         AC_MSG_WARN([No POSIX signal functions on this system, wxApp::OnFatalException will not be called])
4519         wxUSE_ON_FATAL_EXCEPTION=no
4520     fi
4521
4522     if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes"; then
4523       AC_CACHE_CHECK([for sa_handler type], wx_cv_type_sa_handler,
4524       [
4525         dnl C compiler happily compiles the code even if there is type mismatch
4526         AC_LANG_PUSH(C++)
4527         AC_TRY_COMPILE([#include <signal.h>],
4528                      [
4529                         extern void testSigHandler(int);
4530
4531                         struct sigaction sa;
4532                         sa.sa_handler = testSigHandler;
4533                      ], [
4534                         wx_cv_type_sa_handler=int
4535                      ], [
4536                         wx_cv_type_sa_handler=void
4537                      ])
4538         AC_LANG_POP()
4539       ])
4540
4541       AC_DEFINE_UNQUOTED(wxTYPE_SA_HANDLER, $wx_cv_type_sa_handler)
4542     fi
4543 fi
4544
4545 dnl backtrace() and backtrace_symbols() for wxStackWalker
4546 if test "$wxUSE_STACKWALKER" = "yes" -a "$wxUSE_UNIX" = "yes"; then
4547     AC_CACHE_CHECK([for backtrace() in <execinfo.h>], wx_cv_func_backtrace,
4548         [
4549             AC_LANG_PUSH(C++)
4550             AC_TRY_COMPILE([#include <execinfo.h>],
4551                 [
4552                     void *trace[1];
4553                     char **messages;
4554
4555                     backtrace(trace, 1);
4556                     messages = backtrace_symbols(trace, 1);
4557                 ],
4558                 wx_cv_func_backtrace=yes,
4559                 wx_cv_func_backtrace=no
4560             )
4561             AC_LANG_POP()
4562         ]
4563     )
4564
4565
4566     if test "$wx_cv_func_backtrace" = "no"; then
4567         AC_MSG_WARN([backtrace() is not available, wxStackWalker will not be available])
4568         wxUSE_STACKWALKER=no
4569     else
4570         AC_CACHE_CHECK([for __cxa_demangle() in <cxxabi.h>], wx_cv_func_cxa_demangle,
4571             [
4572                 AC_LANG_PUSH(C++)
4573                 AC_TRY_LINK([#include <cxxabi.h>],
4574                     [
4575                         int rc;
4576                         __cxxabiv1::__cxa_demangle("foo", 0, 0, &rc);
4577                     ],
4578                     wx_cv_func_cxa_demangle=yes,
4579                     wx_cv_func_cxa_demangle=no
4580                 )
4581                 AC_LANG_POP()
4582             ]
4583         )
4584
4585         if test "$wx_cv_func_cxa_demangle" = "yes"; then
4586             AC_DEFINE(HAVE_CXA_DEMANGLE)
4587         fi
4588     fi
4589 fi
4590
4591 if test "$wxUSE_STACKWALKER" = "yes" -a "$USE_WIN32" != 1 -a "$USE_UNIX" != 1; then
4592     AC_MSG_WARN([wxStackWalker is only available on Win32 and UNIX... disabled])
4593     wxUSE_STACKWALKER=no
4594 fi
4595
4596
4597 dnl check for the function for temp files creation
4598 AC_CHECK_FUNCS(mkstemp mktemp, break)
4599
4600 dnl get the library function to use for wxGetDiskSpace(): it is statfs() under
4601 dnl Linux and *BSD and statvfs() under Solaris
4602 AC_CACHE_CHECK(for statfs, wx_cv_func_statfs,
4603     AC_TRY_COMPILE(
4604         [
4605              #if defined(__BSD__)
4606              #include <sys/param.h>
4607              #include <sys/mount.h>
4608              #else
4609              #include <sys/vfs.h>
4610              #endif
4611         ],
4612         [
4613              long l;
4614              struct statfs fs;
4615              statfs("/", &fs);
4616              l = fs.f_bsize;
4617              l += fs.f_blocks;
4618              l += fs.f_bavail;
4619         ],
4620          wx_cv_func_statfs=yes,
4621          wx_cv_func_statfs=no
4622     )
4623 )
4624
4625 if test "$wx_cv_func_statfs" = "yes"; then
4626     dnl check whether we have its dcelaration too: some systems (AIX 4) lack it
4627     AC_CACHE_CHECK(for statfs declaration, wx_cv_func_statfs_decl,
4628         AC_LANG_PUSH(C++)
4629         AC_TRY_COMPILE(
4630             [
4631                  #if defined(__BSD__)
4632                  #include <sys/param.h>
4633                  #include <sys/mount.h>
4634                  #else
4635                  #include <sys/vfs.h>
4636                  #endif
4637             ],
4638             [
4639                 struct statfs fs;
4640                 statfs("", &fs);
4641             ],
4642             wx_cv_func_statfs_decl=yes,
4643             wx_cv_func_statfs_decl=no
4644         )
4645         AC_LANG_POP()
4646     )
4647
4648     if test "$wx_cv_func_statfs_decl" = "yes"; then
4649         AC_DEFINE(HAVE_STATFS_DECL)
4650     fi
4651
4652     wx_cv_type_statvfs_t="struct statfs"
4653     AC_DEFINE(HAVE_STATFS)
4654 else
4655     AC_CACHE_CHECK(for statvfs, wx_cv_func_statvfs,
4656         AC_TRY_COMPILE(
4657             [
4658                 #include <stddef.h>
4659                 #include <sys/statvfs.h>
4660             ],
4661             [
4662                 statvfs("/", NULL);
4663             ],
4664             wx_cv_func_statvfs=yes,
4665             wx_cv_func_statvfs=no
4666         )
4667     )
4668
4669     if test "$wx_cv_func_statvfs" = "yes"; then
4670         dnl we also have to check whether we should use statvfs_t (works under
4671         dnl Solaris 8, doesn't work under Solaris 7) or "struct statvfs" (vice
4672         dnl versa) as the argument for statvfs in 64 bit off_t mode (in 32 bit
4673         dnl mode both work fine)
4674         dnl
4675         dnl for this check C++ compiler has to be used as passing incompatible
4676         dnl pointers is just a warning and not an error in C
4677         AC_CACHE_CHECK(for statvfs argument type, wx_cv_type_statvfs_t,
4678             AC_LANG_PUSH(C++)
4679             AC_TRY_COMPILE(
4680                 [
4681                     #include <sys/statvfs.h>
4682                 ],
4683                 [
4684                     long l;
4685                     statvfs_t fs;
4686                     statvfs("/", &fs);
4687                     l = fs.f_bsize;
4688                     l += fs.f_blocks;
4689                     l += fs.f_bavail;
4690                 ],
4691                 wx_cv_type_statvfs_t=statvfs_t,
4692                 [
4693                     AC_TRY_COMPILE(
4694                         [
4695                             #include <sys/statvfs.h>
4696                         ],
4697                         [
4698                             long l;
4699                             struct statvfs fs;
4700                             statvfs("/", &fs);
4701                             l = fs.f_bsize;
4702                             l += fs.f_blocks;
4703                             l += fs.f_bavail;
4704                         ],
4705                         wx_cv_type_statvfs_t="struct statvfs",
4706                         wx_cv_type_statvfs_t="unknown"
4707                     )
4708                 ]
4709             )
4710             AC_LANG_POP()
4711         )
4712
4713         if test "$wx_cv_type_statvfs_t" != "unknown"; then
4714             AC_DEFINE(HAVE_STATVFS)
4715         fi
4716     else
4717         dnl set it for the test below
4718         wx_cv_type_statvfs_t="unknown"
4719     fi
4720 fi
4721
4722 if test "$wx_cv_type_statvfs_t" != "unknown"; then
4723     AC_DEFINE_UNQUOTED(WX_STATFS_T, $wx_cv_type_statvfs_t)
4724 else
4725     AC_MSG_WARN([wxGetDiskSpace() function won't work without statfs()])
4726 fi
4727
4728 dnl check for fcntl() or at least flock() needed by Unix implementation of
4729 dnl wxSingleInstanceChecker
4730 if test "$wxUSE_SNGLINST_CHECKER" = "yes"; then
4731     AC_CHECK_FUNCS(fcntl flock, break)
4732
4733     if test "$ac_cv_func_fcntl" != "yes" -a "$ac_cv_func_flock" != "yes"; then
4734         AC_MSG_WARN(wxSingleInstanceChecker not available)
4735         wxUSE_SNGLINST_CHECKER=no
4736     fi
4737 fi
4738
4739 dnl look for a function to modify the environment
4740 AC_CHECK_FUNCS(setenv putenv, break)
4741 if test "$ac_cv_func_setenv" = "yes"; then
4742     AC_CHECK_FUNCS(unsetenv)
4743 fi
4744
4745 HAVE_SOME_SLEEP_FUNC=0
4746 if test "$USE_BEOS" = 1; then
4747     dnl BeOS has its own (wonder where did they get it from) sleep() function
4748     dnl in unistd.h
4749     AC_DEFINE(HAVE_SLEEP)
4750     HAVE_SOME_SLEEP_FUNC=1
4751 fi
4752
4753 if test "$USE_DARWIN" = 1; then
4754     dnl Mac OS X/Darwin has both nanosleep and usleep
4755     dnl but only usleep is defined in unistd.h
4756     AC_DEFINE(HAVE_USLEEP)
4757     HAVE_SOME_SLEEP_FUNC=1
4758 fi
4759
4760 if test "$HAVE_SOME_SLEEP_FUNC" != 1; then
4761     dnl try nanosleep() in libc and libposix4, if this fails - usleep()
4762     POSIX4_LINK=
4763     AC_CHECK_FUNCS(nanosleep,
4764         AC_DEFINE(HAVE_NANOSLEEP),
4765         [
4766             AC_CHECK_LIB(posix4, nanosleep,
4767                 [
4768                     AC_DEFINE(HAVE_NANOSLEEP)
4769                     POSIX4_LINK=" -lposix4"
4770                 ],
4771                 [
4772                     WX_CHECK_FUNCS(usleep,,
4773                                     AC_MSG_WARN([wxSleep() function will not work])
4774                     )
4775                 ]
4776             )
4777         ]
4778     )
4779 fi
4780
4781 dnl check for uname (POSIX) and gethostname (BSD)
4782 WX_CHECK_FUNCS(uname,,,[#include <sys/utsname.h>])
4783 if test "$wx_cv_func_uname" != yes; then
4784     WX_CHECK_FUNCS(gethostname)
4785 fi
4786
4787 WX_CHECK_FUNCS(strtok_r, [], [], [#define _REENTRANT])
4788
4789 dnl check for inet_addr and inet_aton (these may live either in libc, or in
4790 dnl libnsl or libresolv or libsocket)
4791 INET_LINK=
4792 AC_CHECK_FUNCS(inet_addr,
4793     AC_DEFINE(HAVE_INET_ADDR),
4794     [
4795         AC_CHECK_LIB(nsl, inet_addr,
4796             INET_LINK="nsl",
4797             [
4798                 AC_CHECK_LIB(resolv, inet_addr,
4799                     INET_LINK="resolv",
4800                     [
4801                         AC_CHECK_LIB(socket, inet_addr,
4802                             INET_LINK="socket"
4803                         )
4804                     ]
4805                 )
4806             ]
4807         )
4808     ]
4809 )
4810
4811 AC_CHECK_FUNCS(inet_aton,
4812         AC_DEFINE(HAVE_INET_ATON),
4813         [
4814             dnl only check it in the same lib
4815             AC_CHECK_LIB($INET_LINK, inet_aton, AC_DEFINE(HAVE_INET_ATON))
4816         ])
4817
4818 if test "x$INET_LINK" != "x"; then
4819     AC_DEFINE(HAVE_INET_ADDR)
4820     INET_LINK=" -l$INET_LINK"
4821 fi
4822
4823 WX_CHECK_FUNCS(fdopen)
4824
4825 if test "$wxUSE_TARSTREAM" = "yes"; then
4826     WX_CHECK_FUNCS(sysconf)
4827
4828     WX_CHECK_FUNCS(getpwuid_r, [], [],
4829                    [
4830                     #define _REENTRANT
4831                     #include <pwd.h>
4832                    ],
4833                    [[
4834                     struct passwd pw, *ppw;
4835                     char buf[1024];
4836                     getpwuid_r(0, &pw, buf, sizeof(buf), &ppw)
4837                    ]])
4838
4839     WX_CHECK_FUNCS(getgrgid_r, [], [],
4840                    [
4841                     #define _REENTRANT
4842                     #include <grp.h>
4843                    ],
4844                    [[
4845                     struct group grp, *pgrp;
4846                     char buf[1024];
4847                     getgrgid_r(0, &grp, buf, sizeof(buf), &pgrp)
4848                    ]])
4849 fi
4850
4851 fi
4852
4853
4854 dnl ===========================================================================
4855 dnl Now we have all the info we need - use it!
4856 dnl ===========================================================================
4857
4858 dnl flush the cache
4859 AC_CACHE_SAVE
4860
4861 dnl ---------------------------------------------------------------------------
4862 dnl thread support for Unix (for Win32 and OS/2 see past
4863 dnl                          the next matching "else")
4864 dnl ---------------------------------------------------------------------------
4865
4866 dnl under MSW (except mingw32) we always have thread support
4867 if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
4868
4869     dnl the code below:
4870     dnl
4871     dnl   defines THREADS_LINK and THREADS_CFLAGS which are the options
4872     dnl   necessary to build the MT programs for the linker and compiler
4873     dnl   respectively
4874     dnl
4875     dnl   sets wxUSE_THREADS=1 if thread support is activated
4876
4877     THREADS_LINK=
4878     THREADS_CFLAGS=
4879
4880     if test "$wxUSE_THREADS" = "yes" ; then
4881         if test "$USE_BEOS" = 1; then
4882             AC_MSG_WARN([BeOS threads are not yet supported... disabled])
4883             wxUSE_THREADS="no"
4884         fi
4885     fi
4886
4887     if test "$wxUSE_THREADS" = "yes" ; then
4888         dnl find if POSIX threads are available
4889         dnl
4890         dnl the tests here are based on ACX_PTHREAD macro from autoconf macro
4891         dnl archive from http://ac-archive.sourceforge.net/
4892         dnl
4893         dnl thanks to Steven G. Johnson <stevenj@alum.mit.edu> and Alejandro
4894         dnl Forero Cuervo <bachue@bachue.com> for the original code
4895
4896         dnl TODO: cache the result
4897
4898         dnl define the list of the thread options to try in the loop below
4899         dnl with the convention that anything starting with '-' is a cpp flag
4900         dnl while anything else is a library (i.e. there is an implicit "-l")
4901         THREAD_OPTS="-pthread"
4902         if test "x$SUNCXX" = xyes; then
4903             THREAD_OPTS="-mt lthread $THREAD_OPTS"
4904         fi
4905
4906         case "${host}" in
4907           *-*-solaris2* | *-*-sunos4* )
4908                 if test "x$GCC" = "xyes"; then
4909                     dnl Solaris/gcc combination use this one for some reason
4910                     THREAD_OPTS="-pthreads $THREAD_OPTS"
4911                 fi
4912                 ;;
4913           *-*-freebsd*)
4914                 dnl look, in order, for the kernel threads, then Linux threads
4915                 dnl and finally the userland threads
4916                 THREAD_OPTS="-kthread lthread $THREAD_OPTS c_r"
4917                 ;;
4918           *-*-darwin* | *-*-cygwin* )
4919                 dnl Darwin / Mac OS X just uses -lpthread tested below
4920                 dnl and so does Cygwin
4921                 THREAD_OPTS=""
4922                 ;;
4923           *-*-aix*)
4924                 dnl AIX calls the library libpthreads - thanks IBM!
4925                 THREAD_OPTS="pthreads"
4926                 ;;
4927           *-hp-hpux* )
4928                 if test "x$GCC" = "xyes"; then
4929                     dnl g++ versions before 3.3.2 don't support -pthread.
4930                     $CXX -dumpspecs | grep 'pthread:' >/dev/null ||
4931                         THREAD_OPTS=""
4932                 else
4933                     dnl HP-UX aCC (tested with version B3910B A.06.05 [Jul 25
4934                     dnl 2005]) supports -mt
4935                     THREAD_OPTS="-mt"
4936                 fi
4937                 ;;
4938
4939           *-*-irix* )
4940                 dnl gcc under IRIX doesn't seem to like -pthread, but it
4941                 dnl doesn't give an error for it neither, just a warning
4942                 dnl message -- but this is still very annoying
4943                 if test "x$GCC" = "xyes"; then
4944                     THREAD_OPTS=""
4945                 fi
4946                 ;;
4947
4948           *-*-qnx*)
4949                 dnl under QNX thread functions are in libc so we don't need any
4950                 dnl special options to link with them
4951                 THREAD_OPTS=""
4952                 ;;
4953
4954           *-*-*UnixWare*)
4955                 dnl flying by man pages here: Caldera online docs use this
4956                 if test "x$GCC" != "xyes"; then
4957                     THREAD_OPTS="-Ethread"
4958                 fi
4959                 ;;
4960         esac
4961
4962         case "${host}" in
4963             *-*-qnx*)
4964                 dnl -lpthread works, i.e. AC_TRY_LINK() would pass, but results
4965                 dnl in warnings and is not needed under QNX so try without it
4966                 dnl first
4967                 THREAD_OPTS="none pthread"
4968                 ;;
4969
4970             *)
4971                 dnl simply linking with libpthread should make the test below
4972                 dnl work but it's far from certain that the threaded programs
4973                 dnl compiled without any special switches actually work, so try
4974                 dnl it after all the others
4975                 THREAD_OPTS="$THREAD_OPTS pthread none"
4976                 ;;
4977         esac
4978
4979         dnl now test for all possibilities
4980         THREADS_OK=no
4981         for flag in $THREAD_OPTS; do
4982             case $flag in
4983                 none)
4984                     AC_MSG_CHECKING([whether pthreads work without any flags])
4985                     ;;
4986
4987                 -*)
4988                     AC_MSG_CHECKING([whether pthreads work with $flag])
4989                     THREADS_CFLAGS="$flag"
4990                     ;;
4991
4992                 *)
4993                     AC_MSG_CHECKING([for the pthreads library -l$flag])
4994                     THREADS_LINK="-l$flag"
4995                     ;;
4996               esac
4997
4998               save_LIBS="$LIBS"
4999               save_CFLAGS="$CFLAGS"
5000               LIBS="$THREADS_LINK $LIBS"
5001               CFLAGS="$THREADS_CFLAGS $CFLAGS"
5002
5003               AC_TRY_LINK([#include <pthread.h>],
5004                           [pthread_create(0,0,0,0);],
5005                           THREADS_OK=yes)
5006
5007               LIBS="$save_LIBS"
5008               CFLAGS="$save_CFLAGS"
5009
5010               AC_MSG_RESULT($THREADS_OK)
5011               if test "x$THREADS_OK" = "xyes"; then
5012                       break;
5013               fi
5014
5015               THREADS_LINK=""
5016               THREADS_CFLAGS=""
5017       done
5018
5019       if test "x$THREADS_OK" != "xyes"; then
5020           wxUSE_THREADS=no
5021           AC_MSG_WARN([No thread support on this system... disabled])
5022       else
5023           dnl yes, these special compiler flags should be used with the
5024           dnl linker as well
5025           dnl
5026           dnl NB: add them to LDFLAGS immediately because we need them to be
5027           dnl     used for the subsequent tests some of which can fail without
5028           dnl     MT support, hence the reason for the duplication below:
5029           dnl     adding them just to WXCONFIG_LDFLAGS and adding the entire
5030           dnl     contents of the latter to LDFLAGS in the end is not enough.
5031           LDFLAGS="$THREADS_CFLAGS $LDFLAGS"
5032           WXCONFIG_LDFLAGS="$THREADS_CFLAGS $WXCONFIG_LDFLAGS"
5033           LIBS="$THREADS_LINK $LIBS"
5034
5035           AC_MSG_CHECKING([if more special flags are required for pthreads])
5036           flag=no
5037           case "${host}" in
5038             *-aix*)
5039                 dnl again quoting from
5040                 dnl http://www-1.ibm.com/servers/esdd/articles/gnu.html:
5041                 dnl
5042                 dnl     When compiling and linking with -pthread, the library
5043                 dnl     search path should include -L/usr/lib/threads at the
5044                 dnl     beginning of the path.
5045                 LDFLAGS="-L/usr/lib/threads $LDFLAGS"
5046                 WXCONFIG_LDFLAGS="-L/usr/lib/threads $WXCONFIG_LDFLAGS"
5047                 flag="-D_THREAD_SAFE"
5048                 ;;
5049             *-freebsd*)
5050                 flag="-D_THREAD_SAFE"
5051                 ;;
5052             *-hp-hpux* )
5053                 flag="-D_REENTRANT"
5054                 if test "x$GCC" != "xyes"; then
5055                     dnl see http://docs.hp.com/hpux/onlinedocs/2213/threads.htm
5056                     flag="$flag -D_RWSTD_MULTI_THREAD"
5057                 fi
5058                 ;;
5059             *solaris* | alpha*-osf*)
5060                 flag="-D_REENTRANT"
5061                 ;;
5062           esac
5063           AC_MSG_RESULT(${flag})
5064           if test "x$flag" != xno; then
5065               THREADS_CFLAGS="$THREADS_CFLAGS $flag"
5066           fi
5067
5068           dnl don't add these options to CPPFLAGS as cpp might not know them
5069           WXCONFIG_CFLAGS="$WXCONFIG_CFLAGS $THREADS_CFLAGS"
5070       fi
5071     fi
5072
5073     dnl do other tests only if we are using threads
5074     if test "$wxUSE_THREADS" = "yes" ; then
5075       AC_CHECK_FUNCS(thr_setconcurrency)
5076
5077       dnl can't use AC_CHECK_FUNCS for this one as it's usually a macro and so
5078       dnl wouldn't be found by it
5079       AC_CACHE_CHECK([for pthread_cleanup_push/pop], wx_cv_func_pthread_cleanup,
5080       [
5081         dnl C compiler may treat pthread_cleanup_push() as an undeclared
5082         dnl function and not give a warning even if it's unavailable, so use
5083         dnl the C++ one for this test
5084         AC_LANG_PUSH(C++)
5085         AC_TRY_COMPILE([#include <pthread.h>
5086                void ThreadCleanupFunc(void *p);
5087             ],
5088             [
5089                 void *p;
5090                 pthread_cleanup_push(ThreadCleanupFunc, p);
5091                 pthread_cleanup_pop(0);
5092             ], [
5093                wx_cv_func_pthread_cleanup=yes
5094             ], [
5095                wx_cv_func_pthread_cleanup=no
5096             ]
5097         )
5098         AC_LANG_POP()
5099       ])
5100       if test "x$wx_cv_func_pthread_cleanup" = "xyes"; then
5101         AC_DEFINE(wxHAVE_PTHREAD_CLEANUP)
5102       fi
5103
5104       AC_CHECK_HEADERS(sched.h,,, [AC_INCLUDES_DEFAULT()])
5105       if test "$ac_cv_header_sched_h" = "yes"; then
5106           AC_CHECK_FUNC(sched_yield,
5107             AC_DEFINE(HAVE_SCHED_YIELD),
5108             [
5109                 AC_CHECK_LIB(posix4,
5110                     sched_yield,
5111                     [AC_DEFINE(HAVE_SCHED_YIELD) POSIX4_LINK=" -lposix4"],
5112                     AC_MSG_WARN(wxThread::Yield will not work properly)
5113                 )
5114             ]
5115           )
5116       fi
5117
5118       dnl to be able to set the thread priority, we need to have all of the
5119       dnl following functions:
5120       dnl   1. pthread_attr_getschedpolicy
5121       dnl   2. sched_get_priority_min and sched_get_priority_max
5122       dnl      (this one can be in either libpthread or libposix4 (under Solaris))
5123       dnl   3. pthread_attr_getschedparam and pthread_attr_setschedparam
5124       HAVE_PRIOR_FUNCS=0
5125       AC_CHECK_FUNC(pthread_attr_getschedpolicy,
5126                      [AC_CHECK_FUNC(pthread_attr_setschedparam,
5127                        [AC_CHECK_FUNC(sched_get_priority_max,
5128                            HAVE_PRIOR_FUNCS=1,
5129                            [AC_CHECK_LIB([posix4], sched_get_priority_max,
5130                              [
5131                                 HAVE_PRIOR_FUNCS=1
5132                                 POSIX4_LINK=" -lposix4"
5133                              ],
5134                            )]
5135                        )]
5136                      )]
5137                    )
5138
5139       if test "$HAVE_PRIOR_FUNCS" = 1; then
5140         AC_DEFINE(HAVE_THREAD_PRIORITY_FUNCTIONS)
5141       else
5142         AC_MSG_WARN(Setting thread priority will not work)
5143       fi
5144
5145       AC_CHECK_FUNC(pthread_cancel,
5146                     AC_DEFINE(HAVE_PTHREAD_CANCEL),
5147                     AC_MSG_WARN([wxThread::Kill() will not work properly]))
5148
5149       AC_CHECK_FUNC(pthread_mutex_timedlock,
5150                     AC_DEFINE(HAVE_PTHREAD_MUTEX_TIMEDLOCK),
5151                     AC_MSG_WARN([wxMutex::LockTimeout() will not work]))
5152
5153       AC_CHECK_FUNC(pthread_attr_setstacksize,
5154                     AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE))
5155
5156       dnl mutexattr_t initialization is done in quite different ways on different
5157       dnl platforms, so check for a few things:
5158       dnl
5159       dnl HAVE_MUTEX_RECURSIVE means that we can create recursive mutexes
5160       dnl HAVE_MUTEXATTR_SETTYPE means that we do it using
5161       dnl pthread_mutexattr_settype(PTHREAD_MUTEX_RECURSIVE) and if it is not
5162       dnl defined, we do it by directly assigned
5163       dnl PTHREAD_MUTEX_RECURSIVE_MUTEX_INITIALIZER_NP to attr
5164
5165       AC_CACHE_CHECK([for pthread_mutexattr_t], wx_cv_type_pthread_mutexattr_t,
5166       [
5167         AC_TRY_COMPILE([#include <pthread.h>],
5168             [
5169                pthread_mutexattr_t attr;
5170                pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
5171             ],
5172             wx_cv_type_pthread_mutexattr_t=yes,
5173             wx_cv_type_pthread_mutexattr_t=no
5174         )
5175       ])
5176
5177       if test "$wx_cv_type_pthread_mutexattr_t" = "yes"; then
5178         AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_T)
5179
5180         dnl check if we already have the declaration we need, it is not
5181         dnl present in some systems' headers
5182         AC_CACHE_CHECK([for pthread_mutexattr_settype declaration],
5183                        wx_cv_func_pthread_mutexattr_settype_decl, [
5184                        AC_TRY_COMPILE([#include <pthread.h>],
5185                            [
5186                                pthread_mutexattr_t attr;
5187                                pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
5188                            ],
5189                            wx_cv_func_pthread_mutexattr_settype_decl=yes,
5190                            wx_cv_func_pthread_mutexattr_settype_decl=no
5191                        )
5192         ])
5193         if test "$wx_cv_func_pthread_mutexattr_settype_decl" = "yes"; then
5194             AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_SETTYPE_DECL)
5195         fi
5196       else
5197         dnl don't despair, there may be another way to do it
5198         AC_CACHE_CHECK([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER],
5199                        wx_cv_type_pthread_rec_mutex_init,
5200         [
5201             AC_TRY_COMPILE([#include <pthread.h>],
5202                 [
5203                     pthread_mutex_t attr = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
5204                 ], [
5205                     wx_cv_type_pthread_rec_mutex_init=yes
5206                 ], [
5207                     wx_cv_type_pthread_rec_mutex_init=no
5208                 ]
5209             )
5210         ])
5211         if test "$wx_cv_type_pthread_rec_mutex_init" = "yes"; then
5212           AC_DEFINE(HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
5213         else
5214           dnl this may break code working elsewhere, so at least warn about it
5215           AC_MSG_WARN([wxMutex won't be recursive on this platform])
5216         fi
5217       fi
5218
5219       if test "$wxUSE_COMPILER_TLS" = "auto"; then
5220           if test "$USE_NETBSD" = 1; then
5221               AC_MSG_WARN([Disabling TLS under NetBSD, please contact wx-dev if it works now])
5222               wxUSE_COMPILER_TLS=no
5223           else
5224               wxUSE_COMPILER_TLS=yes
5225           fi
5226       fi
5227
5228       if test "$wxUSE_COMPILER_TLS" = "yes"; then
5229           dnl test for compiler thread-specific variables support
5230           AC_CACHE_CHECK([for __thread keyword],
5231                          wx_cv_cc___thread,
5232               [
5233                   AC_TRY_COMPILE([#include <pthread.h>],
5234                       [
5235                           static __thread int n = 0;
5236                           static __thread int *p = 0;
5237                       ],
5238                       wx_cv_cc___thread=yes,
5239                       wx_cv_cc___thread=no
5240                   )
5241               ]
5242           )
5243
5244           if test "$wx_cv_cc___thread" = "yes"; then
5245               AX_GXX_VERSION
5246               if test -n "$ax_cv_gxx_version"; then
5247                   dnl g++ supports __thread since at least version 3.3 but its support
5248                   dnl seems to be broken until 4.1, see
5249                   dnl   http://thread.gmane.org/gmane.comp.lib.wxwidgets.devel/108388
5250                   dnl
5251                   dnl NB: we still need to test __thread support with
5252                   dnl     AC_TRY_COMPILE above even for g++ 4 as it doesn't
5253                   dnl     support it for all architectures (e.g. it doesn't
5254                   dnl     work under OS X)
5255                   AC_MSG_CHECKING([whether __thread support in g++ is usable])
5256                   case "$ax_cv_gxx_version" in
5257                     1.* | 2.* | 3.* )
5258                         AC_MSG_RESULT([no, it's broken])
5259                         wx_cv_cc___thread=no
5260                         ;;
5261                     *)
5262                         AC_MSG_RESULT([yes, it works])
5263                         ;;
5264                   esac
5265               fi
5266           fi
5267
5268           if test "$wx_cv_cc___thread" = "yes"; then
5269             AC_DEFINE(HAVE___THREAD_KEYWORD)
5270           fi
5271         fi
5272     fi
5273
5274 dnl from if !MSW
5275 else
5276     if test "$wxUSE_THREADS" = "yes" ; then
5277       case "${host}" in
5278         x86_64-*-mingw32* )
5279         ;;
5280         *-*-mingw32* )
5281             dnl check if the compiler accepts -mthreads
5282             AC_CACHE_CHECK([if compiler supports -mthreads],
5283                 wx_cv_cflags_mthread,
5284                 [
5285                     CFLAGS_OLD="$CFLAGS"
5286                     CFLAGS="-mthreads $CFLAGS"
5287                     AC_TRY_COMPILE([], [],
5288                         wx_cv_cflags_mthread=yes,
5289                         wx_cv_cflags_mthread=no
5290                     )
5291                 ]
5292             )
5293
5294             if test "$wx_cv_cflags_mthread" = "yes"; then
5295                 dnl it does, use it
5296                 WXCONFIG_CFLAGS="$WXCONFIG_CFLAGS -mthreads"
5297                 LDFLAGS="$LDFLAGS -mthreads"
5298             else
5299                 dnl it doesn't
5300                 CFLAGS="$CFLAGS_OLD"
5301             fi
5302         ;;
5303         *-pc-os2*emx )
5304             WXCONFIG_CFLAGS="$WXCONFIG_CFLAGS -Zmt -D__ST_MT_ERRNO__"
5305             LDFLAGS="$LDFLAGS -Zmt"
5306         ;;
5307       esac
5308     fi
5309 fi
5310
5311 AC_CHECK_FUNC(localtime_r, [ AC_DEFINE(HAVE_LOCALTIME_R) ])
5312 AC_CHECK_FUNC(gmtime_r, [ AC_DEFINE(HAVE_GMTIME_R) ])
5313 dnl By preference, we probably should use getaddrinfo which avoids thread
5314 dnl safety issues and supports IPv6, however there currently is no code
5315 dnl for it, so testing for it is temporarily disabled and we are restricted
5316 dnl to gethostbyname_r/gethostbyaddr_r  and getservbyname_r
5317
5318 dnl AC_CHECK_FUNC(getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO), [
5319     dnl no getaddrinfo, so check for gethostbyname_r and
5320     dnl related functions (taken from python's configure.in)
5321     dnl sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments
5322       AX_FUNC_WHICH_GETHOSTBYNAME_R
5323       if test "x$ac_cv_func_which_gethostbyname_r" = "xno" -o \
5324               "x$ac_cv_func_which_gethostbyname_r" = "xunknown" ; then
5325           AC_CHECK_FUNC(gethostbyname, [ AC_DEFINE(HAVE_GETHOSTBYNAME) ])
5326       fi
5327       dnl A similar test for getservbyname_r
5328       dnl I'm tempted to just not do this test which is taking much time and
5329       dnl do something similar as for gethostbyaddr_r, but OTOH the macro
5330       dnl doing the test already exists, so using it is easy enough.     - SN
5331       AC_raf_FUNC_WHICH_GETSERVBYNAME_R
5332       if test "x$ac_cv_func_which_getservbyname_r" = "xno" -o \
5333               "x$ac_cv_func_which_getservbyname_r" = "xunknown" ; then
5334           AC_CHECK_FUNCS(getservbyname,[ AC_DEFINE(HAVE_GETSERVBYNAME) ])
5335       fi
5336       dnl For gethostbyaddr_r, we currently do no separate test, instead, we
5337       dnl silently assume it's available exactly if gethostbyname_r is
5338       dnl available and always requires two more arguments than
5339       dnl gethostbyname_r.
5340       dnl (also, I'm lazy and there no m4 file that's ready for use for this
5341       dnl  function, although it should be easy to rewrite the gethostbyname_r
5342       dnl  check to fit this case, if it's really needed.                - SN )
5343 dnl    ]
5344 dnl )
5345
5346 if test "$wxUSE_THREADS" = "yes"; then
5347   AC_DEFINE(wxUSE_THREADS)
5348
5349   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS thread"
5350 else
5351   dnl on some systems, _REENTRANT should be defined if we want to use any _r()
5352   dnl functions - add tests for other functions here as well
5353   if test "$wx_cv_func_strtok_r" = "yes"; then
5354     AC_MSG_CHECKING(if -D_REENTRANT is needed)
5355     if test "$NEEDS_D_REENTRANT_FOR_R_FUNCS" = 1; then
5356         WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS -D_REENTRANT"
5357         AC_MSG_RESULT(yes)
5358     else
5359         AC_MSG_RESULT(no)
5360     fi
5361   fi
5362 fi
5363
5364 if test "$WXGTK2" = 1 ; then
5365   AC_DEFINE_UNQUOTED(__WXGTK20__,$WXGTK2)
5366   WXGTK12=1
5367 fi
5368
5369 if test "$WXGTK12" = 1 ; then
5370   AC_DEFINE_UNQUOTED(__WXGTK12__,$WXGTK12)
5371 fi
5372
5373 if test "$WXGTK127" = 1 ; then
5374   AC_DEFINE_UNQUOTED(__WXGTK127__,$WXGTK127)
5375 fi
5376
5377 if test "$WXGPE" = 1 ; then
5378   AC_DEFINE_UNQUOTED(__WXGPE__,$WXGPE)
5379 fi
5380
5381 dnl DEBUG_CFLAGS contains debugging options (supposed to be the same for C and C++
5382 dnl compilers: we'd need a separate DEBUG_CXXFLAGS if this is ever not the case)
5383 DEBUG_CFLAGS=
5384 if `echo $CXXFLAGS $CFLAGS | grep " -g" >/dev/null`; then
5385     dnl the CXXFLAGS or the CFLAGS variable already contains the -g flag
5386     dnl (e.g. it was specified by the user before running configure); since
5387     dnl later they will be merged with DEBUG_CFLAGS, don't set the -g option
5388     dnl in DEBUG_CFLAGS to avoid (possibly different) flag duplicates
5389     AC_MSG_WARN([CXXFLAGS/CFLAGS already contains -g flag; ignoring the --enable-debug_info option])
5390 elif test "$wxUSE_DEBUG_INFO" = "yes" ; then
5391     DEBUG_CFLAGS="-g"
5392 fi
5393
5394 if test "$wxUSE_DEBUG_GDB" = "yes" ; then
5395     wxUSE_DEBUG_INFO=yes
5396     if test "$GCC" = yes; then
5397         DEBUG_CFLAGS="-ggdb"
5398     fi
5399 fi
5400
5401 if test "$wxUSE_DEBUG_FLAG" = "no" ; then
5402     WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS -DwxDEBUG_LEVEL=0"
5403
5404     if test "$wxUSE_GTK" = 1 ; then
5405         if test "x$wxGTK_VERSION" = "x1" ; then
5406             CPPFLAGS="-DGTK_NO_CHECK_CASTS $CPPFLAGS"
5407         fi
5408     fi
5409 fi
5410
5411 if test "$wxUSE_MEM_TRACING" = "yes" ; then
5412     AC_DEFINE(wxUSE_MEMORY_TRACING)
5413     AC_DEFINE(wxUSE_GLOBAL_MEMORY_OPERATORS)
5414     AC_DEFINE(wxUSE_DEBUG_NEW_ALWAYS)
5415     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS memcheck"
5416 fi
5417
5418 if test "$wxUSE_DMALLOC" = "yes" ; then
5419     DMALLOC_LIBS="-ldmallocthcxx"
5420 fi
5421
5422 dnl cc/cxx/ld option for profiling
5423 PROFILE_FLAGS=
5424 if test "$wxUSE_PROFILE" = "yes" ; then
5425     PROFILE_FLAGS=" -pg"
5426 fi
5427
5428 if test "$GCC" = "yes" ; then
5429     if test "$wxUSE_NO_RTTI" = "yes" ; then
5430         dnl Define wxNO_RTTI on the command line because only g++ 4.3 and later
5431         dnl define __GXX_RTTI which allows us to detect the use of -fno-rtti
5432         dnl switch but we need to do it manually for the older versions.
5433         WXCONFIG_CXXFLAGS="$WXCONFIG_CXXFLAGS -DwxNO_RTTI -fno-rtti"
5434     fi
5435     if test "$wxUSE_NO_EXCEPTIONS" = "yes" ; then
5436         WXCONFIG_CXXFLAGS="$WXCONFIG_CXXFLAGS -fno-exceptions"
5437     fi
5438     if test "$wxUSE_PERMISSIVE" = "yes" ; then
5439         WXCONFIG_CFLAGS="$WXCONFIG_CFLAGS -fpermissive"
5440     fi
5441
5442     dnl Ian Brown <ian.brown@printsoft.de> reports that versions of gcc before
5443     dnl 3.0 overflow the table of contents on rs6000 as they create an entry
5444     dnl for each subroutine by default -- using the switch below only creates
5445     dnl one entry per file instead at the price of minor performance penalty
5446     dnl
5447     dnl As of wx2.4 a bug in the hppa gcc compiler causes a similar problem
5448     dnl without -ffunction-sections.  No idea how long we'll need to maintain
5449     dnl this, or even the extent of gcc/wx version combinations affected, but
5450     dnl also as above, this 'fix' does not come without side effects.
5451     dnl
5452     dnl TODO: test for the gcc version here (how?)
5453     case "${host}" in
5454       powerpc*-*-aix* )
5455         WXCONFIG_CFLAGS="$WXCONFIG_CFLAGS -mminimal-toc"
5456         ;;
5457       *-hppa* )
5458         WXCONFIG_CFLAGS="$WXCONFIG_CFLAGS -ffunction-sections"
5459         ;;
5460     esac
5461 fi
5462
5463 dnl C/C++ compiler option for optimization (supposed to be the same for both)
5464 OPTIMISE_CFLAGS=
5465 if `echo $CXXFLAGS $CFLAGS | grep " -O" >/dev/null`; then
5466     dnl the CXXFLAGS or the CFLAGS variable already contains -O optimization flag
5467     dnl (e.g. it was specified by the user before running configure); since
5468     dnl later they will be merged with OPTIMISE_CFLAGS, don't set the -O option
5469     dnl in OPTIMISE_CFLAGS to avoid (possibly different) flag duplicates
5470     AC_MSG_WARN([CXXFLAGS/CFLAGS already contains -O flag; ignoring the --disable-optimise option])
5471 else
5472     if test "$wxUSE_OPTIMISE" = "no" ; then
5473         if test "$GCC" = yes ; then
5474             dnl use -O0 because compiling with it is faster than compiling with no
5475             dnl optimization options at all (at least with g++ 3.2)
5476             OPTIMISE_CFLAGS="-O0"
5477         fi
5478     else
5479         if test "$GCC" = yes ; then
5480             case "${host}" in
5481                 *-pc-os2_emx | *-pc-os2-emx )
5482                     dnl Not all of the supported gcc versions understand
5483                     dnl -fstrict-aliasing and none actually needs it (yet).
5484                     OPTIMISE_CFLAGS="-O2"
5485                 ;;
5486                 *)
5487                     dnl Switch on optimisation but keep strict-aliasing off for
5488                     dnl now (see -fstrict-aliasing in the gcc manual). When it is
5489                     dnl switched back on consider using -Wstrict-aliasing=2.
5490                     OPTIMISE_CFLAGS="-O2 -fno-strict-aliasing"
5491                 ;;
5492             esac
5493         else
5494             OPTIMISE_CFLAGS="-O"
5495         fi
5496     fi
5497 fi
5498
5499 dnl ---------------------------------------------------------------------------
5500 dnl compatibility level
5501 dnl ---------------------------------------------------------------------------
5502
5503 if test "x$WXWIN_COMPATIBILITY_2_6" = "xyes"; then
5504     AC_DEFINE(WXWIN_COMPATIBILITY_2_6)
5505
5506     WXWIN_COMPATIBILITY_2_8="yes"
5507 fi
5508
5509 if test "x$WXWIN_COMPATIBILITY_2_8" != "xno"; then
5510     AC_DEFINE(WXWIN_COMPATIBILITY_2_8)
5511 fi
5512
5513 dnl ---------------------------------------------------------------------------
5514 dnl the library may be built without GUI classes at all
5515 dnl ---------------------------------------------------------------------------
5516
5517 if test "$wxUSE_GUI" = "yes"; then
5518     AC_DEFINE(wxUSE_GUI)
5519
5520     dnl the things we always pull in the GUI version of the library:
5521     dnl 1. basic things like wxApp, wxWindow, wxControl, wxFrame, wxDialog (the
5522     dnl    library really can't be built without those)
5523     dnl 2. basic controls: wxButton, wxStaticText, wxTextCtrl (these are used in
5524     dnl    almost any program and the first 2 are needed to show a message box
5525     dnl    which want to be always able to do)
5526     dnl 3. GDI stuff: icon, cursors and all that. Although it would be very nice
5527     dnl    to compile without them (if the app doesn't do any drawing, it doesn't
5528     dnl    need the dcs, pens, brushes, ...), this just can't be done now
5529     dnl 4. menu stuff: wxMenu, wxMenuBar, wxMenuItem
5530     dnl 5. misc stuff: timers, settings, message box
5531 fi
5532
5533 dnl ---------------------------------------------------------------------------
5534 dnl Unix/Windows
5535 dnl ---------------------------------------------------------------------------
5536
5537 if test "$wxUSE_UNIX" = "yes"; then
5538   AC_DEFINE(wxUSE_UNIX)
5539 fi
5540
5541 dnl ------------------------------------------------------------------------
5542 dnl DLL support
5543 dnl ------------------------------------------------------------------------
5544
5545 dnl under MSW we always have LoadLibrary/GetProcAddress
5546 if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
5547
5548     HAVE_DL_FUNCS=0
5549     HAVE_SHL_FUNCS=0
5550     if test "$wxUSE_DYNAMIC_LOADER" = "yes" -o "$wxUSE_DYNLIB_CLASS" = "yes" ; then
5551         if test "$USE_DOS" = 1; then
5552             HAVE_DL_FUNCS=0
5553         else
5554             dnl the test is a bit complicated because we check for dlopen() both with
5555             dnl and without -ldl and we also try to find shl_load() if there is no
5556             dnl dlopen() on this system
5557             AC_CHECK_FUNCS(dlopen,
5558             [
5559                 AC_DEFINE(HAVE_DLOPEN)
5560                 HAVE_DL_FUNCS=1
5561             ],
5562             [
5563                 AC_CHECK_LIB(dl, dlopen,
5564                             [
5565                                 AC_DEFINE(HAVE_DLOPEN)
5566                                 HAVE_DL_FUNCS=1
5567                                 DL_LINK=" -ldl$DL_LINK"
5568                             ],
5569                             [
5570                                 AC_CHECK_FUNCS(shl_load,
5571                                               [
5572                                                 AC_DEFINE(HAVE_SHL_LOAD)
5573                                                 HAVE_SHL_FUNCS=1
5574                                               ],
5575                                               [
5576                                                 AC_CHECK_LIB(shl_load, dld,
5577                                                              [
5578                                                                 HAVE_SHL_FUNCS=1
5579                                                                 DL_LINK=" -ldld$DL_LINK"
5580                                                              ])
5581                                               ])
5582                             ])
5583             ])
5584
5585             dnl check also for dlerror()
5586             if test "$HAVE_DL_FUNCS" = 1; then
5587                 AC_CHECK_FUNCS(dlerror,
5588                     AC_DEFINE(HAVE_DLERROR),
5589                     [
5590                         AC_CHECK_LIB(dl, dlerror, AC_DEFINE(HAVE_DLERROR))
5591                     ]
5592                 )
5593             fi
5594         fi
5595
5596         dnl Force HAVE_DL_FUNCS on for Darwin, even if the tests failed (e.g. pre-10.3)
5597         if test "$USE_DARWIN" = 1; then
5598             dnl dlopen/dlerror is implemented in dynlib.cpp for Darwin/Mac OS X
5599             HAVE_DL_FUNCS=1
5600         fi
5601
5602         if test "$HAVE_DL_FUNCS" = 0; then
5603             if test "$HAVE_SHL_FUNCS" = 0; then
5604               if test "$USE_UNIX" = 1 -o "$USE_DOS" = 1; then
5605                   AC_MSG_WARN([Missing dynamic loading support, several features will be disabled])
5606                   wxUSE_DYNAMIC_LOADER=no
5607                   wxUSE_DYNLIB_CLASS=no
5608               else
5609                   AC_MSG_WARN([Assuming wxLibrary class works on this platform])
5610               fi
5611             fi
5612         fi
5613     fi
5614 fi
5615
5616 if test "$wxUSE_DYNAMIC_LOADER" = "yes" ; then
5617     AC_DEFINE(wxUSE_DYNAMIC_LOADER)
5618 fi
5619 if test "$wxUSE_DYNLIB_CLASS" = "yes" ; then
5620     AC_DEFINE(wxUSE_DYNLIB_CLASS)
5621 fi
5622
5623
5624 dnl ---------------------------------------------------------------------------
5625 dnl Verify consistency of plugins/monolithic/shared settings:
5626 dnl ---------------------------------------------------------------------------
5627
5628 if test "$wxUSE_PLUGINS" = "yes" ; then
5629     if test "$wxUSE_SHARED" = "no" ; then
5630         AC_MSG_WARN([plugins supported only in shared build, disabling])
5631         wxUSE_PLUGINS=no
5632     fi
5633     if test "$wxUSE_MONOLITHIC" = "yes" ; then
5634         AC_MSG_WARN([plugins not supported monolithic build, disabling])
5635         wxUSE_PLUGINS=no
5636     fi
5637     if test "$wxUSE_DYNLIB_CLASS" = "no" ; then
5638         AC_MSG_WARN([plugins require wxDynamicLibrary, disabling])
5639         wxUSE_PLUGINS=no
5640     fi
5641     if test "$wxUSE_PLUGINS" = "yes" ; then
5642         AC_DEFINE(wxUSE_PLUGINS)
5643     fi
5644 fi
5645
5646 dnl ---------------------------------------------------------------------------
5647 dnl File system watcher checks
5648 dnl ---------------------------------------------------------------------------
5649
5650 if test "$wxUSE_FSWATCHER" = "yes"; then
5651     dnl wxFileSystemWatcher is always available under MSW but we need either
5652     dnl inotify or kqueue support in the system for it under Unix (this
5653     dnl includes OS X which does have kqueue but no other platforms)
5654     if test "$wxUSE_MSW" != "1"; then
5655         if test "$wxUSE_UNIX" = "yes"; then
5656             AC_CHECK_HEADERS(sys/inotify.h,,, [AC_INCLUDES_DEFAULT()])
5657             if test "$ac_cv_header_sys_inotify_h" = "yes"; then
5658                 AC_DEFINE(wxHAS_INOTIFY)
5659             else
5660                 AC_CHECK_HEADERS(sys/event.h,,, [AC_INCLUDES_DEFAULT()])
5661                 if test "$ac_cv_header_sys_event_h" = "yes"; then
5662                     AC_DEFINE(wxHAS_KQUEUE)
5663                 else
5664                     wxUSE_FSWATCHER=no
5665                 fi
5666             fi
5667         else
5668             wxUSE_FSWATCHER=no
5669         fi
5670     fi
5671
5672     if test "$wxUSE_FSWATCHER" = "yes"; then
5673         AC_DEFINE(wxUSE_FSWATCHER)
5674         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS fswatcher"
5675     else
5676         AC_MSG_WARN([wxFileSystemWatcher won't be available on this platform])
5677     fi
5678 fi
5679
5680 dnl ---------------------------------------------------------------------------
5681 dnl Register non-GUI class options for makefiles and setup.h
5682 dnl ---------------------------------------------------------------------------
5683
5684 if test "$wxUSE_STL" = "yes"; then
5685   AC_DEFINE(wxUSE_STL)
5686 fi
5687
5688 if test "$wxUSE_EXTENDED_RTTI" = "yes"; then
5689   AC_DEFINE(wxUSE_EXTENDED_RTTI)
5690 fi
5691
5692 if test "$wxUSE_ANY" = "yes"; then
5693     AC_DEFINE(wxUSE_ANY)
5694 fi
5695
5696 if test "$wxUSE_APPLE_IEEE" = "yes"; then
5697   AC_DEFINE(wxUSE_APPLE_IEEE)
5698 fi
5699
5700 if test "$wxUSE_TIMER" = "yes"; then
5701   AC_DEFINE(wxUSE_TIMER)
5702 fi
5703
5704 dnl Unix implementation needs additional checks because audio support
5705 dnl comes in many favours:
5706 if test "$USE_UNIX" = 1 ; then
5707     dnl mmedia doesn't compile with wxMGL, remove this if this is ever fixed
5708     if test "$wxUSE_MGL" != 1; then
5709         dnl it's not enough to check for just the header because OSS under NetBSD
5710         dnl redefines ioctl as oss_ioctrl inside it and so we also need to test
5711         dnl whether we need -lossaudio at link-time
5712         AC_CACHE_CHECK([for SNDCTL_DSP_SPEED in sys/soundcard.h], ac_cv_header_sys_soundcard, [
5713             AC_TRY_LINK([
5714                     #include <sys/ioctl.h>
5715                     #include <sys/soundcard.h>
5716                 ],
5717                 [
5718                     ioctl(0, SNDCTL_DSP_SPEED, 0);
5719                 ],
5720                 ac_cv_header_sys_soundcard=yes,
5721                 [
5722                     saveLibs="$LIBS"
5723                     LIBS="$saveLibs -lossaudio"
5724                     AC_TRY_LINK([
5725                             #include <sys/ioctl.h>
5726                             #include <sys/soundcard.h>
5727                         ],
5728                         [
5729                             ioctl(0, SNDCTL_DSP_SPEED, 0);
5730                         ],
5731                         ac_cv_header_sys_soundcard=yes,
5732                         [
5733                             LIBS="$saveLibs"
5734                             ac_cv_header_sys_soundcard=no
5735                         ]
5736                     )
5737                 ]
5738             )
5739         ])
5740     fi
5741
5742     if test "$ac_cv_header_sys_soundcard" = "yes"; then
5743         AC_DEFINE(HAVE_SYS_SOUNDCARD_H)
5744     fi
5745 fi
5746
5747 WITH_PLUGIN_SDL=0
5748 if test "$wxUSE_SOUND" = "yes"; then
5749   if test "$USE_UNIX" = 1 ; then
5750     if test "$wxUSE_LIBSDL" != "no"; then
5751       AM_PATH_SDL([1.2.0],
5752                   [
5753                     EXTRALIBS_SDL="$SDL_LIBS"
5754                     CFLAGS="$SDL_CFLAGS $CFLAGS"
5755                     CXXFLAGS="$SDL_CFLAGS $CXXFLAGS"
5756                     AC_DEFINE(wxUSE_LIBSDL)
5757                   ],
5758                   [wxUSE_LIBSDL="no"])
5759       if test "$wxUSE_LIBSDL" = "yes" -a "$wxUSE_PLUGINS" = "yes" ; then
5760         WITH_PLUGIN_SDL=1
5761       fi
5762     fi
5763   else
5764     dnl wxMGL doesn't support sound under DOS, only under Unix
5765     if test "$wxUSE_MGL" = 1; then
5766         AC_MSG_WARN([wxSound not supported in MGL under DOS... disabled])
5767         wxUSE_SOUND="no"
5768     fi
5769   fi
5770 fi
5771
5772 if test "$wxUSE_SOUND" = "yes"; then
5773   AC_DEFINE(wxUSE_SOUND)
5774   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS sound"
5775 fi
5776
5777 if test "$WXGTK2" = 1; then
5778     PKG_PROG_PKG_CONFIG()
5779
5780     if test "$wxUSE_PRINTING_ARCHITECTURE" = "yes" ; then
5781
5782         if test "$wxUSE_GTKPRINT" = "yes" ; then
5783
5784                 PKG_CHECK_MODULES(GTKPRINT,
5785                                   [gtk+-unix-print-2.0 >= 2.10],
5786                     [
5787                         CFLAGS="$GTKPRINT_CFLAGS $CFLAGS"
5788                         CXXFLAGS="$GTKPRINT_CFLAGS $CXXFLAGS"
5789                         AC_DEFINE(wxUSE_GTKPRINT)
5790                     ],
5791                     [
5792                         AC_MSG_WARN([GTK printing support not found (GTK+ >= 2.10), library will use GNOME printing support or standard PostScript printing])
5793                         wxUSE_GTKPRINT="no"
5794                     ]
5795                 )
5796         fi
5797
5798         if test "$wxUSE_LIBGNOMEPRINT" = "yes" ; then
5799
5800                 PKG_CHECK_MODULES(LIBGNOMEPRINTUI,
5801                                   [libgnomeprintui-2.2 >= 2.8],
5802                     [
5803                         CFLAGS="$LIBGNOMEPRINTUI_CFLAGS $CFLAGS"
5804                         CXXFLAGS="$LIBGNOMEPRINTUI_CFLAGS $CXXFLAGS"
5805                         AC_DEFINE(wxUSE_LIBGNOMEPRINT)
5806                     ],
5807                     [
5808                         AC_MSG_WARN([libgnomeprintui not found, library will use standard PostScript printing])
5809                         wxUSE_LIBGNOMEPRINT="no"
5810                     ]
5811                 )
5812         fi
5813     fi
5814
5815     if test "$wxUSE_MIMETYPE" = "yes" ; then
5816         if test "$wxUSE_LIBGNOMEVFS" = "yes" ; then
5817
5818                 PKG_CHECK_MODULES(GNOMEVFS,
5819                                   [gnome-vfs-2.0 >= 2.0],
5820                     [
5821                         CFLAGS="$GNOMEVFS_CFLAGS $CFLAGS"
5822                         CXXFLAGS="$GNOMEVFS_CFLAGS $CXXFLAGS"
5823                         AC_DEFINE(wxUSE_LIBGNOMEVFS)
5824                     ],
5825                     [
5826                         AC_MSG_WARN([libgnomevfs not found, library won't be able to associate MIME type])
5827                         wxUSE_LIBGNOMEVFS="no"
5828                     ]
5829                 )
5830         fi
5831     fi
5832
5833     if test "$wxUSE_LIBHILDON" = "yes" ; then
5834         PKG_CHECK_MODULES(HILDON,
5835                           [hildon-lgpl >= 0.9],
5836             [
5837                 EXTRALIBS_HILDON="$HILDON_LIBS"
5838                 CFLAGS="$CFLAGS $HILDON_CFLAGS"
5839                 CXXFLAGS="$CXXFLAGS $HILDON_CFLAGS"
5840                 AC_DEFINE(wxUSE_LIBHILDON)
5841                 ac_hildon_lgpl=1
5842             ],
5843             [
5844                 AC_MSG_WARN([libhildon_lgpl not found])
5845                         wxUSE_LIBHILDON="no"
5846                         ac_hildon_lgpl=0
5847             ]
5848         )
5849
5850         if test "$ac_hildon_lgpl" = 0 ; then
5851             PKG_CHECK_MODULES(HILDON2,
5852                               [hildon-1 >= 1.99],
5853                 [
5854                     EXTRALIBS_HILDON="$HILDON2_LIBS"
5855                     CFLAGS="$CFLAGS $HILDON2_CFLAGS"
5856                     CXXFLAGS="$CXXFLAGS $HILDON2_CFLAGS"
5857                     AC_DEFINE(wxUSE_LIBHILDON2)
5858                 ],
5859                 [
5860                     AC_MSG_WARN([libhildon_1 not found])
5861                             wxUSE_LIBHILDON2="no"
5862                 ]
5863             )
5864         fi
5865     fi
5866 fi
5867
5868 if test "$wxUSE_CMDLINE_PARSER" = "yes"; then
5869   AC_DEFINE(wxUSE_CMDLINE_PARSER)
5870 fi
5871
5872 if test "$wxUSE_STOPWATCH" = "yes"; then
5873   AC_DEFINE(wxUSE_STOPWATCH)
5874 fi
5875
5876 if test "$wxUSE_DATETIME" = "yes"; then
5877   AC_DEFINE(wxUSE_DATETIME)
5878 fi
5879
5880 if test "$wxUSE_FILE" = "yes"; then
5881   AC_DEFINE(wxUSE_FILE)
5882 fi
5883
5884 if test "$wxUSE_FFILE" = "yes"; then
5885   AC_DEFINE(wxUSE_FFILE)
5886 fi
5887
5888 if test "$wxUSE_ARCHIVE_STREAMS" = "yes"; then
5889   if test "$wxUSE_STREAMS" != yes; then
5890     AC_MSG_WARN(wxArchive requires wxStreams... disabled)
5891     wxUSE_ARCHIVE_STREAMS=no
5892   else
5893     AC_DEFINE(wxUSE_ARCHIVE_STREAMS)
5894   fi
5895 fi
5896
5897 if test "$wxUSE_ZIPSTREAM" = "yes"; then
5898   if test "$wxUSE_ARCHIVE_STREAMS" != "yes"; then
5899     AC_MSG_WARN(wxZip requires wxArchive... disabled)
5900   elif test "$wxUSE_ZLIB" = "no"; then
5901     AC_MSG_WARN(wxZip requires wxZlib... disabled)
5902   else
5903     AC_DEFINE(wxUSE_ZIPSTREAM)
5904   fi
5905 fi
5906
5907 if test "$wxUSE_TARSTREAM" = "yes"; then
5908   if test "$wxUSE_ARCHIVE_STREAMS" != "yes"; then
5909     AC_MSG_WARN(wxTar requires wxArchive... disabled)
5910   else
5911     AC_DEFINE(wxUSE_TARSTREAM)
5912   fi
5913 fi
5914
5915 if test "$wxUSE_FILE_HISTORY" = "yes"; then
5916   AC_DEFINE(wxUSE_FILE_HISTORY)
5917 fi
5918
5919 if test "$wxUSE_FILESYSTEM" = "yes"; then
5920   if test "$wxUSE_STREAMS" != yes -o \( "$wxUSE_FILE" != yes -a "$wxUSE_FFILE" != yes \); then
5921     AC_MSG_WARN(wxFileSystem requires wxStreams and wxFile or wxFFile... disabled)
5922     wxUSE_FILESYSTEM=no
5923   else
5924     AC_DEFINE(wxUSE_FILESYSTEM)
5925   fi
5926 fi
5927
5928 if test "$wxUSE_FS_ARCHIVE" = "yes"; then
5929   if test "$wxUSE_FILESYSTEM" != yes -o "$wxUSE_ARCHIVE_STREAMS" != yes; then
5930     AC_MSG_WARN(wxArchiveFSHandler requires wxArchive and wxFileSystem... disabled)
5931   else
5932     AC_DEFINE(wxUSE_FS_ARCHIVE)
5933   fi
5934 fi
5935
5936 if test "$wxUSE_FS_ZIP" = "yes"; then
5937   if test "$wxUSE_FS_ARCHIVE" != yes; then
5938     AC_MSG_WARN(wxZipFSHandler requires wxArchiveFSHandler... disabled)
5939   else
5940     AC_DEFINE(wxUSE_FS_ZIP)
5941   fi
5942 fi
5943
5944 if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes"; then
5945   if test "$USE_UNIX" != 1; then
5946     AC_MSG_WARN([Catching fatal exceptions not currently supported on this system, wxApp::OnFatalException will not be called])
5947     wxUSE_ON_FATAL_EXCEPTION=no
5948   else
5949     AC_DEFINE(wxUSE_ON_FATAL_EXCEPTION)
5950   fi
5951 fi
5952
5953 if test "$wxUSE_STACKWALKER" = "yes"; then
5954     AC_DEFINE(wxUSE_STACKWALKER)
5955 fi
5956
5957 if test "$wxUSE_DEBUGREPORT" = "yes"; then
5958     if test "$USE_UNIX" != 1 -a "$USE_WIN32" != 1; then
5959         AC_MSG_WARN([Creating debug reports not currently supported on this system, disabled])
5960         wxUSE_DEBUGREPORT=no
5961     else
5962         AC_DEFINE(wxUSE_DEBUGREPORT)
5963         if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes"; then
5964             SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS debugrpt"
5965         fi
5966     fi
5967 fi
5968
5969 if test "$wxUSE_SNGLINST_CHECKER" = "yes"; then
5970   AC_DEFINE(wxUSE_SNGLINST_CHECKER)
5971 fi
5972
5973 if test "$wxUSE_BUSYINFO" = "yes"; then
5974   AC_DEFINE(wxUSE_BUSYINFO)
5975 fi
5976
5977 if test "$wxUSE_STD_CONTAINERS" = "yes"; then
5978   AC_DEFINE(wxUSE_STD_CONTAINERS)
5979 fi
5980
5981 if test "$wxUSE_STD_IOSTREAM" = "yes"; then
5982   AC_DEFINE(wxUSE_STD_IOSTREAM)
5983 fi
5984
5985 if test "$wxUSE_STD_STRING" = "yes"; then
5986   AC_DEFINE(wxUSE_STD_STRING)
5987 fi
5988
5989 if test "$wxUSE_STD_STRING_CONV_IN_WXSTRING" = "yes"; then
5990   AC_DEFINE(wxUSE_STD_STRING_CONV_IN_WXSTRING)
5991 fi
5992
5993 if test "$wxUSE_STDPATHS" = "yes"; then
5994   AC_DEFINE(wxUSE_STDPATHS)
5995 fi
5996
5997 if test "$wxUSE_TEXTBUFFER" = "yes"; then
5998     AC_DEFINE(wxUSE_TEXTBUFFER)
5999 fi
6000
6001 if test "$wxUSE_TEXTFILE" = "yes"; then
6002   if test "$wxUSE_FILE" != "yes" -o "$wxUSE_TEXTBUFFER" != "yes" ; then
6003     AC_MSG_WARN(wxTextFile requires wxFile and wxTextBuffer... disabled)
6004   else
6005     AC_DEFINE(wxUSE_TEXTFILE)
6006   fi
6007 fi
6008
6009 if test "$wxUSE_CONFIG" = "yes" ; then
6010   if test "$wxUSE_TEXTFILE" != "yes"; then
6011     AC_MSG_WARN(wxConfig requires wxTextFile... disabled)
6012   else
6013     AC_DEFINE(wxUSE_CONFIG)
6014     AC_DEFINE(wxUSE_CONFIG_NATIVE)
6015     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS config"
6016   fi
6017 fi
6018
6019 if test "$wxUSE_INTL" = "yes" ; then
6020   if test "$wxUSE_FILE" != "yes"; then
6021     AC_MSG_WARN(I18n code requires wxFile... disabled)
6022   else
6023     AC_DEFINE(wxUSE_INTL)
6024     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS internat"
6025     GUIDIST="$GUIDIST INTL_DIST"
6026   fi
6027 fi
6028
6029 if test "$wxUSE_XLOCALE" = "yes" ; then
6030     AC_DEFINE(wxUSE_XLOCALE)
6031     AC_CHECK_TYPES(locale_t,,,
6032                    [#include <xlocale.h>
6033                     #include <locale.h>])
6034 fi
6035
6036 if test "$wxUSE_LOG" = "yes"; then
6037   AC_DEFINE(wxUSE_LOG)
6038
6039     if test "$wxUSE_LOGGUI" = "yes"; then
6040       AC_DEFINE(wxUSE_LOGGUI)
6041     fi
6042
6043     if test "$wxUSE_LOGWINDOW" = "yes"; then
6044       AC_DEFINE(wxUSE_LOGWINDOW)
6045     fi
6046
6047     if test "$wxUSE_LOGDIALOG" = "yes"; then
6048       AC_DEFINE(wxUSE_LOG_DIALOG)
6049     fi
6050
6051     dnl the keyboard sample requires wxUSE_LOG
6052     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS keyboard"
6053 fi
6054
6055 if test "$wxUSE_LONGLONG" = "yes"; then
6056   AC_DEFINE(wxUSE_LONGLONG)
6057 fi
6058
6059 if test "$wxUSE_GEOMETRY" = "yes"; then
6060   AC_DEFINE(wxUSE_GEOMETRY)
6061 fi
6062
6063 if test "$wxUSE_BASE64" = "yes"; then
6064   AC_DEFINE(wxUSE_BASE64)
6065 fi
6066
6067 if test "$wxUSE_STREAMS" = "yes" ; then
6068   AC_DEFINE(wxUSE_STREAMS)
6069 fi
6070
6071 if test "$wxUSE_PRINTF_POS_PARAMS" = "yes"; then
6072   AC_DEFINE(wxUSE_PRINTF_POS_PARAMS)
6073 fi
6074
6075 if test "$wxUSE_OBJC_UNIQUIFYING" = "yes"; then
6076   AC_DEFINE(wxUSE_OBJC_UNIQUIFYING)
6077 fi
6078
6079 dnl ---------------------------------------------------------------------------
6080 dnl console event loop stuff
6081 dnl ---------------------------------------------------------------------------
6082
6083 if test "$wxUSE_CONSOLE_EVENTLOOP" = "yes"; then
6084     AC_DEFINE(wxUSE_CONSOLE_EVENTLOOP)
6085
6086     if test "$wxUSE_UNIX" = "yes"; then
6087         if test "$wxUSE_SELECT_DISPATCHER" = "yes"; then
6088             AC_DEFINE(wxUSE_SELECT_DISPATCHER)
6089         fi
6090
6091         if test "$wxUSE_EPOLL_DISPATCHER" = "yes"; then
6092             AC_CHECK_HEADERS(sys/epoll.h,,, [AC_INCLUDES_DEFAULT()])
6093             if test "$ac_cv_header_sys_epoll_h" = "yes"; then
6094                 AC_DEFINE(wxUSE_EPOLL_DISPATCHER)
6095             else
6096                 AC_MSG_WARN([sys/epoll.h not available, wxEpollDispatcher disabled])
6097             fi
6098         fi
6099     fi
6100 fi
6101
6102 dnl ---------------------------------------------------------------------------
6103 dnl time/date functions
6104 dnl ---------------------------------------------------------------------------
6105
6106 dnl check for gettimeofday (SVr4, BSD 4.3) and ftime (V7, BSD 4.3) for the
6107 dnl function to be used for high resolution timers
6108 AC_CHECK_FUNCS(gettimeofday ftime, break)
6109
6110 if test "$ac_cv_func_gettimeofday" = "yes"; then
6111     AC_CACHE_CHECK([whether gettimeofday takes two arguments],
6112                    wx_cv_func_gettimeofday_has_2_args,
6113     [
6114         dnl on some _really_ old systems it takes only 1 argument
6115         AC_TRY_COMPILE(
6116             [
6117                 #include <sys/time.h>
6118                 #include <unistd.h>
6119             ],
6120             [
6121                 struct timeval tv;
6122                 gettimeofday(&tv, NULL);
6123             ],
6124             wx_cv_func_gettimeofday_has_2_args=yes,
6125             AC_TRY_COMPILE(
6126                 [
6127                     #include <sys/time.h>
6128                     #include <unistd.h>
6129                 ],
6130                 [
6131                     struct timeval tv;
6132                     gettimeofday(&tv);
6133                 ],
6134                 wx_cv_func_gettimeofday_has_2_args=no,
6135                 [
6136                     AC_MSG_WARN([failed to determine number of gettimeofday() arguments])
6137                     wx_cv_func_gettimeofday_has_2_args=unknown
6138                 ]
6139             )
6140         )
6141     ])
6142
6143     if test "$wx_cv_func_gettimeofday_has_2_args" != "yes"; then
6144         AC_DEFINE(WX_GETTIMEOFDAY_NO_TZ)
6145     fi
6146 fi
6147
6148 if test "$wxUSE_DATETIME" = "yes"; then
6149     dnl check for timezone variable
6150     dnl   doesn't exist under Darwin / Mac OS X which uses tm_gmtoff instead
6151     AC_CACHE_CHECK(for timezone variable in <time.h>,
6152                    wx_cv_var_timezone,
6153                    [
6154                         AC_LANG_PUSH(C++)
6155                         AC_TRY_COMPILE(
6156                             [
6157                                 #include <time.h>
6158                             ],
6159                             [
6160                                 int tz;
6161                                 tz = timezone;
6162                             ],
6163                             [
6164                                 wx_cv_var_timezone=timezone
6165                             ],
6166                             [
6167                                 AC_TRY_COMPILE(
6168                                     [
6169                                         #include <time.h>
6170                                     ],
6171                                     [
6172                                         int tz;
6173                                         tz = _timezone;
6174                                     ],
6175                                     [
6176                                         wx_cv_var_timezone=_timezone
6177                                     ],
6178                                     [
6179                                         AC_TRY_COMPILE(
6180                                             [
6181                                                 #include <time.h>
6182                                             ],
6183                                             [
6184                                                 int tz;
6185                                                 tz = __timezone;
6186                                             ],
6187                                             [
6188                                                 wx_cv_var_timezone=__timezone
6189                                             ],
6190                                             [
6191                                                 if test "$USE_DOS" = 0 ; then
6192                                                     AC_MSG_WARN(no timezone variable, will use tm_gmtoff instead)
6193                                                 fi
6194                                             ]
6195                                         )
6196                                     ]
6197                                 )
6198                             ]
6199                         )
6200                         AC_LANG_POP()
6201                    ]
6202     )
6203
6204     dnl as we want $wx_cv_var_timezone to be expanded, use AC_DEFINE_UNQUOTED
6205     if test "x$wx_cv_var_timezone" != x ; then
6206         AC_DEFINE_UNQUOTED(WX_TIMEZONE, $wx_cv_var_timezone)
6207     fi
6208
6209     dnl check for localtime (it's POSIX, but the check can do no harm...)
6210     AC_CHECK_FUNCS(localtime)
6211
6212     if test "$ac_cv_func_localtime" = "yes"; then
6213         AC_CACHE_CHECK(for tm_gmtoff in struct tm,
6214                        wx_cv_struct_tm_has_gmtoff,
6215         [
6216             AC_TRY_COMPILE(
6217                 [
6218                     #include <time.h>
6219                 ],
6220                 [
6221                     struct tm tm;
6222                     tm.tm_gmtoff++;
6223                 ],
6224                 [
6225                     wx_cv_struct_tm_has_gmtoff=yes
6226                 ],
6227                 wx_cv_struct_tm_has_gmtoff=no
6228             )
6229         ])
6230     fi
6231
6232     if test "$wx_cv_struct_tm_has_gmtoff" = "yes"; then
6233         AC_DEFINE(WX_GMTOFF_IN_TM)
6234     fi
6235
6236     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS typetest"
6237 fi
6238
6239 dnl ------------------------------------------------------------------------
6240 dnl wxSocket
6241 dnl ------------------------------------------------------------------------
6242
6243 dnl VZ: the GUI hooks wxSocket needs are not implemented yet in some toolkits
6244 if test "$wxUSE_SOCKETS" = "yes"; then
6245     if test "$wxUSE_MGL" = 1; then
6246         AC_MSG_WARN([wxSocket not yet supported under MGL... disabled])
6247         wxUSE_SOCKETS="no"
6248     fi
6249 fi
6250
6251 if test "$wxUSE_SOCKETS" = "yes"; then
6252     dnl under MSW we always have sockets
6253     if test "$TOOLKIT" != "MSW"; then
6254         dnl under Solaris and OS/2, socket functions live in -lsocket
6255         AC_CHECK_FUNC(socket,,
6256             [
6257                 AC_CHECK_LIB(socket, socket,
6258                     if test "$INET_LINK" != " -lsocket"; then
6259                         INET_LINK="$INET_LINK -lsocket"
6260                     fi,
6261                     [
6262                         AC_MSG_WARN([socket library not found - sockets will be disabled])
6263                         wxUSE_SOCKETS=no
6264                     ]
6265                 )
6266             ]
6267         )
6268     fi
6269 fi
6270
6271 if test "$wxUSE_SOCKETS" = "yes" ; then
6272     dnl this test may be appropriate if building under cygwin
6273     dnl right now I'm assuming it also uses the winsock stuff
6274     dnl like mingw does..  -- RL
6275     if test "$TOOLKIT" != "MSW"; then
6276         dnl determine the type of third argument for getsockname
6277         dnl This test needs to be done in C++ mode since gsocket.cpp now
6278         dnl is C++ code and pointer cast that are possible even without
6279         dnl warning in C still fail in C++.
6280         AC_CACHE_CHECK([what is the type of the third argument of getsockname],
6281                        wx_cv_type_getsockname3,
6282             [
6283                 AC_LANG_PUSH(C++)
6284                 AC_TRY_COMPILE(
6285                     [
6286                         #include <sys/types.h>
6287                         #include <sys/socket.h>
6288                     ],
6289                     [
6290                         socklen_t len;
6291                         getsockname(0, 0, &len);
6292                     ],
6293                     wx_cv_type_getsockname3=socklen_t,
6294                     [
6295                         dnl the compiler will compile the version with size_t
6296                         dnl even if the real type of the last parameter is int
6297                         dnl but it should give at least a warning about
6298                         dnl converting between incompatible pointer types, so
6299                         dnl try to use it to get the correct behaviour at
6300                         dnl least with gcc (otherwise we'd always use size_t)
6301                         CFLAGS_OLD="$CFLAGS"
6302                         if test "$GCC" = yes ; then
6303                             CFLAGS="-Werror $CFLAGS"
6304                         fi
6305
6306                         AC_TRY_COMPILE(
6307                             [
6308                                 #include <sys/types.h>
6309                                 #include <sys/socket.h>
6310                             ],
6311                             [
6312                                 size_t len;
6313                                 getsockname(0, 0, &len);
6314                             ],
6315                             wx_cv_type_getsockname3=size_t,
6316                             AC_TRY_COMPILE(
6317                                 [
6318                                     #include <sys/types.h>
6319                                     #include <sys/socket.h>
6320                                 ],
6321                                 [
6322                                     int len;
6323                                     getsockname(0, 0, &len);
6324                                 ],
6325                                 wx_cv_type_getsockname3=int,
6326                                 wx_cv_type_getsockname3=unknown
6327                             )
6328                         )
6329
6330                         CFLAGS="$CFLAGS_OLD"
6331                     ]
6332                 )
6333                 AC_LANG_POP()
6334             ])
6335
6336         if test "$wx_cv_type_getsockname3" = "unknown"; then
6337             wxUSE_SOCKETS=no
6338             AC_MSG_WARN([Couldn't find socklen_t synonym for this system])
6339         else
6340             AC_DEFINE_UNQUOTED(WX_SOCKLEN_T, $wx_cv_type_getsockname3)
6341         fi
6342         dnl Do this again for getsockopt as it may be different
6343         AC_CACHE_CHECK([what is the type of the fifth argument of getsockopt],
6344                        wx_cv_type_getsockopt5,
6345             [
6346                 dnl Note that the rules for compatibility of pointers
6347                 dnl are somewhat different between C and C++, so code
6348                 dnl that fails in C++ may not even give a warning about
6349                 dnl converting between incompatible pointer types in C.
6350                 dnl So this test needs to be done in C++ mode.
6351                 AC_LANG_PUSH(C++)
6352                 AC_TRY_COMPILE(
6353                     [
6354                         #include <sys/types.h>
6355                         #include <sys/socket.h>
6356                     ],
6357                     [
6358                         socklen_t len;
6359                         getsockopt(0, 0, 0, 0, &len);
6360                     ],
6361                     wx_cv_type_getsockopt5=socklen_t,
6362                     [
6363                         AC_TRY_COMPILE(
6364                             [
6365                                 #include <sys/types.h>
6366                                 #include <sys/socket.h>
6367                             ],
6368                             [
6369                                 size_t len;
6370                                 getsockopt(0, 0, 0, 0, &len);
6371                             ],
6372                             wx_cv_type_getsockopt5=size_t,
6373                             AC_TRY_COMPILE(
6374                                 [
6375                                     #include <sys/types.h>
6376                                     #include <sys/socket.h>
6377                                 ],
6378                                 [
6379                                     int len;
6380                                     getsockopt(0, 0, 0, 0, &len);
6381                                 ],
6382                                 wx_cv_type_getsockopt5=int,
6383                                 wx_cv_type_getsockopt5=unknown
6384                             )
6385                         )
6386                     ]
6387                 )
6388                 AC_LANG_POP()
6389             ])
6390
6391         if test "$wx_cv_type_getsockopt5" = "unknown"; then
6392             wxUSE_SOCKETS=no
6393             AC_MSG_WARN([Couldn't find socklen_t synonym for this system])
6394         else
6395             AC_DEFINE_UNQUOTED(SOCKOPTLEN_T, $wx_cv_type_getsockopt5)
6396         fi
6397     fi
6398 fi
6399
6400 if test "$wxUSE_SOCKETS" = "yes" ; then
6401     if test "$wxUSE_IPV6" = "yes"; then
6402         AC_CACHE_CHECK(
6403             [whether we have sockaddr_in6],
6404             [wx_cv_type_sockaddr_in6],
6405             [
6406                 AC_TRY_COMPILE(
6407                     [
6408                         #include <sys/types.h>
6409                         #include <sys/socket.h>
6410                         #include <netinet/in.h>
6411                     ],
6412                     [
6413                         struct sockaddr_in6 sa6;
6414                     ],
6415                     wx_cv_type_sockaddr_in6=yes,
6416                     wx_cv_type_sockaddr_in6=no
6417                 )
6418             ]
6419         )
6420
6421         if test "$wx_cv_type_sockaddr_in6"="yes"; then
6422             AC_DEFINE(wxUSE_IPV6)
6423         else
6424             AC_MSG_WARN([IPv6 support not available... disabled])
6425         fi
6426     fi
6427
6428     AC_DEFINE(wxUSE_SOCKETS)
6429     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS sockets"
6430 fi
6431
6432 if test "$wxUSE_PROTOCOL" = "yes"; then
6433     if test "$wxUSE_SOCKETS" != "yes"; then
6434         AC_MSG_WARN(Protocol classes require sockets... disabled)
6435         wxUSE_PROTOCOL=no
6436     fi
6437 fi
6438
6439 if test "$wxUSE_PROTOCOL" = "yes"; then
6440     AC_DEFINE(wxUSE_PROTOCOL)
6441
6442     if test "$wxUSE_PROTOCOL_HTTP" = "yes"; then
6443         AC_DEFINE(wxUSE_PROTOCOL_HTTP)
6444     fi
6445     if test "$wxUSE_PROTOCOL_FTP" = "yes"; then
6446         AC_DEFINE(wxUSE_PROTOCOL_FTP)
6447     fi
6448     if test "$wxUSE_PROTOCOL_FILE" = "yes"; then
6449         AC_DEFINE(wxUSE_PROTOCOL_FILE)
6450     fi
6451 else
6452     if test "$wxUSE_FS_INET" = "yes"; then
6453         AC_MSG_WARN([HTTP filesystem require protocol classes... disabled])
6454         wxUSE_FS_INET="no"
6455     fi
6456 fi
6457
6458 if test "$wxUSE_URL" = "yes"; then
6459     if test "$wxUSE_PROTOCOL" != "yes"; then
6460         AC_MSG_WARN(wxURL class requires wxProtocol... disabled)
6461         wxUSE_URL=no
6462     fi
6463     if test "$wxUSE_URL" = "yes"; then
6464         AC_DEFINE(wxUSE_URL)
6465     fi
6466 fi
6467
6468 if test "$wxUSE_VARIANT" = "yes"; then
6469     AC_DEFINE(wxUSE_VARIANT)
6470 fi
6471
6472 if test "$wxUSE_FS_INET" = "yes"; then
6473   AC_DEFINE(wxUSE_FS_INET)
6474 fi
6475
6476 dnl ---------------------------------------------------------------------------
6477 dnl Joystick support
6478 dnl ---------------------------------------------------------------------------
6479
6480 if test "$wxUSE_GUI" = "yes" -a "$wxUSE_JOYSTICK" = "yes"; then
6481     wxUSE_JOYSTICK=no
6482
6483     dnl under MSW we always have joystick support
6484     if test "$TOOLKIT" = "MSW"; then
6485         wxUSE_JOYSTICK=yes
6486
6487     dnl mac only available on darwin
6488     elif test "$TOOLKIT" = "OSX" -o "$TOOLKIT" = "COCOA"; then
6489         if test "$USE_DARWIN" = 1; then
6490             dnl check for a bug in the headers, some have bad setEventCallout
6491             AC_MSG_CHECKING([headers have declarations needed for joystick support])
6492             AC_LANG_PUSH(C++)
6493             AC_TRY_COMPILE( [ #include <IOKit/hid/IOHIDLib.h> ],
6494                             [ IOHIDQueueInterface *qi = NULL;
6495                               IOHIDCallbackFunction cb = NULL;
6496                               qi->setEventCallout(NULL, cb, NULL, NULL); ],
6497                             [ wxUSE_JOYSTICK=yes ]
6498                           )
6499             AC_LANG_POP()
6500             AC_MSG_RESULT($wxUSE_JOYSTICK)
6501         fi
6502
6503     dnl joystick support is only for Linux 2.1.x or greater
6504     else
6505         dnl wxJoystick not supported by wxMGL at all
6506         if test "$wxUSE_MGL" != 1; then
6507             dnl notice the dummy includes argument: without it, AC_CHECK_HEADER
6508             dnl checks only whether the header can be preprocessed, not that it
6509             dnl can be compiled and in Linux 2.6.16 joystick.h is present but
6510             dnl can't be compiled because of an error and with the default
6511             dnl AC_CHECK_HEADER semantics we'd still detect it in this case and
6512             dnl build would fail later
6513             AC_CHECK_HEADERS([linux/joystick.h], [wxUSE_JOYSTICK=yes],, [AC_INCLUDES_DEFAULT()])
6514         fi
6515     fi
6516
6517     if test "$wxUSE_JOYSTICK" = "yes"; then
6518         AC_DEFINE(wxUSE_JOYSTICK)
6519         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS joytest"
6520     else
6521         AC_MSG_WARN(Joystick not supported by this system... disabled)
6522     fi
6523 fi
6524
6525
6526 dnl ---------------------------------------------------------------------------
6527 dnl String stuff
6528 dnl ---------------------------------------------------------------------------
6529
6530 if test "$wxUSE_FONTENUM" = "yes" ; then
6531   AC_DEFINE(wxUSE_FONTENUM)
6532 fi
6533
6534 if test "$wxUSE_FONTMAP" = "yes" ; then
6535   AC_DEFINE(wxUSE_FONTMAP)
6536 fi
6537
6538 if test "$wxUSE_UNICODE" = "yes" ; then
6539   AC_DEFINE(wxUSE_UNICODE)
6540
6541   if test "$USE_WIN32" != 1; then
6542       wxUSE_UNICODE_MSLU=no
6543   fi
6544
6545   if test "$USE_WIN32" = 1 -a "$wxUSE_UNICODE_MSLU" = "yes"; then
6546         AC_CHECK_LIB(unicows,main,
6547             [
6548                 AC_DEFINE(wxUSE_UNICODE_MSLU)
6549             ],
6550             [
6551                 AC_MSG_WARN([Compiler doesn't support MSLU (libunicows.a), disabled.
6552                              Applications will only run on Windows NT/2000/XP!])
6553                 wxUSE_UNICODE_MSLU=no
6554             ])
6555     fi
6556 fi
6557
6558 if test "$wxUSE_UNICODE" = "yes" -a "$wxUSE_UNICODE_UTF8" = "yes"; then
6559     AC_DEFINE(wxUSE_UNICODE_UTF8)
6560
6561     if test "$wxUSE_UNICODE_UTF8_LOCALE" = "yes"; then
6562         AC_DEFINE(wxUSE_UTF8_LOCALE_ONLY)
6563     fi
6564 fi
6565
6566 dnl ---------------------------------------------------------------------------
6567 dnl big GUI components: MDI, doc/view, printing, help, ...
6568 dnl ---------------------------------------------------------------------------
6569
6570 if test "$wxUSE_CONSTRAINTS" = "yes"; then
6571     AC_DEFINE(wxUSE_CONSTRAINTS)
6572     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS layout"
6573 fi
6574
6575 if test "$wxUSE_MDI" = "yes"; then
6576     AC_DEFINE(wxUSE_MDI)
6577
6578     if test "$wxUSE_MDI_ARCHITECTURE" = "yes"; then
6579         AC_DEFINE(wxUSE_MDI_ARCHITECTURE)
6580         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS mdi"
6581     fi
6582 fi
6583
6584 if test "$wxUSE_DOC_VIEW_ARCHITECTURE" = "yes" ; then
6585     AC_DEFINE(wxUSE_DOC_VIEW_ARCHITECTURE)
6586     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS docview"
6587 fi
6588
6589 if test "$wxUSE_HELP" = "yes"; then
6590     AC_DEFINE(wxUSE_HELP)
6591     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS help"
6592
6593     if test "$wxUSE_MSW" = 1; then
6594       if test "$wxUSE_MS_HTML_HELP" = "yes"; then
6595         AC_DEFINE(wxUSE_MS_HTML_HELP)
6596       fi
6597     fi
6598
6599     if test "$wxUSE_WXHTML_HELP" = "yes"; then
6600       if test "$wxUSE_HTML" = "yes"; then
6601         AC_DEFINE(wxUSE_WXHTML_HELP)
6602       else
6603         AC_MSG_WARN(Cannot use wxHTML-based help without wxHTML so it won't be compiled)
6604         wxUSE_WXHTML_HELP=no
6605       fi
6606     fi
6607 fi
6608
6609 if test "$wxUSE_PRINTING_ARCHITECTURE" = "yes" ; then
6610     AC_DEFINE(wxUSE_PRINTING_ARCHITECTURE)
6611     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS printing"
6612 fi
6613
6614 if test "$wxUSE_POSTSCRIPT" = "yes" ; then
6615   AC_DEFINE(wxUSE_POSTSCRIPT)
6616 fi
6617
6618 AC_DEFINE(wxUSE_AFM_FOR_POSTSCRIPT)
6619
6620 if test "$wxUSE_SVG" = "yes"; then
6621     AC_DEFINE(wxUSE_SVG)
6622 fi
6623
6624 dnl ---------------------------------------------------------------------------
6625 dnl wxMetafile availability
6626 dnl ---------------------------------------------------------------------------
6627
6628 if test "$wxUSE_METAFILE" = "yes"; then
6629     if test "$wxUSE_MSW" != 1 -a "$wxUSE_MAC" != 1 -a "$wxUSE_PM" != 1; then
6630         AC_MSG_WARN([wxMetafile is not available on this system... disabled])
6631         wxUSE_METAFILE=no
6632     fi
6633 fi
6634
6635 dnl ---------------------------------------------------------------------------
6636 dnl IPC: IPC, Drag'n'Drop, Clipboard, ...
6637 dnl ---------------------------------------------------------------------------
6638
6639 dnl check for ole headers and disable a few features requiring it if not
6640 dnl present (earlier versions of mingw32 don't have ole2.h)
6641 if test "$USE_WIN32" = 1 -a \( "$wxUSE_DATAOBJ"       = "yes" \
6642                           -o "$wxUSE_CLIPBOARD"     = "yes" \
6643                           -o "$wxUSE_OLE"     = "yes" \
6644                           -o "$wxUSE_DRAG_AND_DROP" = "yes" \) ; then
6645     AC_CHECK_HEADER(ole2.h,,, [ ])
6646
6647     if test "$ac_cv_header_ole2_h" = "yes" ; then
6648         if test "$GCC" = yes ; then
6649             AC_MSG_CHECKING([if g++ requires -fvtable-thunks])
6650             AC_TRY_COMPILE([#include <windows.h>
6651                             #include <ole2.h>],
6652                            [],
6653                            [AC_MSG_RESULT(no)],
6654                            [AC_MSG_RESULT(yes)
6655                             WXCONFIG_CXXFLAGS="$WXCONFIG_CXXFLAGS -fvtable-thunks"])
6656             LIBS=" -lrpcrt4 -loleaut32 -lole32 -luuid$LIBS"
6657             if test "$wxUSE_OLE" = "yes" ; then
6658                 AC_DEFINE(wxUSE_OLE)
6659                 AC_DEFINE(wxUSE_OLE_AUTOMATION)
6660                 AC_DEFINE(wxUSE_ACTIVEX)
6661                 SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS oleauto"
6662             fi
6663         fi
6664
6665         dnl for OLE clipboard and dnd
6666         if test "$wxUSE_DATAOBJ" = "yes" ; then
6667             AC_DEFINE(wxUSE_DATAOBJ)
6668         fi
6669     else
6670         AC_MSG_WARN([Some features disabled because OLE headers not found])
6671
6672         wxUSE_CLIPBOARD=no
6673         wxUSE_DRAG_AND_DROP=no
6674         wxUSE_DATAOBJ=no
6675         wxUSE_OLE=no
6676     fi
6677
6678     if test "$wxUSE_METAFILE" = "yes"; then
6679         AC_DEFINE(wxUSE_METAFILE)
6680
6681         dnl this one should probably be made separately configurable
6682         AC_DEFINE(wxUSE_ENH_METAFILE)
6683     fi
6684 fi
6685
6686 if test "$wxUSE_IPC" = "yes"; then
6687     if test "$wxUSE_SOCKETS" != "yes" -a "$USE_WIN32" != 1; then
6688         AC_MSG_WARN(wxWidgets IPC classes require sockets... disabled)
6689         wxUSE_IPC=no
6690     fi
6691
6692     if test "$wxUSE_IPC" = "yes"; then
6693         AC_DEFINE(wxUSE_IPC)
6694         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS ipc"
6695     fi
6696 fi
6697
6698 if test "$wxUSE_DATAOBJ" = "yes"; then
6699     if test "$wxUSE_MGL" = 1 -o "$wxUSE_DFB" = 1; then
6700         AC_MSG_WARN([wxDataObject not yet supported under $TOOLKIT... disabled])
6701         wxUSE_DATAOBJ=no
6702     else
6703         AC_DEFINE(wxUSE_DATAOBJ)
6704     fi
6705 else
6706     AC_MSG_WARN([Clipboard and drag-and-drop require wxDataObject -- disabled])
6707     wxUSE_CLIPBOARD=no
6708     wxUSE_DRAG_AND_DROP=no
6709 fi
6710
6711 if test "$wxUSE_CLIPBOARD" = "yes"; then
6712     if test "$wxUSE_MGL" = 1 -o "$wxUSE_DFB" = 1; then
6713         AC_MSG_WARN([Clipboard not yet supported under $TOOLKIT... disabled])
6714         wxUSE_CLIPBOARD=no
6715     fi
6716
6717     if test "$wxUSE_CLIPBOARD" = "yes"; then
6718         AC_DEFINE(wxUSE_CLIPBOARD)
6719     fi
6720 fi
6721
6722 if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then
6723     if test "$wxUSE_GTK" = 1; then
6724         if test "$WXGTK12" != 1; then
6725             AC_MSG_WARN([Drag and drop is only supported under GTK+ 1.2... disabled])
6726             wxUSE_DRAG_AND_DROP=no
6727         fi
6728     fi
6729
6730     if test "$wxUSE_MOTIF" = 1 -o "$wxUSE_X11" = 1 -o "$wxUSE_MGL" = 1 -o \
6731             "$wxUSE_DFB" = 1; then
6732         AC_MSG_WARN([Drag and drop not yet supported under $TOOLKIT... disabled])
6733         wxUSE_DRAG_AND_DROP=no
6734     fi
6735
6736     if test "$wxUSE_DRAG_AND_DROP" = "yes"; then
6737         AC_DEFINE(wxUSE_DRAG_AND_DROP)
6738     fi
6739
6740 fi
6741
6742 if test "$wxUSE_DRAG_AND_DROP" = "yes" -o "$wxUSE_CLIPBOARD" = "yes"; then
6743     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dnd"
6744 fi
6745
6746 if test "$wxUSE_CLIPBOARD" = "yes"; then
6747     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS clipboard"
6748 fi
6749
6750 if test "$wxUSE_SPLINES" = "yes" ; then
6751   AC_DEFINE(wxUSE_SPLINES)
6752 fi
6753
6754 if test "$wxUSE_MOUSEWHEEL" = "yes" ; then
6755   AC_DEFINE(wxUSE_MOUSEWHEEL)
6756 fi
6757
6758 if test "$wxUSE_UIACTIONSIMULATOR" = "yes" ; then
6759     AC_DEFINE(wxUSE_UIACTIONSIMULATOR)
6760     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS uiaction"
6761 fi
6762
6763 if test "$wxUSE_DC_TRANSFORM_MATRIX" = "yes" ; then
6764     AC_DEFINE(wxUSE_DC_TRANSFORM_MATRIX)
6765 fi
6766
6767 dnl ---------------------------------------------------------------------------
6768 dnl GUI controls
6769 dnl ---------------------------------------------------------------------------
6770
6771 USES_CONTROLS=0
6772 if test "$wxUSE_CONTROLS" = "yes"; then
6773   USES_CONTROLS=1
6774 fi
6775
6776 if test "$wxUSE_MARKUP" = "yes"; then
6777   AC_DEFINE(wxUSE_MARKUP)
6778 fi
6779
6780 if test "$wxUSE_ACCEL" = "yes"; then
6781   AC_DEFINE(wxUSE_ACCEL)
6782   USES_CONTROLS=1
6783 fi
6784
6785 if test "$wxUSE_ANIMATIONCTRL" = "yes"; then
6786   AC_DEFINE(wxUSE_ANIMATIONCTRL)
6787   USES_CONTROLS=1
6788   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS animate"
6789 fi
6790
6791 if test "$wxUSE_BUTTON" = "yes"; then
6792   AC_DEFINE(wxUSE_BUTTON)
6793   USES_CONTROLS=1
6794 fi
6795
6796 if test "$wxUSE_BMPBUTTON" = "yes"; then
6797   AC_DEFINE(wxUSE_BMPBUTTON)
6798   USES_CONTROLS=1
6799 fi
6800
6801 if test "$wxUSE_CALCTRL" = "yes"; then
6802   AC_DEFINE(wxUSE_CALENDARCTRL)
6803   USES_CONTROLS=1
6804   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS calendar"
6805 fi
6806
6807 if test "$wxUSE_CARET" = "yes"; then
6808   AC_DEFINE(wxUSE_CARET)
6809   USES_CONTROLS=1
6810   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS caret"
6811 fi
6812
6813 if test "$wxUSE_COLLPANE" = "yes"; then
6814     AC_DEFINE(wxUSE_COLLPANE)
6815     USES_CONTROLS=1
6816     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS collpane"
6817 fi
6818
6819 if test "$wxUSE_COMBOBOX" = "yes"; then
6820   AC_DEFINE(wxUSE_COMBOBOX)
6821   USES_CONTROLS=1
6822 fi
6823
6824 if test "$wxUSE_COMBOCTRL" = "yes"; then
6825   AC_DEFINE(wxUSE_COMBOCTRL)
6826   USES_CONTROLS=1
6827 fi
6828
6829 if test "$wxUSE_COMMANDLINKBUTTON" = "yes"; then
6830   AC_DEFINE(wxUSE_COMMANDLINKBUTTON)
6831   USES_CONTROLS=1
6832 fi
6833
6834 if test "$wxUSE_CHOICE" = "yes"; then
6835   AC_DEFINE(wxUSE_CHOICE)
6836   USES_CONTROLS=1
6837 fi
6838
6839 if test "$wxUSE_CHOICEBOOK" = "yes"; then
6840     AC_DEFINE(wxUSE_CHOICEBOOK)
6841     USES_CONTROLS=1
6842 fi
6843
6844 if test "$wxUSE_CHECKBOX" = "yes"; then
6845   AC_DEFINE(wxUSE_CHECKBOX)
6846   USES_CONTROLS=1
6847 fi
6848
6849 if test "$wxUSE_CHECKLST" = "yes"; then
6850   AC_DEFINE(wxUSE_CHECKLISTBOX)
6851   USES_CONTROLS=1
6852 fi
6853
6854 if test "$wxUSE_COLOURPICKERCTRL" = "yes"; then
6855   AC_DEFINE(wxUSE_COLOURPICKERCTRL)
6856   USES_CONTROLS=1
6857 fi
6858
6859 if test "$wxUSE_DATEPICKCTRL" = "yes"; then
6860   AC_DEFINE(wxUSE_DATEPICKCTRL)
6861   USES_CONTROLS=1
6862 fi
6863
6864 if test "$wxUSE_DIRPICKERCTRL" = "yes"; then
6865   AC_DEFINE(wxUSE_DIRPICKERCTRL)
6866   USES_CONTROLS=1
6867 fi
6868
6869 if test "$wxUSE_FILECTRL" = "yes"; then
6870   AC_DEFINE(wxUSE_FILECTRL)
6871   USES_CONTROLS=1
6872 fi
6873
6874 if test "$wxUSE_FILEPICKERCTRL" = "yes"; then
6875   AC_DEFINE(wxUSE_FILEPICKERCTRL)
6876   USES_CONTROLS=1
6877 fi
6878
6879 if test "$wxUSE_FONTPICKERCTRL" = "yes"; then
6880   AC_DEFINE(wxUSE_FONTPICKERCTRL)
6881   USES_CONTROLS=1
6882 fi
6883
6884 if test "$wxUSE_DISPLAY" = "yes"; then
6885     if test "$wxUSE_DFB" = 1 -o "$wxUSE_MGL" = 1; then
6886         AC_MSG_WARN([wxDisplay not yet supported under $TOOLKIT... disabled])
6887         wxUSE_DISPLAY=no
6888     else
6889         AC_DEFINE(wxUSE_DISPLAY)
6890         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS display"
6891     fi
6892 fi
6893
6894 if test "$wxUSE_DETECT_SM" = "yes"; then
6895     AC_DEFINE(wxUSE_DETECT_SM)
6896 fi
6897
6898 if test "$wxUSE_GAUGE" = "yes"; then
6899   AC_DEFINE(wxUSE_GAUGE)
6900   USES_CONTROLS=1
6901 fi
6902
6903 if test "$wxUSE_GRID" = "yes"; then
6904   AC_DEFINE(wxUSE_GRID)
6905   USES_CONTROLS=1
6906   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS grid"
6907 fi
6908
6909 if test "$wxUSE_HEADERCTRL" = "yes"; then
6910   AC_DEFINE(wxUSE_HEADERCTRL)
6911   USES_CONTROLS=1
6912 fi
6913
6914 if test "$wxUSE_HYPERLINKCTRL" = "yes"; then
6915   AC_DEFINE(wxUSE_HYPERLINKCTRL)
6916   USES_CONTROLS=1
6917 fi
6918
6919 if test "$wxUSE_BITMAPCOMBOBOX" = "yes"; then
6920   AC_DEFINE(wxUSE_BITMAPCOMBOBOX)
6921   USES_CONTROLS=1
6922 fi
6923
6924 if test "$wxUSE_DATAVIEWCTRL" = "yes"; then
6925   AC_DEFINE(wxUSE_DATAVIEWCTRL)
6926   USES_CONTROLS=1
6927   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dataview"
6928 fi
6929
6930 if test "$wxUSE_IMAGLIST" = "yes"; then
6931     AC_DEFINE(wxUSE_IMAGLIST)
6932 fi
6933
6934 if test "$wxUSE_INFOBAR" = "yes"; then
6935     AC_DEFINE(wxUSE_INFOBAR)
6936 fi
6937
6938 if test "$wxUSE_LISTBOOK" = "yes"; then
6939     AC_DEFINE(wxUSE_LISTBOOK)
6940     USES_CONTROLS=1
6941 fi
6942
6943 if test "$wxUSE_LISTBOX" = "yes"; then
6944     AC_DEFINE(wxUSE_LISTBOX)
6945     USES_CONTROLS=1
6946 fi
6947
6948 if test "$wxUSE_LISTCTRL" = "yes"; then
6949     if test "$wxUSE_IMAGLIST" = "yes"; then
6950         AC_DEFINE(wxUSE_LISTCTRL)
6951         USES_CONTROLS=1
6952         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS listctrl"
6953     else
6954         AC_MSG_WARN([wxListCtrl requires wxImageList and won't be compiled without it])
6955     fi
6956 fi
6957
6958 if test "$wxUSE_EDITABLELISTBOX" = "yes"; then
6959     AC_DEFINE(wxUSE_EDITABLELISTBOX)
6960     USES_CONTROLS=1
6961 fi
6962
6963 if test "$wxUSE_NOTEBOOK" = "yes"; then
6964     AC_DEFINE(wxUSE_NOTEBOOK)
6965     USES_CONTROLS=1
6966     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS notebook"
6967 fi
6968
6969 if test "$wxUSE_NOTIFICATION_MESSAGE" = "yes"; then
6970     AC_DEFINE(wxUSE_NOTIFICATION_MESSAGE)
6971 fi
6972
6973 if test "$wxUSE_ODCOMBOBOX" = "yes"; then
6974   AC_DEFINE(wxUSE_ODCOMBOBOX)
6975   USES_CONTROLS=1
6976   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS combo"
6977 fi
6978
6979 if test "$wxUSE_RADIOBOX" = "yes"; then
6980     AC_DEFINE(wxUSE_RADIOBOX)
6981     USES_CONTROLS=1
6982 fi
6983
6984 if test "$wxUSE_RADIOBTN" = "yes"; then
6985     AC_DEFINE(wxUSE_RADIOBTN)
6986     USES_CONTROLS=1
6987 fi
6988
6989 if test "$wxUSE_REARRANGECTRL" = "yes"; then
6990     AC_DEFINE(wxUSE_REARRANGECTRL)
6991 fi
6992
6993 if test "$wxUSE_RICHMSGDLG" = "yes"; then
6994     AC_DEFINE(wxUSE_RICHMSGDLG)
6995 fi
6996
6997 if test "$wxUSE_SASH" = "yes"; then
6998     AC_DEFINE(wxUSE_SASH)
6999     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS sashtest"
7000 fi
7001
7002 if test "$wxUSE_SCROLLBAR" = "yes"; then
7003     AC_DEFINE(wxUSE_SCROLLBAR)
7004     USES_CONTROLS=1
7005     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS scroll"
7006 fi
7007
7008 if test "$wxUSE_SEARCHCTRL" = "yes"; then
7009     AC_DEFINE(wxUSE_SEARCHCTRL)
7010     USES_CONTROLS=1
7011 fi
7012
7013 if test "$wxUSE_SLIDER" = "yes"; then
7014     AC_DEFINE(wxUSE_SLIDER)
7015     USES_CONTROLS=1
7016 fi
7017
7018 if test "$wxUSE_SPINBTN" = "yes"; then
7019     AC_DEFINE(wxUSE_SPINBTN)
7020     USES_CONTROLS=1
7021 fi
7022
7023 if test "$wxUSE_SPINCTRL" = "yes"; then
7024     AC_DEFINE(wxUSE_SPINCTRL)
7025     USES_CONTROLS=1
7026 fi
7027
7028 if test "$wxUSE_SPLITTER" = "yes"; then
7029     AC_DEFINE(wxUSE_SPLITTER)
7030     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS splitter"
7031 fi
7032
7033 if test "$wxUSE_STATBMP" = "yes"; then
7034     AC_DEFINE(wxUSE_STATBMP)
7035     USES_CONTROLS=1
7036 fi
7037
7038 if test "$wxUSE_STATBOX" = "yes"; then
7039     AC_DEFINE(wxUSE_STATBOX)
7040     USES_CONTROLS=1
7041 fi
7042
7043 if test "$wxUSE_STATTEXT" = "yes"; then
7044     AC_DEFINE(wxUSE_STATTEXT)
7045     USES_CONTROLS=1
7046 fi
7047
7048 if test "$wxUSE_STATLINE" = "yes"; then
7049     AC_DEFINE(wxUSE_STATLINE)
7050     USES_CONTROLS=1
7051 fi
7052
7053 if test "$wxUSE_STATUSBAR" = "yes"; then
7054     dnl this will get undefined in wx/chkconf.h if it's not supported
7055     AC_DEFINE(wxUSE_NATIVE_STATUSBAR)
7056     AC_DEFINE(wxUSE_STATUSBAR)
7057     USES_CONTROLS=1
7058
7059     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS statbar"
7060 fi
7061
7062 if test "$wxUSE_TEXTCTRL" = "yes"; then
7063     AC_DEFINE(wxUSE_TEXTCTRL)
7064     USES_CONTROLS=1
7065     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS text"
7066
7067     dnl we don't have special switches to disable wxUSE_RICHEDIT[2], it doesn't
7068     dnl seem useful to allow disabling them
7069     AC_DEFINE(wxUSE_RICHEDIT)
7070     AC_DEFINE(wxUSE_RICHEDIT2)
7071 fi
7072
7073 if test "$wxUSE_TOGGLEBTN" = "yes"; then
7074     if test "$wxUSE_OLD_COCOA" = 1 ; then
7075         AC_MSG_WARN([Toggle button not yet supported under Mac OS X... disabled])
7076         wxUSE_TOGGLEBTN=no
7077     fi
7078
7079     if test "$wxUSE_TOGGLEBTN" = "yes"; then
7080         AC_DEFINE(wxUSE_TOGGLEBTN)
7081         USES_CONTROLS=1
7082     fi
7083 fi
7084
7085 if test "$wxUSE_TOOLBAR" = "yes"; then
7086     AC_DEFINE(wxUSE_TOOLBAR)
7087     USES_CONTROLS=1
7088
7089     if test "$wxUSE_UNIVERSAL" = "yes"; then
7090         wxUSE_TOOLBAR_NATIVE="no"
7091     else
7092         wxUSE_TOOLBAR_NATIVE="yes"
7093         AC_DEFINE(wxUSE_TOOLBAR_NATIVE)
7094     fi
7095
7096     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS toolbar"
7097 fi
7098
7099 if test "$wxUSE_TOOLTIPS" = "yes"; then
7100     if test "$wxUSE_MOTIF" = 1; then
7101         AC_MSG_WARN([wxTooltip not supported yet under Motif... disabled])
7102     else
7103         if test "$wxUSE_UNIVERSAL" = "yes"; then
7104             AC_MSG_WARN([wxTooltip not supported yet in wxUniversal... disabled])
7105         else
7106             AC_DEFINE(wxUSE_TOOLTIPS)
7107         fi
7108     fi
7109 fi
7110
7111 if test "$wxUSE_TREEBOOK" = "yes"; then
7112     AC_DEFINE(wxUSE_TREEBOOK)
7113     USES_CONTROLS=1
7114 fi
7115
7116 if test "$wxUSE_TOOLBOOK" = "yes"; then
7117     AC_DEFINE(wxUSE_TOOLBOOK)
7118     USES_CONTROLS=1
7119 fi
7120
7121 if test "$wxUSE_TREECTRL" = "yes"; then
7122     if test "$wxUSE_IMAGLIST" = "yes"; then
7123         AC_DEFINE(wxUSE_TREECTRL)
7124         USES_CONTROLS=1
7125         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS treectrl"
7126     else
7127         AC_MSG_WARN([wxTreeCtrl requires wxImageList and won't be compiled without it])
7128     fi
7129 fi
7130
7131 if test "$wxUSE_POPUPWIN" = "yes"; then
7132     if test "$wxUSE_OLD_COCOA" = 1 ; then
7133         AC_MSG_WARN([Popup window not yet supported under Mac OS X... disabled])
7134     else
7135         if test "$wxUSE_PM" = 1; then
7136             AC_MSG_WARN([wxPopupWindow not yet supported under PM... disabled])
7137         else
7138             AC_DEFINE(wxUSE_POPUPWIN)
7139             SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS popup"
7140
7141             USES_CONTROLS=1
7142         fi
7143     fi
7144 fi
7145
7146 if test "$wxUSE_DIALUP_MANAGER" = "yes"; then
7147     if test "$wxUSE_MAC" = 1 -o "$wxUSE_OLD_COCOA" = 1 -o "$wxUSE_MGL" = 1; then
7148         AC_MSG_WARN([Dialup manager not supported on this platform... disabled])
7149     else
7150         AC_DEFINE(wxUSE_DIALUP_MANAGER)
7151         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dialup"
7152     fi
7153 fi
7154
7155 if test "$wxUSE_TIPWINDOW" = "yes"; then
7156     if test "$wxUSE_PM" = 1; then
7157         AC_MSG_WARN([wxTipWindow not yet supported under PM... disabled])
7158     else
7159         AC_DEFINE(wxUSE_TIPWINDOW)
7160     fi
7161 fi
7162
7163 if test "$USES_CONTROLS" = 1; then
7164     AC_DEFINE(wxUSE_CONTROLS)
7165 fi
7166
7167 dnl ---------------------------------------------------------------------------
7168 dnl misc options
7169 dnl ---------------------------------------------------------------------------
7170
7171 dnl please keep the settings below in alphabetical order
7172 if test "$wxUSE_ACCESSIBILITY" = "yes"; then
7173     AC_DEFINE(wxUSE_ACCESSIBILITY)
7174     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS access"
7175 fi
7176
7177 if test "$wxUSE_ARTPROVIDER_STD" = "yes"; then
7178     AC_DEFINE(wxUSE_ARTPROVIDER_STD)
7179 fi
7180
7181 if test "$wxUSE_ARTPROVIDER_TANGO" = "auto"; then
7182     dnl Tango-based art provider is not needed in GTK-based ports as the
7183     dnl native art provider completely replaces it.
7184     if test "$wxUSE_GTK" != 1; then
7185         dnl It also requires support for memory-mapped PNG images.
7186         if test "$wxUSE_LIBPNG" != no -a \
7187                 "$wxUSE_IMAGE" = yes -a \
7188                 "$wxUSE_STREAMS" = yes; then
7189             wxUSE_ARTPROVIDER_TANGO="yes"
7190         fi
7191     fi
7192 fi
7193
7194 if test "$wxUSE_ARTPROVIDER_TANGO" = "yes"; then
7195     AC_DEFINE(wxUSE_ARTPROVIDER_TANGO)
7196 fi
7197
7198 if test "$wxUSE_DRAGIMAGE" = "yes"; then
7199     AC_DEFINE(wxUSE_DRAGIMAGE)
7200     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dragimag"
7201 fi
7202
7203 if test "$wxUSE_EXCEPTIONS" = "yes"; then
7204     if test "$wxUSE_NO_EXCEPTIONS" = "yes" ; then
7205         AC_MSG_WARN([--enable-exceptions can't be used with --enable-no_exceptions])
7206     else
7207         AC_DEFINE(wxUSE_EXCEPTIONS)
7208         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS except"
7209     fi
7210 fi
7211
7212 USE_HTML=0
7213 if test "$wxUSE_HTML" = "yes"; then
7214     AC_DEFINE(wxUSE_HTML)
7215     USE_HTML=1
7216     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS html html/about html/help html/helpview html/printing html/test html/virtual html/widget html/zip htlbox"
7217 fi
7218 if test "$wxUSE_WEBKIT" = "yes"; then
7219     if test "$wxUSE_MAC" = 1 -a "$USE_DARWIN" = 1; then
7220         old_CPPFLAGS="$CPPFLAGS"
7221         CPPFLAGS="-x objective-c++ $CPPFLAGS"
7222         AC_CHECK_HEADER([WebKit/HIWebView.h],
7223                         [
7224                            AC_DEFINE(wxUSE_WEBKIT)
7225                            WEBKIT_LINK="-framework WebKit"
7226                         ],
7227                         [
7228                            AC_MSG_WARN([WebKit headers not found; disabling wxWebKit])
7229                            wxUSE_WEBKIT=no
7230                         ],
7231                         [
7232                            #include <Carbon/Carbon.h>
7233                            #include <WebKit/WebKit.h>
7234                         ])
7235         CPPFLAGS="$old_CPPFLAGS"
7236     elif test "$wxUSE_OLD_COCOA" = 1; then
7237         AC_DEFINE(wxUSE_WEBKIT)
7238     else
7239         wxUSE_WEBKIT=no
7240     fi
7241     if test "$wxUSE_WEBKIT" = "yes"; then
7242         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS html/htmlctrl"
7243     fi
7244 fi
7245
7246 USE_XRC=0
7247 if test "$wxUSE_XRC" = "yes"; then
7248     if test "$wxUSE_XML" != "yes"; then
7249         AC_MSG_WARN([XML library not built, XRC resources disabled])
7250         wxUSE_XRC=no
7251     else
7252         AC_DEFINE(wxUSE_XRC)
7253         USE_XRC=1
7254         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS xrc"
7255     fi
7256 fi
7257
7258 USE_AUI=0
7259 if test "$wxUSE_AUI" = "yes"; then
7260    AC_DEFINE(wxUSE_AUI)
7261    USE_AUI=1
7262    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS aui"
7263 fi
7264
7265 USE_PROPGRID=0
7266 if test "$wxUSE_PROPGRID" = "yes"; then
7267    AC_DEFINE(wxUSE_PROPGRID)
7268    USE_PROPGRID=1
7269    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS propgrid"
7270 fi
7271
7272 USE_RIBBON=0
7273 if test "$wxUSE_RIBBON" = "yes"; then
7274    AC_DEFINE(wxUSE_RIBBON)
7275    USE_RIBBON=1
7276    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS ribbon"
7277 fi
7278
7279 USE_STC=0
7280 if test "$wxUSE_STC" = "yes"; then
7281    AC_DEFINE(wxUSE_STC)
7282    USE_STC=1
7283    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS stc"
7284
7285    dnl python is used to update src/stc.h (see build/bakefiles/scintilla.bkl)
7286    AC_PATH_PROG(PYTHON, python)
7287    if test "x$PYTHON" = "x"; then
7288      COND_PYTHON="#"
7289    fi
7290    AC_SUBST(COND_PYTHON)
7291 fi
7292
7293 if test "$wxUSE_MENUS" = "yes"; then
7294     AC_DEFINE(wxUSE_MENUS)
7295     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS menu"
7296 fi
7297
7298 if test "$wxUSE_METAFILE" = "yes"; then
7299     AC_DEFINE(wxUSE_METAFILE)
7300 fi
7301
7302 if test "$wxUSE_MIMETYPE" = "yes"; then
7303     AC_DEFINE(wxUSE_MIMETYPE)
7304 fi
7305
7306 if test "$wxUSE_MINIFRAME" = "yes"; then
7307     AC_DEFINE(wxUSE_MINIFRAME)
7308 fi
7309
7310 if test "$wxUSE_SYSTEM_OPTIONS" = "yes"; then
7311     AC_DEFINE(wxUSE_SYSTEM_OPTIONS)
7312 fi
7313
7314 if test "$wxUSE_TASKBARICON" = "yes"; then
7315     AC_DEFINE(wxUSE_TASKBARICON)
7316     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS taskbar"
7317 fi
7318
7319
7320 if test "$wxUSE_VALIDATORS" = "yes"; then
7321     AC_DEFINE(wxUSE_VALIDATORS)
7322     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS validate"
7323 fi
7324
7325 if test "$wxUSE_PALETTE" = "yes" ; then
7326     if test "$wxUSE_DFB" = 1; then
7327         AC_MSG_WARN([wxPalette not yet supported under DFB... disabled])
7328         wxUSE_PALETTE=no
7329     else
7330         AC_DEFINE(wxUSE_PALETTE)
7331     fi
7332 fi
7333
7334 if test "$wxUSE_UNICODE" = "yes" -a "$wxUSE_UNICODE_MSLU" = "yes" ; then
7335   dnl Must be done this late because -lunicows must be before all the other libs
7336   LIBS=" -lunicows $LIBS"
7337 fi
7338
7339 USE_RICHTEXT=0
7340 if test "$wxUSE_RICHTEXT" = "yes"; then
7341     AC_DEFINE(wxUSE_RICHTEXT)
7342     USE_RICHTEXT=1
7343     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS richtext"
7344 fi
7345
7346 USE_WEB=0
7347 if test "$wxUSE_WEB" = "yes"; then
7348    AC_DEFINE(wxUSE_WEB)
7349    USE_WEB=1
7350    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS web"
7351
7352    if test "$wxUSE_WEBVIEW_WEBKIT" = "yes" -a "$wxUSE_GTK" = 1; then
7353        AC_DEFINE(wxUSE_WEBVIEW_WEBKIT)
7354        AC_MSG_CHECKING([for webkitgtk libraries])
7355        WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],webkitgtk-1.0)
7356        if test "$ac_find_libraries" != "" ; then
7357            WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
7358            if test "$ac_path_to_link" != " -L/usr/lib" ; then
7359                LDFLAGS="$LDFLAGS $ac_path_to_link"
7360            fi
7361            GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lwebkitgtk-1.0"
7362            AC_MSG_RESULT([yes])
7363        else
7364            AC_MSG_RESULT([no])
7365            AC_MSG_WARN([libwebkitgtk-1.0 not found; disabling webkit backend])
7366            wxUSE_WEBVIEW_WEBKIT="no"
7367        fi
7368
7369        AC_MSG_CHECKING(for webkitgtk includes)
7370        WX_PATH_FIND_INCLUDES([$SEARCH_INCLUDE /usr/include/webkit-1.0], webkit/webkit.h)
7371        if test "$ac_find_includes" != "" ; then
7372            AC_MSG_RESULT(found in $ac_find_includes)
7373            WX_INCLUDE_PATH_EXIST($ac_find_includes, $CPPFLAGS)
7374            CPPFLAGS="$ac_path_to_include $CPPFLAGS"
7375        else
7376            AC_MSG_RESULT([not found])
7377        fi
7378        dnl we also depend on libsoup
7379        AC_MSG_CHECKING(for libsoup includes)
7380        WX_PATH_FIND_INCLUDES([$SEARCH_INCLUDE /usr/include/libsoup-2.4], libsoup/soup.h)
7381        if test "$ac_find_includes" != "" ; then
7382            AC_MSG_RESULT(found in $ac_find_includes)
7383            WX_INCLUDE_PATH_EXIST($ac_find_includes, $CPPFLAGS)
7384            CPPFLAGS="$ac_path_to_include $CPPFLAGS"
7385        else
7386            AC_MSG_RESULT([not found])
7387        fi
7388    fi
7389
7390     if test "$wxUSE_WEBVIEW_WEBKIT" = "yes" -a "$wxUSE_MAC" = 1 -a "$USE_DARWIN" = 1; then
7391         old_CPPFLAGS="$CPPFLAGS"
7392         CPPFLAGS="-x objective-c++ $CPPFLAGS"
7393         AC_CHECK_HEADER([WebKit/HIWebView.h],
7394                         [
7395                            AC_DEFINE(wxUSE_WEBVIEW_WEBKIT)
7396                            WEBKIT_LINK="-framework WebKit"
7397                         ],
7398                         [
7399                            AC_MSG_WARN([WebKit headers not found; disabling wxWebView WebKit])
7400                            wxUSE_WEBVIEW_WEBKIT=no
7401                         ],
7402                         [
7403                            #include <Carbon/Carbon.h>
7404                            #include <WebKit/WebKit.h>
7405                         ])
7406         CPPFLAGS="$old_CPPFLAGS"
7407     elif test "$wxUSE_OLD_COCOA" = 1; then
7408         AC_DEFINE(wxUSE_WEBVIEW_WEBKIT)
7409     else
7410         wxUSE_WEBVIEW_WEBKIT=no
7411     fi
7412 fi
7413
7414 dnl ---------------------------------------------------------------------------
7415 dnl wxImage options
7416 dnl ---------------------------------------------------------------------------
7417
7418 if test "$wxUSE_IMAGE" = "yes" ; then
7419     AC_DEFINE(wxUSE_IMAGE)
7420
7421     if test "$wxUSE_GIF" = "yes" ; then
7422       AC_DEFINE(wxUSE_GIF)
7423     fi
7424
7425     if test "$wxUSE_PCX" = "yes" ; then
7426       AC_DEFINE(wxUSE_PCX)
7427     fi
7428
7429     if test "$wxUSE_TGA" = "yes" ; then
7430       AC_DEFINE(wxUSE_TGA)
7431     fi
7432
7433     if test "$wxUSE_IFF" = "yes" ; then
7434       AC_DEFINE(wxUSE_IFF)
7435     fi
7436
7437     if test "$wxUSE_PNM" = "yes" ; then
7438       AC_DEFINE(wxUSE_PNM)
7439     fi
7440
7441     if test "$wxUSE_XPM" = "yes" ; then
7442       AC_DEFINE(wxUSE_XPM)
7443     fi
7444
7445     if test "$wxUSE_ICO_CUR" = "yes" ; then
7446       AC_DEFINE(wxUSE_ICO_CUR)
7447     fi
7448 fi
7449
7450 dnl ---------------------------------------------------------------------------
7451 dnl common dialogs
7452 dnl ---------------------------------------------------------------------------
7453
7454 if test "$wxUSE_ABOUTDLG" = "yes"; then
7455     AC_DEFINE(wxUSE_ABOUTDLG)
7456 fi
7457
7458 if test "$wxUSE_CHOICEDLG" = "yes"; then
7459     AC_DEFINE(wxUSE_CHOICEDLG)
7460 fi
7461
7462 if test "$wxUSE_COLOURDLG" = "yes"; then
7463     AC_DEFINE(wxUSE_COLOURDLG)
7464 fi
7465
7466 if test "$wxUSE_FILEDLG" = "yes"; then
7467     AC_DEFINE(wxUSE_FILEDLG)
7468 fi
7469
7470 if test "$wxUSE_FINDREPLDLG" = "yes"; then
7471     AC_DEFINE(wxUSE_FINDREPLDLG)
7472 fi
7473
7474 if test "$wxUSE_FONTDLG" = "yes"; then
7475     AC_DEFINE(wxUSE_FONTDLG)
7476 fi
7477
7478 if test "$wxUSE_DIRDLG" = "yes"; then
7479     if test "$wxUSE_TREECTRL" != "yes"; then
7480         AC_MSG_WARN(wxDirDialog requires wxTreeCtrl so it won't be compiled without it)
7481     else
7482         AC_DEFINE(wxUSE_DIRDLG)
7483     fi
7484 fi
7485
7486 if test "$wxUSE_MSGDLG" = "yes"; then
7487     AC_DEFINE(wxUSE_MSGDLG)
7488 fi
7489
7490 if test "$wxUSE_NUMBERDLG" = "yes"; then
7491     AC_DEFINE(wxUSE_NUMBERDLG)
7492 fi
7493
7494 if test "$wxUSE_PROGRESSDLG" = "yes"; then
7495     AC_DEFINE(wxUSE_PROGRESSDLG)
7496 fi
7497
7498 if test "$wxUSE_SPLASH" = "yes"; then
7499     AC_DEFINE(wxUSE_SPLASH)
7500     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS splash"
7501 fi
7502
7503 if test "$wxUSE_STARTUP_TIPS" = "yes"; then
7504     AC_DEFINE(wxUSE_STARTUP_TIPS)
7505 fi
7506
7507 if test "$wxUSE_TEXTDLG" = "yes"; then
7508     AC_DEFINE(wxUSE_TEXTDLG)
7509 fi
7510
7511 if test "$wxUSE_WIZARDDLG" = "yes"; then
7512     AC_DEFINE(wxUSE_WIZARDDLG)
7513     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS wizard"
7514 fi
7515
7516 dnl ---------------------------------------------------------------------------
7517 dnl options used under wxMSW and wxPM
7518 dnl ---------------------------------------------------------------------------
7519
7520 if test "$wxUSE_MSW" = 1 -o "$wxUSE_PM" = 1; then
7521     if test "$wxUSE_OWNER_DRAWN" = "yes"; then
7522         AC_DEFINE(wxUSE_OWNER_DRAWN)
7523     fi
7524 fi
7525
7526 dnl ---------------------------------------------------------------------------
7527 dnl wxMSW-only options
7528 dnl ---------------------------------------------------------------------------
7529
7530 if test "$wxUSE_MSW" = 1 ; then
7531
7532     if test "$wxUSE_DC_CACHEING" = "yes"; then
7533         AC_DEFINE(wxUSE_DC_CACHEING)
7534     fi
7535
7536     if test "$wxUSE_DIB" = "yes"; then
7537         AC_DEFINE(wxUSE_WXDIB)
7538     fi
7539
7540     if test "$wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW" = "yes"; then
7541         AC_DEFINE(wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW)
7542     fi
7543
7544     if test "$wxUSE_UXTHEME" = "yes"; then
7545         AC_DEFINE(wxUSE_UXTHEME)
7546     fi
7547
7548 fi
7549 dnl wxUSE_MSW = 1
7550
7551 dnl not quite MSW-only although mostly useful to disable this under MSW
7552 if test "$wxUSE_AUTOID_MANAGEMENT" = "yes"; then
7553     AC_DEFINE(wxUSE_AUTOID_MANAGEMENT)
7554 fi
7555
7556 if test "$USE_WIN32" = 1 ; then
7557     if test "$wxUSE_INICONF" = "yes"; then
7558         AC_DEFINE(wxUSE_INICONF)
7559     fi
7560
7561     if test "$wxUSE_REGKEY" = "yes"; then
7562         AC_DEFINE(wxUSE_REGKEY)
7563     fi
7564 fi
7565 dnl USE_WIN32 = 1
7566
7567 dnl ---------------------------------------------------------------------------
7568 dnl wxGraphicsContext
7569 dnl ---------------------------------------------------------------------------
7570
7571 dnl Under Mac we don't even provide --enable-graphics_ctx switch as we always
7572 dnl need it -- but because we don't have the option, wxUSE_GRAPHICS_CONTEXT is
7573 dnl not defined automatically and we need to do it ourselves
7574 if test "$wxUSE_MAC" = 1; then
7575     wxUSE_GRAPHICS_CONTEXT="yes"
7576 fi
7577
7578 if test "$wxUSE_GRAPHICS_CONTEXT" = "yes"; then
7579     wx_has_graphics=0
7580     if test "$wxUSE_MSW" = 1; then
7581         AC_CACHE_CHECK([if GDI+ is available], wx_cv_lib_gdiplus,
7582             [
7583                 dnl we need just the header, not the library, as we load the
7584                 dnl GDI+ DLL dynamically anyhow during run-time
7585                 AC_LANG_PUSH(C++)
7586                 AC_TRY_COMPILE(
7587                     [#include <windows.h>
7588                      #include <gdiplus.h>],
7589                     [
7590                         using namespace Gdiplus;
7591                     ],
7592                     wx_cv_lib_gdiplus=yes,
7593                     wx_cv_lib_gdiplus=no
7594                 )
7595                 AC_LANG_POP()
7596             ]
7597         )
7598         if test "$wx_cv_lib_gdiplus" = "yes"; then
7599             wx_has_graphics=1
7600         fi
7601     elif test "$wxUSE_GTK" = 1 -o "$wxUSE_X11" = 1; then
7602         PKG_CHECK_MODULES(CAIRO, cairo,
7603             [wx_has_graphics=1],
7604             [AC_MSG_WARN([Cairo library not found])]
7605         )
7606         if test "$wx_has_graphics" = 1; then
7607             dnl Check that Cairo library is new enough: wxGraphicsContext
7608             dnl won't compile without cairo_push_group() and
7609             dnl cairo_pop_group_to_source() which are new in 1.2.
7610             save_LIBS="$LIBS"
7611             LIBS="$LIBS $CAIRO_LIBS"
7612             AC_CHECK_FUNCS([cairo_push_group])
7613             LIBS="$save_LIBS"
7614             if test "$ac_cv_func_cairo_push_group" = "no"; then
7615                 wx_has_graphics=0
7616                 AC_MSG_WARN([Cairo library is too old and misses cairo_push_group()])
7617             else
7618                 AC_DEFINE(wxUSE_CAIRO)
7619
7620                 dnl We don't need to do this for wxGTK as we already get Cairo
7621                 dnl flags as part of GTK+ ones.
7622                 if test "$wxUSE_GTK" != 1; then
7623                     CPPFLAGS="$CAIRO_CFLAGS $CPPFLAGS"
7624                     GUI_TK_LIBRARY="$GUI_TK_LIBRARY $CAIRO_LIBS"
7625                 fi
7626             fi
7627         fi
7628     else
7629         dnl assume it's ok, add more checks here if needed
7630         wx_has_graphics=1
7631     fi
7632
7633     if test "$wx_has_graphics" = 1; then
7634         AC_DEFINE(wxUSE_GRAPHICS_CONTEXT)
7635     else
7636         AC_MSG_WARN([wxGraphicsContext won't be available])
7637     fi
7638 fi
7639
7640 dnl ---------------------------------------------------------------------------
7641 dnl wxMediaCtrl
7642 dnl ---------------------------------------------------------------------------
7643
7644 USE_MEDIA=0
7645
7646 if test "$wxUSE_MEDIACTRL" = "yes" -o "$wxUSE_MEDIACTRL" = "auto"; then
7647     USE_MEDIA=1
7648
7649     dnl -----------------------------------------------------------------------
7650     dnl GStreamer
7651     dnl -----------------------------------------------------------------------
7652     if test "$wxUSE_GTK" = 1; then
7653         wxUSE_GSTREAMER="no"
7654
7655         dnl -------------------------------------------------------------------
7656         dnl Test for at least 0.8 gstreamer module from pkg-config
7657         dnl Even totem doesn't accept 0.9 evidently.
7658         dnl
7659         dnl So, we first check to see if 0.10 if available - if not we
7660         dnl try the older 0.8 version
7661         dnl -------------------------------------------------------------------
7662         GST_VERSION_MAJOR=0
7663         GST_VERSION_MINOR=10
7664         GST_VERSION=$GST_VERSION_MAJOR.$GST_VERSION_MINOR
7665
7666         if test "$wxUSE_GSTREAMER8" = "no"; then
7667             PKG_CHECK_MODULES(GST,
7668                 [gstreamer-$GST_VERSION gstreamer-plugins-base-$GST_VERSION gconf-2.0],
7669                 [
7670                     wxUSE_GSTREAMER="yes"
7671                     GST_LIBS="$GST_LIBS -lgstinterfaces-$GST_VERSION"
7672                 ],
7673                 [
7674                     AC_MSG_WARN([GStreamer 0.10 not available, falling back to 0.8])
7675                     GST_VERSION_MINOR=8
7676                 ]
7677             )
7678         else
7679             dnl check only for 0.8
7680             GST_VERSION_MINOR=8
7681         fi
7682
7683         if test $GST_VERSION_MINOR = "8"; then
7684             GST_VERSION=$GST_VERSION_MAJOR.$GST_VERSION_MINOR
7685             PKG_CHECK_MODULES(GST,
7686                 [gstreamer-$GST_VERSION gstreamer-interfaces-$GST_VERSION gstreamer-gconf-$GST_VERSION],
7687                 wxUSE_GSTREAMER="yes",
7688                 [
7689                     AC_MSG_WARN([GStreamer 0.8/0.10 not available.])
7690                 ])
7691         fi
7692
7693
7694         if test "$wxUSE_GSTREAMER" = "yes"; then
7695             CPPFLAGS="$GST_CFLAGS $CPPFLAGS"
7696             EXTRALIBS_MEDIA="$GST_LIBS"
7697
7698             AC_DEFINE(wxUSE_GSTREAMER)
7699         else
7700             USE_MEDIA=0
7701         fi
7702     fi
7703
7704     if test $USE_MEDIA = 1; then
7705         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS mediaplayer"
7706         AC_DEFINE(wxUSE_MEDIACTRL)
7707     else
7708         if test "$wxUSE_MEDIACTRL" = "yes"; then
7709             AC_MSG_ERROR([GStreamer not available])
7710         else
7711             dnl was set to 'auto'
7712             AC_MSG_WARN([GStreamer not available... disabling wxMediaCtrl])
7713         fi
7714     fi
7715 fi
7716
7717 dnl ---------------------------------------------------------------------------
7718 dnl get the string with OS info - used by wxGetOsDescription() on MacOS X
7719 dnl ---------------------------------------------------------------------------
7720
7721 if test "$cross_compiling" != "no"; then
7722     dnl Use best guess from host as we can't use uname when cross compiling
7723     OSINFO="\"$host\""
7724 else
7725     dnl attualy work out OS version
7726     OSINFO=`uname -s -r -m`
7727     OSINFO="\"$OSINFO\""
7728 fi
7729
7730 AC_DEFINE_UNQUOTED(WXWIN_OS_DESCRIPTION, $OSINFO)
7731
7732 dnl ---------------------------------------------------------------------------
7733 dnl define the variable containing the installation prefix (used in dcpsg.cpp)
7734 dnl ---------------------------------------------------------------------------
7735
7736 if test "x$prefix" != "xNONE"; then
7737     wxPREFIX=$prefix
7738 else
7739     wxPREFIX=$ac_default_prefix
7740 fi
7741
7742 AC_DEFINE_UNQUOTED(wxINSTALL_PREFIX, "$wxPREFIX")
7743
7744
7745 dnl ---------------------------------------------------------------------------
7746 dnl define variables with all built libraries for wx-config
7747 dnl ---------------------------------------------------------------------------
7748
7749 STD_BASE_LIBS="base"
7750 STD_GUI_LIBS=""
7751 BUILT_WX_LIBS="base"
7752 ALL_WX_LIBS="xrc stc gl media qa html adv core xml net base"
7753
7754 if test "$wxUSE_SOCKETS" = "yes" ; then
7755     STD_BASE_LIBS="net $STD_BASE_LIBS"
7756     BUILT_WX_LIBS="net $BUILT_WX_LIBS"
7757 fi
7758 if test "$wxUSE_XML" = "yes" ; then
7759     STD_BASE_LIBS="xml $STD_BASE_LIBS"
7760     BUILT_WX_LIBS="xml $BUILT_WX_LIBS"
7761 fi
7762
7763 if test "$wxUSE_GUI" = "yes"; then
7764     STD_GUI_LIBS="adv core"
7765     BUILT_WX_LIBS="$STD_GUI_LIBS $BUILT_WX_LIBS"
7766
7767     if test "$wxUSE_DEBUGREPORT" = "yes" ; then
7768         STD_GUI_LIBS="qa $STD_GUI_LIBS"
7769         BUILT_WX_LIBS="qa $BUILT_WX_LIBS"
7770     fi
7771     if test "$wxUSE_HTML" = "yes" ; then
7772         STD_GUI_LIBS="html $STD_GUI_LIBS"
7773         BUILT_WX_LIBS="html $BUILT_WX_LIBS"
7774     fi
7775     if test "$wxUSE_MEDIACTRL" = "yes" ; then
7776         BUILT_WX_LIBS="media $BUILT_WX_LIBS"
7777     fi
7778     if test "$wxUSE_OPENGL" = "yes" ; then
7779         BUILT_WX_LIBS="gl $BUILT_WX_LIBS"
7780     fi
7781     if test "$wxUSE_AUI" = "yes" ; then
7782         BUILT_WX_LIBS="aui $BUILT_WX_LIBS"
7783     fi
7784     if test "$wxUSE_PROPGRID" = "yes" ; then
7785         BUILT_WX_LIBS="propgrid $BUILT_WX_LIBS"
7786     fi
7787     if test "$wxUSE_RIBBON" = "yes" ; then
7788         BUILT_WX_LIBS="ribbon $BUILT_WX_LIBS"
7789     fi
7790     if test "$wxUSE_RICHTEXT" = "yes" ; then
7791         BUILT_WX_LIBS="richtext $BUILT_WX_LIBS"
7792     fi
7793     if test "$wxUSE_STC" = "yes" ; then
7794         BUILT_WX_LIBS="stc $BUILT_WX_LIBS"
7795     fi
7796     if test "$wxUSE_WEB" = "yes" ; then
7797         STD_GUI_LIBS="web $STD_GUI_LIBS"
7798         BUILT_WX_LIBS="web $BUILT_WX_LIBS"
7799     fi
7800     if test "$wxUSE_XRC" = "yes" ; then
7801         STD_GUI_LIBS="xrc $STD_GUI_LIBS"
7802         BUILT_WX_LIBS="xrc $BUILT_WX_LIBS"
7803     fi
7804 fi
7805
7806 AC_SUBST(ALL_WX_LIBS)
7807 AC_SUBST(BUILT_WX_LIBS)
7808 AC_SUBST(STD_BASE_LIBS)
7809 AC_SUBST(STD_GUI_LIBS)
7810
7811 dnl ---------------------------------------------------------------------------
7812 dnl Output the makefiles and such from the results found above
7813 dnl ---------------------------------------------------------------------------
7814
7815 dnl all additional libraries (except wxWidgets itself) we link with
7816 EXTRA_FRAMEWORKS=
7817 if test "$wxUSE_MAC" = 1 ; then
7818     if test "$USE_DARWIN" = 1; then
7819         if test "$wxUSE_OSX_IPHONE" = 1; then
7820             EXTRA_FRAMEWORKS="-framework IOKit -framework UIKit -framework CFNetwork -framework AudioToolbox -framework CoreFoundation -framework CoreGraphics -framework OpenGLES -framework Foundation -framework QuartzCore"
7821         else
7822             EXTRA_FRAMEWORKS="-framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL -framework QuickTime"
7823         fi
7824     fi
7825 fi
7826 if test "$wxUSE_OLD_COCOA" = 1 ; then
7827     EXTRA_FRAMEWORKS="-framework IOKit -framework Cocoa"
7828     if test "$wxUSE_MEDIACTRL" = "yes"; then
7829         EXTRA_FRAMEWORKS="$EXTRA_FRAMEWORKS -framework QuickTime"
7830     fi
7831 fi
7832 if test "$USE_DARWIN" = 1 -a "$wxUSE_MAC" != 1 -a "$wxUSE_OLD_COCOA" != 1 ; then
7833     EXTRA_FRAMEWORKS="$EXTRA_FRAMEWORKS -framework IOKit -framework CoreServices -framework System -framework ApplicationServices"
7834 fi
7835
7836 LDFLAGS="$LDFLAGS $EXTRA_FRAMEWORKS"
7837 WXCONFIG_LDFLAGS="$WXCONFIG_LDFLAGS $EXTRA_FRAMEWORKS"
7838
7839 LIBS="$ZLIB_LINK $POSIX4_LINK $INET_LINK $WCHAR_LINK $DL_LINK $LIBS"
7840
7841 if test "$wxUSE_GUI" = "yes"; then
7842
7843     dnl TODO add checks that these samples will really compile (i.e. all the
7844     dnl      library features they need are present)
7845
7846     dnl TODO some samples are never built so far: mfc (requires VC++)
7847     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS artprov controls dialogs drawing \
7848                      erase event exec font image minimal render \
7849                      shaped svg taborder vscroll widgets wrapsizer"
7850
7851     if test "$wxUSE_MONOLITHIC" != "yes"; then
7852         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS console"
7853     fi
7854     if test "$TOOLKIT" = "MSW"; then
7855         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS regtest"
7856         if test "$wxUSE_UNIVERSAL" != "yes"; then
7857             SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS ownerdrw nativdlg dll"
7858         fi
7859     fi
7860     if test "$TOOLKIT" = "PM" -a "$wxUSE_UNIVERSAL" != "yes"; then
7861         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS ownerdrw"
7862     fi
7863 else
7864     SAMPLES_SUBDIRS="console"
7865     if test "$wxUSE_SOCKETS" = "yes" ; then
7866         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS sockets"
7867     fi
7868     if test "$wxUSE_IPC" = "yes" ; then
7869         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS ipc"
7870     fi
7871 fi
7872
7873
7874 dnl C/C++ compiler options used to compile wxWidgets
7875 dnl
7876 dnl check for icc before gcc as icc is also recognized as gcc
7877 if test "x$INTELCC" = "xyes" ; then
7878     dnl Warnings which can't be easily suppressed in C code are disabled:
7879     dnl
7880     dnl     #810: conversion from "x" to "y" may lose significant bits
7881     dnl     #869: parameter "foo" was never referenced
7882     dnl     #1572: floating-point equality and inequality comparisons
7883     dnl            are unreliable
7884     dnl     #1684: conversion from pointer to same-sized integral type
7885     dnl     #2259: non-pointer conversion from "x" to "y" may lose significant
7886     dnl            bits
7887     CWARNINGS="-Wall -wd810,869,981,1418,1572,1684,2259"
7888 elif test "$GCC" = yes ; then
7889     CWARNINGS="-Wall -Wundef"
7890 fi
7891
7892 if test "x$INTELCXX" = "xyes" ; then
7893     dnl Intel compiler gives some warnings which simply can't be worked
7894     dnl around or of which we have too many (810, 869) so it's impractical to
7895     dnl keep them enabled even if in theory it would be nice and some others
7896     dnl (279) are generated for standard macros and so there is nothing we can
7897     dnl do about them
7898     dnl
7899     dnl     #279: controlling expression is constant
7900     dnl     #383: value copied to temporary, reference to temporary used
7901     dnl     #444: destructor for base class "xxx" is not virtual
7902     dnl     #981: operands are evaluated in unspecified order
7903     dnl     #1418: external definition with no prior declaration
7904     dnl     #1419: external declaration in primary source file
7905     dnl     #1881: argument must be a constant null pointer value
7906     dnl
7907     dnl (for others see CWARNINGS above)
7908     CXXWARNINGS="-Wall -wd279,383,444,810,869,981,1418,1419,1881,2259"
7909 elif test "$GXX" = yes ; then
7910     CXXWARNINGS="-Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy"
7911     AX_CXXFLAGS_GCC_OPTION(-Woverloaded-virtual, CXXWARNINGS)
7912
7913     dnl when building under Mac we currently get hundreds of deprecation
7914     dnl warnings for Carbon symbols from the standard headers -- disable them
7915     dnl as we already know that they're deprecated and nothing else can be seen
7916     dnl with these warnings on
7917     if test "$wxUSE_MAC" = 1 ; then
7918         CXXWARNINGS="$CXXWARNINGS -Wno-deprecated-declarations"
7919     fi
7920 fi
7921
7922
7923 dnl combine everything together and remove the extra white space while doing it
7924 WXCONFIG_CFLAGS=`echo $WXCONFIG_CFLAGS`
7925 WXCONFIG_CXXFLAGS=`echo $WXCONFIG_CFLAGS $WXCONFIG_CXXFLAGS`
7926
7927
7928 dnl add -I options we use during library compilation
7929 dnl
7930 dnl note that the order is somewhat important: wxWidgets headers should
7931 dnl come first and the one with setup.h should be before $(top_srcdir)/include
7932 dnl in case the latter contains setup.h used by non-autoconf makefiles (e.g.
7933 dnl CodeWarrior):
7934 CPPFLAGS=`echo $WXCONFIG_CPPFLAGS \
7935  -I\\${wx_top_builddir}/lib/wx/include/${TOOLCHAIN_FULLNAME} \
7936  -I\\${top_srcdir}/include $TOOLKIT_INCLUDE \
7937  $CPPFLAGS `
7938
7939 C_AND_CXX_FLAGS="$DEBUG_CFLAGS $PROFILE_FLAGS $OPTIMISE_CFLAGS"
7940 CFLAGS=`echo $WXCONFIG_CFLAGS $CWARNINGS $C_AND_CXX_FLAGS $CFLAGS `
7941 CXXFLAGS=`echo $WXCONFIG_CXXFLAGS $C_AND_CXX_FLAGS $CXXFLAGS `
7942 OBJCFLAGS=`echo $WXCONFIG_CFLAGS $CWARNINGS $C_AND_CXX_FLAGS $OBJCFLAGS `
7943 OBJCXXFLAGS=`echo $WXCONFIG_CXXFLAGS $C_AND_CXX_FLAGS $OBJCXXFLAGS `
7944
7945 dnl now that we added WXCONFIG_CPPFLAGS to CPPFLAGS we can add the wx-config
7946 dnl only stuff to it
7947 WXCONFIG_CPPFLAGS=`echo $WXCONFIG_CPPFLAGS $WXCONFIG_ONLY_CPPFLAGS`
7948
7949
7950 if test "x$MWCC" = "xyes"; then
7951     dnl Correct MW 8.3 to be more similar to GCC.  In particular we
7952     dnl must use <regex.h> from system not our local copy on OS X,
7953     dnl but must use local not system on OS 9.
7954     dnl The following should make all -I paths usable for <> includes
7955     dnl while first checking in real system paths.  With 8.3 using
7956     dnl -gccincludes it will actually check local paths before system
7957     dnl even for <> which is totally wrong.
7958
7959     dnl Note that because this absolutely needs to be before any -I
7960     dnl that we have to tack it on to the end of the compiler commandline.
7961     CC="$CC -cwd source -I-"
7962     CXX="$CXX -cwd source -I-"
7963 fi
7964
7965
7966 LIBS=`echo $LIBS`
7967 EXTRALIBS="$LDFLAGS $LDFLAGS_VERSIONING $LIBS $DMALLOC_LIBS"
7968 EXTRALIBS_XML="$EXPAT_LINK"
7969 EXTRALIBS_HTML="$MSPACK_LINK"
7970 EXTRALIBS_MEDIA="$GST_LIBS"
7971 EXTRALIBS_STC="-lwxscintilla${WX_LIB_FLAVOUR}-${WX_RELEASE}${HOST_SUFFIX}"
7972 if test "$wxUSE_GUI" = "yes"; then
7973     EXTRALIBS_GUI=`echo $GUI_TK_LIBRARY $PNG_LINK $JPEG_LINK $TIFF_LINK $WEBKIT_LINK $EXTRALIBS_HILDON $EXTRALIBS_GNOMEVFS $EXTRALIBS_GNOMEPRINT`
7974 fi
7975 if test "$wxUSE_OPENGL" = "yes"; then
7976     EXTRALIBS_OPENGL="$LDFLAGS_GL $OPENGL_LIBS"
7977 fi
7978
7979 LDFLAGS="$LDFLAGS $PROFILE_FLAGS"
7980
7981 WXCONFIG_LIBS="$LIBS"
7982
7983 dnl wx-config must output builtin 3rd party libs in --libs in static build:
7984 if test "$wxUSE_REGEX" = "builtin" ; then
7985     wxconfig_3rdparty="regex${lib_unicode_suffix} $wxconfig_3rdparty"
7986 fi
7987 if test "$wxUSE_EXPAT" = "builtin" ; then
7988     wxconfig_3rdparty="expat $wxconfig_3rdparty"
7989 fi
7990 if test "$wxUSE_LIBTIFF" = "builtin" ; then
7991     wxconfig_3rdparty="tiff $wxconfig_3rdparty"
7992 fi
7993 if test "$wxUSE_LIBJPEG" = "builtin" ; then
7994     wxconfig_3rdparty="jpeg $wxconfig_3rdparty"
7995 fi
7996 if test "$wxUSE_LIBPNG" = "builtin" ; then
7997     wxconfig_3rdparty="png $wxconfig_3rdparty"
7998 fi
7999 if test "$wxUSE_ZLIB" = "builtin" ; then
8000     wxconfig_3rdparty="zlib $wxconfig_3rdparty"
8001 fi
8002
8003 for i in $wxconfig_3rdparty ; do
8004     WXCONFIG_LIBS="-lwx${i}${WX_LIB_FLAVOUR}-${WX_RELEASE}${HOST_SUFFIX} $WXCONFIG_LIBS"
8005 done
8006
8007
8008 if test "x$wxUSE_UNIVERSAL" = "xyes" ; then
8009     WXUNIV=1
8010
8011     case "$wxUNIV_THEMES" in
8012         ''|all)
8013             AC_DEFINE(wxUSE_ALL_THEMES)
8014             ;;
8015
8016         *)
8017             for t in `echo $wxUNIV_THEMES | tr , ' ' | tr '[[a-z]]' '[[A-Z]]'`; do
8018                 AC_DEFINE_UNQUOTED(wxUSE_THEME_$t)
8019             done
8020     esac
8021 else
8022     WXUNIV=0
8023 fi
8024
8025 AC_SUBST(wxUSE_ZLIB)
8026 AC_SUBST(wxUSE_REGEX)
8027 AC_SUBST(wxUSE_EXPAT)
8028 AC_SUBST(wxUSE_LIBJPEG)
8029 AC_SUBST(wxUSE_LIBPNG)
8030 AC_SUBST(wxUSE_LIBTIFF)
8031
8032 if test $wxUSE_MONOLITHIC = "yes" ; then
8033     MONOLITHIC=1
8034 else
8035     MONOLITHIC=0
8036 fi
8037
8038 if test $wxUSE_PLUGINS = "yes" ; then
8039     USE_PLUGINS=1
8040 else
8041     USE_PLUGINS=0
8042 fi
8043
8044 if test "$wxUSE_DEBUGREPORT" = "yes" ; then
8045     USE_QA=1
8046 else
8047     USE_QA=0
8048 fi
8049
8050 if test $wxUSE_OFFICIAL_BUILD = "yes" ; then
8051     OFFICIAL_BUILD=1
8052 else
8053     OFFICIAL_BUILD=0
8054 fi
8055
8056 AC_SUBST(VENDOR)
8057 AC_SUBST(OFFICIAL_BUILD)
8058 AC_SUBST(WX_FLAVOUR)
8059 AC_SUBST(WX_LIB_FLAVOUR)
8060
8061 AC_SUBST(WXUNIV)
8062 AC_SUBST(MONOLITHIC)
8063 AC_SUBST(USE_PLUGINS)
8064 AC_SUBST(LIBS)
8065 AC_SUBST(CXXWARNINGS)
8066 AC_SUBST(EXTRALIBS)
8067 AC_SUBST(EXTRALIBS_XML)
8068 AC_SUBST(EXTRALIBS_HTML)
8069 AC_SUBST(EXTRALIBS_MEDIA)
8070 AC_SUBST(EXTRALIBS_GUI)
8071 AC_SUBST(EXTRALIBS_OPENGL)
8072 AC_SUBST(EXTRALIBS_SDL)
8073 AC_SUBST(EXTRALIBS_STC)
8074 AC_SUBST(WITH_PLUGIN_SDL)
8075 AC_SUBST(EXTRALIBS_GTKPRINT)
8076 AC_SUBST(EXTRALIBS_GNOMEPRINT)
8077 AC_SUBST(EXTRALIBS_GNOMEVFS)
8078 AC_SUBST(EXTRALIBS_HILDON)
8079 AC_SUBST(UNICODE)
8080 AC_SUBST(DEBUG_INFO)
8081 AC_SUBST(DEBUG_FLAG)
8082 TOOLKIT_LOWERCASE=`echo $TOOLKIT | tr '[[A-Z]]' '[[a-z]]'`
8083 AC_SUBST(TOOLKIT_LOWERCASE)
8084 AC_SUBST(TOOLKIT_VERSION)
8085 AC_SUBST(DYLIB_RPATH_INSTALL)
8086 AC_SUBST(DYLIB_RPATH_POSTLINK)
8087 AC_SUBST(SAMPLES_RPATH_FLAG)
8088 AC_SUBST(HEADER_PAD_OPTION)
8089 AC_SUBST(HOST_SUFFIX)
8090 AC_SUBST(CPPUNIT_CFLAGS)
8091 AC_SUBST(CPPUNIT_LIBS)
8092
8093 case "$TOOLKIT" in
8094     GTK)
8095         TOOLKIT_DESC="GTK+"
8096         if test "$WXGTK2" = 1; then
8097             TOOLKIT_DESC="$TOOLKIT_DESC 2"
8098             if test "$wxUSE_GTKPRINT" = "yes" ; then
8099                 TOOLKIT_EXTRA="$TOOLKIT_EXTRA GTK+ printing";
8100             fi
8101             if test "$wxUSE_LIBGNOMEPRINT" = "yes" ; then
8102                 TOOLKIT_EXTRA="$TOOLKIT_EXTRA gnomeprint";
8103             fi
8104             if test "$wxUSE_LIBGNOMEVFS" = "yes" ; then
8105                 TOOLKIT_EXTRA="$TOOLKIT_EXTRA gnomevfs"
8106             fi
8107             if test "$wxUSE_LIBHILDON" = "yes"; then
8108                 TOOLKIT_EXTRA="$TOOLKIT_EXTRA hildon"
8109             fi
8110             if test "$wxUSE_LIBHILDON2" = "yes"; then
8111                 TOOLKIT_EXTRA="$TOOLKIT_EXTRA hildon"
8112             fi
8113
8114             if test "$TOOLKIT_EXTRA" != ""; then
8115                 TOOLKIT_DESC="$TOOLKIT_DESC with support for `echo $TOOLKIT_EXTRA | tr -s ' '`"
8116             fi
8117         fi
8118         ;;
8119
8120     ?*)
8121         TOOLKIT_DESC=$TOOLKIT_LOWERCASE
8122         ;;
8123
8124     *)
8125         TOOLKIT_DESC="base only"
8126         ;;
8127 esac
8128
8129 if test "$wxUSE_WINE" = "yes"; then
8130     BAKEFILE_FORCE_PLATFORM=win32
8131 fi
8132
8133 dnl gcc 3.4 has a pch bug which truncates wide character constants in headers.
8134 dnl Hopefully for a non-unicode build there aren't any wide constants in
8135 dnl headers, but for a unicode build it's best to disable pch.
8136 if test "$wxUSE_UNICODE" = yes -a "$GCC" = yes -a "$bk_use_pch" != no
8137 then
8138     AC_CACHE_CHECK(
8139         [for gcc precompiled header bug],
8140         [wx_cv_gcc_pch_bug],
8141         [[
8142             echo '#include <stdio.h>
8143                   const wchar_t test_var[] = L"awidetest";' > conftest.h
8144
8145             echo '#include "conftest.h"
8146                   int main()
8147                   {
8148                      printf("%ls", test_var);
8149                      return 0;
8150                   }' > conftest.cpp
8151
8152             wx_cv_gcc_pch_bug="pch not supported"
8153
8154             if $CXX conftest.h >/dev/null 2>&1
8155             then
8156                 wx_cv_gcc_pch_bug=
8157
8158                 if $CXX -o conftest$PROGRAM_EXT conftest.cpp >/dev/null 2>&1
8159                 then
8160                     if tr -dc '[a-z]' < conftest$PROGRAM_EXT |
8161                         grep awidetest >/dev/null
8162                     then
8163                         wx_cv_gcc_pch_bug=no
8164                     else
8165                         wx_cv_gcc_pch_bug=yes
8166                     fi
8167                 fi
8168             fi
8169
8170             rm -f conftest.h conftest.gch conftest.cpp conftest$PROGRAM_EXT
8171         ]])
8172
8173     if test "$wx_cv_gcc_pch_bug" = yes; then
8174         dnl make the default for pch 'no'
8175         dnl further below check whether the user overrode and warn them
8176         bk_use_pch=no
8177     fi
8178 fi
8179
8180 AC_BAKEFILE([m4_include(autoconf_inc.m4)])
8181
8182 dnl make install path absolute (if not already);
8183 dnl will fail with (some) MSDOS paths
8184 case ${INSTALL} in
8185   /* ) # Absolute
8186      ;;
8187   ?:* ) # Drive letter, considered as absolute.
8188      ;;
8189   *)
8190      INSTALL=`pwd`/${INSTALL} ;;
8191 esac
8192
8193 if test "$wxUSE_GUI" = "yes"; then
8194
8195 if test "$wxUSE_MSW" = 1 ; then
8196     if test "x$WINDRES" = "x"; then
8197         AC_MSG_ERROR([Required windres program not found])
8198     fi
8199
8200     RESCOMP="$WINDRES"
8201 fi
8202
8203 if test "$wxUSE_MAC" = 1 -o "$wxUSE_OLD_COCOA" = 1; then
8204     dnl base name of the resource file for wxMac must be the same
8205     dnl as library installation base name (-install_name)
8206     WX_RESOURCES_MACOSX_ASCII="libwx_${TOOLCHAIN_NAME}.${wx_release_number}.r"
8207     WX_RESOURCES_MACOSX_DATA="libwx_${TOOLCHAIN_NAME}.${wx_release_number}.rsrc"
8208
8209     dnl add the resources target for wxMac
8210     LIBWXMACRES="\$(wx_top_builddir)/lib/${WX_RESOURCES_MACOSX_ASCII}"
8211
8212     AC_CHECK_PROG(DEREZ, DeRez, DeRez, /Developer/Tools/DeRez)
8213
8214     MACSETFILE="\$(SETFILE)"
8215
8216     dnl resources are bundled both with shared library and applications
8217     dnl since the carb resource *must* be included in the application
8218     if test "$wxUSE_OSX_CARBON" = 1; then
8219         POSTLINK_COMMAND="\$(REZ) -d __DARWIN__ -t APPL Carbon.r -o"
8220         RESCOMP="$REZ"
8221         WXCONFIG_RESFLAGS="-d __DARWIN__ -t APPL Carbon.r -o"
8222     else
8223         POSTLINK_COMMAND="cat /dev/null | \$(REZ) -d __DARWIN__ -t APPL ${LIBWXMACRES}"
8224         RESCOMP="cat /dev/null \| $REZ"
8225         WXCONFIG_RESFLAGS="-d __DARWIN__ -t APPL \$libdir/$WX_RESOURCES_MACOSX_ASCII"
8226     fi
8227
8228 else
8229     dnl default value is to (silently) do nothing in the makefile
8230     MACSETFILE="@true"
8231
8232     if test "$wxUSE_PM" = 1; then
8233         RESCOMP="emxbind"
8234         WXCONFIG_RESFLAGS="-ep"
8235
8236         dnl Is this one really used anywhere for pm?
8237         POSTLINK_COMMAND="$RESCOMP $WXCONFIG_RESFLAGS"
8238     else
8239         POSTLINK_COMMAND="@true"
8240     fi
8241 fi
8242
8243 fi
8244 dnl wxUSE_GUI = 1
8245
8246
8247 dnl find out if the compiler supports PCH
8248 dnl
8249 dnl TODO: this should be in bakefile
8250 if test $GCC_PCH = 1
8251 then
8252     if test "$wx_cv_gcc_pch_bug" = yes; then
8253         AC_MSG_WARN([*** Precompiled header support is broken on this compiler])
8254         AC_MSG_WARN([*** --enable-precomp-headers is not recommended])
8255         AC_MSG_WARN([*** see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13361])
8256     fi
8257
8258     # Our WX_PRECOMP flag does not make sense for any language except C++ because
8259     # the headers that benefit from precompilation are mostly C++ headers.
8260     CXXFLAGS="-DWX_PRECOMP $CXXFLAGS"
8261     # When Bakefile can do multi-language PCH (e.g. C++ and Objective-C++) enable this:
8262     #OBJCXXFLAGS="-DWX_PRECOMP $CXXFLAGS"
8263 fi
8264
8265 dnl HACK ALERT!!
8266 dnl For now, we need to alter bk-deps not to generate deps
8267 dnl when we've configured a Universal binary build.
8268 dnl The next version of Bakefile will have the correct fix for this
8269 dnl at which time, this hack can be removed.
8270
8271 if test "$wxUSE_MAC" = 1 ; then
8272     if test "x$wxUSE_UNIVERSAL_BINARY" != "xno" ; then
8273         sed "s/DEPSMODE=gcc/DEPSMODE=none/" < bk-deps > temp
8274         mv temp bk-deps
8275         chmod +x bk-deps
8276     fi
8277 fi
8278
8279 if test "$wxUSE_SHARED" = "yes"; then
8280     dnl Need addtional flag on OS/2, so override bakefiles value
8281     dnl (there currently is no suitable variable to which the
8282     dnl  missing flags could be added, AFAICS. SN, 18.12.2004. )
8283     case "${host}" in
8284       *-pc-os2_emx | *-pc-os2-emx )
8285         SHARED_LD_CC="`pwd`/dllar.sh -name-mangler-script ./dllnames.sh -libf INITINSTANCE -libf TERMINSTANCE -o"
8286         SHARED_LD_CXX="`pwd`/dllar.sh -name-mangler-script ./dllnames.sh -libf INITINSTANCE -libf TERMINSTANCE -o"
8287         cp -p ${srcdir}/src/os2/dllnames.sh .
8288         cp -p ${srcdir}/src/os2/dllar.sh .
8289       ;;
8290     esac
8291 fi
8292 if test "$wxUSE_OMF" = "yes"; then
8293     case "${host}" in
8294       *-pc-os2_emx | *-pc-os2-emx )
8295         LDFLAGS="$LDFLAGS -Zlinker /EXEPACK"
8296         LDFLAGS_GUI="-Zlinker /PMTYPE:PM"
8297         WXCONFIG_LDFLAGS_GUI="-Zlinker /PMTYPE:PM"
8298       ;;
8299     esac
8300 fi
8301
8302 dnl TOOLCHAIN_DEFS should be used for both wx and client code
8303 WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS $TOOLCHAIN_DEFS"
8304
8305
8306 dnl Sun cc is compatible with gcc and so either of them can use the C
8307 dnl libraries built with the other, i.e. gcc can be used to build wxGTK under
8308 dnl Solaris where GTK+ is compiled using cc and cc can be used under Linux
8309 dnl where GTK+ is built with gcc
8310 dnl
8311 dnl However the compiler options are not compatible at all and in particular
8312 dnl gcc doesn't like cc -mt option and cc doesn't like -pthread. We simply
8313 dnl filter them out as we already have the correct options for multithreaded
8314 dnl programs if we're using threads (and if we don't, it shouldn't matter)
8315 case "${host}" in
8316     *-*-solaris2* )
8317         dnl system packages are compiled with Sun CC and so pkg-config outputs
8318         dnl CC-specific "-mt" flag, remove it when using gcc
8319         if test "$GCC" = yes; then
8320             CPPFLAGS=`echo $CPPFLAGS | sed 's/-mt//'`
8321             LIBS=`echo $LIBS | sed 's/-mt//'`
8322             EXTRALIBS_GUI=`echo $EXTRALIBS_GUI | sed 's/-mt//'`
8323         fi
8324         ;;
8325
8326     *-*-linux* )
8327         dnl OTOH when using Sun CC under Linux, the flags contain gcc-specific
8328         dnl -pthreads which Sun CC doesn't know about
8329         if test "x$SUNCXX" = xyes; then
8330             CPPFLAGS=`echo $CPPFLAGS | sed 's/-pthread//'`
8331             LIBS=`echo $LIBS | sed 's/-pthread//'`
8332             EXTRALIBS_GUI=`echo $EXTRALIBS_GUI | sed 's/-pthread//'`
8333         fi
8334         ;;
8335 esac
8336
8337 dnl Add visibility support flags to CFLAGS/CXXFLAGS - do it this late so that
8338 dnl it doesn't affect compilation checks above
8339 CFLAGS="$CFLAGS $CFLAGS_VISIBILITY"
8340 CXXFLAGS="$CXXFLAGS $CXXFLAGS_VISIBILITY"
8341 OBJCFLAGS="$OBJCFLAGS $CFLAGS_VISIBILITY"
8342 OBJCXXFLAGS="$OBJCXXFLAGS $CXXFLAGS_VISIBILITY"
8343
8344 dnl for convenience, sort the samples in alphabetical order
8345 dnl
8346 dnl FIXME For some mysterious reasons, sometimes the directories are duplicated
8347 dnl       in this list - hence uniq. But normally, this shouldn't be needed!
8348 dnl
8349 dnl       Unfortunately, there is a bug in OS/2's tr, such that
8350 dnl       tr ' ' '\n' introduces DOS-like line breaks, whereas tr '\n' ' '
8351 dnl       only removes the Unix-like part of the introduced line break.
8352 SAMPLES_SUBDIRS="`echo $SAMPLES_SUBDIRS | tr -s ' ' | tr ' ' '\n' | sort | uniq | tr '\n' ' '| tr -d '\r'`"
8353
8354 dnl subtle bakefile goop.
8355 dnl Used in wx-config now too, as its STATIC_FLAG with different makeup.
8356 dnl I wish we would have called it something less likely to clash with
8357 dnl things though.
8358 AC_SUBST(SHARED)
8359
8360 dnl global options
8361 AC_SUBST(WX_LIBRARY_BASENAME_NOGUI)
8362 AC_SUBST(WX_LIBRARY_BASENAME_GUI)
8363
8364 dnl toolkit options
8365 AC_SUBST(USE_GUI)
8366 AC_SUBST(AFMINSTALL)
8367 AC_SUBST(WIN32INSTALL)
8368 AC_SUBST(TOOLKIT)
8369 AC_SUBST(TOOLKIT_DIR)
8370 AC_SUBST(TOOLCHAIN_NAME)
8371 AC_SUBST(TOOLCHAIN_FULLNAME)
8372
8373 dnl wx-config options
8374 AC_SUBST(host_alias)
8375 AC_SUBST(cross_compiling)
8376 AC_SUBST(WIDGET_SET)
8377 AC_SUBST(WX_RELEASE)
8378 AC_SUBST(WX_VERSION)
8379 AC_SUBST(WX_SUBVERSION)
8380 AC_SUBST(WX_CHARTYPE)
8381
8382 dnl note that in addition to the usual CPP/C/CXXFLAGS which are used for
8383 dnl building the library itself, we also have WXCONFIG_-prefixed variants which
8384 dnl are used when building the libraries using the library
8385 dnl
8386 dnl so put anything which should be used only during the library build in, e.g.
8387 dnl CXXFLAGS, but put everything else (by default) into WXCONFIG_CXXFLAGS
8388 dnl
8389 dnl and, finally, for some things which should be only used by wx-config but
8390 dnl not during the library compilation, use WXCONFIG_ONLY_CPPFLAGS which is
8391 dnl added to WXCONFIG_CPPFLAGS after adding the latter to CPPFLAGS
8392 AC_SUBST(WXCONFIG_CPPFLAGS)
8393 AC_SUBST(WXCONFIG_CFLAGS)
8394 AC_SUBST(WXCONFIG_CXXFLAGS)
8395
8396 AC_SUBST(WXCONFIG_LIBS)
8397 AC_SUBST(WXCONFIG_RPATH)
8398 AC_SUBST(WXCONFIG_LDFLAGS)
8399 AC_SUBST(WXCONFIG_LDFLAGS_GUI)
8400 AC_SUBST(WXCONFIG_RESFLAGS)
8401
8402 dnl distribution vars
8403 AC_SUBST(GUIDIST)
8404 AC_SUBST(DISTDIR)
8405
8406 dnl additional subdirectories where we will build
8407 AC_SUBST(SAMPLES_SUBDIRS)
8408
8409 dnl additional libraries and linker settings
8410 AC_SUBST(LDFLAGS)
8411 AC_SUBST(LDFLAGS_GL)
8412 AC_SUBST(OPENGL_LIBS)
8413 AC_SUBST(DMALLOC_LIBS)
8414 AC_SUBST(WX_VERSION_TAG)
8415
8416 dnl additional resurces settings
8417 AC_SUBST(RESCOMP)
8418 AC_SUBST(WINDRES)
8419 AC_SUBST(REZ)
8420 AC_SUBST(RESFLAGS)
8421 AC_SUBST(RESPROGRAMOBJ)
8422 AC_SUBST(WX_RESOURCES_MACOSX_ASCII)
8423 AC_SUBST(WX_RESOURCES_MACOSX_DATA)
8424
8425 dnl additional for Mac OS X
8426 AC_SUBST(DEREZ)
8427 AC_SUBST(LIBWXMACRES)
8428 AC_SUBST(POSTLINK_COMMAND)
8429 AC_SUBST(MACSETFILE)
8430
8431 dnl other tools
8432 AC_SUBST(GCC)
8433 AC_SUBST(DLLTOOL)
8434
8435
8436 dnl MAKE_SET will be replaced with "MAKE=..." or nothing if make sets MAKE
8437 dnl itself (this macro is required if SUBDIRS variable is used in Makefile.am
8438 dnl - and we do use it)
8439 AC_PROG_MAKE_SET
8440
8441
8442 AC_CONFIG_HEADERS([lib/wx/include/${TOOLCHAIN_FULLNAME}/wx/setup.h:setup.h.in])
8443
8444 if test "$USE_WIN32" = 1; then
8445     AC_CONFIG_COMMANDS([rcdefs.h],
8446         [
8447             mkdir -p $outdir &&
8448             $CPP $infile | sed 's/^# *[1-9].*//;s/^ *//;/./,/^$/!d' > $outdir/rcdefs.h
8449         ],
8450         [
8451             CPP="$CPP"
8452             infile="$srcdir/include/wx/msw/genrcdefs.h"
8453             outdir="lib/wx/include/$TOOLCHAIN_FULLNAME/wx/msw"
8454         ]
8455     )
8456 fi
8457
8458 AC_CONFIG_FILES([ lib/wx/config/${TOOLCHAIN_FULLNAME}:wx-config.in ],
8459                 [ chmod +x lib/wx/config/${TOOLCHAIN_FULLNAME} ],
8460                 [ TOOLCHAIN_FULLNAME="${TOOLCHAIN_FULLNAME}" ])
8461
8462 AC_CONFIG_FILES([ lib/wx/config/inplace-${TOOLCHAIN_FULLNAME}:wx-config-inplace.in ],
8463                 [ chmod +x lib/wx/config/inplace-${TOOLCHAIN_FULLNAME} ],
8464                 [ TOOLCHAIN_FULLNAME="${TOOLCHAIN_FULLNAME}" ])
8465
8466 dnl this is used to run ifacecheck with the same flags used by the compiler
8467 dnl for the real compilation:
8468 AC_CONFIG_FILES([ utils/ifacecheck/rungccxml.sh ],
8469                 [ chmod +x utils/ifacecheck/rungccxml.sh ])
8470
8471 if test "$wx_cv_version_script" = "yes"; then
8472     AC_CONFIG_FILES(version-script)
8473 fi
8474 AC_CONFIG_FILES(Makefile)
8475
8476 AC_CONFIG_COMMANDS([wx-config],
8477                    [ rm -f wx-config
8478                      ${LN_S} lib/wx/config/inplace-${TOOLCHAIN_FULLNAME} wx-config
8479                    ],
8480                    [ TOOLCHAIN_FULLNAME="${TOOLCHAIN_FULLNAME}"
8481                      LN_S="${LN_S}"
8482                    ])
8483
8484 dnl This would give us us build dir that in every significant way
8485 dnl resembles an installed wx in prefix=$builddir.  It is troublesome
8486 dnl though in this form because AC_CONFIG_LINKS will fail for directories
8487 dnl on platforms that do not have symlinks.
8488 dnl AC_CONFIG_LINKS([ include/wx-$WX_RELEASE$WX_FLAVOUR:include ])
8489
8490 if test "$wxWITH_SUBDIRS" != "no"; then
8491 dnl Configure samples, demos etc. directories, but only if they are present:
8492 if test "$wxUSE_GUI" = "yes"; then
8493     SUBDIRS="samples demos utils"
8494 else
8495     dnl we build wxBase only
8496     dnl there are no wxBase programs in demos
8497     SUBDIRS="samples utils"
8498 fi
8499 dnl Add tests to the list of subdirs if cppunit 1.8.0+ is detected
8500 AM_PATH_CPPUNIT(1.8.0, [SUBDIRS="$SUBDIRS tests"])
8501
8502 for subdir in $SUBDIRS; do
8503     if test -d ${srcdir}/${subdir} ; then
8504         if test "$wxUSE_GUI" = "yes"; then
8505             if test ${subdir} = "samples"; then
8506                 dnl only take those samples which compile in the current
8507                 dnl configuration and which exist
8508                 makefiles="samples/Makefile.in $makefiles"
8509                 for sample in $SAMPLES_SUBDIRS; do
8510                     if test -d $srcdir/samples/$sample; then
8511                         makefiles="samples/$sample/Makefile.in $makefiles"
8512                     fi
8513                 done
8514             else
8515                 dnl assume that everything compiles for utils &c
8516                 dnl any that shouldn't be built can be added to
8517                 dnl DISABLED_UTILS, DISABLED_DEMOS
8518                 disabled_var=DISABLED_`echo $subdir | tr '[[a-z]]' '[[A-Z]]'`
8519                 eval "disabled=\$$disabled_var"
8520                 disabled=/`echo X $disabled | sed 's@ @/|/@g'`/
8521                 makefiles=`(cd $srcdir ; find $subdir -name Makefile.in) | $EGREP -v "$disabled"`
8522             fi
8523         else
8524             dnl we build wxBase only
8525             dnl don't take all samples/utils, just those which build with wxBase
8526             if test ${subdir} = "samples"; then
8527                 dnl only take those samples which compile in the current
8528                 dnl configuration and which exist
8529                 makefiles="samples/Makefile.in $makefiles"
8530                 for sample in `echo $SAMPLES_SUBDIRS`; do
8531                     if test -d $srcdir/samples/$sample; then
8532                         makefiles="samples/$sample/Makefile.in $makefiles"
8533                     fi
8534                 done
8535             elif test ${subdir} = "utils"; then
8536                 makefiles=""
8537                 for util in ifacecheck ; do
8538                     if test -d $srcdir/utils/$util ; then
8539                         makefiles="utils/$util/src/Makefile.in \
8540                                    $makefiles"
8541                     fi
8542                 done
8543             else
8544                 dnl assume that everything compiles for tests
8545                 makefiles=`(cd $srcdir ; find $subdir -name Makefile.in)`
8546             fi
8547         fi
8548
8549         for mkin in $makefiles ; do
8550             mk=`echo $mkin | sed 's/Makefile\.in/Makefile/g'`
8551             AC_CONFIG_FILES([$mk])
8552         done
8553     fi
8554 done
8555 fi dnl wxWITH_SUBDIRS
8556
8557 AC_OUTPUT
8558
8559 dnl report how we have been configured
8560 echo
8561 echo "Configured wxWidgets ${WX_VERSION} for \`${host}'"
8562 echo ""
8563 echo "  Which GUI toolkit should wxWidgets use?                 ${TOOLKIT_DESC}"
8564 echo "  Should wxWidgets be compiled into single library?       ${wxUSE_MONOLITHIC:-yes}"
8565 echo "  Should wxWidgets be linked as a shared library?         ${wxUSE_SHARED:-no}"
8566 echo $ECHO_N "  Should wxWidgets support Unicode?                       ${wxUSE_UNICODE:-no}$ECHO_C"
8567 if test "$wxUSE_UNICODE" = "yes"; then
8568     if test "$wxUSE_UNICODE_UTF8" = "yes"; then
8569         echo " (using UTF-8)"
8570     else
8571         echo " (using wchar_t)"
8572     fi
8573 else
8574     echo
8575 fi
8576
8577 echo "  What level of wxWidgets compatibility should be enabled?"
8578 echo "                                       wxWidgets 2.6      ${WXWIN_COMPATIBILITY_2_6:-no}"
8579 echo "                                       wxWidgets 2.8      ${WXWIN_COMPATIBILITY_2_8:-yes}"
8580
8581 echo "  Which libraries should wxWidgets use?"
8582 echo "                                       STL                ${wxUSE_STL}"
8583 echo "                                       jpeg               ${wxUSE_LIBJPEG-none}"
8584 echo "                                       png                ${wxUSE_LIBPNG-none}"
8585 echo "                                       regex              ${wxUSE_REGEX}"
8586 echo "                                       tiff               ${wxUSE_LIBTIFF-none}"
8587 if test "$wxUSE_X11" = 1 -o "$wxUSE_MOTIF" = 1; then
8588 echo "                                       xpm                ${wxUSE_LIBXPM-none}"
8589 fi
8590 echo "                                       zlib               ${wxUSE_ZLIB}"
8591 echo "                                       expat              ${wxUSE_EXPAT}"
8592 echo "                                       libmspack          ${wxUSE_LIBMSPACK}"
8593 echo "                                       sdl                ${wxUSE_LIBSDL}"
8594
8595 echo ""
8596
8597 dnl vi: set et sts=4 sw=4 com=\:dnl: