]> git.saurik.com Git - wxWidgets.git/blobdiff - configure.in
Fixed wxPropertyGridPage::DoSetSplitterPosition() infinite recursion
[wxWidgets.git] / configure.in
index fb536f52e5cf02314262a64fdb03e4d0f93a06ba..a402c5825ab329073ffbdbee31ca6e5b2014ec06 100644 (file)
@@ -94,13 +94,14 @@ 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 MAC MGL MICROWIN MOTIF MSW PM X11 DFB"
+ALL_TOOLKITS="COCOA GTK OSX_CARBON OSX_COCOA MGL 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_GTK=0
-DEFAULT_wxUSE_MAC=0
+DEFAULT_wxUSE_OSX_CARBON=0
+DEFAULT_wxUSE_OSX_COCOA=0
 DEFAULT_wxUSE_MGL=0
 DEFAULT_wxUSE_MICROWIN=0
 DEFAULT_wxUSE_MOTIF=0
@@ -109,12 +110,13 @@ DEFAULT_wxUSE_PM=0
 DEFAULT_wxUSE_X11=0
 DEFAULT_wxUSE_DFB=0
 
-dnl these are the values which are really default for the given platform -
-dnl they're not cached and are only used if no --with-toolkit was given *and*
-dnl nothing was found in the cache
+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_GTK=0
-DEFAULT_DEFAULT_wxUSE_MAC=0
+DEFAULT_DEFAULT_wxUSE_OSX_CARBON=0
+DEFAULT_DEFAULT_wxUSE_OSX_COCOA=0
 DEFAULT_DEFAULT_wxUSE_MGL=0
 DEFAULT_DEFAULT_wxUSE_MICROWIN=0
 DEFAULT_DEFAULT_wxUSE_MOTIF=0
@@ -124,7 +126,6 @@ DEFAULT_DEFAULT_wxUSE_X11=0
 DEFAULT_DEFAULT_wxUSE_DFB=0
 
 PROGRAM_EXT=
-SO_SUFFIX=so
 SAMPLES_RPATH_FLAG=
 SAMPLES_RPATH_POSTLINK=
 
@@ -139,7 +140,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
@@ -243,12 +243,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__)
@@ -266,7 +260,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
   ;;
@@ -317,11 +310,10 @@ case "${host}" in
     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_MAC=1
+    DEFAULT_DEFAULT_wxUSE_OSX_CARBON=1
     DEFAULT_STD_FLAG=no
   ;;
   powerpc-apple-macos* )
@@ -330,10 +322,9 @@ case "${host}" in
     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_MAC=1
+    DEFAULT_DEFAULT_wxUSE_OSX_CARBON=1
     DEFAULT_STD_FLAG=no
   ;;
 
@@ -361,8 +352,6 @@ dnl platform should be changed, it can be done here too)
 dnl
 dnl NB: see also DEFAULT_wxUSE<toolkit> variables defined above
 
-WX_ARG_CACHE_INIT
-
 dnl it's only necessary to list the options which should be disabled by
 dnl default, all the rest have default value of "yes" (or, rather, of
 dnl wxUSE_ALL_FEATURES which is the only which has to be set to "yes" by
@@ -378,15 +367,15 @@ DEFAULT_wxUSE_LIBGNOMEVFS=no
 DEFAULT_wxUSE_LIBHILDON=no
 DEFAULT_wxUSE_LIBMSPACK=no
 DEFAULT_wxUSE_LIBSDL=no
-DEFAULT_wxUSE_ODBC=no
 DEFAULT_wxUSE_OPENGL=no
 
 dnl features disabled by default
 DEFAULT_wxUSE_ACCESSIBILITY=no
-DEFAULT_wxUSE_DATAVIEWCTRL=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_LOCALE=no
@@ -402,21 +391,6 @@ DEFAULT_wxUSE_GTK2=yes
 dnl Always default to no. Only special cases require this.
 DEFAULT_wxUSE_OBJC_UNIQUIFYING=no
 
-
-for toolkit in `echo $ALL_TOOLKITS`; do
-  LINE=`grep "wxUSE_$toolkit=" ${wx_arg_cache_file}`
-  if test "x$LINE" != "x" ; then
-    has_toolkit_in_cache=1
-    eval "DEFAULT_$LINE"
-    eval "CACHE_$toolkit=1"
-
-    LINE=`grep "wx${toolkit}_VERSION=" ${wx_arg_cache_file}`
-    if test "x$LINE" != "x" ; then
-        eval "DEFAULT_$LINE"
-    fi
-  fi
-done
-
 dnl ===========================
 dnl deal with configure options
 dnl ===========================
@@ -468,11 +442,12 @@ if test "$wxUSE_UNIVERSAL" = "yes"; then
 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, and we don't need to cache them
-dnl automatically
+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(motif,         [  --with-motif            use Motif/Lesstif], [wxUSE_MOTIF="$withval" CACHE_MOTIF=1 TOOLKIT_GIVEN=1])
-AC_ARG_WITH(mac,           [  --with-mac              use Mac OS X], [wxUSE_MAC="$withval" CACHE_MAC=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(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])
@@ -486,6 +461,103 @@ 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
+dnl we have a default one
+
+AC_MSG_CHECKING(for toolkit)
+
+
+
+# In Wine, we need to default to MSW, not GTK or MOTIF
+if test "$wxUSE_WINE" = "yes"; then
+    DEFAULT_DEFAULT_wxUSE_GTK=0
+    DEFAULT_DEFAULT_wxUSE_MOTIF=0
+    DEFAULT_DEFAULT_wxUSE_MSW=1
+    wxUSE_SHARED=no
+    CC=${CC:-winegcc}
+    CXX=${CXX:-wineg++}
+fi
+
+
+if test "$wxUSE_GUI" = "yes"; then
+
+    if test "$USE_BEOS" = 1; then
+        AC_MSG_ERROR([BeOS GUI is not supported yet, use --disable-gui])
+    fi
+
+    if test "$TOOLKIT_GIVEN" = 1; then
+      dnl convert "yes", "any" or a number to 1 and "no" to 0
+      for toolkit in $ALL_TOOLKITS; do
+        var=wxUSE_$toolkit
+        eval "value=\$${var}"
+        if test "x$value" = "xno"; then
+          eval "$var=0"
+        elif test "x$value" != "x"; then
+          eval "$var=1"
+        fi
+
+        if test "x$value" != "x" -a "x$value" != "xyes" -a "x$value" != "xno"; then
+          eval "wx${toolkit}_VERSION=$value"
+        fi
+      done
+    else
+      dnl try to guess the most apropriate toolkit for this platform
+      for toolkit in $ALL_TOOLKITS; do
+        var=DEFAULT_DEFAULT_wxUSE_$toolkit
+        eval "wxUSE_$toolkit=\$${var}"
+      done
+    fi
+
+    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} \
+                  + ${wxUSE_MICROWIN:-0} + ${wxUSE_MOTIF:-0} + ${wxUSE_MSW:-0} + ${wxUSE_X11:-0}`
+
+    dnl Allow wxUSE_PM only for OS/2 with EMX.
+    case "${host}" in
+      *-pc-os2_emx | *-pc-os2-emx )
+        NUM_TOOLKITS=`expr ${NUM_TOOLKITS} + ${wxUSE_PM:-0}`
+    esac
+
+    case "$NUM_TOOLKITS" in
+      1)
+      ;;
+      0)
+        AC_MSG_ERROR(Please specify a toolkit -- cannot determine the default for ${host})
+      ;;
+      *)
+        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}"
+        if test "$value" = 1; then
+          toolkit_echo=`echo $toolkit | tr '[[A-Z]]' '[[a-z]]'`
+          AC_MSG_RESULT($toolkit_echo)
+        fi
+    done
+else
+    if test "x$host_alias" != "x"; then
+        AC_MSG_RESULT(base ($host_alias hosted) only)
+    else
+        AC_MSG_RESULT(base only)
+    fi
+fi
+
+wxUSE_MAC=0
+if test "$wxUSE_OSX_CARBON" = 1 -o "$wxUSE_OSX_COCOA" = 1; then
+    wxUSE_MAC=1
+fi
+
 dnl ---------------------------------------------------------------------------
 dnl external libraries
 dnl ---------------------------------------------------------------------------
@@ -494,7 +566,9 @@ WX_ARG_SYS_WITH(libpng,    [  --with-libpng           use libpng (PNG image form
 WX_ARG_SYS_WITH(libjpeg,   [  --with-libjpeg          use libjpeg (JPEG file format)], wxUSE_LIBJPEG)
 WX_ARG_SYS_WITH(libtiff,   [  --with-libtiff          use libtiff (TIFF file format)], wxUSE_LIBTIFF)
 WX_ARG_SYS_WITH(libxpm,    [  --with-libxpm           use libxpm (XPM file format)], wxUSE_LIBXPM)
+WX_ARG_WITH(libiconv,      [  --with-libiconv         use libiconv (character conversion)], wxUSE_LIBICONV)
 WX_ARG_WITH(libmspack,     [  --with-libmspack        use libmspack (CHM help files loading)], wxUSE_LIBMSPACK)
+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)
@@ -507,23 +581,12 @@ WX_ARG_WITH(dmalloc,       [  --with-dmalloc          use dmalloc library (http:
 WX_ARG_WITH(sdl,           [  --with-sdl              use SDL for audio on Unix], wxUSE_LIBSDL)
 WX_ARG_SYS_WITH(regex,     [  --with-regex            enable support for wxRegEx class], wxUSE_REGEX)
 WX_ARG_SYS_WITH(zlib,      [  --with-zlib             use zlib for LZW compression], wxUSE_ZLIB)
-WX_ARG_SYS_WITH(odbc,      [  --with-odbc             use the IODBC and wxODBC classes], wxUSE_ODBC)
 WX_ARG_SYS_WITH(expat,     [  --with-expat            enable XML support using expat parser], wxUSE_EXPAT)
 
 AC_MSG_CHECKING([for --with-macosx-sdk])
 AC_ARG_WITH(macosx-sdk,    [  --with-macosx-sdk=PATH  use an OS X SDK at PATH], [
         wxUSE_MACOSX_SDK=$withval
         wx_cv_use_macosx_sdk="wxUSE_MACOSX_SDK=$withval"
-        echo "wxUSE_MACOSX_SDK=$wxUSE_MACOSX_SDK" >> ${wx_arg_cache_file}.tmp
-    ], [
-        # NOTE: Empty string on purpose so that --without-macosx-sdk (thus no)
-        # will override --enable-universal_binary's automatic SDK usage.
-        wxUSE_MACOSX_SDK=
-        LINE=`grep "^wxUSE_MACOSX_SDK=" ${wx_arg_cache_file}`
-        if test "x$LINE" != x ; then
-            eval "$LINE"
-            echo "$LINE" >> ${wx_arg_cache_file}.tmp
-        fi
     ])
 AC_MSG_RESULT([$wxUSE_MACOSX_SDK])
 
@@ -531,17 +594,6 @@ AC_MSG_CHECKING([for --with-macosx-version-min])
 AC_ARG_WITH(macosx-version-min,    [  --with-macosx-version-min=VER   build binaries which require at least this OS X version], [
         wxUSE_MACOSX_VERSION_MIN=$withval
         wx_cv_use_macosx_version_min="wxUSE_MACOSX_VERSION_MIN=$withval"
-        echo "wxUSE_MACOSX_VERSION_MIN=$wxUSE_MACOSX_VERSION_MIN" >> ${wx_arg_cache_file}.tmp
-    ], [
-        # default "yes" because when not using an SDK it means the same as no
-        # but when using an SDK it means to use the SDK version
-        wxUSE_MACOSX_VERSION_MIN=yes
-        # See if there is a value in the cache
-        LINE=`grep "^wxUSE_MACOSX_VERSION_MIN=" ${wx_arg_cache_file}`
-        if test "x$LINE" != x ; then
-            eval "$LINE"
-            echo "$LINE" >> ${wx_arg_cache_file}.tmp
-        fi
     ])
 AC_MSG_RESULT([$wxUSE_MACOSX_VERSION_MIN])
 
@@ -550,7 +602,6 @@ dnl global compile options
 dnl ---------------------------------------------------------------------------
 
 WX_ARG_DISABLE(shared,     [  --disable-shared        create static library instead of shared], wxUSE_SHARED)
-WX_ARG_DISABLE(optimise,   [  --disable-optimise      create optimised code], wxUSE_OPTIMISE)
 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(std_iostreams, [  --enable-std_iostreams  use standard C++ stream classes], wxUSE_STD_IOSTREAM)
@@ -558,25 +609,46 @@ WX_ARG_ENABLE(std_string,    [  --enable-std_string     use standard C++ string
 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)
-WX_ARG_ENABLE(utf8only,      [  --enable-utf8only      only support UTF-8 locales in UTF-8 build (Unix only)], wxUSE_UNICODE_UTF8_LOCALE)
+WX_ARG_ENABLE(utf8only,      [  --enable-utf8only       only support UTF-8 locales in UTF-8 build (Unix only)], wxUSE_UNICODE_UTF8_LOCALE)
 WX_ARG_ENABLE(extended_rtti, [  --enable-extended_rtti  use extended RTTI (XTI)], wxUSE_EXTENDED_RTTI)
-if test "$USE_OS2" = "1"; then
+if test "$USE_OS2" = 1; then
     DEFAULT_wxUSE_OMF=no
     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
+    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
+    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)
@@ -586,7 +658,7 @@ WX_ARG_ENABLE(no_exceptions, [  --enable-no_exceptions  create code without C++
 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 (not yet working)]], wxUSE_UNIVERSAL_BINARY)
+WX_ARG_ENABLE_PARAM(universal_binary, [[  --enable-universal_binary  create Mac PowerPC and Intel Universal binary]], wxUSE_UNIVERSAL_BINARY)
 
 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)
@@ -602,6 +674,7 @@ dnl optional non GUI features
 dnl ---------------------------------------------------------------------------
 
 WX_ARG_FEATURE(intl,          [  --enable-intl           use internationalization system], wxUSE_INTL)
+WX_ARG_FEATURE(xlocale,       [  --enable-xlocale        use x-locale support (requires wxLocale)], wxUSE_XLOCALE)
 WX_ARG_FEATURE(config,        [  --enable-config         use wxConfig (and derived) classes], wxUSE_CONFIG)
 
 WX_ARG_FEATURE(protocols,     [  --enable-protocols      use wxProtocol and derived classes], wxUSE_PROTOCOL)
@@ -609,13 +682,14 @@ WX_ARG_FEATURE(ftp,           [  --enable-ftp            use wxFTP (requires wxP
 WX_ARG_FEATURE(http,          [  --enable-http           use wxHTTP (requires wxProtocol], wxUSE_PROTOCOL_HTTP)
 WX_ARG_FEATURE(fileproto,     [  --enable-fileproto      use wxFileProto class (requires wxProtocol], wxUSE_PROTOCOL_FILE)
 WX_ARG_FEATURE(sockets,       [  --enable-sockets        use socket/network classes], wxUSE_SOCKETS)
+WX_ARG_FEATURE(ipv6,          [  --enable-ipv6           enable IPv6 support in wxSocket], wxUSE_IPV6)
 WX_ARG_FEATURE(ole,           [  --enable-ole            use OLE classes (Win32 only)], wxUSE_OLE)
 WX_ARG_FEATURE(dataobj,       [  --enable-dataobj        use data object classes], wxUSE_DATAOBJ)
 
 WX_ARG_FEATURE(ipc,           [  --enable-ipc            use interprocess communication (wxSocket etc.)], wxUSE_IPC)
 
 WX_ARG_FEATURE(baseevtloop,   [  --enable-baseevtloop    use event loop in console programs too], wxUSE_CONSOLE_EVENTLOOP)
-WX_ARG_FEATURE(epoolloop,     [  --enable-epoolloop      use wxEpollDispatcher class (Linux only)], wxUSE_EPOLL_DISPATCHER)
+WX_ARG_FEATURE(epollloop,     [  --enable-epollloop      use wxEpollDispatcher class (Linux only)], wxUSE_EPOLL_DISPATCHER)
 WX_ARG_FEATURE(selectloop,    [  --enable-selectloop     use wxSelectDispatcher class], wxUSE_SELECT_DISPATCHER)
 
 dnl please keep the settings below in alphabetical order
@@ -643,7 +717,9 @@ WX_ARG_FEATURE(geometry,      [  --enable-geometry       use geometry class], wx
 WX_ARG_FEATURE(log,           [  --enable-log            use logging system], wxUSE_LOG)
 WX_ARG_FEATURE(longlong,      [  --enable-longlong       use wxLongLong class], wxUSE_LONGLONG)
 WX_ARG_FEATURE(mimetype,      [  --enable-mimetype       use wxMimeTypesManager], wxUSE_MIMETYPE)
+WX_ARG_FEATURE(printfposparam,[  --enable-printfposparam use wxVsnprintf() which supports positional parameters], wxUSE_PRINTF_POS_PARAMS)
 WX_ARG_FEATURE(snglinst,      [  --enable-snglinst       use wxSingleInstanceChecker class], wxUSE_SNGLINST_CHECKER)
+WX_ARG_FEATURE(sound,         [  --enable-sound          use wxSound class], wxUSE_SOUND)
 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)
@@ -652,14 +728,11 @@ WX_ARG_FEATURE(tarstream,     [  --enable-tarstream      use wxTar streams], wxU
 WX_ARG_FEATURE(textbuf,       [  --enable-textbuf        use wxTextBuffer class], wxUSE_TEXTBUFFER)
 WX_ARG_FEATURE(textfile,      [  --enable-textfile       use wxTextFile class], wxUSE_TEXTFILE)
 WX_ARG_FEATURE(timer,         [  --enable-timer          use wxTimer class], wxUSE_TIMER)
-WX_ARG_FEATURE(sound,         [  --enable-sound          use wxSound class], wxUSE_SOUND)
-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(printfposparam,[  --enable-printfposparam use wxVsnprintf() which supports positional parameters], wxUSE_PRINTF_POS_PARAMS)
+WX_ARG_FEATURE(variant,       [  --enable-variant        use wxVariant class], wxUSE_VARIANT)
 WX_ARG_FEATURE(zipstream,     [  --enable-zipstream      use wxZip streams], wxUSE_ZIPSTREAM)
 
+dnl URL-related classes
 WX_ARG_FEATURE(url,           [  --enable-url            use wxURL class], wxUSE_URL)
-WX_ARG_FEATURE(variant,       [  --enable-variant        use wxVariant class], wxUSE_VARIANT)
 WX_ARG_FEATURE(protocol,      [  --enable-protocol       use wxProtocol class], wxUSE_PROTOCOL)
 WX_ARG_FEATURE(protocol_http, [  --enable-protocol-http  HTTP support in wxProtocol], wxUSE_PROTOCOL_HTTP)
 WX_ARG_FEATURE(protocol_ftp,  [  --enable-protocol-ftp   FTP support in wxProtocol], wxUSE_PROTOCOL_FTP)
@@ -667,6 +740,9 @@ WX_ARG_FEATURE(protocol_file, [  --enable-protocol-file  FILE support in wxProto
 
 WX_ARG_FEATURE(threads,     [  --enable-threads        use threads], wxUSE_THREADS)
 
+WX_ARG_ENABLE(iniconf,      [  --enable-iniconf        use wxIniConfig (Win32 only)], wxUSE_INICONF)
+WX_ARG_FEATURE(regkey,      [  --enable-regkey         use wxRegKey class (Win32 only)], wxUSE_REGKEY)
+
 if test "$wxUSE_GUI" = "yes"; then
 
 dnl ---------------------------------------------------------------------------
@@ -680,18 +756,21 @@ WX_ARG_FEATURE(html,        [  --enable-html           use wxHTML sub-library],
 WX_ARG_FEATURE(htmlhelp,    [  --enable-htmlhelp       use wxHTML-based help], wxUSE_WXHTML_HELP)
 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(stc,         [  --enable-stc            use wxStyledTextCtrl library], wxUSE_STC)
 WX_ARG_FEATURE(constraints, [  --enable-constraints    use layout-constraints system], wxUSE_CONSTRAINTS)
-WX_ARG_FEATURE(printarch,   [  --enable-printarch      use printing architecture], wxUSE_PRINTING_ARCHITECTURE)
-WX_ARG_FEATURE(mdi,         [  --enable-mdi            use multiple document interface architecture], wxUSE_MDI)
-WX_ARG_FEATURE(mdidoc,      [  --enable-mdidoc         use docview architecture with MDI], wxUSE_MDI_ARCHITECTURE)
 WX_ARG_FEATURE(loggui,      [  --enable-loggui         use standard GUI logger], wxUSE_LOGGUI)
 WX_ARG_FEATURE(logwin,      [  --enable-logwin         use wxLogWindow], wxUSE_LOGWINDOW)
 WX_ARG_FEATURE(logdialog,   [  --enable-logdialog      use wxLogDialog], wxUSE_LOGDIALOG)
+WX_ARG_FEATURE(mdi,         [  --enable-mdi            use multiple document interface architecture], wxUSE_MDI)
+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)
 
 dnl ---------------------------------------------------------------------------
@@ -732,12 +811,13 @@ if test "$wxUSE_CONTROLS" = "yes"; then
   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=no
+  DEFAULT_wxUSE_DATAVIEWCTRL=yes
   DEFAULT_wxUSE_IMAGLIST=yes
   DEFAULT_wxUSE_LISTBOOK=yes
   DEFAULT_wxUSE_LISTBOX=yes
@@ -785,6 +865,7 @@ elif test "$wxUSE_CONTROLS" = "no"; then
   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
@@ -842,6 +923,7 @@ WX_ARG_FEATURE(display,     [  --enable-display        use wxDisplay class], wxU
 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(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)
@@ -852,6 +934,7 @@ WX_ARG_FEATURE(listbook,    [  --enable-listbook       use wxListbook class], wx
 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(radiobox,    [  --enable-radiobox       use wxRadioBox class], wxUSE_RADIOBOX)
 WX_ARG_FEATURE(radiobtn,    [  --enable-radiobtn       use wxRadioButton class], wxUSE_RADIOBTN)
@@ -927,136 +1010,28 @@ WX_ARG_FEATURE(tga,         [  --enable-tga            use tga images (TGA file
 WX_ARG_FEATURE(iff,         [  --enable-iff            use iff images (IFF file format)], wxUSE_IFF)
 WX_ARG_FEATURE(pnm,         [  --enable-pnm            use pnm images (PNM file format)], wxUSE_PNM)
 WX_ARG_FEATURE(xpm,         [  --enable-xpm            use xpm images (XPM file format)], wxUSE_XPM)
-WX_ARG_FEATURE(ico_cur,     [  --enable-icocur         use Windows ICO and CUR formats], wxUSE_ICO_CUR)
+WX_ARG_FEATURE(ico_cur,     [  --enable-ico_cur        use Windows ICO and CUR formats], wxUSE_ICO_CUR)
 
 dnl ---------------------------------------------------------------------------
 dnl wxMSW-only options
 dnl ---------------------------------------------------------------------------
 
 WX_ARG_FEATURE(dccache,     [  --enable-dccache        cache temporary wxDC objects (Win32 only)], wxUSE_DC_CACHEING)
-WX_ARG_ENABLE(iniconf,      [  --enable-iniconf        use wxIniConfig (Win32 only)], wxUSE_INICONF)
 WX_ARG_FEATURE(ps-in-msw,   [  --enable-ps-in-msw      use PS printing in wxMSW (Win32 only)], wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW)
-WX_ARG_FEATURE(ownerdrawn,  [  --enable-ownerdrawn     use owner drawn controls (Win32 only)], wxUSE_OWNER_DRAWN)
-WX_ARG_FEATURE(regkey,      [  --enable-regkey         use wxRegKey class (Win32 only)], wxUSE_REGKEY)
+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)
 
+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
+if test "$wxUSE_MSW" != 1; then
+    DEFAULT_wxUSE_AUTOID_MANAGEMENT=no
 fi
-dnl for GUI only
-
-dnl cache the options values before (may be) aborting below
-WX_ARG_CACHE_FLUSH
-
-dnl check that no more than one toolkit is given and that if none are given that
-dnl we have a default one
-
-AC_MSG_CHECKING(for toolkit)
-
-# In Wine, we need to default to MSW, not GTK or MOTIF
-if test "$wxUSE_WINE" = "yes"; then
-    DEFAULT_DEFAULT_wxUSE_GTK=0
-    DEFAULT_DEFAULT_wxUSE_MOTIF=0
-    DEFAULT_DEFAULT_wxUSE_MSW=1
-    wxUSE_SHARED=no
-    CC=${CC:-winegcc}
-    CXX=${CXX:-wineg++}
-fi
-
-
-if test "$wxUSE_GUI" = "yes"; then
-
-    if test "$USE_BEOS" = 1; then
-        AC_MSG_ERROR([BeOS GUI is not supported yet, use --disable-gui])
-    fi
-
-    if test "$TOOLKIT_GIVEN" = 1; then
-      dnl convert "yes", "any" or a number to 1 and "no" to 0
-      for toolkit in `echo $ALL_TOOLKITS`; do
-        var=wxUSE_$toolkit
-        eval "value=\$${var}"
-        if test "x$value" = "xno"; then
-          eval "$var=0"
-        elif test "x$value" != "x"; then
-          eval "$var=1"
-        fi
-
-        if test "x$value" != "x" -a "x$value" != "xyes" -a "x$value" != "xno"; then
-          eval "wx${toolkit}_VERSION=$value"
-        fi
-      done
-    else
-      dnl try to guess the most apropriate toolkit for this platform
-      for toolkit in `echo $ALL_TOOLKITS`; do
-        if test "$has_toolkit_in_cache" != 1; then
-          var=DEFAULT_DEFAULT_wxUSE_$toolkit
-        else
-          var=DEFAULT_wxUSE_$toolkit
-
-          eval "version=\$DEFAULT_wx${toolkit}_VERSION"
-          if test "x$version" != "x"; then
-            eval "wx${toolkit}_VERSION=$version"
-          fi
-        fi
-        eval "wxUSE_$toolkit=\$${var}"
-      done
-    fi
-
-    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_MAC:-0} \
-                  + ${wxUSE_MGL:-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.
-    case "${host}" in
-      *-pc-os2_emx | *-pc-os2-emx )
-        NUM_TOOLKITS=`expr ${NUM_TOOLKITS} + ${wxUSE_PM:-0}`
-    esac
 
-    case "$NUM_TOOLKITS" in
-      1)
-      ;;
-      0)
-        AC_MSG_ERROR(Please specify a toolkit -- cannot determine the default for ${host})
-      ;;
-      *)
-        AC_MSG_ERROR(Please specify at most one toolkit (maybe some are cached in configarg.cache?))
-    esac
+WX_ARG_FEATURE(autoidman,   [  --enable-autoidman      use automatic ids management], wxUSE_AUTOID_MANAGEMENT)
 
-    # 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
-
-    dnl cache the wxUSE_<TOOLKIT> values too
-    for toolkit in `echo $ALL_TOOLKITS`; do
-      var=wxUSE_$toolkit
-      eval "value=\$${var}"
-      if test "x$value" != x; then
-        cache_var=CACHE_$toolkit
-        eval "cache=\$${cache_var}"
-        if test "$cache" = 1; then
-          echo "$var=$value" >> ${wx_arg_cache_file}
-          eval "version=\$wx${toolkit}_VERSION"
-          if test "x$version" != "x"; then
-            echo "wx${toolkit}_VERSION=$version" >> ${wx_arg_cache_file}
-          fi
-        fi
-        if test "$value" = 1; then
-          toolkit_echo=`echo $toolkit | tr "[[A-Z]]" "[[a-z]]"`
-          AC_MSG_RESULT($toolkit_echo)
-        fi
-      fi
-    done
-else
-    if test "x$host_alias" != "x"; then
-        AC_MSG_RESULT(base ($host_alias hosted) only)
-    else
-        AC_MSG_RESULT(base only)
-    fi
 fi
+dnl for GUI only
 
 dnl ---------------------------------------------------------------------------
 dnl Checks for programs
@@ -1144,6 +1119,8 @@ dnl Support the old --enable-universal_binary in case anyone was using it.
         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
@@ -1210,6 +1187,13 @@ dnl We need to quote the next line where we don't need macros and do need [] in
 [
         MACOSX_SDK_PLIST_VERSION_MIN=`defaults read "$wxUSE_MACOSX_SDK/SDKSettings" buildSettings | grep '^ *"\{0,1\}MACOSX_DEPLOYMENT_TARGET"\{0,1\} *= *"\{0,1\}[^"]*"\{0,1\}; *$' | sed 's/^ *"\{0,1\}MACOSX_DEPLOYMENT_TARGET"\{0,1\} *= *"\{0,1\}\([^"]*\)"\{0,1\} *; *$/\1/'`
 ]
+        # If that failed, try again with the new key
+        if test "x$MACOSX_SDK_PLIST_VERSION_MIN" == "x"; then
+[
+            MACOSX_SDK_PLIST_VERSION_MIN=`defaults read "$wxUSE_MACOSX_SDK/SDKSettings" DefaultProperties | grep '^ *"\{0,1\}MACOSX_DEPLOYMENT_TARGET"\{0,1\} *= *"\{0,1\}[^"]*"\{0,1\}; *$' | sed 's/^ *"\{0,1\}MACOSX_DEPLOYMENT_TARGET"\{0,1\} *= *"\{0,1\}\([^"]*\)"\{0,1\} *; *$/\1/'`
+]
+        fi
+
         if test "x$MACOSX_SDK_PLIST_VERSION_MIN" != "x"; then
             wxUSE_MACOSX_VERSION_MIN=$MACOSX_SDK_PLIST_VERSION_MIN
             AC_MSG_RESULT([$wxUSE_MACOSX_VERSION_MIN])
@@ -1220,6 +1204,11 @@ dnl We need to quote the next line where we don't need macros and do need [] in
     else
         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
 fi
 
 if test "x$wxUSE_MACOSX_VERSION_MIN" != "x"; then
@@ -1499,7 +1488,7 @@ dnl ------------------------------------------------------------------------
 
 dnl Note: non-empty last parameter makes check compile-only,
 dnl   skipping worthless preprocessing check
-AC_CHECK_HEADERS(stdlib.h fnmatch.h langinfo.h malloc.h unistd.h wchar.h,,, [AC_INCLUDES_DEFAULT()])
+AC_CHECK_HEADERS(langinfo.h wchar.h,,, [AC_INCLUDES_DEFAULT])
 
 dnl maybe wchar_t is in wcstr.h if we don't have wchar.h?
 if test "$ac_cv_header_wchar_h" != "yes"; then
@@ -1548,7 +1537,7 @@ case "${host}" in
     ;;
     *-hp-hpux* )
         AC_CHECK_SIZEOF(long long, 0)
-        if test "$ac_cv_sizeof_long_long" != "0"; then
+        if test "$ac_cv_sizeof_long_long" != 0; then
             dnl HPUX 10.20 headers need this define in order to use long long definitions
             CPPFLAGS="-D_INCLUDE_LONGLONG $CPPFLAGS"
         fi
@@ -1577,7 +1566,7 @@ AC_CHECK_SIZEOF(wchar_t, 0,
         #include <stdio.h>
     ]
 )
-if test "$ac_cv_sizeof_wchar_t" != "0"; then
+if test "$ac_cv_sizeof_wchar_t" != 0; then
     wxUSE_WCHAR_T=yes
 else
     wxUSE_WCHAR_T=no
@@ -1685,76 +1674,79 @@ fi
 
 fi dnl wxUSE_VARARG_MACROS == yes
 
+
 dnl check for large file support
+LARGEFILE_CPPFLAGS=
 AC_SYS_LARGEFILE
+if test "$ac_cv_sys_file_offset_bits" = "64"; then
+    LARGEFILE_CPPFLAGS="-D_FILE_OFFSET_BITS=64"
+elif test "$ac_cv_sys_large_files" = 1; then
+    LARGEFILE_CPPFLAGS="-D_LARGE_FILES"
+fi
 
 dnl we need to define _FILE_OFFSET_BITS or _LARGE_FILES on the compiler command
 dnl line because otherwise the system headers risk being included before
 dnl wx/defs.h which defines these constants leading to inconsistent
 dnl sizeof(off_t) in different source files of the same program and linking
 dnl problems
-if test "x$wx_largefile" = "xyes"; then
-    if test "x$ac_cv_sys_file_offset_bits" = "x64"; then
-        WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES"
-
-        dnl We get "Large Files (ILP32) not supported in strict ANSI mode."
-        dnl #error from HP standard headers unless __STDC_EXT__ is defined.
-        dnl The compiler should define it automatically, but some old g++
-        dnl versions don't define it, so test and add it if necessary. AFAIK
-        dnl the problem only affects the C++ compiler so it is added to
-        dnl CXXFLAGS only.
-        if test "$USE_HPUX" = 1 -a "$GXX" = "yes"; then
-            AC_CACHE_CHECK(
-                [if -D__STDC_EXT__ is required],
-                wx_cv_STDC_EXT_required,
-                [
-                    AC_LANG_PUSH(C++)
-                    AC_TRY_COMPILE(
-                        [],
-                        [
-                            #ifndef __STDC_EXT__
-                                choke me
-                            #endif
-                        ],
-                        wx_cv_STDC_EXT_required=no,
-                        wx_cv_STDC_EXT_required=yes
-                    )
-                    AC_LANG_POP()
-                ]
-            )
-            if test "x$wx_cv_STDC_EXT_required" = "xyes"; then
-                WXCONFIG_CXXFLAGS="$WXCONFIG_CXXFLAGS -D__STDC_EXT__"
-            fi
+if test -n "$LARGEFILE_CPPFLAGS"; then
+    WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS $LARGEFILE_CPPFLAGS"
+
+    dnl We get "Large Files (ILP32) not supported in strict ANSI mode."
+    dnl #error from HP standard headers unless __STDC_EXT__ is defined.
+    dnl The compiler should define it automatically, but some old g++
+    dnl versions don't define it, so test and add it if necessary. AFAIK
+    dnl the problem only affects the C++ compiler so it is added to
+    dnl CXXFLAGS only.
+    if test "$USE_HPUX" = 1 -a "$GXX" = "yes"; then
+        AC_CACHE_CHECK(
+            [if -D__STDC_EXT__ is required],
+            wx_cv_STDC_EXT_required,
+            [
+                AC_LANG_PUSH(C++)
+                AC_TRY_COMPILE(
+                    [],
+                    [
+                        #ifndef __STDC_EXT__
+                            choke me
+                        #endif
+                    ],
+                    wx_cv_STDC_EXT_required=no,
+                    wx_cv_STDC_EXT_required=yes
+                )
+                AC_LANG_POP()
+            ]
+        )
+        if test "x$wx_cv_STDC_EXT_required" = "xyes"; then
+            WXCONFIG_CXXFLAGS="$WXCONFIG_CXXFLAGS -D__STDC_EXT__"
         fi
-    else
-        WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS -D_LARGE_FILES"
-    fi
-    dnl AC_FUNC_FSEEKO sets HAVE_FSEEKO and $ac_cv_sys_largefile_source
-    AC_FUNC_FSEEKO
-    if test "$ac_cv_sys_largefile_source" != no; then
-        WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS -D_LARGEFILE_SOURCE=$ac_cv_sys_largefile_source"
     fi
 fi
 
+dnl AC_FUNC_FSEEKO sets HAVE_FSEEKO and $ac_cv_sys_largefile_source
+dnl
+dnl it may be affected by large file flags (this happens under HP-UX 11 for
+dnl example) so set them before using it and also use C++ to ensure that we get
+dnl errors, not warnings, about the missing functions
+AC_LANG_PUSH(C++)
+old_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $LARGEFILE_CPPFLAGS"
+AC_FUNC_FSEEKO
+CPPFLAGS="$old_CPPFLAGS"
+AC_LANG_POP()
+if test "$ac_cv_sys_largefile_source" != no; then
+    WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS -D_LARGEFILE_SOURCE=$ac_cv_sys_largefile_source"
+fi
+
 dnl check for bytesex stuff (don't use AC_C_BIGENDIAN to allow cross-compiling)
 WX_C_BIGENDIAN
 
 dnl check for iostream (as opposed to iostream.h) standard header
 WX_CPP_NEW_HEADERS(, AC_DEFINE(wxUSE_IOSTREAMH))
 
-dnl check whether C++ compiler supports bool built-in type
-WX_CPP_BOOL
-
 dnl check whether C++ compiler supports explicit keyword
 WX_CPP_EXPLICIT
 
-dnl check whether C++ compiler supports C++ casts
-AC_CXX_CONST_CAST
-AC_CXX_REINTERPRET_CAST
-AC_CXX_STATIC_CAST
-dnl we don't use HAVE_DYNAMIC_CAST anywhere right now...
-dnl AC_CXX_DYNAMIC_CAST
-
 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
@@ -1794,7 +1786,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
@@ -1869,7 +1865,7 @@ if test "$wxUSE_STD_STRING" = "yes" -o "$wxUSE_STL" = "yes"; then
         if test "$wx_cv_class_stdbasicstring" != yes; then
             if test "$wxUSE_STL" = "yes"; then
                 AC_MSG_ERROR([Can't use --enable-stl without $std_string or std::basic_string<$char_type>])
-            elif grep wxUSE_STD_STRING $wx_arg_cache_file >/dev/null; then
+            elif test "$wxUSE_STD_STRING" = "yes"; then
                 AC_MSG_ERROR([Can't use --enable-std_string without $std_string or std::basic_string<$char_type>])
             else
                 AC_MSG_WARN([No $std_string or std::basic_string<$char_type>, switching to --disable-std_string])
@@ -1885,7 +1881,7 @@ if test "$wxUSE_STD_IOSTREAM" = "yes"; then
                    [#include <iostream>])
 
     if test "$wxUSE_STD_IOSTREAM" != "yes"; then
-        if grep wxUSE_STD_IOSTREAM $wx_arg_cache_file >/dev/null; then
+        if test "$wxUSE_STD_IOSTREAM" = "yes"; then
             AC_MSG_ERROR([Can't use --enable-std_iostreams without std::istream and std::ostream])
         else
             AC_MSG_WARN([No std::iostreams, switching to --disable-std_iostreams])
@@ -1936,48 +1932,95 @@ if test "$wxUSE_STL" = "yes"; then
         AC_DEFINE(HAVE_STD_STRING_COMPARE)
     fi
 
-    dnl check for hash_map and hash_set headers
-    AC_CHECK_HEADER([hash_map],
-        [AC_CACHE_CHECK([for standard hash_map and hash_set],
-            wx_cv_class_stdhashmapset,
-            [AC_TRY_COMPILE([#include <hash_map>
-                #include <hash_set>],
-                [std::hash_map<double*, char*, std::hash<double*>, std::equal_to<double*> > test1;
-                 std::hash_set<char*, std::hash<char*>, std::equal_to<char*> > test2;],
-                wx_cv_class_stdhashmapset=yes,
-                wx_cv_class_stdhashmapset=no)
-            ]
-        )],
-        [],
-        [ ]
-    )
-
-    if test "$wx_cv_class_stdhashmapset" = yes; then
-        AC_DEFINE(HAVE_HASH_MAP)
-        AC_DEFINE(HAVE_STD_HASH_MAP)
+    if test "$wx_cv_class_gnuhashmapset" = yes; then
+         AC_DEFINE(HAVE_EXT_HASH_MAP)
+         AC_DEFINE(HAVE_GNU_CXX_HASH_MAP)
     fi
 
-    AC_CHECK_HEADER([ext/hash_map],
-        [AC_CACHE_CHECK([for GNU hash_map and hash_set],
-            wx_cv_class_gnuhashmapset,
-            [AC_TRY_COMPILE([#include <ext/hash_map>
-                #include <ext/hash_set>],
-                [__gnu_cxx::hash_map<double*, char*, __gnu_cxx::hash<double*>, std::equal_to<double*> > test1;
-                 __gnu_cxx::hash_set<char*, __gnu_cxx::hash<char*>, std::equal_to<char*> > test2;],
-                wx_cv_class_gnuhashmapset=yes,
-                wx_cv_class_gnuhashmapset=no)
+    AC_CHECK_HEADER([unordered_map],
+        [AC_CACHE_CHECK([for unordered_map and unordered_set in std],
+            wx_cv_class_stdunorderedmapset,
+            [AC_TRY_COMPILE([#include <unordered_map>
+                #include <unordered_set>],
+                [std::unordered_map<double*, char*> test1;
+                 std::unordered_set<char*> test2;],
+                wx_cv_class_stdunorderedmapset=yes,
+                wx_cv_class_stdunorderedmapset=no)
             ]
         )],
         [],
         [ ]
     )
 
-    if test "$wx_cv_class_gnuhashmapset" = yes; then
-         AC_DEFINE(HAVE_EXT_HASH_MAP)
-         AC_DEFINE(HAVE_GNU_CXX_HASH_MAP)
+    if test "$wx_cv_class_stdunorderedmapset" = yes; then
+         AC_DEFINE(HAVE_STD_UNORDERED_MAP)
+         AC_DEFINE(HAVE_STD_UNORDERED_SET)
+    else
+        AC_CHECK_HEADER([tr1/unordered_map],
+            [AC_CACHE_CHECK([for unordered_map and unordered_set in std::tr1],
+                wx_cv_class_tr1unorderedmapset,
+                [AC_TRY_COMPILE([#include <tr1/unordered_map>
+                    #include <tr1/unordered_set>],
+                    [std::tr1::unordered_map<double*, char*> test1;
+                     std::tr1::unordered_set<char*> test2;
+            #if defined(__GNUC__) && (__GNUC__==4) && (__GNUC_MINOR__<2)
+            #error can't use unordered_{map,set} with gcc-4.[01]: http://gcc.gnu.org/PR24389
+            #endif],
+                    wx_cv_class_tr1unorderedmapset=yes,
+                    wx_cv_class_tr1unorderedmapset=no)
+                ]
+            )],
+            [],
+            [ ]
+        )
+
+        if test "$wx_cv_class_tr1unorderedmapset" = yes; then
+            AC_DEFINE(HAVE_TR1_UNORDERED_MAP)
+            AC_DEFINE(HAVE_TR1_UNORDERED_SET)
+        else
+            dnl check for hash_map and hash_set headers
+            AC_CHECK_HEADER([hash_map],
+                [AC_CACHE_CHECK([for std::hash_map and hash_set],
+                    wx_cv_class_stdhashmapset,
+                    [AC_TRY_COMPILE([#include <hash_map>
+                        #include <hash_set>],
+                        [std::hash_map<double*, char*, std::hash<double*>, std::equal_to<double*> > test1;
+                         std::hash_set<char*, std::hash<char*>, std::equal_to<char*> > test2;],
+                        wx_cv_class_stdhashmapset=yes,
+                        wx_cv_class_stdhashmapset=no)
+                    ]
+                )],
+                [],
+                [ ]
+            )
+
+            if test "$wx_cv_class_stdhashmapset" = yes; then
+                AC_DEFINE(HAVE_HASH_MAP)
+                AC_DEFINE(HAVE_STD_HASH_MAP)
+            fi
+
+            AC_CHECK_HEADER([ext/hash_map],
+                [AC_CACHE_CHECK([for GNU hash_map and hash_set],
+                    wx_cv_class_gnuhashmapset,
+                    [AC_TRY_COMPILE([#include <ext/hash_map>
+                        #include <ext/hash_set>],
+                        [__gnu_cxx::hash_map<double*, char*, __gnu_cxx::hash<double*>, std::equal_to<double*> > test1;
+                         __gnu_cxx::hash_set<char*, __gnu_cxx::hash<char*>, std::equal_to<char*> > test2;],
+                        wx_cv_class_gnuhashmapset=yes,
+                        wx_cv_class_gnuhashmapset=no)
+                    ]
+                )],
+                [],
+                [ ]
+            )
+
+        fi
     fi
 fi
 
+dnl check for atomic operations builtins for wx/atomic.h:
+WX_ATOMIC_BUILTINS
+
 dnl pop C++
 AC_LANG_POP()
 
@@ -1997,6 +2040,10 @@ dnl In the same vein. Motif 2.1 should be tried before Motif 1.2 for the
 dnl systems which have both (AIX 4.x does)
 SEARCH_INCLUDE="\
     /usr/local/include        \
+    /usr/local/X11/include    \
+    /usr/local/include/X11    \
+    /usr/local/X11R6/include  \
+    /usr/local/include/X11R6  \
                               \
     /usr/Motif-2.1/include    \
     /usr/Motif-1.2/include    \
@@ -2009,29 +2056,25 @@ SEARCH_INCLUDE="\
                               \
     /usr/X11R6/include        \
     /usr/X11R6.4/include      \
-    /usr/X11R5/include        \
-    /usr/X11R4/include        \
                               \
     /usr/include/X11R6        \
-    /usr/include/X11R5        \
-    /usr/include/X11R4        \
-                              \
-    /usr/local/X11R6/include  \
-    /usr/local/X11R5/include  \
-    /usr/local/X11R4/include  \
-                              \
-    /usr/local/include/X11R6  \
-    /usr/local/include/X11R5  \
-    /usr/local/include/X11R4  \
                               \
     /usr/X11/include          \
     /usr/include/X11          \
-    /usr/local/X11/include    \
-    /usr/local/include/X11    \
                               \
     /usr/XFree86/include/X11  \
     /usr/pkg/include          \
                               \
+    /usr/local/X1R5/include  \
+    /usr/local/include/X11R5  \
+    /usr/X11R5/include        \
+    /usr/include/X11R5        \
+                              \
+    /usr/local/X11R4/include  \
+    /usr/local/include/X11R4  \
+    /usr/X11R4/include        \
+    /usr/include/X11R4        \
+                              \
     /usr/openwin/share/include"
 
 dnl try to find out the standard lib locations for the systems with multiple
@@ -2257,7 +2300,7 @@ if test "$wxUSE_REGEX" != "no"; then
     AC_DEFINE(wxUSE_REGEX)
 
     if test "$wxUSE_UNICODE" = "yes" -a "$wxUSE_REGEX" = "yes"; then
-        AC_MSG_WARN([Defaulting to the the builtin regex library for Unicode build.])
+        AC_MSG_WARN([Defaulting to the builtin regex library for Unicode build.])
         wxUSE_REGEX=builtin
     fi
 
@@ -2428,6 +2471,8 @@ dnl ------------------------------------------------------------------------
 dnl Check for jpeg library
 dnl ------------------------------------------------------------------------
 
+dnl this check must be done before the check for libtiff as libtiff uses
+dnl libjpeg itself
 JPEG_LINK=
 if test "$wxUSE_LIBJPEG" != "no" ; then
     AC_DEFINE(wxUSE_LIBJPEG)
@@ -2543,6 +2588,18 @@ if test "$wxUSE_LIBTIFF" != "no" ; then
             wxUSE_LIBTIFF=sys
         fi
     fi
+    if test "$wxUSE_LIBTIFF" = "builtin" ; then
+        if test "$wxUSE_LIBJPEG" = "no"; then
+            dnl we have to prevent the builtin libtiff configure from building the
+            dnl library with JPEG support as this was explicitly disabled by user,
+            dnl but unfortunately it needs --disable-jpeg and not --without-libjpeg
+            dnl (which will be passed to it anyhow as configure passes arguments to
+            dnl the top-level script to all the other ones called recursively), so
+            dnl we need to hack around this
+            ac_configure_args="$ac_configure_args --disable-jpeg"
+        fi
+        AC_CONFIG_SUBDIRS([src/tiff])
+    fi
 fi
 
 dnl ------------------------------------------------------------------------
@@ -2646,8 +2703,15 @@ 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 -lctl3d32 -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"
+        ;;
+    esac
     if test "$wxUSE_ACCESSIBILITY" = "yes" ; then
         LIBS="$LIBS -loleacc"
     fi
@@ -2658,16 +2722,6 @@ if test "$USE_WIN32" = 1 ; then
             LIBS="$LIBS -lkernel32 -luser32"
     esac
 
-    dnl add extra odbc libs if we have compiled in odbc
-    if test "$wxUSE_ODBC" = "sys" ; then
-        wxUSE_ODBC = "yes"
-    fi
-    if test "$wxUSE_ODBC" = "yes" ; then
-        LIBS=" -lodbc32 -lole32 -loleaut32 $LIBS"
-        AC_DEFINE(wxUSE_ODBC)
-    fi
-    dnl We might want to abort here if wxUSE_ODBC="builtin" isn't supported on msw.
-
     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__"
     RESPROGRAMOBJ="\$(PROGRAM)_resources.o"
@@ -2691,7 +2745,7 @@ if test "$wxUSE_GUI" = "yes"; then
 
     WXGTK12=
     WXGTK127=
-    WXGTK20=
+    WXGTK2=
     WXGPE=
 
     if test "$wxUSE_COCOA" = 1 ; then
@@ -2753,7 +2807,7 @@ if test "$wxUSE_GUI" = "yes"; then
                             fi
                     esac
 
-                    AM_PATH_GTK_2_0(2.0.0, wx_cv_lib_gtk=2.0, , $GTK_MODULES)
+                    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
@@ -2794,7 +2848,7 @@ if test "$wxUSE_GUI" = "yes"; then
         fi
 
         case "$wx_cv_lib_gtk" in
-            2.0)    WXGTK20=1
+            2.0)    WXGTK2=1
                     TOOLKIT_VERSION=2
                     ;;
             1.2.7)  WXGTK127=1
@@ -2813,21 +2867,12 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
                     ;;
         esac
 
-        if test "$WXGTK20" = 1; then
+        if test "$WXGTK2" = 1; then
             save_CFLAGS="$CFLAGS"
             save_LIBS="$LIBS"
             CFLAGS="$wx_cv_cflags_gtk $CFLAGS"
             LIBS="$LIBS $wx_cv_libs_gtk"
 
-            dnl gtk_icon_size_lookup is not available in the GTK+ headers
-            dnl that have shipped with some versions of Sun's JDS. Not using
-            dnl AC_CHECK_FUNCS here since it only checks the function exists
-            dnl in the lib (not the header).
-            AC_CHECK_DECLS([gtk_icon_size_lookup], [],
-                           [AC_DEFINE(NEED_GTK_ICON_SIZE_LOOKUP)],
-                           [#include <gtk/gtk.h>])
-
-
             dnl test if we have at least GTK+ 2.10:
             AC_MSG_CHECKING([if GTK+ is version >= 2.10])
             AC_TRY_COMPILE([
@@ -2841,7 +2886,6 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
                            [
                             AC_DEFINE(__WXGTK210__)
                             AC_DEFINE(__WXGTK26__)
-                            AC_DEFINE(__WXGTK24__)
                             AC_MSG_RESULT([yes])
                             ac_wxgtk210=1
                            ],
@@ -2863,7 +2907,6 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
                             ],
                             [
                                 AC_DEFINE(__WXGTK26__)
-                                AC_DEFINE(__WXGTK24__)
                                 AC_MSG_RESULT([yes])
                                 ac_wxgtk26=1
                             ],
@@ -2873,26 +2916,6 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
                             ])
             fi
 
-            if test "$ac_wxgtk26" = 0; then
-                dnl test if we have at least GTK+ 2.4:
-                AC_MSG_CHECKING([if GTK+ is version >= 2.4])
-                AC_TRY_COMPILE([
-                                #include <gtk/gtk.h>
-                            ],
-                            [
-                                #if !GTK_CHECK_VERSION(2,4,0)
-                                Not GTK+ 2.4
-                                #endif
-                            ],
-                            [
-                                AC_DEFINE(__WXGTK24__)
-                                AC_MSG_RESULT([yes])
-                            ],
-                            [
-                                AC_MSG_RESULT([no])
-                            ])
-            fi
-
             CFLAGS="$save_CFLAGS"
             LIBS="$save_LIBS"
         else
@@ -3223,9 +3246,9 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
         libsm_ice_link=""
         libs_found=0
         for libp in "" " -lXp"; do
-            if test "$libs_found" = "0"; then
+            if test "$libs_found" = 0; then
                 for libsm_ice in "" " -lSM -lICE"; do
-                    if test "$libs_found" = "0"; then
+                    if test "$libs_found" = 0; then
                         save_LIBS="$LIBS"
                         LIBS="$GUI_TK_LIBRARY -lXm ${libp} -lXmu -lXext -lXt${libsm_ice} -lX11"
                         save_CFLAGS=$CFLAGS
@@ -3258,7 +3281,7 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
             fi
         done
 
-        if test "$libs_found" = "0"; then
+        if test "$libs_found" = 0; then
             AC_MSG_RESULT([can't find the right libraries])
             AC_MSG_ERROR([can't link a simple motif program])
         fi
@@ -3391,7 +3414,7 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
         fi
     fi
 
-    if test "$wxUSE_MAC" = 1; then
+    if test "$wxUSE_OSX_CARBON" = 1; then
         AC_MSG_CHECKING([for compiler syntax to enable Pascal strings])
         if test "$GCC" = yes; then
             AC_MSG_RESULT([gcc])
@@ -3410,14 +3433,19 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
             CPPFLAGS="$CPPFLAGS_PASCAL -I\${top_srcdir}/src/mac/carbon/morefilex -DTARGET_CARBON $CPPFLAGS"
         fi
 
-        TOOLKIT=MAC
+        TOOLKIT=OSX_CARBON
         dnl we can't call this MAC_DIST or autoconf thinks its a macro
-        GUIDIST=MACX_DIST
+        GUIDIST=OSX_CARBON_DIST
         dnl wxMac version of wxBase and wxCocoa or wxBase-only built on Darwin
         dnl are different, so they need different names:
         WXBASEPORT="_carbon"
     fi
 
+    if test "$wxUSE_OSX_COCOA" = 1; then
+        TOOLKIT=OSX_COCOA
+        GUIDIST=OSX_COCOA_DIST
+    fi
+
     if test "$wxUSE_COCOA" = 1; then
         TOOLKIT=COCOA
         GUIDIST=COCOA_DIST
@@ -3452,7 +3480,7 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
     if test "$TOOLKIT" = "PM" ; then
         TOOLKIT_DIR="os2"
     else
-        TOOLKIT_DIR=`echo ${TOOLKIT} | tr "[[A-Z]]" "[[a-z]]"`
+        TOOLKIT_DIR=`echo ${TOOLKIT} | tr '[[A-Z]]' '[[a-z]]'`
     fi
 
     if test "$wxUSE_UNIVERSAL" = "yes"; then
@@ -3490,11 +3518,9 @@ 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 "$TOOLKIT" = "DFB" ; then
-        wxUSE_UNICODE_UTF8=yes
-    elif test "$TOOLKIT" = "GTK" -a "$WXGTK20" = "1" ; then
+    if test "$USE_UNIX" = 1 -a "$wxUSE_DARWIN" != 1 ; then
         wxUSE_UNICODE_UTF8=yes
-    elif test "$USE_OS2" = "1" ; then
+    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.
@@ -3523,56 +3549,6 @@ if test "$wxUSE_GUI" = "yes"; then
 fi
 
 
-dnl ----------------------------------------------------------------
-dnl iODBC support
-dnl ----------------------------------------------------------------
-
-IODBC_C_SRC=""
-
-
-dnl ODBC is handled separately for MSW
-if test "$TOOLKIT" != "MSW" ; then
-
-    if test "$wxUSE_ODBC" = "sys" -o "$wxUSE_ODBC" = "yes" ; then
-        dnl This is not ideal we really ough to use the unixodbc-config
-        dnl  or iodbc-config if they exist.
-
-        AC_CHECK_HEADER([sql.h], [found_sql_h=1],, [ ])
-        if test "x$found_sql_h" = "x1" ; then
-            AC_CHECK_LIB(iodbc, SQLAllocEnv, ODBC_LINK=" -liodbc",
-            [
-                AC_CHECK_LIB(unixodbc, SQLAllocEnv, ODBC_LINK=" -lunixodbc",
-                [
-                    AC_CHECK_LIB(odbc, SQLAllocEnv, ODBC_LINK=" -lodbc")
-                ])
-            ])
-        fi
-        if test "x$ODBC_LINK" = "x" ; then
-            if test "$wxUSE_ODBC" = "sys" ; then
-                AC_MSG_ERROR([system ODBC library not found! Use --with-odbc=builtin to use built-in version])
-            else
-                AC_MSG_WARN([system ODBC library not found, will use built-in instead])
-                wxUSE_ODBC=builtin
-            fi
-        else
-            dnl we are using the system library
-            wxUSE_ODBC=sys
-        fi
-    fi
-
-    if test "$wxUSE_ODBC" = "builtin" ; then
-        AC_DEFINE(wxUSE_BUILTIN_IODBC)
-    fi
-fi
-
-if test "$wxUSE_ODBC" != "no" ; then
-    AC_DEFINE(wxUSE_ODBC)
-    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS db"
-
-    dnl is this still necessary?
-    WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS -D_IODBC_"
-fi
-
 dnl ---------------------------------------------------------------------------
 dnl wxDisplay Sanity checks
 dnl ---------------------------------------------------------------------------
@@ -3654,10 +3630,10 @@ dnl ---------------------------------------------------------------------------
 
 USE_OPENGL=0
 if test "$wxUSE_OPENGL" = "yes"; then
-    if test "$wxUSE_MGL" = 1 -o "$wxUSE_DFB" = "1"; 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_MAC" = 1 -o "$wxUSE_COCOA" = "1"; then
+    elif test "$wxUSE_OSX_CARBON" = 1 -o "$wxUSE_OSX_COCOA" = 1 -o "$wxUSE_COCOA" = 1; then
         OPENGL_LIBS="-framework OpenGL -framework AGL"
     elif test "$wxUSE_MSW" = 1; then
         OPENGL_LIBS="-lopengl32 -lglu32"
@@ -3838,9 +3814,6 @@ EOF
       ;;
 
       *-*-cygwin* | *-*-mingw32* )
-        dnl this one shouldn't be used for the library build so put it in a
-        dnl separate variable from WXCONFIG_CPPFLAGS
-        WXCONFIG_ONLY_CPPFLAGS="$WXCONFIG_ONLY_CPPFLAGS -DWXUSINGDLL"
         ;;
 
       *-*-hpux* )
@@ -3851,6 +3824,10 @@ EOF
     esac
     fi
 
+    dnl this one shouldn't be used for the library build so put it in a
+    dnl separate variable from WXCONFIG_CPPFLAGS
+    WXCONFIG_ONLY_CPPFLAGS="$WXCONFIG_ONLY_CPPFLAGS -DWXUSINGDLL"
+
     if test $wxUSE_RPATH = "no"; then
         SAMPLES_RPATH_FLAG=''
         SAMPLES_RPATH_POSTLINK=''
@@ -3893,7 +3870,7 @@ 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}${lib_debug_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}"
 
@@ -3941,55 +3918,11 @@ dnl to not typedef Point and thus fix the problem.
             AC_DEFINE(__Point__)
             ],
             [AC_MSG_FAILURE([no])]
-        )]
-    )
-    AC_LANG_RESTORE
-fi
-
-if test "$wxUSE_MAC" = 1 -o "$wxUSE_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"
-    WX_RESOURCES_MACOSX_DATA="libwx_${TOOLCHAIN_NAME}.${wx_release_number}.rsrc"
-
-    dnl add the resources target for wxMac
-    LIBWXMACRES="\$(wx_top_builddir)/lib/${WX_RESOURCES_MACOSX_ASCII}"
-
-    AC_CHECK_PROG(REZ, Rez, Rez, /Developer/Tools/Rez)
-    AC_CHECK_PROG(DEREZ, DeRez, DeRez, /Developer/Tools/DeRez)
-    AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile)
-
-    MACSETFILE="\$(SETFILE)"
-
-    dnl resources are bundled both with shared library and applications
-    dnl since the carb resource *must* be included in the application
-    if test "$wxUSE_MAC" = 1; then
-        POSTLINK_COMMAND="\$(REZ) -d __DARWIN__ -t APPL Carbon.r -o"
-        RESCOMP="$REZ"
-        WXCONFIG_RESFLAGS="-d __DARWIN__ -t APPL Carbon.r -o"
-    else
-        POSTLINK_COMMAND="cat /dev/null | \$(REZ) -d __DARWIN__ -t APPL ${LIBWXMACRES}"
-        RESCOMP="cat /dev/null \| $REZ"
-        WXCONFIG_RESFLAGS="-d __DARWIN__ -t APPL \$libdir/$WX_RESOURCES_MACOSX_ASCII"
-    fi
-
-else
-    dnl default value is to (silently) do nothing in the makefile
-    MACSETFILE="@true"
-
-    if test "$wxUSE_PM" = 1; then
-        RESCOMP="emxbind"
-        WXCONFIG_RESFLAGS="-ep"
-
-        dnl Is this one really used anywhere for pm?
-        POSTLINK_COMMAND="$RESCOMP $WXCONFIG_RESFLAGS"
-    else
-        POSTLINK_COMMAND="@true"
-    fi
-
+        )]
+    )
+    AC_LANG_RESTORE
 fi
 
-
 dnl ---------------------------------------------------------------------------
 dnl Checks for typedefs
 dnl ---------------------------------------------------------------------------
@@ -4002,8 +3935,6 @@ dnl   defines pid_t if not already defined
 AC_TYPE_PID_T
 dnl   defines size_t if not already defined
 AC_TYPE_SIZE_T
-dnl   defines uid_t and gid_t if not already defined
-AC_TYPE_UID_T
 
 dnl sets HAVE_SSIZE_T if ssize_t is defined
 AC_CHECK_TYPES(ssize_t)
@@ -4169,8 +4100,9 @@ dnl
 dnl so we first check if the function is in the library
 dnl
 dnl FIXME: replace this mess with WX_CHECK_FUNCS()
-AC_CHECK_FUNCS(snprintf vsnprintf)
+AC_CHECK_FUNCS(snprintf vsnprintf vsscanf)
 
+AC_LANG_PUSH(C++)
 if test "$ac_cv_func_vsnprintf" = "yes"; then
     dnl yes it is -- now check if it is in the headers
     AC_CACHE_CHECK([for vsnprintf declaration], wx_cv_func_vsnprintf_decl,
@@ -4265,36 +4197,6 @@ if test "$ac_cv_func_snprintf" = "yes"; then
 
     if test "$wx_cv_func_snprintf_decl" = "yes"; then
         AC_DEFINE(HAVE_SNPRINTF_DECL)
-
-        dnl we know there is an snprintf declaration, but some old headers
-        dnl may have one taking a "char *" format instead of "const char *"
-        AC_CACHE_CHECK([if snprintf declaration is broken], wx_cv_func_broken_snprintf_decl,
-            [
-                AC_TRY_COMPILE(
-                    [
-                        #include <stdio.h>
-                        #include <stdarg.h>
-                        #ifdef __MSL__
-                        #if __MSL__ >= 0x6000
-                        namespace std {}
-                        using namespace std;
-                        #endif
-                        #endif
-                    ],
-                    [
-                        char *buf;
-                        const char *fmt = "%s";
-                        snprintf(buf, 10u, fmt, "wx");
-                    ],
-                    wx_cv_func_broken_snprintf_decl=no,
-                    wx_cv_func_broken_snprintf_decl=yes
-                )
-            ]
-        )
-
-        if test "$wx_cv_func_broken_snprintf_decl" = "yes"; then
-            AC_DEFINE(HAVE_BROKEN_SNPRINTF_DECL)
-        fi
     fi
 
     if test "$wxUSE_PRINTF_POS_PARAMS" = "yes"; then
@@ -4336,39 +4238,40 @@ define HAVE_UNIX98_PRINTF as 1 in setup.h if it is available.])
     fi
 fi
 
-if test "$wxUSE_UNICODE" = yes; then
-
-    dnl our wxVsnprintf() implementation needs to use the system swprintf() in Unicode
-    dnl builds so let's check if swprintf() is declared as C99 imposes:
-    dnl     int swprintf(wchar_t *s, size_t n, const wchar_t *format, ...);
-    dnl or rather as:
-    dnl     int swprintf(wchar_t *s, const wchar_t *format, ...);
-    AC_CHECK_FUNCS(swprintf)
-
-    if test "$ac_cv_func_swprintf" = "yes"; then
-        AC_CACHE_CHECK([if swprintf declaration is broken], wx_cv_func_broken_swprintf_decl,
-            [
-                AC_TRY_COMPILE(
-                    [
-                        #include <stdio.h>
-                        #include <stdarg.h>
-                        #include <wchar.h>
-                    ],
-                    [
-                        wchar_t *buf;
-                        const wchar_t *fmt = L"test";
-                        swprintf(buf, 10u, fmt);
-                    ],
-                    wx_cv_func_broken_swprintf_decl=no,
-                    wx_cv_func_broken_swprintf_decl=yes
-                )
-            ]
-        )
+dnl the same as above but for vsscanf() now: it's not present in at least
+dnl Solaris 9 headers for gcc-3.4 (due to fixinclude's processing of stdio.h)
+if test "$ac_cv_func_vsscanf" = "yes"; then
+    AC_CACHE_CHECK([for vsscanf declaration], wx_cv_func_vsscanf_decl,
+        [
+            AC_TRY_COMPILE(
+                [
+                    #include <stdio.h>
+                    #include <stdarg.h>
+                    #ifdef __MSL__
+                    #if __MSL__ >= 0x6000
+                    namespace std {}
+                    using namespace std;
+                    #endif
+                    #endif
+                ],
+                [
+                    char *buf;
+                    va_list args;
+                    vsscanf(buf, "%s", args);
+                ],
+                wx_cv_func_vsscanf_decl=yes,
+                wx_cv_func_vsscanf_decl=no
+            )
+        ]
+    )
 
-        if test "$wx_cv_func_broken_swprintf_decl" = "yes"; then
-            AC_DEFINE(HAVE_BROKEN_SWPRINTF_DECL)
-        fi
+    if test "$wx_cv_func_vsscanf_decl" = "yes"; then
+        AC_DEFINE(HAVE_VSSCANF_DECL)
     fi
+fi
+AC_LANG_POP()
+
+if test "$wxUSE_UNICODE" = yes; then
 
     dnl also look if we have wide char IO functions, notice that [f]putws are
     dnl declared in special widec.h under Solaris
@@ -4383,7 +4286,7 @@ if test "$wxUSE_UNICODE" = yes; then
             fi
     esac
 
-    WX_CHECK_FUNCS(wputc wputchar putws fputws wprintf vswprintf,,,
+    WX_CHECK_FUNCS(putws fputws wprintf vswprintf vswscanf,,,
                    [$wchar_headers])
 
     dnl MinGW has a vswprintf with a different prototype, and
@@ -4397,10 +4300,6 @@ if test "$wxUSE_UNICODE" = yes; then
                    [AC_MSG_RESULT([no])]);
 fi
 
-if test "x$ac_cv_header_fnmatch_h" = "xyes"; then
-    WX_CHECK_FUNCS(fnmatch,,,[#include <fnmatch.h>])
-fi
-
 if test "$wxUSE_FILE" = "yes"; then
     WX_CHECK_FUNCS(fsync)
 fi
@@ -4415,9 +4314,10 @@ dnl the following tests are for Unix(like) systems only
 if test "$TOOLKIT" != "MSW"; then
 
 dnl check for available version of iconv()
-
-AM_ICONV
-LIBS="$LIBICONV $LIBS"
+if test "$wxUSE_LIBICONV" != "no" ; then
+    AM_ICONV
+    LIBS="$LIBICONV $LIBS"
+fi
 
 dnl check for POSIX signals if we need them
 if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes" -a "$wxUSE_UNIX" = "yes"; then
@@ -4497,7 +4397,7 @@ if test "$wxUSE_STACKWALKER" = "yes" -a "$wxUSE_UNIX" = "yes"; then
     fi
 fi
 
-if test "$wxUSE_STACKWALKER" = "yes" -a "$USE_WIN32" != "1" -a "$USE_UNIX" != "1"; then
+if test "$wxUSE_STACKWALKER" = "yes" -a "$USE_WIN32" != 1 -a "$USE_UNIX" != 1; then
     AC_MSG_WARN([wxStackWalker is only available on Win32 and UNIX... disabled])
     wxUSE_STACKWALKER=no
 fi
@@ -4645,11 +4545,11 @@ if test "$wxUSE_SNGLINST_CHECKER" = "yes"; then
     fi
 fi
 
-dnl check for timegm() used by datetime.cpp
-AC_CHECK_FUNCS(timegm)
-
 dnl look for a function to modify the environment
 AC_CHECK_FUNCS(setenv putenv, break)
+if test "$ac_cv_func_setenv" = "yes"; then
+    AC_CHECK_FUNCS(unsetenv)
+fi
 
 HAVE_SOME_SLEEP_FUNC=0
 if test "$USE_BEOS" = 1; then
@@ -4731,6 +4631,32 @@ fi
 
 WX_CHECK_FUNCS(fdopen)
 
+if test "$wxUSE_TARSTREAM" = "yes"; then
+    WX_CHECK_FUNCS(sysconf)
+
+    WX_CHECK_FUNCS(getpwuid_r, [], [],
+                   [
+                    #define _REENTRANT
+                    #include <pwd.h>
+                   ],
+                   [[
+                    struct passwd pw, *ppw;
+                    char buf[1024];
+                    getpwuid_r(0, &pw, buf, sizeof(buf), &ppw)
+                   ]])
+
+    WX_CHECK_FUNCS(getgrgid_r, [], [],
+                   [
+                    #define _REENTRANT
+                    #include <grp.h>
+                   ],
+                   [[
+                    struct group grp, *pgrp;
+                    char buf[1024];
+                    getgrgid_r(0, &grp, buf, sizeof(buf), &pgrp)
+                   ]])
+fi
+
 fi
 
 
@@ -5072,12 +4998,32 @@ if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
           AC_MSG_WARN([wxMutex won't be recursive on this platform])
         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>],
+              [
+                  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
     fi
 
 dnl from if !MSW
 else
     if test "$wxUSE_THREADS" = "yes" ; then
       case "${host}" in
+        x86_64-*-mingw32* )
+        ;;
         *-*-mingw32* )
             dnl check if the compiler accepts -mthreads
             AC_CACHE_CHECK([if compiler supports -mthreads],
@@ -5111,7 +5057,6 @@ fi
 
 AC_CHECK_FUNC(localtime_r, [ AC_DEFINE(HAVE_LOCALTIME_R) ])
 AC_CHECK_FUNC(gmtime_r, [ AC_DEFINE(HAVE_GMTIME_R) ])
-AC_CHECK_FUNC(readdir_r, [ AC_DEFINE(HAVE_READDIR_R) ])
 dnl By preference, we probably should use getaddrinfo which avoids thread
 dnl safety issues and supports IPv6, however there currently is no code
 dnl for it, so testing for it is temporarily disabled and we are restricted
@@ -5163,8 +5108,8 @@ else
   fi
 fi
 
-if test "$WXGTK20" = 1 ; then
-  AC_DEFINE_UNQUOTED(__WXGTK20__,$WXGTK20)
+if test "$WXGTK2" = 1 ; then
+  AC_DEFINE_UNQUOTED(__WXGTK20__,$WXGTK2)
   WXGTK12=1
 fi
 
@@ -5185,7 +5130,6 @@ 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
     DEBUG_CFLAGS="-g"
-    wxUSE_OPTIMISE=no
 fi
 
 if test "$wxUSE_DEBUG_GDB" = "yes" ; then
@@ -5335,10 +5279,7 @@ if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
     HAVE_DL_FUNCS=0
     HAVE_SHL_FUNCS=0
     if test "$wxUSE_DYNAMIC_LOADER" = "yes" -o "$wxUSE_DYNLIB_CLASS" = "yes" ; then
-        if test "$USE_DARWIN" = 1; then
-            dnl dlopen/dlerror is implemented in dynlib.cpp for Darwin/Mac OS X
-            HAVE_DL_FUNCS=1
-        elif test "$USE_DOS" = 1; then
+        if test "$USE_DOS" = 1; then
             HAVE_DL_FUNCS=0
         else
             dnl the test is a bit complicated because we check for dlopen() both with
@@ -5372,15 +5313,21 @@ if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
                             ])
             ])
 
-        dnl check also for dlerror()
-        if test "$HAVE_DL_FUNCS" = 1; then
-            AC_CHECK_FUNCS(dlerror,
-                AC_DEFINE(HAVE_DLERROR),
-                [
-                    AC_CHECK_LIB(dl, dlerror, AC_DEFINE(HAVE_DLERROR))
-                ]
-            )
+            dnl check also for dlerror()
+            if test "$HAVE_DL_FUNCS" = 1; then
+                AC_CHECK_FUNCS(dlerror,
+                    AC_DEFINE(HAVE_DLERROR),
+                    [
+                        AC_CHECK_LIB(dl, dlerror, AC_DEFINE(HAVE_DLERROR))
+                    ]
+                )
+            fi
         fi
+
+        dnl Force HAVE_DL_FUNCS on for Darwin, even if the tests failed (e.g. pre-10.3)
+        if test "$USE_DARWIN" = 1; then
+            dnl dlopen/dlerror is implemented in dynlib.cpp for Darwin/Mac OS X
+            HAVE_DL_FUNCS=1
         fi
 
         if test "$HAVE_DL_FUNCS" = 0; then
@@ -5449,7 +5396,7 @@ fi
 
 dnl Unix implementation needs additional checks because audio support
 dnl comes in many favours:
-if test "$USE_UNIX" = "1" ; then
+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
@@ -5492,7 +5439,7 @@ fi
 
 WITH_PLUGIN_SDL=0
 if test "$wxUSE_SOUND" = "yes"; then
-  if test "$USE_UNIX" = "1" ; then
+  if test "$USE_UNIX" = 1 ; then
     if test "$wxUSE_LIBSDL" != "no"; then
       AM_PATH_SDL([1.2.0],
                   [
@@ -5520,10 +5467,27 @@ if test "$wxUSE_SOUND" = "yes"; then
   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS sound"
 fi
 
-if test "$WXGTK20" = 1; then
+if test "$WXGTK2" = 1; then
     PKG_PROG_PKG_CONFIG()
 
     if test "$wxUSE_PRINTING_ARCHITECTURE" = "yes" ; then
+
+        if test "$wxUSE_GTKPRINT" = "yes" ; then
+
+                PKG_CHECK_MODULES(GTKPRINT,
+                                  [gtk+-unix-print-2.0 >= 2.10],
+                    [
+                        CFLAGS="$GTKPRINT_CFLAGS $CFLAGS"
+                        CXXFLAGS="$GTKPRINT_CFLAGS $CXXFLAGS"
+                        AC_DEFINE(wxUSE_GTKPRINT)
+                    ],
+                    [
+                        AC_MSG_WARN([GTK printing support not found (GTK+ >= 2.10), library will use GNOME printing support or standard PostScript printing])
+                        wxUSE_GTKPRINT="no"
+                    ]
+                )
+        fi
+
         if test "$wxUSE_LIBGNOMEPRINT" = "yes" ; then
 
                 PKG_CHECK_MODULES(LIBGNOMEPRINTUI,
@@ -5662,7 +5626,7 @@ if test "$wxUSE_STACKWALKER" = "yes"; then
 fi
 
 if test "$wxUSE_DEBUGREPORT" = "yes"; then
-    if test "$USE_UNIX" != "1" -a "$USE_WIN32" != "1"; then
+    if test "$USE_UNIX" != 1 -a "$USE_WIN32" != 1; then
         AC_MSG_WARN([Creating debug reports not currently supported on this system, disabled])
         wxUSE_DEBUGREPORT=no
     else
@@ -5725,6 +5689,13 @@ if test "$wxUSE_INTL" = "yes" ; then
   fi
 fi
 
+if test "$wxUSE_XLOCALE" = "yes" ; then
+    AC_DEFINE(wxUSE_XLOCALE)
+    AC_CHECK_TYPES(locale_t,,,
+                   [#include <xlocale.h>
+                    #include <locale.h>])
+fi
+
 if test "$wxUSE_LOG" = "yes"; then
   AC_DEFINE(wxUSE_LOG)
 
@@ -5993,7 +5964,7 @@ 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
+    if test "$wxUSE_MGL" = 1; then
         AC_MSG_WARN([wxSocket not yet supported under MGL... disabled])
         wxUSE_SOCKETS="no"
     fi
@@ -6149,6 +6120,33 @@ if test "$wxUSE_SOCKETS" = "yes" ; then
 fi
 
 if test "$wxUSE_SOCKETS" = "yes" ; then
+    if test "$wxUSE_IPV6" = "yes"; then
+        AC_CACHE_CHECK(
+            [whether we have sockaddr_in6],
+            [wx_cv_type_sockaddr_in6],
+            [
+                AC_TRY_COMPILE(
+                    [
+                        #include <sys/types.h>
+                        #include <sys/socket.h>
+                        #include <netinet/in.h>
+                    ],
+                    [
+                        struct sockaddr_in6 sa6;
+                    ],
+                    wx_cv_type_sockaddr_in6=yes,
+                    wx_cv_type_sockaddr_in6=no
+                )
+            ]
+        )
+
+        if test "$wx_cv_type_sockaddr_in6"="yes"; then
+            AC_DEFINE(wxUSE_IPV6)
+        else
+            AC_MSG_WARN([IPv6 support not available... disabled])
+        fi
+    fi
+
     AC_DEFINE(wxUSE_SOCKETS)
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS sockets"
 fi
@@ -6209,7 +6207,7 @@ if test "$wxUSE_GUI" = "yes" -a "$wxUSE_JOYSTICK" = "yes"; then
         wxUSE_JOYSTICK=yes
 
     dnl mac only available on darwin
-    elif test "$TOOLKIT" = "MAC" -o "$TOOLKIT" = "COCOA"; then
+    elif test "$TOOLKIT" = "OSX" -o "$TOOLKIT" = "COCOA"; then
         if test "$USE_DARWIN" = 1; then
             dnl check for a bug in the headers, some have bad setEventCallout
             AC_MSG_CHECKING([headers have declarations needed for joystick support])
@@ -6227,7 +6225,7 @@ 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
+        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
@@ -6308,9 +6306,6 @@ fi
 if test "$wxUSE_DOC_VIEW_ARCHITECTURE" = "yes" ; then
     AC_DEFINE(wxUSE_DOC_VIEW_ARCHITECTURE)
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS docview"
-    if test "$wxUSE_MDI_ARCHITECTURE" = "yes"; then
-        SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS docvwmdi"
-    fi
 fi
 
 if test "$wxUSE_HELP" = "yes"; then
@@ -6575,6 +6570,11 @@ if test "$wxUSE_DIRPICKERCTRL" = "yes"; then
   USES_CONTROLS=1
 fi
 
+if test "$wxUSE_FILECTRL" = "yes"; then
+  AC_DEFINE(wxUSE_FILECTRL)
+  USES_CONTROLS=1
+fi
+
 if test "$wxUSE_FILEPICKERCTRL" = "yes"; then
   AC_DEFINE(wxUSE_FILEPICKERCTRL)
   USES_CONTROLS=1
@@ -6662,6 +6662,10 @@ if test "$wxUSE_NOTEBOOK" = "yes"; then
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS notebook"
 fi
 
+if test "$wxUSE_NOTIFICATION_MESSAGE" = "yes"; then
+    AC_DEFINE(wxUSE_NOTIFICATION_MESSAGE)
+fi
+
 if test "$wxUSE_ODCOMBOBOX" = "yes"; then
   AC_DEFINE(wxUSE_ODCOMBOBOX)
   USES_CONTROLS=1
@@ -6751,6 +6755,11 @@ if test "$wxUSE_TEXTCTRL" = "yes"; then
     AC_DEFINE(wxUSE_TEXTCTRL)
     USES_CONTROLS=1
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS text"
+
+    dnl we don't have special switches to disable wxUSE_RICHEDIT[2], it doesn't
+    dnl seem useful to allow disabling them
+    AC_DEFINE(wxUSE_RICHEDIT)
+    AC_DEFINE(wxUSE_RICHEDIT2)
 fi
 
 if test "$wxUSE_TOGGLEBTN" = "yes"; then
@@ -6812,7 +6821,7 @@ if test "$wxUSE_TREECTRL" = "yes"; then
 fi
 
 if test "$wxUSE_POPUPWIN" = "yes"; then
-    if test "$wxUSE_MAC" = 1 -o "$wxUSE_COCOA" = 1 ; then
+    if test "$wxUSE_COCOA" = 1 ; then
         AC_MSG_WARN([Popup window not yet supported under Mac OS X... disabled])
     else
         if test "$wxUSE_PM" = 1; then
@@ -6876,9 +6885,6 @@ if test "$wxUSE_HTML" = "yes"; then
     AC_DEFINE(wxUSE_HTML)
     USE_HTML=1
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS html html/about html/help html/helpview html/printing html/test html/virtual html/widget html/zip htlbox"
-    if test "$wxUSE_MAC" = 1; then
-        SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS html/htmlctrl"
-    fi
 fi
 if test "$wxUSE_WEBKIT" = "yes"; then
     if test "$wxUSE_MAC" = 1 -a "$USE_DARWIN" = 1; then
@@ -6903,6 +6909,9 @@ if test "$wxUSE_WEBKIT" = "yes"; then
     else
         wxUSE_WEBKIT=no
     fi
+    if test "$wxUSE_WEBKIT" = "yes"; then
+        SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS html/htmlctrl"
+    fi
 fi
 
 USE_XRC=0
@@ -6924,6 +6933,13 @@ if test "$wxUSE_AUI" = "yes"; then
    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS aui"
 fi
 
+USE_PROPGRID=0
+if test "$wxUSE_PROPGRID" = "yes"; then
+   AC_DEFINE(wxUSE_PROPGRID)
+   USE_PROPGRID=1
+   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS propgrid"
+fi
+
 USE_STC=0
 if test "$wxUSE_STC" = "yes"; then
    AC_DEFINE(wxUSE_STC)
@@ -7094,49 +7110,67 @@ if test "$wxUSE_WIZARDDLG" = "yes"; then
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS wizard"
 fi
 
+dnl ---------------------------------------------------------------------------
+dnl options used under wxMSW and wxPM
+dnl ---------------------------------------------------------------------------
+
+if test "$wxUSE_MSW" = 1 -o "$wxUSE_PM" = 1; then
+    if test "$wxUSE_OWNER_DRAWN" = "yes"; then
+        AC_DEFINE(wxUSE_OWNER_DRAWN)
+    fi
+fi
+
 dnl ---------------------------------------------------------------------------
 dnl wxMSW-only options
 dnl ---------------------------------------------------------------------------
 
 if test "$wxUSE_MSW" = 1 ; then
 
-if test "$wxUSE_DC_CACHEING" = "yes"; then
-    AC_DEFINE(wxUSE_DC_CACHEING)
-fi
+    if test "$wxUSE_DC_CACHEING" = "yes"; then
+        AC_DEFINE(wxUSE_DC_CACHEING)
+    fi
 
-if test "$wxUSE_INICONF" = "yes"; then
-    AC_DEFINE(wxUSE_INICONF)
-fi
+    if test "$wxUSE_DIB" = "yes"; then
+        AC_DEFINE(wxUSE_WXDIB)
+    fi
 
-if test "$wxUSE_DIB" = "yes"; then
-    AC_DEFINE(wxUSE_WXDIB)
-fi
+    if test "$wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW" = "yes"; then
+        AC_DEFINE(wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW)
+    fi
 
-if test "$wxUSE_OWNER_DRAWN" = "yes"; then
-    AC_DEFINE(wxUSE_OWNER_DRAWN)
-fi
+    if test "$wxUSE_UXTHEME" = "yes"; then
+        AC_DEFINE(wxUSE_UXTHEME)
+    fi
 
-if test "$wxUSE_REGKEY" = "yes"; then
-    AC_DEFINE(wxUSE_REGKEY)
 fi
+dnl wxUSE_MSW = 1
 
-if test "$wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW" = "yes"; then
-    AC_DEFINE(wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW)
+dnl not quite MSW-only although mostly useful to disable this under MSW
+if test "$wxUSE_AUTOID_MANAGEMENT" = "yes"; then
+    AC_DEFINE(wxUSE_AUTOID_MANAGEMENT)
 fi
 
-if test "$wxUSE_UXTHEME" = "yes"; then
-    AC_DEFINE(wxUSE_UXTHEME)
-fi
+if test "$USE_WIN32" = 1 ; then
+    if test "$wxUSE_INICONF" = "yes"; then
+        AC_DEFINE(wxUSE_INICONF)
+    fi
 
+    if test "$wxUSE_REGKEY" = "yes"; then
+        AC_DEFINE(wxUSE_REGKEY)
+    fi
 fi
-dnl wxUSE_MSW = 1
+dnl USE_WIN32 = 1
 
 dnl ---------------------------------------------------------------------------
 dnl wxGraphicsContext
 dnl ---------------------------------------------------------------------------
 
+if test "$wxUSE_MAC" = 1; then
+       wxUSE_GRAPHICS_CONTEXT="yes"
+fi
+
 if test "$wxUSE_GRAPHICS_CONTEXT" = "yes"; then
-   if test "$wxUSE_MAC" = 1 -o "$wxUSE_COCOA" = "1"; 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...
@@ -7206,7 +7240,7 @@ if test "$wxUSE_MEDIACTRL" = "yes"; then
 
         if test "$wxUSE_GSTREAMER" = "yes"; then
             CPPFLAGS="$GST_CFLAGS $CPPFLAGS"
-            LIBS="$GST_LIBS $LIBS"
+            EXTRALIBS_MEDIA="$GST_LIBS"
 
             AC_DEFINE(wxUSE_GSTREAMER)
         else
@@ -7255,15 +7289,12 @@ dnl ---------------------------------------------------------------------------
 STD_BASE_LIBS="base"
 STD_GUI_LIBS=""
 BUILT_WX_LIBS="base"
-ALL_WX_LIBS="xrc stc gl media dbgrid qa html adv core odbc xml net base"
+ALL_WX_LIBS="xrc stc gl media qa html adv core xml net base"
 
 if test "$wxUSE_SOCKETS" = "yes" ; then
     STD_BASE_LIBS="net $STD_BASE_LIBS"
     BUILT_WX_LIBS="net $BUILT_WX_LIBS"
 fi
-if test "$wxUSE_ODBC" != "no" ; then
-    BUILT_WX_LIBS="odbc $BUILT_WX_LIBS"
-fi
 if test "$wxUSE_XML" = "yes" ; then
     STD_BASE_LIBS="xml $STD_BASE_LIBS"
     BUILT_WX_LIBS="xml $BUILT_WX_LIBS"
@@ -7277,9 +7308,6 @@ if test "$wxUSE_GUI" = "yes"; then
         STD_GUI_LIBS="qa $STD_GUI_LIBS"
         BUILT_WX_LIBS="qa $BUILT_WX_LIBS"
     fi
-    if test "$wxUSE_ODBC" != "no" ; then
-        BUILT_WX_LIBS="dbgrid $BUILT_WX_LIBS"
-    fi
     if test "$wxUSE_HTML" = "yes" ; then
         STD_GUI_LIBS="html $STD_GUI_LIBS"
         BUILT_WX_LIBS="html $BUILT_WX_LIBS"
@@ -7293,6 +7321,12 @@ if test "$wxUSE_GUI" = "yes"; then
     if test "$wxUSE_AUI" = "yes" ; then
         BUILT_WX_LIBS="aui $BUILT_WX_LIBS"
     fi
+    if test "$wxUSE_PROPGRID" = "yes" ; then
+        BUILT_WX_LIBS="propgrid $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
@@ -7317,14 +7351,10 @@ 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"
-        else
-            LDFLAGS="$LDFLAGS -lQuickTimeLib"
         fi
     fi
     if test "$USE_DARWIN" = 1; then
-        LDFLAGS="$LDFLAGS -framework IOKit -framework Carbon -framework Cocoa -framework System"
-    else
-        LDFLAGS="$LDFLAGS -lCarbonLib"
+        LDFLAGS="$LDFLAGS -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL"
     fi
 fi
 if test "$wxUSE_COCOA" = 1 ; then
@@ -7364,6 +7394,12 @@ if test "$wxUSE_GUI" = "yes"; then
     fi
 else
     SAMPLES_SUBDIRS="console"
+    if test "$wxUSE_SOCKETS" = "yes" ; then
+        SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS sockets"
+    fi
+    if test "$wxUSE_IPC" = "yes" ; then
+        SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS ipc"
+    fi
 fi
 
 
@@ -7402,8 +7438,8 @@ if test "x$INTELCXX" = "xyes" ; then
     dnl     remark #1419: external declaration in primary source file
     CXXWARNINGS="-Wall -wd279,383,444,810,869,981,1418,1419"
 elif test "$GXX" = yes ; then
-    dnl CXXWARNINGS="-Wall -W -Wcast-qual -Werror"
-    CXXWARNINGS="-Wall -Wundef -Wno-ctor-dtor-privacy"
+    CXXWARNINGS="-Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy"
+    AX_CXXFLAGS_GCC_OPTION(-Woverloaded-virtual, CXXWARNINGS)
 fi
 
 
@@ -7426,6 +7462,8 @@ CPPFLAGS=`echo $WXCONFIG_CPPFLAGS \
 C_AND_CXX_FLAGS="$DEBUG_CFLAGS $PROFILE_FLAGS $OPTIMISE_CFLAGS"
 CFLAGS=`echo $WXCONFIG_CFLAGS $CWARNINGS $C_AND_CXX_FLAGS $CFLAGS `
 CXXFLAGS=`echo $WXCONFIG_CXXFLAGS $C_AND_CXX_FLAGS $CXXFLAGS `
+OBJCFLAGS=`echo $WXCONFIG_CFLAGS $CWARNINGS $C_AND_CXX_FLAGS $OBJCFLAGS `
+OBJCXXFLAGS=`echo $WXCONFIG_CXXFLAGS $C_AND_CXX_FLAGS $OBJCXXFLAGS `
 
 dnl now that we added WXCONFIG_CPPFLAGS to CPPFLAGS we can add the wx-config
 dnl only stuff to it
@@ -7452,7 +7490,7 @@ LIBS=`echo $LIBS`
 EXTRALIBS="$LDFLAGS $LDFLAGS_VERSIONING $LIBS $DMALLOC_LIBS"
 EXTRALIBS_XML="$EXPAT_LINK"
 EXTRALIBS_HTML="$MSPACK_LINK"
-EXTRALIBS_ODBC="$ODBC_LINK"
+EXTRALIBS_MEDIA="$GST_LIBS"
 EXTRALIBS_STC="-lwxscintilla${lib_debug_suffix}${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`
@@ -7472,9 +7510,6 @@ fi
 if test "$wxUSE_EXPAT" = "builtin" ; then
     wxconfig_3rdparty="expat $wxconfig_3rdparty"
 fi
-if test "$wxUSE_ODBC" = "builtin" ; then
-    wxconfig_3rdparty="odbc $wxconfig_3rdparty"
-fi
 if test "$wxUSE_LIBTIFF" = "builtin" ; then
     wxconfig_3rdparty="tiff $wxconfig_3rdparty"
 fi
@@ -7502,7 +7537,7 @@ if test "x$wxUSE_UNIVERSAL" = "xyes" ; then
             ;;
 
         *)
-            for t in `echo $wxUNIV_THEMES | tr , ' ' | tr a-z A-Z`; do
+            for t in `echo $wxUNIV_THEMES | tr , ' ' | tr '[[a-z]]' '[[A-Z]]'`; do
                 AC_DEFINE_UNQUOTED(wxUSE_THEME_$t)
             done
     esac
@@ -7513,7 +7548,6 @@ fi
 AC_SUBST(wxUSE_ZLIB)
 AC_SUBST(wxUSE_REGEX)
 AC_SUBST(wxUSE_EXPAT)
-AC_SUBST(wxUSE_ODBC)
 AC_SUBST(wxUSE_LIBJPEG)
 AC_SUBST(wxUSE_LIBPNG)
 AC_SUBST(wxUSE_LIBTIFF)
@@ -7530,12 +7564,6 @@ else
     USE_PLUGINS=0
 fi
 
-if test $wxUSE_ODBC != "no" ; then
-    USE_ODBC=1
-else
-    USE_ODBC=0
-fi
-
 if test "$wxUSE_DEBUGREPORT" = "yes" ; then
     USE_QA=1
 else
@@ -7561,11 +7589,13 @@ AC_SUBST(CXXWARNINGS)
 AC_SUBST(EXTRALIBS)
 AC_SUBST(EXTRALIBS_XML)
 AC_SUBST(EXTRALIBS_HTML)
-AC_SUBST(EXTRALIBS_ODBC)
+AC_SUBST(EXTRALIBS_MEDIA)
 AC_SUBST(EXTRALIBS_GUI)
 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)
@@ -7573,7 +7603,19 @@ AC_SUBST(UNICODE)
 AC_SUBST(BUILD)
 AC_SUBST(DEBUG_INFO)
 AC_SUBST(DEBUG_FLAG)
-TOOLKIT_LOWERCASE=`echo $TOOLKIT | tr "[[A-Z]]" "[[a-z]]"`
+TOOLKIT_LOWERCASE=xxx
+if test "$TOOLKIT" = "MAC"; then
+    TOOLKIT_LOWERCASE=osx_carbon
+fi
+if test "$TOOLKIT" = "OSX_CARBON"; then
+    TOOLKIT_LOWERCASE=osx_carbon
+fi
+if test "$TOOLKIT" = "OSX_COCOA"; then
+    TOOLKIT_LOWERCASE=osx_cocoa
+fi
+if test "$TOOLKIT_LOWERCASE" = "xxx"; then
+    TOOLKIT_LOWERCASE=`echo $TOOLKIT | tr '[[A-Z]]' '[[a-z]]'`
+fi
 AC_SUBST(TOOLKIT_LOWERCASE)
 AC_SUBST(TOOLKIT_VERSION)
 AC_SUBST(SAMPLES_RPATH_FLAG)
@@ -7585,8 +7627,11 @@ AC_SUBST(CPPUNIT_LIBS)
 case "$TOOLKIT" in
     GTK)
         TOOLKIT_DESC="GTK+"
-        if test "$WXGTK20" = 1; then
+        if test "$WXGTK2" = 1; then
             TOOLKIT_DESC="$TOOLKIT_DESC 2"
+            if test "$wxUSE_GTKPRINT" = "yes" ; then
+                TOOLKIT_EXTRA="$TOOLKIT_EXTRA GTK+ printing";
+            fi
             if test "$wxUSE_LIBGNOMEPRINT" = "yes" ; then
                 TOOLKIT_EXTRA="$TOOLKIT_EXTRA gnomeprint";
             fi
@@ -7676,6 +7721,60 @@ case ${INSTALL} in
      INSTALL=`pwd`/${INSTALL} ;;
 esac
 
+if test "$wxUSE_GUI" = "yes"; then
+
+if test "$wxUSE_MSW" = 1 ; then
+    if test "x$WINDRES" = "x"; then
+        AC_MSG_ERROR([Required windres program not found])
+    fi
+
+    RESCOMP="$WINDRES"
+fi
+
+if test "$wxUSE_MAC" = 1 -o "$wxUSE_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"
+    WX_RESOURCES_MACOSX_DATA="libwx_${TOOLCHAIN_NAME}.${wx_release_number}.rsrc"
+
+    dnl add the resources target for wxMac
+    LIBWXMACRES="\$(wx_top_builddir)/lib/${WX_RESOURCES_MACOSX_ASCII}"
+
+    AC_CHECK_PROG(DEREZ, DeRez, DeRez, /Developer/Tools/DeRez)
+
+    MACSETFILE="\$(SETFILE)"
+
+    dnl resources are bundled both with shared library and applications
+    dnl since the carb resource *must* be included in the application
+    if test "$wxUSE_OSX_CARBON" = 1; then
+        POSTLINK_COMMAND="\$(REZ) -d __DARWIN__ -t APPL Carbon.r -o"
+        RESCOMP="$REZ"
+        WXCONFIG_RESFLAGS="-d __DARWIN__ -t APPL Carbon.r -o"
+    else
+        POSTLINK_COMMAND="cat /dev/null | \$(REZ) -d __DARWIN__ -t APPL ${LIBWXMACRES}"
+        RESCOMP="cat /dev/null \| $REZ"
+        WXCONFIG_RESFLAGS="-d __DARWIN__ -t APPL \$libdir/$WX_RESOURCES_MACOSX_ASCII"
+    fi
+
+else
+    dnl default value is to (silently) do nothing in the makefile
+    MACSETFILE="@true"
+
+    if test "$wxUSE_PM" = 1; then
+        RESCOMP="emxbind"
+        WXCONFIG_RESFLAGS="-ep"
+
+        dnl Is this one really used anywhere for pm?
+        POSTLINK_COMMAND="$RESCOMP $WXCONFIG_RESFLAGS"
+    else
+        POSTLINK_COMMAND="@true"
+    fi
+fi
+
+fi
+dnl wxUSE_GUI = 1
+
+
 dnl find out if the compiler supports PCH
 dnl
 dnl TODO: this should be in bakefile
@@ -7687,7 +7786,11 @@ then
         AC_MSG_WARN([*** see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13361])
     fi
 
-    CPPFLAGS="-DWX_PRECOMP $CPPFLAGS"
+    # Our WX_PRECOMP flag does not make sense for any language except C++ because
+    # the headers that benefit from precompilation are mostly C++ headers.
+    CXXFLAGS="-DWX_PRECOMP $CXXFLAGS"
+    # When Bakefile can do multi-language PCH (e.g. C++ and Objective-C++) enable this:
+    #OBJCXXFLAGS="-DWX_PRECOMP $CXXFLAGS"
 fi
 
 dnl HACK ALERT!!
@@ -7705,16 +7808,6 @@ if test "$wxUSE_MAC" = 1 ; then
 fi
 
 if test "$wxUSE_SHARED" = "yes"; then
-
-    dnl We get the shared build linker from bakefile, since it
-    dnl moved all the logic for this out of this file and into
-    dnl its own macro.  But it can't decide on whether to return
-    dnl us $(VAR), ${VAR}, or the present expansion of VAR.
-    dnl So normalise and expand everything here now, because its
-    dnl not going to change inside wx-config anyway.
-    sanitised_bakefile_mess=`echo "$SHARED_LD_CXX" | tr -d '()'`
-    EXE_LINKER=`eval echo "$sanitised_bakefile_mess"`
-
     dnl Need addtional flag on OS/2, so override bakefiles value
     dnl (there currently is no suitable variable to which the
     dnl  missing flags could be added, AFAICS. SN, 18.12.2004. )
@@ -7726,11 +7819,6 @@ if test "$wxUSE_SHARED" = "yes"; then
         cp -p ${srcdir}/src/os2/dllar.sh .
       ;;
     esac
-else
-
-    dnl No bakefile support for static builds, but this should be ok for most.
-    EXE_LINKER="$CXX -o"
-
 fi
 if test "$wxUSE_OMF" = "yes"; then
     case "${host}" in
@@ -7759,7 +7847,7 @@ case "${host}" in
     *-*-solaris2* )
         dnl system packages are compiled with Sun CC and so pkg-config outputs
         dnl CC-specific "-mt" flag, remove it when using gcc
-        if "$GCC" = yes; then
+        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//'`
@@ -7781,6 +7869,8 @@ dnl Add visibility support flags to CFLAGS/CXXFLAGS - do it this late so that
 dnl it doesn't affect compilation checks above
 CFLAGS="$CFLAGS $CFLAGS_VISIBILITY"
 CXXFLAGS="$CXXFLAGS $CXXFLAGS_VISIBILITY"
+OBJCFLAGS="$OBJCFLAGS $CFLAGS_VISIBILITY"
+OBJCXXFLAGS="$OBJCXXFLAGS $CXXFLAGS_VISIBILITY"
 
 dnl for convenience, sort the samples in alphabetical order
 dnl
