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