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