]> git.saurik.com Git - wxWidgets.git/blobdiff - configure.in
Changed the pragmas to allow debugging under Linux
[wxWidgets.git] / configure.in
index dc9e74345ebee81fe82c36d21d706d5f8aadfd2f..f76c5607b29fe6486044221eec3dd2c1a80c0a8e 100644 (file)
@@ -11,90 +11,6 @@ dnl
 dnl Version: $Id$
 dnl ---------------------------------------------------------------------------
 
-dnl ---------------------------------------------------------------------------
-dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
-dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS. Uses variables
-dnl gtk_config_prefix and/or gtk_config_exec_prefix if defined.
-dnl ---------------------------------------------------------------------------
-dnl
-AC_DEFUN(AM_PATH_GTK,
-[
-  if test x$gtk_config_exec_prefix != x ; then
-     gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
-     if test x${GTK_CONFIG+set} != xset ; then
-        GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
-     fi
-  fi
-  if test x$gtk_config_prefix != x ; then
-     gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
-     if test x${GTK_CONFIG+set} != xset ; then
-        GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
-     fi
-  fi
-
-  AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
-  min_gtk_version=ifelse([$1], ,0.99.7,$1)
-  AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
-  no_gtk=""
-  if test "$GTK_CONFIG" != "no" ; then
-    GTK_CFLAGS=`$GTK_CONFIG --cflags`
-    GTK_LIBS=`$GTK_CONFIG --libs gthread`
-    ac_save_CFLAGS="$CFLAGS"
-    ac_save_LIBS="$LIBS"
-    CFLAGS="$CFLAGS $GTK_CFLAGS"
-    LIBS="$LIBS $GTK_LIBS"
-dnl
-dnl Now check if the installed GTK is sufficiently new. (Also sanity
-dnl checks the results of gtk-config to some extent)
-dnl
-    AC_TRY_RUN([
-#include <gtk/gtk.h>
-#include <gtk/gtkfeatures.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int
-main ()
-{
-  int major, minor, micro;
-
-  if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, &micro) != 3) {
-     printf("%s, bad version string\n", "$min_gtk_version");
-     exit(1);
-   }
-
-   if ((GTK_MAJOR_VERSION != gtk_major_version) ||
-       (GTK_MINOR_VERSION != gtk_minor_version) ||
-       (GTK_MICRO_VERSION != gtk_micro_version)) {
-     printf("Headers vs. library version mismatch!\n");
-     exit(1);
-   }
-
-   if (gtk_minor_version == 1) return FALSE;
-
-   return !((gtk_major_version > major) ||
-    ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
-    ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)));
-}
-],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
-     CFLAGS="$ac_save_CFLAGS"
-     LIBS="$ac_save_LIBS"
-  else
-     no_gtk=yes
-  fi
-  if test "x$no_gtk" = x ; then
-     AC_MSG_RESULT(yes)
-     ifelse([$2], , :, [$2])
-  else
-     AC_MSG_RESULT(no)
-     GTK_CFLAGS=""
-     GTK_LIBS=""
-     ifelse([$3], , :, [$3])
-  fi
-  AC_SUBST(GTK_CFLAGS)
-  AC_SUBST(GTK_LIBS)
-])
-
 dnl ===========================================================================
 dnl macros to find the a file in the list of include/lib paths
 dnl ===========================================================================
@@ -184,10 +100,10 @@ AC_DEFUN(WX_CPP_NEW_HEADERS,
 
     AC_CHECK_HEADERS(iostream)
 
-    if test "x$HAVE_IOSTREAM" = x ; then
-      ifelse([$2], , :, [$2])
-    else
+    if test "$ac_cv_header_iostream" = "yes" ; then
       ifelse([$1], , :, [$1])
+    else
+      ifelse([$2], , :, [$2])
     fi
 
     AC_LANG_RESTORE
@@ -216,7 +132,6 @@ AC_DEFUN(WX_CPP_BOOL,
         return 0;
       ],
       [
-        AC_DEFINE(HAVE_BOOL)
         wx_cv_cpp_bool=yes
       ],
       [
@@ -294,9 +209,9 @@ dnl   possible arguments are 'yes', 'no', or 'sys'
 dnl usage: WX_ARG_SYS_WITH(option, helpmessage, variable-name)
 AC_DEFUN(WX_ARG_SYS_WITH,
         [
-          AC_MSG_CHECKING("for --with-$1")
+          AC_MSG_CHECKING([for --with-$1])
           no_cache=0
-          AC_ARG_WITH($1, $2,
+          AC_ARG_WITH($1, [$2],
                       [
                         if test "$withval" = yes; then
                           ac_cv_use_$1='$3=yes'
@@ -339,9 +254,9 @@ dnl this macro checks for a command line argument and caches the result
 dnl usage: WX_ARG_WITH(option, helpmessage, variable-name)
 AC_DEFUN(WX_ARG_WITH,
         [
-          AC_MSG_CHECKING("for --with-$1")
+          AC_MSG_CHECKING([for --with-$1])
           no_cache=0
-          AC_ARG_WITH($1, $2,
+          AC_ARG_WITH($1, [$2],
                       [
                         if test "$withval" = yes; then
                           ac_cv_use_$1='$3=yes'
@@ -376,9 +291,9 @@ dnl like WX_ARG_WITH but uses AC_ARG_ENABLE instead of AC_ARG_WITH
 dnl usage: WX_ARG_ENABLE(option, helpmessage, variable-name)
 AC_DEFUN(WX_ARG_ENABLE,
         [
-          AC_MSG_CHECKING("for --enable-$1")
+          AC_MSG_CHECKING([for --enable-$1])
           no_cache=0
-          AC_ARG_ENABLE($1, $2,
+          AC_ARG_ENABLE($1, [$2],
                         [
                           if test "$enableval" = yes; then
                             ac_cv_use_$1='$3=yes'
@@ -409,32 +324,6 @@ AC_DEFUN(WX_ARG_ENABLE,
           fi
         ])
 
-dnl -
-dnl - GNU libc extension (added by GL)
-dnl -
-
-AC_DEFUN(WX_GNU_EXTENSIONS,
-[
-AC_MSG_CHECKING([if you need GNU extensions])
-AC_CACHE_VAL(wx_cv_gnu_extensions,[
-   AC_TRY_COMPILE([#include <features.h>],[
-
-#ifndef __GNU_LIBRARY__
- Compile error wanted
-#endif
-
-],
-  [wx_cv_gnu_extensions=yes],
-  [wx_cv_gnu_extensions=no])
-])
-
-AC_MSG_RESULT($wx_cv_gnu_extensions)
-if test "$wx_cv_gnu_extensions" = "yes"; then
-  AC_DEFINE_UNQUOTED(_GNU_SOURCE)
-fi
-])
-
-
 dnl ---------------------------------------------------------------------------
 dnl initialization
 dnl ---------------------------------------------------------------------------
@@ -448,27 +337,39 @@ AC_CANONICAL_SYSTEM
 dnl When making releases do:
 dnl
 dnl WX_RELEASE_NUMBER += 1
-dnl WX_INTERFACE_AGE += 1
-dnl WX_BINARY_AGE += 1
 dnl
-dnl if any functions have been added, do:
+dnl ..and update WX_CURRENT, WX_RELEASE and WX_AGE according to the
+dnl following rules:
+dnl
+dnl    If any changes have been made to the public interface, that is if any
+dnl    exported class, method, global or global type has been added, removed
+dnl    or changed in any way, then do:  WX_CURRENT += 1
+dnl
+dnl    If source changes have been made that *do not* alter the public
+dnl    interface then do:  WX_REVISION += 1
+dnl    If WX_CURRENT was incremented (as above) instead do:  WX_REVISION = 0
+dnl
+dnl    If any public interface was added, do:  WX_AGE += 1
+dnl    If any public interface was removed (or altered in a way effectively
+dnl    removing the previous definition), instead do:  WX_AGE = 0
 dnl
-dnl WX_INTERFACE_AGE = 0
+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=
@@ -492,6 +394,7 @@ USE_ALPHA=
 USE_OSF=
 USE_BSD=
 USE_FREEBSD=
+USE_OPENBSD=
 USE_NETBSD=
 USE_VMS=
 USE_ULTRIX=
@@ -505,26 +408,30 @@ dnl than checking it during run-time
 NEEDS_D_REENTRANT_FOR_R_FUNCS=0
 
 dnl the list of all available toolkits
-ALL_TOOLKITS="CYGWIN GTK MINGW MOTIF 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 +489,13 @@ case "${host}" in
     AC_DEFINE(__BSD__)
     DEFAULT_DEFAULT_wxUSE_GTK=1
   ;;
+  *-*-openbsd*)
+    USE_BSD=1
+    USE_OPENBSD=1
+    AC_DEFINE(__FREEBSD__)
+    AC_DEFINE(__OPENBSD__)
+    DEFAULT_DEFAULT_wxUSE_GTK=1
+  ;;
   *-*-netbsd*)
     USE_BSD=1
     USE_NETBSD=1
@@ -621,7 +535,7 @@ case "${host}" in
     DEFAULT_DEFAULT_wxUSE_MOTIF=1
   ;;
 
-  *-*-cygwin32* | *-*-mingw32* )
+  *-*-cygwin* | *-*-mingw32* )
     USE_UNIX=0
     USE_WIN32=1
     AC_DEFINE(__WIN32__)
@@ -693,11 +607,13 @@ dnl useful to test the compilation with minimum options, define as 0 for normal
 dnl usage
 DEBUG_CONFIGURE=0
 if test $DEBUG_CONFIGURE = 1; then
+  DEFAULT_wxUSE_UNIVERSAL=no
+
   DEFAULT_wxUSE_THREADS=yes
 
   DEFAULT_wxUSE_SHARED=yes
   DEFAULT_wxUSE_BURNT_NAME=no
-  DEFAULT_wxUSE_OPTIMISE=yes
+  DEFAULT_wxUSE_OPTIMISE=no
   DEFAULT_wxUSE_PROFILE=no
   DEFAULT_wxUSE_NO_DEPS=no
   DEFAULT_wxUSE_NO_RTTI=no
@@ -712,8 +628,11 @@ if test $DEBUG_CONFIGURE = 1; then
   DEFAULT_wxUSE_APPLE_IEEE=no
 
   DEFAULT_wxUSE_LOG=yes
+  DEFAULT_wxUSE_LOGWINDOW=no
+  DEFAULT_wxUSE_LOGGUI=no
 
   DEFAULT_wxUSE_GUI=yes
+  DEFAULT_wxUSE_CONTROLS=no
 
   DEFAULT_wxUSE_ZLIB=no
   DEFAULT_wxUSE_LIBPNG=no
@@ -724,13 +643,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 +674,7 @@ if test $DEBUG_CONFIGURE = 1; then
   DEFAULT_wxUSE_CLIPBOARD=no
   DEFAULT_wxUSE_TOOLTIPS=no
   DEFAULT_wxUSE_DRAG_AND_DROP=no
+  DEFAULT_wxUSE_DRAGIMAGE=no
   DEFAULT_wxUSE_SPLINES=no
 
   DEFAULT_wxUSE_MDI_ARCHITECTURE=no
@@ -759,14 +686,25 @@ if test $DEBUG_CONFIGURE = 1; then
   DEFAULT_wxUSE_CONSTRAINTS=no
   DEFAULT_wxUSE_IPC=no
   DEFAULT_wxUSE_HELP=no
+  DEFAULT_wxUSE_WXHTML_HELP=no
   DEFAULT_wxUSE_WXTREE=no
   DEFAULT_wxUSE_METAFILE=no
+  DEFAULT_wxUSE_MIMETYPE=no
 
   DEFAULT_wxUSE_COMMONDLGS=no
+  DEFAULT_wxUSE_CHOICEDLG=no
+  DEFAULT_wxUSE_COLOURDLG=no
   DEFAULT_wxUSE_DIRDLG=no
+  DEFAULT_wxUSE_FILEDLG=no
+  DEFAULT_wxUSE_FONTDLG=no
+  DEFAULT_wxUSE_MSGDLG=no
+  DEFAULT_wxUSE_NUMBERDLG=no
   DEFAULT_wxUSE_TEXTDLG=no
   DEFAULT_wxUSE_STARTUP_TIPS=no
   DEFAULT_wxUSE_PROGRESSDLG=no
+  DEFAULT_wxUSE_WIZARDDLG=no
+
+  DEFAULT_wxUSE_MENUS=no
   DEFAULT_wxUSE_MINIFRAME=no
   DEFAULT_wxUSE_HTML=no
   DEFAULT_wxUSE_FILESYSTEM=no
@@ -774,14 +712,16 @@ if test $DEBUG_CONFIGURE = 1; then
   DEFAULT_wxUSE_FS_ZIP=no
   DEFAULT_wxUSE_BUSYINFO=no
   DEFAULT_wxUSE_ZIPSTREAM=no
-  DEFAULT_wxUSE_VALIDATORS=yes
+  DEFAULT_wxUSE_VALIDATORS=no
 
   DEFAULT_wxUSE_ACCEL=no
-  DEFAULT_wxUSE_CARET=no
+  DEFAULT_wxUSE_BUTTON=no
   DEFAULT_wxUSE_BMPBUTTON=no
+  DEFAULT_wxUSE_CALCTRL=no
+  DEFAULT_wxUSE_CARET=no
   DEFAULT_wxUSE_CHECKBOX=no
   DEFAULT_wxUSE_CHECKLST=no
-  DEFAULT_wxUSE_CHOICE=yes
+  DEFAULT_wxUSE_CHOICE=no
   DEFAULT_wxUSE_COMBOBOX=no
   DEFAULT_wxUSE_GAUGE=no
   DEFAULT_wxUSE_GRID=no
@@ -801,8 +741,10 @@ 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
@@ -812,10 +754,14 @@ if test $DEBUG_CONFIGURE = 1; then
   DEFAULT_wxUSE_UNICODE=no
   DEFAULT_wxUSE_WCSRTOMBS=no
 
+  DEFAULT_wxUSE_IMAGE=no
   DEFAULT_wxUSE_GIF=no
   DEFAULT_wxUSE_PCX=no
   DEFAULT_wxUSE_PNM=no
+  DEFAULT_wxUSE_XPM=no
 else
+  DEFAULT_wxUSE_UNIVERSAL=no
+
   DEFAULT_wxUSE_THREADS=yes
 
   DEFAULT_wxUSE_SHARED=yes
@@ -835,6 +781,8 @@ else
   DEFAULT_wxUSE_APPLE_IEEE=yes
 
   DEFAULT_wxUSE_LOG=yes
+  DEFAULT_wxUSE_LOGWINDOW=yes
+  DEFAULT_wxUSE_LOGGUI=yes
 
   DEFAULT_wxUSE_GUI=yes
 
@@ -847,13 +795,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
@@ -871,6 +826,7 @@ else
   DEFAULT_wxUSE_CLIPBOARD=yes
   DEFAULT_wxUSE_TOOLTIPS=yes
   DEFAULT_wxUSE_DRAG_AND_DROP=yes
+  DEFAULT_wxUSE_DRAGIMAGE=yes
   DEFAULT_wxUSE_SPLINES=yes
 
   DEFAULT_wxUSE_MDI_ARCHITECTURE=yes
@@ -882,14 +838,25 @@ else
   DEFAULT_wxUSE_CONSTRAINTS=yes
   DEFAULT_wxUSE_IPC=yes
   DEFAULT_wxUSE_HELP=yes
+  DEFAULT_wxUSE_WXHTML_HELP=yes
   DEFAULT_wxUSE_WXTREE=yes
   DEFAULT_wxUSE_METAFILE=yes
+  DEFAULT_wxUSE_MIMETYPE=yes
 
   DEFAULT_wxUSE_COMMONDLGS=yes
+  DEFAULT_wxUSE_CHOICEDLG=yes
+  DEFAULT_wxUSE_COLOURDLG=yes
   DEFAULT_wxUSE_DIRDLG=yes
+  DEFAULT_wxUSE_FILEDLG=yes
+  DEFAULT_wxUSE_FONTDLG=yes
+  DEFAULT_wxUSE_MSGDLG=yes
+  DEFAULT_wxUSE_NUMBERDLG=yes
   DEFAULT_wxUSE_TEXTDLG=yes
   DEFAULT_wxUSE_STARTUP_TIPS=yes
   DEFAULT_wxUSE_PROGRESSDLG=yes
+  DEFAULT_wxUSE_WIZARDDLG=yes
+
+  DEFAULT_wxUSE_MENUS=yes
   DEFAULT_wxUSE_MINIFRAME=yes
   DEFAULT_wxUSE_HTML=yes
   DEFAULT_wxUSE_FILESYSTEM=yes
@@ -900,8 +867,10 @@ else
   DEFAULT_wxUSE_VALIDATORS=yes
 
   DEFAULT_wxUSE_ACCEL=yes
-  DEFAULT_wxUSE_CARET=yes
+  DEFAULT_wxUSE_BUTTON=yes
   DEFAULT_wxUSE_BMPBUTTON=yes
+  DEFAULT_wxUSE_CALCTRL=yes
+  DEFAULT_wxUSE_CARET=yes
   DEFAULT_wxUSE_CHECKBOX=yes
   DEFAULT_wxUSE_CHECKLST=yes
   DEFAULT_wxUSE_CHOICE=yes
@@ -924,8 +893,10 @@ 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
@@ -935,9 +906,11 @@ else
   DEFAULT_wxUSE_UNICODE=no
   DEFAULT_wxUSE_WCSRTOMBS=no
 
+  DEFAULT_wxUSE_IMAGE=yes
   DEFAULT_wxUSE_GIF=yes
   DEFAULT_wxUSE_PCX=yes
   DEFAULT_wxUSE_PNM=yes
+  DEFAULT_wxUSE_XPM=yes
 fi
 
 dnl WX_ARG_WITH should be used to select whether an external package will be
@@ -971,6 +944,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])
@@ -978,11 +952,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)
@@ -1029,6 +1001,9 @@ WX_ARG_ENABLE(no_exceptions, [  --enable-no_exceptions  create code without exce
 WX_ARG_ENABLE(permissive,    [  --enable-permissive     compile code disregarding strict ANSI], wxUSE_PERMISSIVE)
 WX_ARG_ENABLE(no_deps,       [  --enable-no_deps        create code without dependency information], wxUSE_NO_DEPS)
 
+WX_ARG_ENABLE(compat20,      [  --enable-compat20       enable wxWin 2.0 compatibility], WXWIN_COMPATIBILITY_2)
+WX_ARG_ENABLE(compat22,      [  --enable-compat22       enable wxWin 2.2 compatibility], WXWIN_COMPATIBILITY_2_2)
+
 dnl ---------------------------------------------------------------------------
 dnl (small) optional non GUI classes
 dnl ---------------------------------------------------------------------------
@@ -1040,9 +1015,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)
@@ -1051,7 +1030,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)
@@ -1062,6 +1043,9 @@ WX_ARG_ENABLE(fs_zip,        [  --enable-fs_zip         use virtual ZIP filesyst
 WX_ARG_ENABLE(zipstream,     [  --enable-zipstream      use wxZipInputStream], wxUSE_ZIPSTREAM)
 
 WX_ARG_ENABLE(catch_segvs,   [  --enable-catch_segvs    catch signals and pass them to wxApp::OnFatalException], wxUSE_ON_FATAL_EXCEPTION)
+WX_ARG_ENABLE(snglinst,      [  --enable-snglinst       use wxSingleInstanceChecker class], wxUSE_SNGLINST_CHECKER)
+
+WX_ARG_ENABLE(mimetype,    [  --enable-mimetypes      use wxMimeTypesManager], wxUSE_MIMETYPE)
 
 dnl ---------------------------------------------------------------------------
 dnl "big" options (i.e. those which change a lot of things throughout the library)
@@ -1077,10 +1061,14 @@ dnl "big" GUI options
 dnl ---------------------------------------------------------------------------
 
 WX_ARG_ENABLE(docview,     [  --enable-docview        use document view architecture], wxUSE_DOC_VIEW_ARCHITECTURE)
-WX_ARG_ENABLE(help,        [  --enable-help           use help (using external browser at present)], wxUSE_HELP)
+WX_ARG_ENABLE(help,        [  --enable-help           use help subsystem], wxUSE_HELP)
+WX_ARG_ENABLE(html,        [  --enable-html           use wxHTML sub-library], wxUSE_HTML)
+WX_ARG_ENABLE(htmlhelp,    [  --enable-htmlhelp       use wxHTML-based help], wxUSE_WXHTML_HELP)
 WX_ARG_ENABLE(constraints, [  --enable-constraints    use layout-constraints system], wxUSE_CONSTRAINTS)
 WX_ARG_ENABLE(printarch,   [  --enable-printarch      use printing architecture], wxUSE_PRINTING_ARCHITECTURE)
 WX_ARG_ENABLE(mdi,         [  --enable-mdi            use multiple document interface architecture], wxUSE_MDI_ARCHITECTURE)
+WX_ARG_ENABLE(loggui,      [  --enable-loggui         use standard GUI logger], wxUSE_LOGGUI)
+WX_ARG_ENABLE(logwin,      [  --enable-logwin         use wxLogWindow], wxUSE_LOGWINDOW)
 
 dnl ---------------------------------------------------------------------------
 dnl PostScript options
@@ -1094,6 +1082,7 @@ dnl WX_ARG_ENABLE(afmfonts,        [  --enable-afmfonts       use Adobe Font Met
 dnl ---------------------------------------------------------------------------
 dnl resources
 dnl ---------------------------------------------------------------------------
+
 WX_ARG_ENABLE(prologio,    [  --enable-prologio       use Prolog IO library], wxUSE_PROLOGIO)
 WX_ARG_ENABLE(resources,   [  --enable-resources      use wxWindows resources], wxUSE_RESOURCES)
 
@@ -1121,9 +1110,11 @@ dnl --disable-<control> later on the command line - but by default all will be
 dnl used (and vice versa)
 if test "$wxUSE_CONTROLS" = "yes"; then
   DEFAULT_wxUSE_ACCEL=yes
+  DEFAULT_wxUSE_BMPBUTTON=yes
+  DEFAULT_wxUSE_BUTTON=yes
+  DEFAULT_wxUSE_CALCTRL=no
   DEFAULT_wxUSE_CARET=yes
   DEFAULT_wxUSE_COMBOBOX=yes
-  DEFAULT_wxUSE_BMPBUTTON=yes
   DEFAULT_wxUSE_CHECKBOX=yes
   DEFAULT_wxUSE_CHECKLISTBOX=yes
   DEFAULT_wxUSE_CHOICE=yes
@@ -1155,9 +1146,11 @@ if test "$wxUSE_CONTROLS" = "yes"; then
   DEFAULT_wxUSE_TREECTRL=yes
 elif test "$wxUSE_CONTROLS" = "no"; then
   DEFAULT_wxUSE_ACCEL=no
+  DEFAULT_wxUSE_BMPBUTTON=no
+  DEFAULT_wxUSE_BUTTON=no
+  DEFAULT_wxUSE_CALCTRL=no
   DEFAULT_wxUSE_CARET=no
   DEFAULT_wxUSE_COMBOBOX=no
-  DEFAULT_wxUSE_BMPBUTTON=no
   DEFAULT_wxUSE_CHECKBOX=no
   DEFAULT_wxUSE_CHECKLISTBOX=no
   DEFAULT_wxUSE_CHOICE=no
@@ -1190,8 +1183,10 @@ elif test "$wxUSE_CONTROLS" = "no"; then
 fi
 
 WX_ARG_ENABLE(accel,       [  --enable-accel          use accelerators], wxUSE_ACCEL)
-WX_ARG_ENABLE(caret,       [  --enable-caret          use wxCaret class], wxUSE_CARET)
+WX_ARG_ENABLE(button,      [  --enable-button         use wxButton class], wxUSE_BUTTON)
 WX_ARG_ENABLE(bmpbutton,   [  --enable-bmpbutton      use wxBitmapButton class], wxUSE_BMPBUTTON)
+WX_ARG_ENABLE(calendar,    [  --enable-calendar       use wxCalendarCtrl class], wxUSE_CALCTRL)
+WX_ARG_ENABLE(caret,       [  --enable-caret          use wxCaret class], wxUSE_CARET)
 WX_ARG_ENABLE(checkbox,    [  --enable-checkbox       use wxCheckBox class], wxUSE_CHECKBOX)
 WX_ARG_ENABLE(checklst,    [  --enable-checklst       use wxCheckListBox (listbox with checkboxes) class], wxUSE_CHECKLST)
 WX_ARG_ENABLE(choice,      [  --enable-choice         use wxChoice class], wxUSE_CHOICE)
@@ -1214,8 +1209,10 @@ 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)
@@ -1223,29 +1220,45 @@ WX_ARG_ENABLE(tbarsmpl,    [  --enable-tbarsmpl       use wxToolBarSimple class]
 WX_ARG_ENABLE(treectrl,    [  --enable-treectrl       use wxTreeCtrl class], wxUSE_TREECTRL)
 
 dnl ---------------------------------------------------------------------------
-dnl misc GUI options
+dnl common dialogs
 dnl ---------------------------------------------------------------------------
 
 WX_ARG_ENABLE(commondlg,   [  --enable-commondlg      use common dialogs (wxDirDialog, wxProgressDialog, wxTextDialog, ...)], wxUSE_COMMONDLGS)
+WX_ARG_ENABLE(choicedlg,   [  --enable-choicedlg      use wxChoiceDialog], wxUSE_CHOICEDLG)
+WX_ARG_ENABLE(coldlg,      [  --enable-coldlg         use wxColourDialog], wxUSE_COLOURDLG)
+WX_ARG_ENABLE(filedlg,     [  --enable-filedlg        use wxFileDialog], wxUSE_FILEDLG)
+WX_ARG_ENABLE(fontdlg,     [  --enable-fontdlg        use wxFontDialog], wxUSE_FONTDLG)
 WX_ARG_ENABLE(dirdlg,      [  --enable-dirdlg         use wxDirDialog], wxUSE_DIRDLG)
+WX_ARG_ENABLE(msgdlg,      [  --enable-msgdlg         use wxMessageDialog], wxUSE_MSGDLG)
+WX_ARG_ENABLE(numberdlg,   [  --enable-numberdlg      use wxNumberEntryDialog], wxUSE_NUMBERDLG)
 WX_ARG_ENABLE(textdlg,     [  --enable-textdlg        use wxTextDialog], wxUSE_TEXTDLG)
 WX_ARG_ENABLE(tipdlg,      [  --enable-tipdlg         use startup tips], wxUSE_STARTUP_TIPS)
 WX_ARG_ENABLE(progressdlg, [  --enable-progressdlg    use wxProgressDialog], wxUSE_PROGRESSDLG)
+WX_ARG_ENABLE(wizarddlg,   [  --enable-wizarddlg      use wxWizard], wxUSE_WIZARDDLG)
+
+dnl ---------------------------------------------------------------------------
+dnl misc GUI options
+dnl ---------------------------------------------------------------------------
+
+WX_ARG_ENABLE(menus,       [  --enable-menus          use wxMenu/wxMenuBar/wxMenuItem classes], wxUSE_MENUS)
 WX_ARG_ENABLE(miniframe,   [  --enable-miniframe      use wxMiniFrame class], wxUSE_MINIFRAME)
-WX_ARG_ENABLE(html,        [  --enable-html           use wxHTML sub-library], wxUSE_HTML)
 WX_ARG_ENABLE(tooltips,    [  --enable-tooltips       use wxToolTip class], wxUSE_TOOLTIPS)
 WX_ARG_ENABLE(splines,     [  --enable-splines        use spline drawing code], wxUSE_SPLINES)
 WX_ARG_ENABLE(validators,  [  --enable-validators     use wxValidator and derived classes], wxUSE_VALIDATORS)
 WX_ARG_ENABLE(busyinfo,    [  --enable-busyinfo       use wxBusyInfo], wxUSE_BUSYINFO)
 WX_ARG_ENABLE(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
@@ -1283,8 +1296,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.
@@ -1323,7 +1337,8 @@ for toolkit in `echo $ALL_TOOLKITS`; do
       echo "$var=$value" >> ${wx_arg_cache_file}
     fi
     if test "$value" = 1; then
-      AC_MSG_RESULT(`echo $toolkit | tr [[A-Z]] [[a-z]]`)
+      toolkit_echo=`echo $toolkit | tr [[A-Z]] [[a-z]]`
+      AC_MSG_RESULT($toolkit_echo)
     fi
   fi
 done
@@ -1407,7 +1422,7 @@ dnl   defines STRIP as strip or nothing if not found
 AC_CHECK_PROG(STRIP, strip, strip, true)
 
 dnl check if VPATH works
-AC_MSG_CHECKING("make for VPATH support")
+AC_MSG_CHECKING([make for VPATH support])
 dnl create Makefile
 cat - << EOF > confMake
 check : file
@@ -1427,7 +1442,7 @@ if test "$RESULT" = 0; then
   AC_MSG_RESULT(yes)
 else
   AC_MSG_RESULT(no)
-  AC_MSG_ERROR(
+  AC_MSG_ERROR([
 You need a make-utility that is able to use the variable
 VPATH correctly.
 If your version of make does not support VPATH correctly,
@@ -1437,7 +1452,7 @@ export MAKE=gmake; ./configure  for sh-type shells
 setenv MAKE gmake; ./configure  for csh-type shells
 Also please do remember to use gmake in this case every time
 you are trying to compile.
-)
+])
 fi
 
 dnl YACC checks
@@ -1547,236 +1562,264 @@ 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=
 
-GUI_TK_LIBRARY=
-GUI_TK_LINK=
+    WXGTK12=
+    WXGTK127=
+    WXGTK20=
 
-WXGTK12=
-WXGTK127=
-WXGTK20=
+    WXWINE=
 
-WXWINE=
-
-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"
+    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_RESULT(no)
-            AC_MSG_ERROR(please set CFLAGS to contain the location of windows.h)
+            AC_MSG_CHECKING(for Windows headers)
+            WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, windows.h)
+            if test "$ac_find_includes" != "" ; then
+                AC_MSG_RESULT(found $ac_find_includes)
+                TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE -I$ac_find_includes"
+            else
+                AC_MSG_RESULT(no)
+                AC_MSG_ERROR(please set CFLAGS to contain the location of windows.h)
+            fi
         fi
-    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"
+        INCLUDE_SUBDIRS="$INCLUDE_SUBDIRS msw"
+        dnl --- Quick & Dirty ; link against most/all libraries
+        dnl --- This will bloat the executable, but it'll work for now...
+        LIBS="$LIBS -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lcrtdll -ladvapi32 -lwsock32"
 
-    dnl add extra odbc libs if we have compiled in odbc
-    if test "$wxUSE_ODBC" = "yes" ; then
-        LIBS="$LIBS -lodbc32 -lole32 -loleaut32"
-    fi
+        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
+        dnl -mwindows is needed to avoid that spawning of a console window
+        if test "$wxUSE_MINGW" = 1; then
+            LDFLAGS="$LDFLAGS -mwindows"
+        fi
 
-    TOOLKIT=MSW
-    GUIDIST=MSW_DIST
+        TOOLKIT=MSW
+        GUIDIST=MSW_DIST
 
-    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 we should calculate these
+        RCINCSWITCH="--include-dir"
+        RCDEFSWITCH="--define"
+        RCPREPROCESSOR="--preprocessor \"\$(CC) -c -E -xc-header -DRC_INVOKED\""
+        RCINPUTSWITCH="-i"
+        RCOUTPUTSWITCH="-o"
+        RESFLAGS="$RCPREPROCESSOR $RCINCSWITCH \$(top_srcdir)/include $RCINCSWITCH \$(top_srcdir)/\$(program_dir) $RCDEFSWITCH __WIN32__ $RCDEFSWITCH __WIN95__ $RCDEFSWITCH __GNUWIN32__"
 
-    dnl set optinal RES_PROGRAM_OPT to RES_PROGRAM
-    RESPROGRAM="\$(RES_PROGRAM)"
+        dnl set optinal RES_PROGRAM_OPT to RES_PROGRAM
+        RESPROGRAM="\$(RES_PROGRAM)"
+    fi
 
-fi
+    if test "$wxUSE_GTK" = 1; then
+        AC_MSG_CHECKING([for GTK+ version])
 
-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
+        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
 
-    TOOLKIT_INCLUDE="$GTK_CFLAGS"
+                if test -z "$wx_cv_lib_gtk"; then
+                    AM_PATH_GTK(1.2.7, wx_cv_lib_gtk=1.2.7)
+                fi
 
-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.
+                if test -z "$wx_cv_lib_gtk"; then
+                    AM_PATH_GTK(1.2.3, wx_cv_lib_gtk=1.2.3)
+                fi
 
-    GUI_TK_LIBRARY="$GTK_LIBS"
+                if test -z "$wx_cv_lib_gtk"; then
+                    dnl looks better in AC_MSG_RESULT
+                    wx_cv_lib_gtk=none
+                else
+                    dnl we need to cache GTK_CFLAGS and GTK_LIBS for the
+                    dnl subsequent runs
+                    wx_cv_cflags_gtk=$GTK_CFLAGS
+                    wx_cv_libs_gtk=$GTK_LIBS
+                fi
+            ]
+        )
 
-dnl 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
+        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
 
-    AFMINSTALL=afminstall
-    TOOLKIT=GTK
-    GUIDIST=GTK_DIST
+        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
 
-    dnl test for XIM support in libgdk
-    AC_CHECK_LIB(gdk, gdk_im_open, AC_DEFINE(HAVE_XIM))
-fi
+        TOOLKIT_INCLUDE="$wx_cv_cflags_gtk"
+        GUI_TK_LIBRARY="$wx_cv_libs_gtk"
 
-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
+        AFMINSTALL=afminstall
+        TOOLKIT=GTK
+        GUIDIST=GTK_DIST
 
-    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)
+        dnl test for XIM support in libgdk
+        AC_CHECK_LIB(gdk, gdk_im_open, AC_DEFINE(HAVE_XIM))
     fi
 
-    MESA_LINK=""
-    AC_MSG_CHECKING(for Mesa library)
-    WX_PATH_FIND_LIBRARIES($SEARCH_LIB,MesaGL)
-    if test "$ac_find_libraries" != "" ; then
-        GUI_TK_LIBRARY="$GUI_TK_LIBRARY -L$ac_find_libraries"
-        MESA_LINK="-lMesaGL"
-        AC_MSG_RESULT(found at $ac_find_libraries)
-    else
-        AC_MSG_ERROR(no)
-    fi
+    if test "$wxUSE_MGL" = 1; then
+        dnl FIXME_MGL - test for MGL's variants for freebsd etc.
 
-    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
+        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
+
+        MGL_OS=linux/gcc/glibc
+        MGL_LIB_TYPE=""
 
-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
+        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
 
-AC_PATH_XTRA
-CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-LDFLAGS="$LDFLAGS $X_LIBS"
+        TOOLKIT_INCLUDE="-I$MGL_ROOT/include"
+        GUI_TK_LIBRARY="-L$MGL_ROOT/lib/$MGL_LIB_TYPE/$MGL_OS -lmgl -lmglcpp -lpm"
 
-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)
+        AFMINSTALL=afminstall
+        TOOLKIT=MGL
+        GUIDIST=MGL_DIST
     fi
 
-    GUI_TK_LIBRARY="$X_LIBS"
-    TOOLKIT_INCLUDE="$X_CFLAGS"
+    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
 
-    AFMINSTALL=afminstall
+        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
 
-    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;
+        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
 
-                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)
-            ]
-        )
+        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
 
-    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)
+    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
 
-            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)
+    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
-            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>
@@ -1792,119 +1835,191 @@ 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)
-            ]
-        )
-    fi
+            AC_MSG_RESULT(found at $ac_find_libraries)
+        else
+            AC_TRY_COMPILE(
+                [
+                    #include <X11/xpm.h>
+                ],
+                [
+                    int version;
 
-    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
+                    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
 
-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
+        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
 
-if test "$wxUSE_PM" = 1; then
-    TOOLKIT=PM
-    GUIDIST=GTK_DIST
-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
 
-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_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" -a "$wxUSE_ODBC" = "yes" ; then
-        ALL_OBJECTS="${ALL_OBJECTS} \$(IODBCOBJS)"
+    if test "$TOOLKIT" != "MSW"; then
+        if test "$wxUSE_ODBC" = "yes" ; then
+            ALL_OBJECTS="${ALL_OBJECTS} \$(IODBCOBJS)"
+        fi
     fi
 
     if test "$wxUSE_LIBJPEG" = "yes" ; then
@@ -1922,9 +2037,30 @@ fi
     if test "$wxUSE_FREETYPE" = "yes" ; then
         ALL_OBJECTS="${ALL_OBJECTS} \$(FREETYPEOBJS)"
     fi
-    ALL_DEPFILES="\$(GUIDEPS) \$(COMMONDEPS) \$(GENERICDEPS) \$(UNIXDEPS) \$(HTMLDEPS) \$(OGLDEPS)"
 
+    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="src/\$(TOOLKITDIR)/files.lst"
+    if test "$wxUSE_UNIVERSAL" = "yes"; then
+        dnl put univ files first!
+        PORT_FILES="\${top_srcdir}/src/univ/files.lst ${PORT_FILES}"
+    fi
     RPM_FILES="src/\$(TOOLKITDIR)/rpmfiles.lst"
     RPM_SPEC="wx\$(TOOLKIT).spec"
 
@@ -1964,12 +2100,6 @@ else
     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
@@ -2084,7 +2214,7 @@ if test "$wxUSE_SHARED" = "yes"; then
         WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
         WX_ALL="CREATE_LINKS"
       ;;
-      *-*-freebsd* | *-*-netbsd* )
+      *-*-freebsd* | *-*-openbsd* | *-*-netbsd* )
         SHARED_LD="${CC} -shared -o"
         PIC_FLAG="-fPIC"
         if test "$wxUSE_OPENGL" = "yes"; then
@@ -2096,8 +2226,8 @@ if test "$wxUSE_SHARED" = "yes"; then
         fi
       ;;
       *-*-darwin* )
-        SHARED_LD="libtool -dynamic -o"
-        PIC_FLAG="-fPIC"
+        SHARED_LD="${CXX} -dynamiclib -o"
+        PIC_FLAG="-dynamic -fPIC"
         if test "$wxUSE_OPENGL" = "yes"; then
             WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS CREATE_INSTALLED_LINKS_GL"
             WX_ALL="CREATE_LINKS CREATE_LINKS_GL"
@@ -2105,6 +2235,18 @@ if test "$wxUSE_SHARED" = "yes"; then
             WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
             WX_ALL="CREATE_LINKS"
         fi
+        dnl add the resources target
+        WX_ALL="${WX_ALL} ./lib/lib${WX_LIBRARY}-${WX_RELEASE}.r"
+        dnl the name of the shared library
+        WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}-${WX_RELEASE}.dylib.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
+        WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
+        dnl the name of the links to the shared library
+        WX_LIBRARY_LINK1="lib${WX_LIBRARY}-${WX_RELEASE}.dylib.${WX_CURRENT}"
+        WX_LIBRARY_LINK2="lib${WX_LIBRARY}-${WX_RELEASE}.dylib"
+        WX_LIBRARY_LINK3="lib${WX_LIBRARY}.dylib"
+        WX_LIBRARY_LINK1_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib.${WX_CURRENT}"
+        WX_LIBRARY_LINK2_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib"
+        WX_LIBRARY_LINK3_GL="lib${WX_LIBRARY}_gl.dylib"
       ;;
       *-*-osf* )
         SHARED_LD="${CXX} -shared -o"
@@ -2128,7 +2270,7 @@ if test "$wxUSE_SHARED" = "yes"; then
         SHARED_LD="/usr/lpp/xlC/bin/makeC++SharedLib -p 0 -o"
         WX_ALL=${WX_LIBRARY_NAME_SHARED}
       ;;
-      *-*-cygwin32* )
+      *-*-cygwin* )
         dnl only static for now
         WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}"
         WX_TARGET_LIBRARY_GL="${WX_LIBRARY_NAME_STATIC_GL}"
@@ -2201,10 +2343,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
@@ -2238,6 +2380,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 ---------------------------------------------------------------------------
@@ -2278,13 +2495,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
 
@@ -2294,9 +2540,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 ---------------------------------------------------------------------------
@@ -2315,8 +2558,6 @@ AC_CHECK_LIB(c, wcslen, [
 dnl check for vprintf/vsprintf() which are GNU extensions
 AC_FUNC_VPRINTF
 
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
 
 dnl check for vsscanf() and vsnprintf() - on some platforms (Linux, glibc
 dnl 2.1.1 for the first one, HP-UX for the second) it's available in the
@@ -2333,6 +2574,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,
 [
@@ -2355,7 +2601,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([
@@ -2377,15 +2622,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,
 [
@@ -2406,18 +2655,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)
@@ -2455,10 +2727,21 @@ fi
 dnl check for vfork() (even if it's the same as fork() in modern Unices)
 AC_CHECK_FUNCS(vfork)
 
+dnl check for fcntl() or at least flock() needed by Unix implementation of
+dnl wxSingleInstanceChecker
+if test "$wxUSE_SNGLINST_CHECKER" = "yes"; then
+    AC_CHECK_FUNCS(fcntl flock, break)
+
+    if test "$ac_cv_func_fcntl" != "yes" -a "$ac_cv_func_flock" != "yes"; then
+        AC_MSG_WARN(wxSingleInstanceChecker not available)
+        wxUSE_SNGLINST_CHECKER=no
+    fi
+fi
+
 dnl check for timegm() used by datetime.cpp
 AC_CHECK_FUNCS(timegm)
 
-dnl look for a 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
@@ -2489,9 +2772,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])
+                    )
                 ]
             )
         ]
@@ -2594,15 +2877,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"
                 ])
             ])
         ])
@@ -2625,7 +2902,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             ])
@@ -2636,7 +2913,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)
                 )]
@@ -2653,7 +2930,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"
@@ -2681,12 +2958,63 @@ if test "$wxUSE_THREADS" = "yes" ; then
                     pthread_cleanup_pop(0);
                  ], [
                     wx_cv_func_pthread_cleanup_push=yes
-                    AC_DEFINE(HAVE_THREAD_CLEANUP_FUNCTIONS)
                  ], [
                     wx_cv_func_pthread_cleanup_push=no
                  ])
   ])
 
+  if test "$wx_cv_func_pthread_cleanup_push" = "yes"; then
+      AC_DEFINE(HAVE_THREAD_CLEANUP_FUNCTIONS)
+  fi
+
+  dnl mutexattr_t initialization is done in quite different ways on different
+  dnl platforms, so check for a few things:
+  dnl
+  dnl HAVE_MUTEX_RECURSIVE means that we can create recursive mutexes
+  dnl HAVE_MUTEXATTR_SETTYPE means that we do it using
+  dnl pthread_mutexattr_settype(PTHREAD_MUTEX_RECURSIVE) and if it is not
+  dnl defined, we do it by directly assigned
+  dnl PTHREAD_MUTEX_RECURSIVE_MUTEX_INITIALIZER_NP to attr
+
+  AC_CACHE_CHECK([for pthread_mutexattr_t], wx_cv_type_pthread_mutexattr_t,
+  [
+    AC_TRY_COMPILE([#include <pthread.h>],
+        [
+           pthread_mutexattr_t attr;
+           pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+        ], [
+           wx_cv_type_pthread_mutexattr_t=yes
+        ], [
+           wx_cv_type_pthread_mutexattr_t=no
+        ]
+    )
+  ])
+
+  if test "$wx_cv_type_pthread_mutexattr_t" = "yes"; then
+    AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_T)
+  else
+    dnl don't despair, there may be another way to do it
+    AC_CACHE_CHECK([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER],
+                   wx_cv_type_pthread_rec_mutex_init,
+    [
+        AC_TRY_COMPILE([#include <pthread.h>],
+            [
+                pthread_mutex_t attr = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+            ], [
+                wx_cv_type_pthread_rec_mutex_init=yes
+            ], [
+                wx_cv_type_pthread_rec_mutex_init=no
+            ]
+        )
+    ])
+    if test "$wx_cv_type_pthread_rec_mutex_init" = "yes"; then
+      AC_DEFINE(HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
+    else
+      dnl this may break code working elsewhere, so at least warn about it
+      AC_MSG_WARN([wxMutex won't be recursive on this platform])
+    fi
+  fi
+
   THREADS_LINK="-l$THREADS_LINK"
 
   dnl building MT programs under Solaris with the native compiler requires -mt
@@ -2704,9 +3032,11 @@ fi
 if test "$wxUSE_THREADS" = "yes"; then
   AC_DEFINE(wxUSE_THREADS)
 
-  dnl must define _REENTRANT for multithreaded code
-  CFLAGS="${CFLAGS} -D_REENTRANT"
-  CXXFLAGS="${CXXFLAGS} -D_REENTRANT"
+  dnl must define _REENTRANT for multithreaded code except for Mac OS X
+  if test "$wxUSE_MAC" = "0"; then
+    CFLAGS="${CFLAGS} -D_REENTRANT"
+    CXXFLAGS="${CXXFLAGS} -D_REENTRANT"
+  fi
 
   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS thread"
 else
@@ -2742,8 +3072,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} -D__UNIX__ -D__POWERPC__ -DTARGET_CARBON"
+  CFLAGS="${CFLAGS} -fno-common -fpascal-strings"
+  CPPFLAGS="${CPPFLAGS} -cpp-precomp -fno-common -fpascal-strings"
+  AC_CHECK_PROG(REZ, Rez, Rez, /Developer/Tools/Rez)
+  AC_CHECK_PROG(DEREZ, Derez, Derez, /Developer/Tools/Derez)
+  RESCOMP=${REZ}
+  REZFLAGS="-d __UNIX__ -useDF"
+  DEREZFLAGS="Carbon.r -useDF"
+  RESFLAGS="Carbon.r -t APPL"
+  LIBWXMACRES="\$(LIBWX_MACRES)"
+  LIBWXMACRESCOMP="\$(LIBWX_MACRESCOMP)"
 fi
 
 if test "$wxUSE_CYGWIN" = 1 ; then
@@ -2823,6 +3162,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 ---------------------------------------------------------------------------
@@ -2876,7 +3225,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
@@ -2886,7 +3257,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=
@@ -2971,14 +3342,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
@@ -2999,6 +3394,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
@@ -3036,6 +3435,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
@@ -3059,7 +3466,7 @@ dnl ------------------------------------------------------------------------
 dnl time/date functions
 dnl ------------------------------------------------------------------------
 
-if test "$wxUSE_TIMEDATE" = "yes"; then
+if test "$wxUSE_DATETIME" = "yes"; then
     dnl check for strptime
     AC_CHECK_FUNCS(strptime)
 
@@ -3131,13 +3538,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)
@@ -3381,6 +3791,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
@@ -3449,6 +3863,10 @@ fi
 if test "$wxUSE_HELP" = "yes"; then
     AC_DEFINE(wxUSE_HELP)
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS help"
+
+    if test "$wxUSE_WXHTML_HELP" = "yes"; then
+        AC_DEFINE(wxUSE_WXHTML_HELP)
+    fi
 fi
 
 if test "$wxUSE_PRINTING_ARCHITECTURE" = "yes" ; then
@@ -3465,12 +3883,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
@@ -3491,6 +3905,7 @@ fi
 
 if test "$wxUSE_CLIPBOARD" = "yes"; then
     AC_DEFINE(wxUSE_CLIPBOARD)
+    AC_DEFINE(wxUSE_DATAOBJ)
 fi
 
 if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then
@@ -3506,15 +3921,17 @@ if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then
         wxUSE_DRAG_AND_DROP=no
     fi
 
+    if test "$wxUSE_MAC" = 1; then
+        AC_MSG_WARN([Drag and drop is not yet supported under Mac OS X])
+        wxUSE_DRAG_AND_DROP=no
+    fi
+
     if test "$USE_WIN32" = 1; then
         dnl check for ole headers and disable DnD if not present (earlier
         dnl versions of mingw32 don't have them)
 
         AC_CHECK_HEADERS(ole2.h)
 
-       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)"
@@ -3551,48 +3968,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
 
@@ -3602,11 +4045,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])
@@ -3615,15 +4060,18 @@ fi
 
 if test "$wxUSE_NOTEBOOK" = "yes"; then
     AC_DEFINE(wxUSE_NOTEBOOK)
+    USES_CONTROLS=1
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS notebook"
 fi
 
 if test "$wxUSE_RADIOBOX" = "yes"; then
     AC_DEFINE(wxUSE_RADIOBOX)
+    USES_CONTROLS=1
 fi
 
 if test "$wxUSE_RADIOBTN" = "yes"; then
     AC_DEFINE(wxUSE_RADIOBTN)
+    USES_CONTROLS=1
 fi
 
 if test "$wxUSE_SASH" = "yes"; then
@@ -3633,19 +4081,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
@@ -3655,10 +4107,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
@@ -3666,11 +4125,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
@@ -3680,28 +4141,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
-  AC_DEFINE(wxUSE_TOGGLEBTN)
+    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
@@ -3719,12 +4197,17 @@ fi
 if test "$wxUSE_TREECTRL" = "yes"; then
     if test "$wxUSE_IMAGLIST" = "yes"; then
         AC_DEFINE(wxUSE_TREECTRL)
+        USES_CONTROLS=1
         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS treectrl"
     else
         AC_MSG_WARN([wxTreeCtrl requires wxImageList and won't be compiled without it])
     fi
 fi
 
+if test "$USES_CONTROLS" = 1; then
+    AC_DEFINE(wxUSE_CONTROLS)
+fi
+
 dnl ---------------------------------------------------------------------------
 dnl misc options
 dnl ---------------------------------------------------------------------------
@@ -3734,36 +4217,22 @@ dnl if test "$wxUSE_WXTREE" = "yes"; then
 dnl   AC_DEFINE(wxUSE_WXTREE)
 dnl fi
 
-if test "$wxUSE_DIRDLG" = "yes"; then
-    if test "$wxUSE_CONSTRAINTS" != "yes"; then
-       AC_MSG_WARN(wxDirDialog requires constraints so it won't be compiled without them)
-    else
-        if test "$wxUSE_TREECTRL" != "yes"; then
-            AC_MSG_WARN(wxDirDialog requires wxTreeCtrl so it won't be compiled without it)
-        else
-            AC_DEFINE(wxUSE_DIRDLG)
-        fi
-    fi
+if test "$wxUSE_DRAGIMAGE" = "yes"; then
+    AC_DEFINE(wxUSE_DRAGIMAGE)
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dragimag"
 fi
 
-if test "$wxUSE_TEXTDLG" = "yes"; then
-    AC_DEFINE(wxUSE_TEXTDLG)
+if test "$wxUSE_MENUS" = "yes"; then
+    AC_DEFINE(wxUSE_MENUS)
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS menu"
 fi
 
-if test "$wxUSE_STARTUP_TIPS" = "yes"; then
-    if test "$wxUSE_CONSTRAINTS" != "yes"; then
-       AC_MSG_WARN(Startup tips requires constraints and won't be compiled without them)
-    else
-        AC_DEFINE(wxUSE_STARTUP_TIPS)
-    fi
+if test "$wxUSE_METAFILE" = "yes"; then
+    AC_DEFINE(wxUSE_METAFILE)
 fi
 
-if test "$wxUSE_PROGRESSDLG" = "yes"; then
-    if test "$wxUSE_CONSTRAINTS" != "yes"; then
-       AC_MSG_WARN(wxProgressDialog requires constraints so it won't be compiled without them)
-    else
-        AC_DEFINE(wxUSE_PROGRESSDLG)
-    fi
+if test "$wxUSE_MIMETYPE" = "yes"; then
+    AC_DEFINE(wxUSE_MIMETYPE)
 fi
 
 if test "$wxUSE_MINIFRAME" = "yes"; then
@@ -3782,6 +4251,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
@@ -3794,6 +4267,75 @@ if test "$wxUSE_PNM" = "yes" ; then
   AC_DEFINE(wxUSE_PNM)
 fi
 
+if test "$wxUSE_XPM" = "yes" ; then
+  AC_DEFINE(wxUSE_XPM)
+fi
+
+dnl ---------------------------------------------------------------------------
+dnl common dialog
+dnl ---------------------------------------------------------------------------
+
+if test "$wxUSE_CHOICEDLG" = "yes"; then
+    AC_DEFINE(wxUSE_CHOICEDLG)
+fi
+
+if test "$wxUSE_COLOURDLG" = "yes"; then
+    AC_DEFINE(wxUSE_COLOURDLG)
+fi
+
+if test "$wxUSE_FILEDLG" = "yes"; then
+    AC_DEFINE(wxUSE_FILEDLG)
+fi
+
+if test "$wxUSE_FONTDLG" = "yes"; then
+    AC_DEFINE(wxUSE_FONTDLG)
+fi
+
+if test "$wxUSE_DIRDLG" = "yes"; then
+    if test "$wxUSE_CONSTRAINTS" != "yes"; then
+       AC_MSG_WARN(wxDirDialog requires constraints so it won't be compiled without them)
+    else
+        if test "$wxUSE_TREECTRL" != "yes"; then
+            AC_MSG_WARN(wxDirDialog requires wxTreeCtrl so it won't be compiled without it)
+        else
+            AC_DEFINE(wxUSE_DIRDLG)
+        fi
+    fi
+fi
+
+if test "$wxUSE_MSGDLG" = "yes"; then
+    AC_DEFINE(wxUSE_MSGDLG)
+fi
+
+if test "$wxUSE_NUMBERDLG" = "yes"; then
+    AC_DEFINE(wxUSE_NUMBERDLG)
+fi
+
+if test "$wxUSE_PROGRESSDLG" = "yes"; then
+    if test "$wxUSE_CONSTRAINTS" != "yes"; then
+       AC_MSG_WARN(wxProgressDialog requires constraints so it won't be compiled without them)
+    else
+        AC_DEFINE(wxUSE_PROGRESSDLG)
+    fi
+fi
+
+if test "$wxUSE_STARTUP_TIPS" = "yes"; then
+    if test "$wxUSE_CONSTRAINTS" != "yes"; then
+       AC_MSG_WARN(Startup tips requires constraints and won't be compiled without them)
+    else
+        AC_DEFINE(wxUSE_STARTUP_TIPS)
+    fi
+fi
+
+if test "$wxUSE_TEXTDLG" = "yes"; then
+    AC_DEFINE(wxUSE_TEXTDLG)
+fi
+
+if test "$wxUSE_WIZARDDLG" = "yes"; then
+    AC_DEFINE(wxUSE_WIZARDDLG)
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS wizard"
+fi
+
 dnl ---------------------------------------------------------------------------
 dnl get the string with OS info - used by wxGetOsDescription()
 dnl ---------------------------------------------------------------------------
@@ -3820,12 +4362,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
+EXTRA_LIBS="$LIBS $POSIX4_LINK $INET_LINK $WCHAR_LINK $THREADS_LINK $DMALLOC_LINK $DL_LINK $ZLIB_LINK -lm"
 if test "$USE_MAC" = 1 ; then
-    EXTRA_LIBS="$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="$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"
@@ -3865,9 +4404,13 @@ if test "$wxUSE_GUI" = "yes"; then
 
     dnl TODO some samples are never built so far:
     dnl      ipc, mfc, nativdlg, oleauto, ownerdrw, proplist
-    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS controls dialogs dragimag \
-                     drawing dynamic event font fractal image menu \
-                     minimal richedit"
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS controls dialogs \
+                     drawing dynamic event font fractal image \
+                     minimal richedit widgets"
+
+    if test "$wxUSE_UNIVERSAL" = "yes" ; then
+        SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS univ"
+    fi
 
     dnl this is needed to be able to find AFM files
     CPPFLAGS="$CPPFLAGS \$(EXTRADEFS) \$(APPEXTRADEFS)"
@@ -3933,11 +4476,13 @@ 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
@@ -3973,6 +4518,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)
@@ -3990,14 +4542,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
@@ -4009,6 +4561,10 @@ if test "$wxUSE_GUI" = "yes"; then
     wx_cv_program_ext=$PROGRAM_EXT
     wx_cv_target_library=$WX_TARGET_LIBRARY
     wx_cv_target_libtype=$WX_TARGET_LIBRARY_TYPE
+    dnl we need to export them because passing them through cache won't
+    dnl work when cache=/dev/null (which is default for autoconf 2.50)
+    export wx_cv_path_samplesubdirs wx_cv_path_ifs wx_cv_program_ext \
+           wx_cv_target_library wx_cv_target_libtype
     AC_CONFIG_SUBDIRS(demos samples utils contrib)
 fi
 dnl from wxUSE_GUI
@@ -4024,13 +4580,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
@@ -4047,7 +4608,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
@@ -4058,18 +4619,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: