Renamed m_blocking to m_non_blocking
[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 and
7 dnl Vadim Zeitlin
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 AC_CANONICAL_SYSTEM
22
23 dnl When making releases do:
24 dnl
25 dnl WX_RELEASE_NUMBER += 1
26 dnl WX_INTERFACE_AGE += 1
27 dnl WX_BINARY_AGE += 1
28 dnl
29 dnl if any functions have been added, do:
30 dnl
31 dnl WX_INTERFACE_AGE = 0
32
33 WX_MAJOR_VERSION_NUMBER=2
34 WX_MINOR_VERSION_NUMBER=1
35 WX_RELEASE_NUMBER=0
36
37 WX_INTERFACE_AGE=0
38 WX_BINARY_AGE=0
39
40 WX_VERSION=$WX_MAJOR_VERSION_NUMBER.$WX_MINOR_VERSION_NUMBER.$WX_RELEASE_NUMBER
41
42 AM_INIT_AUTOMAKE(wxWindows, $WX_VERSION)
43
44 dnl libtool versioning
45 LT_RELEASE=$WX_MAJOR_VERSION_NUMBER.$WX_MINOR_VERSION_NUMBER
46 LT_CURRENT=`expr $WX_RELEASE_NUMBER - $WX_INTERFACE_AGE`
47 LT_REVISION=$WX_INTERFACE_AGE
48 LT_AGE=`expr $WX_BINARY_AGE - $WX_INTERFACE_AGE`
49 AC_SUBST(LT_RELEASE)
50 AC_SUBST(LT_CURRENT)
51 AC_SUBST(LT_REVISION)
52 AC_SUBST(LT_AGE)
53
54 dnl FIXME this hack suppresses automake 1.4 warning about @LTLIBOBJS@ being
55 dnl       never defined in configure.in (remove these lines to see what I'm
56 dnl       speaking about) - Tom Tromey <tromey@cygnus.com> told me that it will
57 dnl       be fixed in the next release.
58 LIBOBJS=
59 LIBOBJS="$LIBOBJS ../common/extended.o"
60
61 dnl ------------------------------------------------------------------------
62 dnl Check platform (host system)
63 dnl ------------------------------------------------------------------------
64
65 dnl assume Unix
66 USE_UNIX=1
67 USE_LINUX=
68 USE_SGI=
69 USE_HPUX=
70 USE_SYSV=
71 USE_SVR4=
72 USE_AIX=
73 USE_SUN=
74 USE_SOLARIS=
75 USE_SUNOS=
76 USE_ALPHA=
77 USE_OSF=
78 USE_BSD=
79 USE_FREEBSD=
80 USE_VMS=
81 USE_ULTRIX=
82 USE_CYGWIN=
83 USE_MINGW=
84 USE_DATA_GENERAL=
85
86 dnl the list of all available toolkits
87 ALL_TOOLKITS="CYGWIN GTK MINGW MOTIF WINE"
88
89 dnl NB: these wxUSE_XXX constants have value of 0 or 1 unlike all the other ones
90 dnl     which are either yes or no
91 DEFAULT_wxUSE_GTK=0
92 DEFAULT_wxUSE_MOTIF=0
93 DEFAULT_wxUSE_MSW=0
94 DEFAULT_wxUSE_WINE=0
95
96 dnl these are the values which are really default for the given platform -
97 dnl they're not cached and are only used if no --with-toolkit was given *and*
98 dnl nothing was found in the cache
99 DEFAULT_DEFAULT_wxUSE_GTK=0
100 DEFAULT_DEFAULT_wxUSE_MOTIF=0
101 DEFAULT_DEFAULT_wxUSE_MSW=0
102 DEFAULT_DEFAULT_wxUSE_WINE=0
103
104 case "${host}" in
105   *-hp-hpux* )
106     USE_HPUX=1
107     DEFAULT_DEFAULT_wxUSE_MOTIF=1
108     AC_DEFINE(__HPUX__)
109   ;;
110   *-*-linux* )
111     USE_LINUX=1
112     AC_DEFINE(__LINUX__)
113     TMP=`uname -m`
114     if test "x$TMP" = "xalpha"; then
115       USE_ALPHA=1
116       AC_DEFINE(__ALPHA__)
117     fi
118     DEFAULT_DEFAULT_wxUSE_GTK=1
119   ;;
120   *-*-irix5* | *-*-irix6* )
121     USE_SGI=1
122     USE_SVR4=1
123     AC_DEFINE(__SGI__)
124     AC_DEFINE(__SVR4__)
125     DEFAULT_DEFAULT_wxUSE_MOTIF=1
126   ;;
127   *-*-solaris2* )
128     USE_SUN=1
129     USE_SOLARIS=1
130     USE_SVR4=1
131     AC_DEFINE(__SUN__)
132     AC_DEFINE(__SOLARIS__)
133     AC_DEFINE(__SVR4__)
134     DEFAULT_DEFAULT_wxUSE_MOTIF=1
135   ;;
136   *-*-sunos4* )
137     USE_SUN=1
138     USE_SUNOS=1
139     USE_BSD=1
140     AC_DEFINE(__SUN__)
141     AC_DEFINE(__SUNOS__)
142     AC_DEFINE(__BSD__)
143     DEFAULT_DEFAULT_wxUSE_MOTIF=1
144   ;;
145   *-*-freebsd* | *-*-netbsd*)
146     USE_BSD=1
147     USE_FREEBSD=1
148     AC_DEFINE(__FREEBSD__)
149     AC_DEFINE(__BSD__)
150     DEFAULT_DEFAULT_wxUSE_GTK=1
151   ;;
152   *-*-osf* )
153     USE_ALPHA=1
154     USE_OSF=1
155     AC_DEFINE(__ALPHA__)
156     AC_DEFINE(__OSF__)
157     DEFAULT_DEFAULT_wxUSE_MOTIF=1
158   ;;
159   *-*-dgux5* )
160     USE_ALPHA=1
161     USE_SVR4=1
162     AC_DEFINE(__ALPHA__)
163     AC_DEFINE(__SVR4__)
164     DEFAULT_DEFAULT_wxUSE_MOTIF=1
165   ;;
166   *-*-sysv5* )
167     USE_SYSV=1
168     USE_SVR4=1
169     AC_DEFINE(__SYSV__)
170     AC_DEFINE(__SVR4__)
171     DEFAULT_DEFAULT_wxUSE_MOTIF=1
172   ;;
173   *-*-aix* )
174     USE_AIX=1
175     USE_SYSV=1
176     USE_SVR4=1
177     AC_DEFINE(__AIX__)
178     AC_DEFINE(__SYSV__)
179     AC_DEFINE(__SVR4__)
180     DEFAULT_DEFAULT_wxUSE_MOTIF=1
181   ;;
182
183   *-*-cygwin32* )
184     USE_UNIX=0
185     AC_DEFINE(__WIN32__)
186     AC_DEFINE(__WIN95__)
187     AC_DEFINE(__WINDOWS__)
188     AC_DEFINE(__GNUWIN32__)
189     AC_DEFINE(WINVER, 0x0400)
190     DEFAULT_DEFAULT_wxUSE_MSW=1
191   ;;
192   *-*-mingw32* )
193     USE_UNIX=0
194     AC_DEFINE(__WIN32__)
195     AC_DEFINE(__WIN95__)
196     AC_DEFINE(__WINDOWS__)
197     AC_DEFINE(__GNUWIN32__)
198     AC_DEFINE(WINVER, 0x0400)
199     DEFAULT_DEFAULT_wxUSE_MSW=1
200   ;;
201
202   *-pc-os2_emx )
203     AC_DEFINE(__EMX__)
204   ;;
205
206   *)
207     AC_MSG_ERROR(unknown system type ${host}.)
208 esac
209
210 if test "$USE_UNIX" = 1 ; then
211   wxUSE_UNIX=yes
212   AC_DEFINE(__UNIX__)
213   EXTRA_VPATH="$EXTRA_VPATH:\$(srcdir)/../unix"
214   SRC_SUBDIRS="$SRC_SUBDIRS unix"
215   INCLUDE_SUBDIRS="$INCLUDE_SUBDIRS unix"
216 fi
217
218 dnl Linux: test for libc5/glibc2: glibc2 has gettext() included
219 if test "$USE_LINUX" = 1; then
220   AC_CHECK_LIB(c,gettext,AC_DEFINE(wxHAVE_GLIBC2))
221 fi
222
223 dnl ---------------------------------------------------------------------------
224 dnl command line options for configure
225 dnl ---------------------------------------------------------------------------
226
227 dnl the default values for all options - we collect them all here to simplify
228 dnl modification of the default values (for example, if the defaults for some
229 dnl platform should be changed, it can be done here too)
230 dnl
231 dnl NB: see also DEFAULT_wxUSE<toolkit> variables defined above
232
233 WX_ARG_CACHE_INIT
234
235 dnl useful to test the compilation with minimum options, define as 0 for normal
236 dnl usage
237 DEBUG_CONFIGURE=0
238 if test $DEBUG_CONFIGURE = 1; then
239   DEFAULT_wxUSE_THREADS=yes
240
241   DEFAULT_wxUSE_OPTIMISE=no
242   DEFAULT_wxUSE_PROFILE=no
243   DEFAULT_wxUSE_NO_RTTI=no
244   DEFAULT_wxUSE_NO_EXCEPTIONS=no
245   DEFAULT_wxUSE_DEBUG_FLAG=yes
246   DEFAULT_wxUSE_DEBUG_INFO=yes
247   DEFAULT_wxUSE_DEBUG_GDB=yes
248   DEFAULT_wxUSE_MEM_TRACING=no
249   DEFAULT_wxUSE_DEBUG_CONTEXT=no
250   DEFAULT_wxUSE_DMALLOC=no
251   DEFAULT_wxUSE_APPLE_IEEE=no
252
253   DEFAULT_wxUSE_LOG=yes
254
255   DEFAULT_wxUSE_GUI=yes
256
257   DEFAULT_wxUSE_ZLIB=no
258   DEFAULT_wxUSE_LIBPNG=no
259   DEFAULT_wxUSE_LIBGIF=no
260   DEFAULT_wxUSE_LIBJPEG=no
261   DEFAULT_wxUSE_ODBC=no
262
263   DEFAULT_wxUSE_STD_IOSTREAM=no
264   DEFAULT_wxUSE_FILE=no
265   DEFAULT_wxUSE_TEXTFILE=no
266   DEFAULT_wxUSE_TIMEDATE=no
267   DEFAULT_wxUSE_WAVE=no
268   DEFAULT_wxUSE_INTL=no
269   DEFAULT_wxUSE_CONFIG=no
270   DEFAULT_wxUSE_STREAMS=no
271   DEFAULT_wxUSE_SOCKETS=no
272   DEFAULT_wxUSE_SERIAL=no
273   DEFAULT_wxUSE_JOYSTICK=no
274   DEFAULT_wxUSE_DYNLIB_CLASS=no
275   DEFAULT_wxUSE_LONGLONG=no
276
277   DEFAULT_wxUSE_AFM_FOR_POSTSCRIPT=no
278   DEFAULT_wxUSE_NORMALIZED_PS_FONTS=no
279   DEFAULT_wxUSE_POSTSCRIPT=no
280
281   DEFAULT_wxUSE_X_RESOURCES=no
282   DEFAULT_wxUSE_CLIPBOARD=no
283   DEFAULT_wxUSE_TOOLTIPS=no
284   DEFAULT_wxUSE_DRAG_AND_DROP=no
285   DEFAULT_wxUSE_SPLINES=no
286
287   DEFAULT_wxUSE_MDI_ARCHITECTURE=no
288   DEFAULT_wxUSE_DOC_VIEW_ARCHITECTURE=no
289   DEFAULT_wxUSE_PRINTING_ARCHITECTURE=no
290
291   DEFAULT_wxUSE_PROLOGIO=no
292   DEFAULT_wxUSE_RESOURCES=no
293   DEFAULT_wxUSE_CONSTRAINTS=no
294   DEFAULT_wxUSE_IPC=no
295   DEFAULT_wxUSE_HELP=no
296   DEFAULT_wxUSE_WXTREE=no
297   DEFAULT_wxUSE_METAFILE=no
298
299   DEFAULT_wxUSE_COMMONDLGS=no
300   DEFAULT_wxUSE_DIRDLG=no
301   DEFAULT_wxUSE_TEXTDLG=no
302   DEFAULT_wxUSE_STARTUP_TIPS=no
303   DEFAULT_wxUSE_PROGRESSDLG=no
304   DEFAULT_wxUSE_MINIFRAME=no
305   DEFAULT_wxUSE_HTML=no
306   DEFAULT_wxUSE_FS_INET=no
307   DEFAULT_wxUSE_FS_ZIP=no
308   DEFAULT_wxUSE_BUSYINFO=no
309   DEFAULT_wxUSE_ZIPSTREAM=no
310   DEFAULT_wxUSE_VALIDATORS=yes
311
312   DEFAULT_wxUSE_ACCEL=no
313   DEFAULT_wxUSE_CARET=no
314   DEFAULT_wxUSE_BMPBUTTON=no
315   DEFAULT_wxUSE_CHECKBOX=no
316   DEFAULT_wxUSE_CHECKLST=no
317   DEFAULT_wxUSE_CHOICE=yes
318   DEFAULT_wxUSE_COMBOBOX=no
319   DEFAULT_wxUSE_GAUGE=no
320   DEFAULT_wxUSE_GRID=no
321   DEFAULT_wxUSE_IMAGLIST=no
322   DEFAULT_wxUSE_LISTBOX=no
323   DEFAULT_wxUSE_LISTCTRL=no
324   DEFAULT_wxUSE_NOTEBOOK=no
325   DEFAULT_wxUSE_RADIOBOX=no
326   DEFAULT_wxUSE_RADIOBTN=no
327   DEFAULT_wxUSE_SASH=no
328   DEFAULT_wxUSE_SCROLLBAR=no
329   DEFAULT_wxUSE_SLIDER=no
330   DEFAULT_wxUSE_SPINBTN=no
331   DEFAULT_wxUSE_SPLITTER=no
332   DEFAULT_wxUSE_STATBMP=no
333   DEFAULT_wxUSE_STATBOX=no
334   DEFAULT_wxUSE_STATLINE=no
335   DEFAULT_wxUSE_STATUSBAR=yes
336   DEFAULT_wxUSE_TABDIALOG=no
337   DEFAULT_wxUSE_TOOLBAR=no
338   DEFAULT_wxUSE_TREECTRL=no
339
340   DEFAULT_wxUSE_UNICODE=no
341   DEFAULT_wxUSE_WCSRTOMBS=no
342 else
343   DEFAULT_wxUSE_THREADS=yes
344
345   DEFAULT_wxUSE_OPTIMISE=yes
346   DEFAULT_wxUSE_PROFILE=no
347   DEFAULT_wxUSE_NO_RTTI=no
348   DEFAULT_wxUSE_NO_EXCEPTIONS=no
349   DEFAULT_wxUSE_DEBUG_FLAG=no
350   DEFAULT_wxUSE_DEBUG_INFO=no
351   DEFAULT_wxUSE_DEBUG_GDB=no
352   DEFAULT_wxUSE_MEM_TRACING=no
353   DEFAULT_wxUSE_DEBUG_CONTEXT=no
354   DEFAULT_wxUSE_DMALLOC=no
355   DEFAULT_wxUSE_APPLE_IEEE=yes
356
357   DEFAULT_wxUSE_LOG=yes
358
359   DEFAULT_wxUSE_GUI=yes
360
361   DEFAULT_wxUSE_ZLIB=yes
362   DEFAULT_wxUSE_LIBPNG=yes
363   DEFAULT_wxUSE_LIBGIF=yes
364   DEFAULT_wxUSE_LIBJPEG=yes
365   DEFAULT_wxUSE_ODBC=no
366
367   DEFAULT_wxUSE_STD_IOSTREAM=yes
368   DEFAULT_wxUSE_FILE=yes
369   DEFAULT_wxUSE_TEXTFILE=yes
370   DEFAULT_wxUSE_TIMEDATE=yes
371   DEFAULT_wxUSE_WAVE=no
372   DEFAULT_wxUSE_INTL=yes
373   DEFAULT_wxUSE_CONFIG=yes
374   DEFAULT_wxUSE_STREAMS=yes
375   DEFAULT_wxUSE_SOCKETS=yes
376   DEFAULT_wxUSE_SERIAL=yes
377   DEFAULT_wxUSE_JOYSTICK=yes
378   DEFAULT_wxUSE_DYNLIB_CLASS=yes
379   DEFAULT_wxUSE_LONGLONG=no
380
381   DEFAULT_wxUSE_AFM_FOR_POSTSCRIPT=yes
382   DEFAULT_wxUSE_NORMALIZED_PS_FONTS=yes
383   DEFAULT_wxUSE_POSTSCRIPT=yes
384
385   DEFAULT_wxUSE_X_RESOURCES=no
386   DEFAULT_wxUSE_CLIPBOARD=yes
387   DEFAULT_wxUSE_TOOLTIPS=yes
388   DEFAULT_wxUSE_DRAG_AND_DROP=yes
389   DEFAULT_wxUSE_SPLINES=yes
390
391   DEFAULT_wxUSE_MDI_ARCHITECTURE=yes
392   DEFAULT_wxUSE_DOC_VIEW_ARCHITECTURE=yes
393   DEFAULT_wxUSE_PRINTING_ARCHITECTURE=yes
394
395   DEFAULT_wxUSE_PROLOGIO=yes
396   DEFAULT_wxUSE_RESOURCES=yes
397   DEFAULT_wxUSE_CONSTRAINTS=yes
398   DEFAULT_wxUSE_IPC=yes
399   DEFAULT_wxUSE_HELP=yes
400   DEFAULT_wxUSE_WXTREE=yes
401   DEFAULT_wxUSE_METAFILE=yes
402
403   DEFAULT_wxUSE_COMMONDLGS=yes
404   DEFAULT_wxUSE_DIRDLG=yes
405   DEFAULT_wxUSE_TEXTDLG=yes
406   DEFAULT_wxUSE_STARTUP_TIPS=yes
407   DEFAULT_wxUSE_PROGRESSDLG=yes
408   DEFAULT_wxUSE_MINIFRAME=yes
409   DEFAULT_wxUSE_HTML=yes
410   DEFAULT_wxUSE_FS_INET=yes
411   DEFAULT_wxUSE_FS_ZIP=yes
412   DEFAULT_wxUSE_BUSYINFO=yes
413   DEFAULT_wxUSE_ZIPSTREAM=yes
414   DEFAULT_wxUSE_VALIDATORS=yes
415
416   DEFAULT_wxUSE_ACCEL=yes
417   DEFAULT_wxUSE_CARET=yes
418   DEFAULT_wxUSE_BMPBUTTON=yes
419   DEFAULT_wxUSE_CHECKBOX=yes
420   DEFAULT_wxUSE_CHECKLST=yes
421   DEFAULT_wxUSE_CHOICE=yes
422   DEFAULT_wxUSE_COMBOBOX=yes
423   DEFAULT_wxUSE_GAUGE=yes
424   DEFAULT_wxUSE_GRID=yes
425   DEFAULT_wxUSE_IMAGLIST=yes
426   DEFAULT_wxUSE_LISTBOX=yes
427   DEFAULT_wxUSE_LISTCTRL=yes
428   DEFAULT_wxUSE_NOTEBOOK=yes
429   DEFAULT_wxUSE_RADIOBOX=yes
430   DEFAULT_wxUSE_RADIOBTN=yes
431   DEFAULT_wxUSE_SASH=yes
432   DEFAULT_wxUSE_SCROLLBAR=yes
433   DEFAULT_wxUSE_SLIDER=yes
434   DEFAULT_wxUSE_SPINBTN=yes
435   DEFAULT_wxUSE_SPLITTER=yes
436   DEFAULT_wxUSE_STATBMP=yes
437   DEFAULT_wxUSE_STATBOX=yes
438   DEFAULT_wxUSE_STATLINE=yes
439   DEFAULT_wxUSE_STATUSBAR=yes
440   DEFAULT_wxUSE_TABDIALOG=no
441   DEFAULT_wxUSE_TOOLBAR=yes
442   DEFAULT_wxUSE_TREECTRL=yes
443
444   DEFAULT_wxUSE_UNICODE=no
445   DEFAULT_wxUSE_WCSRTOMBS=no
446 fi
447
448 dnl WX_ARG_WITH should be used to select whether an external package will be
449 dnl used or not, to configure compile-time features of this package itself,
450 dnl use WX_ARG_ENABLE instead
451
452 dnl ============================
453 dnl external package dependecies
454 dnl ============================
455
456 dnl these options use AC_ARG_WITH and not WX_ARG_WITH on purpose - we cache
457 dnl these values manually
458 for toolkit in `echo $ALL_TOOLKITS`; do
459   LINE=`grep "wxUSE_$toolkit" ${wx_arg_cache_file}`
460   if test "x$LINE" != x ; then
461     has_toolkit_in_cache=1
462     eval "DEFAULT_$LINE"
463     eval "CACHE_$toolkit=1"
464   fi
465 done
466
467 AC_ARG_WITH(gtk,           [  --with-gtk              use GTK+], [wxUSE_GTK="$withval" CACHE_GTK=1 TOOLKIT_GIVEN=1])
468 AC_ARG_WITH(motif,         [  --with-motif            use Motif/Lesstif], [wxUSE_MOTIF="$withval" CACHE_MOTIF=1 TOOLKIT_GIVEN=1])
469 AC_ARG_WITH(wine,          [  --with-wine             use WINE], [wxUSE_WINE="$withval" CACHE_WINE=1 TOOLKIT_GIVEN=1])
470 AC_ARG_WITH(cygwin,        [  --with-cygwin           use Cygwin for MS-Windows], [wxUSE_CYGWIN="$withval" CACHE_CYGWIN=1 TOOLKIT_GIVEN=1])
471 AC_ARG_WITH(mingw,         [  --with-mingw            use GCC Minimal MS-Windows], [wxUSE_MINGW="$withval" CACHE_MINGW=1 TOOLKIT_GIVEN=1])
472
473 AC_ARG_WITH(gtk-prefix,    [  --with-gtk-prefix=PFX   Prefix where GTK is installed],
474             gtk_config_prefix="$withval", gtk_config_prefix="")
475 AC_ARG_WITH(gtk-exec-prefix, [  --with-gtk-exec-prefix=PFX  Exec prefix where GTK is installed],
476             gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
477
478 WX_ARG_WITH(dmalloc,       [  --with-dmalloc          use dmalloc library (www.letters.com/dmalloc)], wxUSE_DMALLOC)
479 WX_ARG_WITH(zlib,          [  --with-zlib             use zlib for LZW compression], wxUSE_ZLIB)
480 WX_ARG_WITH(libpng,        [  --with-libpng           use libpng (PNG image format)], wxUSE_LIBPNG)
481 WX_ARG_WITH(libgif,        [  --with-libgif           use libgif (GIF file format)], wxUSE_LIBGIF)
482 WX_ARG_WITH(libjpeg,       [  --with-libjpeg          use libjpeg (JPEG file format)], wxUSE_LIBJPEG)
483 WX_ARG_WITH(opengl,        [  --with-opengl           use OpenGL (or Mesa)], wxUSE_OPENGL)
484 WX_ARG_WITH(odbc,          [  --with-odbc             use the IODBC and wxODBC classes], wxUSE_ODBC)
485
486 dnl ====================
487 dnl compile-time options
488 dnl ====================
489
490 dnl ---------------------------------------------------------------------------
491 dnl compile options
492 dnl ---------------------------------------------------------------------------
493
494 WX_ARG_ENABLE(optimise,    [  --enable-optimise       create optimised code], wxUSE_OPTIMISE)
495 WX_ARG_ENABLE(debug,       [  --enable-debug          same as debug_flag and debug_info], wxUSE_DEBUG)
496
497 if test "$wxUSE_DEBUG" = "yes"; then
498   DEFAULT_wxUSE_DEBUG_FLAG=yes
499   DEFAULT_wxUSE_DEBUG_INFO=yes
500 elif test "$wxUSE_DEBUG" = "no"; then
501   DEFAULT_wxUSE_DEBUG_FLAG=no
502   DEFAULT_wxUSE_DEBUG_INFO=no
503 fi
504
505 WX_ARG_ENABLE(debug_flag,    [  --enable-debug_flag     set __WXDEBUG__ flag (recommended for developers!)], wxUSE_DEBUG_FLAG)
506 WX_ARG_ENABLE(debug_info,    [  --enable-debug_info     create code with debugging information], wxUSE_DEBUG_INFO)
507 WX_ARG_ENABLE(debug_gdb,     [  --enable-debug_gdb      create code with extra GDB debugging information], wxUSE_DEBUG_GDB)
508 WX_ARG_ENABLE(debug_cntxt,   [  --enable-debug_cntxt    use wxDebugContext], wxUSE_DEBUG_CONTEXT)
509 WX_ARG_ENABLE(mem_tracing,   [  --enable-mem_tracing    create code with memory tracing], wxUSE_MEM_TRACING)
510 WX_ARG_ENABLE(profile,       [  --enable-profile        create code with profiling information], wxUSE_PROFILE)
511 WX_ARG_ENABLE(no_rtti,       [  --enable-no_rtti        create code without RTTI information], wxUSE_NO_RTTI)
512 WX_ARG_ENABLE(no_exceptions, [  --enable-no_exceptions  create code without exceptions information], wxUSE_NO_EXCEPTIONS)
513
514 dnl ---------------------------------------------------------------------------
515 dnl --disable-gui will build only non-GUI part of wxWindows
516 dnl
517 dnl NB: this is still in testing stage, don't use if you don't know what you're
518 dnl     doing
519 dnl ---------------------------------------------------------------------------
520
521 WX_ARG_ENABLE(gui,         [  --enable-gui            use GUI classes], wxUSE_GUI)
522
523 dnl ---------------------------------------------------------------------------
524 dnl (small) optional non GUI classes
525 dnl ---------------------------------------------------------------------------
526
527 WX_ARG_ENABLE(intl,          [  --enable-intl           use internationalization system], wxUSE_INTL)
528 WX_ARG_ENABLE(config,        [  --enable-config         use wxConfig (and derived) classes], wxUSE_CONFIG)
529 WX_ARG_ENABLE(sockets,       [  --enable-sockets        use socket/network classes], wxUSE_SOCKETS)
530 WX_ARG_ENABLE(ipc,           [  --enable-ipc            use interprocess communication (wxSocket etc.)], wxUSE_IPC)
531 WX_ARG_ENABLE(apple_ieee,    [  --enable-apple_ieee     use the Apple IEEE codec], wxUSE_APPLE_IEEE)
532 WX_ARG_ENABLE(timedate,      [  --enable-timedate       use date/time classes], wxUSE_TIMEDATE)
533 WX_ARG_ENABLE(wave,          [  --enable-wave           use wxWave class], wxUSE_WAVE)
534 WX_ARG_ENABLE(fraction,      [  --enable-fraction       use wxFraction class], wxUSE_FRACTION)
535 WX_ARG_ENABLE(dynlib,        [  --enable-dynlib         use wxLibrary class for DLL loading], wxUSE_DYNLIB_CLASS)
536 WX_ARG_ENABLE(longlong,      [  --enable-longlong       use wxLongLong class], wxUSE_LONGLONG)
537 WX_ARG_ENABLE(log,           [  --enable-log            use logging system], wxUSE_LOG)
538 WX_ARG_ENABLE(streams,       [  --enable-streams        use wxStream etc classes], wxUSE_STREAMS)
539 WX_ARG_ENABLE(file,          [  --enable-file           use wxFile classes], wxUSE_FILE)
540 WX_ARG_ENABLE(textfile,      [  --enable-textfile       use wxTextFile classes], wxUSE_TEXTFILE)
541 WX_ARG_ENABLE(unicode,       [  --enable-unicode        compile wxString with Unicode support], wxUSE_UNICODE)
542 WX_ARG_ENABLE(wcsrtombs,     [  --enable-wcsrtombs      use wcsrtombs instead of buggy (GNU libc1/Linux libc5) wcstombs], wxUSE_WCSRTOMBS)
543 WX_ARG_ENABLE(wxprintfv,     [  --enable-wxprintfv      use wxWindows implementation of vprintf()], wxUSE_EXPERIMENTAL_PRINTF)
544 WX_ARG_ENABLE(joystick,      [  --enable-joystick       compile in joystick support (Linux only)], wxUSE_JOYSTICK)
545 WX_ARG_ENABLE(std_iostreams, [  --enable-std_iostreams  use standard C++ stream classes], wxUSE_STD_IOSTREAM)
546 WX_ARG_ENABLE(fs_inet,       [  --enable-fs_inet        use virtual HTTP/FTP filesystems], wxUSE_FS_INET)
547 WX_ARG_ENABLE(fs_zip,        [  --enable-fs_zip         use virtual ZIP filesystems], wxUSE_FS_ZIP)
548 WX_ARG_ENABLE(zipstream,     [  --enable-zipstream      use wxZipInputStream], wxUSE_ZIPSTREAM)
549
550 dnl ---------------------------------------------------------------------------
551 dnl "big" options (i.e. those which change a lot of things throughout the library)
552 dnl ---------------------------------------------------------------------------
553
554 WX_ARG_ENABLE(threads,     [  --enable-threads        use threads], wxUSE_THREADS)
555 WX_ARG_ENABLE(serial,      [  --enable-serial         use class serialization], wxUSE_SERIAL)
556
557 dnl ---------------------------------------------------------------------------
558 dnl "big" GUI options
559 dnl ---------------------------------------------------------------------------
560
561 WX_ARG_ENABLE(docview,     [  --enable-docview        use document view architecture], wxUSE_DOC_VIEW_ARCHITECTURE)
562 WX_ARG_ENABLE(help,        [  --enable-help           use help (using external browser at present)], wxUSE_HELP)
563 WX_ARG_ENABLE(constraints, [  --enable-constraints    use layout-constraints system], wxUSE_CONSTRAINTS)
564 WX_ARG_ENABLE(printarch,   [  --enable-printarch      use printing architecture], wxUSE_PRINTING_ARCHITECTURE)
565 WX_ARG_ENABLE(mdi,         [  --enable-mdi            use multiple document interface architecture], wxUSE_MDI_ARCHITECTURE)
566
567 dnl ---------------------------------------------------------------------------
568 dnl PostScript options
569 dnl ---------------------------------------------------------------------------
570 WX_ARG_ENABLE(postscript,  [  --enable-postscript     use wxPostscriptDC device context (default for gtk+)], wxUSE_POSTSCRIPT)
571
572 dnl VZ: these options seem to be always on, if someone wants to change it please do
573 dnl WX_ARG_ENABLE(PS-normalized,    [  --enable-PS-normalized  use normalized PS fonts], dnl             wxUSE_NORMALIZED_PS_FONTS)
574 dnl WX_ARG_ENABLE(afmfonts,        [  --enable-afmfonts       use Adobe Font Metric Font table], dnl             wxUSE_AFM_FOR_POSTSCRIPT)
575
576 dnl ---------------------------------------------------------------------------
577 dnl resources
578 dnl ---------------------------------------------------------------------------
579 WX_ARG_ENABLE(prologio,    [  --enable-prologio       use Prolog IO library], wxUSE_PROLOGIO)
580 WX_ARG_ENABLE(resources,   [  --enable-resources      use wxWindows resources], wxUSE_RESOURCES)
581
582 WX_ARG_ENABLE(xresources,  [  --enable-xresources     use X resources for save (default for gtk+)], wxUSE_X_RESOURCES)
583
584 dnl ---------------------------------------------------------------------------
585 dnl IPC &c
586 dnl ---------------------------------------------------------------------------
587
588 WX_ARG_ENABLE(clipboard,   [  --enable-clipboard      use wxClipboard classes], wxUSE_CLIPBOARD)
589 WX_ARG_ENABLE(dnd,         [  --enable-dnd            use Drag'n'Drop classes], wxUSE_DRAG_AND_DROP)
590
591 dnl TODO: doesn't work yet
592 WX_ARG_ENABLE(wxtree,      [  --enable-wxtree         make wxTree library], wxUSE_WXTREE)
593
594 dnl ---------------------------------------------------------------------------
595 dnl optional GUI controls (in alphabetical order except the first one)
596 dnl ---------------------------------------------------------------------------
597
598 WX_ARG_ENABLE(controls,    [  --enable-controls       use all usual controls], wxUSE_CONTROLS)
599
600 dnl even with --enable-controls, some may be disabled by giving
601 dnl --disable-<control> later on the command line - but by default all will be
602 dnl used (and vice versa)
603 if test "$wxUSE_CONTROLS" = "yes"; then
604   DEFAULT_wxUSE_ACCEL=yes
605   DEFAULT_wxUSE_CARET=yes
606   DEFAULT_wxUSE_COMBOBOX=yes
607   DEFAULT_wxUSE_BMPBUTTON=yes
608   DEFAULT_wxUSE_CHECKBOX=yes
609   DEFAULT_wxUSE_CHECKLISTBOX=yes
610   DEFAULT_wxUSE_CHOICE=yes
611   DEFAULT_wxUSE_GAUGE=yes
612   DEFAULT_wxUSE_GRID=yes
613   DEFAULT_wxUSE_IMAGLIST=yes
614   DEFAULT_wxUSE_LISTBOX=yes
615   DEFAULT_wxUSE_LISTCTRL=yes
616   DEFAULT_wxUSE_NOTEBOOK=yes
617   DEFAULT_wxUSE_RADIOBOX=yes
618   DEFAULT_wxUSE_RADIOBTN=yes
619   DEFAULT_wxUSE_SASH=yes
620   DEFAULT_wxUSE_SCROLLBAR=yes
621   DEFAULT_wxUSE_SLIDER=yes
622   DEFAULT_wxUSE_SPINBTN=yes
623   DEFAULT_wxUSE_SPLITTER=yes
624   DEFAULT_wxUSE_STATBMP=yes
625   DEFAULT_wxUSE_STATBOX=yes
626   DEFAULT_wxUSE_STATLINE=yes
627   DEFAULT_wxUSE_STATUSBAR=yes
628   DEFAULT_wxUSE_TAB_DIALOG=yes
629   DEFAULT_wxUSE_TOOLBAR=yes
630   DEFAULT_wxUSE_TOOLTIPS=yes
631   DEFAULT_wxUSE_TREECTRL=yes
632 elif test "$wxUSE_CONTROLS" = "no"; then
633   DEFAULT_wxUSE_ACCEL=no
634   DEFAULT_wxUSE_CARET=no
635   DEFAULT_wxUSE_COMBOBOX=no
636   DEFAULT_wxUSE_BMPBUTTON=no
637   DEFAULT_wxUSE_CHECKBOX=no
638   DEFAULT_wxUSE_CHECKLISTBOX=no
639   DEFAULT_wxUSE_CHOICE=no
640   DEFAULT_wxUSE_GAUGE=no
641   DEFAULT_wxUSE_GRID=no
642   DEFAULT_wxUSE_IMAGLIST=no
643   DEFAULT_wxUSE_LISTBOX=no
644   DEFAULT_wxUSE_LISTCTRL=no
645   DEFAULT_wxUSE_NOTEBOOK=no
646   DEFAULT_wxUSE_RADIOBOX=no
647   DEFAULT_wxUSE_RADIOBTN=no
648   DEFAULT_wxUSE_SASH=no
649   DEFAULT_wxUSE_SCROLLBAR=no
650   DEFAULT_wxUSE_SLIDER=no
651   DEFAULT_wxUSE_SPINBTN=no
652   DEFAULT_wxUSE_SPLITTER=no
653   DEFAULT_wxUSE_STATBMP=no
654   DEFAULT_wxUSE_STATBOX=no
655   DEFAULT_wxUSE_STATLINE=no
656   DEFAULT_wxUSE_STATUSBAR=no
657   DEFAULT_wxUSE_TAB_DIALOG=no
658   DEFAULT_wxUSE_TOOLBAR=no
659   DEFAULT_wxUSE_TOOLTIPS=no
660   DEFAULT_wxUSE_TREECTRL=no
661 fi
662
663 WX_ARG_ENABLE(accel,       [  --enable-accel          use accelerators], wxUSE_ACCEL)
664 WX_ARG_ENABLE(caret,       [  --enable-caret          use wxCaret class], wxUSE_CARET)
665 WX_ARG_ENABLE(bmpbutton,   [  --enable-bmpbutton      use wxBitmapButton class], wxUSE_BMPBUTTON)
666 WX_ARG_ENABLE(checkbox,    [  --enable-checkbox       use wxCheckBox class], wxUSE_CHECKBOX)
667 WX_ARG_ENABLE(checklst,    [  --enable-checklst       use wxCheckListBox (listbox with checkboxes) class], wxUSE_CHECKLST)
668 WX_ARG_ENABLE(choice,      [  --enable-choice         use wxChoice class], wxUSE_CHOICE)
669 WX_ARG_ENABLE(combobox,    [  --enable-combobox       use wxComboBox classes], wxUSE_COMBOBOX)
670 WX_ARG_ENABLE(gauge,       [  --enable-gauge          use wxGauge class], wxUSE_GAUGE)
671 WX_ARG_ENABLE(grid,        [  --enable-grid           use wxGrid class], wxUSE_GRID)
672 WX_ARG_ENABLE(imaglist,    [  --enable-imaglist       use wxImageList class], wxUSE_IMAGLIST)
673 WX_ARG_ENABLE(listbox,     [  --enable-listbox        use wxListBox class], wxUSE_LISTBOX)
674 WX_ARG_ENABLE(listctrl,    [  --enable-listctrl       use wxListCtrl class], wxUSE_LISTCTRL)
675 WX_ARG_ENABLE(notebook,    [  --enable-notebook       use wxNotebook class], wxUSE_NOTEBOOK)
676 WX_ARG_ENABLE(radiobox,    [  --enable-radiobox       use wxRadioBox class], wxUSE_RADIOBOX)
677 WX_ARG_ENABLE(radiobtn,    [  --enable-radiobtn       use wxRadioButton class], wxUSE_RADIOBTN)
678 WX_ARG_ENABLE(sash,        [  --enable-sash           use wxSashWindow class], wxUSE_SASH)
679 WX_ARG_ENABLE(scrollbar,   [  --enable-scrollbar      use wxScrollBar class and scrollable windows], wxUSE_SCROLLBAR)
680 WX_ARG_ENABLE(slider,      [  --enable-slider         use wxSlider class], wxUSE_SLIDER)
681 WX_ARG_ENABLE(spinbtn,     [  --enable-spinbtn        use wxSpinButton class], wxUSE_SPINBTN)
682 WX_ARG_ENABLE(splitter,    [  --enable-splitter       use wxSplitterWindow class], wxUSE_SPLITTER)
683 WX_ARG_ENABLE(statbmp,     [  --enable-statbmp        use wxStaticBitmap class], wxUSE_STATBMP)
684 WX_ARG_ENABLE(statbox,     [  --enable-statbox        use wxStaticBox class], wxUSE_STATBOX)
685 WX_ARG_ENABLE(statline,    [  --enable-statline       use wxStaticLine class], wxUSE_STATLINE)
686 WX_ARG_ENABLE(statusbar,   [  --enable-statusbar      use wxStatusBar class], wxUSE_STATUSBAR)
687 WX_ARG_ENABLE(tabdialog,   [  --enable-tabdialog      use wxTabControl class], wxUSE_TABDIALOG)
688 WX_ARG_ENABLE(toolbar,     [  --enable-toolbar        use wxToolBar class], wxUSE_TOOLBAR)
689 WX_ARG_ENABLE(treectrl,    [  --enable-treectrl       use wxTreeCtrl class], wxUSE_TREECTRL)
690
691 dnl ---------------------------------------------------------------------------
692 dnl misc GUI options
693 dnl ---------------------------------------------------------------------------
694
695 WX_ARG_ENABLE(commondlg,   [  --enable-commondlg      use common dialogs (wxDirDialog, wxProgressDialog, wxTextDialog, ...)], wxUSE_COMMONDLGS)
696 WX_ARG_ENABLE(dirdlg,      [  --enable-dirdlg         use wxDirDialog], wxUSE_DIRDLG)
697 WX_ARG_ENABLE(textdlg,     [  --enable-textdlg        use wxTextDialog], wxUSE_TEXTDLG)
698 WX_ARG_ENABLE(tipdlg,      [  --enable-tipdlg         use startup tips], wxUSE_STARTUP_TIPS)
699 WX_ARG_ENABLE(progressdlg, [  --enable-progressdlg    use wxProgressDialog], wxUSE_PROGRESSDLG)
700 WX_ARG_ENABLE(miniframe,   [  --enable-miniframe      use wxMiniFrame class], wxUSE_MINIFRAME)
701 WX_ARG_ENABLE(html,        [  --enable-html           use wxHTML sub-library], wxUSE_HTML)
702 WX_ARG_ENABLE(tooltips,    [  --enable-tooltips       use wxToolTip class], wxUSE_TOOLTIPS)
703 WX_ARG_ENABLE(splines,     [  --enable-splines        use spline drawing code], wxUSE_SPLINES)
704 WX_ARG_ENABLE(validators,  [  --enable-validators     use wxValidator and derived classes], wxUSE_VALIDATORS)
705 WX_ARG_ENABLE(busyinfo,    [  --enable-busyinfo       use wxBusyInfo], wxUSE_BUSYINFO)
706
707 dnl cache the options values before (may be) aborting below
708 WX_ARG_CACHE_FLUSH
709
710 dnl check that no more than one toolkit is given and that if none are given that
711 dnl we have a default one
712
713 AC_MSG_CHECKING(for toolkit)
714
715 if test "$TOOLKIT_GIVEN" = 1; then
716   dnl convert "yes" to 1 and "no" to 0
717   for toolkit in `echo $ALL_TOOLKITS`; do
718     var=wxUSE_$toolkit
719     eval "value=\$${var}"
720     eval "$var=`echo \$value | sed -e "s/yes/1/" -e "s/no/0/"`"
721   done
722 else
723   dnl try to guess the most apropriate toolkit for this platform
724   for toolkit in `echo $ALL_TOOLKITS`; do
725     if test "$has_toolkit_in_cache" != 1; then
726       var=DEFAULT_DEFAULT_wxUSE_$toolkit
727     else
728       var=DEFAULT_wxUSE_$toolkit
729     fi
730     eval "wxUSE_$toolkit=\$${var}"
731   done
732 fi
733
734 dnl we suppose that expr exists...
735 NUM_TOOLKITS=`expr ${wxUSE_GTK:-0} + ${wxUSE_MOTIF:-0} + ${wxUSE_WINE:-0} + ${wxUSE_MINGW:-0} + ${wxUSE_CYGWIN:-0}`
736
737 case "$NUM_TOOLKITS" in
738   1)
739   ;;
740   0)
741     AC_MSG_ERROR(Please specify a toolkit - cannot determine the default for ${host})
742   ;;
743   *)
744     AC_MSG_ERROR(Please specify at most one toolkit (may be some are cached?))
745 esac
746
747 dnl cache the wxUSE_<TOOLKIT> values too
748 for toolkit in `echo $ALL_TOOLKITS`; do
749   var=wxUSE_$toolkit
750   eval "value=\$${var}"
751   if test "x$value" != x; then
752     cache_var=CACHE_$toolkit
753     eval "cache=\$${cache_var}"
754     if test "$cache" = 1; then
755       echo "$var=$value" >> ${wx_arg_cache_file}
756     fi
757     if test "$value" = 1; then
758       AC_MSG_RESULT(`echo $toolkit | tr [[A-Z]] [[a-z]]`)
759     fi
760   fi
761 done
762
763 dnl ---------------------------------------------------------------------------
764 dnl Checks for programs
765 dnl ---------------------------------------------------------------------------
766
767 dnl flush the cache because checking for programs might abort
768 AC_CACHE_SAVE
769
770 dnl cross-compiling support: we're cross compiling if the build system is
771 dnl different from the target one (assume host and target be always the same)
772 if eval "test $host != $build"; then
773   if eval "test $host_alias != NONE"; then
774     CC=$host_alias-gcc 
775     CXX=$host_alias-c++ 
776     AR=$host_alias-ar
777     RANLIB=$host_alias-ranlib
778     DLLTOOL=$host_alias-dlltool 
779     LD=$host_alias-ld 
780     NM=$host_alias-nm
781     STRIP=$host_alias-strip
782   fi
783 fi
784
785 dnl C-compiler checks
786 dnl   defines CC with the compiler to use
787 dnl   defines GCC with yes if using gcc
788 dnl   defines GCC empty if not using gcc
789 dnl   defines CFLAGS
790 AC_PROG_CC
791
792 CFLAGS=`echo "$CFLAGS" | sed 's/-g//g'`
793
794 dnl what is the c-preprocessor
795 dnl   defines CPP with the c-preprocessor
796 AC_PROG_CPP
797
798 dnl is -traditional needed for correct compilations
799 dnl   adds -traditional for gcc if needed
800 AC_PROG_GCC_TRADITIONAL
801
802 AC_LANG_SAVE
803 AC_LANG_CPLUSPLUS
804
805 dnl C++-compiler checks
806 dnl   defines CXX with the compiler to use
807 dnl   defines GXX with yes if using gxx
808 dnl   defines GXX empty if not using gxx
809 dnl   defines CXXFLAGS
810 AC_PROG_CXX
811
812 dnl what is the C++-preprocessor
813 dnl   defines CXXCPP with the C++-preprocessor
814 AC_PROG_CXXCPP
815
816 CXXFLAGS=`echo "$CXXFLAGS" | sed 's/-g//g'`
817
818 AC_LANG_RESTORE
819
820 dnl ranlib command
821 dnl   defines RANLIB with the appropriate command
822 AC_PROG_RANLIB
823
824 dnl ar command
825 dnl   defines AR with the appropriate command
826 AC_CHECK_PROG(AR, ar, ar, ar)
827
828 dnl install checks
829 dnl   defines INSTALL with the appropriate command
830 AC_PROG_INSTALL
831
832 dnl strip command
833 dnl   defines STRIP as strip or nothing if not found
834 AC_CHECK_PROG(STRIP, strip, strip, true)
835
836 dnl check if VPATH works
837 AC_MSG_CHECKING("make for VPATH support")
838 dnl create Makefile
839 cat - << EOF > confMake
840 check : file
841         cp \$? \$@
842         cp \$? final_file
843 EOF
844
845 if test ! -d sub ; then
846   mkdir sub
847 fi
848 echo dummy > sub/file
849 ${MAKE-make} -f confMake VPATH=sub 2> config.log > /dev/null
850 RESULT=$?
851 rm -f sub/file check final_file confMake
852 rmdir sub
853 if test "$RESULT" = 0; then
854   AC_MSG_RESULT(yes)
855 else
856   AC_MSG_RESULT(no)
857   AC_MSG_ERROR(
858 You need a make-utility that is able to use the variable
859 VPATH correctly.
860 If your version of make does not support VPATH correctly,
861 please install GNU-make (possibly as gmake), and start
862 configure with the following command:
863 export MAKE=gmake; ./configure  for sh-type shells
864 setenv MAKE gmake; ./configure  for csh-type shells
865 Also please do remember to use gmake in this case every time
866 you are trying to compile.
867 )
868 fi
869
870 dnl YACC checks
871 dnl   defines YACC with the appropriate command
872 AC_PROG_YACC
873
874 dnl LEX checks
875 dnl   defines LEX with the appropriate command
876 dnl   defines LEXLIB with the appropriate library
877 dnl this AM version (don't use AC_PROG_LEX!) also
878 dnl   defines YYTEXT_POINTER  if yytext is char*
879 dnl   defines LEX_OUTPUT_ROOT as to the base of the
880 dnl                           filename output by the lexer
881 AM_PROG_LEX
882
883 dnl needed for making link to setup.h
884 AC_PROG_LN_S
885
886 dnl without this (which just means that we use WXDLLEXPORT) libtool won't build
887 dnl DLLs under Win32.
888 dnl AC_LIBTOOL_WIN32_DLL
889
890 dnl disable static libs by default, this takes too much time...
891 dnl libtool doesn't work on anything but Linux and maybe
892 dnl ***BSD
893
894 case "${host}" in
895   *-hp-hpux* )
896     AM_DISABLE_SHARED
897   ;;
898   *-*-linux* )
899     AM_DISABLE_STATIC
900   ;;
901   *-*-irix5* | *-*-irix6* )
902     AM_DISABLE_SHARED
903   ;;
904   *-*-solaris2* )
905     AM_DISABLE_SHARED
906   ;;
907   *-*-sunos4* )
908     AM_DISABLE_SHARED
909   ;;
910   *-*-freebsd* | *-*-netbsd*)
911     AM_DISABLE_STATIC
912   ;;
913   *-*-osf* )
914     AM_DISABLE_SHARED
915   ;;
916   *-*-dgux5* )
917     AM_DISABLE_SHARED
918   ;;
919   *-*-sysv5* )
920     AM_DISABLE_SHARED
921   ;;
922   *-*-aix* )
923     AM_DISABLE_SHARED
924   ;;
925   *-*-cygwin32* )
926     AM_DISABLE_STATIC
927   ;;
928   *-*-mingw32* )
929     AM_DISABLE_STATIC
930   ;;
931   *-pc-os2_emx )
932     AM_DISABLE_SHARED
933   ;;
934   *)
935     AC_MSG_ERROR(unknown system type ${host}.)
936 esac
937
938 AM_PROG_LIBTOOL
939
940 dnl ---------------------------------------------------------------------------
941 dnl Define search path for includes and libraries: all headers and libs will be
942 dnl looked for in all directories of this path
943 dnl ---------------------------------------------------------------------------
944
945 SEARCH_INCLUDE="\
946     /usr/Motif-1.2/include    \
947     /usr/Motif-2.1/include    \
948                               \
949     /usr/include/Motif1.2     \
950     /opt/xpm/include/X11      \
951                               \
952     /usr/Motif1.2/include     \
953     /usr/dt/include           \
954     /usr/include/Xm           \
955                               \
956     /usr/X11R6/include        \
957     /usr/X11R5/include        \
958     /usr/X11R4/include        \
959                               \
960     /usr/X11R6/lib            \
961     /usr/X11R5/lib            \
962     /usr/X11R4/lib            \
963                               \
964     /usr/include/X11R6        \
965     /usr/include/X11R5        \
966     /usr/include/X11R4        \
967                               \
968     /usr/local/X11R6/include  \
969     /usr/local/X11R5/include  \
970     /usr/local/X11R4/include  \
971                               \
972     /usr/local/include/X11R6  \
973     /usr/local/include/X11R5  \
974     /usr/local/include/X11R4  \
975                               \
976     /usr/X11/include          \
977     /usr/include/X11          \
978     /usr/local/X11/include    \
979     /usr/local/include/X11    \
980                               \
981     /usr/X386/include         \
982     /usr/x386/include         \
983     /usr/XFree86/include/X11  \
984                               \
985     /usr/include              \
986     /usr/local/include        \
987                               \
988     /usr/include/gtk          \
989     /usr/local/include/gtk    \
990     /usr/include/glib         \
991     /usr/local/include/glib   \
992                               \
993     /usr/include/qt           \
994     /usr/local/include/qt     \
995                               \
996     /usr/include/windows      \
997     /usr/include/wine         \
998     /usr/local/include/wine   \
999                               \
1000     /usr/unsupported/include  \
1001     /usr/athena/include       \
1002     /usr/local/x11r5/include  \
1003     /usr/lpp/Xamples/include  \
1004                               \
1005     /usr/openwin/include      \
1006     /usr/openwin/share/include \
1007     "
1008
1009 SEARCH_LIB="`echo "$SEARCH_INCLUDE" | sed s/include/lib/g` "
1010
1011 dnl ------------------------------------------------------------------------
1012 dnl Check for libraries
1013 dnl ------------------------------------------------------------------------
1014
1015 dnl flush the cache because checking for libraries below might abort
1016 AC_CACHE_SAVE
1017
1018 dnl ----------------------------------------------------------------
1019 dnl search for toolkit (widget sets)
1020 dnl ----------------------------------------------------------------
1021
1022 TOOLKIT=
1023 TOOLKIT_INCLUDE=
1024
1025 GUI_TK_LIBRARY=
1026 GUI_TK_LINK=
1027
1028 WXGTK12=
1029
1030 WXWINE=
1031
1032 if test "$wxUSE_CYGWIN" = 1 || test "$wxUSE_MINGW" = 1 ; then
1033   AC_MSG_CHECKING(for Windows headers)
1034   WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, windows.h)
1035   INCLUDE_SUBDIRS="$INCLUDE_SUBDIRS msw"
1036   
1037   dnl --- Quick & Dirty ; link against most/all libraries
1038   dnl --- This will bloat the executable, but it'll work for now...
1039   LIBS="$LIBS  -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -loldnames -lcomctl32 -lctl3d32 -lcrtdll -ladvapi32 -lwsock32"
1040
1041   if test "$ac_find_includes" != "" ; then
1042     AC_MSG_RESULT(found $ac_find_includes)
1043     TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE -I$ac_find_includes"
1044   else
1045     AC_MSG_RESULT(no)
1046     if test "$cross_compiling" != "yes" ; then
1047       AC_MSG_ERROR(please set CFLAGS to contain the location of windows.h)
1048     fi  
1049   fi
1050
1051   TOOLKIT=MSW
1052 fi
1053
1054 if test "$wxUSE_GTK" = 1; then
1055   dnl avoid calling AM_PATH_GTK twice, so check first for the newer version and
1056   dnl only then, if it wasn't found, for an older one
1057   AM_PATH_GTK(1.2.0, WXGTK12=1)
1058   if test "$WXGTK12" != 1; then
1059     AM_PATH_GTK(1.0.0, , AC_MSG_ERROR(Is gtk-config in path and GTK+ is version 1.2.X or 1.0.X?))
1060   fi
1061
1062   TOOLKIT_INCLUDE="$GTK_CFLAGS"
1063   GUI_TK_LIBRARY="$GTK_LIBS"
1064   TOOLKIT=GTK
1065 fi
1066
1067 if test "$wxUSE_WINE" = 1; then
1068     AC_MSG_CHECKING(for WINE includes)
1069     WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, windows.h)
1070     if test "$ac_find_includes" != "" ; then
1071         AC_MSG_RESULT(found $ac_find_includes)
1072         TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE -I$ac_find_includes"
1073     else
1074         AC_MSG_RESULT(no)
1075         AC_MSG_ERROR(please set CFLAGS to contain the location of windows.h)
1076     fi
1077
1078     XPM_LINK=""
1079     AC_MSG_CHECKING(for Xpm library)
1080     WX_PATH_FIND_LIBRARIES($SEARCH_LIB,Xpm)
1081     if test "$ac_find_libraries" != "" ; then
1082         GUI_TK_LIBRARY="-L$ac_find_libraries"
1083         XPM_LINK="-lXpm"
1084         AC_DEFINE(wxHAVE_LIB_XPM)
1085         AC_MSG_RESULT(found at $ac_find_libraries)
1086     else
1087         AC_MSG_RESULT(no)
1088         AC_MSG_WARN(library will be compiled without support for images in XPM format)
1089     fi
1090     
1091     MESA_LINK=""
1092     AC_MSG_CHECKING(for Mesa library)
1093     WX_PATH_FIND_LIBRARIES($SEARCH_LIB,MesaGL)
1094     if test "$ac_find_libraries" != "" ; then
1095         GUI_TK_LIBRARY="$GUI_TK_LIBRARY -L$ac_find_libraries"
1096         MESA_LINK="-lMesaGL"
1097         AC_MSG_RESULT(found at $ac_find_libraries)
1098     else
1099         AC_MSG_ERROR(no)
1100     fi
1101
1102     GUI_TK_LINK="-lwine $MESA_LINK $XPM_LINK -lXxf86dga -lXxf86vm -lSM -lICE -lXext -lXmu -lX11 -lncurses -ldl -lm"
1103     GUI_TK_LIBRARY="$GUI_TK_LIBRARY $GUI_TK_LINK"
1104     WXWINE=1
1105     TOOLKIT=MSW
1106     LTLIBOBJS="$LTLIBOBJS winestub.lo"
1107 fi
1108
1109 if test "$wxUSE_MOTIF" = 1; then
1110     dnl find the X11 include and library files
1111     dnl   defines x_includes and x_libraries
1112     AC_PATH_XTRA
1113
1114     if test "$no_x" = "yes"; then
1115       AC_MSG_ERROR(X11 libraries not found, aborting)
1116     fi
1117
1118     TOOLKIT_INCLUDE="$X_CFLAGS"
1119     GUI_TK_LIBRARY="$X_LIBS"
1120
1121     AC_MSG_CHECKING(for Motif/Lesstif includes)
1122     WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, Xm/Xm.h)
1123     if test "$ac_find_includes" != "" ; then
1124         AC_MSG_RESULT(found $ac_find_includes)
1125     else
1126         AC_MSG_RESULT(no)
1127         AC_MSG_ERROR(please set CFLAGS to contain the location of Xm/Xm.h)
1128     fi
1129
1130     AC_MSG_CHECKING(for Motif/Lesstif library)
1131     WX_PATH_FIND_LIBRARIES($SEARCH_LIB, Xm)
1132     if test "$ac_find_libraries" != "" ; then
1133         WX_INCLUDE_PATH_EXIST($ac_find_includes, $TOOLKIT_INCLUDE)
1134         WX_LINK_PATH_EXIST($ac_find_libraries, $GUI_TK_LIBRARY)
1135
1136         CHECK_LINK="$GUI_TK_LIBRARY $ac_path_to_link"
1137         TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE $ac_path_to_include"
1138         AC_MSG_RESULT(found at $ac_find_libraries)
1139     else
1140         AC_MSG_RESULT(no)
1141         AC_MSG_ERROR(please set LDFLAGS to contain the location of libXm)
1142     fi
1143
1144     AC_MSG_CHECKING(for Xt library)
1145     WX_PATH_FIND_LIBRARIES($SEARCH_LIB,Xt)
1146     if test "$ac_find_libraries" != "" ; then
1147         WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
1148         CHECK_LINK="$GUI_TK_LIBRARY $ac_path_to_link"
1149         AC_MSG_RESULT(found at $ac_find_libraries)
1150     else
1151         AC_MSG_RESULT(no)
1152         AC_MSG_ERROR(please set LDFLAGS to contain the location of libXt)
1153     fi
1154
1155     XPM_LINK=""
1156     AC_MSG_CHECKING(for Xpm library)
1157     WX_PATH_FIND_LIBRARIES($SEARCH_LIB,Xpm)
1158     if test "$ac_find_libraries" != "" ; then
1159         WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
1160         CHECK_LINK="$GUI_TK_LIBRARY $ac_path_to_link"
1161         XPM_LINK="-lXpm "
1162         AC_DEFINE(wxHAVE_LIB_XPM)
1163         AC_MSG_RESULT(found at $ac_find_libraries)
1164     else
1165         AC_MSG_RESULT(no)
1166         AC_MSG_WARN(library will be compiled without support for images in XPM format)
1167     fi
1168
1169     GUI_TK_LINK="-lXm $XPM_LINK -lXmu -lXt -lX11 -ldl -lm"
1170     GUI_TK_LIBRARY="$GUI_TK_LIBRARY $GUI_TK_LINK"
1171     TOOLKIT=MOTIF
1172 fi
1173
1174 dnl the name of the directory where the files for this toolkit live
1175 TOOLKIT_DIR=`echo ${TOOLKIT} | tr "A-Z" "a-z"`
1176
1177 dnl the symbol which allows conditional compilation for the given toolkit
1178 TOOLKIT_DEF=-D__WX${TOOLKIT}__
1179
1180 dnl the name of the (libtool) library
1181 WX_LIBRARY_NAME="libwx_${TOOLKIT_DIR}.la"
1182
1183 dnl the name of the library to be linked reported by wx-config
1184 WX_LIBRARY="wx_${TOOLKIT_DIR}"
1185
1186 dnl ------------------------------------------------------------------------
1187 dnl Check for headers
1188 dnl ------------------------------------------------------------------------
1189
1190 dnl defines HAVE_STRINGS_H (where some string functions live on AIX for example)
1191 AC_CHECK_HEADERS(strings.h)
1192 dnl defines HAVE_UNISTD_H
1193 AC_CHECK_HEADERS(unistd.h)
1194 dnl defines HAVE_WCHAR_H
1195 AC_CHECK_HEADERS(wchar.h)
1196 dnl defines HAVE_WCSTR_H
1197 AC_CHECK_HEADERS(wcstr.h)
1198 dnl defines HAVE_FNMATCH_H
1199 AC_CHECK_HEADERS(fnmatch.h)
1200 dnl defines HAVE_X11_XKBLIB_H
1201 AC_CHECK_HEADERS(X11/XKBlib.h)
1202
1203 dnl ---------------------------------------------------------------------------
1204 dnl Checks for typedefs
1205 dnl ---------------------------------------------------------------------------
1206
1207 dnl   defines mode_t if not already defined
1208 AC_TYPE_MODE_T
1209 dnl   defines off_t if not already defined
1210 AC_TYPE_OFF_T
1211 dnl   defines pid_t if not already defined
1212 AC_TYPE_PID_T
1213 dnl   defines size_t if not already defined
1214 AC_TYPE_SIZE_T
1215 dnl   defines uid_t and gid_t if not already defined
1216 AC_TYPE_UID_T
1217
1218 dnl ---------------------------------------------------------------------------
1219 dnl Checks for structures
1220 dnl ---------------------------------------------------------------------------
1221
1222 dnl ---------------------------------------------------------------------------
1223 dnl Checks for compiler characteristics
1224 dnl ---------------------------------------------------------------------------
1225
1226 dnl defines const to be empty if c-compiler does not support const fully
1227 AC_C_CONST
1228 dnl defines inline to a sensible value for the c-compiler
1229 AC_C_INLINE
1230
1231 dnl check the sizes of integral types (give some reasonable default values for
1232 dnl cross-compiling)
1233 dnl   defines the size of certain types of variables in SIZEOF_<TYPE>
1234 AC_CHECK_SIZEOF(char, 1)
1235 AC_CHECK_SIZEOF(short, 2)
1236 AC_CHECK_SIZEOF(int *, 4)
1237 AC_CHECK_SIZEOF(int, 4)
1238 AC_CHECK_SIZEOF(long, 4)
1239 AC_CHECK_SIZEOF(long long, 0)
1240
1241 dnl for bytesex stuff (don't use AC_C_BIGENDIAN to allow cross-compiling)
1242 WX_C_BIGENDIAN
1243
1244 dnl check for iostream (as opposed to iostream.h) standard header
1245 WX_CPP_NEW_HEADERS(, AC_DEFINE(wxUSE_IOSTREAMH))
1246
1247 dnl check whether C++ compiler supports bool built-in type
1248 WX_CPP_BOOL
1249
1250 dnl check whether overloading on size_t/int parameter works
1251 WX_CPP_SIZE_T_IS_NOT_INT
1252
1253 dnl check whether we should define _GNU_SOURCE
1254 WX_GNU_EXTENSIONS
1255
1256 dnl ---------------------------------------------------------------------------
1257 dnl Check for functions
1258 dnl ---------------------------------------------------------------------------
1259
1260 dnl check for wcslen
1261 AC_CHECK_LIB(c, wcslen, [
1262             AC_DEFINE(HAVE_WCSLEN)
1263             WCHAR_LINK=""
1264         ], [
1265             AC_CHECK_LIB(w, wcslen, [
1266                 AC_DEFINE(HAVE_WCSLEN)
1267                 WCHAR_LINK="-lw"
1268             ])
1269         ])
1270
1271 dnl check for vprintf/vsprintf() which are GNU extensions
1272 AC_FUNC_VPRINTF
1273
1274 dnl check for vsnprintf() - a safe version of vsprintf()
1275 AC_CHECK_FUNCS(vsnprintf,
1276                AC_DEFINE(HAVE_VSNPRINTF),
1277                AC_MSG_WARN(unsafe function sprintf will be used instead of snprintf)
1278               )
1279
1280 dnl check for vsscanf() - on some platforms (Linux, glibc 2.1.1) it's
1281 dnl available in the library but the prototype is missing, so we can't use
1282 dnl AC_CHECK_FUNCS here, do it manually
1283 AC_LANG_SAVE
1284 AC_LANG_CPLUSPLUS
1285
1286 AC_CACHE_CHECK([for vsscanf], wx_cv_func_vsscanf,
1287 [
1288   AC_TRY_COMPILE(
1289              [
1290                 #include <stdio.h>
1291                 #include <stdarg.h>
1292              ],
1293              [
1294                 va_list ap;
1295                 vsscanf("", "", ap);
1296              ], [
1297                 wx_cv_func_vsscanf=yes
1298                 AC_DEFINE(HAVE_VSSCANF)
1299              ], [
1300                 wx_cv_func_vsscanf=no
1301              ])
1302 ])
1303
1304 AC_LANG_RESTORE
1305
1306 dnl check for vfork() (even if it's the same as fork() in modern Unices)
1307 AC_CHECK_FUNCS(vfork)
1308
1309 POSIX4_LINK=
1310 AC_CHECK_FUNCS(nanosleep, AC_DEFINE(HAVE_NANOSLEEP), [
1311     AC_CHECK_LIB(posix4, nanosleep, [
1312       AC_DEFINE(HAVE_NANOSLEEP)
1313       POSIX4_LINK="-lposix4"
1314     ], [
1315     AC_CHECK_FUNCS(usleep,
1316         AC_DEFINE(HAVE_USLEEP),
1317         AC_MSG_WARN([wxSleep() function will not work]))
1318     ])
1319 ])
1320
1321 dnl check for uname (POSIX) and gethostname (BSD)
1322 AC_CHECK_FUNCS(uname gethostname, break)
1323
1324 dnl ===========================================================================
1325 dnl Now we have all the info we need - use it!
1326 dnl ===========================================================================
1327
1328 dnl flush the cache
1329 AC_CACHE_SAVE
1330
1331 dnl ---------------------------------------------------------------------------
1332 dnl thread support for Unix (always available under Win32)
1333 dnl ---------------------------------------------------------------------------
1334
1335 if test "$USE_UNIX" = 1; then
1336
1337 dnl the code below:
1338 dnl   defines THREADS_OBJ which contains the object files to build
1339 dnl   defines THREADS_LINK which contains the thread library to link with
1340 dnl   defines wxUSE_THREADS=1 if thread support is activated
1341
1342 THREADS_LINK=""
1343 THREADS_OBJ=""
1344
1345 if test "$wxUSE_THREADS" = "yes" ; then
1346     if test "$wxUSE_WINE" = 1 ; then
1347         AC_MSG_WARN([Threads are not supported under WINE])
1348         wxUSE_THREADS="no"
1349     fi
1350 fi
1351
1352 if test "$wxUSE_THREADS" = "yes" ; then
1353     dnl find if POSIX threads are available
1354     
1355     dnl standard lib name is pthread
1356     dnl We no longer test for pthread-0.7 as it breaks compilation on some
1357     dnl glibc2 systems, especially for static linkage.
1358     AC_CHECK_LIB(pthread, pthread_create, [
1359             THREADS_OBJ="threadpsx.lo"
1360             THREADS_LINK="pthread"
1361         ], [
1362             dnl thread functions are in libc_r under FreeBSD
1363             AC_CHECK_LIB(c_r, pthread_create, [
1364                 THREADS_OBJ="threadpsx.lo"
1365                 THREADS_LINK="c_r"
1366             ], [
1367                 dnl VZ: SGI threads are not supported currently
1368                 AC_CHECK_HEADER(sys/prctl.h, [
1369                     THREADS_OBJ="threadsgi.lo"
1370                 ])
1371             ])
1372         ])
1373
1374     if test -z "$THREADS_OBJ" ; then
1375         wxUSE_THREADS=no
1376         AC_MSG_WARN(No thread support on this system)
1377     fi
1378 fi
1379
1380 dnl do other tests only if we are using threads
1381 if test "$wxUSE_THREADS" = "yes" ; then
1382   dnl  LTLIBOBJS="$LTLIBOBJS $THREADS_OBJ"
1383
1384   dnl define autoconf macro to check for given function in both pthread and
1385   dnl posix4 libraries
1386   dnl usage: AC_FUNC_THREAD(FUNCTION_NAME)
1387   dnl VZ: TODO
1388   dnl AC_DEFUN(AC_FUNC_THREAD,
1389   dnl [
1390   dnl     AC_CHECK_LIB($THREADS_LINK, $1,
1391   dnl            AC_DEFINE(HAVE_`'translit($1, `A-Z', 'a-z'),
1392   dnl            [AC_CHECK_LIB("posix4", $1,
1393   dnl                [AC_DEFINE(HAVE_`'translit($1, `A-Z', 'a-z'))
1394   dnl                 POSIX4_LINK="-lposix4"
1395   dnl             ])
1396   dnl            ])
1397   dnl ])
1398
1399   AC_CHECK_HEADERS(sched.h)
1400
1401   AC_CHECK_LIB($THREADS_LINK, sched_yield,
1402                AC_DEFINE(HAVE_SCHED_YIELD),
1403                [AC_CHECK_LIB("posix4", sched_yield,
1404                    [AC_DEFINE(HAVE_SCHED_YIELD) POSIX4_LINK="-lposix4"],
1405                    AC_MSG_WARN(wxThread::Yield will not work properly)
1406                 )]
1407                )
1408
1409   dnl VZ: we should be checking for all of the following functions instead:
1410   dnl   1. pthread_attr_getschedpolicy
1411   dnl   2. sched_get_priority_min and sched_get_priority_max
1412   dnl   3. pthread_attr_getschedparam and pthread_attr_setschedparam
1413   dnl but it seems that if the first one is there, the other ones are too (of
1414   dnl course the proper solution would be to implement AC_FUNC_THREAD above
1415   dnl and do test for them all - anyone?)
1416   AC_CHECK_LIB($THREADS_LINK, pthread_attr_getschedpolicy,
1417                AC_DEFINE(HAVE_THREAD_PRIORITY_FUNCTIONS),
1418                [AC_CHECK_LIB("posix4", pthread_attr_getschedpolicy,
1419                    [AC_DEFINE(HAVE_THREAD_PRIORITY_FUNCTIONS) POSIX4_LINK="-lposix4"],
1420                    AC_MSG_WARN(Setting thread priority will not work)
1421                 )]
1422                )
1423
1424   AC_CHECK_LIB($THREADS_LINK, pthread_cancel,
1425                AC_DEFINE(HAVE_PTHREAD_CANCEL),
1426                AC_MSG_WARN([wxThread::Kill() will not work properly]))
1427
1428   AC_CACHE_CHECK([for pthread_cleanup_push/pop], wx_cv_func_pthread_cleanup_push,
1429   [
1430     AC_TRY_COMPILE([#include <pthread.h>],
1431                  [
1432                     pthread_cleanup_push(NULL, NULL);
1433                     pthread_cleanup_pop(0);
1434                  ], [
1435                     wx_cv_func_pthread_cleanup_push=yes
1436                     AC_DEFINE(HAVE_THREAD_CLEANUP_FUNCTIONS)
1437                  ], [
1438                     wx_cv_func_pthread_cleanup_push=no
1439                  ])
1440   ])
1441
1442   THREADS_LINK="-l$THREADS_LINK"
1443 fi
1444
1445 dnl from if USE_UNIX
1446 fi
1447
1448 if test "$wxUSE_THREADS" = "yes"; then
1449   AC_DEFINE(wxUSE_THREADS)
1450
1451   dnl must define _REENTRANT for multithreaded code
1452   CFLAGS="${CFLAGS} -D_REENTRANT"
1453   CXXFLAGS="${CXXFLAGS} -D_REENTRANT"
1454
1455   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS thread"
1456 fi
1457
1458 if test "$WXGTK12" = 1 ; then
1459   AC_DEFINE_UNQUOTED(__WXGTK12__,$WXGTK12)
1460 fi
1461
1462 if test "$WXWINE" = 1 ; then
1463   TOOLKIT_DEF="${TOOLKIT_DEF} -D__WXWINE__"
1464 fi
1465
1466 if test "$wxUSE_CYGWIN" = 1 ; then
1467   TOOLKIT_DEF="${TOOLKIT_DEF} -D__WIN95__"
1468 fi
1469
1470 WXDEBUG=
1471 if test "$wxUSE_DEBUG_GDB" = "yes" ; then
1472     wxUSE_DEBUG_INFO=yes
1473     WXDEBUG="-ggdb"
1474 fi
1475
1476 if test "$wxUSE_DEBUG_INFO" = "yes" ; then
1477     WXDEBUG="-g"
1478     wxUSE_OPTIMISE=no
1479 fi
1480
1481 if test "$wxUSE_DEBUG_FLAG" = "yes" ; then
1482     AC_DEFINE(WXDEBUG)
1483     WXDEBUG_DEFINE="-D__WXDEBUG__"
1484 else
1485     if test "$wxUSE_GTK" = 1 ; then
1486         WXDEBUG_DEFINE="-DGTK_NO_CHECK_CASTS"
1487     fi
1488 fi
1489
1490 if test "$wxUSE_MEM_TRACING" = "yes" ; then
1491     AC_DEFINE(wxUSE_MEMORY_TRACING)
1492     AC_DEFINE(wxUSE_GLOBAL_MEMORY_OPERATORS)
1493     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS memcheck"
1494 fi
1495
1496 if test "$wxUSE_DMALLOC" = "yes" ; then
1497     DMALLOC_LINK="-ldmalloc"
1498 fi
1499
1500 PROFILE=
1501 if test "$wxUSE_PROFILE" = "yes" ; then
1502     PROFILE="-pg"
1503 fi
1504
1505 if test "$GCC" = yes ; then
1506     if test "$wxUSE_NO_RTTI" = "yes" ; then
1507         WXDEBUG_DEFINE="$WXDEBUG_DEFINE -fno-rtti"
1508     fi
1509     if test "$wxUSE_NO_EXCEPTIONS" = "yes" ; then
1510         WXDEBUG_DEFINE="$WXDEBUG_DEFINE -fno-exceptions"
1511     fi
1512 fi  
1513           
1514           
1515 CXXFLAGS=`echo "${CXXFLAGS}" | sed "s/\-O.//g" `
1516 CFLAGS=`echo "${CFLAGS}" | sed "s/\-O.//g" `
1517 if test "$wxUSE_OPTIMISE" = "no" ; then
1518     OPTIMISE=
1519 else
1520     if test "$GCC" = yes ; then
1521         OPTIMISE="-O2"
1522         case "${host}" in
1523             i586-*-*|i686-*-* )
1524             OPTIMISE="${OPTIMISE} "
1525         ;;
1526         esac
1527     else
1528         OPTIMISE="-O"
1529     fi
1530 fi
1531
1532 dnl ---------------------------------------------------------------------------
1533 dnl Optional libraries
1534 dnl ---------------------------------------------------------------------------
1535
1536 ZLIB_INCLUDE=
1537 if test "$wxUSE_ZLIB" = "yes" ; then
1538   AC_DEFINE(wxUSE_ZLIB)
1539   EXTRA_VPATH="$EXTRA_VPATH:\${srcdir}/../zlib"
1540   ZLIB_INCLUDE="-I\${srcdir}/../zlib"
1541   LTLIBOBJS="$LTLIBOBJS adler32.lo compress.lo crc32.lo gzio.lo uncompr.lo deflate.lo \
1542                         trees.lo zutil.lo inflate.lo infblock.lo inftrees.lo infcodes.lo \
1543                         infutil.lo inffast.lo"
1544 fi
1545
1546 PNG_INCLUDE=
1547 if test "$wxUSE_LIBPNG" = "yes" ; then
1548   AC_DEFINE(wxUSE_LIBPNG)
1549   LTLIBOBJS="$LTLIBOBJS png.lo pngset.lo pngget.lo pngrutil.lo pngtrans.lo pngwutil.lo \
1550                         pngread.lo pngrio.lo pngwio.lo pngwrite.lo pngrtran.lo pngwtran.lo \
1551                         pngmem.lo pngerror.lo pngpread.lo"
1552   EXTRA_VPATH="$EXTRA_VPATH:\${srcdir}/../png"
1553   PNG_INCLUDE="-I\${srcdir}/../png"
1554   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS png"
1555 fi
1556
1557 if test "$wxUSE_LIBGIF" = "yes" ; then
1558   AC_DEFINE(wxUSE_LIBGIF)
1559 fi
1560
1561 JPEG_INCLUDE=
1562 if test "$wxUSE_LIBJPEG" = "yes" ; then
1563   AC_DEFINE(wxUSE_LIBJPEG)
1564   EXTRA_VPATH="$EXTRA_VPATH:\${srcdir}/../jpeg"
1565   JPEG_INCLUDE="-I\${srcdir}/../jpeg"
1566   LTLIBOBJS="$LTLIBOBJS \
1567              jcomapi.lo jutils.lo jerror.lo jmemmgr.lo jmemnobs.lo \
1568              jcapimin.lo jcapistd.lo jctrans.lo jcparam.lo jdatadst.lo \
1569              jcinit.lo jcmaster.lo jcmarker.lo jcmainct.lo jcprepct.lo \
1570              jccoefct.lo jccolor.lo jcsample.lo jchuff.lo jcphuff.lo \
1571              jcdctmgr.lo jfdctfst.lo jfdctflt.lo jfdctint.lo \
1572              jdapimin.lo jdapistd.lo jdtrans.lo jdatasrc.lo \
1573              jdmaster.lo jdinput.lo jdmarker.lo jdhuff.lo jdphuff.lo \
1574              jdmainct.lo jdcoefct.lo jdpostct.lo jddctmgr.lo jidctfst.lo \
1575              jidctflt.lo jidctint.lo jidctred.lo jdsample.lo jdcolor.lo \
1576              jquant1.lo jquant2.lo jdmerge.lo"
1577 fi
1578
1579 if test "$wxUSE_OPENGL" = "yes"; then
1580   AC_CHECK_HEADER(GL/gl.h, [
1581     AC_CHECK_LIB(GL, glInitNames, [
1582       OPENGL_LINK="-lGL"
1583       AC_DEFINE(wxUSE_OPENGL)
1584       UTILS_SUBDIRS="$UTILS_SUBDIRS glcanvas/src"
1585     ],[
1586         AC_CHECK_LIB(MesaGL, glInitNames, [
1587         OPENGL_LINK="-lMesaGL"
1588         AC_DEFINE(wxUSE_OPENGL)
1589         UTILS_SUBDIRS="$UTILS_SUBDIRS glcanvas/src"
1590       ],wxUSE_OPENGL=0)
1591      ],wxUSE_OPENGL=0)
1592     ],wxUSE_OPENGL=0)
1593 fi
1594
1595 dnl ---------------------------------------------------------------------------
1596 dnl the library may be built without GUI classes at all
1597 dnl ---------------------------------------------------------------------------
1598
1599 if test "$wxUSE_GUI" = "yes"; then
1600   AC_DEFINE(wxUSE_GUI)
1601
1602   dnl the things we always pull in the GUI version of the library:
1603   dnl 1. basic things like wxApp, wxWindow, wxControl, wxFrame, wxDialog (the
1604   dnl    library really can't be built without those)
1605   dnl 2. basic controls: wxButton, wxStaticText, wxTextCtrl (these are used in
1606   dnl    almost any program and the first 2 are needed to show a message box
1607   dnl    which want to be always able to do)
1608   dnl 3. GDI stuff: icon, cursors and all that. Although it would be very nice
1609   dnl    to compile without them (if the app doesn't do any drawing, it doesn't
1610   dnl    need the dcs, pens, brushes, ...), this just can't be done now
1611   dnl 4. menu stuff: wxMenu, wxMenuBar, wxMenuItem
1612   dnl 5. misc stuff: timers, settings, message box
1613   dnl   LTLIBOBJS="$LTLIBOBJS \
1614   dnl main.lo app.lo event.lo wincmn.lo window.lo control.lo framecmn.lo frame.lo dialog.lo panelg.lo \
1615   dnl button.lo stattext.lo textctrl.lo \
1616   dnl bitmap.lo brush.lo colour.lo cursor.lo data.lo dc.lo dcbase.lo dcclient.lo \
1617   dnl dcmemory.lo dcscreen.lo font.lo gdicmn.lo gdiobj.lo icon.lo palette.lo pen.lo region.lo \
1618   dnl menu.lo \
1619   dnl settings.lo timer.lo msgdlgg.lo"
1620 else
1621   AC_DEFINE(wxUSE_NOGUI)
1622 fi
1623
1624 dnl ---------------------------------------------------------------------------
1625 dnl Unix/Windows
1626 dnl ---------------------------------------------------------------------------
1627
1628 if test "$wxUSE_UNIX" = "yes"; then
1629   AC_DEFINE(wxUSE_UNIX)
1630 fi
1631
1632 dnl ---------------------------------------------------------------------------
1633 dnl Register non-GUI class options for makefiles and setup.h
1634 dnl ---------------------------------------------------------------------------
1635
1636 if test "$wxUSE_APPLE_IEEE" = "yes"; then
1637   AC_DEFINE(wxUSE_APPLE_IEEE)
1638 fi
1639
1640 if test "$wxUSE_TIMEDATE" = "yes"; then
1641   AC_DEFINE(wxUSE_TIMEDATE)
1642   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS typetest"
1643 fi
1644
1645 if test "$wxUSE_WAVE" = "yes"; then
1646   AC_DEFINE(wxUSE_WAVE)
1647 fi
1648
1649 if test "$wxUSE_FILE" = "yes"; then
1650   AC_DEFINE(wxUSE_FILE)
1651 fi
1652
1653 if test "$wxUSE_FS_INET" = "yes"; then
1654   AC_DEFINE(wxUSE_FS_INET)
1655 fi
1656
1657 if test "$wxUSE_FS_ZIP" = "yes"; then
1658   AC_DEFINE(wxUSE_FS_ZIP)
1659 fi
1660
1661 if test "$wxUSE_ZIPSTREAM" = "yes"; then
1662   AC_DEFINE(wxUSE_ZIPSTREAM)
1663 fi
1664
1665 if test "$wxUSE_BUSYINFO" = "yes"; then
1666   AC_DEFINE(wxUSE_BUSYINFO)
1667 fi
1668
1669 if test "$wxUSE_STD_IOSTREAM" = "yes"; then
1670   AC_DEFINE(wxUSE_STD_IOSTREAM)
1671 fi
1672
1673 if test "$wxUSE_TEXTFILE" = "yes"; then
1674   if test "$wxUSE_FILE" != "yes"; then
1675     AC_MSG_WARN(wxTextFile requires wxFile and it won't be compiled without it)
1676   else
1677     AC_DEFINE(wxUSE_TEXTFILE)
1678   fi
1679 fi
1680
1681 if test "$wxUSE_CONFIG" = "yes" ; then
1682   if test "$wxUSE_TEXTFILE" != "yes"; then
1683     AC_MSG_WARN(wxConfig requires wxTextFile and it won't be compiled without it)
1684   else
1685     AC_DEFINE(wxUSE_CONFIG)
1686     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS config"
1687   fi
1688 fi
1689
1690 if test "$wxUSE_INTL" = "yes" ; then
1691   if test "$wxUSE_FILE" != "yes"; then
1692     AC_MSG_WARN(I18n code requires wxFile and it won't be compiled without it)
1693   else
1694     AC_DEFINE(wxUSE_INTL)
1695     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS internat"
1696   fi
1697 fi
1698
1699 if test "$wxUSE_LOG" = "yes"; then
1700   AC_DEFINE(wxUSE_LOG)
1701 fi
1702
1703 if test "$wxUSE_LONGLONG" = "yes"; then
1704   AC_DEFINE(wxUSE_LONGLONG)
1705 fi
1706
1707 if test "$wxUSE_SOCKETS" = "yes" ; then
1708     if test "$wxUSE_THREADS" = "yes" ; then
1709         AC_DEFINE(wxUSE_SOCKETS)
1710         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS wxsocket"
1711         INCLUDE_SUBDIRS="$INCLUDE_SUBDIRS protocol"
1712     else
1713         AC_MSG_WARN(Socket classes require --with-threads and won't be compiled without it)
1714         wxUSE_SOCKETS=0
1715     fi
1716 fi
1717
1718 if test "$wxUSE_STREAMS" = "yes" ; then
1719   AC_DEFINE(wxUSE_STREAMS)
1720 fi
1721
1722 if test "$wxUSE_SERIAL" = "yes" ; then
1723   AC_DEFINE(wxUSE_SERIAL)
1724 fi
1725
1726 dnl ------------------------------------------------------------------------
1727 dnl wxSocket
1728 dnl ------------------------------------------------------------------------
1729
1730 if test "$wxUSE_SOCKETS" = "yes"; then
1731     AC_LANG_SAVE
1732     AC_LANG_CPLUSPLUS
1733     dnl determine the type of third argument for getsockname
1734     AC_MSG_CHECKING(the type of the third argument of getsockname)
1735     AC_TRY_COMPILE(
1736         [#include <sys/socket.h>],
1737         [socklen_t len; getsockname(0, NULL, &len);],
1738         AC_DEFINE(SOCKLEN_T, socklen_t) AC_MSG_RESULT(socklen_t),
1739            AC_TRY_COMPILE(
1740             [#include <sys/socket.h>],
1741             [size_t len; getsockname(0, NULL, &len);],
1742             AC_DEFINE(SOCKLEN_T, size_t) AC_MSG_RESULT(size_t),
1743             AC_TRY_COMPILE(
1744                 [#include <sys/socket.h>],
1745                 [int len; getsockname(0, NULL, &len);],
1746                 AC_DEFINE(SOCKLEN_T, int) AC_MSG_RESULT(int),
1747             AC_MSG_RESULT(unknown)
1748         )
1749         )
1750     )
1751     AC_LANG_RESTORE
1752 fi
1753
1754 dnl ---------------------------------------------------------------------------
1755 dnl Joystick support
1756 dnl ---------------------------------------------------------------------------
1757
1758 if test "$wxUSE_JOYSTICK" = 1; then
1759   dnl joystick support is only for Linux 2.1.x or greater
1760   AC_CHECK_HEADERS(linux/joystick.h)
1761   if test "$ac_cv_header_linux_joystick_h" = "yes"; then
1762     AC_DEFINE(wxUSE_JOYSTICK)
1763     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS joytest"
1764   fi
1765 fi
1766
1767 dnl ------------------------------------------------------------------------
1768 dnl DLL support
1769 dnl ------------------------------------------------------------------------
1770
1771 HAVE_DL_FUNCS=0
1772 HAVE_SHL_FUNCS=0
1773 if test "$wxUSE_DYNLIB_CLASS" = "yes"; then
1774     dnl the test is a bit complicated because we check for dlopen() both with
1775     dnl and without -ldl
1776     AC_CHECK_FUNCS(dlopen,
1777         [AC_DEFINE(HAVE_DLOPEN) HAVE_DL_FUNCS=1],
1778         [AC_CHECK_LIB(dl, dlopen,
1779             [AC_DEFINE(HAVE_DLOPEN) HAVE_DL_FUNCS=1])])
1780     AC_CHECK_FUNCS( shl_load,
1781                     [AC_DEFINE(HAVE_SHL_LOAD) HAVE_DL_FUNCS=1 HAVE_SHL_FUNCS=1])
1782
1783     if test "$HAVE_DL_FUNCS" = 0; then
1784         if test "$USE_UNIX" = 1; then 
1785             AC_MSG_WARN("--with-dynlib and --with-odbc will be disabled due to missing shared library support")
1786             wxUSE_ODBC=no
1787             wxUSE_DYNLIB_CLASS=no
1788         else
1789             AC_MSG_WARN("Cannot check dynlib requirements on non-Unix platforms. dynlib remains enabled.")
1790         fi    
1791     fi
1792 fi
1793
1794 if test "$wxUSE_DYNLIB_CLASS" = "yes" ; then
1795   AC_DEFINE(wxUSE_DYNLIB_CLASS)
1796 fi
1797
1798 dnl ---------------------------------------------------------------------------
1799 dnl String stuff
1800 dnl ---------------------------------------------------------------------------
1801
1802 if test "$wxUSE_UNICODE" = "yes" ; then
1803   AC_DEFINE(wxUSE_UNICODE)
1804 fi
1805
1806 if test "$wxUSE_WCSRTOMBS" = "yes" ; then
1807   AC_DEFINE(wxUSE_WCSRTOMBS)
1808 fi
1809
1810 if test "$wxUSE_wxUSE_EXPERIMENTAL_PRINTF" = "yes"; then
1811   AC_DEFINE(wxUSE_EXPERIMENTAL_PRINTF)
1812 fi
1813
1814 dnl ----------------------------------------------------------------
1815 dnl iODBC support
1816 dnl ----------------------------------------------------------------
1817
1818 IODBC_C_SRC=""
1819 if test "$wxUSE_ODBC" = "yes" ; then
1820   AC_DEFINE(wxUSE_ODBC)
1821   EXTRA_VPATH="$EXTRA_VPATH:\$(srcdir)/../iodbc"
1822   LTLIBOBJS="$LTLIBOBJS catalog.lo connect.lo dlf.lo dlproc.lo execute.lo fetch.lo hdbc.lo henv.lo herr.lo hstmt.lo info.lo itrace.lo misc.lo prepare.lo result.lo"
1823   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS db"
1824 fi
1825
1826 dnl ----------------------------------------------------------------
1827 dnl Register PostScript options for makefiles and setup.h
1828 dnl ----------------------------------------------------------------
1829
1830 if test "$wxUSE_POSTSCRIPT" = "yes" ; then
1831   AC_DEFINE(wxUSE_POSTSCRIPT)
1832 fi
1833
1834 AC_DEFINE(wxUSE_AFM_FOR_POSTSCRIPT)
1835
1836 AC_DEFINE(wxUSE_NORMALIZED_PS_FONTS)
1837
1838 dnl ---------------------------------------------------------------------------
1839 dnl big GUI components: MDI, doc/view, printing, help, ...
1840 dnl ---------------------------------------------------------------------------
1841
1842 if test "$wxUSE_CONSTRAINTS" = "yes"; then
1843     AC_DEFINE(wxUSE_CONSTRAINTS)
1844     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS layout"
1845 fi
1846
1847 if test "$wxUSE_MDI_ARCHITECTURE" = "yes"; then
1848     AC_DEFINE(wxUSE_MDI_ARCHITECTURE)
1849     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS mdi"
1850 fi
1851
1852 if test "$wxUSE_DOC_VIEW_ARCHITECTURE" = "yes" ; then
1853     AC_DEFINE(wxUSE_DOC_VIEW_ARCHITECTURE)
1854     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS docview"
1855     if test "$wxUSE_MDI_ARCHITECTURE" = "yes"; then
1856         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS docvwmdi"
1857     fi
1858 fi
1859
1860 if test "$wxUSE_HELP" = "yes"; then
1861     AC_DEFINE(wxUSE_HELP)
1862     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS help"
1863 fi
1864
1865 if test "$wxUSE_PRINTING_ARCHITECTURE" = "yes" ; then
1866     if test "$wxUSE_CONSTRAINTS" != "yes"; then
1867         AC_MSG_WARN(Printing support cannot be used without constraints so it won't be compiled without it)
1868     else
1869         AC_DEFINE(wxUSE_PRINTING_ARCHITECTURE)
1870     fi
1871     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS printing"
1872 fi
1873
1874 if test "$wxUSE_PROLOGIO" = "yes" ; then
1875     AC_DEFINE(wxUSE_PROLOGIO)
1876 fi
1877
1878 if test "$wxUSE_RESOURCES" = "yes" ; then
1879     if test "$wxUSE_PROLOGIO" = "yes" ; then
1880         AC_DEFINE(wxUSE_RESOURCES)
1881         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS resource"
1882     else
1883         AC_MSG_WARN([wxWindows ressource system requires PrologIO and can't be compiled without it.])
1884     fi
1885 fi
1886
1887 if test "$wxUSE_X_RESOURCES" = "yes"; then
1888     AC_DEFINE(wxUSE_X_RESOURCES)
1889 fi
1890
1891 dnl ---------------------------------------------------------------------------
1892 dnl IPC: IPC, Drag'n'Drop, Clipboard, ...
1893 dnl ---------------------------------------------------------------------------
1894
1895 if test "$wxUSE_IPC" = "yes"; then
1896     AC_DEFINE(wxUSE_IPC)
1897 fi
1898
1899 if test "$wxUSE_CLIPBOARD" = "yes"; then
1900     AC_DEFINE(wxUSE_CLIPBOARD)
1901 fi
1902
1903 if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then
1904     if test "$wxUSE_GTK" = 1; then
1905         if test "$WXGTK12" != 1; then
1906             AC_MSG_WARN([Drag and drop is only supported under wxGTK 2.1])
1907             wxUSE_DRAG_AND_DROP=no
1908         fi
1909     fi
1910
1911     if test "$wxUSE_MOTIF" = 1; then
1912         AC_MSG_WARN([Drag and drop is not yet supported under Motif])
1913         wxUSE_DRAG_AND_DROP=no
1914     fi
1915
1916     if test "$wxUSE_DRAG_AND_DROP" = "yes"; then
1917         AC_DEFINE(wxUSE_DRAG_AND_DROP)
1918         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dnd"
1919     fi
1920 fi
1921
1922 if test "$wxUSE_SPLINES" = "yes" ; then
1923   AC_DEFINE(wxUSE_SPLINES)
1924 fi
1925
1926 dnl ---------------------------------------------------------------------------
1927 dnl GUI controls
1928 dnl ---------------------------------------------------------------------------
1929
1930 if test "$wxUSE_ACCEL" = "yes"; then
1931   AC_DEFINE(wxUSE_ACCEL)
1932 fi
1933
1934 if test "$wxUSE_CARET" = "yes"; then
1935   AC_DEFINE(wxUSE_CARET)
1936   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS caret"
1937 fi
1938
1939 if test "$wxUSE_COMBOBOX" = "yes"; then
1940   AC_DEFINE(wxUSE_COMBOBOX)
1941 fi
1942
1943 if test "$wxUSE_CHOICE" = "yes"; then
1944   AC_DEFINE(wxUSE_CHOICE)
1945 fi
1946
1947 if test "$wxUSE_BMPBUTTON" = "yes"; then
1948   AC_DEFINE(wxUSE_BMPBUTTON)
1949 fi
1950
1951 if test "$wxUSE_CHECKBOX" = "yes"; then
1952   AC_DEFINE(wxUSE_CHECKBOX)
1953 fi
1954
1955 if test "$wxUSE_CHECKLST" = "yes"; then
1956   AC_DEFINE(wxUSE_CHECKLISTBOX)
1957   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS checklst"
1958 fi
1959
1960 if test "$wxUSE_GAUGE" = "yes"; then
1961   AC_DEFINE(wxUSE_GAUGE)
1962 fi
1963
1964 if test "$wxUSE_GRID" = "yes"; then
1965   AC_DEFINE(wxUSE_GRID)
1966   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS grid"
1967 fi
1968
1969 if test "$wxUSE_IMAGLIST" = "yes"; then
1970     AC_DEFINE(wxUSE_IMAGLIST)
1971 fi
1972
1973 if test "$wxUSE_LISTBOX" = "yes"; then
1974     AC_DEFINE(wxUSE_LISTBOX)
1975 fi
1976
1977 if test "$wxUSE_LISTCTRL" = "yes"; then
1978     if test "$wxUSE_IMAGLIST" = "yes"; then
1979         AC_DEFINE(wxUSE_LISTCTRL)
1980         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS listctrl"
1981     else
1982         AC_MSG_WARN([wxListCtrl requires wxImageList and won't be compiled without it])
1983     fi
1984 fi
1985
1986 if test "$wxUSE_NOTEBOOK" = "yes"; then
1987     AC_DEFINE(wxUSE_NOTEBOOK)
1988     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS notebook"
1989 fi
1990
1991 if test "$wxUSE_RADIOBOX" = "yes"; then
1992     AC_DEFINE(wxUSE_RADIOBOX)
1993 fi
1994
1995 if test "$wxUSE_RADIOBTN" = "yes"; then
1996     AC_DEFINE(wxUSE_RADIOBTN)
1997 fi
1998
1999 if test "$wxUSE_SASH" = "yes"; then
2000     AC_DEFINE(wxUSE_SASH)
2001     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS sashtest"
2002 fi
2003
2004 if test "$wxUSE_SCROLLBAR" = "yes"; then
2005     AC_DEFINE(wxUSE_SCROLLBAR)
2006     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS scroll"
2007 fi
2008
2009 if test "$wxUSE_SLIDER" = "yes"; then
2010     AC_DEFINE(wxUSE_SLIDER)
2011 fi
2012
2013 if test "$wxUSE_SPINBTN" = "yes"; then
2014     AC_DEFINE(wxUSE_SPINBTN)
2015 fi
2016
2017 if test "$wxUSE_SPLITTER" = "yes"; then
2018     AC_DEFINE(wxUSE_SPLITTER)
2019     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS splitter"
2020 fi
2021
2022 if test "$wxUSE_STATBMP" = "yes"; then
2023     AC_DEFINE(wxUSE_STATBMP)
2024 fi
2025
2026 if test "$wxUSE_STATBOX" = "yes"; then
2027     AC_DEFINE(wxUSE_STATBOX)
2028 fi
2029
2030 if test "$wxUSE_STATLINE" = "yes"; then
2031     if test "$wxUSE_WINE" = 1 ; then
2032         AC_MSG_WARN([wxStaticLine is not supported under WINE])
2033     else
2034         if test "$wxUSE_MOTIF" = 1 ; then
2035             AC_MSG_WARN([wxStaticLine is not supported under Motif])
2036         else
2037             AC_DEFINE(wxUSE_STATLINE)
2038         fi
2039     fi
2040 fi
2041
2042 if test "$wxUSE_STATUSBAR" = "yes"; then
2043     AC_DEFINE(wxUSE_STATUSBAR)
2044 fi
2045
2046 if test "$wxUSE_TABDIALOG" = "yes"; then
2047     AC_DEFINE(wxUSE_TAB_DIALOG)
2048     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS tab"
2049 fi
2050
2051 if test "$wxUSE_TOOLBAR" = "yes"; then
2052     AC_DEFINE(wxUSE_TOOLBAR)
2053     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS toolbar"
2054 fi
2055
2056 if test "$wxUSE_TOOLTIPS" = "yes"; then
2057     if test "$wxUSE_MOTIF" = 1; then
2058         AC_MSG_WARN(wxTooltip not supported yet under Motif)
2059     else
2060         if test "$wxUSE_WINE" = 1; then
2061             AC_MSG_WARN(wxTooltip not supported under WINE)
2062         else
2063             AC_DEFINE(wxUSE_TOOLTIPS)
2064         fi
2065     fi
2066 fi
2067
2068 if test "$wxUSE_TREECTRL" = "yes"; then
2069     if test "$wxUSE_IMAGLIST" = "yes"; then
2070         AC_DEFINE(wxUSE_TREECTRL)
2071         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS treectrl"
2072     else
2073         AC_MSG_WARN([wxTreeCtrl requires wxImageList and won't be compiled without it])
2074     fi
2075 fi
2076
2077 dnl ---------------------------------------------------------------------------
2078 dnl misc options
2079 dnl ---------------------------------------------------------------------------
2080
2081 dnl TODO this is unused for now...
2082 dnl if test "$wxUSE_WXTREE" = "yes"; then
2083 dnl   AC_DEFINE(wxUSE_WXTREE)
2084 dnl fi
2085
2086 if test "$wxUSE_METAFILE" = "yes"; then
2087     AC_DEFINE(wxUSE_METAFILE)
2088 fi
2089
2090 if test "$wxUSE_DIRDLG" = "yes"; then
2091     if test "$wxUSE_CONSTRAINTS" != "yes"; then
2092        AC_MSG_WARN(wxDirDialog requires constraints so it won't be compiled without them)
2093     else
2094         if test "$wxUSE_TREECTRL" != "yes"; then
2095             AC_MSG_WARN(wxDirDialog requires wxTreeCtrl so it won't be compiled without it)
2096         else
2097             AC_DEFINE(wxUSE_DIRDLG)
2098         fi
2099     fi
2100 fi
2101
2102 if test "$wxUSE_TEXTDLG" = "yes"; then
2103     AC_DEFINE(wxUSE_TEXTDLG)
2104 fi
2105
2106 if test "$wxUSE_STARTUP_TIPS" = "yes"; then
2107     if test "$wxUSE_CONSTRAINTS" != "yes"; then
2108        AC_MSG_WARN(Startup tips requires constraints and won't be compiled without them)
2109     else
2110         AC_DEFINE(wxUSE_STARTUP_TIPS)
2111     fi
2112 fi
2113
2114 if test "$wxUSE_PROGRESSDLG" = "yes"; then
2115     if test "$wxUSE_CONSTRAINTS" != "yes"; then
2116        AC_MSG_WARN(wxProgressDialog requires constraints so it won't be compiled without them)
2117     else
2118         AC_DEFINE(wxUSE_PROGRESSDLG)
2119     fi
2120 fi
2121
2122 if test "$wxUSE_MINIFRAME" = "yes"; then
2123     AC_DEFINE(wxUSE_MINIFRAME)
2124     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS minifram"
2125 fi
2126
2127 if test "$wxUSE_HTML" = "yes"; then
2128     AC_DEFINE(wxUSE_HTML)
2129     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS html"
2130     INCLUDE_SUBDIRS="$INCLUDE_SUBDIRS html"
2131 fi
2132
2133 if test "$wxUSE_VALIDATORS" = "yes"; then
2134     AC_DEFINE(wxUSE_VALIDATORS)
2135     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS validate"
2136 fi
2137
2138 dnl ---------------------------------------------------------------------------
2139 dnl Output the makefiles and such from the results found above
2140 dnl ---------------------------------------------------------------------------
2141
2142 dnl if we add wxUSE_GUI in the future, it might be handy to separate the libs
2143 dnl into GUI and non-GUI parts
2144 GUILIBS="$GUI_TK_LIBRARY $OPENGL_LINK $LIBPNG_LINK $ZLIB_LINK $TOOLKIT_LINK"
2145
2146 dnl all additional libraries (except wxWindows itself) we link with
2147 EXTRA_LIBS="$LIBS $POSIX4_LINK $WCHAR_LINK $THREADS_LINK $DMALLOC_LINK $GUILIBS"
2148
2149 dnl all the libraries needed to link wxWindows programs (when the library is not
2150 dnl yet installed)
2151 LIBS="\${top_builddir}/src/${TOOLKIT_DIR}/${WX_LIBRARY_NAME} $EXTRA_LIBS"
2152
2153 dnl all -I options we must pass to the compiler
2154 INCLUDES="-I. -I\${top_builddir}/include -I\${top_srcdir}/include $ZLIB_INCLUDE $PNG_INCLUDE $JPEG_INCLUDE $TOOLKIT_INCLUDE"
2155
2156 dnl C/C++ compiler options used to compile wxWindows
2157 if test "$GXX" = yes ; then
2158     dnl CXXWARNINGS="-Wall -W -Wcast-qual -Werror"
2159     CXXWARNINGS="-Wall"
2160     dnl there is one weird warning in docview.h:71 which prevents me from doing
2161     dnl this...
2162     dnl CXXWARNINGS="-Wall -Werror"
2163 fi
2164 EXTRA_CFLAGS="$WXDEBUG $PROFILE $OPTIMISE $INCLUDES"
2165
2166 CPPFLAGS="-I\${top_srcdir}/include $CPPFLAGS"
2167 CFLAGS="$CFLAGS $EXTRA_CFLAGS"
2168 CXXFLAGS="$CXXFLAGS $EXTRA_CFLAGS $CXXWARNINGS"
2169
2170 if test "$wxUSE_GUI" = "yes"; then
2171     dnl TODO add checks that these samples will really compile (i.e. all the
2172     dnl      library features they need are present)
2173
2174     dnl TODO some samples are never built so far:
2175     dnl      mfc, nativdlg, oleauto, ownerdrw, proplist
2176     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS bombs controls dialogs drawing dynamic \
2177                      forty fractal image wxpoem"
2178 fi
2179
2180 dnl for convenience, sort the files to build in alphabetical order
2181 dnl
2182 dnl another shell command to do it which might be faster but is less clear:
2183 dnl  LTLIBOBJS="`for obj in $LTLIBOBJS; do echo $obj; done | sort | sed 's@^@ @'`"
2184 LTLIBOBJS="`echo $LTLIBOBJS | tr -s ' ' | tr ' ' '\n' | sort | tr '\n' ' '`"
2185
2186 dnl for convenience, sort the samples in alphabetical order
2187 dnl
2188 dnl FIXME For some mysterious reasons, sometimes the directories are duplicated
2189 dnl       in this list - hence uniq. But normally, this shouldn't be needed!
2190 SAMPLES_SUBDIRS="`echo $SAMPLES_SUBDIRS | tr -s ' ' | tr ' ' '\n' | sort | uniq | tr '\n' ' '`"
2191
2192 dnl global options
2193 AC_SUBST(WX_MAJOR_VERSION_NUMBER)
2194 AC_SUBST(WX_MINOR_VERSION_NUMBER)
2195 AC_SUBST(WX_RELEASE_NUMBER)
2196 AC_SUBST(WX_LIBRARY_NAME)
2197 AC_SUBST(WX_LIBRARY)
2198
2199 dnl suppress libtool's informational messages - they duplicate its command line
2200 LIBTOOL="$LIBTOOL --silent"
2201 AC_SUBST(LIBTOOL)
2202
2203 dnl debugging options
2204 AC_SUBST(WXDEBUG_DEFINE)
2205
2206 dnl toolkit options
2207 AC_SUBST(TOOLKIT)
2208 AC_SUBST(TOOLKIT_DEF)
2209 AC_SUBST(TOOLKIT_DIR)
2210 AC_SUBST(TOOLKIT_INCLUDE)
2211
2212 dnl additional sources
2213 AC_SUBST(EXTRA_VPATH)
2214 AC_SUBST(LTLIBOBJS)
2215
2216 dnl additional subdirectories where we will build
2217 AC_SUBST(SRC_SUBDIRS)
2218 AC_SUBST(INCLUDE_SUBDIRS)
2219 AC_SUBST(UTILS_SUBDIRS)
2220 AC_SUBST(DOCS_SUBDIRS)
2221 AC_SUBST(SAMPLES_SUBDIRS)
2222 AC_SUBST(USER_SUBDIRS)
2223
2224 dnl additional libraries
2225 AC_SUBST(EXTRA_LIBS)
2226 AC_SUBST(LIBS)
2227
2228 dnl create the configuration header file from the template
2229 dnl
2230 dnl NB: automake can't work correctly if our header lives in a directory which
2231 dnl     is only determined at configure time, so we create it on the top-level
2232 dnl     and make a link to allow '#include "wx/setup.h"' to still work
2233 AM_CONFIG_HEADER(setup.h)
2234
2235 dnl MAKE_SET will be replaced with "MAKE=..." or nothing if make sets MAKE
2236 dnl itself (this is macro is required if SUBDIRS variable is used in Makefile.am
2237 dnl - and we do use it)
2238 AC_PROG_MAKE_SET
2239
2240 dnl create each of the files in the space separated list from the file.in
2241 dnl (the original file name may be overriden by appending another name after a
2242 dnl colon)
2243 AC_OUTPUT([
2244             wx-config
2245             makefile.unx
2246             Makefile
2247             src/Makefile
2248
2249 dnl just for testing, will remove soon (VZ)
2250 dnl             src/msw/Makefile
2251 dnl             include/Makefile include/wx/Makefile include/wx/generic/Makefile
2252 dnl             include/wx/msw/Makefile
2253 dnl             samples/Makefile samples/minimal/Makefile
2254
2255             src/gtk/Makefile
2256             src/motif/Makefile
2257             src/msw/Makefile
2258             include/Makefile
2259             include/wx/Makefile
2260             include/wx/generic/Makefile
2261             include/wx/gtk/Makefile
2262             include/wx/motif/Makefile
2263             include/wx/msw/Makefile
2264             include/wx/msw/gnuwin32/Makefile
2265             include/wx/msw/ctl3d/Makefile
2266             include/wx/protocol/Makefile
2267             include/wx/unix/Makefile
2268             include/wx/html/Makefile
2269             misc/Makefile
2270             misc/afm/Makefile
2271             misc/gs_afm/Makefile
2272             samples/Makefile
2273             samples/bombs/Makefile
2274             samples/caret/Makefile
2275             samples/checklst/Makefile
2276             samples/config/Makefile
2277             samples/controls/Makefile
2278             samples/db/Makefile
2279             samples/dialogs/Makefile
2280             samples/dnd/Makefile
2281             samples/docview/Makefile
2282             samples/docvwmdi/Makefile
2283             samples/drawing/Makefile
2284             samples/dynamic/Makefile
2285             samples/forty/Makefile
2286             samples/fractal/Makefile
2287             samples/grid/Makefile
2288             samples/help/Makefile
2289             samples/image/Makefile
2290             samples/internat/Makefile
2291             samples/layout/Makefile
2292             samples/listctrl/Makefile
2293             samples/mdi/Makefile
2294             samples/memcheck/Makefile
2295             samples/minifram/Makefile
2296             samples/minimal/Makefile
2297             samples/notebook/Makefile
2298             samples/png/Makefile
2299             samples/printing/Makefile
2300             samples/proplist/Makefile
2301             samples/resource/Makefile
2302             samples/sashtest/Makefile
2303             samples/scroll/Makefile
2304             samples/splitter/Makefile
2305             samples/text/Makefile
2306             samples/thread/Makefile
2307             samples/toolbar/Makefile
2308             samples/treectrl/Makefile
2309             samples/typetest/Makefile
2310             samples/validate/Makefile
2311             samples/wxpoem/Makefile
2312             samples/wxsocket/Makefile
2313             samples/html/Makefile
2314             samples/html/about/Makefile
2315             samples/html/help/Makefile
2316             samples/html/test/Makefile
2317             samples/html/printing/Makefile
2318             samples/html/widget/Makefile
2319             samples/html/virtual/Makefile
2320             samples/html/zip/Makefile
2321           ],
2322           [
2323             chmod +x wx-config
2324 dnl The following line is more elegant but test -e is not supported by all
2325 dnl test varieties.
2326 dnl            if test ! -e include/wx/${TOOLKIT_DIR}/setup.h; then
2327             cat include/wx/${TOOLKIT_DIR}/setup.h >/dev/null 2>&1
2328             if test $? != 0; then
2329               ${LN_S} `pwd`/setup.h include/wx/${TOOLKIT_DIR}/setup.h
2330             fi
2331           ],
2332           [
2333             LN_S="${ac_cv_prog_LN_S}"
2334             TOOLKIT_DIR="${TOOLKIT_DIR}"
2335           ]
2336          )
2337