@@ -7839,7 +7929,6 @@ AC_SUBST(WXCONFIG_LIBS)
 AC_SUBST(WXCONFIG_RPATH)
 AC_SUBST(WXCONFIG_LDFLAGS_GUI)
 AC_SUBST(WXCONFIG_RESFLAGS)
-AC_SUBST(EXE_LINKER)
 
 dnl distribution vars
 AC_SUBST(GUIDIST)
@@ -7908,6 +7997,11 @@ AC_CONFIG_FILES([ lib/wx/config/inplace-${TOOLCHAIN_FULLNAME}:wx-config-inplace.
                 [ chmod +x lib/wx/config/inplace-${TOOLCHAIN_FULLNAME} ],
                 [ TOOLCHAIN_FULLNAME="${TOOLCHAIN_FULLNAME}" ])
 
+dnl this is used to run ifacecheck with the same flags used by the compiler
+dnl for the real compilation:
+AC_CONFIG_FILES([ utils/ifacecheck/rungccxml.sh ],
+                [ chmod +x utils/ifacecheck/rungccxml.sh ])
+
 if test "$wx_cv_version_script" = "yes"; then
     AC_CONFIG_FILES(version-script)
 fi
@@ -7931,21 +8025,22 @@ if test "$wxWITH_SUBDIRS" != "no"; then
 dnl Configure samples, demos etc. directories, but only if they are present:
 if test "$wxUSE_GUI" = "yes"; then
     SUBDIRS="samples demos utils"
-else dnl we build wxBase only
+else
+    dnl we build wxBase only
     dnl there are no wxBase programs in demos
     SUBDIRS="samples utils"
 fi
 dnl Add tests to the list of subdirs if cppunit 1.8.0+ is detected
 AM_PATH_CPPUNIT(1.8.0, [SUBDIRS="$SUBDIRS tests"])
 
-for subdir in `echo $SUBDIRS`; do
+for subdir in $SUBDIRS; do
     if test -d ${srcdir}/${subdir} ; then
         if test "$wxUSE_GUI" = "yes"; then
             if test ${subdir} = "samples"; then
                 dnl only take those samples which compile in the current
                 dnl configuration and which exist
                 makefiles="samples/Makefile.in $makefiles"
-                for sample in `echo $SAMPLES_SUBDIRS`; do
+                for sample in $SAMPLES_SUBDIRS; do
                     if test -d $srcdir/samples/$sample; then
                         makefiles="samples/$sample/Makefile.in $makefiles"
                     fi
@@ -7954,26 +8049,33 @@ for subdir in `echo $SUBDIRS`; do
                 dnl assume that everything compiles for utils &c
                 dnl any that shouldn't be built can be added to
                 dnl DISABLED_UTILS, DISABLED_DEMOS
-                disabled_var=DISABLED_`echo $subdir | tr [[a-z]] [[A-Z]]`;
+                disabled_var=DISABLED_`echo $subdir | tr '[[a-z]]' '[[A-Z]]'`
                 eval "disabled=\$$disabled_var"
                 disabled=/`echo X $disabled | sed 's@ @/|/@g'`/
                 makefiles=`(cd $srcdir ; find $subdir -name Makefile.in) | $EGREP -v "$disabled"`
             fi
-        else dnl we build wxBase only
-            dnl don't take all samples/utils, just those which build with
-            dnl wxBase
+        else
+            dnl we build wxBase only
+            dnl don't take all samples/utils, just those which build with wxBase
             if test ${subdir} = "samples"; then
-                makefiles="samples/Makefile.in samples/console/Makefile.in"
+                dnl only take those samples which compile in the current
+                dnl configuration and which exist
+                makefiles="samples/Makefile.in $makefiles"
+                for sample in `echo $SAMPLES_SUBDIRS`; do
+                    if test -d $srcdir/samples/$sample; then
+                        makefiles="samples/$sample/Makefile.in $makefiles"
+                    fi
+                done
             elif test ${subdir} = "utils"; then
                 makefiles=""
-                for util in HelpGen tex2rtf ; do
+                for util in ifacecheck ; do
                     if test -d $srcdir/utils/$util ; then
-                        makefiles="utils/$util/Makefile.in \
-                                   utils/$util/src/Makefile.in \
+                        makefiles="utils/$util/src/Makefile.in \
                                    $makefiles"
                     fi
                 done
-            else dnl assume that everything compiles for tests
+            else
+                dnl assume that everything compiles for tests
                 makefiles=`(cd $srcdir ; find $subdir -name Makefile.in)`
             fi
         fi
@@ -8022,7 +8124,6 @@ if test "$wxUSE_X11" = 1 -o "$wxUSE_MOTIF" = 1; then
 echo "                                       xpm                ${wxUSE_LIBXPM-none}"
 fi
 echo "                                       zlib               ${wxUSE_ZLIB}"
-echo "                                       odbc               ${wxUSE_ODBC}"
 echo "                                       expat              ${wxUSE_EXPAT}"
 echo "                                       libmspack          ${wxUSE_LIBMSPACK}"
 echo "                                       sdl                ${wxUSE_LIBSDL}"