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