]> git.saurik.com Git - wxWidgets.git/blobdiff - configure.in
Not not pass debug messages on from wxLogWindow.
[wxWidgets.git] / configure.in
index 5eb6d8af8bb1acb90e12d4b44d877a014c8beeb0..700c4ed76e16ebca7244709cfa806bbbad818a35 100644 (file)
@@ -8,7 +8,7 @@ dnl
 dnl Top-level configure.in for wxWidgets by Robert Roebling, Phil Blecker,
 dnl Vadim Zeitlin and Ron Lee
 dnl
-dnl This script is under the wxWidgets licence.
+dnl This script is under the wxWindows licence.
 dnl
 dnl Version: $Id$
 dnl ---------------------------------------------------------------------------
@@ -17,16 +17,25 @@ dnl ---------------------------------------------------------------------------
 dnl initialization
 dnl ---------------------------------------------------------------------------
 
-AC_INIT([wxWidgets], [2.9.0], [wx-dev@lists.wxwidgets.org])
+AC_INIT([wxWidgets], [2.9.5], [wx-dev@lists.wxwidgets.org])
 
 dnl the file passed to AC_CONFIG_SRCDIR should be specific to our package
 AC_CONFIG_SRCDIR([wx-config.in])
 
-dnl sets build, host, target variables and the same with _alias
+dnl sets build, host variables and the same with _alias
 AC_CANONICAL_BUILD
 AC_CANONICAL_HOST
-AC_CANONICAL_TARGET
 
+dnl notice that if --host was given but --build was not, cross_compiling is
+dnl only set to "maybe" and not "yes" and will be either set to "yes" later or
+dnl configure will exit with error in AC_PROG_CC so don't test for = "yes" here
+if test "$cross_compiling" != "no"; then
+    HOST_PREFIX="${host_alias}-"
+    HOST_SUFFIX="-$host_alias"
+else
+    HOST_PREFIX=
+    HOST_SUFFIX=
+fi
 
 dnl When making releases do:
 dnl
@@ -34,7 +43,7 @@ dnl wx_release_number += 1
 
 wx_major_version_number=2
 wx_minor_version_number=9
-wx_release_number=0
+wx_release_number=5
 wx_subrelease_number=0
 
 WX_RELEASE=$wx_major_version_number.$wx_minor_version_number
@@ -94,15 +103,15 @@ NEEDS_D_REENTRANT_FOR_R_FUNCS=0
 dnl the list of all available toolkits
 dnl
 dnl update NUM_TOOLKITS calculation below when adding a new toolkit here!
-ALL_TOOLKITS="COCOA GTK OSX_CARBON OSX_COCOA MGL MICROWIN MOTIF MSW PM X11 DFB"
+ALL_TOOLKITS="COCOA GTK OSX_CARBON OSX_COCOA OSX_IPHONE MICROWIN MOTIF MSW PM X11 DFB"
 
 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_COCOA=0
+DEFAULT_wxUSE_OLD_COCOA=0
 DEFAULT_wxUSE_GTK=0
 DEFAULT_wxUSE_OSX_CARBON=0
 DEFAULT_wxUSE_OSX_COCOA=0
-DEFAULT_wxUSE_MGL=0
+DEFAULT_wxUSE_OSX_IPHONE=0
 DEFAULT_wxUSE_MICROWIN=0
 DEFAULT_wxUSE_MOTIF=0
 DEFAULT_wxUSE_MSW=0
@@ -113,11 +122,11 @@ DEFAULT_wxUSE_DFB=0
 dnl these are the values which are really default for the given platform:
 dnl they're used if no --with-<toolkit> options were given to detect the
 dnl toolkit to use by default for the target platform
-DEFAULT_DEFAULT_wxUSE_COCOA=0
+DEFAULT_DEFAULT_wxUSE_OLD_COCOA=0
 DEFAULT_DEFAULT_wxUSE_GTK=0
 DEFAULT_DEFAULT_wxUSE_OSX_CARBON=0
 DEFAULT_DEFAULT_wxUSE_OSX_COCOA=0
-DEFAULT_DEFAULT_wxUSE_MGL=0
+DEFAULT_DEFAULT_wxUSE_OSX_IPHONE=0
 DEFAULT_DEFAULT_wxUSE_MICROWIN=0
 DEFAULT_DEFAULT_wxUSE_MOTIF=0
 DEFAULT_DEFAULT_wxUSE_MSW=0
@@ -126,9 +135,9 @@ DEFAULT_DEFAULT_wxUSE_X11=0
 DEFAULT_DEFAULT_wxUSE_DFB=0
 
 PROGRAM_EXT=
-SO_SUFFIX=so
 SAMPLES_RPATH_FLAG=
-SAMPLES_RPATH_POSTLINK=
+DYLIB_RPATH_INSTALL=
+DYLIB_RPATH_POSTLINK=
 
 DEFAULT_STD_FLAG=yes
 
@@ -141,7 +150,6 @@ case "${host}" in
     USE_HPUX=1
     DEFAULT_DEFAULT_wxUSE_MOTIF=1
     NEEDS_D_REENTRANT_FOR_R_FUNCS=1
-    SO_SUFFIX=sl
     AC_DEFINE(__HPUX__)
 
     dnl many standard declarations in HP-UX headers are only included if either
@@ -174,6 +182,11 @@ case "${host}" in
     AC_DEFINE(__SVR4__)
     DEFAULT_DEFAULT_wxUSE_MOTIF=1
   ;;
+  *-*-qnx*)
+    USE_QNX=1
+    AC_DEFINE(__QNX__)
+    DEFAULT_DEFAULT_wxUSE_X11=1
+  ;;
   *-*-solaris2* )
     USE_SUN=1
     USE_SOLARIS=1
@@ -245,12 +258,6 @@ case "${host}" in
     USE_AIX=1
     USE_SYSV=1
     USE_SVR4=1
-    dnl quoting from http://www-1.ibm.com/servers/esdd/articles/gnu.html:
-    dnl
-    dnl     Both archive libraries and shared libraries on AIX have an .a
-    dnl     extension. This will explain why you can't link with an .so and
-    dnl     why it works with the name changed to .a.
-    SO_SUFFIX=a
     AC_DEFINE(__AIX__)
     AC_DEFINE(__SYSV__)
     AC_DEFINE(__SVR4__)
@@ -268,7 +275,6 @@ case "${host}" in
     dnl MBN: some of the defines have been moved after toolkit detection
     dnl      because for wxMotif/wxGTK/wxX11 to build on Cygwin
     dnl      USE_UNIX  must be set and not USE_WIN32
-    SO_SUFFIX=dll
     PROGRAM_EXT=".exe"
     DEFAULT_DEFAULT_wxUSE_MSW=1
   ;;
@@ -278,7 +284,6 @@ case "${host}" in
     USE_DOS=1
     AC_DEFINE(__DOS__)
     PROGRAM_EXT=".exe"
-    DEFAULT_DEFAULT_wxUSE_MGL=1
   ;;
 
   *-pc-os2_emx | *-pc-os2-emx )
@@ -315,28 +320,23 @@ case "${host}" in
     DEFAULT_STD_FLAG=no
   ;;
 
+  arm-apple-darwin*)
+    dnl iPhone
+    USE_BSD=1
+    USE_DARWIN=1
+    AC_DEFINE(__BSD__)
+    AC_DEFINE(__DARWIN__)
+    DEFAULT_DEFAULT_wxUSE_OSX_IPHONE=1
+  ;;
+
   *-*-darwin* )
     dnl Darwin based distributions (including Mac OS X)
     USE_BSD=1
     USE_DARWIN=1
-    SO_SUFFIX=dylib
     AC_DEFINE(__BSD__)
     AC_DEFINE(__DARWIN__)
     AC_DEFINE(TARGET_CARBON)
     DEFAULT_DEFAULT_wxUSE_OSX_CARBON=1
-    DEFAULT_STD_FLAG=no
-  ;;
-  powerpc-apple-macos* )
-    dnl Classic Mac OS (< X)
-    USE_UNIX=0
-    dnl For some reason the test that should be cross-compiler capable fails
-    dnl However, there is no doubt that MacOS PowerPC is big endian.
-    ac_cv_c_bigendian=yes
-    SO_SUFFIX=shlib
-    dnl AC_DEFINE(TARGET_CARBON)
-    dnl platform.h needs TARGET_CARBON before setup.h, we'll add it to CPPFLAGS
-    DEFAULT_DEFAULT_wxUSE_OSX_CARBON=1
-    DEFAULT_STD_FLAG=no
   ;;
 
   *-*-beos* )
@@ -369,6 +369,7 @@ dnl wxUSE_ALL_FEATURES which is the only which has to be set to "yes" by
 dnl default)
 DEFAULT_wxUSE_ALL_FEATURES=yes
 
+DEFAULT_wxUSE_STD_CONTAINERS=no
 DEFAULT_wxUSE_STD_IOSTREAM=$DEFAULT_STD_FLAG
 DEFAULT_wxUSE_STD_STRING=$DEFAULT_STD_FLAG
 
@@ -376,29 +377,31 @@ dnl libraries disabled by default
 DEFAULT_wxUSE_DMALLOC=no
 DEFAULT_wxUSE_LIBGNOMEVFS=no
 DEFAULT_wxUSE_LIBHILDON=no
+DEFAULT_wxUSE_LIBHILDON2=no
 DEFAULT_wxUSE_LIBMSPACK=no
 DEFAULT_wxUSE_LIBSDL=no
-DEFAULT_wxUSE_OPENGL=no
 
 dnl features disabled by default
 DEFAULT_wxUSE_ACCESSIBILITY=no
-DEFAULT_wxUSE_GRAPHICS_CONTEXT=no
 DEFAULT_wxUSE_IPV6=no
-DEFAULT_wxUSE_MEDIACTRL=no
-DEFAULT_wxUSE_TAB_DIALOG=no
 DEFAULT_wxUSE_GSTREAMER8=no
-
-DEFAULT_wxUSE_UNICODE_UTF8=auto
+DEFAULT_wxUSE_UNICODE_UTF8=no
 DEFAULT_wxUSE_UNICODE_UTF8_LOCALE=no
 
+dnl automatic features
+DEFAULT_wxUSE_ARTPROVIDER_TANGO=auto
+DEFAULT_wxUSE_OPENGL=auto
+DEFAULT_wxUSE_MEDIACTRL=auto
+DEFAULT_wxUSE_COMPILER_TLS=auto
+DEFAULT_wxUSE_HOTKEY=auto
+DEFAULT_wxUSE_METAFILE=auto
+
 dnl Mac/Cocoa users need to enable building universal binaries explicitly
 DEFAULT_wxUSE_UNIVERSAL_BINARY=no
+DEFAULT_wxUSE_MAC_ARCH=no
 
 DEFAULT_wxUSE_OFFICIAL_BUILD=no
 
-dnl Applicable only when --with-gtk was used:
-DEFAULT_wxUSE_GTK2=yes
-
 dnl Always default to no. Only special cases require this.
 DEFAULT_wxUSE_OBJC_UNIQUIFYING=no
 
@@ -441,6 +444,15 @@ fi
 
 WX_ARG_DISABLE(all-features,[  --disable-all-features  disable all optional features to build minimal library], wxUSE_ALL_FEATURES)
 
+if test "$wxUSE_ALL_FEATURES" = "no"; then
+    dnl this is a bit ugly but currently we have no choice but to manually
+    dnl reset all the options with default value of auto if all features are to
+    dnl be disabled because we can't have an option with default value of
+    dnl "auto-or-no-if-wxUSE_ALL_FEATURES-is-disabled"
+    DEFAULT_wxUSE_ARTPROVIDER_TANGO=no
+    DEFAULT_wxUSE_MEDIACTRL=no
+fi
+
 dnl ---------------------------------------------------------------------------
 dnl port selection
 dnl ---------------------------------------------------------------------------
@@ -454,22 +466,24 @@ fi
 
 dnl we use AC_ARG_WITH and not WX_ARG_WITH for the toolkit options as they
 dnl shouldn't default to wxUSE_ALL_FEATURES
