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