]> git.saurik.com Git - wxWidgets.git/blobdiff - configure.in
fix for losing focus under Windows after showing the progress dialog
[wxWidgets.git] / configure.in
index 838379770478b32e003a6f717015fc91a12cacf7..6252daa5e11054b36b164c8aa9f8e9177d056716 100644 (file)
@@ -257,7 +257,6 @@ case "${host}" in
     AC_DEFINE(__EMX__)
     PROGRAM_EXT=".exe"
     DEFAULT_DEFAULT_wxUSE_PM=1
-    LIBS="$LIBS -lstdcpp"
   ;;
 
   powerpc-*-darwin* )
@@ -354,6 +353,8 @@ if test $DEBUG_CONFIGURE = 1; then
   DEFAULT_wxUSE_FONTMAP=no
   DEFAULT_wxUSE_STREAMS=no
   DEFAULT_wxUSE_SOCKETS=no
+  DEFAULT_wxUSE_OLE=no
+  DEFAULT_wxUSE_DATAOBJ=no
   DEFAULT_wxUSE_DIALUP_MANAGER=no
   DEFAULT_wxUSE_JOYSTICK=no
   DEFAULT_wxUSE_DYNLIB_CLASS=no
@@ -392,7 +393,7 @@ if test $DEBUG_CONFIGURE = 1; then
   DEFAULT_wxUSE_PROTOCOL_FTP=no
   DEFAULT_wxUSE_PROTOCOL_FILE=no
   DEFAULT_wxUSE_URL=no
-  
+
   DEFAULT_wxUSE_COMMONDLGS=no
   DEFAULT_wxUSE_CHOICEDLG=no
   DEFAULT_wxUSE_COLOURDLG=no
@@ -527,6 +528,8 @@ else
   DEFAULT_wxUSE_FONTMAP=yes
   DEFAULT_wxUSE_STREAMS=yes
   DEFAULT_wxUSE_SOCKETS=yes
+  DEFAULT_wxUSE_OLE=yes
+  DEFAULT_wxUSE_DATAOBJ=yes
   DEFAULT_wxUSE_DIALUP_MANAGER=yes
   DEFAULT_wxUSE_JOYSTICK=yes
   DEFAULT_wxUSE_DYNLIB_CLASS=yes
@@ -656,8 +659,8 @@ dnl ============================
 dnl these options use AC_ARG_WITH and not WX_ARG_WITH on purpose - we cache
 dnl these values manually
 for toolkit in `echo $ALL_TOOLKITS`; do
-  LINE=`grep "wxUSE_$toolkit" ${wx_arg_cache_file}`
-  if test "x$LINE" != x ; then
+  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"
@@ -688,7 +691,7 @@ AC_ARG_WITH(microwin,      [  --with-microwin         use MicroWindows], [wxUSE_
 AC_ARG_WITH(x11,           [  --with-x11              use X11], [wxUSE_X11="$withval" wxUSE_UNIVERSAL="yes" CACHE_X11=1 TOOLKIT_GIVEN=1])
 WX_ARG_ENABLE(nanox,       [  --enable-nanox          use NanoX], wxUSE_NANOX)
 
-AC_ARG_ENABLE(gtk2,        [  --enable-gtk2           use GTK+ 2.0 if available (EXPERIMENTAL)],wxUSE_GTK2="yes",wxUSE_GTK2="no")
+WX_ARG_ENABLE(gtk2,        [  --enable-gtk2           use GTK+ 2.0 if available (EXPERIMENTAL)], wxUSE_GTK2)
 
 WX_ARG_SYS_WITH(libpng,    [  --with-libpng           use libpng (PNG image format)], wxUSE_LIBPNG)
 WX_ARG_SYS_WITH(libjpeg,   [  --with-libjpeg          use libjpeg (JPEG file format)], wxUSE_LIBJPEG)
@@ -737,6 +740,13 @@ WX_ARG_ENABLE(no_deps,       [  --enable-no_deps        create code without depe
 WX_ARG_ENABLE(compat20,      [  --enable-compat20       enable wxWindows 2.0 compatibility], WXWIN_COMPATIBILITY_2)
 WX_ARG_ENABLE(compat22,      [  --disable-compat22      disable wxWindows 2.2 compatibility], WXWIN_COMPATIBILITY_2_2)
 
+AC_ARG_ENABLE(rpath,         [  --enable-rpath=DIR      output the rpath flag from wx-config], [wxRPATH_DIR="$enableval"])
+
+if test "$wxRPATH_DIR" != "" -a "$wxRPATH_DIR" != "disable"; then
+   WXCONFIG_RPATH="-Wl,-rpath -Wl,$wxRPATH_DIR"
+fi
+
+
 dnl ---------------------------------------------------------------------------
 dnl (small) optional non GUI classes
 dnl ---------------------------------------------------------------------------
@@ -749,6 +759,8 @@ WX_ARG_ENABLE(ftp,           [  --enable-ftp            use wxFTP (requires wxPr
 WX_ARG_ENABLE(http,          [  --enable-http           use wxHTTP (requires wxProtocol], wxUSE_PROTOCOL_HTTP)
 WX_ARG_ENABLE(fileproto,     [  --enable-fileproto      use wxFileProto class (requires wxProtocol], wxUSE_PROTOCOL_FILE)
 WX_ARG_ENABLE(sockets,       [  --enable-sockets        use socket/network classes], wxUSE_SOCKETS)
+WX_ARG_ENABLE(ole,           [  --enable-ole            use OLE classes], wxUSE_OLE)
+WX_ARG_ENABLE(dataobj,       [  --enable-dataobj        use data object classes], wxUSE_DATAOBJ)
 
 WX_ARG_ENABLE(ipc,           [  --enable-ipc            use interprocess communication (wxSocket etc.)], wxUSE_IPC)
 
@@ -1028,7 +1040,9 @@ dnl Path separator; ':' for unix, ';' for OS/2
 dnl Stem for flex output; lexyy for OS/2, lex.yy otherwise
 case "${host}" in
   *-pc-os2_emx | *-pc-os2-emx )
-    dnl PATH_IFS is autodetected by OS/2's configure (usually ';')
+    PATH_IFS=';'
+dnl Really ought to text for this as meanwhile there are flex versions using
+dnl lex.yy as well due to FAT support being more and more dropped...
     LEX_STEM="lexyy"
   ;;
   *)
@@ -1087,10 +1101,10 @@ if test "$wxUSE_GUI" = "yes"; then
       1)
       ;;
       0)
-        AC_MSG_ERROR(Please specify a toolkit - cannot determine the default for ${host})
+        AC_MSG_ERROR(Please specify a toolkit -- cannot determine the default for ${host})
       ;;
       *)
-        AC_MSG_ERROR(Please specify at most one toolkit (may be some are cached?))
+        AC_MSG_ERROR(Please specify at most one toolkit (maybe some are cached in configarg.cache?))
     esac
 
     dnl cache the wxUSE_<TOOLKIT> values too
@@ -1113,24 +1127,50 @@ else
     AC_MSG_RESULT(base ($host_alias hosted) only)
 fi
 
+dnl ---------------------------------------------------------------------------
+dnl When we are using gcc on OS/2, we want to be either using resources (PM)
+dnl or a more complete POSIX emulation for Motif/GTK+/X11
+dnl ---------------------------------------------------------------------------
+dnl (OS/2-only piece)
+case "${host}" in
+  *-pc-os2_emx | *-pc-os2-emx )
+      dnl Explicitly link -lstdcpp, since we are using "gcc" not "g++"/"c++".
+      LIBS="$LIBS -lstdcpp"
+      if test "$wxUSE_MOTIF" = 1 -o "$wxUSE_GTK" = 1 -o "$wxUSE_X11" = 1; then
+          dnl More complete Unix emulation for unix-like ports
+         dnl by linking in POSIX/2's cExt (if available).
+          AC_CHECK_LIB(cExt, drand48, LIBS="$LIBS -lcExt")
+      else
+         dnl Include resources for the "native" port (wxPM).
+          RESPROGRAMOBJ="\${top_srcdir}/include/wx/os2/wx.res"
+      fi
+  ;;
+esac
+dnl (end of OS/2-only piece)
+
 dnl ---------------------------------------------------------------------------
 dnl When we are using Cygwin with Motif/GTK+, we want it to appear like
 dnl 'just' a POSIX platform, so the Win32 API must not be available
 dnl ---------------------------------------------------------------------------
-
-define_win32=0
+dnl (Windows-only piece)
+wants_win32=0
+doesnt_want_win32=0
 case "${host}" in
   *-*-cygwin*)
       if test "$wxUSE_MSW" = 1 ; then
-        define_win32=1
+        wants_win32=1
+      else
+        doesnt_want_win32=1
       fi
   ;;
   *-*-mingw*)
-      define_win32=1
+      wants_win32=1
   ;;
 esac
 
-if test "$define_win32" = 1 ; then
+dnl NB: The two tests bellow are *NOT* mutually exclusive! They should only
+dnl     take effect on Cygwin/Mingw and not other platforms.
+if test "$wants_win32" = 1 ; then
     USE_UNIX=0
     USE_WIN32=1
     AC_DEFINE(__WIN32__)
@@ -1139,10 +1179,12 @@ if test "$define_win32" = 1 ; then
     AC_DEFINE(__GNUWIN32__)
     AC_DEFINE(STRICT)
     AC_DEFINE(WINVER, 0x0400)
-else
+fi
+if test "$doesnt_want_win32" = 1 ; then
     USE_UNIX=1
     USE_WIN32=0
 fi
+dnl (end of Windows-only piece)
 
 if test "$USE_UNIX" = 1 ; then
     wxUSE_UNIX=yes
@@ -1221,7 +1263,7 @@ dnl   make install path absolute (if not already); will fail with MSDOS paths
 case ${INSTALL} in
   /* ) # Absolute
      ;;
-  *)     
+  *)
      INSTALL=`pwd`/${INSTALL} ;;
 esac
 
@@ -1342,10 +1384,6 @@ if test "$ac_cv_header_wchar_h" != "yes"; then
     AC_CHECK_HEADERS(wcstr.h)
 fi
 
-dnl checking for wctype.h is useless as we need wcslen(), not just wchar_t and
-dnl this function is never provided by it
-dnl AC_CHECK_HEADERS(wctype.h)
-
 dnl defines HAVE_FNMATCH_H
 AC_CHECK_HEADERS(fnmatch.h)
 
@@ -1528,7 +1566,7 @@ AC_CACHE_SAVE
 dnl check for glibc version
 dnl
 dnl VZ: I have no idea why had this check been there originally, but now
-dnl     it is only used to get the recursive mutexes under Linux
+dnl     we could probably do without it by just always adding _GNU_SOURCE
 if test "$USE_LINUX" = 1; then
     AC_CACHE_CHECK([for glibc 2.1 or later], wx_cv_lib_glibc21,[
         AC_TRY_COMPILE([#include <features.h>],
@@ -1550,6 +1588,20 @@ if test "$USE_LINUX" = 1; then
     fi
 fi
 
+dnl we may need _GNU_SOURCE for 2 things:
+dnl
+dnl  1. to get PTHREAD_MUTEX_RECURSIVE with glibc 2.1+ (strictly speaking we
+dnl  only need _XOPEN_SOURCE=500 but just defining this disables _BSD_SOURCE
+dnl  which breaks libtiff compilation, so it is simpler to just define
+dnl  _GNU_SOURCE to get everything)
+dnl
+dnl  2. for Unicode functions
+if test "x$wx_cv_lib_glibc21" = "xyes"; then
+    if test "$wxUSE_UNICODE" = "yes" -o "$wxUSE_THREADS" = "yes"; then
+        AC_DEFINE(_GNU_SOURCE)
+    fi
+fi
+
 dnl ---------------------------------------------------------------------------
 dnl Optional libraries
 dnl
@@ -1639,7 +1691,7 @@ PNG_INCLUDE=
 PNG_LINK=
 if test "$wxUSE_LIBPNG" != "no" ; then
     AC_DEFINE(wxUSE_LIBPNG)
-    
+
     if test "$wxUSE_MGL" = 1 -a "$wxUSE_LIBPNG" = "builtin" ; then
         AC_MSG_WARN([wxMGL doesn't work with builtin png library, will use MGL one instead])
         wxUSE_LIBPNG=sys
@@ -1928,6 +1980,21 @@ equivalent variable and GTK+ is version 1.2.3 or above.
                     ;;
         esac
 
+        if test "$WXGTK20" = 1; then
+            if test "$wxUSE_PRINTING_ARCHITECTURE" = "yes" ; then
+                PKG_CHECK_MODULES(PANGOFT2, pangoft2,
+                    [
+                        CXXFLAGS="$CXXFLAGS $PANGOFT2_CFLAGS"
+                        LIBS="$LIBS $PANGOFT2_LIBS"
+                    ],
+                    [
+                        AC_MSG_WARN([pangoft2 library not found, library will be compiled without printing support])
+                        wxUSE_PRINTING_ARCHITECTURE="no"
+                    ]
+                )
+            fi
+        fi
+
         TOOLKIT_INCLUDE="$wx_cv_cflags_gtk"
         GUI_TK_LIBRARY="$wx_cv_libs_gtk"
 
@@ -2113,7 +2180,9 @@ equivalent variable and GTK+ is version 1.2.3 or above.
             mesa_link=" -lMesaGL"
             AC_MSG_RESULT(found at $ac_find_libraries)
         else
-            AC_MSG_ERROR(no)
+            mesa_link=""
+            AC_MSG_RESULT(no)
+            AC_MSG_WARN(library will be compiled without Mesa support)
         fi
 
         GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lwine$mesa_link$xpm_link -lXxf86dga -lXxf86vm -lSM -lICE -lXext -lXmu -lX11 -lncurses"
@@ -2139,7 +2208,9 @@ equivalent variable and GTK+ is version 1.2.3 or above.
         AC_MSG_CHECKING(for Motif/Lesstif headers)
         WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, Xm/Xm.h)
         if test "$ac_find_includes" != "" ; then
-            AC_MSG_RESULT(found $ac_find_includes)
+            AC_MSG_RESULT(found in $ac_find_includes)
+            WX_INCLUDE_PATH_EXIST($ac_find_includes, $TOOLKIT_INCLUDE)
+            TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE$ac_path_to_include"
         else
             AC_TRY_COMPILE(
                 [
@@ -2164,16 +2235,17 @@ equivalent variable and GTK+ is version 1.2.3 or above.
             AC_MSG_CHECKING(for Motif/Lesstif library)
             WX_PATH_FIND_LIBRARIES($SEARCH_LIB, Xm)
             if test "$ac_find_libraries" != "" ; then
-                WX_INCLUDE_PATH_EXIST($ac_find_includes, $TOOLKIT_INCLUDE)
-                WX_LINK_PATH_EXIST($ac_find_libraries, $GUI_TK_LIBRARY)
+                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"
-                TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE$ac_path_to_include"
-                AC_MSG_RESULT(found at $ac_find_libraries)
             else
-                dnl it might happen that we found headers in one of the standard
-                dnl paths but the libs are elsewhere - we do need to try to
-                dnl compile a sample program then here
+                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_TRY_COMPILE(
                     [
                         #include <Xm/Xm.h>
@@ -2191,6 +2263,8 @@ equivalent variable and GTK+ is version 1.2.3 or above.
                         AC_MSG_ERROR(please set LDFLAGS to contain the location of libXm)
                     ]
                 )
+
+                CFLAGS=$save_CFLAGS
             fi
         fi
 
@@ -2200,10 +2274,14 @@ equivalent variable and GTK+ is version 1.2.3 or above.
         if test "$ac_find_libraries" != "" ; then
             WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
             GUI_TK_LIBRARY="$GUI_TK_LIBRARY$ac_path_to_link"
+
             xpm_link=" -lXpm"
             AC_DEFINE(wxHAVE_LIB_XPM)
             AC_MSG_RESULT(found at $ac_find_libraries)
         else
+            save_CFLAGS=$CFLAGS
+            CFLAGS="$CFLAGS $TOOLKIT_INCLUDE"
+
             AC_TRY_COMPILE(
                 [
                     #include <X11/xpm.h>
@@ -2223,18 +2301,56 @@ equivalent variable and GTK+ is version 1.2.3 or above.
                     AC_MSG_WARN(library will be compiled without support for images in XPM format)
                 ]
             )
+
+            CFLAGS=$save_CFLAGS
         fi
 
-        dnl MBN: this should really be an AC_TRY_LINK, but it is faster
-        dnl      to special case it
-        xt_needs_sm_ice=
-        case "${host}" in
-          *-*-cygwin* )
-            xt_needs_sm_ice=" -lSM -lICE"
-            ;;
-        esac
+        AC_MSG_CHECKING([if we need -lXp and/or -lSM -lICE])
+        libp_link=""
+        libsm_ice_link=""
+        libs_found=0
+        for libp in "" " -lXp"; do
+            if test "$libs_found" = "0"; then
+                for libsm_ice in " -lSM -lICE"; do
+                    if test "$libs_found" = "0"; then                
+                        save_LIBS="$LIBS"
+                        LIBS="$GUI_TK_LIBRARY -lXm${xpm_link} ${libp} -lXmu -lXext -lXt${libsm_ice} -lX11"
+                        save_CFLAGS=$CFLAGS
+                        CFLAGS="$CFLAGS $TOOLKIT_INCLUDE"
+
+                        AC_TRY_LINK(
+                            [
+                                #include <Xm/Xm.h>
+                                #include <Xm/List.h>
+                            ],
+                            [
+                                XmString string = NULL;
+                                Widget w = NULL;
+                                int position = 0;
+                                XmListAddItem(w, string, position);
+                            ],
+                            [
+                                libp_link="$libp"
+                                libsm_ice_link="$libsm_ice"
+                                AC_MSG_RESULT(
+                                    [need${libp_link}${libsm_ice_link}])
+                                libs_found=1
+                            ], []
+                        )
 
-        GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXm$xpm_link -lXmu -lXext -lXt${xt_needs_sm_ice} -lX11"
+                        LIBS="$save_LIBS"
+                        CFLAGS=$save_CFLAGS
+                    fi
+                done
+            fi
+        done
+
+        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
+
+        GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXm$xpm_link${libp_link} -lXmu -lXext -lXt${libsm_ice_link} -lX11"
         TOOLKIT_VPATH="\${top_srcdir}/src/motif${PATH_IFS}\${top_srcdir}/src/motif/xmcombo"
         TOOLKIT=MOTIF
         GUIDIST=MOTIF_DIST
@@ -2482,7 +2598,7 @@ case "${host}" in
         dnl dynamic shared libraries (in order to embed the resources)
         if test "$wxUSE_MAC" = 1; then
             dnl the name of the resources file for wxMac
-            WX_RESOURCES_MACOSX_ASCII="lib${WX_LIBRARY}.r" 
+            WX_RESOURCES_MACOSX_ASCII="lib${WX_LIBRARY}.r"
             WX_RESOURCES_MACOSX_DATA="lib${WX_LIBRARY}.rsrc"
         fi
         ;;
@@ -2816,157 +2932,53 @@ dnl Check for functions
 dnl ---------------------------------------------------------------------------
 
 dnl don't check for wchar_t functions if we haven't got wchar_t itself
-WCHAR_OK=0
 if test "$wx_cv_sizeof_wchar_t" != "0"; then
-    dnl check for wcslen
+    AC_DEFINE(wxUSE_WCHAR_T)
+
+    dnl check for wcslen in all possible places
+    WCSLEN_FOUND=0
     WCHAR_LINK=
-    AC_CHECK_FUNCS(wcslen, [
-                    AC_DEFINE(HAVE_WCSLEN)
-                    WCHAR_OK=1
-                  ])
+    AC_CHECK_FUNCS(wcslen, WCSLEN_FOUND=1)
 
-    if test "$WCHAR_OK" = 0; then
+    if test "$WCSLEN_FOUND" = 0; then
         if test "$TOOLKIT" = "MSW"; then
-            AC_CHECK_LIB(msvcrt, wcslen, [
-                AC_DEFINE(HAVE_WCSLEN)
-                WCHAR_OK=1
-            ])
+            AC_CHECK_LIB(msvcrt, wcslen, WCHAR_OK=1)
         else
             AC_CHECK_LIB(w, wcslen, [
-                            AC_DEFINE(HAVE_WCSLEN)
                             WCHAR_LINK=" -lw"
-                            WCHAR_OK=1
+                            WCSLEN_FOUND=1
                         ])
         fi
     fi
-fi
 
-dnl we need at least the definition of wchar_t itself and wcslen() to compile
-dnl with wchar_t support -- turn it off if we don't have this
-if test "$WCHAR_OK" = 1; then
-    AC_DEFINE(wxUSE_WCHAR_T)
+    if test "$WCSLEN_FOUND" = 1; then
+        AC_DEFINE(HAVE_WCSLEN)
+    fi
 
-    dnl also try to use wcsrtombs instead of wcstombs which is buggy in old GNU
+    dnl try to use wcsrtombs instead of wcstombs which is buggy in old GNU
     dnl libc versions if possible
     AC_CHECK_FUNCS(wcsrtombs)
 else
-    dnl use built-in wcslen for Darwin (what about other BSD based systems?)
-    if test "$USE_DARWIN" = 1; then
-        AC_DEFINE(wxUSE_WCHAR_T)
-    else
-        AC_MSG_WARN([Wide character support is unavailable])
-    fi
+    AC_MSG_WARN([Wide character support is unavailable])
 fi
 
-dnl check for vprintf/vsprintf() which are GNU extensions
-AC_FUNC_VPRINTF
-
-dnl check for vsscanf() and vsnprintf() - on some platforms (Linux, glibc
-dnl 2.1.1 for the first one, HP-UX for the second) it's available in the
-dnl library but the prototype is missing, so we can't use AC_CHECK_FUNCS() here,
-dnl do it manually. We can't use AC_TRY_COMPILE(), either, because it doesn't
-dnl check if the symbol is available at linking time
-
-dnl we use AC_TRY_LINK() here instead of AC_TRY_RUN() to make the checks
-dnl work for cross-compilation, but AC_TRY_LINK() normally only compiles
-dnl one function while we need at least 2 - hence the ugly hack below. To
-dnl understand why it works, remember that AC_TRY_LINK() just prepends
-dnl "int main() {" in the beginning of the code and "; return 0; }" at the
-dnl end...
-
-dnl if we fail to find vsnprintf, also try for _vsnprintf as that is what
-dnl we'll find under MSW if it exists.
-
-dnl final note: AC_TRY_LINK will only be executed if there is nothing in
-dnl the cache so we have to do AC_DEFINE(HAVE_VSNPRINTF) below and not inside
-dnl it or the symbol wouldn't be defined for the 2nd and subsequent configure
-dnl runs
+dnl *printf() functions sometimes are available in the library but not
+dnl prototyped -- if this is the case, we can't use them from C++ code, but to
+dnl detect this we have to use C++ compiler for testing
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
 
-dnl check for vsnprintf() - a safe version of vsprintf()
-AC_CACHE_CHECK([for vsnprintf], wx_cv_func_vsnprintf,
-[
-  AC_TRY_LINK([
-                    #include <stdio.h>
-                    #include <stdarg.h>
-                 ], [
-                    int wx_test_vsnprintf(const char *, ...);
-
-                    wx_test_vsnprintf("%s");
-                    return 0;
-                 }
-
-                 int wx_test_vsnprintf(const char *fmt, ...)
-                 {
-                    char *s;
-
-                    va_list argp;
-                    va_start(argp, fmt);
-                    vsnprintf(s, 42, fmt, argp);
-                    va_end(argp);
-                 ], [
-                    wx_cv_func_vsnprintf=yes
-                 ], [
-                    AC_TRY_LINK([
-                                      #include <stdio.h>
-                                      #include <stdarg.h>
-                                   ], [
-                                      int wx_test_vsnprintf(const char *, ...);
-
-                                      wx_test_vsnprintf("%s");
-                                      return 0;
-                                   }
-
-                                   int wx_test_vsnprintf(const char *fmt, ...)
-                                   {
-                                      char *s;
-
-                                      va_list argp;
-                                      va_start(argp, fmt);
-                                      _vsnprintf(s, 42, fmt, argp);
-                                      va_end(argp);
-                                   ], [
-                                      wx_cv_func_vsnprintf=yes
-                                   ], [
-                                      wx_cv_func_vsnprintf=no
-                                   ])
-                 ])
-])
+dnl check for vsnprintf() -- a safe version of vsprintf())
+AC_CHECK_FUNCS(vsnprintf)
 
-if test "$wx_cv_func_vsnprintf" = yes; then
-    AC_DEFINE(HAVE_VSNPRINTF)
-else
-    AC_MSG_WARN(unsafe function vsprintf will be used instead of vsnprintf)
+if test "$wxUSE_UNICODE" = yes; then
+    dnl also look if we have wide char IO functions
+    AC_CHECK_FUNCS(fputwc wprintf vswprintf)
 fi
 
-dnl check for vsscanf()
-AC_CACHE_CHECK([for vsscanf], wx_cv_func_vsscanf,
-[
-  AC_TRY_COMPILE([
-                    #include <stdio.h>
-                    #include <stdarg.h>
-                ], [
-                    int wx_test_vsscanf(const char *, ...);
-
-                    wx_test_vsscanf("%d");
-                    return 0;
-                }
-
-                int wx_test_vsscanf(const char *fmt, ...)
-                {
-                    va_list argp;
-                    va_start(argp, fmt);
-                    vsscanf("42", fmt, argp);
-                    va_end(argp);
-                ], [
-                    wx_cv_func_vsscanf=yes
-                ], [
-                    wx_cv_func_vsscanf=no
-                ])
-])
+AC_LANG_RESTORE
+
 
-if test "$wx_cv_func_vsscanf" = yes; then
-    AC_DEFINE(HAVE_VSSCANF)
-fi
 
 dnl the following tests are for Unix(like) systems only
 if test "$TOOLKIT" != "MSW"; then
@@ -3013,9 +3025,6 @@ if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes" -a "$wxUSE_UNIX" = "yes"; then
     fi
 fi
 
-dnl check for vfork() (even if it's the same as fork() in modern Unices)
-AC_CHECK_FUNCS(vfork)
-
 dnl check for the function for temp files creation
 AC_CHECK_FUNCS(mkstemp mktemp, break)
 
@@ -3187,11 +3196,12 @@ dnl flush the cache
 AC_CACHE_SAVE
 
 dnl ---------------------------------------------------------------------------
-dnl thread support for Unix (always available under Win32)
+dnl thread support for Unix (for Win32 see past the next matching "else")
 dnl ---------------------------------------------------------------------------
 
-dnl under MSW we always have thread support
+dnl under MSW (except mingw32) we always have thread support
 CPP_MT_FLAG=
+COMMON_THREADCPPFLAGS=
 if test "$TOOLKIT" != "MSW"; then
 
     dnl the code below:
@@ -3406,14 +3416,6 @@ if test "$TOOLKIT" != "MSW"; then
       dnl defined, we do it by directly assigned
       dnl PTHREAD_MUTEX_RECURSIVE_MUTEX_INITIALIZER_NP to attr
 
-      dnl we need _GNU_SOURCE to get PTHREAD_MUTEX_RECURSIVE with glibc 2.1+
-      dnl (strictly speaking we only need _XOPEN_SOURCE=500 but just defining
-      dnl this disables _BSD_SOURCE which breaks libtiff compilation, so it is
-      dnl simpler to just define _GNU_SOURCE to get everything)
-      if test "x$wx_cv_lib_glibc21" = "xyes"; then
-          CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
-      fi
-
       AC_CACHE_CHECK([for pthread_mutexattr_t], wx_cv_type_pthread_mutexattr_t,
       [
         AC_TRY_COMPILE([#include <pthread.h>],
@@ -3455,6 +3457,17 @@ if test "$TOOLKIT" != "MSW"; then
     fi
 
 dnl from if !MSW
+else
+    if test "$wxUSE_THREADS" = "yes" ; then
+      case "${host}" in
+        *-*-mingw32* )
+        CFLAGS="$CFLAGS -mthreads"
+        CXXFLAGS="$CXXFLAGS -mthreads"
+        COMMON_THREADCPPFLAGS="-mthreads"
+        LDFLAGS="$LDFLAGS -mthreads"
+        ;;
+      esac
+    fi
 fi
 
 if test "$wxUSE_THREADS" = "yes"; then
@@ -3895,13 +3908,8 @@ dnl ------------------------------------------------------------------------
 dnl wxSocket
 dnl ------------------------------------------------------------------------
 
-dnl VZ: the GUI hooks wxSocket needs are not implemented yet in wxX11
+dnl VZ: the GUI hooks wxSocket needs are not implemented yet in wxMGL
 if test "$wxUSE_SOCKETS" = "yes"; then
-    if test "$wxUSE_X11" = "1"; then
-        AC_MSG_WARN([wxSocket not yet supported under X11... disabled])
-        wxUSE_SOCKETS="no"
-    fi
-
     if test "$wxUSE_MGL" = "1"; then
         AC_MSG_WARN([wxSocket not yet supported under MGL... disabled])
         wxUSE_SOCKETS="no"
@@ -4110,7 +4118,7 @@ fi
 
 if test "$wxUSE_UNICODE" = "yes" ; then
   AC_DEFINE(wxUSE_UNICODE)
-  
+
   if test "$wxUSE_MSW" != 1; then
       wxUSE_UNICODE_MSLU=no
   fi
@@ -4166,15 +4174,17 @@ if test "$wxUSE_CONSTRAINTS" = "yes"; then
 fi
 
 if test "$wxUSE_MDI_ARCHITECTURE" = "yes"; then
-    if test "$wxUSE_UNIVERSAL" = "yes"; then
-        AC_MSG_WARN(MDI not yet supported for wxUniversal... disabled)
-        wxUSE_MDI_ARCHITECTURE=no
-    fi
 
-    if test "$wxUSE_MDI_ARCHITECTURE" = "yes"; then
-        AC_DEFINE(wxUSE_MDI_ARCHITECTURE)
-        SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS mdi"
-    fi
+dnl     There is now experimental generic MDI support 
+dnl     if test "$wxUSE_UNIVERSAL" = "yes"; then
+dnl         AC_MSG_WARN(MDI not yet supported for wxUniversal... disabled)
+dnl         wxUSE_MDI_ARCHITECTURE=no
+dnl     fi
+
+   if test "$wxUSE_MDI_ARCHITECTURE" = "yes"; then
+       AC_DEFINE(wxUSE_MDI_ARCHITECTURE)
+       SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS mdi"
+   fi
 fi
 
 if test "$wxUSE_DOC_VIEW_ARCHITECTURE" = "yes" ; then
@@ -4239,13 +4249,24 @@ dnl check for ole headers and disable a few features requiring it if not
 dnl present (earlier versions of mingw32 don't have ole2.h)
 if test "$wxUSE_MSW" = 1 -a \( "$wxUSE_DATAOBJ"       = "yes" \
                           -o "$wxUSE_CLIPBOARD"     = "yes" \
+                          -o "$wxUSE_OLE"     = "yes" \
                           -o "$wxUSE_DRAG_AND_DROP" = "yes" \) ; then
     AC_CHECK_HEADERS(ole2.h)
 
     if test "$ac_cv_header_ole2_h" = "yes" ; then
         if test "$GCC" = yes ; then
+            AC_LANG_SAVE
+            AC_LANG_CPLUSPLUS
+
+            AC_MSG_CHECKING([if g++ requires -fvtable-thunks])
+            AC_TRY_COMPILE([#include <windows.h>
+                            #include <ole2.h>],
+                           [],
+                           [AC_MSG_RESULT(no)],
+                           [AC_MSG_RESULT(yes)
+                            CODE_GEN_FLAGS_CXX="$CODE_GEN_FLAGS_CXX -fvtable-thunks"])
+            AC_LANG_RESTORE
             ALL_OBJECTS="$ALL_OBJECTS \$(OLEOBJS)"
-            CODE_GEN_FLAGS_CXX="$CODE_GEN_FLAGS_CXX -fvtable-thunks"
             LIBS=" -lrpcrt4 -loleaut32 -lole32 -luuid$LIBS"
             AC_DEFINE(wxUSE_OLE)
 
@@ -4259,6 +4280,51 @@ if test "$wxUSE_MSW" = 1 -a \( "$wxUSE_DATAOBJ"       = "yes" \
         wxUSE_CLIPBOARD=no
         wxUSE_DRAG_AND_DROP=no
         wxUSE_DATAOBJ=no
+        wxUSE_OLE=no
+    fi
+
+    if test "$wxUSE_METAFILE" = "yes"; then
+        AC_DEFINE(wxUSE_METAFILE)
+
+        dnl this one should probably be made separately configurable
+        AC_DEFINE(wxUSE_ENH_METAFILE)
+    fi
+fi
+
+if test "$wxUSE_WINE" = 1 -a \( "$wxUSE_DATAOBJ"       = "yes" \
+                          -o "$wxUSE_CLIPBOARD"     = "yes" \
+                          -o "$wxUSE_OLE"     = "yes" \
+                          -o "$wxUSE_DRAG_AND_DROP" = "yes" \) ; then
+    AC_CHECK_HEADERS(ole2.h)
+
+    if test "$ac_cv_header_ole2_h" = "yes" ; then
+        if test "$GCC" = yes ; then
+            AC_LANG_SAVE
+            AC_LANG_CPLUSPLUS
+
+            AC_MSG_CHECKING([if g++ requires -fvtable-thunks])
+            AC_TRY_COMPILE([#include <windows.h>
+                            #include <ole2.h>],
+                           [],
+                           [AC_MSG_RESULT(no)],
+                           [AC_MSG_RESULT(yes)
+                            CODE_GEN_FLAGS_CXX="$CODE_GEN_FLAGS_CXX -fvtable-thunks"])
+            AC_LANG_RESTORE
+            ALL_OBJECTS="$ALL_OBJECTS \$(OLEOBJS)"
+            LIBS=" -lwine_uuid$LIBS"
+            AC_DEFINE(wxUSE_OLE)
+
+        fi
+
+        dnl for OLE clipboard and dnd
+        AC_DEFINE(wxUSE_DATAOBJ)
+    else
+        AC_MSG_WARN([Some features disabled because OLE headers not found])
+
+        wxUSE_CLIPBOARD=no
+        wxUSE_DRAG_AND_DROP=no
+        wxUSE_DATAOBJ=no
+        wxUSE_OLE=no
     fi
 
     if test "$wxUSE_METAFILE" = "yes"; then
@@ -4588,7 +4654,7 @@ if test "$wxUSE_POPUPWIN" = "yes"; then
         else
             if test "$wxUSE_PM" = 1; then
                 AC_MSG_WARN([wxPopupWindow not yet supported under PM... disabled])
-            else 
+            else
                 AC_DEFINE(wxUSE_POPUPWIN)
 
                 USES_CONTROLS=1
@@ -4600,7 +4666,7 @@ fi
 if test "$wxUSE_TIPWINDOW" = "yes"; then
     if test "$wxUSE_PM" = 1; then
         AC_MSG_WARN([wxTipWindow not yet supported under PM... disabled])
-    else 
+    else
         AC_DEFINE(wxUSE_TIPWINDOW)
     fi
 fi
@@ -4853,7 +4919,7 @@ if test "$wxUSE_GUI" = "yes"; then
     dnl      ipc, mfc, nativdlg, oleauto, ownerdrw
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS artprov controls dialogs \
                      drawing dynamic erase event exec font image \
-                     minimal richedit rotate widgets"
+                     minimal propsize rotate widgets"
 
     dnl this is needed to be able to find AFM files
     CPPFLAGS="$CPPFLAGS \$(EXTRADEFS) \$(APPEXTRADEFS)"
@@ -4899,8 +4965,8 @@ fi
 EXTRA_CFLAGS="$WXDEBUG $WXODBCFLAG $PROFILE $OPTIMISE $INCLUDES"
 
 dnl remove the extra white space from the cc/c++/ld options
-CFLAGS=`echo $CFLAGS $EXTRA_CFLAGS $CXXWARNINGS | sed 's/ \\+/ /g'`
-CXXFLAGS=`echo $CXXFLAGS $EXTRA_CFLAGS $CXXWARNINGS | sed 's/ \+/ /g'`
+CFLAGS=`echo $EXTRA_CFLAGS $CFLAGS $CXXWARNINGS | sed 's/ \\+/ /g'`
+CXXFLAGS=`echo $EXTRA_CFLAGS $CXXFLAGS $CXXWARNINGS | sed 's/ \+/ /g'`
 LIBS=`echo $LIBS | sed 's/ \+/ /g'`
 
 LDFLAGS="$LDFLAGS $PROFILE"
@@ -4973,6 +5039,7 @@ AC_SUBST(WXCONFIG_LIBS_GL)
 AC_SUBST(WXCONFIG_LIBS_STATIC)
 AC_SUBST(WXCONFIG_LIBS_STATIC_GL)
 AC_SUBST(WXCONFIG_INCLUDE)
+AC_SUBST(WXCONFIG_RPATH)
 
 dnl the list of files to compile/install
 AC_SUBST(ALL_OBJECTS)
@@ -4984,6 +5051,7 @@ AC_SUBST(GUIDIST)
 AC_SUBST(PORT_FILES)
 AC_SUBST(DISTDIR)
 
+AC_SUBST(COMMON_THREADCPPFLAGS)
 dnl additional subdirectories where we will build
 AC_SUBST(SAMPLES_SUBDIRS)