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