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