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