-AC_ARG_WITH(gtk,          [[  --with-gtk[=VERSION]    use GTK+, VERSION can be 2 (default), 1 or "any"]], [wxUSE_GTK="$withval" CACHE_GTK=1 TOOLKIT_GIVEN=1])
+AC_ARG_WITH(gtk,          [[  --with-gtk[=VERSION]    use GTK+, VERSION can be 3, 2 (default), 1 or "any"]], [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(osx_carbon,    [  --with-osx_carbon       use Mac OS X (Carbon) ], [wxUSE_OSX_CARBON="$withval" CACHE_OSX_CARBON=1 TOOLKIT_GIVEN=1])
-AC_ARG_WITH(osx_cocoa,     [  --with-osx_cocoa        use Mac OS X (Cocoa) ], [wxUSE_OSX_COCOA="$withval" CACHE_OSX_COCOA=1 TOOLKIT_GIVEN=1])
-AC_ARG_WITH(mac,           [  --with-mac              use Mac OS X (Default) ], [wxUSE_OSX_CARBON="$withval" CACHE_OSX_CARBON=1 TOOLKIT_GIVEN=1])
-AC_ARG_WITH(cocoa,         [  --with-cocoa            use Cocoa], [wxUSE_COCOA="$withval" CACHE_COCOA=1 TOOLKIT_GIVEN=1])
+AC_ARG_WITH(osx_carbon,    [  --with-osx_carbon       use Mac OS X (Carbon)], [wxUSE_OSX_CARBON="$withval" CACHE_OSX_CARBON=1 TOOLKIT_GIVEN=1])
+AC_ARG_WITH(osx_cocoa,     [  --with-osx_cocoa        use Mac OS X (Cocoa)], [wxUSE_OSX_COCOA="$withval" CACHE_OSX_COCOA=1 TOOLKIT_GIVEN=1])
+AC_ARG_WITH(osx_iphone,    [  --with-osx_iphone       use iPhone OS X port], [wxUSE_OSX_IPHONE="$withval" CACHE_OSX_IPHONE=1 TOOLKIT_GIVEN=1])
+AC_ARG_WITH(osx,           [  --with-osx              use Mac OS X (default port, currently Carbon)], [wxUSE_OSX_CARBON="$withval" CACHE_OSX_CARBON=1 TOOLKIT_GIVEN=1])
+AC_ARG_WITH(carbon,        [  --with-carbon           same as --with-osx_carbon], [wxUSE_OSX_CARBON="$withval" CACHE_OSX_CARBON=1 TOOLKIT_GIVEN=1])
+AC_ARG_WITH(cocoa,         [  --with-cocoa            same as --with-osx_cocoa], [wxUSE_OSX_COCOA="$withval" CACHE_OSX_COCOA=1 TOOLKIT_GIVEN=1])
+AC_ARG_WITH(iphone,        [  --with-iphone           same as --with-osx_iphone], [wxUSE_OSX_IPHONE="$withval" CACHE_OSX_IPHONE=1 TOOLKIT_GIVEN=1])
+AC_ARG_WITH(mac,           [  --with-mac              same as --with-osx], [wxUSE_OSX_CARBON="$withval" CACHE_OSX_CARBON=1 TOOLKIT_GIVEN=1])
+AC_ARG_WITH(old_cocoa,     [  --with-old_cocoa        use old, deprecated, Cocoa port], [wxUSE_OLD_COCOA="$withval" CACHE_OLD_COCOA=1 TOOLKIT_GIVEN=1])
 AC_ARG_WITH(wine,          [  --with-wine             use Wine], [wxUSE_WINE="$withval" CACHE_WINE=1])
 AC_ARG_WITH(msw,           [  --with-msw              use MS-Windows], [wxUSE_MSW="$withval" CACHE_MSW=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 SciTech MGL], [wxUSE_MGL="$withval" wxUSE_UNIVERSAL="yes" CACHE_MGL=1 TOOLKIT_GIVEN=1])
 AC_ARG_WITH(directfb,      [  --with-directfb         use DirectFB], [wxUSE_DFB="$withval" wxUSE_UNIVERSAL="yes" CACHE_DFB=1 TOOLKIT_GIVEN=1])
 AC_ARG_WITH(microwin,      [  --with-microwin         use MicroWindows], [wxUSE_MICROWIN="$withval" CACHE_MICROWIN=1 TOOLKIT_GIVEN=1])
 AC_ARG_WITH(x11,           [  --with-x11              use X11], [wxUSE_X11="$withval" wxUSE_UNIVERSAL="yes" CACHE_X11=1 TOOLKIT_GIVEN=1])
 WX_ARG_ENABLE(nanox,       [  --enable-nanox          use NanoX], wxUSE_NANOX)
-
-AC_ARG_ENABLE(gtk2,        [  --disable-gtk2          use GTK+ 1.2 instead of 2.0], [wxUSE_GTK2="$enableval"])
 WX_ARG_ENABLE(gpe,         [  --enable-gpe            use GNOME PDA Environment features if possible], wxUSE_GPE)
 
 dnl check that no more than one toolkit is given and that if none are given that
@@ -512,7 +526,7 @@ if test "$wxUSE_GUI" = "yes"; then
         fi
       done
     else
-      dnl try to guess the most apropriate toolkit for this platform
+      dnl try to guess the most appropriate toolkit for this platform
       for toolkit in $ALL_TOOLKITS; do
         var=DEFAULT_DEFAULT_wxUSE_$toolkit
         eval "wxUSE_$toolkit=\$${var}"
@@ -521,8 +535,8 @@ if test "$wxUSE_GUI" = "yes"; then
 
     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_COCOA:-0} + ${wxUSE_GTK:-0} + ${wxUSE_OSX_CARBON:-0} \
-                  + ${wxUSE_OSX_COCOA:-0} + ${wxUSE_MGL:-0} + ${wxUSE_DFB:-0} \
+    NUM_TOOLKITS=`expr ${wxUSE_OLD_COCOA:-0} + ${wxUSE_GTK:-0} + ${wxUSE_OSX_CARBON:-0} \
+                  + ${wxUSE_OSX_COCOA:-0} + ${wxUSE_OSX_IPHONE:-0} + ${wxUSE_DFB:-0} \
                   + ${wxUSE_MICROWIN:-0} + ${wxUSE_MOTIF:-0} + ${wxUSE_MSW:-0} + ${wxUSE_X11:-0}`
 
     dnl Allow wxUSE_PM only for OS/2 with EMX.
@@ -541,13 +555,6 @@ if test "$wxUSE_GUI" = "yes"; then
         AC_MSG_ERROR(Please specify at most one toolkit)
     esac
 
-    # to be removed when --disable-gtk2 isn't needed
-    if test "x$wxUSE_GTK2" = "xyes"; then
-        wxGTK_VERSION=2
-    elif test "x$wxUSE_GTK2" = "xno"; then
-        wxGTK_VERSION=1
-    fi
-
     for toolkit in $ALL_TOOLKITS; do
         var=wxUSE_$toolkit
         eval "value=\$${var}"
@@ -565,7 +572,9 @@ else
 fi
 
 wxUSE_MAC=0
-if test "$wxUSE_OSX_CARBON" = 1 -o "$wxUSE_OSX_COCOA" = 1; then
+if test "$wxUSE_OSX_CARBON" = 1 \
+       -o "$wxUSE_OSX_COCOA" = 1 \
+       -o "$wxUSE_OSX_IPHONE" = 1; then
     wxUSE_MAC=1
 fi
 
@@ -582,7 +591,8 @@ WX_ARG_WITH(libmspack,     [  --with-libmspack        use libmspack (CHM help fi
 WX_ARG_WITHOUT(gtkprint,   [  --without-gtkprint      don't use GTK printing support], wxUSE_GTKPRINT)
 WX_ARG_WITHOUT(gnomeprint, [  --without-gnomeprint    don't use GNOME printing libraries], wxUSE_LIBGNOMEPRINT)
 WX_ARG_WITH(gnomevfs,      [  --with-gnomevfs         use GNOME VFS for associating MIME types], wxUSE_LIBGNOMEVFS)
-WX_ARG_WITH(hildon,        [  --with-hildon           use Hildon framework for Nokia 770], wxUSE_LIBHILDON)
+WX_ARG_WITH(libnotify,     [  --with-libnotify        use libnotify for notifications], wxUSE_LIBNOTIFY)
+WX_ARG_WITH(hildon,        [  --with-hildon           use Hildon framework for Nokia 770/800/810], wxUSE_LIBHILDON)
 WX_ARG_WITH(opengl,        [  --with-opengl           use OpenGL (or Mesa)], wxUSE_OPENGL)
 
 fi
@@ -608,15 +618,83 @@ AC_ARG_WITH(macosx-version-min,    [  --with-macosx-version-min=VER   build bina
     ])
 AC_MSG_RESULT([$wxUSE_MACOSX_VERSION_MIN])
 
+dnl ---------------------------------------------------------------------------
+dnl debugging options
+dnl ---------------------------------------------------------------------------
+
+dnl don't use WX_ARG_ENABLE as it just gets in the way instead of helping with
+dnl this rather unusual option
+AC_MSG_CHECKING([for --enable-debug])
+AC_ARG_ENABLE(debug,       [  --enable-debug          build library for debugging],
+    [
+        if test "$enableval" = yes; then
+            wxUSE_DEBUG=yes
+        elif test "$enableval" = no; then
+            wxUSE_DEBUG=no
+        elif test "$enableval" = max; then
+            wxUSE_DEBUG=yes
+            WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS -DwxDEBUG_LEVEL=2"
+        else
+            AC_MSG_ERROR([Invalid --enable-debug value, must be yes, no or max])
+        fi
+    ],
+    wxUSE_DEBUG=default
+)
+AC_MSG_RESULT([${enable_debug-default}])
+
+case "$wxUSE_DEBUG" in
+    yes)
+        dnl build the library for debugging: enable debugging code and generate
+        dnl the debug information for the library itself
+        DEFAULT_wxUSE_DEBUG_FLAG=yes
+        DEFAULT_wxUSE_DEBUG_INFO=yes
+
+        dnl also disable optimizations by default if --enable-debug was used
+        dnl (this can still be overridden by an explicit --enable-optimise)
+        DEFAULT_wxUSE_OPTIMISE=no
+        ;;
+
+    no)
+        dnl --disable-debug is equivalent to both --disable-debug_flag and
+        dnl --disable-debug_info
+        DEFAULT_wxUSE_DEBUG_FLAG=no
+        DEFAULT_wxUSE_DEBUG_INFO=no
+        ;;
+
+    default)
+        dnl the library is built with debugging support by default but without
+        dnl debug information as this requires much, much more disk space
+        DEFAULT_wxUSE_DEBUG_FLAG=yes
+        DEFAULT_wxUSE_DEBUG_INFO=no
+        ;;
+esac
+
+WX_ARG_DISABLE(debug_flag,   [  --disable-debug_flag    disable all debugging support], wxUSE_DEBUG_FLAG)
+WX_ARG_ENABLE(debug_info,    [  --enable-debug_info     generate debug information], wxUSE_DEBUG_INFO)
+
+dnl enabled if just --enable-debug_{flag,info} was
+dnl
+dnl in any case, only set the default value and allow overriding it with an
+
+WX_ARG_ENABLE(debug_gdb,     [  --enable-debug_gdb      create code with extra GDB debugging information], wxUSE_DEBUG_GDB)
+WX_ARG_ENABLE(debug_cntxt,   [  --enable-debug_cntxt    obsolete, don't use: use wxDebugContext], wxUSE_DEBUG_CONTEXT)
+WX_ARG_ENABLE(mem_tracing,   [  --enable-mem_tracing    obsolete, don't use: create code with memory tracing], wxUSE_MEM_TRACING)
+
 dnl ---------------------------------------------------------------------------
 dnl global compile options
 dnl ---------------------------------------------------------------------------
 
 WX_ARG_DISABLE(shared,     [  --disable-shared        create static library instead of shared], wxUSE_SHARED)
-WX_ARG_ENABLE(debug,       [  --enable-debug          same as debug_flag and debug_info], wxUSE_DEBUG)
-WX_ARG_ENABLE(stl,         [  --enable-stl            use STL for containers], wxUSE_STL)
+WX_ARG_ENABLE(stl,         [  --enable-stl            use standard C++ classes for everything], wxUSE_STL)
+if test "$wxUSE_STL" = "yes"; then
+    DEFAULT_wxUSE_STD_CONTAINERS=yes
+    DEFAULT_wxUSE_STD_IOSTREAM=yes
+    DEFAULT_wxUSE_STD_STRING=yes
+fi
+WX_ARG_ENABLE(std_containers,[  --enable-std_containers use standard C++ container classes], wxUSE_STD_CONTAINERS)
 WX_ARG_ENABLE(std_iostreams, [  --enable-std_iostreams  use standard C++ stream classes], wxUSE_STD_IOSTREAM)
 WX_ARG_ENABLE(std_string,    [  --enable-std_string     use standard C++ string classes], wxUSE_STD_STRING)
+WX_ARG_ENABLE(std_string_conv_in_wxstring, [ --enable-std_string_conv_in_wxstring     provide implicit conversion to std::string in wxString], wxUSE_STD_STRING_CONV_IN_WXSTRING)
 WX_ARG_DISABLE(unicode,      [  --disable-unicode       compile without Unicode support], wxUSE_UNICODE)
 WX_ARG_ENABLE(mslu,          [  --enable-mslu           use MS Layer for Unicode on Windows 9x (Win32 only)], wxUSE_UNICODE_MSLU)
 WX_ARG_ENABLE_PARAM(utf8,    [  --enable-utf8           use UTF-8 representation for strings (Unix only)], wxUSE_UNICODE_UTF8)
@@ -627,49 +705,17 @@ if test "$USE_OS2" = 1; then
     WX_ARG_ENABLE(omf,     [  --enable-omf            use OMF object format], wxUSE_OMF)
 fi
 
-dnl --enablle-debug is equivalent to both --enable-debug_flag and
-dnl --enable-debug_info
-if test "$wxUSE_DEBUG" = "yes"; then
-    DEFAULT_wxUSE_DEBUG_FLAG=yes
-    DEFAULT_wxUSE_DEBUG_INFO=yes
-    BUILD=debug
-elif test "$wxUSE_DEBUG" = "no"; then
-    DEFAULT_wxUSE_DEBUG_FLAG=no
-    DEFAULT_wxUSE_DEBUG_INFO=no
-    BUILD=release
-fi
-
-WX_ARG_ENABLE(debug_flag,    [  --enable-debug_flag     set __WXDEBUG__ flag (recommended for developers!)], wxUSE_DEBUG_FLAG)
-WX_ARG_ENABLE(debug_info,    [  --enable-debug_info     create code with debugging information], wxUSE_DEBUG_INFO)
-
-dnl it's important to also do it in the other direction to get the correct
-dnl output in the configure summary (which uses wxUSE_DEBUG)
-if test "$wxUSE_DEBUG_FLAG" = "yes" -a "$wxUSE_DEBUG_INFO" = "yes"; then
-    wxUSE_DEBUG=yes
-    BUILD=debug
-fi
-
-dnl disable optimizations by default if --enable-debug was used but leave them
-dnl enabled if just --enable-debug_{flag,info} was
-dnl
-dnl in any case, only set the default value and allow overriding it with an
-dnl explicit --enable-optimise
-if test "$wxUSE_DEBUG" = "yes"; then
-    DEFAULT_wxUSE_OPTIMISE=no
-fi
-
 WX_ARG_DISABLE(optimise,   [  --disable-optimise      compile without optimisations], wxUSE_OPTIMISE)
 
-WX_ARG_ENABLE(debug_gdb,     [  --enable-debug_gdb      create code with extra GDB debugging information], wxUSE_DEBUG_GDB)
-WX_ARG_ENABLE(debug_cntxt,   [  --enable-debug_cntxt    use wxDebugContext], wxUSE_DEBUG_CONTEXT)
-WX_ARG_ENABLE(mem_tracing,   [  --enable-mem_tracing    create code with memory tracing], wxUSE_MEM_TRACING)
 WX_ARG_ENABLE(profile,       [  --enable-profile        create code with profiling information], wxUSE_PROFILE)
 WX_ARG_ENABLE(no_rtti,       [  --enable-no_rtti        create code without RTTI information], wxUSE_NO_RTTI)
 WX_ARG_ENABLE(no_exceptions, [  --enable-no_exceptions  create code without C++ exceptions handling], wxUSE_NO_EXCEPTIONS)
 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_DISABLE(vararg_macros,[  --disable-vararg_macros don't use vararg macros, even if they are supported], wxUSE_VARARG_MACROS)
-WX_ARG_ENABLE_PARAM(universal_binary, [[  --enable-universal_binary  create Mac PowerPC and Intel Universal binary]], wxUSE_UNIVERSAL_BINARY)
+
+WX_ARG_ENABLE_PARAM(universal_binary, [[  --enable-universal_binary=archs create universal binary for the specified (or all supported) architectures]], wxUSE_UNIVERSAL_BINARY)
+WX_ARG_ENABLE_PARAM(macosx_arch,      [[  --enable-macosx_arch=ARCH  build for just the specified architecture]], wxUSE_MAC_ARCH)
 
 WX_ARG_ENABLE(compat26,      [  --enable-compat26       enable wxWidgets 2.6 compatibility], WXWIN_COMPATIBILITY_2_6)
 WX_ARG_DISABLE(compat28,     [  --disable-compat28      disable wxWidgets 2.8 compatibility], WXWIN_COMPATIBILITY_2_8)
@@ -679,6 +725,7 @@ WX_ARG_DISABLE(rpath,        [  --disable-rpath         disable use of rpath for
 WX_ARG_ENABLE(objc_uniquifying,[  --enable-objc_uniquifying enable Objective-C class name uniquifying], wxUSE_OBJC_UNIQUIFYING)
 
 WX_ARG_DISABLE(visibility,   [  --disable-visibility    disable use of ELF symbols visibility even if supported], wxUSE_VISIBILITY)
+WX_ARG_DISABLE(tls,          [  --disable-tls           disable use of compiler TLS support], wxUSE_COMPILER_TLS)
 
 dnl ---------------------------------------------------------------------------
 dnl optional non GUI features
@@ -704,6 +751,7 @@ WX_ARG_FEATURE(epollloop,     [  --enable-epollloop      use wxEpollDispatcher c
 WX_ARG_FEATURE(selectloop,    [  --enable-selectloop     use wxSelectDispatcher class], wxUSE_SELECT_DISPATCHER)
 
 dnl please keep the settings below in alphabetical order
+WX_ARG_FEATURE(any,           [  --enable-any            use wxAny class], wxUSE_ANY)
 WX_ARG_FEATURE(apple_ieee,    [  --enable-apple_ieee     use the Apple IEEE codec], wxUSE_APPLE_IEEE)
 WX_ARG_FEATURE(arcstream,     [  --enable-arcstream      use wxArchive streams], wxUSE_ARCHIVE_STREAMS)
 WX_ARG_FEATURE(base64,        [  --enable-base64         use base64 encoding/decoding functions], wxUSE_BASE64)
@@ -718,12 +766,15 @@ WX_ARG_FEATURE(dynamicloader, [  --enable-dynamicloader  use (new) wxDynamicLibr
 WX_ARG_FEATURE(exceptions,    [  --enable-exceptions     build exception-safe library], wxUSE_EXCEPTIONS)
 WX_ARG_FEATURE(ffile,         [  --enable-ffile          use wxFFile class], wxUSE_FFILE)
 WX_ARG_FEATURE(file,          [  --enable-file           use wxFile class], wxUSE_FILE)
+WX_ARG_FEATURE(filehistory,   [  --enable-filehistory    use wxFileHistory class], wxUSE_FILE_HISTORY)
 WX_ARG_FEATURE(filesystem,    [  --enable-filesystem     use virtual file systems classes], wxUSE_FILESYSTEM)
 WX_ARG_FEATURE(fontenum,      [  --enable-fontenum       use wxFontEnumerator class], wxUSE_FONTENUM)
 WX_ARG_FEATURE(fontmap,       [  --enable-fontmap        use font encodings conversion classes], wxUSE_FONTMAP)
 WX_ARG_FEATURE(fs_archive,    [  --enable-fs_archive     use virtual archive filesystems], wxUSE_FS_ARCHIVE)
 WX_ARG_FEATURE(fs_inet,       [  --enable-fs_inet        use virtual HTTP/FTP filesystems], wxUSE_FS_INET)
 WX_ARG_FEATURE(fs_zip,        [  --enable-fs_zip         now replaced by fs_archive], wxUSE_FS_ZIP)
+WX_ARG_FEATURE(fsvolume,      [  --enable-fsvolume       use wxFSVolume class], wxUSE_FSVOLUME)
+WX_ARG_FEATURE(fswatcher,     [  --enable-fswatcher      use wxFileSystemWatcher class], wxUSE_FSWATCHER)
 WX_ARG_FEATURE(geometry,      [  --enable-geometry       use geometry class], wxUSE_GEOMETRY)
 WX_ARG_FEATURE(log,           [  --enable-log            use logging system], wxUSE_LOG)
 WX_ARG_FEATURE(longlong,      [  --enable-longlong       use wxLongLong class], wxUSE_LONGLONG)
@@ -734,7 +785,7 @@ WX_ARG_FEATURE(sound,         [  --enable-sound          use wxSound class], wxU
 WX_ARG_FEATURE(stdpaths,      [  --enable-stdpaths       use wxStandardPaths class], wxUSE_STDPATHS)
 WX_ARG_FEATURE(stopwatch,     [  --enable-stopwatch      use wxStopWatch class], wxUSE_STOPWATCH)
 WX_ARG_FEATURE(streams,       [  --enable-streams        use wxStream etc classes], wxUSE_STREAMS)
-WX_ARG_FEATURE(system_options,[  --enable-sysoptions     use wxSystemOptions], wxUSE_SYSTEM_OPTIONS)
+WX_ARG_FEATURE(sysoptions,    [  --enable-sysoptions     use wxSystemOptions], wxUSE_SYSTEM_OPTIONS)
 WX_ARG_FEATURE(tarstream,     [  --enable-tarstream      use wxTar streams], wxUSE_TARSTREAM)
 WX_ARG_FEATURE(textbuf,       [  --enable-textbuf        use wxTextBuffer class], wxUSE_TEXTBUFFER)
 WX_ARG_FEATURE(textfile,      [  --enable-textfile       use wxTextFile class], wxUSE_TEXTFILE)
@@ -768,6 +819,7 @@ WX_ARG_FEATURE(htmlhelp,    [  --enable-htmlhelp       use wxHTML-based help], w
 WX_ARG_FEATURE(xrc,         [  --enable-xrc            use XRC resources sub-library], wxUSE_XRC)
 WX_ARG_FEATURE(aui,         [  --enable-aui            use AUI docking library], wxUSE_AUI)
 WX_ARG_FEATURE(propgrid,    [  --enable-propgrid       use wxPropertyGrid library], wxUSE_PROPGRID)
+WX_ARG_FEATURE(ribbon,      [  --enable-ribbon         use wxRibbon library], wxUSE_RIBBON)
 WX_ARG_FEATURE(stc,         [  --enable-stc            use wxStyledTextCtrl library], wxUSE_STC)
 WX_ARG_FEATURE(constraints, [  --enable-constraints    use layout-constraints system], wxUSE_CONSTRAINTS)
 WX_ARG_FEATURE(loggui,      [  --enable-loggui         use standard GUI logger], wxUSE_LOGGUI)
@@ -777,12 +829,18 @@ WX_ARG_FEATURE(mdi,         [  --enable-mdi            use multiple document int
 WX_ARG_FEATURE(mdidoc,      [  --enable-mdidoc         use docview architecture with MDI], wxUSE_MDI_ARCHITECTURE)
 WX_ARG_FEATURE(mediactrl,   [  --enable-mediactrl      use wxMediaCtrl class], wxUSE_MEDIACTRL)
 WX_ARG_FEATURE(gstreamer8,  [  --enable-gstreamer8     force GStreamer 0.8 instead of 0.10 with the wxMediaCtrl class on unix], wxUSE_GSTREAMER8)
-WX_ARG_FEATURE(webkit,      [  --enable-webkit         use wxWebKitCtrl (Mac)], wxUSE_WEBKIT)
 WX_ARG_FEATURE(richtext,    [  --enable-richtext       use wxRichTextCtrl], wxUSE_RICHTEXT)
-WX_ARG_FEATURE(graphics_ctx,[  --enable-graphics_ctx   use graphics context 2D drawing API], wxUSE_GRAPHICS_CONTEXT)
 WX_ARG_FEATURE(postscript,  [  --enable-postscript     use wxPostscriptDC device context (default for gtk+)], wxUSE_POSTSCRIPT)
 WX_ARG_FEATURE(printarch,   [  --enable-printarch      use printing architecture], wxUSE_PRINTING_ARCHITECTURE)
 WX_ARG_FEATURE(svg,         [  --enable-svg            use wxSVGFileDC device context], wxUSE_SVG)
+WX_ARG_FEATURE(webkit,      [  --enable-webkit         use wxWebKitCtrl (Mac-only, use wxWebView instead)], wxUSE_WEBKIT)
+WX_ARG_FEATURE(webview,     [  --enable-webview        use wxWebView library], wxUSE_WEBVIEW)
+
+dnl wxDC is implemented in terms of wxGraphicsContext in wxOSX so the latter
+dnl can't be disabled, don't even provide an option to do it
+if test "$wxUSE_MAC" != 1; then
+WX_ARG_FEATURE(graphics_ctx,[  --enable-graphics_ctx   use graphics context 2D drawing API], wxUSE_GRAPHICS_CONTEXT)
+fi
 
 dnl ---------------------------------------------------------------------------
 dnl IPC &c
@@ -790,7 +848,6 @@ dnl ---------------------------------------------------------------------------
 
 WX_ARG_FEATURE(clipboard,   [  --enable-clipboard      use wxClipboard class], wxUSE_CLIPBOARD)
 WX_ARG_FEATURE(dnd,         [  --enable-dnd            use Drag'n'Drop classes], wxUSE_DRAG_AND_DROP)
-WX_ARG_FEATURE(metafile,    [  --enable-metafile       use win32 metafiles], wxUSE_METAFILE)
 
 dnl ---------------------------------------------------------------------------
 dnl optional GUI controls (in alphabetical order except the first one)
@@ -800,124 +857,85 @@ dnl don't set DEFAULT_wxUSE_XXX below if the option is not specified
 DEFAULT_wxUSE_CONTROLS=none
 WX_ARG_DISABLE(controls,    [  --disable-controls      disable compilation of all standard controls], wxUSE_CONTROLS)
 
-dnl even with --enable-controls, some may be disabled by giving
-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_ANIMATIONCTRL=yes
-  DEFAULT_wxUSE_BMPBUTTON=yes
-  DEFAULT_wxUSE_BUTTON=yes
-  DEFAULT_wxUSE_CALCTRL=yes
-  DEFAULT_wxUSE_CARET=yes
-  DEFAULT_wxUSE_COMBOBOX=yes
-  DEFAULT_wxUSE_CHECKBOX=yes
-  DEFAULT_wxUSE_CHECKLISTBOX=yes
-  DEFAULT_wxUSE_CHOICE=yes
-  DEFAULT_wxUSE_CHOICEBOOK=yes
-  DEFAULT_wxUSE_COLLPANE=yes
-  DEFAULT_wxUSE_COLOURPICKERCTRL=yes
-  DEFAULT_wxUSE_COMBOBOX=yes
-  DEFAULT_wxUSE_DATEPICKCTRL=yes
-  DEFAULT_wxUSE_DISPLAY=yes
-  DEFAULT_wxUSE_DETECT_SM=yes
-  DEFAULT_wxUSE_DIRPICKERCTRL=yes
-  DEFAULT_wxUSE_FILECTRL=yes
-  DEFAULT_wxUSE_FILEPICKERCTRL=yes
-  DEFAULT_wxUSE_FONTPICKERCTRL=yes
-  DEFAULT_wxUSE_GAUGE=yes
-  DEFAULT_wxUSE_GRID=yes
-  DEFAULT_wxUSE_HYPERLINKCTRL=yes
-  DEFAULT_wxUSE_DATAVIEWCTRL=yes
-  DEFAULT_wxUSE_IMAGLIST=yes
-  DEFAULT_wxUSE_LISTBOOK=yes
-  DEFAULT_wxUSE_LISTBOX=yes
-  DEFAULT_wxUSE_LISTCTRL=yes
-  DEFAULT_wxUSE_NOTEBOOK=yes
-  DEFAULT_wxUSE_RADIOBOX=yes
-  DEFAULT_wxUSE_RADIOBTN=yes
-  DEFAULT_wxUSE_SASH=yes
-  DEFAULT_wxUSE_SCROLLBAR=yes
-  DEFAULT_wxUSE_SEARCHCTRL=yes
-  DEFAULT_wxUSE_SLIDER=yes
-  DEFAULT_wxUSE_SPINBTN=yes
-  DEFAULT_wxUSE_SPINCTRL=yes
-  DEFAULT_wxUSE_SPLITTER=yes
-  DEFAULT_wxUSE_STATBMP=yes
-  DEFAULT_wxUSE_STATBOX=yes
-  DEFAULT_wxUSE_STATLINE=yes
-  DEFAULT_wxUSE_STATUSBAR=yes
-  DEFAULT_wxUSE_TAB_DIALOG=yes
-  DEFAULT_wxUSE_TOGGLEBTN=yes
-  DEFAULT_wxUSE_TOOLBAR=yes
-  DEFAULT_wxUSE_TOOLBAR_NATIVE=yes
-  DEFAULT_wxUSE_TOOLTIPS=yes
-  DEFAULT_wxUSE_TREEBOOK=yes
-  DEFAULT_wxUSE_TOOLBOOK=yes
-  DEFAULT_wxUSE_TREECTRL=yes
-  DEFAULT_wxUSE_POPUPWIN=yes
-  DEFAULT_wxUSE_TIPWINDOW=yes
-elif test "$wxUSE_CONTROLS" = "no"; then
-  DEFAULT_wxUSE_ACCEL=no
-  DEFAULT_wxUSE_ANIMATIONCTRL=no
-  DEFAULT_wxUSE_BMPBUTTON=no
-  DEFAULT_wxUSE_BUTTON=no
-  DEFAULT_wxUSE_CALCTRL=no
-  DEFAULT_wxUSE_CARET=no
-  DEFAULT_wxUSE_COLLPANE=no
-  DEFAULT_wxUSE_COMBOBOX=no
-  DEFAULT_wxUSE_CHECKBOX=no
-  DEFAULT_wxUSE_CHECKLISTBOX=no
-  DEFAULT_wxUSE_CHOICE=no
-  DEFAULT_wxUSE_CHOICEBOOK=no
-  DEFAULT_wxUSE_COLOURPICKERCTRL=no
-  DEFAULT_wxUSE_COMBOBOX=no
-  DEFAULT_wxUSE_DATEPICKCTRL=no
-  DEFAULT_wxUSE_DISPLAY=no
-  DEFAULT_wxUSE_DETECT_SM=no
-  DEFAULT_wxUSE_DIRPICKERCTRL=no
-  DEFAULT_wxUSE_FILECTRL=no
-  DEFAULT_wxUSE_FILEPICKERCTRL=no
-  DEFAULT_wxUSE_FONTPICKERCTRL=no
-  DEFAULT_wxUSE_GAUGE=no
-  DEFAULT_wxUSE_GRID=no
-  DEFAULT_wxUSE_HYPERLINKCTRL=no
-  DEFAULT_wxUSE_DATAVIEWCTRL=no
-  DEFAULT_wxUSE_IMAGLIST=no
-  DEFAULT_wxUSE_LISTBOOK=no
-  DEFAULT_wxUSE_LISTBOX=no
-  DEFAULT_wxUSE_LISTCTRL=no
-  DEFAULT_wxUSE_NOTEBOOK=no
-  DEFAULT_wxUSE_RADIOBOX=no
-  DEFAULT_wxUSE_RADIOBTN=no
-  DEFAULT_wxUSE_SASH=no
-  DEFAULT_wxUSE_SCROLLBAR=no
-  DEFAULT_wxUSE_SEARCHCTRL=no
-  DEFAULT_wxUSE_SLIDER=no
-  DEFAULT_wxUSE_SPINBTN=no
-  DEFAULT_wxUSE_SPINCTRL=no
-  DEFAULT_wxUSE_SPLITTER=no
-  DEFAULT_wxUSE_STATBMP=no
-  DEFAULT_wxUSE_STATBOX=no
-  DEFAULT_wxUSE_STATLINE=no
-  DEFAULT_wxUSE_STATUSBAR=no
-  DEFAULT_wxUSE_TAB_DIALOG=no
-  DEFAULT_wxUSE_TOGGLEBTN=no
-  DEFAULT_wxUSE_TOOLBAR=no
-  DEFAULT_wxUSE_TOOLBAR_NATIVE=no
-  DEFAULT_wxUSE_TOOLTIPS=no
-  DEFAULT_wxUSE_TREEBOOK=no
-  DEFAULT_wxUSE_TOOLBOOK=no
-  DEFAULT_wxUSE_TREECTRL=no
-  DEFAULT_wxUSE_POPUPWIN=no
-  DEFAULT_wxUSE_TIPWINDOW=no
-fi
+dnl even with --disable-controls, some may be enabled by an explicit
+dnl --enable-<control> later on the command line -- but by default all will be
+dnl disabled
+if test "$wxUSE_CONTROLS" = "no"; then
+    DEFAULT_wxUSE_ACCEL=no
+    DEFAULT_wxUSE_ANIMATIONCTRL=no
+    DEFAULT_wxUSE_BANNERWINDOW=no
+    DEFAULT_wxUSE_BMPBUTTON=no
+    DEFAULT_wxUSE_BUTTON=no
+    DEFAULT_wxUSE_CALCTRL=no
+    DEFAULT_wxUSE_CARET=no
+    DEFAULT_wxUSE_CHECKBOX=no
+    DEFAULT_wxUSE_CHECKLISTBOX=no
+    DEFAULT_wxUSE_CHOICE=no
+    DEFAULT_wxUSE_CHOICEBOOK=no
+    DEFAULT_wxUSE_COLLPANE=no
+    DEFAULT_wxUSE_COLOURPICKERCTRL=no
+    DEFAULT_wxUSE_COMBOBOX=no
+    DEFAULT_wxUSE_COMBOBOX=no
+    DEFAULT_wxUSE_COMMANDLINKBUTTON=no
+    DEFAULT_wxUSE_DATAVIEWCTRL=no
+    DEFAULT_wxUSE_DATEPICKCTRL=no
+    DEFAULT_wxUSE_DETECT_SM=no
+    DEFAULT_wxUSE_DIRPICKERCTRL=no
+    DEFAULT_wxUSE_DISPLAY=no
+    DEFAULT_wxUSE_FILECTRL=no
+    DEFAULT_wxUSE_FILEPICKERCTRL=no
+    DEFAULT_wxUSE_FONTPICKERCTRL=no
+    DEFAULT_wxUSE_GAUGE=no
+    DEFAULT_wxUSE_GRID=no
+    DEFAULT_wxUSE_HEADERCTRL=no
+    DEFAULT_wxUSE_HYPERLINKCTRL=no
+    DEFAULT_wxUSE_IMAGLIST=no
+    DEFAULT_wxUSE_LISTBOOK=no
+    DEFAULT_wxUSE_LISTBOX=no
+    DEFAULT_wxUSE_LISTCTRL=no
+    DEFAULT_wxUSE_MARKUP=no
+    DEFAULT_wxUSE_NOTEBOOK=no
+    DEFAULT_wxUSE_POPUPWIN=no
+    DEFAULT_wxUSE_RADIOBOX=no
+    DEFAULT_wxUSE_RADIOBTN=no
+    DEFAULT_wxUSE_RICHMSGDLG=no
+    DEFAULT_wxUSE_RICHTOOLTIP=no
+    DEFAULT_wxUSE_REARRANGECTRL=no
+    DEFAULT_wxUSE_SASH=no
+    DEFAULT_wxUSE_SCROLLBAR=no
+    DEFAULT_wxUSE_SEARCHCTRL=no
+    DEFAULT_wxUSE_SLIDER=no
+    DEFAULT_wxUSE_SPINBTN=no
+    DEFAULT_wxUSE_SPINCTRL=no
+    DEFAULT_wxUSE_SPLITTER=no
+    DEFAULT_wxUSE_STATBMP=no
+    DEFAULT_wxUSE_STATBOX=no
+    DEFAULT_wxUSE_STATLINE=no
+    DEFAULT_wxUSE_STATUSBAR=no
+    DEFAULT_wxUSE_TIMEPICKCTRL=no
+    DEFAULT_wxUSE_TIPWINDOW=no
+    DEFAULT_wxUSE_TOGGLEBTN=no
+    DEFAULT_wxUSE_TOOLBAR=no
+    DEFAULT_wxUSE_TOOLBAR_NATIVE=no
+    DEFAULT_wxUSE_TOOLBOOK=no
+    DEFAULT_wxUSE_TOOLTIPS=no
+    DEFAULT_wxUSE_TREEBOOK=no
+    DEFAULT_wxUSE_TREECTRL=no
+    DEFAULT_wxUSE_TREELISTCTRL=no
+fi
+
+dnl features affecting multiple controls
+WX_ARG_FEATURE(markup,      [  --enable-markup         support wxControl::SetLabelMarkup], wxUSE_MARKUP)
 
+dnl please keep the settings below in alphabetical order
 WX_ARG_FEATURE(accel,       [  --enable-accel          use accelerators], wxUSE_ACCEL)
 WX_ARG_FEATURE(animatectrl, [  --enable-animatectrl    use wxAnimationCtrl class], wxUSE_ANIMATIONCTRL)
-WX_ARG_FEATURE(button,      [  --enable-button         use wxButton class], wxUSE_BUTTON)
+WX_ARG_FEATURE(bannerwindow,[  --enable-bannerwindow   use wxBannerWindow class], wxUSE_BANNERWINDOW)
+WX_ARG_FEATURE(artstd,      [  --enable-artstd         use standard XPM icons in wxArtProvider], wxUSE_ARTPROVIDER_STD)
+WX_ARG_FEATURE(arttango,    [  --enable-arttango       use Tango icons in wxArtProvider], wxUSE_ARTPROVIDER_TANGO)
 WX_ARG_FEATURE(bmpbutton,   [  --enable-bmpbutton      use wxBitmapButton class], wxUSE_BMPBUTTON)
 WX_ARG_FEATURE(bmpcombobox, [  --enable-bmpcombobox    use wxBitmapComboBox class], wxUSE_BITMAPCOMBOBOX)
+WX_ARG_FEATURE(button,      [  --enable-button         use wxButton class], wxUSE_BUTTON)
 WX_ARG_FEATURE(calendar,    [  --enable-calendar       use wxCalendarCtrl class], wxUSE_CALCTRL)
 WX_ARG_FEATURE(caret,       [  --enable-caret          use wxCaret class], wxUSE_CARET)
 WX_ARG_FEATURE(checkbox,    [  --enable-checkbox       use wxCheckBox class], wxUSE_CHECKBOX)
@@ -928,27 +946,34 @@ WX_ARG_FEATURE(collpane,    [  --enable-collpane       use wxCollapsiblePane cla
 WX_ARG_FEATURE(colourpicker,[  --enable-colourpicker   use wxColourPickerCtrl class], wxUSE_COLOURPICKERCTRL)
 WX_ARG_FEATURE(combobox,    [  --enable-combobox       use wxComboBox class], wxUSE_COMBOBOX)
 WX_ARG_FEATURE(comboctrl,   [  --enable-comboctrl      use wxComboCtrl class], wxUSE_COMBOCTRL)
+WX_ARG_FEATURE(commandlinkbutton, [  --enable-commandlinkbutton      use wxCommmandLinkButton class], wxUSE_COMMANDLINKBUTTON)
+WX_ARG_FEATURE(dataviewctrl,[  --enable-dataviewctrl   use wxDataViewCtrl class], wxUSE_DATAVIEWCTRL)
 WX_ARG_FEATURE(datepick,    [  --enable-datepick       use wxDatePickerCtrl class], wxUSE_DATEPICKCTRL)
+WX_ARG_FEATURE(detect_sm,   [  --enable-detect_sm      use code to detect X11 session manager], wxUSE_DETECT_SM)
 WX_ARG_FEATURE(dirpicker,   [  --enable-dirpicker      use wxDirPickerCtrl class], wxUSE_DIRPICKERCTRL)
 WX_ARG_FEATURE(display,     [  --enable-display        use wxDisplay class], wxUSE_DISPLAY)
-WX_ARG_FEATURE(detect_sm,   [  --enable-detect_sm      use code to detect X11 session manager], wxUSE_DETECT_SM)
 WX_ARG_FEATURE(editablebox, [  --enable-editablebox    use wxEditableListBox class], wxUSE_EDITABLELISTBOX)
-WX_ARG_FEATURE(filepicker,  [  --enable-filepicker     use wxFilePickerCtrl class], wxUSE_FILEPICKERCTRL)
 WX_ARG_FEATURE(filectrl,    [  --enable-filectrl       use wxFileCtrl class], wxUSE_FILECTRL)
+WX_ARG_FEATURE(filepicker,  [  --enable-filepicker     use wxFilePickerCtrl class], wxUSE_FILEPICKERCTRL)
 WX_ARG_FEATURE(fontpicker,  [  --enable-fontpicker     use wxFontPickerCtrl class], wxUSE_FONTPICKERCTRL)
 WX_ARG_FEATURE(gauge,       [  --enable-gauge          use wxGauge class], wxUSE_GAUGE)
 WX_ARG_FEATURE(grid,        [  --enable-grid           use wxGrid class], wxUSE_GRID)
-WX_ARG_FEATURE(dataviewctrl,[  --enable-dataviewctrl   use wxDataViewCtrl class], wxUSE_DATAVIEWCTRL)
+WX_ARG_FEATURE(headerctrl,  [  --enable-headerctrl     use wxHeaderCtrl class], wxUSE_HEADERCTRL)
 WX_ARG_FEATURE(hyperlink,   [  --enable-hyperlink      use wxHyperlinkCtrl class], wxUSE_HYPERLINKCTRL)
 WX_ARG_FEATURE(imaglist,    [  --enable-imaglist       use wxImageList class], wxUSE_IMAGLIST)
+WX_ARG_FEATURE(infobar,     [  --enable-infobar        use wxInfoBar class], wxUSE_INFOBAR)
 WX_ARG_FEATURE(listbook,    [  --enable-listbook       use wxListbook class], wxUSE_LISTBOOK)
 WX_ARG_FEATURE(listbox,     [  --enable-listbox        use wxListBox class], wxUSE_LISTBOX)
 WX_ARG_FEATURE(listctrl,    [  --enable-listctrl       use wxListCtrl class], wxUSE_LISTCTRL)
 WX_ARG_FEATURE(notebook,    [  --enable-notebook       use wxNotebook class], wxUSE_NOTEBOOK)
 WX_ARG_FEATURE(notifmsg,    [  --enable-notifmsg       use wxNotificationMessage class], wxUSE_NOTIFICATION_MESSAGE)
 WX_ARG_FEATURE(odcombobox,  [  --enable-odcombobox     use wxOwnerDrawnComboBox class], wxUSE_ODCOMBOBOX)
+WX_ARG_FEATURE(popupwin,    [  --enable-popupwin       use wxPopUpWindow class], wxUSE_POPUPWIN)
 WX_ARG_FEATURE(radiobox,    [  --enable-radiobox       use wxRadioBox class], wxUSE_RADIOBOX)
 WX_ARG_FEATURE(radiobtn,    [  --enable-radiobtn       use wxRadioButton class], wxUSE_RADIOBTN)
+WX_ARG_FEATURE(richmsgdlg,  [  --enable-richmsgdlg     use wxRichMessageDialog class], wxUSE_RICHMSGDLG)
+WX_ARG_FEATURE(richtooltip, [  --enable-richtooltip    use wxRichToolTip class], wxUSE_RICHTOOLTIP)
+WX_ARG_FEATURE(rearrangectrl,[  --enable-rearrangectrl  use wxRearrangeList/Ctrl/Dialog], wxUSE_REARRANGECTRL)
 WX_ARG_FEATURE(sash,        [  --enable-sash           use wxSashWindow class], wxUSE_SASH)
 WX_ARG_FEATURE(scrollbar,   [  --enable-scrollbar      use wxScrollBar class and scrollable windows], wxUSE_SCROLLBAR)
 WX_ARG_FEATURE(searchctrl,  [  --enable-searchctrl     use wxSearchCtrl class], wxUSE_SEARCHCTRL)
@@ -961,17 +986,17 @@ WX_ARG_FEATURE(statbox,     [  --enable-statbox        use wxStaticBox class], w
 WX_ARG_FEATURE(statline,    [  --enable-statline       use wxStaticLine class], wxUSE_STATLINE)
 WX_ARG_FEATURE(stattext,    [  --enable-stattext       use wxStaticText class], wxUSE_STATTEXT)
 WX_ARG_FEATURE(statusbar,   [  --enable-statusbar      use wxStatusBar class], wxUSE_STATUSBAR)
-WX_ARG_FEATURE(tabdialog,   [  --enable-tabdialog      use wxTabControl class], wxUSE_TAB_DIALOG)
 WX_ARG_FEATURE(taskbaricon, [  --enable-taskbaricon    use wxTaskBarIcon class], wxUSE_TASKBARICON)
+WX_ARG_FEATURE(tbarnative,  [  --enable-tbarnative     use native wxToolBar class], wxUSE_TOOLBAR_NATIVE)
 WX_ARG_FEATURE(textctrl,    [  --enable-textctrl       use wxTextCtrl class], wxUSE_TEXTCTRL)
+WX_ARG_FEATURE(datepick,    [  --enable-timepick       use wxTimePickerCtrl class], wxUSE_TIMEPICKCTRL)
+WX_ARG_FEATURE(tipwindow,   [  --enable-tipwindow      use wxTipWindow class], wxUSE_TIPWINDOW)
 WX_ARG_FEATURE(togglebtn,   [  --enable-togglebtn      use wxToggleButton class], wxUSE_TOGGLEBTN)
 WX_ARG_FEATURE(toolbar,     [  --enable-toolbar        use wxToolBar class], wxUSE_TOOLBAR)
-WX_ARG_FEATURE(tbarnative,  [  --enable-tbarnative     use native wxToolBar class], wxUSE_TOOLBAR_NATIVE)
-WX_ARG_FEATURE(treebook,    [  --enable-treebook       use wxTreebook class], wxUSE_TREEBOOK)
 WX_ARG_FEATURE(toolbook,    [  --enable-toolbook       use wxToolbook class], wxUSE_TOOLBOOK)
+WX_ARG_FEATURE(treebook,    [  --enable-treebook       use wxTreebook class], wxUSE_TREEBOOK)
 WX_ARG_FEATURE(treectrl,    [  --enable-treectrl       use wxTreeCtrl class], wxUSE_TREECTRL)
-WX_ARG_FEATURE(tipwindow,   [  --enable-tipwindow      use wxTipWindow class], wxUSE_TIPWINDOW)
-WX_ARG_FEATURE(popupwin,    [  --enable-popupwin       use wxPopUpWindow class], wxUSE_POPUPWIN)
+WX_ARG_FEATURE(treelist,    [  --enable-treelist       use wxTreeListCtrl class], wxUSE_TREELISTCTRL)
 
 dnl ---------------------------------------------------------------------------
 dnl common dialogs
@@ -1004,10 +1029,14 @@ WX_ARG_FEATURE(splines,     [  --enable-splines        use spline drawing code],
 WX_ARG_FEATURE(mousewheel,  [  --enable-mousewheel     use mousewheel], wxUSE_MOUSEWHEEL)
 WX_ARG_FEATURE(validators,  [  --enable-validators     use wxValidator and derived classes], wxUSE_VALIDATORS)
 WX_ARG_FEATURE(busyinfo,    [  --enable-busyinfo       use wxBusyInfo], wxUSE_BUSYINFO)
+WX_ARG_FEATURE(hotkey,      [  --enable-hotkey         use wxWindow::RegisterHotKey()], wxUSE_HOTKEY)
 WX_ARG_FEATURE(joystick,    [  --enable-joystick       use wxJoystick], wxUSE_JOYSTICK)
-WX_ARG_FEATURE(metafile,    [  --enable-metafiles      use wxMetaFile (Win32 only)], wxUSE_METAFILE)
+WX_ARG_FEATURE(metafile,    [  --enable-metafiles      use wxMetaFile], wxUSE_METAFILE)
 WX_ARG_FEATURE(dragimage,   [  --enable-dragimage      use wxDragImage], wxUSE_DRAGIMAGE)
 WX_ARG_FEATURE(accessibility,[  --enable-accessibility  enable accessibility support], wxUSE_ACCESSIBILITY)
+WX_ARG_FEATURE(uiactionsim,  [  --enable-uiactionsim    use wxUIActionSimulator (experimental)], wxUSE_UIACTIONSIMULATOR)
+WX_ARG_FEATURE(dctransform,  [  --enable-dctransform    use wxDC::SetTransformMatrix and related], wxUSE_DC_TRANSFORM_MATRIX)
+WX_ARG_FEATURE(webviewwebkit,[  --enable-webviewwebkit  use wxWebView WebKit backend], wxUSE_WEBVIEW_WEBKIT)
 
 dnl ---------------------------------------------------------------------------
 dnl support for image formats that do not rely on external library
@@ -1032,6 +1061,7 @@ WX_ARG_FEATURE(ps-in-msw,   [  --enable-ps-in-msw      use PS printing in wxMSW
 WX_ARG_FEATURE(ownerdrawn,  [  --enable-ownerdrawn     use owner drawn controls (Win32 and OS/2 only)], wxUSE_OWNER_DRAWN)
 WX_ARG_FEATURE(uxtheme,     [  --enable-uxtheme        enable support for Windows XP themed look (Win32 only)], wxUSE_UXTHEME)
 WX_ARG_FEATURE(wxdib,       [  --enable-wxdib          use wxDIB class (Win32 only)], wxUSE_DIB)
+WX_ARG_FEATURE(webviewie,   [  --enable-webviewie      use wxWebView IE backend (Win32 only)], wxUSE_WEBVIEW_IE)
 
 dnl this one is not really MSW-specific but it exists mainly to be turned off
 dnl under MSW, it should be off by default on the other platforms
@@ -1059,7 +1089,7 @@ dnl   defines CFLAGS
 dnl
 dnl this magic incantation is needed to prevent AC_PROG_CC from setting the
 dnl default CFLAGS (something like "-g -O2") -- we don't need this as we add
-dnl -g and -O flags ourselves below
+dnl (if not already present in C*FLAGS) the -g and -O flags ourselves below
 CFLAGS=${CFLAGS:=}
 AC_BAKEFILE_PROG_CC
 
@@ -1095,58 +1125,62 @@ if test "x$SUNCXX" != xyes; then
     fi
 fi
 
+dnl ---------------------------------------------------------------------------
+dnl Mac-specific SDK/architectures checks
+dnl ---------------------------------------------------------------------------
+
+if test "$wxUSE_MAC" = 1; then
+
 retest_macosx_linking=no
 
-dnl Support the old --enable-universal_binary in case anyone was using it.
-#if test "$wxUSE_MAC" = 1; then
-    if test "x$wxUSE_UNIVERSAL_BINARY" != xno ; then
-        dnl --enable-universal_binary uses a default SDK (currently 10.4u)
-        dnl --enable-universal_binary=SDK names a path to an SDK
-        if test "x$wxUSE_UNIVERSAL_BINARY" == xyes; then
-            # Implicitly turn on the new --with-macosx-sdk using the default
-            # SDK which provides the behavior this option has always had.
-            if test "x$wxUSE_MACOSX_SDK" = "x"; then
-                AC_MSG_WARN([Enabling default SDK due to --enable-universal_binary.])
-                AC_MSG_WARN([If you don't want this, specify --without-macosx-sdk])
-                wxUSE_MACOSX_SDK=yes
-            fi
-        else
-            # Complain to user if he specified an argument to --enable-universal_binary
-            # and also 1) specified --with-macosx-sdk using the default (yes) or
-            # 2) specified --with-macosx-sdk using a path or 3) specified
-            # --without-macosx-sdk (no).
-            if test "x$wxUSE_MACOSX_SDK" != "x" ; then
-                AC_MSG_FAILURE([Please specify the new --with-macosx-sdk=PATH and do not specify an arg to --enable-universal_binary])
-            else
-                # Put the SDK path into the wxUSE_MACOSX_SDK.  We don't have to
-                # special-case the empty string because the below test simply
-                # converts "no" to the empty string anyway.
-                wxUSE_MACOSX_SDK="$wxUSE_UNIVERSAL_BINARY"
-                dnl Warn about deprecated usage.
-                AC_MSG_WARN([Please use --with-macosx-sdk=PATH and --enable-universal_binary without an argument])
-            fi
+OSX_ARCH_OPTS=""
+
+dnl Deal with architecture selection. By default, we compile for the current
+dnl architecture, whatever it is. With --enable-universal_binary the list of
+dnl architectures can be explicitly specified. If it isn't, we compile for all
+dnl supported ones.
+if test "x$wxUSE_UNIVERSAL_BINARY" != xno ; then
+    if test "x$wxUSE_MAC_ARCH" != xno; then
+        AC_MSG_WARN([--enable-macosx_arch is ignored when --enable-universal_binary is used.])
+    fi
+
+    if test "x$wxUSE_UNIVERSAL_BINARY" != xyes; then
+        OSX_ARCH_OPTS=$wxUSE_UNIVERSAL_BINARY
+    else dnl Use all architectures supported
+        OSX_ARCH_OPTS="ppc,i386"
+        if test "$wxUSE_OSX_COCOA" = 1; then
+            OSX_ARCH_OPTS="$OSX_ARCH_OPTS,x86_64"
         fi
-        dnl FIXME: I think it would be better to put this into CC, CXX, and LD rather than the flags.
-        OSX_UNIV_OPTS="-arch ppc -arch i386"
-        CXXFLAGS="$OSX_UNIV_OPTS $CXXFLAGS"
-        CFLAGS="$OSX_UNIV_OPTS $CFLAGS"
-        OBJCXXFLAGS="$OSX_UNIV_OPTS $OBJCXXFLAGS"
-        OBJCFLAGS="$OSX_UNIV_OPTS $OBJCFLAGS"
-        LDFLAGS="$OSX_UNIV_OPTS $LDFLAGS"
-        dnl NOTE: Only the compiler driver needs arch flags.  The link editor
-        dnl is incapable of using them but the compiler driver (which we use
-        dnl as LD when building dynamic libraries) uses them to invoke the
-        dnl real ld multiple times.  If we moved to libtool -dynamic we would
-        dnl need no arch flags because libtool automatically invokes ld for
-        dnl every architecture found in the fat input files.
-        dnl
-        dnl For static library builds, AR/RANLIB automatically create proper
-        dnl fat archives although AR is unable to update them once RANLIB has
-        dnl made them into proper fat archives.  Fortunately, our link process
-        dnl simply removes the .a file before using ar to create a new one.
-        dnl If we did move to libtool -static we still wouldn't need arch flags
-        dnl because libtool automatically figures it out based on input.
-        retest_macosx_linking=yes
+    fi
+
+    AC_MSG_CHECKING([for architectures to use in universal binary])
+    AC_MSG_RESULT([$OSX_ARCH_OPTS])
+
+    dnl NOTE: Only the compiler driver needs arch flags.  The link editor
+    dnl is incapable of using them but the compiler driver (which we use
+    dnl as LD when building dynamic libraries) uses them to invoke the
+    dnl real ld multiple times.  If we moved to libtool -dynamic we would
+    dnl need no arch flags because libtool automatically invokes ld for
+    dnl every architecture found in the fat input files.
+    dnl
+    dnl For static library builds, AR/RANLIB automatically create proper
+    dnl fat archives although AR is unable to update them once RANLIB has
+    dnl made them into proper fat archives.  Fortunately, our link process
+    dnl simply removes the .a file before using ar to create a new one.
+    dnl If we did move to libtool -static we still wouldn't need arch flags
+    dnl because libtool automatically figures it out based on input.
+    retest_macosx_linking=yes
+else
+    if test "x$wxUSE_MAC_ARCH" != xno; then
+        OSX_ARCH_OPTS=$wxUSE_MAC_ARCH
+    fi
+fi
+
+if test "x$OSX_ARCH_OPTS" != "x"; then
+    dnl Check if there is more than one architecture
+    if echo $OSX_ARCH_OPTS | grep -q ","; then
+        AC_MSG_WARN([Disabling dependency tracking due to universal binary build.])
+        disable_macosx_deps=yes
 
         dnl HACK: PCH could be made to work by precompiling for each architecture into separate directories
         dnl and including all architecture directories with each compiler invocation.
@@ -1155,7 +1189,15 @@ dnl Support the old --enable-universal_binary in case anyone was using it.
         AC_MSG_WARN([Disabling precompiled headers due to universal binary build.])
         bk_use_pch=no
     fi
-#fi
+
+    OSX_ARCH_OPTS=`echo $OSX_ARCH_OPTS | sed -e 's/^/-arch /' -e 's/,/ -arch /g'`
+
+    CXXFLAGS="$OSX_ARCH_OPTS $CXXFLAGS"
+    CFLAGS="$OSX_ARCH_OPTS $CFLAGS"
+    OBJCXXFLAGS="$OSX_ARCH_OPTS $OBJCXXFLAGS"
+    OBJCFLAGS="$OSX_ARCH_OPTS $OBJCFLAGS"
+    LDFLAGS="$OSX_ARCH_OPTS $LDFLAGS"
+fi
 
 dnl Set up the Mac OS X SDK.  We do this early so configure tests will occur
 dnl with the SDK in place.
@@ -1175,10 +1217,8 @@ if test "x$wxUSE_MACOSX_SDK" != "x"; then
     else
         AC_MSG_RESULT([exists])
     fi
+    dnl CC and CXX will have these flags added below, after the compiler has been chosen
     MACOSX_SDK_OPTS="-isysroot $wxUSE_MACOSX_SDK"
-    eval "CC=\"$CC $MACOSX_SDK_OPTS\""
-    eval "CXX=\"$CXX $MACOSX_SDK_OPTS\""
-    eval "LD=\"$LD $MACOSX_SDK_OPTS\""
     retest_macosx_linking=yes
     dnl NOTE: When libtool is used in lieu of AR/RANLIB (i.e. in static mode)
     dnl the syslibroot makes no difference.  We aren't using libtool now but
@@ -1216,14 +1256,22 @@ dnl We need to quote the next line where we don't need macros and do need [] in
         wxUSE_MACOSX_VERSION_MIN=
     fi
 elif test "x$wxUSE_MACOSX_VERSION_MIN" = "x"; then
-    if test "$wxUSE_MAC" = 1; then
-        # otherwise configure stops on leopard for universal_binary
-        wxUSE_MACOSX_VERSION_MIN=10.4
-    fi
+    wxUSE_MACOSX_VERSION_MIN=10.5
+fi
+
+if test "x$MACOSX_SDK_OPTS" != "x"; then 
+    eval "CC=\"$CC $MACOSX_SDK_OPTS\""
+    eval "CXX=\"$CXX $MACOSX_SDK_OPTS\""
+    eval "LD=\"$LD $MACOSX_SDK_OPTS\""
+    retest_macosx_linking=yes
 fi
 
 if test "x$wxUSE_MACOSX_VERSION_MIN" != "x"; then
-    MACOSX_VERSION_MIN_OPTS="-mmacosx-version-min=$wxUSE_MACOSX_VERSION_MIN"
+    if test "$wxUSE_OSX_IPHONE" = 1; then
+        MACOSX_VERSION_MIN_OPTS="-miphoneos-version-min=$wxUSE_MACOSX_VERSION_MIN"
+    else
+        MACOSX_VERSION_MIN_OPTS="-mmacosx-version-min=$wxUSE_MACOSX_VERSION_MIN"
+    fi
     eval "CC=\"$CC $MACOSX_VERSION_MIN_OPTS\""
     eval "CXX=\"$CXX $MACOSX_VERSION_MIN_OPTS\""
     eval "LD=\"$LD $MACOSX_VERSION_MIN_OPTS\""
@@ -1235,16 +1283,17 @@ dnl still compile and link both C and C++.  If we didn't do this, then most
 dnl of the remaining tests would fail.
 if test "x$retest_macosx_linking" = "xyes"; then
     AC_LANG_PUSH(C)
-    AC_MSG_CHECKING([if C compiler works with SDK/version options])
+    AC_MSG_CHECKING([if C compiler ($CC) works with SDK/version options])
     AC_TRY_LINK([],[],[AC_MSG_RESULT([yes])],[AC_MSG_FAILURE([no.  Try a different SDK]); exit 1])
     AC_LANG_POP()
 
     AC_LANG_PUSH(C++)
-    AC_MSG_CHECKING([if C++ compiler works with SDK/version options])
+    AC_MSG_CHECKING([if C++ compiler ($CXX) works with SDK/version options])
     AC_TRY_LINK([],[],[AC_MSG_RESULT([yes])],[AC_MSG_FAILURE([no.  Try a different SDK]); exit 1])
     AC_LANG_POP()
 fi
 
+fi dnl wxUSE_MAC
 
 case "${host}" in
 
@@ -1263,10 +1312,34 @@ dnl ------------------------------------------------------------------------
 dnl Platform specific tests
 dnl ------------------------------------------------------------------------
 
-dnl xlC needs -qunique under AIX so that one source file can be
-dnl compiled to multiple object files and safely linked together.
-if test "x$XLCXX" = "xyes" -a "x$USE_AIX" = "x1"; then
-    CXXFLAGS="-qunique $CXXFLAGS"
+if test "$USE_LINUX" = 1 -o "$USE_GNU" = 1; then
+    dnl While g++ predefines _GNU_SOURCE by default, gcc does not, so do it
+    dnl explicitly to ensure that the tests done below using C compiler
+    dnl succeed, otherwise things like pthread_mutexattr_settype() (and many
+    dnl others) wouldn't be detected.
+    AC_DEFINE(_GNU_SOURCE)
+
+    dnl For non-g++ compilers (including gcc, as mentioned above) we need to
+    dnl add this flag explicitly when building our own code later too.
+    GNU_SOURCE_FLAG="-D_GNU_SOURCE"
+    CFLAGS="$GNU_SOURCE_FLAG $CFLAGS"
+fi
+
+if test "x$USE_AIX" = "x1"; then
+    dnl xlC needs -qunique under AIX so that one source file can be
+    dnl compiled to multiple object files and safely linked together.
+    if test "x$XLCXX" = "xyes"; then
+        CXXFLAGS="-qunique $CXXFLAGS"
+    fi
+
+    dnl AIX sys/timer.h header #defines func_data as t_union.data breaking the
+    dnl compilation of GTK+ headers that use func_data as parameter name in
+    dnl several places. We could work around this by inserting "#undef
+    dnl func_data" in the code but IBM provides a possibility to disable this
+    dnl #define by pre-defining the symbol below and this seems to be simpler.
+    dnl And if we have any problems because of it we can always remove it and
+    dnl use the #undef approach.
+    CPPFLAGS="-D_LINUX_SOURCE_COMPAT $CPPFLAGS"
 fi
 
 dnl This case is for PowerPC OS X vs. everything else
@@ -1353,7 +1426,7 @@ if test "$wxUSE_WINE" = "yes"; then
     LDFLAGS_GUI="-mwindows"
 fi
 
-dnl NB: The two tests bellow are *NOT* mutually exclusive! They should only
+dnl NB: The two tests below are *NOT* mutually exclusive! They should only
 dnl     take effect on Cygwin/Mingw and not other platforms.
 if test "$wants_win32" = 1 ; then
     USE_UNIX=0
@@ -1519,9 +1592,15 @@ case "${host}" in
   ;;
 esac
 
-dnl POSIX needs this for select(), but old systems don't have it
 if test "$USE_UNIX" = 1 ; then
+    dnl POSIX needs this for select(), but old systems don't have it
     AC_CHECK_HEADERS([sys/select.h],,, [AC_INCLUDES_DEFAULT()])
+
+    dnl Header defining C++ ABI is currently only available with g++ but test
+    dnl for it unconditionally in case it becomes supported by other compilers.
+    AC_LANG_PUSH(C++)
+    AC_CHECK_HEADERS([cxxabi.h],,, [AC_INCLUDES_DEFAULT()])
+    AC_LANG_POP()
 fi
 
 dnl ---------------------------------------------------------------------------
@@ -1577,11 +1656,10 @@ AC_CHECK_SIZEOF(wchar_t, 0,
         #include <stdio.h>
     ]
 )
-if test "$ac_cv_sizeof_wchar_t" != 0; then
-    wxUSE_WCHAR_T=yes
-else
-    wxUSE_WCHAR_T=no
+if test "$ac_cv_sizeof_wchar_t" = 0; then
+    AC_MSG_ERROR([wxWidgets requires wchar_t support.])
 fi
+AC_DEFINE(wxUSE_WCHAR_T)
 
 dnl checks needed to define wxVaCopy
 AC_CACHE_CHECK([for va_copy],
@@ -1589,20 +1667,22 @@ AC_CACHE_CHECK([for va_copy],
     [
         AC_LANG_PUSH(C++)
         AC_LINK_IFELSE([
-            #include <stdarg.h>
-            void foo(char *f, ...)
-            {
-                va_list ap1, ap2;
-                va_start(ap1, f);
-                va_copy(ap2, ap1);
-                va_end(ap2);
-                va_end(ap1);
-            }
-            int main()
-            {
-                foo("hi", 17);
-                return 0;
-            }],
+            AC_LANG_SOURCE([
+                #include <stdarg.h>
+                void foo(char *f, ...)
+                {
+                    va_list ap1, ap2;
+                    va_start(ap1, f);
+                    va_copy(ap2, ap1);
+                    va_end(ap2);
+                    va_end(ap1);
+                }
+                int main()
+                {
+                    foo("hi", 17);
+                    return 0;
+                }])
+            ],
             wx_cv_func_va_copy=yes,
             wx_cv_func_va_copy=no
         )
@@ -1618,22 +1698,24 @@ else
         wx_cv_type_va_list_lvalue,
         [
             AC_RUN_IFELSE([
-                #include <stdarg.h>
-                int foo(char *f, ...)
-                {
-                    va_list ap1, ap2;
-                    va_start(ap1, f);
-                    ap2 = ap1;
-                    if ( va_arg(ap1, int) != 17 || va_arg(ap2, int) != 17 )
-                        return 1;
-                    va_end(ap2);
-                    va_end(ap1);
-                    return 0;
-                }
-                int main()
-                {
-                    return foo("hi", 17);
-                }],
+                AC_LANG_SOURCE([
+                    #include <stdarg.h>
+                    int foo(char *f, ...)
+                    {
+                        va_list ap1, ap2;
+                        va_start(ap1, f);
+                        ap2 = ap1;
+                        if ( va_arg(ap1, int) != 17 || va_arg(ap2, int) != 17 )
+                            return 1;
+                        va_end(ap2);
+                        va_end(ap1);
+                        return 0;
+                    }
+                    int main()
+                    {
+                        return foo("hi", 17);
+                    }])
+                ],
                 wx_cv_type_va_list_lvalue=yes,
                 wx_cv_type_va_list_lvalue=no,
                 dnl assume most common case for cross-compiling...
@@ -1662,7 +1744,7 @@ AC_CACHE_CHECK(
         dnl C compiler might support variadic macros when C++ one doesn't
         dnl (happens with gcc/g++ 2.95.4), so must use C++ one explicitly
         AC_LANG_PUSH(C++)
-        AC_COMPILE_IFELSE(
+        AC_COMPILE_IFELSE([
             AC_LANG_PROGRAM(
                 [
                     #include <stdio.h>
@@ -1671,7 +1753,7 @@ AC_CACHE_CHECK(
                 [
                     test("%s %d %p", "test", 1, 0);
                 ]
-            ),
+            )],
             [wx_cv_have_variadic_macros=yes],
             [wx_cv_have_variadic_macros=no]
             )
@@ -1761,7 +1843,7 @@ WX_CPP_EXPLICIT
 dnl With Sun CC, temporaries have block scope by default. This flag is needed
 dnl to get the expression scope behaviour that conforms to the standard.
 if test "x$SUNCXX" = xyes; then
-    CXXFLAGS="-features=tmplife $CXXFLAGS"
+    CXXFLAGS="-features=tmplife $GNU_SOURCE_FLAG $CXXFLAGS"
 fi
 
 dnl Sun X11 headers are (still, in 2005!) non-ANSI and the best they could do
@@ -1772,18 +1854,57 @@ if test "x$SUNCC" = xyes; then
     CFLAGS="-erroff=E_NO_EXPLICIT_TYPE_GIVEN $CFLAGS"
 fi
 
-dnl SGI mipsPro compiler gives this warning for "conversion from pointer to
-dnl same-sized integral type" even when there is an explicit cast and as there
-dnl is no way to turn it off and there are hundreds of these warnings in wx
-dnl sources, just turn it off for now
+dnl SGI mipsPro compiler version 7.4.4 and later (and maybe some earlier
+dnl versions too but it's known that 7.4.2 doesn't give this warning but does
+dnl instead warn about "unknown warning number 3970" which explains that we
+dnl don't want to do this for it) gives this warning for "conversion from
+dnl pointer to same-sized integral type" even when there is an explicit cast
+dnl and as there is no way to turn it off and there are hundreds of these
+dnl warnings in wx sources, just turn it off for now
 dnl
 dnl a better long term solution would be to use #pragma set/reset woff in
 dnl wxPtrToUInt() and use it instead of casts elsewhere
 if test "x$SGICC" = "xyes"; then
-    CFLAGS="-woff 3970 $CFLAGS"
+    AC_CACHE_CHECK([if cc version is 7.4.4 or greater],
+        wx_cv_prog_sgicc744,
+        [
+            AC_TRY_COMPILE([],
+                [
+                    #if _SGI_COMPILER_VERSION >= 744
+                    chock me: mipsPro is 7.4.4 or later
+                    #endif
+                ],
+                wx_cv_prog_sgicc744=no,
+                wx_cv_prog_sgicc744=yes
+            )
+        ]
+    )
+
+    if test "x$wx_cv_prog_sgicc744" = "xyes"; then
+        CFLAGS="-woff 3970 $CFLAGS"
+    fi
 fi
 if test "x$SGICXX" = "xyes"; then
-    CXXFLAGS="-woff 3970 $CXXFLAGS"
+    AC_CACHE_CHECK([if CC version is 7.4.4 or greater],
+        wx_cv_prog_sgicxx744,
+        [
+            AC_LANG_PUSH(C++)
+            AC_TRY_COMPILE([],
+                [
+                    #if _SGI_COMPILER_VERSION >= 744
+                    chock me: mipsPro is 7.4.4 or later
+                    #endif
+                ],
+                wx_cv_prog_sgicxx744=no,
+                wx_cv_prog_sgicxx744=yes
+            )
+            AC_LANG_POP()
+        ]
+    )
+
+    if test "x$wx_cv_prog_sgicxx744" = "xyes"; then
+        CXXFLAGS="-woff 3970 $CXXFLAGS"
+    fi
 fi
 
 dnl HP-UX c89/aCC compiler warnings
@@ -1797,7 +1918,11 @@ fi
 if test "x$HPCXX" = "xyes"; then
     dnl 2340: "value copied to temporary, reference to temporary used": very
     dnl       painful as triggered by any occurrence of user-defined conversion
-    CXXFLAGS="+W 2340 $CXXFLAGS"
+    dnl 4232: "conversion from 'Foo *' to a more strictly aligned type 'Bar *'
+    dnl       may cause misaligned access": this might indicate a real problem
+    dnl       but any use of GTK+ cast macros results in it so it's unusable
+    dnl       for wxGTK code
+    CXXFLAGS="+W 2340,4232 $CXXFLAGS"
 fi
 
 dnl DEC/Compaq/HP cxx warnings
@@ -2025,6 +2150,8 @@ if test "$wxUSE_STL" = "yes"; then
     fi
 fi
 
+AC_CHECK_HEADERS([type_traits tr1/type_traits])
+
 dnl check for atomic operations builtins for wx/atomic.h:
 WX_ATOMIC_BUILTINS
 
@@ -2049,7 +2176,9 @@ SEARCH_INCLUDE="\
     /usr/local/include        \
     /usr/local/X11/include    \
     /usr/local/include/X11    \
+    /usr/local/X11R7/include  \
     /usr/local/X11R6/include  \
+    /usr/local/include/X11R7  \
     /usr/local/include/X11R6  \
                               \
     /usr/Motif-2.1/include    \
@@ -2061,9 +2190,11 @@ SEARCH_INCLUDE="\
                               \
     /usr/include/Xm           \
                               \
+    /usr/X11R7/include        \
     /usr/X11R6/include        \
     /usr/X11R6.4/include      \
                               \
+    /usr/include/X11R7        \
     /usr/include/X11R6        \
                               \
     /usr/X11/include          \
@@ -2086,7 +2217,7 @@ SEARCH_INCLUDE="\
 
 dnl try to find out the standard lib locations for the systems with multiple
 dnl ABIs
-AC_MSG_CHECKING([for libraries directory])
+AC_MSG_CHECKING([for libraries directories])
 
 case "${host}" in
     *-*-irix6* )
@@ -2099,7 +2230,9 @@ case "${host}" in
                         if test -f $libc; then
                             save_LIBS="$LIBS"
                             LIBS="$libc"
-                            AC_LINK_IFELSE([int main() { return 0; }],
+                            AC_LINK_IFELSE([
+                                    AC_LANG_SOURCE([int main() { return 0; }])
+                                ],
                                 wx_cv_std_libpath=`echo $d | sed s@/usr/@@`)
                             LIBS="$save_LIBS"
                             if test "x$wx_cv_std_libpath" != "x"; then
@@ -2108,9 +2241,6 @@ case "${host}" in
                         fi
                     done
                 done
-                if test "x$wx_cv_std_libpath" = "x"; then
-                    wx_cv_std_libpath="lib"
-                fi
             ]
         )
         ;;
@@ -2119,29 +2249,50 @@ case "${host}" in
         dnl use ../lib or ../lib/64 depending on the size of void*
         if test "$ac_cv_sizeof_void_p" = 8 -a -d "/usr/lib/64"; then
             wx_cv_std_libpath="lib/64"
-        else
-            wx_cv_std_libpath="lib"
         fi
         ;;
 
     *-*-linux* )
-        dnl use ../lib or ../lib64 depending on the size of void*
-        if test "$ac_cv_sizeof_void_p" = 8 -a \
-                -d "/usr/lib64" -a ! -h "/usr/lib64"; then
-            wx_cv_std_libpath="lib64"
+        dnl Recent Debian versions (as of 2011) use new approach to multiarch
+        dnl and put the libraries under /usr/lib/arch-linux-gnu. Annoyingly,
+        dnl "arch" here is not `uname -m` because it is "i386" even when uname
+        dnl returns e.g. "i686". So we need to test for it explicitly.
+        if test "$ac_cv_sizeof_void_p" = 8; then
+            if test -d "/usr/lib/`uname -m`-linux-gnu"; then
+                wx_cv_std_libfullpath="/usr/lib/`uname -m`-linux-gnu"
+            elif test -d "/usr/lib64" -a ! -h "/usr/lib64"; then
+                wx_cv_std_libpath="lib64"
+            fi
         else
-            wx_cv_std_libpath="lib"
+            case "${host}" in
+                i*86-*-linux* )
+                    if test -d '/usr/lib/i386-linux-gnu'; then
+                        wx_cv_std_libfullpath='/usr/lib/i386-linux-gnu'
+                    fi
+            esac
         fi
-        ;;
 
-    *)
-        wx_cv_std_libpath="lib";
+        dnl And on top of all this, some packages haven't been updated for
+        dnl full multiarch support yet so we still need to look in /usr/lib
+        dnl too as well.
+        if test -n "$wx_cv_std_libfullpath" -a -d "/usr/lib"; then
+            wx_cv_std_libfullpath="$wx_cv_std_libfullpath /usr/lib"
+        fi
         ;;
 esac
 
-AC_MSG_RESULT($wx_cv_std_libpath)
+if test -z "$wx_cv_std_libpath"; then
+    wx_cv_std_libpath="lib"
+fi
 
-SEARCH_LIB="`echo "$SEARCH_INCLUDE" | sed s@include@$wx_cv_std_libpath@g` /usr/$wx_cv_std_libpath"
+if test -z "$wx_cv_std_libfullpath"; then
+    wx_cv_std_libfullpath="/usr/$wx_cv_std_libpath"
+fi
+
+
+AC_MSG_RESULT($wx_cv_std_libfullpath)
+
+SEARCH_LIB="`echo "$SEARCH_INCLUDE" | sed s@include@$wx_cv_std_libpath@g` $wx_cv_std_libfullpath"
 
 dnl Cross compiling with gcc?
 if test "$build" != "$host" -a "$GCC" = yes; then
@@ -2173,7 +2324,7 @@ if test "$build" != "$host" -a "$GCC" = yes; then
             x_includes=$ac_find_includes
         fi
         if test -z "$x_libraries" -o "$x_libraries" = NONE; then
-            WX_PATH_FIND_LIBRARIES($SEARCH_LIB, Xt)
+            WX_PATH_FIND_LIBRARIES(Xt)
             x_libraries=$ac_find_libraries
         fi
     fi
@@ -2186,45 +2337,6 @@ dnl ------------------------------------------------------------------------
 dnl flush the cache because checking for libraries below might abort
 AC_CACHE_SAVE
 
-dnl check for glibc version
-dnl
-dnl VZ: I have no idea why had this check been there originally, but now
-dnl     we could probably do without it by just always adding _GNU_SOURCE
-if test "$USE_LINUX" = 1 -o "$USE_GNU" = 1; then
-    AC_CACHE_CHECK([for glibc 2.1 or later], wx_cv_lib_glibc21,[
-        AC_TRY_COMPILE([#include <features.h>],
-            [
-                #if (__GLIBC__ < 2) || (__GLIBC_MINOR__ < 1)
-                not glibc 2.1
-                #endif
-            ],
-            [
-                wx_cv_lib_glibc21=yes
-            ],
-            [
-                wx_cv_lib_glibc21=no
-            ]
-        )
-    ])
-    if test "$wx_cv_lib_glibc21" = "yes"; then
-        AC_DEFINE(wxHAVE_GLIBC2)
-    fi
-fi
-
-dnl we may need _GNU_SOURCE for 2 things:
-dnl
-dnl  1. to get PTHREAD_MUTEX_RECURSIVE with glibc 2.1+ (strictly speaking we
-dnl  only need _XOPEN_SOURCE=500 but just defining this disables _BSD_SOURCE
-dnl  which breaks libtiff compilation, so it is simpler to just define
-dnl  _GNU_SOURCE to get everything)
-dnl
-dnl  2. for Unicode functions
-if test "x$wx_cv_lib_glibc21" = "xyes"; then
-    if test "$wxUSE_UNICODE" = "yes" -o "$wxUSE_THREADS" = "yes"; then
-        AC_DEFINE(_GNU_SOURCE)
-    fi
-fi
-
 dnl Only add the -lm library if floating point functions cannot be used
 dnl without it.  This check is important on cygwin because of the bizarre
 dnl way that they have organized functions into libraries.  On cygwin, both
@@ -2413,63 +2525,54 @@ PNG_LINK=
 if test "$wxUSE_LIBPNG" != "no" ; then
     AC_DEFINE(wxUSE_LIBPNG)
 
-    if test "$wxUSE_MGL" = 1 -a "$wxUSE_LIBPNG" = "builtin" ; then
-        AC_MSG_WARN([wxMGL doesn't work with builtin png library, will use MGL one instead])
-        wxUSE_LIBPNG=sys
-    fi
-
     dnl for the check below to have a chance to succeed, we must already have
-    dnl libz somewhere (don't do this when bulding wxMGL since its libpng
-    dnl doesn't depend on zlib)
-    if test "$wxUSE_MGL" != 1 -a "$wxUSE_LIBPNG" = "sys" -a "$wxUSE_ZLIB" != "sys" ; then
+    dnl libz somewhere
+    if test "$wxUSE_LIBPNG" = "sys" -a "$wxUSE_ZLIB" != "sys" ; then
         AC_MSG_WARN([system png library doesn't work without system zlib, will use built-in instead])
         wxUSE_LIBPNG=builtin
     fi
 
-    if test "$wxUSE_MGL" != 1 ; then
-        dnl Don't check for libpng when building wxMGL, libmgl contains it
-        if test "$wxUSE_LIBPNG" = "sys" -o "$wxUSE_LIBPNG" = "yes" ; then
-            dnl libpng version 0.9 is known to not work, if an even newer
-            dnl version is required, just bump it up in the test below
-            AC_CACHE_CHECK([for png.h > 0.90], ac_cv_header_png_h,
-                [AC_TRY_RUN(
-                    dnl png.h defines PNG_LIBPNG_VER=number
-                    [
-                        #include <png.h>
-                        #include <stdio.h>
+    if test "$wxUSE_LIBPNG" = "sys" -o "$wxUSE_LIBPNG" = "yes" ; then
+        dnl libpng version 0.9 is known to not work, if an even newer
+        dnl version is required, just bump it up in the test below
+        AC_CACHE_CHECK([for png.h > 0.90], ac_cv_header_png_h,
+            [AC_TRY_RUN(
+                dnl png.h defines PNG_LIBPNG_VER=number
+                [
+                    #include <png.h>
+                    #include <stdio.h>
 
-                        int main()
-                        {
-                            FILE *f=fopen("conftestval", "w");
-                            if (!f) exit(1);
-                            fprintf(f, "%s",
-                                     PNG_LIBPNG_VER > 90 ? "yes" : "no");
-                            exit(0);
-                        }
-                    ],
-                    ac_cv_header_png_h=`cat conftestval`,
-                    ac_cv_header_png_h=no,
-                    dnl cross-compiling: test (later) if we have any png.h
-                    unset ac_cv_header_png_h
-                )]
-            )
-            AC_CHECK_HEADER(png.h,,, [ ])
+                    int main()
+                    {
+                        FILE *f=fopen("conftestval", "w");
+                        if (!f) exit(1);
+                        fprintf(f, "%s",
+                                 PNG_LIBPNG_VER > 90 ? "yes" : "no");
+                        exit(0);
+                    }
+                ],
+                ac_cv_header_png_h=`cat conftestval`,
+                ac_cv_header_png_h=no,
+                dnl cross-compiling: test (later) if we have any png.h
+                unset ac_cv_header_png_h
+            )]
+        )
+        AC_CHECK_HEADER(png.h,,, [ ])
 
-            if test "$ac_cv_header_png_h" = "yes"; then
-                AC_CHECK_LIB(png, png_check_sig, PNG_LINK=" -lpng -lz", , [-lz -lm])
-            fi
+        if test "$ac_cv_header_png_h" = "yes"; then
+            AC_CHECK_LIB(png, png_sig_cmp, PNG_LINK=" -lpng -lz", , [-lz -lm])
+        fi
 
-            if test "x$PNG_LINK" = "x" ; then
-                if test "$wxUSE_LIBPNG" = "sys" ; then
-                    AC_MSG_ERROR([system png library not found or too old! Use --with-libpng=builtin to use built-in version])
-                else
-                    AC_MSG_WARN([system png library not found or too old, will use built-in instead])
-                    wxUSE_LIBPNG=builtin
-                fi
+        if test "x$PNG_LINK" = "x" ; then
+            if test "$wxUSE_LIBPNG" = "sys" ; then
+                AC_MSG_ERROR([system png library not found or too old! Use --with-libpng=builtin to use built-in version])
             else
-                dnl we are using the system library
-                wxUSE_LIBPNG=sys
+                AC_MSG_WARN([system png library not found or too old, will use built-in instead])
+                wxUSE_LIBPNG=builtin
             fi
+        else
+            dnl we are using the system library
+            wxUSE_LIBPNG=sys
         fi
     fi
 fi
@@ -2484,71 +2587,63 @@ JPEG_LINK=
 if test "$wxUSE_LIBJPEG" != "no" ; then
     AC_DEFINE(wxUSE_LIBJPEG)
 
-    if test "$wxUSE_MGL" = 1 -a "$wxUSE_LIBJPEG" = "builtin" ; then
-        AC_MSG_WARN([wxMGL doesn't work with builtin jpeg library, will use MGL one instead])
-        wxUSE_LIBJPEG=sys
-    fi
-
-    if test "$wxUSE_MGL" != 1 ; then
-        dnl Don't check for libjpeg when building wxMGL, libmgl contains it
-        if test "$wxUSE_LIBJPEG" = "sys" -o "$wxUSE_LIBJPEG" = "yes" ; then
-            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
-                )
+    if test "$wxUSE_LIBJPEG" = "sys" -o "$wxUSE_LIBJPEG" = "yes" ; then
+        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)
+        )
+        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 "$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
-                if test "$wxUSE_LIBJPEG" = "sys" ; then
-                    AC_MSG_ERROR([system jpeg library not found! Use --with-libjpeg=builtin to use built-in version])
-                else
-                    AC_MSG_WARN([system jpeg library not found, will use built-in instead])
-                    wxUSE_LIBJPEG=builtin
-                fi
+        if test "x$JPEG_LINK" = "x" ; then
+            if test "$wxUSE_LIBJPEG" = "sys" ; then
+                AC_MSG_ERROR([system jpeg library not found! Use --with-libjpeg=builtin to use built-in version])
             else
-                dnl we are using the system library
-                wxUSE_LIBJPEG=sys
-
-                if test "$wxUSE_MSW" = 1; then
-                    dnl boolean is defined by the jpeg headers and also by the
-                    dnl Windows headers of some compilers. This type has been
-                    dnl renamed in the builtin, so it is only an issue when
-                    dnl using an external jpeg lib on Windows.
-                    AC_CHECK_TYPES(
-                        [boolean],
-                        [
-                            AC_CHECK_SIZEOF(
-                                [boolean],
-                                [],
-                                [
-                                    #undef HAVE_BOOLEAN
-                                    #include <stdio.h>
-                                    #include <jpeglib.h>
-                                ])
-                            AC_DEFINE_UNQUOTED(
-                                [wxHACK_BOOLEAN],
-                                [wxInt`expr 8 \* $ac_cv_sizeof_boolean`])
-                        ],
-                        [],
-                        [#include <windows.h>])
-                fi
+                AC_MSG_WARN([system jpeg library not found, will use built-in instead])
+                wxUSE_LIBJPEG=builtin
+            fi
+        else
+            dnl we are using the system library
+            wxUSE_LIBJPEG=sys
+
+            if test "$wxUSE_MSW" = 1; then
+                dnl boolean is defined by the jpeg headers and also by the
+                dnl Windows headers of some compilers. This type has been
+                dnl renamed in the builtin, so it is only an issue when
+                dnl using an external jpeg lib on Windows.
+                AC_CHECK_TYPES(
+                    [boolean],
+                    [
+                        AC_CHECK_SIZEOF(
+                            [boolean],
+                            [],
+                            [
+                                #undef HAVE_BOOLEAN
+                                #include <stdio.h>
+                                #include <jpeglib.h>
+                            ])
+                        AC_DEFINE_UNQUOTED(
+                            [wxHACK_BOOLEAN],
+                            [wxInt`expr 8 \* $ac_cv_sizeof_boolean`])
+                    ],
+                    [],
+                    [#include <windows.h>])
             fi
         fi
     fi
@@ -2605,6 +2700,14 @@ if test "$wxUSE_LIBTIFF" != "no" ; then
             dnl we need to hack around this
             ac_configure_args="$ac_configure_args --disable-jpeg"
         fi
+
+        dnl If libtiff configure detects lzma library, it enables support for
+        dnl LZMA compression and using it requires linking with liblzma.
+        AC_CHECK_LIB(lzma, lzma_code, [LIBS="$LIBS -llzma"])
+
+        dnl Similarly for jbig
+        AC_CHECK_LIB(jbig, jbg_dec_init, [LIBS="$LIBS -ljbig"])
+
         AC_CONFIG_SUBDIRS([src/tiff])
     fi
 fi
@@ -2613,17 +2716,6 @@ dnl ------------------------------------------------------------------------
 dnl Check for expat libraries
 dnl ------------------------------------------------------------------------
 
-if test "$wxUSE_WCHAR_T" != "yes"; then
-    if test "$wxUSE_EXPAT" != "no"; then
-        AC_MSG_WARN([wxWidgets requires wchar_t to use expat, disabling])
-        wxUSE_EXPAT=no
-    fi
-    if test "$wxUSE_XML" != "no"; then
-        AC_MSG_WARN([wxWidgets requires wchar_t to use xml, disabling])
-        wxUSE_XML=no
-    fi
-fi
-
 if test "$wxUSE_EXPAT" != "no"; then
     wxUSE_XML=yes
     AC_DEFINE(wxUSE_EXPAT)
@@ -2708,15 +2800,13 @@ if test "$USE_WIN32" = 1 ; then
     ],
     [ ])
 
-    dnl --- FIXME: This is still a somewhat random list of libs,
-    dnl ---        some of them should probably be included conditionally.
+    LIBS="$LIBS -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -ladvapi32 -lwsock32 -lgdi32"
     case "${host}" in
-       x86_64-*-mingw32* )
-            dnl --- For mingw-w64 lctl3d32's name has changed
-            LIBS="$LIBS -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -lwctl3d32 -ladvapi32 -lwsock32 -lgdi32"
-        ;;
-        * )
-            LIBS="$LIBS -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32"
+        x86_64-*-mingw32* )
+            dnl we need to define this to embed the manifest for correct
+            dnl platform from wx/msw/wx.rc (this is not needed for x86 which is
+            dnl the default in wx/msw/rcdefs.h)
+            WINDRES_CPU_DEFINE="--define WX_CPU_AMD64"
         ;;
     esac
     if test "$wxUSE_ACCESSIBILITY" = "yes" ; then
@@ -2730,19 +2820,16 @@ if test "$USE_WIN32" = 1 ; then
     esac
 
     dnl This one is still used by some sample makefiles.
-    RESFLAGS="--include-dir \$(top_srcdir)/include --include-dir \$(top_srcdir)/\$(program_dir) --define __WIN32__ --define __WIN95__ --define __GNUWIN32__"
+    RESFLAGS="--include-dir \$(top_srcdir)/include --include-dir \$(top_srcdir)/\$(program_dir) --define __WIN32__ --define __WIN95__ --define __GNUWIN32__ $WINDRES_CPU_DEFINE"
     RESPROGRAMOBJ="\$(PROGRAM)_resources.o"
 
     dnl This lot we export to wx-config.  It must add the relevant
     dnl include directories at the point when they can be known.
     dnl (but are these (still) required anyway?)
-    WXCONFIG_RESFLAGS="--define __WIN32__ --define __WIN95__ --define __GNUWIN32__"
+    WXCONFIG_RESFLAGS="--define __WIN32__ --define __WIN95__ --define __GNUWIN32__ $WINDRES_CPU_DEFINE"
 
     dnl install Win32-specific files in "make install"
     WIN32INSTALL=win32install
-
-    dnl pbt.h is missing on Wine at least
-    AC_CHECK_HEADER([pbt.h],, [AC_DEFINE(NEED_PBT_H)], [ ])
 fi
 
 if test "$wxUSE_GUI" = "yes"; then
@@ -2750,12 +2837,13 @@ if test "$wxUSE_GUI" = "yes"; then
 
     GUI_TK_LIBRARY=
 
-    WXGTK12=
+    WXGTK1=
     WXGTK127=
     WXGTK2=
+    WXGTK3=
     WXGPE=
 
-    if test "$wxUSE_COCOA" = 1 ; then
+    if test "$wxUSE_OLD_COCOA" = 1 ; then
         if test "$wxUSE_PRINTING_ARCHITECTURE" = "yes"; then
             AC_MSG_WARN([Printing not supported under wxCocoa yet, disabled])
             wxUSE_PRINTING_ARCHITECTURE=no
@@ -2800,6 +2888,10 @@ if test "$wxUSE_GUI" = "yes"; then
                     GTK_MODULES=gthread
                 fi
 
+                if test -z "$wxGTK_VERSION"; then
+                    wxGTK_VERSION=any
+                fi
+
                 dnl detect GTK2
                 wx_cv_lib_gtk=
                 if test "x$wxGTK_VERSION" != "x1"
@@ -2814,15 +2906,14 @@ if test "$wxUSE_GUI" = "yes"; then
                             fi
                     esac
 
-                    AM_PATH_GTK_2_0(2.4.0, wx_cv_lib_gtk=2.0, , $GTK_MODULES)
-
-                    dnl Solaris also requires -lX11 for static lib
-                    case "${host}" in
-                        *-*-solaris2* )
-                            if test "$wxUSE_SHARED" != "yes"; then
-                                GTK_LIBS="$GTK_LIBS -lX11"
-                            fi
-                    esac
+                    if test "$wxGTK_VERSION" != 3; then
+                        AM_PATH_GTK_2_0(2.6.0, wx_cv_lib_gtk=2.0, , $GTK_MODULES)
+                    fi
+                    if test -z "$wx_cv_lib_gtk"; then
+                        if test "$wxGTK_VERSION" = 3 -o "$wxGTK_VERSION" = any; then
+                            AM_PATH_GTK_3_0(, wx_cv_lib_gtk=3, , $GTK_MODULES)
+                        fi
+                    fi
                 fi
 
                 dnl detect GTK1.x
@@ -2840,10 +2931,13 @@ if test "$wxUSE_GUI" = "yes"; then
                     dnl looks better in AC_MSG_RESULT
                     wx_cv_lib_gtk=none
                 else
+                    dnl we use symbols from X11 directly so we should link with it
+                    GTK_LIBS="$GTK_LIBS -lX11"
+
                     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=`echo $GTK_LIBS | sed -e 's/ -l[[^ ]]*cairo[[^ ]]*//g'`
+                    wx_cv_libs_gtk=$GTK_LIBS
                 fi
             ]
         )
@@ -2855,14 +2949,16 @@ if test "$wxUSE_GUI" = "yes"; then
         fi
 
         case "$wx_cv_lib_gtk" in
+            3)      WXGTK3=1
+                    TOOLKIT_VERSION=3
+                    ;;
             2.0)    WXGTK2=1
                     TOOLKIT_VERSION=2
                     ;;
             1.2.7)  WXGTK127=1
-                    WXGTK12=1
-                    ;;
-            1.2.3)  WXGTK12=1
+                    WXGTK1=1
                     ;;
+            1.2*)   WXGTK1=1 ;;
             *)      AC_MSG_ERROR([
 The development files for GTK+ were not found. For GTK+ 2, please
 ensure that pkg-config is in the path and that gtk+-2.0.pc is
@@ -2874,53 +2970,56 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
                     ;;
         esac
 
-        if test "$WXGTK2" = 1; then
+        if test "$WXGTK3" = 1; then
+            AC_DEFINE(__WXGTK218__)
+            AC_DEFINE(__WXGTK210__)
+        elif test "$WXGTK2" = 1; then
             save_CFLAGS="$CFLAGS"
             save_LIBS="$LIBS"
             CFLAGS="$wx_cv_cflags_gtk $CFLAGS"
             LIBS="$LIBS $wx_cv_libs_gtk"
 
-            dnl test if we have at least GTK+ 2.10:
-            AC_MSG_CHECKING([if GTK+ is version >= 2.10])
+            dnl test if we have at least GTK+ 2.18:
+            AC_MSG_CHECKING([if GTK+ is version >= 2.18])
             AC_TRY_COMPILE([
                             #include <gtk/gtk.h>
                            ],
                            [
-                            #if !GTK_CHECK_VERSION(2,10,0)
-                            Not GTK+ 2.10
+                            #if !GTK_CHECK_VERSION(2,18,0)
+                            Not GTK+ 2.18
                             #endif
                            ],
                            [
+                            AC_DEFINE(__WXGTK218__)
                             AC_DEFINE(__WXGTK210__)
-                            AC_DEFINE(__WXGTK26__)
                             AC_MSG_RESULT([yes])
-                            ac_wxgtk210=1
+                            ac_wxgtk218=1
                            ],
                            [
                             AC_MSG_RESULT([no])
-                            ac_wxgtk210=0
+                            ac_wxgtk218=0
                            ])
 
-            if test "$ac_wxgtk210" = 0; then
-                dnl test if we have at least GTK+ 2.6:
-                AC_MSG_CHECKING([if GTK+ is version >= 2.6])
+            if test "$ac_wxgtk218" = 0; then
+                dnl test if we have at least GTK+ 2.10:
+                AC_MSG_CHECKING([if GTK+ is version >= 2.10])
                 AC_TRY_COMPILE([
                                 #include <gtk/gtk.h>
-                            ],
-                            [
-                                #if !GTK_CHECK_VERSION(2,6,0)
-                                Not GTK+ 2.6
+                               ],
+                               [
+                                #if !GTK_CHECK_VERSION(2,10,0)
+                                Not GTK+ 2.10
                                 #endif
-                            ],
-                            [
-                                AC_DEFINE(__WXGTK26__)
+                               ],
+                               [
+                                AC_DEFINE(__WXGTK210__)
                                 AC_MSG_RESULT([yes])
-                                ac_wxgtk26=1
-                            ],
-                            [
+                                ac_wxgtk210=1
+                               ],
+                               [
                                 AC_MSG_RESULT([no])
-                                ac_wxgtk26=0
-                            ])
+                                ac_wxgtk210=0
+                               ])
             fi
 
             CFLAGS="$save_CFLAGS"
@@ -2943,7 +3042,6 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
 
         TOOLKIT_INCLUDE="$wx_cv_cflags_gtk"
         GUI_TK_LIBRARY="$wx_cv_libs_gtk $GUI_TK_LIBRARY"
-
         AFMINSTALL=afminstall
         TOOLKIT=GTK
         GUIDIST=GTK_DIST
@@ -2951,7 +3049,7 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
         dnl test for external libxpm if we're configured to use it
         if test "$wxUSE_GPE" = "yes"; then
             AC_MSG_CHECKING(for gpewidget library)
-            WX_PATH_FIND_LIBRARIES($SEARCH_LIB,gpewidget)
+            WX_PATH_FIND_LIBRARIES(gpewidget)
             if test "$ac_find_libraries" != "" ; then
                 WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
                 dnl -lgpewidget must be before all GTK libs and
@@ -2964,7 +3062,7 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
             fi
 
             dnl AC_MSG_CHECKING(for gpe library)
-            dnl WX_PATH_FIND_LIBRARIES($SEARCH_LIB,gpe)
+            dnl WX_PATH_FIND_LIBRARIES(gpe)
             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 -lgpe"
@@ -2975,74 +3073,6 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
         fi
     fi
 
-    if test "$wxUSE_MGL" = 1; then
-       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
-
-        AC_MSG_CHECKING(for libmgl location)
-        dnl Find MGL library that we want
-        dnl FIXME_MGL - test for MGL variants for freebsd etc.;
-        dnl             and for non-x86 versions
-        case "${host}" in
-            *-*-linux* )
-              dnl glibc.so, glibc are for older versions of MGL,
-              dnl x86/a, x86/so are used by >= 5.0 R11
-              if test "x$wxUSE_SHARED" = xyes ; then
-                  mgl_os_candidates="linux/gcc/x86/so linux/gcc/x86/a linux/gcc/glibc.so linux/gcc/glibc"
-              else
-                  mgl_os_candidates="linux/gcc/x86/a linux/gcc/x86/so linux/gcc/glibc linux/gcc/glibc.so"
-              fi
-              ;;
-            *-pc-msdosdjgpp )
-              mgl_os_candidates="dos32/dj2"
-              ;;
-            *)
-              AC_MSG_ERROR(This system type ${host} is not yet supported by wxMGL.)
-        esac
-
-        mgl_lib_type=""
-        mgl_os=""
-
-        for mgl_os_i in $mgl_os_candidates ; do
-            if test "x$mgl_os" = x ; then
-                if test "$wxUSE_DEBUG_FLAG" = yes ; then
-                    if test -f $MGL_ROOT/lib/debug/$mgl_os_i/libmgl.a -o \
-                            -f $MGL_ROOT/lib/debug/$mgl_os_i/libmgl.so; then
-                        mgl_lib_type=debug
-                        mgl_os=$mgl_os_i
-                    fi
-                fi
-                if test "x$mgl_lib_type" = x ; then
-                    if test -f $MGL_ROOT/lib/release/$mgl_os_i/libmgl.a -o \
-                            -f $MGL_ROOT/lib/release/$mgl_os_i/libmgl.so; then
-                        mgl_lib_type=release
-                        mgl_os=$mgl_os_i
-                    fi
-                fi
-            fi
-        done
-
-        if test "x$mgl_os" = x ; then
-            AC_MSG_RESULT(not found)
-            AC_MSG_ERROR([Cannot find MGL libraries, make sure they are compiled.])
-        fi
-        AC_MSG_RESULT("$MGL_ROOT/lib/$mgl_lib_type/$mgl_os")
-
-        wxUSE_UNIVERSAL="yes"
-
-        TOOLKIT_INCLUDE="-I$MGL_ROOT/include"
-        GUI_TK_LIBRARY="-L$MGL_ROOT/lib/$mgl_lib_type/$mgl_os -lmgl -lmglcpp -lpm"
-
-        AFMINSTALL=afminstall
-        TOOLKIT=MGL
-        GUIDIST=MGL_DIST
-    fi
-
     if test "$wxUSE_DFB" = 1; then
        PKG_PROG_PKG_CONFIG()
 
@@ -3210,7 +3240,7 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
 
 
         AC_MSG_CHECKING(for Motif/Lesstif library)
-        WX_PATH_FIND_LIBRARIES($SEARCH_LIB, Xm)
+        WX_PATH_FIND_LIBRARIES(Xm)
 
         if test "x$ac_find_libraries" != "x" ; then
             AC_MSG_RESULT(found in $ac_find_libraries)
@@ -3349,7 +3379,7 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
         dnl test for external libxpm if we're configured to use it
         if test "$wxUSE_LIBXPM" = "sys"; then
             AC_MSG_CHECKING(for Xpm library)
-            WX_PATH_FIND_LIBRARIES($SEARCH_LIB,Xpm)
+            WX_PATH_FIND_LIBRARIES(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"
@@ -3434,10 +3464,10 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
         fi
 
         if test "x$wxUSE_UNIX" = "xyes"; then
-            CPPFLAGS="$CPPFLAGS_PASCAL -I\${top_srcdir}/src/mac/carbon/morefilex -I/Developer/Headers/FlatCarbon $CPPFLAGS"
+            CPPFLAGS="$CPPFLAGS_PASCAL -I/Developer/Headers/FlatCarbon $CPPFLAGS"
         else
             dnl platform.h needs TARGET_CARBON before setup.h
-            CPPFLAGS="$CPPFLAGS_PASCAL -I\${top_srcdir}/src/mac/carbon/morefilex -DTARGET_CARBON $CPPFLAGS"
+            CPPFLAGS="$CPPFLAGS_PASCAL -DTARGET_CARBON $CPPFLAGS"
         fi
 
         TOOLKIT=OSX_CARBON
@@ -3446,14 +3476,27 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
         dnl wxMac version of wxBase and wxCocoa or wxBase-only built on Darwin
         dnl are different, so they need different names:
         WXBASEPORT="_carbon"
+
+        dnl in addition to defining __WXOSX_CARBON__ for this toolkit we want
+        dnl to also define these extra symbols to make it possible to test for
+        dnl any Mac port (__WXMAC__ is for backwards compatibility, __WXOSX__
+        dnl is a new name)
+        TOOLCHAIN_DEFS="${TOOLCHAIN_DEFS} -D__WXMAC__ -D__WXOSX__"
     fi
 
     if test "$wxUSE_OSX_COCOA" = 1; then
         TOOLKIT=OSX_COCOA
         GUIDIST=OSX_COCOA_DIST
+
+        dnl see the comment above in wxUSE_OSX_CARBON branch
+        TOOLCHAIN_DEFS="${TOOLCHAIN_DEFS} -D__WXMAC__ -D__WXOSX__"
+    fi
+
+    if test "$wxUSE_OSX_IPHONE" = 1; then
+        TOOLKIT=OSX_IPHONE
     fi
 
-    if test "$wxUSE_COCOA" = 1; then
+    if test "$wxUSE_OLD_COCOA" = 1; then
         TOOLKIT=COCOA
         GUIDIST=COCOA_DIST
     fi
@@ -3518,25 +3561,6 @@ else
 fi
 
 
-dnl ---------------------------------------------------------------------------
-dnl UTF-8 support
-dnl ---------------------------------------------------------------------------
-
-dnl If UTF-8 support wasn't explicitly enabled or disabled, enable it only
-dnl for ports where it makes sense by default (GTK+, DirectFB):
-if test "$wxUSE_UNICODE" = "yes" -a "$wxUSE_UNICODE_UTF8" = "auto" ; then
-    if test "$USE_UNIX" = 1 -a "$wxUSE_DARWIN" != 1 ; then
-        wxUSE_UNICODE_UTF8=yes
-    elif test "$USE_OS2" = 1 ; then
-        dnl wide char support is quite incomplete in libc;
-        dnl UTF-8 might actually work when evaluating/setting
-        dnl code pages correctly, even for ports other than GTK20.
-        wxUSE_UNICODE_UTF8=yes
-    else
-        wxUSE_UNICODE_UTF8=no
-    fi
-fi
-
 dnl ---------------------------------------------------------------------------
 dnl Optional libraries included when system library is not used
 dnl ---------------------------------------------------------------------------
@@ -3557,71 +3581,67 @@ fi
 
 
 dnl ---------------------------------------------------------------------------
-dnl wxDisplay Sanity checks
+dnl wxDisplay checks
 dnl ---------------------------------------------------------------------------
 
+USE_XINERAMA=0
 if test "$wxUSE_DISPLAY" = "yes"; then
-dnl ---------------------------------------------------------------------------
-dnl Xinerama (for unix ) - Brian Victor
-dnl ---------------------------------------------------------------------------
-    if test "$wxUSE_UNIX" = "yes" -a "$wxUSE_MAC" != 1 -a "$wxUSE_COCOA" != 1; then
-        AC_MSG_CHECKING([for Xinerama])
-        WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],Xinerama)
+    dnl Xinerama is used for wxGTK1/wxX11/wxMotif only
+    if test "$wxUSE_MOTIF" = 1 -o "$wxUSE_X11" = 1 -o "$WXGTK1" = 1; then
+        WX_FIND_LIB(Xinerama, XineramaQueryScreens)
         if test "$ac_find_libraries" != "" ; then
-            WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
-            if test "$ac_path_to_link" != " -L/usr/lib" ; then
-                LDFLAGS="$LDFLAGS $ac_path_to_link"
+            if test "$ac_find_libraries" != "std" ; then
+              WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
+              if test "$ac_path_to_link" != " -L/usr/lib" ; then
+                  LDFLAGS="$LDFLAGS $ac_path_to_link"
+              fi
             fi
+            USE_XINERAMA=1
             GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXinerama"
-            AC_MSG_RESULT([yes])
-
-            AC_MSG_CHECKING([for Xxf86vm extension])
-            WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],Xxf86vm)
-            if test "$ac_find_libraries" != "" ; then
-                AC_MSG_RESULT([yes])
-                AC_CHECK_HEADERS([X11/extensions/xf86vmode.h],
-                                 [
-                                  GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXxf86vm"
-                                 ],
-                                 [],
-                                 [
-                                      #if HAVE_X11_XLIB_H
-                                        #include <X11/Xlib.h>
-                                      #endif
-                                 ])
-            else
-                AC_MSG_RESULT([no])
-            fi
-
         else
-            AC_MSG_RESULT([no])
             AC_MSG_WARN([Xinerama not found; disabling wxDisplay])
             wxUSE_DISPLAY="no"
         fi
     elif test "$wxUSE_MSW" = 1; then
-dnl ---------------------------------------------------------------------------
-dnl DirectDraw for MSW - optionally used by WxDisplay.
-dnl ---------------------------------------------------------------------------
+        dnl DirectDraw for MSW - optionally used by WxDisplay.
         AC_CHECK_HEADER([ddraw.h], [], [], [#include <windows.h>])
     fi
 fi
 
+if test "$wxUSE_DISPLAY" = "yes"; then
+    dnl wxGTK2 needs Xxf86vm as well as Xinerama-using ports from above
+    if test "$USE_XINERAMA" = 1 -o "$wxUSE_GTK" = 1; then
+        WX_FIND_LIB(Xxf86vm, XF86VidModeQueryExtension)
+        if test "$ac_find_libraries" != "" ; then
+            AC_CHECK_HEADERS([X11/extensions/xf86vmode.h],
+                             [
+                              GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXxf86vm"
+                             ],
+                             [],
+                             [
+                                  #if HAVE_X11_XLIB_H
+                                    #include <X11/Xlib.h>
+                                  #endif
+                             ])
+        fi
+    fi
+fi
+
 dnl ---------------------------------------------------------------------------
 dnl X11 session management
 dnl ---------------------------------------------------------------------------
 if test "$wxUSE_DETECT_SM" = "yes"; then
-    if test "$wxUSE_UNIX" = "yes" -a "$wxUSE_MAC" != 1 -a "$wxUSE_COCOA" != 1; then
-        AC_MSG_CHECKING([for -lSM - X11 session management])
-        WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],SM)
+    if test "$wxUSE_UNIX" = "yes" -a "$wxUSE_MAC" != 1 -a "$wxUSE_OLD_COCOA" != 1; then
+        WX_FIND_LIB(SM, SmcOpenConnection)
         if test "$ac_find_libraries" != "" ; then
-            WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
-            if test "$ac_path_to_link" != " -L/usr/lib" ; then
+            if test "$ac_find_libraries" != "std" ; then
+              WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
+              if test "$ac_path_to_link" != " -L/usr/lib" ; then
                 LDFLAGS="$LDFLAGS $ac_path_to_link"
+              fi
             fi
             GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lSM"
-            AC_MSG_RESULT([yes])
         else
-            AC_MSG_RESULT([no])
             AC_MSG_WARN([libSM not found; disabling session management detection])
             wxUSE_DETECT_SM="no"
         fi
@@ -3636,15 +3656,16 @@ dnl OpenGL libraries
 dnl ---------------------------------------------------------------------------
 
 USE_OPENGL=0
-if test "$wxUSE_OPENGL" = "yes"; then
-    if test "$wxUSE_MGL" = 1 -o "$wxUSE_DFB" = 1; then
-        AC_MSG_WARN([wxGLCanvas not implemented for this port, library will be compiled without it.])
-        wxUSE_OPENGL="no"
-    elif test "$wxUSE_OSX_CARBON" = 1 -o "$wxUSE_OSX_COCOA" = 1 -o "$wxUSE_COCOA" = 1; then
+if test "$wxUSE_OPENGL" = "yes" -o "$wxUSE_OPENGL" = "auto"; then
+
+    dnl look in glcanvas.h for the list of platforms supported by wxGlCanvas:
+
+    if test "$wxUSE_OSX_CARBON" = 1 -o "$wxUSE_OSX_COCOA" = 1 -o "$wxUSE_OLD_COCOA" = 1; then
         OPENGL_LIBS="-framework OpenGL -framework AGL"
     elif test "$wxUSE_MSW" = 1; then
         OPENGL_LIBS="-lopengl32 -lglu32"
-    else
+    elif test "$wxUSE_MOTIF" = 1 -o "$wxUSE_X11" = 1 -o "$wxUSE_GTK" = 1; then
+
         dnl adjust CPPFLAGS to include GL/gl.h location if necessary
         dnl (/opt/graphics/OpenGL is for HP-UX systems, bug 925307)
         AC_MSG_CHECKING([for OpenGL headers])
@@ -3661,48 +3682,43 @@ if test "$wxUSE_OPENGL" = "yes"; then
             AC_CHECK_HEADER(GL/glu.h, [
                 found_gl=0
 
-                AC_MSG_CHECKING([for -lGL])
-                WX_PATH_FIND_LIBRARIES([$SEARCH_LIB /opt/graphics/OpenGL/lib],GL)
+                WX_FIND_LIB(GL, glBegin, [/opt/graphics/OpenGL/lib])
                 if test "$ac_find_libraries" != "" ; then
-                    AC_MSG_RESULT([found in $ac_find_libraries])
-
-                    WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
-                    if test "$ac_path_to_link" != " -L/usr/lib" ; then
+                    if test "$ac_find_libraries" != "std" ; then
+                      WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
+                      if test "$ac_path_to_link" != " -L/usr/lib" ; then
                         LDFLAGS_GL="$ac_path_to_link"
+                      fi
                     fi
 
                     dnl don't suppose that libGL and libGLU are always in the
                     dnl same directory -- this is not true for some common
                     dnl distributions
-                    AC_MSG_CHECKING([for -lGLU])
-                    WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],GLU)
+                    WX_FIND_LIB(GLU, gluBeginCurve, [/opt/graphics/OpenGL/lib])
                     if test "$ac_find_libraries" != "" ; then
+                      if test "$ac_find_libraries" != "std" ; then
                         WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
                         if test "$ac_path_to_link" != " -L/usr/lib" -a \
-                                    "$ac_path_to_link" != "$LDFLAGS_GL"; then
-                            LDFLAGS_GL="$LDFLAGS_GL$ac_path_to_link"
+                                "$ac_path_to_link" != "$LDFLAGS_GL" ; then
+                          LDFLAGS_GL="$LDFLAGS_GL$ac_path_to_link"
                         fi
+                      fi
 
                         found_gl=1
                         OPENGL_LIBS="-lGL -lGLU"
-                        AC_MSG_RESULT([yes])
-                    else
-                        AC_MSG_RESULT([no])
                     fi
-                else
-                    AC_MSG_RESULT([no])
                 fi
 
                 if test "$found_gl" != 1; then
-                    AC_MSG_CHECKING([for -lMesaGL])
-                    WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],MesaGL)
+                    WX_FIND_LIB(MesaGL, glEnable, [/opt/graphics/OpenGL/lib])
                     if test "$ac_find_libraries" != "" ; then
+                      if test "$ac_find_libraries" != "std" ; then
                         WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
-                        LDFLAGS_GL="$LDFLAGS$ac_path_to_link"
-                        OPENGL_LIBS="-lMesaGL -lMesaGLU"
-                        AC_MSG_RESULT([yes])
-                    else
-                        AC_MSG_RESULT([no])
+                        if test "$ac_path_to_link" != " -L/usr/lib" ; then
+                          LDFLAGS_GL="$LDFLAGS_GL$ac_path_to_link"
+                        fi
+                      fi
+                      OPENGL_LIBS="-lMesaGL -lMesaGLU"
                     fi
                 fi
             ],, [ ])
@@ -3711,11 +3727,25 @@ if test "$wxUSE_OPENGL" = "yes"; then
         [ ])
 
         if test "x$OPENGL_LIBS" = "x"; then
-            dnl it should be an error and not a warning because OpenGL is not on
-            dnl by default and so if it had been explicitly requested, we
-            dnl shouldn't just fall back to compiling the library without it
-            AC_MSG_ERROR(OpenGL libraries not available)
+            if test "$wxUSE_OPENGL" = "yes"; then
+                AC_MSG_ERROR([OpenGL libraries not available])
+            else
+                dnl case wxUSE_OPENGL=auto
+                AC_MSG_WARN([OpenGL libraries not available, disabling support for OpenGL])
+                wxUSE_OPENGL=no
+                USE_OPENGL=0
+            fi
         fi
+    else
+        AC_MSG_WARN([wxGLCanvas not implemented for this port, library will be compiled without it.])
+        wxUSE_OPENGL="no"
+    fi
+
+    if test "$wxUSE_OPENGL" = "auto"; then
+        dnl if the OpenGL libraries were unavailable, this would have been
+        dnl changed to "no" above, if it wasn't, change it to "yes" as we've
+        dnl verified that we can indeed use OpenGL
+        wxUSE_OPENGL=yes
     fi
 
     if test "$wxUSE_OPENGL" = "yes"; then
@@ -3804,20 +3834,28 @@ if test "$wxUSE_SHARED" = "yes"; then
       ;;
 
       *-*-darwin* )
-        install_name_tool=`which install_name_tool`
+        install_name_tool=`which ${HOST_PREFIX}install_name_tool`
         if test "$install_name_tool" -a -x "$install_name_tool"; then
-            SAMPLES_RPATH_POSTLINK="\$(wx_top_builddir)/change-install-names \$(LIBDIRNAME) \$(prefix) \$@"
+            DYLIB_RPATH_POSTLINK="${HOST_PREFIX}install_name_tool -id \$@ \$@"
             cat <<EOF >change-install-names
 #!/bin/sh
-libnames=\`cd \${1} ; ls -1 | grep '\.[[0-9]][[0-9]]*\.dylib\$'\`
-inst_cmd="install_name_tool "
+libnames=\`cd \${2} ; ls -1 | grep '\.[[0-9]][[0-9]]*\.dylib\$'\`
 for i in \${libnames} ; do
-    inst_cmd="\${inst_cmd} -change \${2}/lib/\${i} \${1}/\${i}"
+    ${HOST_PREFIX}install_name_tool -id \${3}/\${i} \${1}/\${i}
+    for dep in \${libnames} ; do
+        ${HOST_PREFIX}install_name_tool -change \${2}/\${dep} \${3}/\${dep} \${1}/\${i}
+    done
 done
-\${inst_cmd} \${3}
 EOF
             chmod +x change-install-names
+            DYLIB_RPATH_INSTALL="\$(wx_top_builddir)/change-install-names \${DESTDIR}\${libdir} \$(wx_top_builddir)/lib \${libdir}"
         fi
+
+        dnl the HEADER_PAD_OPTION is required by some wx samples to avoid the error:
+        dnl "install_name_tool: changing install names can't be redone for: the_exe_name
+        dnl (for architecture ppc) because larger updated load commands do not fit
+        dnl (the program must be relinked)"
+        HEADER_PAD_OPTION="-headerpad_max_install_names"
       ;;
 
       *-*-cygwin* | *-*-mingw32* )
@@ -3837,7 +3875,7 @@ EOF
 
     if test $wxUSE_RPATH = "no"; then
         SAMPLES_RPATH_FLAG=''
-        SAMPLES_RPATH_POSTLINK=''
+        DYLIB_PATH_POSTLINK=''
         WXCONFIG_RPATH=''
     fi
 
@@ -3860,15 +3898,6 @@ if test "$wxUSE_UNICODE" = "yes"; then
     UNICODE=1
 fi
 
-lib_debug_suffix=
-WX_DEBUGTYPE="release"
-DEBUG_FLAG=0
-if test "$wxUSE_DEBUG_FLAG" = "yes"; then
-    lib_debug_suffix=d
-    WX_DEBUGTYPE="debug"
-    DEBUG_FLAG=1
-fi
-
 WX_FLAVOUR=${WX_FLAVOUR:+-$WX_FLAVOUR}
 WX_LIB_FLAVOUR=`echo $WX_FLAVOUR | tr '-' '_'`
 
@@ -3877,31 +3906,30 @@ if test "$wxUSE_DEBUG_INFO" = "yes"; then
     DEBUG_INFO=1
 fi
 
-WX_VERSION_TAG=`echo WX${lib_unicode_suffix}${lib_debug_suffix}${WX_LIB_FLAVOUR}_${WX_RELEASE} | tr '[[a-z]]' '[[A-Z]]'`
+WX_VERSION_TAG=`echo WX${lib_unicode_suffix}${WX_LIB_FLAVOUR}_${WX_RELEASE} | tr '[[a-z]]' '[[A-Z]]'`
 
-TOOLCHAIN_NAME="${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_unicode_suffix}${lib_debug_suffix}${WX_LIB_FLAVOUR}-${WX_RELEASE}"
+TOOLCHAIN_NAME="${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_unicode_suffix}${WX_LIB_FLAVOUR}-${WX_RELEASE}${HOST_SUFFIX}"
 
-TOOLCHAIN_FULLNAME="${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}-${WX_CHARTYPE}-${WX_DEBUGTYPE}${config_linkage_component}-${WX_RELEASE}${WX_FLAVOUR}"
-
-if test "$cross_compiling" = "yes"; then
-    HOST_SUFFIX="-$host_alias"
-    TOOLCHAIN_NAME="$TOOLCHAIN_NAME$HOST_SUFFIX"
-    TOOLCHAIN_FULLNAME="${host_alias}-$TOOLCHAIN_FULLNAME"
-fi
+TOOLCHAIN_FULLNAME="${HOST_PREFIX}${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}-${WX_CHARTYPE}${config_linkage_component}-${WX_RELEASE}${WX_FLAVOUR}"
 
 dnl library link name
-dnl These just save us from exporting lib_{unicode,debug,flavour}_suffix.
+dnl These just save us from exporting lib_{unicode,flavour}_suffix.
 dnl If we ever need to do that, we won't need to keep these.
-WX_LIBRARY_BASENAME_NOGUI="wx_base${WXBASEPORT}${lib_unicode_suffix}${lib_debug_suffix}${WX_LIB_FLAVOUR}"
+
+if test "$wxUSE_OSX_CARBON" = 1 -o "$wxUSE_OSX_COCOA" = 1 -o "$wxUSE_OLD_COCOA" = 1; then
+    WX_LIBRARY_BASENAME_NOGUI="wx_base${lib_unicode_suffix}${WX_LIB_FLAVOUR}"
+else
+    WX_LIBRARY_BASENAME_NOGUI="wx_base${WXBASEPORT}${lib_unicode_suffix}${WX_LIB_FLAVOUR}"
+fi
 if test "${TOOLKIT_DIR}" = "os2"; then
-    WX_LIBRARY_BASENAME_GUI="wx_pm${WIDGET_SET}${lib_unicode_suffix}${lib_debug_suffix}${WX_LIB_FLAVOUR}"
+    WX_LIBRARY_BASENAME_GUI="wx_pm${WIDGET_SET}${lib_unicode_suffix}${WX_LIB_FLAVOUR}"
 else
-    WX_LIBRARY_BASENAME_GUI="wx_${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_unicode_suffix}${lib_debug_suffix}${WX_LIB_FLAVOUR}"
+    WX_LIBRARY_BASENAME_GUI="wx_${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_unicode_suffix}${WX_LIB_FLAVOUR}"
 fi
 
 
 
-if test "$wxUSE_COCOA" = 1; then
+if test "$wxUSE_OLD_COCOA" = 1; then
     AC_LANG_SAVE
     AC_WX_LANG_OBJECTIVEC
 dnl Recent AppKit/NSEvent.h include parts of IOKit which eventually
@@ -4052,54 +4080,47 @@ dnl ---------------------------------------------------------------------------
 dnl Check for functions
 dnl ---------------------------------------------------------------------------
 
-dnl don't check for wchar_t functions if we haven't got wchar_t itself
-if test "$wxUSE_WCHAR_T" = "yes"; then
-    AC_DEFINE(wxUSE_WCHAR_T)
-
-    dnl check for wcslen in all possible places
-    WCSLEN_FOUND=0
-    WCHAR_LINK=
-    AC_CHECK_FUNCS(wcslen, WCSLEN_FOUND=1)
-
-    if test "$WCSLEN_FOUND" = 0; then
-        if test "$TOOLKIT" = "MSW"; then
-            AC_CHECK_LIB(msvcrt, wcslen, WCHAR_OK=1)
-        else
-            AC_CHECK_LIB(w, wcslen, [
-                            WCHAR_LINK=" -lw"
-                            WCSLEN_FOUND=1
-                        ])
-        fi
-    fi
+dnl check for wcslen in all possible places
+WCSLEN_FOUND=0
+WCHAR_LINK=
+AC_CHECK_FUNCS(wcslen, WCSLEN_FOUND=1)
 
-    if test "$WCSLEN_FOUND" = 1; then
-        AC_DEFINE(HAVE_WCSLEN)
+if test "$WCSLEN_FOUND" = 0; then
+    if test "$TOOLKIT" = "MSW"; then
+        AC_CHECK_LIB(msvcrt, wcslen, WCHAR_OK=1)
+    else
+        AC_CHECK_LIB(w, wcslen, [
+                        WCHAR_LINK=" -lw"
+                        WCSLEN_FOUND=1
+                    ])
     fi
+fi
 
-    AC_CHECK_FUNCS([wcsdup])
+if test "$WCSLEN_FOUND" = 1; then
+    AC_DEFINE(HAVE_WCSLEN)
+fi
 
-    dnl On HP-UX aCC need this define to find mbstrtowcs() &c
-    dnl Can't be used for g++ since the mbstate_t in wchar.h can conflict
-    dnl with g++'s in <cwchar> (unless -D_INCLUDE__STDC_A1_SOURCE is in the
-    dnl flags when g++ is configured, it will declare it's own).
-    if test "$USE_HPUX" = 1 -a "$GCC" != "yes"; then
-        CPPFLAGS="-D_INCLUDE__STDC_A1_SOURCE $CPPFLAGS"
-    fi
+AC_CHECK_FUNCS([wcsdup wcsftime strnlen wcsnlen wcscasecmp wcsncasecmp])
 
-    dnl Try to use wcsrtombs instead of wcstombs which is buggy in old GNU
-    dnl libc versions if possible. AC_CHECK_FUNCS only checks it's in the
-    dnl library, not the header, so do a header check for mbstate_t first.
-    AC_CHECK_TYPES([mbstate_t],
-                   [AC_CHECK_FUNCS(wcsrtombs)],
-                   [],
-                   [#include <wchar.h>])
-else
-    AC_MSG_WARN([Wide character support is unavailable])
+dnl On HP-UX aCC need this define to find mbstrtowcs() &c
+dnl Can't be used for g++ since the mbstate_t in wchar.h can conflict
+dnl with g++'s in <cwchar> (unless -D_INCLUDE__STDC_A1_SOURCE is in the
+dnl flags when g++ is configured, it will declare its own).
+if test "$USE_HPUX" = 1 -a "$GCC" != "yes"; then
+    CPPFLAGS="-D_INCLUDE__STDC_A1_SOURCE $CPPFLAGS"
 fi
 
+dnl Try to use wcsrtombs instead of wcstombs which is buggy in old GNU
+dnl libc versions if possible. AC_CHECK_FUNCS only checks it's in the
+dnl library, not the header, so do a header check for mbstate_t first.
+AC_CHECK_TYPES([mbstate_t],
+               [AC_CHECK_FUNCS(wcsrtombs)],
+               [],
+               [#include <wchar.h>])
+
 dnl check for vsnprintf() -- a safe version of vsprintf())
 dnl
-dnl the trouble here is that on some systems (e.g HP-UX 10) this function is
+dnl the trouble here is that on some systems (e.g. HP-UX 10) this function is
 dnl present in libc but not in the system headers and so AC_CHECK_FUNCS (which,
 dnl stupidly, provides a dummy function declaration inside its extension)
 dnl succeeds, even with C++ compiler, but the compilation of wxWidgets fails
@@ -4115,19 +4136,11 @@ if test "$ac_cv_func_vsnprintf" = "yes"; then
     AC_CACHE_CHECK([for vsnprintf declaration], wx_cv_func_vsnprintf_decl,
         [
             dnl our troubles are not over: HP-UX 11 prototypes vsnprintf() as
-            dnl taking "char *" and not "const char *" while Metrowerks does
-            dnl provide a correct vsnprintf declaration but in C++ mode it's
-            dnl always in std namespace and so we have to bring it in scope
+            dnl taking "char *" and not "const char *" so test for this too
             AC_TRY_COMPILE(
                 [
                     #include <stdio.h>
                     #include <stdarg.h>
-                    #ifdef __MSL__
-                    #if __MSL__ >= 0x6000
-                    namespace std {}
-                    using namespace std;
-                    #endif
-                    #endif
                 ],
                 [
                     char *buf;
@@ -4362,41 +4375,48 @@ dnl backtrace() and backtrace_symbols() for wxStackWalker
 if test "$wxUSE_STACKWALKER" = "yes" -a "$wxUSE_UNIX" = "yes"; then
     AC_CACHE_CHECK([for backtrace() in <execinfo.h>], wx_cv_func_backtrace,
         [
-            AC_LANG_PUSH(C++)
-            AC_TRY_COMPILE([#include <execinfo.h>],
+            AC_SEARCH_LIBS(backtrace, execinfo,
                 [
-                    void *trace[1];
-                    char **messages;
-
-                    backtrace(trace, 1);
-                    messages = backtrace_symbols(trace, 1);
+                    AC_LANG_PUSH(C++)
+                    AC_TRY_LINK([#include <execinfo.h>],
+                        [
+                            void *trace[1];
+                            char **messages;
+                            backtrace(trace, 1);
+                            messages = backtrace_symbols(trace, 1);
+                        ],
+                        wx_cv_func_backtrace=yes,
+                        wx_cv_func_backtrace=no
+                    )
+                    AC_LANG_POP()
                 ],
-                wx_cv_func_backtrace=yes,
                 wx_cv_func_backtrace=no
             )
-            AC_LANG_POP()
         ]
     )
 
-
     if test "$wx_cv_func_backtrace" = "no"; then
         AC_MSG_WARN([backtrace() is not available, wxStackWalker will not be available])
         wxUSE_STACKWALKER=no
     else
-        AC_CACHE_CHECK([for __cxa_demangle() in <cxxabi.h>], wx_cv_func_cxa_demangle,
-            [
-                AC_LANG_PUSH(C++)
-                AC_TRY_LINK([#include <cxxabi.h>],
-                    [
-                        int rc;
-                        __cxxabiv1::__cxa_demangle("foo", 0, 0, &rc);
-                    ],
-                    wx_cv_func_cxa_demangle=yes,
-                    wx_cv_func_cxa_demangle=no
-                )
-                AC_LANG_POP()
-            ]
-        )
+        if test "$ac_cv_header_cxxabi_h" = "yes"; then
+            AC_CACHE_CHECK([for __cxa_demangle() in <cxxabi.h>], wx_cv_func_cxa_demangle,
+                [
+                    AC_LANG_PUSH(C++)
+                    AC_TRY_LINK([#include <cxxabi.h>],
+                        [
+                            int rc;
+                            __cxxabiv1::__cxa_demangle("foo", 0, 0, &rc);
+                        ],
+                        wx_cv_func_cxa_demangle=yes,
+                        wx_cv_func_cxa_demangle=no
+                    )
+                    AC_LANG_POP()
+                ]
+            )
+        else
+            wx_cv_func_cxa_demangle=no
+        fi
 
         if test "$wx_cv_func_cxa_demangle" = "yes"; then
             AC_DEFINE(HAVE_CXA_DEMANGLE)
@@ -4761,6 +4781,12 @@ if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
                 fi
                 ;;
 
+          *-*-qnx*)
+                dnl under QNX thread functions are in libc so we don't need any
+                dnl special options to link with them
+                THREAD_OPTS=""
+                ;;
+
           *-*-*UnixWare*)
                 dnl flying by man pages here: Caldera online docs use this
                 if test "x$GCC" != "xyes"; then
@@ -4769,10 +4795,22 @@ if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
                 ;;
         esac
 
-        dnl simply linking with libpthread should make the test below work but
-        dnl it's far from certain that the threaded programs compiled without
-        dnl any special switches actually work, so try it after all the others
-        THREAD_OPTS="$THREAD_OPTS pthread none"
+        case "${host}" in
+            *-*-qnx*)
+                dnl -lpthread works, i.e. AC_TRY_LINK() would pass, but results
+                dnl in warnings and is not needed under QNX so try without it
+                dnl first
+                THREAD_OPTS="none pthread"
+                ;;
+
+            *)
+                dnl simply linking with libpthread should make the test below
+                dnl work but it's far from certain that the threaded programs
+                dnl compiled without any special switches actually work, so try
+                dnl it after all the others
+                THREAD_OPTS="$THREAD_OPTS pthread none"
+                ;;
+        esac
 
         dnl now test for all possibilities
         THREADS_OK=no
@@ -4820,7 +4858,14 @@ if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
       else
           dnl yes, these special compiler flags should be used with the
           dnl linker as well
+          dnl
+          dnl NB: add them to LDFLAGS immediately because we need them to be
+          dnl     used for the subsequent tests some of which can fail without
+          dnl     MT support, hence the reason for the duplication below:
+          dnl     adding them just to WXCONFIG_LDFLAGS and adding the entire
+          dnl     contents of the latter to LDFLAGS in the end is not enough.
           LDFLAGS="$THREADS_CFLAGS $LDFLAGS"
+          WXCONFIG_LDFLAGS="$THREADS_CFLAGS $WXCONFIG_LDFLAGS"
           LIBS="$THREADS_LINK $LIBS"
 
           AC_MSG_CHECKING([if more special flags are required for pthreads])
@@ -4834,6 +4879,7 @@ if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
                 dnl     search path should include -L/usr/lib/threads at the
                 dnl     beginning of the path.
                 LDFLAGS="-L/usr/lib/threads $LDFLAGS"
+                WXCONFIG_LDFLAGS="-L/usr/lib/threads $WXCONFIG_LDFLAGS"
                 flag="-D_THREAD_SAFE"
                 ;;
             *-freebsd*)
@@ -4862,7 +4908,13 @@ if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
 
     dnl do other tests only if we are using threads
     if test "$wxUSE_THREADS" = "yes" ; then
-      AC_CHECK_FUNCS(thr_setconcurrency)
+        AC_CHECK_FUNCS(pthread_setconcurrency,
+            AC_DEFINE(HAVE_PTHREAD_SET_CONCURRENCY),
+            [
+                AC_CHECK_FUNCS(thr_setconcurrency,
+                    AC_DEFINE(HAVE_THR_SETCONCURRENCY),
+                    AC_MSG_WARN(Setting thread concurrency will not work properly))
+            ])
 
       dnl can't use AC_CHECK_FUNCS for this one as it's usually a macro and so
       dnl wouldn't be found by it
@@ -5006,23 +5058,82 @@ if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
         fi
       fi
 
-      dnl test for compiler thread-specific variables support
-      AC_CACHE_CHECK([for __thread keyword],
-                     wx_cv_cc___thread,
-      [
-          AC_TRY_COMPILE([#include <pthread.h>],
+      if test "$wxUSE_COMPILER_TLS" = "auto"; then
+          if test "$USE_NETBSD" = 1; then
+              AC_MSG_WARN([Disabling TLS under NetBSD, please contact wx-dev if it works now])
+              wxUSE_COMPILER_TLS=no
+          else
+              wxUSE_COMPILER_TLS=yes
+          fi
+      fi
+
+      if test "$wxUSE_COMPILER_TLS" = "yes"; then
+          dnl test for compiler thread-specific variables support
+          AC_CACHE_CHECK([for __thread keyword],
+                         wx_cv_cc___thread,
               [
-                  static __thread int n = 0;
-                  static __thread int *p = 0;
-              ],
-              wx_cv_cc___thread=yes,
-              wx_cv_cc___thread=no
+                  AC_TRY_COMPILE([#include <pthread.h>],
+                      [
+                          static __thread int n = 0;
+                          static __thread int *p = 0;
+                      ],
+                      wx_cv_cc___thread=yes,
+                      wx_cv_cc___thread=no
+                  )
+              ]
           )
-      ])
 
-      if test "$wx_cv_cc___thread" = "yes"; then
-        AC_DEFINE(HAVE___THREAD_KEYWORD)
-      fi
+          if test "$wx_cv_cc___thread" = "yes"; then
+              AX_GXX_VERSION
+              if test -n "$ax_cv_gxx_version"; then
+                  dnl g++ supports __thread since at least version 3.3 but its support
+                  dnl seems to be broken until 4.1, see
+                  dnl   http://thread.gmane.org/gmane.comp.lib.wxwidgets.devel/108388
+                  dnl
+                  dnl NB: we still need to test __thread support with
+                  dnl     AC_TRY_COMPILE above even for g++ 4 as it doesn't
+                  dnl     support it for all architectures (e.g. it doesn't
+                  dnl     work under OS X)
+                  AC_MSG_CHECKING([whether __thread support in g++ is usable])
+                  case "$ax_cv_gxx_version" in
+                    1.* | 2.* | 3.* )
+                        AC_MSG_RESULT([no, it's broken])
+                        wx_cv_cc___thread=no
+                        ;;
+                    *)
+                        AC_MSG_RESULT([yes, it works])
+                        ;;
+                  esac
+              fi
+          fi
+
+          if test "$wx_cv_cc___thread" = "yes"; then
+            AC_DEFINE(HAVE___THREAD_KEYWORD)
+          fi
+        fi
+
+        if test "$ac_cv_header_cxxabi_h" = "yes"; then
+            AC_CACHE_CHECK([for abi::__forced_unwind() in <cxxabi.h>],
+                wx_cv_type_abi_forced_unwind,
+                [
+                    AC_LANG_PUSH(C++)
+                    AC_TRY_COMPILE([#include <cxxabi.h>],
+                        [
+                            void foo(abi::__forced_unwind&);
+                        ],
+                        wx_cv_type_abi_forced_unwind=yes,
+                        wx_cv_type_abi_forced_unwind=no
+                    )
+                    AC_LANG_POP()
+                ]
+            )
+        else
+            wx_cv_type_abi_forced_unwind=no
+        fi
+
+        if test "$wx_cv_type_abi_forced_unwind" = "yes"; then
+            AC_DEFINE(HAVE_ABI_FORCEDUNWIND)
+        fi
     fi
 
 dnl from if !MSW
@@ -5097,6 +5208,10 @@ dnl AC_CHECK_FUNC(getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO), [
 dnl    ]
 dnl )
 
+dnl This is currently always defined under Unix, there is no reason to ever
+dnl disable compiler TLS support there.
+AC_DEFINE(wxUSE_COMPILER_TLS)
+
 if test "$wxUSE_THREADS" = "yes"; then
   AC_DEFINE(wxUSE_THREADS)
 
@@ -5115,13 +5230,12 @@ else
   fi
 fi
 
+if test "$WXGTK3" = 1 ; then
+    AC_DEFINE_UNQUOTED(__WXGTK3__, 1)
+    WXGTK2=1
+fi
 if test "$WXGTK2" = 1 ; then
   AC_DEFINE_UNQUOTED(__WXGTK20__,$WXGTK2)
-  WXGTK12=1
-fi
-
-if test "$WXGTK12" = 1 ; then
-  AC_DEFINE_UNQUOTED(__WXGTK12__,$WXGTK12)
 fi
 
 if test "$WXGTK127" = 1 ; then
@@ -5135,7 +5249,13 @@ fi
 dnl DEBUG_CFLAGS contains debugging options (supposed to be the same for C and C++
 dnl compilers: we'd need a separate DEBUG_CXXFLAGS if this is ever not the case)
 DEBUG_CFLAGS=
-if test "$wxUSE_DEBUG_INFO" = "yes" ; then
+if `echo $CXXFLAGS $CFLAGS | grep " -g" >/dev/null`; then
+    dnl the CXXFLAGS or the CFLAGS variable already contains the -g flag
+    dnl (e.g. it was specified by the user before running configure); since
+    dnl later they will be merged with DEBUG_CFLAGS, don't set the -g option
+    dnl in DEBUG_CFLAGS to avoid (possibly different) flag duplicates
+    AC_MSG_WARN([CXXFLAGS/CFLAGS already contains -g flag; ignoring the --enable-debug_info option])
+elif test "$wxUSE_DEBUG_INFO" = "yes" ; then
     DEBUG_CFLAGS="-g"
 fi
 
@@ -5146,12 +5266,13 @@ if test "$wxUSE_DEBUG_GDB" = "yes" ; then
     fi
 fi
 
-if test "$wxUSE_DEBUG_FLAG" = "yes" ; then
-    AC_DEFINE(WXDEBUG)
-    WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS -D__WXDEBUG__"
-else
+if test "$wxUSE_DEBUG_FLAG" = "no" ; then
+    WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS -DwxDEBUG_LEVEL=0"
+
     if test "$wxUSE_GTK" = 1 ; then
-        if test "x$wxGTK_VERSION" = "x1" ; then
+        if test "$WXGTK2" = 1 ; then
+            CPPFLAGS="$CPPFLAGS -DG_DISABLE_CAST_CHECKS"
+        else
             CPPFLAGS="-DGTK_NO_CHECK_CASTS $CPPFLAGS"
         fi
     fi
@@ -5176,7 +5297,10 @@ fi
 
 if test "$GCC" = "yes" ; then
     if test "$wxUSE_NO_RTTI" = "yes" ; then
-        WXCONFIG_CXXFLAGS="$WXCONFIG_CXXFLAGS -fno-rtti"
+        dnl Define wxNO_RTTI on the command line because only g++ 4.3 and later
+        dnl define __GXX_RTTI which allows us to detect the use of -fno-rtti
+        dnl switch but we need to do it manually for the older versions.
+        WXCONFIG_CXXFLAGS="$WXCONFIG_CXXFLAGS -DwxNO_RTTI -fno-rtti"
     fi
     if test "$wxUSE_NO_EXCEPTIONS" = "yes" ; then
         WXCONFIG_CXXFLAGS="$WXCONFIG_CXXFLAGS -fno-exceptions"
@@ -5208,29 +5332,37 @@ fi
 
 dnl C/C++ compiler option for optimization (supposed to be the same for both)
 OPTIMISE_CFLAGS=
-if test "$wxUSE_OPTIMISE" = "no" ; then
-    if test "$GCC" = yes ; then
-        dnl use -O0 because compiling with it is faster than compiling with no
-        dnl optimization options at all (at least with g++ 3.2)
-        OPTIMISE_CFLAGS="-O0"
-    fi
+if `echo $CXXFLAGS $CFLAGS | grep " -O" >/dev/null`; then
+    dnl the CXXFLAGS or the CFLAGS variable already contains -O optimization flag
+    dnl (e.g. it was specified by the user before running configure); since
+    dnl later they will be merged with OPTIMISE_CFLAGS, don't set the -O option
+    dnl in OPTIMISE_CFLAGS to avoid (possibly different) flag duplicates
+    AC_MSG_WARN([CXXFLAGS/CFLAGS already contains -O flag; ignoring the --disable-optimise option])
 else
-    if test "$GCC" = yes ; then
-        case "${host}" in
-            *-pc-os2_emx | *-pc-os2-emx )
-                dnl Not all of the supported gcc versions understand
-                dnl -fstrict-aliasing and none actually needs it (yet).
-                OPTIMISE_CFLAGS="-O2"
-            ;;
-            *)
-                dnl Switch on optimisation but keep strict-aliasing off for
-                dnl now (see -fstrict-aliasing in the gcc manual). When it is
-                dnl switched back on consider using -Wstrict-aliasing=2.
-                OPTIMISE_CFLAGS="-O2 -fno-strict-aliasing"
-            ;;
-        esac
+    if test "$wxUSE_OPTIMISE" = "no" ; then
+        if test "$GCC" = yes ; then
+            dnl use -O0 because compiling with it is faster than compiling with no
+            dnl optimization options at all (at least with g++ 3.2)
+            OPTIMISE_CFLAGS="-O0"
+        fi
     else
-        OPTIMISE_CFLAGS="-O"
+        if test "$GCC" = yes ; then
+            case "${host}" in
+                *-pc-os2_emx | *-pc-os2-emx )
+                    dnl Not all of the supported gcc versions understand
+                    dnl -fstrict-aliasing and none actually needs it (yet).
+                    OPTIMISE_CFLAGS="-O2"
+                ;;
+                *)
+                    dnl Switch on optimisation but keep strict-aliasing off for
+                    dnl now (see -fstrict-aliasing in the gcc manual). When it is
+                    dnl switched back on consider using -Wstrict-aliasing=2.
+                    OPTIMISE_CFLAGS="-O2 -fno-strict-aliasing"
+                ;;
+            esac
+        else
+            OPTIMISE_CFLAGS="-O"
+        fi
     fi
 fi
 
@@ -5381,6 +5513,45 @@ if test "$wxUSE_PLUGINS" = "yes" ; then
     fi
 fi
 
+dnl ---------------------------------------------------------------------------
+dnl File system watcher checks
+dnl ---------------------------------------------------------------------------
+
+if test "$wxUSE_FSWATCHER" = "yes"; then
+    dnl wxFileSystemWatcher is always available under MSW but we need either
+    dnl inotify or kqueue support in the system for it under Unix (this
+    dnl includes OS X which does have kqueue but no other platforms)
+    if test "$wxUSE_MSW" != "1"; then
+        if test "$wxUSE_UNIX" = "yes"; then
+            AC_CHECK_HEADERS(sys/inotify.h,,, [AC_INCLUDES_DEFAULT()])
+            if test "$ac_cv_header_sys_inotify_h" = "yes"; then
+                AC_DEFINE(wxHAS_INOTIFY)
+            else
+                AC_CHECK_HEADERS(sys/event.h,,, [AC_INCLUDES_DEFAULT()])
+                if test "$ac_cv_header_sys_event_h" = "yes"; then
+                    AC_DEFINE(wxHAS_KQUEUE)
+                else
+                    wxUSE_FSWATCHER=no
+                fi
+            fi
+        else
+            wxUSE_FSWATCHER=no
+        fi
+    else
+        if test "$wxUSE_THREADS" != "yes"; then
+            AC_MSG_WARN([wxFileSystemWatcher disabled due to --disable-threads])
+            wxUSE_FSWATCHER=no
+        fi
+    fi
+
+    if test "$wxUSE_FSWATCHER" = "yes"; then
+        AC_DEFINE(wxUSE_FSWATCHER)
+        SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS fswatcher"
+    else
+        AC_MSG_WARN([wxFileSystemWatcher won't be available on this platform])
+    fi
+fi
+
 dnl ---------------------------------------------------------------------------
 dnl Register non-GUI class options for makefiles and setup.h
 dnl ---------------------------------------------------------------------------
@@ -5393,51 +5564,52 @@ if test "$wxUSE_EXTENDED_RTTI" = "yes"; then
   AC_DEFINE(wxUSE_EXTENDED_RTTI)
 fi
 
-if test "$wxUSE_APPLE_IEEE" = "yes"; then
-  AC_DEFINE(wxUSE_APPLE_IEEE)
+if test "$wxUSE_ANY" = "yes"; then
+    AC_DEFINE(wxUSE_ANY)
 fi
 
-if test "$wxUSE_TIMER" = "yes"; then
-  AC_DEFINE(wxUSE_TIMER)
+if test "$wxUSE_APPLE_IEEE" = "yes"; then
+  AC_DEFINE(wxUSE_APPLE_IEEE)
 fi
 
-dnl Unix implementation needs additional checks because audio support
-dnl comes in many favours:
-if test "$USE_UNIX" = 1 ; then
-    dnl mmedia doesn't compile with wxMGL, remove this if this is ever fixed
-    if test "$wxUSE_MGL" != 1; then
-        dnl it's not enough to check for just the header because OSS under NetBSD
-        dnl redefines ioctl as oss_ioctrl inside it and so we also need to test
-        dnl whether we need -lossaudio at link-time
-        AC_CACHE_CHECK([for SNDCTL_DSP_SPEED in sys/soundcard.h], ac_cv_header_sys_soundcard, [
-            AC_TRY_LINK([
-                    #include <sys/ioctl.h>
-                    #include <sys/soundcard.h>
-                ],
-                [
-                    ioctl(0, SNDCTL_DSP_SPEED, 0);
-                ],
-                ac_cv_header_sys_soundcard=yes,
-                [
-                    saveLibs="$LIBS"
-                    LIBS="$saveLibs -lossaudio"
-                    AC_TRY_LINK([
-                            #include <sys/ioctl.h>
-                            #include <sys/soundcard.h>
-                        ],
-                        [
-                            ioctl(0, SNDCTL_DSP_SPEED, 0);
-                        ],
-                        ac_cv_header_sys_soundcard=yes,
-                        [
-                            LIBS="$saveLibs"
-                            ac_cv_header_sys_soundcard=no
-                        ]
-                    )
-                ]
-            )
-        ])
-    fi
+if test "$wxUSE_TIMER" = "yes"; then
+  AC_DEFINE(wxUSE_TIMER)
+fi
+
+dnl Unix implementation needs additional checks because audio support
+dnl comes in many favours:
+if test "$USE_UNIX" = 1 ; then
+    dnl it's not enough to check for just the header because OSS under NetBSD
+    dnl redefines ioctl as oss_ioctrl inside it and so we also need to test
+    dnl whether we need -lossaudio at link-time
+    AC_CACHE_CHECK([for SNDCTL_DSP_SPEED in sys/soundcard.h], ac_cv_header_sys_soundcard, [
+        AC_TRY_LINK([
+                #include <sys/ioctl.h>
+                #include <sys/soundcard.h>
+            ],
+            [
+                ioctl(0, SNDCTL_DSP_SPEED, 0);
+            ],
+            ac_cv_header_sys_soundcard=yes,
+            [
+                saveLibs="$LIBS"
+                LIBS="$saveLibs -lossaudio"
+                AC_TRY_LINK([
+                        #include <sys/ioctl.h>
+                        #include <sys/soundcard.h>
+                    ],
+                    [
+                        ioctl(0, SNDCTL_DSP_SPEED, 0);
+                    ],
+                    ac_cv_header_sys_soundcard=yes,
+                    [
+                        LIBS="$saveLibs"
+                        ac_cv_header_sys_soundcard=no
+                    ]
+                )
+            ]
+        )
+    ])
 
     if test "$ac_cv_header_sys_soundcard" = "yes"; then
         AC_DEFINE(HAVE_SYS_SOUNDCARD_H)
@@ -5460,12 +5632,6 @@ if test "$wxUSE_SOUND" = "yes"; then
         WITH_PLUGIN_SDL=1
       fi
     fi
-  else
-    dnl wxMGL doesn't support sound under DOS, only under Unix
-    if test "$wxUSE_MGL" = 1; then
-        AC_MSG_WARN([wxSound not supported in MGL under DOS... disabled])
-        wxUSE_SOUND="no"
-    fi
   fi
 fi
 
@@ -5480,10 +5646,15 @@ if test "$WXGTK2" = 1; then
     if test "$wxUSE_PRINTING_ARCHITECTURE" = "yes" ; then
 
         if test "$wxUSE_GTKPRINT" = "yes" ; then
-
+            if test "$WXGTK3" = 1; then
+                gtk_unix_print="gtk+-unix-print-3.0"
+            else
+                gtk_unix_print="gtk+-unix-print-2.0 >= 2.10"
+            fi
                 PKG_CHECK_MODULES(GTKPRINT,
-                                  [gtk+-unix-print-2.0 >= 2.10],
+                                  [$gtk_unix_print],
                     [
+                        GUI_TK_LIBRARY="$GUI_TK_LIBRARY $GTKPRINT_LIBS"
                         CFLAGS="$GTKPRINT_CFLAGS $CFLAGS"
                         CXXFLAGS="$GTKPRINT_CFLAGS $CXXFLAGS"
                         AC_DEFINE(wxUSE_GTKPRINT)
@@ -5495,17 +5666,26 @@ if test "$WXGTK2" = 1; then
                 )
         fi
 
+        if test "$WXGTK3" = 1; then
+            wxUSE_LIBGNOMEPRINT=no
+        fi
+
         if test "$wxUSE_LIBGNOMEPRINT" = "yes" ; then
 
                 PKG_CHECK_MODULES(LIBGNOMEPRINTUI,
                                   [libgnomeprintui-2.2 >= 2.8],
                     [
+                        GUI_TK_LIBRARY="$GUI_TK_LIBRARY $LIBGNOMEPRINTUI_LIBS"
                         CFLAGS="$LIBGNOMEPRINTUI_CFLAGS $CFLAGS"
                         CXXFLAGS="$LIBGNOMEPRINTUI_CFLAGS $CXXFLAGS"
                         AC_DEFINE(wxUSE_LIBGNOMEPRINT)
                     ],
                     [
-                        AC_MSG_WARN([libgnomeprintui not found, library will use standard PostScript printing])
+                        if test "$wxUSE_GTKPRINT" = yes; then
+                            AC_MSG_RESULT(no)
+                        else
+                            AC_MSG_WARN([libgnomeprintui not found, library will use standard PostScript printing])
+                        fi
                         wxUSE_LIBGNOMEPRINT="no"
                     ]
                 )
@@ -5518,6 +5698,7 @@ if test "$WXGTK2" = 1; then
                 PKG_CHECK_MODULES(GNOMEVFS,
                                   [gnome-vfs-2.0 >= 2.0],
                     [
+                        GUI_TK_LIBRARY="$GUI_TK_LIBRARY $GNOMEVFS_LIBS"
                         CFLAGS="$GNOMEVFS_CFLAGS $CFLAGS"
                         CXXFLAGS="$GNOMEVFS_CFLAGS $CXXFLAGS"
                         AC_DEFINE(wxUSE_LIBGNOMEVFS)
@@ -5530,20 +5711,63 @@ if test "$WXGTK2" = 1; then
         fi
     fi
 
+    if test "$wxUSE_NOTIFICATION_MESSAGE" = "yes" ; then
+        if test "$wxUSE_LIBNOTIFY" = "yes" ; then
+            HAVE_LIBNOTIFY=0
+            PKG_CHECK_MODULES(LIBNOTIFY, [libnotify >= 0.7],
+                [
+                    HAVE_LIBNOTIFY=1
+                    AC_DEFINE(wxUSE_LIBNOTIFY_0_7)
+                ],
+                [
+                    PKG_CHECK_MODULES(LIBNOTIFY, [libnotify >= 0.4],
+                        [HAVE_LIBNOTIFY=1],
+                        [AC_MSG_WARN([libnotify not found, wxNotificationMessage will use generic implementation.])]
+                    )
+                ]
+            )
+
+            if test "$HAVE_LIBNOTIFY" = "1" ; then
+                GUI_TK_LIBRARY="$GUI_TK_LIBRARY $LIBNOTIFY_LIBS"
+                CFLAGS="$LIBNOTIFY_CFLAGS $CFLAGS"
+                CXXFLAGS="$LIBNOTIFY_CFLAGS $CXXFLAGS"
+                AC_DEFINE(wxUSE_LIBNOTIFY)
+            fi
+        fi
+    fi
+
     if test "$wxUSE_LIBHILDON" = "yes" ; then
         PKG_CHECK_MODULES(HILDON,
                           [hildon-lgpl >= 0.9],
             [
-                EXTRALIBS_HILDON="$HILDON_LIBS"
+                GUI_TK_LIBRARY="$GUI_TK_LIBRARY $HILDON_LIBS"
                 CFLAGS="$CFLAGS $HILDON_CFLAGS"
                 CXXFLAGS="$CXXFLAGS $HILDON_CFLAGS"
                 AC_DEFINE(wxUSE_LIBHILDON)
+                ac_hildon_lgpl=1
             ],
             [
                 AC_MSG_WARN([libhildon_lgpl not found])
                         wxUSE_LIBHILDON="no"
+                        ac_hildon_lgpl=0
             ]
         )
+
+        if test "$ac_hildon_lgpl" = 0 ; then
+            PKG_CHECK_MODULES(HILDON2,
+                              [hildon-1 >= 1.99],
+                [
+                    GUI_TK_LIBRARY="$GUI_TK_LIBRARY $HILDON2_LIBS"
+                    CFLAGS="$CFLAGS $HILDON2_CFLAGS"
+                    CXXFLAGS="$CXXFLAGS $HILDON2_CFLAGS"
+                    AC_DEFINE(wxUSE_LIBHILDON2)
+                ],
+                [
+                    AC_MSG_WARN([libhildon_1 not found])
+                            wxUSE_LIBHILDON2="no"
+                ]
+            )
+        fi
     fi
 fi
 
@@ -5594,6 +5818,10 @@ if test "$wxUSE_TARSTREAM" = "yes"; then
   fi
 fi
 
+if test "$wxUSE_FILE_HISTORY" = "yes"; then
+  AC_DEFINE(wxUSE_FILE_HISTORY)
+fi
+
 if test "$wxUSE_FILESYSTEM" = "yes"; then
   if test "$wxUSE_STREAMS" != yes -o \( "$wxUSE_FILE" != yes -a "$wxUSE_FFILE" != yes \); then
     AC_MSG_WARN(wxFileSystem requires wxStreams and wxFile or wxFFile... disabled)
@@ -5619,6 +5847,10 @@ if test "$wxUSE_FS_ZIP" = "yes"; then
   fi
 fi
 
+if test "$wxUSE_FSVOLUME" = "yes"; then
+  AC_DEFINE(wxUSE_FSVOLUME)
+fi
+
 if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes"; then
   if test "$USE_UNIX" != 1; then
     AC_MSG_WARN([Catching fatal exceptions not currently supported on this system, wxApp::OnFatalException will not be called])
@@ -5652,6 +5884,24 @@ if test "$wxUSE_BUSYINFO" = "yes"; then
   AC_DEFINE(wxUSE_BUSYINFO)
 fi
 
+if test "$wxUSE_HOTKEY" = "yes"; then
+  if test "$wxUSE_MSW" != 1 -a "$wxUSE_OSX_COCOA" != 1 -a "$wxUSE_OSX_CARBON" != 1; then
+    AC_MSG_WARN([Hot keys not supported by the current toolkit, disabled])
+    wxUSE_HOTKEY=no
+  fi
+elif test "$wxUSE_HOTKEY" = "auto"; then
+  if test "$wxUSE_MSW" = 1 -o "$wxUSE_OSX_COCOA" = 1 -o "$wxUSE_OSX_CARBON" = 1; then
+    wxUSE_HOTKEY=yes
+  fi
+fi
+if test "$wxUSE_HOTKEY" = "yes"; then
+  AC_DEFINE(wxUSE_HOTKEY)
+fi
+
+if test "$wxUSE_STD_CONTAINERS" = "yes"; then
+  AC_DEFINE(wxUSE_STD_CONTAINERS)
+fi
+
 if test "$wxUSE_STD_IOSTREAM" = "yes"; then
   AC_DEFINE(wxUSE_STD_IOSTREAM)
 fi
@@ -5660,6 +5910,10 @@ if test "$wxUSE_STD_STRING" = "yes"; then
   AC_DEFINE(wxUSE_STD_STRING)
 fi
 
+if test "$wxUSE_STD_STRING_CONV_IN_WXSTRING" = "yes"; then
+  AC_DEFINE(wxUSE_STD_STRING_CONV_IN_WXSTRING)
+fi
+
 if test "$wxUSE_STDPATHS" = "yes"; then
   AC_DEFINE(wxUSE_STDPATHS)
 fi
@@ -5696,7 +5950,7 @@ if test "$wxUSE_INTL" = "yes" ; then
   fi
 fi
 
-if test "$wxUSE_XLOCALE" == "yes" ; then
+if test "$wxUSE_XLOCALE" = "yes" ; then
     AC_DEFINE(wxUSE_XLOCALE)
     AC_CHECK_TYPES(locale_t,,,
                    [#include <xlocale.h>
@@ -5816,65 +6070,6 @@ if test "$ac_cv_func_gettimeofday" = "yes"; then
 fi
 
 if test "$wxUSE_DATETIME" = "yes"; then
-    dnl check for strptime and for its declaration as some systems lack it
-    AC_CHECK_FUNC(strptime)
-    if test "$ac_cv_func_strptime" = "yes"; then
-        AC_CACHE_CHECK([for strptime declaration], wx_cv_func_strptime_decl,
-            [
-                AC_LANG_PUSH(C++)
-                AC_TRY_COMPILE(
-                    [
-                        #include <time.h>
-                    ],
-                    [
-                        struct tm t;
-                        strptime("foo", "bar", &t);
-                    ],
-                    wx_cv_func_strptime_decl=yes,
-                    wx_cv_func_strptime_decl=no
-                )
-                AC_LANG_POP()
-            ]
-        )
-    fi
-    if test "$wx_cv_func_strptime_decl" = "yes"; then
-        AC_DEFINE(HAVE_STRPTIME_DECL)
-    else
-        wx_strptime_decl="extern char *strptime(const char *, const char *, struct tm *);"
-    fi
-    if test "$ac_cv_func_strptime" = "yes"; then
-        dnl strptime() behaviour doesn't conform to POSIX under Mac OS X <
-        dnl 10.5 and possibly other BSD variants, check that strptime() we
-        dnl have fails to parse format when the string doesn't match it instea
-        dnl of just stopping immediately and returning non-NULL
-        AC_CACHE_CHECK([whether strptime() fails on invalid strings],
-            wx_cv_func_strptime_ok,
-            [AC_RUN_IFELSE(
-                [
-                    #include <stdlib.h>
-                    #include <time.h>
-                    #include "confdefs.h"
-
-                    $wx_strptime_decl
-
-                    int main()
-                    {
-                        struct tm t;
-                        return !!strptime("", "%x", &t);
-                    }
-                ],
-                wx_cv_func_strptime_ok=yes,
-                wx_cv_func_strptime_ok=no,
-                dnl be pessimistic when cross-compiling
-                wx_cv_func_strptime_ok=no
-            )]
-        )
-
-        if test "$wx_cv_func_strptime_ok" = "yes"; then
-            AC_DEFINE(HAVE_STRPTIME)
-        fi
-    fi
-
     dnl check for timezone variable
     dnl   doesn't exist under Darwin / Mac OS X which uses tm_gmtoff instead
     AC_CACHE_CHECK(for timezone variable in <time.h>,
@@ -5966,16 +6161,14 @@ if test "$wxUSE_DATETIME" = "yes"; then
 fi
 
 dnl ------------------------------------------------------------------------
-dnl wxSocket
+dnl wxProcess
 dnl ------------------------------------------------------------------------
 
-dnl VZ: the GUI hooks wxSocket needs are not implemented yet in some toolkits
-if test "$wxUSE_SOCKETS" = "yes"; then
-    if test "$wxUSE_MGL" = 1; then
-        AC_MSG_WARN([wxSocket not yet supported under MGL... disabled])
-        wxUSE_SOCKETS="no"
-    fi
-fi
+AC_CHECK_FUNCS(setpriority)
+
+dnl ------------------------------------------------------------------------
+dnl wxSocket
+dnl ------------------------------------------------------------------------
 
 if test "$wxUSE_SOCKETS" = "yes"; then
     dnl under MSW we always have sockets
@@ -6231,16 +6424,13 @@ if test "$wxUSE_GUI" = "yes" -a "$wxUSE_JOYSTICK" = "yes"; then
 
     dnl joystick support is only for Linux 2.1.x or greater
     else
-        dnl wxJoystick not supported by wxMGL at all
-        if test "$wxUSE_MGL" != 1; then
-            dnl notice the dummy includes argument: without it, AC_CHECK_HEADER
-            dnl checks only whether the header can be preprocessed, not that it
-            dnl can be compiled and in Linux 2.6.16 joystick.h is present but
-            dnl can't be compiled because of an error and with the default
-            dnl AC_CHECK_HEADER semantics we'd still detect it in this case and
-            dnl build would fail later
-            AC_CHECK_HEADERS([linux/joystick.h], [wxUSE_JOYSTICK=yes],, [AC_INCLUDES_DEFAULT()])
-        fi
+        dnl notice the dummy includes argument: without it, AC_CHECK_HEADER
+        dnl checks only whether the header can be preprocessed, not that it
+        dnl can be compiled and in Linux 2.6.16 joystick.h is present but
+        dnl can't be compiled because of an error and with the default
+        dnl AC_CHECK_HEADER semantics we'd still detect it in this case and
+        dnl build would fail later
+        AC_CHECK_HEADERS([linux/joystick.h], [wxUSE_JOYSTICK=yes],, [AC_INCLUDES_DEFAULT()])
     fi
 
     if test "$wxUSE_JOYSTICK" = "yes"; then
@@ -6336,11 +6526,7 @@ if test "$wxUSE_HELP" = "yes"; then
 fi
 
 if test "$wxUSE_PRINTING_ARCHITECTURE" = "yes" ; then
-    if test "$wxUSE_CONSTRAINTS" != "yes"; then
-        AC_MSG_WARN(Printing support cannot be used without constraints so it won't be compiled without it)
-    else
-        AC_DEFINE(wxUSE_PRINTING_ARCHITECTURE)
-    fi
+    AC_DEFINE(wxUSE_PRINTING_ARCHITECTURE)
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS printing"
 fi
 
@@ -6355,7 +6541,7 @@ if test "$wxUSE_SVG" = "yes"; then
 fi
 
 dnl ---------------------------------------------------------------------------
-dnl wxMetafile availability
+dnl wxMetafile
 dnl ---------------------------------------------------------------------------
 
 if test "$wxUSE_METAFILE" = "yes"; then
@@ -6363,6 +6549,18 @@ if test "$wxUSE_METAFILE" = "yes"; then
         AC_MSG_WARN([wxMetafile is not available on this system... disabled])
         wxUSE_METAFILE=no
     fi
+elif test "$wxUSE_METAFILE" = "auto"; then
+    if test "$wxUSE_MSW" = 1 -o "$wxUSE_MAC" = 1 -o "$wxUSE_PM" = 1; then
+        wxUSE_METAFILE=yes
+    fi
+fi
+
+if test "$wxUSE_METAFILE" = "yes"; then
+    AC_DEFINE(wxUSE_METAFILE)
+    if test "$wxUSE_MSW" = 1; then
+        dnl this one should probably be made separately configurable
+        AC_DEFINE(wxUSE_ENH_METAFILE)
+    fi
 fi
 
 dnl ---------------------------------------------------------------------------
@@ -6407,13 +6605,6 @@ if test "$USE_WIN32" = 1 -a \( "$wxUSE_DATAOBJ"       = "yes" \
         wxUSE_DATAOBJ=no
         wxUSE_OLE=no
     fi
-
-    if test "$wxUSE_METAFILE" = "yes"; then
-        AC_DEFINE(wxUSE_METAFILE)
-
-        dnl this one should probably be made separately configurable
-        AC_DEFINE(wxUSE_ENH_METAFILE)
-    fi
 fi
 
 if test "$wxUSE_IPC" = "yes"; then
@@ -6429,12 +6620,7 @@ if test "$wxUSE_IPC" = "yes"; then
 fi
 
 if test "$wxUSE_DATAOBJ" = "yes"; then
-    if test "$wxUSE_MGL" = 1 -o "$wxUSE_DFB" = 1; then
-        AC_MSG_WARN([wxDataObject not yet supported under $TOOLKIT... disabled])
-        wxUSE_DATAOBJ=no
-    else
-        AC_DEFINE(wxUSE_DATAOBJ)
-    fi
+    AC_DEFINE(wxUSE_DATAOBJ)
 else
     AC_MSG_WARN([Clipboard and drag-and-drop require wxDataObject -- disabled])
     wxUSE_CLIPBOARD=no
@@ -6442,7 +6628,7 @@ else
 fi
 
 if test "$wxUSE_CLIPBOARD" = "yes"; then
-    if test "$wxUSE_MGL" = 1 -o "$wxUSE_DFB" = 1; then
+    if test "$wxUSE_DFB" = 1; then
         AC_MSG_WARN([Clipboard not yet supported under $TOOLKIT... disabled])
         wxUSE_CLIPBOARD=no
     fi
@@ -6453,15 +6639,7 @@ if test "$wxUSE_CLIPBOARD" = "yes"; then
 fi
 
 if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then
-    if test "$wxUSE_GTK" = 1; then
-        if test "$WXGTK12" != 1; then
-            AC_MSG_WARN([Drag and drop is only supported under GTK+ 1.2... disabled])
-            wxUSE_DRAG_AND_DROP=no
-        fi
-    fi
-
-    if test "$wxUSE_MOTIF" = 1 -o "$wxUSE_X11" = 1 -o "$wxUSE_MGL" = 1 -o \
-            "$wxUSE_DFB" = 1; then
+    if test "$wxUSE_MOTIF" = 1 -o "$wxUSE_X11" = 1 -o "$wxUSE_DFB" = 1; then
         AC_MSG_WARN([Drag and drop not yet supported under $TOOLKIT... disabled])
         wxUSE_DRAG_AND_DROP=no
     fi
@@ -6476,6 +6654,10 @@ if test "$wxUSE_DRAG_AND_DROP" = "yes" -o "$wxUSE_CLIPBOARD" = "yes"; then
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dnd"
 fi
 
+if test "$wxUSE_CLIPBOARD" = "yes"; then
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS clipboard"
+fi
+
 if test "$wxUSE_SPLINES" = "yes" ; then
   AC_DEFINE(wxUSE_SPLINES)
 fi
@@ -6484,6 +6666,15 @@ if test "$wxUSE_MOUSEWHEEL" = "yes" ; then
   AC_DEFINE(wxUSE_MOUSEWHEEL)
 fi
 
+if test "$wxUSE_UIACTIONSIMULATOR" = "yes" ; then
+    AC_DEFINE(wxUSE_UIACTIONSIMULATOR)
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS uiaction"
+fi
+
+if test "$wxUSE_DC_TRANSFORM_MATRIX" = "yes" ; then
+    AC_DEFINE(wxUSE_DC_TRANSFORM_MATRIX)
+fi
+
 dnl ---------------------------------------------------------------------------
 dnl GUI controls
 dnl ---------------------------------------------------------------------------
@@ -6493,6 +6684,10 @@ if test "$wxUSE_CONTROLS" = "yes"; then
   USES_CONTROLS=1
 fi
 
+if test "$wxUSE_MARKUP" = "yes"; then
+  AC_DEFINE(wxUSE_MARKUP)
+fi
+
 if test "$wxUSE_ACCEL" = "yes"; then
   AC_DEFINE(wxUSE_ACCEL)
   USES_CONTROLS=1
@@ -6504,6 +6699,10 @@ if test "$wxUSE_ANIMATIONCTRL" = "yes"; then
   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS animate"
 fi
 
+if test "$wxUSE_BANNERWINDOW" = "yes"; then
+  AC_DEFINE(wxUSE_BANNERWINDOW)
+fi
+
 if test "$wxUSE_BUTTON" = "yes"; then
   AC_DEFINE(wxUSE_BUTTON)
   USES_CONTROLS=1
@@ -6542,6 +6741,11 @@ if test "$wxUSE_COMBOCTRL" = "yes"; then
   USES_CONTROLS=1
 fi
 
+if test "$wxUSE_COMMANDLINKBUTTON" = "yes"; then
+  AC_DEFINE(wxUSE_COMMANDLINKBUTTON)
+  USES_CONTROLS=1
+fi
+
 if test "$wxUSE_CHOICE" = "yes"; then
   AC_DEFINE(wxUSE_CHOICE)
   USES_CONTROLS=1
@@ -6593,7 +6797,7 @@ if test "$wxUSE_FONTPICKERCTRL" = "yes"; then
 fi
 
 if test "$wxUSE_DISPLAY" = "yes"; then
-    if test "$wxUSE_DFB" = 1 -o "$wxUSE_MGL" = 1; then
+    if test "$wxUSE_DFB" = 1; then
         AC_MSG_WARN([wxDisplay not yet supported under $TOOLKIT... disabled])
         wxUSE_DISPLAY=no
     else
@@ -6617,6 +6821,11 @@ if test "$wxUSE_GRID" = "yes"; then
   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS grid"
 fi
 
+if test "$wxUSE_HEADERCTRL" = "yes"; then
+  AC_DEFINE(wxUSE_HEADERCTRL)
+  USES_CONTROLS=1
+fi
+
 if test "$wxUSE_HYPERLINKCTRL" = "yes"; then
   AC_DEFINE(wxUSE_HYPERLINKCTRL)
   USES_CONTROLS=1
@@ -6637,6 +6846,10 @@ if test "$wxUSE_IMAGLIST" = "yes"; then
     AC_DEFINE(wxUSE_IMAGLIST)
 fi
 
+if test "$wxUSE_INFOBAR" = "yes"; then
+    AC_DEFINE(wxUSE_INFOBAR)
+fi
+
 if test "$wxUSE_LISTBOOK" = "yes"; then
     AC_DEFINE(wxUSE_LISTBOOK)
     USES_CONTROLS=1
@@ -6660,7 +6873,6 @@ fi
 if test "$wxUSE_EDITABLELISTBOX" = "yes"; then
     AC_DEFINE(wxUSE_EDITABLELISTBOX)
     USES_CONTROLS=1
-    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS editlbox"
 fi
 
 if test "$wxUSE_NOTEBOOK" = "yes"; then
@@ -6689,6 +6901,18 @@ if test "$wxUSE_RADIOBTN" = "yes"; then
     USES_CONTROLS=1
 fi
 
+if test "$wxUSE_REARRANGECTRL" = "yes"; then
+    AC_DEFINE(wxUSE_REARRANGECTRL)
+fi
+
+if test "$wxUSE_RICHMSGDLG" = "yes"; then
+    AC_DEFINE(wxUSE_RICHMSGDLG)
+fi
+
+if test "$wxUSE_RICHTOOLTIP" = "yes"; then
+    AC_DEFINE(wxUSE_RICHTOOLTIP)
+fi
+
 if test "$wxUSE_SASH" = "yes"; then
     AC_DEFINE(wxUSE_SASH)
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS sashtest"
@@ -6697,7 +6921,7 @@ fi
 if test "$wxUSE_SCROLLBAR" = "yes"; then
     AC_DEFINE(wxUSE_SCROLLBAR)
     USES_CONTROLS=1
-    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS scroll scrollsub"
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS scroll"
 fi
 
 if test "$wxUSE_SEARCHCTRL" = "yes"; then
@@ -6754,10 +6978,6 @@ if test "$wxUSE_STATUSBAR" = "yes"; then
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS statbar"
 fi
 
-if test "$wxUSE_TAB_DIALOG" = "yes"; then
-    AC_DEFINE(wxUSE_TAB_DIALOG)
-fi
-
 if test "$wxUSE_TEXTCTRL" = "yes"; then
     AC_DEFINE(wxUSE_TEXTCTRL)
     USES_CONTROLS=1
@@ -6769,8 +6989,13 @@ if test "$wxUSE_TEXTCTRL" = "yes"; then
     AC_DEFINE(wxUSE_RICHEDIT2)
 fi
 
+if test "$wxUSE_TIMEPICKCTRL" = "yes"; then
+  AC_DEFINE(wxUSE_TIMEPICKCTRL)
+  USES_CONTROLS=1
+fi
+
 if test "$wxUSE_TOGGLEBTN" = "yes"; then
-    if test "$wxUSE_COCOA" = 1 ; then
+    if test "$wxUSE_OLD_COCOA" = 1 ; then
         AC_MSG_WARN([Toggle button not yet supported under Mac OS X... disabled])
         wxUSE_TOGGLEBTN=no
     fi
@@ -6827,8 +7052,14 @@ if test "$wxUSE_TREECTRL" = "yes"; then
     fi
 fi
 
+if test "$wxUSE_TREELISTCTRL" = "yes"; then
+    AC_DEFINE(wxUSE_TREELISTCTRL)
+    USES_CONTROLS=1
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS treelist"
+fi
+
 if test "$wxUSE_POPUPWIN" = "yes"; then
-    if test "$wxUSE_COCOA" = 1 ; then
+    if test "$wxUSE_OLD_COCOA" = 1 ; then
         AC_MSG_WARN([Popup window not yet supported under Mac OS X... disabled])
     else
         if test "$wxUSE_PM" = 1; then
@@ -6843,7 +7074,7 @@ if test "$wxUSE_POPUPWIN" = "yes"; then
 fi
 
 if test "$wxUSE_DIALUP_MANAGER" = "yes"; then
-    if test "$wxUSE_MAC" = 1 -o "$wxUSE_COCOA" = 1 -o "$wxUSE_MGL" = 1; then
+    if test "$wxUSE_MAC" = 1 -o "$wxUSE_OLD_COCOA" = 1; then
         AC_MSG_WARN([Dialup manager not supported on this platform... disabled])
     else
         AC_DEFINE(wxUSE_DIALUP_MANAGER)
@@ -6873,6 +7104,27 @@ if test "$wxUSE_ACCESSIBILITY" = "yes"; then
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS access"
 fi
 
+if test "$wxUSE_ARTPROVIDER_STD" = "yes"; then
+    AC_DEFINE(wxUSE_ARTPROVIDER_STD)
+fi
+
+if test "$wxUSE_ARTPROVIDER_TANGO" = "auto"; then
+    dnl Tango-based art provider is not needed in GTK-based ports as the
+    dnl native art provider completely replaces it.
+    if test "$wxUSE_GTK" != 1; then
+        dnl It also requires support for memory-mapped PNG images.
+        if test "$wxUSE_LIBPNG" != no -a \
+                "$wxUSE_IMAGE" = yes -a \
+                "$wxUSE_STREAMS" = yes; then
+            wxUSE_ARTPROVIDER_TANGO="yes"
+        fi
+    fi
+fi
+
+if test "$wxUSE_ARTPROVIDER_TANGO" = "yes"; then
+    AC_DEFINE(wxUSE_ARTPROVIDER_TANGO)
+fi
+
 if test "$wxUSE_DRAGIMAGE" = "yes"; then
     AC_DEFINE(wxUSE_DRAGIMAGE)
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dragimag"
@@ -6911,7 +7163,7 @@ if test "$wxUSE_WEBKIT" = "yes"; then
                            #include <WebKit/WebKit.h>
                         ])
         CPPFLAGS="$old_CPPFLAGS"
-    elif test "$wxUSE_COCOA" = 1; then
+    elif test "$wxUSE_OLD_COCOA" = 1; then
         AC_DEFINE(wxUSE_WEBKIT)
     else
         wxUSE_WEBKIT=no
@@ -6947,11 +7199,25 @@ if test "$wxUSE_PROPGRID" = "yes"; then
    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS propgrid"
 fi
 
+USE_RIBBON=0
+if test "$wxUSE_RIBBON" = "yes"; then
+   AC_DEFINE(wxUSE_RIBBON)
+   USE_RIBBON=1
+   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS ribbon"
+fi
+
 USE_STC=0
 if test "$wxUSE_STC" = "yes"; then
    AC_DEFINE(wxUSE_STC)
    USE_STC=1
    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS stc"
+
+   dnl python is used to update src/stc.h (see build/bakefiles/scintilla.bkl)
+   AC_PATH_PROG(PYTHON, python)
+   if test "x$PYTHON" = "x"; then
+     COND_PYTHON="#"
+   fi
+   AC_SUBST(COND_PYTHON)
 fi
 
 if test "$wxUSE_MENUS" = "yes"; then
@@ -6959,10 +7225,6 @@ if test "$wxUSE_MENUS" = "yes"; then
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS menu"
 fi
 
-if test "$wxUSE_METAFILE" = "yes"; then
-    AC_DEFINE(wxUSE_METAFILE)
-fi
-
 if test "$wxUSE_MIMETYPE" = "yes"; then
     AC_DEFINE(wxUSE_MIMETYPE)
 fi
@@ -6977,6 +7239,10 @@ fi
 
 if test "$wxUSE_TASKBARICON" = "yes"; then
     AC_DEFINE(wxUSE_TASKBARICON)
+    dnl This is used under MSW, just enable it always without testing for the
+    dnl toolkit nor providing a separate option for it because it's totally
+    dnl harmless to have it defined even if it's unnecessary.
+    AC_DEFINE(wxUSE_TASKBARICON_BALLOONS)
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS taskbar"
 fi
 
@@ -7007,6 +7273,71 @@ if test "$wxUSE_RICHTEXT" = "yes"; then
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS richtext"
 fi
 
+if test "$wxUSE_WEBVIEW" = "yes"; then
+    USE_WEBVIEW_WEBKIT=0
+    if test "$wxUSE_WEBVIEW_WEBKIT" = "yes"; then
+        if test "$wxUSE_GTK" = 1; then
+            webkitgtk=webkit-1.0
+            if test "$WXGTK3" = 1; then
+                webkitgtk=webkitgtk-3.0
+            fi
+            PKG_CHECK_MODULES([WEBKIT],
+                              [$webkitgtk >= 1.3.1],
+                              [
+                                USE_WEBVIEW_WEBKIT=1
+                                CPPFLAGS="$CPPFLAGS $WEBKIT_CFLAGS"
+                                GUI_TK_LIBRARY="$GUI_TK_LIBRARY $WEBKIT_LIBS"
+                              ],
+                              [
+                                AC_MSG_WARN([webkitgtk not found.])
+                              ])
+        elif test "$wxUSE_MAC" = 1 -a "$USE_DARWIN" = 1; then
+            dnl Under Mac we always have the libraries but check for the
+            dnl headers
+            old_CPPFLAGS="$CPPFLAGS"
+            CPPFLAGS="-x objective-c++ $CPPFLAGS"
+            AC_CHECK_HEADER([WebKit/HIWebView.h],
+                            [
+                                USE_WEBVIEW_WEBKIT=1
+                                WEBKIT_LINK="-framework WebKit"
+                            ],
+                            [
+                                AC_MSG_WARN([WebKit headers not found])
+                            ],
+                            [
+                                #include <Carbon/Carbon.h>
+                                #include <WebKit/WebKit.h>
+                            ])
+            CPPFLAGS="$old_CPPFLAGS"
+        fi
+    fi
+
+    wxUSE_WEBVIEW="no"
+    if test "$wxUSE_GTK" = 1 -o "$wxUSE_MAC" = 1; then
+        if test "$USE_WEBVIEW_WEBKIT" = 1; then
+            wxUSE_WEBVIEW="yes"
+            AC_DEFINE(wxUSE_WEBVIEW_WEBKIT)
+        else
+            AC_MSG_WARN([WebKit not available, disabling wxWebView])
+        fi
+    elif test "$wxUSE_MSW" = 1; then
+        if test "$wxUSE_WEBVIEW_IE" = "yes"; then
+            dnl TODO: Check for the required headers/libraries under Windows
+            dnl       too and do the right thing automatically there too.
+            wxUSE_WEBVIEW="yes"
+            AC_DEFINE(wxUSE_WEBVIEW_IE)
+        fi
+    fi
+fi
+
+if test "$wxUSE_WEBVIEW" = "yes"; then
+    USE_WEBVIEW=1
+    AC_DEFINE(wxUSE_WEBVIEW)
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS webview"
+else
+    USE_WEBVIEW=0
+fi
+
 dnl ---------------------------------------------------------------------------
 dnl wxImage options
 dnl ---------------------------------------------------------------------------
@@ -7088,11 +7419,7 @@ if test "$wxUSE_NUMBERDLG" = "yes"; then
 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
+    AC_DEFINE(wxUSE_PROGRESSDLG)
 fi
 
 if test "$wxUSE_SPLASH" = "yes"; then
@@ -7101,11 +7428,7 @@ if test "$wxUSE_SPLASH" = "yes"; then
 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
+    AC_DEFINE(wxUSE_STARTUP_TIPS)
 fi
 
 if test "$wxUSE_TEXTDLG" = "yes"; then
@@ -7172,23 +7495,73 @@ dnl ---------------------------------------------------------------------------
 dnl wxGraphicsContext
 dnl ---------------------------------------------------------------------------
 
+dnl Under Mac we don't even provide --enable-graphics_ctx switch as we always
+dnl need it -- but because we don't have the option, wxUSE_GRAPHICS_CONTEXT is
+dnl not defined automatically and we need to do it ourselves
 if test "$wxUSE_MAC" = 1; then
-       wxUSE_GRAPHICS_CONTEXT="yes"
+    wxUSE_GRAPHICS_CONTEXT="yes"
 fi
 
 if test "$wxUSE_GRAPHICS_CONTEXT" = "yes"; then
-   if test "$wxUSE_MAC" = 1 -o "$wxUSE_COCOA" = 1; then
-      AC_DEFINE(wxUSE_GRAPHICS_CONTEXT)
-   elif test "$wxUSE_GTK" != 1; then
-      dnl for other builds we'll just wing it for now...
-      AC_DEFINE(wxUSE_GRAPHICS_CONTEXT)
-   else
-      dnl ...but let's check for cairo availability for wxGTK builds
-      PKG_CHECK_MODULES(CAIRO, cairo,
-          [AC_DEFINE(wxUSE_GRAPHICS_CONTEXT)],
-          [AC_MSG_WARN([Cairo library not found, unable to set wxUSE_GRAPHICS_CONTEXT])]
-      )
-   fi
+    wx_has_graphics=0
+    if test "$wxUSE_MSW" = 1; then
+        AC_CACHE_CHECK([if GDI+ is available], wx_cv_lib_gdiplus,
+            [
+                dnl we need just the header, not the library, as we load the
+                dnl GDI+ DLL dynamically anyhow during run-time
+                AC_LANG_PUSH(C++)
+                AC_TRY_COMPILE(
+                    [#include <windows.h>
+                     #include <gdiplus.h>],
+                    [
+                        using namespace Gdiplus;
+                    ],
+                    wx_cv_lib_gdiplus=yes,
+                    wx_cv_lib_gdiplus=no
+                )
+                AC_LANG_POP()
+            ]
+        )
+        if test "$wx_cv_lib_gdiplus" = "yes"; then
+            wx_has_graphics=1
+        fi
+    elif test "$wxUSE_GTK" = 1 -o "$wxUSE_X11" = 1; then
+        PKG_CHECK_MODULES(CAIRO, cairo,
+            [wx_has_graphics=1],
+            [AC_MSG_WARN([Cairo library not found])]
+        )
+        if test "$wx_has_graphics" = 1; then
+            dnl Check that Cairo library is new enough: wxGraphicsContext
+            dnl won't compile without cairo_push_group() and
+            dnl cairo_pop_group_to_source() which are new in 1.2.
+            save_LIBS="$LIBS"
+            LIBS="$LIBS $CAIRO_LIBS"
+            AC_CHECK_FUNCS([cairo_push_group])
+            LIBS="$save_LIBS"
+            if test "$ac_cv_func_cairo_push_group" = "no"; then
+                wx_has_graphics=0
+                AC_MSG_WARN([Cairo library is too old and misses cairo_push_group()])
+            else
+                AC_DEFINE(wxUSE_CAIRO)
+
+                dnl We don't need to do this for wxGTK as we already get Cairo
+                dnl flags as part of GTK+ ones.
+                if test "$wxUSE_GTK" != 1; then
+                    CPPFLAGS="$CAIRO_CFLAGS $CPPFLAGS"
+                    GUI_TK_LIBRARY="$GUI_TK_LIBRARY $CAIRO_LIBS"
+                fi
+            fi
+        fi
+    else
+        dnl assume it's ok, add more checks here if needed
+        wx_has_graphics=1
+    fi
+
+    if test "$wx_has_graphics" = 1; then
+        AC_DEFINE(wxUSE_GRAPHICS_CONTEXT)
+    else
+        AC_MSG_WARN([wxGraphicsContext won't be available])
+    fi
 fi
 
 dnl ---------------------------------------------------------------------------
@@ -7197,7 +7570,7 @@ dnl ---------------------------------------------------------------------------
 
 USE_MEDIA=0
 
-if test "$wxUSE_MEDIACTRL" = "yes"; then
+if test "$wxUSE_MEDIACTRL" = "yes" -o "$wxUSE_MEDIACTRL" = "auto"; then
     USE_MEDIA=1
 
     dnl -----------------------------------------------------------------------
@@ -7219,7 +7592,7 @@ if test "$wxUSE_MEDIACTRL" = "yes"; then
 
         if test "$wxUSE_GSTREAMER8" = "no"; then
             PKG_CHECK_MODULES(GST,
-                [gstreamer-$GST_VERSION gstreamer-plugins-base-$GST_VERSION gconf-2.0],
+                [gstreamer-$GST_VERSION gstreamer-plugins-base-$GST_VERSION],
                 [
                     wxUSE_GSTREAMER="yes"
                     GST_LIBS="$GST_LIBS -lgstinterfaces-$GST_VERSION"
@@ -7253,11 +7626,23 @@ if test "$wxUSE_MEDIACTRL" = "yes"; then
         else
             USE_MEDIA=0
         fi
+
+    elif test "$wxUSE_MAC" = 1; then 
+         dnl We always have the necessary libraries under Mac 
+         dnl but we need to link with it explicitly.
+         GST_LIBS="-framework QTKit"
     fi
 
     if test $USE_MEDIA = 1; then
         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS mediaplayer"
         AC_DEFINE(wxUSE_MEDIACTRL)
+    else
+        if test "$wxUSE_MEDIACTRL" = "yes"; then
+            AC_MSG_ERROR([GStreamer not available])
+        else
+            dnl was set to 'auto'
+            AC_MSG_WARN([GStreamer not available... disabling wxMediaCtrl])
+        fi
     fi
 fi
 
@@ -7265,7 +7650,7 @@ dnl ---------------------------------------------------------------------------
 dnl get the string with OS info - used by wxGetOsDescription() on MacOS X
 dnl ---------------------------------------------------------------------------
 
-if test "$cross_compiling" = "yes"; then
+if test "$cross_compiling" != "no"; then
     dnl Use best guess from host as we can't use uname when cross compiling
     OSINFO="\"$host\""
 else
@@ -7331,12 +7716,19 @@ if test "$wxUSE_GUI" = "yes"; then
     if test "$wxUSE_PROPGRID" = "yes" ; then
         BUILT_WX_LIBS="propgrid $BUILT_WX_LIBS"
     fi
+    if test "$wxUSE_RIBBON" = "yes" ; then
+        BUILT_WX_LIBS="ribbon $BUILT_WX_LIBS"
+    fi
     if test "$wxUSE_RICHTEXT" = "yes" ; then
         BUILT_WX_LIBS="richtext $BUILT_WX_LIBS"
     fi
     if test "$wxUSE_STC" = "yes" ; then
         BUILT_WX_LIBS="stc $BUILT_WX_LIBS"
     fi
+    if test "$wxUSE_WEBVIEW" = "yes" ; then
+        STD_GUI_LIBS="webview $STD_GUI_LIBS"
+        BUILT_WX_LIBS="webview $BUILT_WX_LIBS"
+    fi
     if test "$wxUSE_XRC" = "yes" ; then
         STD_GUI_LIBS="xrc $STD_GUI_LIBS"
         BUILT_WX_LIBS="xrc $BUILT_WX_LIBS"
@@ -7353,27 +7745,61 @@ dnl Output the makefiles and such from the results found above
 dnl ---------------------------------------------------------------------------
 
 dnl all additional libraries (except wxWidgets itself) we link with
-
+EXTRA_FRAMEWORKS=
 if test "$wxUSE_MAC" = 1 ; then
-    if test "$wxUSE_SOUND" = "yes" || test "$wxUSE_MEDIACTRL" = "yes"; then
-        if test "$USE_DARWIN" = 1; then
-            LDFLAGS="$LDFLAGS -framework QuickTime"
-        fi
-    fi
     if test "$USE_DARWIN" = 1; then
-        LDFLAGS="$LDFLAGS -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL"
+        if test "$wxUSE_OSX_IPHONE" = 1; then
+            EXTRA_FRAMEWORKS="-framework IOKit -framework UIKit -framework CFNetwork -framework AudioToolbox -framework CoreFoundation -framework CoreGraphics -framework OpenGLES -framework Foundation -framework QuartzCore"
+        else
+            EXTRA_FRAMEWORKS="-framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL"
+
+            dnl The case of QuickTime framework is special: we only need it in
+            dnl 32 bit builds and not in 64 bit and, moreover, linking with it
+            dnl in 64 bit builds results in a warning because the framework is
+            dnl not available in 64 bits itself. So make an effort to avoid it
+            dnl when building for 64 bits only (i.e. not universal build).
+
+            if test "$cross_compiling" != "no"; then
+                dnl The check below doesn't work well when cross-compiling
+                dnl ("file" under non-OS X systems might not recognize
+                dnl universal binaries) so assume we do build for 32 bits as
+                dnl it's safer: at worst we'll get a warning when building in
+                dnl 64 bits only, but at least the build will still work.
+                wx_cv_target_x86_64=no
+            else
+                AC_CACHE_CHECK(
+                    [if we target only x86_64],
+                    wx_cv_target_x86_64,
+                    AC_LINK_IFELSE(
+                        [AC_LANG_SOURCE([int main() { return 0; }])],
+                        if file conftest$ac_exeext|grep -q 'i386\|ppc'; then
+                            wx_cv_target_x86_64=no
+                        else
+                            wx_cv_target_x86_64=yes
+                        fi
+                    )
+                )
+            fi
+
+            if test "$wx_cv_target_x86_64" != "yes"; then
+                EXTRA_FRAMEWORKS="$EXTRA_FRAMEWORKS -framework QuickTime"
+            fi
+        fi
     fi
 fi
-if test "$wxUSE_COCOA" = 1 ; then
-    LDFLAGS="$LDFLAGS -framework IOKit -framework Cocoa"
+if test "$wxUSE_OLD_COCOA" = 1 ; then
+    EXTRA_FRAMEWORKS="-framework IOKit -framework Cocoa"
     if test "$wxUSE_MEDIACTRL" = "yes"; then
-        LDFLAGS="$LDFLAGS -framework QuickTime"
+        EXTRA_FRAMEWORKS="$EXTRA_FRAMEWORKS -framework QuickTime"
     fi
 fi
-if test "$USE_DARWIN" = 1 -a "$wxUSE_MAC" != 1 -a "$wxUSE_COCOA" != 1 ; then
-    LDFLAGS="$LDFLAGS -framework IOKit -framework CoreServices -framework System -framework ApplicationServices"
+if test "$USE_DARWIN" = 1 -a "$wxUSE_MAC" != 1 -a "$wxUSE_OLD_COCOA" != 1 ; then
+    EXTRA_FRAMEWORKS="$EXTRA_FRAMEWORKS -framework IOKit -framework CoreServices -framework System -framework ApplicationServices"
 fi
 
+LDFLAGS="$LDFLAGS $EXTRA_FRAMEWORKS"
+WXCONFIG_LDFLAGS="$WXCONFIG_LDFLAGS $EXTRA_FRAMEWORKS"
+
 LIBS="$ZLIB_LINK $POSIX4_LINK $INET_LINK $WCHAR_LINK $DL_LINK $LIBS"
 
 if test "$wxUSE_GUI" = "yes"; then
@@ -7383,9 +7809,8 @@ if test "$wxUSE_GUI" = "yes"; then
 
     dnl TODO some samples are never built so far: mfc (requires VC++)
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS artprov controls dialogs drawing \
-                     erase event exec font image minimal mobile \
-                     mobile/wxedit mobile/styles render \
-                     shaped svg taborder vscroll widgets"
+                     erase event exec font image minimal preferences render \
+                     shaped svg taborder vscroll widgets wrapsizer"
 
     if test "$wxUSE_MONOLITHIC" != "yes"; then
         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS console"
@@ -7393,7 +7818,7 @@ if test "$wxUSE_GUI" = "yes"; then
     if test "$TOOLKIT" = "MSW"; then
         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS regtest"
         if test "$wxUSE_UNIVERSAL" != "yes"; then
-            SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS ownerdrw nativdlg"
+            SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS ownerdrw nativdlg dll"
         fi
     fi
     if test "$TOOLKIT" = "PM" -a "$wxUSE_UNIVERSAL" != "yes"; then
@@ -7416,14 +7841,14 @@ dnl check for icc before gcc as icc is also recognized as gcc
 if test "x$INTELCC" = "xyes" ; then
     dnl Warnings which can't be easily suppressed in C code are disabled:
     dnl
-    dnl     remark #810: conversion from "x" to "y" may lose significant bits
-    dnl     remark #869: parameter "foo" was never referenced
-    dnl     remark #1572: floating-point equality and inequality comparisons
-    dnl                   are unreliable
-    dnl     remark #1684: conversion from pointer to same-sized integral type
-    dnl
-    dnl (for others see below)
-    CWARNINGS="-Wall -wd810,869,981,1418,1572,1684"
+    dnl     #810: conversion from "x" to "y" may lose significant bits
+    dnl     #869: parameter "foo" was never referenced
+    dnl     #1572: floating-point equality and inequality comparisons
+    dnl            are unreliable
+    dnl     #1684: conversion from pointer to same-sized integral type
+    dnl     #2259: non-pointer conversion from "x" to "y" may lose significant
+    dnl            bits
+    CWARNINGS="-Wall -wd810,869,981,1418,1572,1684,2259"
 elif test "$GCC" = yes ; then
     CWARNINGS="-Wall -Wundef"
 fi
@@ -7435,18 +7860,27 @@ if test "x$INTELCXX" = "xyes" ; then
     dnl (279) are generated for standard macros and so there is nothing we can
     dnl do about them
     dnl
-    dnl     remark #279: controlling expression is constant
-    dnl     remark #383: value copied to temporary, reference to temporary used
-    dnl     remark #444: destructor for base class "xxx" is not virtual
-    dnl     remark #810: conversion from "x" to "y" may lose significant bits
-    dnl     remark #869: parameter "foo" was never referenced
-    dnl     remark #981: operands are evaluated in unspecified order
-    dnl     remark #1418: external definition with no prior declaration
-    dnl     remark #1419: external declaration in primary source file
-    CXXWARNINGS="-Wall -wd279,383,444,810,869,981,1418,1419"
+    dnl     #279: controlling expression is constant
+    dnl     #383: value copied to temporary, reference to temporary used
+    dnl     #444: destructor for base class "xxx" is not virtual
+    dnl     #981: operands are evaluated in unspecified order
+    dnl     #1418: external definition with no prior declaration
+    dnl     #1419: external declaration in primary source file
+    dnl     #1881: argument must be a constant null pointer value
+    dnl
+    dnl (for others see CWARNINGS above)
+    CXXWARNINGS="-Wall -wd279,383,444,810,869,981,1418,1419,1881,2259"
 elif test "$GXX" = yes ; then
-    dnl CXXWARNINGS="-Wall -W -Wcast-qual -Werror"
     CXXWARNINGS="-Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy"
+    AX_CXXFLAGS_GCC_OPTION(-Woverloaded-virtual, CXXWARNINGS)
+
+    dnl when building under Mac we currently get hundreds of deprecation
+    dnl warnings for Carbon symbols from the standard headers -- disable them
+    dnl as we already know that they're deprecated and nothing else can be seen
+    dnl with these warnings on
+    if test "$wxUSE_MAC" = 1 ; then
+        CXXWARNINGS="$CXXWARNINGS -Wno-deprecated-declarations"
+    fi
 fi
 
 
@@ -7459,8 +7893,7 @@ dnl add -I options we use during library compilation
 dnl
 dnl note that the order is somewhat important: wxWidgets headers should
 dnl come first and the one with setup.h should be before $(top_srcdir)/include
-dnl in case the latter contains setup.h used by non-autoconf makefiles (e.g.
-dnl CodeWarrior):
+dnl in case the latter contains setup.h used by non-autoconf makefiles
 CPPFLAGS=`echo $WXCONFIG_CPPFLAGS \
  -I\\${wx_top_builddir}/lib/wx/include/${TOOLCHAIN_FULLNAME} \
  -I\\${top_srcdir}/include $TOOLKIT_INCLUDE \
@@ -7498,9 +7931,9 @@ EXTRALIBS="$LDFLAGS $LDFLAGS_VERSIONING $LIBS $DMALLOC_LIBS"
 EXTRALIBS_XML="$EXPAT_LINK"
 EXTRALIBS_HTML="$MSPACK_LINK"
 EXTRALIBS_MEDIA="$GST_LIBS"
-EXTRALIBS_STC="-lwxscintilla${lib_debug_suffix}${WX_LIB_FLAVOUR}-${WX_RELEASE}${HOST_SUFFIX}"
+EXTRALIBS_STC="-lwxscintilla${WX_LIB_FLAVOUR}-${WX_RELEASE}${HOST_SUFFIX}"
 if test "$wxUSE_GUI" = "yes"; then
-    EXTRALIBS_GUI=`echo $GUI_TK_LIBRARY $PNG_LINK $JPEG_LINK $TIFF_LINK $WEBKIT_LINK $EXTRALIBS_HILDON $EXTRALIBS_GNOMEVFS $EXTRALIBS_GNOMEPRINT`
+    EXTRALIBS_GUI=`echo $GUI_TK_LIBRARY $PNG_LINK $JPEG_LINK $TIFF_LINK $WEBKIT_LINK`
 fi
 if test "$wxUSE_OPENGL" = "yes"; then
     EXTRALIBS_OPENGL="$LDFLAGS_GL $OPENGL_LIBS"
@@ -7531,7 +7964,7 @@ if test "$wxUSE_ZLIB" = "builtin" ; then
 fi
 
 for i in $wxconfig_3rdparty ; do
-    WXCONFIG_LIBS="-lwx${i}${lib_debug_suffix}${WX_LIB_FLAVOUR}-${WX_RELEASE}${HOST_SUFFIX} $WXCONFIG_LIBS"
+    WXCONFIG_LIBS="-lwx${i}${WX_LIB_FLAVOUR}-${WX_RELEASE}${HOST_SUFFIX} $WXCONFIG_LIBS"
 done
 
 
@@ -7602,31 +8035,16 @@ AC_SUBST(EXTRALIBS_OPENGL)
 AC_SUBST(EXTRALIBS_SDL)
 AC_SUBST(EXTRALIBS_STC)
 AC_SUBST(WITH_PLUGIN_SDL)
-AC_SUBST(EXTRALIBS_GTKPRINT)
-AC_SUBST(EXTRALIBS_GNOMEPRINT)
-AC_SUBST(EXTRALIBS_GNOMEVFS)
-AC_SUBST(EXTRALIBS_HILDON)
 AC_SUBST(UNICODE)
-AC_SUBST(BUILD)
 AC_SUBST(DEBUG_INFO)
 AC_SUBST(DEBUG_FLAG)
-TOOLKIT_LOWERCASE=xxx
-if test "$TOOLKIT" = "MAC"; then
-    TOOLKIT_LOWERCASE=osx
-fi
-if test "$TOOLKIT" = "OSX_CARBON"; then
-    TOOLKIT_LOWERCASE=osx
-fi
-if test "$TOOLKIT" = "OSX_COCOA"; then
-    TOOLKIT_LOWERCASE=osx
-fi
-if test "$TOOLKIT_LOWERCASE" = "xxx"; then
-    TOOLKIT_LOWERCASE=`echo $TOOLKIT | tr '[[A-Z]]' '[[a-z]]'`
-fi
+TOOLKIT_LOWERCASE=`echo $TOOLKIT | tr '[[A-Z]]' '[[a-z]]'`
 AC_SUBST(TOOLKIT_LOWERCASE)
 AC_SUBST(TOOLKIT_VERSION)
+AC_SUBST(DYLIB_RPATH_INSTALL)
+AC_SUBST(DYLIB_RPATH_POSTLINK)
 AC_SUBST(SAMPLES_RPATH_FLAG)
-AC_SUBST(SAMPLES_RPATH_POSTLINK)
+AC_SUBST(HEADER_PAD_OPTION)
 AC_SUBST(HOST_SUFFIX)
 AC_SUBST(CPPUNIT_CFLAGS)
 AC_SUBST(CPPUNIT_LIBS)
@@ -7635,7 +8053,11 @@ case "$TOOLKIT" in
     GTK)
         TOOLKIT_DESC="GTK+"
         if test "$WXGTK2" = 1; then
-            TOOLKIT_DESC="$TOOLKIT_DESC 2"
+            if test "$WXGTK3" = 1; then
+                TOOLKIT_DESC="$TOOLKIT_DESC 3"
+            else
+                TOOLKIT_DESC="$TOOLKIT_DESC 2"
+            fi
             if test "$wxUSE_GTKPRINT" = "yes" ; then
                 TOOLKIT_EXTRA="$TOOLKIT_EXTRA GTK+ printing";
             fi
@@ -7645,9 +8067,15 @@ case "$TOOLKIT" in
             if test "$wxUSE_LIBGNOMEVFS" = "yes" ; then
                 TOOLKIT_EXTRA="$TOOLKIT_EXTRA gnomevfs"
             fi
+            if test "$wxUSE_LIBNOTIFY" = "yes" ; then
+                TOOLKIT_EXTRA="$TOOLKIT_EXTRA libnotify"
+            fi
             if test "$wxUSE_LIBHILDON" = "yes"; then
                 TOOLKIT_EXTRA="$TOOLKIT_EXTRA hildon"
             fi
+            if test "$wxUSE_LIBHILDON2" = "yes"; then
+                TOOLKIT_EXTRA="$TOOLKIT_EXTRA hildon"
+            fi
 
             if test "$TOOLKIT_EXTRA" != ""; then
                 TOOLKIT_DESC="$TOOLKIT_DESC with support for `echo $TOOLKIT_EXTRA | tr -s ' '`"
@@ -7738,7 +8166,7 @@ if test "$wxUSE_MSW" = 1 ; then
     RESCOMP="$WINDRES"
 fi
 
-if test "$wxUSE_MAC" = 1 -o "$wxUSE_COCOA" = 1; then
+if test "$wxUSE_MAC" = 1 -o "$wxUSE_OLD_COCOA" = 1; then
     dnl base name of the resource file for wxMac must be the same
     dnl as library installation base name (-install_name)
     WX_RESOURCES_MACOSX_ASCII="libwx_${TOOLCHAIN_NAME}.${wx_release_number}.r"
@@ -7808,9 +8236,11 @@ dnl at which time, this hack can be removed.
 
 if test "$wxUSE_MAC" = 1 ; then
     if test "x$wxUSE_UNIVERSAL_BINARY" != "xno" ; then
-        sed "s/DEPSMODE=gcc/DEPSMODE=none/" < bk-deps > temp
-        mv temp bk-deps
-        chmod +x bk-deps
+        if test "x$disable_macosx_deps" = "xyes"; then
+            sed "s/DEPSMODE=gcc/DEPSMODE=none/" < bk-deps > temp
+                mv temp bk-deps
+            chmod +x bk-deps
+        fi
     fi
 fi
 
@@ -7855,9 +8285,9 @@ case "${host}" in
         dnl system packages are compiled with Sun CC and so pkg-config outputs
         dnl CC-specific "-mt" flag, remove it when using gcc
         if test "$GCC" = yes; then
-            CPPFLAGS=`echo $CPPFLAGS | sed 's/-mt//'`
-            LIBS=`echo $LIBS | sed 's/-mt//'`
-            EXTRALIBS_GUI=`echo $EXTRALIBS_GUI | sed 's/-mt//'`
+            CPPFLAGS=`echo $CPPFLAGS | sed 's/-mt//g'`
+            LIBS=`echo $LIBS | sed 's/-mt//g'`
+            EXTRALIBS_GUI=`echo $EXTRALIBS_GUI | sed 's/-mt//g'`
         fi
         ;;
 
@@ -7865,9 +8295,9 @@ case "${host}" in
         dnl OTOH when using Sun CC under Linux, the flags contain gcc-specific
         dnl -pthreads which Sun CC doesn't know about
         if test "x$SUNCXX" = xyes; then
-            CPPFLAGS=`echo $CPPFLAGS | sed 's/-pthread//'`
-            LIBS=`echo $LIBS | sed 's/-pthread//'`
-            EXTRALIBS_GUI=`echo $EXTRALIBS_GUI | sed 's/-pthread//'`
+            CPPFLAGS=`echo $CPPFLAGS | sed 's/-pthread//g'`
+            LIBS=`echo $LIBS | sed 's/-pthread//g'`
+            EXTRALIBS_GUI=`echo $EXTRALIBS_GUI | sed 's/-pthread//g'`
         fi
         ;;
 esac
@@ -7916,7 +8346,6 @@ AC_SUBST(WX_RELEASE)
 AC_SUBST(WX_VERSION)
 AC_SUBST(WX_SUBVERSION)
 AC_SUBST(WX_CHARTYPE)
-AC_SUBST(WX_DEBUGTYPE)
 
 dnl note that in addition to the usual CPP/C/CXXFLAGS which are used for
 dnl building the library itself, we also have WXCONFIG_-prefixed variants which
@@ -7934,6 +8363,7 @@ AC_SUBST(WXCONFIG_CXXFLAGS)
 
 AC_SUBST(WXCONFIG_LIBS)
 AC_SUBST(WXCONFIG_RPATH)
+AC_SUBST(WXCONFIG_LDFLAGS)
 AC_SUBST(WXCONFIG_LDFLAGS_GUI)
 AC_SUBST(WXCONFIG_RESFLAGS)
 
@@ -7980,10 +8410,7 @@ AC_PROG_MAKE_SET
 AC_CONFIG_HEADERS([lib/wx/include/${TOOLCHAIN_FULLNAME}/wx/setup.h:setup.h.in])
 
 if test "$USE_WIN32" = 1; then
-    AC_CONFIG_COMMANDS(
-        [
-            rcdefs.h
-        ],
+    AC_CONFIG_COMMANDS([rcdefs.h],
         [
             mkdir -p $outdir &&
             $CPP $infile | sed 's/^# *[1-9].*//;s/^ *//;/./,/^$/!d' > $outdir/rcdefs.h
@@ -8103,8 +8530,6 @@ echo "Configured wxWidgets ${WX_VERSION} for \`${host}'"
 echo ""
 echo "  Which GUI toolkit should wxWidgets use?                 ${TOOLKIT_DESC}"
 echo "  Should wxWidgets be compiled into single library?       ${wxUSE_MONOLITHIC:-yes}"
-
-echo "  Should wxWidgets be compiled in debug mode?             ${wxUSE_DEBUG:-no}"
 echo "  Should wxWidgets be linked as a shared library?         ${wxUSE_SHARED:-no}"
 echo $ECHO_N "  Should wxWidgets support Unicode?                       ${wxUSE_UNICODE:-no}$ECHO_C"
 if test "$wxUSE_UNICODE" = "yes"; then