]> git.saurik.com Git - wxWidgets.git/blobdiff - configure.in
Added MSW toplevel.cpp and regenerated makefiles and such.
[wxWidgets.git] / configure.in
index 74cbd5834d0e83e9239babac2f0f527d69757122..049843487e8d4c36651c1c820515fe890610705c 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 ===========================================================================
@@ -124,7 +40,7 @@ AC_DEFUN(WX_PATH_FIND_LIBRARIES,
 ac_find_libraries=
 for ac_dir in $1;
   do
-    for ac_extension in a so sl; do
+    for ac_extension in a so sl dylib; do
       if test -f "$ac_dir/lib$2.$ac_extension"; then
         ac_find_libraries=$ac_dir
         break 2
@@ -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 WX_INTERFACE_AGE = 0
+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 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=0
+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=
@@ -491,7 +393,9 @@ USE_SUNOS=
 USE_ALPHA=
 USE_OSF=
 USE_BSD=
+USE_DARWIN=
 USE_FREEBSD=
+USE_OPENBSD=
 USE_NETBSD=
 USE_VMS=
 USE_ULTRIX=
@@ -505,26 +409,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 MAC 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_MAC=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_MAC=0
-DEFAULT_DEFAULT_wxUSE_WINE=0
 DEFAULT_DEFAULT_wxUSE_PM=0
+DEFAULT_DEFAULT_wxUSE_WINE=0
 
 PROGRAM_EXT=
 
@@ -582,6 +490,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
@@ -621,7 +536,7 @@ case "${host}" in
     DEFAULT_DEFAULT_wxUSE_MOTIF=1
   ;;
 
-  *-*-cygwin32* | *-*-mingw32* )
+  *-*-cygwin* | *-*-mingw32* )
     USE_UNIX=0
     USE_WIN32=1
     AC_DEFINE(__WIN32__)
@@ -642,9 +557,9 @@ case "${host}" in
 
   *-*-darwin* )
     USE_BSD=1
-    USE_MAC=1
-    AC_DEFINE(__MAC__)
+    USE_DARWIN=1
     AC_DEFINE(__BSD__)
+    AC_DEFINE(__DARWIN__)
     AC_DEFINE(__UNIX__)
     DEFAULT_DEFAULT_wxUSE_MAC=1
   ;;
@@ -672,9 +587,27 @@ if test "$USE_BEOS" = 1; then
     INCLUDE_SUBDIRS="$INCLUDE_SUBDIRS be"
 fi
 
-dnl Linux: test for libc5/glibc2: glibc2 has gettext() included
+dnl check for glibc version
 if test "$USE_LINUX" = 1; then
-  AC_CHECK_LIB(c,gettext,AC_DEFINE(wxHAVE_GLIBC2))
+    AC_CACHE_CHECK([for glibc 2.1 or later], wx_lib_glibc21,
+        AC_TRY_COMPILE([#include <features.h>],
+            [
+                #if !__GLIBC_PREREQ(2, 1)
+                    #error not glibc2.1
+                #endif
+            ],
+            [
+                wx_lib_glibc21=yes
+            ],
+            [
+                wx_lib_glibc21=no
+            ]
+        )
+    )
+
+    if test "$wx_lib_glibc21" = "yes"; then
+        AC_DEFINE(wxHAVE_GLIBC2)
+    fi
 fi
 
 dnl ---------------------------------------------------------------------------
@@ -693,11 +626,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
@@ -712,9 +647,13 @@ 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_REGEX=no
   DEFAULT_wxUSE_ZLIB=no
   DEFAULT_wxUSE_LIBPNG=no
   DEFAULT_wxUSE_LIBJPEG=no
@@ -724,13 +663,20 @@ if test $DEBUG_CONFIGURE = 1; then
   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
@@ -748,6 +694,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
@@ -759,14 +706,29 @@ if test $DEBUG_CONFIGURE = 1; then
   DEFAULT_wxUSE_CONSTRAINTS=no
   DEFAULT_wxUSE_IPC=no
   DEFAULT_wxUSE_HELP=no
-  DEFAULT_wxUSE_WXTREE=no
+  DEFAULT_wxUSE_MS_HTML_HELP=no
+  DEFAULT_wxUSE_WXHTML_HELP=no
+  DEFAULT_wxUSE_TREELAYOUT=no
   DEFAULT_wxUSE_METAFILE=no
+  DEFAULT_wxUSE_MIMETYPE=no
+  DEFAULT_wxUSE_SYSTEM_OPTIONS=yes
 
   DEFAULT_wxUSE_COMMONDLGS=no
+  DEFAULT_wxUSE_CHOICEDLG=no
+  DEFAULT_wxUSE_COLOURDLG=no
   DEFAULT_wxUSE_DIRDLG=no
+  DEFAULT_wxUSE_FILEDLG=no
+  DEFAULT_wxUSE_FINDREPLDLG=no
+  DEFAULT_wxUSE_FONTDLG=no
+  DEFAULT_wxUSE_MSGDLG=no
+  DEFAULT_wxUSE_NUMBERDLG=no
   DEFAULT_wxUSE_TEXTDLG=no
+  DEFAULT_wxUSE_SPLASH=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
@@ -774,14 +736,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
@@ -790,6 +754,7 @@ if test $DEBUG_CONFIGURE = 1; then
   DEFAULT_wxUSE_LISTBOX=no
   DEFAULT_wxUSE_LISTCTRL=no
   DEFAULT_wxUSE_NOTEBOOK=no
+  DEFAULT_wxUSE_PROPSHEET=no
   DEFAULT_wxUSE_RADIOBOX=no
   DEFAULT_wxUSE_RADIOBTN=no
   DEFAULT_wxUSE_SASH=no
@@ -801,20 +766,28 @@ 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
   DEFAULT_wxUSE_TREECTRL=no
+  DEFAULT_wxUSE_POPUPWIN=no
 
   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
@@ -834,9 +807,12 @@ else
   DEFAULT_wxUSE_APPLE_IEEE=yes
 
   DEFAULT_wxUSE_LOG=yes
+  DEFAULT_wxUSE_LOGWINDOW=yes
+  DEFAULT_wxUSE_LOGGUI=yes
 
   DEFAULT_wxUSE_GUI=yes
 
+  DEFAULT_wxUSE_REGEX=yes
   DEFAULT_wxUSE_ZLIB=yes
   DEFAULT_wxUSE_LIBPNG=yes
   DEFAULT_wxUSE_LIBJPEG=yes
@@ -846,13 +822,20 @@ else
   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
@@ -870,6 +853,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
@@ -881,14 +865,29 @@ else
   DEFAULT_wxUSE_CONSTRAINTS=yes
   DEFAULT_wxUSE_IPC=yes
   DEFAULT_wxUSE_HELP=yes
-  DEFAULT_wxUSE_WXTREE=yes
+  DEFAULT_wxUSE_MS_HTML_HELP=yes
+  DEFAULT_wxUSE_WXHTML_HELP=yes
+  DEFAULT_wxUSE_TREELAYOUT=yes
   DEFAULT_wxUSE_METAFILE=yes
+  DEFAULT_wxUSE_MIMETYPE=yes
+  DEFAULT_wxUSE_SYSTEM_OPTIONS=yes
 
   DEFAULT_wxUSE_COMMONDLGS=yes
+  DEFAULT_wxUSE_CHOICEDLG=yes
+  DEFAULT_wxUSE_COLOURDLG=yes
   DEFAULT_wxUSE_DIRDLG=yes
+  DEFAULT_wxUSE_FILEDLG=yes
+  DEFAULT_wxUSE_FINDREPLDLG=yes
+  DEFAULT_wxUSE_FONTDLG=yes
+  DEFAULT_wxUSE_MSGDLG=yes
+  DEFAULT_wxUSE_NUMBERDLG=yes
   DEFAULT_wxUSE_TEXTDLG=yes
+  DEFAULT_wxUSE_SPLASH=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
@@ -899,8 +898,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
@@ -912,6 +913,7 @@ else
   DEFAULT_wxUSE_LISTBOX=yes
   DEFAULT_wxUSE_LISTCTRL=yes
   DEFAULT_wxUSE_NOTEBOOK=yes
+  DEFAULT_wxUSE_PROPSHEET=yes
   DEFAULT_wxUSE_RADIOBOX=yes
   DEFAULT_wxUSE_RADIOBTN=yes
   DEFAULT_wxUSE_SASH=yes
@@ -923,19 +925,25 @@ 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
   DEFAULT_wxUSE_TREECTRL=yes
+  DEFAULT_wxUSE_POPUPWIN=yes
 
   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
@@ -969,6 +977,7 @@ 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])
@@ -976,11 +985,9 @@ AC_ARG_WITH(wine,          [  --with-wine             use WINE], [wxUSE_WINE="$w
 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)
@@ -992,6 +999,7 @@ fi
 dnl for GUI only
 
 WX_ARG_WITH(dmalloc,       [  --with-dmalloc          use dmalloc library (www.letters.com/dmalloc)], wxUSE_DMALLOC)
+WX_ARG_SYS_WITH(regex,     [  --with-regex            enable support for wxRegEx class], wxUSE_REGEX)
 WX_ARG_SYS_WITH(zlib,      [  --with-zlib             use zlib for LZW compression], wxUSE_ZLIB)
 WX_ARG_WITH(odbc,          [  --with-odbc             use the IODBC and wxODBC classes], wxUSE_ODBC)
 
@@ -1027,6 +1035,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 ---------------------------------------------------------------------------
@@ -1038,9 +1049,13 @@ 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)
@@ -1049,7 +1064,9 @@ WX_ARG_ENABLE(geometry,      [  --enable-geometry       use geometry class], wxU
 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)
@@ -1060,6 +1077,10 @@ 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)
+WX_ARG_ENABLE(system_options,    [  --enable-sysoptions      use wxSystemOptions], wxUSE_SYSTEM_OPTIONS)
 
 dnl ---------------------------------------------------------------------------
 dnl "big" options (i.e. those which change a lot of things throughout the library)
@@ -1075,10 +1096,15 @@ 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(mshtmlhelp,  [  --enable-mshtmlhelp     use MS HTML Help (win32)], wxUSE_MS_HTML_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
@@ -1092,6 +1118,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)
 
@@ -1105,8 +1132,7 @@ WX_ARG_ENABLE(clipboard,   [  --enable-clipboard      use wxClipboard classes],
 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)
+WX_ARG_ENABLE(treelayout,  [  --enable-treelayout     use wxTreeLayout classes], wxUSE_TREELAYOUT)
 
 dnl ---------------------------------------------------------------------------
 dnl optional GUI controls (in alphabetical order except the first one)
@@ -1119,9 +1145,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
@@ -1132,6 +1160,7 @@ if test "$wxUSE_CONTROLS" = "yes"; then
   DEFAULT_wxUSE_LISTBOX=yes
   DEFAULT_wxUSE_LISTCTRL=yes
   DEFAULT_wxUSE_NOTEBOOK=yes
+  DEFAULT_wxUSE_PROPSHEET=yes
   DEFAULT_wxUSE_RADIOBOX=yes
   DEFAULT_wxUSE_RADIOBTN=yes
   DEFAULT_wxUSE_SASH=yes
@@ -1145,16 +1174,20 @@ 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
   DEFAULT_wxUSE_TOOLTIPS=yes
   DEFAULT_wxUSE_TREECTRL=yes
+  DEFAULT_wxUSE_POPUPWIN=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
@@ -1165,6 +1198,7 @@ elif test "$wxUSE_CONTROLS" = "no"; then
   DEFAULT_wxUSE_LISTBOX=no
   DEFAULT_wxUSE_LISTCTRL=no
   DEFAULT_wxUSE_NOTEBOOK=no
+  DEFAULT_wxUSE_PROPSHEET=no
   DEFAULT_wxUSE_RADIOBOX=no
   DEFAULT_wxUSE_RADIOBTN=no
   DEFAULT_wxUSE_SASH=no
@@ -1178,16 +1212,20 @@ 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
   DEFAULT_wxUSE_TOOLTIPS=no
   DEFAULT_wxUSE_TREECTRL=no
+  DEFAULT_wxUSE_POPUPWIN=no
 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)
@@ -1199,6 +1237,7 @@ WX_ARG_ENABLE(imaglist,    [  --enable-imaglist       use wxImageList class], wx
 WX_ARG_ENABLE(listbox,     [  --enable-listbox        use wxListBox class], wxUSE_LISTBOX)
 WX_ARG_ENABLE(listctrl,    [  --enable-listctrl       use wxListCtrl class], wxUSE_LISTCTRL)
 WX_ARG_ENABLE(notebook,    [  --enable-notebook       use wxNotebook class], wxUSE_NOTEBOOK)
+WX_ARG_ENABLE(propsheet,   [  --enable-propsheet      use wxPropertySheet class], wxUSE_PROPSHEET)
 WX_ARG_ENABLE(radiobox,    [  --enable-radiobox       use wxRadioBox class], wxUSE_RADIOBOX)
 WX_ARG_ENABLE(radiobtn,    [  --enable-radiobtn       use wxRadioButton class], wxUSE_RADIOBTN)
 WX_ARG_ENABLE(sash,        [  --enable-sash           use wxSashWindow class], wxUSE_SASH)
@@ -1210,37 +1249,59 @@ 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)
+WX_ARG_ENABLE(popupwin,    [  --enable-popupwin       use wxPopUpWindow class], wxUSE_POPUPWIN)
 
 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(filedlg,     [  --enable-finddlg        use wxFindReplaceDialog], wxUSE_FINDREPLDLG)
+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(splash,      [  --enable-splash         use wxSplashScreen], wxUSE_SPLASH)
 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(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
@@ -1278,8 +1339,9 @@ else
   done
 fi
 
-dnl we suppose that expr exists...
-NUM_TOOLKITS=`expr ${wxUSE_GTK:-0} + ${wxUSE_MOTIF:-0} + ${wxUSE_MAC:-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.
@@ -1318,7 +1380,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
@@ -1402,7 +1465,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
@@ -1422,7 +1485,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,
@@ -1432,7 +1495,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
@@ -1535,6 +1598,30 @@ dnl ------------------------------------------------------------------------
 dnl flush the cache because checking for libraries below might abort
 AC_CACHE_SAVE
 
+dnl ------------------------------------------------------------------------
+dnl Check for regex libraries
+dnl ------------------------------------------------------------------------
+
+REGEX_INCLUDE=
+if test "$wxUSE_REGEX" != "no"; then
+    dnl according to Unix 98 specs, regcomp() is in libc but I believe that
+    dnl on some old systems it may be in libregex - check for it too?
+    AC_CHECK_HEADER(regex.h, AC_CHECK_FUNCS(regcomp))
+
+    if test "x$ac_cv_func_regcomp" != "xyes"; then
+        dnl we were asked to use the system version of regex lib only but it
+        dnl is not available
+        if test "$wxUSE_REGEX" = "sys"; then
+            AC_MSG_ERROR([system regex library not found! Use --with-regex to use the built-in regex library.])
+        fi
+
+        dnl fallback to the built in code
+        REGEX_INCLUDE="-I\${top_srcdir}/src/regex"
+    fi
+
+    AC_DEFINE(wxUSE_REGEX)
+fi
+
 dnl ----------------------------------------------------------------
 dnl search for toolkit (widget sets)
 dnl ----------------------------------------------------------------
@@ -1542,266 +1629,255 @@ 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
+        AC_CHECK_HEADER(windows.h, [],
+        [
+            AC_MSG_ERROR(please set CFLAGS to contain the location of windows.h)
+        ])
 
-WXWINE=
+        INCLUDE_SUBDIRS="$INCLUDE_SUBDIRS msw"
 
-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 --- 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 -ladvapi32 -lwsock32"
+
+        dnl add extra odbc libs if we have compiled in odbc
+        if test "$wxUSE_ODBC" = "yes" ; then
+            LIBS="$LIBS -lodbc32 -lole32 -loleaut32"
+        fi
+
+        dnl -mwindows is needed to avoid that spawning of a console window
+        if test "$wxUSE_MINGW" = 1; then
+            LDFLAGS="$LDFLAGS -mwindows"
         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"
+        TOOLKIT=MSW
+        GUIDIST=MSW_DIST
 
-    dnl add extra odbc libs if we have compiled in odbc
-    if test "$wxUSE_ODBC" = "yes" ; then
-        LIBS="$LIBS -lodbc32 -lole32 -loleaut32"
-    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 -mwindows is needed to avoid that spawning of a console window
-    if test "$wxUSE_MINGW" = 1; then
-        LDFLAGS="$LDFLAGS -mwindows"
+        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
 
-    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__"
+                if test -z "$wx_cv_lib_gtk"; then
+                    AM_PATH_GTK(1.2.7, wx_cv_lib_gtk=1.2.7)
+                fi
 
-    dnl set optinal RES_PROGRAM_OPT to RES_PROGRAM
-    RESPROGRAM="\$(RES_PROGRAM)"
+                if test -z "$wx_cv_lib_gtk"; then
+                    AM_PATH_GTK(1.2.3, wx_cv_lib_gtk=1.2.3)
+                fi
 
-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
+            ]
+        )
 
-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
+        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
 
-    TOOLKIT_INCLUDE="$GTK_CFLAGS"
-
-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.
-
-    GUI_TK_LIBRARY="$GTK_LIBS"
-
-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
-
-    AFMINSTALL=afminstall
-
-    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
-
-    dnl test for XIM support in libgdk
-    AC_CHECK_LIB(gdk, gdk_im_open, AC_DEFINE(HAVE_XIM))
-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
+        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
 
-    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
+        TOOLKIT_INCLUDE="$wx_cv_cflags_gtk"
+        GUI_TK_LIBRARY="$wx_cv_libs_gtk"
 
-    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
+        AFMINSTALL=afminstall
+        TOOLKIT=GTK
+        GUIDIST=GTK_DIST
 
-    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
-
-    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
-
-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"
-
-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)
+        dnl test for XIM support in libgdk
+        AC_CHECK_LIB(gdk, gdk_im_open, AC_DEFINE(HAVE_XIM))
     fi
 
-    GUI_TK_LIBRARY="$X_LIBS"
-    TOOLKIT_INCLUDE="$X_CFLAGS"
+    if test "$wxUSE_MGL" = 1; then
+        dnl FIXME_MGL - test for MGL's variants for freebsd etc.
 
-    AFMINSTALL=afminstall
+        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
 
-    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;
+        MGL_OS=linux/gcc/glibc
+        MGL_LIB_TYPE=""
 
-                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)
-            ]
-        )
+        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
+
+        TOOLKIT_INCLUDE="-I$MGL_ROOT/include"
+        GUI_TK_LIBRARY="-L$MGL_ROOT/lib/$MGL_LIB_TYPE/$MGL_OS -lmgl -lmglcpp -lpm"
+
+        AFMINSTALL=afminstall
+        TOOLKIT=MGL
+        GUIDIST=MGL_DIST
     fi
 
-    if test "$COMPILED_X_PROGRAM" = 0; then
-        AC_MSG_CHECKING(for Motif/Lesstif library)
-        WX_PATH_FIND_LIBRARIES($SEARCH_LIB, Xm)
+    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
+
+        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)
+            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_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
-            TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE $ac_path_to_include"
+        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
-            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_MSG_ERROR(no)
+        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
+
+    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
+
+        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>
@@ -1817,137 +1893,185 @@ if test "$wxUSE_MOTIF" = 1; then
                 ],
                 [
                     AC_MSG_RESULT(no)
-                    AC_MSG_ERROR(please set LDFLAGS to contain the location of libXm)
+                    AC_MSG_ERROR(please set CFLAGS to contain the location of Xm/Xm.h)
                 ]
             )
         fi
-    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 "$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 = XpmLibraryVersion();
-            ],
-            [
+                        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
+
+        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 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)
-            ]
-        )
+            AC_MSG_RESULT(found at $ac_find_libraries)
+        else
+            AC_TRY_COMPILE(
+                [
+                    #include <X11/xpm.h>
+                ],
+                [
+                    int version;
+
+                    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)
+                ]
+            )
+        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
 
-    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_MAC" = 1; then
-    TOOLKIT=MAC
-    UNIXOBJS="\$(UNIX_OBJS)"
-    UNIXDEPS="\$(UNIX_DEPS)"
-    dnl we can't call this MAC_DIST or autoconf thinks its a macro
-    GUIDIST=MACX_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
+    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
+
+    if test "$wxUSE_PM" = 1; then
+        TOOLKIT=PM
+        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 (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
@@ -1956,6 +2080,12 @@ fi
         fi
     fi
 
+    dnl REGEX_INCLUDE is only set if we want regex support and if we use our
+    dnl own sources and not the system library
+    if test "x$REGEX_INCLUDE" != "x" ; then
+        ALL_OBJECTS="${ALL_OBJECTS} \$(REGEXOBJS)"
+    fi
+
     if test "$wxUSE_LIBJPEG" = "yes" ; then
         ALL_OBJECTS="${ALL_OBJECTS} \$(JPEGOBJS)"
     fi
@@ -1971,9 +2101,29 @@ fi
     if test "$wxUSE_FREETYPE" = "yes" ; then
         ALL_OBJECTS="${ALL_OBJECTS} \$(FREETYPEOBJS)"
     fi
-    ALL_DEPFILES="\$(GUIDEPS) \$(COMMONDEPS) \$(GENERICDEPS) \$(UNIXDEPS) \$(HTMLDEPS) \$(OGLDEPS)"
 
-    PORT_FILES="src/\$(TOOLKITDIR)/files.lst"
+    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
+
+    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"
 
@@ -1986,6 +2136,9 @@ else
     dnl this may be (almost) unneccesary for wxBase now we use TOOLKIT_NAME
     TOOLKIT_DIR="base"
 
+    dnl well, we have to set it to something...
+    TOOLKIT_VPATH="."
+
     dnl the base name of the library and wxXXX-config files
     if test "$wxUSE_DEBUG_FLAG" = "yes"; then
         TOOLKIT_NAME="${TOOLKIT_DIR}d"
@@ -1999,6 +2152,12 @@ else
     ALL_OBJECTS="\$(BASE_OBJS) \$(BASE_UNIX_OBJS)"
     ALL_DEPFILES="\$(BASE_DEPS) \$(BASE_UNIX_DEPS)"
 
+    dnl REGEX_INCLUDE is only set if we want regex support and if we use our
+    dnl own sources and not the system library
+    if test "x$REGEX_INCLUDE" != "x" ; then
+        ALL_OBJECTS="${ALL_OBJECTS} \$(REGEXOBJS)"
+    fi
+
     if test "$wxUSE_ZLIB" = "yes" ; then
         ALL_OBJECTS="${ALL_OBJECTS} \$(ZLIBOBJS)"
     fi
@@ -2006,19 +2165,13 @@ else
     dnl building wxBase only
     WX_LIBRARY="wx_${TOOLKIT_NAME}"
 
-    PORT_FILES="src/files.lst"
+    PORT_FILES="\${top_srcdir}/src/files.lst"
     RPM_FILES="src/rpmfiles.lst"
     RPM_SPEC="wxBase.spec"
 
     dnl distribute only wxBase sources/headers
     GUIDIST="BASE_DIST"
     DISTDIR="wxBase"
-
-    dnl Apple MAC OS X specific extras
-    if test "$USE_UNIX" = 1 ; then
-       ALL_OBJECTS="${ALL_OBJECTS} dl_macosx.o"
-       ALL_DEPFILES="${ALL_DEPFILES} dl_macosx.d"
-    fi
 fi
 
 dnl the name of the (libtool) library
@@ -2029,89 +2182,103 @@ dnl the name of the static library
 WX_LIBRARY_NAME_STATIC="lib${WX_LIBRARY}.a"
 WX_LIBRARY_NAME_STATIC_GL="lib${WX_LIBRARY}_gl.a"
 
-dnl the name of the shared library
-WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}-${WX_RELEASE}.so.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
-WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.so.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
-
-dnl the name of the links to the shared library
-WX_LIBRARY_LINK1="lib${WX_LIBRARY}-${WX_RELEASE}.so.${WX_CURRENT}"
-WX_LIBRARY_LINK2="lib${WX_LIBRARY}-${WX_RELEASE}.so"
-WX_LIBRARY_LINK3="lib${WX_LIBRARY}.so"
-WX_LIBRARY_LINK1_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.so.${WX_CURRENT}"
-WX_LIBRARY_LINK2_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.so"
-WX_LIBRARY_LINK3_GL="lib${WX_LIBRARY}_gl.so"
-
-dnl shared library settings
-SHARED_LD=
-PIC_FLAG=
-WX_ALL=
-WX_ALL_INSTALLED=
-BURNT_LIBRARY_NAME=
-WX_TARGET_LIBRARY_SONAME=
-
 dnl --- the marker for quick search, leave it here: SHARED_LIB_SETUP ---
 
 if test "$wxUSE_SHARED" = "yes"; then
+    dnl the name of the shared library
     case "${host}" in
+      *-*-mingw32* )
+        WX_LIBRARY_NAME_SHARED="wx${WX_MAJOR_VERSION_NUMBER}${WX_MINOR_VERSION_NUMBER}_${WX_RELEASE_NUMBER}.dll"
+      ;;
+
       *-hp-hpux* )
-        if test "$GCC" = yes ; then
-            SHARED_LD="${CC} -shared -fPIC -o"
-            PIC_FLAG="-fPIC"
-        else
+        SO_SUFFIX="sl"
+      ;;
+
+      *-*-darwin* )
+        SO_SUFFIX="dylib"
+      ;;
+
+      * )
+        SO_SUFFIX="so"
+      ;;
+    esac
+
+    dnl set the name of the shared lib if not done above
+    if test "x$SO_SUFFIX" != "x"; then
+        WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}-${WX_RELEASE}.${SO_SUFFIX}.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
+        WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.${SO_SUFFIX}.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
+    fi
+
+    dnl the name of the links to the shared library
+    WX_LIBRARY_LINK1="lib${WX_LIBRARY}-${WX_RELEASE}.${SO_SUFFIX}.${WX_CURRENT}"
+    WX_LIBRARY_LINK2="lib${WX_LIBRARY}-${WX_RELEASE}.${SO_SUFFIX}"
+    WX_LIBRARY_LINK3="lib${WX_LIBRARY}.${SO_SUFFIX}"
+    WX_LIBRARY_LINK1_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.${SO_SUFFIX}.${WX_CURRENT}"
+    WX_LIBRARY_LINK2_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.${SO_SUFFIX}"
+    WX_LIBRARY_LINK3_GL="lib${WX_LIBRARY}_gl.${SO_SUFFIX}"
+
+    dnl install targets
+    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 the extra compiler flags needed for compilation of shared library
+    if test "$GCC" = "yes"; then
+        dnl the switch for gcc is the same under all platforms
+        PIC_FLAG="-fPIC"
+    fi
+
+    dnl the command to use for creating the shared library
+    SHARED_LD="${CXX} -shared -o"
+
+    case "${host}" in
+      *-hp-hpux* )
+        dnl default settings are good for gcc but not for the native HP-UX
+        if test "$GCC" != "yes"; then
             dnl no idea why it wants it, but it does
             LDFLAGS="-L/usr/lib"
 
             SHARED_LD="${CXX} -b -o"
             PIC_FLAG="+Z"
         fi
-        WX_LIBRARY_NAME_SHARED="libwx_${TOOLKIT_NAME}.sl"
-        WX_LIBRARY_NAME_SHARED_GL="libwx_${TOOLKIT_NAME}_gl.sl"
-        if test "$wxUSE_OPENGL" = "yes"; then
-            WX_ALL_INSTALLED="preinstall_gl"
-            WX_ALL="${WX_LIBRARY_NAME_SHARED} ${WX_LIBRARY_NAME_SHARED_GL}"
-        else
-            WX_ALL="${WX_LIBRARY_NAME_SHARED}"
-        fi
+
       ;;
 
-      dnl in fact, these settings are for any platform using gcc
       *-*-linux* )
-        SHARED_LD="${CC} -shared -o"
-        PIC_FLAG="-fPIC"
+        if test "$GCC" != "yes"; then
+            AC_CACHE_CHECK([for Intel compiler], wx_cv_prog_icc,
+            [
+                AC_TRY_COMPILE([],
+                    [
+                        #ifndef __INTEL_COMPILER
+                        #error Not icc
+                        #endif
+                    ],
+                    wx_cv_prog_icc=yes,
+                    wx_cv_prog_icc=no
+                )
+            ])
+
+            if test "$wx_cv_prog_icc" = "yes"; then
+                PIC_FLAG="-KPIC"
+            fi
+        fi
+
         if test "$wxUSE_BURNT_NAME" = "yes" ; then
             BURNT_LIBRARY_NAME="-Wl,-soname,${WX_LIBRARY_LINK1}"
             BURNT_LIBRARY_NAME_GL="-Wl,-soname,${WX_LIBRARY_LINK1_GL}"
             dnl substitute this in makelib.env for the contrib libs
             WX_TARGET_LIBRARY_SONAME="-Wl,-soname,\$(TARGETLIB_LINK1)"
         fi
-        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
-      ;;
-      *-*-irix5* | *-*-irix6* )
-        if test "$GCC" = yes ; then
-           SHARED_LD="${CC} -shared -o"
-           PIC_FLAG="-fPIC"
-        else
-           SHARED_LD="${CXX} -shared -o"
-        fi
-        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
       ;;
+
       *-*-solaris2* )
         if test "$GCC" = yes ; then
-            SHARED_LD="${CC} -shared -o"
-            PIC_FLAG="-fPIC"
-
             dnl newer versions of gcc need -isystem to compile X headers on
             dnl Solaris (which use old style C syntax)
             CPPFLAGS="$CPPFLAGS -isystem /usr/openwin/include"
@@ -2119,65 +2286,25 @@ if test "$wxUSE_SHARED" = "yes"; then
             SHARED_LD="${CXX} -G -o"
             PIC_FLAG="-KPIC"
         fi
-        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
-      ;;
-      *-*-sunos4* )
-        SHARED_LD="${CC} -shared -o"
-        PIC_FLAG="-fPIC"
-        WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
-        WX_ALL="CREATE_LINKS"
-      ;;
-      *-*-freebsd* | *-*-netbsd* )
-        SHARED_LD="${CC} -shared -o"
-        PIC_FLAG="-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
       ;;
+
       *-*-darwin* )
-        SHARED_LD="libtool -dynamic -o"
-        PIC_FLAG="-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"
+        TOOLKIT_DEF="${TOOLKIT_DEF} -D__UNIX__ -D__DARWIN__ -D__POWERPC__"
+        CPPFLAGS="${CPPFLAGS} -fno-common"
+        SHARED_LD="${CXX} -dynamiclib -o"
+        PIC_FLAG="-dynamic -fPIC"
+
+        dnl add the resources target for wxMac
+        if test "$wxUSE_MAC" = 1 ; then
+                WX_ALL="${WX_ALL} ./lib/lib${WX_LIBRARY}-${WX_RELEASE}.r"
         fi
       ;;
-      *-*-osf* )
-        SHARED_LD="${CXX} -shared -o"
-        PIC_FLAG="-fPIC"
-        WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
-        WX_ALL="CREATE_LINKS"
-      ;;
-      *-*-dgux5* )
-        SHARED_LD="${CXX} -shared -o"
-        PIC_FLAG="-fPIC"
-        WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
-        WX_ALL="CREATE_LINKS"
-      ;;
-      *-*-sysv5* )
-        SHARED_LD="${CC} -shared -o"
-        PIC_FLAG="-fPIC"
-        WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
-        WX_ALL="CREATE_LINKS"
-      ;;
+
       *-*-aix* )
         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}"
@@ -2188,30 +2315,43 @@ if test "$wxUSE_SHARED" = "yes"; then
             WX_ALL="${WX_LIBRARY_NAME_STATIC}"
         fi
       ;;
+
       *-*-mingw32* )
-        dnl only static for now
-        WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}"
-        WX_TARGET_LIBRARY_GL="${WX_LIBRARY_NAME_STATIC_GL}"
+        WX_LIBRARY_NAME_STATIC="lib/libwx${WX_MAJOR_VERSION_NUMBER}${WX_MINOR_VERSION_NUMBER}_${WX_RELEASE_NUMBER}.a"
+        SHARED_LD="${CC} -shared -Wl,--out-implib,${WX_LIBRARY_NAME_STATIC} -o"
+        TOOLKIT_DEF="${TOOLKIT_DEF} -DWXUSINGDLL=1"
+        WXMSW_DLL_DEFINES="-UWXUSINGDLL -DWXMAKINGDLL=1 -D_DLL=1 -D_WINDLL=1"
+        WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_SHARED}"
+        WX_TARGET_LIBRARY_GL="${WX_LIBRARY_NAME_SHARED_GL}"
         if test "$wxUSE_OPENGL" = "yes"; then
             WX_ALL_INSTALLED="preinstall_gl"
-            WX_ALL="${WX_LIBRARY_NAME_STATIC} ${WX_LIBRARY_NAME_STATIC_GL}"
+            WX_ALL="${WX_LIBRARY_NAME_SHARED} ${WX_LIBRARY_NAME_SHARED_GL}"
         else
-            WX_ALL="${WX_LIBRARY_NAME_STATIC}"
+            WX_ALL="${WX_LIBRARY_NAME_SHARED}"
         fi
       ;;
+
       *-pc-os2_emx )
         dnl only static for now
         WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}"
         WX_ALL="${WX_LIBRARY_NAME_STATIC}"
       ;;
+
       *-*-beos* )
         dnl can't use gcc under BeOS for shared library creation because it
         dnl complains about missing 'main'
         SHARED_LD="${LD} -shared -o"
-        PIC_FLAG="-fPIC"
-        WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
-        WX_ALL="CREATE_LINKS"
       ;;
+
+      *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | \
+      *-*-sunos4* | \
+      *-*-irix5* | *-*-irix6* | \
+      *-*-osf* | \
+      *-*-dgux5* | \
+      *-*-sysv5* )
+        dnl defaults are ok
+      ;;
+
       *)
         AC_MSG_ERROR(unknown system type ${host}.)
     esac
@@ -2221,6 +2361,7 @@ if test "$wxUSE_SHARED" = "yes"; then
         WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_SHARED}"
         WX_TARGET_LIBRARY_GL="${WX_LIBRARY_NAME_SHARED_GL}"
     fi
+
     dnl do not alter the LIBRARY_TYPE strings "so" and "a", they are magic
     WX_TARGET_LIBRARY_TYPE="so"
 else
@@ -2250,10 +2391,10 @@ 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_FCNTL_H
-AC_CHECK_HEADERS(fcntl.h)
 dnl defines HAVE_WCHAR_H
 AC_CHECK_HEADERS(wchar.h)
 dnl defines HAVE_WCSTR_H
@@ -2272,6 +2413,31 @@ if test "$wxUSE_GUI" = "yes"; then
     fi
 fi
 
+if test "$USE_WIN32" = 1; then
+    AC_CHECK_HEADERS(w32api.h)
+    
+    dnl check if can use _WIN_IE macro
+    AC_CACHE_CHECK([if w32api has good enough MSIE support], wx_cv_w32api_win_ie,
+    [
+      AC_TRY_COMPILE([#include <w32api.h>],
+                   [
+                     #define wxCHECK_W32API_VERSION( major, minor ) \
+                     ( defined( __W32API_MAJOR_VERSION ) && defined( __W32API_MINOR_VERSION ) \
+                     && ( ( __W32API_MAJOR_VERSION > (major) ) \
+                     || ( __W32API_MAJOR_VERSION == (major) && __W32API_MINOR_VERSION >= (minor))))
+                     
+                     #if !wxCHECK_W32API_VERSION(1,1)
+                     #error You need w32api 1.1 or newer
+                     #endif
+                   ], [
+                      wx_cv_w32api_win_ie=yes
+                      CPPFLAGS="$CPPFLAGS -D_WIN_IE=0x400"
+                   ], [
+                      wx_cv_w32api_win_ie=no
+                   ])
+    ])
+fi
+
 dnl ---------------------------------------------------------------------------
 dnl Checks for typedefs
 dnl ---------------------------------------------------------------------------
@@ -2287,6 +2453,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 ---------------------------------------------------------------------------
@@ -2327,13 +2568,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
 
@@ -2343,9 +2613,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 ---------------------------------------------------------------------------
@@ -2358,14 +2625,17 @@ AC_CHECK_LIB(c, wcslen, [
             AC_CHECK_LIB(w, wcslen, [
                 AC_DEFINE(HAVE_WCSLEN)
                 WCHAR_LINK="-lw"
+            ], [
+                AC_CHECK_LIB(msvcrt, wcslen, [
+                    AC_DEFINE(HAVE_WCSLEN)
+                    WCHAR_LINK=""
+                ])
             ])
         ])
 
 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
@@ -2382,6 +2652,11 @@ 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,
 [
@@ -2404,7 +2679,6 @@ 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_TRY_COMPILE([
@@ -2426,15 +2700,19 @@ 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
                                    ])
                  ])
 ])
 
+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,
 [
@@ -2455,18 +2733,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)
@@ -2495,19 +2796,59 @@ if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes" -a "$wxUSE_UNIX" = "yes"; then
                      ])
       ])
 
-      AC_LANG_RESTORE
+      AC_LANG_RESTORE
+
+      AC_DEFINE_UNQUOTED(wxTYPE_SA_HANDLER, $wx_cv_type_sa_handler)
+    fi
+fi
+
+dnl check for vfork() (even if it's the same as fork() in modern Unices)
+AC_CHECK_FUNCS(vfork)
+
+dnl get the library function to use for wxGetDiskSpace()
+AC_CACHE_CHECK(for statfs, wx_cv_func_statfs,
+    AC_TRY_COMPILE(
+        [
+             #include <sys/vfs.h>
+        ],
+        [
+             long l;
+             struct statfs fs;
+             statfs("/", &fs);
+             l = fs.f_bsize;
+             l += fs.f_blocks;
+             l += fs.f_bavail;
+        ],
+        [
+             wx_cv_func_statfs=yes
+        ],
+        [
+             wx_cv_func_statfs=no
+        ]
+    )
+)
+
+if test "$wx_cv_func_statfs" = "yes"; then
+    AC_DEFINE(HAVE_STATFS)
+else
+    AC_MSG_WARN([wxGetDiskSpace() function won't work without statfs()])
+fi
 
-      AC_DEFINE_UNQUOTED(wxTYPE_SA_HANDLER, $wx_cv_type_sa_handler)
+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 vfork() (even if it's the same as fork() in modern Unices)
-AC_CHECK_FUNCS(vfork)
-
 dnl check for timegm() used by datetime.cpp
 AC_CHECK_FUNCS(timegm)
 
-dnl look for a functiopn to modify the environment
+dnl look for a function to modify the environment
 AC_CHECK_FUNCS(putenv setenv, break)
 
 HAVE_SOME_SLEEP_FUNC=0
@@ -2518,7 +2859,7 @@ if test "$USE_BEOS" = 1; then
     HAVE_SOME_SLEEP_FUNC=1
 fi
 
-if test "$USE_MAC" = 1; then
+if test "$USE_DARWIN" = 1; then
     dnl Mac OS X has both nanosleep and usleep
     dnl but only usleep is defined in unistd.h
     AC_DEFINE(HAVE_USLEEP)
@@ -2538,9 +2879,9 @@ if test "$HAVE_SOME_SLEEP_FUNC" != 1; then
                 ],
                 [
                     AC_CHECK_FUNCS(usleep,
-                       AC_DEFINE(HAVE_USLEEP),
-                   )
-                    AC_MSG_WARN([wxSleep() function will not work])
+                        AC_DEFINE(HAVE_USLEEP),
+                        AC_MSG_WARN([wxSleep() function will not work])
+                    )
                 ]
             )
         ]
@@ -2643,15 +2984,9 @@ if test "$wxUSE_THREADS" = "yes" ; then
                 THREADS_OBJ="threadpsx.lo"
                 THREADS_LINK="c_r"
             ], [
-                dnl thread functions are in libcc_dynamic under Mac OS X/Darwin
-                AC_CHECK_LIB(cc_dynamic, pthread_create, [
-                    THREADS_OBJ="threadpsx.lo"
-                    THREADS_LINK="cc_dynamic"
-                ], [
-                    dnl VZ: SGI threads are not supported currently
-                    AC_CHECK_HEADER(sys/prctl.h, [
-                        THREADS_OBJ="threadsgi.lo"
-                    ])
+                dnl VZ: SGI threads are not supported currently
+                AC_CHECK_HEADER(sys/prctl.h, [
+                    THREADS_OBJ="threadsgi.lo"
                 ])
             ])
         ])
@@ -2674,7 +3009,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             ])
@@ -2685,7 +3020,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)
                 )]
@@ -2702,7 +3037,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"
@@ -2730,18 +3065,77 @@ 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
+
+  dnl we need _GNU_SOURCE to get PTHREAD_MUTEX_RECURSIVE with glibc 2.1+
+  dnl (strictly speaking we only need _XOPEN_SOURCE=500 but just defining
+  dnl this disables _BSD_SOURCE which breaks libtiff compilation, so it is
+  dnl simpler to just define _GNU_SOURCE to get everything)
+  if test "x$wx_lib_glibc21" = "xyes"; then
+      CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
+  fi
+
+  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"
+      CPPFLAGS="${CFLAGS} -mt"
       CXXFLAGS="${CXXFLAGS} -mt"
       LDFLAGS="${LDFLAGS} -mt"
   fi
@@ -2753,9 +3147,10 @@ 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 Darwin/Mac OS X
+  if test "$USE_DARWIN" != 1; then
+    CPPFLAGS="${CPPFLAGS} -D_REENTRANT"
+  fi
 
   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS thread"
 else
@@ -2764,8 +3159,7 @@ else
   if test "$ac_cv_func_strtok_r" = "yes"; then
     AC_MSG_CHECKING(if -D_REENTRANT is needed)
     if test "$NEEDS_D_REENTRANT_FOR_R_FUNCS" = 1; then
-        CFLAGS="${CFLAGS} -D_REENTRANT"
-        CXXFLAGS="${CXXFLAGS} -D_REENTRANT"
+        CPPFLAGS="${CPPFLAGS} -D_REENTRANT"
         AC_MSG_RESULT(yes)
     else
         AC_MSG_RESULT(no)
@@ -2791,8 +3185,17 @@ if test "$WXWINE" = 1 ; then
 fi
 
 if test "$wxUSE_MAC" = 1 ; then
-  TOOLKIT_DEF="${TOOLKIT_DEF} -D__UNIX__ -DTARGET_CARBON"
-  TOOLKIT_INCLUDE="${TOOLKIT_INCLUDE}"
+  TOOLKIT_DEF="${TOOLKIT_DEF} -DTARGET_CARBON"
+  CPPFLAGS="${CPPFLAGS} -fpascal-strings"
+  CXXFLAGS="${CXXFLAGS} -cpp-precomp"
+  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
@@ -2838,12 +3241,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"
@@ -2871,6 +3275,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 ---------------------------------------------------------------------------
@@ -2924,7 +3338,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
@@ -2934,7 +3370,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=
@@ -2968,17 +3404,25 @@ if test "$wxUSE_FREETYPE" = "yes" -o "$wxUSE_FREETYPE" = "sys" ; then
 fi
 
 if test "$wxUSE_OPENGL" = "yes"; then
-  AC_CHECK_HEADER(GL/gl.h, [
+  if test "$wxUSE_MAC" = 1; then
     AC_DEFINE(wxUSE_OPENGL)
     AC_DEFINE(wxUSE_GLCANVAS)
-    AC_CHECK_LIB(GL, glFlush, [
-      OPENGL_LINK="-lGL -lGLU"
-    ],[
-        AC_CHECK_LIB(MesaGL, glFlush, [
-        OPENGL_LINK="-lMesaGL -lMesaGLU"
-      ],)
-     ],)
-    ],wxUSE_OPENGL=0)
+    OPENGL_LINK="-framework OpenGL -framework AGL"
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS opengl"
+  else
+    AC_CHECK_HEADER(GL/gl.h, [
+      AC_DEFINE(wxUSE_OPENGL)
+      AC_DEFINE(wxUSE_GLCANVAS)
+      SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS opengl"
+      AC_CHECK_LIB(GL, glFlush, [
+        OPENGL_LINK="-lGL -lGLU"
+      ],[
+          AC_CHECK_LIB(MesaGL, glFlush, [
+          OPENGL_LINK="-lMesaGL -lMesaGLU"
+        ],)
+       ],)
+      ],wxUSE_OPENGL=0)
+  fi
 fi
 
 dnl ---------------------------------------------------------------------------
@@ -3019,14 +3463,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
@@ -3047,6 +3515,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
@@ -3084,6 +3556,14 @@ 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
@@ -3103,11 +3583,11 @@ if test "$wxUSE_STREAMS" = "yes" ; then
   AC_DEFINE(wxUSE_STREAMS)
 fi
 
-dnl ------------------------------------------------------------------------
+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)
 
@@ -3121,10 +3601,10 @@ if test "$wxUSE_TIMEDATE" = "yes"; then
                             ],
                             [
                                 int tz;
-                                tz = __timezone;
+                                tz = timezone;
                             ],
                             [
-                                wx_cv_var_timezone=__timezone
+                                wx_cv_var_timezone=timezone
                             ],
                             [
                                 AC_TRY_COMPILE(
@@ -3145,10 +3625,10 @@ if test "$wxUSE_TIMEDATE" = "yes"; then
                                             ],
                                             [
                                                 int tz;
-                                                tz = timezone;
+                                                tz = __timezone;
                                             ],
                                             [
-                                                wx_cv_var_timezone=timezone
+                                                wx_cv_var_timezone=__timezone
                                             ],
                                             AC_MSG_ERROR(no timezone variable)
                                         )
@@ -3179,13 +3659,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)
@@ -3205,8 +3688,7 @@ if test "$wxUSE_TIMEDATE" = "yes"; then
                 ],
                 [
                     struct timeval tv;
-                    struct timezone tz;
-                    gettimeofday(&tv, &tz);
+                    gettimeofday(&tv, NULL);
                 ],
                 wx_cv_func_gettimeofday_has_2_args=yes,
                 AC_TRY_COMPILE(
@@ -3219,7 +3701,10 @@ if test "$wxUSE_TIMEDATE" = "yes"; then
                         gettimeofday(&tv);
                     ],
                     wx_cv_func_gettimeofday_has_2_args=no,
-                    wx_cv_func_gettimeofday_has_2_args=unknown
+                    [
+                        AC_MSG_WARN([failed to determine number of gettimeofday() arguments])
+                        wx_cv_func_gettimeofday_has_2_args=unknown
+                    ]
                 )
             )
             AC_LANG_RESTORE
@@ -3360,8 +3845,8 @@ if test "$TOOLKIT" != "MSW"; then
 HAVE_DL_FUNCS=0
 HAVE_SHL_FUNCS=0
 if test "$wxUSE_DYNLIB_CLASS" = "yes"; then
-    if test "$USE_MAC" = 1; then
-        dnl Mac OS X needs dl_macosx.c to be compiled in to fake dlopen/dlerror
+    if test "$USE_DARWIN" = 1; then
+        dnl dlopen/dlerror is implemented in dynlib.cpp for Darwin/Mac OS X
         HAVE_DL_FUNCS=1
     else
         dnl the test is a bit complicated because we check for dlopen() both with
@@ -3429,6 +3914,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
@@ -3458,9 +3947,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 ----------------------------------------------------------------
@@ -3500,6 +3986,28 @@ fi
 if test "$wxUSE_HELP" = "yes"; then
     AC_DEFINE(wxUSE_HELP)
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS help"
+
+    if test "$USE_WIN32" = 1; then
+      if test "$wxUSE_MS_HTML_HELP" = "yes"; then
+        AC_CHECK_HEADER(htmlhelp.h, 
+            [
+                AC_DEFINE(wxUSE_MS_HTML_HELP)
+            ],
+            [
+                AC_MSG_WARN([MS HTML Help cannot be used without htmlhelp.h, disabled])
+                wxUSE_MS_HTML_HELP=no
+            ])
+      fi
+    fi
+
+    if test "$wxUSE_WXHTML_HELP" = "yes"; then
+      if test "$wxUSE_HTML" = "yes"; then
+        AC_DEFINE(wxUSE_WXHTML_HELP)
+      else
+        AC_MSG_WARN(Cannot use wxHTML-based help without wxHTML so it won't be compiled)
+        wxUSE_WXHTML_HELP=no
+      fi
+    fi
 fi
 
 if test "$wxUSE_PRINTING_ARCHITECTURE" = "yes" ; then
@@ -3516,12 +4024,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
@@ -3532,6 +4036,40 @@ dnl ---------------------------------------------------------------------------
 dnl IPC: IPC, Drag'n'Drop, Clipboard, ...
 dnl ---------------------------------------------------------------------------
 
+dnl check for ole headers and disable a few features requiring it if not
+dnl present (earlier versions of mingw32 don't have ole2.h)
+if test "$USE_WIN32" = 1; then
+    AC_CHECK_HEADERS(ole2.h)
+
+    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 -lrpcrt4 -loleaut32 -lole32 -luuid"
+            AC_DEFINE(wxUSE_OLE)
+
+        fi
+
+        dnl for OLE clipboard and dnd
+        AC_DEFINE(wxUSE_DATAOBJ)
+    else
+        AC_MSG_WARN([Some features disabled because OLE headers not found])
+
+        wxUSE_CLIPBOARD=no
+        wxUSE_DRAG_AND_DROP=no
+        wxUSE_DATAOBJ=no
+    fi
+
+    dnl this is for MSW only, so we test for it inside "if USE_WIN32"
+    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
+
 if test "$wxUSE_IPC" = "yes"; then
     if test "$wxUSE_SOCKETS" != "yes"; then
         AC_MSG_WARN(wxWindows IPC classes require sockets, disabled)
@@ -3542,6 +4080,9 @@ fi
 
 if test "$wxUSE_CLIPBOARD" = "yes"; then
     AC_DEFINE(wxUSE_CLIPBOARD)
+
+    dnl required by clipboard code in configuration check
+    AC_DEFINE(wxUSE_DATAOBJ)
 fi
 
 if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then
@@ -3557,34 +4098,9 @@ if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then
         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)
-
-       dnl for some reason this test always fails here??
-        dnl if test "x$HAVE_OLE2_H" != x ; then
-       dnl this one does the right thing though
-        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
+    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 "$wxUSE_DRAG_AND_DROP" = "yes"; then
@@ -3602,48 +4118,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
 
@@ -3653,11 +4195,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])
@@ -3666,15 +4210,24 @@ fi
 
 if test "$wxUSE_NOTEBOOK" = "yes"; then
     AC_DEFINE(wxUSE_NOTEBOOK)
+    USES_CONTROLS=1
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS notebook"
 fi
 
+if test "$wxUSE_PROPSHEET" = "yes"; then
+    AC_DEFINE(wxUSE_PROPSHEET)
+    USES_CONTROLS=1
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS proplist"
+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
@@ -3684,19 +4237,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
@@ -3706,10 +4263,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
@@ -3717,11 +4281,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
@@ -3731,24 +4297,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
@@ -3766,51 +4353,55 @@ 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 "$wxUSE_POPUPWIN" = "yes"; then
+    if test "$wxUSE_MAC" = 1; then
+        AC_MSG_WARN(Popup window is not yet supported under Mac OS)
+    else
+        AC_DEFINE(wxUSE_POPUPWIN)
+        USES_CONTROLS=1
+    fi
+fi
+
+if test "$USES_CONTROLS" = 1; then
+    AC_DEFINE(wxUSE_CONTROLS)
+fi
+
 dnl ---------------------------------------------------------------------------
 dnl misc options
 dnl ---------------------------------------------------------------------------
 
-dnl TODO this is unused for now...
-dnl if test "$wxUSE_WXTREE" = "yes"; then
-dnl   AC_DEFINE(wxUSE_WXTREE)
-dnl fi
+if test "$wxUSE_TREELAYOUT" = "yes"; then
+    AC_DEFINE(wxUSE_TREELAYOUT)
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS treelay"
+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_SYSTEM_OPTIONS" = "yes"; then
+    AC_DEFINE(wxUSE_SYSTEM_OPTIONS)
 fi
 
 if test "$wxUSE_MINIFRAME" = "yes"; then
@@ -3829,6 +4420,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
@@ -3841,6 +4436,83 @@ 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_FINDREPLDLG" = "yes"; then
+    AC_DEFINE(wxUSE_FINDREPLDLG)
+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_SPLASH" = "yes"; then
+    AC_DEFINE(wxUSE_SPLASH)
+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 ---------------------------------------------------------------------------
@@ -3856,6 +4528,18 @@ fi
 
 AC_DEFINE_UNQUOTED(WXWIN_OS_DESCRIPTION, $OSINFO)
 
+dnl ---------------------------------------------------------------------------
+dnl define the variable containing the installation prefix (used in dcpsg.cpp)
+dnl ---------------------------------------------------------------------------
+
+if test "x$prefix" != "xNONE"; then
+    wxPREFIX=$prefix
+else
+    wxPREFIX=$ac_default_prefix
+fi
+
+AC_DEFINE_UNQUOTED(wxINSTALL_PREFIX, "$wxPREFIX")
+
 dnl ---------------------------------------------------------------------------
 dnl Output the makefiles and such from the results found above
 dnl ---------------------------------------------------------------------------
@@ -3867,12 +4551,9 @@ dnl all additional libraries (except wxWindows itself) we link with
 dnl
 dnl note that we always link with -lm except for Mac OS X
 dnl extended.c uses floor() and is always linked in
-if test "$USE_MAC" = 1 ; then
-    EXTRA_LIBS="$LIBS $POSIX4_LINK $INET_LINK $WCHAR_LINK $THREADS_LINK $DMALLOC_LINK $DL_LINK $ZLIB_LINK -framework System"
-    CFLAGS="${CFLAGS} -fpascal-strings"
-    CPPFLAGS="${CPPFLAGS} -fpascal-strings"
-else
-    EXTRA_LIBS="$LIBS $POSIX4_LINK $INET_LINK $WCHAR_LINK $THREADS_LINK $DMALLOC_LINK $DL_LINK $ZLIB_LINK -lm"
+EXTRA_LIBS="$LIBS $POSIX4_LINK $INET_LINK $WCHAR_LINK $THREADS_LINK $DMALLOC_LINK $DL_LINK $ZLIB_LINK -lm"
+if test "$wxUSE_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 $FREETYPE_LINK $EXTRA_LIBS"
@@ -3883,7 +4564,9 @@ 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 $FREETYPE_INCLUDE $TOOLKIT_INCLUDE"
+INCLUDES="-I. -I\${top_builddir}/include -I\${top_srcdir}/include \
+$REGEX_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
@@ -3911,15 +4594,19 @@ if test "$wxUSE_GUI" = "yes"; then
     dnl      library features they need are present)
 
     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 event font fractal image menu \
-                     minimal richedit"
+    dnl      ipc, mfc, nativdlg, oleauto, ownerdrw
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS controls dialogs \
+                     drawing dynamic erase event exec font image \
+                     minimal richedit rotate 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)"
 else
-    SAMPLES_SUBDIRS=""
+    SAMPLES_SUBDIRS="console"
 fi
 
 dnl for convenience, sort the samples in alphabetical order
@@ -3968,6 +4655,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)
@@ -3979,24 +4667,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)
 
@@ -4022,6 +4702,7 @@ AC_SUBST(OPENGL_LIBS)
 AC_SUBST(EXTRADEFS)
 AC_SUBST(LIBS)
 AC_SUBST(LD_LIBS)
+AC_SUBST(WXMSW_DLL_DEFINES)
 
 dnl additional resurces settings
 AC_SUBST(RCINPUTSWITCH)
@@ -4029,6 +4710,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)
@@ -4046,14 +4734,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
@@ -4064,7 +4752,12 @@ if test "$wxUSE_GUI" = "yes"; then
     wx_cv_path_ifs=$PATH_IFS
     wx_cv_program_ext=$PROGRAM_EXT
     wx_cv_target_library=$WX_TARGET_LIBRARY
+    wx_cv_target_library_gl=$WX_TARGET_LIBRARY_GL
     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_library_gl wx_cv_target_libtype
     AC_CONFIG_SUBDIRS(demos samples utils contrib)
 fi
 dnl from wxUSE_GUI
@@ -4080,13 +4773,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
@@ -4103,7 +4801,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
@@ -4114,18 +4812,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: