]> git.saurik.com Git - wxWidgets.git/blobdiff - configure.in
fixed unused parameter warnings in non-debug build
[wxWidgets.git] / configure.in
index 1a5329885a50b5fe29276bb6f391e2742f3e58be..1dc0572b297bbd40b587148f311b5cd28ba4338f 100644 (file)
@@ -17,7 +17,7 @@ dnl ---------------------------------------------------------------------------
 dnl initialization
 dnl ---------------------------------------------------------------------------
 
-AC_INIT([wxWidgets], [2.6.2], [wx-dev@lists.wxwidgets.org])
+AC_INIT([wxWidgets], [2.7.0], [wx-dev@lists.wxwidgets.org])
 
 dnl the file passed to AC_CONFIG_SRCDIR should be specific to our package
 AC_CONFIG_SRCDIR([wx-config.in])
@@ -33,9 +33,9 @@ dnl
 dnl wx_release_number += 1
 
 wx_major_version_number=2
-wx_minor_version_number=6
-wx_release_number=2
-wx_subrelease_number=1
+wx_minor_version_number=7
+wx_release_number=0
+wx_subrelease_number=0
 
 WX_RELEASE=$wx_major_version_number.$wx_minor_version_number
 WX_VERSION=$WX_RELEASE.$wx_release_number
@@ -134,6 +134,10 @@ case "${host}" in
     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
+    dnl _HPUX_SOURCE is defined, see stdsyms(5)
+    CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
   ;;
   *-*-linux* )
     USE_LINUX=1
@@ -252,7 +256,6 @@ case "${host}" in
     dnl      USE_UNIX  must be set and not USE_WIN32
     SO_SUFFIX=dll
     PROGRAM_EXT=".exe"
-    RESCOMP=windres
     DEFAULT_DEFAULT_wxUSE_MSW=1
     DEFAULT_STD_FLAG=no
   ;;
@@ -299,8 +302,8 @@ case "${host}" in
     DEFAULT_STD_FLAG=no
   ;;
 
-  powerpc-*-darwin* )
-    dnl PowerPC Darwin based distributions (including Mac OS X)
+  *-*-darwin* )
+    dnl Darwin based distributions (including Mac OS X)
     USE_BSD=1
     USE_DARWIN=1
     SO_SUFFIX=dylib
@@ -782,6 +785,7 @@ dnl ---------------------------------------------------------------------------
 WX_ARG_ENABLE(gui,         [  --enable-gui            use GUI classes], wxUSE_GUI)
 WX_ARG_ENABLE(monolithic,  [  --enable-monolithic     build wxWidgets as single library], wxUSE_MONOLITHIC)
 WX_ARG_ENABLE(plugins,     [  --enable-plugins        build parts of wxWidgets as loadable components], wxUSE_PLUGINS)
+WX_ARG_WITH(subdirs,       [  --without-subdirs       don't generate makefiles for samples/demos/...], wxWITH_SUBDIRS, without)
 
 if test "$wxUSE_GUI" = "yes"; then
 
@@ -1139,10 +1143,14 @@ WX_ARG_ENABLE(mousewheel,  [  --enable-mousewheel     use mousewheel], wxUSE_MOU
 WX_ARG_ENABLE(validators,  [  --enable-validators     use wxValidator and derived classes], wxUSE_VALIDATORS)
 WX_ARG_ENABLE(busyinfo,    [  --enable-busyinfo       use wxBusyInfo], wxUSE_BUSYINFO)
 WX_ARG_ENABLE(joystick,    [  --enable-joystick       use wxJoystick], wxUSE_JOYSTICK)
-WX_ARG_ENABLE(metafile,    [  --enable-metafiles      use wxMetaFile (Windows only)], wxUSE_METAFILE)
+WX_ARG_ENABLE(metafile,    [  --enable-metafiles      use wxMetaFile (Win32 only)], wxUSE_METAFILE)
 WX_ARG_ENABLE(dragimage,   [  --enable-dragimage      use wxDragImage], wxUSE_DRAGIMAGE)
 WX_ARG_ENABLE(accessibility,[  --enable-accessibility  enable accessibility support], wxUSE_ACCESSIBILITY)
 
+if test "$wxUSE_MSW" = "1"; then
+    WX_ARG_ENABLE(dccache, [  --enable-dccache        cache temporary wxDC objects (Win32 only)], wxUSE_DC_CACHEING)
+fi
+
 dnl ---------------------------------------------------------------------------
 dnl support for image formats that do not rely on external library
 dnl ---------------------------------------------------------------------------
@@ -1321,7 +1329,6 @@ if test "$wxUSE_WINE" = "yes"; then
     dnl FIXME: we should do a better job of testing for these
     CC=winegcc
     CXX=wineg++
-    RESCOMP=wrc
     LDFLAGS_GUI="-mwindows"
 fi
 
@@ -1355,24 +1362,6 @@ dnl ---------------------------------------------------------------------------
 dnl flush the cache because checking for programs might abort
 AC_CACHE_SAVE
 
-dnl cross-compiling support: we're cross compiling if the build system is
-dnl different from the target one (assume host and target be always the same)
-if test "$build" != "$host" ; then
-    if test "$USE_WIN32" = 1 -o "$USE_DOS" = 1 -o "$USE_UNIX" = 1; then
-        CC=$host_alias-gcc
-        CXX=$host_alias-c++
-        AR=$host_alias-ar
-        RANLIB=$host_alias-ranlib
-        DLLTOOL=$host_alias-dlltool
-        RESCOMP=$host_alias-windres
-        STRIP=$host_alias-strip
-    elif test "x$CC" '!=' "x"; then
-        echo "You set CC, I assume you know what you are doing."
-    else
-        AC_MSG_ERROR($build_alias -> $host_alias cross compilation not supported yet.)
-    fi
-fi
-
 dnl C-compiler checks
 dnl   defines CC with the compiler to use
 dnl   defines GCC with yes if using gcc
@@ -1410,7 +1399,7 @@ AC_PROG_RANLIB
 
 dnl ar command
 dnl   defines AR with the appropriate command
-AC_CHECK_PROG(AR, ar, ar)
+AC_CHECK_TOOL(AR, ar)
 if test "x$AR" = "x" ; then
     AC_MSG_ERROR([ar is needed to build wxWidgets])
 fi
@@ -1436,7 +1425,7 @@ case "${host}" in
     dnl The other BSD's should probably go in here too, since this is
     dnl to workaround a strange static lib BSDism.
     dnl Mac OS X install seems to ignore -p option...
-    powerpc-*-darwin* )
+    *-*-darwin* )
         INSTALL_PROGRAM="cp -fp"
         INSTALL_DATA="cp -fp"
         ;;
@@ -1445,8 +1434,20 @@ case "${host}" in
 esac
 
 dnl strip command
-dnl   defines STRIP as strip or nothing if not found
-AC_CHECK_PROG(STRIP, strip, strip, true)
+dnl   defines STRIP as strip or nothing (true) if not found
+AC_CHECK_TOOL(STRIP, strip, true)
+
+dnl Win32 tools
+if test "$wxUSE_WINE" = "yes"; then
+    AC_CHECK_TOOL(RESCOMP, wrc)
+else
+    case "${host}" in
+    *-*-cygwin* | *-*-mingw32* )
+        AC_CHECK_TOOL(RESCOMP, windres)
+        AC_CHECK_TOOL(DLLTOOL, dlltool)
+        ;;
+    esac
+fi
 
 dnl does make support "-include" (only GNU make does AFAIK)?
 AC_CACHE_CHECK([if make is GNU make], wx_cv_prog_makeisgnu,
@@ -1521,8 +1522,7 @@ if test "x$XLCXX" = "xyes" -a "x$USE_AIX" = "x1"; then
     CXXFLAGS="$CXXFLAGS -qunique"
 fi
 
-
-dnl This case is for OS X vs. everything else
+dnl This case is for PowerPC OS X vs. everything else
 case "${host}" in
   powerpc-*-darwin* )
     AC_MSG_CHECKING([if __POWERPC__ is already defined])
@@ -1534,6 +1534,12 @@ case "${host}" in
         [AC_MSG_RESULT([no])
         AC_DEFINE(__POWERPC__)
     ])
+  ;;
+esac
+
+dnl This case is for OS X vs. everything else
+case "${host}" in
+  *-*-darwin* )
     AC_MSG_CHECKING([if CoreFoundation/CFBase.h is usable])
     AC_TRY_COMPILE([#include <CoreFoundation/CFBase.h>
 ],[],
@@ -1698,10 +1704,6 @@ fi
 dnl defines HAVE_FNMATCH_H
 AC_CHECK_HEADERS(fnmatch.h)
 
-if test "x$ac_cv_header_fnmatch_h" = "xyes"; then
-    AC_CHECK_FUNCS(fnmatch)
-fi
-
 dnl defines HAVE_LANGINFO_H (GNU libc locale parameters)
 AC_CHECK_HEADERS(langinfo.h)
 
@@ -1718,19 +1720,6 @@ case "${host}" in
   ;;
 esac
 
-if test "$wxUSE_GUI" = "yes"; then
-    if test "$wxUSE_UNIX" = "yes" -a "$wxUSE_PM" != 1; then
-        dnl defines HAVE_X11_XKBLIB_H
-        AC_CHECK_HEADERS(X11/Xlib.h)
-        AC_CHECK_HEADERS([X11/XKBlib.h], [], [], 
-                         [
-                          #if HAVE_X11_XLIB_H
-                            #include <X11/Xlib.h>
-                          #endif
-                         ])
-    fi
-fi
-
 dnl ---------------------------------------------------------------------------
 dnl Checks for compiler characteristics
 dnl ---------------------------------------------------------------------------
@@ -1866,6 +1855,37 @@ dnl problems
 if test "x$wx_largefile" = "xyes"; then
     if test "x$ac_cv_sys_file_offset_bits" = "x64"; then
         WX_LARGEFILE_FLAGS="-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_SAVE
+                    AC_LANG_CPLUSPLUS
+                    AC_TRY_COMPILE(
+                        [],
+                        [
+                            #ifndef __STDC_EXT__
+                                choke me
+                            #endif
+                        ],
+                        wx_cv_STDC_EXT_required=no,
+                        wx_cv_STDC_EXT_required=yes
+                    )
+                    AC_LANG_RESTORE
+                ]
+            )
+            if test "x$wx_cv_STDC_EXT_required" = "xyes"; then
+                CXXFLAGS="$CXXFLAGS -D__STDC_EXT__"
+            fi
+        fi
     else
         WX_LARGEFILE_FLAGS="-D_LARGE_FILES"
     fi
@@ -1896,6 +1916,48 @@ 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
+    CXXFLAGS="$CXXFLAGS -features=tmplife"
+fi
+
+dnl Sun X11 headers are (still, in 2005!) non-ANSI and the best they could do
+dnl was to hack their C++ compiler to accept them silently -- but C compiler
+dnl still spits out dozens of warnings for each X include file, so suppress
+dnl them
+if test "x$SUNCC" = xyes; then
+    CFLAGS="$CFLAGS -erroff=E_NO_EXPLICIT_TYPE_GIVEN"
+fi
+
+dnl SGI mipsPro compiler gives this warning for "conversion from pointer to
+dnl same-sized integral type" even when there is an explicit cast and as there
+dnl is no way to turn it off and there are hundreds of these warnings in wx
+dnl sources, just turn it off for now
+dnl
+dnl a better long term solution would be to use #pragma set/reset woff in
+dnl wxPtrToUInt() and use it instead of casts elsewhere
+if test "x$SGICC" = "xyes"; then
+    CFLAGS="$CFLAGS -woff 3970"
+fi
+if test "x$SGICXX" = "xyes"; then
+    CXXFLAGS="$CXXFLAGS -woff 3970"
+fi
+
+dnl HP-UX c89/aCC compiler warnings
+if test "x$HPCC" = "xyes"; then
+    dnl 2011: "unrecognized preprocessor directive": nice warning but it's given
+    dnl       even for directives inside #if which is not true (i.e. which are
+    dnl       used for other compilers/OS) and so we have no way to get rid of it
+    dnl 2450: "long long is non standard" -- yes, we know
+    CFLAGS="$CFLAGS +W 2011,2450"
+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="$CXXFLAGS +W 2340"
+fi
+
 dnl check for std::string or std::wstring
 if test "$wxUSE_STD_STRING" = "yes" -o "$wxUSE_STL" = "yes"; then
     AC_LANG_PUSH(C++)
@@ -2047,9 +2109,6 @@ SEARCH_INCLUDE="\
     /usr/Motif-2.1/include    \
     /usr/Motif-1.2/include    \
     /usr/include/Motif1.2     \
-    /opt/xpm/include/X11      \
-    /opt/GBxpm/include/       \
-    /opt/GBxpm/X11/include/   \
                               \
     /usr/dt/include           \
     /usr/openwin/include      \
@@ -2078,42 +2137,69 @@ SEARCH_INCLUDE="\
     /usr/local/X11/include    \
     /usr/local/include/X11    \
                               \
-    /usr/X386/include         \
-    /usr/x386/include         \
     /usr/XFree86/include/X11  \
-                              \
-    X:/XFree86/include        \
-    X:/XFree86/include/X11    \
-                              \
-    /usr/include/gtk          \
-    /usr/local/include/gtk    \
-    /usr/include/glib         \
-    /usr/local/include/glib   \
-                              \
-    /usr/include/qt           \
-    /usr/local/include/qt     \
-                              \
-    /usr/local/arm/3.3.2/include     \
-                              \
-    /usr/include/windows      \
-    /usr/include/wine         \
-    /usr/local/include/wine   \
-                              \
-    /usr/unsupported/include  \
-    /usr/athena/include       \
-    /usr/local/x11r5/include  \
-    /usr/lpp/Xamples/include  \
+    /usr/pkg/include          \
                               \
     /usr/openwin/share/include"
 
-dnl prepend lib and lib32 for IRIX where the files in these directories should
-dnl be found before the ones in lib64 for 32bit compilation -- of course, this
-dnl probably/surely breaks 64bit compilation... IMO the only real solution is to
-dnl stop using WX_PATH_FIND_LIBRARIES() at all and use AC_CHECK_LIB() instead
-dnl
-dnl also put 64 bit versions for Linux on AMD, they must come before the usual
-dnl locations or 64 bit compilation failed
-SEARCH_LIB="/usr/lib /usr/lib32 /usr/lib64 /usr/X11R6/lib64 `echo "$SEARCH_INCLUDE" | sed s/include/lib/g`"
+dnl try to find out the standard lib locations for the systems with multiple
+dnl ABIs
+AC_MSG_CHECKING([for libraries directory])
+
+case "${host}" in
+    *-*-irix6* )
+        AC_CACHE_VAL(
+            wx_cv_std_libpath,
+            [
+                for d in WX_STD_LIBPATH(); do
+                    for e in a so sl dylib dll.a; do
+                        libc="$d/libc.$e"
+                        if test -f $libc; then
+                            save_LIBS="$LIBS"
+                            LIBS="$libc"
+                            AC_LINK_IFELSE([int main() { return 0; }],
+                                wx_cv_std_libpath=`echo $d | sed s@/usr/@@`)
+                            LIBS="$save_LIBS"
+                            if test "x$wx_cv_std_libpath" != "x"; then
+                                break 2
+                            fi
+                        fi
+                    done
+                done
+                if test "x$wx_cv_std_libpath" = "x"; then
+                    wx_cv_std_libpath="lib"
+                fi
+            ]
+        )
+        ;;
+
+    *-*-solaris2* )
+        dnl use ../lib or ../lib/64 depending on the size of void*
+        if test "$ac_cv_sizeof_void_p" = 8 -a -d "/usr/lib/64"; then
+            wx_cv_std_libpath="lib/64"
+        else
+            wx_cv_std_libpath="lib"
+        fi
+        ;;
+
+    *-*-linux* )
+        dnl use ../lib or ../lib64 depending on the size of void*
+        if test "$ac_cv_sizeof_void_p" = 8 -a \
+                -d "/usr/lib64" -a ! -h "/usr/lib64"; then
+            wx_cv_std_libpath="lib64"
+        else
+            wx_cv_std_libpath="lib"
+        fi
+        ;;
+
+    *)
+        wx_cv_std_libpath="lib";
+        ;;
+esac
+
+AC_MSG_RESULT($wx_cv_std_libpath)
+
+SEARCH_LIB="`echo "$SEARCH_INCLUDE" | sed s@include@$wx_cv_std_libpath@g` /usr/$wx_cv_std_libpath"
 
 dnl Cross compiling with gcc?
 if test "$build" != "$host" -a "$GCC" = yes; then
@@ -2166,7 +2252,7 @@ if test "$USE_LINUX" = 1 -o "$USE_GNU" = 1; then
         AC_TRY_COMPILE([#include <features.h>],
             [
                 #if (__GLIBC__ < 2) || (__GLIBC_MINOR__ < 1)
-                    #error not glibc2.1
+                not glibc 2.1
                 #endif
             ],
             [
@@ -2675,8 +2761,32 @@ if test "$wxUSE_GUI" = "yes"; then
 
                 dnl detect GTK2
                 wx_cv_lib_gtk=
-                if test "x$wxGTK_VERSION" != "x1"; then
+                if test "x$wxGTK_VERSION" != "x1"
+                then
+                    dnl The gthread.pc that ships with solaris returns '-mt',
+                    dnl it's correct for Sun CC, but gcc requires '-pthreads'.
+                    dnl So disable the compile check and remove the -mt below.
+                    case "${host}" in
+                        *-*-solaris2* )
+                            if test "$wxUSE_THREADS" = "yes" -a "$GCC" = yes; then
+                               enable_gtktest=no
+                            fi
+                    esac
+
                     AM_PATH_GTK_2_0(2.0.0, wx_cv_lib_gtk=2.0, , $GTK_MODULES)
+
+                    dnl Remove the '-mt' for gcc on solaris
+                    case "${host}" in
+                        *-*-solaris2* )
+                            if test "$wxUSE_THREADS" = "yes" -a "$GCC" = yes; then
+                                GTK_CFLAGS=`echo $GTK_CFLAGS | sed 's/-mt//'`
+                                GTK_LIBS=`echo $GTK_LIBS | sed 's/-mt//'`
+                            fi
+                            dnl solaris also requires -lX11 for static lib
+                            if test "$wxUSE_SHARED" != "yes"; then
+                                GTK_LIBS="$GTK_LIBS -lX11"
+                            fi
+                    esac
                 fi
 
                 dnl detect GTK1.x
@@ -2697,7 +2807,7 @@ if test "$wxUSE_GUI" = "yes"; then
                     dnl we need to cache GTK_CFLAGS and GTK_LIBS for the
                     dnl subsequent runs
                     wx_cv_cflags_gtk=$GTK_CFLAGS
-                    wx_cv_libs_gtk=$GTK_LIBS
+                    wx_cv_libs_gtk=`echo $GTK_LIBS | sed -e 's/ -l[[^ ]]*cairo[[^ ]]*//g'`
                 fi
             ]
         )
@@ -2733,8 +2843,6 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
             save_LIBS="$LIBS"
             CFLAGS="$CFLAGS $wx_cv_cflags_gtk"
             LIBS="$LIBS $wx_cv_libs_gtk"
-            
-            AC_CHECK_FUNCS([pango_font_family_is_monospace])
 
             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
@@ -2754,7 +2862,7 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
                             AC_DEFINE(NEED_GTK_ICON_SIZE_LOOKUP)
                             AC_MSG_RESULT([yes])
                            ])
-            
+
             dnl test if we have at least GTK+ 2.4:
             AC_MSG_CHECKING([if GTK+ is version >= 2.4])
             AC_TRY_COMPILE([
@@ -2762,7 +2870,7 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
                            ],
                            [
                             #if !GTK_CHECK_VERSION(2,4,0)
-                            #error "Not GTK+ 2.4"
+                            Not GTK+ 2.4
                             #endif
                            ],
                            [
@@ -2772,7 +2880,7 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
                            [
                             AC_MSG_RESULT([no])
                            ])
-            
+
             CFLAGS="$save_CFLAGS"
             LIBS="$save_LIBS"
         else
@@ -2809,7 +2917,7 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
                 dnl we guess its path from the prefix
                 GUI_TK_LIBRARY="-L${prefix}/lib -lgpewidget $GUI_TK_LIBRARY"
                 WXGPE=1
-                AC_MSG_RESULT(found at $ac_find_libraries)
+                AC_MSG_RESULT([found in $ac_find_libraries])
             else
                 AC_MSG_RESULT(not found)
             fi
@@ -2819,7 +2927,7 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
             dnl if test "$ac_find_libraries" != "" ; then
             dnl     WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
             dnl     GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lgpe"
-            dnl     AC_MSG_RESULT(found at $ac_find_libraries)
+            dnl     AC_MSG_RESULT(found in $ac_find_libraries)
             dnl else
             dnl     AC_MSG_RESULT(not found)
             dnl fi
@@ -2929,7 +3037,7 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
         AC_PATH_XTRA
 
         if test "$no_x" = "yes"; then
-          AC_MSG_ERROR(X11 not found, please use --x-includes and/or --x-libraries options)
+          AC_MSG_ERROR([X11 not found, please use --x-includes and/or --x-libraries options (see config.log for details)])
         fi
 
         dnl for some reason AC_PATH_XTRA seems to add -INONE and -LNONE (and
@@ -3019,6 +3127,9 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
             WX_INCLUDE_PATH_EXIST($ac_find_includes, $TOOLKIT_INCLUDE)
             TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE$ac_path_to_include"
         else
+            save_CFLAGS=$CFLAGS
+            CFLAGS="$CFLAGS $TOOLKIT_INCLUDE"
+
             AC_TRY_COMPILE(
                 [
                     #include <Xm/Xm.h>
@@ -3033,46 +3144,51 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
                 ],
                 [
                     AC_MSG_RESULT(no)
-                    AC_MSG_ERROR(please set CFLAGS to contain the location of Xm/Xm.h)
+                    AC_MSG_ERROR(please set CPPFLAGS to contain the location of Xm/Xm.h)
                 ]
             )
+
+            CFLAGS=$save_CFLAGS
         fi
 
-        if test "$COMPILED_X_PROGRAM" = 0; then
-            AC_MSG_CHECKING(for Motif/Lesstif library)
-            WX_PATH_FIND_LIBRARIES($SEARCH_LIB, Xm)
-            if test "$ac_find_libraries" != "" ; then
-                AC_MSG_RESULT(found at $ac_find_libraries)
 
-                WX_LINK_PATH_EXIST($ac_find_libraries, $GUI_TK_LIBRARY)
-                GUI_TK_LIBRARY="$GUI_TK_LIBRARY$ac_path_to_link"
-            else
-                dnl it might happen that we found headers in one of the
-                dnl standard paths but the libs are elsewhere - we do need to
-                dnl try to compile a sample program then here
-                save_CFLAGS=$CFLAGS
-                CFLAGS="$CFLAGS $TOOLKIT_INCLUDE"
+        AC_MSG_CHECKING(for Motif/Lesstif library)
+        WX_PATH_FIND_LIBRARIES($SEARCH_LIB, Xm)
 
-                AC_TRY_COMPILE(
-                    [
-                        #include <Xm/Xm.h>
-                    ],
-                    [
-                        int version;
-                        version = xmUseVersion;
-                    ],
-                    [
-                        AC_MSG_RESULT(found in default search path)
-                        COMPILED_X_PROGRAM=1
-                    ],
-                    [
-                        AC_MSG_RESULT(no)
-                        AC_MSG_ERROR(please set LDFLAGS to contain the location of libXm)
-                    ]
-                )
+        if test "x$ac_find_libraries" != "x" ; then
+            AC_MSG_RESULT(found in $ac_find_libraries)
 
-                CFLAGS=$save_CFLAGS
-            fi
+            WX_LINK_PATH_EXIST($ac_find_libraries, $GUI_TK_LIBRARY)
+            GUI_TK_LIBRARY="$GUI_TK_LIBRARY$ac_path_to_link"
+        else
+            dnl it might happen that we found headers in one of the standard
+            dnl paths but the libs are elsewhere but still in default (linker)
+            dnl path -- try to compile a test program to check for this
+            save_CFLAGS=$CFLAGS
+            CFLAGS="$CFLAGS $TOOLKIT_INCLUDE"
+            save_LIBS="$LIBS"
+            LIBS="$GUI_TK_LIBRARY -lXm -lXmu -lXext -lX11"
+
+            AC_TRY_LINK(
+                [
+                    #include <Xm/Xm.h>
+                ],
+                [
+                    int version;
+                    version = xmUseVersion;
+                ],
+                [
+                    AC_MSG_RESULT(found in default search path)
+                    COMPILED_X_PROGRAM=1
+                ],
+                [
+                    AC_MSG_RESULT(no)
+                    AC_MSG_ERROR(please set LDFLAGS to contain the location of libXm)
+                ]
+            )
+
+            CFLAGS=$save_CFLAGS
+            LIBS="$save_LIBS"
         fi
 
         AC_MSG_CHECKING([if we need -lXp and/or -lSM -lICE])
@@ -3120,46 +3236,53 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
             AC_MSG_ERROR([can't link a simple motif program])
         fi
 
+        dnl this seems to be needed under IRIX and shouldn't do any harm
+        dnl elsewhere
+        AC_CHECK_LIB(Sgm, [SgCreateList], [libsgm_link=" -lSgm"])
+
         save_CFLAGS=$CFLAGS
         CFLAGS="$CFLAGS $TOOLKIT_INCLUDE"
-        AC_MSG_CHECKING([for Motif 2])
-        AC_TRY_COMPILE([
-                        #include <Xm/Xm.h>
-                       ],
-                       [
-                        #if XmVersion < 2000
-                        #error "Not Motif 2"
-                        #endif
-                       ],
-                       [
-                        AC_DEFINE(__WXMOTIF20__,1)
-                        AC_MSG_RESULT([found])
-                       ],
-                       [
-                        AC_DEFINE(__WXMOTIF20__,0)
-                        AC_MSG_RESULT([not found])
-                       ])
-
-        AC_MSG_CHECKING([whether Motif is Lesstif])
-        AC_TRY_COMPILE([
-                        #include <Xm/Xm.h>
-                       ],
-                       [
-                        #if !defined(LesstifVersion) || LesstifVersion <= 0
-                        #error "Not Lesstif"
-                        #endif
-                       ],
-                       [
-                        AC_DEFINE(__WXLESSTIF__,1)
-                        AC_MSG_RESULT([yes])
-                       ],
-                       [
-                        AC_DEFINE(__WXLESSTIF__,0)
-                        AC_MSG_RESULT([no])
-                       ])
+
+        AC_CACHE_CHECK([for Motif 2],
+            wx_cv_lib_motif2,
+            AC_TRY_COMPILE([
+                            #include <Xm/Xm.h>
+                           ],
+                           [
+                            #if XmVersion < 2000
+                            Not Motif 2
+                            #endif
+                           ],
+                           wx_cv_lib_motif2="yes",
+                           wx_cv_lib_motif2="no"))
+        if test "$wx_cv_lib_motif2" = "yes"; then
+            AC_DEFINE(__WXMOTIF20__,1)
+        else
+            AC_DEFINE(__WXMOTIF20__,0)
+        fi
+
+        AC_CACHE_CHECK([whether Motif is Lesstif],
+            wx_cv_lib_lesstif,
+            AC_TRY_COMPILE([
+                            #include <Xm/Xm.h>
+                           ],
+                           [
+                            #if !defined(LesstifVersion) || LesstifVersion <= 0
+                            Not Lesstif
+                            #endif
+                           ],
+                           wx_cv_lib_lesstif="yes",
+                           wx_cv_lib_lesstif="no")
+        )
+        if test "$wx_cv_lib_lesstif" = "yes"; then
+            AC_DEFINE(__WXLESSTIF__,1)
+        else
+            AC_DEFINE(__WXLESSTIF__,0)
+        fi
+
         CFLAGS=$save_CFLAGS
 
-        GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXm${libp_link} -lXmu -lXext -lXt${libsm_ice_link} -lX11"
+        GUI_TK_LIBRARY="$GUI_TK_LIBRARY${libsgm_link} -lXm${libp_link} -lXmu -lXext -lXt${libsm_ice_link} -lX11"
         TOOLKIT=MOTIF
         GUIDIST=MOTIF_DIST
     fi
@@ -3173,7 +3296,7 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
             if test "$ac_find_libraries" != "" ; then
                 WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
                 GUI_TK_LIBRARY="$GUI_TK_LIBRARY$ac_path_to_link"
-                AC_MSG_RESULT(found at $ac_find_libraries)
+                AC_MSG_RESULT(found in $ac_find_libraries)
 
                 AC_CACHE_CHECK([for X11/xpm.h],
                     wx_cv_x11_xpm_h,
@@ -3336,6 +3459,20 @@ dnl ---------------------------------------------------------------------------
 dnl Optional libraries included when system library is not used
 dnl ---------------------------------------------------------------------------
 
+dnl do this after test for X11 above so that we have a chance of finding Xlib.h
+if test "$wxUSE_GUI" = "yes"; then
+    if test "$wxUSE_UNIX" = "yes" -a "$wxUSE_PM" != 1; then
+        dnl defines HAVE_X11_XKBLIB_H
+        AC_CHECK_HEADERS(X11/Xlib.h)
+        AC_CHECK_HEADERS([X11/XKBlib.h], [], [], 
+                         [
+                          #if HAVE_X11_XLIB_H
+                            #include <X11/Xlib.h>
+                          #endif
+                         ])
+    fi
+fi
+
 
 dnl ----------------------------------------------------------------
 dnl iODBC support
@@ -3558,7 +3695,7 @@ if test "$wxUSE_SHARED" = "yes"; then
       *-*-linux* | *-*-gnu* )
         SAMPLES_RPATH_FLAG="-Wl,-rpath,\$(top_builddir)lib"
         WXCONFIG_RPATH="-Wl,-rpath,\$libdir"
-       ;;
+        ;;
 
       *-*-solaris2* )
         if test "$GCC" = yes ; then
@@ -3598,7 +3735,7 @@ if test "$wxUSE_SHARED" = "yes"; then
         fi
       ;;
       
-      powerpc-*-darwin* )
+      *-*-darwin* )
         install_name_tool=`which install_name_tool`
         if test "$install_name_tool" -a -x "$install_name_tool"; then
             SAMPLES_RPATH_POSTLINK="\$(top_builddir)change-install-names \$(LIBDIRNAME) \$(prefix) \$@"
@@ -3887,14 +4024,21 @@ if test "$wxUSE_WCHAR_T" = "yes"; then
         AC_DEFINE(HAVE_WCSLEN)
     fi
 
-    dnl on HP-UX aCC and g++ need this define to find mbstrtowcs() &c
-    if test "$USE_HPUX" = 1; then
+    dnl On HP-UX aCC need this define to find mbstrtowcs() &c
+    dnl Can't be used for g++ since the mbstate_t in wchar.h can conflict
+    dnl with g++'s in <cwchar> (unless -D_INCLUDE__STDC_A1_SOURCE is in the
+    dnl flags when g++ is configured, it will declare it's own).
+    if test "$USE_HPUX" = 1 -a "$GCC" != "yes"; then
         CPPFLAGS="$CPPFLAGS -D_INCLUDE__STDC_A1_SOURCE "
     fi
 
-    dnl try to use wcsrtombs instead of wcstombs which is buggy in old GNU
-    dnl libc versions if possible
-    AC_CHECK_FUNCS(wcsrtombs)
+    dnl Try to use wcsrtombs instead of wcstombs which is buggy in old GNU
+    dnl libc versions if possible. AC_CHECK_FUNCS only checks it's in the
+    dnl library, not the header, so do a header check for mbstate_t first.
+    AC_CHECK_TYPES([mbstate_t],
+                   [AC_CHECK_FUNCS(wcsrtombs)],
+                   [],
+                   [#include <wchar.h>])
 else
     AC_MSG_WARN([Wide character support is unavailable])
 fi
@@ -3907,22 +4051,32 @@ AC_LANG_CPLUSPLUS
 
 dnl check for vsnprintf() -- a safe version of vsprintf())
 dnl
-dnl the trouble here is that on some systems (notable HP-UX) this function is
+dnl the trouble here is that on some systems (e.g HP-UX 10) this function is
 dnl present in libc but not in the system headers and so AC_CHECK_FUNCS (which,
 dnl stupidly, provides a dummy function declaration inside its extension)
 dnl succeeds, even with C++ compiler, but the compilation of wxWidgets fails
 dnl
 dnl so we first check if the function is in the library
-AC_CHECK_FUNCS(vsnprintf)
+AC_CHECK_FUNCS(snprintf vsnprintf)
 
 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,
         [
+            dnl our troubles are not over: HP-UX 11 prototypes vsnprintf() as
+            dnl taking "char *" and not "const char *" while Metrowerks does
+            dnl provide a correct vsnprintf declaration but in C++ mode it's
+            dnl always in std namespace and so we have to bring it in scope
             AC_TRY_COMPILE(
                 [
                     #include <stdio.h>
                     #include <stdarg.h>
+                    #ifdef __MSL__
+                    #if __MSL__ >= 0x6000
+                    namespace std {}
+                    using namespace std;
+                    #endif
+                    #endif
                 ],
                 [
                     char *buf;
@@ -3930,33 +4084,105 @@ if test "$ac_cv_func_vsnprintf" = "yes"; then
                     vsnprintf(buf, 10u, "%s", ap);
                 ],
                 wx_cv_func_vsnprintf_decl=yes,
-                [
-                    dnl Metrowerks does provide a vsnprintf declaration
-                    dnl but in C++ mode it's always in std namespace.
-                    dnl FIXME: Do we have any UNIX C++ compilers that would
-                    dnl fail this test if using namespace std; was
-                    dnl simply always included?
-                    AC_TRY_COMPILE(
-                        [
-                            #include <stdio.h>
-                            #include <stdarg.h>
-                            using namespace std;
-                        ],
-                        [
-                            char *buf;
-                            va_list ap;
-                            vsnprintf(buf, 10u, "%s", ap);
-                        ],
-                        wx_cv_func_vsnprintf_decl=yes,
-                        wx_cv_func_vsnprintf_decl=no
-                    )
-                ]
+                wx_cv_func_vsnprintf_decl=no
             )
         ]
     )
 
     if test "$wx_cv_func_vsnprintf_decl" = "yes"; then
         AC_DEFINE(HAVE_VSNPRINTF_DECL)
+
+        dnl we know there is a vsnprintf declaration, but some old headers
+        dnl may have one taking a "char *" format instead of "const char *"
+        AC_CACHE_CHECK([if vsnprintf declaration is broken], wx_cv_func_broken_vsnprintf_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 ap;
+                        const char *fmt = "%s";
+                        vsnprintf(buf, 10u, fmt, ap);
+                    ],
+                    wx_cv_func_broken_vsnprintf_decl=no,
+                    wx_cv_func_broken_vsnprintf_decl=yes
+                )
+            ]
+        )
+
+        if test "$wx_cv_func_broken_vsnprintf_decl" = "yes"; then
+            AC_DEFINE(HAVE_BROKEN_VSNPRINTF_DECL)
+        fi
+    fi
+fi
+
+dnl the same as above but for snprintf() now: it's not present in at least AIX
+dnl 4.2 headers
+if test "$ac_cv_func_snprintf" = "yes"; then
+    AC_CACHE_CHECK([for snprintf declaration], wx_cv_func_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;
+                    snprintf(buf, 10u, "%s", "wx");
+                ],
+                wx_cv_func_snprintf_decl=yes,
+                wx_cv_func_snprintf_decl=no
+            )
+        ]
+    )
+
+    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
 fi
 
@@ -3977,6 +4203,13 @@ fi
 
 AC_LANG_RESTORE
 
+if test "x$ac_cv_header_fnmatch_h" = "xyes"; then
+    AC_CHECK_FUNCS(fnmatch)
+fi
+
+if test "$wxUSE_FILE" = "yes"; then
+    AC_CHECK_FUNCS(fsync)
+fi
 
 
 dnl the following tests are for Unix(like) systems only
@@ -4086,10 +4319,10 @@ AC_CACHE_CHECK(for statfs, wx_cv_func_statfs,
     AC_TRY_COMPILE(
         [
              #if defined(__BSD__)
-               #include <sys/param.h>
-               #include <sys/mount.h>
+             #include <sys/param.h>
+             #include <sys/mount.h>
              #else
-               #include <sys/vfs.h>
+             #include <sys/vfs.h>
              #endif
         ],
         [
@@ -4100,16 +4333,39 @@ AC_CACHE_CHECK(for statfs, wx_cv_func_statfs,
              l += fs.f_blocks;
              l += fs.f_bavail;
         ],
-        [
-             wx_cv_func_statfs=yes
-        ],
-        [
-             wx_cv_func_statfs=no
-        ]
+         wx_cv_func_statfs=yes,
+         wx_cv_func_statfs=no
     )
 )
 
 if test "$wx_cv_func_statfs" = "yes"; then
+    dnl check whether we have its dcelaration too: some systems (AIX 4) lack it
+    AC_LANG_SAVE
+    AC_LANG_CPLUSPLUS
+    AC_CACHE_CHECK(for statfs declaration, wx_cv_func_statfs_decl,
+        AC_TRY_COMPILE(
+            [
+                 #if defined(__BSD__)
+                 #include <sys/param.h>
+                 #include <sys/mount.h>
+                 #else
+                 #include <sys/vfs.h>
+                 #endif
+            ],
+            [
+                struct statfs fs;
+                statfs("", &fs);
+            ],
+            wx_cv_func_statfs_decl=yes,
+            wx_cv_func_statfs_decl=no
+        )
+    )
+    AC_LANG_RESTORE
+
+    if test "$wx_cv_func_statfs_decl" = "yes"; then
+        AC_DEFINE(HAVE_STATFS_DECL)
+    fi
+
     wx_cv_type_statvfs_t="struct statfs"
     AC_DEFINE(HAVE_STATFS)
 else
@@ -4393,10 +4649,14 @@ if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
                 THREAD_OPTS="pthreads"
                 ;;
           *-hp-hpux* )
-                dnl HP-UX aCC only gives a warning, not an error about
-                dnl -pthread but it doesn't work and we have to use -lpthread
-                dnl there
-                if test "x$GCC" != "xyes"; then
+                if test "x$GCC" = "xyes"; then
+                    dnl g++ versions before 3.3.2 don't support -pthread.
+                    $CXX -dumpspecs | grep 'pthread:' >/dev/null ||
+                        THREAD_OPTS="" 
+                else
+                    dnl HP-UX aCC only gives a warning, not an error about
+                    dnl -pthread but it doesn't work and we have to use
+                    dnl -lpthread there
                     THREAD_OPTS=""
                 fi
                 ;;
@@ -4516,6 +4776,28 @@ if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
     if test "$wxUSE_THREADS" = "yes" ; then
       AC_CHECK_FUNCS(thr_setconcurrency)
 
+      dnl can't use AC_CHECK_FUNCS for this one as it's usually a macro and so
+      dnl wouldn't be found by it
+      AC_CACHE_CHECK([for pthread_cleanup_push/pop], wx_cv_func_pthread_cleanup,
+      [
+        AC_TRY_COMPILE([#include <pthread.h>
+               void ThreadCleanupFunc(void *p);
+            ],
+            [
+                void *p;
+                pthread_cleanup_push(ThreadCleanupFunc, p);
+                pthread_cleanup_pop(0);
+            ], [
+               wx_cv_func_pthread_cleanup=yes
+            ], [
+               wx_cv_func_pthread_cleanup=no
+            ]
+        )
+      ])
+      if test "x$wx_cv_func_pthread_cleanup" = "xyes"; then
+        AC_DEFINE(wxHAVE_PTHREAD_CLEANUP)
+      fi
+
       AC_CHECK_HEADERS(sched.h)
       if test "$ac_cv_header_sched_h" = "yes"; then
           AC_CHECK_FUNC(sched_yield,
@@ -4579,16 +4861,31 @@ if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
             [
                pthread_mutexattr_t attr;
                pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
-            ], [
-               wx_cv_type_pthread_mutexattr_t=yes
-            ], [
-               wx_cv_type_pthread_mutexattr_t=no
-            ]
+            ],
+            wx_cv_type_pthread_mutexattr_t=yes,
+            wx_cv_type_pthread_mutexattr_t=no
         )
       ])
 
       if test "$wx_cv_type_pthread_mutexattr_t" = "yes"; then
         AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_T)
+
+        dnl check if we already have the declaration we need, it is not
+        dnl present in some systems' headers
+        AC_CACHE_CHECK([for pthread_mutexattr_settype declaration],
+                       wx_cv_func_pthread_mutexattr_settype_decl, [
+                       AC_TRY_COMPILE([#include <pthread.h>],
+                           [
+                               pthread_mutexattr_t attr;
+                               pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+                           ],
+                           wx_cv_func_pthread_mutexattr_settype_decl=yes,
+                           wx_cv_func_pthread_mutexattr_settype_decl=no
+                       )
+        ])
+        if test "$wx_cv_func_pthread_mutexattr_settype_decl" = "yes"; then
+            AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_SETTYPE_DECL)
+        fi
       else
         dnl don't despair, there may be another way to do it
         AC_CACHE_CHECK([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER],
@@ -4943,8 +5240,41 @@ fi
 dnl Unix implementation needs additional checks because audio support
 dnl comes in many favours:
 if test "$USE_UNIX" = "1" ; then
-    AC_CHECK_HEADERS([sys/soundcard.h],,
-                     [DISABLED_CONTRIB="$DISABLED_CONTRIB mmedia"])
+    dnl it's not enough to check for just the header because OSS under NetBSD
+    dnl redefines ioctl as oss_ioctrl inside it and so we also need to test
+    dnl whether we need -lossaudio at link-time
+    AC_CACHE_CHECK([for ioctl() in sys/soundcard.h], ac_cv_header_sys_soundcard, [
+        AC_TRY_LINK([
+                #include <sys/soundcard.h>
+            ],
+            [
+                ioctl(0, SNDCTL_DSP_SYNC, 0);
+            ],
+            ac_cv_header_sys_soundcard=yes,
+            [
+                saveLibs="$LIBS"
+                LIBS="$saveLibs -lossaudio"
+                AC_TRY_LINK([
+                        #include <sys/soundcard.h>
+                    ],
+                    [
+                        ioctl(0, SNDCTL_DSP_SYNC, 0);
+                    ],
+                    ac_cv_header_sys_soundcard=yes,
+                    [
+                        LIBS="$saveLibs"
+                        ac_cv_header_sys_soundcard=no
+                    ]
+                )
+            ]
+        )
+    ])
+
+    if test "$ac_cv_header_sys_soundcard" = "yes"; then
+        AC_DEFINE(HAVE_SYS_SOUNDCARD_H)
+    else
+        DISABLED_CONTRIB="$DISABLED_CONTRIB mmedia"
+    fi
 fi
 WITH_PLUGIN_SDL=0
 if test "$wxUSE_SOUND" = "yes"; then
@@ -5140,11 +5470,34 @@ fi
 
 dnl ---------------------------------------------------------------------------
 dnl time/date functions
-dnl ------------------------------------------------------------------------
+dnl ---------------------------------------------------------------------------
 
 if test "$wxUSE_DATETIME" = "yes"; then
-    dnl check for strptime
+    dnl check for strptime and for its declaration as some systems lack it
     AC_CHECK_FUNCS(strptime)
+    if test "$ac_cv_func_strptime" = "yes"; then
+        AC_CACHE_CHECK([for strptime declaration], wx_cv_func_strptime_decl,
+            [
+                AC_LANG_SAVE
+                AC_LANG_CPLUSPLUS
+                AC_TRY_COMPILE(
+                    [
+                        #include <time.h>
+                    ],
+                    [
+                        struct tm t;
+                        strptime("foo", "bar", &t);
+                    ],
+                    wx_cv_func_strptime_decl=yes,
+                    wx_cv_func_strptime_decl=no
+                )
+                AC_LANG_RESTORE
+            ]
+        )
+    fi
+    if test "$wx_cv_func_strptime_decl" = "yes"; then
+        AC_DEFINE(HAVE_STRPTIME_DECL)
+    fi
 
     dnl check for timezone variable
     dnl   doesn't exist under Darwin / Mac OS X which uses tm_gmtoff instead
@@ -5342,9 +5695,9 @@ if test "$wxUSE_SOCKETS" = "yes" ; then
                         dnl converting between incompatible pointer types, so
                         dnl try to use it to get the correct behaviour at
                         dnl least with gcc (otherwise we'd always use size_t)
-                        CFLAGS_OLD="$CFLAGS"
+                        CXXFLAGS_OLD="$CXXFLAGS"
                         if test "$GCC" = yes ; then
-                            CFLAGS="$CFLAGS -Werror"
+                            CXXFLAGS="$CXXFLAGS -Werror"
                         fi
 
                         AC_TRY_COMPILE(
@@ -5371,7 +5724,7 @@ if test "$wxUSE_SOCKETS" = "yes" ; then
                             )
                         )
 
-                        CFLAGS="$CFLAGS_OLD"
+                        CXXFLAGS="$CXXFLAGS_OLD"
                     ]
                 )
             ])
@@ -5380,7 +5733,7 @@ if test "$wxUSE_SOCKETS" = "yes" ; then
             wxUSE_SOCKETS=no
             AC_MSG_WARN([Couldn't find socklen_t synonym for this system])
         else
-            AC_DEFINE_UNQUOTED(SOCKLEN_T, $wx_cv_type_getsockname3)
+            AC_DEFINE_UNQUOTED(WX_SOCKLEN_T, $wx_cv_type_getsockname3)
         fi
         dnl Do this again for getsockopt as it may be different
         AC_CACHE_CHECK([what is the type of the fifth argument of getsockopt],
@@ -5403,9 +5756,9 @@ if test "$wxUSE_SOCKETS" = "yes" ; then
                         dnl converting between incompatible pointer types, so
                         dnl try to use it to get the correct behaviour at
                         dnl least with gcc (otherwise we'd always use size_t)
-                        CFLAGS_OLD="$CFLAGS"
+                        CXXFLAGS_OLD="$CXXFLAGS"
                         if test "$GCC" = yes ; then
-                            CFLAGS="$CFLAGS -Werror"
+                            CXXFLAGS="$CXXFLAGS -Werror"
                         fi
 
                         AC_TRY_COMPILE(
@@ -5432,7 +5785,7 @@ if test "$wxUSE_SOCKETS" = "yes" ; then
                             )
                         )
 
-                        CFLAGS="$CFLAGS_OLD"
+                        CXXFLAGS="$CXXFLAGS_OLD"
                     ]
                 )
             ])
@@ -5636,6 +5989,17 @@ if test "$wxUSE_PROLOGIO" = "yes" -o  "$wxUSE_RESOURCES" = "yes"; then
     AC_MSG_ERROR([wxExpr and old-style resources are now available in contrib only])
 fi
 
+dnl ---------------------------------------------------------------------------
+dnl wxMetafile availability
+dnl ---------------------------------------------------------------------------
+
+if test "$wxUSE_METAFILE" = "yes"; then
+    if test "$wxUSE_MSW" != 1 -a "$wxUSE_MAC" != 1 -a "$wxUSE_PM" != 1; then
+        AC_MSG_WARN([wxMetafile is not available on this system... disabled])
+        wxUSE_METAFILE=no
+    fi
+fi
+
 dnl ---------------------------------------------------------------------------
 dnl IPC: IPC, Drag'n'Drop, Clipboard, ...
 dnl ---------------------------------------------------------------------------
@@ -6073,6 +6437,10 @@ if test "$wxUSE_ACCESSIBILITY" = "yes"; then
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS access"
 fi
 
+if test "$wxUSE_DC_CACHEING" = "yes"; then
+    AC_DEFINE(wxUSE_DC_CACHEING)
+fi
+
 if test "$wxUSE_DRAGIMAGE" = "yes"; then
     AC_DEFINE(wxUSE_DRAGIMAGE)
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dragimag"
@@ -6538,12 +6906,42 @@ INCLUDES="-I\${top_builddir}lib/wx/include/${TOOLCHAIN_FULLNAME} \
 -I\${top_srcdir}/include $TOOLKIT_INCLUDE"
 
 dnl C/C++ compiler options used to compile wxWidgets
-if test "$GXX" = yes ; then
+dnl
+dnl check for icc before gcc as icc is also recognized as gcc
+if test "x$INTELCC" = "xyes" ; then
+    dnl Warnings which can't be easily suppressed in C code are disabled:
+    dnl
+    dnl     remark #810: conversion from "x" to "y" may lose significant bits
+    dnl     remark #869: parameter "foo" was never referenced
+    dnl     remark #1572: floating-point equality and inequality comparisons
+    dnl                   are unreliable
+    dnl     remark #1684: conversion from pointer to same-sized integral type
+    dnl
+    dnl (for others see below)
+    CWARNINGS="-Wall -wd810,869,981,1418,1572,1684"
+elif test "$GCC" = yes ; then
+    CWARNINGS="-Wall -Wundef"
+fi
+
+if test "x$INTELCXX" = "xyes" ; then
+    dnl Intel compiler gives some warnings which simply can't be worked
+    dnl around or of which we have too many (810, 869) so it's impractical to
+    dnl keep them enabled even if in theory it would be nice and some others
+    dnl (279) are generated for standard macros and so there is nothing we can
+    dnl do about them
+    dnl
+    dnl     remark #279: controlling expression is constant
+    dnl     remark #383: value copied to temporary, reference to temporary used
+    dnl     remark #444: destructor for base class "xxx" is not virtual
+    dnl     remark #810: conversion from "x" to "y" may lose significant bits
+    dnl     remark #869: parameter "foo" was never referenced
+    dnl     remark #981: operands are evaluated in unspecified order
+    dnl     remark #1418: external definition with no prior declaration
+    dnl     remark #1419: external declaration in primary source file
+    CXXWARNINGS="-Wall -wd279,383,444,810,869,981,1418,1419"
+elif test "$GXX" = yes ; then
     dnl CXXWARNINGS="-Wall -W -Wcast-qual -Werror"
-    CWARNINGS="-Wall" 
-    CXXWARNINGS="$CWARNINGS -Wno-ctor-dtor-privacy" 
-    dnl should enable this one day...
-    dnl CXXWARNINGS="-Wall -Werror"
+    CXXWARNINGS="-Wall -Wundef -Wno-ctor-dtor-privacy" 
 fi
 
 EXTRA_CFLAGS="$WXDEBUG $WXODBCFLAG $PROFILE $OPTIMISE"
@@ -6552,7 +6950,7 @@ dnl remove the extra white space from the cc/c++/ld options
 CPPFLAGS=`echo $WXDEBUG_DEFINE $INCLUDES $CPPFLAGS`
 CFLAGS=`echo $CODE_GEN_FLAGS $EXTRA_CFLAGS $CFLAGS $CWARNINGS`
 CXXFLAGS=`echo $CODE_GEN_FLAGS $CODE_GEN_FLAGS_CXX $EXTRA_CFLAGS $CXXFLAGS $CXXWARNINGS`
-    
+
 if test "x$MWCC" = "xyes"; then
     dnl Correct MW 8.3 to be more similar to GCC.  In particular we
     dnl must use <regex.h> from system not our local copy on OS X,
@@ -6714,10 +7112,6 @@ fi
 
 AC_BAKEFILE([m4_include(autoconf_inc.m4)])
 
-if test "$wxUSE_WINE" = "yes"; then
-    RESCOMP=wrc
-fi
-
 if test "$wxUSE_SHARED" = "yes"; then
 
     dnl We get the shared build linker from bakefile, since it
@@ -6756,77 +7150,16 @@ if test "$wxUSE_OMF" = "yes"; then
     esac
 fi
 
-dnl According to Vaclav, if NO_GCC_PRAGMA is used for any reason it needs to
-dnl be in wx-config output.  Not doing so could result in link problems.
-GCC_PRAGMA_FLAGS=""
-PCH_FLAGS=""
-
-dnl Find out if we have to define WX_PRECOMP (and thus NO_GCC_PRAGMA)
+dnl find out if the compiler supports PCH
+dnl
+dnl TODO: this should be in bakefile
 if test $GCC_PCH = 1 ; then
-    PCH_FLAGS="-DWX_PRECOMP"
-    GCC_PRAGMA_FLAGS="-DNO_GCC_PRAGMA"
-else
-    dnl Find out if we have to define NO_GCC_PRAGMA
-    if test "$GCC" = yes; then
-        AC_MSG_CHECKING([if this GCC version is >= 4.0 and needs -DNO_GCC_PRAGMA])
-        AC_TRY_COMPILE([],
-            [#if (__GNUC__ < 4)
-             #error "Not GCC 4.0 or greater"
-             #endif
-            ],
-            [GCC_PRAGMA_FLAGS="-DNO_GCC_PRAGMA"
-             AC_MSG_RESULT([yes])],
-            [AC_MSG_RESULT([no])
-            case "${host}" in
-                powerpc-*-darwin* )
-                    dnl Some Apple's GCC version are broken and can't handle the
-                    dnl pragmas:
-                    GCC_PRAGMA_FLAGS="-DNO_GCC_PRAGMA"
-                ;;
-                *-*-mingw32* )
-                    dnl MinGW GCC versions > 3.2 have problems with
-                    dnl static member of classes derived from templates
-                    dnl in combination with #pragma interface/implementation
-                    dnl (the test case uses 4 files)
-                    dnl ... and with exceptions handling (undefined symbols needed
-                    dnl to correctly calls dtors when unwinding) as well
-                    if test "$wxUSE_STL" = "yes" -o \
-                    "$wxUSE_NO_EXCEPTIONS" != "yes" -o \
-                    "$wxUSE_NO_RTTI" != "yes"; then
-                        AC_MSG_CHECKING([if this MinGW version needs -DNO_GCC_PRAGMA])
-                        AC_TRY_COMPILE([],
-                            [#if !(__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2))
-                             #error "Not GCC 3.2 or greater"
-                             #endif
-                            ],
-                            [GCC_PRAGMA_FLAGS="-DNO_GCC_PRAGMA"
-                             AC_MSG_RESULT([yes])],
-                            [AC_MSG_RESULT([no])])
-                    fi
-                    ;;
-                *-pc-os2_emx | *-pc-os2-emx )
-                    dnl GCC versions ported to OS/2 have similar problems with
-                    dnl static member of classes in combination with STL and
-                    dnl pragma interface/implementation
-                    if test "$wxUSE_STL" = "yes"; then
-                        AC_MSG_CHECKING([if this gcc version needs -DNO_GCC_PRAGMA])
-                        AC_TRY_COMPILE([],
-                            [#if !(__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2))
-                             #error "Not GCC 3.2 or greater"
-                             #endif
-                            ],
-                            [GCC_PRAGMA_FLAGS="-DNO_GCC_PRAGMA"
-                             AC_MSG_RESULT([yes])],
-                            [AC_MSG_RESULT([no])])
-                    fi
-                    ;;
-            esac
-dnl  closing bracket of if GCC < 4.0
-        ] ) 
-    fi
+    CPPFLAGS="-DWX_PRECOMP $CPPFLAGS"
 fi
-CPPFLAGS="$PCH_FLAGS $GCC_PRAGMA_FLAGS $CPPFLAGS"
 
+dnl TOOLCHAIN_DEFS are used by wx-config but should be also used for wx build
+dnl itself
+CPPFLAGS="$CPPFLAGS $TOOLCHAIN_DEFS"
 
 dnl for convenience, sort the samples in alphabetical order
 dnl
@@ -6948,7 +7281,7 @@ dnl on platforms that do not have symlinks.
 dnl AC_CONFIG_LINKS([ include/wx-$WX_RELEASE$WX_FLAVOUR:include ])
 dnl AC_CONFIG_LINKS([ contrib/include ])
 
-
+if test "$wxWITH_SUBDIRS" != "no"; then
 dnl Configure samples, contrib etc. directories, but only if they are present:
 if test "$wxUSE_GUI" = "yes"; then
     SUBDIRS="samples demos utils contrib"
@@ -7005,7 +7338,7 @@ for subdir in `echo $SUBDIRS`; do
         done
     fi
 done
-
+fi dnl wxWITH_SUBDIRS
 
 AC_OUTPUT