applied path 906264: test program
[wxWidgets.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION($Id$)dnl
3
4 AC_PREREQ(2.57)
5
6 dnl ---------------------------------------------------------------------------
7 dnl
8 dnl Top-level configure.in for wxWindows by Robert Roebling, Phil Blecker,
9 dnl Vadim Zeitlin and Ron Lee
10 dnl
11 dnl This script is under the wxWindows licence.
12 dnl
13 dnl Version: $Id$
14 dnl ---------------------------------------------------------------------------
15
16 dnl ---------------------------------------------------------------------------
17 dnl initialization
18 dnl ---------------------------------------------------------------------------
19
20 AC_INIT([wxWindows], [2.5.2], [wx-dev@lists.wxwindows.org])
21
22 dnl the file passed to AC_CONFIG_SRCDIR should be specific to our package
23 AC_CONFIG_SRCDIR([wx-config.in])
24
25 dnl sets build, host, target variables and the same with _alias
26 AC_CANONICAL_BUILD
27 AC_CANONICAL_HOST
28 AC_CANONICAL_TARGET
29
30
31 dnl When making releases do:
32 dnl
33 dnl WX_RELEASE_NUMBER += 1
34 dnl
35 dnl ..and update WX_CURRENT, WX_RELEASE and WX_AGE according to the
36 dnl following rules:
37 dnl
38 dnl    If any changes have been made to the public interface, that is if any
39 dnl    exported class, method, global or global type has been added, removed
40 dnl    or changed in any way, then do:  WX_CURRENT += 1
41 dnl
42 dnl    If source changes have been made that *do not* alter the public
43 dnl    interface then do:  WX_REVISION += 1
44 dnl    If WX_CURRENT was incremented (as above) instead do:  WX_REVISION = 0
45 dnl
46 dnl    If any public interface was added, do:  WX_AGE += 1
47 dnl    If any public interface was removed (or altered in a way effectively
48 dnl    removing the previous definition), instead do:  WX_AGE = 0
49 dnl
50 dnl When the major or minor version numbers are incremented, all the above
51 dnl variables should be reset to 0.
52 dnl
53 dnl The resulting library name will be of the form:
54 dnl   libwx_$(TOOLKIT)-$(WX_RELEASE).so.$(WX_CURRENT).$(WX_REVISION).$(WX_AGE)
55
56 WX_MAJOR_VERSION_NUMBER=2
57 WX_MINOR_VERSION_NUMBER=5
58 WX_RELEASE_NUMBER=2
59
60 WX_VERSION=$WX_MAJOR_VERSION_NUMBER.$WX_MINOR_VERSION_NUMBER.$WX_RELEASE_NUMBER
61 WX_RELEASE=$WX_MAJOR_VERSION_NUMBER.$WX_MINOR_VERSION_NUMBER
62
63 WX_MSW_VERSION=$WX_MAJOR_VERSION_NUMBER$WX_MINOR_VERSION_NUMBER$WX_RELEASE_NUMBER
64
65 WX_CURRENT=1
66 WX_REVISION=0
67 WX_AGE=0
68
69
70 dnl ------------------------------------------------------------------------
71 dnl Check platform (host system)
72 dnl ------------------------------------------------------------------------
73
74 dnl OS (assume Unix)
75 USE_UNIX=1
76 USE_OS2=0
77 USE_WIN32=0
78 USE_DOS=0
79 USE_BEOS=0
80 USE_MAC=0
81
82 dnl Unix kind
83 USE_AIX=
84 USE_BSD=                            dnl any BSD
85 USE_DARWIN=                         dnl a.k.a. Mac OS X
86 USE_FREEBSD=
87 USE_GNU=                            dnl GNU/Hurd
88 USE_HPUX=
89 USE_LINUX=
90 USE_NETBSD=
91 USE_OPENBSD=
92 USE_OSF=                            dnl OSF/1 (obsolete?)
93 USE_SGI=
94 USE_SOLARIS=                        dnl Solaris ("SunOS" >= 5)
95 USE_SUN=                            dnl SunOS or Solaris
96 USE_SUNOS=                          dnl old/real SunOS (obsolete)
97 USE_SVR4=                           dnl SysV R4
98 USE_SYSV=                           dnl any System V
99 USE_VMS=
100 USE_ULTRIX=
101 USE_UNIXWARE=
102
103 dnl hardware platform
104 USE_ALPHA=
105
106 dnl on some platforms xxx_r() functions are declared inside "#ifdef
107 dnl _REENTRANT" and it's easier to just define this symbol for these platforms
108 dnl than checking it during run-time
109 NEEDS_D_REENTRANT_FOR_R_FUNCS=0
110
111 dnl the list of all available toolkits
112 dnl
113 dnl update NUM_TOOLKITS calculation below when adding a new toolkit here!
114 ALL_TOOLKITS="COCOA GTK MAC MGL MICROWIN MOTIF MSW PM X11"
115
116 dnl NB: these wxUSE_XXX constants have value of 0 or 1 unlike all the other ones
117 dnl     which are either yes or no
118 DEFAULT_wxUSE_COCOA=0
119 DEFAULT_wxUSE_GTK=0
120 DEFAULT_wxUSE_MAC=0
121 DEFAULT_wxUSE_MGL=0
122 DEFAULT_wxUSE_MICROWIN=0
123 DEFAULT_wxUSE_MOTIF=0
124 DEFAULT_wxUSE_MSW=0
125 DEFAULT_wxUSE_PM=0
126 DEFAULT_wxUSE_X11=0
127
128 dnl these are the values which are really default for the given platform -
129 dnl they're not cached and are only used if no --with-toolkit was given *and*
130 dnl nothing was found in the cache
131 DEFAULT_DEFAULT_wxUSE_COCOA=0
132 DEFAULT_DEFAULT_wxUSE_GTK=0
133 DEFAULT_DEFAULT_wxUSE_MAC=0
134 DEFAULT_DEFAULT_wxUSE_MGL=0
135 DEFAULT_DEFAULT_wxUSE_MICROWIN=0
136 DEFAULT_DEFAULT_wxUSE_MOTIF=0
137 DEFAULT_DEFAULT_wxUSE_MSW=0
138 DEFAULT_DEFAULT_wxUSE_PM=0
139 DEFAULT_DEFAULT_wxUSE_X11=0
140
141 PROGRAM_EXT=
142 SO_SUFFIX=so
143 SAMPLES_RPATH_FLAG=
144 SAMPLES_RPATH_POSTLINK=
145
146 dnl to support a new system, you need to add its canonical name (as determined
147 dnl by config.sub or specified by the configure command line) to this "case"
148 dnl and also define the shared library flags below - search for
149 dnl SHARED_LIB_SETUP to find the exact place
150 case "${host}" in
151   *-hp-hpux* )
152     USE_HPUX=1
153     DEFAULT_DEFAULT_wxUSE_MOTIF=1
154     NEEDS_D_REENTRANT_FOR_R_FUNCS=1
155     SO_SUFFIX=sl
156     AC_DEFINE(__HPUX__)
157   ;;
158   *-*-linux* )
159     USE_LINUX=1
160     AC_DEFINE(__LINUX__)
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   *-*-gnu* | *-*-k*bsd*-gnu )
169     USE_GNU=1
170     TMP=`uname -m`
171     if test "x$TMP" = "xalpha"; then
172       USE_ALPHA=1
173       AC_DEFINE(__ALPHA__)
174     fi
175     DEFAULT_DEFAULT_wxUSE_GTK=1
176   ;;
177   *-*-irix5* | *-*-irix6* )
178     USE_SGI=1
179     USE_SVR4=1
180     AC_DEFINE(__SGI__)
181     AC_DEFINE(__SVR4__)
182     DEFAULT_DEFAULT_wxUSE_MOTIF=1
183   ;;
184   *-*-solaris2* )
185     USE_SUN=1
186     USE_SOLARIS=1
187     USE_SVR4=1
188     AC_DEFINE(__SUN__)
189     AC_DEFINE(__SOLARIS__)
190     AC_DEFINE(__SVR4__)
191     DEFAULT_DEFAULT_wxUSE_MOTIF=1
192     NEEDS_D_REENTRANT_FOR_R_FUNCS=1
193   ;;
194   *-*-sunos4* )
195     USE_SUN=1
196     USE_SUNOS=1
197     USE_BSD=1
198     AC_DEFINE(__SUN__)
199     AC_DEFINE(__SUNOS__)
200     AC_DEFINE(__BSD__)
201     DEFAULT_DEFAULT_wxUSE_MOTIF=1
202   ;;
203   *-*-freebsd*)
204     USE_BSD=1
205     USE_FREEBSD=1
206     AC_DEFINE(__FREEBSD__)
207     AC_DEFINE(__BSD__)
208     DEFAULT_DEFAULT_wxUSE_GTK=1
209   ;;
210   *-*-openbsd*)
211     USE_BSD=1
212     USE_OPENBSD=1
213     AC_DEFINE(__OPENBSD__)
214     AC_DEFINE(__BSD__)
215     DEFAULT_DEFAULT_wxUSE_GTK=1
216   ;;
217   *-*-netbsd*)
218     USE_BSD=1
219     USE_NETBSD=1
220     AC_DEFINE(__NETBSD__)
221     AC_DEFINE(__BSD__)
222     DEFAULT_DEFAULT_wxUSE_GTK=1
223   ;;
224   *-*-osf* )
225     USE_ALPHA=1
226     USE_OSF=1
227     AC_DEFINE(__ALPHA__)
228     AC_DEFINE(__OSF__)
229     DEFAULT_DEFAULT_wxUSE_MOTIF=1
230     NEEDS_D_REENTRANT_FOR_R_FUNCS=1
231   ;;
232   *-*-dgux5* )
233     USE_ALPHA=1
234     USE_SVR4=1
235     AC_DEFINE(__ALPHA__)
236     AC_DEFINE(__SVR4__)
237     DEFAULT_DEFAULT_wxUSE_MOTIF=1
238   ;;
239   *-*-sysv5* )
240     USE_SYSV=1
241     USE_SVR4=1
242     AC_DEFINE(__SYSV__)
243     AC_DEFINE(__SVR4__)
244     DEFAULT_DEFAULT_wxUSE_MOTIF=1
245   ;;
246   *-*-aix* )
247     USE_AIX=1
248     USE_SYSV=1
249     USE_SVR4=1
250     dnl quoting from http://www-1.ibm.com/servers/esdd/articles/gnu.html:
251     dnl
252     dnl     Both archive libraries and shared libraries on AIX have an .a
253     dnl     extension. This will explain why you can't link with an .so and
254     dnl     why it works with the name changed to .a.
255     SO_SUFFIX=a
256     AC_DEFINE(__AIX__)
257     AC_DEFINE(__SYSV__)
258     AC_DEFINE(__SVR4__)
259     DEFAULT_DEFAULT_wxUSE_MOTIF=1
260   ;;
261
262   *-*-*UnixWare*)
263     USE_SYSV=1
264     USE_SVR4=1
265     USE_UNIXWARE=1
266     AC_DEFINE(__UNIXWARE__)
267   ;;
268
269   *-*-cygwin* | *-*-mingw32* )
270     dnl MBN: some of the defines have been moved after toolkit detection
271     dnl      because for wxMotif/wxGTK/wxX11 to build on Cygwin
272     dnl      USE_UNIX  must be set and not USE_WIN32
273     SO_SUFFIX=dll
274     PROGRAM_EXT=".exe"
275     RESCOMP=windres
276     DEFAULT_DEFAULT_wxUSE_MSW=1
277   ;;
278
279   *-pc-msdosdjgpp )
280     USE_UNIX=0
281     USE_DOS=1
282     AC_DEFINE(__DOS__)
283     PROGRAM_EXT=".exe"
284     DEFAULT_DEFAULT_wxUSE_MGL=1
285     dnl DJGPP needs explicit -lstdc++ for some reason (VS: mayb some versions only?)
286     LIBS="$LIBS -lstdc++"
287   ;;
288
289   *-pc-os2_emx | *-pc-os2-emx )
290     AC_DEFINE(__EMX__)
291     USE_OS2=1
292     AC_DEFINE(__OS2__)
293     PROGRAM_EXT=".exe"
294     DEFAULT_DEFAULT_wxUSE_PM=1
295     dnl "c++" wrapper is not always available, so always use plain gcc.
296     CXX=gcc
297     LDFLAGS="$LDFLAGS -Zcrtdll"
298     dnl
299     dnl Some special code that's automatically added by autoconf-2.57 for OS/2
300     dnl and hopefully also by autoconf-2.58 and newer on all other platforms.
301     dnl For now however, we still need it to make sure the configure script
302     dnl works on OS/2 no matter what platform it is generated on.
303     ac_executable_extensions=".exe"
304     export ac_executable_extensions
305     dnl This strange code is necessary to deal with handling of
306     dnl backslashes by ksh and pdksh's sh variant.
307     ac_save_IFS="$IFS"
308     IFS='\\'
309     ac_TEMP_PATH=
310     for ac_dir in $PATH; do
311       IFS=$ac_save_IFS
312       if test -z "$ac_TEMP_PATH"; then
313         ac_TEMP_PATH="$ac_dir"
314       else
315         ac_TEMP_PATH="$ac_TEMP_PATH/$ac_dir"
316       fi
317     done
318     export PATH="$ac_TEMP_PATH"
319     unset ac_TEMP_PATH
320   ;;
321
322   powerpc-*-darwin* )
323     dnl PowerPC Darwin based distributions (including Mac OS X)
324     USE_BSD=1
325     USE_DARWIN=1
326     SO_SUFFIX=dylib
327     AC_DEFINE(__BSD__)
328     AC_DEFINE(__DARWIN__)
329     AC_DEFINE(__POWERPC__)
330     AC_DEFINE(TARGET_CARBON)
331     DEFAULT_DEFAULT_wxUSE_MAC=1
332   ;;
333
334   *-*-beos* )
335     dnl leave USE_UNIX on - BeOS is sufficiently Unix-like for this
336     USE_BEOS=1
337     AC_DEFINE(__BEOS__)
338   ;;
339
340   *)
341     AC_MSG_ERROR(unknown system type ${host}.)
342 esac
343
344 dnl ---------------------------------------------------------------------------
345 dnl command line options for configure
346 dnl ---------------------------------------------------------------------------
347
348 dnl the default values for all options - we collect them all here to simplify
349 dnl modification of the default values (for example, if the defaults for some
350 dnl platform should be changed, it can be done here too)
351 dnl
352 dnl NB: see also DEFAULT_wxUSE<toolkit> variables defined above
353
354 WX_ARG_CACHE_INIT
355
356 dnl useful to test the compilation with minimum options, define as 0 for normal
357 dnl usage
358 DEBUG_CONFIGURE=0
359 if test $DEBUG_CONFIGURE = 1; then
360   DEFAULT_wxUSE_UNIVERSAL=no
361   DEFAULT_wxUSE_STL=no
362
363   DEFAULT_wxUSE_NANOX=no
364
365   DEFAULT_wxUSE_THREADS=yes
366
367   DEFAULT_wxUSE_SHARED=yes
368   DEFAULT_wxUSE_OPTIMISE=no
369   DEFAULT_wxUSE_PROFILE=no
370   DEFAULT_wxUSE_NO_DEPS=no
371   DEFAULT_wxUSE_NO_RTTI=no
372   DEFAULT_wxUSE_NO_EXCEPTIONS=no
373   DEFAULT_wxUSE_PERMISSIVE=no
374   DEFAULT_wxUSE_DEBUG_FLAG=yes
375   DEFAULT_wxUSE_DEBUG_INFO=yes
376   DEFAULT_wxUSE_DEBUG_GDB=yes
377   DEFAULT_wxUSE_MEM_TRACING=no
378   DEFAULT_wxUSE_DEBUG_CONTEXT=no
379   DEFAULT_wxUSE_DMALLOC=no
380   DEFAULT_wxUSE_APPLE_IEEE=no
381
382   DEFAULT_wxUSE_EXCEPTIONS=no
383   DEFAULT_wxUSE_LOG=yes
384   DEFAULT_wxUSE_LOGWINDOW=no
385   DEFAULT_wxUSE_LOGGUI=no
386   DEFAULT_wxUSE_LOGDIALOG=no
387
388   DEFAULT_wxUSE_GUI=yes
389   DEFAULT_wxUSE_CONTROLS=no
390
391   DEFAULT_wxUSE_REGEX=no
392   DEFAULT_wxUSE_XML=no
393   DEFAULT_wxUSE_EXPAT=no
394   DEFAULT_wxUSE_ZLIB=no
395   DEFAULT_wxUSE_LIBPNG=no
396   DEFAULT_wxUSE_LIBJPEG=no
397   DEFAULT_wxUSE_LIBTIFF=no
398   DEFAULT_wxUSE_LIBXPM=no
399   DEFAULT_wxUSE_LIBMSPACK=no
400   DEFAULT_wxUSE_LIBSDL=no
401   DEFAULT_wxUSE_ODBC=no
402   DEFAULT_wxUSE_OPENGL=no
403
404   DEFAULT_wxUSE_ON_FATAL_EXCEPTION=no
405   DEFAULT_wxUSE_SNGLINST_CHECKER=no
406   DEFAULT_wxUSE_STD_IOSTREAM=no
407   DEFAULT_wxUSE_CMDLINE_PARSER=no
408   DEFAULT_wxUSE_DATETIME=no
409   DEFAULT_wxUSE_TIMER=no
410   DEFAULT_wxUSE_STOPWATCH=no
411   DEFAULT_wxUSE_FILE=no
412   DEFAULT_wxUSE_FFILE=no
413   DEFAULT_wxUSE_TEXTBUFFER=no
414   DEFAULT_wxUSE_TEXTFILE=no
415   DEFAULT_wxUSE_SOUND=no
416   DEFAULT_wxUSE_INTL=no
417   DEFAULT_wxUSE_CONFIG=no
418   DEFAULT_wxUSE_FONTMAP=no
419   DEFAULT_wxUSE_STREAMS=no
420   DEFAULT_wxUSE_SOCKETS=no
421   DEFAULT_wxUSE_OLE=no
422   DEFAULT_wxUSE_DATAOBJ=no
423   DEFAULT_wxUSE_DIALUP_MANAGER=no
424   DEFAULT_wxUSE_JOYSTICK=no
425   DEFAULT_wxUSE_DYNLIB_CLASS=no
426   DEFAULT_wxUSE_DYNAMIC_LOADER=no
427   DEFAULT_wxUSE_LONGLONG=no
428   DEFAULT_wxUSE_GEOMETRY=no
429
430   DEFAULT_wxUSE_AFM_FOR_POSTSCRIPT=no
431   DEFAULT_wxUSE_NORMALIZED_PS_FONTS=no
432   DEFAULT_wxUSE_POSTSCRIPT=no
433
434   DEFAULT_wxUSE_CLIPBOARD=no
435   DEFAULT_wxUSE_TOOLTIPS=no
436   DEFAULT_wxUSE_DRAG_AND_DROP=no
437   DEFAULT_wxUSE_DRAGIMAGE=no
438   DEFAULT_wxUSE_SPLINES=no
439
440   DEFAULT_wxUSE_MDI_ARCHITECTURE=no
441   DEFAULT_wxUSE_DOC_VIEW_ARCHITECTURE=no
442   DEFAULT_wxUSE_PRINTING_ARCHITECTURE=no
443
444   DEFAULT_wxUSE_RESOURCES=no
445   DEFAULT_wxUSE_CONSTRAINTS=no
446   DEFAULT_wxUSE_IPC=no
447   DEFAULT_wxUSE_HELP=no
448   DEFAULT_wxUSE_MS_HTML_HELP=no
449   DEFAULT_wxUSE_WXHTML_HELP=no
450   DEFAULT_wxUSE_TREELAYOUT=no
451   DEFAULT_wxUSE_METAFILE=no
452   DEFAULT_wxUSE_MIMETYPE=no
453   DEFAULT_wxUSE_SYSTEM_OPTIONS=no
454   DEFAULT_wxUSE_PROTOCOL=no
455   DEFAULT_wxUSE_PROTOCOL_HTTP=no
456   DEFAULT_wxUSE_PROTOCOL_FTP=no
457   DEFAULT_wxUSE_PROTOCOL_FILE=no
458   DEFAULT_wxUSE_URL=no
459
460   DEFAULT_wxUSE_COMMONDLGS=no
461   DEFAULT_wxUSE_CHOICEDLG=no
462   DEFAULT_wxUSE_COLOURDLG=no
463   DEFAULT_wxUSE_DIRDLG=no
464   DEFAULT_wxUSE_FILEDLG=no
465   DEFAULT_wxUSE_FINDREPLDLG=no
466   DEFAULT_wxUSE_FONTDLG=no
467   DEFAULT_wxUSE_MSGDLG=no
468   DEFAULT_wxUSE_NUMBERDLG=no
469   DEFAULT_wxUSE_TEXTDLG=no
470   DEFAULT_wxUSE_SPLASH=no
471   DEFAULT_wxUSE_STARTUP_TIPS=no
472   DEFAULT_wxUSE_PROGRESSDLG=no
473   DEFAULT_wxUSE_WIZARDDLG=no
474
475   DEFAULT_wxUSE_MENUS=no
476   DEFAULT_wxUSE_MINIFRAME=no
477   DEFAULT_wxUSE_HTML=no
478   DEFAULT_wxUSE_FILESYSTEM=no
479   DEFAULT_wxUSE_FS_INET=no
480   DEFAULT_wxUSE_FS_ZIP=no
481   DEFAULT_wxUSE_BUSYINFO=no
482   DEFAULT_wxUSE_ZIPSTREAM=no
483   DEFAULT_wxUSE_GZSTREAM=no
484   DEFAULT_wxUSE_VALIDATORS=no
485
486   DEFAULT_wxUSE_ACCEL=no
487   DEFAULT_wxUSE_BUTTON=no
488   DEFAULT_wxUSE_BMPBUTTON=no
489   DEFAULT_wxUSE_CALCTRL=no
490   DEFAULT_wxUSE_CARET=no
491   DEFAULT_wxUSE_CHECKBOX=no
492   DEFAULT_wxUSE_CHECKLST=no
493   DEFAULT_wxUSE_CHOICE=no
494   DEFAULT_wxUSE_COMBOBOX=no
495   DEFAULT_wxUSE_DISPLAY=no
496   DEFAULT_wxUSE_GAUGE=no
497   DEFAULT_wxUSE_GRID=no
498   DEFAULT_wxUSE_IMAGLIST=no
499   DEFAULT_wxUSE_LISTBOOK=no
500   DEFAULT_wxUSE_LISTBOX=no
501   DEFAULT_wxUSE_LISTCTRL=no
502   DEFAULT_wxUSE_NOTEBOOK=no
503   DEFAULT_wxUSE_RADIOBOX=no
504   DEFAULT_wxUSE_RADIOBTN=no
505   DEFAULT_wxUSE_SASH=no
506   DEFAULT_wxUSE_SCROLLBAR=no
507   DEFAULT_wxUSE_SLIDER=no
508   DEFAULT_wxUSE_SPINBTN=no
509   DEFAULT_wxUSE_SPINCTRL=no
510   DEFAULT_wxUSE_SPLITTER=no
511   DEFAULT_wxUSE_STATBMP=no
512   DEFAULT_wxUSE_STATBOX=no
513   DEFAULT_wxUSE_STATLINE=no
514   DEFAULT_wxUSE_STATTEXT=no
515   DEFAULT_wxUSE_STATUSBAR=yes
516   DEFAULT_wxUSE_TABDIALOG=no
517   DEFAULT_wxUSE_TEXTCTRL=no
518   DEFAULT_wxUSE_TOGGLEBTN=no
519   DEFAULT_wxUSE_TOOLBAR=no
520   DEFAULT_wxUSE_TOOLBAR_NATIVE=no
521   DEFAULT_wxUSE_TOOLBAR_SIMPLE=no
522   DEFAULT_wxUSE_TREECTRL=no
523   DEFAULT_wxUSE_POPUPWIN=no
524   DEFAULT_wxUSE_TIPWINDOW=no
525
526   DEFAULT_wxUSE_UNICODE=no
527   DEFAULT_wxUSE_UNICODE_MSLU=no
528   DEFAULT_wxUSE_WCSRTOMBS=no
529
530   DEFAULT_wxUSE_PALETTE=no
531   DEFAULT_wxUSE_IMAGE=no
532   DEFAULT_wxUSE_GIF=no
533   DEFAULT_wxUSE_PCX=no
534   DEFAULT_wxUSE_PNM=no
535   DEFAULT_wxUSE_IFF=no
536   DEFAULT_wxUSE_XPM=no
537   DEFAULT_wxUSE_ICO_CUR=no
538   DEFAULT_wxUSE_ACCESSIBILITY=no
539   
540   DEFAULT_wxUSE_MONOLITHIC=no
541   DEFAULT_wxUSE_PLUGINS=no
542   DEFAULT_wxUSE_OFFICIAL_BUILD=no
543 else
544   DEFAULT_wxUSE_UNIVERSAL=no
545   DEFAULT_wxUSE_STL=no
546
547   DEFAULT_wxUSE_NANOX=no
548
549   DEFAULT_wxUSE_THREADS=yes
550
551   DEFAULT_wxUSE_SHARED=yes
552   DEFAULT_wxUSE_OPTIMISE=yes
553   DEFAULT_wxUSE_PROFILE=no
554   DEFAULT_wxUSE_NO_DEPS=no
555   DEFAULT_wxUSE_NO_RTTI=no
556   DEFAULT_wxUSE_NO_EXCEPTIONS=no
557   DEFAULT_wxUSE_PERMISSIVE=no
558   DEFAULT_wxUSE_DEBUG_FLAG=no
559   DEFAULT_wxUSE_DEBUG_INFO=no
560   DEFAULT_wxUSE_DEBUG_GDB=no
561   DEFAULT_wxUSE_MEM_TRACING=no
562   DEFAULT_wxUSE_DEBUG_CONTEXT=no
563   DEFAULT_wxUSE_DMALLOC=no
564   DEFAULT_wxUSE_APPLE_IEEE=yes
565
566   DEFAULT_wxUSE_EXCEPTIONS=yes
567   DEFAULT_wxUSE_LOG=yes
568   DEFAULT_wxUSE_LOGWINDOW=yes
569   DEFAULT_wxUSE_LOGGUI=yes
570   DEFAULT_wxUSE_LOGDIALOG=yes
571
572   DEFAULT_wxUSE_GUI=yes
573
574   DEFAULT_wxUSE_REGEX=yes
575   DEFAULT_wxUSE_XML=yes
576   DEFAULT_wxUSE_EXPAT=yes
577   DEFAULT_wxUSE_ZLIB=yes
578   DEFAULT_wxUSE_LIBPNG=yes
579   DEFAULT_wxUSE_LIBJPEG=yes
580   DEFAULT_wxUSE_LIBTIFF=yes
581   DEFAULT_wxUSE_LIBXPM=yes
582   DEFAULT_wxUSE_LIBMSPACK=yes
583   DEFAULT_wxUSE_LIBSDL=no
584   DEFAULT_wxUSE_ODBC=no
585   DEFAULT_wxUSE_OPENGL=no
586
587   DEFAULT_wxUSE_ON_FATAL_EXCEPTION=yes
588   DEFAULT_wxUSE_SNGLINST_CHECKER=yes
589   DEFAULT_wxUSE_STD_IOSTREAM=no
590   DEFAULT_wxUSE_CMDLINE_PARSER=yes
591   DEFAULT_wxUSE_DATETIME=yes
592   DEFAULT_wxUSE_TIMER=yes
593   DEFAULT_wxUSE_STOPWATCH=yes
594   DEFAULT_wxUSE_FILE=yes
595   DEFAULT_wxUSE_FFILE=yes
596   DEFAULT_wxUSE_TEXTBUFFER=yes
597   DEFAULT_wxUSE_TEXTFILE=yes
598   DEFAULT_wxUSE_SOUND=yes
599   DEFAULT_wxUSE_INTL=yes
600   DEFAULT_wxUSE_CONFIG=yes
601   DEFAULT_wxUSE_FONTMAP=yes
602   DEFAULT_wxUSE_STREAMS=yes
603   DEFAULT_wxUSE_SOCKETS=yes
604   DEFAULT_wxUSE_OLE=yes
605   DEFAULT_wxUSE_DATAOBJ=yes
606   DEFAULT_wxUSE_DIALUP_MANAGER=yes
607   DEFAULT_wxUSE_JOYSTICK=yes
608   DEFAULT_wxUSE_DYNLIB_CLASS=yes
609   DEFAULT_wxUSE_DYNAMIC_LOADER=yes
610   DEFAULT_wxUSE_LONGLONG=yes
611   DEFAULT_wxUSE_GEOMETRY=yes
612
613   DEFAULT_wxUSE_AFM_FOR_POSTSCRIPT=yes
614   DEFAULT_wxUSE_NORMALIZED_PS_FONTS=yes
615   DEFAULT_wxUSE_POSTSCRIPT=yes
616
617   DEFAULT_wxUSE_CLIPBOARD=yes
618   DEFAULT_wxUSE_TOOLTIPS=yes
619   DEFAULT_wxUSE_DRAG_AND_DROP=yes
620   DEFAULT_wxUSE_DRAGIMAGE=yes
621   DEFAULT_wxUSE_SPLINES=yes
622
623   DEFAULT_wxUSE_MDI_ARCHITECTURE=yes
624   DEFAULT_wxUSE_DOC_VIEW_ARCHITECTURE=yes
625   DEFAULT_wxUSE_PRINTING_ARCHITECTURE=yes
626
627   DEFAULT_wxUSE_RESOURCES=no
628   DEFAULT_wxUSE_CONSTRAINTS=yes
629   DEFAULT_wxUSE_IPC=yes
630   DEFAULT_wxUSE_HELP=yes
631   DEFAULT_wxUSE_MS_HTML_HELP=yes
632   DEFAULT_wxUSE_WXHTML_HELP=yes
633   DEFAULT_wxUSE_TREELAYOUT=yes
634   DEFAULT_wxUSE_METAFILE=yes
635   DEFAULT_wxUSE_MIMETYPE=yes
636   DEFAULT_wxUSE_SYSTEM_OPTIONS=yes
637   DEFAULT_wxUSE_PROTOCOL=yes
638   DEFAULT_wxUSE_PROTOCOL_HTTP=yes
639   DEFAULT_wxUSE_PROTOCOL_FTP=yes
640   DEFAULT_wxUSE_PROTOCOL_FILE=yes
641   DEFAULT_wxUSE_URL=yes
642
643   DEFAULT_wxUSE_COMMONDLGS=yes
644   DEFAULT_wxUSE_CHOICEDLG=yes
645   DEFAULT_wxUSE_COLOURDLG=yes
646   DEFAULT_wxUSE_DIRDLG=yes
647   DEFAULT_wxUSE_FILEDLG=yes
648   DEFAULT_wxUSE_FINDREPLDLG=yes
649   DEFAULT_wxUSE_FONTDLG=yes
650   DEFAULT_wxUSE_MSGDLG=yes
651   DEFAULT_wxUSE_NUMBERDLG=yes
652   DEFAULT_wxUSE_TEXTDLG=yes
653   DEFAULT_wxUSE_SPLASH=yes
654   DEFAULT_wxUSE_STARTUP_TIPS=yes
655   DEFAULT_wxUSE_PROGRESSDLG=yes
656   DEFAULT_wxUSE_WIZARDDLG=yes
657
658   DEFAULT_wxUSE_MENUS=yes
659   DEFAULT_wxUSE_MINIFRAME=yes
660   DEFAULT_wxUSE_HTML=yes
661   DEFAULT_wxUSE_FILESYSTEM=yes
662   DEFAULT_wxUSE_FS_INET=yes
663   DEFAULT_wxUSE_FS_ZIP=yes
664   DEFAULT_wxUSE_BUSYINFO=yes
665   DEFAULT_wxUSE_ZIPSTREAM=yes
666   DEFAULT_wxUSE_GZSTREAM=yes
667   DEFAULT_wxUSE_VALIDATORS=yes
668
669   DEFAULT_wxUSE_ACCEL=yes
670   DEFAULT_wxUSE_BUTTON=yes
671   DEFAULT_wxUSE_BMPBUTTON=yes
672   DEFAULT_wxUSE_CALCTRL=yes
673   DEFAULT_wxUSE_CARET=yes
674   DEFAULT_wxUSE_CHECKBOX=yes
675   DEFAULT_wxUSE_CHECKLST=yes
676   DEFAULT_wxUSE_CHOICE=yes
677   DEFAULT_wxUSE_COMBOBOX=yes
678   DEFAULT_wxUSE_DISPLAY=no
679   DEFAULT_wxUSE_GAUGE=yes
680   DEFAULT_wxUSE_GRID=yes
681   DEFAULT_wxUSE_IMAGLIST=yes
682   DEFAULT_wxUSE_LISTBOOK=yes
683   DEFAULT_wxUSE_LISTBOX=yes
684   DEFAULT_wxUSE_LISTCTRL=yes
685   DEFAULT_wxUSE_NOTEBOOK=yes
686   DEFAULT_wxUSE_RADIOBOX=yes
687   DEFAULT_wxUSE_RADIOBTN=yes
688   DEFAULT_wxUSE_SASH=yes
689   DEFAULT_wxUSE_SCROLLBAR=yes
690   DEFAULT_wxUSE_SLIDER=yes
691   DEFAULT_wxUSE_SPINBTN=yes
692   DEFAULT_wxUSE_SPINCTRL=yes
693   DEFAULT_wxUSE_SPLITTER=yes
694   DEFAULT_wxUSE_STATBMP=yes
695   DEFAULT_wxUSE_STATBOX=yes
696   DEFAULT_wxUSE_STATLINE=yes
697   DEFAULT_wxUSE_STATTEXT=yes
698   DEFAULT_wxUSE_STATUSBAR=yes
699   DEFAULT_wxUSE_TABDIALOG=no
700   DEFAULT_wxUSE_TEXTCTRL=yes
701   DEFAULT_wxUSE_TOGGLEBTN=yes
702   DEFAULT_wxUSE_TOOLBAR=yes
703   DEFAULT_wxUSE_TOOLBAR_NATIVE=yes
704   DEFAULT_wxUSE_TOOLBAR_SIMPLE=yes
705   DEFAULT_wxUSE_TREECTRL=yes
706   DEFAULT_wxUSE_POPUPWIN=yes
707   DEFAULT_wxUSE_TIPWINDOW=yes
708
709   DEFAULT_wxUSE_UNICODE=no
710   DEFAULT_wxUSE_UNICODE_MSLU=yes
711   DEFAULT_wxUSE_WCSRTOMBS=no
712
713   DEFAULT_wxUSE_PALETTE=yes
714   DEFAULT_wxUSE_IMAGE=yes
715   DEFAULT_wxUSE_GIF=yes
716   DEFAULT_wxUSE_PCX=yes
717   DEFAULT_wxUSE_IFF=no
718   DEFAULT_wxUSE_PNM=yes
719   DEFAULT_wxUSE_XPM=yes
720   DEFAULT_wxUSE_ICO_CUR=yes
721   DEFAULT_wxUSE_ACCESSIBILITY=no
722   
723   DEFAULT_wxUSE_MONOLITHIC=no
724   DEFAULT_wxUSE_PLUGINS=no
725   DEFAULT_wxUSE_OFFICIAL_BUILD=no
726 fi
727
728 dnl WX_ARG_WITH should be used to select whether an external package will be
729 dnl used or not, to configure compile-time features of this package itself,
730 dnl use WX_ARG_ENABLE instead
731
732 dnl ============================
733 dnl external package dependecies
734 dnl ============================
735
736 dnl these options use AC_ARG_WITH and not WX_ARG_WITH on purpose - we cache
737 dnl these values manually
738 for toolkit in `echo $ALL_TOOLKITS`; do
739   LINE=`grep "wxUSE_$toolkit=" ${wx_arg_cache_file}`
740   if test "x$LINE" != "x" ; then
741     has_toolkit_in_cache=1
742     eval "DEFAULT_$LINE"
743     eval "CACHE_$toolkit=1"
744   fi
745 done
746
747 dnl ---------------------------------------------------------------------------
748 dnl --disable-gui will build only non-GUI part of wxWindows: check for this
749 dnl first to disable many other switches if it's given
750 dnl
751 dnl NB: this is still in testing stage, don't use if you don't know what you're
752 dnl     doing
753 dnl ---------------------------------------------------------------------------
754
755 WX_ARG_ENABLE(gui,         [  --enable-gui            use GUI classes], wxUSE_GUI)
756 WX_ARG_ENABLE(monolithic,  [  --enable-monolithic     build wxWindows as single library], wxUSE_MONOLITHIC)
757 WX_ARG_ENABLE(plugins,     [  --enable-plugins        build parts of wxWindows as loadable components], wxUSE_PLUGINS)
758
759 if test "$wxUSE_GUI" = "yes"; then
760
761 WX_ARG_ENABLE(universal,   [  --enable-universal      use wxWindows GUI controls instead of native ones], wxUSE_UNIVERSAL)
762 AC_ARG_WITH(gtk,           [  --with-gtk              use GTK+], [wxUSE_GTK="$withval" CACHE_GTK=1 TOOLKIT_GIVEN=1])
763 AC_ARG_WITH(motif,         [  --with-motif            use Motif/Lesstif], [wxUSE_MOTIF="$withval" CACHE_MOTIF=1 TOOLKIT_GIVEN=1])
764 AC_ARG_WITH(mac,           [  --with-mac              use Mac OS X], [wxUSE_MAC="$withval" TOOLKIT_GIVEN=1])
765 AC_ARG_WITH(cocoa,         [  --with-cocoa            use Cocoa], [wxUSE_COCOA="$withval" TOOLKIT_GIVEN=1])
766 AC_ARG_WITH(wine,          [  --with-wine             use Wine], [wxUSE_WINE="$withval" CACHE_WINE=1])
767 AC_ARG_WITH(msw,           [  --with-msw              use MS-Windows], [wxUSE_MSW="$withval" CACHE_MSW=1 TOOLKIT_GIVEN=1])
768 AC_ARG_WITH(pm,            [  --with-pm               use OS/2 Presentation Manager], [wxUSE_PM="$withval" CACHE_PM=1 TOOLKIT_GIVEN=1])
769 AC_ARG_WITH(mgl,           [  --with-mgl              use SciTech MGL], [wxUSE_MGL="$withval" wxUSE_UNIVERSAL="yes" CACHE_MGL=1 TOOLKIT_GIVEN=1])
770 AC_ARG_WITH(microwin,      [  --with-microwin         use MicroWindows], [wxUSE_MICROWIN="$withval" CACHE_MICROWIN=1 TOOLKIT_GIVEN=1])
771 AC_ARG_WITH(x11,           [  --with-x11              use X11], [wxUSE_X11="$withval" wxUSE_UNIVERSAL="yes" CACHE_X11=1 TOOLKIT_GIVEN=1])
772 WX_ARG_ENABLE(nanox,       [  --enable-nanox          use NanoX], wxUSE_NANOX)
773
774 WX_ARG_ENABLE(gtk2,        [  --enable-gtk2           use GTK+ 2.0 if available (EXPERIMENTAL)], wxUSE_GTK2)
775 WX_ARG_ENABLE(gpe,         [  --enable-gpe            use GNOME PDA Environment features if possible], wxUSE_GPE)
776
777 WX_ARG_SYS_WITH(libpng,    [  --with-libpng           use libpng (PNG image format)], wxUSE_LIBPNG)
778 WX_ARG_SYS_WITH(libjpeg,   [  --with-libjpeg          use libjpeg (JPEG file format)], wxUSE_LIBJPEG)
779 WX_ARG_SYS_WITH(libtiff,   [  --with-libtiff          use libtiff (TIFF file format)], wxUSE_LIBTIFF)
780 WX_ARG_SYS_WITH(libxpm,    [  --with-libxpm           use libxpm (XPM file format)], wxUSE_LIBXPM)
781 WX_ARG_WITH(libmspack,     [  --with-libmspack        use libmspack (CHM help files loading)], wxUSE_LIBMSPACK)
782 WX_ARG_WITH(sdl,           [  --with-sdl              use SDL for audio on Unix], wxUSE_LIBSDL)
783 WX_ARG_WITH(opengl,        [  --with-opengl           use OpenGL (or Mesa)], wxUSE_OPENGL)
784
785 fi
786 dnl for GUI only
787
788 WX_ARG_WITH(dmalloc,       [  --with-dmalloc          use dmalloc library (http://dmalloc.com/)], wxUSE_DMALLOC)
789 WX_ARG_SYS_WITH(regex,     [  --with-regex            enable support for wxRegEx class], wxUSE_REGEX)
790 WX_ARG_SYS_WITH(zlib,      [  --with-zlib             use zlib for LZW compression], wxUSE_ZLIB)
791 WX_ARG_SYS_WITH(odbc,      [  --with-odbc             use the IODBC and wxODBC classes], wxUSE_ODBC)
792 WX_ARG_SYS_WITH(expat,     [  --with-expat            enable XML support using expat parser], wxUSE_EXPAT)
793
794 dnl ---------------------------------------------------------------------------
795 dnl compile options
796 dnl ---------------------------------------------------------------------------
797
798 WX_ARG_ENABLE(shared,      [  --enable-shared         create shared library code], wxUSE_SHARED)
799 WX_ARG_ENABLE(optimise,    [  --enable-optimise       create optimised code], wxUSE_OPTIMISE)
800 WX_ARG_ENABLE(debug,       [  --enable-debug          same as debug_flag and debug_info], wxUSE_DEBUG)
801 WX_ARG_ENABLE(stl,         [  --enable-stl            use STL for containers], wxUSE_STL)
802
803 if test "$wxUSE_DEBUG" = "yes"; then
804   DEFAULT_wxUSE_DEBUG_FLAG=yes
805   DEFAULT_wxUSE_DEBUG_INFO=yes
806   BUILD=debug
807 elif test "$wxUSE_DEBUG" = "no"; then
808   DEFAULT_wxUSE_DEBUG_FLAG=no
809   DEFAULT_wxUSE_DEBUG_INFO=no
810   BUILD=release
811 fi
812
813 WX_ARG_ENABLE(debug_flag,    [  --enable-debug_flag     set __WXDEBUG__ flag (recommended for developers!)], wxUSE_DEBUG_FLAG)
814 WX_ARG_ENABLE(debug_info,    [  --enable-debug_info     create code with debugging information], wxUSE_DEBUG_INFO)
815 WX_ARG_ENABLE(debug_gdb,     [  --enable-debug_gdb      create code with extra GDB debugging information], wxUSE_DEBUG_GDB)
816 WX_ARG_ENABLE(debug_cntxt,   [  --enable-debug_cntxt    use wxDebugContext], wxUSE_DEBUG_CONTEXT)
817 WX_ARG_ENABLE(mem_tracing,   [  --enable-mem_tracing    create code with memory tracing], wxUSE_MEM_TRACING)
818 WX_ARG_ENABLE(profile,       [  --enable-profile        create code with profiling information], wxUSE_PROFILE)
819 WX_ARG_ENABLE(no_rtti,       [  --enable-no_rtti        create code without RTTI information], wxUSE_NO_RTTI)
820 WX_ARG_ENABLE(no_exceptions, [  --enable-no_exceptions  create code without C++ exceptions handling], wxUSE_NO_EXCEPTIONS)
821 WX_ARG_ENABLE(permissive,    [  --enable-permissive     compile code disregarding strict ANSI], wxUSE_PERMISSIVE)
822 WX_ARG_ENABLE(no_deps,       [  --enable-no_deps        create code without dependency information], wxUSE_NO_DEPS)
823
824 WX_ARG_ENABLE(compat22,      [  --enable-compat22       enable wxWindows 2.2 compatibility], WXWIN_COMPATIBILITY_2_2)
825 WX_ARG_ENABLE(compat24,      [  --disable-compat24      disable wxWindows 2.4 compatibility], WXWIN_COMPATIBILITY_2_4, disable)
826
827 AC_ARG_ENABLE(rpath,         [  --enable-rpath=DIR      output the rpath flag from wx-config], [wxRPATH_DIR="$enableval"])
828
829 if test "$wxRPATH_DIR" != "" -a "$wxRPATH_DIR" != "disable"; then
830    WXCONFIG_RPATH="-Wl,-rpath -Wl,$wxRPATH_DIR"
831 fi
832
833
834 dnl ---------------------------------------------------------------------------
835 dnl (small) optional non GUI classes
836 dnl ---------------------------------------------------------------------------
837
838 WX_ARG_ENABLE(intl,          [  --enable-intl           use internationalization system], wxUSE_INTL)
839 WX_ARG_ENABLE(config,        [  --enable-config         use wxConfig (and derived) classes], wxUSE_CONFIG)
840
841 WX_ARG_ENABLE(protocols,     [  --enable-protocols      use wxProtocol and derived classes], wxUSE_PROTOCOL)
842 WX_ARG_ENABLE(ftp,           [  --enable-ftp            use wxFTP (requires wxProtocol], wxUSE_PROTOCOL_FTP)
843 WX_ARG_ENABLE(http,          [  --enable-http           use wxHTTP (requires wxProtocol], wxUSE_PROTOCOL_HTTP)
844 WX_ARG_ENABLE(fileproto,     [  --enable-fileproto      use wxFileProto class (requires wxProtocol], wxUSE_PROTOCOL_FILE)
845 WX_ARG_ENABLE(sockets,       [  --enable-sockets        use socket/network classes], wxUSE_SOCKETS)
846 WX_ARG_ENABLE(ole,           [  --enable-ole            use OLE classes (Win32 only)], wxUSE_OLE)
847 WX_ARG_ENABLE(dataobj,       [  --enable-dataobj        use data object classes], wxUSE_DATAOBJ)
848
849 WX_ARG_ENABLE(ipc,           [  --enable-ipc            use interprocess communication (wxSocket etc.)], wxUSE_IPC)
850
851 dnl please keep the settings below in alphabetical order
852 WX_ARG_ENABLE(apple_ieee,    [  --enable-apple_ieee     use the Apple IEEE codec], wxUSE_APPLE_IEEE)
853 WX_ARG_ENABLE(catch_segvs,   [  --enable-catch_segvs    catch signals in wxApp::OnFatalException (Unix only)], wxUSE_ON_FATAL_EXCEPTION)
854 WX_ARG_ENABLE(cmdline,       [  --enable-cmdline        use wxCmdLineParser class], wxUSE_CMDLINE_PARSER)
855 WX_ARG_ENABLE(datetime,      [  --enable-datetime       use wxDateTime class], wxUSE_DATETIME)
856 WX_ARG_ENABLE(dialupman,     [  --enable-dialupman      use dialup network classes], wxUSE_DIALUP_MANAGER)
857 WX_ARG_ENABLE(dynlib,        [  --enable-dynlib         use wxLibrary class for DLL loading], wxUSE_DYNLIB_CLASS)
858 WX_ARG_ENABLE(dynamicloader, [  --enable-dynamicloader  use (new) wxDynamicLibrary class], wxUSE_DYNAMIC_LOADER)
859 WX_ARG_ENABLE(exceptions,    [  --enable-exceptions     build exception-safe library], wxUSE_EXCEPTIONS)
860 WX_ARG_ENABLE(ffile,         [  --enable-ffile          use wxFFile class], wxUSE_FFILE)
861 WX_ARG_ENABLE(file,          [  --enable-file           use wxFile class], wxUSE_FILE)
862 WX_ARG_ENABLE(filesystem,    [  --enable-filesystem     use virtual file systems classes], wxUSE_FILESYSTEM)
863 WX_ARG_ENABLE(fontmap,       [  --enable-fontmap        use font encodings conversion classes], wxUSE_FONTMAP)
864 WX_ARG_ENABLE(fs_inet,       [  --enable-fs_inet        use virtual HTTP/FTP filesystems], wxUSE_FS_INET)
865 WX_ARG_ENABLE(fs_zip,        [  --enable-fs_zip         use virtual ZIP filesystems], wxUSE_FS_ZIP)
866 WX_ARG_ENABLE(geometry,      [  --enable-geometry       use geometry class], wxUSE_GEOMETRY)
867 WX_ARG_ENABLE(log,           [  --enable-log            use logging system], wxUSE_LOG)
868 WX_ARG_ENABLE(longlong,      [  --enable-longlong       use wxLongLong class], wxUSE_LONGLONG)
869 WX_ARG_ENABLE(mimetype,      [  --enable-mimetype       use wxMimeTypesManager], wxUSE_MIMETYPE)
870 WX_ARG_ENABLE(mslu,          [  --enable-mslu           use MS Layer for Unicode on Windows 9x (Win32 only)], wxUSE_UNICODE_MSLU)
871 WX_ARG_ENABLE(snglinst,      [  --enable-snglinst       use wxSingleInstanceChecker class], wxUSE_SNGLINST_CHECKER)
872 WX_ARG_ENABLE(streams,       [  --enable-streams        use wxStream etc classes], wxUSE_STREAMS)
873 WX_ARG_ENABLE(std_iostreams, [  --enable-std_iostreams  use standard C++ stream classes], wxUSE_STD_IOSTREAM)
874 WX_ARG_ENABLE(stopwatch,     [  --enable-stopwatch      use wxStopWatch class], wxUSE_STOPWATCH)
875 WX_ARG_ENABLE(system_options,[  --enable-sysoptions     use wxSystemOptions], wxUSE_SYSTEM_OPTIONS)
876 WX_ARG_ENABLE(textbuf,       [  --enable-textbuf        use wxTextBuffer class], wxUSE_TEXTBUFFER)
877 WX_ARG_ENABLE(textfile,      [  --enable-textfile       use wxTextFile class], wxUSE_TEXTFILE)
878 WX_ARG_ENABLE(timer,         [  --enable-timer          use wxTimer class], wxUSE_TIMER)
879 WX_ARG_ENABLE(unicode,       [  --enable-unicode        compile wxString with Unicode support], wxUSE_UNICODE)
880 WX_ARG_ENABLE(sound,         [  --enable-sound          use wxSound class], wxUSE_SOUND)
881 WX_ARG_ENABLE(wxprintfv,     [  --enable-wxprintfv      use wxWindows implementation of vprintf()], wxUSE_EXPERIMENTAL_PRINTF)
882 WX_ARG_ENABLE(zipstream,     [  --enable-zipstream      use wxZipInputStream], wxUSE_ZIPSTREAM)
883 WX_ARG_ENABLE(gzstream,      [  --enable-gzstream       use wxGzipInputStream], wxUSE_GZSTREAM)
884
885 WX_ARG_ENABLE(url,           [  --enable-url            use wxURL class], wxUSE_URL)
886 WX_ARG_ENABLE(protocol,      [  --enable-protocol       use wxProtocol class], wxUSE_PROTOCOL)
887 WX_ARG_ENABLE(protocol_http, [  --enable-protocol-http  HTTP support in wxProtocol], wxUSE_PROTOCOL_HTTP)
888 WX_ARG_ENABLE(protocol_ftp,  [  --enable-protocol-ftp   FTP support in wxProtocol], wxUSE_PROTOCOL_FTP)
889 WX_ARG_ENABLE(protocol_file, [  --enable-protocol-file  FILE support in wxProtocol], wxUSE_PROTOCOL_FILE)
890
891
892 dnl ---------------------------------------------------------------------------
893 dnl "big" options (i.e. those which change a lot of things throughout the library)
894 dnl ---------------------------------------------------------------------------
895
896 WX_ARG_ENABLE(threads,     [  --enable-threads        use threads], wxUSE_THREADS)
897
898 if test "$wxUSE_GUI" = "yes"; then
899
900 dnl ---------------------------------------------------------------------------
901 dnl "big" GUI options
902 dnl ---------------------------------------------------------------------------
903
904 WX_ARG_ENABLE(docview,     [  --enable-docview        use document view architecture], wxUSE_DOC_VIEW_ARCHITECTURE)
905 WX_ARG_ENABLE(help,        [  --enable-help           use help subsystem], wxUSE_HELP)
906 WX_ARG_ENABLE(mshtmlhelp,  [  --enable-mshtmlhelp     use MS HTML Help (win32)], wxUSE_MS_HTML_HELP)
907 WX_ARG_ENABLE(html,        [  --enable-html           use wxHTML sub-library], wxUSE_HTML)
908 WX_ARG_ENABLE(htmlhelp,    [  --enable-htmlhelp       use wxHTML-based help], wxUSE_WXHTML_HELP)
909 WX_ARG_ENABLE(constraints, [  --enable-constraints    use layout-constraints system], wxUSE_CONSTRAINTS)
910 WX_ARG_ENABLE(printarch,   [  --enable-printarch      use printing architecture], wxUSE_PRINTING_ARCHITECTURE)
911 WX_ARG_ENABLE(mdi,         [  --enable-mdi            use multiple document interface architecture], wxUSE_MDI_ARCHITECTURE)
912 WX_ARG_ENABLE(loggui,      [  --enable-loggui         use standard GUI logger], wxUSE_LOGGUI)
913 WX_ARG_ENABLE(logwin,      [  --enable-logwin         use wxLogWindow], wxUSE_LOGWINDOW)
914 WX_ARG_ENABLE(logdialog,   [  --enable-logdialog      use wxLogDialog], wxUSE_LOGDIALOG)
915
916 dnl ---------------------------------------------------------------------------
917 dnl PostScript options
918 dnl ---------------------------------------------------------------------------
919 WX_ARG_ENABLE(postscript,  [  --enable-postscript     use wxPostscriptDC device context (default for gtk+)], wxUSE_POSTSCRIPT)
920
921 dnl VZ: these options seem to be always on, if someone wants to change it please do
922 dnl WX_ARG_ENABLE(PS-normalized,    [  --enable-PS-normalized  use normalized PS fonts], dnl             wxUSE_NORMALIZED_PS_FONTS)
923 dnl WX_ARG_ENABLE(afmfonts,        [  --enable-afmfonts       use Adobe Font Metric Font table], dnl             wxUSE_AFM_FOR_POSTSCRIPT)
924
925 dnl ---------------------------------------------------------------------------
926 dnl resources
927 dnl ---------------------------------------------------------------------------
928
929 WX_ARG_ENABLE(prologio,    [  --enable-prologio       not available; see contrib], wxUSE_PROLOGIO)
930 WX_ARG_ENABLE(resources,   [  --enable-resources      not available; see contrib], wxUSE_RESOURCES)
931
932 dnl ---------------------------------------------------------------------------
933 dnl IPC &c
934 dnl ---------------------------------------------------------------------------
935
936 WX_ARG_ENABLE(clipboard,   [  --enable-clipboard      use wxClipboard class], wxUSE_CLIPBOARD)
937 WX_ARG_ENABLE(dnd,         [  --enable-dnd            use Drag'n'Drop classes], wxUSE_DRAG_AND_DROP)
938 WX_ARG_ENABLE(metafile,    [  --enable-metafile       use win32 metafiles], wxUSE_METAFILE)
939
940 dnl WX_ARG_ENABLE(treelayout,  [  --enable-treelayout     use wxTreeLayout class], wxUSE_TREELAYOUT)
941
942 dnl ---------------------------------------------------------------------------
943 dnl optional GUI controls (in alphabetical order except the first one)
944 dnl ---------------------------------------------------------------------------
945
946 WX_ARG_ENABLE(controls,    [  --enable-controls       use all usual controls], wxUSE_CONTROLS)
947
948 dnl even with --enable-controls, some may be disabled by giving
949 dnl --disable-<control> later on the command line - but by default all will be
950 dnl used (and vice versa)
951 if test "$wxUSE_CONTROLS" = "yes"; then
952   DEFAULT_wxUSE_ACCEL=yes
953   DEFAULT_wxUSE_BMPBUTTON=yes
954   DEFAULT_wxUSE_BUTTON=yes
955   DEFAULT_wxUSE_CALCTRL=no
956   DEFAULT_wxUSE_CARET=yes
957   DEFAULT_wxUSE_COMBOBOX=yes
958   DEFAULT_wxUSE_CHECKBOX=yes
959   DEFAULT_wxUSE_CHECKLISTBOX=yes
960   DEFAULT_wxUSE_CHOICE=yes
961   DEFAULT_wxUSE_GAUGE=yes
962   DEFAULT_wxUSE_GRID=yes
963   DEFAULT_wxUSE_IMAGLIST=yes
964   DEFAULT_wxUSE_LISTBOOK=yes
965   DEFAULT_wxUSE_LISTBOX=yes
966   DEFAULT_wxUSE_LISTCTRL=yes
967   DEFAULT_wxUSE_NOTEBOOK=yes
968   DEFAULT_wxUSE_RADIOBOX=yes
969   DEFAULT_wxUSE_RADIOBTN=yes
970   DEFAULT_wxUSE_SASH=yes
971   DEFAULT_wxUSE_SCROLLBAR=yes
972   DEFAULT_wxUSE_SLIDER=yes
973   DEFAULT_wxUSE_SPINBTN=yes
974   DEFAULT_wxUSE_SPINCTRL=yes
975   DEFAULT_wxUSE_SPLITTER=yes
976   DEFAULT_wxUSE_STATBMP=yes
977   DEFAULT_wxUSE_STATBOX=yes
978   DEFAULT_wxUSE_STATLINE=yes
979   DEFAULT_wxUSE_STATUSBAR=yes
980   DEFAULT_wxUSE_TAB_DIALOG=yes
981   DEFAULT_wxUSE_TOGGLEBTN=yes
982   DEFAULT_wxUSE_TOOLBAR=yes
983   DEFAULT_wxUSE_TOOLBAR_NATIVE=yes
984   DEFAULT_wxUSE_TOOLBAR_SIMPLE=yes
985   DEFAULT_wxUSE_TOOLTIPS=yes
986   DEFAULT_wxUSE_TREECTRL=yes
987   DEFAULT_wxUSE_POPUPWIN=yes
988   DEFAULT_wxUSE_TIPWINDOW=yes
989 elif test "$wxUSE_CONTROLS" = "no"; then
990   DEFAULT_wxUSE_ACCEL=no
991   DEFAULT_wxUSE_BMPBUTTON=no
992   DEFAULT_wxUSE_BUTTON=no
993   DEFAULT_wxUSE_CALCTRL=no
994   DEFAULT_wxUSE_CARET=no
995   DEFAULT_wxUSE_COMBOBOX=no
996   DEFAULT_wxUSE_CHECKBOX=no
997   DEFAULT_wxUSE_CHECKLISTBOX=no
998   DEFAULT_wxUSE_CHOICE=no
999   DEFAULT_wxUSE_GAUGE=no
1000   DEFAULT_wxUSE_GRID=no
1001   DEFAULT_wxUSE_IMAGLIST=no
1002   DEFAULT_wxUSE_LISTBOOK=no
1003   DEFAULT_wxUSE_LISTBOX=no
1004   DEFAULT_wxUSE_LISTCTRL=no
1005   DEFAULT_wxUSE_NOTEBOOK=no
1006   DEFAULT_wxUSE_RADIOBOX=no
1007   DEFAULT_wxUSE_RADIOBTN=no
1008   DEFAULT_wxUSE_SASH=no
1009   DEFAULT_wxUSE_SCROLLBAR=no
1010   DEFAULT_wxUSE_SLIDER=no
1011   DEFAULT_wxUSE_SPINBTN=no
1012   DEFAULT_wxUSE_SPINCTRL=no
1013   DEFAULT_wxUSE_SPLITTER=no
1014   DEFAULT_wxUSE_STATBMP=no
1015   DEFAULT_wxUSE_STATBOX=no
1016   DEFAULT_wxUSE_STATLINE=no
1017   DEFAULT_wxUSE_STATUSBAR=no
1018   DEFAULT_wxUSE_TAB_DIALOG=no
1019   DEFAULT_wxUSE_TOGGLEBTN=no
1020   DEFAULT_wxUSE_TOOLBAR=no
1021   DEFAULT_wxUSE_TOOLBAR_NATIVE=no
1022   DEFAULT_wxUSE_TOOLBAR_SIMPLE=no
1023   DEFAULT_wxUSE_TOOLTIPS=no
1024   DEFAULT_wxUSE_TREECTRL=no
1025   DEFAULT_wxUSE_POPUPWIN=no
1026   DEFAULT_wxUSE_TIPWINDOW=no
1027 fi
1028
1029 ## FIXME: This is a blatant hack
1030 if test "x$wxUSE_COCOA" != "x" -a "$wxUSE_COCOA" != "0" ; then
1031   wxUSE_PRINTING_ARCHITECTURE=no
1032   wxUSE_DRAG_AND_DROP=no
1033   # Generic notebook requires tab dialog
1034   DEFAULT_wxUSE_TABDIALOG=yes
1035   DEFAULT_wxUSE_SCROLLBAR=no
1036   DEFAULT_wxUSE_TOOLTIPS=no
1037   DEFAULT_wxUSE_DRAGIMAGE=no
1038 fi
1039
1040 WX_ARG_ENABLE(accel,       [  --enable-accel          use accelerators], wxUSE_ACCEL)
1041 WX_ARG_ENABLE(button,      [  --enable-button         use wxButton class], wxUSE_BUTTON)
1042 WX_ARG_ENABLE(bmpbutton,   [  --enable-bmpbutton      use wxBitmapButton class], wxUSE_BMPBUTTON)
1043 WX_ARG_ENABLE(calendar,    [  --enable-calendar       use wxCalendarCtrl class], wxUSE_CALCTRL)
1044 WX_ARG_ENABLE(caret,       [  --enable-caret          use wxCaret class], wxUSE_CARET)
1045 WX_ARG_ENABLE(checkbox,    [  --enable-checkbox       use wxCheckBox class], wxUSE_CHECKBOX)
1046 WX_ARG_ENABLE(checklst,    [  --enable-checklst       use wxCheckListBox (listbox with checkboxes) class], wxUSE_CHECKLST)
1047 WX_ARG_ENABLE(choice,      [  --enable-choice         use wxChoice class], wxUSE_CHOICE)
1048 WX_ARG_ENABLE(combobox,    [  --enable-combobox       use wxComboBox class], wxUSE_COMBOBOX)
1049 WX_ARG_ENABLE(display,     [  --enable-display        use wxDisplay class], wxUSE_DISPLAY)
1050 WX_ARG_ENABLE(gauge,       [  --enable-gauge          use wxGauge class], wxUSE_GAUGE)
1051 WX_ARG_ENABLE(grid,        [  --enable-grid           use wxGrid class], wxUSE_GRID)
1052 WX_ARG_ENABLE(imaglist,    [  --enable-imaglist       use wxImageList class], wxUSE_IMAGLIST)
1053 WX_ARG_ENABLE(listbook,    [  --enable-listbook       use wxListbook class], wxUSE_LISTBOOK)
1054 WX_ARG_ENABLE(listbox,     [  --enable-listbox        use wxListBox class], wxUSE_LISTBOX)
1055 WX_ARG_ENABLE(listctrl,    [  --enable-listctrl       use wxListCtrl class], wxUSE_LISTCTRL)
1056 WX_ARG_ENABLE(notebook,    [  --enable-notebook       use wxNotebook class], wxUSE_NOTEBOOK)
1057 WX_ARG_ENABLE(radiobox,    [  --enable-radiobox       use wxRadioBox class], wxUSE_RADIOBOX)
1058 WX_ARG_ENABLE(radiobtn,    [  --enable-radiobtn       use wxRadioButton class], wxUSE_RADIOBTN)
1059 WX_ARG_ENABLE(sash,        [  --enable-sash           use wxSashWindow class], wxUSE_SASH)
1060 WX_ARG_ENABLE(scrollbar,   [  --enable-scrollbar      use wxScrollBar class and scrollable windows], wxUSE_SCROLLBAR)
1061 WX_ARG_ENABLE(slider,      [  --enable-slider         use wxSlider class], wxUSE_SLIDER)
1062 WX_ARG_ENABLE(spinbtn,     [  --enable-spinbtn        use wxSpinButton class], wxUSE_SPINBTN)
1063 WX_ARG_ENABLE(spinctrl,    [  --enable-spinctrl       use wxSpinCtrl class], wxUSE_SPINCTRL)
1064 WX_ARG_ENABLE(splitter,    [  --enable-splitter       use wxSplitterWindow class], wxUSE_SPLITTER)
1065 WX_ARG_ENABLE(statbmp,     [  --enable-statbmp        use wxStaticBitmap class], wxUSE_STATBMP)
1066 WX_ARG_ENABLE(statbox,     [  --enable-statbox        use wxStaticBox class], wxUSE_STATBOX)
1067 WX_ARG_ENABLE(statline,    [  --enable-statline       use wxStaticLine class], wxUSE_STATLINE)
1068 WX_ARG_ENABLE(stattext,    [  --enable-stattext       use wxStaticText class], wxUSE_STATTEXT)
1069 WX_ARG_ENABLE(statusbar,   [  --enable-statusbar      use wxStatusBar class], wxUSE_STATUSBAR)
1070 WX_ARG_ENABLE(tabdialog,   [  --enable-tabdialog      use wxTabControl class], wxUSE_TABDIALOG)
1071 WX_ARG_ENABLE(textctrl,    [  --enable-textctrl       use wxTextCtrl class], wxUSE_TEXTCTRL)
1072 WX_ARG_ENABLE(togglebtn,   [  --enable-togglebtn      use wxToggleButton class], wxUSE_TOGGLEBTN)
1073 WX_ARG_ENABLE(toolbar,     [  --enable-toolbar        use wxToolBar class], wxUSE_TOOLBAR)
1074 WX_ARG_ENABLE(tbarnative,  [  --enable-tbarnative     use native wxToolBar class], wxUSE_TOOLBAR_NATIVE)
1075 WX_ARG_ENABLE(tbarsmpl,    [  --enable-tbarsmpl       use wxToolBarSimple class], wxUSE_TOOLBAR_SIMPLE)
1076 WX_ARG_ENABLE(treectrl,    [  --enable-treectrl       use wxTreeCtrl class], wxUSE_TREECTRL)
1077 WX_ARG_ENABLE(tipwindow,   [  --enable-tipwindow      use wxTipWindow class], wxUSE_TIPWINDOW)
1078 WX_ARG_ENABLE(popupwin,    [  --enable-popupwin       use wxPopUpWindow class], wxUSE_POPUPWIN)
1079
1080 dnl ---------------------------------------------------------------------------
1081 dnl common dialogs
1082 dnl ---------------------------------------------------------------------------
1083
1084 WX_ARG_ENABLE(commondlg,   [  --enable-commondlg      use all common dialogs], wxUSE_COMMONDLGS)
1085 WX_ARG_ENABLE(choicedlg,   [  --enable-choicedlg      use wxChoiceDialog], wxUSE_CHOICEDLG)
1086 WX_ARG_ENABLE(coldlg,      [  --enable-coldlg         use wxColourDialog], wxUSE_COLOURDLG)
1087 WX_ARG_ENABLE(filedlg,     [  --enable-filedlg        use wxFileDialog], wxUSE_FILEDLG)
1088 WX_ARG_ENABLE(finddlg,     [  --enable-finddlg        use wxFindReplaceDialog], wxUSE_FINDREPLDLG)
1089 WX_ARG_ENABLE(fontdlg,     [  --enable-fontdlg        use wxFontDialog], wxUSE_FONTDLG)
1090 WX_ARG_ENABLE(dirdlg,      [  --enable-dirdlg         use wxDirDialog], wxUSE_DIRDLG)
1091 WX_ARG_ENABLE(msgdlg,      [  --enable-msgdlg         use wxMessageDialog], wxUSE_MSGDLG)
1092 WX_ARG_ENABLE(numberdlg,   [  --enable-numberdlg      use wxNumberEntryDialog], wxUSE_NUMBERDLG)
1093 WX_ARG_ENABLE(splash,      [  --enable-splash         use wxSplashScreen], wxUSE_SPLASH)
1094 WX_ARG_ENABLE(textdlg,     [  --enable-textdlg        use wxTextDialog], wxUSE_TEXTDLG)
1095 WX_ARG_ENABLE(tipdlg,      [  --enable-tipdlg         use startup tips], wxUSE_STARTUP_TIPS)
1096 WX_ARG_ENABLE(progressdlg, [  --enable-progressdlg    use wxProgressDialog], wxUSE_PROGRESSDLG)
1097 WX_ARG_ENABLE(wizarddlg,   [  --enable-wizarddlg      use wxWizard], wxUSE_WIZARDDLG)
1098
1099 dnl ---------------------------------------------------------------------------
1100 dnl misc GUI options
1101 dnl ---------------------------------------------------------------------------
1102
1103 WX_ARG_ENABLE(menus,       [  --enable-menus          use wxMenu/wxMenuBar/wxMenuItem classes], wxUSE_MENUS)
1104 WX_ARG_ENABLE(miniframe,   [  --enable-miniframe      use wxMiniFrame class], wxUSE_MINIFRAME)
1105 WX_ARG_ENABLE(tooltips,    [  --enable-tooltips       use wxToolTip class], wxUSE_TOOLTIPS)
1106 WX_ARG_ENABLE(splines,     [  --enable-splines        use spline drawing code], wxUSE_SPLINES)
1107 WX_ARG_ENABLE(validators,  [  --enable-validators     use wxValidator and derived classes], wxUSE_VALIDATORS)
1108 WX_ARG_ENABLE(busyinfo,    [  --enable-busyinfo       use wxBusyInfo], wxUSE_BUSYINFO)
1109 WX_ARG_ENABLE(joystick,    [  --enable-joystick       use wxJoystick (Linux only)], wxUSE_JOYSTICK)
1110 WX_ARG_ENABLE(metafile,    [  --enable-metafiles      use wxMetaFile (Windows only)], wxUSE_METAFILE)
1111 WX_ARG_ENABLE(dragimage,   [  --enable-dragimage      use wxDragImage], wxUSE_DRAGIMAGE)
1112 WX_ARG_ENABLE(accessibility,[  --enable-accessibility  enable accessibility support], wxUSE_ACCESSIBILITY)
1113
1114 dnl ---------------------------------------------------------------------------
1115 dnl support for image formats that do not rely on external library
1116 dnl ---------------------------------------------------------------------------
1117
1118 WX_ARG_ENABLE(palette,     [  --enable-palette        use wxPalette class], wxUSE_PALETTE)
1119 WX_ARG_ENABLE(image,       [  --enable-image          use wxImage class], wxUSE_IMAGE)
1120 WX_ARG_ENABLE(gif,         [  --enable-gif            use gif images (GIF file format)], wxUSE_GIF)
1121 WX_ARG_ENABLE(pcx,         [  --enable-pcx            use pcx images (PCX file format)], wxUSE_PCX)
1122 WX_ARG_ENABLE(iff,         [  --enable-iff            use iff images (IFF file format)], wxUSE_IFF)
1123 WX_ARG_ENABLE(pnm,         [  --enable-pnm            use pnm images (PNM file format)], wxUSE_PNM)
1124 WX_ARG_ENABLE(xpm,         [  --enable-xpm            use xpm images (XPM file format)], wxUSE_XPM)
1125 WX_ARG_ENABLE(ico_cur,     [  --enable-icocur         use Windows ICO and CUR formats], wxUSE_ICO_CUR)
1126
1127 fi
1128
1129 dnl ---------------------------------------------------------------------------
1130 dnl some win32 settings
1131 dnl ---------------------------------------------------------------------------
1132
1133 WX_ARG_ENABLE(official_build,  [  --enable-official_build official build of wxWindows (win32 DLL only)], wxUSE_OFFICIAL_BUILD)
1134 AC_ARG_ENABLE(vendor,  [  --enable-vendor=VENDOR  vendor name (win32 DLL only)], [VENDOR="$enableval"])
1135 if test "x$VENDOR" = "x"; then
1136     VENDOR="custom"
1137 fi
1138
1139 dnl General settings (needed for GUI and non-GUI compilations alike).
1140 dnl Path separator; ':' for unix, ';' for OS/2
1141 case "${host}" in
1142   *-pc-os2_emx | *-pc-os2-emx )
1143     PATH_IFS=';'
1144   ;;
1145   *)
1146     PATH_IFS=':'
1147   ;;
1148 esac
1149
1150 dnl for GUI only
1151
1152 dnl cache the options values before (may be) aborting below
1153 WX_ARG_CACHE_FLUSH
1154
1155 dnl check that no more than one toolkit is given and that if none are given that
1156 dnl we have a default one
1157
1158 AC_MSG_CHECKING(for toolkit)
1159
1160 # In Wine, we need to default to MSW, not GTK or MOTIF
1161 if test "$wxUSE_WINE" = "yes"; then
1162     DEFAULT_DEFAULT_wxUSE_GTK=0
1163     DEFAULT_DEFAULT_wxUSE_MOTIF=0
1164     DEFAULT_DEFAULT_wxUSE_MSW=1
1165     wxUSE_SHARED=no
1166 fi
1167
1168 if test "$wxUSE_GUI" = "yes"; then
1169
1170     if test "$USE_BEOS" = 1; then
1171         AC_MSG_ERROR([BeOS GUI is not supported yet, use --disable-gui])
1172     fi
1173
1174     if test "$TOOLKIT_GIVEN" = 1; then
1175       dnl convert "yes" to 1 and "no" to 0
1176       for toolkit in `echo $ALL_TOOLKITS`; do
1177         var=wxUSE_$toolkit
1178         eval "value=\$${var}"
1179         eval "$var=`echo \$value | sed -e "s/yes/1/" -e "s/no/0/"`"
1180       done
1181     else
1182       dnl try to guess the most apropriate toolkit for this platform
1183       for toolkit in `echo $ALL_TOOLKITS`; do
1184         if test "$has_toolkit_in_cache" != 1; then
1185           var=DEFAULT_DEFAULT_wxUSE_$toolkit
1186         else
1187           var=DEFAULT_wxUSE_$toolkit
1188         fi
1189         eval "wxUSE_$toolkit=\$${var}"
1190       done
1191     fi
1192
1193     dnl we suppose that expr is available (maybe there is a better way to do
1194     dnl this? what about using ALL_TOOLKITS? TODO)
1195     NUM_TOOLKITS=`expr ${wxUSE_COCOA:-0} + ${wxUSE_GTK:-0} + ${wxUSE_MAC:-0} \
1196                   + ${wxUSE_MGL:-0} + ${wxUSE_MICROWIN:-0} \
1197                   + ${wxUSE_MOTIF:-0} + ${wxUSE_MSW:-0} + ${wxUSE_X11:-0}`
1198
1199     dnl Allow wxUSE_PM only for OS/2 with EMX.
1200     case "${host}" in
1201       *-pc-os2_emx | *-pc-os2-emx )
1202         NUM_TOOLKITS=`expr ${NUM_TOOLKITS} + ${wxUSE_PM:-0}`
1203     esac
1204
1205     case "$NUM_TOOLKITS" in
1206       1)
1207       ;;
1208       0)
1209         AC_MSG_ERROR(Please specify a toolkit -- cannot determine the default for ${host})
1210       ;;
1211       *)
1212         AC_MSG_ERROR(Please specify at most one toolkit (maybe some are cached in configarg.cache?))
1213     esac
1214
1215     dnl cache the wxUSE_<TOOLKIT> values too
1216     for toolkit in `echo $ALL_TOOLKITS`; do
1217       var=wxUSE_$toolkit
1218       eval "value=\$${var}"
1219       if test "x$value" != x; then
1220         cache_var=CACHE_$toolkit
1221         eval "cache=\$${cache_var}"
1222         if test "$cache" = 1; then
1223           echo "$var=$value" >> ${wx_arg_cache_file}
1224         fi
1225         if test "$value" = 1; then
1226           toolkit_echo=`echo $toolkit | tr "[[A-Z]]" "[[a-z]]"`
1227           AC_MSG_RESULT($toolkit_echo)
1228         fi
1229       fi
1230     done
1231 else
1232     if test "x$host_alias" != "x"; then
1233         AC_MSG_RESULT(base ($host_alias hosted) only)
1234     else
1235         AC_MSG_RESULT(base only)
1236     fi
1237 fi
1238
1239 dnl ---------------------------------------------------------------------------
1240 dnl When we are using Cygwin with Motif/GTK+, we want it to appear like
1241 dnl 'just' a POSIX platform, so the Win32 API must not be available
1242 dnl ---------------------------------------------------------------------------
1243 dnl (Windows-only piece)
1244 wants_win32=0
1245 doesnt_want_win32=0
1246 case "${host}" in
1247   *-*-cygwin*)
1248       if test "$wxUSE_MSW" = 1 ; then
1249         wants_win32=1
1250       else
1251         doesnt_want_win32=1
1252       fi
1253   ;;
1254   *-*-mingw*)
1255       wants_win32=1
1256   ;;
1257 esac
1258
1259 dnl ---------------------------------------------------------------------------
1260 dnl Wine is a virtual platform, we need to patch things up a bit
1261 dnl ---------------------------------------------------------------------------
1262 if test "$wxUSE_WINE" = "yes"; then
1263     wants_win32=1
1264     dnl FIXME: we should do a better job of testing for these
1265     CC=winegcc
1266     CXX=wineg++
1267     RESCOMP=wrc
1268     LDFLAGS_GUI="-mwindows"
1269 fi
1270
1271 dnl NB: The two tests bellow are *NOT* mutually exclusive! They should only
1272 dnl     take effect on Cygwin/Mingw and not other platforms.
1273 if test "$wants_win32" = 1 ; then
1274     USE_UNIX=0
1275     USE_WIN32=1
1276     AC_DEFINE(__WIN32__)
1277     AC_DEFINE(__WIN95__)
1278     AC_DEFINE(__WINDOWS__)
1279     AC_DEFINE(__GNUWIN32__)
1280     AC_DEFINE(STRICT)
1281     AC_DEFINE(WINVER, 0x0400)
1282 fi
1283 if test "$doesnt_want_win32" = 1 ; then
1284     USE_UNIX=1
1285     USE_WIN32=0
1286 fi
1287 dnl (end of Windows-only piece)
1288
1289 if test "$USE_UNIX" = 1 ; then
1290     wxUSE_UNIX=yes
1291     AC_DEFINE(__UNIX__)
1292 fi
1293
1294 dnl ---------------------------------------------------------------------------
1295 dnl Checks for programs
1296 dnl ---------------------------------------------------------------------------
1297
1298 dnl flush the cache because checking for programs might abort
1299 AC_CACHE_SAVE
1300
1301 dnl cross-compiling support: we're cross compiling if the build system is
1302 dnl different from the target one (assume host and target be always the same)
1303 if test "$build" != "$host" ; then
1304     if test "$USE_WIN32" = 1 -o "$USE_DOS" = 1 -o "$USE_UNIX"; then
1305         CC=$host_alias-gcc
1306         CXX=$host_alias-c++
1307         AR=$host_alias-ar
1308         RANLIB=$host_alias-ranlib
1309         DLLTOOL=$host_alias-dlltool
1310         RESCOMP=$host_alias-windres
1311         LD=$host_alias-ld
1312         NM=$host_alias-nm
1313         STRIP=$host_alias-strip
1314     else
1315         AC_MSG_ERROR($build_alias -> $host_alias cross compilation not supported yet.)
1316     fi
1317 fi
1318
1319 dnl C-compiler checks
1320 dnl   defines CC with the compiler to use
1321 dnl   defines GCC with yes if using gcc
1322 dnl   defines GCC empty if not using gcc
1323 dnl   defines CFLAGS
1324 dnl
1325 dnl this magic incantation is needed to prevent AC_PROG_CC from setting the
1326 dnl default CFLAGS (something like "-g -O2") -- we don't need this as we add
1327 dnl -g and -O flags ourselves below
1328 CFLAGS=${CFLAGS:=}
1329 AC_PROG_CC
1330
1331 dnl is -traditional needed for correct compilations
1332 dnl   adds -traditional for gcc if needed
1333 AC_PROG_GCC_TRADITIONAL
1334
1335 AC_LANG_SAVE
1336 AC_LANG_CPLUSPLUS
1337
1338 dnl C++-compiler checks
1339 dnl   defines CXX with the compiler to use
1340 dnl   defines GXX with yes if using gxx
1341 dnl   defines GXX empty if not using gxx
1342 dnl   defines CXXFLAGS
1343 dnl
1344 dnl see CFLAGS line above
1345 CXXFLAGS=${CXXFLAGS:=}
1346 AC_PROG_CXX
1347
1348 AC_LANG_RESTORE
1349
1350 dnl check if compiler includes /usr/local/include in
1351 dnl default include files search path.
1352 AC_MSG_CHECKING([for /usr/local/include in default include path])
1353 GCC_SEARCHES_USR_LOCAL_INCLUDE="no"
1354 if test "$GCC" = "yes" ; then
1355   echo | gcc -v -x c++ -E - 2>&1 | sed -n '/^#include </,$p' | \
1356         sed -n '1,/End of search list\./p' | \
1357         grep '^ */usr/local/include$' 2>&1 /dev/null \
1358   && GCC_SEARCHES_USR_LOCAL_INCLUDE="yes"
1359 fi
1360 AC_MSG_RESULT([$GCC_SEARCHES_USR_LOCAL_INCLUDE])
1361
1362 dnl ranlib command
1363 dnl   defines RANLIB with the appropriate command
1364 AC_PROG_RANLIB
1365
1366 dnl ar command
1367 dnl   defines AR with the appropriate command
1368 AC_CHECK_PROG(AR, ar, ar)
1369 if test "x$AR" = "x" ; then
1370     AC_MSG_ERROR([ar is needed to build wxWindows])
1371 fi
1372
1373 dnl install checks
1374 dnl   defines INSTALL with the appropriate command
1375 AC_PROG_INSTALL
1376
1377 dnl   make install path absolute (if not already);
1378 dnl   will fail with (some) MSDOS paths
1379 case ${INSTALL} in
1380   /* ) # Absolute
1381      ;;
1382   ?:* ) # Drive letter, considered as absolute.
1383      ;;
1384   *)
1385      INSTALL=`pwd`/${INSTALL} ;;
1386 esac
1387
1388 dnl HP-UX install doesn't handle the "-d" switch so don't use it there
1389 case ${host} in
1390     *-hp-hpux* )
1391         INSTALL_DIR="mkdir"
1392         ;;
1393
1394     *)  INSTALL_DIR="$INSTALL -d"
1395         ;;
1396 esac
1397
1398
1399 case "${host}" in
1400
1401     dnl The other BSD's should probably go in here too, since this is
1402     dnl to workaround a strange static lib BSDism.
1403     dnl Mac OS X install seems to ignore -p option...
1404     powerpc-*-darwin* )
1405         INSTALL_PROGRAM="cp -fp"
1406         INSTALL_DATA="cp -fp"
1407         ;;
1408     *)
1409         ;;
1410 esac
1411
1412 dnl strip command
1413 dnl   defines STRIP as strip or nothing if not found
1414 AC_CHECK_PROG(STRIP, strip, strip, true)
1415
1416 dnl does make support "-include" (only GNU make does AFAIK)?
1417 AC_CACHE_CHECK([if make is GNU make], wx_cv_prog_makeisgnu,
1418 [
1419     if ( ${SHELL-sh} -c "${MAKE-make} --version" 2> /dev/null |
1420             egrep -s GNU > /dev/null); then
1421         wx_cv_prog_makeisgnu="yes"
1422     else
1423         wx_cv_prog_makeisgnu="no"
1424     fi
1425 ])
1426
1427 if test "x$wx_cv_prog_makeisgnu" = "xyes"; then
1428     IF_GNU_MAKE=""
1429 else
1430     IF_GNU_MAKE="#"
1431 fi
1432
1433 AC_SUBST(IF_GNU_MAKE)
1434
1435 dnl we don't need to check for VPATH support in GNU make - it does have it
1436 if test "x$wx_cv_prog_makeisgnu" != "xyes"; then
1437 dnl check if VPATH works
1438 AC_CACHE_CHECK([if make supports VPATH], wx_cv_prog_makevpath, [
1439 dnl create Makefile
1440 cat - << EOF > confMake
1441 check : file
1442         cp \$? \$@
1443         cp \$? final_file
1444 EOF
1445
1446 if test ! -d sub ; then
1447   mkdir sub
1448 fi
1449 echo dummy > sub/file
1450 ${MAKE-make} -f confMake VPATH=sub 2>&5 > /dev/null
1451 RESULT=$?
1452 rm -f sub/file check final_file confMake
1453 rmdir sub
1454 if test "$RESULT" = 0; then
1455   wx_cv_prog_makevpath="yes"
1456 else
1457   wx_cv_prog_makevpath="no"
1458 fi
1459 ])
1460
1461 if test "x$wx_cv_prog_makevpath" != "xyes"; then
1462 AC_MSG_ERROR([
1463 You need a make-utility that is able to use the variable
1464 VPATH correctly.
1465 If your version of make does not support VPATH correctly,
1466 please install GNU-make (possibly as gmake), and start
1467 configure with the following command:
1468 export MAKE=gmake; ./configure  for sh-type shells
1469 setenv MAKE gmake; ./configure  for csh-type shells
1470 Also please do remember to use gmake in this case every time
1471 you are trying to compile.
1472 ])
1473 fi dnl make without VPATH
1474 fi dnl not GNU make
1475
1476 dnl needed for making link to setup.h
1477 AC_PROG_LN_S
1478
1479 dnl ------------------------------------------------------------------------
1480 dnl Platform specific tests
1481 dnl ------------------------------------------------------------------------
1482
1483 case "${host}" in
1484   *-pc-os2_emx | *-pc-os2-emx )
1485       dnl ---------------------------------------------------------------------
1486       dnl When we are using gcc on OS/2, we want to be either using resources
1487       dnl (PM) or a more complete POSIX emulation for Motif/GTK+/X11.
1488       dnl Moreover we need to link explicitly against either stdcpp.a or
1489       dnl stdcxx.a (depending on compiler version), since we are using "gcc",
1490       dnl not "g++/c++".
1491       dnl ---------------------------------------------------------------------
1492       dnl (OS/2-only piece)
1493       if test "$wxUSE_MOTIF" = 1 -o "$wxUSE_GTK" = 1 -o "$wxUSE_X11" = 1; then
1494           dnl More complete Unix emulation for unix-like ports
1495           dnl by linking in POSIX/2's cExt (if available).
1496           AC_CHECK_LIB(cExt, drand48, LIBS="$LIBS -lcExt")
1497       else
1498           dnl Include resources for the "native" port (wxPM).
1499           RESPROGRAMOBJ="\${top_srcdir}/include/wx/os2/wx.res"
1500       fi
1501       AC_CACHE_CHECK([for gcc version], wx_cv_gccversion,[
1502           AC_TRY_COMPILE([],
1503               [
1504                   #if (__GNUC__ < 3)
1505                       #error old gcc
1506                   #endif
1507               ],
1508               [
1509                   AC_TRY_COMPILE([],
1510                       [
1511                           #if (__GNUC__==3) && ((__GNUC_MINOR__ < 2) || ((__GNUC_MINOR__==2) && (__GNUC_PATCHLEVEL__<2)))
1512                               #error intermediate gcc
1513                           #endif
1514                       ],
1515                       [
1516                          wx_cv_gccversion=Innotek
1517                       ],
1518                       [
1519                          wx_cv_gccversion=3
1520                       ]
1521                   )
1522               ],
1523               [
1524                   wx_cv_gccversion=2
1525               ]
1526           )
1527       ])
1528       if test "$wx_cv_gccversion" = "2"; then
1529           LIBS="$LIBS -lstdcpp"
1530           LDFLAGS="$LDFLAGS -Zsysv-signals"
1531       else
1532           if test "$wx_cv_gccversion" = "3"; then
1533               LIBS="$LIBS -lstdcxx"
1534               LDFLAGS="$LDFLAGS -Zsysv-signals"
1535           else
1536               LIBS="$LIBS -lstdc++"
1537           fi
1538       fi
1539       dnl (end of OS/2-only piece)
1540   ;;
1541   *)
1542       dnl ---------------------------------------------------------------------
1543       dnl look for strcasecmp() in string.h and then strings.h if it's not
1544       dnl there. Don't do this on OS/2, where "stricmp" is the function to be
1545       dnl used.
1546       dnl ---------------------------------------------------------------------
1547       dnl (non-OS/2-only piece)
1548
1549       AC_LANG_SAVE
1550       AC_LANG_CPLUSPLUS
1551
1552       AC_CACHE_CHECK([for strcasecmp() in string.h], ac_cv_string_strcasecmp, [
1553           AC_TRY_LINK([
1554               #include <string.h>
1555               ],
1556               [
1557                   strcasecmp("foo", "bar");
1558               ],
1559               ac_cv_string_strcasecmp=yes,
1560               ac_cv_string_strcasecmp=no
1561           )
1562       ])
1563
1564       if test x"$ac_cv_string_strcasecmp" = "xyes"; then
1565           AC_DEFINE(HAVE_STRCASECMP_IN_STRING_H)
1566       else
1567           AC_CACHE_CHECK([for strcasecmp() in strings.h], ac_cv_strings_strcasecmp, [
1568               AC_TRY_LINK([
1569                   #include <strings.h>
1570                   ],
1571                   [
1572                       strcasecmp("foo", "bar");
1573                   ],
1574                   ac_cv_strings_strcasecmp=yes,
1575                   ac_cv_strings_strcasecmp=no
1576               )
1577           ])
1578
1579           if test x"$ac_cv_string_strcasecmp" = "xyes"; then
1580               AC_DEFINE(HAVE_STRCASECMP_IN_STRINGS_H)
1581           else
1582               AC_MSG_ERROR([No case-insensitive string comparison function found.])
1583           fi
1584       fi
1585
1586       AC_LANG_RESTORE
1587       dnl (end of non-OS/2-only piece)
1588   ;;
1589 esac
1590
1591 dnl ------------------------------------------------------------------------
1592 dnl Check for headers
1593 dnl ------------------------------------------------------------------------
1594
1595 dnl defines HAVE_STDLIB_H
1596 AC_CHECK_HEADERS(stdlib.h)
1597 dnl defines HAVE_MALLOC_H
1598 AC_CHECK_HEADERS(malloc.h)
1599 dnl defines HAVE_UNISTD_H
1600 AC_CHECK_HEADERS(unistd.h)
1601 dnl defines HAVE_WCHAR_H
1602 AC_CHECK_HEADERS(wchar.h)
1603
1604 dnl maybe wchar_t is in wcstr.h if we don't have wchar.h?
1605 if test "$ac_cv_header_wchar_h" != "yes"; then
1606     dnl defines HAVE_WCSTR_H
1607     AC_CHECK_HEADERS(wcstr.h)
1608 fi
1609
1610 dnl defines HAVE_FNMATCH_H
1611 AC_CHECK_HEADERS(fnmatch.h)
1612
1613 if test "x$ac_cv_header_fnmatch_h" = "xyes"; then
1614     AC_CHECK_FUNCS(fnmatch)
1615 fi
1616
1617 dnl defines HAVE_LANGINFO_H (GNU libc locale parameters)
1618 AC_CHECK_HEADERS(langinfo.h)
1619
1620 case "${host}" in
1621   *-pc-os2_emx | *-pc-os2-emx )
1622       dnl Explicitly link -lintl if langinfo.h is available.
1623       if test $ac_cv_header_langinfo_h = "yes"; then
1624           LIBS="$LIBS -lintl"
1625       fi
1626   ;;
1627 esac
1628
1629 if test "$wxUSE_GUI" = "yes"; then
1630     if test "$wxUSE_UNIX" = "yes" -a "$wxUSE_PM" != 1; then
1631         dnl defines HAVE_X11_XKBLIB_H
1632         AC_CHECK_HEADERS(X11/Xlib.h)
1633         AC_CHECK_HEADERS([X11/XKBlib.h], [], [], 
1634                          [
1635                           #if HAVE_X11_XLIB_H
1636                             #include <X11/Xlib.h>
1637                           #endif
1638                          ])
1639     fi
1640 fi
1641
1642 dnl ---------------------------------------------------------------------------
1643 dnl Checks for compiler characteristics
1644 dnl ---------------------------------------------------------------------------
1645
1646 dnl defines const to be empty if c-compiler does not support const fully
1647 AC_C_CONST
1648 dnl defines inline to a sensible value for the c-compiler
1649 AC_C_INLINE
1650
1651 dnl check the sizes of integral types (give some reasonable default values for
1652 dnl cross-compiling)
1653 dnl   defines the size of certain types of variables in SIZEOF_<TYPE>
1654 AC_CHECK_SIZEOF(char, 1)
1655 AC_CHECK_SIZEOF(short, 2)
1656 AC_CHECK_SIZEOF(void *, 4)
1657 AC_CHECK_SIZEOF(int, 4)
1658 AC_CHECK_SIZEOF(long, 4)
1659 AC_CHECK_SIZEOF(size_t, 4)
1660
1661 case "${host}" in
1662     arm-*-linux* )
1663         AC_CHECK_SIZEOF(long long, 8)
1664     ;;
1665     *-hp-hpux* )
1666         AC_CHECK_SIZEOF(long long, 0)
1667         if test "$ac_cv_sizeof_long_long" != "0"; then
1668             dnl HPUX 10.20 headers need this define in order to use long long definitions
1669             CPPFLAGS="$CPPFLAGS -D_INCLUDE_LONGLONG"
1670         fi
1671     ;;
1672     * )
1673         AC_CHECK_SIZEOF(long long, 0)
1674 esac
1675
1676 dnl we have to do it ourselves because SGI/Irix's stdio.h does not include
1677 dnl wchar_t and AC_CHECK_SIZEOF only includes stdio.h
1678 dnl Mac OS X does not provide wchar.h and wchar_t is defined by stdlib.h (GD)
1679 AC_CACHE_CHECK([size of wchar_t], wx_cv_sizeof_wchar_t,
1680 [
1681     AC_TRY_RUN(
1682         [
1683             /* DJGPP only has fake wchar_t: */
1684             #ifdef __DJGPP__
1685             #  error "fake wchar_t"
1686             #endif
1687             #ifdef HAVE_WCHAR_H
1688             #  ifdef __CYGWIN__
1689             #    include <stddef.h>
1690             #  endif
1691             #  include <wchar.h>
1692             #endif
1693             #ifdef HAVE_STDLIB_H
1694             #  include <stdlib.h>
1695             #endif
1696             #include <stdio.h>
1697             int main()
1698             {
1699                 FILE *f=fopen("conftestval", "w");
1700                 if (!f) exit(1);
1701                 fprintf(f, "%i", sizeof(wchar_t));
1702                 exit(0);
1703             }
1704         ],
1705         wx_cv_sizeof_wchar_t=`cat conftestval`,
1706         wx_cv_sizeof_wchar_t=0,
1707         [
1708             case "${host}" in
1709               *-pc-msdosdjgpp )
1710                 wx_cv_sizeof_wchar_t=0
1711                 ;;
1712               * )
1713                 wx_cv_sizeof_wchar_t=4
1714                 ;;
1715             esac
1716         ]
1717     )
1718 ])
1719
1720 AC_DEFINE_UNQUOTED(SIZEOF_WCHAR_T, $wx_cv_sizeof_wchar_t)
1721
1722 dnl check for large file support
1723 AC_SYS_LARGEFILE
1724
1725 dnl we need to define _FILE_OFFSET_BITS or _LARGE_FILES on the compiler command
1726 dnl line because otherwise the system headers risk being included before
1727 dnl wx/defs.h which defines these constants leading to inconsistent
1728 dnl sizeof(off_t) in different source files of the same program and linking
1729 dnl problems
1730 if test "x$wx_largefile" = "xyes"; then
1731     if test "x$ac_cv_sys_file_offset_bits" = "x64"; then
1732         WX_LARGEFILE_FLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES"
1733     else
1734         WX_LARGEFILE_FLAGS="-D_LARGE_FILES"
1735     fi
1736     CPPFLAGS="$CPPFLAGS $WX_LARGEFILE_FLAGS"
1737 fi
1738
1739 dnl check for bytesex stuff (don't use AC_C_BIGENDIAN to allow cross-compiling)
1740 WX_C_BIGENDIAN
1741
1742 dnl check for iostream (as opposed to iostream.h) standard header
1743 WX_CPP_NEW_HEADERS(, AC_DEFINE(wxUSE_IOSTREAMH))
1744
1745 dnl check whether C++ compiler supports bool built-in type
1746 WX_CPP_BOOL
1747
1748 dnl check whether C++ compiler supports explicit keyword
1749 WX_CPP_EXPLICIT
1750
1751 dnl check whether C++ compiler supports C++ casts
1752 AC_CXX_CONST_CAST
1753 AC_CXX_STATIC_CAST
1754
1755 dnl check various STL features
1756 if test "$wxUSE_STL" = "yes"; then
1757     AC_LANG_PUSH(C++)
1758
1759     dnl check for basic STL functionality
1760     AC_MSG_CHECKING([for basic STL functionality])
1761     AC_TRY_COMPILE([#include <string>
1762                     #include <functional>
1763                     #include <algorithm>
1764                     #include <vector>
1765                     #include <list>],
1766                     [std::vector<int> moo;
1767                      std::list<int> foo;
1768                      std::vector<int>::iterator it = 
1769                          std::find_if(moo.begin(), moo.end(),
1770                                       std::bind2nd(std::less<int>(), 3));],
1771                     [AC_MSG_RESULT([yes])],
1772                     [AC_MSG_RESULT([no])
1773                      AC_MSG_ERROR([Basic STL functionality missing])])
1774
1775     dnl check if <string> declares std::wstring
1776     AC_MSG_CHECKING([for std::wstring in <string>])
1777     AC_TRY_COMPILE([#include <string>],
1778                    [std::wstring foo;],
1779                    [AC_MSG_RESULT(yes)
1780                     AC_DEFINE(HAVE_STD_WSTRING)],
1781                    [AC_MSG_RESULT(no)])
1782
1783     dnl check for compliant std::string::compare
1784     AC_MSG_CHECKING([for compliant std::string::compare])
1785     AC_TRY_COMPILE([#include <string>],
1786                    [std::string foo, bar;
1787                     foo.compare(bar);
1788                     foo.compare(1, 1, bar);
1789                     foo.compare(1, 1, bar, 1, 1);
1790                     foo.compare("");
1791                     foo.compare(1, 1, "");
1792                     foo.compare(1, 1, "", 2);],
1793                    [AC_MSG_RESULT(yes)
1794                     AC_DEFINE(HAVE_STD_STRING_COMPARE)],
1795                    [AC_MSG_RESULT(no)])
1796
1797     AC_LANG_POP
1798 fi
1799
1800 dnl ---------------------------------------------------------------------------
1801 dnl Define search path for includes and libraries: all headers and libs will be
1802 dnl looked for in all directories of this path
1803 dnl ---------------------------------------------------------------------------
1804
1805 dnl Notice that /usr/include should *not* be in this list, otherwise it breaks
1806 dnl compilation on Solaris/AIX/... with gcc because standard (non ANSI C)
1807 dnl headers are included instead of the "fixed" (ANSI-fied) gcc ones.
1808 dnl
1809 dnl Also try to put all directories which may contain X11R6 before those which
1810 dnl may contain X11R5/4 - we want to use R6 on machines which have both!
1811 dnl
1812 dnl In the same vein. Motif 2.1 should be tried before Motif 1.2 for the
1813 dnl systems which have both (AIX 4.x does)
1814 SEARCH_INCLUDE="\
1815     /usr/local/include        \
1816                               \
1817     /usr/Motif-2.1/include    \
1818     /usr/Motif-1.2/include    \
1819     /usr/include/Motif1.2     \
1820     /opt/xpm/include/X11      \
1821     /opt/GBxpm/include/       \
1822     /opt/GBxpm/X11/include/   \
1823                               \
1824     /usr/dt/include           \
1825     /usr/openwin/include      \
1826                               \
1827     /usr/include/Xm           \
1828                               \
1829     /usr/X11R6/include        \
1830     /usr/X11R6.4/include      \
1831     /usr/X11R5/include        \
1832     /usr/X11R4/include        \
1833                               \
1834     /usr/include/X11R6        \
1835     /usr/include/X11R5        \
1836     /usr/include/X11R4        \
1837                               \
1838     /usr/local/X11R6/include  \
1839     /usr/local/X11R5/include  \
1840     /usr/local/X11R4/include  \
1841                               \
1842     /usr/local/include/X11R6  \
1843     /usr/local/include/X11R5  \
1844     /usr/local/include/X11R4  \
1845                               \
1846     /usr/X11/include          \
1847     /usr/include/X11          \
1848     /usr/local/X11/include    \
1849     /usr/local/include/X11    \
1850                               \
1851     /usr/X386/include         \
1852     /usr/x386/include         \
1853     /usr/XFree86/include/X11  \
1854                               \
1855     X:/XFree86/include        \
1856     X:/XFree86/include/X11    \
1857                               \
1858     /usr/include/gtk          \
1859     /usr/local/include/gtk    \
1860     /usr/include/glib         \
1861     /usr/local/include/glib   \
1862                               \
1863     /usr/include/qt           \
1864     /usr/local/include/qt     \
1865                               \
1866     /usr/local/arm/3.3.2/include     \
1867                               \
1868     /usr/include/windows      \
1869     /usr/include/wine         \
1870     /usr/local/include/wine   \
1871                               \
1872     /usr/unsupported/include  \
1873     /usr/athena/include       \
1874     /usr/local/x11r5/include  \
1875     /usr/lpp/Xamples/include  \
1876                               \
1877     /usr/openwin/share/include"
1878
1879 dnl prepend lib and lib32 for IRIX where the files in these directories should
1880 dnl be found before the ones in lib64 for 32bit compilation -- of course, this
1881 dnl probably/surely breaks 64bit compilation... IMO the only real solution is to
1882 dnl stop using WX_PATH_FIND_LIBRARIES() at all and use AC_CHECK_LIB() instead
1883 dnl
1884 dnl add 64 bit versions for Linux on AMD (this is not perfect but well...)
1885 SEARCH_LIB="/usr/lib /usr/lib32 `echo "$SEARCH_INCLUDE" | sed s/include/lib/g` /usr/lib64 /usr/X11R6/lib64"
1886
1887 dnl ------------------------------------------------------------------------
1888 dnl Check for libraries
1889 dnl ------------------------------------------------------------------------
1890
1891 dnl flush the cache because checking for libraries below might abort
1892 AC_CACHE_SAVE
1893
1894 dnl check for glibc version
1895 dnl
1896 dnl VZ: I have no idea why had this check been there originally, but now
1897 dnl     we could probably do without it by just always adding _GNU_SOURCE
1898 if test "$USE_LINUX" = 1 -o "$USE_GNU" = 1; then
1899     AC_CACHE_CHECK([for glibc 2.1 or later], wx_cv_lib_glibc21,[
1900         AC_TRY_COMPILE([#include <features.h>],
1901             [
1902                 #if (__GLIBC__ < 2) || (__GLIBC_MINOR__ < 1)
1903                     #error not glibc2.1
1904                 #endif
1905             ],
1906             [
1907                 wx_cv_lib_glibc21=yes
1908             ],
1909             [
1910                 wx_cv_lib_glibc21=no
1911             ]
1912         )
1913     ])
1914     if test "$wx_cv_lib_glibc21" = "yes"; then
1915         AC_DEFINE(wxHAVE_GLIBC2)
1916     fi
1917 fi
1918
1919 dnl we may need _GNU_SOURCE for 2 things:
1920 dnl
1921 dnl  1. to get PTHREAD_MUTEX_RECURSIVE with glibc 2.1+ (strictly speaking we
1922 dnl  only need _XOPEN_SOURCE=500 but just defining this disables _BSD_SOURCE
1923 dnl  which breaks libtiff compilation, so it is simpler to just define
1924 dnl  _GNU_SOURCE to get everything)
1925 dnl
1926 dnl  2. for Unicode functions
1927 if test "x$wx_cv_lib_glibc21" = "xyes"; then
1928     if test "$wxUSE_UNICODE" = "yes" -o "$wxUSE_THREADS" = "yes"; then
1929         AC_DEFINE(_GNU_SOURCE)
1930     fi
1931 fi
1932
1933 dnl ---------------------------------------------------------------------------
1934 dnl Optional libraries
1935 dnl
1936 dnl   --with-<lib>=sys
1937 dnl       looks for system library and fails if not found
1938 dnl
1939 dnl   --with-<lib>
1940 dnl   --with-<lib>=yes
1941 dnl       looks for system library and, if not found, prints a warning,
1942 dnl       falls back to the builtin wx version, and continues configuration
1943 dnl
1944 dnl   --with-<lib>=builtin
1945 dnl       uses builtin wx version without searching for system library
1946 dnl
1947 dnl   --with-<lib>=no
1948 dnl   --without-<lib>
1949 dnl       do not use library (neither system nor builtin wx version)
1950 dnl
1951 dnl ---------------------------------------------------------------------------
1952
1953 dnl ------------------------------------------------------------------------
1954 dnl Check for regex libraries
1955 dnl ------------------------------------------------------------------------
1956
1957 if test "$wxUSE_REGEX" != "no"; then
1958     AC_DEFINE(wxUSE_REGEX)
1959             
1960     if test "$wxUSE_UNICODE" = "yes" -a "$wxUSE_REGEX" = "yes"; then
1961         AC_MSG_WARN([Defaulting to the the builtin regex library for Unicode build.])
1962         wxUSE_REGEX=builtin
1963     fi
1964
1965     if test "$wxUSE_REGEX" = "sys" -o "$wxUSE_REGEX" = "yes" ; then
1966         dnl according to Unix 98 specs, regcomp() is in libc but I believe that
1967         dnl on some old systems it may be in libregex - check for it too?
1968         AC_CHECK_HEADER(regex.h, [AC_CHECK_FUNCS(regcomp)])
1969
1970         if test "x$ac_cv_func_regcomp" != "xyes"; then
1971             if test "$wxUSE_REGEX" = "sys" ; then
1972                 AC_MSG_ERROR([system regex library not found! Use --with-regex to use built-in version])
1973             else
1974                 AC_MSG_WARN([system regex library not found, will use built-in instead])
1975                 wxUSE_REGEX=builtin
1976             fi
1977         else
1978             dnl we are using the system library
1979             wxUSE_REGEX=sys
1980             dnl only the built-in supports advanced REs
1981             AC_DEFINE(WX_NO_REGEX_ADVANCED)
1982         fi
1983     fi
1984 fi
1985
1986 dnl ------------------------------------------------------------------------
1987 dnl Check for zlib compression library
1988 dnl ------------------------------------------------------------------------
1989
1990 ZLIB_LINK=
1991 if test "$wxUSE_ZLIB" != "no" ; then
1992     AC_DEFINE(wxUSE_ZLIB)
1993
1994     if test "$wxUSE_ZLIB" = "sys" -o "$wxUSE_ZLIB" = "yes" ; then
1995         dnl don't test for zlib under Mac -- its verson there is 1.1.3 but we
1996         dnl should still use it because hopefully (can someone confirm this?)
1997         dnl Apple did fix the security problem in it and not using the system
1998         dnl library results in a whole bunch of warnings when linking with
1999         dnl Carbon framework
2000         if test "$USE_DARWIN" = 1; then
2001             system_zlib_h_ok="yes"
2002         else
2003             dnl we have troubles with ancient zlib versions (e.g. 1.0.4 is
2004             dnl known to not work) and although I don't know which is
2005             dnl the minimal required version it's safer to test for 1.1.4 as
2006             dnl it fixes a security problem in 1.1.3 -- and hopefully nobody
2007             dnl has anything more ancient (1.1.3 was released in July 1998)
2008             dnl anyhow
2009             AC_CACHE_CHECK([for zlib.h >= 1.1.4], ac_cv_header_zlib_h,
2010                 [AC_TRY_RUN(
2011                     dnl zlib.h defines ZLIB_VERSION="x.y.z"
2012                     [
2013                         #include <zlib.h>
2014                         #include <stdio.h>
2015
2016                         int main()
2017                         {
2018                             FILE *f=fopen("conftestval", "w");
2019                             if (!f) exit(1);
2020                             fprintf(f, "%s",
2021                                     ZLIB_VERSION[0] == '1' &&
2022                                     (ZLIB_VERSION[2] > '1' ||
2023                                     (ZLIB_VERSION[2] == '1' &&
2024                                      ZLIB_VERSION[4] >= '4')) ? "yes" : "no");
2025                             exit(0);
2026                         }
2027                     ],
2028                     ac_cv_header_zlib_h=`cat conftestval`,
2029                     ac_cv_header_zlib_h=no,
2030                     dnl cross-compiling: don't have an answer, try later
2031                     unset ac_cv_header_zlib_h
2032                 )]
2033             )
2034             dnl If the test above did not come up with a value (e.g. cross
2035             dnl compiling) then this should give a definitive answer
2036             AC_CHECK_HEADER(zlib.h)
2037
2038             system_zlib_h_ok=$ac_cv_header_zlib_h
2039         fi
2040
2041         if test "$system_zlib_h_ok" = "yes"; then
2042             AC_CHECK_LIB(z, deflate, ZLIB_LINK=" -lz")
2043         fi
2044
2045         if test "x$ZLIB_LINK" = "x" ; then
2046             if test "$wxUSE_ZLIB" = "sys" ; then
2047                 AC_MSG_ERROR([zlib library not found or too old! Use --with-zlib=builtin to use built-in version])
2048             else
2049                 AC_MSG_WARN([zlib library not found or too old, will use built-in instead])
2050                 wxUSE_ZLIB=builtin
2051             fi
2052         else
2053             dnl we are using the system library
2054             wxUSE_ZLIB=sys
2055         fi
2056     fi
2057 fi
2058
2059 dnl ------------------------------------------------------------------------
2060 dnl Check for png library
2061 dnl ------------------------------------------------------------------------
2062
2063 PNG_LINK=
2064 if test "$wxUSE_LIBPNG" != "no" ; then
2065     AC_DEFINE(wxUSE_LIBPNG)
2066
2067     if test "$wxUSE_MGL" = 1 -a "$wxUSE_LIBPNG" = "builtin" ; then
2068         AC_MSG_WARN([wxMGL doesn't work with builtin png library, will use MGL one instead])
2069         wxUSE_LIBPNG=sys
2070     fi
2071
2072     dnl for the check below to have a chance to succeed, we must already have
2073     dnl libz somewhere (don't do this when bulding wxMGL since its libpng
2074     dnl doesn't depend on zlib)
2075     if test "$wxUSE_MGL" != 1 -a "$wxUSE_LIBPNG" = "sys" -a "$wxUSE_ZLIB" != "sys" ; then
2076         AC_MSG_WARN([system png library doesn't work without system zlib, will use built-in instead])
2077         wxUSE_LIBPNG=builtin
2078     fi
2079
2080     if test "$wxUSE_MGL" != 1 ; then
2081         dnl Don't check for libpng when building wxMGL, libmgl contains it
2082         if test "$wxUSE_LIBPNG" = "sys" -o "$wxUSE_LIBPNG" = "yes" ; then
2083             dnl libpng version 0.9 is known to not work, if an even newer
2084             dnl version is required, just bump it up in the test below
2085             AC_CACHE_CHECK([for png.h > 0.90], ac_cv_header_png_h,
2086                 [AC_TRY_RUN(
2087                     dnl png.h defines PNG_LIBPNG_VER=number
2088                     [
2089                         #include <png.h>
2090                         #include <stdio.h>
2091
2092                         int main()
2093                         {
2094                             FILE *f=fopen("conftestval", "w");
2095                             if (!f) exit(1);
2096                             fprintf(f, "%s",
2097                                      PNG_LIBPNG_VER > 90 ? "yes" : "no");
2098                             exit(0);
2099                         }
2100                     ],
2101                     ac_cv_header_png_h=`cat conftestval`,
2102                     ac_cv_header_png_h=no,
2103                     dnl cross-compiling: test (later) if we have any png.h
2104                     unset ac_cv_header_png_h
2105                 )]
2106             )
2107             AC_CHECK_HEADER(png.h)
2108
2109             if test "$ac_cv_header_png_h" = "yes"; then
2110                 AC_CHECK_LIB(png, png_check_sig, PNG_LINK=" -lpng", , [-lz -lm])
2111             fi
2112
2113             if test "x$PNG_LINK" = "x" ; then
2114                 if test "$wxUSE_LIBPNG" = "sys" ; then
2115                     AC_MSG_ERROR([system png library not found or too old! Use --with-libpng=builtin to use built-in version])
2116                 else
2117                     AC_MSG_WARN([system png library not found or too old, will use built-in instead])
2118                     wxUSE_LIBPNG=builtin
2119                 fi
2120             else
2121                 dnl we are using the system library
2122                 wxUSE_LIBPNG=sys
2123             fi
2124         fi
2125     fi
2126
2127     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS png"
2128 fi
2129
2130 dnl ------------------------------------------------------------------------
2131 dnl Check for jpeg library
2132 dnl ------------------------------------------------------------------------
2133
2134 JPEG_LINK=
2135 if test "$wxUSE_LIBJPEG" != "no" ; then
2136     AC_DEFINE(wxUSE_LIBJPEG)
2137
2138     if test "$wxUSE_MGL" = 1 -a "$wxUSE_LIBJPEG" = "builtin" ; then
2139         AC_MSG_WARN([wxMGL doesn't work with builtin jpeg library, will use MGL one instead])
2140         wxUSE_LIBJPEG=sys
2141     fi
2142
2143     if test "$wxUSE_MGL" != 1 ; then
2144         dnl Don't check for libjpeg when building wxMGL, libmgl contains it
2145         if test "$wxUSE_LIBJPEG" = "sys" -o "$wxUSE_LIBJPEG" = "yes" ; then
2146             dnl can't use AC_CHECK_HEADER as jconfig.h defines things like
2147             dnl HAVE_STDLIB_H which are already defined and this provokes
2148             dnl a compiler warning which configure considers as an error...
2149             AC_MSG_CHECKING(for jpeglib.h)
2150             AC_CACHE_VAL(ac_cv_header_jpeglib_h,
2151                 AC_TRY_COMPILE(
2152                     [
2153                         #undef HAVE_STDLIB_H
2154                         #include <stdio.h>
2155                         #include <jpeglib.h>
2156                     ],
2157                     [
2158                     ],
2159                     ac_cv_header_jpeglib_h=yes,
2160                     ac_cv_header_jpeglib_h=no
2161                 )
2162             )
2163             AC_MSG_RESULT($ac_cv_header_jpeglib_h)
2164
2165             if test "$ac_cv_header_jpeglib_h" = "yes"; then
2166                 AC_CHECK_LIB(jpeg, jpeg_read_header, JPEG_LINK=" -ljpeg")
2167             fi
2168
2169             if test "x$JPEG_LINK" = "x" ; then
2170                 if test "$wxUSE_LIBJPEG" = "sys" ; then
2171                     AC_MSG_ERROR([system jpeg library not found! Use --with-libjpeg=builtin to use built-in version])
2172                 else
2173                     AC_MSG_WARN([system jpeg library not found, will use built-in instead])
2174                     wxUSE_LIBJPEG=builtin
2175                 fi
2176             else
2177                 dnl we are using the system library
2178                 wxUSE_LIBJPEG=sys
2179             fi
2180         fi
2181     fi
2182 fi
2183
2184 dnl ------------------------------------------------------------------------
2185 dnl Check for tiff library
2186 dnl ------------------------------------------------------------------------
2187
2188 TIFF_LINK=
2189 TIFF_PREREQ_LINKS=-lm
2190 if test "$wxUSE_LIBTIFF" != "no" ; then
2191     AC_DEFINE(wxUSE_LIBTIFF)
2192
2193     if test "$wxUSE_LIBTIFF" = "sys" -o "$wxUSE_LIBTIFF" = "yes" ; then
2194         dnl libtiff may depend on libjpeg and libz so use them in the test
2195         dnl below or it would fail
2196         if test "$wxUSE_LIBJPEG" = "sys"; then
2197             TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $JPEG_LINK"
2198         fi
2199         if test "$wxUSE_ZLIB" = "sys"; then
2200             TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $ZLIB_LINK"
2201         fi
2202         AC_CHECK_HEADER(tiffio.h,
2203                         [
2204                             AC_CHECK_LIB(tiff, TIFFError,
2205                                          TIFF_LINK=" -ltiff",
2206                                          ,
2207                                          $TIFF_PREREQ_LINKS)
2208                         ]
2209                        )
2210
2211         if test "x$TIFF_LINK" = "x" ; then
2212             if test "$wxUSE_LIBTIFF" = "sys" ; then
2213                 AC_MSG_ERROR([system tiff library not found! Use --with-libtiff=builtin to use built-in version])
2214             else
2215                 AC_MSG_WARN([system tiff library not found, will use built-in instead])
2216                 wxUSE_LIBTIFF=builtin
2217             fi
2218         else
2219             dnl we are using the system library
2220             wxUSE_LIBTIFF=sys
2221         fi
2222     fi
2223 fi
2224
2225 dnl ------------------------------------------------------------------------
2226 dnl Check for expat libraries
2227 dnl ------------------------------------------------------------------------
2228
2229 if test "$wxUSE_EXPAT" != "no"; then
2230     wxUSE_XML=yes
2231     AC_DEFINE(wxUSE_EXPAT)
2232     AC_DEFINE(wxUSE_XML)
2233     
2234     if test "$wxUSE_EXPAT" = "sys" -o "$wxUSE_EXPAT" = "yes" ; then           
2235         AC_CHECK_HEADER([expat.h], [found_expat_h=1])
2236         if test "x$found_expat_h" = "x1"; then
2237             dnl Expat 1.95.6 comes with broken expat.h:
2238             AC_CACHE_CHECK([if expat.h is valid C++ header],
2239                 wx_cv_expat_is_not_broken,
2240                 [
2241                 AC_LANG_SAVE
2242                 AC_LANG_CPLUSPLUS
2243                 AC_TRY_COMPILE([#include <expat.h>],[],
2244                     wx_cv_expat_is_not_broken=yes,
2245                     wx_cv_expat_is_not_broken=no
2246                 )
2247                 AC_LANG_RESTORE
2248                 ]
2249             )
2250             if test "$wx_cv_expat_is_not_broken" = "yes" ; then
2251                 AC_CHECK_LIB(expat, XML_ParserCreate, EXPAT_LINK=" -lexpat")
2252             fi
2253         fi
2254         if test "x$EXPAT_LINK" = "x" ; then
2255             if test "$wxUSE_EXPAT" = "sys" ; then
2256                 AC_MSG_ERROR([system expat library not found! Use --with-expat=builtin to use built-in version])
2257             else
2258                 AC_MSG_WARN([system expat library not found, will use built-in instead])
2259                 wxUSE_EXPAT=builtin
2260             fi
2261         else
2262             dnl we are using the system library
2263             wxUSE_EXPAT=sys
2264         fi
2265     fi
2266     if test "$wxUSE_EXPAT" = "builtin" ; then
2267         dnl Expat needs this:
2268         AC_CONFIG_SUBDIRS([src/expat])
2269     fi
2270 fi
2271
2272
2273 dnl ------------------------------------------------------------------------
2274 dnl Check for libmspack
2275 dnl ------------------------------------------------------------------------
2276
2277 if test "$wxUSE_LIBMSPACK" != "no"; then
2278     
2279     AC_CHECK_HEADER([mspack.h], [found_mspack_h=1])
2280     if test "x$found_mspack_h" = "x1"; then
2281         AC_CHECK_LIB(mspack, mspack_create_chm_decompressor,
2282                      MSPACK_LINK=" -lmspack")
2283     fi
2284     if test "x$MSPACK_LINK" = "x" ; then
2285         wxUSE_LIBMSPACK=no
2286     else
2287         AC_DEFINE(wxUSE_LIBMSPACK)
2288     fi
2289 fi
2290
2291
2292 dnl ----------------------------------------------------------------
2293 dnl search for toolkit (widget sets)
2294 dnl ----------------------------------------------------------------
2295
2296 AFMINSTALL=
2297 WIN32INSTALL=
2298
2299 TOOLKIT=
2300 TOOLKIT_INCLUDE=
2301 WIDGET_SET=
2302
2303 dnl are we building for a win32 target environment?
2304 dnl If so, setup common stuff needed for both GUI and Base libs.
2305 if test "$USE_WIN32" = 1 ; then
2306     AC_CHECK_HEADERS(w32api.h)
2307     AC_CHECK_HEADER(windows.h, [],
2308     [
2309         AC_MSG_ERROR(please set CFLAGS to contain the location of windows.h)
2310     ])
2311
2312     dnl --- FIXME: This is still a somewhat random list of libs,
2313     dnl ---        some of them should probably be included conditionally.
2314     LIBS="$LIBS -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32"
2315
2316     if test "$wxUSE_ACCESSIBILITY" = "yes" ; then
2317         LIBS="$LIBS -loleacc"
2318     fi
2319
2320     case "${host}" in
2321         *-*-cygwin* )
2322             dnl Cygwin doesn't include these by default
2323             LIBS="$LIBS -lkernel32 -luser32"
2324             TOOLCHAIN_DEFS="${TOOLCHAIN_DEFS} -D__WIN95__"
2325     esac
2326
2327     dnl add extra odbc libs if we have compiled in odbc
2328     if test "$wxUSE_ODBC" = "sys" ; then
2329         wxUSE_ODBC = "yes"
2330     fi
2331     if test "$wxUSE_ODBC" = "yes" ; then
2332         LIBS=" -lodbc32 -lole32 -loleaut32 $LIBS"
2333         AC_DEFINE(wxUSE_ODBC)
2334     fi
2335     dnl We might want to abort here if wxUSE_ODBC="builtin" isn't supported on msw.
2336
2337     RESFLAGS="--include-dir \$(top_srcdir)/include --include-dir \$(top_srcdir)/\$(program_dir) --define __WIN32__ --define __WIN95__ --define __GNUWIN32__"
2338     RESPROGRAMOBJ="\$(PROGRAM)_resources.o"
2339
2340     dnl install Win32-specific files in "make install"
2341     WIN32INSTALL=win32install
2342 fi
2343
2344 if test "$wxUSE_GUI" = "yes"; then
2345     USE_GUI=1
2346
2347     GUI_TK_LIBRARY=
2348
2349     WXGTK12=
2350     WXGTK127=
2351     WXGTK20=
2352     WXGPE=
2353
2354     if test "$wxUSE_MSW" = 1 ; then
2355         TOOLKIT=MSW
2356         GUIDIST=MSW_DIST
2357
2358         dnl -mwindows causes a heap of other default gui libs to be linked in.
2359         dnl FIXME: If cygwin needs this, please push it above, if not, please
2360         dnl        remove this comment :-)
2361         case "${host}" in
2362             *-*-mingw32* )
2363                 WXCONFIG_LDFLAGS_GUI="$LDFLAGS -Wl,--subsystem,windows -mwindows"
2364         esac
2365     fi
2366
2367     if test "$wxUSE_GTK" = 1; then
2368         AC_MSG_CHECKING([for GTK+ version])
2369
2370         gtk_version_cached=1
2371         AC_CACHE_VAL(wx_cv_lib_gtk,
2372             [
2373                 dnl stupid GTK+ AM macros produce their own messages, so we
2374                 dnl have to pass to the next line
2375                 gtk_version_cached=0
2376                 AC_MSG_RESULT()
2377
2378                 dnl we must link against lgthread unless the user
2379                 dnl used --disable-threads
2380                 GTK_MODULES=
2381                 if test "$wxUSE_THREADS" = "yes"; then
2382                     GTK_MODULES=gthread
2383                 fi
2384
2385                 dnl note that if we fail to find GTK2 we abort and don't fall
2386                 dnl back to GTK1.x
2387                 wx_cv_lib_gtk=
2388                 if test "x$wxUSE_GTK2" = "xyes"; then
2389                     AM_PATH_GTK_2_0(2.0.0, wx_cv_lib_gtk=2.0, , $GTK_MODULES)
2390                 else
2391                     AM_PATH_GTK(1.2.7, wx_cv_lib_gtk=1.2.7, , $GTK_MODULES)
2392
2393                     if test -z "$wx_cv_lib_gtk"; then
2394                         AM_PATH_GTK(1.2.3, wx_cv_lib_gtk=1.2.3, , $GTK_MODULES)
2395                     fi
2396                 fi
2397
2398                 if test -z "$wx_cv_lib_gtk"; then
2399                     dnl looks better in AC_MSG_RESULT
2400                     wx_cv_lib_gtk=none
2401                 else
2402                     dnl we need to cache GTK_CFLAGS and GTK_LIBS for the
2403                     dnl subsequent runs
2404                     wx_cv_cflags_gtk=$GTK_CFLAGS
2405                     wx_cv_libs_gtk=$GTK_LIBS
2406                 fi
2407             ]
2408         )
2409
2410         dnl if it wasn't cached, the messages from AM_PATH_GTK() above are
2411         dnl enough
2412         if test "$gtk_version_cached" = 1; then
2413             AC_MSG_RESULT($wx_cv_lib_gtk)
2414         fi
2415
2416         case "$wx_cv_lib_gtk" in
2417             2.0)    WXGTK20=1
2418                     TOOLKIT_VERSION=2
2419                     ;;
2420             1.2.7)  WXGTK127=1
2421                     WXGTK12=1
2422                     ;;
2423             1.2.3)  WXGTK12=1
2424                     ;;
2425             *)      AC_MSG_ERROR([
2426 Please check that gtk-config is in path, the directory
2427 where GTK+ libraries are installed (returned by
2428 'gtk-config --libs' command) is in LD_LIBRARY_PATH or
2429 equivalent variable and GTK+ is version 1.2.3 or above.
2430                             ])
2431                     ;;
2432         esac
2433
2434         if test "$WXGTK20" = 1; then
2435             if test "$wxUSE_PRINTING_ARCHITECTURE" = "yes" ; then
2436                 PKG_CHECK_MODULES(PANGOFT2, pangoft2,
2437                     [
2438                         CXXFLAGS="$CXXFLAGS $PANGOFT2_CFLAGS"
2439                         GUI_TK_LIBRARY="$GUI_TK_LIBRARY $PANGOFT2_LIBS"
2440                     ],
2441                     [
2442                         AC_MSG_WARN([pangoft2 library not found, library will be compiled without printing support])
2443                         wxUSE_PRINTING_ARCHITECTURE="no"
2444                     ]
2445                 )
2446             fi
2447         else
2448             if test "$wxUSE_UNICODE" = "yes"; then
2449                 AC_MSG_WARN([Unicode configuration not supported with GTK+ 1.x])
2450                 wxUSE_UNICODE=no
2451             fi
2452         fi
2453
2454         dnl we need poll() in src/gtk/app.cpp (we know that Darwin doesn't
2455         dnl have it but we do the check for the others)
2456         if test "$USE_DARWIN" != 1; then
2457             AC_CHECK_FUNCS(poll)
2458         fi
2459
2460         TOOLKIT_INCLUDE="$wx_cv_cflags_gtk"
2461         GUI_TK_LIBRARY="$wx_cv_libs_gtk $GUI_TK_LIBRARY"
2462
2463         AFMINSTALL=afminstall
2464         TOOLKIT=GTK
2465         GUIDIST=GTK_DIST
2466
2467         dnl test for XIM support in libgdk
2468         AC_CHECK_LIB(gdk, gdk_im_open, AC_DEFINE(HAVE_XIM))
2469         
2470         
2471         dnl test for external libxpm if we're configured to use it
2472         if test "$wxUSE_GPE" = "yes"; then
2473             AC_MSG_CHECKING(for gpewidget library)
2474             WX_PATH_FIND_LIBRARIES($SEARCH_LIB,gpewidget)
2475             if test "$ac_find_libraries" != "" ; then
2476                 WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
2477                 dnl -lgpewidget must be before all GTK libs and
2478                 dnl we guess its path from the prefix
2479                 GUI_TK_LIBRARY="-L${prefix}/lib -lgpewidget $GUI_TK_LIBRARY"
2480                 WXGPE=1
2481                 AC_MSG_RESULT(found at $ac_find_libraries)
2482             else
2483                 AC_MSG_RESULT(not found)
2484             fi
2485
2486             dnl AC_MSG_CHECKING(for gpe library)
2487             dnl WX_PATH_FIND_LIBRARIES($SEARCH_LIB,gpe)
2488             dnl if test "$ac_find_libraries" != "" ; then
2489             dnl     WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
2490             dnl     GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lgpe"
2491             dnl     AC_MSG_RESULT(found at $ac_find_libraries)
2492             dnl else
2493             dnl     AC_MSG_RESULT(not found)
2494             dnl fi
2495         fi
2496     fi
2497
2498     if test "$wxUSE_MGL" = 1; then
2499        AC_MSG_CHECKING(for SciTech MGL library)
2500         if test "x$MGL_ROOT" = x ; then
2501             AC_MSG_RESULT(not found)
2502             AC_MSG_ERROR([Cannot find MGL library. Make sure MGL_ROOT is set.])
2503         else
2504             AC_MSG_RESULT($MGL_ROOT)
2505         fi
2506
2507         AC_MSG_CHECKING(for libmgl location)
2508         dnl Find MGL library that we want
2509         dnl FIXME_MGL - test for MGL variants for freebsd etc.;
2510         dnl             and for non-x86 versions
2511         case "${host}" in
2512             *-*-linux* )
2513               dnl glibc.so, glibc are for older versions of MGL,
2514               dnl x86/a, x86/so are used by >= 5.0 R11
2515               if test "x$wxUSE_SHARED" = xyes ; then
2516                   mgl_os_candidates="linux/gcc/x86/so linux/gcc/x86/a linux/gcc/glibc.so linux/gcc/glibc"
2517               else
2518                   mgl_os_candidates="linux/gcc/x86/a linux/gcc/x86/so linux/gcc/glibc linux/gcc/glibc.so"
2519               fi
2520               ;;
2521             *-pc-msdosdjgpp )
2522               mgl_os_candidates="dos32/dj2"
2523               ;;
2524             *)
2525               AC_MSG_ERROR(This system type ${host} is not yet supported by wxMGL.)
2526         esac
2527
2528         mgl_lib_type=""
2529         mgl_os=""
2530
2531         for mgl_os_i in $mgl_os_candidates ; do
2532             if test "x$mgl_os" = x ; then
2533                 if test "$wxUSE_DEBUG_FLAG" = yes ; then
2534                     if test -f $MGL_ROOT/lib/debug/$mgl_os_i/libmgl.a -o \
2535                             -f $MGL_ROOT/lib/debug/$mgl_os_i/libmgl.so; then
2536                         mgl_lib_type=debug
2537                         mgl_os=$mgl_os_i
2538                     fi
2539                 fi
2540                 if test "x$mgl_lib_type" = x ; then
2541                     if test -f $MGL_ROOT/lib/release/$mgl_os_i/libmgl.a -o \
2542                             -f $MGL_ROOT/lib/release/$mgl_os_i/libmgl.so; then
2543                         mgl_lib_type=release
2544                         mgl_os=$mgl_os_i
2545                     fi
2546                 fi
2547             fi
2548         done
2549
2550         if test "x$mgl_os" = x ; then
2551             AC_MSG_RESULT(not found)
2552             AC_MSG_ERROR([Cannot find MGL libraries, make sure they are compiled.])
2553         fi
2554         AC_MSG_RESULT("$MGL_ROOT/lib/$mgl_lib_type/$mgl_os")
2555
2556         wxUSE_UNIVERSAL="yes"
2557
2558         TOOLKIT_INCLUDE="-I$MGL_ROOT/include"
2559         GUI_TK_LIBRARY="-L$MGL_ROOT/lib/$mgl_lib_type/$mgl_os -lmgl -lmglcpp -lpm"
2560
2561         AFMINSTALL=afminstall
2562         TOOLKIT=MGL
2563         GUIDIST=MGL_DIST
2564     fi
2565
2566     if test "$wxUSE_MICROWIN" = 1; then
2567         AC_MSG_CHECKING(for MicroWindows)
2568         if test "x$MICROWINDOWS" = x ; then
2569             AC_MSG_RESULT(not found)
2570             AC_MSG_ERROR([Cannot find MicroWindows library. Make sure MICROWINDOWS is set.])
2571         else
2572             AC_MSG_RESULT($MICROWINDOWS)
2573         fi
2574
2575         if test -f $MICROWINDOWS/lib/libmwin.a; then
2576             AC_MSG_RESULT(MicroWindows' libraries found.)
2577         else
2578             AC_MSG_ERROR([Cannot find MicroWindows libraries, make sure they are compiled.])
2579         fi
2580
2581         TOOLKIT_INCLUDE="-I$MICROWINDOWS/include"
2582         GUI_TK_LIBRARY="-L$MICROWINDOWS/lib -lmwin -lmwengine -mwfonts -mwdrivers -mwinlib"
2583
2584         wxUSE_UNIVERSAL="yes"
2585
2586         AFMINSTALL=afminstall
2587         TOOLKIT=MICROWIN
2588         GUIDIST=MICROWIN_DIST
2589
2590         TOOLCHAIN_DEFS="${TOOLCHAIN_DEFS} -D__WXMSW__ -D__WIN95__ -D__WIN32__ -DMWIN -DMICROWIN_NOCONTROLS -DMICROWIN_TODO=1"
2591     fi
2592
2593     if test "$wxUSE_X11" = 1; then
2594         dnl use standard macros to check for X headers/libs, this brings support
2595         dnl for the standard configure options --x-includes and --x-libraries
2596         AC_PATH_XTRA
2597
2598         if test "$no_x" = "yes"; then
2599           AC_MSG_ERROR(X11 not found, please use --x-includes and/or --x-libraries options)
2600         fi
2601
2602         GUI_TK_LIBRARY="$X_LIBS"
2603         TOOLKIT_INCLUDE="$X_CFLAGS"
2604         AFMINSTALL=afminstall
2605         COMPILED_X_PROGRAM=0
2606
2607         if test "$wxUSE_NANOX" = "yes"; then
2608             AC_MSG_CHECKING(for MicroWindows/NanoX distribution)
2609             if test "x$MICROWIN" = x ; then
2610                 AC_MSG_RESULT(not found)
2611                 AC_MSG_ERROR([Cannot find MicroWindows library. Make sure MICROWIN is set.])
2612             else
2613                 AC_MSG_RESULT($MICROWIN)
2614                 AC_DEFINE(wxUSE_NANOX)
2615             fi
2616         fi
2617
2618         if test "$wxUSE_UNICODE" = "yes"; then
2619                 PKG_CHECK_MODULES(PANGOX, pangox,
2620                     [
2621                         CXXFLAGS="$CXXFLAGS $PANGOX_CFLAGS"
2622                         GUI_TK_LIBRARY="$GUI_TK_LIBRARY $PANGOX_LIBS"
2623                     ],
2624                     [
2625                         AC_MSG_ERROR([pangox library not found, library cannot be compiled in Unicode mode])
2626                     ]
2627                 )
2628                 PKG_CHECK_MODULES(PANGOFT2, pangoft2,
2629                     [
2630                         CXXFLAGS="$CXXFLAGS $PANGOFT2_CFLAGS"
2631                         GUI_TK_LIBRARY="$GUI_TK_LIBRARY $PANGOFT2_LIBS"
2632                     ],
2633                     [
2634                         AC_MSG_WARN([pangoft2 library not found, library will be compiled without printing support])
2635                         wxUSE_PRINTING_ARCHITECTURE="no"
2636                     ]
2637                 )
2638                 PKG_CHECK_MODULES(PANGOXFT, pangoxft,
2639                     [
2640                         CXXFLAGS="$CXXFLAGS $PANGOXFT_CFLAGS"
2641                         GUI_TK_LIBRARY="$GUI_TK_LIBRARY $PANGOXFT_LIBS"
2642                     ],
2643                     [
2644                         AC_MSG_WARN([pangoxft library not found, library will be compiled without anti-aliasing support])
2645                     ]
2646                 )
2647         fi
2648
2649         wxUSE_UNIVERSAL="yes"
2650
2651         if test "$wxUSE_NANOX" = "yes"; then
2652             TOOLKIT_INCLUDE="-I\$(top_srcdir)/include/wx/x11/nanox -I\$(MICROWIN)/src/include $TOOLKIT_INCLUDE"
2653             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"
2654             GUI_TK_LIBRARY="$GUI_TK_LIBRARY \$(MICROWIN)/src/lib/libnano-X.a"
2655         else
2656             GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lX11"
2657         fi
2658
2659         TOOLKIT_VPATH="\${top_srcdir}/src/x11"
2660         TOOLKIT=X11
2661         GUIDIST=X11_DIST
2662     fi
2663
2664     if test "$wxUSE_MOTIF" = 1; then
2665         dnl use standard macros to check for X headers/libs, this brings support
2666         dnl for the standard configure options --x-includes and --x-libraries
2667         AC_PATH_XTRA
2668
2669         if test "$no_x" = "yes"; then
2670           AC_MSG_ERROR(X11 not found, please use --x-includes and/or --x-libraries options)
2671         fi
2672
2673         dnl for some reason AC_PATH_XTRA seems to add -INONE and -LNONE to
2674         dnl X_LIBS and X_CFLAGS respectively -- what for??
2675         GUI_TK_LIBRARY=`echo $X_LIBS | sed 's/ -LNONE//'`
2676         TOOLKIT_INCLUDE=`echo $X_CFLAGS | sed 's/ -INONE//'`
2677         AFMINSTALL=afminstall
2678         COMPILED_X_PROGRAM=0
2679
2680         AC_MSG_CHECKING(for Motif/Lesstif headers)
2681         WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, Xm/Xm.h)
2682         if test "$ac_find_includes" != "" ; then
2683             AC_MSG_RESULT(found in $ac_find_includes)
2684             WX_INCLUDE_PATH_EXIST($ac_find_includes, $TOOLKIT_INCLUDE)
2685             TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE$ac_path_to_include"
2686         else
2687             AC_TRY_COMPILE(
2688                 [
2689                     #include <Xm/Xm.h>
2690                 ],
2691                 [
2692                     int version;
2693                     version = xmUseVersion;
2694                 ],
2695                 [
2696                     AC_MSG_RESULT(found in default search path)
2697                     COMPILED_X_PROGRAM=1
2698                 ],
2699                 [
2700                     AC_MSG_RESULT(no)
2701                     AC_MSG_ERROR(please set CFLAGS to contain the location of Xm/Xm.h)
2702                 ]
2703             )
2704         fi
2705
2706         if test "$COMPILED_X_PROGRAM" = 0; then
2707             AC_MSG_CHECKING(for Motif/Lesstif library)
2708             WX_PATH_FIND_LIBRARIES($SEARCH_LIB, Xm)
2709             if test "$ac_find_libraries" != "" ; then
2710                 AC_MSG_RESULT(found at $ac_find_libraries)
2711
2712                 WX_LINK_PATH_EXIST($ac_find_libraries, $GUI_TK_LIBRARY)
2713                 GUI_TK_LIBRARY="$GUI_TK_LIBRARY$ac_path_to_link"
2714             else
2715                 dnl it might happen that we found headers in one of the
2716                 dnl standard paths but the libs are elsewhere - we do need to
2717                 dnl try to compile a sample program then here
2718                 save_CFLAGS=$CFLAGS
2719                 CFLAGS="$CFLAGS $TOOLKIT_INCLUDE"
2720
2721                 AC_TRY_COMPILE(
2722                     [
2723                         #include <Xm/Xm.h>
2724                     ],
2725                     [
2726                         int version;
2727                         version = xmUseVersion;
2728                     ],
2729                     [
2730                         AC_MSG_RESULT(found in default search path)
2731                         COMPILED_X_PROGRAM=1
2732                     ],
2733                     [
2734                         AC_MSG_RESULT(no)
2735                         AC_MSG_ERROR(please set LDFLAGS to contain the location of libXm)
2736                     ]
2737                 )
2738
2739                 CFLAGS=$save_CFLAGS
2740             fi
2741         fi
2742
2743         AC_MSG_CHECKING([if we need -lXp and/or -lSM -lICE])
2744         libp_link=""
2745         libsm_ice_link=""
2746         libs_found=0
2747         for libp in "" " -lXp"; do
2748             if test "$libs_found" = "0"; then
2749                 for libsm_ice in "" " -lSM -lICE"; do
2750                     if test "$libs_found" = "0"; then
2751                         save_LIBS="$LIBS"
2752                         LIBS="$GUI_TK_LIBRARY -lXm ${libp} -lXmu -lXext -lXt${libsm_ice} -lX11"
2753                         save_CFLAGS=$CFLAGS
2754                         CFLAGS="$CFLAGS $TOOLKIT_INCLUDE"
2755
2756                         AC_TRY_LINK(
2757                             [
2758                                 #include <Xm/Xm.h>
2759                                 #include <Xm/List.h>
2760                             ],
2761                             [
2762                                 XmString string = NULL;
2763                                 Widget w = NULL;
2764                                 int position = 0;
2765                                 XmListAddItem(w, string, position);
2766                             ],
2767                             [
2768                                 libp_link="$libp"
2769                                 libsm_ice_link="$libsm_ice"
2770                                 AC_MSG_RESULT(
2771                                     [need${libp_link}${libsm_ice_link}])
2772                                 libs_found=1
2773                             ], []
2774                         )
2775
2776                         LIBS="$save_LIBS"
2777                         CFLAGS=$save_CFLAGS
2778                     fi
2779                 done
2780             fi
2781         done
2782
2783         if test "$libs_found" = "0"; then
2784             AC_MSG_RESULT([can't find the right libraries])
2785             AC_MSG_ERROR([can't link a simple motif program])
2786         fi
2787
2788         save_CFLAGS=$CFLAGS
2789         CFLAGS="$CFLAGS $TOOLKIT_INCLUDE"
2790         AC_MSG_CHECKING([for Motif 2])
2791         AC_TRY_COMPILE([
2792                         #include <Xm/Xm.h>
2793                        ],
2794                        [
2795                         #if XmVersion < 2000
2796                         #error "Not Motif 2"
2797                         #endif
2798                        ],
2799                        [
2800                         AC_DEFINE(__WXMOTIF20__,1)
2801                         AC_MSG_RESULT([found])
2802                        ],
2803                        [
2804                         AC_DEFINE(__WXMOTIF20__,0)
2805                         AC_MSG_RESULT([not found])
2806                        ])
2807         CFLAGS=$save_CFLAGS
2808
2809         GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXm${libp_link} -lXmu -lXext -lXt${libsm_ice_link} -lX11"
2810         TOOLKIT_VPATH="\${top_srcdir}/src/motif${PATH_IFS}\${top_srcdir}/src/motif/xmcombo${PATH_IFS}\${top_srcdir}/src/x11"
2811         TOOLKIT=MOTIF
2812         GUIDIST=MOTIF_DIST
2813     fi
2814
2815     if test "$wxUSE_X11" = 1 -o "$wxUSE_MOTIF" = 1; then
2816         dnl test for external libxpm if we're configured to use it
2817         if test "$wxUSE_LIBXPM" = "sys"; then
2818             AC_MSG_CHECKING(for Xpm library)
2819             WX_PATH_FIND_LIBRARIES($SEARCH_LIB,Xpm)
2820             if test "$ac_find_libraries" != "" ; then
2821                 WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
2822                 GUI_TK_LIBRARY="$GUI_TK_LIBRARY$ac_path_to_link"
2823                 AC_MSG_RESULT(found at $ac_find_libraries)
2824
2825                 AC_CACHE_CHECK([for X11/xpm.h],
2826                     wx_cv_x11_xpm_h,
2827                     [
2828                         save_CFLAGS=$CFLAGS
2829                         CFLAGS="$CFLAGS $TOOLKIT_INCLUDE"
2830
2831                         AC_TRY_COMPILE(
2832                             [
2833                                 #include <X11/xpm.h>
2834                             ],
2835                             [
2836                                 int version;
2837                                 version = XpmLibraryVersion();
2838                             ],
2839                             wx_cv_x11_xpm_h=yes,
2840                             wx_cv_x11_xpm_h=no
2841                         )
2842
2843                         CFLAGS=$save_CFLAGS
2844                     ]
2845                 )
2846
2847                 if test $wx_cv_x11_xpm_h = "yes"; then
2848                     GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXpm"
2849                     AC_DEFINE(wxHAVE_LIB_XPM)
2850                 else
2851                     AC_MSG_WARN([built-in less efficient XPM decoder will be used])
2852                 fi
2853             fi
2854
2855         fi
2856
2857         dnl XShapeQueryExtension checks: first the library, then prototype
2858         AC_CHECK_LIB([Xext], [XShapeQueryExtension],
2859                      [
2860                       GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXext"
2861                       wxHAVE_XEXT_LIB=1
2862                      ],
2863                      [], [$GUI_TK_LIBRARY -lX11])
2864
2865         if test "$wxHAVE_XEXT_LIB" = 1; then
2866             save_CFLAGS="$CFLAGS"
2867             CFLAGS="$CFLAGS $TOOLKIT_INCLUDE"
2868
2869             AC_MSG_CHECKING([for X11/extensions/shape.h])
2870             AC_TRY_COMPILE([
2871                             #include <X11/Xlib.h> 
2872                             #include <X11/extensions/shape.h>
2873                            ],
2874                            [
2875                             int dummy1, dummy2;
2876                             XShapeQueryExtension((Display*)NULL,
2877                                                  (int*)NULL, (int*)NULL);
2878                            ],
2879                            [
2880                             AC_DEFINE(HAVE_XSHAPE)
2881                             AC_MSG_RESULT([found])
2882                            ],
2883                            [
2884                             AC_MSG_RESULT([not found])
2885                            ])
2886             CFLAGS="$save_CFLAGS"
2887
2888         fi
2889     fi
2890
2891     if test "$wxUSE_MAC" = 1; then
2892         AC_MSG_CHECKING([for compiler syntax to enable Pascal strings])
2893         if test "$GCC" = yes; then
2894             AC_MSG_RESULT([gcc])
2895             CPPFLAGS_PASCAL="-fpascal-strings"
2896         elif test "`echo $CXX | sed -e 's@.*/@@'`" = "xlC"; then
2897             AC_MSG_RESULT([xlc])
2898             CPPFLAGS_PASCAL="-qmacpstr"
2899         else
2900             AC_MSG_RESULT([none])
2901         fi
2902
2903         CPPFLAGS="$CPPFLAGS $CPPFLAGS_PASCAL -I\${top_srcdir}/src/mac/morefilex -I/Developer/Headers/FlatCarbon"
2904
2905         TOOLKIT_VPATH="\${top_srcdir}/src/mac${PATH_IFS}\${top_srcdir}/src/mac/morefilex"
2906         TOOLKIT=MAC
2907         dnl we can't call this MAC_DIST or autoconf thinks its a macro
2908         GUIDIST=MACX_DIST
2909         dnl wxMac version of wxBase and wxCocoa or wxBase-only built on Darwin
2910         dnl are different, so they need different names:
2911         WXBASEPORT="_carbon"
2912     fi
2913
2914     if test "$wxUSE_COCOA" = 1; then
2915         TOOLKIT_VPATH="\${top_srcdir}/src/cocoa"
2916         TOOLKIT=COCOA
2917         GUIDIST=COCOA_DIST
2918     fi
2919
2920     if test "$wxUSE_PM" = 1; then
2921         TOOLKIT=PM
2922         GUIDIST=GTK_DIST
2923     fi
2924
2925     dnl the name of the directory where the files for this toolkit live
2926     if test "$TOOLKIT" = "PM" ; then
2927         TOOLKIT_DIR="os2"
2928     else
2929         TOOLKIT_DIR=`echo ${TOOLKIT} | tr "[[A-Z]]" "[[a-z]]"`
2930     fi
2931
2932     dnl misc other files depending on the port
2933     PORT_FILES="\${top_srcdir}/src/\$(TOOLKITDIR)/files.lst"
2934
2935     if test "$wxUSE_UNIVERSAL" = "yes"; then
2936         ALL_OBJECTS="\$(GUI_LOWLEVEL_OBJS) \${UNIVOBJS}"
2937
2938         dnl ALL_SOURCES and ALL_HEADERS shouldn't include really all sources
2939         dnl and headers as some/most are not needed for wxUniv but I don't
2940         dnl have time to add GUI_LOWLEVEL_SOURCES/HEADERS stuff now (TODO!)
2941         ALL_SOURCES="\$(ALL_SOURCES) \${UNIV_SOURCES}"
2942         ALL_HEADERS="\$(ALL_HEADERS) \${UNIV_HEADERS}"
2943
2944         PORT_FILES="${PORT_FILES} \${top_srcdir}/src/univ/files.lst"
2945         if test "$wxUSE_X11" = 1; then
2946             TOOLKIT_VPATH="\${top_srcdir}/src/${TOOLKIT_DIR}${PATH_IFS}\${top_srcdir}/src/univ${PATH_IFS}\${top_srcdir}/src/univ/themes"
2947         else
2948             TOOLKIT_VPATH="\${top_srcdir}/src/univ${PATH_IFS}\${top_srcdir}/src/univ/themes${PATH_IFS}\${top_srcdir}/src/${TOOLKIT_DIR}"
2949         fi
2950         TOOLCHAIN_DEFS="${TOOLCHAIN_DEFS} -D__WXUNIVERSAL__"
2951         WIDGET_SET=univ
2952     else
2953         ALL_OBJECTS="\$(GUIOBJS)"
2954         ALL_SOURCES="\$(ALL_SOURCES)"
2955         ALL_HEADERS="\$(ALL_HEADERS)"
2956     fi
2957
2958     ALL_OBJECTS="${ALL_OBJECTS} \$(COMMONOBJS) \$(GENERICOBJS)"
2959
2960     if test "$TOOLKIT" != "MSW" -a "$USE_DOS" != 1; then
2961         ALL_OBJECTS="${ALL_OBJECTS} \$(UNIXOBJS)"
2962     fi
2963
2964     if test "$wxUSE_HTML" = "yes"; then
2965         ALL_OBJECTS="${ALL_OBJECTS} \$(HTMLOBJS)"
2966     fi
2967
2968     if test "$wxUSE_LIBJPEG" = "builtin" ; then
2969         ALL_OBJECTS="${ALL_OBJECTS} \$(JPEGOBJS)"
2970     fi
2971     if test "$wxUSE_LIBTIFF" = "builtin" ; then
2972         ALL_OBJECTS="${ALL_OBJECTS} \$(TIFFOBJS)"
2973     fi
2974     if test "$wxUSE_LIBPNG" = "builtin" ; then
2975         ALL_OBJECTS="${ALL_OBJECTS} \$(PNGOBJS)"
2976     fi
2977
2978     dnl distribute samples/demos/utils with GUI versions
2979     GUIDIST="${GUIDIST} SAMPLES_DIST DEMOS_DIST UTILS_DIST MISC_DIST"
2980     DISTDIR="wx\$(TOOLKIT)"
2981 else
2982     USE_GUI=0
2983
2984     dnl this doesn't quite work right for wxBase, but the places
2985     dnl where it is wrong aren't fatal (yet) though.
2986     TOOLKIT_DIR="base"
2987
2988     dnl the sources, their dependenices and the headers
2989     if test "$USE_WIN32" = 1 ; then
2990         ALL_OBJECTS="\${BASE_OBJS} \${BASE_MSW_OBJS}"
2991         TOOLKIT_VPATH="\${top_srcdir}/src/msw"
2992
2993         dnl yes, the toolkit for wxBase on win32 is actually MSW
2994         dnl wxBase on unix does not need a 'TOOLKIT' defined.
2995         TOOLKIT="MSW"
2996     else
2997         ALL_OBJECTS="\${BASE_OBJS} \${BASE_UNIX_OBJS}"
2998         TOOLKIT_VPATH="\${top_srcdir}/src/unix"
2999     fi
3000
3001     ALL_SOURCES="\$(ALL_SOURCES)"
3002     ALL_HEADERS="\$(ALL_HEADERS)"
3003
3004     PORT_FILES="\${top_srcdir}/src/files.lst"
3005
3006     dnl distribute only wxBase sources/headers
3007     GUIDIST="BASE_DIST"
3008     DISTDIR="wxBase"
3009 fi
3010
3011 dnl ---------------------------------------------------------------------------
3012 dnl Optional libraries included when system library is not used
3013 dnl ---------------------------------------------------------------------------
3014
3015
3016 dnl ----------------------------------------------------------------
3017 dnl iODBC support
3018 dnl ----------------------------------------------------------------
3019
3020 IODBC_C_SRC=""
3021
3022
3023 dnl ODBC is handled seperately for MSW 
3024 if test "$TOOLKIT" != "MSW" ; then
3025
3026     if test "$wxUSE_ODBC" = "sys" -o "$wxUSE_ODBC" = "yes" ; then
3027         dnl This is not ideal we really ough to use the unixodbc-config
3028         dnl  or iodbc-config if they exist.
3029
3030         AC_CHECK_HEADER([sql.h], [found_sql_h=1])
3031         if test "x$found_sql_h" = "x1" ; then
3032             AC_CHECK_LIB(iodbc, SQLAllocEnv, ODBC_LINK=" -liodbc",
3033             [
3034                 AC_CHECK_LIB(unixodbc, SQLAllocEnv, ODBC_LINK=" -lunixodbc",
3035                 [
3036                     AC_CHECK_LIB(odbc, SQLAllocEnv, ODBC_LINK=" -lodbc")
3037                 ])
3038             ])
3039         fi 
3040         if test "x$ODBC_LINK" = "x" ; then
3041             if test "$wxUSE_ODBC" = "sys" ; then
3042                 AC_MSG_ERROR([system ODBC library not found! Use --with-odbc=builtin to use built-in version])
3043             else
3044                 AC_MSG_WARN([system ODBC library not found, will use built-in instead])
3045                 wxUSE_ODBC=builtin
3046             fi
3047         else
3048             dnl we are using the system library
3049             wxUSE_ODBC=sys
3050         fi
3051     fi
3052     if test "$wxUSE_ODBC" != "no" ; then
3053         AC_DEFINE(wxUSE_ODBC)
3054         if test "$wxUSE_ODBC" = "builtin" ; then
3055             AC_DEFINE(wxUSE_BUILTIN_IODBC)
3056         fi
3057         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS db"
3058     
3059         dnl is this still necessary in 2.5?
3060         WXODBCFLAG="-D_IODBC_"
3061     fi
3062 fi
3063
3064 if test "$wxUSE_REGEX" = "builtin" ; then
3065     ALL_OBJECTS="${ALL_OBJECTS} \$(REGEXOBJS)"
3066 fi
3067 if test "$wxUSE_ZLIB" = "builtin" ; then
3068     ALL_OBJECTS="${ALL_OBJECTS} \$(ZLIBOBJS)"
3069 fi
3070
3071 dnl ---------------------------------------------------------------------------
3072 dnl Xinerama (for unix wxDisplay) - Brian Victor
3073 dnl ---------------------------------------------------------------------------
3074 if test "$wxUSE_DISPLAY" = "yes"; then
3075     if test "$wxUSE_UNIX" = "yes" -a "$wxUSE_MAC" != 1; then
3076         AC_MSG_CHECKING([for Xinerama])
3077         WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],Xinerama)
3078         if test "$ac_find_libraries" != "" ; then
3079             WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
3080             if test "$ac_path_to_link" != " -L/usr/lib" ; then
3081                 LDFLAGS="$LDFLAGS $ac_path_to_link"
3082             fi
3083             GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXinerama"
3084             AC_MSG_RESULT([yes])
3085
3086             AC_MSG_CHECKING([for Xxf86vm extension])
3087             WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],Xxf86vm)
3088             if test "$ac_find_libraries" != "" ; then
3089                 AC_MSG_RESULT([yes])
3090                 AC_CHECK_HEADERS([X11/extensions/xf86vmode.h],
3091                                  [
3092                                   GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXxf86vm"
3093                                  ],
3094                                  [], 
3095                                  [
3096                                       #if HAVE_X11_XLIB_H
3097                                         #include <X11/Xlib.h>
3098                                       #endif
3099                                  ])
3100             else
3101                 AC_MSG_RESULT([no])
3102             fi
3103         
3104         else
3105             AC_MSG_RESULT([no])
3106             AC_MSG_WARN("*** Xinerama not found; disabling wxDisplay")
3107             wxUSE_DISPLAY="no"
3108         fi
3109     fi
3110 fi
3111
3112 dnl ---------------------------------------------------------------------------
3113 dnl OpenGL libraries
3114 dnl ---------------------------------------------------------------------------
3115
3116 USE_OPENGL=0
3117 if test "$wxUSE_OPENGL" = "yes"; then
3118     if test "$wxUSE_MAC" = 1 -o "$wxUSE_COCOA" = "1"; then
3119         OPENGL_LIBS="-framework OpenGL -framework AGL"
3120     elif test "$wxUSE_MSW" = 1; then
3121         OPENGL_LIBS="-lopengl32 -lglu32"
3122     else
3123         dnl David Elliott: Without this snippet AC_CHECK_HEADER fails to find
3124         dnl GL/gl.h on Mac OS X where it is located in
3125         dnl /usr/X11R6/include/GL/gl.h:
3126
3127         WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, GL/gl.h)
3128         if test "$ac_find_includes" != "" ; then
3129             AC_MSG_RESULT(found in $ac_find_includes)
3130             WX_INCLUDE_PATH_EXIST($ac_find_includes, $CPPFLAGS)
3131             CPPFLAGS="$CPPFLAGS$ac_path_to_include"
3132         fi
3133
3134         AC_CHECK_HEADER(GL/gl.h,
3135             [
3136                 found_gl=0
3137
3138                 AC_MSG_CHECKING([for -lGL])
3139                 WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],GL)
3140                 if test "$ac_find_libraries" != "" ; then
3141                     WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
3142                     if test "$ac_path_to_link" != " -L/usr/lib" ; then
3143                         LDFLAGS_GL="$ac_path_to_link"
3144                     fi
3145
3146                     dnl don't suppose that libGL and libGLU are always in the
3147                     dnl same directory -- this is not true for some common
3148                     dnl distributions
3149                     WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],GLU)
3150                     if test "$ac_find_libraries" != "" ; then
3151                         WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
3152                         if test "$ac_path_to_link" != " -L/usr/lib" -a \
3153                                     "$ac_path_to_link" != "$LDFLAGS_GL"; then
3154                             LDFLAGS_GL="$LDFLAGS_GL$ac_path_to_link"
3155                         fi
3156
3157                         found_gl=1
3158                         OPENGL_LIBS="-lGL -lGLU"
3159                         AC_MSG_RESULT([yes])
3160                     fi
3161                 fi
3162
3163                 if test "$found_gl" != 1; then
3164                     AC_MSG_RESULT([no])
3165                     AC_MSG_CHECKING([for -lMesaGL])
3166                     WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],MesaGL)
3167                     if test "$ac_find_libraries" != "" ; then
3168                         WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
3169                         LDFLAGS_GL="$LDFLAGS$ac_path_to_link"
3170                         OPENGL_LIBS="-lMesaGL -lMesaGLU"
3171                         AC_MSG_RESULT([yes])
3172                     else
3173                         AC_MSG_RESULT([no])
3174                     fi
3175                 fi
3176             ])
3177
3178         if test "x$OPENGL_LIBS" = "x"; then
3179             dnl it should be an error and not a warning because OpenGL is not on
3180             dnl by default and so if it had been explicitely requested, we
3181             dnl shouldn't just fall back to compiling the library without it
3182             AC_MSG_ERROR(OpenGL libraries not available)
3183         fi
3184     fi
3185
3186     if test "$wxUSE_OPENGL" = "yes"; then
3187         USE_OPENGL=1
3188         AC_DEFINE(wxUSE_OPENGL)
3189         AC_DEFINE(wxUSE_GLCANVAS)
3190         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS opengl opengl/cube opengl/penguin opengl/isosurf"
3191     fi
3192 fi
3193
3194 if test -z "$TOOLKIT_VPATH" ; then
3195     TOOLKIT_VPATH="\${top_srcdir}/src/${TOOLKIT_DIR}"
3196 fi
3197
3198 dnl the symbol which allows conditional compilation for the given toolkit
3199 if test -n "$TOOLKIT" ; then
3200     TOOLCHAIN_DEFS="${TOOLCHAIN_DEFS} -D__WX${TOOLKIT}__"
3201 fi
3202
3203 UNICODE=0
3204 lib_unicode_suffix=
3205 if test "$wxUSE_UNICODE" = "yes"; then
3206     lib_unicode_suffix=u
3207     UNICODE=1
3208 fi
3209
3210 lib_debug_suffix=
3211 DEBUG_FLAG=0
3212 if test "$wxUSE_DEBUG_FLAG" = "yes"; then
3213     lib_debug_suffix=d
3214     DEBUG_FLAG=1
3215 fi
3216
3217 DEBUG_INFO=0
3218 if test "$wxUSE_DEBUG_INFO" = "yes"; then
3219     DEBUG_INFO=1
3220 fi
3221
3222 WX_VERSION_TAG=`echo WX${lib_unicode_suffix}${lib_debug_suffix}_${WX_RELEASE} | tr "[[a-z]]" "[[A-Z]]"`
3223
3224 TOOLCHAIN_NAME="${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_unicode_suffix}${lib_debug_suffix}-${WX_RELEASE}"
3225 TOOLCHAIN_NAME_GL="${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_unicode_suffix}${lib_debug_suffix}_gl-${WX_RELEASE}"
3226
3227 if test "$cross_compiling" = "yes"; then
3228     TOOLCHAIN_NAME="${TOOLCHAIN_NAME}-${host_alias}"
3229     TOOLCHAIN_NAME_GL="${TOOLCHAIN_NAME_GL}-${host_alias}"
3230     HOST_SUFFIX="-${host_alias}"
3231 fi
3232
3233 dnl library link name
3234 WX_LIBRARY="wx_${TOOLCHAIN_NAME}"
3235 WX_LIBRARY_GL="wx_${TOOLCHAIN_NAME_GL}"
3236 WX_LIBRARY_BASENAME_NOGUI="wx_base${WXBASEPORT}${lib_unicode_suffix}${lib_debug_suffix}"
3237 WX_LIBRARY_BASENAME_GUI="wx_${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_unicode_suffix}${lib_debug_suffix}"
3238
3239 dnl the name of the shared library
3240 WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}.${SO_SUFFIX}.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
3241 WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY_GL}.${SO_SUFFIX}.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
3242
3243 dnl the name of the links to the shared library
3244 WX_LIBRARY_LINK1="lib${WX_LIBRARY}.${SO_SUFFIX}.${WX_CURRENT}"
3245 WX_LIBRARY_LINK2="lib${WX_LIBRARY}.${SO_SUFFIX}"
3246 WX_LIBRARY_LINK1_GL="lib${WX_LIBRARY_GL}.${SO_SUFFIX}.${WX_CURRENT}"
3247 WX_LIBRARY_LINK2_GL="lib${WX_LIBRARY_GL}.${SO_SUFFIX}"
3248
3249 case "${host}" in
3250     *-*-cygwin* | *-*-mingw32* )
3251         WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}.${SO_SUFFIX}"
3252         WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY_GL}.${SO_SUFFIX}"
3253         ;;
3254
3255     *-*-darwin* )
3256         dnl Under Mac OS X, the naming conventions for shared libraries
3257         dnl are different: the number precedes the suffix.
3258
3259         WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}.${SO_SUFFIX}"
3260         WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY_GL}.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}.${SO_SUFFIX}"
3261
3262         WX_LIBRARY_LINK1="lib${WX_LIBRARY}.${WX_CURRENT}.${SO_SUFFIX}"
3263         WX_LIBRARY_LINK2="lib${WX_LIBRARY}.${SO_SUFFIX}"
3264         WX_LIBRARY_LINK1_GL="lib${WX_LIBRARY_GL}.${WX_CURRENT}.${SO_SUFFIX}"
3265         WX_LIBRARY_LINK2_GL="lib${WX_LIBRARY_GL}.${SO_SUFFIX}"
3266
3267         dnl base name of the resource file for wxMac must be the same
3268         dnl as library installation base name (-install_name)
3269         if test "$wxUSE_MAC" = 1 -o "$wxUSE_COCOA" = "1"; then
3270             WX_RESOURCES_MACOSX_ASCII="lib${WX_LIBRARY}.${WX_CURRENT}.r"
3271             WX_RESOURCES_MACOSX_DATA="lib${WX_LIBRARY}.${WX_CURRENT}.rsrc"
3272         fi
3273         ;;
3274 esac
3275
3276 dnl the name of the static library
3277 WX_LIBRARY_NAME_STATIC="lib${WX_LIBRARY}.a"
3278 WX_LIBRARY_NAME_STATIC_GL="lib${WX_LIBRARY_GL}.a"
3279
3280 dnl define which libs wx-config should link.
3281 WXCONFIG_LIBS="-l${WX_LIBRARY}"
3282 WXCONFIG_LIBS_STATIC="lib${WX_LIBRARY}.a"
3283
3284 if test "$wxUSE_OPENGL" = "yes"; then
3285     WXCONFIG_LIBS_GL="-l${WX_LIBRARY_GL} ${OPENGL_LIBS}"
3286     WXCONFIG_LIBS_STATIC_GL="lib${WX_LIBRARY_GL}.a ${OPENGL_LIBS}"
3287 fi
3288
3289
3290 dnl --- the marker for quick search, leave it here: SHARED_LIB_SETUP ---
3291
3292 if test "$wxUSE_SHARED" = "yes"; then
3293     case "${host}" in
3294       *-pc-os2_emx | *-pc-os2-emx | \
3295       *-pc-msdosdjgpp )
3296         dnl only static for now
3297         wxUSE_SHARED=no
3298         AC_MSG_WARN([Host system doesn't support shared libraries, disabling])
3299       ;;
3300     esac
3301 fi
3302
3303 SHARED=0
3304 if test "$wxUSE_SHARED" = "yes"; then
3305     SHARED=1
3306
3307     dnl use versioned symbols if available on the platform
3308     WX_VERSIONED_SYMBOLS([\$(top_builddir)version-script])
3309
3310     case "${host}" in
3311       *-*-linux* | *-*-gnu* )
3312         SAMPLES_RPATH_FLAG="-Wl,-rpath,\$(top_builddir)lib"
3313         ;;
3314
3315       *-*-solaris2* )
3316         if test "$GCC" = yes ; then
3317             dnl newer versions of gcc need -isystem to compile X headers on
3318             dnl Solaris (which use old style C syntax)
3319             CPPFLAGS="$CPPFLAGS -isystem /usr/openwin/include"
3320
3321             dnl gcc may use Sun's ld, in which case -rpath gives a confusing
3322             dnl error message. We have to try both -Wl,-rpath and -Wl,-R:
3323             saveLdflags="$LDFLAGS"
3324             LDFLAGS="$saveLdflags -Wl,-rpath,/"
3325             AC_MSG_CHECKING([if the linker accepts -rpath])
3326             AC_TRY_LINK(
3327                 [],[],
3328                 [
3329                     AC_MSG_RESULT([yes])
3330                     SAMPLES_RPATH_FLAG="-Wl,-rpath,\$(top_builddir)lib"
3331                 ],
3332                 [
3333                     AC_MSG_RESULT([no])
3334                     AC_MSG_CHECKING([if the linker accepts -R])
3335                     LDFLAGS="$saveLdflags -Wl,-R,/"
3336                     AC_TRY_LINK(
3337                         [],[],
3338                         [
3339                              AC_MSG_RESULT([yes])
3340                              SAMPLES_RPATH_FLAG="-Wl,-R,\$(top_builddir)lib"],
3341                         [
3342                             AC_MSG_RESULT([no])
3343                         ])                    
3344                 ])
3345             LDFLAGS="$saveLdflags"
3346         else
3347             SHARED_LD="${CXX} -G -o"
3348             PIC_FLAG="-KPIC"
3349             SAMPLES_RPATH_FLAG="-R\$(top_builddir)lib"
3350         fi
3351       ;;
3352       
3353       powerpc-*-darwin* )
3354         SAMPLES_RPATH_POSTLINK="\$(top_builddir)change-install-names \$(LIBDIRNAME) \$(prefix) \$@"
3355         cat <<EOF >change-install-names
3356 #!/bin/sh
3357 libnames=\`cd \${1} ; ls -1 | grep '\.[[0-9]][[0-9]]*\.dylib\$'\`
3358 inst_cmd="install_name_tool "
3359 for i in \${libnames} ; do
3360     inst_cmd="\${inst_cmd} -change \${2}/lib/\${i} \${1}/\${i}"
3361 done
3362 \${inst_cmd} \${3}
3363 EOF
3364         chmod +x change-install-names
3365       ;;
3366       
3367     esac
3368
3369     dnl set target to shared if not explicitly chose static before
3370     if test "x$WX_TARGET_LIBRARY" = "x"; then
3371         WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_SHARED}"
3372         WX_TARGET_LIBRARY_GL="${WX_LIBRARY_NAME_SHARED_GL}"
3373     fi
3374
3375     dnl do not alter the LIBRARY_TYPE strings "so" and "a", they are magic
3376     WX_TARGET_LIBRARY_TYPE="so"
3377     INSTALL_LIBRARY='$(INSTALL_PROGRAM)'
3378 fi
3379
3380 dnl do not 'else' this, it may be changed in the above conditional.
3381 if test "$wxUSE_SHARED" = "no"; then
3382
3383     dnl give static wxBase and wxMSW build a working install target
3384     if test "$wxUSE_GUI" = "no" -o "$USE_WIN32" = 1 ; then
3385         dnl we're here because WX_ALL_INSTALLED is empty, but play safe anyway
3386         WX_ALL_INSTALLED="${WX_ALL_INSTALLED} preinstall"
3387     fi
3388
3389     if test "$wxUSE_MAC" = 1 -o "$wxUSE_COCOA" = 1 ; then
3390         WX_ALL_INSTALLED="${WX_ALL_INSTALLED} preinstall"
3391     fi
3392
3393     if test "$wxUSE_OPENGL" = "yes"; then
3394         WX_ALL_INSTALLED="${WX_ALL_INSTALLED} preinstall_gl"
3395         WX_ALL="\$(build_libdir)/${WX_LIBRARY_NAME_STATIC} \$(build_libdir)/${WX_LIBRARY_NAME_STATIC_GL}"
3396     else
3397         WX_ALL="\$(build_libdir)/${WX_LIBRARY_NAME_STATIC}"
3398     fi
3399
3400     WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}"
3401     WX_TARGET_LIBRARY_GL="${WX_LIBRARY_NAME_STATIC_GL}"
3402
3403     WX_TARGET_LIBRARY_TYPE="a"
3404     INSTALL_LIBRARY='$(INSTALL_DATA)'
3405
3406     dnl wx-config should assume the --static flag by default if we don't have
3407     dnl any shared libs anyhow
3408     STATIC_FLAG="yes"
3409 else
3410     STATIC_FLAG="no"
3411 fi
3412
3413 if test "$wxUSE_MAC" = 1 -o "$wxUSE_COCOA" = 1; then
3414     dnl add the resources target for wxMac
3415     LIBWXMACRES="\$(top_builddir)lib/${WX_RESOURCES_MACOSX_ASCII}"
3416     WX_ALL="${WX_ALL} ${LIBWXMACRES}"
3417     WX_ALL_INSTALLED="${WX_ALL_INSTALLED} preinstall_res"
3418
3419     AC_CHECK_PROG(RESCOMP, Rez, Rez, /Developer/Tools/Rez)
3420     AC_CHECK_PROG(DEREZ, DeRez, DeRez, /Developer/Tools/DeRez)
3421     AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile)
3422
3423     MACSETFILE="\$(SETFILE)"
3424
3425     dnl resources are bundled both with shared library and applications
3426     dnl since the carb resource *must* be included in the application
3427     if test "$wxUSE_MAC" = 1; then
3428         MACRESCOMP="\$(RESCOMP) -d __DARWIN__ -t APPL Carbon.r ${LIBWXMACRES} -o"
3429
3430         dnl this command is used to implement `wx-config --rezflags` and it is
3431         dnl eval'd there so escape any metacharacters inside
3432         MACRESWXCONFIG="${RESCOMP} -d __DARWIN__ -t APPL Carbon.r \\\${exec_prefix}/lib/${WX_RESOURCES_MACOSX_ASCII} -o"
3433     else
3434         MACRESCOMP="echo -n | \$(RESCOMP) -d __DARWIN__ -t APPL ${LIBWXMACRES} -o"
3435         MACRESWXCONFIG="echo -n \\\| ${RESCOMP} -d __DARWIN__ -t APPL \\\${exec_prefix}/lib/${WX_RESOURCES_MACOSX_ASCII} -o"
3436     fi
3437 else
3438     dnl default value is to (silently) do nothing in the makefile
3439     MACSETFILE="@#"
3440     MACRESWXCONFIG="#"
3441
3442     dnl confusingly, wxOS2 also uses MACRESCOMP in its post-link step
3443     if test "$wxUSE_PM" = 1; then
3444         MACRESCOMP="emxbind -ep"
3445     else
3446         MACRESCOMP="@#"
3447     fi
3448 fi
3449
3450
3451 dnl ---------------------------------------------------------------------------
3452 dnl Checks for typedefs
3453 dnl ---------------------------------------------------------------------------
3454
3455 dnl   defines mode_t if not already defined
3456 AC_TYPE_MODE_T
3457 dnl   defines off_t if not already defined
3458 AC_TYPE_OFF_T
3459 dnl   defines pid_t if not already defined
3460 AC_TYPE_PID_T
3461 dnl   defines size_t if not already defined
3462 AC_TYPE_SIZE_T
3463 dnl   defines uid_t and gid_t if not already defined
3464 AC_TYPE_UID_T
3465
3466 dnl check what exactly size_t is on this machine - this is necessary to avoid
3467 dnl ambiguous overloads in several places, notably wx/string.h and wx/array.h
3468 AC_LANG_SAVE
3469 AC_LANG_CPLUSPLUS
3470 AC_CACHE_CHECK([if size_t is unsigned int],
3471     wx_cv_size_t_is_uint,
3472     [
3473     dnl an obvious check like AC_TRY_COMPILE[struct Foo { ... };] doesn't work
3474     dnl with egcs (at least) up to 1.1.1 as it allows you to compile duplicate
3475     dnl methods in a local class (i.e. class inside a function) declaration
3476     dnl without any objections!!
3477     dnl
3478     dnl hence the hack below: we must have Foo at global scope!
3479     AC_TRY_COMPILE([#include <stddef.h>],
3480         [
3481             return 0; }
3482
3483             struct Foo { void foo(size_t); void foo(unsigned int); };
3484
3485             int bar() {
3486         ],
3487         wx_cv_size_t_is_uint=no,
3488         wx_cv_size_t_is_uint=yes
3489     )
3490     ]
3491 )
3492
3493 if test "$wx_cv_size_t_is_uint" = "yes"; then
3494     AC_DEFINE(wxSIZE_T_IS_UINT)
3495 else
3496     AC_CACHE_CHECK([if size_t is unsigned long],
3497         wx_cv_size_t_is_ulong,
3498         AC_TRY_COMPILE([#include <stddef.h>],
3499             [
3500                 return 0; }
3501
3502                 struct Foo { void foo(size_t); void foo(unsigned long); };
3503
3504                 int bar() {
3505             ],
3506             wx_cv_size_t_is_ulong=no,
3507             wx_cv_size_t_is_ulong=yes
3508         )
3509     )
3510
3511     if test "$wx_cv_size_t_is_ulong" = "yes"; then
3512         AC_DEFINE(wxSIZE_T_IS_ULONG)
3513     fi
3514 fi
3515
3516 AC_LANG_RESTORE
3517
3518 dnl ---------------------------------------------------------------------------
3519 dnl Checks for structures
3520 dnl ---------------------------------------------------------------------------
3521
3522 dnl does passwd struct has the pw_gecos field?
3523 AC_CACHE_CHECK([for pw_gecos in struct passwd], wx_cv_struct_pw_gecos,
3524     [
3525         AC_TRY_COMPILE([#include <pwd.h>],
3526              [
3527                 char *p;
3528                 struct passwd *pw;
3529                 p = pw->pw_gecos;
3530              ],
3531              [
3532                 wx_cv_struct_pw_gecos=yes
3533              ],
3534              [
3535                 wx_cv_struct_pw_gecos=no
3536              ]
3537         )
3538     ]
3539 )
3540
3541 if test "$wx_cv_struct_pw_gecos" = "yes"; then
3542     AC_DEFINE(HAVE_PW_GECOS)
3543 fi
3544
3545 dnl ---------------------------------------------------------------------------
3546 dnl Check for functions
3547 dnl ---------------------------------------------------------------------------
3548
3549 dnl don't check for wchar_t functions if we haven't got wchar_t itself
3550 if test "$wx_cv_sizeof_wchar_t" != "0"; then
3551     AC_DEFINE(wxUSE_WCHAR_T)
3552
3553     dnl check for wcslen in all possible places
3554     WCSLEN_FOUND=0
3555     WCHAR_LINK=
3556     AC_CHECK_FUNCS(wcslen, WCSLEN_FOUND=1)
3557
3558     if test "$WCSLEN_FOUND" = 0; then
3559         if test "$TOOLKIT" = "MSW"; then
3560             AC_CHECK_LIB(msvcrt, wcslen, WCHAR_OK=1)
3561         else
3562             AC_CHECK_LIB(w, wcslen, [
3563                             WCHAR_LINK=" -lw"
3564                             WCSLEN_FOUND=1
3565                         ])
3566         fi
3567     fi
3568
3569     if test "$WCSLEN_FOUND" = 1; then
3570         AC_DEFINE(HAVE_WCSLEN)
3571     fi
3572
3573     dnl try to use wcsrtombs instead of wcstombs which is buggy in old GNU
3574     dnl libc versions if possible
3575     AC_CHECK_FUNCS(wcsrtombs)
3576 else
3577     AC_MSG_WARN([Wide character support is unavailable])
3578 fi
3579
3580 dnl *printf() functions sometimes are available in the library but not
3581 dnl prototyped -- if this is the case, we can't use them from C++ code, but to
3582 dnl detect this we have to use C++ compiler for testing
3583 AC_LANG_SAVE
3584 AC_LANG_CPLUSPLUS
3585
3586 dnl check for vsnprintf() -- a safe version of vsprintf())
3587 dnl
3588 dnl the trouble here is that on some systems (notable HP-UX) this function is
3589 dnl present in libc but not in the system headers and so AC_CHECK_FUNCS (which,
3590 dnl stupidly, provides a dummy function declaration inside its extension)
3591 dnl succeeds, even with C++ compiler, but the compilation of wxWindows fails
3592 dnl
3593 dnl so we first check if the function is in the library
3594 AC_CHECK_FUNCS(vsnprintf)
3595
3596 if test "$ac_cv_func_vsnprintf" = "yes"; then
3597     dnl yes it is -- now check if it is in the headers
3598     AC_CACHE_CHECK([for vsnprintf declaration], wx_cv_func_vsnprintf_decl,
3599         [
3600             AC_TRY_COMPILE(
3601                 [
3602                     #include <stdio.h>
3603                     #include <stdarg.h>
3604                 ],
3605                 [
3606                     char *buf;
3607                     va_list ap;
3608                     vsnprintf(buf, 10u, "%s", ap);
3609                 ],
3610                 wx_cv_func_vsnprintf_decl=yes,
3611                 wx_cv_func_vsnprintf_decl=no
3612             )
3613         ]
3614     )
3615
3616     if test "$wx_cv_func_vsnprintf_decl" = "yes"; then
3617         AC_DEFINE(HAVE_VSNPRINTF_DECL)
3618     fi
3619 fi
3620
3621 if test "$wxUSE_UNICODE" = yes; then
3622     dnl also look if we have wide char IO functions
3623     AC_CHECK_FUNCS(fputwc wprintf vswprintf)
3624
3625     dnl MinGW has a vswprintf with a different prototype, and
3626     dnl a _vsnwprintf with the correct prototype, but AC_CHECK_FUNCS
3627     dnl finds it even if it is not declared in some versions...
3628     AC_MSG_CHECKING([for _vsnwprintf])
3629     AC_TRY_COMPILE([#include <wchar.h>],
3630                    [&_vsnwprintf;],
3631                    [AC_MSG_RESULT([yes])
3632                     AC_DEFINE(HAVE__VSNWPRINTF)],
3633                    [AC_MSG_RESULT([no])]);
3634 fi
3635
3636 AC_LANG_RESTORE
3637
3638
3639
3640 dnl the following tests are for Unix(like) systems only
3641 if test "$TOOLKIT" != "MSW"; then
3642
3643 dnl check for available version of iconv()
3644
3645 AC_LANG_SAVE
3646 AC_LANG_CPLUSPLUS
3647 AM_ICONV
3648 LIBS="$LIBICONV $LIBS"
3649 AC_LANG_RESTORE
3650
3651 dnl check for POSIX signals if we need them
3652 if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes" -a "$wxUSE_UNIX" = "yes"; then
3653     AC_CHECK_FUNCS(sigaction)
3654
3655     if test "$ac_cv_func_sigaction" = "no"; then
3656         AC_MSG_WARN([No POSIX signal functions on this system, wxApp::OnFatalException will not be called])
3657         wxUSE_ON_FATAL_EXCEPTION=no
3658     fi
3659
3660     if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes"; then
3661       AC_LANG_SAVE
3662       AC_LANG_CPLUSPLUS
3663
3664       AC_CACHE_CHECK([for sa_handler type], wx_cv_type_sa_handler,
3665       [
3666         AC_TRY_COMPILE([#include <signal.h>],
3667                      [
3668                         extern void testSigHandler(int);
3669
3670                         struct sigaction sa;
3671                         sa.sa_handler = testSigHandler;
3672                      ], [
3673                         wx_cv_type_sa_handler=int
3674                      ], [
3675                         wx_cv_type_sa_handler=void
3676                      ])
3677       ])
3678
3679       AC_LANG_RESTORE
3680
3681       AC_DEFINE_UNQUOTED(wxTYPE_SA_HANDLER, $wx_cv_type_sa_handler)
3682     fi
3683 fi
3684
3685 dnl check for the function for temp files creation
3686 AC_CHECK_FUNCS(mkstemp mktemp, break)
3687
3688 dnl get the library function to use for wxGetDiskSpace(): it is statfs() under
3689 dnl Linux and *BSD and statvfs() under Solaris
3690 AC_CACHE_CHECK(for statfs, wx_cv_func_statfs,
3691     AC_TRY_COMPILE(
3692         [
3693              #if defined(__BSD__)
3694                #include <sys/param.h>
3695                #include <sys/mount.h>
3696              #else
3697                #include <sys/vfs.h>
3698              #endif
3699         ],
3700         [
3701              long l;
3702              struct statfs fs;
3703              statfs("/", &fs);
3704              l = fs.f_bsize;
3705              l += fs.f_blocks;
3706              l += fs.f_bavail;
3707         ],
3708         [
3709              wx_cv_func_statfs=yes
3710         ],
3711         [
3712              wx_cv_func_statfs=no
3713         ]
3714     )
3715 )
3716
3717 if test "$wx_cv_func_statfs" = "yes"; then
3718     wx_cv_type_statvfs_t="struct statfs"
3719     AC_DEFINE(HAVE_STATFS)
3720 else
3721     AC_CACHE_CHECK(for statvfs, wx_cv_func_statvfs,
3722         AC_TRY_COMPILE(
3723             [
3724                 #include <stddef.h>
3725                 #include <sys/statvfs.h>
3726             ],
3727             [
3728                 statvfs("/", NULL);
3729             ],
3730             wx_cv_func_statvfs=yes,
3731             wx_cv_func_statvfs=no
3732         )
3733     )
3734
3735     if test "$wx_cv_func_statvfs" = "yes"; then
3736         dnl we also have to check whether we should use statvfs_t (works under
3737         dnl Solaris 8, doesn't work under Solaris 7) or "struct statvfs" (vice
3738         dnl versa) as the argument for statvfs in 64 bit off_t mode (in 32 bit
3739         dnl mode both work fine)
3740         dnl
3741         dnl for this check C++ compiler has to be used as passing incompatible
3742         dnl pointers is just a warning and not an error in C
3743         AC_LANG_SAVE
3744         AC_LANG_CPLUSPLUS
3745
3746         AC_CACHE_CHECK(for statvfs argument type, wx_cv_type_statvfs_t,
3747             AC_TRY_COMPILE(
3748                 [
3749                     #include <sys/statvfs.h>
3750                 ],
3751                 [
3752                     long l;
3753                     statvfs_t fs;
3754                     statvfs("/", &fs);
3755                     l = fs.f_bsize;
3756                     l += fs.f_blocks;
3757                     l += fs.f_bavail;
3758                 ],
3759                 wx_cv_type_statvfs_t=statvfs_t,
3760                 [
3761                     AC_TRY_COMPILE(
3762                         [
3763                             #include <sys/statvfs.h>
3764                         ],
3765                         [
3766                             long l;
3767                             struct statvfs fs;
3768                             statvfs("/", &fs);
3769                             l = fs.f_bsize;
3770                             l += fs.f_blocks;
3771                             l += fs.f_bavail;
3772                         ],
3773                         wx_cv_type_statvfs_t="struct statvfs",
3774                         wx_cv_type_statvfs_t="unknown"
3775                     )
3776                 ]
3777             )
3778         )
3779
3780         AC_LANG_RESTORE
3781
3782         if test "$wx_cv_type_statvfs_t" != "unknown"; then
3783             AC_DEFINE(HAVE_STATVFS)
3784         fi
3785     else
3786         dnl set it for the test below
3787         wx_cv_type_statvfs_t="unknown"
3788     fi
3789 fi
3790
3791 if test "$wx_cv_type_statvfs_t" != "unknown"; then
3792     AC_DEFINE_UNQUOTED(WX_STATFS_T, $wx_cv_type_statvfs_t)
3793 else
3794     AC_MSG_WARN([wxGetDiskSpace() function won't work without statfs()])
3795 fi
3796
3797 dnl check for fcntl() or at least flock() needed by Unix implementation of
3798 dnl wxSingleInstanceChecker
3799 if test "$wxUSE_SNGLINST_CHECKER" = "yes"; then
3800     AC_CHECK_FUNCS(fcntl flock, break)
3801
3802     if test "$ac_cv_func_fcntl" != "yes" -a "$ac_cv_func_flock" != "yes"; then
3803         AC_MSG_WARN(wxSingleInstanceChecker not available)
3804         wxUSE_SNGLINST_CHECKER=no
3805     fi
3806 fi
3807
3808 dnl check for timegm() used by datetime.cpp
3809 AC_CHECK_FUNCS(timegm)
3810
3811 dnl look for a function to modify the environment
3812 AC_CHECK_FUNCS(putenv setenv, break)
3813
3814 HAVE_SOME_SLEEP_FUNC=0
3815 if test "$USE_BEOS" = 1; then
3816     dnl BeOS has its own (wonder where did they get it from) sleep() function
3817     dnl in unistd.h
3818     AC_DEFINE(HAVE_SLEEP)
3819     HAVE_SOME_SLEEP_FUNC=1
3820 fi
3821
3822 if test "$USE_DARWIN" = 1; then
3823     dnl Mac OS X/Darwin has both nanosleep and usleep
3824     dnl but only usleep is defined in unistd.h
3825     AC_DEFINE(HAVE_USLEEP)
3826     HAVE_SOME_SLEEP_FUNC=1
3827 fi
3828
3829 if test "$HAVE_SOME_SLEEP_FUNC" != 1; then
3830     dnl try nanosleep() in libc and libposix4, if this fails - usleep()
3831     POSIX4_LINK=
3832     AC_CHECK_FUNCS(nanosleep,
3833         AC_DEFINE(HAVE_NANOSLEEP),
3834         [
3835             AC_CHECK_LIB(posix4, nanosleep,
3836                 [
3837                     AC_DEFINE(HAVE_NANOSLEEP)
3838                     POSIX4_LINK=" -lposix4"
3839                 ],
3840                 [
3841                     AC_CHECK_FUNCS(usleep,
3842                         AC_DEFINE(HAVE_USLEEP),
3843                         AC_MSG_WARN([wxSleep() function will not work])
3844                     )
3845                 ]
3846             )
3847         ]
3848     )
3849 fi
3850
3851 dnl check for uname (POSIX) and gethostname (BSD)
3852 AC_CHECK_FUNCS(uname gethostname, break)
3853
3854 dnl check for MT-safe version of strtok (on DEC Alpha, it's ok for C compiler
3855 dnl but not for C++ one - hence change language)
3856 AC_LANG_SAVE
3857 AC_LANG_CPLUSPLUS
3858
3859 AC_CHECK_FUNCS(strtok_r)
3860
3861 AC_LANG_RESTORE
3862
3863 dnl check for inet_addr and inet_aton (these may live either in libc, or in
3864 dnl libnsl or libresolv or libsocket)
3865 INET_LINK=
3866 AC_CHECK_FUNCS(inet_addr,
3867     AC_DEFINE(HAVE_INET_ADDR),
3868     [
3869         AC_CHECK_LIB(nsl, inet_addr,
3870             INET_LINK="nsl",
3871             [
3872                 AC_CHECK_LIB(resolv, inet_addr,
3873                     INET_LINK="resolv",
3874                     [
3875                         AC_CHECK_LIB(socket, inet_addr,
3876                             INET_LINK="socket"
3877                         )
3878                     ]
3879                 )
3880             ]
3881         )
3882     ]
3883 )
3884
3885 AC_CHECK_FUNCS(inet_aton,
3886         AC_DEFINE(HAVE_INET_ATON),
3887         [
3888             dnl only check it in the same lib
3889             AC_CHECK_LIB($INET_LINK, inet_aton, AC_DEFINE(HAVE_INET_ATON))
3890         ])
3891
3892 if test "x$INET_LINK" != "x"; then
3893     AC_DEFINE(HAVE_INET_ADDR)
3894     INET_LINK=" -l$INET_LINK"
3895 fi
3896
3897 fi
3898 dnl if !MSW
3899
3900
3901 dnl ------------------------------------------
3902 dnl Checks specific to contrib libs (MMedia)
3903 dnl ------------------------------------------
3904
3905 dnl Check for ESD:
3906 EXTRALIBS_ESD=
3907 AC_CHECK_LIB(esd, esd_close, [
3908     AC_CHECK_HEADERS([esd.h], [
3909     EXTRALIBS_ESD="-lesd"
3910   ])
3911 ])
3912 AC_SUBST(EXTRALIBS_ESD)
3913
3914 dnl check for known CD-ROM interface
3915 AC_MSG_CHECKING([for known CD-ROM interface])
3916 AC_TRY_COMPILE([#ifdef __linux__
3917                 #include <linux/cdrom.h>
3918                 #else
3919                 /* For Solaris */
3920                 #include <sys/cdio.h>
3921                 #endif
3922                 ],
3923                [struct cdrom_tocentry entry, old_entry;],
3924                [AC_MSG_RESULT([yes])
3925                 AC_DEFINE(HAVE_KNOWN_CDROM_INTERFACE)],
3926                [AC_MSG_RESULT([no])])
3927
3928 dnl ===========================================================================
3929 dnl Now we have all the info we need - use it!
3930 dnl ===========================================================================
3931
3932 dnl flush the cache
3933 AC_CACHE_SAVE
3934
3935 dnl ---------------------------------------------------------------------------
3936 dnl thread support for Unix (for Win32 and OS/2 see past
3937 dnl                          the next matching "else")
3938 dnl ---------------------------------------------------------------------------
3939
3940 dnl under MSW (except mingw32) we always have thread support
3941 CPP_MT_FLAG=
3942 if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
3943
3944     dnl the code below:
3945     dnl
3946     dnl   defines THREADS_LINK and THREADS_CFLAGS which are the options
3947     dnl   necessary to build the MT programs for the linker and compiler
3948     dnl   respectively
3949     dnl
3950     dnl   sets wxUSE_THREADS=1 if thread support is activated
3951
3952     THREADS_LINK=
3953     THREADS_CFLAGS=
3954
3955     if test "$wxUSE_THREADS" = "yes" ; then
3956         if test "$USE_BEOS" = 1; then
3957             AC_MSG_WARN([BeOS threads are not yet supported... disabled])
3958             wxUSE_THREADS="no"
3959         fi
3960     fi
3961
3962     if test "$wxUSE_THREADS" = "yes" ; then
3963         dnl find if POSIX threads are available
3964         dnl
3965         dnl the tests here are based on ACX_PTHREAD macro from autoconf macro
3966         dnl archive from http://ac-archive.sourceforge.net/
3967         dnl
3968         dnl thanks to Steven G. Johnson <stevenj@alum.mit.edu> and Alejandro
3969         dnl Forero Cuervo <bachue@bachue.com> for the original code
3970
3971         dnl TODO: cache the result
3972
3973         dnl define the list of the thread options to try in the loop below
3974         dnl with the convention that anything starting with '-' is a cpp flag
3975         dnl while anything else is a library (i.e. there is an implicit "-l")
3976         THREAD_OPTS="-pthread"
3977         case "${host}" in
3978           *-*-solaris2* | *-*-sunos4* )
3979                 if test "x$GCC" = "xyes"; then
3980                     dnl Solaris/gcc combination use this one for some reason
3981                     THREAD_OPTS="-pthreads $THREAD_OPTS"
3982                 else
3983                     THREAD_OPTS="-mt $THREAD_OPTS"
3984                 fi
3985                 ;;
3986           *-*-freebsd*)
3987                 dnl look, in order, for the kernel threads, then Linux threads
3988                 dnl and finally the userland threads
3989                 THREAD_OPTS="-kthread lthread $THREAD_OPTS c_r"
3990                 ;;
3991           *-*-darwin* | *-*-cygwin* )
3992                 dnl Darwin / Mac OS X just uses -lpthread tested below
3993                 dnl and so does Cygwin
3994                 THREAD_OPTS=""
3995                 ;;
3996           *-*-aix*)
3997                 dnl AIX calls the library libpthreads - thanks IBM!
3998                 THREAD_OPTS="pthreads"
3999                 ;;
4000           *-hp-hpux* )
4001                 dnl HP-UX aCC only gives a warning, not an error about
4002                 dnl -pthread but it doesn't work and we have to use -lpthread
4003                 dnl there
4004                 if test "x$GCC" != "xyes"; then
4005                     THREAD_OPTS=""
4006                 fi
4007                 ;;
4008
4009           *-*-irix* )
4010                 dnl gcc under IRIX doesn't seem to like -pthread, but it
4011                 dnl doesn't give an error for it neither, just a warning
4012                 dnl message -- but this is still very annoying
4013                 if test "x$GCC" = "xyes"; then
4014                     THREAD_OPTS=""
4015                 fi
4016                 ;;
4017
4018           *-*-*UnixWare*)
4019                 dnl flying by man pages here: Caldera online docs use this
4020                 if test "x$GCC" != "xyes"; then
4021                     THREAD_OPTS="-Ethread"
4022                 fi
4023                 ;;
4024         esac
4025
4026         dnl simply linking with libpthread should make the test below work but
4027         dnl it's far from certain that the threaded programs compiled without
4028         dnl any special switches actually work, so try it after all the others
4029         THREAD_OPTS="$THREAD_OPTS pthread none"
4030
4031         dnl now test for all possibilities
4032         THREADS_OK=no
4033         for flag in $THREAD_OPTS; do
4034             case $flag in
4035                 none)
4036                     AC_MSG_CHECKING([whether pthreads work without any flags])
4037                     ;;
4038
4039                 -*)
4040                     AC_MSG_CHECKING([whether pthreads work with $flag])
4041                     THREADS_CFLAGS="$flag"
4042                     ;;
4043
4044                 *)
4045                     AC_MSG_CHECKING([for the pthreads library -l$flag])
4046                     THREADS_LINK="-l$flag"
4047                     ;;
4048               esac
4049
4050               save_LIBS="$LIBS"
4051               save_CFLAGS="$CFLAGS"
4052               LIBS="$THREADS_LINK $LIBS"
4053               CFLAGS="$THREADS_CFLAGS $CFLAGS"
4054
4055               AC_TRY_LINK([#include <pthread.h>],
4056                           [pthread_create(0,0,0,0);],
4057                           THREADS_OK=yes)
4058
4059               LIBS="$save_LIBS"
4060               CFLAGS="$save_CFLAGS"
4061
4062               AC_MSG_RESULT($THREADS_OK)
4063               if test "x$THREADS_OK" = "xyes"; then
4064                       break;
4065               fi
4066
4067               THREADS_LINK=""
4068               THREADS_CFLAGS=""
4069       done
4070
4071       if test "x$THREADS_OK" != "xyes"; then
4072           wxUSE_THREADS=no
4073           AC_MSG_WARN([No thread support on this system... disabled])
4074       else
4075           dnl yes, these special compiler flags should be used with the
4076           dnl linker as well
4077           LDFLAGS="$THREADS_CFLAGS $LDFLAGS"
4078           LIBS="$THREADS_LINK $LIBS"
4079
4080           AC_MSG_CHECKING([if more special flags are required for pthreads])
4081           flag=no
4082           case "${host}" in
4083             *-aix*)
4084                 dnl again quoting from
4085                 dnl http://www-1.ibm.com/servers/esdd/articles/gnu.html:
4086                 dnl
4087                 dnl     When compiling and linking with -pthread, the library
4088                 dnl     search path should include -L/usr/lib/threads at the
4089                 dnl     beginning of the path.
4090                 LDFLAGS="-L/usr/lib/threads $LDFLAGS"
4091                 flag="-D_THREAD_SAFE"
4092                 ;;
4093             *-freebsd*)
4094                 flag="-D_THREAD_SAFE"
4095                 ;;
4096             *-hp-hpux* )
4097                 flag="-D_REENTRANT"
4098                 if test "x$GCC" != "xyes"; then
4099                     dnl see http://docs.hp.com/hpux/onlinedocs/2213/threads.htm
4100                     flag="$flag -D_RWSTD_MULTI_THREAD"
4101                 fi
4102                 ;;
4103             *solaris* | alpha*-osf*)
4104                 flag="-D_REENTRANT"
4105                 ;;
4106           esac
4107           AC_MSG_RESULT(${flag})
4108           if test "x$flag" != xno; then
4109               THREADS_CFLAGS="$THREADS_CFLAGS $flag"
4110           fi
4111
4112           if test "x$THREADS_CFLAGS" != "x"; then
4113             dnl don't add these options to CPPFLAGS as cpp might not know them
4114             CFLAGS="$CFLAGS $THREADS_CFLAGS"
4115             CXXFLAGS="$CXXFLAGS $THREADS_CFLAGS"
4116           fi
4117       fi
4118     fi
4119
4120     dnl do other tests only if we are using threads
4121     if test "$wxUSE_THREADS" = "yes" ; then
4122       AC_CHECK_FUNCS(thr_setconcurrency)
4123
4124       AC_CHECK_HEADERS(sched.h)
4125       if test "$ac_cv_header_sched_h" = "yes"; then
4126           AC_CHECK_FUNC(sched_yield,
4127             AC_DEFINE(HAVE_SCHED_YIELD),
4128             [
4129                 AC_CHECK_LIB(posix4,
4130                     sched_yield,
4131                     [AC_DEFINE(HAVE_SCHED_YIELD) POSIX4_LINK=" -lposix4"],
4132                     AC_MSG_WARN(wxThread::Yield will not work properly)
4133                 )
4134             ]
4135           )
4136       fi
4137
4138       dnl to be able to set the thread priority, we need to have all of the
4139       dnl following functions:
4140       dnl   1. pthread_attr_getschedpolicy
4141       dnl   2. sched_get_priority_min and sched_get_priority_max
4142       dnl      (this one can be in either libpthread or libposix4 (under Solaris))
4143       dnl   3. pthread_attr_getschedparam and pthread_attr_setschedparam
4144       HAVE_PRIOR_FUNCS=0
4145       AC_CHECK_FUNC(pthread_attr_getschedpolicy,
4146                      [AC_CHECK_FUNC(pthread_attr_setschedparam,
4147                        [AC_CHECK_FUNC(sched_get_priority_max,
4148                            HAVE_PRIOR_FUNCS=1,
4149                            [AC_CHECK_LIB([posix4], sched_get_priority_max,
4150                              [
4151                                 HAVE_PRIOR_FUNCS=1
4152                                 POSIX4_LINK=" -lposix4"
4153                              ],
4154                            )]
4155                        )]
4156                      )]
4157                    )
4158
4159       if test "$HAVE_PRIOR_FUNCS" = 1; then
4160         AC_DEFINE(HAVE_THREAD_PRIORITY_FUNCTIONS)
4161       else
4162         AC_MSG_WARN(Setting thread priority will not work)
4163       fi
4164
4165       AC_CHECK_FUNC(pthread_cancel,
4166                     AC_DEFINE(HAVE_PTHREAD_CANCEL),
4167                     AC_MSG_WARN([wxThread::Kill() will not work properly]))
4168
4169       dnl we don't use pthread_cleanup_push/pop() any more in the code, but I
4170       dnl the code here for now in case we need it again soon; otherwise it
4171       dnl should be removed in a couple of months (VZ in Sep 2003)
4172       dnl
4173       dnl AC_CACHE_CHECK([for pthread_cleanup_push/pop], wx_cv_func_pthread_cleanup_push,
4174       dnl [
4175       dnl   AC_TRY_COMPILE([#include <pthread.h>],
4176       dnl                [
4177       dnl                   pthread_cleanup_push(NULL, NULL);
4178       dnl                   pthread_cleanup_pop(0);
4179       dnl                ], [
4180       dnl                   wx_cv_func_pthread_cleanup_push=yes
4181       dnl                ], [
4182       dnl                   wx_cv_func_pthread_cleanup_push=no
4183       dnl                ])
4184       dnl ])
4185       dnl 
4186       dnl if test "$wx_cv_func_pthread_cleanup_push" = "yes"; then
4187       dnl     AC_DEFINE(HAVE_THREAD_CLEANUP_FUNCTIONS)
4188       dnl fi
4189
4190       dnl mutexattr_t initialization is done in quite different ways on different
4191       dnl platforms, so check for a few things:
4192       dnl
4193       dnl HAVE_MUTEX_RECURSIVE means that we can create recursive mutexes
4194       dnl HAVE_MUTEXATTR_SETTYPE means that we do it using
4195       dnl pthread_mutexattr_settype(PTHREAD_MUTEX_RECURSIVE) and if it is not
4196       dnl defined, we do it by directly assigned
4197       dnl PTHREAD_MUTEX_RECURSIVE_MUTEX_INITIALIZER_NP to attr
4198
4199       AC_CACHE_CHECK([for pthread_mutexattr_t], wx_cv_type_pthread_mutexattr_t,
4200       [
4201         AC_TRY_COMPILE([#include <pthread.h>],
4202             [
4203                pthread_mutexattr_t attr;
4204                pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
4205             ], [
4206                wx_cv_type_pthread_mutexattr_t=yes
4207             ], [
4208                wx_cv_type_pthread_mutexattr_t=no
4209             ]
4210         )
4211       ])
4212
4213       if test "$wx_cv_type_pthread_mutexattr_t" = "yes"; then
4214         AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_T)
4215       else
4216         dnl don't despair, there may be another way to do it
4217         AC_CACHE_CHECK([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER],
4218                        wx_cv_type_pthread_rec_mutex_init,
4219         [
4220             AC_TRY_COMPILE([#include <pthread.h>],
4221                 [
4222                     pthread_mutex_t attr = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
4223                 ], [
4224                     wx_cv_type_pthread_rec_mutex_init=yes
4225                 ], [
4226                     wx_cv_type_pthread_rec_mutex_init=no
4227                 ]
4228             )
4229         ])
4230         if test "$wx_cv_type_pthread_rec_mutex_init" = "yes"; then
4231           AC_DEFINE(HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
4232         else
4233           dnl this may break code working elsewhere, so at least warn about it
4234           AC_MSG_WARN([wxMutex won't be recursive on this platform])
4235         fi
4236       fi
4237     fi
4238
4239 dnl from if !MSW
4240 else
4241     if test "$wxUSE_THREADS" = "yes" ; then
4242       case "${host}" in
4243         *-*-mingw32* )
4244             dnl check if the compiler accepts -mthreads
4245             AC_CACHE_CHECK([if compiler supports -mthreads],
4246                 wx_cv_cflags_mthread,
4247                 [
4248                     CFLAGS_OLD="$CFLAGS"
4249                     CFLAGS="$CFLAGS -mthreads"
4250                     AC_TRY_COMPILE([], [],
4251                         wx_cv_cflags_mthread=yes,
4252                         wx_cv_cflags_mthread=no
4253                     )
4254                 ]
4255             )
4256
4257             if test "$wx_cv_cflags_mthread" = "yes"; then
4258                 dnl it does, use it
4259                 CXXFLAGS="$CXXFLAGS -mthreads"
4260                 TOOLCHAIN_DEFS="$TOOLCHAIN_DEFS -mthreads"
4261                 LDFLAGS="$LDFLAGS -mthreads"
4262             else
4263                 dnl it doesn't
4264                 CFLAGS="$CFLAGS_OLD"
4265             fi
4266         ;;
4267         *-pc-os2*emx )
4268             CFLAGS="$CFLAGS -Zmt -D__ST_MT_ERRNO__"
4269             CXXFLAGS="$CXXFLAGS -Zmt -D__ST_MT_ERRNO__"
4270             LDFLAGS="$LDFLAGS -Zmt"
4271         ;;
4272       esac
4273     fi
4274 fi
4275
4276 if test "$wxUSE_THREADS" = "yes"; then
4277   AC_DEFINE(wxUSE_THREADS)
4278
4279   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS thread"
4280 else
4281   dnl on some systems, _REENTRANT should be defined if we want to use any _r()
4282   dnl functions - add tests for other functions here as well
4283   if test "$ac_cv_func_strtok_r" = "yes"; then
4284     AC_MSG_CHECKING(if -D_REENTRANT is needed)
4285     if test "$NEEDS_D_REENTRANT_FOR_R_FUNCS" = 1; then
4286         TOOLCHAIN_DEFS="${TOOLCHAIN_DEFS} -D_REENTRANT"
4287         AC_MSG_RESULT(yes)
4288     else
4289         AC_MSG_RESULT(no)
4290     fi
4291   fi
4292 fi
4293
4294 if test "$WXGTK20" = 1 ; then
4295   AC_DEFINE_UNQUOTED(__WXGTK20__,$WXGTK20)
4296   WXGTK12=1
4297 fi
4298
4299 if test "$WXGTK12" = 1 ; then
4300   AC_DEFINE_UNQUOTED(__WXGTK12__,$WXGTK12)
4301 fi
4302
4303 if test "$WXGTK127" = 1 ; then
4304   AC_DEFINE_UNQUOTED(__WXGTK127__,$WXGTK127)
4305 fi
4306
4307 if test "$WXGPE" = 1 ; then
4308   AC_DEFINE_UNQUOTED(__WXGPE__,$WXGPE)
4309 fi
4310
4311 WXDEBUG=
4312
4313 if test "$wxUSE_DEBUG_INFO" = "yes" ; then
4314     WXDEBUG="-g"
4315     wxUSE_OPTIMISE=no
4316 fi
4317
4318 if test "$wxUSE_DEBUG_GDB" = "yes" ; then
4319     wxUSE_DEBUG_INFO=yes
4320     WXDEBUG="-ggdb"
4321 fi
4322
4323 if test "$wxUSE_DEBUG_FLAG" = "yes" ; then
4324     AC_DEFINE(WXDEBUG)
4325     WXDEBUG_DEFINE="-D__WXDEBUG__"
4326 else
4327     if test "$wxUSE_GTK" = 1 ; then
4328         WXDEBUG_DEFINE="-DGTK_NO_CHECK_CASTS"
4329     fi
4330 fi
4331
4332 if test "$wxUSE_MEM_TRACING" = "yes" ; then
4333     AC_DEFINE(wxUSE_MEMORY_TRACING)
4334     AC_DEFINE(wxUSE_GLOBAL_MEMORY_OPERATORS)
4335     AC_DEFINE(wxUSE_DEBUG_NEW_ALWAYS)
4336     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS memcheck"
4337 fi
4338
4339 if test "$wxUSE_DMALLOC" = "yes" ; then
4340     DMALLOC_LIBS="-ldmalloc"
4341 fi
4342
4343 PROFILE=
4344 if test "$wxUSE_PROFILE" = "yes" ; then
4345     PROFILE=" -pg"
4346 fi
4347
4348 CODE_GEN_FLAGS=
4349 CODE_GEN_FLAGS_CXX=
4350 if test "$GCC" = "yes" ; then
4351     if test "$wxUSE_NO_RTTI" = "yes" ; then
4352         CODE_GEN_FLAGS_CXX="$CODE_GEN_FLAGS_CXX -fno-rtti"
4353     fi
4354     if test "$wxUSE_NO_EXCEPTIONS" = "yes" ; then
4355         CODE_GEN_FLAGS_CXX="$CODE_GEN_FLAGS_CXX -fno-exceptions"
4356     fi
4357     if test "$wxUSE_PERMISSIVE" = "yes" ; then
4358         CODE_GEN_FLAGS="$CODE_GEN_FLAGS -fpermissive"
4359     fi
4360
4361     dnl Ian Brown <ian.brown@printsoft.de> reports that versions of gcc before
4362     dnl 3.0 overflow the table of contents on rs6000 as they create an entry
4363     dnl for each subroutine by default -- using the switch below only creates
4364     dnl one entry per file instead at the price of minor performance penalty
4365     dnl
4366     dnl As of wx2.4 a bug in the hppa gcc compiler causes a similar problem
4367     dnl without -ffunction-sections.  No idea how long we'll need to maintain
4368     dnl this, or even the extent of gcc/wx version combinations affected, but
4369     dnl also as above, this 'fix' does not come without side effects.
4370     dnl
4371     dnl TODO: test for the gcc version here (how?)
4372     case "${host}" in
4373       powerpc*-*-aix* )
4374         CODE_GEN_FLAGS="$CODE_GEN_FLAGS -mminimal-toc"
4375         ;;
4376       *-hppa* )
4377         CODE_GEN_FLAGS="$CODE_GEN_FLAGS -ffunction-sections"
4378         ;;
4379     esac
4380 fi
4381
4382 OPTIMISE=
4383 if test "$wxUSE_OPTIMISE" = "no" ; then
4384     if test "$GCC" = yes ; then
4385         dnl use -O0 because compiling with it is faster than compiling with no
4386         dnl optimization options at all (at least with g++ 3.2)
4387         OPTIMISE="-O0"
4388     fi
4389 else
4390     if test "$GCC" = yes ; then
4391         OPTIMISE="-O2"
4392
4393         dnl VZ: does anybody know what does this do??
4394         case "${host}" in
4395             i586-*-*|i686-*-* )
4396             OPTIMISE="${OPTIMISE} "
4397         ;;
4398         esac
4399     else
4400         OPTIMISE="-O"
4401     fi
4402 fi
4403
4404 dnl ---------------------------------------------------------------------------
4405 dnl compatibility level
4406 dnl ---------------------------------------------------------------------------
4407
4408 if test "x$WXWIN_COMPATIBILITY_2_2" = "xyes"; then
4409     AC_DEFINE(WXWIN_COMPATIBILITY_2_2)
4410
4411     WXWIN_COMPATIBILITY_2_4="yes"
4412 fi
4413
4414 if test "x$WXWIN_COMPATIBILITY_2_4" != "xno"; then
4415     AC_DEFINE(WXWIN_COMPATIBILITY_2_4)
4416 fi
4417
4418 dnl ---------------------------------------------------------------------------
4419 dnl the library may be built without GUI classes at all
4420 dnl ---------------------------------------------------------------------------
4421
4422 if test "$wxUSE_GUI" = "yes"; then
4423   AC_DEFINE(wxUSE_GUI)
4424
4425   dnl the things we always pull in the GUI version of the library:
4426   dnl 1. basic things like wxApp, wxWindow, wxControl, wxFrame, wxDialog (the
4427   dnl    library really can't be built without those)
4428   dnl 2. basic controls: wxButton, wxStaticText, wxTextCtrl (these are used in
4429   dnl    almost any program and the first 2 are needed to show a message box
4430   dnl    which want to be always able to do)
4431   dnl 3. GDI stuff: icon, cursors and all that. Although it would be very nice
4432   dnl    to compile without them (if the app doesn't do any drawing, it doesn't
4433   dnl    need the dcs, pens, brushes, ...), this just can't be done now
4434   dnl 4. menu stuff: wxMenu, wxMenuBar, wxMenuItem
4435   dnl 5. misc stuff: timers, settings, message box
4436 else
4437   AC_DEFINE(wxUSE_NOGUI)
4438 fi
4439
4440 dnl ---------------------------------------------------------------------------
4441 dnl Unix/Windows
4442 dnl ---------------------------------------------------------------------------
4443
4444 if test "$wxUSE_UNIX" = "yes"; then
4445   AC_DEFINE(wxUSE_UNIX)
4446 fi
4447
4448 dnl ------------------------------------------------------------------------
4449 dnl DLL support
4450 dnl ------------------------------------------------------------------------
4451
4452 dnl under MSW we always have LoadLibrary/GetProcAddress
4453 if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
4454
4455     HAVE_DL_FUNCS=0
4456     HAVE_SHL_FUNCS=0
4457     if test "$wxUSE_DYNAMIC_LOADER" = "yes" -o "$wxUSE_DYNLIB_CLASS" = "yes" ; then
4458         if test "$USE_DARWIN" = 1; then
4459             dnl dlopen/dlerror is implemented in dynlib.cpp for Darwin/Mac OS X
4460             HAVE_DL_FUNCS=1
4461         else
4462             dnl the test is a bit complicated because we check for dlopen() both with
4463             dnl and without -ldl and we also try to find shl_load() if there is no
4464             dnl dlopen() on this system
4465             AC_CHECK_FUNCS(dlopen,
4466             [
4467                 AC_DEFINE(HAVE_DLOPEN)
4468                 HAVE_DL_FUNCS=1
4469             ],
4470             [
4471                 AC_CHECK_LIB(dl, dlopen,
4472                             [
4473                                 AC_DEFINE(HAVE_DLOPEN)
4474                                 HAVE_DL_FUNCS=1
4475                                 DL_LINK=" -ldl$DL_LINK"
4476                             ],
4477                             [
4478                                 AC_CHECK_FUNCS(shl_load,
4479                                               [
4480                                                 AC_DEFINE(HAVE_SHL_LOAD)
4481                                                 HAVE_SHL_FUNCS=1
4482                                               ],
4483                                               [
4484                                                 AC_CHECK_LIB(shl_load, dld,
4485                                                              [
4486                                                                 HAVE_SHL_FUNCS=1
4487                                                                 DL_LINK=" -ldld$DL_LINK"
4488                                                              ])
4489                                               ])
4490                             ])
4491             ])
4492
4493         dnl check also for dlerror()
4494         if test "$HAVE_DL_FUNCS" = 1; then
4495             AC_CHECK_FUNCS(dlerror,
4496                 AC_DEFINE(HAVE_DLERROR),
4497                 [
4498                     AC_CHECK_LIB(dl, dlerror, AC_DEFINE(HAVE_DLERROR))
4499                 ]
4500             )
4501         fi
4502         fi
4503
4504         if test "$HAVE_DL_FUNCS" = 0; then
4505             if test "$HAVE_SHL_FUNCS" = 0; then
4506               if test "$USE_UNIX" = 1; then
4507                   AC_MSG_WARN([Missing dynamic loading support, several features will be disabled])
4508                   wxUSE_DYNAMIC_LOADER=no
4509                   wxUSE_DYNLIB_CLASS=no
4510               else
4511                   AC_MSG_WARN([Assuming wxLibrary class works on this platform])
4512               fi
4513             fi
4514         fi
4515     fi
4516 fi
4517
4518 if test "$wxUSE_DYNAMIC_LOADER" = "yes" ; then
4519     AC_DEFINE(wxUSE_DYNAMIC_LOADER)
4520 fi
4521 if test "$wxUSE_DYNLIB_CLASS" = "yes" ; then
4522     AC_DEFINE(wxUSE_DYNLIB_CLASS)
4523 fi
4524
4525
4526 dnl ---------------------------------------------------------------------------
4527 dnl Verify consistency of plugins/monolithic/shared settings:
4528 dnl ---------------------------------------------------------------------------
4529
4530 if test "$wxUSE_PLUGINS" = "yes" ; then
4531     if test "$wxUSE_SHARED" = "no" ; then
4532         AC_MSG_WARN([plugins supported only in shared build, disabling])
4533         wxUSE_PLUGINS=no
4534     fi
4535     if test "$wxUSE_MONOLITHIC" = "yes" ; then
4536         AC_MSG_WARN([plugins not supported monolithic build, disabling])
4537         wxUSE_PLUGINS=no
4538     fi
4539     if test "$wxUSE_DYNLIB_CLASS" = "no" ; then
4540         AC_MSG_WARN([plugins require wxDynamicLibrary, disabling])
4541         wxUSE_PLUGINS=no
4542     fi
4543     if test "$wxUSE_PLUGINS" = "yes" ; then
4544         AC_DEFINE(wxUSE_PLUGINS)
4545     fi
4546 fi
4547
4548 dnl ---------------------------------------------------------------------------
4549 dnl Register non-GUI class options for makefiles and setup.h
4550 dnl ---------------------------------------------------------------------------
4551
4552 if test "$wxUSE_STL" = "yes"; then
4553   AC_DEFINE(wxUSE_STL)
4554 fi
4555
4556 if test "$wxUSE_APPLE_IEEE" = "yes"; then
4557   AC_DEFINE(wxUSE_APPLE_IEEE)
4558 fi
4559
4560 if test "$wxUSE_TIMER" = "yes"; then
4561   AC_DEFINE(wxUSE_TIMER)
4562 fi
4563
4564 WITH_PLUGIN_SDL=0
4565 if test "$wxUSE_SOUND" = "yes"; then
4566   dnl Unix implementation needs additional checks because audio support
4567   dnl comes in many favours:
4568   if test "$USE_UNIX" = "1" ; then
4569     AC_CHECK_HEADERS([sys/soundcard.h])
4570
4571     if test "$wxUSE_LIBSDL" != "no"; then
4572       AM_PATH_SDL([1.2.0],
4573                   [
4574                     EXTRALIBS_SDL="$SDL_LIBS"
4575                     CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
4576                     AC_DEFINE(wxUSE_LIBSDL)
4577                   ],
4578                   [wxUSE_LIBSDL="no"])
4579       if test "$wxUSE_LIBSDL" = "yes" -a "$wxUSE_PLUGINS" = "yes" ; then
4580         WITH_PLUGIN_SDL=1
4581       fi
4582     fi
4583   fi
4584  
4585   AC_DEFINE(wxUSE_SOUND)
4586   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS sound"
4587 fi
4588
4589 if test "$wxUSE_CMDLINE_PARSER" = "yes"; then
4590   AC_DEFINE(wxUSE_CMDLINE_PARSER)
4591 fi
4592
4593 if test "$wxUSE_STOPWATCH" = "yes"; then
4594   AC_DEFINE(wxUSE_STOPWATCH)
4595 fi
4596
4597 if test "$wxUSE_DATETIME" = "yes"; then
4598   AC_DEFINE(wxUSE_DATETIME)
4599 fi
4600
4601 if test "$wxUSE_FILE" = "yes"; then
4602   AC_DEFINE(wxUSE_FILE)
4603 fi
4604
4605 if test "$wxUSE_FFILE" = "yes"; then
4606   AC_DEFINE(wxUSE_FFILE)
4607 fi
4608
4609 if test "$wxUSE_FILESYSTEM" = "yes"; then
4610   AC_DEFINE(wxUSE_FILESYSTEM)
4611 fi
4612
4613 if test "$wxUSE_FS_ZIP" = "yes"; then
4614   AC_DEFINE(wxUSE_FS_ZIP)
4615 fi
4616
4617 if test "$wxUSE_ZIPSTREAM" = "yes"; then
4618   AC_DEFINE(wxUSE_ZIPSTREAM)
4619 fi
4620
4621 if test "$wxUSE_GZSTREAM" = "yes"; then
4622   AC_DEFINE(wxUSE_GZSTREAM)
4623 fi
4624
4625 if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes"; then
4626   AC_DEFINE(wxUSE_ON_FATAL_EXCEPTION)
4627 fi
4628
4629 if test "$wxUSE_SNGLINST_CHECKER" = "yes"; then
4630   AC_DEFINE(wxUSE_SNGLINST_CHECKER)
4631 fi
4632
4633 if test "$wxUSE_BUSYINFO" = "yes"; then
4634   AC_DEFINE(wxUSE_BUSYINFO)
4635 fi
4636
4637 if test "$wxUSE_STD_IOSTREAM" = "yes"; then
4638   AC_DEFINE(wxUSE_STD_IOSTREAM)
4639 fi
4640
4641 if test "$wxUSE_TEXTBUFFER" = "yes"; then
4642     AC_DEFINE(wxUSE_TEXTBUFFER)
4643 fi
4644
4645 if test "$wxUSE_TEXTFILE" = "yes"; then
4646   if test "$wxUSE_FILE" != "yes" -o "$wxUSE_TEXTBUFFER" != "yes" ; then
4647     AC_MSG_WARN(wxTextFile requires wxFile and wxTextBuffer... disabled)
4648   else
4649     AC_DEFINE(wxUSE_TEXTFILE)
4650   fi
4651 fi
4652
4653 if test "$wxUSE_CONFIG" = "yes" ; then
4654   if test "$wxUSE_TEXTFILE" != "yes"; then
4655     AC_MSG_WARN(wxConfig requires wxTextFile... disabled)
4656   else
4657     AC_DEFINE(wxUSE_CONFIG)
4658     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS config"
4659   fi
4660 fi
4661
4662 if test "$wxUSE_INTL" = "yes" ; then
4663   if test "$wxUSE_FILE" != "yes"; then
4664     AC_MSG_WARN(I18n code requires wxFile... disabled)
4665   else
4666     AC_DEFINE(wxUSE_INTL)
4667     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS internat"
4668     GUIDIST="$GUIDIST INTL_DIST"
4669   fi
4670 fi
4671
4672 if test "$wxUSE_LOG" = "yes"; then
4673   AC_DEFINE(wxUSE_LOG)
4674
4675     if test "$wxUSE_LOGGUI" = "yes"; then
4676       AC_DEFINE(wxUSE_LOGGUI)
4677     fi
4678
4679     if test "$wxUSE_LOGWINDOW" = "yes"; then
4680       AC_DEFINE(wxUSE_LOGWINDOW)
4681     fi
4682
4683     if test "$wxUSE_LOGDIALOG" = "yes"; then
4684       AC_DEFINE(wxUSE_LOG_DIALOG)
4685     fi
4686 fi
4687
4688 if test "$wxUSE_LONGLONG" = "yes"; then
4689   AC_DEFINE(wxUSE_LONGLONG)
4690 fi
4691
4692 if test "$wxUSE_GEOMETRY" = "yes"; then
4693   AC_DEFINE(wxUSE_GEOMETRY)
4694 fi
4695
4696 if test "$wxUSE_DIALUP_MANAGER" = "yes" ; then
4697   AC_DEFINE(wxUSE_DIALUP_MANAGER)
4698   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dialup"
4699 fi
4700
4701 if test "$wxUSE_STREAMS" = "yes" ; then
4702   AC_DEFINE(wxUSE_STREAMS)
4703 fi
4704
4705 dnl ---------------------------------------------------------------------------
4706 dnl time/date functions
4707 dnl ------------------------------------------------------------------------
4708
4709 if test "$wxUSE_DATETIME" = "yes"; then
4710     dnl check for strptime
4711     AC_CHECK_FUNCS(strptime)
4712
4713     dnl check for timezone variable
4714     dnl   doesn't exist under Darwin / Mac OS X which uses tm_gmtoff instead
4715     AC_CACHE_CHECK(for timezone variable in <time.h>,
4716                    wx_cv_var_timezone,
4717                    [
4718                         AC_TRY_COMPILE(
4719                             [
4720                                 #include <time.h>
4721                             ],
4722                             [
4723                                 int tz;
4724                                 tz = timezone;
4725                             ],
4726                             [
4727                                 wx_cv_var_timezone=timezone
4728                             ],
4729                             [
4730                                 AC_TRY_COMPILE(
4731                                     [
4732                                         #include <time.h>
4733                                     ],
4734                                     [
4735                                         int tz;
4736                                         tz = _timezone;
4737                                     ],
4738                                     [
4739                                         wx_cv_var_timezone=_timezone
4740                                     ],
4741                                     [
4742                                         AC_TRY_COMPILE(
4743                                             [
4744                                                 #include <time.h>
4745                                             ],
4746                                             [
4747                                                 int tz;
4748                                                 tz = __timezone;
4749                                             ],
4750                                             [
4751                                                 wx_cv_var_timezone=__timezone
4752                                             ],
4753                                             [
4754                                                 if test "$USE_DOS" = 0 ; then
4755                                                     AC_MSG_WARN(no timezone variable, will use tm_gmtoff instead)
4756                                                 fi
4757                                             ]
4758                                         )
4759                                     ]
4760                                 )
4761                             ]
4762                         )
4763                    ]
4764     )
4765
4766     dnl as we want $wx_cv_var_timezone to be expanded, use AC_DEFINE_UNQUOTED
4767     if test "x$wx_cv_var_timezone" != x ; then
4768         AC_DEFINE_UNQUOTED(WX_TIMEZONE, $wx_cv_var_timezone)
4769     fi
4770
4771     dnl check for localtime (it's POSIX, but the check can do no harm...)
4772     AC_CHECK_FUNCS(localtime)
4773
4774     if test "$ac_cv_func_localtime" = "yes"; then
4775         AC_CACHE_CHECK(for tm_gmtoff in struct tm,
4776                        wx_cv_struct_tm_has_gmtoff,
4777         [
4778             AC_TRY_COMPILE(
4779                 [
4780                     #include <time.h>
4781                 ],
4782                 [
4783                     struct tm tm;
4784                     tm.tm_gmtoff++;
4785                 ],
4786                 [
4787                     wx_cv_struct_tm_has_gmtoff=yes
4788                 ],
4789                 wx_cv_struct_tm_has_gmtoff=no
4790             )
4791         ])
4792     fi
4793
4794     if test "$wx_cv_struct_tm_has_gmtoff" = "yes"; then
4795         AC_DEFINE(WX_GMTOFF_IN_TM)
4796     fi
4797
4798     dnl check for gettimeofday (SVr4, BSD 4.3) and ftime (V7, BSD 4.3) for the
4799     dnl function to be used for high resolution timers
4800     AC_CHECK_FUNCS(gettimeofday ftime, break)
4801
4802     if test "$ac_cv_func_gettimeofday" = "yes"; then
4803         AC_CACHE_CHECK([whether gettimeofday takes two arguments],
4804                        wx_cv_func_gettimeofday_has_2_args,
4805         [
4806             dnl on some _really_ old systems it takes only 1 argument
4807             AC_LANG_SAVE
4808             AC_LANG_CPLUSPLUS
4809
4810             AC_TRY_COMPILE(
4811                 [
4812                     #include <sys/time.h>
4813                     #include <unistd.h>
4814                 ],
4815                 [
4816                     struct timeval tv;
4817                     gettimeofday(&tv, NULL);
4818                 ],
4819                 wx_cv_func_gettimeofday_has_2_args=yes,
4820                 AC_TRY_COMPILE(
4821                     [
4822                         #include <sys/time.h>
4823                         #include <unistd.h>
4824                     ],
4825                     [
4826                         struct timeval tv;
4827                         gettimeofday(&tv);
4828                     ],
4829                     wx_cv_func_gettimeofday_has_2_args=no,
4830                     [
4831                         AC_MSG_WARN([failed to determine number of gettimeofday() arguments])
4832                         wx_cv_func_gettimeofday_has_2_args=unknown
4833                     ]
4834                 )
4835             )
4836             AC_LANG_RESTORE
4837         ])
4838
4839         if test "$wx_cv_func_gettimeofday_has_2_args" != "yes"; then
4840             AC_DEFINE(WX_GETTIMEOFDAY_NO_TZ)
4841         fi
4842     fi
4843
4844     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS typetest"
4845 fi
4846
4847 dnl ------------------------------------------------------------------------
4848 dnl wxSocket
4849 dnl ------------------------------------------------------------------------
4850
4851 dnl VZ: the GUI hooks wxSocket needs are not implemented yet in some toolkits
4852 if test "$wxUSE_SOCKETS" = "yes"; then
4853     if test "$wxUSE_MGL" = "1"; then
4854         AC_MSG_WARN([wxSocket not yet supported under MGL... disabled])
4855         wxUSE_SOCKETS="no"
4856     fi
4857 fi
4858
4859 if test "$wxUSE_SOCKETS" = "yes"; then
4860     dnl under MSW we always have sockets
4861     if test "$TOOLKIT" != "MSW"; then
4862         dnl under Solaris and OS/2, socket functions live in -lsocket
4863         AC_CHECK_FUNC(socket,,
4864             [
4865                 AC_CHECK_LIB(socket, socket,
4866                     if test "$INET_LINK" != " -lsocket"; then
4867                         INET_LINK="$INET_LINK -lsocket"
4868                     fi,
4869                     [
4870                         AC_MSG_WARN([socket library not found - sockets will be disabled])
4871                         wxUSE_SOCKETS=no
4872                     ]
4873                 )
4874             ]
4875         )
4876     fi
4877 fi
4878
4879 if test "$wxUSE_SOCKETS" = "yes" ; then
4880     dnl this test may be appropriate if building under cygwin
4881     dnl right now I'm assuming it also uses the winsock stuff
4882     dnl like mingw does..  -- RL
4883     if test "$TOOLKIT" != "MSW"; then
4884         dnl determine the type of third argument for getsockname
4885         AC_CACHE_CHECK([what is the type of the third argument of getsockname],
4886                        wx_cv_type_getsockname3,
4887             [
4888                 AC_TRY_COMPILE(
4889                     [
4890                         #include <sys/types.h>
4891                         #include <sys/socket.h>
4892                     ],
4893                     [
4894                         socklen_t len;
4895                         getsockname(0, 0, &len);
4896                     ],
4897                     wx_cv_type_getsockname3=socklen_t,
4898                     [
4899                         dnl the compiler will compile the version with size_t
4900                         dnl even if the real type of the last parameter is int
4901                         dnl but it should give at least a warning about
4902                         dnl converting between incompatible pointer types, so
4903                         dnl try to use it to get the correct behaviour at
4904                         dnl least with gcc (otherwise we'd always use size_t)
4905                         CFLAGS_OLD="$CFLAGS"
4906                         if test "$GCC" = yes ; then
4907                             CFLAGS="$CFLAGS -Werror"
4908                         fi
4909
4910                         AC_TRY_COMPILE(
4911                             [
4912                                 #include <sys/types.h>
4913                                 #include <sys/socket.h>
4914                             ],
4915                             [
4916                                 size_t len;
4917                                 getsockname(0, 0, &len);
4918                             ],
4919                             wx_cv_type_getsockname3=size_t,
4920                             AC_TRY_COMPILE(
4921                                 [
4922                                     #include <sys/types.h>
4923                                     #include <sys/socket.h>
4924                                 ],
4925                                 [
4926                                     int len;
4927                                     getsockname(0, 0, &len);
4928                                 ],
4929                                 wx_cv_type_getsockname3=int,
4930                                 wx_cv_type_getsockname3=unknown
4931                             )
4932                         )
4933
4934                         CFLAGS="$CFLAGS_OLD"
4935                     ]
4936                 )
4937             ])
4938
4939         if test "$wx_cv_type_getsockname3" = "unknown"; then
4940             wxUSE_SOCKETS=no
4941             AC_MSG_WARN([Couldn't find socklen_t synonym for this system])
4942         else
4943             AC_DEFINE_UNQUOTED(SOCKLEN_T, $wx_cv_type_getsockname3)
4944         fi
4945     fi
4946 fi
4947
4948 if test "$wxUSE_SOCKETS" = "yes" ; then
4949     AC_DEFINE(wxUSE_SOCKETS)
4950     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS sockets"
4951 fi
4952
4953 if test "$wxUSE_PROTOCOL" = "yes"; then
4954     if test "$wxUSE_SOCKETS" != "yes"; then
4955         AC_MSG_WARN(Protocol classes require sockets... disabled)
4956         wxUSE_PROTOCOL=no
4957     fi
4958 fi
4959
4960 if test "$wxUSE_PROTOCOL" = "yes"; then
4961     AC_DEFINE(wxUSE_PROTOCOL)
4962
4963     if test "$wxUSE_PROTOCOL_HTTP" = "yes"; then
4964         AC_DEFINE(wxUSE_PROTOCOL_HTTP)
4965     fi
4966     if test "$wxUSE_PROTOCOL_FTP" = "yes"; then
4967         AC_DEFINE(wxUSE_PROTOCOL_FTP)
4968     fi
4969     if test "$wxUSE_PROTOCOL_FILE" = "yes"; then
4970         AC_DEFINE(wxUSE_PROTOCOL_FILE)
4971     fi
4972 else
4973     if test "$wxUSE_FS_INET" = "yes"; then
4974         AC_MSG_WARN([HTTP filesystem require protocol classes... disabled])   
4975         wxUSE_FS_INET="no"
4976     fi
4977 fi
4978
4979 if test "$wxUSE_URL" = "yes"; then
4980     if test "$wxUSE_PROTOCOL" != "yes"; then
4981         AC_MSG_WARN(wxURL class requires wxProtocol... disabled)
4982         wxUSE_URL=no
4983     fi
4984     if test "$wxUSE_URL" = "yes"; then
4985         AC_DEFINE(wxUSE_URL)
4986     fi
4987 fi
4988
4989 if test "$wxUSE_FS_INET" = "yes"; then
4990   AC_DEFINE(wxUSE_FS_INET)
4991 fi
4992
4993 dnl ---------------------------------------------------------------------------
4994 dnl Joystick support
4995 dnl ---------------------------------------------------------------------------
4996
4997 if test "$wxUSE_GUI" = "yes"; then
4998
4999     if test "$TOOLKIT" = "MAC" -o "$TOOLKIT" = "COCOA"; then
5000         AC_MSG_WARN([Joystick not yet supported under Mac OS X... disabled])
5001         wxUSE_JOYSTICK=no
5002      fi
5003     
5004      dnl under MSW we always have joystick support
5005     if test "$TOOLKIT" != "MSW"; then
5006         if test "$wxUSE_JOYSTICK" = "yes"; then
5007             dnl joystick support is only for Linux 2.1.x or greater
5008             AC_CHECK_HEADERS(linux/joystick.h)
5009             if test "$ac_cv_header_linux_joystick_h" != "yes"; then
5010                 wxUSE_JOYSTICK=no
5011                 AC_MSG_WARN(Joystick not supported by this system... disabled)
5012             fi
5013         fi
5014     fi
5015
5016     if test "$wxUSE_JOYSTICK" = "yes"; then
5017         AC_DEFINE(wxUSE_JOYSTICK)
5018         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS joytest"
5019     fi
5020 fi
5021
5022
5023 dnl ---------------------------------------------------------------------------
5024 dnl String stuff
5025 dnl ---------------------------------------------------------------------------
5026
5027 if test "$wxUSE_FONTMAP" = "yes" ; then
5028   AC_DEFINE(wxUSE_FONTMAP)
5029 fi
5030
5031 if test "$wxUSE_UNICODE" = "yes" ; then
5032   AC_DEFINE(wxUSE_UNICODE)
5033
5034   if test "$USE_WIN32" != 1; then
5035       wxUSE_UNICODE_MSLU=no
5036   fi
5037
5038   if test "$USE_WIN32" = 1 -a "$wxUSE_UNICODE_MSLU" = "yes"; then
5039         AC_CHECK_LIB(unicows,main,
5040             [
5041                 AC_DEFINE(wxUSE_UNICODE_MSLU)
5042             ],
5043             [
5044                 AC_MSG_WARN([Compiler doesn't support MSLU (libunicows.a), disabled.
5045                              Applications will only run on Windows NT/2000/XP!])
5046                 wxUSE_UNICODE_MSLU=no
5047             ])
5048     fi
5049 fi
5050
5051 if test "$wxUSE_wxUSE_EXPERIMENTAL_PRINTF" = "yes"; then
5052   AC_DEFINE(wxUSE_EXPERIMENTAL_PRINTF)
5053 fi
5054
5055 dnl ----------------------------------------------------------------
5056 dnl Register PostScript options for makefiles and setup.h
5057 dnl ----------------------------------------------------------------
5058
5059 if test "$wxUSE_POSTSCRIPT" = "yes" ; then
5060   AC_DEFINE(wxUSE_POSTSCRIPT)
5061 fi
5062
5063 AC_DEFINE(wxUSE_AFM_FOR_POSTSCRIPT)
5064
5065 AC_DEFINE(wxUSE_NORMALIZED_PS_FONTS)
5066
5067 dnl ---------------------------------------------------------------------------
5068 dnl big GUI components: MDI, doc/view, printing, help, ...
5069 dnl ---------------------------------------------------------------------------
5070
5071 if test "$wxUSE_CONSTRAINTS" = "yes"; then
5072     AC_DEFINE(wxUSE_CONSTRAINTS)
5073     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS layout"
5074 fi
5075
5076 if test "$wxUSE_MDI_ARCHITECTURE" = "yes"; then
5077    AC_DEFINE(wxUSE_MDI_ARCHITECTURE)
5078    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS mdi"
5079 fi
5080
5081 if test "$wxUSE_DOC_VIEW_ARCHITECTURE" = "yes" ; then
5082     AC_DEFINE(wxUSE_DOC_VIEW_ARCHITECTURE)
5083     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS docview"
5084     if test "$wxUSE_MDI_ARCHITECTURE" = "yes"; then
5085         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS docvwmdi"
5086     fi
5087 fi
5088
5089 if test "$wxUSE_HELP" = "yes"; then
5090     AC_DEFINE(wxUSE_HELP)
5091     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS help"
5092
5093     if test "$wxUSE_MSW" = 1; then
5094       if test "$wxUSE_MS_HTML_HELP" = "yes"; then
5095         AC_DEFINE(wxUSE_MS_HTML_HELP)
5096       fi
5097     fi
5098
5099     if test "$wxUSE_WXHTML_HELP" = "yes"; then
5100       if test "$wxUSE_HTML" = "yes"; then
5101         AC_DEFINE(wxUSE_WXHTML_HELP)
5102       else
5103         AC_MSG_WARN(Cannot use wxHTML-based help without wxHTML so it won't be compiled)
5104         wxUSE_WXHTML_HELP=no
5105       fi
5106     fi
5107 fi
5108
5109 if test "$wxUSE_PRINTING_ARCHITECTURE" = "yes" ; then
5110     if test "$wxUSE_CONSTRAINTS" != "yes"; then
5111         AC_MSG_WARN(Printing support cannot be used without constraints so it won't be compiled without it)
5112     else
5113         AC_DEFINE(wxUSE_PRINTING_ARCHITECTURE)
5114     fi
5115     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS printing"
5116 fi
5117
5118 if test "$wxUSE_PROLOGIO" = "yes" -o  "$wxUSE_RESOURCES" = "yes"; then
5119     AC_MSG_ERROR([wxExpr and old-style resources are now available in contrib only])
5120 fi
5121
5122 dnl ---------------------------------------------------------------------------
5123 dnl IPC: IPC, Drag'n'Drop, Clipboard, ...
5124 dnl ---------------------------------------------------------------------------
5125
5126 dnl check for ole headers and disable a few features requiring it if not
5127 dnl present (earlier versions of mingw32 don't have ole2.h)
5128 if test "$USE_WIN32" = 1 -a \( "$wxUSE_DATAOBJ"       = "yes" \
5129                           -o "$wxUSE_CLIPBOARD"     = "yes" \
5130                           -o "$wxUSE_OLE"     = "yes" \
5131                           -o "$wxUSE_DRAG_AND_DROP" = "yes" \) ; then
5132     AC_CHECK_HEADERS(ole2.h)
5133
5134     if test "$ac_cv_header_ole2_h" = "yes" ; then
5135         if test "$GCC" = yes ; then
5136             AC_LANG_SAVE
5137             AC_LANG_CPLUSPLUS
5138
5139             AC_MSG_CHECKING([if g++ requires -fvtable-thunks])
5140             AC_TRY_COMPILE([#include <windows.h>
5141                             #include <ole2.h>],
5142                            [],
5143                            [AC_MSG_RESULT(no)],
5144                            [AC_MSG_RESULT(yes)
5145                             CODE_GEN_FLAGS_CXX="$CODE_GEN_FLAGS_CXX -fvtable-thunks"])
5146             AC_LANG_RESTORE
5147             ALL_OBJECTS="$ALL_OBJECTS \$(OLEOBJS)"
5148             LIBS=" -lrpcrt4 -loleaut32 -lole32 -luuid$LIBS"
5149             if test "$wxUSE_OLE" = "yes" ; then
5150                 AC_DEFINE(wxUSE_OLE)
5151             fi
5152         fi
5153
5154         dnl for OLE clipboard and dnd
5155         if test "$wxUSE_DATAOBJ" = "yes" ; then
5156             AC_DEFINE(wxUSE_DATAOBJ)
5157         fi
5158     else
5159         AC_MSG_WARN([Some features disabled because OLE headers not found])
5160
5161         wxUSE_CLIPBOARD=no
5162         wxUSE_DRAG_AND_DROP=no
5163         wxUSE_DATAOBJ=no
5164         wxUSE_OLE=no
5165     fi
5166
5167     if test "$wxUSE_METAFILE" = "yes"; then
5168         AC_DEFINE(wxUSE_METAFILE)
5169
5170         dnl this one should probably be made separately configurable
5171         AC_DEFINE(wxUSE_ENH_METAFILE)
5172     fi
5173 fi
5174
5175 if test "$wxUSE_IPC" = "yes"; then
5176     if test "$wxUSE_SOCKETS" != "yes"; then
5177         AC_MSG_WARN(wxWindows IPC classes require sockets... disabled)
5178     fi
5179
5180     AC_DEFINE(wxUSE_IPC)
5181 fi
5182
5183 if test "$wxUSE_CLIPBOARD" = "yes"; then
5184     if test "$wxUSE_MGL" = 1; then
5185         AC_MSG_WARN([Clipboard not yet supported under MGL... disabled])
5186         wxUSE_CLIPBOARD=no
5187     fi
5188
5189     if test "$wxUSE_CLIPBOARD" = "yes"; then
5190         AC_DEFINE(wxUSE_CLIPBOARD)
5191
5192         dnl required by clipboard code in configuration check
5193         AC_DEFINE(wxUSE_DATAOBJ)
5194     fi
5195 fi
5196
5197 if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then
5198     if test "$wxUSE_GTK" = 1; then
5199         if test "$WXGTK12" != 1; then
5200             AC_MSG_WARN([Drag and drop is only supported under GTK+ 1.2... disabled])
5201             wxUSE_DRAG_AND_DROP=no
5202         fi
5203     fi
5204
5205     if test "$wxUSE_MOTIF" = 1; then
5206         AC_MSG_WARN([Drag and drop not yet supported under Motif... disabled])
5207         wxUSE_DRAG_AND_DROP=no
5208     fi
5209
5210     if test "$wxUSE_X11" = 1; then
5211         AC_MSG_WARN([Drag and drop not yet supported under X11... disabled])
5212         wxUSE_DRAG_AND_DROP=no
5213     fi
5214
5215     if test "$wxUSE_MGL" = 1; then
5216         AC_MSG_WARN([Drag and drop not yet supported under MGL... disabled])
5217         wxUSE_DRAG_AND_DROP=no
5218     fi
5219
5220     if test "$wxUSE_DRAG_AND_DROP" = "yes"; then
5221         AC_DEFINE(wxUSE_DRAG_AND_DROP)
5222     fi
5223
5224 fi
5225
5226 if test "$wxUSE_DRAG_AND_DROP" = "yes" -o "$wxUSE_CLIPBOARD" = "yes"; then
5227     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dnd"
5228 fi
5229
5230 if test "$wxUSE_SPLINES" = "yes" ; then
5231   AC_DEFINE(wxUSE_SPLINES)
5232 fi
5233
5234 dnl ---------------------------------------------------------------------------
5235 dnl GUI controls
5236 dnl ---------------------------------------------------------------------------
5237
5238 USES_CONTROLS=0
5239 if test "$wxUSE_CONTROLS" = "yes"; then
5240   USES_CONTROLS=1
5241 fi
5242
5243 if test "$wxUSE_ACCEL" = "yes"; then
5244   AC_DEFINE(wxUSE_ACCEL)
5245   USES_CONTROLS=1
5246 fi
5247
5248 if test "$wxUSE_BUTTON" = "yes"; then
5249   AC_DEFINE(wxUSE_BUTTON)
5250   USES_CONTROLS=1
5251 fi
5252
5253 if test "$wxUSE_BMPBUTTON" = "yes"; then
5254   AC_DEFINE(wxUSE_BMPBUTTON)
5255   USES_CONTROLS=1
5256 fi
5257
5258 if test "$wxUSE_CALCTRL" = "yes"; then
5259   AC_DEFINE(wxUSE_CALENDARCTRL)
5260   USES_CONTROLS=1
5261   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS calendar"
5262 fi
5263
5264 if test "$wxUSE_CARET" = "yes"; then
5265   AC_DEFINE(wxUSE_CARET)
5266   USES_CONTROLS=1
5267   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS caret"
5268 fi
5269
5270 if test "$wxUSE_COMBOBOX" = "yes"; then
5271   AC_DEFINE(wxUSE_COMBOBOX)
5272   USES_CONTROLS=1
5273 fi
5274
5275 if test "$wxUSE_CHOICE" = "yes"; then
5276   AC_DEFINE(wxUSE_CHOICE)
5277   USES_CONTROLS=1
5278 fi
5279
5280 if test "$wxUSE_CHECKBOX" = "yes"; then
5281   AC_DEFINE(wxUSE_CHECKBOX)
5282   USES_CONTROLS=1
5283 fi
5284
5285 if test "$wxUSE_CHECKLST" = "yes"; then
5286   AC_DEFINE(wxUSE_CHECKLISTBOX)
5287   USES_CONTROLS=1
5288   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS checklst"
5289 fi
5290
5291 if test "$wxUSE_DISPLAY" = "yes"; then
5292     AC_DEFINE(wxUSE_DISPLAY)
5293     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS display"
5294 fi
5295
5296 if test "$wxUSE_GAUGE" = "yes"; then
5297   AC_DEFINE(wxUSE_GAUGE)
5298   USES_CONTROLS=1
5299 fi
5300
5301 if test "$wxUSE_GRID" = "yes"; then
5302   AC_DEFINE(wxUSE_GRID)
5303   USES_CONTROLS=1
5304   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS grid"
5305 fi
5306
5307 if test "$wxUSE_IMAGLIST" = "yes"; then
5308     AC_DEFINE(wxUSE_IMAGLIST)
5309 fi
5310
5311 if test "$wxUSE_LISTBOOK" = "yes"; then
5312     AC_DEFINE(wxUSE_LISTBOOK)
5313     USES_CONTROLS=1
5314 fi
5315
5316 if test "$wxUSE_LISTBOX" = "yes"; then
5317     AC_DEFINE(wxUSE_LISTBOX)
5318     USES_CONTROLS=1
5319 fi
5320
5321 if test "$wxUSE_LISTCTRL" = "yes"; then
5322     if test "$wxUSE_IMAGLIST" = "yes"; then
5323         AC_DEFINE(wxUSE_LISTCTRL)
5324         USES_CONTROLS=1
5325         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS listctrl"
5326     else
5327         AC_MSG_WARN([wxListCtrl requires wxImageList and won't be compiled without it])
5328     fi
5329 fi
5330
5331 if test "$wxUSE_NOTEBOOK" = "yes"; then
5332     AC_DEFINE(wxUSE_NOTEBOOK)
5333     USES_CONTROLS=1
5334     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS notebook"
5335 fi
5336
5337 dnl if test "$wxUSE_PROPSHEET" = "yes"; then
5338 dnl     AC_DEFINE(wxUSE_PROPSHEET)
5339 dnl     USES_CONTROLS=1
5340 dnl     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS proplist"
5341 dnl fi
5342
5343 if test "$wxUSE_RADIOBOX" = "yes"; then
5344     AC_DEFINE(wxUSE_RADIOBOX)
5345     USES_CONTROLS=1
5346 fi
5347
5348 if test "$wxUSE_RADIOBTN" = "yes"; then
5349     AC_DEFINE(wxUSE_RADIOBTN)
5350     USES_CONTROLS=1
5351 fi
5352
5353 if test "$wxUSE_SASH" = "yes"; then
5354     AC_DEFINE(wxUSE_SASH)
5355     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS sashtest"
5356 fi
5357
5358 if test "$wxUSE_SCROLLBAR" = "yes"; then
5359     AC_DEFINE(wxUSE_SCROLLBAR)
5360     USES_CONTROLS=1
5361     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS scroll scrollsub"
5362 fi
5363
5364 if test "$wxUSE_SLIDER" = "yes"; then
5365     AC_DEFINE(wxUSE_SLIDER)
5366     USES_CONTROLS=1
5367 fi
5368
5369 if test "$wxUSE_SPINBTN" = "yes"; then
5370     AC_DEFINE(wxUSE_SPINBTN)
5371     USES_CONTROLS=1
5372 fi
5373
5374 if test "$wxUSE_SPINCTRL" = "yes"; then
5375     AC_DEFINE(wxUSE_SPINCTRL)
5376     USES_CONTROLS=1
5377 fi
5378
5379 if test "$wxUSE_SPLITTER" = "yes"; then
5380     AC_DEFINE(wxUSE_SPLITTER)
5381     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS splitter"
5382 fi
5383
5384 if test "$wxUSE_STATBMP" = "yes"; then
5385     AC_DEFINE(wxUSE_STATBMP)
5386     USES_CONTROLS=1
5387 fi
5388
5389 if test "$wxUSE_STATBOX" = "yes"; then
5390     AC_DEFINE(wxUSE_STATBOX)
5391     USES_CONTROLS=1
5392 fi
5393
5394 if test "$wxUSE_STATTEXT" = "yes"; then
5395     AC_DEFINE(wxUSE_STATTEXT)
5396     USES_CONTROLS=1
5397 fi
5398
5399 if test "$wxUSE_STATLINE" = "yes"; then
5400     AC_DEFINE(wxUSE_STATLINE)
5401     USES_CONTROLS=1
5402 fi
5403
5404 if test "$wxUSE_STATUSBAR" = "yes"; then
5405     AC_DEFINE(wxUSE_STATUSBAR)
5406     USES_CONTROLS=1
5407
5408     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS statbar"
5409 fi
5410
5411 if test "$wxUSE_TABDIALOG" = "yes"; then
5412     AC_DEFINE(wxUSE_TAB_DIALOG)
5413     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS tab"
5414 fi
5415
5416 if test "$wxUSE_TEXTCTRL" = "yes"; then
5417     AC_DEFINE(wxUSE_TEXTCTRL)
5418     USES_CONTROLS=1
5419     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS text"
5420 fi
5421
5422 if test "$wxUSE_TOGGLEBTN" = "yes"; then
5423     if test "$wxUSE_COCOA" = 1 ; then
5424         AC_MSG_WARN([Toggle button not yet supported under Mac OS X... disabled])
5425         wxUSE_TOGGLEBTN=no
5426     fi
5427     if test "$wxUSE_UNIVERSAL" = "yes"; then
5428         AC_MSG_WARN([Toggle button not yet supported under wxUniversal... disabled])
5429         wxUSE_TOGGLEBTN=no
5430     fi
5431
5432     if test "$wxUSE_TOGGLEBTN" = "yes"; then
5433         AC_DEFINE(wxUSE_TOGGLEBTN)
5434         USES_CONTROLS=1
5435     fi
5436 fi
5437
5438 if test "$wxUSE_TOOLBAR_SIMPLE" = "yes"; then
5439     AC_DEFINE(wxUSE_TOOLBAR_SIMPLE)
5440     wxUSE_TOOLBAR="yes"
5441     USES_CONTROLS=1
5442 fi
5443
5444 if test "$wxUSE_TOOLBAR" = "yes"; then
5445     AC_DEFINE(wxUSE_TOOLBAR)
5446     USES_CONTROLS=1
5447
5448     dnl if wxUSE_TOOLBAR and !wxUSE_TOOLBAR_SIMPLE => wxUSE_TOOLBAR_NATIVE
5449     if test "$wxUSE_TOOLBAR_SIMPLE" != "yes"; then
5450         wxUSE_TOOLBAR_NATIVE="yes"
5451     fi
5452
5453     if test "$wxUSE_TOOLBAR_NATIVE" = "yes"; then
5454         AC_DEFINE(wxUSE_TOOLBAR_NATIVE)
5455         USES_CONTROLS=1
5456     fi
5457
5458     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS toolbar"
5459 fi
5460
5461 if test "$wxUSE_TOOLTIPS" = "yes"; then
5462     if test "$wxUSE_MOTIF" = 1; then
5463         AC_MSG_WARN([wxTooltip not supported yet under Motif... disabled])
5464     else
5465         if test "$wxUSE_UNIVERSAL" = "yes"; then
5466             AC_MSG_WARN([wxTooltip not supported yet in wxUniversal... disabled])
5467         else
5468             AC_DEFINE(wxUSE_TOOLTIPS)
5469         fi
5470     fi
5471 fi
5472
5473 if test "$wxUSE_TREECTRL" = "yes"; then
5474     if test "$wxUSE_IMAGLIST" = "yes"; then
5475         AC_DEFINE(wxUSE_TREECTRL)
5476         USES_CONTROLS=1
5477         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS treectrl"
5478     else
5479         AC_MSG_WARN([wxTreeCtrl requires wxImageList and won't be compiled without it])
5480     fi
5481 fi
5482
5483 if test "$wxUSE_POPUPWIN" = "yes"; then
5484     if test "$wxUSE_MAC" = 1 -o "$wxUSE_COCOA" = 1 ; then
5485         AC_MSG_WARN([Popup window not yet supported under Mac OS X... disabled])
5486     else
5487         if test "$wxUSE_PM" = 1; then
5488             AC_MSG_WARN([wxPopupWindow not yet supported under PM... disabled])
5489         else
5490             AC_DEFINE(wxUSE_POPUPWIN)
5491
5492             USES_CONTROLS=1
5493         fi
5494     fi
5495 fi
5496
5497 if test "$wxUSE_TIPWINDOW" = "yes"; then
5498     if test "$wxUSE_PM" = 1; then
5499         AC_MSG_WARN([wxTipWindow not yet supported under PM... disabled])
5500     else
5501         AC_DEFINE(wxUSE_TIPWINDOW)
5502     fi
5503 fi
5504
5505 if test "$USES_CONTROLS" = 1; then
5506     AC_DEFINE(wxUSE_CONTROLS)
5507 fi
5508
5509 dnl ---------------------------------------------------------------------------
5510 dnl misc options
5511 dnl ---------------------------------------------------------------------------
5512
5513 dnl please keep the settings below in alphabetical order
5514 if test "$wxUSE_ACCESSIBILITY" = "yes"; then
5515     AC_DEFINE(wxUSE_ACCESSIBILITY)
5516     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS access"
5517 fi
5518
5519 if test "$wxUSE_DRAGIMAGE" = "yes"; then
5520     AC_DEFINE(wxUSE_DRAGIMAGE)
5521     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dragimag"
5522 fi
5523
5524 if test "$wxUSE_EXCEPTIONS" = "yes"; then
5525     AC_DEFINE(wxUSE_EXCEPTIONS)
5526 fi
5527
5528 USE_HTML=0
5529 if test "$wxUSE_HTML" = "yes"; then
5530     AC_DEFINE(wxUSE_HTML)
5531     USE_HTML=1
5532     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS html html/about html/help html/helpview html/printing html/test html/virtual html/widget html/zip htlbox"
5533 fi
5534
5535 if test "$wxUSE_MENUS" = "yes"; then
5536     AC_DEFINE(wxUSE_MENUS)
5537     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS menu"
5538 fi
5539
5540 if test "$wxUSE_METAFILE" = "yes"; then
5541     AC_DEFINE(wxUSE_METAFILE)
5542 fi
5543
5544 if test "$wxUSE_MIMETYPE" = "yes"; then
5545     AC_DEFINE(wxUSE_MIMETYPE)
5546 fi
5547
5548 if test "$wxUSE_MINIFRAME" = "yes"; then
5549     AC_DEFINE(wxUSE_MINIFRAME)
5550     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS minifram"
5551 fi
5552
5553 if test "$wxUSE_SYSTEM_OPTIONS" = "yes"; then
5554     AC_DEFINE(wxUSE_SYSTEM_OPTIONS)
5555     if test "$TOOLKIT" = "MSW" -o "$TOOLKIT" = "GTK" -o "$TOOLKIT" = "X11" -o \
5556         "$TOOLKIT" = "MOTIF"; then
5557         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS taskbar"
5558     fi
5559 fi
5560
5561
5562 if test "$wxUSE_VALIDATORS" = "yes"; then
5563     AC_DEFINE(wxUSE_VALIDATORS)
5564     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS validate"
5565 fi
5566
5567 if test "$wxUSE_PALETTE" = "yes" ; then
5568   AC_DEFINE(wxUSE_PALETTE)
5569 fi
5570
5571 if test "$wxUSE_UNICODE" = "yes" -a "$wxUSE_UNICODE_MSLU" = "yes" ; then
5572   dnl Must be done this late because -lunicows must be before all the other libs
5573   LIBS=" -lunicows $LIBS"
5574 fi
5575
5576 dnl ---------------------------------------------------------------------------
5577 dnl wxImage options
5578 dnl ---------------------------------------------------------------------------
5579
5580 if test "$wxUSE_IMAGE" = "yes" ; then
5581     AC_DEFINE(wxUSE_IMAGE)
5582
5583     if test "$wxUSE_GIF" = "yes" ; then
5584       AC_DEFINE(wxUSE_GIF)
5585     fi
5586
5587     if test "$wxUSE_PCX" = "yes" ; then
5588       AC_DEFINE(wxUSE_PCX)
5589     fi
5590
5591     if test "$wxUSE_IFF" = "yes" ; then
5592       AC_DEFINE(wxUSE_IFF)
5593     fi
5594
5595     if test "$wxUSE_PNM" = "yes" ; then
5596       AC_DEFINE(wxUSE_PNM)
5597     fi
5598
5599     if test "$wxUSE_XPM" = "yes" ; then
5600       AC_DEFINE(wxUSE_XPM)
5601     fi
5602
5603     if test "$wxUSE_ICO_CUR" = "yes" ; then
5604       AC_DEFINE(wxUSE_ICO_CUR)
5605     fi
5606 fi
5607
5608 dnl ---------------------------------------------------------------------------
5609 dnl common dialogs
5610 dnl ---------------------------------------------------------------------------
5611
5612 if test "$wxUSE_CHOICEDLG" = "yes"; then
5613     AC_DEFINE(wxUSE_CHOICEDLG)
5614 fi
5615
5616 if test "$wxUSE_COLOURDLG" = "yes"; then
5617     AC_DEFINE(wxUSE_COLOURDLG)
5618 fi
5619
5620 if test "$wxUSE_FILEDLG" = "yes"; then
5621     AC_DEFINE(wxUSE_FILEDLG)
5622 fi
5623
5624 if test "$wxUSE_FINDREPLDLG" = "yes"; then
5625     AC_DEFINE(wxUSE_FINDREPLDLG)
5626 fi
5627
5628 if test "$wxUSE_FONTDLG" = "yes"; then
5629     AC_DEFINE(wxUSE_FONTDLG)
5630 fi
5631
5632 if test "$wxUSE_DIRDLG" = "yes"; then
5633     if test "$wxUSE_TREECTRL" != "yes"; then
5634         AC_MSG_WARN(wxDirDialog requires wxTreeCtrl so it won't be compiled without it)
5635     else
5636         AC_DEFINE(wxUSE_DIRDLG)
5637     fi
5638 fi
5639
5640 if test "$wxUSE_MSGDLG" = "yes"; then
5641     AC_DEFINE(wxUSE_MSGDLG)
5642 fi
5643
5644 if test "$wxUSE_NUMBERDLG" = "yes"; then
5645     AC_DEFINE(wxUSE_NUMBERDLG)
5646 fi
5647
5648 if test "$wxUSE_PROGRESSDLG" = "yes"; then
5649     if test "$wxUSE_CONSTRAINTS" != "yes"; then
5650        AC_MSG_WARN(wxProgressDialog requires constraints so it won't be compiled without them)
5651     else
5652         AC_DEFINE(wxUSE_PROGRESSDLG)
5653     fi
5654 fi
5655
5656 if test "$wxUSE_SPLASH" = "yes"; then
5657     AC_DEFINE(wxUSE_SPLASH)
5658 fi
5659
5660 if test "$wxUSE_STARTUP_TIPS" = "yes"; then
5661     if test "$wxUSE_CONSTRAINTS" != "yes"; then
5662        AC_MSG_WARN(Startup tips requires constraints and won't be compiled without them)
5663     else
5664         AC_DEFINE(wxUSE_STARTUP_TIPS)
5665     fi
5666 fi
5667
5668 if test "$wxUSE_TEXTDLG" = "yes"; then
5669     AC_DEFINE(wxUSE_TEXTDLG)
5670 fi
5671
5672 if test "$wxUSE_WIZARDDLG" = "yes"; then
5673     AC_DEFINE(wxUSE_WIZARDDLG)
5674     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS wizard"
5675 fi
5676
5677 dnl ---------------------------------------------------------------------------
5678 dnl get the string with OS info - used by wxGetOsDescription()
5679 dnl ---------------------------------------------------------------------------
5680
5681 if test "$cross_compiling" = "yes"; then
5682     dnl Use best guess from host as we can't use uname when cross compiling
5683     OSINFO="\"$host\""
5684 else
5685     dnl attualy work out OS version
5686     OSINFO=`uname -s -r -m`
5687     OSINFO="\"$OSINFO\""
5688 fi
5689
5690 AC_DEFINE_UNQUOTED(WXWIN_OS_DESCRIPTION, $OSINFO)
5691
5692 dnl ---------------------------------------------------------------------------
5693 dnl define the variable containing the installation prefix (used in dcpsg.cpp)
5694 dnl ---------------------------------------------------------------------------
5695
5696 if test "x$prefix" != "xNONE"; then
5697     wxPREFIX=$prefix
5698 else
5699     wxPREFIX=$ac_default_prefix
5700 fi
5701
5702 AC_DEFINE_UNQUOTED(wxINSTALL_PREFIX, "$wxPREFIX")
5703
5704 dnl define the variables used in wx-config
5705 top_builddir_wxconfig=`pwd`
5706
5707
5708 dnl ---------------------------------------------------------------------------
5709 dnl define variables with all built libraries for wx-config
5710 dnl ---------------------------------------------------------------------------
5711
5712 CORE_BASE_LIBS="net base"
5713 CORE_GUI_LIBS="adv core"
5714
5715 if test "$wxUSE_XML" = "yes" ; then
5716     CORE_BASE_LIBS="xml $CORE_BASE_LIBS"
5717 fi
5718 if test "$wxUSE_ODBC" != "no" ; then
5719     CORE_BASE_LIBS="odbc $CORE_BASE_LIBS"
5720     CORE_GUI_LIBS="dbgrid $CORE_GUI_LIBS"
5721 fi
5722 if test "$wxUSE_HTML" = "yes" ; then
5723     CORE_GUI_LIBS="html $CORE_GUI_LIBS"
5724 fi
5725
5726 if test "$wxUSE_GUI" != "yes"; then
5727     CORE_GUI_LIBS=""
5728 fi
5729
5730 AC_SUBST(CORE_BASE_LIBS)
5731 AC_SUBST(CORE_GUI_LIBS)
5732
5733
5734 dnl ---------------------------------------------------------------------------
5735 dnl Output the makefiles and such from the results found above
5736 dnl ---------------------------------------------------------------------------
5737
5738 dnl all additional libraries (except wxWindows itself) we link with
5739
5740 dnl note that we always link with -lm except for Mac OS X
5741 dnl extended.c uses floor() and is always linked in
5742
5743 if test "$wxUSE_MAC" = 1 ; then
5744     LDFLAGS="$LDFLAGS -framework Carbon -framework System"
5745 fi
5746 if test "$wxUSE_COCOA" = 1 ; then
5747     LDFLAGS="$LDFLAGS -framework Cocoa -framework System"
5748 fi
5749
5750 dnl FIXME: should this be covered by the conditional above
5751 dnl given the -lm comment there?  Or should that comment (and
5752 dnl this one) be removed..   [ 7 Nov 2001 ]
5753
5754 LIBS="$ZLIB_LINK $POSIX4_LINK $INET_LINK $WCHAR_LINK $DL_LINK $LIBS"
5755
5756 dnl Only add the -lm library if floating point functions cannot be used
5757 dnl without it.  This check is important on cygwin because of the bizarre
5758 dnl way that they have organized functions into libraries.  On cygwin, both
5759 dnl libc.a and libm.a are symbolic links to a single lib libcygwin.a.  This
5760 dnl means that
5761 dnl   1) linking with -lm is not necessary, and
5762 dnl   2) linking with -lm is dangerous if the order of libraries is wrong
5763 dnl In particular, if you compile any program with -mno-cygwin and link with
5764 dnl -lm, it will crash instantly when it is run.  This happens because the
5765 dnl linker incorrectly links the Cygwin libm.a (==libcygwin.a), which replaces
5766 dnl the ___main function instead of allowing it to be defined by
5767 dnl /usr/lib/mingw/libmingw32.a as it should be.
5768 dnl
5769 dnl On MacOS X, this test will find that -lm is unnecessary and leave it out.
5770 dnl
5771 dnl Just check a few floating point functions. If they are all found without
5772 dnl -lm, then we must not need -lm.
5773 have_cos=0
5774 have_floor=0
5775 AC_CHECK_FUNCS(cos, have_cos=1)
5776 AC_CHECK_FUNCS(floor, have_floor=1)
5777 AC_MSG_CHECKING(if floating point functions link without -lm)
5778 if test "$have_cos" = 1 -a "$have_floor" = 1; then
5779     AC_MSG_RESULT(yes)
5780 else
5781     AC_MSG_RESULT(no)
5782     LIBS="$LIBS -lm"
5783     # use different functions to avoid configure caching
5784     have_sin=0
5785     have_ceil=0
5786     AC_CHECK_FUNCS(sin, have_sin=1)
5787     AC_CHECK_FUNCS(ceil, have_ceil=1)
5788     AC_MSG_CHECKING(if floating point functions link with -lm)
5789     if test "$have_sin" = 1 -a "$have_ceil" = 1; then
5790         AC_MSG_RESULT(yes)
5791     else
5792         AC_MSG_RESULT(no)
5793         # not sure we should warn the user, crash, etc.
5794     fi
5795 fi
5796
5797 if test "$wxUSE_GUI" = "yes"; then
5798
5799     dnl TODO add checks that these samples will really compile (i.e. all the
5800     dnl      library features they need are present)
5801
5802     dnl TODO some samples are never built so far:
5803     dnl      ipc, mfc, nativdlg, oleauto, ownerdrw
5804     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS artprov controls dialogs \
5805                      drawing dynamic erase event exec font image \
5806                      minimal propsize rotate shaped widgets render"
5807
5808     if test "$wxUSE_MONOLITHIC" != "yes"; then
5809         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS console"
5810     fi
5811 else
5812     SAMPLES_SUBDIRS="console"
5813 fi
5814
5815
5816 dnl all -I options we must pass to the compiler
5817 dnl
5818 dnl note that the order is somewhat important: wxWindows headers should
5819 dnl come first and the one with setup.h should be before $(top_srcdir)/include
5820 dnl in case the latter contains setup.h used by non-autoconf makefiles (e.g.
5821 dnl CodeWarrior):
5822 INCLUDES="-I\${top_builddir}lib/wx/include/${TOOLCHAIN_NAME} \
5823 -I\${top_srcdir}/include $TOOLKIT_INCLUDE"
5824
5825 dnl C/C++ compiler options used to compile wxWindows
5826 if test "$GXX" = yes ; then
5827     dnl CXXWARNINGS="-Wall -W -Wcast-qual -Werror"
5828     CXXWARNINGS="-Wall"
5829     dnl should enable this one day...
5830     dnl CXXWARNINGS="-Wall -Werror"
5831 fi
5832
5833 EXTRA_CFLAGS="$WXDEBUG $WXODBCFLAG $PROFILE $OPTIMISE"
5834
5835 dnl remove the extra white space from the cc/c++/ld options
5836 CPPFLAGS=`echo $WXDEBUG_DEFINE $INCLUDES $CPPFLAGS | sed 's/ \\+/ /g'`
5837 CFLAGS=`echo $CODE_GEN_FLAGS $EXTRA_CFLAGS $CFLAGS $CXXWARNINGS | sed 's/ \\+/ /g'`
5838 CXXFLAGS=`echo $CODE_GEN_FLAGS $CODE_GEN_FLAGS_CXX $EXTRA_CFLAGS $CXXFLAGS $CXXWARNINGS | sed 's/ \+/ /g'`
5839     
5840
5841 LIBS=`echo $LIBS | sed 's/ \+/ /g'`
5842 EXTRALIBS="$LDFLAGS $LDFLAGS_VERSIONING $LIBS $DMALLOC_LIBS"
5843 EXTRALIBS_XML="$EXPAT_LINK"
5844 EXTRALIBS_HTML="$MSPACK_LINK"
5845 EXTRALIBS_ODBC="$ODBC_LINK"
5846 if test "$wxUSE_GUI" = "yes"; then
5847     EXTRALIBS_GUI=`echo $GUI_TK_LIBRARY $PNG_LINK $JPEG_LINK $TIFF_LINK | sed 's/ \+/ /g'`
5848 fi
5849 if test "$wxUSE_OPENGL" = "yes"; then
5850     EXTRALIBS_OPENGL="$LDFLAGS_GL $OPENGL_LIBS"
5851 fi
5852     
5853 LDFLAGS="$LDFLAGS $PROFILE"
5854
5855 dnl wxGTK does not need TOOLKIT includes in wx-config
5856 if test "$wxUSE_GTK" = 1; then
5857     WXCONFIG_INCLUDE=
5858 else
5859     WXCONFIG_INCLUDE="$TOOLKIT_INCLUDE"
5860 fi
5861
5862 WXCONFIG_EXTRALIBS="$LIBS"
5863
5864 dnl wx-config must output builtin 3rd party libs in --libs in static build:
5865 if test "$wxUSE_REGEX" = "builtin" ; then
5866     wxconfig_3rdparty="$wxconfig_3rdparty regex${lib_unicode_suffix}"
5867 fi
5868 if test "$wxUSE_EXPAT" = "builtin" ; then
5869     wxconfig_3rdparty="$wxconfig_3rdparty expat"
5870 fi
5871 if test "$wxUSE_ODBC" = "builtin" ; then
5872     wxconfig_3rdparty="$wxconfig_3rdparty odbc"
5873 fi
5874 if test "$wxUSE_LIBTIFF" = "builtin" ; then
5875     wxconfig_3rdparty="$wxconfig_3rdparty tiff"
5876 fi
5877 if test "$wxUSE_LIBJPEG" = "builtin" ; then
5878     wxconfig_3rdparty="$wxconfig_3rdparty jpeg"
5879 fi
5880 if test "$wxUSE_LIBPNG" = "builtin" ; then
5881     wxconfig_3rdparty="$wxconfig_3rdparty png"
5882 fi
5883 if test "$wxUSE_ZLIB" = "builtin" ; then
5884     wxconfig_3rdparty="$wxconfig_3rdparty zlib"
5885 fi
5886 if test "$wxUSE_ODBC" = "builtin" ; then
5887     wxconfig_3rdparty="$wxconfig_3rdparty odbc"
5888 fi
5889
5890 for i in $wxconfig_3rdparty ; do
5891     WXCONFIG_EXTRALIBS="$WXCONFIG_EXTRALIBS -lwx${i}${lib_debug_suffix}${HOST_SUFFIX}"
5892 done
5893
5894
5895 if test "x$wxUSE_UNIVERSAL" = "xyes" ; then
5896     WXUNIV=1
5897 else
5898     WXUNIV=0
5899 fi
5900
5901 AC_SUBST(wxUSE_ZLIB)
5902 AC_SUBST(wxUSE_REGEX)
5903 AC_SUBST(wxUSE_EXPAT)
5904 AC_SUBST(wxUSE_ODBC)
5905 AC_SUBST(wxUSE_LIBJPEG)
5906 AC_SUBST(wxUSE_LIBPNG)
5907 AC_SUBST(wxUSE_LIBTIFF)
5908
5909 if test $wxUSE_MONOLITHIC = "yes" ; then
5910     MONOLITHIC=1
5911 else
5912     MONOLITHIC=0
5913 fi
5914
5915 if test $wxUSE_PLUGINS = "yes" ; then
5916     USE_PLUGINS=1
5917 else
5918     USE_PLUGINS=0
5919 fi
5920
5921 if test $wxUSE_ODBC != "no" ; then
5922     USE_ODBC=1
5923 else
5924     USE_ODBC=0
5925 fi
5926
5927 if test $wxUSE_OFFICIAL_BUILD = "yes" ; then
5928     OFFICIAL_BUILD=1
5929 else
5930     OFFICIAL_BUILD=0
5931 fi
5932
5933 AC_SUBST(VENDOR)
5934 AC_SUBST(OFFICIAL_BUILD)
5935
5936 AC_SUBST(WXUNIV)
5937 AC_SUBST(MONOLITHIC)
5938 AC_SUBST(USE_PLUGINS)
5939 AC_SUBST(LIBS)
5940 AC_SUBST(EXTRALIBS)
5941 AC_SUBST(EXTRALIBS_XML)
5942 AC_SUBST(EXTRALIBS_HTML)
5943 AC_SUBST(EXTRALIBS_ODBC)
5944 AC_SUBST(EXTRALIBS_GUI)
5945 AC_SUBST(EXTRALIBS_OPENGL)
5946 AC_SUBST(EXTRALIBS_SDL)
5947 AC_SUBST(WITH_PLUGIN_SDL)
5948 AC_SUBST(UNICODE)
5949 AC_SUBST(BUILD)
5950 AC_SUBST(DEBUG_INFO)
5951 AC_SUBST(DEBUG_FLAG)
5952 AC_SUBST(SHARED)
5953 TOOLKIT_LOWERCASE=`echo $TOOLKIT | tr "[[A-Z]]" "[[a-z]]"`
5954 AC_SUBST(TOOLKIT_LOWERCASE)
5955 AC_SUBST(TOOLKIT_VERSION)
5956 AC_SUBST(SAMPLES_RPATH_FLAG)
5957 AC_SUBST(SAMPLES_RPATH_POSTLINK)
5958 AC_SUBST(HOST_SUFFIX)
5959 AC_SUBST(CPPUNIT_CFLAGS)
5960 AC_SUBST(CPPUNIT_LIBS)
5961
5962 AC_BAKEFILE
5963
5964
5965 dnl Find out if we have to define NO_GCC_PRAGMA and WX_PRECOMP:
5966 if test $GCC_PCH = 1 ; then
5967     CODE_GEN_FLAGS="-DWX_PRECOMP -DNO_GCC_PRAGMA $CODE_GEN_FLAGS"
5968     CPPFLAGS="-DWX_PRECOMP -DNO_GCC_PRAGMA $CPPFLAGS"
5969 else
5970     case "${host}" in
5971         powerpc-*-darwin* )
5972             dnl Some Apple's GCC version are broken and can't handle the
5973             dnl pragmas:
5974             CODE_GEN_FLAGS="-DNO_GCC_PRAGMA $CODE_GEN_FLAGS"
5975             CPPFLAGS="-DNO_GCC_PRAGMA $CPPFLAGS"
5976             ;;
5977     esac
5978 fi
5979
5980
5981 dnl for convenience, sort the samples in alphabetical order
5982 dnl
5983 dnl FIXME For some mysterious reasons, sometimes the directories are duplicated
5984 dnl       in this list - hence uniq. But normally, this shouldn't be needed!
5985 dnl
5986 dnl       Unfortunately, there is a bug in OS/2's tr, such that
5987 dnl       tr ' ' '\n' introduces DOS-like line breaks, whereas tr '\n' ' '
5988 dnl       only removes the Unix-like part of the introduced line break.
5989 SAMPLES_SUBDIRS="`echo $SAMPLES_SUBDIRS | tr -s ' ' | tr ' ' '\n' | sort | uniq | tr '\n' ' '| tr -d '\r'`"
5990
5991 dnl makefile variables
5992 AC_SUBST(PATH_IFS)
5993
5994 dnl global options
5995 AC_SUBST(WX_MAJOR_VERSION_NUMBER)
5996 AC_SUBST(WX_MINOR_VERSION_NUMBER)
5997 AC_SUBST(WX_RELEASE_NUMBER)
5998 AC_SUBST(WX_LIBRARY_NAME_STATIC)
5999 AC_SUBST(WX_LIBRARY_NAME_SHARED)
6000 AC_SUBST(WX_LIBRARY_BASENAME_NOGUI)
6001 AC_SUBST(WX_LIBRARY_BASENAME_GUI)
6002 AC_SUBST(WX_LIBRARY_IMPORTLIB)
6003 AC_SUBST(WX_TARGET_LIBRARY)
6004 AC_SUBST(WX_LIBRARY_LINK1)
6005 AC_SUBST(WX_LIBRARY_LINK2)
6006 AC_SUBST(PROGRAM_EXT)
6007
6008 dnl global gl options
6009 AC_SUBST(WX_LIBRARY_NAME_STATIC_GL)
6010 AC_SUBST(WX_LIBRARY_NAME_SHARED_GL)
6011 AC_SUBST(WX_TARGET_LIBRARY_GL)
6012 AC_SUBST(WX_LIBRARY_LINK1_GL)
6013 AC_SUBST(WX_LIBRARY_LINK2_GL)
6014
6015 dnl are we supposed to create the links?
6016 AC_SUBST(WX_ALL)
6017 AC_SUBST(WX_ALL_INSTALLED)
6018
6019 AC_SUBST(SHARED_LD)
6020 AC_SUBST(PIC_FLAG)
6021
6022 AC_SUBST(WX_TARGET_LIBRARY_TYPE)
6023
6024 AC_SUBST(STATIC_FLAG)
6025
6026 dnl debugging options
6027 AC_SUBST(WXDEBUG_DEFINE)
6028
6029 dnl toolkit options
6030 AC_SUBST(USE_GUI)
6031 AC_SUBST(AFMINSTALL)
6032 AC_SUBST(WIN32INSTALL)
6033 AC_SUBST(TOOLKIT)
6034 AC_SUBST(TOOLKIT_DIR)
6035 AC_SUBST(TOOLKIT_VPATH)
6036 AC_SUBST(TOOLCHAIN_NAME)
6037 AC_SUBST(TOOLCHAIN_DEFS)
6038 AC_SUBST(TOOLCHAIN_DLL_DEFS)
6039
6040 dnl wx-config options
6041 AC_SUBST(top_builddir_wxconfig)
6042 AC_SUBST(host_alias)
6043 AC_SUBST(cross_compiling)
6044 AC_SUBST(WXCONFIG_EXTRALIBS)
6045 AC_SUBST(WXCONFIG_LIBS)
6046 AC_SUBST(WXCONFIG_LIBS_GL)
6047 AC_SUBST(WXCONFIG_LIBS_STATIC)
6048 AC_SUBST(WXCONFIG_LIBS_STATIC_GL)
6049 AC_SUBST(WXCONFIG_INCLUDE)
6050 AC_SUBST(WXCONFIG_RPATH)
6051 AC_SUBST(WXCONFIG_LDFLAGS_GUI)
6052 AC_SUBST(WX_LARGEFILE_FLAGS)
6053 AC_SUBST(CODE_GEN_FLAGS)
6054 AC_SUBST(CODE_GEN_FLAGS_CXX)
6055
6056 dnl the list of files to compile/install
6057 AC_SUBST(ALL_OBJECTS)
6058 AC_SUBST(ALL_HEADERS)
6059 AC_SUBST(ALL_SOURCES)
6060
6061 dnl distribution vars
6062 AC_SUBST(GUIDIST)
6063 AC_SUBST(PORT_FILES)
6064 AC_SUBST(DISTDIR)
6065
6066 dnl additional subdirectories where we will build
6067 AC_SUBST(SAMPLES_SUBDIRS)
6068
6069 dnl additional libraries and linker settings
6070 AC_SUBST(LDFLAGS)
6071 AC_SUBST(LDFLAGS_GL)
6072 AC_SUBST(LDFLAGS_VERSIONING)
6073 AC_SUBST(LDFLAGS_EXE)
6074 AC_SUBST(OPENGL_LIBS)
6075 AC_SUBST(DMALLOC_LIBS)
6076 AC_SUBST(WX_VERSION_TAG)
6077
6078 dnl additional resurces settings
6079 AC_SUBST(RESCOMP)
6080 AC_SUBST(RESFLAGS)
6081 AC_SUBST(RESPROGRAMOBJ)
6082 AC_SUBST(WX_RESOURCES_MACOSX_ASCII)
6083 AC_SUBST(WX_RESOURCES_MACOSX_DATA)
6084
6085 dnl additional for Mac OS X
6086 AC_SUBST(DEREZ)
6087 AC_SUBST(LIBWXMACRES)
6088 AC_SUBST(MACRESCOMP)
6089 AC_SUBST(MACSETFILE)
6090 AC_SUBST(MACRESWXCONFIG)
6091
6092 dnl other tools
6093 AC_SUBST(GCC)
6094 AC_SUBST(GCC_SEARCHES_USR_LOCAL_INCLUDE)
6095 AC_SUBST(DLLTOOL)
6096 AC_SUBST(AS)
6097 AC_SUBST(NM)
6098 AC_SUBST(LD)
6099 AC_SUBST(MAKEINFO)
6100 AC_SUBST(INSTALL_LIBRARY)
6101 AC_SUBST(INSTALL_DIR)
6102
6103
6104 dnl MAKE_SET will be replaced with "MAKE=..." or nothing if make sets MAKE
6105 dnl itself (this macro is required if SUBDIRS variable is used in Makefile.am
6106 dnl - and we do use it)
6107 AC_PROG_MAKE_SET
6108
6109 dnl move setup.h back if available
6110 if test -f lib/wx/include/${TOOLCHAIN_NAME}/wx/setup.h; then
6111     mv -f lib/wx/include/${TOOLCHAIN_NAME}/wx/setup.h setup.h
6112 fi
6113
6114 AC_CONFIG_HEADERS([setup.h])
6115
6116 dnl create each of the files in the space separated list from the file.in
6117 dnl (the original file name may be overriden by appending another name after a
6118 dnl colon)
6119 AC_CONFIG_FILES([
6120             wx-config
6121             version-script
6122             Makefile
6123           ])
6124
6125 AC_CONFIG_COMMANDS([default],
6126           [
6127             dnl This test is required to make the following idempotent.
6128             dnl Otherwise running config.status or rerunning configure
6129             dnl would stomp the wx-config link or try to move it onto
6130             dnl itself.
6131             dnl Use -h instead of -L to test for link (GD)
6132             dnl   -h is documented as obsolete under Mac OS X but works
6133             dnl   -L is obsolete under Solaris8
6134             if test ! -h wx-config; then
6135                 chmod +x wx-config
6136                 mv wx-config wx${TOOLCHAIN_NAME}-config
6137                 ${LN_S} wx${TOOLCHAIN_NAME}-config wx-config
6138             fi
6139
6140             if test ! -d lib; then
6141               mkdir lib
6142             fi
6143             if test ! -d lib/wx; then
6144               mkdir lib/wx
6145             fi
6146             if test ! -d lib/wx/include; then
6147               mkdir lib/wx/include
6148             fi
6149             if test ! -d lib/wx/include/${TOOLCHAIN_NAME}; then
6150               mkdir lib/wx/include/${TOOLCHAIN_NAME}
6151             fi
6152             if test ! -d lib/wx/include/${TOOLCHAIN_NAME}/wx; then
6153               mkdir lib/wx/include/${TOOLCHAIN_NAME}/wx
6154             fi
6155             if test -f setup.h; then
6156               mv -f setup.h lib/wx/include/${TOOLCHAIN_NAME}/wx/setup.h
6157             fi
6158           ],
6159           [
6160             TOOLCHAIN_NAME="${TOOLCHAIN_NAME}"
6161             LN_S="${LN_S}"
6162           ]
6163          )
6164
6165
6166 dnl Configure samples, contrib etc. directories, but only if they are present:
6167 if test "$wxUSE_GUI" = "yes"; then
6168     SUBDIRS="samples demos utils contrib"
6169 else dnl we build wxBase only
6170     dnl there are no wxBase programs in contrib nor demos
6171     SUBDIRS="samples utils"
6172 fi
6173 dnl Add tests to the list of subdirs if cppunit 1.8.0+ is detected
6174 AM_PATH_CPPUNIT(1.8.0, SUBDIRS="$SUBDIRS tests")
6175
6176 for subdir in `echo $SUBDIRS`; do
6177     if test -d ${srcdir}/${subdir} ; then
6178         if test "$wxUSE_GUI" = "yes"; then
6179             if test ${subdir} = "samples"; then
6180                 dnl only take those samples which compile in the current
6181                 dnl configuration and which exist
6182                 makefiles="samples/Makefile.in $makefiles"
6183                 for sample in `echo $SAMPLES_SUBDIRS`; do
6184                     if test -d $srcdir/samples/$sample; then
6185                         makefiles="samples/$sample/Makefile.in $makefiles"
6186                     fi
6187                 done
6188             else dnl assume that everything compiles for utils &c
6189                 makefiles=`(cd $srcdir ; find $subdir -name Makefile.in)`
6190             fi
6191         else dnl we build wxBase only
6192             dnl don't take all samples/utils, just those which build with
6193             dnl wxBase
6194             if test ${subdir} = "samples"; then
6195                 makefiles="samples/Makefile.in samples/console/Makefile.in"
6196             elif test ${subdir} = "utils"; then
6197                 makefiles="utils/HelpGen/Makefile.in \
6198                            utils/HelpGen/src/Makefile.in \
6199                            utils/tex2rtf/Makefile.in \
6200                            utils/tex2rtf/src/Makefile.in"
6201             else dnl assume that everything compiles for tests
6202                 makefiles=`(cd $srcdir ; find $subdir -name Makefile.in)`
6203             fi
6204         fi
6205
6206         for mkin in $makefiles ; do
6207             mk=`echo $mkin | sed 's/Makefile\.in/Makefile/g'`
6208             AC_CONFIG_FILES([$mk])
6209         done
6210     fi
6211 done
6212
6213
6214 AC_OUTPUT
6215
6216 dnl report on what we decided to do
6217 echo
6218 echo "Configured wxWindows ${WX_VERSION} for \`${host}'"
6219 echo ""
6220 echo "  Which GUI toolkit should wxWindows use?                 ${TOOLKIT_LOWERCASE:-base only}"
6221 echo "  Should wxWindows be compiled into single library?       ${wxUSE_MONOLITHIC:-yes}"
6222
6223 echo "  Should wxWindows be compiled in debug mode?             ${wxUSE_DEBUG:-no}"
6224 echo "  Should wxWindows be linked as a shared library?         ${wxUSE_SHARED:-no}"
6225 echo "  Should wxWindows be compiled in Unicode mode?           ${wxUSE_UNICODE:-no}"
6226
6227 echo "  What level of wxWindows compatibility should be enabled?"
6228 echo "                                       wxWindows 2.2      ${WXWIN_COMPATIBILITY_2_2:-no}"
6229 echo "                                       wxWindows 2.4      ${WXWIN_COMPATIBILITY_2_4:-yes}"
6230
6231 echo "  Which libraries should wxWindows use?"
6232 echo "                                       jpeg               ${wxUSE_LIBJPEG-none}"
6233 echo "                                       png                ${wxUSE_LIBPNG-none}"
6234 echo "                                       regex              ${wxUSE_REGEX}"
6235 echo "                                       tiff               ${wxUSE_LIBTIFF-none}"
6236 if test "$wxUSE_X11" = 1 -o "$wxUSE_MOTIF" = 1; then
6237 echo "                                       xpm                ${wxUSE_LIBXPM-none}"
6238 fi
6239 echo "                                       zlib               ${wxUSE_ZLIB}"
6240 echo "                                       odbc               ${wxUSE_ODBC}"
6241 echo "                                       expat              ${wxUSE_EXPAT}"
6242 echo "                                       libmspack          ${wxUSE_LIBMSPACK}"
6243 echo "                                       sdl                ${wxUSE_LIBSDL}"
6244
6245 echo ""
6246
6247 dnl vi: set et sts=4 sw=4 com=\:dnl: