]> git.saurik.com Git - wxWidgets.git/blobdiff - configure.in
added new files to be included in the installer
[wxWidgets.git] / configure.in
index 51dc45d4ea3580b08abcee4d0513a6598725731b..8a23a6d14d1681b66805e6de08f067c6e4105103 100644 (file)
@@ -11,90 +11,6 @@ dnl
 dnl Version: $Id$
 dnl ---------------------------------------------------------------------------
 
-dnl ---------------------------------------------------------------------------
-dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
-dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS. Uses variables
-dnl gtk_config_prefix and/or gtk_config_exec_prefix if defined.
-dnl ---------------------------------------------------------------------------
-dnl
-AC_DEFUN(AM_PATH_GTK,
-[
-  if test x$gtk_config_exec_prefix != x ; then
-     gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
-     if test x${GTK_CONFIG+set} != xset ; then
-        GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
-     fi
-  fi
-  if test x$gtk_config_prefix != x ; then
-     gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
-     if test x${GTK_CONFIG+set} != xset ; then
-        GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
-     fi
-  fi
-
-  AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
-  min_gtk_version=ifelse([$1], ,0.99.7,$1)
-  AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
-  no_gtk=""
-  if test "$GTK_CONFIG" != "no" ; then
-    GTK_CFLAGS=`$GTK_CONFIG --cflags`
-    GTK_LIBS=`$GTK_CONFIG --libs gthread`
-    ac_save_CFLAGS="$CFLAGS"
-    ac_save_LIBS="$LIBS"
-    CFLAGS="$CFLAGS $GTK_CFLAGS"
-    LIBS="$LIBS $GTK_LIBS"
-dnl
-dnl Now check if the installed GTK is sufficiently new. (Also sanity
-dnl checks the results of gtk-config to some extent)
-dnl
-    AC_TRY_RUN([
-#include <gtk/gtk.h>
-#include <gtk/gtkfeatures.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int
-main ()
-{
-  int major, minor, micro;
-
-  if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, &micro) != 3) {
-     printf("%s, bad version string\n", "$min_gtk_version");
-     exit(1);
-   }
-
-   if ((GTK_MAJOR_VERSION != gtk_major_version) ||
-       (GTK_MINOR_VERSION != gtk_minor_version) ||
-       (GTK_MICRO_VERSION != gtk_micro_version)) {
-     printf("Headers vs. library version mismatch!\n");
-     exit(1);
-   }
-
-   if (gtk_minor_version == 1) return FALSE;
-
-   return !((gtk_major_version > major) ||
-    ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
-    ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)));
-}
-],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
-     CFLAGS="$ac_save_CFLAGS"
-     LIBS="$ac_save_LIBS"
-  else
-     no_gtk=yes
-  fi
-  if test "x$no_gtk" = x ; then
-     AC_MSG_RESULT(yes)
-     ifelse([$2], , :, [$2])
-  else
-     AC_MSG_RESULT(no)
-     GTK_CFLAGS=""
-     GTK_LIBS=""
-     ifelse([$3], , :, [$3])
-  fi
-  AC_SUBST(GTK_CFLAGS)
-  AC_SUBST(GTK_LIBS)
-])
-
 dnl ===========================================================================
 dnl macros to find the a file in the list of include/lib paths
 dnl ===========================================================================
@@ -184,10 +100,10 @@ AC_DEFUN(WX_CPP_NEW_HEADERS,
 
     AC_CHECK_HEADERS(iostream)
 
-    if test "x$HAVE_IOSTREAM" = x ; then
-      ifelse([$2], , :, [$2])
-    else
+    if test "$ac_cv_header_iostream" = "yes" ; then
       ifelse([$1], , :, [$1])
+    else
+      ifelse([$2], , :, [$2])
     fi
 
     AC_LANG_RESTORE
@@ -216,7 +132,6 @@ AC_DEFUN(WX_CPP_BOOL,
         return 0;
       ],
       [
-        AC_DEFINE(HAVE_BOOL)
         wx_cv_cpp_bool=yes
       ],
       [
@@ -294,9 +209,9 @@ dnl   possible arguments are 'yes', 'no', or 'sys'
 dnl usage: WX_ARG_SYS_WITH(option, helpmessage, variable-name)
 AC_DEFUN(WX_ARG_SYS_WITH,
         [
-          AC_MSG_CHECKING("for --with-$1")
+          AC_MSG_CHECKING([for --with-$1])
           no_cache=0
-          AC_ARG_WITH($1, $2,
+          AC_ARG_WITH($1, [$2],
                       [
                         if test "$withval" = yes; then
                           ac_cv_use_$1='$3=yes'
@@ -339,9 +254,9 @@ dnl this macro checks for a command line argument and caches the result
 dnl usage: WX_ARG_WITH(option, helpmessage, variable-name)
 AC_DEFUN(WX_ARG_WITH,
         [
-          AC_MSG_CHECKING("for --with-$1")
+          AC_MSG_CHECKING([for --with-$1])
           no_cache=0
-          AC_ARG_WITH($1, $2,
+          AC_ARG_WITH($1, [$2],
                       [
                         if test "$withval" = yes; then
                           ac_cv_use_$1='$3=yes'
@@ -376,9 +291,9 @@ dnl like WX_ARG_WITH but uses AC_ARG_ENABLE instead of AC_ARG_WITH
 dnl usage: WX_ARG_ENABLE(option, helpmessage, variable-name)
 AC_DEFUN(WX_ARG_ENABLE,
         [
-          AC_MSG_CHECKING("for --enable-$1")
+          AC_MSG_CHECKING([for --enable-$1])
           no_cache=0
-          AC_ARG_ENABLE($1, $2,
+          AC_ARG_ENABLE($1, [$2],
                         [
                           if test "$enableval" = yes; then
                             ac_cv_use_$1='$3=yes'
@@ -409,32 +324,6 @@ AC_DEFUN(WX_ARG_ENABLE,
           fi
         ])
 
-dnl -
-dnl - GNU libc extension (added by GL)
-dnl -
-
-AC_DEFUN(WX_GNU_EXTENSIONS,
-[
-AC_MSG_CHECKING([if you need GNU extensions])
-AC_CACHE_VAL(wx_cv_gnu_extensions,[
-   AC_TRY_COMPILE([#include <features.h>],[
-
-#ifndef __GNU_LIBRARY__
- Compile error wanted
-#endif
-
-],
-  [wx_cv_gnu_extensions=yes],
-  [wx_cv_gnu_extensions=no])
-])
-
-AC_MSG_RESULT($wx_cv_gnu_extensions)
-if test "$wx_cv_gnu_extensions" = "yes"; then
-  AC_DEFINE_UNQUOTED(_GNU_SOURCE)
-fi
-])
-
-
 dnl ---------------------------------------------------------------------------
 dnl initialization
 dnl ---------------------------------------------------------------------------
@@ -448,27 +337,39 @@ AC_CANONICAL_SYSTEM
 dnl When making releases do:
 dnl
 dnl WX_RELEASE_NUMBER += 1
-dnl WX_INTERFACE_AGE += 1
-dnl WX_BINARY_AGE += 1
 dnl
-dnl if any functions have been added, do:
+dnl ..and update WX_CURRENT, WX_RELEASE and WX_AGE according to the
+dnl following rules:
+dnl
+dnl    If any changes have been made to the public interface, that is if any
+dnl    exported class, method, global or global type has been added, removed
+dnl    or changed in any way, then do:  WX_CURRENT += 1
+dnl
+dnl    If source changes have been made that *do not* alter the public
+dnl    interface then do:  WX_REVISION += 1
+dnl    If WX_CURRENT was incremented (as above) instead do:  WX_REVISION = 0
+dnl
+dnl    If any public interface was added, do:  WX_AGE += 1
+dnl    If any public interface was removed (or altered in a way effectively
+dnl    removing the previous definition), instead do:  WX_AGE = 0
+dnl
+dnl When the major or minor version numbers are incremented, all the above
+dnl variables should be reset to 0.
 dnl
-dnl WX_INTERFACE_AGE = 0
+dnl The resulting library name will be of the form:
+dnl   libwx_$(TOOLKIT)-$(WX_RELEASE).so.$(WX_CURRENT).$(WX_REVISION).$(WX_AGE)
 
 WX_MAJOR_VERSION_NUMBER=2
 WX_MINOR_VERSION_NUMBER=3
-WX_RELEASE_NUMBER=0
-
-WX_INTERFACE_AGE=0
-WX_BINARY_AGE=1
+WX_RELEASE_NUMBER=2
 
 WX_VERSION=$WX_MAJOR_VERSION_NUMBER.$WX_MINOR_VERSION_NUMBER.$WX_RELEASE_NUMBER
-
-dnl wxWindows shared library versioning
 WX_RELEASE=$WX_MAJOR_VERSION_NUMBER.$WX_MINOR_VERSION_NUMBER
-WX_CURRENT=`expr $WX_RELEASE_NUMBER - $WX_INTERFACE_AGE`
-WX_REVISION=$WX_INTERFACE_AGE
-WX_AGE=`expr $WX_BINARY_AGE - $WX_INTERFACE_AGE`
+
+WX_CURRENT=1
+WX_REVISION=0
+WX_AGE=0
+
 
 dnl ------------------------------------------------------------------------
 dnl Check platform (host system)
@@ -478,6 +379,7 @@ dnl assume Unix
 USE_UNIX=1
 USE_WIN32=0
 USE_BEOS=0
+USE_MAC=0
 
 USE_LINUX=
 USE_SGI=
@@ -492,6 +394,7 @@ USE_ALPHA=
 USE_OSF=
 USE_BSD=
 USE_FREEBSD=
+USE_OPENBSD=
 USE_NETBSD=
 USE_VMS=
 USE_ULTRIX=
@@ -505,24 +408,30 @@ dnl than checking it during run-time
 NEEDS_D_REENTRANT_FOR_R_FUNCS=0
 
 dnl the list of all available toolkits
-ALL_TOOLKITS="CYGWIN GTK MINGW MOTIF WINE PM"
+dnl
+dnl update NUM_TOOLKITS calculation below when adding a new toolkit here!
+ALL_TOOLKITS="CYGWIN GTK MAC MGL MINGW MOTIF PM WINE"
 
 dnl NB: these wxUSE_XXX constants have value of 0 or 1 unlike all the other ones
 dnl     which are either yes or no
 DEFAULT_wxUSE_GTK=0
+DEFAULT_wxUSE_MAC=0
+DEFAULT_wxUSE_MGL=0
 DEFAULT_wxUSE_MOTIF=0
 DEFAULT_wxUSE_MSW=0
-DEFAULT_wxUSE_WINE=0
 DEFAULT_wxUSE_PM=0
+DEFAULT_wxUSE_WINE=0
 
 dnl these are the values which are really default for the given platform -
 dnl they're not cached and are only used if no --with-toolkit was given *and*
 dnl nothing was found in the cache
 DEFAULT_DEFAULT_wxUSE_GTK=0
+DEFAULT_DEFAULT_wxUSE_MAC=0
+DEFAULT_DEFAULT_wxUSE_MGL=0
 DEFAULT_DEFAULT_wxUSE_MOTIF=0
 DEFAULT_DEFAULT_wxUSE_MSW=0
-DEFAULT_DEFAULT_wxUSE_WINE=0
 DEFAULT_DEFAULT_wxUSE_PM=0
+DEFAULT_DEFAULT_wxUSE_WINE=0
 
 PROGRAM_EXT=
 
@@ -580,6 +489,13 @@ case "${host}" in
     AC_DEFINE(__BSD__)
     DEFAULT_DEFAULT_wxUSE_GTK=1
   ;;
+  *-*-openbsd*)
+    USE_BSD=1
+    USE_OPENBSD=1
+    AC_DEFINE(__FREEBSD__)
+    AC_DEFINE(__OPENBSD__)
+    DEFAULT_DEFAULT_wxUSE_GTK=1
+  ;;
   *-*-netbsd*)
     USE_BSD=1
     USE_NETBSD=1
@@ -619,7 +535,7 @@ case "${host}" in
     DEFAULT_DEFAULT_wxUSE_MOTIF=1
   ;;
 
-  *-*-cygwin32* | *-*-mingw32* )
+  *-*-cygwin* | *-*-mingw32* )
     USE_UNIX=0
     USE_WIN32=1
     AC_DEFINE(__WIN32__)
@@ -638,6 +554,15 @@ case "${host}" in
     DEFAULT_DEFAULT_wxUSE_PM=1
   ;;
 
+  *-*-darwin* )
+    USE_BSD=1
+    USE_MAC=1
+    AC_DEFINE(__MAC__)
+    AC_DEFINE(__BSD__)
+    AC_DEFINE(__UNIX__)
+    DEFAULT_DEFAULT_wxUSE_MAC=1
+  ;;
+
   *-*-beos* )
     dnl leave USE_UNIX on - BeOS is sufficiently Unix-like for this
     USE_BEOS=1
@@ -682,11 +607,13 @@ dnl useful to test the compilation with minimum options, define as 0 for normal
 dnl usage
 DEBUG_CONFIGURE=0
 if test $DEBUG_CONFIGURE = 1; then
+  DEFAULT_wxUSE_UNIVERSAL=no
+
   DEFAULT_wxUSE_THREADS=yes
 
   DEFAULT_wxUSE_SHARED=yes
   DEFAULT_wxUSE_BURNT_NAME=no
-  DEFAULT_wxUSE_OPTIMISE=yes
+  DEFAULT_wxUSE_OPTIMISE=no
   DEFAULT_wxUSE_PROFILE=no
   DEFAULT_wxUSE_NO_DEPS=no
   DEFAULT_wxUSE_NO_RTTI=no
@@ -701,24 +628,35 @@ if test $DEBUG_CONFIGURE = 1; then
   DEFAULT_wxUSE_APPLE_IEEE=no
 
   DEFAULT_wxUSE_LOG=yes
+  DEFAULT_wxUSE_LOGWINDOW=no
+  DEFAULT_wxUSE_LOGGUI=no
 
   DEFAULT_wxUSE_GUI=yes
+  DEFAULT_wxUSE_CONTROLS=no
 
   DEFAULT_wxUSE_ZLIB=no
   DEFAULT_wxUSE_LIBPNG=no
   DEFAULT_wxUSE_LIBJPEG=no
   DEFAULT_wxUSE_LIBTIFF=no
   DEFAULT_wxUSE_ODBC=no
+  DEFAULT_wxUSE_FREETYPE=no
   DEFAULT_wxUSE_OPENGL=no
 
   DEFAULT_wxUSE_ON_FATAL_EXCEPTION=no
+  DEFAULT_wxUSE_SNGLINST_CHECKER=no
   DEFAULT_wxUSE_STD_IOSTREAM=no
+  DEFAULT_wxUSE_CMDLINE_PARSER=no
+  DEFAULT_wxUSE_DATETIME=no
+  DEFAULT_wxUSE_TIMEDATE=no
+  DEFAULT_wxUSE_TIMER=no
+  DEFAULT_wxUSE_STOPWATCH=no
   DEFAULT_wxUSE_FILE=no
+  DEFAULT_wxUSE_FFILE=no
   DEFAULT_wxUSE_TEXTFILE=no
-  DEFAULT_wxUSE_TIMEDATE=no
   DEFAULT_wxUSE_WAVE=no
   DEFAULT_wxUSE_INTL=no
   DEFAULT_wxUSE_CONFIG=no
+  DEFAULT_wxUSE_FONTMAP=no
   DEFAULT_wxUSE_STREAMS=no
   DEFAULT_wxUSE_SOCKETS=no
   DEFAULT_wxUSE_DIALUP_MANAGER=no
@@ -726,6 +664,7 @@ if test $DEBUG_CONFIGURE = 1; then
   DEFAULT_wxUSE_JOYSTICK=no
   DEFAULT_wxUSE_DYNLIB_CLASS=no
   DEFAULT_wxUSE_LONGLONG=no
+  DEFAULT_wxUSE_GEOMETRY=no
 
   DEFAULT_wxUSE_AFM_FOR_POSTSCRIPT=no
   DEFAULT_wxUSE_NORMALIZED_PS_FONTS=no
@@ -735,6 +674,7 @@ if test $DEBUG_CONFIGURE = 1; then
   DEFAULT_wxUSE_CLIPBOARD=no
   DEFAULT_wxUSE_TOOLTIPS=no
   DEFAULT_wxUSE_DRAG_AND_DROP=no
+  DEFAULT_wxUSE_DRAGIMAGE=no
   DEFAULT_wxUSE_SPLINES=no
 
   DEFAULT_wxUSE_MDI_ARCHITECTURE=no
@@ -746,14 +686,25 @@ if test $DEBUG_CONFIGURE = 1; then
   DEFAULT_wxUSE_CONSTRAINTS=no
   DEFAULT_wxUSE_IPC=no
   DEFAULT_wxUSE_HELP=no
+  DEFAULT_wxUSE_WXHTML_HELP=no
   DEFAULT_wxUSE_WXTREE=no
   DEFAULT_wxUSE_METAFILE=no
+  DEFAULT_wxUSE_MIMETYPE=no
 
   DEFAULT_wxUSE_COMMONDLGS=no
+  DEFAULT_wxUSE_CHOICEDLG=no
+  DEFAULT_wxUSE_COLOURDLG=no
   DEFAULT_wxUSE_DIRDLG=no
+  DEFAULT_wxUSE_FILEDLG=no
+  DEFAULT_wxUSE_FONTDLG=no
+  DEFAULT_wxUSE_MSGDLG=no
+  DEFAULT_wxUSE_NUMBERDLG=no
   DEFAULT_wxUSE_TEXTDLG=no
   DEFAULT_wxUSE_STARTUP_TIPS=no
   DEFAULT_wxUSE_PROGRESSDLG=no
+  DEFAULT_wxUSE_WIZARDDLG=no
+
+  DEFAULT_wxUSE_MENUS=no
   DEFAULT_wxUSE_MINIFRAME=no
   DEFAULT_wxUSE_HTML=no
   DEFAULT_wxUSE_FILESYSTEM=no
@@ -761,14 +712,16 @@ if test $DEBUG_CONFIGURE = 1; then
   DEFAULT_wxUSE_FS_ZIP=no
   DEFAULT_wxUSE_BUSYINFO=no
   DEFAULT_wxUSE_ZIPSTREAM=no
-  DEFAULT_wxUSE_VALIDATORS=yes
+  DEFAULT_wxUSE_VALIDATORS=no
 
   DEFAULT_wxUSE_ACCEL=no
-  DEFAULT_wxUSE_CARET=no
+  DEFAULT_wxUSE_BUTTON=no
   DEFAULT_wxUSE_BMPBUTTON=no
+  DEFAULT_wxUSE_CALCTRL=no
+  DEFAULT_wxUSE_CARET=no
   DEFAULT_wxUSE_CHECKBOX=no
   DEFAULT_wxUSE_CHECKLST=no
-  DEFAULT_wxUSE_CHOICE=yes
+  DEFAULT_wxUSE_CHOICE=no
   DEFAULT_wxUSE_COMBOBOX=no
   DEFAULT_wxUSE_GAUGE=no
   DEFAULT_wxUSE_GRID=no
@@ -777,7 +730,6 @@ if test $DEBUG_CONFIGURE = 1; then
   DEFAULT_wxUSE_LISTBOX=no
   DEFAULT_wxUSE_LISTCTRL=no
   DEFAULT_wxUSE_NOTEBOOK=no
-  DEFAULT_wxUSE_PLOT=no
   DEFAULT_wxUSE_RADIOBOX=no
   DEFAULT_wxUSE_RADIOBTN=no
   DEFAULT_wxUSE_SASH=no
@@ -789,8 +741,11 @@ if test $DEBUG_CONFIGURE = 1; then
   DEFAULT_wxUSE_STATBMP=no
   DEFAULT_wxUSE_STATBOX=no
   DEFAULT_wxUSE_STATLINE=no
+  DEFAULT_wxUSE_STATTEXT=no
   DEFAULT_wxUSE_STATUSBAR=yes
   DEFAULT_wxUSE_TABDIALOG=no
+  DEFAULT_wxUSE_TEXTCTRL=no
+  DEFAULT_wxUSE_TOGGLEBTN=no
   DEFAULT_wxUSE_TOOLBAR=no
   DEFAULT_wxUSE_TOOLBAR_NATIVE=no
   DEFAULT_wxUSE_TOOLBAR_SIMPLE=no
@@ -799,10 +754,14 @@ if test $DEBUG_CONFIGURE = 1; then
   DEFAULT_wxUSE_UNICODE=no
   DEFAULT_wxUSE_WCSRTOMBS=no
 
+  DEFAULT_wxUSE_IMAGE=no
   DEFAULT_wxUSE_GIF=no
   DEFAULT_wxUSE_PCX=no
   DEFAULT_wxUSE_PNM=no
+  DEFAULT_wxUSE_XPM=no
 else
+  DEFAULT_wxUSE_UNIVERSAL=no
+
   DEFAULT_wxUSE_THREADS=yes
 
   DEFAULT_wxUSE_SHARED=yes
@@ -822,6 +781,8 @@ else
   DEFAULT_wxUSE_APPLE_IEEE=yes
 
   DEFAULT_wxUSE_LOG=yes
+  DEFAULT_wxUSE_LOGWINDOW=yes
+  DEFAULT_wxUSE_LOGGUI=yes
 
   DEFAULT_wxUSE_GUI=yes
 
@@ -830,16 +791,24 @@ else
   DEFAULT_wxUSE_LIBJPEG=yes
   DEFAULT_wxUSE_LIBTIFF=yes
   DEFAULT_wxUSE_ODBC=no
+  DEFAULT_wxUSE_FREETYPE=no
   DEFAULT_wxUSE_OPENGL=no
 
   DEFAULT_wxUSE_ON_FATAL_EXCEPTION=yes
+  DEFAULT_wxUSE_SNGLINST_CHECKER=yes
   DEFAULT_wxUSE_STD_IOSTREAM=no
+  DEFAULT_wxUSE_CMDLINE_PARSER=yes
+  DEFAULT_wxUSE_DATETIME=yes
+  DEFAULT_wxUSE_TIMEDATE=no
+  DEFAULT_wxUSE_TIMER=yes
+  DEFAULT_wxUSE_STOPWATCH=yes
   DEFAULT_wxUSE_FILE=yes
+  DEFAULT_wxUSE_FFILE=yes
   DEFAULT_wxUSE_TEXTFILE=yes
-  DEFAULT_wxUSE_TIMEDATE=yes
   DEFAULT_wxUSE_WAVE=no
   DEFAULT_wxUSE_INTL=yes
   DEFAULT_wxUSE_CONFIG=yes
+  DEFAULT_wxUSE_FONTMAP=yes
   DEFAULT_wxUSE_STREAMS=yes
   DEFAULT_wxUSE_SOCKETS=yes
   DEFAULT_wxUSE_DIALUP_MANAGER=yes
@@ -847,6 +816,7 @@ else
   DEFAULT_wxUSE_JOYSTICK=yes
   DEFAULT_wxUSE_DYNLIB_CLASS=yes
   DEFAULT_wxUSE_LONGLONG=yes
+  DEFAULT_wxUSE_GEOMETRY=yes
 
   DEFAULT_wxUSE_AFM_FOR_POSTSCRIPT=yes
   DEFAULT_wxUSE_NORMALIZED_PS_FONTS=yes
@@ -856,6 +826,7 @@ else
   DEFAULT_wxUSE_CLIPBOARD=yes
   DEFAULT_wxUSE_TOOLTIPS=yes
   DEFAULT_wxUSE_DRAG_AND_DROP=yes
+  DEFAULT_wxUSE_DRAGIMAGE=yes
   DEFAULT_wxUSE_SPLINES=yes
 
   DEFAULT_wxUSE_MDI_ARCHITECTURE=yes
@@ -867,14 +838,25 @@ else
   DEFAULT_wxUSE_CONSTRAINTS=yes
   DEFAULT_wxUSE_IPC=yes
   DEFAULT_wxUSE_HELP=yes
+  DEFAULT_wxUSE_WXHTML_HELP=yes
   DEFAULT_wxUSE_WXTREE=yes
   DEFAULT_wxUSE_METAFILE=yes
+  DEFAULT_wxUSE_MIMETYPE=yes
 
   DEFAULT_wxUSE_COMMONDLGS=yes
+  DEFAULT_wxUSE_CHOICEDLG=yes
+  DEFAULT_wxUSE_COLOURDLG=yes
   DEFAULT_wxUSE_DIRDLG=yes
+  DEFAULT_wxUSE_FILEDLG=yes
+  DEFAULT_wxUSE_FONTDLG=yes
+  DEFAULT_wxUSE_MSGDLG=yes
+  DEFAULT_wxUSE_NUMBERDLG=yes
   DEFAULT_wxUSE_TEXTDLG=yes
   DEFAULT_wxUSE_STARTUP_TIPS=yes
   DEFAULT_wxUSE_PROGRESSDLG=yes
+  DEFAULT_wxUSE_WIZARDDLG=yes
+
+  DEFAULT_wxUSE_MENUS=yes
   DEFAULT_wxUSE_MINIFRAME=yes
   DEFAULT_wxUSE_HTML=yes
   DEFAULT_wxUSE_FILESYSTEM=yes
@@ -885,8 +867,10 @@ else
   DEFAULT_wxUSE_VALIDATORS=yes
 
   DEFAULT_wxUSE_ACCEL=yes
-  DEFAULT_wxUSE_CARET=yes
+  DEFAULT_wxUSE_BUTTON=yes
   DEFAULT_wxUSE_BMPBUTTON=yes
+  DEFAULT_wxUSE_CALCTRL=yes
+  DEFAULT_wxUSE_CARET=yes
   DEFAULT_wxUSE_CHECKBOX=yes
   DEFAULT_wxUSE_CHECKLST=yes
   DEFAULT_wxUSE_CHOICE=yes
@@ -898,7 +882,6 @@ else
   DEFAULT_wxUSE_LISTBOX=yes
   DEFAULT_wxUSE_LISTCTRL=yes
   DEFAULT_wxUSE_NOTEBOOK=yes
-  DEFAULT_wxUSE_PLOT=yes
   DEFAULT_wxUSE_RADIOBOX=yes
   DEFAULT_wxUSE_RADIOBTN=yes
   DEFAULT_wxUSE_SASH=yes
@@ -910,8 +893,11 @@ else
   DEFAULT_wxUSE_STATBMP=yes
   DEFAULT_wxUSE_STATBOX=yes
   DEFAULT_wxUSE_STATLINE=yes
+  DEFAULT_wxUSE_STATTEXT=yes
   DEFAULT_wxUSE_STATUSBAR=yes
   DEFAULT_wxUSE_TABDIALOG=no
+  DEFAULT_wxUSE_TEXTCTRL=yes
+  DEFAULT_wxUSE_TOGGLEBTN=yes
   DEFAULT_wxUSE_TOOLBAR=yes
   DEFAULT_wxUSE_TOOLBAR_NATIVE=yes
   DEFAULT_wxUSE_TOOLBAR_SIMPLE=yes
@@ -920,9 +906,11 @@ else
   DEFAULT_wxUSE_UNICODE=no
   DEFAULT_wxUSE_WCSRTOMBS=no
 
+  DEFAULT_wxUSE_IMAGE=yes
   DEFAULT_wxUSE_GIF=yes
   DEFAULT_wxUSE_PCX=yes
   DEFAULT_wxUSE_PNM=yes
+  DEFAULT_wxUSE_XPM=yes
 fi
 
 dnl WX_ARG_WITH should be used to select whether an external package will be
@@ -956,21 +944,22 @@ WX_ARG_ENABLE(gui,         [  --enable-gui            use GUI classes], wxUSE_GU
 
 if test "$wxUSE_GUI" = "yes"; then
 
+WX_ARG_ENABLE(universal,   [  --enable-universal      use wxWindows GUI controls instead of native ones], wxUSE_UNIVERSAL)
 AC_ARG_WITH(gtk,           [  --with-gtk              use GTK+], [wxUSE_GTK="$withval" CACHE_GTK=1 TOOLKIT_GIVEN=1])
 AC_ARG_WITH(motif,         [  --with-motif            use Motif/Lesstif], [wxUSE_MOTIF="$withval" CACHE_MOTIF=1 TOOLKIT_GIVEN=1])
+AC_ARG_WITH(mac,           [  --with-mac              use Mac OS X], [wxUSE_MAC="$withval" TOOLKIT_GIVEN=1])
 AC_ARG_WITH(wine,          [  --with-wine             use WINE], [wxUSE_WINE="$withval" CACHE_WINE=1 TOOLKIT_GIVEN=1])
 AC_ARG_WITH(cygwin,        [  --with-cygwin           use Cygwin for MS-Windows], [wxUSE_CYGWIN="$withval" CACHE_CYGWIN=1 TOOLKIT_GIVEN=1])
 AC_ARG_WITH(mingw,         [  --with-mingw            use GCC Minimal MS-Windows], [wxUSE_MINGW="$withval" CACHE_MINGW=1 TOOLKIT_GIVEN=1])
 AC_ARG_WITH(pm,            [  --with-pm               use OS/2 Presentation Manager], [wxUSE_PM="$withval" CACHE_PM=1 TOOLKIT_GIVEN=1])
+AC_ARG_WITH(mgl,           [  --with-mgl              use MGL], [wxUSE_MGL="$withval" CACHE_MGL=1 TOOLKIT_GIVEN=1])
 
-AC_ARG_WITH(gtk-prefix,    [  --with-gtk-prefix=PFX   Prefix where GTK is installed],
-            gtk_config_prefix="$withval", gtk_config_prefix="")
-AC_ARG_WITH(gtk-exec-prefix, [  --with-gtk-exec-prefix=PFX  Exec prefix where GTK is installed],
-            gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
+AC_ARG_ENABLE(gtk2,        [  --enable-gtk2           use GTK+ 2.0 if available (EXPERIMENTAL)],wxUSE_GTK2=1,wxUSE_GTK2=0)
 
 WX_ARG_SYS_WITH(libpng,    [  --with-libpng           use libpng (PNG image format)], wxUSE_LIBPNG)
 WX_ARG_SYS_WITH(libjpeg,   [  --with-libjpeg          use libjpeg (JPEG file format)], wxUSE_LIBJPEG)
 WX_ARG_SYS_WITH(libtiff,   [  --with-libtiff          use libtiff (TIFF file format)], wxUSE_LIBTIFF)
+WX_ARG_SYS_WITH(freetype,  [  --with-freetype         use freetype (font rasterizer)], wxUSE_FREETYPE)
 WX_ARG_WITH(opengl,        [  --with-opengl           use OpenGL (or Mesa)], wxUSE_OPENGL)
 
 fi
@@ -1012,6 +1001,9 @@ WX_ARG_ENABLE(no_exceptions, [  --enable-no_exceptions  create code without exce
 WX_ARG_ENABLE(permissive,    [  --enable-permissive     compile code disregarding strict ANSI], wxUSE_PERMISSIVE)
 WX_ARG_ENABLE(no_deps,       [  --enable-no_deps        create code without dependency information], wxUSE_NO_DEPS)
 
+WX_ARG_ENABLE(compat20,      [  --enable-compat20       enable wxWin 2.0 compatibility], WXWIN_COMPATIBILITY_2)
+WX_ARG_ENABLE(compat22,      [  --enable-compat22       enable wxWin 2.2 compatibility], WXWIN_COMPATIBILITY_2_2)
+
 dnl ---------------------------------------------------------------------------
 dnl (small) optional non GUI classes
 dnl ---------------------------------------------------------------------------
@@ -1023,17 +1015,24 @@ WX_ARG_ENABLE(sockets,       [  --enable-sockets        use socket/network class
 
 WX_ARG_ENABLE(ipc,           [  --enable-ipc            use interprocess communication (wxSocket etc.)], wxUSE_IPC)
 
+WX_ARG_ENABLE(cmdline,       [  --enable-cmdline        use wxCmdLineParser class], wxUSE_CMDLINE_PARSER)
+WX_ARG_ENABLE(datetime,      [  --enable-datetime       use wxDateTime class], wxUSE_DATETIME)
+WX_ARG_ENABLE(timedate,      [  --enable-timedate       use obsolete wxDate/wxTime classes], wxUSE_TIMEDATE)
+WX_ARG_ENABLE(stopwatch,     [  --enable-stopwatch      use wxStopWatch class], wxUSE_STOPWATCH)
 WX_ARG_ENABLE(dialupman,     [  --enable-dialupman      use dialup network classes], wxUSE_DIALUP_MANAGER)
 WX_ARG_ENABLE(apple_ieee,    [  --enable-apple_ieee     use the Apple IEEE codec], wxUSE_APPLE_IEEE)
-WX_ARG_ENABLE(timedate,      [  --enable-timedate       use date/time classes], wxUSE_TIMEDATE)
+WX_ARG_ENABLE(timer,         [  --enable-timer          use wxTimer class], wxUSE_TIMER)
 WX_ARG_ENABLE(wave,          [  --enable-wave           use wxWave class], wxUSE_WAVE)
 WX_ARG_ENABLE(fraction,      [  --enable-fraction       use wxFraction class], wxUSE_FRACTION)
 WX_ARG_ENABLE(dynlib,        [  --enable-dynlib         use wxLibrary class for DLL loading], wxUSE_DYNLIB_CLASS)
 WX_ARG_ENABLE(longlong,      [  --enable-longlong       use wxLongLong class], wxUSE_LONGLONG)
+WX_ARG_ENABLE(geometry,      [  --enable-geometry       use geometry class], wxUSE_GEOMETRY)
 WX_ARG_ENABLE(log,           [  --enable-log            use logging system], wxUSE_LOG)
 WX_ARG_ENABLE(streams,       [  --enable-streams        use wxStream etc classes], wxUSE_STREAMS)
 WX_ARG_ENABLE(file,          [  --enable-file           use wxFile classes], wxUSE_FILE)
+WX_ARG_ENABLE(ffile,         [  --enable-ffile          use wxFFile classes], wxUSE_FFILE)
 WX_ARG_ENABLE(textfile,      [  --enable-textfile       use wxTextFile classes], wxUSE_TEXTFILE)
+WX_ARG_ENABLE(fontmap,       [  --enable-fontmap        use font encodings conversion classes], wxUSE_FONTMAP)
 WX_ARG_ENABLE(unicode,       [  --enable-unicode        compile wxString with Unicode support], wxUSE_UNICODE)
 WX_ARG_ENABLE(wcsrtombs,     [  --enable-wcsrtombs      use wcsrtombs instead of buggy (GNU libc1/Linux libc5) wcstombs], wxUSE_WCSRTOMBS)
 WX_ARG_ENABLE(wxprintfv,     [  --enable-wxprintfv      use wxWindows implementation of vprintf()], wxUSE_EXPERIMENTAL_PRINTF)
@@ -1044,6 +1043,9 @@ WX_ARG_ENABLE(fs_zip,        [  --enable-fs_zip         use virtual ZIP filesyst
 WX_ARG_ENABLE(zipstream,     [  --enable-zipstream      use wxZipInputStream], wxUSE_ZIPSTREAM)
 
 WX_ARG_ENABLE(catch_segvs,   [  --enable-catch_segvs    catch signals and pass them to wxApp::OnFatalException], wxUSE_ON_FATAL_EXCEPTION)
+WX_ARG_ENABLE(snglinst,      [  --enable-snglinst       use wxSingleInstanceChecker class], wxUSE_SNGLINST_CHECKER)
+
+WX_ARG_ENABLE(mimetype,    [  --enable-mimetypes      use wxMimeTypesManager], wxUSE_MIMETYPE)
 
 dnl ---------------------------------------------------------------------------
 dnl "big" options (i.e. those which change a lot of things throughout the library)
@@ -1059,10 +1061,14 @@ dnl "big" GUI options
 dnl ---------------------------------------------------------------------------
 
 WX_ARG_ENABLE(docview,     [  --enable-docview        use document view architecture], wxUSE_DOC_VIEW_ARCHITECTURE)
-WX_ARG_ENABLE(help,        [  --enable-help           use help (using external browser at present)], wxUSE_HELP)
+WX_ARG_ENABLE(help,        [  --enable-help           use help subsystem], wxUSE_HELP)
+WX_ARG_ENABLE(html,        [  --enable-html           use wxHTML sub-library], wxUSE_HTML)
+WX_ARG_ENABLE(htmlhelp,    [  --enable-htmlhelp       use wxHTML-based help], wxUSE_WXHTML_HELP)
 WX_ARG_ENABLE(constraints, [  --enable-constraints    use layout-constraints system], wxUSE_CONSTRAINTS)
 WX_ARG_ENABLE(printarch,   [  --enable-printarch      use printing architecture], wxUSE_PRINTING_ARCHITECTURE)
 WX_ARG_ENABLE(mdi,         [  --enable-mdi            use multiple document interface architecture], wxUSE_MDI_ARCHITECTURE)
+WX_ARG_ENABLE(loggui,      [  --enable-loggui         use standard GUI logger], wxUSE_LOGGUI)
+WX_ARG_ENABLE(logwin,      [  --enable-logwin         use wxLogWindow], wxUSE_LOGWINDOW)
 
 dnl ---------------------------------------------------------------------------
 dnl PostScript options
@@ -1076,6 +1082,7 @@ dnl WX_ARG_ENABLE(afmfonts,        [  --enable-afmfonts       use Adobe Font Met
 dnl ---------------------------------------------------------------------------
 dnl resources
 dnl ---------------------------------------------------------------------------
+
 WX_ARG_ENABLE(prologio,    [  --enable-prologio       use Prolog IO library], wxUSE_PROLOGIO)
 WX_ARG_ENABLE(resources,   [  --enable-resources      use wxWindows resources], wxUSE_RESOURCES)
 
@@ -1087,6 +1094,7 @@ dnl ---------------------------------------------------------------------------
 
 WX_ARG_ENABLE(clipboard,   [  --enable-clipboard      use wxClipboard classes], wxUSE_CLIPBOARD)
 WX_ARG_ENABLE(dnd,         [  --enable-dnd            use Drag'n'Drop classes], wxUSE_DRAG_AND_DROP)
+WX_ARG_ENABLE(metafile,    [  --enable-metafile       use win32 metafiles], wxUSE_METAFILE)
 
 dnl TODO: doesn't work yet
 WX_ARG_ENABLE(wxtree,      [  --enable-wxtree         make wxTree library], wxUSE_WXTREE)
@@ -1102,9 +1110,11 @@ dnl --disable-<control> later on the command line - but by default all will be
 dnl used (and vice versa)
 if test "$wxUSE_CONTROLS" = "yes"; then
   DEFAULT_wxUSE_ACCEL=yes
+  DEFAULT_wxUSE_BMPBUTTON=yes
+  DEFAULT_wxUSE_BUTTON=yes
+  DEFAULT_wxUSE_CALCTRL=no
   DEFAULT_wxUSE_CARET=yes
   DEFAULT_wxUSE_COMBOBOX=yes
-  DEFAULT_wxUSE_BMPBUTTON=yes
   DEFAULT_wxUSE_CHECKBOX=yes
   DEFAULT_wxUSE_CHECKLISTBOX=yes
   DEFAULT_wxUSE_CHOICE=yes
@@ -1128,6 +1138,7 @@ if test "$wxUSE_CONTROLS" = "yes"; then
   DEFAULT_wxUSE_STATLINE=yes
   DEFAULT_wxUSE_STATUSBAR=yes
   DEFAULT_wxUSE_TAB_DIALOG=yes
+  DEFAULT_wxUSE_TOGGLEBTN=yes
   DEFAULT_wxUSE_TOOLBAR=yes
   DEFAULT_wxUSE_TOOLBAR_NATIVE=yes
   DEFAULT_wxUSE_TOOLBAR_SIMPLE=yes
@@ -1135,9 +1146,11 @@ if test "$wxUSE_CONTROLS" = "yes"; then
   DEFAULT_wxUSE_TREECTRL=yes
 elif test "$wxUSE_CONTROLS" = "no"; then
   DEFAULT_wxUSE_ACCEL=no
+  DEFAULT_wxUSE_BMPBUTTON=no
+  DEFAULT_wxUSE_BUTTON=no
+  DEFAULT_wxUSE_CALCTRL=no
   DEFAULT_wxUSE_CARET=no
   DEFAULT_wxUSE_COMBOBOX=no
-  DEFAULT_wxUSE_BMPBUTTON=no
   DEFAULT_wxUSE_CHECKBOX=no
   DEFAULT_wxUSE_CHECKLISTBOX=no
   DEFAULT_wxUSE_CHOICE=no
@@ -1161,6 +1174,7 @@ elif test "$wxUSE_CONTROLS" = "no"; then
   DEFAULT_wxUSE_STATLINE=no
   DEFAULT_wxUSE_STATUSBAR=no
   DEFAULT_wxUSE_TAB_DIALOG=no
+  DEFAULT_wxUSE_TOGGLEBTN=no
   DEFAULT_wxUSE_TOOLBAR=no
   DEFAULT_wxUSE_TOOLBAR_NATIVE=no
   DEFAULT_wxUSE_TOOLBAR_SIMPLE=no
@@ -1169,8 +1183,10 @@ elif test "$wxUSE_CONTROLS" = "no"; then
 fi
 
 WX_ARG_ENABLE(accel,       [  --enable-accel          use accelerators], wxUSE_ACCEL)
-WX_ARG_ENABLE(caret,       [  --enable-caret          use wxCaret class], wxUSE_CARET)
+WX_ARG_ENABLE(button,      [  --enable-button         use wxButton class], wxUSE_BUTTON)
 WX_ARG_ENABLE(bmpbutton,   [  --enable-bmpbutton      use wxBitmapButton class], wxUSE_BMPBUTTON)
+WX_ARG_ENABLE(calendar,    [  --enable-calendar       use wxCalendarCtrl class], wxUSE_CALCTRL)
+WX_ARG_ENABLE(caret,       [  --enable-caret          use wxCaret class], wxUSE_CARET)
 WX_ARG_ENABLE(checkbox,    [  --enable-checkbox       use wxCheckBox class], wxUSE_CHECKBOX)
 WX_ARG_ENABLE(checklst,    [  --enable-checklst       use wxCheckListBox (listbox with checkboxes) class], wxUSE_CHECKLST)
 WX_ARG_ENABLE(choice,      [  --enable-choice         use wxChoice class], wxUSE_CHOICE)
@@ -1193,38 +1209,56 @@ WX_ARG_ENABLE(splitter,    [  --enable-splitter       use wxSplitterWindow class
 WX_ARG_ENABLE(statbmp,     [  --enable-statbmp        use wxStaticBitmap class], wxUSE_STATBMP)
 WX_ARG_ENABLE(statbox,     [  --enable-statbox        use wxStaticBox class], wxUSE_STATBOX)
 WX_ARG_ENABLE(statline,    [  --enable-statline       use wxStaticLine class], wxUSE_STATLINE)
+WX_ARG_ENABLE(stattext,    [  --enable-stattext       use wxStaticText class], wxUSE_STATTEXT)
 WX_ARG_ENABLE(statusbar,   [  --enable-statusbar      use wxStatusBar class], wxUSE_STATUSBAR)
 WX_ARG_ENABLE(tabdialog,   [  --enable-tabdialog      use wxTabControl class], wxUSE_TABDIALOG)
+WX_ARG_ENABLE(textctrl,    [  --enable-textctrl       use wxTextCtrl class], wxUSE_TEXTCTRL)
+WX_ARG_ENABLE(togglebtn,   [  --enable-togglebtn      use wxToggleButton class], wxUSE_TOGGLEBTN)
 WX_ARG_ENABLE(toolbar,     [  --enable-toolbar        use wxToolBar class], wxUSE_TOOLBAR)
 WX_ARG_ENABLE(tbarnative,  [  --enable-tbarnative     use native wxToolBar class], wxUSE_TOOLBAR_NATIVE)
 WX_ARG_ENABLE(tbarsmpl,    [  --enable-tbarsmpl       use wxToolBarSimple class], wxUSE_TOOLBAR_SIMPLE)
 WX_ARG_ENABLE(treectrl,    [  --enable-treectrl       use wxTreeCtrl class], wxUSE_TREECTRL)
 
 dnl ---------------------------------------------------------------------------
-dnl misc GUI options
+dnl common dialogs
 dnl ---------------------------------------------------------------------------
 
 WX_ARG_ENABLE(commondlg,   [  --enable-commondlg      use common dialogs (wxDirDialog, wxProgressDialog, wxTextDialog, ...)], wxUSE_COMMONDLGS)
+WX_ARG_ENABLE(choicedlg,   [  --enable-choicedlg      use wxChoiceDialog], wxUSE_CHOICEDLG)
+WX_ARG_ENABLE(coldlg,      [  --enable-coldlg         use wxColourDialog], wxUSE_COLOURDLG)
+WX_ARG_ENABLE(filedlg,     [  --enable-filedlg        use wxFileDialog], wxUSE_FILEDLG)
+WX_ARG_ENABLE(fontdlg,     [  --enable-fontdlg        use wxFontDialog], wxUSE_FONTDLG)
 WX_ARG_ENABLE(dirdlg,      [  --enable-dirdlg         use wxDirDialog], wxUSE_DIRDLG)
+WX_ARG_ENABLE(msgdlg,      [  --enable-msgdlg         use wxMessageDialog], wxUSE_MSGDLG)
+WX_ARG_ENABLE(numberdlg,   [  --enable-numberdlg      use wxNumberEntryDialog], wxUSE_NUMBERDLG)
 WX_ARG_ENABLE(textdlg,     [  --enable-textdlg        use wxTextDialog], wxUSE_TEXTDLG)
 WX_ARG_ENABLE(tipdlg,      [  --enable-tipdlg         use startup tips], wxUSE_STARTUP_TIPS)
 WX_ARG_ENABLE(progressdlg, [  --enable-progressdlg    use wxProgressDialog], wxUSE_PROGRESSDLG)
+WX_ARG_ENABLE(wizarddlg,   [  --enable-wizarddlg      use wxWizard], wxUSE_WIZARDDLG)
+
+dnl ---------------------------------------------------------------------------
+dnl misc GUI options
+dnl ---------------------------------------------------------------------------
+
+WX_ARG_ENABLE(menus,       [  --enable-menus          use wxMenu/wxMenuBar/wxMenuItem classes], wxUSE_MENUS)
 WX_ARG_ENABLE(miniframe,   [  --enable-miniframe      use wxMiniFrame class], wxUSE_MINIFRAME)
-WX_ARG_ENABLE(html,        [  --enable-html           use wxHTML sub-library], wxUSE_HTML)
 WX_ARG_ENABLE(tooltips,    [  --enable-tooltips       use wxToolTip class], wxUSE_TOOLTIPS)
 WX_ARG_ENABLE(splines,     [  --enable-splines        use spline drawing code], wxUSE_SPLINES)
 WX_ARG_ENABLE(validators,  [  --enable-validators     use wxValidator and derived classes], wxUSE_VALIDATORS)
 WX_ARG_ENABLE(busyinfo,    [  --enable-busyinfo       use wxBusyInfo], wxUSE_BUSYINFO)
-WX_ARG_ENABLE(plot,        [  --enable-plot           use wxPlot], wxUSE_PLOT)
 WX_ARG_ENABLE(joystick,    [  --enable-joystick       compile in joystick support (Linux only)], wxUSE_JOYSTICK)
+WX_ARG_ENABLE(metafile,    [  --enable-metafiles      use wxMetaFile (Windows only)], wxUSE_METAFILE)
+WX_ARG_ENABLE(dragimage,   [  --enable-dragimage      use wxDragImage], wxUSE_DRAGIMAGE)
 
 dnl ---------------------------------------------------------------------------
 dnl support for image formats that do not rely on external library
 dnl ---------------------------------------------------------------------------
 
+WX_ARG_ENABLE(image,       [  --enable-image          use wxImage class], wxUSE_IMAGE)
 WX_ARG_ENABLE(gif,         [  --enable-gif            use gif images (GIF file format)], wxUSE_GIF)
 WX_ARG_ENABLE(pcx,         [  --enable-pcx            use pcx images (PCX file format)], wxUSE_PCX)
 WX_ARG_ENABLE(pnm,         [  --enable-pnm            use pnm images (PNM file format)], wxUSE_PNM)
+WX_ARG_ENABLE(pnm,         [  --enable-xpm            use xpm images (XPM file format)], wxUSE_XPM)
 
 fi
 dnl for GUI only
@@ -1262,8 +1296,9 @@ else
   done
 fi
 
-dnl we suppose that expr exists...
-NUM_TOOLKITS=`expr ${wxUSE_GTK:-0} + ${wxUSE_MOTIF:-0} + ${wxUSE_WINE:-0} + ${wxUSE_MINGW:-0} + ${wxUSE_CYGWIN:-0}`
+dnl we suppose that expr is available (maybe there is a better way to do
+dnl this? what about using ALL_TOOLKITS? TODO)
+NUM_TOOLKITS=`expr ${wxUSE_GTK:-0} + ${wxUSE_MOTIF:-0} + ${wxUSE_MAC:-0} + ${wxUSE_WINE:-0} + ${wxUSE_MINGW:-0} + ${wxUSE_CYGWIN:-0} + ${wxUSE_MGL:-0}`
 
 dnl Allow wxUSE_PM only for OS/2 with EMX.
 dnl Path separator; ':' for unix.
@@ -1302,7 +1337,8 @@ for toolkit in `echo $ALL_TOOLKITS`; do
       echo "$var=$value" >> ${wx_arg_cache_file}
     fi
     if test "$value" = 1; then
-      AC_MSG_RESULT(`echo $toolkit | tr [[A-Z]] [[a-z]]`)
+      toolkit_echo=`echo $toolkit | tr [[A-Z]] [[a-z]]`
+      AC_MSG_RESULT($toolkit_echo)
     fi
   fi
 done
@@ -1386,7 +1422,7 @@ dnl   defines STRIP as strip or nothing if not found
 AC_CHECK_PROG(STRIP, strip, strip, true)
 
 dnl check if VPATH works
-AC_MSG_CHECKING("make for VPATH support")
+AC_MSG_CHECKING([make for VPATH support])
 dnl create Makefile
 cat - << EOF > confMake
 check : file
@@ -1406,7 +1442,7 @@ if test "$RESULT" = 0; then
   AC_MSG_RESULT(yes)
 else
   AC_MSG_RESULT(no)
-  AC_MSG_ERROR(
+  AC_MSG_ERROR([
 You need a make-utility that is able to use the variable
 VPATH correctly.
 If your version of make does not support VPATH correctly,
@@ -1416,7 +1452,7 @@ export MAKE=gmake; ./configure  for sh-type shells
 setenv MAKE gmake; ./configure  for csh-type shells
 Also please do remember to use gmake in this case every time
 you are trying to compile.
-)
+])
 fi
 
 dnl YACC checks
@@ -1526,404 +1562,458 @@ dnl ----------------------------------------------------------------
 AFMINSTALL=
 
 if test "$wxUSE_GUI" = "yes"; then
+    USE_GUI=1
 
-USE_GUI=1
+    TOOLKIT=
+    TOOLKIT_INCLUDE=
 
-TOOLKIT=
-TOOLKIT_INCLUDE=
+    GUI_TK_LIBRARY=
+    GUI_TK_LINK=
 
-GUIOBJS=
-COMMONOBJS=
-GENERICOBJS=
+    WXGTK12=
+    WXGTK127=
+    WXGTK20=
 
-GUI_TK_LIBRARY=
-GUI_TK_LINK=
+    WXWINE=
 
-WXGTK12=
-WXGTK127=
-WXGTK20=
+    if test "$wxUSE_CYGWIN" = 1 || test "$wxUSE_MINGW" = 1 ; then
+        if test "$cross_compiling" = "yes" ; then
+            dnl mingw32 will find them even if they're not in one of standard paths
+            AC_MSG_WARN(skipping windows.h check for cross-compilation)
+        else
+            AC_MSG_CHECKING(for Windows headers)
+            WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, windows.h)
+            if test "$ac_find_includes" != "" ; then
+                AC_MSG_RESULT(found $ac_find_includes)
+                TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE -I$ac_find_includes"
+            else
+                AC_MSG_RESULT(no)
+                AC_MSG_ERROR(please set CFLAGS to contain the location of windows.h)
+            fi
+        fi
 
-WXWINE=
+        INCLUDE_SUBDIRS="$INCLUDE_SUBDIRS msw"
+        dnl --- Quick & Dirty ; link against most/all libraries
+        dnl --- This will bloat the executable, but it'll work for now...
+        LIBS="$LIBS -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lcrtdll -ladvapi32 -lwsock32"
 
-if test "$wxUSE_CYGWIN" = 1 || test "$wxUSE_MINGW" = 1 ; then
-    if test "$cross_compiling" = "yes" ; then
-        dnl mingw32 will find them even if they're not in one of standard paths
-        AC_MSG_WARN(skipping windows.h check for cross-compilation)
-    else
-        AC_MSG_CHECKING(for Windows headers)
-        WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, windows.h)
-        if test "$ac_find_includes" != "" ; then
-            AC_MSG_RESULT(found $ac_find_includes)
-            TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE -I$ac_find_includes"
-        else
-            AC_MSG_RESULT(no)
-            AC_MSG_ERROR(please set CFLAGS to contain the location of windows.h)
+        dnl add extra odbc libs if we have compiled in odbc
+        if test "$wxUSE_ODBC" = "yes" ; then
+            LIBS="$LIBS -lodbc32 -lole32 -loleaut32"
         fi
-    fi
 
-    INCLUDE_SUBDIRS="$INCLUDE_SUBDIRS msw"
-    dnl --- Quick & Dirty ; link against most/all libraries
-    dnl --- This will bloat the executable, but it'll work for now...
-    LIBS="$LIBS -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lcrtdll -ladvapi32 -lwsock32"
+        dnl -mwindows is needed to avoid that spawning of a console window
+        if test "$wxUSE_MINGW" = 1; then
+            LDFLAGS="$LDFLAGS -mwindows"
+        fi
 
-    dnl add extra odbc libs if we have compiled in odbc
-    if test "$wxUSE_ODBC" = "yes" ; then
-        LIBS="$LIBS -lodbc32 -lole32 -loleaut32"
-    fi
+        TOOLKIT=MSW
+        GUIDIST=MSW_DIST
 
-    dnl -mwindows is needed to avoid that spawning of a console window
-    if test "$wxUSE_MINGW" = 1; then
-        LDFLAGS="$LDFLAGS -mwindows"
+        dnl we should calculate these
+        RCINCSWITCH="--include-dir"
+        RCDEFSWITCH="--define"
+        RCPREPROCESSOR="--preprocessor \"\$(CC) -c -E -xc-header -DRC_INVOKED\""
+        RCINPUTSWITCH="-i"
+        RCOUTPUTSWITCH="-o"
+        RESFLAGS="$RCPREPROCESSOR $RCINCSWITCH \$(top_srcdir)/include $RCINCSWITCH \$(top_srcdir)/\$(program_dir) $RCDEFSWITCH __WIN32__ $RCDEFSWITCH __WIN95__ $RCDEFSWITCH __GNUWIN32__"
+
+        dnl set optinal RES_PROGRAM_OPT to RES_PROGRAM
+        RESPROGRAM="\$(RES_PROGRAM)"
     fi
 
-    TOOLKIT=MSW
+    if test "$wxUSE_GTK" = 1; then
+        AC_MSG_CHECKING([for GTK+ version])
 
-    GUIOBJS="\$(MSW_GUIOBJS)"
-    GUIHEADERS="\$(MSW_HEADERS)"
-    COMMONOBJS="\$(MSW_COMMONOBJS)"
-    GENERICOBJS="\$(MSW_GENERICOBJS)"
-    UNIXOBJS=
-    GUIDIST=MSW_DIST
+        gtk_version_cached=1
+        AC_CACHE_VAL(wx_cv_lib_gtk,
+            [
+                dnl stupid GTK+ AM macros produce their own messages, so we
+                dnl have to pass to the next line
+                gtk_version_cached=0
+                AC_MSG_RESULT("")
+
+                wx_cv_lib_gtk=
+                if test "x$wxUSE_GTK2" = "xyes"; then
+                    AM_PATH_GTK_2_0(1.3.1, wx_cv_lib_gtk=2.0, gthread)
+                fi
+
+                if test -z "$wx_cv_lib_gtk"; then
+                    AM_PATH_GTK(1.2.7, wx_cv_lib_gtk=1.2.7)
+                fi
+
+                if test -z "$wx_cv_lib_gtk"; then
+                    AM_PATH_GTK(1.2.3, wx_cv_lib_gtk=1.2.3)
+                fi
+
+                if test -z "$wx_cv_lib_gtk"; then
+                    dnl looks better in AC_MSG_RESULT
+                    wx_cv_lib_gtk=none
+                else
+                    dnl we need to cache GTK_CFLAGS and GTK_LIBS for the
+                    dnl subsequent runs
+                    wx_cv_cflags_gtk=$GTK_CFLAGS
+                    wx_cv_libs_gtk=$GTK_LIBS
+                fi
+            ]
+        )
 
-    dnl we should calculate these
-    RCINCSWITCH="--include-dir"
-    RCDEFSWITCH="--define"
-    RCPREPROCESSOR="--preprocessor \"\$(CC) -c -E -xc-header -DRC_INVOKED\""
-    RCINPUTSWITCH="-i"
-    RCOUTPUTSWITCH="-o"
-    RESFLAGS="$RCPREPROCESSOR $RCINCSWITCH \$(top_srcdir)/include $RCINCSWITCH \$(top_srcdir)/\$(program_dir) $RCDEFSWITCH __WIN32__ $RCDEFSWITCH __WIN95__ $RCDEFSWITCH __GNUWIN32__"
+        dnl if it wasn't cached, the messages from AM_PATH_GTK() above are
+        dnl enough
+        if test "$gtk_version_cached" = 1; then
+            AC_MSG_RESULT($wx_cv_lib_gtk)
+        fi
 
-    dnl set optinal RES_PROGRAM_OPT to RES_PROGRAM
-    RESPROGRAM="\$(RES_PROGRAM)"
+        case "$wx_cv_lib_gtk" in
+            2.0)    WXGTK20=1
+                    ;;
+            1.2.7)  WXGTK127=1
+                    WXGTK12=1
+                    ;;
+            1.2.3)  WXGTK12=1
+                    ;;
+            *)      AC_MSG_ERROR([
+Please check that gtk-config is in path, the directory
+where GTK+ libraries are installed (returned by
+'gtk-config --libs' command) is in LD_LIBRARY_PATH or
+equivalent variable and GTK+ is version 1.2.3 or above.
+                            ])
+                    ;;
+        esac
 
-fi
+        TOOLKIT_INCLUDE="$wx_cv_cflags_gtk"
+        GUI_TK_LIBRARY="$wx_cv_libs_gtk"
 
-if test "$wxUSE_GTK" = 1; then
-    dnl avoid calling AM_PATH_GTK twice, so check first for the newer version
-    dnl and only then, if it wasn't found, for an older one
-    AM_PATH_GTK_2_0(1.3.1, WXGTK20=1,[
-      AM_PATH_GTK(1.2.7, WXGTK127=1)
-      AM_PATH_GTK(1.2.3, WXGTK12=1)
-    ], gthread)
-
-    if test "$WXGTK12" != 1 -a "$WXGTK20" != 1; then
-        AC_MSG_ERROR([
-            Please check that gtk-config is in path, the directory
-            where GTK+ libraries are installed (returned by
-            'gtk-config --libs' command) is in LD_LIBRARY_PATH or
-            equivalent variable and GTK+ is version 1.2.3 or above.
-        ])
-    fi
-
-    TOOLKIT_INCLUDE="$GTK_CFLAGS"
+        AFMINSTALL=afminstall
+        TOOLKIT=GTK
+        GUIDIST=GTK_DIST
 
-dnl Appending gthreads as it was done here is not portable, instead
-dnl we now call "gtk-config --libs gthread" which sets the right library
-dnl name for us. The following hacks are no longer required.
+        dnl test for XIM support in libgdk
+        AC_CHECK_LIB(gdk, gdk_im_open, AC_DEFINE(HAVE_XIM))
+    fi
 
-    GUI_TK_LIBRARY="$GTK_LIBS"
+    if test "$wxUSE_MGL" = 1; then
+        dnl FIXME_MGL - test for MGL's variants for freebsd etc.
 
-dnl dnl On FreeBSD, the libs are called gtk12 etc, so we must append gthread12
-dnl    echo $GTK_LIBS | fgrep -q "glib12"
-dnl    if test $? = 0  ; then
-dnl       GUI_TK_LIBRARY="$GTK_LIBS -gthread12"
-dnl    else
-dnl       GUI_TK_LIBRARY="$GTK_LIBS -lgthread"
-dnl    fi
-    TOOLKIT=GTK
+        AC_MSG_CHECKING(for SciTech MGL library)
+        if test "x$MGL_ROOT" = x ; then
+            AC_MSG_RESULT(not found)
+            AC_MSG_ERROR([Cannot find MGL library. Make sure MGL_ROOT is set.])
+        else
+            AC_MSG_RESULT($MGL_ROOT)
+        fi
 
-    AFMINSTALL=afminstall
+        MGL_OS=linux/gcc/glibc
+        MGL_LIB_TYPE=""
 
-    GUIOBJS="\$(GTK_GUIOBJS)"
-    GUIHEADERS="\$(GTK_HEADERS)"
-    COMMONOBJS="\$(GTK_COMMONOBJS)"
-    GENERICOBJS="\$(GTK_GENERICOBJS)"
-    GUIDEPS="\$(GTK_GUIDEPS)"
-    COMMONDEPS="\$(GTK_COMMONDEPS)"
-    GENERICDEPS="\$(GTK_GENERICDEPS)"
-    UNIXOBJS="\$(UNIX_OBJS)"
-    UNIXDEPS="\$(UNIX_DEPS)"
-    GUIDIST=GTK_DIST
+        if test "$wxUSE_DEBUG_FLAG" = yes ; then
+            if test -f $MGL_ROOT/lib/debug/$MGL_OS/libmgl.a ; then
+                MGL_LIB_TYPE=debug
+            fi
+        fi
+        if test "x$MGL_LIB_TYPE" = x ; then
+            if test -f $MGL_ROOT/lib/release/$MGL_OS/libmgl.a ; then
+                MGL_LIB_TYPE=release
+            else
+                AC_MSG_ERROR([Cannot find MGL libraries, make sure they are compiled.])
+            fi
+        fi
 
-    dnl test for XIM support in libgdk
-    AC_CHECK_LIB(gdk, gdk_im_open, AC_DEFINE(HAVE_XIM))
-fi
+        TOOLKIT_INCLUDE="-I$MGL_ROOT/include"
+        GUI_TK_LIBRARY="-L$MGL_ROOT/lib/$MGL_LIB_TYPE/$MGL_OS -lmgl -lmglcpp -lpm"
 
-if test "$wxUSE_WINE" = 1; then
-    AC_MSG_CHECKING(for WINE includes)
-    WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, windows.h)
-    if test "$ac_find_includes" != "" ; then
-        AC_MSG_RESULT(found $ac_find_includes)
-        TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE -I$ac_find_includes"
-    else
-        AC_MSG_RESULT(no)
-        AC_MSG_ERROR(please set CFLAGS to contain the location of windows.h)
+        AFMINSTALL=afminstall
+        TOOLKIT=MGL
+        GUIDIST=MGL_DIST
     fi
 
-    XPM_LINK=""
-    AC_MSG_CHECKING(for Xpm library)
-    WX_PATH_FIND_LIBRARIES($SEARCH_LIB,Xpm)
-    if test "$ac_find_libraries" != "" ; then
-        GUI_TK_LIBRARY="-L$ac_find_libraries"
-        XPM_LINK="-lXpm"
-        AC_DEFINE(wxHAVE_LIB_XPM)
-        AC_MSG_RESULT(found at $ac_find_libraries)
-    else
-        AC_MSG_RESULT(no)
-        AC_MSG_WARN(library will be compiled without support for images in XPM format)
-    fi
+    if test "$wxUSE_WINE" = 1; then
+        AC_MSG_CHECKING(for WINE includes)
+        WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, windows.h)
+        if test "$ac_find_includes" != "" ; then
+            AC_MSG_RESULT(found $ac_find_includes)
+            TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE -I$ac_find_includes"
+        else
+            AC_MSG_RESULT(no)
+            AC_MSG_ERROR(please set CFLAGS to contain the location of windows.h)
+        fi
 
-    MESA_LINK=""
-    AC_MSG_CHECKING(for Mesa library)
-    WX_PATH_FIND_LIBRARIES($SEARCH_LIB,MesaGL)
-    if test "$ac_find_libraries" != "" ; then
-        GUI_TK_LIBRARY="$GUI_TK_LIBRARY -L$ac_find_libraries"
-        MESA_LINK="-lMesaGL"
-        AC_MSG_RESULT(found at $ac_find_libraries)
-    else
-        AC_MSG_ERROR(no)
-    fi
+        XPM_LINK=""
+        AC_MSG_CHECKING(for Xpm library)
+        WX_PATH_FIND_LIBRARIES($SEARCH_LIB,Xpm)
+        if test "$ac_find_libraries" != "" ; then
+            GUI_TK_LIBRARY="-L$ac_find_libraries"
+            XPM_LINK="-lXpm"
+            AC_DEFINE(wxHAVE_LIB_XPM)
+            AC_MSG_RESULT(found at $ac_find_libraries)
+        else
+            AC_MSG_RESULT(no)
+            AC_MSG_WARN(library will be compiled without support for images in XPM format)
+        fi
 
-    GUI_TK_LINK="-lwine $MESA_LINK $XPM_LINK -lXxf86dga -lXxf86vm -lSM -lICE -lXext -lXmu -lX11 -lncurses"
-    GUI_TK_LIBRARY="$GUI_TK_LIBRARY $GUI_TK_LINK"
-    WXWINE=1
-    TOOLKIT=MSW
+        MESA_LINK=""
+        AC_MSG_CHECKING(for Mesa library)
+        WX_PATH_FIND_LIBRARIES($SEARCH_LIB,MesaGL)
+        if test "$ac_find_libraries" != "" ; then
+            GUI_TK_LIBRARY="$GUI_TK_LIBRARY -L$ac_find_libraries"
+            MESA_LINK="-lMesaGL"
+            AC_MSG_RESULT(found at $ac_find_libraries)
+        else
+            AC_MSG_ERROR(no)
+        fi
 
-    GUIHEADERS="\$(MSW_HEADERS)"
-    GUIOBJS="\$(MSW_GUIOBJS)"
-    COMMONOBJS="\$(MSW_COMMONOBJS)"
-    GENERICOBJS="\$(MSW_GENERICOBJS)"
-    GUIDEPS="\$(MSW_GUIDEPS)"
-    COMMONDEPS="\$(MSW_COMMONDEPS)"
-    GENERICDEPS="\$(MSW_GENERICDEPS)"
-    UNIXOBJS="\$(UNIX_OBJS)"
-    UNIXDEPS="\$(UNIX_DEPS)"
-    GUIDIST=MSW_DIST
-fi
+        GUI_TK_LINK="-lwine $MESA_LINK $XPM_LINK -lXxf86dga -lXxf86vm -lSM -lICE -lXext -lXmu -lX11 -lncurses"
+        GUI_TK_LIBRARY="$GUI_TK_LIBRARY $GUI_TK_LINK"
+        WXWINE=1
+        TOOLKIT=MSW
+        GUIDIST=MSW_DIST
+    fi
 
-dnl use standard macros to check for X headers/libs, this brings support
-dnl for the standard configure options --x-includes and --x-libraries;
-dnl the path to the X headers/libs is not only needed for motif, but also
-dnl by the OpenGL and XKBlib.h checks further down
+    dnl use standard macros to check for X headers/libs, this brings support
+    dnl for the standard configure options --x-includes and --x-libraries;
+    dnl the path to the X headers/libs is not only needed for motif, but also
+    dnl by the OpenGL and XKBlib.h checks further down
 
-AC_PATH_XTRA
-CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-LDFLAGS="$LDFLAGS $X_LIBS"
+    AC_PATH_XTRA
+    CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+    LDFLAGS="$LDFLAGS $X_LIBS"
 
-if test "$wxUSE_MOTIF" = 1; then
-    if test "$no_x" = "yes"; then
-      AC_MSG_ERROR(X11 not found, please use --x-includes and/or --x-libraries options)
-    fi
+    if test "$wxUSE_MOTIF" = 1; then
+        if test "$no_x" = "yes"; then
+          AC_MSG_ERROR(X11 not found, please use --x-includes and/or --x-libraries options)
+        fi
 
-    GUI_TK_LIBRARY="$X_LIBS"
-    TOOLKIT_INCLUDE="$X_CFLAGS"
+        GUI_TK_LIBRARY="$X_LIBS"
+        TOOLKIT_INCLUDE="$X_CFLAGS"
+
+        AFMINSTALL=afminstall
+
+        dnl manual check for X11 headers/libs
+        dnl
+        dnl    AC_MSG_CHECKING(for X11 headers)
+        dnl    WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, X11/Intrinsic.h)
+        dnl    if test "$ac_find_includes" != "" ; then
+        dnl        AC_MSG_RESULT(found $ac_find_includes)
+        dnl    else
+        dnl        AC_MSG_RESULT(no)
+        dnl        AC_MSG_ERROR(please set CFLAGS to contain the location of X11/Intrinsic.h)
+        dnl    fi
+        dnl
+        dnl    AC_MSG_CHECKING(for X11 libraries)
+        dnl    WX_PATH_FIND_LIBRARIES($SEARCH_LIB, X11)
+        dnl    if test "$ac_find_libraries" != "" ; then
+        dnl        WX_INCLUDE_PATH_EXIST($ac_find_includes, $TOOLKIT_INCLUDE)
+        dnl        WX_LINK_PATH_EXIST($ac_find_libraries, $GUI_TK_LIBRARY)
+        dnl
+        dnl        GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
+        dnl        TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE $ac_path_to_include"
+        dnl        AC_MSG_RESULT(found at $ac_find_libraries)
+        dnl    else
+        dnl        AC_MSG_RESULT(no)
+        dnl        AC_MSG_ERROR(please set LDFLAGS to contain the location of libX11)
+        dnl    fi
+
+        COMPILED_X_PROGRAM=0
+
+        AC_MSG_CHECKING(for Motif/Lesstif headers)
+        WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, Xm/Xm.h)
+        if test "$ac_find_includes" != "" ; then
+            AC_MSG_RESULT(found $ac_find_includes)
+        else
+            AC_TRY_COMPILE(
+                [
+                    #include <Xm/Xm.h>
+                ],
+                [
+                    int version;
 
-    AFMINSTALL=afminstall
+                    version = xmUseVersion;
+                ],
+                [
+                    AC_MSG_RESULT(found in default search path)
+                    COMPILED_X_PROGRAM=1
+                ],
+                [
+                    AC_MSG_RESULT(no)
+                    AC_MSG_ERROR(please set CFLAGS to contain the location of Xm/Xm.h)
+                ]
+            )
+        fi
 
-    dnl manual check for X11 headers/libs
-    dnl
-    dnl    AC_MSG_CHECKING(for X11 headers)
-    dnl    WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, X11/Intrinsic.h)
-    dnl    if test "$ac_find_includes" != "" ; then
-    dnl        AC_MSG_RESULT(found $ac_find_includes)
-    dnl    else
-    dnl        AC_MSG_RESULT(no)
-    dnl        AC_MSG_ERROR(please set CFLAGS to contain the location of X11/Intrinsic.h)
-    dnl    fi
-    dnl
-    dnl    AC_MSG_CHECKING(for X11 libraries)
-    dnl    WX_PATH_FIND_LIBRARIES($SEARCH_LIB, X11)
-    dnl    if test "$ac_find_libraries" != "" ; then
-    dnl        WX_INCLUDE_PATH_EXIST($ac_find_includes, $TOOLKIT_INCLUDE)
-    dnl        WX_LINK_PATH_EXIST($ac_find_libraries, $GUI_TK_LIBRARY)
-    dnl
-    dnl        GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
-    dnl        TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE $ac_path_to_include"
-    dnl        AC_MSG_RESULT(found at $ac_find_libraries)
-    dnl    else
-    dnl        AC_MSG_RESULT(no)
-    dnl        AC_MSG_ERROR(please set LDFLAGS to contain the location of libX11)
-    dnl    fi
-
-    COMPILED_X_PROGRAM=0
-
-    AC_MSG_CHECKING(for Motif/Lesstif headers)
-    WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, Xm/Xm.h)
-    if test "$ac_find_includes" != "" ; then
-        AC_MSG_RESULT(found $ac_find_includes)
-    else
-        AC_TRY_COMPILE(
-            [
-                #include <Xm/Xm.h>
-            ],
-            [
-                int version;
+        if test "$COMPILED_X_PROGRAM" = 0; then
+            AC_MSG_CHECKING(for Motif/Lesstif library)
+            WX_PATH_FIND_LIBRARIES($SEARCH_LIB, Xm)
+            if test "$ac_find_libraries" != "" ; then
+                WX_INCLUDE_PATH_EXIST($ac_find_includes, $TOOLKIT_INCLUDE)
+                WX_LINK_PATH_EXIST($ac_find_libraries, $GUI_TK_LIBRARY)
+
+                GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
+                TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE $ac_path_to_include"
+                AC_MSG_RESULT(found at $ac_find_libraries)
+            else
+                dnl it might happen that we found headers in one of the standard
+                dnl paths but the libs are elsewhere - we do need to try to
+                dnl compile a sample program then here
+                AC_TRY_COMPILE(
+                    [
+                        #include <Xm/Xm.h>
+                    ],
+                    [
+                        int version;
 
-                version = xmUseVersion;
-            ],
-            [
-                AC_MSG_RESULT(found in default search path)
-                COMPILED_X_PROGRAM=1
-            ],
-            [
-                AC_MSG_RESULT(no)
-                AC_MSG_ERROR(please set CFLAGS to contain the location of Xm/Xm.h)
-            ]
-        )
-    fi
+                        version = xmUseVersion;
+                    ],
+                    [
+                        AC_MSG_RESULT(found in default search path)
+                        COMPILED_X_PROGRAM=1
+                    ],
+                    [
+                        AC_MSG_RESULT(no)
+                        AC_MSG_ERROR(please set LDFLAGS to contain the location of libXm)
+                    ]
+                )
+            fi
+        fi
 
-    if test "$COMPILED_X_PROGRAM" = 0; then
-        AC_MSG_CHECKING(for Motif/Lesstif library)
-        WX_PATH_FIND_LIBRARIES($SEARCH_LIB, Xm)
+        dnl we don't need this as we used AC_PATH_XTRA above which does it for us
+        dnl
+        dnl dnl if we already compiled a sample program, X libs are surely there
+        dnl if test "$COMPILED_X_PROGRAM" = 0; then
+        dnl     AC_MSG_CHECKING(for Xt library)
+        dnl     WX_PATH_FIND_LIBRARIES($SEARCH_LIB,Xt)
+        dnl     if test "$ac_find_libraries" != "" ; then
+        dnl         WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
+        dnl         GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
+        dnl         AC_MSG_RESULT(found at $ac_find_libraries)
+        dnl     else
+        dnl         AC_TRY_COMPILE
+        dnl         (
+        dnl             [
+        dnl                 #include <X11/Intrinsic.h>
+        dnl             ],
+        dnl             [
+        dnl                 char *p;
+        dnl                 p = XtMalloc(5);
+        dnl             ],
+        dnl             [
+        dnl                 AC_MSG_RESULT(found in default search path)
+        dnl                 COMPILED_X_PROGRAM=1
+        dnl             ],
+        dnl             [
+        dnl                 AC_MSG_RESULT(no)
+        dnl                 AC_MSG_ERROR(please set LDFLAGS to contain the location of libXt)
+        dnl             ]
+        dnl         )
+        dnl     fi
+        dnl fi
+
+        XPM_LINK=""
+        AC_MSG_CHECKING(for Xpm library)
+        WX_PATH_FIND_LIBRARIES($SEARCH_LIB,Xpm)
         if test "$ac_find_libraries" != "" ; then
-            WX_INCLUDE_PATH_EXIST($ac_find_includes, $TOOLKIT_INCLUDE)
-            WX_LINK_PATH_EXIST($ac_find_libraries, $GUI_TK_LIBRARY)
-
+            WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
             GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
-            TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE $ac_path_to_include"
+            XPM_LINK="-lXpm "
+            AC_DEFINE(wxHAVE_LIB_XPM)
             AC_MSG_RESULT(found at $ac_find_libraries)
         else
-            dnl it might happen that we found headers in one of the standard
-            dnl paths but the libs are elsewhere - we do need to try to
-            dnl compile a sample program then here
             AC_TRY_COMPILE(
                 [
-                    #include <Xm/Xm.h>
+                    #include <X11/xpm.h>
                 ],
                 [
                     int version;
 
-                    version = xmUseVersion;
+                    version = XpmLibraryVersion();
                 ],
                 [
+                XPM_LINK="-lXpm "
+                AC_DEFINE(wxHAVE_LIB_XPM)
                     AC_MSG_RESULT(found in default search path)
-                    COMPILED_X_PROGRAM=1
+                    COMPILED_X_PROGRAM=0
                 ],
                 [
                     AC_MSG_RESULT(no)
-                    AC_MSG_ERROR(please set LDFLAGS to contain the location of libXm)
+                    AC_MSG_WARN(library will be compiled without support for images in XPM format)
                 ]
             )
         fi
+
+        GUI_TK_LINK="-lXm $XPM_LINK -lXmu -lXext -lXt -lX11"
+        GUI_TK_LIBRARY="$GUI_TK_LIBRARY $GUI_TK_LINK"
+        TOOLKIT=MOTIF
+        GUIDIST=MOTIF_DIST
     fi
 
-    dnl we don't need this as we used AC_PATH_XTRA above which does it for us
-    dnl
-    dnl dnl if we already compiled a sample program, X libs are surely there
-    dnl if test "$COMPILED_X_PROGRAM" = 0; then
-    dnl     AC_MSG_CHECKING(for Xt library)
-    dnl     WX_PATH_FIND_LIBRARIES($SEARCH_LIB,Xt)
-    dnl     if test "$ac_find_libraries" != "" ; then
-    dnl         WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
-    dnl         GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
-    dnl         AC_MSG_RESULT(found at $ac_find_libraries)
-    dnl     else
-    dnl         AC_TRY_COMPILE
-    dnl         (
-    dnl             [
-    dnl                 #include <X11/Intrinsic.h>
-    dnl             ],
-    dnl             [
-    dnl                 char *p;
-    dnl                 p = XtMalloc(5);
-    dnl             ],
-    dnl             [
-    dnl                 AC_MSG_RESULT(found in default search path)
-    dnl                 COMPILED_X_PROGRAM=1
-    dnl             ],
-    dnl             [
-    dnl                 AC_MSG_RESULT(no)
-    dnl                 AC_MSG_ERROR(please set LDFLAGS to contain the location of libXt)
-    dnl             ]
-    dnl         )
-    dnl     fi
-    dnl fi
-
-    XPM_LINK=""
-    AC_MSG_CHECKING(for Xpm library)
-    WX_PATH_FIND_LIBRARIES($SEARCH_LIB,Xpm)
-    if test "$ac_find_libraries" != "" ; then
-        WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
-        GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
-        XPM_LINK="-lXpm "
-        AC_DEFINE(wxHAVE_LIB_XPM)
-        AC_MSG_RESULT(found at $ac_find_libraries)
-    else
-        AC_TRY_COMPILE(
-            [
-                #include <X11/xpm.h>
-            ],
-            [
-                int version;
+    if test "$wxUSE_MAC" = 1; then
+        TOOLKIT=MAC
+        dnl we can't call this MAC_DIST or autoconf thinks its a macro
+        GUIDIST=MACX_DIST
+    fi
 
-                version = XpmLibraryVersion();
-            ],
-            [
-            XPM_LINK="-lXpm "
-            AC_DEFINE(wxHAVE_LIB_XPM)
-                AC_MSG_RESULT(found in default search path)
-                COMPILED_X_PROGRAM=0
-            ],
-            [
-                AC_MSG_RESULT(no)
-                AC_MSG_WARN(library will be compiled without support for images in XPM format)
-            ]
-        )
+    if test "$wxUSE_PM" = 1; then
+        TOOLKIT=PM
+        GUIDIST=GTK_DIST
     fi
 
-    GUI_TK_LINK="-lXm $XPM_LINK -lXmu -lXext -lXt -lX11"
-    GUI_TK_LIBRARY="$GUI_TK_LIBRARY $GUI_TK_LINK"
-    TOOLKIT=MOTIF
-
-    GUIHEADERS="\$(MOTIF_HEADERS)"
-    GUIOBJS="\$(MOTIF_GUIOBJS)"
-    COMMONOBJS="\$(MOTIF_COMMONOBJS)"
-    GENERICOBJS="\$(MOTIF_GENERICOBJS)"
-    GUIDEPS="\$(MOTIF_GUIDEPS)"
-    COMMONDEPS="\$(MOTIF_COMMONDEPS)"
-    GENERICDEPS="\$(MOTIF_GENERICDEPS)"
-    UNIXOBJS="\$(UNIX_OBJS)"
-    UNIXDEPS="\$(UNIX_DEPS)"
-    GUIDIST=MOTIF_DIST
-fi
-
-if test "$wxUSE_PM" = 1; then
-    TOOLKIT=PM
-
-    GUIOBJS="\$(PM_GUIOBJS)"
-    GUIHEADERS="\$(PM_HEADERS)"
-    COMMONOBJS="\$(PM_COMMONOBJS)"
-    GENERICOBJS="\$(PM_GENERICOBJS)"
-    GUIDEPS="\$(PM_GUIDEPS)"
-    COMMONDEPS="\$(PM_COMMONDEPS)"
-    GENERICDEPS="\$(PM_GENERICDEPS)"
-    UNIXOBJS=
-    UNIXDEPS=
-    GUIDIST=GTK_DIST
-fi
-
-dnl the name of the directory where the files for this toolkit live
-if test "$TOOLKIT" != "PM" ; then
-    TOOLKIT_DIR=`echo ${TOOLKIT} | tr "[[A-Z]]" "[[a-z]]"`
-else
-    TOOLKIT_DIR="os2"
-fi
+    dnl the name of the directory where the files for this toolkit live
+    if test "$TOOLKIT" != "PM" ; then
+        TOOLKIT_DIR=`echo ${TOOLKIT} | tr "[[A-Z]]" "[[a-z]]"`
+    else
+        TOOLKIT_DIR="os2"
+    fi
 
     dnl the (base) name of the library and support files for this toolkit
-    if test "$wxUSE_DEBUG_FLAG" = "yes"; then
-        TOOLKIT_NAME="${TOOLKIT_DIR}d"
+    TOOLKIT_NAME="${TOOLKIT_DIR}"
+
+    dnl the list of paths containing the files for this toolkit
+    TOOLKIT_VPATH="\${top_srcdir}/src/${TOOLKIT_DIR}"
+
+    dnl need to add an extra dir for wxMotif
+    if test "$TOOLKIT_NAME" = "motif"; then
+        TOOLKIT_VPATH="${TOOLKIT_VPATH}${PATH_IFS}\${top_srcdir}/src/motif/xmcombo"
+    fi
+
+    dnl are we using the generic version with this low level toolkit?
+    if test "$wxUSE_UNIVERSAL" = "yes"; then
+        TOOLKIT_NAME="${TOOLKIT_NAME}univ"
+        UNIV_VPATH="\${top_srcdir}/src/univ${PATH_IFS}\${top_srcdir}/src/univ/themes"
+        TOOLKIT_VPATH="${UNIV_VPATH}${PATH_IFS}${TOOLKIT_VPATH}"
+        SETUPH_DIR="univ"
     else
-        TOOLKIT_NAME="${TOOLKIT_DIR}"
+        SETUPH_DIR="${TOOLKIT_DIR}"
+    fi
+
+    dnl append 'd' to the debug library name
+    if test "$wxUSE_DEBUG_FLAG" = "yes"; then
+        TOOLKIT_NAME="${TOOLKIT_NAME}d"
     fi
 
     dnl the symbol which allows conditional compilation for the given toolkit
     TOOLKIT_DEF="-D__WX${TOOLKIT}__"
+    if test "$wxUSE_UNIVERSAL" = "yes"; then
+        TOOLKIT_DEF="${TOOLKIT_DEF} -D__WXUNIVERSAL__"
+    fi
 
     dnl the name of the (libtool) library
     WX_LIBRARY="wx_${TOOLKIT_NAME}"
 
-    dnl the sources, their dependenices and the headers
-    ALL_OBJECTS="\$(GUIOBJS) \$(COMMONOBJS) \$(GENERICOBJS) \$(UNIXOBJS) \$(HTMLOBJS) \$(OGLOBJS)"
+    dnl collect together all the object files for this port
+    if test "$wxUSE_UNIVERSAL" = "yes"; then
+        ALL_OBJECTS="\$(GUI_LOWLEVEL_OBJS) \${UNIVOBJS}"
+    else
+        ALL_OBJECTS="\$(GUIOBJS)"
+    fi
+
+    ALL_OBJECTS="${ALL_OBJECTS} \$(COMMONOBJS) \$(GENERICOBJS)"
+
+    if test "$TOOLKIT" != "MSW"; then
+        ALL_OBJECTS="${ALL_OBJECTS} \$(UNIXOBJS)"
+    fi
+
+    if test "$wxUSE_HTML" = "yes"; then
+        ALL_OBJECTS="${ALL_OBJECTS} \$(HTMLOBJS)"
+    fi
 
     dnl ODBC objects are Unix only
     if test "$TOOLKIT" != "MSW"; then
@@ -1944,9 +2034,32 @@ fi
     if test "$wxUSE_ZLIB" = "yes" ; then
         ALL_OBJECTS="${ALL_OBJECTS} \$(ZLIBOBJS)"
     fi
-    ALL_DEPFILES="\$(GUIDEPS) \$(COMMONDEPS) \$(GENERICDEPS) \$(UNIXDEPS) \$(HTMLDEPS) \$(OGLDEPS)"
+    if test "$wxUSE_FREETYPE" = "yes" ; then
+        ALL_OBJECTS="${ALL_OBJECTS} \$(FREETYPEOBJS)"
+    fi
+
+    dnl collect all .d files together as well
+    if test "$wxUSE_UNIVERSAL" = "yes"; then
+        ALL_DEPFILES="\$(GUI_LOWLEVEL_DEPS) \$(UNIVDEPS)"
+    else
+        ALL_DEPFILES="\$(GUIDEPS)"
+    fi
+
+    ALL_DEPFILES="${ALL_DEPFILES} \$(COMMONDEPS) \$(GENERICDEPS)"
+
+    if test "$TOOLKIT" != "MSW"; then
+        ALL_DEPFILES="${ALL_DEPFILES} \$(UNIXDEPS)"
+    fi
+
+    if test "$wxUSE_HTML" = "yes"; then
+        ALL_DEPFILES="${ALL_DEPFILES} \$(HTMLDEPS)"
+    fi
 
-    PORT_FILES="src/\$(TOOLKITDIR)/files.lst"
+    dnl misc other files depending on the port
+    PORT_FILES="\${top_srcdir}/src/\$(TOOLKITDIR)/files.lst"
+    if test "$wxUSE_UNIVERSAL" = "yes"; then
+        PORT_FILES="${PORT_FILES} \${top_srcdir}/src/univ/files.lst"
+    fi
     RPM_FILES="src/\$(TOOLKITDIR)/rpmfiles.lst"
     RPM_SPEC="wx\$(TOOLKIT).spec"
 
@@ -1969,8 +2082,8 @@ else
     TOOLKIT_DEF="-D__WXBASE__"
 
     dnl the sources, their dependenices and the headers
-    ALL_OBJECTS="\$(BASE_OBJS) \${BASE_UNIX_OBJS}"
-    ALL_DEPFILES="\${BASE_DEPS} \${BASE_UNIX_DEPS}"
+    ALL_OBJECTS="\$(BASE_OBJS) \$(BASE_UNIX_OBJS)"
+    ALL_DEPFILES="\$(BASE_DEPS) \$(BASE_UNIX_DEPS)"
 
     if test "$wxUSE_ZLIB" = "yes" ; then
         ALL_OBJECTS="${ALL_OBJECTS} \$(ZLIBOBJS)"
@@ -2100,7 +2213,7 @@ if test "$wxUSE_SHARED" = "yes"; then
         WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
         WX_ALL="CREATE_LINKS"
       ;;
-      *-*-freebsd* | *-*-netbsd*)
+      *-*-freebsd* | *-*-openbsd* | *-*-netbsd* )
         SHARED_LD="${CC} -shared -o"
         PIC_FLAG="-fPIC"
         if test "$wxUSE_OPENGL" = "yes"; then
@@ -2111,6 +2224,29 @@ if test "$wxUSE_SHARED" = "yes"; then
             WX_ALL="CREATE_LINKS"
         fi
       ;;
+      *-*-darwin* )
+        SHARED_LD="${CXX} -dynamiclib -o"
+        PIC_FLAG="-dynamic -fPIC"
+        if test "$wxUSE_OPENGL" = "yes"; then
+            WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS CREATE_INSTALLED_LINKS_GL"
+            WX_ALL="CREATE_LINKS CREATE_LINKS_GL"
+        else
+            WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
+            WX_ALL="CREATE_LINKS"
+        fi
+        dnl add the resources target
+        WX_ALL="${WX_ALL} ./lib/lib${WX_LIBRARY}-${WX_RELEASE}.r"
+        dnl the name of the shared library
+        WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}-${WX_RELEASE}.dylib.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
+        WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
+        dnl the name of the links to the shared library
+        WX_LIBRARY_LINK1="lib${WX_LIBRARY}-${WX_RELEASE}.dylib.${WX_CURRENT}"
+        WX_LIBRARY_LINK2="lib${WX_LIBRARY}-${WX_RELEASE}.dylib"
+        WX_LIBRARY_LINK3="lib${WX_LIBRARY}.dylib"
+        WX_LIBRARY_LINK1_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib.${WX_CURRENT}"
+        WX_LIBRARY_LINK2_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib"
+        WX_LIBRARY_LINK3_GL="lib${WX_LIBRARY}_gl.dylib"
+      ;;
       *-*-osf* )
         SHARED_LD="${CXX} -shared -o"
         PIC_FLAG="-fPIC"
@@ -2133,7 +2269,7 @@ if test "$wxUSE_SHARED" = "yes"; then
         SHARED_LD="/usr/lpp/xlC/bin/makeC++SharedLib -p 0 -o"
         WX_ALL=${WX_LIBRARY_NAME_SHARED}
       ;;
-      *-*-cygwin32* )
+      *-*-cygwin* )
         dnl only static for now
         WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}"
         WX_TARGET_LIBRARY_GL="${WX_LIBRARY_NAME_STATIC_GL}"
@@ -2206,6 +2342,8 @@ dnl ------------------------------------------------------------------------
 
 dnl defines HAVE_STRINGS_H (where some string functions live on AIX for example)
 AC_CHECK_HEADERS(strings.h)
+dnl defines HAVE_STDLIB_H
+AC_CHECK_HEADERS(stdlib.h)
 dnl defines HAVE_UNISTD_H
 AC_CHECK_HEADERS(unistd.h)
 dnl defines HAVE_WCHAR_H
@@ -2241,6 +2379,81 @@ AC_TYPE_SIZE_T
 dnl   defines uid_t and gid_t if not already defined
 AC_TYPE_UID_T
 
+dnl   check for wchar_t
+AC_CACHE_CHECK([for wchar_t], wx_cv_type_wchar_t,
+[
+    AC_TRY_COMPILE([#include <wchar.h>],
+        [
+            wchar_t wc, *ws;
+            wc = L'a';
+            ws = L"Hello, world!";
+        ],
+        wx_cv_type_wchar_t=yes,
+        AC_TRY_COMPILE([#include <stdlib.h>],
+            [
+                wchar_t wc, *ws;
+                wc = L'a';
+                ws = L"Hello, world!";
+            ],
+        wx_cv_type_wchar_t=yes,
+        wx_cv_type_wchar_t=no)
+    )
+])
+
+if test "$wx_cv_type_wchar_t" = "yes"; then
+    AC_DEFINE(wxUSE_WCHAR_T)
+fi
+
+dnl check what exactly size_t is on this machine - this is necessary to avoid
+dnl ambiguos overloads in several places, notably wx/string.h and wx/array.h
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+AC_CACHE_CHECK([if size_t is unsigned int],
+    wx_cv_size_t_is_uint,
+    dnl an obvious check like AC_TRY_COMPILE[struct Foo { ... };] doesn't work
+    dnl with egcs (at least) up to 1.1.1 as it allows you to compile duplicate
+    dnl methods in a local class (i.e. class inside a function) declaration
+    dnl without any objections!!
+    dnl
+    dnl hence the hack below: we must have Foo at global scope!
+    AC_TRY_COMPILE([#include <stddef.h>],
+        [
+            return 0; }
+
+            struct Foo { void foo(size_t); void foo(unsigned int); };
+
+            int bar() {
+        ],
+        wx_cv_size_t_is_uint=no,
+        wx_cv_size_t_is_uint=yes
+    )
+)
+
+if test "$wx_cv_size_t_is_uint" = "yes"; then
+    AC_DEFINE(wxSIZE_T_IS_UINT)
+else
+    AC_CACHE_CHECK([if size_t is unsigned long],
+        wx_cv_size_t_is_ulong,
+        AC_TRY_COMPILE([#include <stddef.h>],
+            [
+                return 0; }
+
+                struct Foo { void foo(size_t); void foo(unsigned long); };
+
+                int bar() {
+            ],
+            wx_cv_size_t_is_ulong=no,
+            wx_cv_size_t_is_ulong=yes
+        )
+    )
+
+    if test "$wx_cv_size_t_is_ulong" = "yes"; then
+        AC_DEFINE(wxSIZE_T_IS_ULONG)
+    fi
+fi
+
+AC_LANG_RESTORE
+
 dnl ---------------------------------------------------------------------------
 dnl Checks for structures
 dnl ---------------------------------------------------------------------------
@@ -2281,13 +2494,42 @@ dnl check the sizes of integral types (give some reasonable default values for
 dnl cross-compiling)
 dnl   defines the size of certain types of variables in SIZEOF_<TYPE>
 AC_CHECK_SIZEOF(char, 1)
-AC_CHECK_SIZEOF(wchar_t, 4)
 AC_CHECK_SIZEOF(short, 2)
 AC_CHECK_SIZEOF(int *, 4)
 AC_CHECK_SIZEOF(int, 4)
 AC_CHECK_SIZEOF(long, 4)
 AC_CHECK_SIZEOF(long long, 0)
 
+dnl we have to do it ourselves because SGI/Irix's stdio.h does not include
+dnl wchar_t an AC_CHECK_SIZEOF only includes stdio.h
+dnl Mac OS X does not provide wchar.h and wchar_t is defined by stdlib.h (GD)
+AC_CACHE_CHECK([size of wchar_t], wx_cv_sizeof_wchar_t,
+[
+    AC_TRY_RUN(
+        [
+            #ifdef HAVE_WCHAR_H
+            #  include <wchar.h>
+            #endif
+            #ifdef HAVE_STDLIB_H
+            #  include <stdlib.h>
+            #endif
+            #include <stdio.h>
+            int main()
+            {
+                FILE *f=fopen("conftestval", "w");
+                if (!f) exit(1);
+                fprintf(f, "%i", sizeof(wchar_t));
+                exit(0);
+            }
+        ],
+        wx_cv_sizeof_wchar_t=`cat conftestval`,
+        wx_cv_sizeof_wchar_t=0,
+        wx_cv_sizeof_wchar_t=4
+    )
+])
+
+AC_DEFINE_UNQUOTED(SIZEOF_WCHAR_T, $wx_cv_sizeof_wchar_t)
+
 dnl for bytesex stuff (don't use AC_C_BIGENDIAN to allow cross-compiling)
 WX_C_BIGENDIAN
 
@@ -2297,9 +2539,6 @@ WX_CPP_NEW_HEADERS(, AC_DEFINE(wxUSE_IOSTREAMH))
 dnl check whether C++ compiler supports bool built-in type
 WX_CPP_BOOL
 
-dnl check whether we should define _GNU_SOURCE
-WX_GNU_EXTENSIONS
-
 dnl ---------------------------------------------------------------------------
 dnl Check for functions
 dnl ---------------------------------------------------------------------------
@@ -2318,8 +2557,6 @@ AC_CHECK_LIB(c, wcslen, [
 dnl check for vprintf/vsprintf() which are GNU extensions
 AC_FUNC_VPRINTF
 
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
 
 dnl check for vsscanf() and vsnprintf() - on some platforms (Linux, glibc
 dnl 2.1.1 for the first one, HP-UX for the second) it's available in the
@@ -2333,6 +2570,14 @@ dnl understand why it works, remember that AC_TRY_COMPILE() just prepends
 dnl "int main() {" in the beginning of the code and "; return 0; }" at the
 dnl end...
 
+dnl if we fail to find vsnprintf, also try for _vsnprintf as that is what
+dnl we'll find under MSW if it exists.
+
+dnl final note: AC_TRY_COMPILE will only be executed if there is nothing in
+dnl the cache so we have to do AC_DEFINE(HAVE_VSNPRINTF) below and not inside
+dnl it or the symbol wouldn't be defined for the 2nd and subsequent configure
+dnl runs
+
 dnl check for vsnprintf() - a safe version of vsprintf()
 AC_CACHE_CHECK([for vsnprintf], wx_cv_func_vsnprintf,
 [
@@ -2355,14 +2600,40 @@ AC_CACHE_CHECK([for vsnprintf], wx_cv_func_vsnprintf,
                     vsnprintf(s, 42, fmt, argp);
                     va_end(argp);
                  ], [
-                    AC_DEFINE(HAVE_VSNPRINTF)
                     wx_cv_func_vsnprintf=yes
                  ], [
-                    AC_MSG_WARN(unsafe function sprintf will be used instead of snprintf)
-                    wx_cv_func_vsnprintf=no
+                    AC_TRY_COMPILE([
+                                      #include <stdio.h>
+                                      #include <stdarg.h>
+                                   ], [
+                                      int wx_test_vsnprintf(const char *, ...);
+
+                                      wx_test_vsnprintf("%s");
+                                      return 0;
+                                   }
+
+                                   int wx_test_vsnprintf(const char *fmt, ...)
+                                   {
+                                      char *s;
+
+                                      va_list argp;
+                                      va_start(argp, fmt);
+                                      _vsnprintf(s, 42, fmt, argp);
+                                      va_end(argp);
+                                   ], [
+                                      wx_cv_func_vsnprintf=yes
+                                   ], [
+                                      wx_cv_func_vsnprintf=no
+                                   ])
                  ])
 ])
 
+if test "$wx_cv_func_vsnprintf" = yes; then
+    AC_DEFINE(HAVE_VSNPRINTF)
+else
+    AC_MSG_WARN(unsafe function sprintf will be used instead of snprintf)
+fi
+
 dnl check for vsscanf()
 AC_CACHE_CHECK([for vsscanf], wx_cv_func_vsscanf,
 [
@@ -2383,18 +2654,41 @@ AC_CACHE_CHECK([for vsscanf], wx_cv_func_vsscanf,
                     vsscanf("42", fmt, argp);
                     va_end(argp);
                 ], [
-                    AC_DEFINE(HAVE_VSSCANF)
                     wx_cv_func_vsscanf=yes
                 ], [
                     wx_cv_func_vsscanf=no
                 ])
 ])
 
-AC_LANG_RESTORE
+if test "$wx_cv_func_vsscanf" = yes; then
+    AC_DEFINE(HAVE_VSSCANF)
+fi
 
 dnl the following tests are for Unix(like) systems only
 if test "$TOOLKIT" != "MSW"; then
 
+dnl check for available version of iconv()
+
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+AC_CACHE_CHECK([if iconv() takes char**], wx_cv_iconv_takes_char,
+[
+    AC_TRY_COMPILE([#include <iconv.h>],
+    [
+        char **inbuf, **outbuf;
+        iconv_t cd;
+        size_t insz, outsz;
+        iconv(cd, inbuf, &insz, outbuf, &outsz);
+    ],
+    wx_cv_iconv_takes_char=yes,
+    wx_cv_iconv_takes_char=no)
+])
+AC_LANG_RESTORE
+if test "$wx_cv_iconv_takes_char" = yes ; then
+    AC_DEFINE(WX_ICONV_TAKES_CHAR)
+fi
+
+
 dnl check for POSIX signals if we need them
 if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes" -a "$wxUSE_UNIX" = "yes"; then
     AC_CHECK_FUNCS(sigaction)
@@ -2432,9 +2726,23 @@ fi
 dnl check for vfork() (even if it's the same as fork() in modern Unices)
 AC_CHECK_FUNCS(vfork)
 
+dnl check for fcntl() or at least flock() needed by Unix implementation of
+dnl wxSingleInstanceChecker
+if test "$wxUSE_SNGLINST_CHECKER" = "yes"; then
+    AC_CHECK_FUNCS(fcntl flock, break)
+
+    if test "$ac_cv_func_fcntl" != "yes" -a "$ac_cv_func_flock" != "yes"; then
+        AC_MSG_WARN(wxSingleInstanceChecker not available)
+        wxUSE_SNGLINST_CHECKER=no
+    fi
+fi
+
 dnl check for timegm() used by datetime.cpp
 AC_CHECK_FUNCS(timegm)
 
+dnl look for a function to modify the environment
+AC_CHECK_FUNCS(putenv setenv, break)
+
 HAVE_SOME_SLEEP_FUNC=0
 if test "$USE_BEOS" = 1; then
     dnl BeOS has its own (wonder where did they get it from) sleep() function
@@ -2443,6 +2751,13 @@ if test "$USE_BEOS" = 1; then
     HAVE_SOME_SLEEP_FUNC=1
 fi
 
+if test "$USE_MAC" = 1; then
+    dnl Mac OS X has both nanosleep and usleep
+    dnl but only usleep is defined in unistd.h
+    AC_DEFINE(HAVE_USLEEP)
+    HAVE_SOME_SLEEP_FUNC=1
+fi
+
 if test "$HAVE_SOME_SLEEP_FUNC" != 1; then
     dnl try nanosleep() in libc and libposix4, if this fails - usleep()
     POSIX4_LINK=
@@ -2455,8 +2770,10 @@ if test "$HAVE_SOME_SLEEP_FUNC" != 1; then
                     POSIX4_LINK="-lposix4"
                 ],
                 [
-                    AC_CHECK_FUNCS(usleep)
-                    AC_MSG_WARN([wxSleep() function will not work])
+                    AC_CHECK_FUNCS(usleep,
+                        AC_DEFINE(HAVE_USLEEP),
+                        AC_MSG_WARN([wxSleep() function will not work])
+                    )
                 ]
             )
         ]
@@ -2541,7 +2858,7 @@ if test "$wxUSE_THREADS" = "yes" ; then
     dnl find if POSIX threads are available
 
     dnl AIX calls the library libpthreads - thanks IBM!
-    if test "$wxUSE_AIX" = 1; then
+    if test "$USE_AIX" = 1; then
         THREADS_LIB=pthreads
     else
         THREADS_LIB=pthread
@@ -2584,7 +2901,7 @@ if test "$wxUSE_THREADS" = "yes" ; then
   dnl [
   dnl     AC_CHECK_LIB($THREADS_LINK, $1,
   dnl            AC_DEFINE(HAVE_`'translit($1, `A-Z', 'a-z'),
-  dnl            [AC_CHECK_LIB("posix4", $1,
+  dnl            [AC_CHECK_LIB([posix4], $1,
   dnl                [AC_DEFINE(HAVE_`'translit($1, `A-Z', 'a-z'))
   dnl                 POSIX4_LINK="-lposix4"
   dnl             ])
@@ -2595,7 +2912,7 @@ if test "$wxUSE_THREADS" = "yes" ; then
 
   AC_CHECK_LIB($THREADS_LINK, sched_yield,
                AC_DEFINE(HAVE_SCHED_YIELD),
-               [AC_CHECK_LIB("posix4", sched_yield,
+               [AC_CHECK_LIB([posix4], sched_yield,
                    [AC_DEFINE(HAVE_SCHED_YIELD) POSIX4_LINK="-lposix4"],
                    AC_MSG_WARN(wxThread::Yield will not work properly)
                 )]
@@ -2612,7 +2929,7 @@ if test "$wxUSE_THREADS" = "yes" ; then
                  AC_CHECK_LIB($THREADS_LINK, pthread_attr_setschedparam,
                    AC_CHECK_LIB($THREADS_LINK, sched_get_priority_max,
                        HAVE_PRIOR_FUNCS=1,
-                       AC_CHECK_LIB("posix4", sched_get_priority_max,
+                       AC_CHECK_LIB([posix4], sched_get_priority_max,
                          [
                             HAVE_PRIOR_FUNCS=1
                             POSIX4_LINK="-lposix4"
@@ -2640,13 +2957,72 @@ if test "$wxUSE_THREADS" = "yes" ; then
                     pthread_cleanup_pop(0);
                  ], [
                     wx_cv_func_pthread_cleanup_push=yes
-                    AC_DEFINE(HAVE_THREAD_CLEANUP_FUNCTIONS)
                  ], [
                     wx_cv_func_pthread_cleanup_push=no
                  ])
   ])
 
+  if test "$wx_cv_func_pthread_cleanup_push" = "yes"; then
+      AC_DEFINE(HAVE_THREAD_CLEANUP_FUNCTIONS)
+  fi
+
+  dnl mutexattr_t initialization is done in quite different ways on different
+  dnl platforms, so check for a few things:
+  dnl
+  dnl HAVE_MUTEX_RECURSIVE means that we can create recursive mutexes
+  dnl HAVE_MUTEXATTR_SETTYPE means that we do it using
+  dnl pthread_mutexattr_settype(PTHREAD_MUTEX_RECURSIVE) and if it is not
+  dnl defined, we do it by directly assigned
+  dnl PTHREAD_MUTEX_RECURSIVE_MUTEX_INITIALIZER_NP to attr
+
+  AC_CACHE_CHECK([for pthread_mutexattr_t], wx_cv_type_pthread_mutexattr_t,
+  [
+    AC_TRY_COMPILE([#include <pthread.h>],
+        [
+           pthread_mutexattr_t attr;
+           pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+        ], [
+           wx_cv_type_pthread_mutexattr_t=yes
+        ], [
+           wx_cv_type_pthread_mutexattr_t=no
+        ]
+    )
+  ])
+
+  if test "$wx_cv_type_pthread_mutexattr_t" = "yes"; then
+    AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_T)
+  else
+    dnl don't despair, there may be another way to do it
+    AC_CACHE_CHECK([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER],
+                   wx_cv_type_pthread_rec_mutex_init,
+    [
+        AC_TRY_COMPILE([#include <pthread.h>],
+            [
+                pthread_mutex_t attr = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+            ], [
+                wx_cv_type_pthread_rec_mutex_init=yes
+            ], [
+                wx_cv_type_pthread_rec_mutex_init=no
+            ]
+        )
+    ])
+    if test "$wx_cv_type_pthread_rec_mutex_init" = "yes"; then
+      AC_DEFINE(HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
+    else
+      dnl this may break code working elsewhere, so at least warn about it
+      AC_MSG_WARN([wxMutex won't be recursive on this platform])
+    fi
+  fi
+
   THREADS_LINK="-l$THREADS_LINK"
+
+  dnl building MT programs under Solaris with the native compiler requires -mt
+  dnl switch
+  if test "$USE_SOLARIS" = "yes" -a "$GCC" != "yes"; then
+      CFLAGS="${CFLAGS} -mt"
+      CXXFLAGS="${CXXFLAGS} -mt"
+      LDFLAGS="${LDFLAGS} -mt"
+  fi
 fi
 
 dnl from if !MSW
@@ -2655,9 +3031,11 @@ fi
 if test "$wxUSE_THREADS" = "yes"; then
   AC_DEFINE(wxUSE_THREADS)
 
-  dnl must define _REENTRANT for multithreaded code
-  CFLAGS="${CFLAGS} -D_REENTRANT"
-  CXXFLAGS="${CXXFLAGS} -D_REENTRANT"
+  dnl must define _REENTRANT for multithreaded code except for Mac OS X
+  if test "$wxUSE_MAC" = "0"; then
+    CFLAGS="${CFLAGS} -D_REENTRANT"
+    CXXFLAGS="${CXXFLAGS} -D_REENTRANT"
+  fi
 
   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS thread"
 else
@@ -2692,6 +3070,20 @@ if test "$WXWINE" = 1 ; then
   TOOLKIT_DEF="${TOOLKIT_DEF} -D__WXWINE__"
 fi
 
+if test "$wxUSE_MAC" = 1 ; then
+  TOOLKIT_DEF="${TOOLKIT_DEF} -D__UNIX__ -D__POWERPC__ -DTARGET_CARBON"
+  CFLAGS="${CFLAGS} -fno-common -fpascal-strings"
+  CPPFLAGS="${CPPFLAGS} -cpp-precomp -fno-common -fpascal-strings"
+  AC_CHECK_PROG(REZ, Rez, Rez, /Developer/Tools/Rez)
+  AC_CHECK_PROG(DEREZ, Derez, Derez, /Developer/Tools/Derez)
+  RESCOMP=${REZ}
+  REZFLAGS="-d __UNIX__ -useDF"
+  DEREZFLAGS="Carbon.r -useDF"
+  RESFLAGS="Carbon.r -t APPL"
+  LIBWXMACRES="\$(LIBWX_MACRES)"
+  LIBWXMACRESCOMP="\$(LIBWX_MACRESCOMP)"
+fi
+
 if test "$wxUSE_CYGWIN" = 1 ; then
   TOOLKIT_DEF="${TOOLKIT_DEF} -D__WIN95__"
 fi
@@ -2735,12 +3127,13 @@ fi
 
 DEP_INFO_FLAGS=
 CODE_GEN_FLAGS=
+CODE_GEN_FLAGS_CXX=
 if test "$GCC" = yes ; then
     if test "$wxUSE_NO_RTTI" = "yes" ; then
-        CODE_GEN_FLAGS="$CODE_GEN_FLAGS -fno-rtti"
+        CODE_GEN_FLAGS_CXX="$CODE_GEN_FLAGS -fno-rtti"
     fi
     if test "$wxUSE_NO_EXCEPTIONS" = "yes" ; then
-        CODE_GEN_FLAGS="$CODE_GEN_FLAGS -fno-exceptions"
+        CODE_GEN_FLAGS_CXX="$CODE_GEN_FLAGS -fno-exceptions"
     fi
     if test "$wxUSE_PERMISSIVE" = "yes" ; then
        CODE_GEN_FLAGS="$CODE_GEN_FLAGS -fpermissive"
@@ -2768,6 +3161,16 @@ else
     fi
 fi
 
+if test "$WXWIN_COMPATIBILITY_2" = "yes"; then
+    AC_DEFINE(WXWIN_COMPATIBILITY_2)
+
+    WXWIN_COMPATIBILITY_2_2="yes"
+fi
+
+if test "$WXWIN_COMPATIBILITY_2_2" = "yes"; then
+    AC_DEFINE(WXWIN_COMPATIBILITY_2_2)
+fi
+
 dnl ---------------------------------------------------------------------------
 dnl Optional libraries
 dnl ---------------------------------------------------------------------------
@@ -2821,7 +3224,29 @@ if test "$wxUSE_LIBJPEG" = "yes" -o "$wxUSE_LIBJPEG" = "sys" ; then
     JPEG_INCLUDE="-I\${top_srcdir}/src/jpeg"
   else
     JPEG_LINK=
-    AC_CHECK_HEADER(jpeglib.h, AC_CHECK_LIB(jpeg, jpeg_read_header, JPEG_LINK="-ljpeg"))
+    dnl can't use AC_CHECK_HEADER as jconfig.h defines things like
+    dnl HAVE_STDLIB_H which are already defined and this provokes
+    dnl a compiler warning which configure considers as an error...
+    AC_MSG_CHECKING(for jpeglib.h)
+    AC_CACHE_VAL(ac_cv_header_jpeglib_h,
+        AC_TRY_COMPILE(
+            [
+                #undef HAVE_STDLIB_H
+                #include <stdio.h>
+                #include <jpeglib.h>
+            ],
+            [
+            ],
+            ac_cv_header_jpeglib_h=yes,
+            ac_cv_header_jpeglib_h=no
+        )
+    )
+    AC_MSG_RESULT($ac_cv_header_jpeglib_h)
+
+    if test "$ac_cv_header_jpeglib_h" = "yes"; then
+        AC_CHECK_LIB(jpeg, jpeg_read_header, JPEG_LINK="-ljpeg")
+    fi
+
     if test "x$JPEG_LINK" = "x" ; then
         AC_MSG_ERROR(system jpeg library not found! Use --with-libjpeg=yes to use the built-in one)
     fi
@@ -2831,7 +3256,7 @@ fi
 TIFF_INCLUDE=
 if test "$wxUSE_LIBTIFF" = "yes" -o "$wxUSE_LIBTIFF" = "sys" ; then
   AC_DEFINE(wxUSE_LIBTIFF)
-  if test "$wxUSE_LIBTIFF" = "yes" ; then  
+  if test "$wxUSE_LIBTIFF" = "yes" ; then
     TIFF_INCLUDE="-I\${top_srcdir}/src/tiff"
   else
     TIFF_LINK=
@@ -2845,6 +3270,25 @@ if test "$wxUSE_LIBTIFF" = "yes" -o "$wxUSE_LIBTIFF" = "sys" ; then
   fi
 fi
 
+FREETYPE_INCLUDE=
+if test "$wxUSE_FREETYPE" = "yes" -o "$wxUSE_FREETYPE" = "sys" ; then
+  AC_DEFINE(wxUSE_FREETYPE)
+  if test "$wxUSE_FREETYPE" = "yes" ; then
+    FREETYPE_INCLUDE="-I\${top_srcdir}/src/freetype"
+  else
+    FREETYPE_LINK=
+    AC_CHECK_HEADER(freetype.h,
+                    AC_CHECK_LIB(freetype, FT_Render_Glyph,
+                                 FREETYPE_LINK="-lfreetype",
+                                 ,
+                                 [-lm])
+                   )
+    if test "x$FREETYPE_LINK" = "x" ; then
+        AC_MSG_ERROR(system freetype library not found! Use --with-freetype=yes to use the built-in freetype)
+    fi
+  fi
+fi
+
 if test "$wxUSE_OPENGL" = "yes"; then
   AC_CHECK_HEADER(GL/gl.h, [
     AC_DEFINE(wxUSE_OPENGL)
@@ -2897,14 +3341,38 @@ if test "$wxUSE_APPLE_IEEE" = "yes"; then
   AC_DEFINE(wxUSE_APPLE_IEEE)
 fi
 
+if test "$wxUSE_TIMER" = "yes"; then
+  AC_DEFINE(wxUSE_TIMER)
+fi
+
 if test "$wxUSE_WAVE" = "yes"; then
   AC_DEFINE(wxUSE_WAVE)
 fi
 
+if test "$wxUSE_CMDLINE_PARSER" = "yes"; then
+  AC_DEFINE(wxUSE_CMDLINE_PARSER)
+fi
+
+if test "$wxUSE_STOPWATCH" = "yes"; then
+  AC_DEFINE(wxUSE_STOPWATCH)
+fi
+
+if test "$wxUSE_DATETIME" = "yes"; then
+  AC_DEFINE(wxUSE_DATETIME)
+fi
+
+if test "$wxUSE_TIMEDATE" = "yes"; then
+  AC_DEFINE(wxUSE_TIMEDATE)
+fi
+
 if test "$wxUSE_FILE" = "yes"; then
   AC_DEFINE(wxUSE_FILE)
 fi
 
+if test "$wxUSE_FFILE" = "yes"; then
+  AC_DEFINE(wxUSE_FFILE)
+fi
+
 if test "$wxUSE_FILESYSTEM" = "yes"; then
   AC_DEFINE(wxUSE_FILESYSTEM)
 fi
@@ -2925,6 +3393,10 @@ if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes"; then
   AC_DEFINE(wxUSE_ON_FATAL_EXCEPTION)
 fi
 
+if test "$wxUSE_SNGLINST_CHECKER" = "yes"; then
+  AC_DEFINE(wxUSE_SNGLINST_CHECKER)
+fi
+
 if test "$wxUSE_BUSYINFO" = "yes"; then
   AC_DEFINE(wxUSE_BUSYINFO)
 fi
@@ -2962,14 +3434,22 @@ fi
 
 if test "$wxUSE_LOG" = "yes"; then
   AC_DEFINE(wxUSE_LOG)
+
+    if test "$wxUSE_LOGGUI" = "yes"; then
+      AC_DEFINE(wxUSE_LOGGUI)
+    fi
+
+    if test "$wxUSE_LOGWINDOW" = "yes"; then
+      AC_DEFINE(wxUSE_LOGWINDOW)
+    fi
 fi
 
 if test "$wxUSE_LONGLONG" = "yes"; then
   AC_DEFINE(wxUSE_LONGLONG)
 fi
 
-if test "$wxUSE_PLOT" = "yes"; then
-  AC_DEFINE(wxUSE_PLOT)
+if test "$wxUSE_GEOMETRY" = "yes"; then
+  AC_DEFINE(wxUSE_GEOMETRY)
 fi
 
 if test "$wxUSE_DIALUP_MANAGER" = "yes" ; then
@@ -2985,7 +3465,7 @@ dnl ------------------------------------------------------------------------
 dnl time/date functions
 dnl ------------------------------------------------------------------------
 
-if test "$wxUSE_TIMEDATE" = "yes"; then
+if test "$wxUSE_DATETIME" = "yes"; then
     dnl check for strptime
     AC_CHECK_FUNCS(strptime)
 
@@ -3057,13 +3537,16 @@ if test "$wxUSE_TIMEDATE" = "yes"; then
                 ],
                 [
                     wx_cv_struct_tm_has_gmtoff=yes
-                    AC_DEFINE(WX_GMTOFF_IN_TM)
                 ],
                 wx_cv_struct_tm_has_gmtoff=no
             )
         ])
     fi
 
+    if test "$wx_cv_struct_tm_has_gmtoff" = "yes"; then
+        AC_DEFINE(WX_GMTOFF_IN_TM)
+    fi
+
     dnl check for gettimeofday (SVr4, BSD 4.3) and ftime (V7, BSD 4.3) for the
     dnl function to be used for high resolution timers
     AC_CHECK_FUNCS(gettimeofday ftime, break)
@@ -3132,8 +3615,9 @@ if test "$wxUSE_SOCKETS" = "yes"; then
     )
 fi
 
-fi
-dnl if !MSW
+dnl this test may be appropriate if building under cygwin
+dnl right now I'm assuming it also uses the winsock stuff
+dnl like mingw does..  -- RL
 
 if test "$wxUSE_SOCKETS" = "yes" ; then
     dnl determine the type of third argument for getsockname
@@ -3189,6 +3673,9 @@ if test "$wxUSE_SOCKETS" = "yes" ; then
     fi
 fi
 
+fi
+dnl if !MSW
+
 if test "$wxUSE_SOCKETS" = "yes" ; then
     AC_DEFINE(wxUSE_SOCKETS)
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS sockets"
@@ -3234,10 +3721,14 @@ if test "$TOOLKIT" != "MSW"; then
 HAVE_DL_FUNCS=0
 HAVE_SHL_FUNCS=0
 if test "$wxUSE_DYNLIB_CLASS" = "yes"; then
-    dnl the test is a bit complicated because we check for dlopen() both with
-    dnl and without -ldl and we also try to find shl_load() if there is no
-    dnl dlopen() on this system
-    AC_CHECK_FUNCS(dlopen,
+    if test "$USE_MAC" = 1; then
+        dnl Mac OS X needs dl_macosx.c to be compiled in to fake dlopen/dlerror
+        HAVE_DL_FUNCS=1
+    else
+        dnl the test is a bit complicated because we check for dlopen() both with
+        dnl and without -ldl and we also try to find shl_load() if there is no
+        dnl dlopen() on this system
+        AC_CHECK_FUNCS(dlopen,
         [
             AC_DEFINE(HAVE_DLOPEN)
             HAVE_DL_FUNCS=1
@@ -3271,6 +3762,7 @@ if test "$wxUSE_DYNLIB_CLASS" = "yes"; then
                        AC_DEFINE(HAVE_DLERROR),
                        AC_CHECK_LIB(dl, dlerror, AC_DEFINE(HAVE_DLERROR)))
     fi
+    fi
 
     if test "$HAVE_DL_FUNCS" = 0; then
         if test "$HAVE_SHL_FUNCS" = 0; then
@@ -3298,6 +3790,10 @@ dnl ---------------------------------------------------------------------------
 dnl String stuff
 dnl ---------------------------------------------------------------------------
 
+if test "$wxUSE_FONTMAP" = "yes" ; then
+  AC_DEFINE(wxUSE_FONTMAP)
+fi
+
 if test "$wxUSE_UNICODE" = "yes" ; then
   AC_DEFINE(wxUSE_UNICODE)
 fi
@@ -3327,9 +3823,6 @@ if test "$wxUSE_ODBC" = "yes" ; then
     AC_DEFINE(wxUSE_ODBC)
     WXODBCFLAG="-D_IODBC_"
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS db"
-    IODBCOBJS="\$(IODBC_OBJS)"
-else
-    IODBCOBJS=
 fi
 
 dnl ----------------------------------------------------------------
@@ -3369,6 +3862,10 @@ fi
 if test "$wxUSE_HELP" = "yes"; then
     AC_DEFINE(wxUSE_HELP)
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS help"
+
+    if test "$wxUSE_WXHTML_HELP" = "yes"; then
+        AC_DEFINE(wxUSE_WXHTML_HELP)
+    fi
 fi
 
 if test "$wxUSE_PRINTING_ARCHITECTURE" = "yes" ; then
@@ -3385,12 +3882,8 @@ if test "$wxUSE_PROLOGIO" = "yes" ; then
 fi
 
 if test "$wxUSE_RESOURCES" = "yes" ; then
-    if test "$wxUSE_PROLOGIO" = "yes" ; then
-        AC_DEFINE(wxUSE_RESOURCES)
-        SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS resource"
-    else
-        AC_MSG_WARN([wxWindows ressource system requires PrologIO and can't be compiled without it.])
-    fi
+    AC_DEFINE(wxUSE_RESOURCES)
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS resource"
 fi
 
 if test "$wxUSE_X_RESOURCES" = "yes"; then
@@ -3411,6 +3904,7 @@ fi
 
 if test "$wxUSE_CLIPBOARD" = "yes"; then
     AC_DEFINE(wxUSE_CLIPBOARD)
+    AC_DEFINE(wxUSE_DATAOBJ)
 fi
 
 if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then
@@ -3426,11 +3920,33 @@ if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then
         wxUSE_DRAG_AND_DROP=no
     fi
 
+    if test "$wxUSE_MAC" = 1; then
+        AC_MSG_WARN([Drag and drop is not yet supported under Mac OS X])
+        wxUSE_DRAG_AND_DROP=no
+    fi
+
     if test "$USE_WIN32" = 1; then
         dnl check for ole headers and disable DnD if not present (earlier
         dnl versions of mingw32 don't have them)
+
         AC_CHECK_HEADERS(ole2.h)
-        if test "x$HAVE_OLE2_H" = x ; then
+
+        if test "$ac_cv_header_ole2_h" = "yes" ; then
+            if test "$GCC" = yes ; then
+                ALL_OBJECTS="$ALL_OBJECTS \$(OLEOBJS)"
+                ALL_DEPFILES="$ALL_DEPFILES \$(OLEDEPS)"
+                CODE_GEN_FLAGS_CXX="$CODE_GEN_FLAGS_CXX -fvtable-thunks"
+                LIBS="$LIBS -lole32 -luuid"
+
+                dnl metafiles need the ole code, right??  if not this
+                dnl doesn't need to be in here.
+                if test "$wxUSE_METAFILE" = "yes"; then
+                    AC_DEFINE(wxUSE_METAFILE)
+                    dnl this one should probably be made separately configurable
+                    AC_DEFINE(wxUSE_ENH_METAFILE)
+                fi
+            fi
+        else
             AC_MSG_WARN(Drag and drop disabled because OLE headers not found)
             wxUSE_DRAG_AND_DROP=no
         fi
@@ -3451,48 +3967,74 @@ dnl ---------------------------------------------------------------------------
 dnl GUI controls
 dnl ---------------------------------------------------------------------------
 
+USES_CONTROLS=0
+if test "$wxUSE_CONTROLS" = "yes"; then
+  USES_CONTROLS=1
+fi
+
 if test "$wxUSE_ACCEL" = "yes"; then
   AC_DEFINE(wxUSE_ACCEL)
+  USES_CONTROLS=1
+fi
+
+if test "$wxUSE_BUTTON" = "yes"; then
+  AC_DEFINE(wxUSE_BUTTON)
+  USES_CONTROLS=1
+fi
+
+if test "$wxUSE_BMPBUTTON" = "yes"; then
+  AC_DEFINE(wxUSE_BMPBUTTON)
+  USES_CONTROLS=1
+fi
+
+if test "$wxUSE_CALCTRL" = "yes"; then
+  AC_DEFINE(wxUSE_CALENDARCTRL)
+  USES_CONTROLS=1
+  SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS calendar"
 fi
 
 if test "$wxUSE_CARET" = "yes"; then
   AC_DEFINE(wxUSE_CARET)
+  USES_CONTROLS=1
   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS caret"
 fi
 
 if test "$wxUSE_COMBOBOX" = "yes"; then
   AC_DEFINE(wxUSE_COMBOBOX)
+  USES_CONTROLS=1
 fi
 
 if test "$wxUSE_CHOICE" = "yes"; then
   AC_DEFINE(wxUSE_CHOICE)
-fi
-
-if test "$wxUSE_BMPBUTTON" = "yes"; then
-  AC_DEFINE(wxUSE_BMPBUTTON)
+  USES_CONTROLS=1
 fi
 
 if test "$wxUSE_CHECKBOX" = "yes"; then
   AC_DEFINE(wxUSE_CHECKBOX)
+  USES_CONTROLS=1
 fi
 
 if test "$wxUSE_CHECKLST" = "yes"; then
   AC_DEFINE(wxUSE_CHECKLISTBOX)
+  USES_CONTROLS=1
   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS checklst"
 fi
 
 if test "$wxUSE_GAUGE" = "yes"; then
   AC_DEFINE(wxUSE_GAUGE)
+  USES_CONTROLS=1
 fi
 
 if test "$wxUSE_NEW_GRID" = "yes"; then
   wxUSE_GRID="yes"
   AC_DEFINE(wxUSE_NEW_GRID)
+  USES_CONTROLS=1
   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS newgrid"
 fi
 
 if test "$wxUSE_GRID" = "yes"; then
   AC_DEFINE(wxUSE_GRID)
+  USES_CONTROLS=1
   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS grid"
 fi
 
@@ -3502,11 +4044,13 @@ fi
 
 if test "$wxUSE_LISTBOX" = "yes"; then
     AC_DEFINE(wxUSE_LISTBOX)
+    USES_CONTROLS=1
 fi
 
 if test "$wxUSE_LISTCTRL" = "yes"; then
     if test "$wxUSE_IMAGLIST" = "yes"; then
         AC_DEFINE(wxUSE_LISTCTRL)
+        USES_CONTROLS=1
         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS listctrl"
     else
         AC_MSG_WARN([wxListCtrl requires wxImageList and won't be compiled without it])
@@ -3515,15 +4059,18 @@ fi
 
 if test "$wxUSE_NOTEBOOK" = "yes"; then
     AC_DEFINE(wxUSE_NOTEBOOK)
+    USES_CONTROLS=1
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS notebook"
 fi
 
 if test "$wxUSE_RADIOBOX" = "yes"; then
     AC_DEFINE(wxUSE_RADIOBOX)
+    USES_CONTROLS=1
 fi
 
 if test "$wxUSE_RADIOBTN" = "yes"; then
     AC_DEFINE(wxUSE_RADIOBTN)
+    USES_CONTROLS=1
 fi
 
 if test "$wxUSE_SASH" = "yes"; then
@@ -3533,19 +4080,23 @@ fi
 
 if test "$wxUSE_SCROLLBAR" = "yes"; then
     AC_DEFINE(wxUSE_SCROLLBAR)
+    USES_CONTROLS=1
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS scroll scrollsub"
 fi
 
 if test "$wxUSE_SLIDER" = "yes"; then
     AC_DEFINE(wxUSE_SLIDER)
+    USES_CONTROLS=1
 fi
 
 if test "$wxUSE_SPINBTN" = "yes"; then
     AC_DEFINE(wxUSE_SPINBTN)
+    USES_CONTROLS=1
 fi
 
 if test "$wxUSE_SPINCTRL" = "yes"; then
     AC_DEFINE(wxUSE_SPINCTRL)
+    USES_CONTROLS=1
 fi
 
 if test "$wxUSE_SPLITTER" = "yes"; then
@@ -3555,10 +4106,17 @@ fi
 
 if test "$wxUSE_STATBMP" = "yes"; then
     AC_DEFINE(wxUSE_STATBMP)
+    USES_CONTROLS=1
 fi
 
 if test "$wxUSE_STATBOX" = "yes"; then
     AC_DEFINE(wxUSE_STATBOX)
+    USES_CONTROLS=1
+fi
+
+if test "$wxUSE_STATTEXT" = "yes"; then
+    AC_DEFINE(wxUSE_STATTEXT)
+    USES_CONTROLS=1
 fi
 
 if test "$wxUSE_STATLINE" = "yes"; then
@@ -3566,11 +4124,13 @@ if test "$wxUSE_STATLINE" = "yes"; then
         AC_MSG_WARN([wxStaticLine is not supported under WINE])
     else
         AC_DEFINE(wxUSE_STATLINE)
+        USES_CONTROLS=1
     fi
 fi
 
 if test "$wxUSE_STATUSBAR" = "yes"; then
     AC_DEFINE(wxUSE_STATUSBAR)
+    USES_CONTROLS=1
 
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS statbar"
 fi
@@ -3580,24 +4140,45 @@ if test "$wxUSE_TABDIALOG" = "yes"; then
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS tab"
 fi
 
+if test "$wxUSE_TEXTCTRL" = "yes"; then
+    AC_DEFINE(wxUSE_TEXTCTRL)
+    USES_CONTROLS=1
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS text"
+fi
+
+if test "$wxUSE_TOGGLEBTN" = "yes"; then
+    if test "$wxUSE_MAC" = 1; then
+        AC_MSG_WARN([Toggle button is not yet supported under Mac OS X])
+        wxUSE_TOGGLEBTN=no
+    fi
+
+    if test "$wxUSE_TOGGLEBTN" = "yes"; then
+        AC_DEFINE(wxUSE_TOGGLEBTN)
+        USES_CONTROLS=1
+    fi
+fi
+
 if test "$wxUSE_TOOLBAR_SIMPLE" = "yes"; then
     AC_DEFINE(wxUSE_TOOLBAR_SIMPLE)
     wxUSE_TOOLBAR="yes"
+    USES_CONTROLS=1
 fi
 
 if test "$wxUSE_TOOLBAR" = "yes"; then
     AC_DEFINE(wxUSE_TOOLBAR)
+    USES_CONTROLS=1
 
     dnl if wxUSE_TOOLBAR and !wxUSE_TOOLBAR_SIMPLE => wxUSE_TOOLBAR_NATIVE
     if test "$wxUSE_TOOLBAR_SIMPLE" != "yes"; then
         wxUSE_TOOLBAR_NATIVE="yes"
     fi
 
-    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS toolbar"
-fi
+    if test "$wxUSE_TOOLBAR_NATIVE" = "yes"; then
+        AC_DEFINE(wxUSE_TOOLBAR_NATIVE)
+        USES_CONTROLS=1
+    fi
 
-if test "$wxUSE_TOOLBAR_NATIVE" = "yes"; then
-    AC_DEFINE(wxUSE_TOOLBAR_NATIVE)
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS toolbar"
 fi
 
 if test "$wxUSE_TOOLTIPS" = "yes"; then
@@ -3615,12 +4196,17 @@ fi
 if test "$wxUSE_TREECTRL" = "yes"; then
     if test "$wxUSE_IMAGLIST" = "yes"; then
         AC_DEFINE(wxUSE_TREECTRL)
+        USES_CONTROLS=1
         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS treectrl"
     else
         AC_MSG_WARN([wxTreeCtrl requires wxImageList and won't be compiled without it])
     fi
 fi
 
+if test "$USES_CONTROLS" = 1; then
+    AC_DEFINE(wxUSE_CONTROLS)
+fi
+
 dnl ---------------------------------------------------------------------------
 dnl misc options
 dnl ---------------------------------------------------------------------------
@@ -3630,40 +4216,22 @@ dnl if test "$wxUSE_WXTREE" = "yes"; then
 dnl   AC_DEFINE(wxUSE_WXTREE)
 dnl fi
 
-if test "$wxUSE_METAFILE" = "yes"; then
-    AC_DEFINE(wxUSE_METAFILE)
-fi
-
-if test "$wxUSE_DIRDLG" = "yes"; then
-    if test "$wxUSE_CONSTRAINTS" != "yes"; then
-       AC_MSG_WARN(wxDirDialog requires constraints so it won't be compiled without them)
-    else
-        if test "$wxUSE_TREECTRL" != "yes"; then
-            AC_MSG_WARN(wxDirDialog requires wxTreeCtrl so it won't be compiled without it)
-        else
-            AC_DEFINE(wxUSE_DIRDLG)
-        fi
-    fi
+if test "$wxUSE_DRAGIMAGE" = "yes"; then
+    AC_DEFINE(wxUSE_DRAGIMAGE)
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dragimag"
 fi
 
-if test "$wxUSE_TEXTDLG" = "yes"; then
-    AC_DEFINE(wxUSE_TEXTDLG)
+if test "$wxUSE_MENUS" = "yes"; then
+    AC_DEFINE(wxUSE_MENUS)
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS menu"
 fi
 
-if test "$wxUSE_STARTUP_TIPS" = "yes"; then
-    if test "$wxUSE_CONSTRAINTS" != "yes"; then
-       AC_MSG_WARN(Startup tips requires constraints and won't be compiled without them)
-    else
-        AC_DEFINE(wxUSE_STARTUP_TIPS)
-    fi
+if test "$wxUSE_METAFILE" = "yes"; then
+    AC_DEFINE(wxUSE_METAFILE)
 fi
 
-if test "$wxUSE_PROGRESSDLG" = "yes"; then
-    if test "$wxUSE_CONSTRAINTS" != "yes"; then
-       AC_MSG_WARN(wxProgressDialog requires constraints so it won't be compiled without them)
-    else
-        AC_DEFINE(wxUSE_PROGRESSDLG)
-    fi
+if test "$wxUSE_MIMETYPE" = "yes"; then
+    AC_DEFINE(wxUSE_MIMETYPE)
 fi
 
 if test "$wxUSE_MINIFRAME" = "yes"; then
@@ -3682,6 +4250,10 @@ if test "$wxUSE_VALIDATORS" = "yes"; then
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS validate"
 fi
 
+if test "$wxUSE_IMAGE" = "yes" ; then
+  AC_DEFINE(wxUSE_IMAGE)
+fi
+
 if test "$wxUSE_GIF" = "yes" ; then
   AC_DEFINE(wxUSE_GIF)
 fi
@@ -3694,6 +4266,75 @@ if test "$wxUSE_PNM" = "yes" ; then
   AC_DEFINE(wxUSE_PNM)
 fi
 
+if test "$wxUSE_XPM" = "yes" ; then
+  AC_DEFINE(wxUSE_XPM)
+fi
+
+dnl ---------------------------------------------------------------------------
+dnl common dialog
+dnl ---------------------------------------------------------------------------
+
+if test "$wxUSE_CHOICEDLG" = "yes"; then
+    AC_DEFINE(wxUSE_CHOICEDLG)
+fi
+
+if test "$wxUSE_COLOURDLG" = "yes"; then
+    AC_DEFINE(wxUSE_COLOURDLG)
+fi
+
+if test "$wxUSE_FILEDLG" = "yes"; then
+    AC_DEFINE(wxUSE_FILEDLG)
+fi
+
+if test "$wxUSE_FONTDLG" = "yes"; then
+    AC_DEFINE(wxUSE_FONTDLG)
+fi
+
+if test "$wxUSE_DIRDLG" = "yes"; then
+    if test "$wxUSE_CONSTRAINTS" != "yes"; then
+       AC_MSG_WARN(wxDirDialog requires constraints so it won't be compiled without them)
+    else
+        if test "$wxUSE_TREECTRL" != "yes"; then
+            AC_MSG_WARN(wxDirDialog requires wxTreeCtrl so it won't be compiled without it)
+        else
+            AC_DEFINE(wxUSE_DIRDLG)
+        fi
+    fi
+fi
+
+if test "$wxUSE_MSGDLG" = "yes"; then
+    AC_DEFINE(wxUSE_MSGDLG)
+fi
+
+if test "$wxUSE_NUMBERDLG" = "yes"; then
+    AC_DEFINE(wxUSE_NUMBERDLG)
+fi
+
+if test "$wxUSE_PROGRESSDLG" = "yes"; then
+    if test "$wxUSE_CONSTRAINTS" != "yes"; then
+       AC_MSG_WARN(wxProgressDialog requires constraints so it won't be compiled without them)
+    else
+        AC_DEFINE(wxUSE_PROGRESSDLG)
+    fi
+fi
+
+if test "$wxUSE_STARTUP_TIPS" = "yes"; then
+    if test "$wxUSE_CONSTRAINTS" != "yes"; then
+       AC_MSG_WARN(Startup tips requires constraints and won't be compiled without them)
+    else
+        AC_DEFINE(wxUSE_STARTUP_TIPS)
+    fi
+fi
+
+if test "$wxUSE_TEXTDLG" = "yes"; then
+    AC_DEFINE(wxUSE_TEXTDLG)
+fi
+
+if test "$wxUSE_WIZARDDLG" = "yes"; then
+    AC_DEFINE(wxUSE_WIZARDDLG)
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS wizard"
+fi
+
 dnl ---------------------------------------------------------------------------
 dnl get the string with OS info - used by wxGetOsDescription()
 dnl ---------------------------------------------------------------------------
@@ -3718,11 +4359,14 @@ OPENGL_LIBS="$OPENGL_LINK"
 
 dnl all additional libraries (except wxWindows itself) we link with
 dnl
-dnl note that we always link with -lm - extended.c uses floor() and is always
-dnl linked in
+dnl note that we always link with -lm except for Mac OS X
+dnl extended.c uses floor() and is always linked in
 EXTRA_LIBS="$LIBS $POSIX4_LINK $INET_LINK $WCHAR_LINK $THREADS_LINK $DMALLOC_LINK $DL_LINK $ZLIB_LINK -lm"
+if test "$USE_MAC" = 1 ; then
+    EXTRA_LIBS="$EXTRA_LIBS -framework Carbon -framework System"
+fi
 if test "$wxUSE_GUI" = "yes"; then
-    EXTRA_LIBS="$GUILIBS $PNG_LINK $JPEG_LINK $TIFF_LINK $EXTRA_LIBS"
+    EXTRA_LIBS="$GUILIBS $PNG_LINK $JPEG_LINK $TIFF_LINK $FREETYPE_LINK $EXTRA_LIBS"
 fi
 
 dnl all the libraries needed to link wxWindows programs when using the
@@ -3730,7 +4374,7 @@ dnl makefile system without libtool
 LD_LIBS="\${top_builddir}/lib/${WX_LIBRARY_NAME_STATIC} $EXTRA_LIBS"
 
 dnl all -I options we must pass to the compiler
-INCLUDES="-I. -I\${top_builddir}/include -I\${top_srcdir}/include $ZLIB_INCLUDE $PNG_INCLUDE $JPEG_INCLUDE $TIFF_INCLUDE $TOOLKIT_INCLUDE"
+INCLUDES="-I. -I\${top_builddir}/include -I\${top_srcdir}/include $ZLIB_INCLUDE $PNG_INCLUDE $JPEG_INCLUDE $TIFF_INCLUDE $FREETYPE_INCLUDE $TOOLKIT_INCLUDE"
 
 dnl wxGTK does not need TOOLKIT includes in wx-config
 if test "$wxUSE_GTK" = 1; then
@@ -3759,8 +4403,13 @@ if test "$wxUSE_GUI" = "yes"; then
 
     dnl TODO some samples are never built so far:
     dnl      ipc, mfc, nativdlg, oleauto, ownerdrw, proplist
-    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS controls dialogs dragimag drawing dynamic \
-                     font fractal image menu minimal richedit"
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS controls dialogs \
+                     drawing dynamic event font fractal image \
+                     minimal richedit widgets"
+
+    if test "$wxUSE_UNIVERSAL" = "yes" ; then
+        SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS univ"
+    fi
 
     dnl this is needed to be able to find AFM files
     CPPFLAGS="$CPPFLAGS \$(EXTRADEFS) \$(APPEXTRADEFS)"
@@ -3814,6 +4463,7 @@ AC_SUBST(SHARED_LD)
 AC_SUBST(PIC_FLAG)
 AC_SUBST(DEP_INFO_FLAGS)
 AC_SUBST(CODE_GEN_FLAGS)
+AC_SUBST(CODE_GEN_FLAGS_CXX)
 AC_SUBST(BURNT_LIBRARY_NAME)
 AC_SUBST(BURNT_LIBRARY_NAME_GL)
 AC_SUBST(WX_TARGET_LIBRARY_SONAME)
@@ -3825,24 +4475,16 @@ AC_SUBST(WXDEBUG_DEFINE)
 dnl toolkit options
 AC_SUBST(USE_GUI)
 AC_SUBST(AFMINSTALL)
+AC_SUBST(SETUPH_DIR)
 AC_SUBST(TOOLKIT)
 AC_SUBST(TOOLKIT_DEF)
 AC_SUBST(TOOLKIT_DIR)
 AC_SUBST(TOOLKIT_NAME)
 AC_SUBST(TOOLKIT_INCLUDE)
+AC_SUBST(TOOLKIT_VPATH)
 AC_SUBST(WXCONFIG_INCLUDE)
 
 dnl what to compile
-AC_SUBST(GUIHEADERS)
-AC_SUBST(GUIOBJS)
-AC_SUBST(COMMONOBJS)
-AC_SUBST(GENERICOBJS)
-AC_SUBST(GUIDEPS)
-AC_SUBST(COMMONDEPS)
-AC_SUBST(GENERICDEPS)
-AC_SUBST(IODBCOBJS)
-AC_SUBST(UNIXOBJS)
-AC_SUBST(UNIXDEPS)
 AC_SUBST(ALL_OBJECTS)
 AC_SUBST(ALL_DEPFILES)
 
@@ -3875,6 +4517,13 @@ AC_SUBST(RCOUTPUTSWITCH)
 AC_SUBST(RESPROGRAM)
 AC_SUBST(RESCOMP)
 AC_SUBST(RESFLAGS)
+dnl additional for Mac OS X
+AC_SUBST(REZ)
+AC_SUBST(REZFLAGS)
+AC_SUBST(DEREZ)
+AC_SUBST(DEREZFLAGS)
+AC_SUBST(LIBWXMACRES)
+AC_SUBST(LIBWXMACRESCOMP)
 
 dnl These seam to be missing
 AC_SUBST(DLLTOOL)
@@ -3892,14 +4541,14 @@ AC_PROG_MAKE_SET
 dnl move setup.h back if available
 if test -d include; then
     if test -d include/wx; then
-        if test -d include/wx/${TOOLKIT_DIR}; then
-            if test -f include/wx/${TOOLKIT_DIR}/setup.h; then
-                mv -f include/wx/${TOOLKIT_DIR}/setup.h setup.h 
+        if test -d include/wx/${SETUPH_DIR}; then
+            if test -f include/wx/${SETUPH_DIR}/setup.h; then
+                mv -f include/wx/${SETUPH_DIR}/setup.h setup.h
             fi
         fi
     fi
 fi
-            
+
 AC_CONFIG_HEADER(setup.h:setup.h.in)
 
 dnl some more GUI only things
@@ -3911,6 +4560,10 @@ if test "$wxUSE_GUI" = "yes"; then
     wx_cv_program_ext=$PROGRAM_EXT
     wx_cv_target_library=$WX_TARGET_LIBRARY
     wx_cv_target_libtype=$WX_TARGET_LIBRARY_TYPE
+    dnl we need to export them because passing them through cache won't
+    dnl work when cache=/dev/null (which is default for autoconf 2.50)
+    export wx_cv_path_samplesubdirs wx_cv_path_ifs wx_cv_program_ext \
+           wx_cv_target_library wx_cv_target_libtype
     AC_CONFIG_SUBDIRS(demos samples utils contrib)
 fi
 dnl from wxUSE_GUI
@@ -3926,13 +4579,18 @@ AC_OUTPUT([
             Makefile
           ],
           [
-            chmod +x wx-config
-            mv wx-config wx${TOOLKIT_NAME}-config
-            ${LN_S} wx${TOOLKIT_NAME}-config wx-config
-            
+            dnl don't move the file on itself - this happens when we run
+            dnl config.status which, as configure, executes these commands
+            dnl but, unlike it, doesn't create wx-config (which already
+            if test ! -f wx${TOOLKIT_NAME}-config; then
+                chmod +x wx-config
+                mv wx-config wx${TOOLKIT_NAME}-config
+                ${LN_S} wx${TOOLKIT_NAME}-config wx-config
+            fi
+
             dnl the debian build process wants setup.h in the lib subdir so we
             dnl can pretend wxWin is already installed, so we *copy* it there
-            
+
             if test ! -d lib; then
               mkdir lib
             fi
@@ -3949,7 +4607,7 @@ AC_OUTPUT([
               mkdir lib/wx/include/wx/${TOOLKIT_NAME}
             fi
             if test -f setup.h; then
-                cp -f setup.h lib/wx/include/wx/${TOOLKIT_NAME}/setup.h
+                cp -fp setup.h lib/wx/include/wx/${TOOLKIT_NAME}/setup.h
             fi
 
             dnl *move* setup.h to its final place
@@ -3960,18 +4618,19 @@ AC_OUTPUT([
             if test ! -d include/wx; then
               mkdir include/wx
             fi
-            if test ! -d include/wx/${TOOLKIT_DIR}; then
-              mkdir include/wx/${TOOLKIT_DIR}
+            if test ! -d include/wx/${SETUPH_DIR}; then
+              mkdir include/wx/${SETUPH_DIR}
             fi
             if test -f setup.h; then
-                mv -f setup.h include/wx/${TOOLKIT_DIR}/setup.h
+                cp -fp setup.h include/wx/${SETUPH_DIR}/setup.h
             fi
-            
+
           ],
           [
-            TOOLKIT_DIR="${TOOLKIT_DIR}"
+            SETUPH_DIR="${SETUPH_DIR}"
             TOOLKIT_NAME="${TOOLKIT_NAME}"
             LN_S="${LN_S}"
           ]
          )
 
+dnl vi: set et ts=4 sw=4 list: