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