Index: win/tclWinInit.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinInit.c,v
retrieving revision 1.83
diff -u -r1.83 tclWinInit.c
--- win/tclWinInit.c	2 Aug 2009 10:41:09 -0000	1.83
+++ win/tclWinInit.c	14 Aug 2009 05:34:57 -0000
@@ -435,6 +435,15 @@
     int useWide;
 
     useWide = (TclWinGetPlatformId() != VER_PLATFORM_WIN32_WINDOWS);
+#ifdef HAVE_UNICOWS
+    if (!useWide) {
+	HINSTANCE hInstance = LoadLibraryA("unicows");
+	if (hInstance != NULL) {
+	    useWide = 1;
+	    FreeLibrary(hInstance);
+	}
+    }
+#endif
     TclWinSetInterfaces(useWide);
 }
 
Index: win/configure
===================================================================
RCS file: /cvsroot/tcl/tcl/win/configure,v
retrieving revision 1.125
diff -u -r1.125 configure
--- win/configure	26 Jul 2009 07:57:56 -0000	1.125
+++ win/configure	14 Aug 2009 05:34:57 -0000
@@ -4325,8 +4325,62 @@
 #define TCL_CFG_DO64BIT 1
 _ACEOF
 
-    fi
+    else
+
+	cat >>conftest.$ac_ext <<_ACEOF
+extern char _stdcall LoadGodot();
+void main() {LoadGodot();}
+_ACEOF
+	rm -f conftest.$ac_objext conftest$ac_exeext
+	ac_func_search_save_LIBS=$LIBS
+	if test "${GCC}" = "yes" ; then
+	    LIBS="-lunicows $ac_func_search_save_LIBS"
+	else
+	    LIBS="unicows.lib $ac_func_search_save_LIBS"
+	fi
+	if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+	    (eval $ac_link) 2>conftest.er1
+	    ac_status=$?
+	    grep -v '^ *+' conftest.er1 >conftest.err
+	    rm -f conftest.er1
+	    cat conftest.err >&5
+	    echo "$as_me:$LINENO: \$? = $ac_status" >&5
+	    (exit $ac_status); } &&
+		 { ac_try='test -z "$ac_c_werror_flag"
+				 || test ! -s conftest.err'
+	    { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+	    (eval $ac_try) 2>&5
+	    ac_status=$?
+	    echo "$as_me:$LINENO: \$? = $ac_status" >&5
+	    (exit $ac_status); }; } &&
+		 { ac_try='test -s conftest$ac_exeext'
+	    { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+	    (eval $ac_try) 2>&5
+	    ac_status=$?
+	    echo "$as_me:$LINENO: \$? = $ac_status" >&5
+	    (exit $ac_status); }; }; then
+	    if test "${GCC}" = "yes" ; then
+		LIBS_GUI="-lunicows $LIBS_GUI"
+	    else
+		LIBS_GUI="unicows.lib $LIBS_GUI"
+	    fi
+	    echo "$as_me:$LINENO: result: unicows library found" >&5
+echo "${ECHO_T}unicows library found" >&6
+	    cat >>confdefs.h <<\_ACEOF
+#define HAVE_UNICOWS 1
+_ACEOF
 
+	    UNICOWS_DLL_FILE=\${UNICOWS_DLL_FILE}
+
+	else
+	    echo "$as_me:$LINENO: result: unicows library not found" >&5
+echo "${ECHO_T}unicows library not found" >&6
+	    echo "$as_me: failed program was:" >&5
+	    sed 's/^/| /' conftest.$ac_ext >&5
+	    LIBS="$ac_func_search_save_LIBS"
+	fi
+
+    fi
 
     # DL_LIBS is empty, but then we match the Unix version
 
Index: win/tcl.m4
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tcl.m4,v
retrieving revision 1.76
diff -u -r1.76 tcl.m4
--- win/tcl.m4	26 Jul 2009 07:57:57 -0000	1.76
+++ win/tcl.m4	14 Aug 2009 05:34:57 -0000
@@ -776,8 +776,56 @@
 
     if test "$do64bit" != "no" ; then
 	AC_DEFINE(TCL_CFG_DO64BIT)
+    else
+
+	cat >>conftest.$ac_ext <<_ACEOF
+extern char _stdcall LoadGodot();
+void main() {LoadGodot();}
+_ACEOF
+	rm -f conftest.$ac_objext conftest$ac_exeext
+	ac_func_search_save_LIBS=$LIBS
+	if test "${GCC}" = "yes" ; then
+	    LIBS="-lunicows $ac_func_search_save_LIBS"
+	else
+	    LIBS="unicows.lib $ac_func_search_save_LIBS"
+	fi
+	if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+	    (eval $ac_link) 2>conftest.er1
+	    ac_status=$?
+	    grep -v '^ *+' conftest.er1 >conftest.err
+	    rm -f conftest.er1
+	    cat conftest.err >&5
+	    echo "$as_me:$LINENO: \$? = $ac_status" >&5
+	    (exit $ac_status); } &&
+		 { ac_try='test -z "$ac_c_werror_flag"
+				 || test ! -s conftest.err'
+	    { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+	    (eval $ac_try) 2>&5
+	    ac_status=$?
+	    echo "$as_me:$LINENO: \$? = $ac_status" >&5
+	    (exit $ac_status); }; } &&
+		 { ac_try='test -s conftest$ac_exeext'
+	    { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+	    (eval $ac_try) 2>&5
+	    ac_status=$?
+	    echo "$as_me:$LINENO: \$? = $ac_status" >&5
+	    (exit $ac_status); }; }; then
+	    if test "${GCC}" = "yes" ; then
+		LIBS_GUI="-lunicows $LIBS_GUI"
+	    else
+		LIBS_GUI="unicows.lib $LIBS_GUI"
+	    fi
+	    AC_MSG_RESULT([unicows library found])
+	    AC_DEFINE(HAVE_UNICOWS)
+	    AC_SUBST(UNICOWS_DLL_FILE,[\${UNICOWS_DLL_FILE}])
+	else
+	    AC_MSG_RESULT([unicows library not found])
+	    echo "$as_me: failed program was:" >&5
+	    sed 's/^/| /' conftest.$ac_ext >&5
+	    LIBS="$ac_func_search_save_LIBS"
+	fi
+
     fi
-    AC_SUBST(UNICOWS_DLL_FILE)
 
     # DL_LIBS is empty, but then we match the Unix version
     AC_SUBST(DL_LIBS)