
TK_PATCHES -   09/24/1999

This patch file updates from Tk 8.2.0 to Tk 8.2.0+. It should be applied
by running the "patch" program in the top-level directory of a clean
Tk 8.2.0 release, using the command "patch -p0 <TK_PATCHES"

If you are using Solaris, don't be surprised if the patch utility does not
work. This is a known problem. Better install GNU patch version 2.1 or later.

Prereq: "8.2.0"
*** generic/tk.h.orig	Fri Aug 13 20:26:19 1999
--- generic/tk.h	Fri Sep 24 21:25:38 1999
***************
*** 49,55 ****
  #define TK_RELEASE_SERIAL  0
  
  #define TK_VERSION "8.2"
! #define TK_PATCH_LEVEL "8.2.0"
  
  /*
   * The following definitions set up the proper options for Macintosh
--- 49,55 ----
  #define TK_RELEASE_SERIAL  0
  
  #define TK_VERSION "8.2"
! #define TK_PATCH_LEVEL "8.2.0+"
  
  /*
   * The following definitions set up the proper options for Macintosh
***************
*** 96,101 ****
--- 96,104 ----
  
  #ifdef XNQueryInputStyle
  #define TK_USE_INPUT_METHODS
+ #ifdef I18N_IMPROVE
+ #include <X11/Xlocale.h>
+ #endif /* I18N_IMPROVE */
  #endif
  
  /*
***************
*** 1167,1181 ****
  #define Tk_Main(argc, argv, proc) \
      Tk_MainEx(argc, argv, proc, Tcl_CreateInterp())
  
- char *Tk_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, char *version, int exact));
- 
- #ifndef USE_TK_STUBS
- 
- #define Tk_InitStubs(interp, version, exact) \
-     Tcl_PkgRequire(interp, "Tk", version, exact)
- 
- #endif
- 
  
  /*
   *--------------------------------------------------------------
--- 1170,1175 ----
***************
*** 1208,1213 ****
--- 1202,1225 ----
   */
  
  #include "tkDecls.h"
+ 
+ /*
+  * Convenience declaration of Tk_InitStubs.
+  * This function is not *implemented* by the tcl library, so the storage
+  * class is neither DLLEXPORT nor DLLIMPORT
+  */
+ 
+ #undef TCL_STORAGE_CLASS
+ #define TCL_STORAGE_CLASS
+ 
+ EXTERN char *Tk_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, char *version, int exact));
+ 
+ #ifndef USE_TK_STUBS
+ 
+ #define Tk_InitStubs(interp, version, exact) \
+     Tcl_PkgRequire(interp, "Tk", version, exact)
+ 
+ #endif
  
  /*
   * Tcl commands exported by Tk:
*** pluspatch.orig	Fri Sep 24 21:28:56 1999
--- pluspatch	Fri Sep 24 21:25:38 1999
***************
*** 0 ****
--- 1,60 ----
+ #!/bin/sh
+ # The next line restarts using tclsh8.2 \
+ exec tclsh8.2 $0 ${1+"$@"}
+ 
+ set dirs ". ./unix ./library ./generic ./tests ./doc ./mac ./win ./win/rc"
+ set package "+"
+ set version "8.2.0"
+ set date [clock format [clock seconds] -format {%m/%d/%Y}]
+ 
+ #
+ # This is a tcl-script that will search a list of directories
+ # for ".orig"-files. For all of these it will make a "diff",
+ # and create a patch-file.
+ #
+ #	Written by:	Jan Nijtmans
+ #			CMG (Computer Managemeng Group) Arnhem B.V.
+ #			email: Jan.Nijtmans@wxs.nl (private)
+ #			       Jan.Nijtmans@cmg.nl (work)
+ #			url:   http://home.wxs.nl/~nijtmans/
+ 
+ set patchlevel ""
+ set dfiles ""
+ 
+ set file [open pluspatch.orig w]
+ close $file
+ 
+ foreach dir $dirs {
+     set files [eval exec ls $dir]
+     foreach file $files {
+ 	if {[regexp ".*\.orig" $file]} {
+ 	    set file $dir/[string range $file 0 [expr [string length $file]-6]]
+ 	    if {$file=="$dir/tk.h"} {
+ 		set patchlevel $file.diff
+ 	    } else {
+ 		lappend dfiles $file.diff
+ 	    }
+ 	    set file [string range $file 2 [string length $file]]
+ 	    puts stdout "creating $file.diff"
+ 	    catch "exec diff -c $file.orig $file >$file.diff"
+ 	}
+     }
+ }
+ 
+ puts stdout "creating TK_PATCHES"
+ set file [open TK_PATCHES w]
+ puts $file "
+ TK_PATCHES -   $date
+ 
+ This patch file updates from Tk ${version} to Tk ${version}${package}. It should be applied
+ by running the \"patch\" program in the top-level directory of a clean
+ Tk ${version} release, using the command \"patch -p0 <TK_PATCHES\"
+ 
+ If you are using Solaris, don't be surprised if the patch utility does not
+ work. This is a known problem. Better install GNU patch version 2.1 or later.
+ 
+ Prereq: \"${version}\"
+ [eval exec cat $patchlevel $dfiles]"
+ close $file
+ 
+ file delete pluspatch.diff pluspatch.orig
*** unix/Makefile.in.orig	Sat Aug 14 00:06:14 1999
--- unix/Makefile.in	Fri Sep 24 21:25:38 1999
***************
*** 83,88 ****
--- 83,89 ----
  
  # The linker flags needed to link in the Tcl library (ex: -ltcl8.2)
  TCL_LIB_FLAG =		@TCL_LIB_FLAG@
+ TCL_STUB_LIB_FLAG =	@TCL_STUB_LIB_FLAG@
  
  # Libraries built with optimization switches have this additional extension
  TK_DBGX =		@TK_DBGX@
***************
*** 182,187 ****
--- 183,189 ----
  
  #TCL_LIB_SPEC = @TCL_BUILD_LIB_SPEC@
  TCL_LIB_SPEC = @TCL_LIB_SPEC@
+ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
  TK_EXP_FILE = @TK_EXP_FILE@
  TK_BUILD_EXP_FILE = @TK_BUILD_EXP_FILE@
  
***************
*** 210,216 ****
  # modify any of this stuff by hand.
  #----------------------------------------------------------------
  
! AC_FLAGS =		@EXTRA_CFLAGS@ @DEFS@
  RANLIB =		@RANLIB@
  SRC_DIR =		@srcdir@/..
  TOP_DIR =		@srcdir@/..
--- 212,219 ----
  # modify any of this stuff by hand.
  #----------------------------------------------------------------
  
! AC_FLAGS =		@EXTRA_CFLAGS@ @DEFS@ @X11_IMAKE_FLAGS@ \
! 	-DI18N_IMPROVE @CPPFLAGS@
  RANLIB =		@RANLIB@
  SRC_DIR =		@srcdir@/..
  TOP_DIR =		@srcdir@/..
***************
*** 267,273 ****
  	tkUnixCursor.o tkUnixDraw.o tkUnixEmbed.o tkUnixEvent.o \
  	tkUnixFocus.o tkUnixFont.o tkUnixInit.o tkUnixKey.o tkUnixMenu.o \
  	tkUnixMenubu.o tkUnixScale.o tkUnixScrlbr.o tkUnixSelect.o \
! 	tkUnixSend.o tkUnixWm.o tkUnixXId.o tkStubInit.o tkStubLib.o
  
  STUB_LIB_OBJS = tkStubLib.o
  
--- 270,277 ----
  	tkUnixCursor.o tkUnixDraw.o tkUnixEmbed.o tkUnixEvent.o \
  	tkUnixFocus.o tkUnixFont.o tkUnixInit.o tkUnixKey.o tkUnixMenu.o \
  	tkUnixMenubu.o tkUnixScale.o tkUnixScrlbr.o tkUnixSelect.o \
! 	tkUnixSend.o tkUnixWm.o tkUnixXId.o tkStubInit.o tkStubLib.o \
! 	tkUnixIm.o
  
  STUB_LIB_OBJS = tkStubLib.o
  
***************
*** 329,334 ****
--- 333,339 ----
  	$(UNIX_DIR)/tkUnixEmbed.c $(UNIX_DIR)/tkUnixEvent.c \
  	$(UNIX_DIR)/tkUnixFocus.c \
  	$(UNIX_DIR)/tkUnixFont.c $(UNIX_DIR)/tkUnixInit.c \
+ 	$(UNIX_DIR)/tkUnixIm.c \
  	$(UNIX_DIR)/tkUnixKey.c \
  	$(UNIX_DIR)/tkUnixMenu.c $(UNIX_DIR)/tkUnixMenubu.c \
  	$(UNIX_DIR)/tkUnixScale.c $(UNIX_DIR)/tkUnixScrlbr.c \
***************
*** 434,439 ****
--- 439,446 ----
  	@$(INSTALL_DATA) $(TK_LIB_FILE) $(LIB_INSTALL_DIR)/$(TK_LIB_FILE)
  	@(cd $(LIB_INSTALL_DIR); $(RANLIB) $(TK_LIB_FILE))
  	@chmod 555 $(LIB_INSTALL_DIR)/$(TK_LIB_FILE)
+ 	@echo "Installing pkgIndex.tcl"
+ 	@tclsh$(VERSION) pkgInstall.tcl $(LIB_INSTALL_DIR)
  	@echo "Installing wish"
  	@$(INSTALL_PROGRAM) wish $(BIN_INSTALL_DIR)/wish$(VERSION)
  	@echo "Installing tkConfig.sh"
***************
*** 561,566 ****
--- 568,585 ----
  	rm -f Makefile config.status config.cache config.log tkConfig.sh \
  		$(PACKAGE).* prototype
  
+ patchclean:	modeclean
+ 	@for i in .. ../generic ../doc ../unix ../mac ../win \
+ 		../library ../win/rc ../tests ;do \
+ 	    echo "removing $$i/*.orig and $$i/*.diff"; \
+ 	    rm -f $$i/*.orig $$i/*.diff; \
+ 	done;
+ 	rm -f ../*patch*
+ 
+ modeclean:
+ 	chmod u-w ../changes ../library/*.tcl ../tests/*.test
+ 	chmod u-w ../doc/*.n ../generic/*.c ../win/rc/*.rc
+ 
  depend:
  	makedepend -- $(DEPEND_SWITCHES) -- $(SRCS)
  
***************
*** 704,710 ****
  	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkScrollbar.c
  
  tkSquare.o: $(GENERIC_DIR)/tkSquare.c
! 	$(CC) -c $(CC_SWITCHES_NO_STUBS) $(GENERIC_DIR)/tkSquare.c
  
  tkCanvas.o: $(GENERIC_DIR)/tkCanvas.c
  	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkCanvas.c
--- 723,729 ----
  	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkScrollbar.c
  
  tkSquare.o: $(GENERIC_DIR)/tkSquare.c
! 	$(CC) -c $(CC_SWITCHES) -DUSE_TK_STUBS $(GENERIC_DIR)/tkSquare.c
  
  tkCanvas.o: $(GENERIC_DIR)/tkCanvas.c
  	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkCanvas.c
***************
*** 758,764 ****
  	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPhoto.c
  
  tkTest.o: $(GENERIC_DIR)/tkTest.c
! 	$(CC) -c $(CC_SWITCHES_NO_STUBS) $(GENERIC_DIR)/tkTest.c
  
  tkText.o: $(GENERIC_DIR)/tkText.c
  	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkText.c
--- 777,783 ----
  	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPhoto.c
  
  tkTest.o: $(GENERIC_DIR)/tkTest.c
! 	$(CC) -c $(CC_SWITCHES) -DUSE_TK_STUBS $(GENERIC_DIR)/tkTest.c
  
  tkText.o: $(GENERIC_DIR)/tkText.c
  	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkText.c
***************
*** 825,830 ****
--- 844,852 ----
  
  tkUnixFont.o: $(UNIX_DIR)/tkUnixFont.c
  	$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixFont.c
+ 
+ tkUnixIm.o: $(UNIX_DIR)/tkUnixIm.c
+ 	$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixIm.c
  
  tkUnixInit.o: $(UNIX_DIR)/tkUnixInit.c $(GENERIC_DIR)/tkInitScript.h tkConfig.sh
  	$(CC) -c $(CC_SWITCHES) -DTK_LIBRARY=\"${TK_LIBRARY}\" \
*** unix/aclocal.m4.orig	Fri Sep 24 21:25:38 1999
--- unix/aclocal.m4	Fri Sep 24 21:25:38 1999
***************
*** 0 ****
--- 1,1697 ----
+ #------------------------------------------------------------------------
+ # SC_PATH_TCLCONFIG --
+ #
+ #	Locate the tclConfig.sh file and perform a sanity check on
+ #	the Tcl compile flags
+ #
+ # Arguments:
+ #	none
+ #
+ # Results:
+ #
+ #	Adds the following arguments to configure:
+ #		--with-tcl=...
+ #
+ #	Defines the following vars:
+ #		TCL_BIN_DIR	Full path to the directory containing
+ #				the tclConfig.sh file
+ #------------------------------------------------------------------------
+ 
+ AC_DEFUN(SC_PATH_TCLCONFIG, [
+     #
+     # Ok, lets find the tcl configuration
+     # First, look for one uninstalled.
+     # the alternative search directory is invoked by --with-tcl
+     #
+ 
+     if test x"${no_tcl}" = x ; then
+ 	# we reset no_tcl in case something fails here
+ 	no_tcl=true
+ 	AC_ARG_WITH(tcl, [  --with-tcl              directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval})
+ 	AC_MSG_CHECKING([for Tcl configuration])
+ 	AC_CACHE_VAL(ac_cv_c_tclconfig,[
+ 
+ 	    # First check to see if --with-tclconfig was specified.
+ 	    if test x"${with_tclconfig}" != x ; then
+ 		if test -f "${with_tclconfig}/tclConfig.sh" ; then
+ 		    ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
+ 		else
+ 		    AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
+ 		fi
+ 	    fi
+ 
+ 	    # then check for a private Tcl installation
+ 	    if test x"${ac_cv_c_tclconfig}" = x ; then
+ 		for i in \
+ 			../tcl \
+ 			`ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
+ 			../../tcl \
+ 			`ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
+ 			../../../tcl \
+ 			`ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
+ 		    if test -f "$i/unix/tclConfig.sh" ; then
+ 			ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
+ 			break
+ 		    fi
+ 		done
+ 	    fi
+ 
+ 	    # check in a few common install locations
+ 	    if test x"${ac_cv_c_tclconfig}" = x ; then
+ 		for i in `ls -d ${prefix}/lib 2>/dev/null` \
+ 			`ls -d /usr/local/lib 2>/dev/null` ; do
+ 		    if test -f "$i/tclConfig.sh" ; then
+ 			ac_cv_c_tclconfig=`(cd $i; pwd)`
+ 			break
+ 		    fi
+ 		done
+ 	    fi
+ 
+ 	    # check in a few other private locations
+ 	    if test x"${ac_cv_c_tcliconfig}" = x ; then
+ 		for i in \
+ 			${srcdir}/../tcl \
+ 			`ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
+ 		    if test -f "$i/unix/tclConfig.sh" ; then
+ 		    ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
+ 		    break
+ 		fi
+ 		done
+ 	    fi
+ 	])
+ 
+ 	if test x"${ac_cv_c_tclconfig}" = x ; then
+ 	    TCL_BIN_DIR="# no Tcl configs found"
+ 	    AC_MSG_WARN(Can't find Tcl configuration definitions)
+ 	    exit 0
+ 	else
+ 	    no_tcl=
+ 	    TCL_BIN_DIR=${ac_cv_c_tclconfig}
+ 	    AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
+ 	fi
+     fi
+ ])
+ 
+ #------------------------------------------------------------------------
+ # SC_PATH_TKCONFIG --
+ #
+ #	Locate the tkConfig.sh file
+ #
+ # Arguments:
+ #	none
+ #
+ # Results:
+ #
+ #	Adds the following arguments to configure:
+ #		--with-tk=...
+ #
+ #	Defines the following vars:
+ #		TK_BIN_DIR	Full path to the directory containing
+ #				the tkConfig.sh file
+ #------------------------------------------------------------------------
+ 
+ AC_DEFUN(SC_PATH_TKCONFIG, [
+     #
+     # Ok, lets find the tk configuration
+     # First, look for one uninstalled.
+     # the alternative search directory is invoked by --with-tk
+     #
+ 
+     if test x"${no_tk}" = x ; then
+ 	# we reset no_tk in case something fails here
+ 	no_tk=true
+ 	AC_ARG_WITH(tk, [  --with-tk               directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval})
+ 	AC_MSG_CHECKING([for Tk configuration])
+ 	AC_CACHE_VAL(ac_cv_c_tkconfig,[
+ 
+ 	    # First check to see if --with-tkconfig was specified.
+ 	    if test x"${with_tkconfig}" != x ; then
+ 		if test -f "${with_tkconfig}/tkConfig.sh" ; then
+ 		    ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
+ 		else
+ 		    AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
+ 		fi
+ 	    fi
+ 
+ 	    # then check for a private Tk library
+ 	    if test x"${ac_cv_c_tkconfig}" = x ; then
+ 		for i in \
+ 			../tk \
+ 			`ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
+ 			../../tk \
+ 			`ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
+ 			../../../tk \
+ 			`ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
+ 		    if test -f "$i/unix/tkConfig.sh" ; then
+ 			ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
+ 			break
+ 		    fi
+ 		done
+ 	    fi
+ 	    # check in a few common install locations
+ 	    if test x"${ac_cv_c_tkconfig}" = x ; then
+ 		for i in `ls -d ${prefix}/lib 2>/dev/null` \
+ 			`ls -d /usr/local/lib 2>/dev/null` ; do
+ 		    if test -f "$i/tkConfig.sh" ; then
+ 			ac_cv_c_tkconfig=`(cd $i; pwd)`
+ 			break
+ 		    fi
+ 		done
+ 	    fi
+ 	    # check in a few other private locations
+ 	    if test x"${ac_cv_c_tkconfig}" = x ; then
+ 		for i in \
+ 			${srcdir}/../tk \
+ 			`ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
+ 		    if test -f "$i/unix/tkConfig.sh" ; then
+ 			ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
+ 			break
+ 		    fi
+ 		done
+ 	    fi
+ 	])
+ 	if test x"${ac_cv_c_tkconfig}" = x ; then
+ 	    TK_BIN_DIR="# no Tk configs found"
+ 	    AC_MSG_WARN(Can't find Tk configuration definitions)
+ 	    exit 0
+ 	else
+ 	    no_tk=
+ 	    TK_BIN_DIR=${ac_cv_c_tkconfig}
+ 	    AC_MSG_RESULT(found $TK_BIN_DIR/tkConfig.sh)
+ 	fi
+     fi
+ 
+ ])
+ 
+ #------------------------------------------------------------------------
+ # SC_LOAD_TCLCONFIG --
+ #
+ #	Load the tclConfig.sh file
+ #
+ # Arguments:
+ #	
+ #	Requires the following vars to be set:
+ #		TCL_BIN_DIR
+ #
+ # Results:
+ #
+ #	Subst the following vars:
+ #		TCL_BIN_DIR
+ #		TCL_SRC_DIR
+ #		TCL_LIB_FILE
+ #
+ #------------------------------------------------------------------------
+ 
+ AC_DEFUN(SC_LOAD_TCLCONFIG, [
+     AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
+ 
+     if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
+         AC_MSG_RESULT([loading])
+ 	. $TCL_BIN_DIR/tclConfig.sh
+     else
+         AC_MSG_RESULT([file not found])
+     fi
+ 
+     #
+     # The eval is required to do the TCL_DBGX substitution in the
+     # TCL_LIB_FILE variable
+     #
+ 
+     eval TCL_LIB_FILE=${TCL_LIB_FILE}
+     eval TCL_LIB_FLAG=${TCL_LIB_FLAG}
+ 
+     AC_SUBST(TCL_BIN_DIR)
+     AC_SUBST(TCL_SRC_DIR)
+     AC_SUBST(TCL_LIB_FILE)
+ ])
+ 
+ #------------------------------------------------------------------------
+ # SC_LOAD_TKCONFIG --
+ #
+ #	Load the tkConfig.sh file
+ #
+ # Arguments:
+ #	
+ #	Requires the following vars to be set:
+ #		TK_BIN_DIR
+ #
+ # Results:
+ #
+ #	Sets the following vars that should be in tkConfig.sh:
+ #		TK_BIN_DIR
+ #------------------------------------------------------------------------
+ 
+ AC_DEFUN(SC_LOAD_TKCONFIG, [
+     AC_MSG_CHECKING([for existence of $TCLCONFIG])
+ 
+     if test -f "$TK_BIN_DIR/tkConfig.sh" ; then
+         AC_MSG_CHECKING([loading $TK_BIN_DIR/tkConfig.sh])
+ 	. $TK_BIN_DIR/tkConfig.sh
+     else
+         AC_MSG_RESULT([could not find $TK_BIN_DIR/tkConfig.sh])
+     fi
+ 
+     AC_SUBST(TK_BIN_DIR)
+     AC_SUBST(TK_SRC_DIR)
+     AC_SUBST(TK_LIB_FILE)
+ ])
+ 
+ #------------------------------------------------------------------------
+ # SC_ENABLE_GCC --
+ #
+ #	Allows the use of GCC if available
+ #
+ # Arguments:
+ #	none
+ #	
+ # Results:
+ #
+ #	Adds the following arguments to configure:
+ #		--enable-gcc
+ #
+ #	Sets the following vars:
+ #		CC	Command to use for the compiler
+ #------------------------------------------------------------------------
+ 
+ AC_DEFUN(SC_ENABLE_GCC, [
+     AC_ARG_ENABLE(gcc, [  --enable-gcc            allow use of gcc if available [--disable-gcc]],
+ 	[ok=$enableval], [ok=no])
+     if test "$ok" = "yes"; then
+ 	CC=gcc
+ 	AC_PROG_CC
+     else
+ 	CC=${CC-cc}
+     fi
+ ])
+ 
+ #------------------------------------------------------------------------
+ # SC_ENABLE_SHARED --
+ #
+ #	Allows the building of shared libraries
+ #
+ # Arguments:
+ #	none
+ #	
+ # Results:
+ #
+ #	Adds the following arguments to configure:
+ #		--enable-shared=yes|no
+ #
+ #	Defines the following vars:
+ #		STATIC_BUILD	Used for building import/export libraries
+ #				on Windows.
+ #
+ #	Sets the following vars:
+ #		SHARED_BUILD	Value of 1 or 0
+ #------------------------------------------------------------------------
+ 
+ AC_DEFUN(SC_ENABLE_SHARED, [
+     AC_MSG_CHECKING([how to build libraries])
+     AC_ARG_ENABLE(shared,
+ 	[  --disable-shared        build and link without shared libraries [--disable-shared]],
+ 	[tcl_ok=$enableval], [tcl_ok=yes])
+ 
+     if test "${enable_shared+set}" = set; then
+ 	enableval="$enable_shared"
+ 	tcl_ok=$enableval
+     else
+ 	tcl_ok=yes
+     fi
+ 
+     if test "$tcl_ok" = "yes" ; then
+ 	AC_MSG_RESULT([shared])
+ 	SHARED_BUILD=1
+     else
+ 	AC_MSG_RESULT([static])
+ 	SHARED_BUILD=0
+ 	AC_DEFINE(STATIC_BUILD)
+     fi
+ ])
+ 
+ #------------------------------------------------------------------------
+ # SC_ENABLE_THREADS --
+ #
+ #	Specify if thread support should be enabled
+ #
+ # Arguments:
+ #	none
+ #	
+ # Results:
+ #
+ #	Adds the following arguments to configure:
+ #		--enable-threads
+ #
+ #	Sets the following vars:
+ #		THREADS_LIBS	Thread library(s)
+ #
+ #	Defines the following vars:
+ #		TCL_THREADS
+ #		_REENTRANT
+ #
+ #------------------------------------------------------------------------
+ 
+ AC_DEFUN(SC_ENABLE_THREADS, [
+     AC_MSG_CHECKING(for building with threads)
+     AC_ARG_ENABLE(threads, [  --enable-threads        build with threads],
+ 	[tcl_ok=$enableval], [tcl_ok=no])
+ 
+     if test "$tcl_ok" = "yes"; then
+ 	AC_MSG_RESULT(yes)
+ 	TCL_THREADS=1
+ 	AC_DEFINE(TCL_THREADS)
+ 	AC_DEFINE(_REENTRANT)
+ 
+ 	AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
+ 	if test "$tcl_ok" = "yes"; then
+ 	    # The space is needed
+ 	    THREADS_LIBS=" -lpthread"
+ 	else
+ 	    TCL_THREADS=0
+ 	    AC_MSG_WARN("Don t know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...")
+ 	fi
+     else
+ 	TCL_THREADS=0
+ 	AC_MSG_RESULT(no (default))
+     fi
+ 
+ ])
+ 
+ #------------------------------------------------------------------------
+ # SC_ENABLE_SYMBOLS --
+ #
+ #	Specify if debugging symbols should be used
+ #
+ # Arguments:
+ #	none
+ #	
+ #	Requires the following vars to be set:
+ #		CFLAGS_DEBUG
+ #		CFLAGS_OPTIMIZE
+ #		LDFLAGS_DEBUG
+ #		LDFLAGS_OPTIMIZE
+ #	
+ # Results:
+ #
+ #	Adds the following arguments to configure:
+ #		--enable-symbols
+ #
+ #	Defines the following vars:
+ #		CFLAGS_DEFAULT	Sets to CFLAGS_DEBUG if true
+ #				Sets to CFLAGS_OPTIMIZE if false
+ #		LDFLAGS_DEFAULT	Sets to LDFLAGS_DEBUG if true
+ #				Sets to LDFLAGS_OPTIMIZE if false
+ #		DBGX		Debug library extension
+ #
+ #------------------------------------------------------------------------
+ 
+ AC_DEFUN(SC_ENABLE_SYMBOLS, [
+     AC_MSG_CHECKING([for build with symbols])
+     AC_ARG_ENABLE(symbols, [  --enable-symbols        build with debugging symbols [--enable-symbols]],    [tcl_ok=$enableval], [tcl_ok=no])
+     if test "$tcl_ok" = "yes"; then
+ 	CFLAGS_DEFAULT='${CFLAGS_DEBUG}'
+ 	LDFLAGS_DEFAULT='${LDFLAGS_DEBUG}'
+ 	DBGX=g
+ 	AC_MSG_RESULT([yes])
+     else
+ 	CFLAGS_DEFAULT='${CFLAGS_OPTIMIZE}'
+ 	LDFLAGS_DEFAULT='${LDFLAGS_OPTIMIZE}'
+ 	DBGX=""
+ 	AC_MSG_RESULT([no])
+     fi
+ ])
+ 
+ #--------------------------------------------------------------------
+ # SC_CONFIG_CFLAGS
+ #
+ #	Try to determine the proper flags to pass to the compiler
+ #	for building shared libraries and other such nonsense.
+ #
+ # Arguments:
+ #	none
+ #
+ # Results:
+ #
+ #	Defines the following vars:
+ #
+ #       DL_OBJS -       Name of the object file that implements dynamic
+ #                       loading for Tcl on this system.
+ #       DL_LIBS -       Library file(s) to include in tclsh and other base
+ #                       applications in order for the "load" command to work.
+ #       LDFLAGS -      Flags to pass to the compiler when linking object
+ #                       files into an executable application binary such
+ #                       as tclsh.
+ #       LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
+ #                       that tell the run-time dynamic linker where to look
+ #                       for shared libraries such as libtcl.so.  Depends on
+ #                       the variable LIB_RUNTIME_DIR in the Makefile.
+ #       MAKE_LIB -      Command to execute to build the Tcl library;
+ #                       differs depending on whether or not Tcl is being
+ #                       compiled as a shared library.
+ #       SHLIB_CFLAGS -  Flags to pass to cc when compiling the components
+ #                       of a shared library (may request position-independent
+ #                       code, among other things).
+ #       SHLIB_LD -      Base command to use for combining object files
+ #                       into a shared library.
+ #       SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
+ #                       creating shared libraries.  This symbol typically
+ #                       goes at the end of the "ld" commands that build
+ #                       shared libraries. The value of the symbol is
+ #                       "${LIBS}" if all of the dependent libraries should
+ #                       be specified when creating a shared library.  If
+ #                       dependent libraries should not be specified (as on
+ #                       SunOS 4.x, where they cause the link to fail, or in
+ #                       general if Tcl and Tk aren't themselves shared
+ #                       libraries), then this symbol has an empty string
+ #                       as its value.
+ #       SHLIB_SUFFIX -  Suffix to use for the names of dynamically loadable
+ #                       extensions.  An empty string means we don't know how
+ #                       to use shared libraries on this platform.
+ #       TCL_LIB_FILE -  Name of the file that contains the Tcl library, such
+ #                       as libtcl7.8.so or libtcl7.8.a.
+ #       TCL_LIB_SUFFIX -Specifies everything that comes after the "libtcl"
+ #                       in the shared library name, using the $VERSION variable
+ #                       to put the version in the right place.  This is used
+ #                       by platforms that need non-standard library names.
+ #                       Examples:  ${VERSION}.so.1.1 on NetBSD, since it needs
+ #                       to have a version after the .so, and ${VERSION}.a
+ #                       on AIX, since the Tcl shared library needs to have
+ #                       a .a extension whereas shared objects for loadable
+ #                       extensions have a .so extension.  Defaults to
+ #                       ${VERSION}${SHLIB_SUFFIX}.
+ #       TCL_NEEDS_EXP_FILE -
+ #                       1 means that an export file is needed to link to a
+ #                       shared library.
+ #       TCL_EXP_FILE -  The name of the installed export / import file which
+ #                       should be used to link to the Tcl shared library.
+ #                       Empty if Tcl is unshared.
+ #       TCL_BUILD_EXP_FILE -
+ #                       The name of the built export / import file which
+ #                       should be used to link to the Tcl shared library.
+ #                       Empty if Tcl is unshared.
+ #	CFLAGS_DEBUG -
+ #			Flags used when running the compiler in debug mode
+ #	CFLAGS_OPTIMIZE -
+ #			Flags used when running the compiler in optimize mode
+ #
+ #	EXTRA_CFLAGS
+ #
+ #	Subst's the following vars:
+ #		DL_LIBS
+ #		CFLAGS_DEBUG
+ #		CFLAGS_OPTIMIZE
+ #--------------------------------------------------------------------
+ 
+ AC_DEFUN(SC_CONFIG_CFLAGS, [
+ 
+     # Step 0: Enable 64 bit support?
+ 
+     AC_MSG_CHECKING([if 64bit support is enabled])
+     AC_ARG_ENABLE(64bit,[  --enable-64bit          enable 64bit support],,enableval="no")
+ 
+     if test "$enableval" = "yes"; then
+ 	AC_MSG_RESULT(Will compile with 64bit support)
+ 	do64bit=yes
+     else
+ 	do64bit=no
+     fi
+     AC_MSG_RESULT($do64bit)
+  
+     # Step 1: set the variable "system" to hold the name and version number
+     # for the system.  This can usually be done via the "uname" command, but
+     # there are a few systems, like Next, where this doesn't work.
+ 
+     AC_MSG_CHECKING([system version (for dynamic loading)])
+     if test -f /usr/lib/NextStep/software_version; then
+ 	system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
+     else
+ 	system=`uname -s`-`uname -r`
+ 	if test "$?" -ne 0 ; then
+ 	    AC_MSG_RESULT([unknown (can't find uname command)])
+ 	    system=unknown
+ 	else
+ 	    # Special check for weird MP-RAS system (uname returns weird
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+ 		system=MP-RAS-`awk '{print $3}' /etc/.relid'`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+ 	    fi
+ 	    AC_MSG_RESULT($system)
+ 	fi
+     fi
+ 
+     # Step 2: check for existence of -ldl library.  This is needed because
+     # Linux can use either -ldl or -ldld for dynamic loading.
+ 
+     AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
+ 
+     # Step 3: set configuration options based on system name and version.
+ 
+     do64bit_ok=no
+     fullSrcDir=`cd $srcdir; pwd`
+     EXTRA_CFLAGS=""
+     TCL_EXPORT_FILE_SUFFIX=""
+     UNSHARED_LIB_SUFFIX=""
+     TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
+     ECHO_VERSION='`echo ${VERSION}`'
+     TCL_LIB_VERSIONS_OK=ok
+     CFLAGS_DEBUG=-g
+     CFLAGS_OPTIMIZE=-O
+     TCL_NEEDS_EXP_FILE=0
+     TCL_BUILD_EXP_FILE=""
+     TCL_EXP_FILE=""
+     case $system in
+ 	AIX-4.[[2-9]])
+ 	    SHLIB_CFLAGS=""
+ 	    SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+ 	    DL_OBJS=""
+ 	    DL_LIBS="-ldl"
+ 	    LDFLAGS=""
+ 	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ 	    TCL_NEEDS_EXP_FILE=1
+ 	    TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
+ 	    ;;
+ 	AIX-*)
+ 	    SHLIB_CFLAGS=""
+ 	    SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+ 	    DL_OBJS=""
+ 	    LIBOBJS="$LIBOBJS tclLoadAix.o"
+ 	    DL_LIBS="-lld"
+ 	    LDFLAGS=""
+ 	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ 	    TCL_NEEDS_EXP_FILE=1
+ 	    TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
+ 	    ;;
+ 	BSD/OS-2.1*|BSD/OS-3*)
+ 	    SHLIB_CFLAGS=""
+ 	    SHLIB_LD="shlicc -r"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+ 	    DL_OBJS=""
+ 	    DL_LIBS="-ldl"
+ 	    LDFLAGS=""
+ 	    LD_SEARCH_FLAGS=""
+ 	    ;;
+ 	BSD/OS-4.*)
+ 	    SHLIB_CFLAGS="-export-dynamic -fPIC"
+ 	    SHLIB_LD="cc -shared"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+ 	    DL_OBJS=""
+ 	    DL_LIBS="-ldl"
+ 	    LDFLAGS="-export-dynamic"
+ 	    LD_SEARCH_FLAGS=""
+ 	    ;;
+ 	dgux*)
+ 	    SHLIB_CFLAGS="-K PIC"
+ 	    SHLIB_LD="cc -G"
+ 	    SHLIB_LD_LIBS=""
+ 	    SHLIB_SUFFIX=".so"
+ 	    DL_OBJS=""
+ 	    DL_LIBS="-ldl"
+ 	    LDFLAGS=""
+ 	    LD_SEARCH_FLAGS=""
+ 	    ;;
+ 	HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*|HP-UX-*.11.*)
+ 	    SHLIB_SUFFIX=".sl"
+ 	    AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
+ 	    if test "$tcl_ok" = yes; then
+ 		SHLIB_CFLAGS="+z"
+ 		SHLIB_LD="ld -b"
+ 		SHLIB_LD_LIBS=""
+ 		DL_OBJS="tclLoadShl.o"
+ 		DL_LIBS="-ldld"
+ 		LDFLAGS="-Wl,-E"
+ 		LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
+ 	    fi
+ 	    ;;
+ 	IRIX-4.*)
+ 	    SHLIB_CFLAGS="-G 0"
+ 	    SHLIB_SUFFIX=".a"
+ 	    SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    DL_OBJS="tclLoadAout.o"
+ 	    DL_LIBS=""
+ 	    LDFLAGS="-Wl,-D,08000000"
+ 	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ 	    SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
+ 	    ;;
+ 	IRIX-5.*|IRIX-6.*|IRIX64-6.5*)
+ 	    SHLIB_CFLAGS=""
+ 	    SHLIB_LD="ld -n32 -shared -rdata_shared"
+ 	    SHLIB_LD_LIBS=""
+ 	    SHLIB_SUFFIX=".so"
+ 	    DL_OBJS=""
+ 	    DL_LIBS=""
+ 	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ 	    if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
+ 		EXTRA_CFLAGS="-mabi=n32"
+ 		LDFLAGS="-mabi=n32"
+ 	    else
+ 		case $system in
+ 		    IRIX-6.3)
+ 			# Use to build 6.2 compatible binaries on 6.3.
+ 			EXTRA_CFLAGS="-n32 -D_OLD_TERMIOS"
+ 			;;
+ 		    *)
+ 			EXTRA_CFLAGS="-n32"
+ 			;;
+ 		esac
+ 		LDFLAGS="-n32"
+ 	    fi
+ 	    ;;
+ 	IRIX64-6.*)
+ 	    SHLIB_CFLAGS=""
+ 	    SHLIB_LD="ld -32 -shared -rdata_shared"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+ 	    DL_OBJS=""
+ 	    DL_LIBS=""
+ 	    LDFLAGS=""
+ 	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ 	    ;;
+ 	Linux*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+ 
+ 	    # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings 
+ 	    # when you inline the string and math operations.  Turn this off to
+ 	    # get rid of the warnings.
+ 
+ 	    CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
+ 
+ 	    if test "$have_dl" = yes; then
+ 		SHLIB_LD="${CC} -shared"
+ 		DL_OBJS=""
+ 		DL_LIBS="-ldl"
+ 		LDFLAGS="-rdynamic"
+ 		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ 	    else
+ 		AC_CHECK_HEADER(dld.h, [
+ 		    SHLIB_LD="ld -shared"
+ 		    DL_OBJS="tclLoadDld.o"
+ 		    DL_LIBS="-ldld"
+ 		    LDFLAGS=""
+ 		    LD_SEARCH_FLAGS=""])
+ 	    fi
+ 	    if test "`uname -m`" = "alpha" ; then
+ 		EXTRA_CFLAGS="-mieee"
+ 	    fi
+ 	    ;;
+ 	MP-RAS-02*)
+ 	    SHLIB_CFLAGS="-K PIC"
+ 	    SHLIB_LD="cc -G"
+ 	    SHLIB_LD_LIBS=""
+ 	    SHLIB_SUFFIX=".so"
+ 	    DL_OBJS=""
+ 	    DL_LIBS="-ldl"
+ 	    LDFLAGS=""
+ 	    LD_SEARCH_FLAGS=""
+ 	    ;;
+ 	MP-RAS-*)
+ 	    SHLIB_CFLAGS="-K PIC"
+ 	    SHLIB_LD="cc -G"
+ 	    SHLIB_LD_LIBS=""
+ 	    SHLIB_SUFFIX=".so"
+ 	    DL_OBJS=""
+ 	    DL_LIBS="-ldl"
+ 	    LDFLAGS="-Wl,-Bexport"
+ 	    LD_SEARCH_FLAGS=""
+ 	    ;;
+ 	NetBSD-*|FreeBSD-[[12]].*|OpenBSD-*)
+ 	    # Not available on all versions:  check for include file.
+ 	    AC_CHECK_HEADER(dlfcn.h, [
+ 		SHLIB_CFLAGS="-fpic"
+ 		SHLIB_LD="ld -Bshareable -x"
+ 		SHLIB_LD_LIBS=""
+ 		SHLIB_SUFFIX=".so"
+ 		DL_OBJS=""
+ 		DL_LIBS=""
+ 		LDFLAGS=""
+ 		LD_SEARCH_FLAGS=""
+ 		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
+ 	    ], [
+ 		SHLIB_CFLAGS=""
+ 		SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
+ 		SHLIB_LD_LIBS='${LIBS}'
+ 		SHLIB_SUFFIX=".a"
+ 		DL_OBJS="tclLoadAout.o"
+ 		DL_LIBS=""
+ 		LDFLAGS=""
+ 		LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ 		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ 	    ])
+ 
+ 	    # FreeBSD doesn't handle version numbers with dots.
+ 
+ 	    UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ 	    TCL_LIB_VERSIONS_OK=nodots
+ 	    ;;
+ 	FreeBSD-*)
+ 	    # FreeBSD 3.* and greater have ELF.
+ 	    SHLIB_CFLAGS="-fpic"
+ 	    SHLIB_LD="ld -Bshareable -x"
+ 	    SHLIB_LD_LIBS=""
+ 	    SHLIB_SUFFIX=".so"
+ 	    DL_OBJS=""
+ 	    DL_LIBS=""
+ 	    LDFLAGS=""
+ 	    LD_SEARCH_FLAGS=""
+ 	    ;;
+ 	NEXTSTEP-*)
+ 	    SHLIB_CFLAGS=""
+ 	    SHLIB_LD="cc -nostdlib -r"
+ 	    SHLIB_LD_LIBS=""
+ 	    SHLIB_SUFFIX=".so"
+ 	    DL_OBJS="tclLoadNext.o"
+ 	    DL_LIBS=""
+ 	    LDFLAGS=""
+ 	    LD_SEARCH_FLAGS=""
+ 	    ;;
+ 	OS/390-*)
+ 	    CFLAGS_OPTIMIZE=""      # Optimizer is buggy
+ 	    AC_DEFINE(_OE_SOCKETS)  # needed in sys/socket.h
+ 	    ;;      
+ 	OSF1-1.0|OSF1-1.1|OSF1-1.2)
+ 	    # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
+ 	    SHLIB_CFLAGS=""
+ 	    # Hack: make package name same as library name
+ 	    SHLIB_LD='ld -R -export $@:'
+ 	    SHLIB_LD_LIBS=""
+ 	    SHLIB_SUFFIX=".so"
+ 	    DL_OBJS="tclLoadOSF.o"
+ 	    DL_LIBS=""
+ 	    LDFLAGS=""
+ 	    LD_SEARCH_FLAGS=""
+ 	    ;;
+ 	OSF1-1.*)
+ 	    # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
+ 	    SHLIB_CFLAGS="-fpic"
+ 	    SHLIB_LD="ld -shared"
+ 	    SHLIB_LD_LIBS=""
+ 	    SHLIB_SUFFIX=".so"
+ 	    DL_OBJS=""
+ 	    DL_LIBS=""
+ 	    LDFLAGS=""
+ 	    LD_SEARCH_FLAGS=""
+ 	    ;;
+ 	OSF1-V*)
+ 	    # Digital OSF/1
+ 	    SHLIB_CFLAGS=""
+ 	    SHLIB_LD='ld -shared -expect_unresolved "*"'
+ 	    SHLIB_LD_LIBS=""
+ 	    SHLIB_SUFFIX=".so"
+ 	    DL_OBJS=""
+ 	    DL_LIBS=""
+ 	    LDFLAGS=""
+ 	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ 	    ;;
+ 	RISCos-*)
+ 	    SHLIB_CFLAGS="-G 0"
+ 	    SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".a"
+ 	    DL_OBJS="tclLoadAout.o"
+ 	    DL_LIBS=""
+ 	    LDFLAGS="-Wl,-D,08000000"
+ 	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ 	    ;;
+ 	SCO_SV-3.2*)
+ 	    # Note, dlopen is available only on SCO 3.2.5 and greater.  However,
+ 	    # this test works, since "uname -s" was non-standard in 3.2.4 and
+ 	    # below.
+ 	    SHLIB_CFLAGS="-Kpic -belf"
+ 	    SHLIB_LD="ld -G"
+ 	    SHLIB_LD_LIBS=""
+ 	    SHLIB_SUFFIX=".so"
+ 	    DL_OBJS=""
+ 	    DL_LIBS=""
+ 	    LDFLAGS="-belf -Wl,-Bexport"
+ 	    LD_SEARCH_FLAGS=""
+ 	    ;;
+ 	SINIX*5.4*)
+ 	    SHLIB_CFLAGS="-K PIC"
+ 	    SHLIB_LD="cc -G"
+ 	    SHLIB_LD_LIBS=""
+ 	    SHLIB_SUFFIX=".so"
+ 	    DL_OBJS=""
+ 	    DL_LIBS="-ldl"
+ 	    LDFLAGS=""
+ 	    LD_SEARCH_FLAGS=""
+ 	    ;;
+ 	SunOS-4*)
+ 	    SHLIB_CFLAGS="-PIC"
+ 	    SHLIB_LD="ld"
+ 	    SHLIB_LD_LIBS=""
+ 	    SHLIB_SUFFIX=".so"
+ 	    DL_OBJS=""
+ 	    DL_LIBS="-ldl"
+ 	    LDFLAGS=""
+ 	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ 
+ 	    # SunOS can't handle version numbers with dots in them in library
+ 	    # specs, like -ltcl7.5, so use -ltcl75 instead.  Also, it
+ 	    # requires an extra version number at the end of .so file names.
+ 	    # So, the library has to have a name like libtcl75.so.1.0
+ 
+ 	    SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
+ 	    UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ 	    TCL_LIB_VERSIONS_OK=nodots
+ 	    ;;
+ 	SunOS-5.[[0-6]]*)
+ 	    SHLIB_CFLAGS="-KPIC"
+ 	    SHLIB_LD="/usr/ccs/bin/ld -G -z text"
+ 
+ 	    # Note: need the LIBS below, otherwise Tk won't find Tcl's
+ 	    # symbols when dynamically loaded into tclsh.
+ 
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+ 	    DL_OBJS=""
+ 	    DL_LIBS="-ldl"
+ 	    LDFLAGS=""
+ 	    LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
+ 	    ;;
+ 	SunOS-5*)
+ 	    SHLIB_CFLAGS="-KPIC"
+ 	    SHLIB_LD="/usr/ccs/bin/ld -G -z text"
+ 	    LDFLAGS=""
+     
+ 	    do64bit_ok=no
+ 	    if test "$do64bit" = "yes" ; then
+ 	    arch=`isainfo`
+ 	    if test "$arch" = "sparcv9 sparc" ; then
+ 		if test "$CC" != "gcc" -a `$CC -v 2>&1 | grep -c gcc` = "0" ; then
+ 		do64bit_ok=yes
+ 		EXTRA_CFLAGS="-xarch=v9"
+ 		LDFLAGS="-xarch=v9"
+ 		else 
+ 		AC_MSG_WARN("64bit mode not supported using GCC on $system")
+ 		fi
+ 	    else
+ 		AC_MSG_WARN("64bit mode only supported sparcv9 system")
+ 	    fi
+ 	    fi
+ 	    
+ 	    # Note: need the LIBS below, otherwise Tk won't find Tcl's
+ 	    # symbols when dynamically loaded into tclsh.
+ 
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+ 	    DL_OBJS=""
+ 	    DL_LIBS="-ldl"
+ 	    if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
+ 		LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
+ 	    else
+ 		LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
+ 	    fi
+ 	    ;;
+ 	ULTRIX-4.*)
+ 	    SHLIB_CFLAGS="-G 0"
+ 	    SHLIB_SUFFIX=".a"
+ 	    SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    DL_OBJS="tclLoadAout.o"
+ 	    DL_LIBS=""
+ 	    LDFLAGS="-Wl,-D,08000000"
+ 	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ 	    ;;
+ 	UNIX_SV* | UnixWare-5*)
+ 	    SHLIB_CFLAGS="-KPIC"
+ 	    SHLIB_LD="cc -G"
+ 	    SHLIB_LD_LIBS=""
+ 	    SHLIB_SUFFIX=".so"
+ 	    DL_OBJS=""
+ 	    DL_LIBS="-ldl"
+ 	    # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
+ 	    # that don't grok the -Bexport option.  Test that it does.
+ 	    hold_ldflags=$LDFLAGS
+ 	    AC_MSG_CHECKING(for ld accepts -Bexport flag)
+ 	    LDFLAGS="${LDFLAGS} -Wl,-Bexport"
+ 	    AC_TRY_LINK(, [int i;], found=yes, found=no)
+ 	    LDFLAGS=$hold_ldflags
+ 	    AC_MSG_RESULT($found)
+ 	    if test $found = yes; then
+ 	    LDFLAGS="-Wl,-Bexport"
+ 	    else
+ 	    LDFLAGS=""
+ 	    fi
+ 	    LD_SEARCH_FLAGS=""
+ 	    ;;
+     esac
+ 
+     if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
+     AC_MSG_WARN("64bit support being disabled -- not supported on this platform")
+     fi
+ 
+     # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
+     # Loading for Tcl -- What Became of It?".  Proc. 2nd Tcl/Tk Workshop,
+     # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
+     # to determine which of several header files defines the a.out file
+     # format (a.out.h, sys/exec.h, or sys/exec_aout.h).  At present, we
+     # support only a file format that is more or less version-7-compatible. 
+     # In particular,
+     #	- a.out files must begin with `struct exec'.
+     #	- the N_TXTOFF on the `struct exec' must compute the seek address
+     #	  of the text segment
+     #	- The `struct exec' must contain a_magic, a_text, a_data, a_bss
+     #	  and a_entry fields.
+     # The following compilation should succeed if and only if either sys/exec.h
+     # or a.out.h is usable for the purpose.
+     #
+     # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
+     # `struct exec' includes a second header that contains information that
+     # duplicates the v7 fields that are needed.
+ 
+     if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
+ 	AC_MSG_CHECKING(sys/exec.h)
+ 	AC_TRY_COMPILE([#include <sys/exec.h>],[
+ 	    struct exec foo;
+ 	    unsigned long seek;
+ 	    int flag;
+ #if defined(__mips) || defined(mips)
+ 	    seek = N_TXTOFF (foo.ex_f, foo.ex_o);
+ #else
+ 	    seek = N_TXTOFF (foo);
+ #endif
+ 	    flag = (foo.a_magic == OMAGIC);
+ 	    return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
+     ], tcl_ok=usable, tcl_ok=unusable)
+ 	AC_MSG_RESULT($tcl_ok)
+ 	if test $tcl_ok = usable; then
+ 	    AC_DEFINE(USE_SYS_EXEC_H)
+ 	else
+ 	    AC_MSG_CHECKING(a.out.h)
+ 	    AC_TRY_COMPILE([#include <a.out.h>],[
+ 		struct exec foo;
+ 		unsigned long seek;
+ 		int flag;
+ #if defined(__mips) || defined(mips)
+ 		seek = N_TXTOFF (foo.ex_f, foo.ex_o);
+ #else
+ 		seek = N_TXTOFF (foo);
+ #endif
+ 		flag = (foo.a_magic == OMAGIC);
+ 		return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
+ 	    ], tcl_ok=usable, tcl_ok=unusable)
+ 	    AC_MSG_RESULT($tcl_ok)
+ 	    if test $tcl_ok = usable; then
+ 		AC_DEFINE(USE_A_OUT_H)
+ 	    else
+ 		AC_MSG_CHECKING(sys/exec_aout.h)
+ 		AC_TRY_COMPILE([#include <sys/exec_aout.h>],[
+ 		    struct exec foo;
+ 		    unsigned long seek;
+ 		    int flag;
+ #if defined(__mips) || defined(mips)
+ 		    seek = N_TXTOFF (foo.ex_f, foo.ex_o);
+ #else
+ 		    seek = N_TXTOFF (foo);
+ #endif
+ 		    flag = (foo.a_midmag == OMAGIC);
+ 		    return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
+ 		], tcl_ok=usable, tcl_ok=unusable)
+ 		AC_MSG_RESULT($tcl_ok)
+ 		if test $tcl_ok = usable; then
+ 		    AC_DEFINE(USE_SYS_EXEC_AOUT_H)
+ 		else
+ 		    DL_OBJS=""
+ 		fi
+ 	    fi
+ 	fi
+     fi
+ 
+     # Step 5: disable dynamic loading if requested via a command-line switch.
+ 
+     AC_ARG_ENABLE(load, [  --disable-load          disallow dynamic loading and "load" command],
+ 	[tcl_ok=$enableval], [tcl_ok=yes])
+     if test "$tcl_ok" = "no"; then
+ 	DL_OBJS=""
+     fi
+ 
+     if test "x$SHLIB_LD" != "x" ; then
+ 	BUILD_DLTEST="\$(DLTEST_TARGETS)"
+     else
+ 	echo "Can't figure out how to do dynamic loading or shared libraries"
+ 	echo "on this system."
+ 	SHLIB_CFLAGS=""
+ 	SHLIB_LD=""
+ 	SHLIB_SUFFIX=""
+ 	DL_OBJS="tclLoadNone.o"
+ 	DL_LIBS=""
+ 	LDFLAGS=""
+ 	LD_SEARCH_FLAGS=""
+ 	BUILD_DLTEST=""
+     fi
+ 
+     # If we're running gcc, then change the C flags for compiling shared
+     # libraries to the right flags for gcc, instead of those for the
+     # standard manufacturer compiler.
+ 
+     if test "$DL_OBJS" != "tclLoadNone.o" ; then
+ 	if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
+ 	    case $system in
+ 		AIX-*)
+ 		    ;;
+ 		BSD/OS*)
+ 		    ;;
+ 		IRIX*)
+ 		    ;;
+ 		NetBSD-*|FreeBSD-*|OpenBSD-*)
+ 		    ;;
+ 		RISCos-*)
+ 		    ;;
+ 		ULTRIX-4.*)
+ 		    ;;
+ 		*)
+ 		    SHLIB_CFLAGS="-fPIC"
+ 		    ;;
+ 	    esac
+ 	fi
+     fi
+ 
+     if test "$SHARED_LIB_SUFFIX" = "" ; then
+ 	SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
+     fi
+     if test "$UNSHARED_LIB_SUFFIX" = "" ; then
+ 	UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
+     fi
+ 
+     AC_SUBST(DL_LIBS)
+     AC_SUBST(CFLAGS_DEBUG)
+     AC_SUBST(CFLAGS_OPTIMIZE)
+ ])
+ 
+ #--------------------------------------------------------------------
+ # SC_SERIAL_PORT
+ #
+ #	Determine which interface to use to talk to the serial port.
+ #	Note that #include lines must begin in leftmost column for
+ #	some compilers to recognize them as preprocessor directives.
+ #
+ # Arguments:
+ #	none
+ #	
+ # Results:
+ #
+ #	Defines only one of the following vars:
+ #		USE_TERMIOS
+ #		USE_TERMIO
+ #		USE_SGTTY
+ #
+ #--------------------------------------------------------------------
+ 
+ AC_DEFUN(SC_SERIAL_PORT, [
+     AC_MSG_CHECKING([termios vs. termio vs. sgtty])
+ 
+     AC_TRY_RUN([
+ #include <termios.h>
+ 
+ main()
+ {
+     struct termios t;
+     if (tcgetattr(0, &t) == 0) {
+ 	cfsetospeed(&t, 0);
+ 	t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
+ 	return 0;
+     }
+     return 1;
+ }], tk_ok=termios, tk_ok=no, tk_ok=no)
+ 
+     if test $tk_ok = termios; then
+ 	AC_DEFINE(USE_TERMIOS)
+     else
+ 	AC_TRY_RUN([
+ #include <termio.h>
+ 
+ main()
+ {
+     struct termio t;
+     if (ioctl(0, TCGETA, &t) == 0) {
+ 	t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
+ 	return 0;
+     }
+     return 1;
+     }], tk_ok=termio, tk_ok=no, tk_ok=no)
+ 
+     if test $tk_ok = termio; then
+ 	AC_DEFINE(USE_TERMIO)
+     else
+ 	AC_TRY_RUN([
+ #include <sgtty.h>
+ 
+ main()
+ {
+     struct sgttyb t;
+     if (ioctl(0, TIOCGETP, &t) == 0) {
+ 	t.sg_ospeed = 0;
+ 	t.sg_flags |= ODDP | EVENP | RAW;
+ 	return 0;
+     }
+     return 1;
+ }], tk_ok=sgtty, tk_ok=none, tk_ok=none)
+     if test $tk_ok = sgtty; then
+ 	AC_DEFINE(USE_SGTTY)
+     fi
+     fi
+     fi
+     AC_MSG_RESULT($tk_ok)
+ ])
+ 
+ #--------------------------------------------------------------------
+ # SC_MISSING_POSIX_HEADERS
+ #
+ #	Supply substitutes for missing POSIX header files.  Special
+ #	notes:
+ #	    - stdlib.h doesn't define strtol, strtoul, or
+ #	      strtod insome versions of SunOS
+ #	    - some versions of string.h don't declare procedures such
+ #	      as strstr
+ #
+ # Arguments:
+ #	none
+ #	
+ # Results:
+ #
+ #	Defines some of the following vars:
+ #		NO_DIRENT_H
+ #		NO_ERRNO_H
+ #		NO_VALUES_H
+ #		NO_LIMITS_H
+ #		NO_STDLIB_H
+ #		NO_STRING_H
+ #		NO_SYS_WAIT_H
+ #		NO_DLFCN_H
+ #		HAVE_UNISTD_H
+ #		HAVE_SYS_PARAM_H
+ #
+ #		HAVE_STRING_H ?
+ #
+ #--------------------------------------------------------------------
+ 
+ AC_DEFUN(SC_MISSING_POSIX_HEADERS, [
+ 
+     AC_MSG_CHECKING(dirent.h)
+     AC_TRY_LINK([#include <sys/types.h>
+ #include <dirent.h>], [
+ #ifndef _POSIX_SOURCE
+ #   ifdef __Lynx__
+ 	/*
+ 	 * Generate compilation error to make the test fail:  Lynx headers
+ 	 * are only valid if really in the POSIX environment.
+ 	 */
+ 
+ 	missing_procedure();
+ #   endif
+ #endif
+ DIR *d;
+ struct dirent *entryPtr;
+ char *p;
+ d = opendir("foobar");
+ entryPtr = readdir(d);
+ p = entryPtr->d_name;
+ closedir(d);
+ ], tcl_ok=yes, tcl_ok=no)
+ 
+     if test $tcl_ok = no; then
+ 	AC_DEFINE(NO_DIRENT_H)
+     fi
+ 
+     AC_MSG_RESULT($tcl_ok)
+     AC_CHECK_HEADER(errno.h, , AC_DEFINE(NO_ERRNO_H))
+     AC_CHECK_HEADER(float.h, , AC_DEFINE(NO_FLOAT_H))
+     AC_CHECK_HEADER(values.h, , AC_DEFINE(NO_VALUES_H))
+     AC_CHECK_HEADER(limits.h, , AC_DEFINE(NO_LIMITS_H))
+     AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
+     AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
+     AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
+     AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
+     if test $tcl_ok = 0; then
+ 	AC_DEFINE(NO_STDLIB_H)
+     fi
+     AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
+     AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
+     AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
+ 
+     # See also memmove check below for a place where NO_STRING_H can be
+     # set and why.
+ 
+     if test $tcl_ok = 0; then
+ 	AC_DEFINE(NO_STRING_H)
+     fi
+ 
+     AC_CHECK_HEADER(sys/wait.h, , AC_DEFINE(NO_SYS_WAIT_H))
+     AC_CHECK_HEADER(dlfcn.h, , AC_DEFINE(NO_DLFCN_H))
+ 
+     # OS/390 lacks sys/param.h (and doesn't need it, by chance).
+ 
+     AC_HAVE_HEADERS(unistd.h sys/param.h)
+ 
+ ])
+ 
+ #--------------------------------------------------------------------
+ # SC_PATH_X
+ #
+ #	Locate the X11 header files and the X11 library archive.  Try
+ #	the ac_path_x macro first, but if it doesn't find the X stuff
+ #	(e.g. because there's no xmkmf program) then check through
+ #	a list of possible directories.  Under some conditions the
+ #	autoconf macro will return an include directory that contains
+ #	no include files, so double-check its result just to be safe.
+ #
+ # Arguments:
+ #	none
+ #	
+ # Results:
+ #
+ #	Sets the the following vars:
+ #		XINCLUDES
+ #		XLIBSW
+ #
+ #--------------------------------------------------------------------
+ 
+ AC_DEFUN(SC_PATH_X, [
+     AC_PATH_X
+     not_really_there=""
+     if test "$no_x" = ""; then
+ 	if test "$x_includes" = ""; then
+ 	    AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
+ 	else
+ 	    if test ! -r $x_includes/X11/Intrinsic.h; then
+ 		not_really_there="yes"
+ 	    fi
+ 	fi
+     fi
+     if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
+ 	AC_MSG_CHECKING(for X11 header files)
+ 	XINCLUDES="# no special path needed"
+ 	AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope")
+ 	if test "$XINCLUDES" = nope; then
+ 	    dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
+ 	    for i in $dirs ; do
+ 		if test -r $i/X11/Intrinsic.h; then
+ 		    AC_MSG_RESULT($i)
+ 		    XINCLUDES=" -I$i"
+ 		    break
+ 		fi
+ 	    done
+ 	fi
+     else
+ 	if test "$x_includes" != ""; then
+ 	    XINCLUDES=-I$x_includes
+ 	else
+ 	    XINCLUDES="# no special path needed"
+ 	fi
+     fi
+     if test "$XINCLUDES" = nope; then
+ 	AC_MSG_RESULT(couldn't find any!)
+ 	XINCLUDES="# no include files found"
+     fi
+ 
+     if test "$no_x" = yes; then
+ 	AC_MSG_CHECKING(for X11 libraries)
+ 	XLIBSW=nope
+ 	dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
+ 	for i in $dirs ; do
+ 	    if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
+ 		AC_MSG_RESULT($i)
+ 		XLIBSW="-L$i -lX11"
+ 		x_libraries="$i"
+ 		break
+ 	    fi
+ 	done
+     else
+ 	if test "$x_libraries" = ""; then
+ 	    XLIBSW=-lX11
+ 	else
+ 	    XLIBSW="-L$x_libraries -lX11"
+ 	fi
+     fi
+     if test "$XLIBSW" = nope ; then
+ 	AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
+     fi
+     if test "$XLIBSW" = nope ; then
+ 	AC_MSG_RESULT(couldn't find any!  Using -lX11.)
+ 	XLIBSW=-lX11
+     fi
+ ])
+ #--------------------------------------------------------------------
+ # SC_BLOCKING_STYLE
+ #
+ #	The statements below check for systems where POSIX-style
+ #	non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented. 
+ #	On these systems (mostly older ones), use the old BSD-style
+ #	FIONBIO approach instead.
+ #
+ # Arguments:
+ #	none
+ #	
+ # Results:
+ #
+ #	Defines some of the following vars:
+ #		HAVE_SYS_IOCTL_H
+ #		HAVE_SYS_FILIO_H
+ #		USE_FIONBIO
+ #		O_NONBLOCK
+ #
+ #--------------------------------------------------------------------
+ 
+ AC_DEFUN(SC_BLOCKING_STYLE, [
+     AC_CHECK_HEADERS(sys/ioctl.h)
+     AC_CHECK_HEADERS(sys/filio.h)
+     AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
+     if test -f /usr/lib/NextStep/software_version; then
+ 	system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
+     else
+ 	system=`uname -s`-`uname -r`
+ 	if test "$?" -ne 0 ; then
+ 	    system=unknown
+ 	else
+ 	    # Special check for weird MP-RAS system (uname returns weird
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+ 		system=MP-RAS-`awk '{print $3}' /etc/.relid'`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+ 	    fi
+ 	fi
+     fi
+     case $system in
+ 	# There used to be code here to use FIONBIO under AIX.  However, it
+ 	# was reported that FIONBIO doesn't work under AIX 3.2.5.  Since
+ 	# using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
+ 	# code (JO, 5/31/97).
+ 
+ 	OSF*)
+ 	    AC_DEFINE(USE_FIONBIO)
+ 	    AC_MSG_RESULT(FIONBIO)
+ 	    ;;
+ 	SunOS-4*)
+ 	    AC_DEFINE(USE_FIONBIO)
+ 	    AC_MSG_RESULT(FIONBIO)
+ 	    ;;
+ 	ULTRIX-4.*)
+ 	    AC_DEFINE(USE_FIONBIO)
+ 	    AC_MSG_RESULT(FIONBIO)
+ 	    ;;
+ 	*)
+ 	    AC_MSG_RESULT(O_NONBLOCK)
+ 	    ;;
+     esac
+ ])
+ 
+ #--------------------------------------------------------------------
+ # SC_HAVE_VFORK
+ #
+ #	Check to see whether the system provides a vfork kernel call.
+ #	If not, then use fork instead.  Also, check for a problem with
+ #	vforks and signals that can cause core dumps if a vforked child
+ #	resets a signal handler.  If the problem exists, then use fork
+ #	instead of vfork.
+ #
+ # Arguments:
+ #	none
+ #	
+ # Results:
+ #
+ #	Defines some of the following vars:
+ #		vfork (=fork)
+ #
+ #--------------------------------------------------------------------
+ 
+ AC_DEFUN(SC_HAVE_VFORK, [
+     AC_TYPE_SIGNAL()
+     AC_CHECK_FUNC(vfork, tcl_ok=1, tcl_ok=0)
+     if test "$tcl_ok" = 1; then
+ 	AC_MSG_CHECKING([vfork/signal bug]);
+ 	AC_TRY_RUN([
+ #include <stdio.h>
+ #include <signal.h>
+ #include <sys/wait.h>
+ int gotSignal = 0;
+ sigProc(sig)
+     int sig;
+ {
+     gotSignal = 1;
+ }
+ main()
+ {
+     int pid, sts;
+     (void) signal(SIGCHLD, sigProc);
+     pid = vfork();
+     if (pid <  0) {
+ 	exit(1);
+     } else if (pid == 0) {
+ 	(void) signal(SIGCHLD, SIG_DFL);
+ 	_exit(0);
+     } else {
+ 	(void) wait(&sts);
+     }
+     exit((gotSignal) ? 0 : 1);
+ }], tcl_ok=1, tcl_ok=0, tcl_ok=0)
+ 
+ 	if test "$tcl_ok" = 1; then
+ 	    AC_MSG_RESULT(ok)
+ 	else
+ 	    AC_MSG_RESULT([buggy, using fork instead])
+ 	fi
+     fi
+     rm -f core
+     if test "$tcl_ok" = 0; then
+ 	AC_DEFINE(vfork, fork)
+     fi
+ ])
+ 
+ #--------------------------------------------------------------------
+ # SC_TIME_HANLDER
+ #
+ #	Checks how the system deals with time.h, what time structures
+ #	are used on the system, and what fields the structures have.
+ #
+ # Arguments:
+ #	none
+ #	
+ # Results:
+ #
+ #	Defines some of the following vars:
+ #		USE_DELTA_FOR_TZ
+ #		HAVE_TM_GMTOFF
+ #		HAVE_TM_TZADJ
+ #		HAVE_TIMEZONE_VAR
+ #
+ #--------------------------------------------------------------------
+ 
+ AC_DEFUN(SC_TIME_HANDLER, [
+     AC_CHECK_HEADERS(sys/time.h)
+     AC_HEADER_TIME
+     AC_STRUCT_TIMEZONE
+ 
+     AC_MSG_CHECKING([tm_tzadj in struct tm])
+     AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
+ 	    [AC_DEFINE(HAVE_TM_TZADJ)
+ 	    AC_MSG_RESULT(yes)],
+ 	    AC_MSG_RESULT(no))
+ 
+     AC_MSG_CHECKING([tm_gmtoff in struct tm])
+     AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
+ 	    [AC_DEFINE(HAVE_TM_GMTOFF)
+ 	    AC_MSG_RESULT(yes)],
+ 	    AC_MSG_RESULT(no))
+ 
+     #
+     # Its important to include time.h in this check, as some systems
+     # (like convex) have timezone functions, etc.
+     #
+     have_timezone=no
+     AC_MSG_CHECKING([long timezone variable])
+     AC_TRY_COMPILE([#include <time.h>],
+ 	    [extern long timezone;
+ 	    timezone += 1;
+ 	    exit (0);],
+ 	    [have_timezone=yes
+ 	    AC_DEFINE(HAVE_TIMEZONE_VAR)
+ 	    AC_MSG_RESULT(yes)],
+ 	    AC_MSG_RESULT(no))
+ 
+     #
+     # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
+     #
+     if test "$have_timezone" = no; then
+     AC_MSG_CHECKING([time_t timezone variable])
+     AC_TRY_COMPILE([#include <time.h>],
+ 	    [extern time_t timezone;
+ 	    timezone += 1;
+ 	    exit (0);],
+ 	    [AC_DEFINE(HAVE_TIMEZONE_VAR)
+ 	    AC_MSG_RESULT(yes)],
+ 	    AC_MSG_RESULT(no))
+     fi
+ 
+     #
+     # AIX does not have a timezone field in struct tm. When the AIX bsd
+     # library is used, the timezone global and the gettimeofday methods are
+     # to be avoided for timezone deduction instead, we deduce the timezone
+     # by comparing the localtime result on a known GMT value.
+     #
+ 
+     if test "`uname -s`" = "AIX" ; then
+ 	AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes)
+ 	if test $libbsd = yes; then
+ 	    AC_DEFINE(USE_DELTA_FOR_TZ)
+ 	fi
+     fi
+ ])
+ 
+ #--------------------------------------------------------------------
+ # SC_BUGGY_STRTOD
+ #
+ #	Under Solaris 2.4, strtod returns the wrong value for the
+ #	terminating character under some conditions.  Check for this
+ #	and if the problem exists use a substitute procedure
+ #	"fixstrtod" (provided by Tcl) that corrects the error.
+ #
+ # Arguments:
+ #	none
+ #	
+ # Results:
+ #
+ #	Might defines some of the following vars:
+ #		strtod (=fixstrtod)
+ #
+ #--------------------------------------------------------------------
+ 
+ AC_DEFUN(SC_BUGGY_STRTOD, [
+     AC_CHECK_FUNC(strtod, tk_strtod=1, tk_strtod=0)
+     if test "$tk_strtod" = 1; then
+ 	AC_MSG_CHECKING([for Solaris 2.4 strtod bug])
+ 	AC_TRY_RUN([
+ 	    extern double strtod();
+ 	    int main()
+ 	    {
+ 		char *string = "NaN";
+ 		char *term;
+ 		strtod(string, &term);
+ 		if ((term != string) && (term[-1] == 0)) {
+ 		    exit(1);
+ 		}
+ 		exit(0);
+ 	    }], tk_ok=1, tk_ok=0, tk_ok=0)
+ 	if test "$tk_ok" = 1; then
+ 	    AC_MSG_RESULT(ok)
+ 	else
+ 	    AC_MSG_RESULT(buggy)
+ 	    AC_DEFINE(strtod, fixstrtod)
+ 	fi
+     fi
+ ])
+ 
+ #--------------------------------------------------------------------
+ # SC_TCL_LINK_LIBS
+ #
+ #	Search for the libraries needed to link the Tcl shell.
+ #	Things like the math library (-lm) and socket stuff (-lsocket vs.
+ #	-lnsl) are dealt with here.
+ #
+ # Arguments:
+ #	Requires the following vars to be set in the Makefile:
+ #		DL_LIBS
+ #		LIBS
+ #		MATH_LIBS
+ #	
+ # Results:
+ #
+ #	Subst's the following var:
+ #		TCL_LIBS
+ #		MATH_LIBS
+ #
+ #	Might append to the following vars:
+ #		LIBS
+ #
+ #	Might define the following vars:
+ #		HAVE_NET_ERRNO_H
+ #
+ #--------------------------------------------------------------------
+ 
+ AC_DEFUN(SC_TCL_LINK_LIBS, [
+     #--------------------------------------------------------------------
+     # On a few very rare systems, all of the libm.a stuff is
+     # already in libc.a.  Set compiler flags accordingly.
+     # Also, Linux requires the "ieee" library for math to work
+     # right (and it must appear before "-lm").
+     #--------------------------------------------------------------------
+ 
+     AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
+     AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
+ 
+     #--------------------------------------------------------------------
+     # On AIX systems, libbsd.a has to be linked in to support
+     # non-blocking file IO.  This library has to be linked in after
+     # the MATH_LIBS or it breaks the pow() function.  The way to
+     # insure proper sequencing, is to add it to the tail of MATH_LIBS.
+     # This library also supplies gettimeofday.
+     #--------------------------------------------------------------------
+ 
+     libbsd=no
+     if test "`uname -s`" = "AIX" ; then
+ 	AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes)
+ 	if test $libbsd = yes; then
+ 	    MATH_LIBS="$MATH_LIBS -lbsd"
+ 	fi
+     fi
+ 
+ 
+     #--------------------------------------------------------------------
+     # Interactive UNIX requires -linet instead of -lsocket, plus it
+     # needs net/errno.h to define the socket-related error codes.
+     #--------------------------------------------------------------------
+ 
+     AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
+     AC_CHECK_HEADER(net/errno.h, AC_DEFINE(HAVE_NET_ERRNO_H))
+ 
+     #--------------------------------------------------------------------
+     #	Check for the existence of the -lsocket and -lnsl libraries.
+     #	The order here is important, so that they end up in the right
+     #	order in the command line generated by make.  Here are some
+     #	special considerations:
+     #	1. Use "connect" and "accept" to check for -lsocket, and
+     #	   "gethostbyname" to check for -lnsl.
+     #	2. Use each function name only once:  can't redo a check because
+     #	   autoconf caches the results of the last check and won't redo it.
+     #	3. Use -lnsl and -lsocket only if they supply procedures that
+     #	   aren't already present in the normal libraries.  This is because
+     #	   IRIX 5.2 has libraries, but they aren't needed and they're
+     #	   bogus:  they goof up name resolution if used.
+     #	4. On some SVR4 systems, can't use -lsocket without -lnsl too.
+     #	   To get around this problem, check for both libraries together
+     #	   if -lsocket doesn't work by itself.
+     #--------------------------------------------------------------------
+ 
+     tcl_checkBoth=0
+     AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
+     if test "$tcl_checkSocket" = 1; then
+ 	AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", tcl_checkBoth=1)
+     fi
+     if test "$tcl_checkBoth" = 1; then
+ 	tk_oldLibs=$LIBS
+ 	LIBS="$LIBS -lsocket -lnsl"
+ 	AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
+     fi
+     AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main,
+ 	    [LIBS="$LIBS -lnsl"]))
+     
+     # Don't perform the eval of the libraries here because DL_LIBS
+     # won't be set until we call SC_CONFIG_CFLAGS
+ 
+     TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
+     AC_SUBST(TCL_LIBS)
+     AC_SUBST(MATH_LIBS)
+ ])
*** unix/configure.in.orig	Sat Aug 14 00:06:14 1999
--- unix/configure.in	Fri Sep 24 21:25:38 1999
***************
*** 40,46 ****
  #------------------------------------------------------------------------
  
  if test "${GCC}" = "yes" ; then
!     CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int"
  else
      CFLAGS_WARNING=""
  fi
--- 40,46 ----
  #------------------------------------------------------------------------
  
  if test "${GCC}" = "yes" ; then
!     CFLAGS_WARNING="-Wall -Wno-implicit-int"
  else
      CFLAGS_WARNING=""
  fi
***************
*** 342,352 ****
  if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then
      TK_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
      TK_LIB_FILE=libtk${TK_SHARED_LIB_SUFFIX}
!     MAKE_LIB="\${SHLIB_LD} -o \${TK_LIB_FILE} \${OBJS} \$(TK_LD_SEARCH_FLAGS) ${TCL_STUB_LIB_SPEC} \${LIBS}"
      RANLIB=":"
  
! #    TCL_STUB_FLAGS="-DUSE_TCL_STUBS"
!     TCL_STUB_FLAGS=""
  else
      TK_SHLIB_CFLAGS=""
      TK_LIB_FILE=libtk${TK_UNSHARED_LIB_SUFFIX}
--- 342,351 ----
  if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then
      TK_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
      TK_LIB_FILE=libtk${TK_SHARED_LIB_SUFFIX}
!     MAKE_LIB="\${SHLIB_LD} -o \${TK_LIB_FILE} \${OBJS} \$(TK_LD_SEARCH_FLAGS) \${TCL_STUB_LIB_SPEC} \${LIBS}"
      RANLIB=":"
  
!     TCL_STUB_FLAGS="-DUSE_TCL_STUBS"
  else
      TK_SHLIB_CFLAGS=""
      TK_LIB_FILE=libtk${TK_UNSHARED_LIB_SUFFIX}
***************
*** 381,386 ****
--- 380,492 ----
  fi
  
  #--------------------------------------------------------------------
+ #	Checking X lib for i18n related things.
+ #--------------------------------------------------------------------
+ 
+ X11_IMAKE_FLAGS=""
+ tk_oldCflags=$CFLAGS
+ tk_oldLibs=$LIBS
+ CFLAGS="$CFLAGS $XINCLUDES"
+ LIBS="$XLIBSW $LIBS"
+ 
+ AC_MSG_CHECKING([XRegisterIMInstantiateCallback])
+ AC_TRY_LINK([
+ #include <X11/Xlib.h>
+ ], [
+ XRegisterIMInstantiateCallback(0, 0, 0, 0, 0, 0);
+ ], [
+ AC_MSG_RESULT(yes)
+ X11_IMAKE_FLAGS="-DHAVE_XIMREGINSTCB"
+ ], [
+ AC_MSG_RESULT(no)
+ ])
+ 
+ AC_MSG_CHECKING([XIDProc])
+ AC_TRY_COMPILE([
+ #include <X11/Xlib.h>
+ ], [
+ XIDProc *a;
+ ], [
+ AC_MSG_RESULT(yes)
+ ], [
+ AC_MSG_RESULT(no)
+ X11_IMAKE_FLAGS="$X11_IMAKE_FLAGS -DNO_XIDPROC"
+ ])
+ 
+ HAVE_XMKMF=""
+ AC_PATH_PROG(HAVE_XMKMF, xmkmf, "", /usr/X11R6/bin /usr/X11R5/bin /usr/local/X11R6/bin /usr/local/X11R5/bin /usr/openwin/bin /usr/X11/bin /usr/X386/bin /usr/sww/bin /usr/unsupported/bin)
+ if test "X$HAVE_XMKMF" != "X"; then
+     IMAKE_FLAGS=""
+     if test -d ImakeCheck; then
+         rm -rf ImakeCheck
+     fi
+     mkdir ImakeCheck
+     cat << EOF > ImakeCheck/Imakefile
+ SRCS = dummy.c
+ OBJS = dummy.o
+ 
+ ComplexProgramTarget(dummy)
+ EOF
+     cat << EOF > ImakeCheck/dummy.c
+ static int justAnInt = 0;
+ EOF
+     (cd ./ImakeCheck; rm -f Makefile Makefile.*; eval $HAVE_XMKMF) > /dev/null 2>&1
+     for i in `(cd ./ImakeCheck; make -n dummy.o)`
+     do
+         case $i in -D*) IMAKE_FLAGS="$IMAKE_FLAGS $i";; esac
+     done
+     if test "X$IMAKE_FLAGS" != "X"; then
+         AC_MSG_RESULT(Add these flags for proper compile: $IMAKE_FLAGS)
+         X11_IMAKE_FLAGS="$X11_IMAKE_FLAGS $IMAKE_FLAGS"
+     fi
+     rm -rf ImakeCheck
+ fi
+ 
+ # At last check FreeBSD and have -lxpg4.
+ AC_MSG_CHECKING([system version (for additional locale library)])
+ if test -f /usr/lib/NextStep/software_version; then
+     system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
+ else
+     system=`uname -s`-`uname -r`
+     if test "$?" -ne 0 ; then
+         system=unknown
+     else
+         # Special check for weird MP-RAS system (uname returns weird
+         # results, and the version is kept in special file).
+     
+         if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+             system=MP-RAS-`awk '{print $3}' /etc/.relid'`
+         fi
+         if test "`uname -s`" = "AIX" ; then
+             system=AIX-`uname -v`.`uname -r`
+         fi
+     fi
+ fi
+ 
+ case $system in
+     FreeBSD-*)
+ 	LIBS="$XLIBSW -lxpg4 $tk_oldLibs"
+ 	CFLAGS="$CFLAGS $X11_IMAKE_FLAGS"
+ 	AC_TRY_COMPILE([
+ #include <locale.h>
+ ], [
+ (void)setlocale(LC_ALL, "");
+ ], [
+ AC_MSG_RESULT(use xpg4 library.)
+ XLIBSW="$XLIBSW -lxpg4"
+ ], [
+ AC_MSG_RESULT(no need other libraries.)
+ ])
+ 	;;
+     *)
+ 	AC_MSG_RESULT(No additional library is needed.)
+ 	;;
+ esac
+ 
+ CFLAGS=$tk_oldCflags
+ LIBS=$tk_oldLibs
+ 
+ #--------------------------------------------------------------------
  # The statements below define various symbols relating to creating
  # the stub'd version of the Tk library
  #
***************
*** 410,415 ****
--- 516,522 ----
  AC_SUBST(STUB_LIB_FILE)
  
  AC_SUBST(TK_STUB_LIB_FILE)
+ AC_SUBST(TCL_STUB_LIB_FLAG)
  AC_SUBST(TK_STUB_LIB_FLAG)
  AC_SUBST(TK_BUILD_STUB_LIB_SPEC)
  AC_SUBST(TK_STUB_LIB_SPEC)
***************
*** 444,452 ****
  AC_SUBST(SHLIB_VERSION)
  AC_SUBST(TCL_BIN_DIR)
  AC_SUBST(TCL_LIB_SPEC)
  AC_SUBST(TCL_LIB_FLAG)
! #AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
! #AC_SUBST(TCL_BUILD_LIB_SPEC)
  AC_SUBST(TCL_DBGX)
  AC_SUBST(TCL_LIB_FLAG)
  AC_SUBST(TCL_SRC_DIR)
--- 551,560 ----
  AC_SUBST(SHLIB_VERSION)
  AC_SUBST(TCL_BIN_DIR)
  AC_SUBST(TCL_LIB_SPEC)
+ AC_SUBST(TCL_STUB_LIB_SPEC)
  AC_SUBST(TCL_LIB_FLAG)
! AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
! AC_SUBST(TCL_BUILD_LIB_SPEC)
  AC_SUBST(TCL_DBGX)
  AC_SUBST(TCL_LIB_FLAG)
  AC_SUBST(TCL_SRC_DIR)
***************
*** 454,459 ****
--- 562,568 ----
  AC_SUBST(TK_BUILD_LIB_SPEC)
  AC_SUBST(TK_CC_SEARCH_FLAGS)
  AC_SUBST(TK_LD_SEARCH_FLAGS)
+ AC_SUBST(TK_SHARED_LIB_FILE)
  AC_SUBST(TK_LIB_FILE)
  AC_SUBST(TK_LIB_FLAG)
  AC_SUBST(TK_LIB_SPEC)
***************
*** 465,469 ****
  AC_SUBST(XINCLUDES)
  AC_SUBST(XLIBSW)
  AC_SUBST(TK_SHARED_BUILD)
! 
! AC_OUTPUT(Makefile tkConfig.sh)
--- 574,578 ----
  AC_SUBST(XINCLUDES)
  AC_SUBST(XLIBSW)
  AC_SUBST(TK_SHARED_BUILD)
! AC_SUBST(X11_IMAKE_FLAGS)
! AC_OUTPUT(Makefile tkConfig.sh pkgIndex.tcl)
*** unix/configure.orig	Sat Aug 14 00:06:14 1999
--- unix/configure	Fri Sep 24 21:25:39 1999
***************
*** 22,32 ****
  ac_help="$ac_help
    --disable-load          disallow dynamic loading and "load" command"
  ac_help="$ac_help
!   --enable-symbols        build with debugging symbols [--disable-symbols]"
  ac_help="$ac_help
    --with-x                use the X Window System"
  ac_help="$ac_help
!   --enable-shared         build and link with shared libraries [--enable-shared]"
  
  # Initialize some variables set by options.
  # The variables have the same names as the options, with
--- 22,32 ----
  ac_help="$ac_help
    --disable-load          disallow dynamic loading and "load" command"
  ac_help="$ac_help
!   --enable-symbols        build with debugging symbols [--enable-symbols]"
  ac_help="$ac_help
    --with-x                use the X Window System"
  ac_help="$ac_help
!   --disable-shared        build and link without shared libraries [--disable-shared]"
  
  # Initialize some variables set by options.
  # The variables have the same names as the options, with
***************
*** 1256,1262 ****
  #------------------------------------------------------------------------
  
  if test "${GCC}" = "yes" ; then
!     CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int"
  else
      CFLAGS_WARNING=""
  fi
--- 1256,1262 ----
  #------------------------------------------------------------------------
  
  if test "${GCC}" = "yes" ; then
!     CFLAGS_WARNING="-Wall -Wno-implicit-int"
  else
      CFLAGS_WARNING=""
  fi
***************
*** 1527,1533 ****
  	    SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
  	    SHLIB_LD_LIBS='${LIBS}'
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS="tclLoadDl.o"
  	    DL_LIBS="-ldl"
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
--- 1527,1533 ----
  	    SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
  	    SHLIB_LD_LIBS='${LIBS}'
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS=""
  	    DL_LIBS="-ldl"
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
***************
*** 1539,1545 ****
  	    SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512"
  	    SHLIB_LD_LIBS='${LIBS}'
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS="tclLoadDl.o"
  	    LIBOBJS="$LIBOBJS tclLoadAix.o"
  	    DL_LIBS="-lld"
  	    LDFLAGS=""
--- 1539,1545 ----
  	    SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512"
  	    SHLIB_LD_LIBS='${LIBS}'
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS=""
  	    LIBOBJS="$LIBOBJS tclLoadAix.o"
  	    DL_LIBS="-lld"
  	    LDFLAGS=""
***************
*** 1552,1558 ****
  	    SHLIB_LD="shlicc -r"
  	    SHLIB_LD_LIBS='${LIBS}'
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS="tclLoadDl.o"
  	    DL_LIBS="-ldl"
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS=""
--- 1552,1558 ----
  	    SHLIB_LD="shlicc -r"
  	    SHLIB_LD_LIBS='${LIBS}'
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS=""
  	    DL_LIBS="-ldl"
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS=""
***************
*** 1562,1568 ****
  	    SHLIB_LD="cc -shared"
  	    SHLIB_LD_LIBS='${LIBS}'
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS="tclLoadDl.o"
  	    DL_LIBS="-ldl"
  	    LDFLAGS="-export-dynamic"
  	    LD_SEARCH_FLAGS=""
--- 1562,1568 ----
  	    SHLIB_LD="cc -shared"
  	    SHLIB_LD_LIBS='${LIBS}'
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS=""
  	    DL_LIBS="-ldl"
  	    LDFLAGS="-export-dynamic"
  	    LD_SEARCH_FLAGS=""
***************
*** 1572,1578 ****
  	    SHLIB_LD="cc -G"
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS="tclLoadDl.o"
  	    DL_LIBS="-ldl"
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS=""
--- 1572,1578 ----
  	    SHLIB_LD="cc -G"
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS=""
  	    DL_LIBS="-ldl"
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS=""
***************
*** 1646,1652 ****
  	    SHLIB_LD="ld -n32 -shared -rdata_shared"
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS="tclLoadDl.o"
  	    DL_LIBS=""
  	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  	    if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
--- 1646,1652 ----
  	    SHLIB_LD="ld -n32 -shared -rdata_shared"
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS=""
  	    DL_LIBS=""
  	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  	    if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
***************
*** 1670,1676 ****
  	    SHLIB_LD="ld -32 -shared -rdata_shared"
  	    SHLIB_LD_LIBS='${LIBS}'
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS="tclLoadDl.o"
  	    DL_LIBS=""
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
--- 1670,1676 ----
  	    SHLIB_LD="ld -32 -shared -rdata_shared"
  	    SHLIB_LD_LIBS='${LIBS}'
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS=""
  	    DL_LIBS=""
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
***************
*** 1688,1694 ****
  
  	    if test "$have_dl" = yes; then
  		SHLIB_LD="${CC} -shared"
! 		DL_OBJS="tclLoadDl.o"
  		DL_LIBS="-ldl"
  		LDFLAGS="-rdynamic"
  		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
--- 1688,1694 ----
  
  	    if test "$have_dl" = yes; then
  		SHLIB_LD="${CC} -shared"
! 		DL_OBJS=""
  		DL_LIBS="-ldl"
  		LDFLAGS="-rdynamic"
  		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
***************
*** 1741,1747 ****
  	    SHLIB_LD="cc -G"
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS="tclLoadDl.o"
  	    DL_LIBS="-ldl"
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS=""
--- 1741,1747 ----
  	    SHLIB_LD="cc -G"
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS=""
  	    DL_LIBS="-ldl"
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS=""
***************
*** 1751,1757 ****
  	    SHLIB_LD="cc -G"
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS="tclLoadDl.o"
  	    DL_LIBS="-ldl"
  	    LDFLAGS="-Wl,-Bexport"
  	    LD_SEARCH_FLAGS=""
--- 1751,1757 ----
  	    SHLIB_LD="cc -G"
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS=""
  	    DL_LIBS="-ldl"
  	    LDFLAGS="-Wl,-Bexport"
  	    LD_SEARCH_FLAGS=""
***************
*** 1791,1797 ****
  		SHLIB_LD="ld -Bshareable -x"
  		SHLIB_LD_LIBS=""
  		SHLIB_SUFFIX=".so"
! 		DL_OBJS="tclLoadDl.o"
  		DL_LIBS=""
  		LDFLAGS=""
  		LD_SEARCH_FLAGS=""
--- 1791,1797 ----
  		SHLIB_LD="ld -Bshareable -x"
  		SHLIB_LD_LIBS=""
  		SHLIB_SUFFIX=".so"
! 		DL_OBJS=""
  		DL_LIBS=""
  		LDFLAGS=""
  		LD_SEARCH_FLAGS=""
***************
*** 1824,1830 ****
  	    SHLIB_LD="ld -Bshareable -x"
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS="tclLoadDl.o"
  	    DL_LIBS=""
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS=""
--- 1824,1830 ----
  	    SHLIB_LD="ld -Bshareable -x"
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS=""
  	    DL_LIBS=""
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS=""
***************
*** 1864,1870 ****
  	    SHLIB_LD="ld -shared"
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS="tclLoadDl.o"
  	    DL_LIBS=""
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS=""
--- 1864,1870 ----
  	    SHLIB_LD="ld -shared"
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS=""
  	    DL_LIBS=""
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS=""
***************
*** 1875,1881 ****
  	    SHLIB_LD='ld -shared -expect_unresolved "*"'
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS="tclLoadDl.o"
  	    DL_LIBS=""
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
--- 1875,1881 ----
  	    SHLIB_LD='ld -shared -expect_unresolved "*"'
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS=""
  	    DL_LIBS=""
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
***************
*** 1898,1904 ****
  	    SHLIB_LD="ld -G"
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS="tclLoadDl.o"
  	    DL_LIBS=""
  	    LDFLAGS="-belf -Wl,-Bexport"
  	    LD_SEARCH_FLAGS=""
--- 1898,1904 ----
  	    SHLIB_LD="ld -G"
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS=""
  	    DL_LIBS=""
  	    LDFLAGS="-belf -Wl,-Bexport"
  	    LD_SEARCH_FLAGS=""
***************
*** 1908,1914 ****
  	    SHLIB_LD="cc -G"
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS="tclLoadDl.o"
  	    DL_LIBS="-ldl"
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS=""
--- 1908,1914 ----
  	    SHLIB_LD="cc -G"
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS=""
  	    DL_LIBS="-ldl"
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS=""
***************
*** 1918,1924 ****
  	    SHLIB_LD="ld"
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS="tclLoadDl.o"
  	    DL_LIBS="-ldl"
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
--- 1918,1924 ----
  	    SHLIB_LD="ld"
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS=""
  	    DL_LIBS="-ldl"
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
***************
*** 1941,1947 ****
  
  	    SHLIB_LD_LIBS='${LIBS}'
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS="tclLoadDl.o"
  	    DL_LIBS="-ldl"
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
--- 1941,1947 ----
  
  	    SHLIB_LD_LIBS='${LIBS}'
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS=""
  	    DL_LIBS="-ldl"
  	    LDFLAGS=""
  	    LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
***************
*** 1972,1978 ****
  
  	    SHLIB_LD_LIBS='${LIBS}'
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS="tclLoadDl.o"
  	    DL_LIBS="-ldl"
  	    if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
  		LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
--- 1972,1978 ----
  
  	    SHLIB_LD_LIBS='${LIBS}'
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS=""
  	    DL_LIBS="-ldl"
  	    if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
  		LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
***************
*** 1995,2001 ****
  	    SHLIB_LD="cc -G"
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS="tclLoadDl.o"
  	    DL_LIBS="-ldl"
  	    # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
  	    # that don't grok the -Bexport option.  Test that it does.
--- 1995,2001 ----
  	    SHLIB_LD="cc -G"
  	    SHLIB_LD_LIBS=""
  	    SHLIB_SUFFIX=".so"
! 	    DL_OBJS=""
  	    DL_LIBS="-ldl"
  	    # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
  	    # that don't grok the -Bexport option.  Test that it does.
***************
*** 2190,2196 ****
  	DL_OBJS=""
      fi
  
!     if test "x$DL_OBJS" != "x" ; then
  	BUILD_DLTEST="\$(DLTEST_TARGETS)"
      else
  	echo "Can't figure out how to do dynamic loading or shared libraries"
--- 2190,2196 ----
  	DL_OBJS=""
      fi
  
!     if test "x$SHLIB_LD" != "x" ; then
  	BUILD_DLTEST="\$(DLTEST_TARGETS)"
      else
  	echo "Can't figure out how to do dynamic loading or shared libraries"
***************
*** 2255,2267 ****
  fi
  
      if test "$tcl_ok" = "yes"; then
! 	CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
! 	LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
  	DBGX=g
  	echo "$ac_t""yes" 1>&6
      else
! 	CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}"
! 	LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
  	DBGX=""
  	echo "$ac_t""no" 1>&6
      fi
--- 2255,2267 ----
  fi
  
      if test "$tcl_ok" = "yes"; then
! 	CFLAGS_DEFAULT='${CFLAGS_DEBUG}'
! 	LDFLAGS_DEFAULT='${LDFLAGS_DEBUG}'
  	DBGX=g
  	echo "$ac_t""yes" 1>&6
      else
! 	CFLAGS_DEFAULT='${CFLAGS_OPTIMIZE}'
! 	LDFLAGS_DEFAULT='${LDFLAGS_OPTIMIZE}'
  	DBGX=""
  	echo "$ac_t""no" 1>&6
      fi
***************
*** 3967,3977 ****
  if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then
      TK_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
      TK_LIB_FILE=libtk${TK_SHARED_LIB_SUFFIX}
!     MAKE_LIB="\${SHLIB_LD} -o \${TK_LIB_FILE} \${OBJS} \$(TK_LD_SEARCH_FLAGS) ${TCL_STUB_LIB_SPEC} \${LIBS}"
      RANLIB=":"
  
! #    TCL_STUB_FLAGS="-DUSE_TCL_STUBS"
!     TCL_STUB_FLAGS=""
  else
      TK_SHLIB_CFLAGS=""
      TK_LIB_FILE=libtk${TK_UNSHARED_LIB_SUFFIX}
--- 3967,3976 ----
  if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then
      TK_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
      TK_LIB_FILE=libtk${TK_SHARED_LIB_SUFFIX}
!     MAKE_LIB="\${SHLIB_LD} -o \${TK_LIB_FILE} \${OBJS} \$(TK_LD_SEARCH_FLAGS) \${TCL_STUB_LIB_SPEC} \${LIBS}"
      RANLIB=":"
  
!     TCL_STUB_FLAGS="-DUSE_TCL_STUBS"
  else
      TK_SHLIB_CFLAGS=""
      TK_LIB_FILE=libtk${TK_UNSHARED_LIB_SUFFIX}
***************
*** 4006,4011 ****
--- 4005,4206 ----
  fi
  
  #--------------------------------------------------------------------
+ #	Checking X lib for i18n related things.
+ #--------------------------------------------------------------------
+ 
+ X11_IMAKE_FLAGS=""
+ tk_oldCflags=$CFLAGS
+ tk_oldLibs=$LIBS
+ CFLAGS="$CFLAGS $XINCLUDES"
+ LIBS="$XLIBSW $LIBS"
+ 
+ echo $ac_n "checking XRegisterIMInstantiateCallback""... $ac_c" 1>&6
+ echo "configure:4019: checking XRegisterIMInstantiateCallback" >&5
+ cat > conftest.$ac_ext <<EOF
+ #line 4021 "configure"
+ #include "confdefs.h"
+ 
+ #include <X11/Xlib.h>
+ 
+ int main() {
+ 
+ XRegisterIMInstantiateCallback(0, 0, 0, 0, 0, 0);
+ 
+ ; return 0; }
+ EOF
+ if { (eval echo configure:4032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   
+ echo "$ac_t""yes" 1>&6
+ X11_IMAKE_FLAGS="-DHAVE_XIMREGINSTCB"
+ 
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   
+ echo "$ac_t""no" 1>&6
+ 
+ fi
+ rm -f conftest*
+ 
+ echo $ac_n "checking XIDProc""... $ac_c" 1>&6
+ echo "configure:4049: checking XIDProc" >&5
+ cat > conftest.$ac_ext <<EOF
+ #line 4051 "configure"
+ #include "confdefs.h"
+ 
+ #include <X11/Xlib.h>
+ 
+ int main() {
+ 
+ XIDProc *a;
+ 
+ ; return 0; }
+ EOF
+ if { (eval echo configure:4062: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+   rm -rf conftest*
+   
+ echo "$ac_t""yes" 1>&6
+ 
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   
+ echo "$ac_t""no" 1>&6
+ X11_IMAKE_FLAGS="$X11_IMAKE_FLAGS -DNO_XIDPROC"
+ 
+ fi
+ rm -f conftest*
+ 
+ HAVE_XMKMF=""
+ # Extract the first word of "xmkmf", so it can be a program name with args.
+ set dummy xmkmf; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+ echo "configure:4082: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_HAVE_XMKMF'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   case "$HAVE_XMKMF" in
+   /*)
+   ac_cv_path_HAVE_XMKMF="$HAVE_XMKMF" # Let the user override the test with a path.
+   ;;
+   ?:/*)			 
+   ac_cv_path_HAVE_XMKMF="$HAVE_XMKMF" # Let the user override the test with a dos path.
+   ;;
+   *)
+   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+   ac_dummy="/usr/X11R6/bin /usr/X11R5/bin /usr/local/X11R6/bin /usr/local/X11R5/bin /usr/openwin/bin /usr/X11/bin /usr/X386/bin /usr/sww/bin /usr/unsupported/bin"
+   for ac_dir in $ac_dummy; do 
+     test -z "$ac_dir" && ac_dir=.
+     if test -f $ac_dir/$ac_word; then
+       ac_cv_path_HAVE_XMKMF="$ac_dir/$ac_word"
+       break
+     fi
+   done
+   IFS="$ac_save_ifs"
+   test -z "$ac_cv_path_HAVE_XMKMF" && ac_cv_path_HAVE_XMKMF=""""
+   ;;
+ esac
+ fi
+ HAVE_XMKMF="$ac_cv_path_HAVE_XMKMF"
+ if test -n "$HAVE_XMKMF"; then
+   echo "$ac_t""$HAVE_XMKMF" 1>&6
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ 
+ if test "X$HAVE_XMKMF" != "X"; then
+     IMAKE_FLAGS=""
+     if test -d ImakeCheck; then
+         rm -rf ImakeCheck
+     fi
+     mkdir ImakeCheck
+     cat << EOF > ImakeCheck/Imakefile
+ SRCS = dummy.c
+ OBJS = dummy.o
+ 
+ ComplexProgramTarget(dummy)
+ EOF
+     cat << EOF > ImakeCheck/dummy.c
+ static int justAnInt = 0;
+ EOF
+     (cd ./ImakeCheck; rm -f Makefile Makefile.*; eval $HAVE_XMKMF) > /dev/null 2>&1
+     for i in `(cd ./ImakeCheck; make -n dummy.o)`
+     do
+         case $i in -D*) IMAKE_FLAGS="$IMAKE_FLAGS $i";; esac
+     done
+     if test "X$IMAKE_FLAGS" != "X"; then
+         echo "$ac_t""Add these flags for proper compile: $IMAKE_FLAGS" 1>&6
+         X11_IMAKE_FLAGS="$X11_IMAKE_FLAGS $IMAKE_FLAGS"
+     fi
+     rm -rf ImakeCheck
+ fi
+ 
+ # At last check FreeBSD and have -lxpg4.
+ echo $ac_n "checking system version (for additional locale library)""... $ac_c" 1>&6
+ echo "configure:4144: checking system version (for additional locale library)" >&5
+ if test -f /usr/lib/NextStep/software_version; then
+     system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
+ else
+     system=`uname -s`-`uname -r`
+     if test "$?" -ne 0 ; then
+         system=unknown
+     else
+         # Special check for weird MP-RAS system (uname returns weird
+         # results, and the version is kept in special file).
+     
+         if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+             system=MP-RAS-`awk '{print $3}' /etc/.relid'`
+         fi
+         if test "`uname -s`" = "AIX" ; then
+             system=AIX-`uname -v`.`uname -r`
+         fi
+     fi
+ fi
+ 
+ case $system in
+     FreeBSD-*)
+ 	LIBS="$XLIBSW -lxpg4 $tk_oldLibs"
+ 	CFLAGS="$CFLAGS $X11_IMAKE_FLAGS"
+ 	cat > conftest.$ac_ext <<EOF
+ #line 4169 "configure"
+ #include "confdefs.h"
+ 
+ #include <locale.h>
+ 
+ int main() {
+ 
+ (void)setlocale(LC_ALL, "");
+ 
+ ; return 0; }
+ EOF
+ if { (eval echo configure:4180: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+   rm -rf conftest*
+   
+ echo "$ac_t""use xpg4 library." 1>&6
+ XLIBSW="$XLIBSW -lxpg4"
+ 
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   
+ echo "$ac_t""no need other libraries." 1>&6
+ 
+ fi
+ rm -f conftest*
+ 	;;
+     *)
+ 	echo "$ac_t""No additional library is needed." 1>&6
+ 	;;
+ esac
+ 
+ CFLAGS=$tk_oldCflags
+ LIBS=$tk_oldLibs
+ 
+ #--------------------------------------------------------------------
  # The statements below define various symbols relating to creating
  # the stub'd version of the Tk library
  #
***************
*** 4045,4050 ****
--- 4240,4246 ----
  
  
  
+ 
  eval "TK_LIB_FILE=${TK_LIB_FILE}"
  
  
***************
*** 4070,4077 ****
  
  
  
! #AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
! #AC_SUBST(TCL_BUILD_LIB_SPEC)
  
  
  
--- 4266,4275 ----
  
  
  
! 
! 
! 
! 
  
  
  
***************
*** 4203,4209 ****
  
  ac_given_srcdir=$srcdir
  
! trap 'rm -fr `echo "Makefile tkConfig.sh" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
  EOF
  cat >> $CONFIG_STATUS <<EOF
  
--- 4401,4407 ----
  
  ac_given_srcdir=$srcdir
  
! trap 'rm -fr `echo "Makefile tkConfig.sh pkgIndex.tcl" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
  EOF
  cat >> $CONFIG_STATUS <<EOF
  
***************
*** 4244,4251 ****
--- 4442,4451 ----
  s%@DL_LIBS@%$DL_LIBS%g
  s%@CFLAGS_DEBUG@%$CFLAGS_DEBUG%g
  s%@CFLAGS_OPTIMIZE@%$CFLAGS_OPTIMIZE%g
+ s%@HAVE_XMKMF@%$HAVE_XMKMF%g
  s%@STUB_LIB_FILE@%$STUB_LIB_FILE%g
  s%@TK_STUB_LIB_FILE@%$TK_STUB_LIB_FILE%g
+ s%@TCL_STUB_LIB_FLAG@%$TCL_STUB_LIB_FLAG%g
  s%@TK_STUB_LIB_FLAG@%$TK_STUB_LIB_FLAG%g
  s%@TK_BUILD_STUB_LIB_SPEC@%$TK_BUILD_STUB_LIB_SPEC%g
  s%@TK_STUB_LIB_SPEC@%$TK_STUB_LIB_SPEC%g
***************
*** 4270,4281 ****
--- 4470,4485 ----
  s%@SHLIB_SUFFIX@%$SHLIB_SUFFIX%g
  s%@SHLIB_VERSION@%$SHLIB_VERSION%g
  s%@TCL_LIB_SPEC@%$TCL_LIB_SPEC%g
+ s%@TCL_STUB_LIB_SPEC@%$TCL_STUB_LIB_SPEC%g
  s%@TCL_LIB_FLAG@%$TCL_LIB_FLAG%g
+ s%@TCL_BUILD_STUB_LIB_SPEC@%$TCL_BUILD_STUB_LIB_SPEC%g
+ s%@TCL_BUILD_LIB_SPEC@%$TCL_BUILD_LIB_SPEC%g
  s%@TCL_DBGX@%$TCL_DBGX%g
  s%@TCL_VERSION@%$TCL_VERSION%g
  s%@TK_BUILD_LIB_SPEC@%$TK_BUILD_LIB_SPEC%g
  s%@TK_CC_SEARCH_FLAGS@%$TK_CC_SEARCH_FLAGS%g
  s%@TK_LD_SEARCH_FLAGS@%$TK_LD_SEARCH_FLAGS%g
+ s%@TK_SHARED_LIB_FILE@%$TK_SHARED_LIB_FILE%g
  s%@TK_LIB_FILE@%$TK_LIB_FILE%g
  s%@TK_LIB_FLAG@%$TK_LIB_FLAG%g
  s%@TK_LIB_SPEC@%$TK_LIB_SPEC%g
***************
*** 4287,4292 ****
--- 4491,4497 ----
  s%@XINCLUDES@%$XINCLUDES%g
  s%@XLIBSW@%$XLIBSW%g
  s%@TK_SHARED_BUILD@%$TK_SHARED_BUILD%g
+ s%@X11_IMAKE_FLAGS@%$X11_IMAKE_FLAGS%g
  
  CEOF
  EOF
***************
*** 4328,4334 ****
  
  cat >> $CONFIG_STATUS <<EOF
  
! CONFIG_FILES=\${CONFIG_FILES-"Makefile tkConfig.sh"}
  EOF
  cat >> $CONFIG_STATUS <<\EOF
  for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
--- 4533,4539 ----
  
  cat >> $CONFIG_STATUS <<EOF
  
! CONFIG_FILES=\${CONFIG_FILES-"Makefile tkConfig.sh pkgIndex.tcl"}
  EOF
  cat >> $CONFIG_STATUS <<\EOF
  for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
*** unix/mkinstalldirs.orig	Fri Sep 24 21:25:39 1999
--- unix/mkinstalldirs	Fri Sep 24 21:25:39 1999
***************
*** 0 ****
--- 1,32 ----
+ #! /bin/sh
+ # mkinstalldirs --- make directory hierarchy
+ # Author: Noah Friedman <friedman@prep.ai.mit.edu>
+ # Created: 1993-05-16
+ # Last modified: 1994-03-25
+ # Public domain
+ 
+ errstatus=0
+ 
+ for file in ${1+"$@"} ; do 
+    set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+    shift
+ 
+    pathcomp=
+    for d in ${1+"$@"} ; do
+      pathcomp="$pathcomp$d"
+      case "$pathcomp" in
+        -* ) pathcomp=./$pathcomp ;;
+      esac
+ 
+      if test ! -d "$pathcomp"; then
+         echo "mkdir $pathcomp" 1>&2
+         mkdir "$pathcomp" || errstatus=$?
+      fi
+ 
+      pathcomp="$pathcomp/"
+    done
+ done
+ 
+ exit $errstatus
+ 
+ # mkinstalldirs ends here
*** unix/pkgIndex.tcl.in.orig	Fri Sep 24 21:25:39 1999
--- unix/pkgIndex.tcl.in	Fri Sep 24 21:25:39 1999
***************
*** 0 ****
--- 1,7 ----
+ # Tcl package index file, version 1.0
+ 
+ package ifneeded Tk @TK_VERSION@ [list load [file join $dir @TK_LIB_FILE@] Tk]
+ package ifneeded Tksquare @TK_VERSION@ [list tclPkgSetup $dir Tksquare @TK_VERSION@\
+     [list [list Tksquare[info sharedlibextension] load square]]]
+ package ifneeded Tktest @TK_VERSION@ [list tclPkgSetup $dir Tktest @TK_VERSION@\
+     [list [list Tktest[info sharedlibextension] load {testclipboard testcbind testdeleteapps testembed testmakeexist testmenubar testmetrics testprop testsend}]]]
*** unix/pkgInstall.tcl.orig	Fri Sep 24 21:25:39 1999
--- unix/pkgInstall.tcl	Fri Sep 24 21:25:39 1999
***************
*** 0 ****
--- 1,74 ----
+ #!/bin/sh
+ # The next line restarts using tclsh8.2 \
+ exec tclsh8.2 $0 ${1+"$@"}
+ 
+ #
+ # pkgInstall.tcl
+ #
+ # script to install a pkgIndex.tcl file
+ # into <exec-prefix>/lib
+ #
+ # Written by:	Jan Nijtmans
+ #		CMG (Computer Management Group) Arnhem B.V.
+ #		email: Jan.Nijtmans@wxs.nl (private)
+ #		       Jan.Nijtmans@cmg.nl (work)
+ #		url:   http://home.wxs.nl/~nijtmans/
+ 
+ if {[llength $argv] != 1} {
+     puts stderr "usage: pkgInstall.tcl <prefix>"
+     exit 1
+ }
+ 
+ set dir [lindex $argv 0]
+ set header ""
+ 
+ set f [open pkgIndex.tcl r]
+ set line [gets $f]
+ while {![regexp "package ifneeded " $line] && ![eof $f]} {
+     append header "${line}\n"
+     set line [gets $f]
+ }
+ set pkgIndex "${line}\n"
+ while {![info complete $pkgIndex] && ![eof $f]} {
+     set line [gets $f]
+     append pkgIndex "${line}\n"
+ }
+ close $f
+ regexp {package ifneeded ([A-Z][a-z_]+) ([0-9\.]+) } $pkgIndex \
+ 		trash Pkgname version
+ set separator "if \{\[package vcompare \[info tclversion\] $tcl_version\] < 0\} return\n"
+ 
+ if {![catch {set f [open [file join $dir pkgIndex.tcl] r]}]} {
+     set line {}
+     while {![string match "*package ifneeded*" $line] &&
+ 	    ![string match "if*" $line] && ![eof $f]} {
+ 	set line [gets $f]
+     }
+     while {![eof $f]} {
+ 	set chunk "${line}\n"
+ 	while {![info complete $chunk] && ![eof $f]} {
+ 	    set line [gets $f]
+ 	    append chunk "${line}\n"
+ 	}
+ 	if [string match "*package ifneeded*" $chunk] {
+ 	    if {![string match "package ifneeded $Pkgname $version *" $chunk]} {
+ 		append header $chunk
+ 	    }
+ 	} elseif [string match "if*" $chunk] {
+ 	    regsub -all "\\\$tcl_version" $chunk "\[info tclversion\]" chunk
+ 	    if {[string equal "if \{\[package vcompare \[info tclversion\] $tcl_version\] < 0\} return\n" $chunk]} {
+ 		set separator ""
+ 	    }
+ 	    append header $chunk
+ 	}
+ 	set line [gets $f]
+     }
+     close $f
+ }
+ 
+ set f [open [file join $dir pkgIndex.tcl] w]
+ puts -nonewline $f $header
+ puts -nonewline $f $separator
+ puts -nonewline $f $pkgIndex
+ flush $f
+ close $f
*** unix/tkAppInit.c.orig	Fri Apr 16 03:51:45 1999
--- unix/tkAppInit.c	Fri Sep 24 21:25:39 1999
***************
*** 13,20 ****
--- 13,24 ----
   * RCS: @(#) $Id: tkAppInit.c,v 1.4 1999/04/16 01:51:45 stanton Exp $
   */
  
+ #undef TCL_USE_STUBS
+ 
  #include "tk.h"
+ #ifndef I18N_IMPROVE
  #include "locale.h"
+ #endif /* !I18N_IMPROVE */
  
  /*
   * The following variable is a special hack that is needed in order for
*** unix/tkConfig.sh.in.orig	Sat Aug 14 00:06:14 1999
--- unix/tkConfig.sh.in	Fri Sep 24 21:25:39 1999
***************
*** 20,26 ****
  TK_PATCH_LEVEL='@TK_PATCH_LEVEL@'
  
  # -D flags for use with the C compiler.
! TK_DEFS='@DEFS@'
  
  # Flag, 1: we built a shared lib, 0 we didn't
  TK_SHARED_BUILD=@TK_SHARED_BUILD@
--- 20,26 ----
  TK_PATCH_LEVEL='@TK_PATCH_LEVEL@'
  
  # -D flags for use with the C compiler.
! TK_DEFS='@DEFS@ @X11_IMAKE_FLAGS@ -DI18N_IMPROVE'
  
  # Flag, 1: we built a shared lib, 0 we didn't
  TK_SHARED_BUILD=@TK_SHARED_BUILD@
*** unix/tkUnixEvent.c.orig	Fri Apr 16 03:51:46 1999
--- unix/tkUnixEvent.c	Fri Sep 24 21:25:39 1999
***************
*** 161,167 ****
          (void) XSync(dispPtr->display, False);
          (void) XCloseDisplay(dispPtr->display);
      }
!     
      ckfree((char *) dispPtr);
  }
  
--- 161,172 ----
          (void) XSync(dispPtr->display, False);
          (void) XCloseDisplay(dispPtr->display);
      }
! #ifdef I18N_IMPROVE
!     if (displayPtr->imEncoding != NULL) {
! 	Tcl_FreeEncoding(displayPtr->imEncoding);
!     }
! #endif /* I18N_IMPROVE */    
! 
      ckfree((char *) dispPtr);
  }
  
***************
*** 246,251 ****
--- 251,268 ----
  
      while (numFound > 0) {
  	XNextEvent(display, &event);
+ #ifdef I18N_IMPROVE
+ 	/*
+ 	 * To avoid Tk freezing by IM server's protocol bugs,
+ 	 * Re-check queued event after an event is filterd.
+ 	 *
+ 	 *	m-hirano
+ 	 */
+ 	if (XFilterEvent(&event, None) == True) {
+ 	    numFound = XEventsQueued(display, QueuedAlready);
+ 	    continue;
+ 	}
+ #endif /* I18N_IMPROVE */
  	Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
  	numFound--;
      }
*** unix/tkUnixIm.c.orig	Fri Sep 24 21:25:39 1999
--- unix/tkUnixIm.c	Fri Sep 24 21:25:39 1999
***************
*** 0 ****
--- 1,255 ----
+ /* 
+  * tkUnixIm.c --
+  *
+  *      This file contains modules to implement the XIM protocol session.
+  *	This is the shrinked version of tkXIM.c, worte for tk8.0jp.
+  *
+  *	Author:	m-hirano@sra.co.jp
+  *
+  * Copyright 1999 Software Research Associates, Inc.
+  *
+  * Permission to use, copy, modify, and distribute this software and its
+  * documentation for any purpose and without fee is hereby granted, provided
+  * that the above copyright notice appear in all copies and that both that
+  * copyright notice and this permission notice appear in supporting
+  * documentation, and that the name of Software Research Associates not be
+  * used in advertising or publicity pertaining to distribution of the
+  * software without specific, written prior permission.  Software Research
+  * Associates makes no representations about the suitability of this software
+  * for any purpose.  It is provided "as is" without express or implied
+  * warranty.
+  */
+ 
+ #if 0
+ static char rcsid[] = "$Header: /home/m-hirano/cvsroot/tcltk/tk8.1/unix/tkUnixIm.c,v 1.1 1999/05/10 00:39:16 m-hirano Exp $";
+ #endif
+ 
+ #include "tkPort.h"
+ #include "tkInt.h"
+ 
+ #ifdef TK_USE_INPUT_METHODS
+ #ifdef I18N_IMPROVE
+ 
+ static void		TkpIMGenericHandler _ANSI_ARGS_((ClientData clientData, XEvent *eventPtr));
+ static TkWindow *	GetToplevel _ANSI_ARGS_((TkWindow *winPtr));
+ static void		TkpCreateIMGenericHandler _ANSI_ARGS_((Tk_Window tkwin));
+ static void		TkpDeleteIMGenericHandler _ANSI_ARGS_((Tk_Window tkwin));
+ 
+ static TkWindow *
+ GetToplevel(winPtr)
+      TkWindow *winPtr;
+ {
+     while (!(winPtr->flags & TK_TOP_LEVEL)) {
+ 	winPtr = winPtr->parentPtr;
+ 	if (winPtr == NULL) {
+ 	    return NULL;
+ 	}
+     }
+     return winPtr;
+ }
+ 
+ 
+ static void
+ TkpIMGenericHandler(clientData, eventPtr)
+      ClientData clientData;
+      XEvent *eventPtr;
+ {
+     Tk_Window tkwin = (Tk_Window)clientData;
+     TkWindow *winPtr = (TkWindow *)clientData;
+     
+     if (eventPtr->xany.window != Tk_WindowId(tkwin) ||
+ 	winPtr->inputContext == NULL ||
+ 	!(winPtr->flags & TK_CHECKED_IC)) {
+ 	/*
+ 	 * Why ME ???
+ 	 */
+ 	return;
+     }
+ 
+     /*
+      * Well, should I care about Enter/Leave ?
+      */
+ 
+     switch (eventPtr->type) {
+         case KeyPress:
+         case FocusIn: {
+ 	    Window root, child;
+ 	    int rootX, rootY;
+ 	    int wX, wY;
+ 	    unsigned int mask;
+ 
+ 	    /*
+ 	     * Care about case mouse pointer is not on winPtr->window.
+ 	     * In such a case, IM server can't fetch any events from Tk.
+ 	     */
+ 
+ 	    if (XQueryPointer(winPtr->display,
+ 			      RootWindow(winPtr->display, winPtr->screenNum),
+ 			      &root, &child, &rootX, &rootY, &wX, &wY, &mask) == True) {
+ 		TkWindow *pWin = (TkWindow *)Tk_CoordsToWindow(rootX, rootY,
+ 							       (Tk_Window)winPtr);
+ 		if (pWin != NULL && (pWin->window != winPtr->window)) {
+ #if 0
+ 		    /*
+ 		     * Code belows are what I REALLY want to do. But,
+ 		     * in XIMPreeditPosition mode, IM server use the
+ 		     * focus window as key event source window and as
+ 		     * PreeditArea window by X11 specification. I want
+ 		     * IM server to use this focus window ONLY as key
+ 		     * event source. Means:
+ 		     *
+ 		     * 	o PreeditArea and PreeditPosition take place
+ 		     * 	  within client window (winPtr->window).
+ 		     *	o KeyPress event source is the window in which
+ 		     *	  mouse pointer is (pWin->window).
+ 		     */
+ 
+ 		    if (XSetICValues(winPtr->inputContext, XNFocusWindow,
+ 				     pWin->window, NULL) != NULL) {
+ 			fprintf(stderr, "debugIC: can't set IC focus to pointer window 0x%08x\n",
+ 				pWin->window);
+ 		    } else {
+ 			fprintf(stderr, "debugIC: set IC focus to pointer window 0x%08x\n",
+ 				pWin->window);
+ 		    }
+ #endif
+ 		    /*
+ 		     * Check pWin and winPtr are in same toplevel.
+ 		     * If they are NOT, don't change focus. 
+ 		     */
+ 		    TkWindow *pTop = GetToplevel(pWin);
+ 		    TkWindow *wTop = GetToplevel(winPtr);
+ 		    if (pTop == wTop) {
+ 			TkpChangeFocus(winPtr, 1);
+ 		    }
+ 		}
+ 	    }
+ 	    /*
+ 	     * Get current focused window.
+ 	     */
+ 	    if (winPtr->dispPtr->lastFocusedIC != winPtr->inputContext) {
+ 		winPtr->dispPtr->lastFocusedIC = winPtr->inputContext;
+ 		XSetICFocus(winPtr->inputContext);
+ 	    }
+ 	    break;
+ 	}
+ 
+         case FocusOut: {
+ 	    winPtr->dispPtr->lastFocusedIC = None;
+ 	    XUnsetICFocus(winPtr->inputContext);
+ 	    break;
+ 	}
+ 
+ 	case DestroyNotify: {
+ 	    winPtr->dispPtr->lastFocusedIC = NULL;
+ 	    XUnsetICFocus(winPtr->inputContext);
+ 	    TkpDeleteIMGenericHandler(tkwin);
+ 	    break;
+ 	}
+     }
+ }
+ 
+ 
+ static void
+ TkpCreateIMGenericHandler(tkwin)
+      Tk_Window tkwin;
+ {
+     Tk_CreateEventHandler(tkwin, FocusChangeMask|StructureNotifyMask|KeyPressMask
+ #if 0
+ 			  EnterWindowMask|LeaveWindowMask,
+ #else
+ 			  ,
+ #endif
+ 			  (Tk_EventProc *)TkpIMGenericHandler,
+ 			  (ClientData)tkwin);
+ }
+ 
+ 
+ static void
+ TkpDeleteIMGenericHandler(tkwin)
+      Tk_Window tkwin;
+ {
+     Tk_DeleteEventHandler(tkwin, FocusChangeMask|StructureNotifyMask|KeyPressMask
+ #if 0
+ 			  EnterWindowMask|LeaveWindowMask,
+ #else
+ 			  ,
+ #endif
+ 			  (Tk_EventProc *)TkpIMGenericHandler,
+ 			  (ClientData)tkwin);
+ }
+ 
+ 
+ XIC
+ TkpCreateIC(winPtr)
+      TkWindow *winPtr;
+ {
+     if (winPtr->dispPtr->inputMethod != NULL &&
+ 	!(winPtr->flags & TK_CHECKED_IC)) {
+ 	winPtr->inputContext =
+ 		XCreateIC(winPtr->dispPtr->inputMethod,
+ 			  XNInputStyle, XIMPreeditNothing|XIMStatusNothing,
+ 			  XNClientWindow, winPtr->window,
+ 			  XNFocusWindow, winPtr->window,
+ 			  NULL);
+ 	if (winPtr->inputContext != NULL) {
+ 	    TkpCreateIMGenericHandler((Tk_Window)winPtr);
+ 	}
+     }
+     winPtr->flags |= TK_CHECKED_IC;
+     return winPtr->inputContext;
+ }
+ 
+ 
+ void
+ TkpDestroyIC(winPtr, needDestroy)
+      TkWindow *winPtr;
+      int needDestroy;
+ {
+     TkpDeleteIMGenericHandler((Tk_Window)winPtr);
+     if (winPtr->inputContext == winPtr->dispPtr->lastFocusedIC) {
+ 	winPtr->dispPtr->lastFocusedIC = None;
+     }
+     if (needDestroy == 1 &&
+ 	winPtr->inputContext != NULL) {
+ 	XDestroyIC(winPtr->inputContext);
+     }
+     winPtr->flags &= ~(TK_CHECKED_IC);
+     winPtr->inputContext = NULL;
+ }
+ 
+ 
+ int
+ Tk_ImconfigureObjCmd(clientData, interp, objc, objv)
+      ClientData clientData;	/* Main window associated with
+ 				 * interpreter. */
+      Tcl_Interp *interp;	/* Current interpreter. */
+      int objc;			/* Number of arguments. */
+      Tcl_Obj *CONST objv[];	/* Argument objects. */
+ {
+     Tk_Window tkwin = (Tk_Window)clientData;
+     Tcl_Obj *resultPtr = Tcl_GetObjResult(interp);
+ 
+     if (objc < 2) {
+ 	Tcl_WrongNumArgs(interp, 1, objv, "path ?option? ?arg? ...");
+ 	return TCL_ERROR;
+     }
+ 
+     tkwin = Tk_NameToWindow(interp, Tcl_GetStringFromObj(objv[1], NULL), tkwin);
+     if (tkwin == NULL) {
+ 	return TCL_ERROR;
+     }
+ 
+     if (((TkWindow *)tkwin)->dispPtr->inputMethod == NULL) {
+ 	Tcl_AppendStringsToObj(resultPtr, "No IM server is available.", NULL);
+ 	return TCL_ERROR;
+     }
+ 
+     Tcl_AppendStringsToObj(resultPtr,
+ 			  (TkpCreateIC((TkWindow *)tkwin) != NULL) ? "1" : "0",
+ 			  NULL);
+     return TCL_OK;
+ }
+ 
+ #endif /* I18N_IMPROVE */
+ #endif /* TK_USE_INPUT_METHODS */
*** unix/tkUnixInit.c.orig	Fri Apr 16 03:51:46 1999
--- unix/tkUnixInit.c	Fri Sep 24 21:25:39 1999
***************
*** 104,111 ****
  
  void
  TkpDisplayWarning(msg, title)
!     char *msg;			/* Message to be displayed. */
!     char *title;		/* Title of warning. */
  {
      Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR);
      if (errChannel) {
--- 104,111 ----
  
  void
  TkpDisplayWarning(msg, title)
!     CONST char *msg;		/* Message to be displayed. */
!     CONST char *title;		/* Title of warning. */
  {
      Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR);
      if (errChannel) {
*** unix/tkUnixInt.h.orig	Fri Apr 16 03:51:46 1999
--- unix/tkUnixInt.h	Fri Sep 24 21:25:39 1999
***************
*** 24,29 ****
--- 24,32 ----
   * Prototypes for procedures that are referenced in files other
   * than the ones they're defined in.
   */
+ 
+ #include "tclPlatDecls.h"
+ 
  #include "tkIntPlatDecls.h"
  
  #endif /* _TKUNIXINT */
*** unix/tkUnixKey.c.orig	Fri Apr 16 03:51:46 1999
--- unix/tkUnixKey.c	Fri Sep 24 21:25:39 1999
***************
*** 83,89 ****
--- 83,94 ----
  #endif /* TK_USE_INPUT_METHODS */
      Tcl_DStringSetLength(&buf, len);
  
+ #if defined(I18N_IMPROVE) && defined(TK_USE_INPUT_METHODS)
+     Tcl_ExternalToUtfDString(winPtr->dispPtr->imEncoding,
+ 			     Tcl_DStringValue(&buf), len, dsPtr);
+ #else
      Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(&buf), len, dsPtr);
+ #endif /* I18N_IMPROVE && TK_USE_INPUT_METHODS */
      Tcl_DStringFree(&buf);
  
      return Tcl_DStringValue(dsPtr);
*** unix/tkUnixMenubu.c.orig	Fri Apr 16 03:51:47 1999
--- unix/tkUnixMenubu.c	Fri Sep 24 21:25:39 1999
***************
*** 143,150 ****
       * foreground color, generate the stippled effect.
       */
  
!     if (((mbPtr->state == STATE_DISABLED) 
!             && (mbPtr->disabledFg == NULL)) || (mbPtr->image != NULL)) {
  	XFillRectangle(mbPtr->display, pixmap, mbPtr->disabledGC,
  		mbPtr->inset, mbPtr->inset,
  		(unsigned) (Tk_Width(tkwin) - 2*mbPtr->inset),
--- 143,150 ----
       * foreground color, generate the stippled effect.
       */
  
!     if ((mbPtr->state == STATE_DISABLED) 
!             && ((mbPtr->disabledFg == NULL) || (mbPtr->image != NULL))) {
  	XFillRectangle(mbPtr->display, pixmap, mbPtr->disabledGC,
  		mbPtr->inset, mbPtr->inset,
  		(unsigned) (Tk_Width(tkwin) - 2*mbPtr->inset),
*** library/bgerror.tcl.orig	Fri Apr 16 03:51:25 1999
--- library/bgerror.tcl	Fri Sep 24 21:25:39 1999
***************
*** 42,48 ****
  
      # Ok the application's tkerror either failed or was not found
      # we use the default dialog then :
!     if {$tcl_platform(platform) == "macintosh"} {
  	set ok Ok
      } else {
  	set ok OK
--- 42,48 ----
  
      # Ok the application's tkerror either failed or was not found
      # we use the default dialog then :
!     if {![string compare $tcl_platform(platform) macintosh]} {
  	set ok Ok
      } else {
  	set ok OK
*** library/entry.tcl.orig	Mon Aug  9 20:38:29 1999
--- library/entry.tcl	Fri Sep 24 21:25:39 1999
***************
*** 214,219 ****
--- 214,226 ----
      }
  }
  
+ # input method configuration binding (unix only)
+ if {![string compare $tcl_platform(platform) "unix"]} {
+     if {[string compare [info commands imconfigure] {}]} {
+ 	bind Text <FocusIn> {catch {imconfigure %W}}
+     }
+ }
+ 
  # Additional emacs-like bindings:
  
  bind Entry <Control-a> {
*** library/scrlbar.tcl.orig	Fri Apr 16 03:51:27 1999
--- library/scrlbar.tcl	Fri Sep 24 21:25:40 1999
***************
*** 224,230 ****
      if {[llength $tkPriv(initValues)] == 2} {
  	set tkPriv(initPos) $iv0
      } else {
! 	if {$iv0 == 0} {
  	    set tkPriv(initPos) 0.0
  	} else {
  	    set tkPriv(initPos) [expr {(double([lindex $tkPriv(initValues) 2])) \
--- 224,230 ----
      if {[llength $tkPriv(initValues)] == 2} {
  	set tkPriv(initPos) $iv0
      } else {
! 	if {!$iv0} {
  	    set tkPriv(initPos) 0.0
  	} else {
  	    set tkPriv(initPos) [expr {(double([lindex $tkPriv(initValues) 2])) \
*** library/text.tcl.orig	Fri Apr 16 03:51:27 1999
--- library/text.tcl	Fri Sep 24 21:25:40 1999
***************
*** 377,390 ****
  	%W delete [tkTextPrevPos %W insert tcl_startOfPreviousWord] insert
      }
  }
! 
! # Macintosh only bindings:
! 
! # if text black & highlight black -> text white, other text the same
! if {![string compare $tcl_platform(platform) "macintosh"]} {
  bind Text <FocusIn> {
!     %W tag configure sel -borderwidth 0
!     %W configure -selectbackground systemHighlight -selectforeground systemHighlightText
  }
  bind Text <FocusOut> {
      %W tag configure sel -borderwidth 1
--- 377,395 ----
  	%W delete [tkTextPrevPos %W insert tcl_startOfPreviousWord] insert
      }
  }
! switch $tcl_platform(platform) {
!   "unix" {
!     # input method configuration binding
!     if {[string compare [info commands imconfigure] {}]} {
! 	bind Text <FocusIn> {catch {imconfigure %W}}
!     }
!   }
!   "macintosh" {
!   # if text black & highlight black -> text white, other text the same
  bind Text <FocusIn> {
! 	%W tag configure sel -borderwidth 0
! 	%W configure -selectbackground systemHighlight \
! 		-selectforeground systemHighlightText
  }
  bind Text <FocusOut> {
      %W tag configure sel -borderwidth 1
***************
*** 416,421 ****
--- 421,427 ----
  }
  
  # End of Mac only bindings
+  }
  }
  
  # A few additional bindings of my own.
***************
*** 791,801 ****
  
      set i [$w index insert]
      scan $i "%d.%d" line char
!     if {[string compare $tkPriv(prevPos) $i] != 0} {
  	set tkPriv(char) $char
      }
      set new [$w index [expr {$line + $n}].$tkPriv(char)]
!     if {[$w compare $new == end] || [$w compare $new == "insert linestart"]} {
  	set new $i
      }
      set tkPriv(prevPos) $new
--- 797,807 ----
  
      set i [$w index insert]
      scan $i "%d.%d" line char
!     if {[string compare $tkPriv(prevPos) $i]} {
  	set tkPriv(char) $char
      }
      set new [$w index [expr {$line + $n}].$tkPriv(char)]
!     if {[$w compare $new == end] || [$w compare $new == {insert linestart}]} {
  	set new $i
      }
      set tkPriv(prevPos) $new
*** generic/tkConsole.c.orig	Fri Jul 30 04:09:25 1999
--- generic/tkConsole.c	Fri Sep 24 21:25:40 1999
***************
*** 321,327 ****
  #ifdef MAC_TCL
      static char initCmd[] = "source -rsrc {Console}";
  #else
!     static char initCmd[] = "source $tk_library/console.tcl";
  #endif
      
      consoleInterp = Tcl_CreateInterp();
--- 321,327 ----
  #ifdef MAC_TCL
      static char initCmd[] = "source -rsrc {Console}";
  #else
!     static char initCmd[] = "if [catch {::wrap::source lib/tk$tk_version/console}] {source [file join $tk_library console.tcl]}";
  #endif
      
      consoleInterp = Tcl_CreateInterp();
*** generic/tkEvent.c.orig	Fri Aug 13 20:26:20 1999
--- generic/tkEvent.c	Fri Sep 24 21:25:40 1999
***************
*** 636,641 ****
--- 636,653 ----
      }
  
  #ifdef TK_USE_INPUT_METHODS
+ #ifdef I18N_IMPROVE
+       /*
+        * No need to create an input context for each and every window.
+        *
+        * Futhermore, XFilterEvent() should be called just after the
+        * event is fetched, since some IM server have protocol bugs that
+        * causes Tk freezing, so events EXCEPT THE INPUT METHODS THINGS
+        * should only be queued into Tcl event queue.
+        *
+        *		m-hirano
+        */
+ #else
      /*
       * Pass the event to the input method(s), if there are any, and
       * discard the event if the input method(s) insist.  Create the
***************
*** 656,661 ****
--- 668,674 ----
      if (XFilterEvent(eventPtr, None)) {
          goto done;
      }
+ #endif /* I18N_IMPROVE */
  #endif /* TK_USE_INPUT_METHODS */
  
      /*
***************
*** 909,914 ****
--- 922,938 ----
  	}
      }
  
+ #if defined(TK_USE_INPUT_METHODS) && defined(I18N_IMPROVE)
+     if (eventPtr->type == KeyPress && eventPtr->xkey.keycode == 0) {
+         /*
+          * No doubt this is a composed message from IM server.
+          * Tk can handle KeyPress event with zero keycode value 
+          * if state of the event is zero.
+          */
+         eventPtr->xkey.state = 0;
+     }
+ #endif /* TK_USE_INPUT_METHODS && I18N_IMPROVE */
+ 
      if ((dispPtr->delayedMotionPtr != NULL) && (position == TCL_QUEUE_TAIL)) {
  	if ((eventPtr->type == MotionNotify) && (eventPtr->xmotion.window
  		== dispPtr->delayedMotionPtr->event.xmotion.window)) {
***************
*** 1095,1103 ****
--- 1119,1136 ----
   *--------------------------------------------------------------
   */
  
+ #ifndef USE_TCL_STUBS
+ extern TclStubs tclStubs;
+ #   define Tcl_MainLoop tclStubs.tcl_MainLoop
+ #endif
+ 
  void
  Tk_MainLoop()
  {
+     if (Tcl_MainLoop) {
+ 	Tcl_MainLoop();
+ 	return;
+     }
      while (Tk_GetNumMainWindows() > 0) {
  	Tcl_DoOneEvent(0);
      }
*** generic/tkImgPhoto.c.orig	Thu Jul  1 02:39:44 1999
--- generic/tkImgPhoto.c	Fri Sep 24 21:25:40 1999
***************
*** 20,27 ****
--- 20,32 ----
  
  #include "tkInt.h"
  #include "tkPort.h"
+ #ifdef MAC_TCL
  #include "tclMath.h"
+ #else
+ #include <math.h>
+ #endif
  #include <ctype.h>
+ #include <string.h>
  
  #ifdef __WIN32__
  #include "tkWinInt.h"
*** generic/tkInt.decls.orig	Tue Aug 10 20:14:57 1999
--- generic/tkInt.decls	Fri Sep 24 21:25:40 1999
***************
*** 287,293 ****
  }
  
  declare 58 generic {
!     void TkpDisplayWarning (char *msg, char *title)
  }
  
  declare 59 generic {
--- 287,293 ----
  }
  
  declare 58 generic {
!     void TkpDisplayWarning (CONST char *msg, CONST char *title)
  }
  
  declare 59 generic {
***************
*** 619,624 ****
--- 619,653 ----
      void TkSetFocusWin (TkWindow *winPtr, int force) 
  }
  
+ declare 137 generic {
+     int  TkTextGetIndex (Tcl_Interp *interp, struct TkText *textPtr, \
+ 	    char *string, struct TkTextIndex *indexPtr)
+ }
+ 
+ declare 138 generic {
+     void  TkTextIndexBackBytes (CONST struct TkTextIndex *srcPtr, \
+ 	    int count, struct TkTextIndex *dstPtr)
+ }
+ 
+ declare 139 generic {
+     void  TkTextIndexForwBytes (CONST struct TkTextIndex *srcPtr, \
+ 	    int count, struct TkTextIndex *dstPtr)
+ }
+ 
+ declare 140 generic {
+     struct TkTextIndex *  TkTextMakeByteIndex (struct TkTextBTree_ *tree, \
+ 	    int lineIndex, int byteIndex, struct TkTextIndex *indexPtr)
+ }
+ 
+ declare 141 generic {
+     void  TkTextPrintIndex (CONST struct TkTextIndex *indexPtr, char *string)
+ }
+ 
+ declare 142 generic {
+     struct TkTextSegment * TkTextSetMark (struct TkText *textPtr, char *name, \
+ 			    struct TkTextIndex *indexPtr)
+ }
+ 
  ##############################################################################
  
  # Define the platform specific internal Tcl interface. These functions are
***************
*** 661,666 ****
--- 690,699 ----
      void TkUnixSetMenubar (Tk_Window tkwin, Tk_Window menubar)
  }
  	
+ declare 8 unix {
+     int TkpTestembedCmd (ClientData clientdata, Tcl_Interp *interp, \
+ 	    int argc, char **argv)
+ }
  
  
  ############################
***************
*** 806,811 ****
--- 839,849 ----
      int TkWinGetPlatformId(void)
  }
  
+ declare 34 win {
+     int TkpTestembedCmd (ClientData clietdata, Tcl_Interp *interp, \
+ 	    int argc, char **argv)
+ }
+ 
  ########################
  # Mac specific functions
  
***************
*** 1032,1037 ****
--- 1070,1079 ----
      MacDrawable * TkMacGetHostToplevel  (TkWindow *winPtr)
  }
  
+ declare 65 mac {
+     int TkpTestembedCmd (ClientData clietdata, Tcl_Interp *interp, \
+ 	    int argc, char **argv)
+ }
  
  ##############################################################################
  
*** generic/tkInt.h.orig	Thu Jun 17 21:58:00 1999
--- generic/tkInt.h	Fri Sep 24 21:25:40 1999
***************
*** 482,487 ****
--- 482,500 ----
  
  #ifdef TK_USE_INPUT_METHODS
      XIM inputMethod;		/* Input method for this display */
+ #ifdef I18N_IMPROVE
+     Tcl_Encoding imEncoding;	/* Tcl encoding when the first Tcl
+ 				 * interp was created.
+ 				 * For encoding conversion from
+ 				 * XmbLookupString() to UTF.
+ 				 */
+     XIC lastFocusedIC;		/* The last focused input context on
+ 				 * the display.
+ 				 */
+ #ifdef XNDestroyCallback
+     XIMCallback destroyCallback;
+ #endif /* XNDestroyCallback */
+ #endif /* I18N_IMPROVE */
  #endif /* TK_USE_INPUT_METHODS */
      Tcl_HashTable winTable;	/* Maps from X window ids to TkWindow ptrs. */
  
***************
*** 985,993 ****
  EXTERN int		Tk_WmCmd _ANSI_ARGS_((ClientData clientData,
  			    Tcl_Interp *interp, int argc, char **argv));
  
- void	TkConsolePrint _ANSI_ARGS_((Tcl_Interp *interp,
- 			    int devId, char *buffer, long size));
- 
  EXTERN void		TkEventInit _ANSI_ARGS_((void));
  
  EXTERN int		TkCreateMenuCmd _ANSI_ARGS_((Tcl_Interp *interp));
--- 998,1003 ----
***************
*** 1002,1007 ****
--- 1012,1032 ----
   */
  EXTERN int		TkUnsupported1Cmd _ANSI_ARGS_((ClientData clientData,
  			    Tcl_Interp *interp, int argc, char **argv));
+ 
+ #if defined(TK_USE_INPUT_METHODS) && defined(I18N_IMPROVE)
+ EXTERN XIC		TkpCreateIC _ANSI_ARGS_((TkWindow *winPtr));
+ EXTERN void		TkpDestroyIC _ANSI_ARGS_((TkWindow *winPtr, int needDestroy));
+ EXTERN int		Tk_ImconfigureObjCmd _ANSI_ARGS_((ClientData clientData,
+ 			    Tcl_Interp *interp, int objc,
+ 			    Tcl_Obj *CONST objv[]));
+ #endif
+ 
+ # undef TCL_STORAGE_CLASS
+ # define TCL_STORAGE_CLASS
+ 
+ EXTERN int	TkConsoleInit _ANSI_ARGS_((Tcl_Interp *interp));
+ EXTERN void	TkConsolePrint _ANSI_ARGS_((Tcl_Interp *interp,
+ 			    int devId, char *buffer, long size));
  
  # undef TCL_STORAGE_CLASS
  # define TCL_STORAGE_CLASS DLLIMPORT
*** generic/tkIntDecls.h.orig	Tue Aug 10 20:14:57 1999
--- generic/tkIntDecls.h	Fri Sep 24 21:25:40 1999
***************
*** 22,27 ****
--- 22,31 ----
  #define TCL_STORAGE_CLASS DLLEXPORT
  #endif
  
+ struct TkText;
+ struct TkTextIndex;
+ struct TkTextBTree_;
+ 
  /*
   * WARNING: This file is automatically generated by the tools/genStubs.tcl
   * script.  Any modifications to the function declarations below should be made
***************
*** 214,221 ****
  EXTERN void		TkpClaimFocus _ANSI_ARGS_((TkWindow * topLevelPtr, 
  				int force));
  /* 58 */
! EXTERN void		TkpDisplayWarning _ANSI_ARGS_((char * msg, 
! 				char * title));
  /* 59 */
  EXTERN void		TkpGetAppName _ANSI_ARGS_((Tcl_Interp * interp, 
  				Tcl_DString * name));
--- 218,225 ----
  EXTERN void		TkpClaimFocus _ANSI_ARGS_((TkWindow * topLevelPtr, 
  				int force));
  /* 58 */
! EXTERN void		TkpDisplayWarning _ANSI_ARGS_((CONST char * msg, 
! 				CONST char * title));
  /* 59 */
  EXTERN void		TkpGetAppName _ANSI_ARGS_((Tcl_Interp * interp, 
  				Tcl_DString * name));
***************
*** 506,511 ****
--- 510,539 ----
  /* 136 */
  EXTERN void		TkSetFocusWin _ANSI_ARGS_((TkWindow * winPtr, 
  				int force));
+ /* 137 */
+ EXTERN int		TkTextGetIndex _ANSI_ARGS_((Tcl_Interp * interp, 
+ 				struct TkText * textPtr, char * string, 
+ 				struct TkTextIndex * indexPtr));
+ /* 138 */
+ EXTERN void		TkTextIndexBackBytes _ANSI_ARGS_((
+ 				CONST struct TkTextIndex * srcPtr, int count, 
+ 				struct TkTextIndex * dstPtr));
+ /* 139 */
+ EXTERN void		TkTextIndexForwBytes _ANSI_ARGS_((
+ 				CONST struct TkTextIndex * srcPtr, int count, 
+ 				struct TkTextIndex * dstPtr));
+ /* 140 */
+ EXTERN struct TkTextIndex * TkTextMakeByteIndex _ANSI_ARGS_((
+ 				struct TkTextBTree_ * tree, int lineIndex, 
+ 				int byteIndex, struct TkTextIndex * indexPtr));
+ /* 141 */
+ EXTERN void		TkTextPrintIndex _ANSI_ARGS_((
+ 				CONST struct TkTextIndex * indexPtr, 
+ 				char * string));
+ /* 142 */
+ EXTERN struct TkTextSegment * TkTextSetMark _ANSI_ARGS_((
+ 				struct TkText * textPtr, char * name, 
+ 				struct TkTextIndex * indexPtr));
  
  typedef struct TkIntStubs {
      int magic;
***************
*** 569,575 ****
      int (*tkpChangeFocus) _ANSI_ARGS_((TkWindow * winPtr, int force)); /* 55 */
      void (*tkpCloseDisplay) _ANSI_ARGS_((TkDisplay * dispPtr)); /* 56 */
      void (*tkpClaimFocus) _ANSI_ARGS_((TkWindow * topLevelPtr, int force)); /* 57 */
!     void (*tkpDisplayWarning) _ANSI_ARGS_((char * msg, char * title)); /* 58 */
      void (*tkpGetAppName) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_DString * name)); /* 59 */
      TkWindow * (*tkpGetOtherWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 60 */
      TkWindow * (*tkpGetWrapperWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 61 */
--- 597,603 ----
      int (*tkpChangeFocus) _ANSI_ARGS_((TkWindow * winPtr, int force)); /* 55 */
      void (*tkpCloseDisplay) _ANSI_ARGS_((TkDisplay * dispPtr)); /* 56 */
      void (*tkpClaimFocus) _ANSI_ARGS_((TkWindow * topLevelPtr, int force)); /* 57 */
!     void (*tkpDisplayWarning) _ANSI_ARGS_((CONST char * msg, CONST char * title)); /* 58 */
      void (*tkpGetAppName) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_DString * name)); /* 59 */
      TkWindow * (*tkpGetOtherWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 60 */
      TkWindow * (*tkpGetWrapperWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 61 */
***************
*** 808,813 ****
--- 836,847 ----
  #endif /* MAC_TCL */
      void (*tkpDrawHighlightBorder) _ANSI_ARGS_((Tk_Window tkwin, GC fgGC, GC bgGC, int highlightWidth, Drawable drawable)); /* 135 */
      void (*tkSetFocusWin) _ANSI_ARGS_((TkWindow * winPtr, int force)); /* 136 */
+     int (*tkTextGetIndex) _ANSI_ARGS_((Tcl_Interp * interp, struct TkText * textPtr, char * string, struct TkTextIndex * indexPtr)); /* 137 */
+     void (*tkTextIndexBackBytes) _ANSI_ARGS_((CONST struct TkTextIndex * srcPtr, int count, struct TkTextIndex * dstPtr)); /* 138 */
+     void (*tkTextIndexForwBytes) _ANSI_ARGS_((CONST struct TkTextIndex * srcPtr, int count, struct TkTextIndex * dstPtr)); /* 139 */
+     struct TkTextIndex * (*tkTextMakeByteIndex) _ANSI_ARGS_((struct TkTextBTree_ * tree, int lineIndex, int byteIndex, struct TkTextIndex * indexPtr)); /* 140 */
+     void (*tkTextPrintIndex) _ANSI_ARGS_((CONST struct TkTextIndex * indexPtr, char * string)); /* 141 */
+     struct TkTextSegment * (*tkTextSetMark) _ANSI_ARGS_((struct TkText * textPtr, char * name, struct TkTextIndex * indexPtr)); /* 142 */
  } TkIntStubs;
  
  #ifdef __cplusplus
***************
*** 1447,1452 ****
--- 1481,1510 ----
  #ifndef TkSetFocusWin
  #define TkSetFocusWin \
  	(tkIntStubsPtr->tkSetFocusWin) /* 136 */
+ #endif
+ #ifndef TkTextGetIndex
+ #define TkTextGetIndex \
+ 	(tkIntStubsPtr->tkTextGetIndex) /* 137 */
+ #endif
+ #ifndef TkTextIndexBackBytes
+ #define TkTextIndexBackBytes \
+ 	(tkIntStubsPtr->tkTextIndexBackBytes) /* 138 */
+ #endif
+ #ifndef TkTextIndexForwBytes
+ #define TkTextIndexForwBytes \
+ 	(tkIntStubsPtr->tkTextIndexForwBytes) /* 139 */
+ #endif
+ #ifndef TkTextMakeByteIndex
+ #define TkTextMakeByteIndex \
+ 	(tkIntStubsPtr->tkTextMakeByteIndex) /* 140 */
+ #endif
+ #ifndef TkTextPrintIndex
+ #define TkTextPrintIndex \
+ 	(tkIntStubsPtr->tkTextPrintIndex) /* 141 */
+ #endif
+ #ifndef TkTextSetMark
+ #define TkTextSetMark \
+ 	(tkIntStubsPtr->tkTextSetMark) /* 142 */
  #endif
  
  #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
*** generic/tkIntPlatDecls.h.orig	Tue May 25 03:31:06 1999
--- generic/tkIntPlatDecls.h	Fri Sep 24 21:25:41 1999
***************
*** 52,57 ****
--- 52,60 ----
  /* 7 */
  EXTERN void		TkUnixSetMenubar _ANSI_ARGS_((Tk_Window tkwin, 
  				Tk_Window menubar));
+ /* 8 */
+ EXTERN int		TkpTestembedCmd _ANSI_ARGS_((ClientData clientdata, 
+ 				Tcl_Interp * interp, int argc, char ** argv));
  #endif /* UNIX */
  #ifdef __WIN32__
  /* 0 */
***************
*** 142,147 ****
--- 145,153 ----
  				char * className));
  /* 33 */
  EXTERN int		TkWinGetPlatformId _ANSI_ARGS_((void));
+ /* 34 */
+ EXTERN int		TkpTestembedCmd _ANSI_ARGS_((ClientData clietdata, 
+ 				Tcl_Interp * interp, int argc, char ** argv));
  #endif /* __WIN32__ */
  #ifdef MAC_TCL
  /* 0 */
***************
*** 290,295 ****
--- 296,304 ----
  EXTERN MacDrawable *	TkMacContainerId _ANSI_ARGS_((TkWindow * winPtr));
  /* 64 */
  EXTERN MacDrawable *	TkMacGetHostToplevel _ANSI_ARGS_((TkWindow * winPtr));
+ /* 65 */
+ EXTERN int		TkpTestembedCmd _ANSI_ARGS_((ClientData clietdata, 
+ 				Tcl_Interp * interp, int argc, char ** argv));
  #endif /* MAC_TCL */
  
  typedef struct TkIntPlatStubs {
***************
*** 305,310 ****
--- 314,320 ----
      Window (*tkUnixContainerId) _ANSI_ARGS_((TkWindow * winPtr)); /* 5 */
      int (*tkUnixDoOneXEvent) _ANSI_ARGS_((Tcl_Time * timePtr)); /* 6 */
      void (*tkUnixSetMenubar) _ANSI_ARGS_((Tk_Window tkwin, Tk_Window menubar)); /* 7 */
+     int (*tkpTestembedCmd) _ANSI_ARGS_((ClientData clientdata, Tcl_Interp * interp, int argc, char ** argv)); /* 8 */
  #endif /* UNIX */
  #ifdef __WIN32__
      char * (*tkAlignImageData) _ANSI_ARGS_((XImage * image, int alignment, int bitOrder)); /* 0 */
***************
*** 341,346 ****
--- 351,357 ----
      void (*tkWinDialogDebug) _ANSI_ARGS_((int debug)); /* 31 */
      Tcl_Obj * (*tkWinGetMenuSystemDefault) _ANSI_ARGS_((Tk_Window tkwin, char * dbName, char * className)); /* 32 */
      int (*tkWinGetPlatformId) _ANSI_ARGS_((void)); /* 33 */
+     int (*tkpTestembedCmd) _ANSI_ARGS_((ClientData clietdata, Tcl_Interp * interp, int argc, char ** argv)); /* 34 */
  #endif /* __WIN32__ */
  #ifdef MAC_TCL
      void (*tkGenerateActivateEvents) _ANSI_ARGS_((TkWindow * winPtr, int active)); /* 0 */
***************
*** 408,413 ****
--- 419,425 ----
      Tk_Window (*tk_TopCoordsToWindow) _ANSI_ARGS_((Tk_Window tkwin, int rootX, int rootY, int * newX, int * newY)); /* 62 */
      MacDrawable * (*tkMacContainerId) _ANSI_ARGS_((TkWindow * winPtr)); /* 63 */
      MacDrawable * (*tkMacGetHostToplevel) _ANSI_ARGS_((TkWindow * winPtr)); /* 64 */
+     int (*tkpTestembedCmd) _ANSI_ARGS_((ClientData clietdata, Tcl_Interp * interp, int argc, char ** argv)); /* 65 */
  #endif /* MAC_TCL */
  } TkIntPlatStubs;
  
***************
*** 458,463 ****
--- 470,479 ----
  #define TkUnixSetMenubar \
  	(tkIntPlatStubsPtr->tkUnixSetMenubar) /* 7 */
  #endif
+ #ifndef TkpTestembedCmd
+ #define TkpTestembedCmd \
+ 	(tkIntPlatStubsPtr->tkpTestembedCmd) /* 8 */
+ #endif
  #endif /* UNIX */
  #ifdef __WIN32__
  #ifndef TkAlignImageData
***************
*** 593,598 ****
--- 609,618 ----
  #define TkWinGetPlatformId \
  	(tkIntPlatStubsPtr->tkWinGetPlatformId) /* 33 */
  #endif
+ #ifndef TkpTestembedCmd
+ #define TkpTestembedCmd \
+ 	(tkIntPlatStubsPtr->tkpTestembedCmd) /* 34 */
+ #endif
  #endif /* __WIN32__ */
  #ifdef MAC_TCL
  #ifndef TkGenerateActivateEvents
***************
*** 824,829 ****
--- 844,853 ----
  #ifndef TkMacGetHostToplevel
  #define TkMacGetHostToplevel \
  	(tkIntPlatStubsPtr->tkMacGetHostToplevel) /* 64 */
+ #endif
+ #ifndef TkpTestembedCmd
+ #define TkpTestembedCmd \
+ 	(tkIntPlatStubsPtr->tkpTestembedCmd) /* 65 */
  #endif
  #endif /* MAC_TCL */
  
*** generic/tkMain.c.orig	Wed Apr 28 20:18:06 1999
--- generic/tkMain.c	Fri Sep 24 21:25:41 1999
***************
*** 57,64 ****
  extern int		isatty _ANSI_ARGS_((int fd));
  extern char *		strrchr _ANSI_ARGS_((CONST char *string, int c));
  #endif
! extern void		TkpDisplayWarning _ANSI_ARGS_((char *msg,
! 			    char *title));
  
  /*
   * Forward declarations for procedures defined later in this file.
--- 57,64 ----
  extern int		isatty _ANSI_ARGS_((int fd));
  extern char *		strrchr _ANSI_ARGS_((CONST char *string, int c));
  #endif
! extern void		TkpDisplayWarning _ANSI_ARGS_((CONST char *msg,
! 			    CONST char *title));
  
  /*
   * Forward declarations for procedures defined later in this file.
***************
*** 407,412 ****
--- 407,413 ----
  	partial ? "tcl_prompt2" : "tcl_prompt1", TCL_GLOBAL_ONLY);
      if (promptCmd == NULL) {
  defaultPrompt:
+ 	outChannel = Tcl_GetChannel(interp, "stdout", NULL);
  	if (!partial) {
  
              /*
***************
*** 415,427 ****
               * this interpreter with "interp transfer".
               */
  
- 	    outChannel = Tcl_GetChannel(interp, "stdout", NULL);
              if (outChannel != (Tcl_Channel) NULL) {
                  Tcl_WriteChars(outChannel, "% ", 2);
              }
  	}
      } else {
  	code = Tcl_Eval(interp, promptCmd);
  	if (code != TCL_OK) {
  	    Tcl_AddErrorInfo(interp,
  		    "\n    (script that generates prompt)");
--- 416,428 ----
               * this interpreter with "interp transfer".
               */
  
              if (outChannel != (Tcl_Channel) NULL) {
                  Tcl_WriteChars(outChannel, "% ", 2);
              }
  	}
      } else {
  	code = Tcl_Eval(interp, promptCmd);
+ 	outChannel = Tcl_GetChannel(interp, "stdout", NULL);
  	if (code != TCL_OK) {
  	    Tcl_AddErrorInfo(interp,
  		    "\n    (script that generates prompt)");
***************
*** 437,442 ****
--- 438,445 ----
                  Tcl_WriteChars(errChannel, "\n", 1);
              }
  	    goto defaultPrompt;
+ 	} else if (*Tcl_GetStringResult(interp) && outChannel) {
+ 	    Tcl_Write(outChannel, Tcl_GetStringResult(interp), -1);
  	}
      }
      outChannel = Tcl_GetChannel(interp, "stdout", NULL);
*** generic/tkScale.c.orig	Wed Apr 21 23:53:27 1999
--- generic/tkScale.c	Fri Sep 24 21:25:41 1999
***************
*** 24,30 ****
--- 24,34 ----
  #include "tkPort.h"
  #include "default.h"
  #include "tkInt.h"
+ #ifdef MAC_TCL
  #include "tclMath.h"
+ #else
+ #include <math.h>
+ #endif
  #include "tkScale.h"
  
  /*
*** generic/tkSquare.c.orig	Fri Apr 16 03:51:22 1999
--- generic/tkSquare.c	Fri Sep 24 21:25:41 1999
***************
*** 15,25 ****
--- 15,42 ----
   * RCS: @(#) $Id: tkSquare.c,v 1.3 1999/04/16 01:51:22 stanton Exp $
   */
  
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+ 
  #include "tkPort.h"
  #define __NO_OLD_CONFIG
  #include "tk.h"
  #include "tkInt.h"
  
+ #ifdef __cplusplus
+ }
+ #endif
+ 
+ /*
+  * TCL_STORAGE_CLASS is set unconditionally to DLLEXPORT because the
+  * Tksquare_Init declaration is in the source file itself, which is only
+  * accessed when we are building a library.
+  */
+ 
+ #undef TCL_STORAGE_CLASS
+ #define TCL_STORAGE_CLASS DLLEXPORT
+ 
  /*
   * A data structure of the following type is kept for each square
   * widget managed by this file:
***************
*** 107,112 ****
--- 124,178 ----
  static int		SquareWidgetCmd _ANSI_ARGS_((ClientData clientData,
  			    Tcl_Interp *, int objc, Tcl_Obj * CONST objv[]));
  
+ /*
+  *----------------------------------------------------------------------
+  *
+  * Tksquare_Init --
+  *
+  *	This procedure performs intialization for the Tk square
+  *	exension.
+  *
+  * Results:
+  *	Returns a standard Tcl completion code, and leaves an error
+  *	message in interp->result if an error occurs.
+  *
+  * Side effects:
+  *	Creates several test commands.
+  *
+  *----------------------------------------------------------------------
+  */
+ 
+ EXTERN Tksquare_Init _ANSI_ARGS_((Tcl_Interp *interp));
+ 
+ int
+ #ifdef _USING_PROTOTYPES_
+ Tksquare_Init (
+     Tcl_Interp *interp)		/* Interpreter for application. */
+ #else
+ Tksquare_Init(interp)
+     Tcl_Interp *interp;		/* Interpreter for application. */
+ #endif
+ {
+     /*
+      * Create the square command.
+      */
+ 
+     if (Tcl_InitStubs(interp, TCL_VERSION, 1) == NULL) {
+ 	return TCL_ERROR;
+     }
+     if (Tk_InitStubs(interp, TK_VERSION, 1) == NULL) {
+ 	return TCL_ERROR;
+     }
+     if (Tcl_PkgProvide(interp, "Tksquare", TK_VERSION) != TCL_OK) {
+ 	return TCL_ERROR;
+     }
+ 
+     Tcl_CreateObjCommand(interp, "square", SquareObjCmd,
+ 	    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ 
+     return TCL_OK;
+ }
+ 
  /*
   *--------------------------------------------------------------
   *
*** generic/tkStubInit.c.orig	Tue Aug 10 20:14:57 1999
--- generic/tkStubInit.c	Fri Sep 24 21:25:41 1999
***************
*** 339,344 ****
--- 339,350 ----
  #endif /* MAC_TCL */
      TkpDrawHighlightBorder, /* 135 */
      TkSetFocusWin, /* 136 */
+     TkTextGetIndex, /* 137 */
+     TkTextIndexBackBytes, /* 138 */
+     TkTextIndexForwBytes, /* 139 */
+     TkTextMakeByteIndex, /* 140 */
+     TkTextPrintIndex, /* 141 */
+     TkTextSetMark, /* 142 */
  };
  
  TkIntPlatStubs tkIntPlatStubs = {
***************
*** 353,358 ****
--- 359,365 ----
      TkUnixContainerId, /* 5 */
      TkUnixDoOneXEvent, /* 6 */
      TkUnixSetMenubar, /* 7 */
+     TkpTestembedCmd, /* 8 */
  #endif /* UNIX */
  #ifdef __WIN32__
      TkAlignImageData, /* 0 */
***************
*** 389,394 ****
--- 396,402 ----
      TkWinDialogDebug, /* 31 */
      TkWinGetMenuSystemDefault, /* 32 */
      TkWinGetPlatformId, /* 33 */
+     TkpTestembedCmd, /* 34 */
  #endif /* __WIN32__ */
  #ifdef MAC_TCL
      TkGenerateActivateEvents, /* 0 */
***************
*** 456,461 ****
--- 464,470 ----
      Tk_TopCoordsToWindow, /* 62 */
      TkMacContainerId, /* 63 */
      TkMacGetHostToplevel, /* 64 */
+     TkpTestembedCmd, /* 65 */
  #endif /* MAC_TCL */
  };
  
*** generic/tkTest.c.orig	Wed Jun 16 22:11:29 1999
--- generic/tkTest.c	Fri Sep 24 21:25:41 1999
***************
*** 15,27 ****
   *
   * RCS: @(#) $Id: tkTest.c,v 1.6 1999/06/16 20:11:29 surles Exp $
   */
! 
  #include "tkInt.h"
  #include "tkPort.h"
- #include "tkText.h"
  
  #ifdef __WIN32__
  #include "tkWinInt.h"
  #endif
  
  #ifdef MAC_TCL
--- 15,28 ----
   *
   * RCS: @(#) $Id: tkTest.c,v 1.6 1999/06/16 20:11:29 surles Exp $
   */
! #include "tk.h"
! #include "tkText.h"
  #include "tkInt.h"
  #include "tkPort.h"
  
  #ifdef __WIN32__
  #include "tkWinInt.h"
+ #include "tkScrollbar.h"
  #endif
  
  #ifdef MAC_TCL
***************
*** 33,38 ****
--- 34,56 ----
  #endif
  
  /*
+  * TCL_STORAGE_CLASS is set unconditionally to DLLEXPORT because the
+  * Tktest_Init declaration is in the source file itself, which is only
+  * accessed when we are building a library.
+  */
+ 
+ #undef TCL_STORAGE_CLASS
+ #define TCL_STORAGE_CLASS DLLEXPORT
+ 
+ #ifdef __cplusplus
+ }
+ #define dummy  /* */
+ #define dummy2 /* */
+ #define dummy3 /* */
+ #define dummy4 /* */
+ #endif
+ 
+ /*
   * The following data structure represents the master for a test
   * image:
   */
***************
*** 97,116 ****
      struct NewApp *nextPtr;	/* Next in list of new interpreters. */
  } NewApp;
  
! static NewApp *newAppPtr = NULL;
  				/* First in list of all new interpreters. */
  
- /*
-  * Declaration for the square widget's class command procedure:
-  */
- 
- extern int SquareObjCmd _ANSI_ARGS_((ClientData clientData,
- 	Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
  
  typedef struct CBinding {
      Tcl_Interp *interp;
      char *command;
!     char *delete;
  } CBinding;
  
  /*
--- 115,128 ----
      struct NewApp *nextPtr;	/* Next in list of new interpreters. */
  } NewApp;
  
! static NewApp *newAppPtr = (NewApp *) NULL;
  				/* First in list of all new interpreters. */
  
  
  typedef struct CBinding {
      Tcl_Interp *interp;
      char *command;
!     char *del;
  } CBinding;
  
  /*
***************
*** 147,153 ****
  			    Tcl_Interp *interp, XEvent *eventPtr,
  			    Tk_Window tkwin, KeySym keySym));
  static void		CBindingFreeProc _ANSI_ARGS_((ClientData clientData));
! int			Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
  static int		ImageCmd _ANSI_ARGS_((ClientData dummy,
  			    Tcl_Interp *interp, int argc, char **argv));
  static int		TestcbindCmd _ANSI_ARGS_((ClientData dummy,
--- 159,165 ----
  			    Tcl_Interp *interp, XEvent *eventPtr,
  			    Tk_Window tkwin, KeySym keySym));
  static void		CBindingFreeProc _ANSI_ARGS_((ClientData clientData));
! EXTERN int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
  static int		ImageCmd _ANSI_ARGS_((ClientData dummy,
  			    Tcl_Interp *interp, int argc, char **argv));
  static int		TestcbindCmd _ANSI_ARGS_((ClientData dummy,
***************
*** 165,171 ****
  			    Tcl_Interp *interp, int objc,
  			    Tcl_Obj * CONST objv[]));
  static int		TestdeleteappsCmd _ANSI_ARGS_((ClientData dummy,
! 			    Tcl_Interp *interp, int argc, char **argv));
  static int		TestfontObjCmd _ANSI_ARGS_((ClientData dummy,
  			    Tcl_Interp *interp, int objc,
  			    Tcl_Obj *CONST objv[]));
--- 177,184 ----
  			    Tcl_Interp *interp, int objc,
  			    Tcl_Obj * CONST objv[]));
  static int		TestdeleteappsCmd _ANSI_ARGS_((ClientData dummy,
! 			    Tcl_Interp *interp, int objc,
! 			    Tcl_Obj * CONST objv[]));
  static int		TestfontObjCmd _ANSI_ARGS_((ClientData dummy,
  			    Tcl_Interp *interp, int objc,
  			    Tcl_Obj *CONST objv[]));
***************
*** 181,194 ****
  			    Tcl_Interp *interp, int objc,
  			    Tcl_Obj * CONST objv[]));
  static int		TestpropCmd _ANSI_ARGS_((ClientData dummy,
! 			    Tcl_Interp *interp, int argc, char **argv));
  static int		TestsendCmd _ANSI_ARGS_((ClientData dummy,
  			    Tcl_Interp *interp, int argc, char **argv));
  static int		TesttextCmd _ANSI_ARGS_((ClientData dummy,
  			    Tcl_Interp *interp, int argc, char **argv));
  #if !(defined(__WIN32__) || defined(MAC_TCL))
  static int		TestwrapperCmd _ANSI_ARGS_((ClientData dummy,
! 			    Tcl_Interp *interp, int argc, char **argv));
  #endif
  static void		TrivialCmdDeletedProc _ANSI_ARGS_((
  			    ClientData clientData));
--- 194,209 ----
  			    Tcl_Interp *interp, int objc,
  			    Tcl_Obj * CONST objv[]));
  static int		TestpropCmd _ANSI_ARGS_((ClientData dummy,
! 			    Tcl_Interp *interp, int objc,
! 			    Tcl_Obj * CONST objv[]));
  static int		TestsendCmd _ANSI_ARGS_((ClientData dummy,
  			    Tcl_Interp *interp, int argc, char **argv));
  static int		TesttextCmd _ANSI_ARGS_((ClientData dummy,
  			    Tcl_Interp *interp, int argc, char **argv));
  #if !(defined(__WIN32__) || defined(MAC_TCL))
  static int		TestwrapperCmd _ANSI_ARGS_((ClientData dummy,
! 			    Tcl_Interp *interp, int objc,
! 			    Tcl_Obj * CONST objv[]));
  #endif
  static void		TrivialCmdDeletedProc _ANSI_ARGS_((
  			    ClientData clientData));
***************
*** 202,213 ****
   * External (platform specific) initialization routine:
   */
  
- extern int		TkplatformtestInit _ANSI_ARGS_((
- 			    Tcl_Interp *interp));
- extern int              TclThread_Init _ANSI_ARGS_((Tcl_Interp *interp));
- 
  #if !(defined(__WIN32__) && defined(MAC_TCL))
  #define TkplatformtestInit(x) TCL_OK
  #endif
  
  /*
--- 217,227 ----
   * External (platform specific) initialization routine:
   */
  
  #if !(defined(__WIN32__) && defined(MAC_TCL))
  #define TkplatformtestInit(x) TCL_OK
+ #else
+ extern int		TkplatformtestInit _ANSI_ARGS_((
+ 			    Tcl_Interp *interp));
  #endif
  
  /*
***************
*** 229,236 ****
--- 243,255 ----
   */
  
  int
+ #ifdef _USING_PROTOTYPES_
+ Tktest_Init (
+     Tcl_Interp *interp)		/* Interpreter for application. */
+ #else
  Tktest_Init(interp)
      Tcl_Interp *interp;		/* Interpreter for application. */
+ #endif
  {
      static int initialized = 0;
  
***************
*** 238,249 ****
       * Create additional commands for testing Tk.
       */
  
      if (Tcl_PkgProvide(interp, "Tktest", TK_VERSION) == TCL_ERROR) {
          return TCL_ERROR;
      }
  
-     Tcl_CreateObjCommand(interp, "square", SquareObjCmd,
- 	    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
      Tcl_CreateCommand(interp, "testcbind", TestcbindCmd,
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
      Tcl_CreateObjCommand(interp, "testbitmap", TestbitmapObjCmd,
--- 257,272 ----
       * Create additional commands for testing Tk.
       */
  
+     if (Tcl_InitStubs(interp, TCL_VERSION, 1) == NULL) {
+ 	return TCL_ERROR;
+     }
+     if (Tk_InitStubs(interp, TK_VERSION, 1) == NULL) {
+ 	return TCL_ERROR;
+     }
      if (Tcl_PkgProvide(interp, "Tktest", TK_VERSION) == TCL_ERROR) {
          return TCL_ERROR;
      }
  
      Tcl_CreateCommand(interp, "testcbind", TestcbindCmd,
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
      Tcl_CreateObjCommand(interp, "testbitmap", TestbitmapObjCmd,
***************
*** 254,260 ****
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
      Tcl_CreateObjCommand(interp, "testcursor", TestcursorObjCmd,
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
!     Tcl_CreateCommand(interp, "testdeleteapps", TestdeleteappsCmd,
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
      Tcl_CreateCommand(interp, "testembed", TkpTestembedCmd,
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
--- 277,283 ----
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
      Tcl_CreateObjCommand(interp, "testcursor", TestcursorObjCmd,
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
!     Tcl_CreateObjCommand(interp, "testdeleteapps", TestdeleteappsCmd,
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
      Tcl_CreateCommand(interp, "testembed", TkpTestembedCmd,
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
***************
*** 270,291 ****
      Tcl_CreateCommand(interp, "testmetrics", TestmetricsCmd,
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
  #endif
!     Tcl_CreateCommand(interp, "testprop", TestpropCmd,
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
      Tcl_CreateCommand(interp, "testsend", TestsendCmd,
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
      Tcl_CreateCommand(interp, "testtext", TesttextCmd,
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
  #if !(defined(__WIN32__) || defined(MAC_TCL))
!     Tcl_CreateCommand(interp, "testwrapper", TestwrapperCmd,
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
  #endif
- 
- #ifdef TCL_THREADS
-     if (TclThread_Init(interp) != TCL_OK) {
- 	return TCL_ERROR;
-     }
- #endif
      
      /*
       * Create test image type.
--- 293,308 ----
      Tcl_CreateCommand(interp, "testmetrics", TestmetricsCmd,
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
  #endif
!     Tcl_CreateObjCommand(interp, "testprop", TestpropCmd,
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
      Tcl_CreateCommand(interp, "testsend", TestsendCmd,
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
      Tcl_CreateCommand(interp, "testtext", TesttextCmd,
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
  #if !(defined(__WIN32__) || defined(MAC_TCL))
!     Tcl_CreateObjCommand(interp, "testwrapper", TestwrapperCmd,
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
  #endif
      
      /*
       * Create test image type.
***************
*** 321,331 ****
--- 338,356 ----
   */
  
  static int
+ #ifdef _USING_PROTOTYPES_
+ TestcbindCmd (
+     ClientData clientData,		/* Main window for application. */
+     Tcl_Interp *interp,			/* Current interpreter. */
+     int argc,				/* Number of arguments. */
+     char **argv)			/* Argument strings. */
+ #else
  TestcbindCmd(clientData, interp, argc, argv)
      ClientData clientData;		/* Main window for application. */
      Tcl_Interp *interp;			/* Current interpreter. */
      int argc;				/* Number of arguments. */
      char **argv;			/* Argument strings. */
+ #endif
  {
      TkWindow *winPtr;
      Tk_Window tkwin;
***************
*** 362,370 ****
      cbindPtr->command =
  	    strcpy((char *) ckalloc(strlen(argv[3]) + 1), argv[3]);
      if (argc == 4) {
! 	cbindPtr->delete = NULL;
      } else {
! 	cbindPtr->delete =
  		strcpy((char *) ckalloc(strlen(argv[4]) + 1), argv[4]);
      }
  
--- 387,395 ----
      cbindPtr->command =
  	    strcpy((char *) ckalloc(strlen(argv[3]) + 1), argv[3]);
      if (argc == 4) {
! 	cbindPtr->del = NULL;
      } else {
! 	cbindPtr->del =
  		strcpy((char *) ckalloc(strlen(argv[4]) + 1), argv[4]);
      }
  
***************
*** 372,379 ****
  	    object, argv[2], CBindingEvalProc, CBindingFreeProc,
  	    (ClientData) cbindPtr) == 0) {
  	ckfree((char *) cbindPtr->command);
! 	if (cbindPtr->delete != NULL) {
! 	    ckfree((char *) cbindPtr->delete);
  	}
  	ckfree((char *) cbindPtr);
  	return TCL_ERROR;
--- 397,404 ----
  	    object, argv[2], CBindingEvalProc, CBindingFreeProc,
  	    (ClientData) cbindPtr) == 0) {
  	ckfree((char *) cbindPtr->command);
! 	if (cbindPtr->del != NULL) {
! 	    ckfree((char *) cbindPtr->del);
  	}
  	ckfree((char *) cbindPtr);
  	return TCL_ERROR;
***************
*** 382,393 ****
  }
  
  static int
! CBindingEvalProc(clientData, interp, eventPtr, tkwin, keySym)
      ClientData clientData;
      Tcl_Interp *interp;
!     XEvent *eventPtr;
!     Tk_Window tkwin;
!     KeySym keySym;
  {
      CBinding *cbindPtr;
  
--- 407,427 ----
  }
  
  static int
! #ifdef _USING_PROTOTYPES_
! CBindingEvalProc (
!     ClientData clientData,
!     Tcl_Interp *interp,
!     XEvent *dummy,
!     Tk_Window dummy2,
!     KeySym dummy3)
! #else
! CBindingEvalProc(clientData, interp, dummy, dummy2, dummy3)
      ClientData clientData;
      Tcl_Interp *interp;
!     XEvent *dummy;
!     Tk_Window dummy2;
!     KeySym dummy3;
! #endif
  {
      CBinding *cbindPtr;
  
***************
*** 397,410 ****
  }
  
  static void
  CBindingFreeProc(clientData)
      ClientData clientData;
  {
      CBinding *cbindPtr = (CBinding *) clientData;
      
!     if (cbindPtr->delete != NULL) {
! 	Tcl_GlobalEval(cbindPtr->interp, cbindPtr->delete);
! 	ckfree((char *) cbindPtr->delete);
      }
      ckfree((char *) cbindPtr->command);
      ckfree((char *) cbindPtr);
--- 431,449 ----
  }
  
  static void
+ #ifdef _USING_PROTOTYPES_
+ CBindingFreeProc (
+     ClientData clientData)
+ #else
  CBindingFreeProc(clientData)
      ClientData clientData;
+ #endif
  {
      CBinding *cbindPtr = (CBinding *) clientData;
      
!     if (cbindPtr->del != NULL) {
! 	Tcl_GlobalEval(cbindPtr->interp, cbindPtr->del);
! 	ckfree((char *) cbindPtr->del);
      }
      ckfree((char *) cbindPtr->command);
      ckfree((char *) cbindPtr);
***************
*** 429,439 ****
--- 468,486 ----
  
  	/* ARGSUSED */
  static int
+ #ifdef _USING_PROTOTYPES_
+ TestbitmapObjCmd (
+     ClientData clientData,	/* Main window for application. */
+     Tcl_Interp *interp,		/* Current interpreter. */
+     int objc,			/* Number of arguments. */
+     Tcl_Obj *CONST objv[])	/* Argument objects. */
+ #else
  TestbitmapObjCmd(clientData, interp, objc, objv)
      ClientData clientData;	/* Main window for application. */
      Tcl_Interp *interp;		/* Current interpreter. */
      int objc;			/* Number of arguments. */
      Tcl_Obj *CONST objv[];	/* Argument objects. */
+ #endif
  {
  
      if (objc < 2) {
***************
*** 464,474 ****
--- 511,529 ----
  
  	/* ARGSUSED */
  static int
+ #ifdef _USING_PROTOTYPES_
+ TestborderObjCmd (
+     ClientData clientData,	/* Main window for application. */
+     Tcl_Interp *interp,		/* Current interpreter. */
+     int objc,			/* Number of arguments. */
+     Tcl_Obj *CONST objv[])	/* Argument objects. */
+ #else
  TestborderObjCmd(clientData, interp, objc, objv)
      ClientData clientData;	/* Main window for application. */
      Tcl_Interp *interp;		/* Current interpreter. */
      int objc;			/* Number of arguments. */
      Tcl_Obj *CONST objv[];	/* Argument objects. */
+ #endif
  {
  
      if (objc < 2) {
***************
*** 499,509 ****
--- 554,572 ----
  
  	/* ARGSUSED */
  static int
+ #ifdef _USING_PROTOTYPES_
+ TestcolorObjCmd (
+     ClientData clientData,	/* Main window for application. */
+     Tcl_Interp *interp,		/* Current interpreter. */
+     int objc,			/* Number of arguments. */
+     Tcl_Obj *CONST objv[])	/* Argument objects. */
+ #else
  TestcolorObjCmd(clientData, interp, objc, objv)
      ClientData clientData;	/* Main window for application. */
      Tcl_Interp *interp;		/* Current interpreter. */
      int objc;			/* Number of arguments. */
      Tcl_Obj *CONST objv[];	/* Argument objects. */
+ #endif
  {
  
      if (objc < 2) {
***************
*** 534,544 ****
--- 597,615 ----
  
  	/* ARGSUSED */
  static int
+ #ifdef _USING_PROTOTYPES_
+ TestcursorObjCmd (
+     ClientData clientData,	/* Main window for application. */
+     Tcl_Interp *interp,		/* Current interpreter. */
+     int objc,			/* Number of arguments. */
+     Tcl_Obj *CONST objv[])	/* Argument objects. */
+ #else
  TestcursorObjCmd(clientData, interp, objc, objv)
      ClientData clientData;	/* Main window for application. */
      Tcl_Interp *interp;		/* Current interpreter. */
      int objc;			/* Number of arguments. */
      Tcl_Obj *CONST objv[];	/* Argument objects. */
+ #endif
  {
  
      if (objc < 2) {
***************
*** 570,580 ****
  
  	/* ARGSUSED */
  static int
! TestdeleteappsCmd(clientData, interp, argc, argv)
!     ClientData clientData;		/* Main window for application. */
!     Tcl_Interp *interp;			/* Current interpreter. */
!     int argc;				/* Number of arguments. */
!     char **argv;			/* Argument strings. */
  {
      NewApp *nextPtr;
  
--- 641,659 ----
  
  	/* ARGSUSED */
  static int
! #ifdef _USING_PROTOTYPES_
! TestdeleteappsCmd (
!     ClientData dummy,			/* Main window for application. */
!     Tcl_Interp *dummy2,			/* Current interpreter. */
!     int dummy3,				/* Number of arguments. */
!     Tcl_Obj *CONST dummy4[])		/* Argument strings. */
! #else
! TestdeleteappsCmd(dummy, dummy2, dummy3, dummy4)
!     ClientData dummy;			/* Main window for application. */
!     Tcl_Interp *dummy2;			/* Current interpreter. */
!     int dummy3;				/* Number of arguments. */
!     Tcl_Obj *CONST *dummy4[];		/* Argument strings. */
! #endif
  {
      NewApp *nextPtr;
  
***************
*** 1579,1585 ****
  	if (strcmp(argv[i], "-variable") != 0) {
  	    Tcl_AppendResult(interp, "bad option name \"", argv[i],
  		    "\"", (char *) NULL);
- 	    return TCL_ERROR;
  	}
  	if ((i+1) == argc) {
  	    Tcl_AppendResult(interp, "no value given for \"", argv[i],
--- 1658,1663 ----
***************
*** 1660,1665 ****
--- 1738,1745 ----
  		"\": must be changed", (char *) NULL);
  	return TCL_ERROR;
      }
+     Tk_ImageChanged(timPtr->master, x, y, width, height, timPtr->width,
+ 	    timPtr->height);
      return TCL_OK;
  }
  
***************
*** 1682,1691 ****
--- 1762,1778 ----
   */
  
  static ClientData
+ #ifdef _USING_PROTOTYPES_
+ ImageGet (
+     Tk_Window tkwin,		/* Token for window in which image will
+ 				 * be used. */
+     ClientData clientData)	/* Pointer to TImageMaster for image. */
+ #else
  ImageGet(tkwin, clientData)
      Tk_Window tkwin;		/* Token for window in which image will
  				 * be used. */
      ClientData clientData;	/* Pointer to TImageMaster for image. */
+ #endif
  {
      TImageMaster *timPtr = (TImageMaster *) clientData;
      TImageInstance *instPtr;
***************
*** 1723,1728 ****
--- 1810,1826 ----
   */
  
  static void
+ #ifdef _USING_PROTOTYPES_
+ ImageDisplay (
+     ClientData clientData,	/* Pointer to TImageInstance for image. */
+     Display *display,		/* Display to use for drawing. */
+     Drawable drawable,		/* Where to redraw image. */
+     int imageX, int imageY,	/* Origin of area to redraw, relative to
+ 				 * origin of image. */
+     int width, int height,	/* Dimensions of area to redraw. */
+     int drawableX,		/* Coordinates in drawable corresponding to */
+     int drawableY)		/* imageX and imageY. */
+ #else
  ImageDisplay(clientData, display, drawable, imageX, imageY, width, height,
  	drawableX, drawableY)
      ClientData clientData;	/* Pointer to TImageInstance for image. */
***************
*** 1733,1738 ****
--- 1831,1837 ----
      int width, height;		/* Dimensions of area to redraw. */
      int drawableX, drawableY;	/* Coordinates in drawable corresponding to
  				 * imageX and imageY. */
+ #endif
  {
      TImageInstance *instPtr = (TImageInstance *) clientData;
      char buffer[200 + TCL_INTEGER_SPACE * 6];
***************
*** 1775,1783 ****
--- 1874,1888 ----
   */
  
  static void
+ #ifdef _USING_PROTOTYPES_
+ ImageFree (
+     ClientData clientData,	/* Pointer to TImageInstance for instance. */
+     Display *display)		/* Display where image was to be drawn. */
+ #else
  ImageFree(clientData, display)
      ClientData clientData;	/* Pointer to TImageInstance for instance. */
      Display *display;		/* Display where image was to be drawn. */
+ #endif
  {
      TImageInstance *instPtr = (TImageInstance *) clientData;
      char buffer[200];
***************
*** 1808,1817 ****
--- 1913,1929 ----
   */
  
  static void
+ #ifdef _USING_PROTOTYPES_
+ ImageDelete (
+     ClientData clientData)	/* Pointer to TImageMaster for image.  When
+ 				 * this procedure is called, no more
+ 				 * instances exist. */
+ #else
  ImageDelete(clientData)
      ClientData clientData;	/* Pointer to TImageMaster for image.  When
  				 * this procedure is called, no more
  				 * instances exist. */
+ #endif
  {
      TImageMaster *timPtr = (TImageMaster *) clientData;
      char buffer[100];
***************
*** 2040,2050 ****
  
  	/* ARGSUSED */
  static int
  TestpropCmd(clientData, interp, argc, argv)
      ClientData clientData;		/* Main window for application. */
      Tcl_Interp *interp;			/* Current interpreter. */
      int argc;				/* Number of arguments. */
!     char **argv;			/* Argument strings. */
  {
      Tk_Window mainWin = (Tk_Window) clientData;
      int result, actualFormat;
--- 2152,2170 ----
  
  	/* ARGSUSED */
  static int
+ #ifdef _USING_PROTOTYPES_
+ TestpropCmd (
+     ClientData clientData,		/* Main window for application. */
+     Tcl_Interp *interp,			/* Current interpreter. */
+     int argc,				/* Number of arguments. */
+     Tcl_Obj *CONST argv[])		/* Argument objects. */
+ #else
  TestpropCmd(clientData, interp, argc, argv)
      ClientData clientData;		/* Main window for application. */
      Tcl_Interp *interp;			/* Current interpreter. */
      int argc;				/* Number of arguments. */
!     Tcl_Obj *CONST argv[];		/* Argument objects. */
! #endif
  {
      Tk_Window mainWin = (Tk_Window) clientData;
      int result, actualFormat;
***************
*** 2055,2067 ****
      char buffer[30];
  
      if (argc != 3) {
! 	Tcl_AppendResult(interp, "wrong # args;  must be \"", argv[0],
  		" window property\"", (char *) NULL);
  	return TCL_ERROR;
      }
  
!     w = strtoul(argv[1], &end, 0);
!     propName = Tk_InternAtom(mainWin, argv[2]);
      property = NULL;
      result = XGetWindowProperty(Tk_Display(mainWin),
  	    w, propName, 0, 100000, False, AnyPropertyType,
--- 2175,2187 ----
      char buffer[30];
  
      if (argc != 3) {
! 	Tcl_AppendResult(interp, "wrong # args;  must be \"", Tcl_GetString(argv[0]),
  		" window property\"", (char *) NULL);
  	return TCL_ERROR;
      }
  
!     w = strtoul(Tcl_GetString(argv[1]), &end, 0);
!     propName = Tk_InternAtom(mainWin, Tcl_GetString(argv[2]));
      property = NULL;
      result = XGetWindowProperty(Tk_Display(mainWin),
  	    w, propName, 0, 100000, False, AnyPropertyType,
***************
*** 2307,2329 ****
  
  	/* ARGSUSED */
  static int
  TestwrapperCmd(clientData, interp, argc, argv)
      ClientData clientData;		/* Main window for application. */
      Tcl_Interp *interp;			/* Current interpreter. */
      int argc;				/* Number of arguments. */
!     char **argv;			/* Argument strings. */
  {
      TkWindow *winPtr, *wrapperPtr;
      Tk_Window tkwin;
  
      if (argc != 2) {
! 	Tcl_AppendResult(interp, "wrong # args;  must be \"", argv[0],
! 		" window\"", (char *) NULL);
  	return TCL_ERROR;
      }
      
      tkwin = (Tk_Window) clientData;
!     winPtr = (TkWindow *) Tk_NameToWindow(interp, argv[1], tkwin);
      if (winPtr == NULL) {
  	return TCL_ERROR;
      }
--- 2427,2456 ----
  
  	/* ARGSUSED */
  static int
+ #ifdef _USING_PROTOTYPES_
+ TestwrapperCmd (
+     ClientData clientData,		/* Main window for application. */
+     Tcl_Interp *interp,			/* Current interpreter. */
+     int argc,				/* Number of arguments. */
+     Tcl_Obj *CONST argv[])		/* Argument objects. */
+ #else
  TestwrapperCmd(clientData, interp, argc, argv)
      ClientData clientData;		/* Main window for application. */
      Tcl_Interp *interp;			/* Current interpreter. */
      int argc;				/* Number of arguments. */
!     Tcl_Obj *CONST argv[];		/* Argument strings. */
! #endif
  {
      TkWindow *winPtr, *wrapperPtr;
      Tk_Window tkwin;
  
      if (argc != 2) {
! 	Tcl_WrongNumArgs(interp, 1, argv, "window");
  	return TCL_ERROR;
      }
      
      tkwin = (Tk_Window) clientData;
!     winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetStringFromObj(argv[1], NULL), tkwin);
      if (winPtr == NULL) {
  	return TCL_ERROR;
      }
*** generic/tkText.h.orig	Thu Jun 17 21:58:00 1999
--- generic/tkText.h	Fri Sep 24 21:25:41 1999
***************
*** 30,36 ****
   * file:
   */
  
! typedef struct TkTextBTree *TkTextBTree;
  
  /*
   * The data structure below defines a single line of text (from newline
--- 30,36 ----
   * file:
   */
  
! typedef struct TkTextBTree_ *TkTextBTree;
  
  /*
   * The data structure below defines a single line of text (from newline
*** generic/tkWindow.c.orig	Wed Apr 21 23:53:28 1999
--- generic/tkWindow.c	Fri Sep 24 21:25:41 1999
***************
*** 21,26 ****
--- 21,29 ----
  #if !defined(__WIN32__) && !defined(MAC_TCL)
  #include "tkUnixInt.h"
  #endif
+ #if defined(__WIN32__)
+ #include "tkWinInt.h"
+ #endif
  
  
  typedef struct ThreadSpecificData {
***************
*** 155,160 ****
--- 158,166 ----
  #ifdef MAC_TCL
      {"unsupported1",	TkUnsupported1Cmd,	NULL,			1, 1},
  #endif
+ #if defined(TK_USE_INPUT_METHODS) && defined(I18N_IMPROVE)
+     {"imconfigure",	NULL,			Tk_ImconfigureObjCmd,	1, 1},
+ #endif /* TK_USE_INPUT_METHODS && I18N_IMPROVE */
      {(char *) NULL,	(int (*) _ANSI_ARGS_((ClientData, Tcl_Interp *, int, char **))) NULL, NULL, 0}
  };
  
***************
*** 209,214 ****
--- 215,229 ----
  			    char *name));
  static void		OpenIM _ANSI_ARGS_((TkDisplay *dispPtr));
  static void		UnlinkWindow _ANSI_ARGS_((TkWindow *winPtr));
+ #ifdef TK_USE_INPUT_METHODS
+ #ifdef I18N_IMPROVE
+ static Bool		CanInitiateIm _ANSI_ARGS_((char *locale));
+ static void		IMInstantiateCallback _ANSI_ARGS_ ((Display *display,
+ 				XPointer clientData, XPointer callData));
+ static void		IMDestroyCallback _ANSI_ARGS_ ((XIM im, XPointer clientData, 
+ 				XPointer callData));
+ #endif /* I18N_IMPROVE */
+ #endif /* TK_USE_INPUT_METHODS */
  
  /*
   *----------------------------------------------------------------------
***************
*** 1269,1275 ****
      TkBindDeadWindow(winPtr);
  #ifdef TK_USE_INPUT_METHODS
      if (winPtr->inputContext != NULL) {
! 	XDestroyIC(winPtr->inputContext);
      }
  #endif /* TK_USE_INPUT_METHODS */
      if (winPtr->tagPtr != NULL) {
--- 1284,1294 ----
      TkBindDeadWindow(winPtr);
  #ifdef TK_USE_INPUT_METHODS
      if (winPtr->inputContext != NULL) {
! #ifdef I18N_IMPROVE
! 	TkpDestroyIC(winPtr, 1);
! #else
!   	XDestroyIC(winPtr->inputContext);
! #endif /* I18N_IMPROVE */
      }
  #endif /* TK_USE_INPUT_METHODS */
      if (winPtr->tagPtr != NULL) {
***************
*** 2422,2427 ****
--- 2441,2603 ----
  {
      return ((TkWindow *) tkwin)->mainPtr->strictMotif;
  }
+ #ifdef TK_USE_INPUT_METHODS
+ #ifdef I18N_IMPROVE
+ 
+ static Bool
+ CanInitiateIm(locale)
+      char *locale;
+ {
+     static int inited = 0;
+     static Bool ret = False;
+     
+     if (inited == 0) {
+ 	char *curSpec = setlocale(LC_ALL, NULL);
+ 
+ 	inited = 1;
+ 
+ 	if (strcmp(locale, "C") == 0 ||
+ 	    strcmp(locale, "POSIX") == 0) {
+ 	    goto Checked;
+ 	}
+ 
+ 	/*
+ 	 * Ok I know, everyone of core Tcl/Tk developer hates this.
+ 	 * believe it or not, it must be needed to call
+ 	 * setlocale(3)/_Xsetlocale() VERY HERE. This is what the X
+ 	 * input method wants.
+ 	 * Note that X11's i18n implementation should be ONLY governed
+ 	 * by LC_CTYPE. This is clearly/explicitly specified in X11
+ 	 * documente Chapter 13. Thus, If there are some X11
+ 	 * implementation that need using LC_ALL to initialize i18n
+ 	 * subsystem, I won't care about such a X library.
+ 	 * But, we are still on edge of darkside. ctype(3) routines
+ 	 * are governed by LC_CTYPE.... Need to create "Locale
+ 	 * independent ctype libraries" for Tcl/Tk...
+ 	 *
+ 	 *	m-hirano
+ 	 */
+ 
+ 	/*
+ 	 * OK, First of all, setting WHOLE locale to "C".
+ 	 */
+ 	(void)setlocale(LC_ALL, "C");
+ 	if (setlocale(LC_CTYPE, locale) == NULL) {
+ 	    /*
+ 	     * Reset to old locale.
+ 	     */
+ 	    if (setlocale(LC_ALL, curSpec) == NULL) {
+ 		(void)setlocale(LC_ALL, "C");
+ 	    }
+ 	    goto Checked;
+ 	} else {
+ 	    /*
+ 	     * For insurance, reset LC_NUMERIC to "C" for Tcl numeric parsing.
+ 	     */
+ 	    (void)setlocale(LC_NUMERIC, "C");
+ 	}
+ 	if (XSupportsLocale() != True) {
+ 	    goto Checked;
+ 	}
+ 
+ 	ret = True;
+ 	/*
+ 	 * At last, Setting the locale modifiers.
+ 	 */
+ 	(void)XSetLocaleModifiers("");
+     }
+ 
+     Checked:
+     return ret;
+ }
+ 
+ /*
+  *----------------------------------------------------------------------
+  *
+  * IMInstantiateCallback
+  *
+  *	Whenever IM server become available, this function will be called.
+  *
+  * Results:
+  *	OpenIM() is called.
+  *
+  * Side effects:
+  *	None.
+  *
+  *----------------------------------------------------------------------
+  */
+ 
+ void
+ IMInstantiateCallback(display, clientData, callData)
+      Display *display;
+      XPointer clientData;
+      XPointer callData;
+ {
+     TkDisplay *dispPtr = (TkDisplay *)clientData;
+ 
+     if (display == dispPtr->display &&
+ 	dispPtr->inputMethod == NULL) {
+ 	OpenIM(dispPtr);
+     }
+ }
+ 
+ /*
+  *----------------------------------------------------------------------
+  *
+  * IMDestroyCallback
+  *
+  *	Whenever IM server stops the service, this function will be called.
+  *
+  * Results:
+  *	the XIM opened before is marked as unusable.
+  *
+  * Side effects:
+  *	XIC using this XIM will be useless.
+  *
+  *----------------------------------------------------------------------
+  */
+ void
+ IMDestroyCallback(im, clientData, callData)
+      XIM im;
+      XPointer clientData;
+      XPointer callData;
+ {
+     TkDisplay *dispPtr = (TkDisplay *)clientData;
+     if (im == dispPtr->inputMethod) {
+ 	Tcl_HashTable winTable = dispPtr->winTable;
+ 	Tcl_HashEntry *entry = NULL;
+ 	Tcl_HashSearch search;
+ 	TkWindow *winPtr;
+ 
+ 	/*
+ 	 * We must not call XCloseIM() or XDestroyIC().
+ 	 * because the XIM and XIC are destroyed by Xlib 
+ 	 * automatically.
+ 	 */
+ 	for (entry = Tcl_FirstHashEntry(&winTable, &search); entry != NULL;
+ 	     entry = Tcl_NextHashEntry(&search)) {
+ 	    winPtr = (TkWindow *)Tcl_GetHashValue(entry);
+ 	    if (winPtr->dispPtr->display == dispPtr->display &&
+ 		winPtr->dispPtr->inputMethod == im &&
+ 		winPtr->inputContext != NULL) {
+ 		TkpDestroyIC(winPtr, 0);
+ 	    }
+ 	}
+ 	dispPtr->inputMethod = NULL;
+ 	dispPtr->lastFocusedIC = NULL;
+ #ifdef HAVE_XIMREGINSTCB
+ #ifdef NO_XIDPROC
+ 	XRegisterIMInstantiateCallback(dispPtr->display, NULL, NULL, NULL,
+ 				       (XIMProc)IMInstantiateCallback, (XPointer *)dispPtr);
+ #else
+ 	XRegisterIMInstantiateCallback(dispPtr->display, NULL, NULL, NULL,
+ 				       (XIDProc)IMInstantiateCallback, (XPointer)dispPtr);
+ #endif /* NO_XIDPROC */
+ #endif /* HAVE_XIMREGINSTCB */
+     }
+ }
+ #endif /* I18N_IMPROVE */
+ #endif /* TK_USE_INPUT_METHODS */
  
  /* 
   *--------------------------------------------------------------
***************
*** 2452,2459 ****
--- 2628,2668 ----
      unsigned short i;
      XIMStyles *stylePtr;
  
+ #ifdef I18N_IMPROVE
+     int styleFound = 0;
+     char *imLocale = NULL;
+     char *imEncoding = NULL;
+ 
+     dispPtr->inputMethod = NULL;
+     dispPtr->imEncoding = NULL;
+     dispPtr->lastFocusedIC = NULL;
+ 
+     TclpGetStartupLocaleEncoding(&imEncoding, &imLocale);
+     if (imEncoding == NULL || imEncoding[0] == '\0' ||
+ 	imLocale == NULL || imLocale[0] == '\0') {
+ 	return;
+     }
+     if (CanInitiateIm(imLocale) == False) {
+ 	return;
+     }
+ #endif /* I18N_IMPROVE */
      dispPtr->inputMethod = XOpenIM(dispPtr->display, NULL, NULL, NULL);
      if (dispPtr->inputMethod == NULL) {
+ #ifdef I18N_IMPROVE
+ #ifdef HAVE_XIMREGINSTCB
+ 	/*
+ 	 * Maybe no IM server is available rite now.
+ 	 * Try to register instatntiate callback.
+ 	 */
+ #ifdef NO_XIDPROC
+ 	XRegisterIMInstantiateCallback(dispPtr->display, NULL, NULL, NULL,
+ 				       (XIMProc)IMInstantiateCallback, (XPointer *)dispPtr);
+ #else
+ 	XRegisterIMInstantiateCallback(dispPtr->display, NULL, NULL, NULL,
+ 				       (XIDProc)IMInstantiateCallback, (XPointer)dispPtr);
+ #endif /* NO_XIDPROC */
+ #endif /* HAVE_XIMREGINSTCB */
+ #endif /* I18N_IMPROVE */
  	return;
      }
  
***************
*** 2464,2474 ****
      for (i = 0; i < stylePtr->count_styles; i++) {
  	if (stylePtr->supported_styles[i]
  		== (XIMPreeditNothing|XIMStatusNothing)) {
! 	    XFree(stylePtr);
! 	    return;
  	}
      }
      XFree(stylePtr);
  
      error:
  
--- 2673,2702 ----
      for (i = 0; i < stylePtr->count_styles; i++) {
  	if (stylePtr->supported_styles[i]
  		== (XIMPreeditNothing|XIMStatusNothing)) {
! #ifdef I18N_IMPROVE
! 	    styleFound = 1;
! #else
!   	    XFree(stylePtr);
!   	    return;
! #endif /* I18N_IMPROVE */
  	}
      }
      XFree(stylePtr);
+ #ifdef I18N_IMPROVE
+     if (styleFound == 1) {
+ 	/*
+ 	 * Create a Tcl_Encoding for XmbLookupString() conversion.
+ 	 */
+ 	dispPtr->imEncoding = Tcl_GetEncoding(NULL, imEncoding);
+ #ifdef XNDestroyCallback
+ 	dispPtr->destroyCallback.client_data = (XPointer)dispPtr;
+ 	dispPtr->destroyCallback.callback = (XIMProc)IMDestroyCallback;
+ 	(void)XSetIMValues(dispPtr->inputMethod,
+ 			   XNDestroyCallback, &(dispPtr->destroyCallback), NULL);
+ #endif /* XNDestroyCallback */	
+ 	return;
+     }
+ #endif /* I18N_IMPROVE */
  
      error:
  
***************
*** 2708,2714 ****
--- 2936,2953 ----
      char **argv, *args[20];
      Tcl_DString class;
      ThreadSpecificData *tsdPtr;
+     static char version[] = TK_PATCH_LEVEL;
      
+ #if defined(__WIN32__) && defined(STATIC_BUILD) && !defined(NO_STATIC_INIT)
+     /*
+      * If we are in a statically linked executable, then we need to
+      * explicitly initialize the Windows function tables here since
+      * DllMain() will not be invoked.
+      */
+ 
+     TkWinXInit(GetModuleHandle(NULL));
+ #endif
+ 
      /*
       * Ensure that we are getting the matching version of Tcl.  This is
       * really only an issue when Tk is loaded dynamically.
***************
*** 2718,2723 ****
--- 2957,2966 ----
          return TCL_ERROR;
      }
  
+     if (Tcl_SetMainLoop) {
+ 	Tcl_SetMainLoop(Tk_GetNumMainWindows);
+     }
+ 
      tsdPtr = (ThreadSpecificData *) 
  	Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
  
***************
*** 2944,2959 ****
       * Provide Tk and its stub table.
       */
  
!     code = Tcl_PkgProvideEx(interp, "Tk", TK_VERSION, (ClientData) &tkStubs);
      if (code != TCL_OK) {
  	goto done;
      }
  
  #ifdef Tk_InitStubs
  #undef Tk_InitStubs
  #endif
  
      Tk_InitStubs(interp, TK_VERSION, 1);
  
      /*
       * Invoke platform-specific initialization.
--- 3187,3205 ----
       * Provide Tk and its stub table.
       */
  
!     version[5] = 0;
!     code = Tcl_PkgProvideEx(interp, "Tk", version, (ClientData) &tkStubs);
      if (code != TCL_OK) {
  	goto done;
      }
  
+ #ifndef __WIN32__
  #ifdef Tk_InitStubs
  #undef Tk_InitStubs
  #endif
  
      Tk_InitStubs(interp, TK_VERSION, 1);
+ #endif
  
      /*
       * Invoke platform-specific initialization.
***************
*** 2964,2969 ****
--- 3210,3218 ----
      done:
      if (argv != NULL) {
  	ckfree((char *) argv);
+     }
+     if (code != TCL_ERROR) {
+ 	code = TCL_OK;
      }
      return code;
  }
*** tests/bind.test.orig	Thu Jul  8 20:22:22 1999
--- tests/bind.test	Fri Sep 24 21:25:42 1999
***************
*** 214,220 ****
      .b.c bind foo
  } {}
  
! 
  if {[string compare testcbind [info commands testcbind]] != 0} {
      puts "This application hasn't been compiled with the testcbind command,"
      puts "therefore I am skipping all of these tests."
--- 214,220 ----
      .b.c bind foo
  } {}
  
! auto_load ::testcbind
  if {[string compare testcbind [info commands testcbind]] != 0} {
      puts "This application hasn't been compiled with the testcbind command,"
      puts "therefore I am skipping all of these tests."
*** tests/button.test.orig	Fri Apr 16 03:51:34 1999
--- tests/button.test	Fri Sep 24 21:25:42 1999
***************
*** 13,18 ****
--- 13,19 ----
      source [file join [pwd] [file dirname [info script]] defs.tcl]
  }
  
+ auto_load ::testsend
  if {[lsearch [image types] test] < 0} {
      puts "This application hasn't been compiled with the \"test\""
      puts "image, so I can't run this test.  Are you sure you're using"
*** tests/defs.tcl.orig	Sat Jun 19 02:59:01 1999
--- tests/defs.tcl	Fri Sep 24 21:25:42 1999
***************
*** 18,28 ****
  if {[info exists tk_version]} {
      tk appname tktest
      wm title . tktest
  } else {
  
      # Ensure that we have a minimal auto_path so we don't pick up extra junk.
  
!     set auto_path [list [info library]]
  }
  
  # create the "tcltest" namespace for all testing variables and procedures
--- 18,46 ----
  if {[info exists tk_version]} {
      tk appname tktest
      wm title . tktest
+     catch {package require -exact Tktest $tk_version}
  } else {
  
      # Ensure that we have a minimal auto_path so we don't pick up extra junk.
  
!     set auto_path [list [info library] [file dirname [info nameofexecutable]]]
! }
! 
! # Error-messages are not neccary if the Tcltest, Objtest
! # or Proctest packages are not present. Many tests can
! # still run, so it is not reasonable to stop for that.
! 
! catch {package require -exact Tcltest [info tclversion]}
! catch {package require -exact Objtest [info tclversion]}
! catch {package require Proctest 1.0}
! if {$tcl_platform(platform) == "unix"} {
!     catch {package require -exact Unixtest [info tclversion]}
! }
! if {$tcl_platform(platform) == "macintosh"} {
!     catch {package require -exact Mactest [info tclversion]}
! }
! if {$tcl_platform(platform) == "windows"} {
!     catch {package require -exact Wintest [info tclversion]}
  }
  
  # create the "tcltest" namespace for all testing variables and procedures
*** tests/entry.test.orig	Fri Apr 16 03:51:37 1999
--- tests/entry.test	Fri Sep 24 21:25:42 1999
***************
*** 12,17 ****
--- 12,18 ----
      source [file join [pwd] [file dirname [info script]] defs.tcl]
  }
  
+ auto_load testsend
  if {[lsearch [image types] test] < 0} {
      puts "This application hasn't been compiled with the \"test\""
      puts "image, so I can't run this test.  Are you sure you're using"
*** tests/image.test.orig	Fri Apr 16 03:51:38 1999
--- tests/image.test	Fri Sep 24 21:25:42 1999
***************
*** 13,18 ****
--- 13,19 ----
      source [file join [pwd] [file dirname [info script]] defs.tcl]
  }
  
+ auto_load testsend
  if {[lsearch [image types] test] < 0} {
      puts "This application hasn't been compiled with the \"test\" image"
      puts "type, so I can't run this test.  Are you sure you're using"
*** tests/menu.test.orig	Fri Apr 16 03:51:39 1999
--- tests/menu.test	Fri Sep 24 21:25:42 1999
***************
*** 11,16 ****
--- 11,17 ----
      source [file join [pwd] [file dirname [info script]] defs.tcl]
  }
  
+ auto_load testcbind
  if {[lsearch [image types] test] < 0} {
      puts "This application hasn't been compiled with the \"test\" image"
      puts "type, so I can't run this test.  Are you sure you're using"
***************
*** 218,224 ****
  .m1 add separator
  .m1 add checkbutton -label "checkbutton" -variable check -onvalue on -offvalue off
  .m1 add radiobutton -label "radiobutton" -variable radio
! image create photo image1 -file [file join $tk_library demos images earth.gif]
  
  foreach configTest {
      {-activebackground 
--- 219,225 ----
  .m1 add separator
  .m1 add checkbutton -label "checkbutton" -variable check -onvalue on -offvalue off
  .m1 add radiobutton -label "radiobutton" -variable radio
! image create photo image1 -file [file join .. library demos images earth.gif]
  
  foreach configTest {
      {-activebackground 
***************
*** 1351,1357 ****
  test menu-8.2 {DestroyMenuEntry} {
      catch {image delete image1a}
      catch {destroy .m1}
!     image create photo image1a -file [file join $tk_library demos images earth.gif]
      menu .m1
      .m1 add command -image image1a
      list [catch {.m1 delete 1} msg] $msg [destroy .m1] [image delete image1a]
--- 1352,1358 ----
  test menu-8.2 {DestroyMenuEntry} {
      catch {image delete image1a}
      catch {destroy .m1}
!     image create photo image1a -file [file join [pwd] .. library demos images earth.gif]
      menu .m1
      .m1 add command -image image1a
      list [catch {.m1 delete 1} msg] $msg [destroy .m1] [image delete image1a]
***************
*** 1605,1611 ****
      catch {image delete image1}
      catch {image delete image2}
      image create test image1
!     image create photo image2 -file [file join $tk_library demos images earth.gif]
      menu .m1
      .m1 add command -image image1
      list [catch {.m1 entryconfigure 1 -image image2} msg] $msg [destroy .m1] [image delete image1] [image delete image2]
--- 1606,1612 ----
      catch {image delete image1}
      catch {image delete image2}
      image create test image1
!     image create photo image2 -file [file join [pwd] .. library demos images earth.gif]
      menu .m1
      .m1 add command -image image1
      list [catch {.m1 entryconfigure 1 -image image2} msg] $msg [destroy .m1] [image delete image1] [image delete image2]
***************
*** 1614,1620 ****
      catch {destroy .m1}
      catch {image delete image1}
      catch {image delete image2}
!     image create photo image1 -file [file join $tk_library demos images earth.gif]
      image create test image2
      menu .m1
      .m1 add checkbutton -image image1
--- 1615,1621 ----
      catch {destroy .m1}
      catch {image delete image1}
      catch {image delete image2}
!     image create photo image1 -file [file join [pwd] .. library demos images earth.gif]
      image create test image2
      menu .m1
      .m1 add checkbutton -image image1
***************
*** 1625,1631 ****
      catch {image delete image1}
      catch {image delete image2}
      catch {image delete image3}
!     image create photo image1 -file [file join $tk_library demos images earth.gif]
      image create test image2
      image create test image3
      menu .m1
--- 1626,1632 ----
      catch {image delete image1}
      catch {image delete image2}
      catch {image delete image3}
!     image create photo image1 -file [file join [pwd] .. library demos images earth.gif]
      image create test image2
      image create test image3
      menu .m1
*** tests/unixEmbed.test.orig	Wed Apr 21 23:53:30 1999
--- tests/unixEmbed.test	Fri Sep 24 21:25:42 1999
***************
*** 115,120 ****
--- 115,121 ----
      dobg {
  	eval destroy [winfo child .]
  	toplevel .t -use $w
+ 	package require Tktest
  	list [testembed] [expr [lindex [lindex [testembed all] 0] 0] - $w]
      }
  } {{{XXX {} {} .t}} 0}
***************
*** 129,134 ****
--- 130,136 ----
  	eval destroy [winfo child .]
  	toplevel .t1 -use $w1
  	toplevel .t2 -use $w2
+ 	package require Tktest
  	testembed
      }
  } {{XXX {} {} .t2} {XXX {} {} .t1}}
***************
*** 155,160 ****
--- 157,163 ----
      dobg {
  	eval destroy [winfo child .]
  	toplevel .t1 -use $w1
+ 	package require Tktest
  	testembed
      }
      destroy .f1
***************
*** 173,178 ****
--- 176,182 ----
      dobg {
  	eval destroy [winfo child .]
  	toplevel .t1 -use $w1
+ 	package require Tktest
  	testembed
  	destroy .t1
  	testembed
***************
*** 593,598 ****
--- 597,603 ----
  	eval destroy [winfo child .]
  	toplevel .t1 -use $w1 -highlightthickness 2 -bd 2 -relief sunken
  	set x {}
+ 	package require Tktest
  	lappend x [testembed]
  	destroy .t1
  	lappend x [testembed]
*** doc/wish.1.orig	Mon Sep 14 20:23:01 1998
--- doc/wish.1	Fri Sep 24 21:25:43 1999
***************
*** 175,182 ****
  command with ``\fB% \fR''.  You can change the prompt by setting the
  variables \fBtcl_prompt1\fR and \fBtcl_prompt2\fR.  If variable
  \fBtcl_prompt1\fR exists then it must consist of a Tcl script
! to output a prompt;  instead of outputting a prompt \fBwish\fR
! will evaluate the script in \fBtcl_prompt1\fR.
  The variable \fBtcl_prompt2\fR is used in a similar way when
  a newline is typed but the current command isn't yet complete;
  if \fBtcl_prompt2\fR isn't set then no prompt is output for
--- 175,183 ----
  command with ``\fB% \fR''.  You can change the prompt by setting the
  variables \fBtcl_prompt1\fR and \fBtcl_prompt2\fR.  If variable
  \fBtcl_prompt1\fR exists then it must consist of a Tcl script
! to return a prompt; instead of outputting a prompt \fBtclsh\fR
! will evaluate the script in \fBtcl_prompt1\fR and write the
! result of the evaluation to stdout.
  The variable \fBtcl_prompt2\fR is used in a similar way when
  a newline is typed but the current command isn't yet complete;
  if \fBtcl_prompt2\fR isn't set then no prompt is output for
*** mac/pkgIndex.tcl.orig	Fri Sep 24 21:25:43 1999
--- mac/pkgIndex.tcl	Fri Sep 24 21:25:43 1999
***************
*** 0 ****
--- 1,5 ----
+ # Tcl package index file, version 1.0
+ 
+ package ifneeded Tk 8.0 [list load [file join $dir libtk8.0[info sharedlibextension]] Tk]
+ package ifneeded Tksquare 8.0 [list tclPkgSetup $dir Tksquare 8.0 [list [list Tksquare[info sharedlibextension] load square]]]
+ package ifneeded Tktest 8.0 [list tclPkgSetup $dir Tktest 8.0 [list [list Tktest[info sharedlibextension] load {testcbind testdeleteapps testembed testmakeexist testmenubar testprop testsend testwrapper}]]]
*** mac/tkMacAppInit.c.orig	Wed Jun 16 07:33:58 1999
--- mac/tkMacAppInit.c	Fri Sep 24 21:25:43 1999
***************
*** 12,17 ****
--- 12,19 ----
   * RCS: @(#) $Id: tkMacAppInit.c,v 1.11 1999/06/16 05:33:58 jingham Exp $
   */
  
+ #undef TCL_USE_STUBS
+ 
  #include <Gestalt.h>
  #include <ToolUtils.h>
  #include <Fonts.h>
*** mac/tkMacInit.c.orig	Fri Apr 16 03:51:31 1999
--- mac/tkMacInit.c	Fri Sep 24 21:25:43 1999
***************
*** 32,37 ****
--- 32,170 ----
  QDGlobalsPtr tcl_macQdPtr = NULL;
  
  /*
+  * Default directory in which to look for libraries:
+  */
+ 
+ #ifndef TK_LIBRARY
+ #define TK_LIBRARY "."
+ #endif
+ 
+ static char defaultLibraryDir[200] = TK_LIBRARY;
+ 
+ /*
+  * The following string is the startup script executed in new
+  * interpreters.  It looks on disk in several different directories
+  * for a script "tk.tcl" that is compatible with this version
+  * of Tk.  The tk.tcl script does all of the real work of
+  * initialization.
+  */
+ 
+ static char initScript[] =
+ "proc tkInit {} {\n\
+     global tk_library tk_version tk_patchLevel env\n\
+     set errors \"\"\n\
+     rename tkInit {}\n\
+     set dirs {}\n\
+     if [info exists env(TK_LIBRARY)] {\n\
+ 	lappend dirs $env(TK_LIBRARY)\n\
+     }\n\
+     lappend dirs $tk_library\n\
+     set tk_library {}\n\
+     if ![catch {uplevel #0 source -rsrc tk}] {\n\
+ 	uplevel #0 {\n\
+     	    source -rsrc button\n\
+     	    source -rsrc entry\n\
+     	    source -rsrc listbox\n\
+     	    source -rsrc menu\n\
+     	    source -rsrc scale\n\
+     	    source -rsrc scrollbar\n\
+     	    source -rsrc text\n\
+     	    source -rsrc dialog\n\
+     	    source -rsrc focus\n\
+     	    source -rsrc optionMenu\n\
+     	    source -rsrc palette\n\
+     	    source -rsrc tearoff\n\
+     	    source -rsrc tkerror\n\
+     	    source -rsrc comdlg\n\
+     	    source -rsrc msgbox\n\\n\
+ 	}\n\
+ 	return\n\
+     }\n\
+     lappend dirs [file join [file dirname [info library]] tk$tk_version]\n\
+     set parentDir [file dirname [file dirname [info nameofexecutable]]]\n\
+     lappend dirs [file join $parentDir lib tk$tk_version]\n\
+     if {![regexp {.*[ab][12345]} $tk_patchLevel version]} {\n\
+ 	set version $tk_version\n\
+     }\n\
+     lappend dirs [file join [file dirname $parentDir] tk$version library]\n\
+     lappend dirs [file join $parentDir library]\n\
+     foreach i $dirs {\n\
+ 	set tk_library $i\n\
+ 	if ![catch {uplevel #0 source [list [file join $i tk.tcl]]}] {\n\
+ 	    return\n\
+ 	} else {\n\
+ 	    append errors \"[file join $i tk.tcl]: $msg\n$errorInfo\n\"\n\
+ 	}\n\
+     }\n\
+     set tk_library {}\n\
+     set msg \"Can't find a usable tk.tcl in the following directories: \n\"\n\
+     append msg \"    $dirs\n\"\n\
+     append msg \"This probably means that Tk wasn't installed properly.\n\"\n\
+     error $msg\n\
+ }\n\
+ tkInit";
+ 
+ /*
+  * The following script is used to initialize Tk in a safe interpreter.
+  */
+ 
+ static char safeInitScript[] =
+ "proc tkInit {} {\n\
+     global tk_library tk_version tk_patchLevel env\n\
+     set errors \"\"\n\
+     rename tkInit {}\n\
+     set dirs {}\n\
+     if [info exists env(TK_LIBRARY)] {\n\
+ 	lappend dirs $env(TK_LIBRARY)\n\
+     }\n\
+     lappend dirs $tk_library\n\
+     set tk_library {}\n\
+     if ![catch {uplevel #0 source -rsrc tk}] {\n\
+ 	uplevel #0 {\n\
+     	    source -rsrc button\n\
+     	    source -rsrc entry\n\
+     	    source -rsrc listbox\n\
+     	    source -rsrc menu\n\
+     	    source -rsrc scale\n\
+     	    source -rsrc scrollbar\n\
+     	    source -rsrc text\n\
+     	    source -rsrc dialog\n\
+     	    source -rsrc focus\n\
+     	    source -rsrc optionMenu\n\
+     	    source -rsrc palette\n\
+     	    source -rsrc tearoff\n\
+     	    source -rsrc tkerror\n\
+     	    source -rsrc comdlg\n\
+     	    source -rsrc msgbox\n\\n\
+ 	}\n\
+ 	return\n\
+     }\n\
+     lappend dirs [file join [file dirname [info library]] tk$tk_version]\n\
+     set parentDir [file dirname [file dirname [info nameofexecutable]]]\n\
+     lappend dirs [file join $parentDir lib tk$tk_version]\n\
+     if {![regexp {.*[ab][1-9]} $tk_patchLevel version]} {\n\
+ 	set version $tk_version\n\
+     }\n\
+     lappend dirs [file join [file dirname [file dirname [info library]]] tk$version library]\n\
+     foreach i $dirs {\n\
+ 	set tk_library $i\n\
+ 	if ![catch {uplevel #0 source [list [file join $i tk.tcl]]}] {\n\
+ 	    return\n\
+ 	} else {\n\
+ 	    append errors \"[file join $i tk.tcl]: $msg\n$errorInfo\n\"\n\
+ 	}\n\
+     }\n\
+     set tk_library {}\n\
+     set msg \"Can't find a usable tk.tcl in the following directories: \n\"\n\
+     append msg \"    $dirs\n\n\"\n\
+     append msg \"$errors\n\n\"\n\
+     append msg \"This probably means that Tk wasn't installed properly.\n\"\n\
+     error $msg\n\
+ }\n\
+ tkInit";
+ 
+ 
+ /*
   *----------------------------------------------------------------------
   *
   * TkpInit --
***************
*** 58,102 ****
      Tcl_DString path;
      int result;
  
-     /*
-      * The following does not work with
-      * safe interps because file exists is restricted.
-      * to be fixed using [interp issafe] like in Unix & Windows.
-      */
-     static char initCmd[] =
- 	"if [file exists $tk_library:tk.tcl] {\n\
- 	    source $tk_library:tk.tcl\n\
- 	    source $tk_library:button.tcl\n\
- 	    source $tk_library:entry.tcl\n\
- 	    source $tk_library:listbox.tcl\n\
- 	    source $tk_library:menu.tcl\n\
- 	    source $tk_library:scale.tcl\n\
- 	    source $tk_library:scrlbar.tcl\n\
- 	    source $tk_library:text.tcl\n\
- 	    source $tk_library:comdlg.tcl\n\
- 	    source $tk_library:msgbox.tcl\n\
- 	} else {\n\
- 	    set msg \"can't find tk resource or $tk_library:tk.tcl;\"\n\
- 	    append msg \" perhaps you need to\\ninstall Tk or set your \"\n\
- 	    append msg \"TK_LIBRARY environment variable?\"\n\
- 	    error $msg\n\
- 	}";
- 
      Tcl_DStringInit(&path);
  
      /*
       * The tk_library path can be found in several places.  Here is the order
       * in which the are searched.
       *		1) the variable may already exist
!      *		2) env array
!      *		3) System Folder:Extensions:Tool Command Language:
       */
!      
      libDir = Tcl_GetVar(interp, "tk_library", TCL_GLOBAL_ONLY);
      if (libDir == NULL) {
- 	libDir = Tcl_GetVar2(interp, "env", "TK_LIBRARY", TCL_GLOBAL_ONLY);
-     }
-     if (libDir == NULL) {
  	tempPath = Tcl_GetVar2(interp, "env", "EXT_FOLDER", TCL_GLOBAL_ONLY);
  	if (tempPath != NULL) {
  	    Tcl_DString libPath;
--- 191,208 ----
      Tcl_DString path;
      int result;
  
      Tcl_DStringInit(&path);
  
      /*
       * The tk_library path can be found in several places.  Here is the order
       * in which the are searched.
       *		1) the variable may already exist
!      *		2) System Folder:Extensions:Tool Command Language:
!      *		3) env array
       */
! 
      libDir = Tcl_GetVar(interp, "tk_library", TCL_GLOBAL_ONLY);
      if (libDir == NULL) {
  	tempPath = Tcl_GetVar2(interp, "env", "EXT_FOLDER", TCL_GLOBAL_ONLY);
  	if (tempPath != NULL) {
  	    Tcl_DString libPath;
***************
*** 112,118 ****
  	}
      }
      if (libDir == NULL) {
! 	libDir = "no library";
      }
  
      /*
--- 218,224 ----
  	}
      }
      if (libDir == NULL) {
! 	libDir = "";
      }
  
      /*
***************
*** 121,151 ****
      Tcl_SetVar(interp, "tk_library", libDir, TCL_GLOBAL_ONLY);
      Tcl_DStringFree(&path);
  
!     /*
!      * Source the needed Tk libraries from the resource
!      * fork of the application.
!      */
!     result = Tcl_MacEvalResource(interp, "tk", 0, NULL);
!     result |= Tcl_MacEvalResource(interp, "button", 0, NULL);
!     result |= Tcl_MacEvalResource(interp, "entry", 0, NULL);
!     result |= Tcl_MacEvalResource(interp, "listbox", 0, NULL);
!     result |= Tcl_MacEvalResource(interp, "menu", 0, NULL);
!     result |= Tcl_MacEvalResource(interp, "scale", 0, NULL);
!     result |= Tcl_MacEvalResource(interp, "scrollbar", 0, NULL);
!     result |= Tcl_MacEvalResource(interp, "text", 0, NULL);
!     result |= Tcl_MacEvalResource(interp, "dialog", 0, NULL);
!     result |= Tcl_MacEvalResource(interp, "focus", 0, NULL);
!     result |= Tcl_MacEvalResource(interp, "optionMenu", 0, NULL);
!     result |= Tcl_MacEvalResource(interp, "palette", 0, NULL);
!     result |= Tcl_MacEvalResource(interp, "tearoff", 0, NULL);
!     result |= Tcl_MacEvalResource(interp, "tkerror", 0, NULL);
!     result |= Tcl_MacEvalResource(interp, "comdlg", 0, NULL);
!     result |= Tcl_MacEvalResource(interp, "msgbox", 0, NULL);
! 
!     if (result != TCL_OK) {
! 	result = Tcl_Eval(interp, initCmd);
      }
!     return result;
  }
  
  /*
--- 227,236 ----
      Tcl_SetVar(interp, "tk_library", libDir, TCL_GLOBAL_ONLY);
      Tcl_DStringFree(&path);
  
!     if (doSafe) {
! 	return Tcl_Eval(interp, safeInitScript);
      }
!     return Tcl_Eval(interp, initScript);
  }
  
  /*
*** mac/tkMacPort.h.orig	Sun Aug  1 23:25:23 1999
--- mac/tkMacPort.h	Fri Sep 24 21:25:43 1999
***************
*** 70,78 ****
   * in any other header file.
   */
  
- #ifndef panic	/* In a stubs-aware setting, this could confuse the #define */
- extern void 		panic  _ANSI_ARGS_(TCL_VARARGS(char *, string));
- #endif
  extern int		strcasecmp _ANSI_ARGS_((CONST char *s1,
  			    CONST char *s2));
  extern int		strncasecmp _ANSI_ARGS_((CONST char *s1,
--- 70,75 ----
*** mac/tkMacTest.c.orig	Fri Apr 16 03:51:32 1999
--- mac/tkMacTest.c	Fri Sep 24 21:25:43 1999
***************
*** 19,24 ****
--- 19,25 ----
   * Forward declarations of procedures defined later in this file:
   */
  
+ int			Tkptest_Init _ANSI_ARGS_((Tcl_Interp *interp));
  int			TkplatformtestInit _ANSI_ARGS_((Tcl_Interp *interp));
  static int		DebuggerCmd _ANSI_ARGS_((ClientData dummy,
  			    Tcl_Interp *interp, int argc, char **argv));
***************
*** 42,47 ****
--- 43,71 ----
  
  int
  TkplatformtestInit(
+     Tcl_Interp *interp)		/* Interpreter to add commands to. */
+ {
+     return Tkptest_Init(interp);
+ }
+ /*
+  *----------------------------------------------------------------------
+  *
+  * Tkptest_Init --
+  *
+  *	Defines commands that test platform specific functionality for
+  *	Macintosh platforms.
+  *
+  * Results:
+  *	A standard Tcl result.
+  *
+  * Side effects:
+  *	Defines new commands.
+  *
+  *----------------------------------------------------------------------
+  */
+ 
+ int
+ Tkptest_Init(
      Tcl_Interp *interp)		/* Interpreter to add commands to. */
  {
      /*
*** win/Makefile.gnu.orig	Fri Sep 24 21:25:43 1999
--- win/Makefile.gnu	Fri Sep 24 21:25:43 1999
***************
*** 0 ****
--- 1,609 ----
+ # Generated automatically from Makefile.in by configure.
+ # Visual C++ 2.x and 4.0 makefile
+ #
+ # See the file "license.terms" for information on usage and redistribution
+ # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ # 
+ # Copyright (c) 1995-1996 Sun Microsystems, Inc.
+ # SCCS: @(#) makefile.vc 1.63 97/08/13 13:33:32
+ 
+ # Does not depend on the presence of any environment variables in
+ # order to compile tcl; all needed information is derived from 
+ # location of the compiler directories.
+ 
+ # This file is CYGNUS LOCAL.  It is a copy of makefile.vc from the
+ # standard tk distribution, modified to work with cygwin32 and an
+ # autoconf configure script.  I have chosen to minimize the number of
+ # changes, so the comments continue to refer to Visual C++ and the
+ # like.  This should make it easier to merge in a new version if that
+ # is necessary.
+ 
+ prefix = /usr/local
+ exec_prefix = /usr/local
+ VPATH = .:./../xlib:./../generic:./../unix:./../win/rc
+ srcdir = .
+ 
+ INSTALL = /usr/bin/install -c
+ INSTALL_PROGRAM = ${INSTALL}
+ INSTALL_DATA = ${INSTALL} -m 644
+ 
+ CC = gcc
+ CFLAGS = -O2 -DSTATIC_BUILD -mno-cygwin
+ NM = nm
+ AS = as
+ LD = ld
+ DLLTOOL = dlltool
+ DLLWRAP = dllwrap -mno-cygwin
+ WINDRES = windres
+ 
+ DLL_LDFLAGS = -mwindows -Wl,-e,_DllMain@12
+ DLL_LDLIBS =
+ 
+ # Current Tk version;  used in various names.
+ 
+ DIRVERSION = 8.2
+ 
+ # The following definition can be set to non-null for special systems
+ # like AFS with replication.  It allows the pathnames used for installation
+ # to be different than those used for actually reference files at
+ # run-time.  INSTALL_ROOT is prepended to $prefix and $exec_prefix
+ # when installing files.
+ INSTALL_ROOT =
+ 
+ # Directory from which applications will reference the library of Tcl
+ # scripts (note: you can set the TK_LIBRARY environment variable at
+ # run-time to override the compiled-in location):
+ TK_LIBRARY =		${prefix}/lib/tk$(DIRVERSION)
+ 
+ # Path name to use when installing library scripts:
+ SCRIPT_INSTALL_DIR =	$(INSTALL_ROOT)$(TK_LIBRARY)
+ 
+ # Directory in which to install the .a or .so binary for the Tk library:
+ LIB_INSTALL_DIR =	$(INSTALL_ROOT)${exec_prefix}/lib
+ 
+ # Directory in which to install the program wish:
+ BIN_INSTALL_DIR =	$(INSTALL_ROOT)${exec_prefix}/bin
+ 
+ # Directory in which to install the include file tk.h:
+ INCLUDE_INSTALL_DIR =	$(INSTALL_ROOT)${prefix}/include
+ 
+ # Directory in which to install the X11 header files.  These files are
+ # not machine independent, so they should not go in includedir.
+ X11_INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)/usr/local/i386-mingw32/include/X11
+ 
+ DEMOPROGS = browse hello ixset rmt rolodex square tcolor timer widget
+ 
+ #
+ # Project directories
+ #
+ # ROOT    = top of source tree
+ #
+ # TMPDIR  = location where .obj files should be stored during build
+ #
+ # TOOLS32 = location of VC++ 32-bit development tools. Note that the
+ #	    VC++ 2.0 header files are broken, so you need to use the
+ #	    ones that come with the developer network CD's, or later
+ #	    versions of VC++.
+ #
+ # TCLDIR = location of top of Tcl source heirarchy
+ #
+ 
+ ROOT	= $(srcdir)/..
+ TMPDIR	= .
+ TOOLS32	= c:\msdev
+ TCLDIR	= $(srcdir)/../../tcl8.2.0
+ 
+ # Set this to the appropriate value of /MACHINE: for your platform
+ MACHINE	= IX86
+ 
+ # Comment the following line to compile with symbols
+ NODEBUG=1
+ 
+ # uncomment the following two lines to compile with TCL_MEM_DEBUG
+ #DEBUGDEFINES	=-DTCL_MEM_DEBUG
+ 
+ ######################################################################
+ # Do not modify below this line
+ ######################################################################
+ 
+ TCLNAMEPREFIX = tcl
+ TKNAMEPREFIX = tk
+ WISHNAMEPREFIX = wish
+ VERSION = 82
+ DOTVERSION = 8.2
+ 
+ TCLSTUBPREFIX = $(TCLNAMEPREFIX)stub
+ TKSTUBPREFIX  = $(TKNAMEPREFIX)stub
+ 
+ TCLLIB = lib$(TCLNAMEPREFIX)$(VERSION).a
+ TCLSTUBLIB = lib$(TCLSTUBPREFIX)$(VERSION).a
+ TCLLIBSA = lib$(TCLNAMEPREFIX)$(VERSION)s.a
+ TCLPLUGINDLL = $(TCLNAMEPREFIX)$(VERSION)p.dll
+ TCLPLUGINLIB = lib$(TCLNAMEPREFIX)$(VERSION)p.a
+ TKDLL = $(TKNAMEPREFIX)$(VERSION).dll
+ TKLIB = lib$(TKNAMEPREFIX)$(VERSION).a
+ TKLIBSA = lib$(TKNAMEPREFIX)$(VERSION)s.a
+ TKPLUGINDLL = $(TKNAMEPREFIX)$(VERSION)p.dll
+ TKPLUGINLIB = lib$(TKNAMEPREFIX)$(VERSION)p.a
+ TKSTUBLIB = lib$(TKSTUBPREFIX)$(VERSION).a
+ TESTDLLNAME	= $(TKNAMEPREFIX)test$(DBGX).dll
+ TESTDLL		= $(OUTDIR)/$(TESTDLLNAME)
+ PTESTDLLNAME	= $(TKNAMEPREFIX)ptest$(DBGX).dll
+ PTESTDLL	= $(OUTDIR)/$(PTESTDLLNAME)
+ SQUAREDLLNAME	= $(TKNAMEPREFIX)square$(DBGX).dll
+ SQUAREDLL	= $(OUTDIR)/$(SQUAREDLLNAME)
+ 
+ WISH = wish$(VERSION).exe
+ WISHSA = wish$(VERSION)s.exe
+ WISHP = wishp$(VERSION).exe
+ TKTEST = tktest.exe
+ DUMPEXTS = $(TMPDIR)\dumpexts.exe
+ 
+ WISHOBJS = \
+ 	$(TMPDIR)/winMain.o
+ 
+ WISHSAOBJS = \
+ 	$(TMPDIR)/winMainSA.o
+ 
+ 
+ TKTESTOBJS = \
+ 	$(TMPDIR)/tkTest.o \
+ 	$(TMPDIR)/tkSquare.o \
+ 	$(TMPDIR)/testMain.o
+ 
+ XLIBOBJS = \
+ 	$(TMPDIR)/xcolors.o \
+ 	$(TMPDIR)/xdraw.o \
+ 	$(TMPDIR)/xgc.o \
+ 	$(TMPDIR)/ximage.o \
+ 	$(TMPDIR)/xutil.o
+ 
+ TKOBJS = \
+ 	$(TMPDIR)/tkConsole.o \
+ 	$(TMPDIR)/tkMain.o \
+ 	$(TMPDIR)/tkUnixMenubu.o \
+ 	$(TMPDIR)/tkUnixScale.o \
+ 	$(XLIBOBJS) \
+ 	$(TMPDIR)/tkWin3d.o \
+ 	$(TMPDIR)/tkWinButton.o \
+ 	$(TMPDIR)/tkWinClipboard.o \
+ 	$(TMPDIR)/tkWinColor.o \
+ 	$(TMPDIR)/tkWinConfig.o \
+ 	$(TMPDIR)/tkWinCursor.o \
+ 	$(TMPDIR)/tkWinDialog.o \
+ 	$(TMPDIR)/tkWinDraw.o \
+ 	$(TMPDIR)/tkWinEmbed.o \
+ 	$(TMPDIR)/tkWinFont.o \
+ 	$(TMPDIR)/tkWinImage.o \
+ 	$(TMPDIR)/tkWinInit.o \
+ 	$(TMPDIR)/tkWinKey.o \
+ 	$(TMPDIR)/tkWinMenu.o \
+ 	$(TMPDIR)/tkWinPixmap.o \
+ 	$(TMPDIR)/tkWinPointer.o \
+ 	$(TMPDIR)/tkWinRegion.o \
+ 	$(TMPDIR)/tkWinScrlbr.o \
+ 	$(TMPDIR)/tkWinSend.o \
+ 	$(TMPDIR)/tkWinWindow.o \
+ 	$(TMPDIR)/tkWinWm.o \
+ 	$(TMPDIR)/tkWinX.o \
+ 	$(TMPDIR)/stubs.o \
+ 	$(TMPDIR)/tk3d.o \
+ 	$(TMPDIR)/tkArgv.o \
+ 	$(TMPDIR)/tkAtom.o \
+ 	$(TMPDIR)/tkBind.o \
+ 	$(TMPDIR)/tkBitmap.o \
+ 	$(TMPDIR)/tkButton.o \
+ 	$(TMPDIR)/tkCanvArc.o \
+ 	$(TMPDIR)/tkCanvBmap.o \
+ 	$(TMPDIR)/tkCanvImg.o \
+ 	$(TMPDIR)/tkCanvLine.o \
+ 	$(TMPDIR)/tkCanvPoly.o \
+ 	$(TMPDIR)/tkCanvPs.o \
+ 	$(TMPDIR)/tkCanvText.o \
+ 	$(TMPDIR)/tkCanvUtil.o \
+ 	$(TMPDIR)/tkCanvWind.o \
+ 	$(TMPDIR)/tkCanvas.o \
+ 	$(TMPDIR)/tkClipboard.o \
+ 	$(TMPDIR)/tkCmds.o \
+ 	$(TMPDIR)/tkColor.o \
+ 	$(TMPDIR)/tkConfig.o \
+ 	$(TMPDIR)/tkCursor.o \
+ 	$(TMPDIR)/tkEntry.o \
+ 	$(TMPDIR)/tkError.o \
+ 	$(TMPDIR)/tkEvent.o \
+ 	$(TMPDIR)/tkFileFilter.o \
+ 	$(TMPDIR)/tkFocus.o \
+ 	$(TMPDIR)/tkFont.o \
+ 	$(TMPDIR)/tkFrame.o \
+ 	$(TMPDIR)/tkGC.o \
+ 	$(TMPDIR)/tkGeometry.o \
+ 	$(TMPDIR)/tkGet.o \
+ 	$(TMPDIR)/tkGrab.o \
+ 	$(TMPDIR)/tkGrid.o \
+ 	$(TMPDIR)/tkImage.o \
+ 	$(TMPDIR)/tkImgBmap.o \
+ 	$(TMPDIR)/tkImgGIF.o \
+ 	$(TMPDIR)/tkImgPPM.o \
+ 	$(TMPDIR)/tkImgPhoto.o \
+ 	$(TMPDIR)/tkImgUtil.o \
+ 	$(TMPDIR)/tkListbox.o \
+ 	$(TMPDIR)/tkMacWinMenu.o \
+ 	$(TMPDIR)/tkMenu.o \
+ 	$(TMPDIR)/tkMenubutton.o \
+ 	$(TMPDIR)/tkMenuDraw.o \
+ 	$(TMPDIR)/tkMessage.o \
+ 	$(TMPDIR)/tkObj.o \
+ 	$(TMPDIR)/tkOldConfig.o \
+ 	$(TMPDIR)/tkOption.o \
+ 	$(TMPDIR)/tkPack.o \
+ 	$(TMPDIR)/tkPlace.o \
+ 	$(TMPDIR)/tkPointer.o \
+ 	$(TMPDIR)/tkRectOval.o \
+ 	$(TMPDIR)/tkScale.o \
+ 	$(TMPDIR)/tkScrollbar.o \
+ 	$(TMPDIR)/tkSelect.o \
+ 	$(TMPDIR)/tkText.o \
+ 	$(TMPDIR)/tkTextBTree.o \
+ 	$(TMPDIR)/tkTextDisp.o \
+ 	$(TMPDIR)/tkTextImage.o \
+ 	$(TMPDIR)/tkTextIndex.o \
+ 	$(TMPDIR)/tkTextMark.o \
+ 	$(TMPDIR)/tkTextTag.o \
+ 	$(TMPDIR)/tkTextWind.o \
+ 	$(TMPDIR)/tkTrig.o \
+ 	$(TMPDIR)/tkUtil.o \
+ 	$(TMPDIR)/tkVisual.o \
+ 	$(TMPDIR)/tkStubInit.o \
+ 	$(TMPDIR)/tkWindow.o
+ 
+ TKDLLOBJS = \
+ 	$(TKOBJS) \
+ 	$(TMPDIR)/tkWin32Dll.o
+ 
+ TKSTUBOBJS = $(TMPDIR)/tkStubLib.o
+ 
+ cc32		= $(TOOLS32)\bin\cl.exe
+ link32		= $(TOOLS32)\bin\link.exe
+ rc32		= $(TOOLS32)\bin\rc.exe
+ include32	= -I$(TOOLS32)\include
+ 
+ WINDIR          = $(ROOT)/win
+ OUTDIR		= .
+ GENERICDIR	= $(ROOT)/generic
+ LIBDIR		= $(ROOT)/library
+ XLIBDIR		= $(ROOT)/xlib
+ BITMAPDIR	= $(ROOT)/bitmaps
+ TCLLIBDIR       = ../../tcl8.2.0/win
+ RCDIR		= $(WINDIR)/rc
+ 
+ TK_INCLUDES	= -I$(WINDIR) -I$(GENERICDIR) -I$(BITMAPDIR) -I$(XLIBDIR) \
+ 			-I$(TCLDIR)/generic
+ TK_DEFINES	= $(DEBUGDEFINES)
+ 
+ TK_CFLAGS	= $(cdebug) $(cflags) $(cvarsdll) $(include32) \
+ 			$(TK_INCLUDES) $(TK_DEFINES) $(CFLAGS)
+ 
+ ######################################################################
+ # Link flags
+ ######################################################################
+ 
+ #!IFDEF NODEBUG
+ #ldebug = /RELEASE
+ #!ELSE
+ #ldebug = -debug:full -debugtype:cv
+ #!ENDIF
+ 
+ # declarations common to all linker options
+ lcommon = /NODEFAULTLIB /RELEASE /NOLOGO
+ 
+ # declarations for use on Intel i386, i486, and Pentium systems
+ #!IF "$(MACHINE)" == "IX86"
+ #DLLENTRY = @12
+ #lflags   = $(lcommon) -align:0x1000 /MACHINE:$(MACHINE)
+ #!ELSE
+ #lflags   = $(lcommon) /MACHINE:$(MACHINE)
+ #!ENDIF
+ 
+ conlflags = $(lflags) -Wl,--subsystem,console -mwindows
+ guilflags = $(lflags) -mwindows
+ dlllflags = $(lflags)
+ 
+ #!IF "$(MACHINE)" == "PPC"
+ #libc = libc.lib
+ #libcdll = crtdll.lib
+ #!ELSE
+ #libc = libc.lib oldnames.lib
+ #libcdll = msvcrt.lib oldnames.lib
+ #!ENDIF
+ 
+ baselibs   = -lkernel32 $(optlibs) -ladvapi32
+ winlibs    = $(baselibs) -luser32 -lgdi32 -lcomdlg32 -lwinspool
+ guilibs	   = $(libc) $(winlibs)
+ 
+ guilibsdll = $(libcdll) $(winlibs)
+ 
+ ######################################################################
+ # Compile flags
+ ######################################################################
+ 
+ #!IFDEF NODEBUG
+ #cdebug = -Ox
+ #!ELSE
+ #cdebug = -Z7 -Od -WX
+ #!ENDIF
+ 
+ # declarations common to all compiler options
+ #ccommon = -c -W3 -nologo -YX
+ 
+ #!IF "$(MACHINE)" == "IX86"
+ #cflags = $(ccommon) -D_X86_=1
+ #!ELSE
+ #!IF "$(MACHINE)" == "MIPS"
+ #cflags = $(ccommon) -D_MIPS_=1
+ #!ELSE
+ #!IF "$(MACHINE)" == "PPC"
+ #cflags = $(ccommon) -D_PPC_=1
+ #!ELSE
+ #!IF "$(MACHINE)" == "ALPHA"
+ #cflags = $(ccommon) -D_ALPHA_=1
+ #!ENDIF
+ #!ENDIF
+ #!ENDIF
+ #!ENDIF
+ 
+ cvars      = -DWIN32 -D_WIN32 -D__WIN32__
+ cvarsmt    = $(cvars) -D_MT
+ cvarsdll   = $(cvarsmt) -D_DLL
+ 
+ CON_CFLAGS	= $(cdebug) $(cflags) $(cvars) $(include32) -DCONSOLE
+ 
+ ######################################################################
+ # Project specific targets
+ ######################################################################
+ 
+ all:    $(WISH) $(TKLIBSA) $(TKSTUBLIB)
+ tktest:	$(WISH) $(TESTDLL) $(PTESTDLL) $(SQUAREDLL)
+ 
+ install: install-binaries install-libraries install-demos
+ 
+ install-binaries: $(TKDLL) $(TKLIB) $(WISH)
+ 	@for i in $(LIB_INSTALL_DIR) $(BIN_INSTALL_DIR) ; \
+ 	    do \
+ 	    if [ ! -d $$i ] ; then \
+ 		echo "Making directory $$i"; \
+ 		mkdir $$i; \
+ 		chmod 755 $$i; \
+ 		else true; \
+ 		fi; \
+ 	    done;
+ 	@echo "Installing $(TKLIB)"
+ 	@$(INSTALL_DATA) $(TKLIB) $(LIB_INSTALL_DIR)/$(TKLIB)
+ 	@chmod 555 $(LIB_INSTALL_DIR)/$(TKLIB)
+ 	@echo "Installing wish"
+ 	@$(INSTALL_PROGRAM) $(WISH) $(BIN_INSTALL_DIR)/$(WISH)
+ 	@echo "Installing tkConfig.sh"
+ 	@$(INSTALL_DATA) ../unix/tkConfig.sh $(LIB_INSTALL_DIR)/tkConfig.sh
+ 
+ install-libraries:
+ 	@echo "Installing DLL"
+ 	@$(INSTALL_DATA) $(TKDLL) $(BIN_INSTALL_DIR)/$(TKDLL)
+ 	@for i in $(INSTALL_ROOT)${prefix}/lib $(INCLUDE_INSTALL_DIR) \
+ 		$(SCRIPT_INSTALL_DIR) $(INSTALL_ROOT)/usr/local \
+ 		$(INSTALL_ROOT)/usr/local/i386-mingw32 \
+ 		$(INSTALL_ROOT)/usr/local/i386-mingw32/include \
+ 		$(X11_INCLUDE_INSTALL_DIR) ; \
+ 	    do \
+ 	    if [ ! -d $$i ] ; then \
+ 		echo "Making directory $$i"; \
+ 		mkdir $$i; \
+ 		chmod 755 $$i; \
+ 		else true; \
+ 		fi; \
+ 	    done;
+ 	@echo "Installing tk.h"
+ 	@$(INSTALL_DATA) $(GENERICDIR)/tk.h $(INCLUDE_INSTALL_DIR)/tk.h
+ 	for i in $(XLIBDIR)/X11/*.h; \
+ 	    do \
+ 	    echo "Installing $$i"; \
+ 	    $(INSTALL_DATA) $$i $(X11_INCLUDE_INSTALL_DIR); \
+ 	    done;
+ 	for i in $(ROOT)/library/*.tcl $(ROOT)/library/tclIndex $(ROOT)/library/prolog.ps $(ROOT)/unix/tkAppInit.c; \
+ 	    do \
+ 	    echo "Installing $$i"; \
+ 	    $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \
+ 	    done;
+ 
+ install-minimal:
+ 	@echo "Installing DLL"
+ 	@$(INSTALL_DATA) $(TKDLL) $(BIN_INSTALL_DIR)/$(TKDLL)
+ 	@for i in $(INSTALL_ROOT)${prefix}/lib $(SCRIPT_INSTALL_DIR) ; \
+ 	    do \
+ 	    if [ ! -d $$i ] ; then \
+ 		echo "Making directory $$i"; \
+ 		mkdir $$i; \
+ 		chmod 755 $$i; \
+ 		else true; \
+ 		fi; \
+ 	    done;
+ 	for i in $(ROOT)/library/*.tcl $(ROOT)/library/tclIndex $(ROOT)/library/prolog.ps; \
+ 	    do \
+ 	    echo "Installing $$i"; \
+ 	    $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \
+ 	    done;
+ 
+ install-demos:
+ 	@for i in $(INSTALL_ROOT)${prefix}/lib $(SCRIPT_INSTALL_DIR) \
+ 		$(SCRIPT_INSTALL_DIR)/demos \
+ 		$(SCRIPT_INSTALL_DIR)/demos/images ; \
+ 	    do \
+ 	    if [ ! -d $$i ] ; then \
+ 		echo "Making directory $$i"; \
+ 		mkdir $$i; \
+ 		chmod 755 $$i; \
+ 		else true; \
+ 		fi; \
+ 	    done;
+ 	@for i in $(ROOT)/library/demos/*; \
+ 	    do \
+ 	    if [ -f $$i ] ; then \
+ 		echo "Installing $$i"; \
+ 		sed -e '3 s|exec wish|exec $(WISH)|' \
+ 			$$i > $(SCRIPT_INSTALL_DIR)/demos/`basename $$i`; \
+ 	    fi; \
+ 	    done;
+ 	@for i in $(DEMOPROGS); \
+ 	    do \
+ 	    chmod 755 $(SCRIPT_INSTALL_DIR)/demos/$$i; \
+ 	    done;
+ 	@for i in $(ROOT)/library/demos/images/*; \
+ 	    do \
+ 	    if [ -f $$i ] ; then \
+ 		echo "Installing $$i"; \
+ 		$(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/demos/images; \
+ 		fi; \
+ 	    done;
+ 
+ $(TKLIBSA): $(TKOBJS) $(TKSTUBOBJS)
+ 	$(AR) cr $(TKLIBSA) $(TKOBJS) $(TKSTUBOBJS)
+ 
+ $(TKSTUBLIB): $(TKSTUBOBJS)
+ 	$(AR) cr $(TKSTUBLIB) $(TKSTUBOBJS)
+ 
+ $(TKDLL): $(TKDLLOBJS) tkres.o tk.def
+ 	$(DLLWRAP) -s $(DLL_LDFLAGS) -o $@ $(TKDLLOBJS) \
+ 	  --def tk.def tkres.o \
+ 	  $(TCLLIBDIR)/$(TCLSTUBLIB) $(DLL_LDLIBS)
+ 
+ $(TKLIB): $(TMPDIR)/tk.def $(TKDLL)
+ 	$(DLLTOOL) --as=$(AS) --dllname $(TKDLL) --def $(TMPDIR)/tk.def \
+ 	  --output-lib $(TKLIB)
+ 
+ $(TKPLUGINLIB): $(TMPDIR)/plugin.def
+ 	$(DLLTOOL) --as=$(AS) --dllname $(TKPLUGINDLL) \
+ 	  --def $(TMPDIR)/plugin.def --output-lib $(TKPLUGINLIB)
+ 
+ $(TKPLUGINDLL): $(TKOBJS) tkres.o $(TMPDIR)/plugin.def
+ 	$(DLLWRAP) $(DLL_LDFLAGS) -o $(TKPLUGINDLL) \
+ 	  --def plugin.def $(TKOBJS) tkres.o \
+ 	  $(TCLDIR)/$(TCLSTUBLIB) $(DLL_LDLIBS)
+ 
+ 
+ $(TESTDLL):	$(TMPDIR)/tkTest.o $(TMPDIR)/tclDllEntry.o $(OUTDIR)/$(TKSTUBLIB)
+ 	echo EXPORTS > $(TMPDIR)/tktest.def
+ 	echo Tktest_Init >> $(TMPDIR)/tktest.def
+ 	$(DLLWRAP) -s $(DLL_LDFLAGS) -o $@ \
+ 	  --def $(TMPDIR)/tktest.def $(TMPDIR)/tkTest.o $(TMPDIR)/tclDllEntry.o \
+ 	  $(TCLLIBDIR)/$(TCLSTUBLIB) $(OUTDIR)/$(TKSTUBLIB)
+ 	rm -f $(TMPDIRNAME)/tktest.def
+ 
+ $(PTESTDLL):	$(TMPDIR)/tkWinTest.o $(TMPDIR)/tclDllEntry.o $(OUTDIR)/$(TKSTUBLIB)
+ 	echo EXPORTS > $(TMPDIR)/tkptest.def
+ 	echo Tkptest_Init >> $(TMPDIR)/tkptest.def
+ 	$(DLLWRAP) -s $(DLL_LDFLAGS) -o $@ \
+ 	  --def $(TMPDIR)/tkptest.def $(TMPDIR)/tkWinTest.o $(TMPDIR)/tclDllEntry.o \
+ 	  $(TCLLIBDIR)/$(TCLSTUBLIB) $(OUTDIR)/$(TKSTUBLIB)
+ 	rm -f $(TMPDIRNAME)/tkptest.def
+ 
+ $(SQUAREDLL):	$(TMPDIR)/tkSquare.o $(TMPDIR)/tclDllEntry.o $(OUTDIR)/$(TKSTUBLIB)
+ 	echo EXPORTS > $(TMPDIR)/square.def
+ 	echo Tksquare_Init >> $(TMPDIR)/square.def
+ 	$(DLLWRAP) -s $(DLL_LDFLAGS) -o $@ \
+ 	  --def $(TMPDIR)/square.def $(TMPDIR)/tkSquare.o $(TMPDIR)/tclDllEntry.o \
+ 	  $(TCLLIBDIR)/$(TCLSTUBLIB) $(OUTDIR)/$(TKSTUBLIB)
+ 	rm -f $(TMPDIRNAME)/square.def
+ 
+ 
+ 
+ $(WISH): $(WISHOBJS) wishres.o $(TKLIB)
+ 	$(CC) -mno-cygwin $(ldebug) $(guilflags) $(WISHOBJS) wishres.o -o $@ \
+ 		$(TKLIB) $(TCLLIBDIR)/$(TCLLIB) $(guilibsdll)
+ 	strip $(WISH)
+ 
+ $(WISHP): $(WISHOBJS) $(TKPLUGINLIB) wishres.o
+ 	$(CC) -mno-cygwin $(ldebug) $(guilflags) $(WISHOBJS) wishres.o -o $@ \
+ 		$(TKPLUGINLIB) $(TCLLIBDIR)/$(TCLPLUGINLIB) $(guilibsdll)
+ 
+ tk.def: $(TKDLLOBJS)
+ 	$(DLLTOOL) --export-all --exclude-symbols DllMain@12 --output-def $@ $(TKDLLOBJS)
+ 
+ plugin.def: $(TKDLLOBJS)
+ 	$(DLLTOOL) --export-all --exclude-symbols DllMain@12 --output-def $@ $(TKDLLOBJS)
+ 
+ $(DUMPEXTS): $(TCLDIR)\win\winDumpExts.c
+ 	$(cc32) $(CON_CFLAGS) -Fo$(TMPDIR)\ $?
+ 	set LIB=$(TOOLS32)\lib
+ 	$(link32) $(ldebug) $(conlflags) $(guilibs) -out:$@ \
+ 		$(TMPDIR)\winDumpExts.obj 
+ 
+ $(TMPDIR)/tkTest.o: $(GENERICDIR)/tkTest.c
+ 	$(CC) -c $(TK_CFLAGS) -DUSE_TCL_STUBS -DUSE_TK_STUBS -DNO_PLATFORM_TEST $(GENERICDIR)/tkTest.c
+ 
+ $(TMPDIR)/tkSquare.o: $(GENERICDIR)/tkSquare.c
+ 	$(CC) -c $(TK_CFLAGS) -DUSE_TCL_STUBS -DUSE_TK_STUBS $(GENERICDIR)/tkSquare.c
+ 
+ $(TMPDIR)/tkWinTest.o: $(WINDIR)/tkWinTest.c
+ 	$(CC) -c $(TK_CFLAGS) -DUSE_TCL_STUBS -DUSE_TK_STUBS $(WINDIR)/tkWinTest.c
+ 
+ $(TMPDIR)/winMain.o: $(TMPDIR)/winMain.c
+ 	$(CC) -c $(TK_CFLAGS) $(TMPDIR)/winMain.c
+ 
+ 
+ #
+ # Implicit rules
+ #
+ 
+ .c.o:
+ 	$(CC) -c $(TK_CFLAGS) -DUSE_TCL_STUBS $<
+ 
+ tkres.o: $(ROOT)/win/rc/tk.rc
+ 	$(WINDRES) --include $(ROOT)/win/rc --include $(ROOT)/generic --include $(TCLDIR)/generic \
+ 	  --define VS_VERSION_INFO=1 $(ROOT)/win/rc/tk.rc tkres.o
+ 
+ wishres.o: $(ROOT)/win/rc/wish.rc
+ 	$(WINDRES) --include $(ROOT)/win/rc --include $(ROOT)/generic --include $(TCLDIR)/generic \
+ 	  --define VS_VERSION_INFO=1 $(ROOT)/win/rc/wish.rc wishres.o
+ 
+ #{$(ROOT)\win\rc}.rc{$(TMPDIR)}.res:
+ #	$(rc32) -fo $@ -r -i $(ROOT)\generic $<
+ 
+ clean:
+ 	rm -f *.exp *.a *.dll *.exe $(TMPDIR)/*.o *.res *.def
+ 	rm -f tk.base tkplugin.base
+ 
+ # dependencies
+ 
+ $(TMPDIR)/tk.res: \
+     $(RCDIR)/buttons.bmp \
+     $(RCDIR)/cursor*.cur \
+     $(RCDIR)/tk.ico
+ 
+ $(GENERICDIR)/default.h: $(WINDIR)/tkWinDefault.h
+ $(GENERICDIR)/tkButton.c: $(GENERICDIR)/default.h
+ $(GENERICDIR)/tkCanvas.c: $(GENERICDIR)/default.h
+ $(GENERICDIR)/tkEntry.c: $(GENERICDIR)/default.h
+ $(GENERICDIR)/tkFrame.c: $(GENERICDIR)/default.h
+ $(GENERICDIR)/tkListbox.c: $(GENERICDIR)/default.h
+ $(GENERICDIR)/tkMenu.c: $(GENERICDIR)/default.h
+ $(GENERICDIR)/tkMenubutton.c: $(GENERICDIR)/default.h
+ $(GENERICDIR)/tkMessage.c: $(GENERICDIR)/default.h
+ $(GENERICDIR)/tkScale.c: $(GENERICDIR)/default.h
+ $(GENERICDIR)/tkScrollbar.c: $(GENERICDIR)/default.h
+ $(GENERICDIR)/tkText.c: $(GENERICDIR)/default.h
+ $(GENERICDIR)/tkTextIndex.c: $(GENERICDIR)/default.h
+ $(GENERICDIR)/tkTextTag.c: $(GENERICDIR)/default.h
+ 
+ $(GENERICDIR)/tkText.c: $(GENERICDIR)/tkText.h
+ $(GENERICDIR)/tkTextBTree.c: $(GENERICDIR)/tkText.h
+ $(GENERICDIR)/tkTextDisp.c: $(GENERICDIR)/tkText.h
+ $(GENERICDIR)/tkTextDisp.c: $(GENERICDIR)/tkText.h
+ $(GENERICDIR)/tkTextImage.c: $(GENERICDIR)/tkText.h
+ $(GENERICDIR)/tkTextIndex.c: $(GENERICDIR)/tkText.h
+ $(GENERICDIR)/tkTextMark.c: $(GENERICDIR)/tkText.h
+ $(GENERICDIR)/tkTextTag.c: $(GENERICDIR)/tkText.h
+ $(GENERICDIR)/tkTextWind.c: $(GENERICDIR)/tkText.h
+ 
+ $(GENERICDIR)/tkMacWinMenu.c: $(GENERICDIR)/tkMenu.h
+ $(GENERICDIR)/tkMenu.c: $(GENERICDIR)/tkMenu.h
+ $(GENERICDIR)/tkMenuDraw.c: $(GENERICDIR)/tkMenu.h
+ $(WINDIR)/tkWinMenu.c: $(GENERICDIR)/tkMenu.h
+ 
*** win/aclocal.m4.orig	Sat Aug 14 00:06:27 1999
--- win/aclocal.m4	Fri Sep 24 21:25:43 1999
***************
*** 346,366 ****
      # set various compiler flags depending on whether we are using gcc or cl
      
      if test "${GCC}" = "yes" ; then
! 	CFLAGS_DEBUG=-g
! 	CFLAGS_OPTIMIZE=-O
! 	CFLAGS_WARNING="-Wall -Wconversion"
! 	LDFLAGS_DEBUG=-g
! 	LDFLAGS_OPTIMIZE=-O
! 	PATHTYPE=-u
  	
  	# Specify the CC output file names based on the target name
! 	CC_OBJNAME="-o \[$]@"
! 	CC_EXENAME="-o \[$]@"
      else
  	SHLIB_LD="link -dll -nologo"
  	SHLIB_LD_LIBS="user32.lib advapi32.lib"
  	LIBS="user32.lib advapi32.lib"
  	AR="lib -nologo"
  	RC="rc"
  	MAKE_LIB="\${AR} -out:\[$]@"
  	MAKE_EXE="\${CC} -Fe\[$]@"
--- 346,401 ----
      # set various compiler flags depending on whether we are using gcc or cl
      
      if test "${GCC}" = "yes" ; then
! 	SHLIB_LD="dllwrap"
! 	SHLIB_LD_LIBS="-luser32 -ladvapi32"
! 	LIBS="user32.lib advapi32.lib"
! 	AR="ar cf"
! 	RC="winres"
! 	MAKE_LIB="\${AR} \[$]@"
! 	MAKE_EXE="\${CC} -Fe\[$]@"
! 	
! 	if test "${SHARED_BUILD}" = "0" ; then
! 	    # static
!             AC_MSG_RESULT([using static flags])
! 	    runtime=-MT
! 	    MAKE_DLL="echo "
! 	    LIBSUFFIX="s\${DBGX}.a"
! 	    LIBRARIES="\${STATIC_LIBRARIES}"
! 	    EXESUFFIX="s\${DBGX}.exe"
! 	    DLLSUFFIX=""
! 	else
! 	    # dynamic
!             AC_MSG_RESULT([using shared flags])
! 	    runtime=-MD
! 	    MAKE_DLL="\${SHLIB_LD} \${SHLIB_LD_LIBS} \$(LDFLAGS) -out:\[$]@"
! 	    LIBSUFFIX="\${DBGX}.a"
! 	    DLLSUFFIX="\${DBGX}.dll"
! 	    EXESUFFIX="\${DBGX}.exe"
! 	    LIBRARIES="\${SHARED_LIBRARIES}"
! 	fi
! 
! 	EXTRA_CFLAGS="-YX"
! 	CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d"
! 	CFLAGS_OPTIMIZE="-nologo -O2 -Gs -GD ${runtime}"
! 	CFLAGS_WARNING="-W3"
! 	LDFLAGS_DEBUG="-debug:full -debugtype:cv"
! 	LDFLAGS_OPTIMIZE="-release"
! 	PATHTYPE=-w
  	
  	# Specify the CC output file names based on the target name
! 	CC_OBJNAME="-Fo\[$]@"
! 	CC_EXENAME="-Fe\"\$(shell cygpath \$(PATHTYPE) '\[$]@')\""
! 
! 	# Specify linker flags depending on the type of app being 
! 	# built -- Console vs. Window.
! 	LDFLAGS_CONSOLE="-subsystem:console"
! 	LDFLAGS_WINDOW="-subsystem:windows"
      else
  	SHLIB_LD="link -dll -nologo"
  	SHLIB_LD_LIBS="user32.lib advapi32.lib"
  	LIBS="user32.lib advapi32.lib"
  	AR="lib -nologo"
+ 	STLIB_LD="lib -nologo"
  	RC="rc"
  	MAKE_LIB="\${AR} -out:\[$]@"
  	MAKE_EXE="\${CC} -Fe\[$]@"
*** win/configure.orig	Sat Aug 14 00:06:27 1999
--- win/configure	Fri Sep 24 21:25:43 1999
***************
*** 1022,1042 ****
      # set various compiler flags depending on whether we are using gcc or cl
      
      if test "${GCC}" = "yes" ; then
! 	CFLAGS_DEBUG=-g
! 	CFLAGS_OPTIMIZE=-O
! 	CFLAGS_WARNING="-Wall -Wconversion"
! 	LDFLAGS_DEBUG=-g
! 	LDFLAGS_OPTIMIZE=-O
! 	PATHTYPE=-u
  	
  	# Specify the CC output file names based on the target name
! 	CC_OBJNAME="-o \$@"
! 	CC_EXENAME="-o \$@"
      else
  	SHLIB_LD="link -dll -nologo"
  	SHLIB_LD_LIBS="user32.lib advapi32.lib"
  	LIBS="user32.lib advapi32.lib"
  	AR="lib -nologo"
  	RC="rc"
  	MAKE_LIB="\${AR} -out:\$@"
  	MAKE_EXE="\${CC} -Fe\$@"
--- 1022,1077 ----
      # set various compiler flags depending on whether we are using gcc or cl
      
      if test "${GCC}" = "yes" ; then
! 	SHLIB_LD="dllwrap"
! 	SHLIB_LD_LIBS="-luser32 -ladvapi32"
! 	LIBS="user32.lib advapi32.lib"
! 	AR="ar cf"
! 	RC="winres"
! 	MAKE_LIB="\${AR} \$@"
! 	MAKE_EXE="\${CC} -Fe\$@"
! 	
! 	if test "${SHARED_BUILD}" = "0" ; then
! 	    # static
!             echo "$ac_t""using static flags" 1>&6
! 	    runtime=-MT
! 	    MAKE_DLL="echo "
! 	    LIBSUFFIX="s\${DBGX}.a"
! 	    LIBRARIES="\${STATIC_LIBRARIES}"
! 	    EXESUFFIX="s\${DBGX}.exe"
! 	    DLLSUFFIX=""
! 	else
! 	    # dynamic
!             echo "$ac_t""using shared flags" 1>&6
! 	    runtime=-MD
! 	    MAKE_DLL="\${SHLIB_LD} \${SHLIB_LD_LIBS} \$(LDFLAGS) -out:\$@"
! 	    LIBSUFFIX="\${DBGX}.a"
! 	    DLLSUFFIX="\${DBGX}.dll"
! 	    EXESUFFIX="\${DBGX}.exe"
! 	    LIBRARIES="\${SHARED_LIBRARIES}"
! 	fi
! 
! 	EXTRA_CFLAGS="-YX"
! 	CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d"
! 	CFLAGS_OPTIMIZE="-nologo -O2 -Gs -GD ${runtime}"
! 	CFLAGS_WARNING="-W3"
! 	LDFLAGS_DEBUG="-debug:full -debugtype:cv"
! 	LDFLAGS_OPTIMIZE="-release"
! 	PATHTYPE=-w
  	
  	# Specify the CC output file names based on the target name
! 	CC_OBJNAME="-Fo\$@"
! 	CC_EXENAME="-Fe\"\$(shell cygpath \$(PATHTYPE) '\$@')\""
! 
! 	# Specify linker flags depending on the type of app being 
! 	# built -- Console vs. Window.
! 	LDFLAGS_CONSOLE="-subsystem:console"
! 	LDFLAGS_WINDOW="-subsystem:windows"
      else
  	SHLIB_LD="link -dll -nologo"
  	SHLIB_LD_LIBS="user32.lib advapi32.lib"
  	LIBS="user32.lib advapi32.lib"
  	AR="lib -nologo"
+ 	STLIB_LD="lib -nologo"
  	RC="rc"
  	MAKE_LIB="\${AR} -out:\$@"
  	MAKE_EXE="\${CC} -Fe\$@"
***************
*** 1089,1095 ****
  
  
      echo $ac_n "checking for build with symbols""... $ac_c" 1>&6
! echo "configure:1093: checking for build with symbols" >&5
      # Check whether --enable-symbols or --disable-symbols was given.
  if test "${enable_symbols+set}" = set; then
    enableval="$enable_symbols"
--- 1124,1130 ----
  
  
      echo $ac_n "checking for build with symbols""... $ac_c" 1>&6
! echo "configure:1128: checking for build with symbols" >&5
      # Check whether --enable-symbols or --disable-symbols was given.
  if test "${enable_symbols+set}" = set; then
    enableval="$enable_symbols"
***************
*** 1122,1128 ****
  
  
      echo $ac_n "checking the location of tclConfig.sh""... $ac_c" 1>&6
! echo "configure:1126: checking the location of tclConfig.sh" >&5
  
      if test -d ../../tcl8.2$TK_PATCH_LEVEL/win;  then
  	TCL_BIN_DIR_DEFAULT=../../tcl8.2$TK_PATCH_LEVEL/win
--- 1157,1163 ----
  
  
      echo $ac_n "checking the location of tclConfig.sh""... $ac_c" 1>&6
! echo "configure:1161: checking the location of tclConfig.sh" >&5
  
      if test -d ../../tcl8.2$TK_PATCH_LEVEL/win;  then
  	TCL_BIN_DIR_DEFAULT=../../tcl8.2$TK_PATCH_LEVEL/win
***************
*** 1148,1154 ****
  
  
      echo $ac_n "checking for existence of $TCL_BIN_DIR/tclConfig.sh""... $ac_c" 1>&6
! echo "configure:1152: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5
  
      if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
          echo "$ac_t""loading" 1>&6
--- 1183,1189 ----
  
  
      echo $ac_n "checking for existence of $TCL_BIN_DIR/tclConfig.sh""... $ac_c" 1>&6
! echo "configure:1187: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5
  
      if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
          echo "$ac_t""loading" 1>&6
*** win/makefile.vc.orig	Sat Jul 31 04:31:57 1999
--- win/makefile.vc	Fri Sep 24 21:26:42 1999
***************
*** 1,4 ****
! # Visual C++ 2.x and 4.0 makefile
  #
  # See the file "license.terms" for information on usage and redistribution
  # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
--- 1,4 ----
! # Visual C++ 2.x, 4.x, 5.0 and 6.0 makefile
  #
  # See the file "license.terms" for information on usage and redistribution
  # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
***************
*** 24,45 ****
  #
  # TCLDIR = location of top of Tcl source heirarchy
  #
  
  ROOT		= ..
! TOOLS32		= c:\program files\devstudio\vc
  TOOLS32_rc	= c:\program files\devstudio\sharedide
! TCLDIR		= ..\..\tcl8.2
  INSTALLDIR      = c:\program files\tcl
  
  # Set this to the appropriate value of /MACHINE: for your platform
  MACHINE	= IX86
  
  # Uncomment the following line to compile with thread support
! #THREADDEFINES = -DTCL_THREADS=1
  
  # Set NODEBUG to 0 to compile with symbols
  NODEBUG = 1
  
  # uncomment the following two lines to compile with TCL_MEM_DEBUG
  #DEBUGDEFINES	=-DTCL_MEM_DEBUG
  
--- 24,56 ----
  #
  # TCLDIR = location of top of Tcl source heirarchy
  #
+ # INSTALLDIR = where the install- targets should copy the binaries and
+ #           support files
+ #
  
  ROOT		= ..
! #TOOLS32 	= c:\msdev                                                 # VC++ 2.x,4.x
! #TOOLS32_rc	= c:\msdev
! TOOLS32		= c:\program files\devstudio\vc                            # VC++ 5.x
  TOOLS32_rc	= c:\program files\devstudio\sharedide
! #TOOLS32 	= c:\program files\microsoft visual studio\vc98            # VC++ 6.x
! #TOOLS32_rc	= c:\program files\microsoft visual studio\common\msdev98
! TCLDIR		= ..\..\tcl8.2.0
  INSTALLDIR      = c:\program files\tcl
  
  # Set this to the appropriate value of /MACHINE: for your platform
  MACHINE	= IX86
  
  # Uncomment the following line to compile with thread support
! THREADDEFINES = -DTCL_THREADS=1
  
  # Set NODEBUG to 0 to compile with symbols
  NODEBUG = 1
  
+ # Set NOSTATIC to 0 to compile as static libraries
+ NOSTATIC = 1
+ 
+ 
  # uncomment the following two lines to compile with TCL_MEM_DEBUG
  #DEBUGDEFINES	=-DTCL_MEM_DEBUG
  
***************
*** 58,69 ****
  
  
  BINROOT		= .
  !IF "$(NODEBUG)" == "1"
! TMPDIRNAME	= Release
! DBGX		=
  !ELSE
! TMPDIRNAME	= Debug
! DBGX		= d
  !ENDIF
  TMPDIR		= $(BINROOT)\$(TMPDIRNAME)
  OUTDIRNAME	= $(TMPDIRNAME)
--- 69,85 ----
  
  
  BINROOT		= .
+ !IF "$(NOSTATIC)" == "1"
+ S		=
+ !ELSE
+ S		= s
+ !ENDIF
  !IF "$(NODEBUG)" == "1"
! TMPDIRNAME	= Release$(S)
! DBGX		= $(S)
  !ELSE
! TMPDIRNAME	= Debug$(S)
! DBGX		= $(S)d
  !ENDIF
  TMPDIR		= $(BINROOT)\$(TMPDIRNAME)
  OUTDIRNAME	= $(TMPDIRNAME)
***************
*** 75,80 ****
--- 91,103 ----
  TKDLLNAME	= $(TKNAMEPREFIX)$(VERSION)$(DBGX).dll
  TKDLL 		= $(OUTDIR)\$(TKDLLNAME)
  TKLIB 		= $(OUTDIR)\$(TKNAMEPREFIX)$(VERSION)$(DBGX).lib
+ TKLIBS 		= $(OUTDIR)\$(TKNAMEPREFIX)$(VERSION)s$(DBGX).lib
+ TESTDLLNAME	= $(TKNAMEPREFIX)test.dll
+ TESTDLL 	= $(OUTDIR)\$(TESTDLLNAME)
+ TKPTESTDLLNAME	= $(TKNAMEPREFIX)ptest.dll
+ TKPTESTDLL 	= $(OUTDIR)\$(TKPTESTDLLNAME)
+ SQUAREDLLNAME	= $(TKNAMEPREFIX)square.dll
+ SQUAREDLL	= $(OUTDIR)\$(SQUAREDLLNAME)
  TKSTUBLIBNAME	= $(TKSTUBPREFIX)$(VERSION)$(DBGX).lib
  TKSTUBLIB	= $(OUTDIR)\$(TKSTUBLIBNAME)
  TKPLUGINDLLNAME	= $(TKNAMEPREFIX)$(VERSION)p$(DBG).dll
***************
*** 92,101 ****
--- 115,129 ----
  INCLUDE_INSTALL_DIR = $(INSTALLDIR)\include
  LIB_INSTALL_DIR = $(INSTALLDIR)\lib
  SCRIPT_INSTALL_DIR = $(LIB_INSTALL_DIR)\tk$(DOTVERSION)
+ X11_INCLUDE_INSTALL_DIR = $(INCLUDE_INSTALL_DIR)\X11
+ DEMOPROGS = browse hello ixset rmt rolodex square tcolor timer widget
  
  WISHOBJS = \
  	$(TMPDIR)\winMain.obj
  
+ WISHSAOBJS = \
+ 	$(TMPDIR)\winMainSA.obj
+ 
  TKTESTOBJS = \
  	$(TMPDIR)\tkTest.obj \
  	$(TMPDIR)\tkSquare.obj \
***************
*** 111,121 ****
  
  TKOBJS = \
  	$(TMPDIR)\tkConsole.obj \
  	$(TMPDIR)\tkUnixMenubu.obj \
  	$(TMPDIR)\tkUnixScale.obj \
  	$(XLIBOBJS) \
  	$(TMPDIR)\tkWin3d.obj \
- 	$(TMPDIR)\tkWin32Dll.obj \
  	$(TMPDIR)\tkWinButton.obj \
  	$(TMPDIR)\tkWinClipboard.obj \
  	$(TMPDIR)\tkWinColor.obj \
--- 139,149 ----
  
  TKOBJS = \
  	$(TMPDIR)\tkConsole.obj \
+ 	$(TMPDIR)\tkMain.obj \
  	$(TMPDIR)\tkUnixMenubu.obj \
  	$(TMPDIR)\tkUnixScale.obj \
  	$(XLIBOBJS) \
  	$(TMPDIR)\tkWin3d.obj \
  	$(TMPDIR)\tkWinButton.obj \
  	$(TMPDIR)\tkWinClipboard.obj \
  	$(TMPDIR)\tkWinColor.obj \
***************
*** 180,186 ****
  	$(TMPDIR)\tkImgUtil.obj \
  	$(TMPDIR)\tkListbox.obj \
  	$(TMPDIR)\tkMacWinMenu.obj \
- 	$(TMPDIR)\tkMain.obj \
  	$(TMPDIR)\tkMenu.obj \
  	$(TMPDIR)\tkMenubutton.obj \
  	$(TMPDIR)\tkMenuDraw.obj \
--- 208,213 ----
***************
*** 210,216 ****
  	$(TMPDIR)\tkStubLib.obj \
  	$(TMPDIR)\tkWindow.obj
  
! TKSTUBOBJS = $(TMPDIR)\tkStubLib.obj \
  
  
  cc32		= "$(TOOLS32)\bin\cl.exe"
--- 237,247 ----
  	$(TMPDIR)\tkStubLib.obj \
  	$(TMPDIR)\tkWindow.obj
  
! TKDLLOBJS = \
! 	$(TKOBJS) \
! 	$(TMPDIR)\tkWin32Dll.obj
! 
! TKSTUBOBJS = $(TMPDIR)\tkStubLib.obj
  
  
  cc32		= "$(TOOLS32)\bin\cl.exe"
***************
*** 221,237 ****
  
  WINDIR          = $(ROOT)\win
  GENERICDIR	= $(ROOT)\generic
  XLIBDIR		= $(ROOT)\xlib
  BITMAPDIR	= $(ROOT)\bitmaps
  TCLLIBDIR       = $(TCLDIR)\win\$(OUTDIRNAME)
  RCDIR		= $(WINDIR)\rc
  
  TK_INCLUDES	= -I$(WINDIR) -I$(GENERICDIR) -I$(BITMAPDIR) -I$(XLIBDIR) \
  			-I$(TCLDIR)\generic
  TK_DEFINES	= -D__WIN32__ $(DEBUGDEFINES) $(THREADDEFINES)
  
  TK_CFLAGS	= $(cdebug) $(cflags) $(cvarsdll) $(include32) \
! 			$(TK_INCLUDES) $(TK_DEFINES) -DUSE_TCL_STUBS
  
  WISH_CFLAGS	= $(cdebug) $(cflags) $(cvarsdll) $(include32) \
  			$(TK_INCLUDES) $(TK_DEFINES)
--- 252,275 ----
  
  WINDIR          = $(ROOT)\win
  GENERICDIR	= $(ROOT)\generic
+ LIBDIR		= $(ROOT)\library
  XLIBDIR		= $(ROOT)\xlib
  BITMAPDIR	= $(ROOT)\bitmaps
  TCLLIBDIR       = $(TCLDIR)\win\$(OUTDIRNAME)
  RCDIR		= $(WINDIR)\rc
  
+ !IF "$(NOSTATIC)" == "1"
+ cstatic = -DUSE_TCL_STUBS
+ !ELSE
+ cstatic =
+ !ENDIF
+ 
  TK_INCLUDES	= -I$(WINDIR) -I$(GENERICDIR) -I$(BITMAPDIR) -I$(XLIBDIR) \
  			-I$(TCLDIR)\generic
  TK_DEFINES	= -D__WIN32__ $(DEBUGDEFINES) $(THREADDEFINES)
  
  TK_CFLAGS	= $(cdebug) $(cflags) $(cvarsdll) $(include32) \
! 			$(TK_INCLUDES) $(TK_DEFINES) $(cstatic)
  
  WISH_CFLAGS	= $(cdebug) $(cflags) $(cvarsdll) $(include32) \
  			$(TK_INCLUDES) $(TK_DEFINES)
***************
*** 280,292 ****
  ######################################################################
  
  !IF "$(NODEBUG)" == "1"
! !IF "$(MACHINE)" == "ALPHA"
! # MSVC on Alpha doesn't understand -Ot
! cdebug = -O2i -Gs -GD
! !ELSE
! # NOTE: Due to a bug in MSVC, we cannot use -O2 here or Tk starts to misbehave.
! cdebug = -Oti -Gs -GD
! !ENDIF
  !ELSE
  cdebug = -Z7 -Od -WX
  !ENDIF
--- 318,324 ----
  ######################################################################
  
  !IF "$(NODEBUG)" == "1"
! cdebug = -Ox -Oy- -GD
  !ELSE
  cdebug = -Z7 -Od -WX
  !ENDIF
***************
*** 326,332 ****
  # Project specific targets
  ######################################################################
  
! all:    setup $(WISH) $(CAT32)
  install: install-binaries install-libraries
  plugin:	setup $(TKPLUGINDLL) $(WISHP)
  tktest: setup $(TKTEST) $(CAT32)
--- 358,364 ----
  # Project specific targets
  ######################################################################
  
! all:    setup $(WISH) $(TKLIBS) $(CAT32)
  install: install-binaries install-libraries
  plugin:	setup $(TKPLUGINDLL) $(WISHP)
  tktest: setup $(TKTEST) $(CAT32)
***************
*** 355,362 ****
--- 387,396 ----
  	@mkd "$(BIN_INSTALL_DIR)"
  	copy $(TKDLL) "$(BIN_INSTALL_DIR)"
  	copy $(WISH) "$(BIN_INSTALL_DIR)"
+ 	-copy $(WISHSA) "$(BIN_INSTALL_DIR)"
  	@mkd "$(LIB_INSTALL_DIR)"
  	copy $(TKLIB) "$(LIB_INSTALL_DIR)"
+ 	copy $(TKLIBS) "$(LIB_INSTALL_DIR)"
  
  install-libraries:
  	@mkd "$(INCLUDE_INSTALL_DIR)"
***************
*** 379,390 ****
  $(TKSTUBLIB): $(TKSTUBOBJS)
          $(lib32) /out:$@ $(TKSTUBOBJS)
  
! $(TKDLL): $(TKOBJS) $(TMPDIR)\tk.res $(TMPDIR)\tk.def
  	set LIB=$(TOOLS32)\lib
         $(link32) $(ldebug) $(dlllflags) -def:$(TMPDIR)\tk.def \
  		-out:$@ $(TMPDIR)\tk.res $(TCLLIBDIR)\$(TCLSTUBLIB) \
  		$(guilibsdll) @<<
! 			$(TKOBJS)
  <<
  
  $(TKPLUGINLIB): $(TKPLUGINDLL)
--- 413,430 ----
  $(TKSTUBLIB): $(TKSTUBOBJS)
          $(lib32) /out:$@ $(TKSTUBOBJS)
  
! $(TKDLL): $(TKDLLOBJS) $(TMPDIR)\tk.res $(TMPDIR)\tk.def
  	set LIB=$(TOOLS32)\lib
         $(link32) $(ldebug) $(dlllflags) -def:$(TMPDIR)\tk.def \
  		-out:$@ $(TMPDIR)\tk.res $(TCLLIBDIR)\$(TCLSTUBLIB) \
  		$(guilibsdll) @<<
! 			$(TKDLLOBJS)
! <<
! 
! $(TKLIBS): $(TKOBJS)
!       @del $(TKLIBS)
!         $(lib32) -out:$(TKLIBS) @<<
!                $(TKOBJS)
  <<
  
  $(TKPLUGINLIB): $(TKPLUGINDLL)
***************
*** 413,428 ****
  		$(guilibsdll) $(TCLLIBDIR)\$(TCLPLUGINLIB) \
  		$(TKPLUGINLIB) $(WISHOBJS) 
  
! $(TKTEST): $(TKTESTOBJS) $(TKLIB) $(TMPDIR)\wish.res
  	set LIB=$(TOOLS32)\lib
! 	$(link32) $(ldebug) $(guilflags) $(TMPDIR)\wish.res -out:$@ \
! 		$(guilibsdll) $(TCLLIBDIR)\$(TCLLIB) $(TKLIB) $(TKTESTOBJS)
  
  $(TMPDIR)\tk.def: $(DUMPEXTS) $(TKOBJS)
  	$(DUMPEXTS) -o $@ $(TKDLLNAME) @<<
  		$(TKOBJS)
  <<
  
  $(TMPDIR)\plugin.def: $(DUMPEXTS) $(TKOBJS)
  	$(DUMPEXTS) -o $@ $(TKPLUGINDLLNAME) @<<
  		$(TKOBJS)
--- 453,503 ----
  		$(guilibsdll) $(TCLLIBDIR)\$(TCLPLUGINLIB) \
  		$(TKPLUGINLIB) $(WISHOBJS) 
  
! $(TESTDLL): $(TMPDIR)\tkTest.obj $(TMPDIR)\tkWinDllEntry.obj $(TKLIB) $(TCLLIBDIR)\$(TCLLIB) $(TMPDIR)\tktest.def
  	set LIB=$(TOOLS32)\lib
! 	$(link32) $(ldebug) $(dlllflags) -def:$(TMPDIR)\tktest.def \
! 		-out:$@ $(TKLIB) $(TCLLIBDIR)\$(TCLLIB) \
! 		$(guilibsdll) @<<
! 			$(TMPDIR)\tkTest.obj $(TMPDIR)\tkWinDllEntry.obj
! <<
! 
! $(TKPTESTDLL): $(TMPDIR)\tkWinTest.obj $(TMPDIR)\tkWinDllEntry.obj $(TKSTUBLIB) $(TCLLIBDIR)\$(TCLSTUBLIB) $(TMPDIR)\tkptest.def
! 	set LIB=$(TOOLS32)\lib
! 	$(link32) $(ldebug) $(dlllflags) -def:$(TMPDIR)\tkptest.def \
! 		-out:$@ $(TKSTUBLIB) $(TCLLIBDIR)\$(TCLSTUBLIB) \
! 		$(guilibsdll) @<<
! 			$(TMPDIR)\tkWinTest.obj $(TMPDIR)\tkWinDllEntry.obj
! <<
! 
! $(SQUAREDLL): $(TMPDIR)\tkSquare.obj $(TMPDIR)\tkWinDllEntry.obj $(TKSTUBLIB) $(TCLLIBDIR)\$(TCLSTUBLIB) $(TMPDIR)\tksquare.def
! 	set LIB=$(TOOLS32)\lib
! 	$(link32) $(ldebug) $(dlllflags) -def:$(TMPDIR)\tksquare.def \
! 		-out:$@ $(TKSTUBLIB) $(TCLLIBDIR)\$(TCLSTUBLIB) \
! 		$(guilibsdll) @<<
! 			$(TMPDIR)\tkSquare.obj $(TMPDIR)\tkWinDllEntry.obj
! <<
! 
  
  $(TMPDIR)\tk.def: $(DUMPEXTS) $(TKOBJS)
  	$(DUMPEXTS) -o $@ $(TKDLLNAME) @<<
  		$(TKOBJS)
  <<
  
+ $(TMPDIR)\tktest.def: $(DUMPEXTS) $(TMPDIR)\tkTest.obj
+ 	$(DUMPEXTS) -o $@ $(TESTDLLNAME) @<<
+ 		$(TMPDIR)\tkTest.obj
+ <<
+ 
+ $(TMPDIR)\tkptest.def: $(DUMPEXTS) $(TMPDIR)\tkWinTest.obj
+ 	$(DUMPEXTS) -o $@ $(TESTDLLNAME) @<<
+ 		$(TMPDIR)\tkWinTest.obj
+ <<
+ 
+ $(TMPDIR)\tksquare.def: $(DUMPEXTS) $(TMPDIR)\tkSquare.obj
+ 	$(DUMPEXTS) -o $@ $(SQUAREDLLNAME) @<<
+ 		$(TMPDIR)\tkSquare.obj
+ <<
+ 
  $(TMPDIR)\plugin.def: $(DUMPEXTS) $(TKOBJS)
  	$(DUMPEXTS) -o $@ $(TKPLUGINDLLNAME) @<<
  		$(TKOBJS)
***************
*** 451,464 ****
  # Special case object file targets
  #
  
- $(TMPDIR)\testMain.obj: $(ROOT)\win\winMain.c
- 	$(cc32) $(WISH_CFLAGS) -DTK_TEST -Fo$@ $?
- 
  $(TMPDIR)\tkTest.obj: $(ROOT)\generic\tkTest.c
! 	$(cc32) $(WISH_CFLAGS) -Fo$@ $?
  
  $(TMPDIR)\tkSquare.obj: $(ROOT)\generic\tkSquare.c
! 	$(cc32) $(WISH_CFLAGS) -Fo$@ $?
  
  $(TMPDIR)\winMain.obj: $(ROOT)\win\winMain.c
  	$(cc32) $(WISH_CFLAGS) -Fo$@ $?
--- 526,539 ----
  # Special case object file targets
  #
  
  $(TMPDIR)\tkTest.obj: $(ROOT)\generic\tkTest.c
! 	$(cc32) $(TK_CFLAGS) -DUSE_TK_STUBS -Fo$@ $?
! 
! $(TMPDIR)\tkWinTest.obj: $(ROOT)\win\tkWinTest.c
! 	$(cc32) $(TK_CFLAGS) -DUSE_TK_STUBS -Fo$@ $?
  
  $(TMPDIR)\tkSquare.obj: $(ROOT)\generic\tkSquare.c
! 	$(cc32) $(TK_CFLAGS) -DUSE_TK_STUBS -Fo$@ $?
  
  $(TMPDIR)\winMain.obj: $(ROOT)\win\winMain.c
  	$(cc32) $(WISH_CFLAGS) -Fo$@ $?
***************
*** 471,486 ****
  #
  
  {$(XLIBDIR)}.c{$(TMPDIR)}.obj:
! 	$(cc32) -DDLL_BUILD -DBUILD_tk $(TK_CFLAGS) -Fo$(TMPDIR)\ $<
  
  {$(GENERICDIR)}.c{$(TMPDIR)}.obj:
! 	$(cc32) -DDLL_BUILD -DBUILD_tk $(TK_CFLAGS) -Fo$(TMPDIR)\ $<
  
  {$(WINDIR)}.c{$(TMPDIR)}.obj:
! 	$(cc32) -DDLL_BUILD -DBUILD_tk $(TK_CFLAGS) -Fo$(TMPDIR)\ $<
  
  {$(ROOT)\unix}.c{$(TMPDIR)}.obj:
! 	$(cc32) -DDLL_BUILD -DBUILD_tk $(TK_CFLAGS) -Fo$(TMPDIR)\ $<
  
  {$(RCDIR)}.rc{$(TMPDIR)}.res:
  	$(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TOOLS32)\include" \
--- 546,561 ----
  #
  
  {$(XLIBDIR)}.c{$(TMPDIR)}.obj:
! 	$(cc32) $(TK_CFLAGS) -DSTATIC_BUILD -Fo$(TMPDIR)\ $<
  
  {$(GENERICDIR)}.c{$(TMPDIR)}.obj:
! 	$(cc32) $(TK_CFLAGS) -DSTATIC_BUILD -Fo$(TMPDIR)\ $<
  
  {$(WINDIR)}.c{$(TMPDIR)}.obj:
! 	$(cc32) $(TK_CFLAGS) -DSTATIC_BUILD -Fo$(TMPDIR)\ $<
  
  {$(ROOT)\unix}.c{$(TMPDIR)}.obj:
! 	$(cc32) $(TK_CFLAGS) -DSTATIC_BUILD -Fo$(TMPDIR)\ $<
  
  {$(RCDIR)}.rc{$(TMPDIR)}.res:
  	$(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TOOLS32)\include" \
*** win/pkgIndex.tk.orig	Fri Sep 24 21:25:43 1999
--- win/pkgIndex.tk	Fri Sep 24 21:25:43 1999
***************
*** 0 ****
--- 1,5 ----
+ # Tcl package index file, version 1.0
+ 
+ if {[package vcompare [info tclversion] 8.1] < 0} return
+ 
+ package ifneeded Tk 8.1 [list load tk81.dll Tk]
*** win/pkgIndex.win.orig	Fri Sep 24 21:25:43 1999
--- win/pkgIndex.win	Fri Sep 24 21:25:43 1999
***************
*** 0 ****
--- 1,7 ----
+ # Tcl package index file, version 1.0
+ 
+ package ifneeded Tk 8.0 [list load [file join $dir tk80.dll] Tk]
+ package ifneeded Tksquare 8.0 [list tclPkgSetup $dir Tksquare 8.0\
+     {{Tksquare.dll load square}}]
+ package ifneeded Tktest 8.0 [list tclPkgSetup $dir Tktest 8.0\
+     {{Tktest.dll load {testclipboard testcbind testdeleteapps testembed testmakeexist testmenubar testmetrics testprop testsend}}}]
*** win/tcl82plus.wse.orig	Fri Sep 24 21:25:43 1999
--- win/tcl82plus.wse	Fri Sep 24 21:26:54 1999
***************
*** 0 ****
--- 1,1089 ----
+ Document Type: WSE
+ item: Global
+   Version=6.0
+   Flags=00010100
+   Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+   Japanese Font Name=MS Gothic
+   Japanese Font Size=10
+   Progress Bar DLL=%_WISE_%\Progress\WIZ%_EXE_OS_TYPE_%.DLL
+   Start Gradient=0 0 255
+   End Gradient=0 0 0
+   Windows Flags=00000100000000010010110000011000
+   Log Pathname=%MAINDIR%\INSTALL.LOG
+   Message Font=MS Sans Serif
+   Font Size=8
+   Disk Filename=SETUP
+   Patch Flags=0000000000000001
+   Patch Threshold=85
+   Patch Memory=4000
+   FTP Cluster Size=20
+   Per-User Version ID=1
+   Dialogs Version=6
+   Variable Name1=_SYS_
+   Variable Default1=C:\WINNT\System32
+   Variable Flags1=00001000
+   Variable Name2=_WISE_
+   Variable Default2=C:\Program Files\Wise
+   Variable Flags2=00001000
+   Variable Name3=_ODBC16_
+   Variable Default3=C:\WINNT\System32
+   Variable Flags3=00001000
+   Variable Name4=_ODBC32_
+   Variable Default4=C:\PROGRA~1\Wise\Runtime\ODBC30
+   Variable Flags4=00001000
+ end
+ item: Open/Close INSTALL.LOG
+   Flags=00000001
+ end
+ item: Check if File/Dir Exists
+   Pathname=%SYS32%
+   Flags=10000100
+ end
+ item: Set Variable
+   Variable=SYS32
+   Value=%WIN%
+ end
+ item: End Block
+ end
+ item: Set Variable
+   Variable=APPTITLE
+   Value=Tcl/Tk 8.2 for Windows
+   Flags=10000000
+ end
+ item: Set Variable
+   Variable=GROUP
+   Value=Tcl
+   Flags=10000000
+ end
+ item: Set Variable
+   Variable=DISABLED
+   Value=!
+ end
+ item: Set Variable
+   Variable=MAINDIR
+   Value=Tcl
+   Flags=10000000
+ end
+ item: Check Configuration
+   Flags=10111011
+ end
+ item: Get Registry Key Value
+   Variable=COMMON
+   Key=SOFTWARE\Microsoft\Windows\CurrentVersion
+   Default=C:\Program Files\Common Files
+   Value Name=CommonFilesDir
+   Flags=00000100
+ end
+ item: Get Registry Key Value
+   Variable=PROGRAM_FILES
+   Key=SOFTWARE\Microsoft\Windows\CurrentVersion
+   Default=C:\Program Files
+   Value Name=ProgramFilesDir
+   Flags=00000100
+ end
+ item: Set Variable
+   Variable=MAINDIR
+   Value=%PROGRAM_FILES%\%MAINDIR%
+   Flags=00001100
+ end
+ item: Set Variable
+   Variable=EXPLORER
+   Value=1
+ end
+ item: Else Statement
+ end
+ item: Set Variable
+   Variable=MAINDIR
+   Value=C:\%MAINDIR%
+   Flags=00001100
+ end
+ item: End Block
+ end
+ item: Set Variable
+   Variable=BACKUP
+   Value=%MAINDIR%\BACKUP
+   Flags=10000000
+ end
+ item: Set Variable
+   Variable=DOBACKUP
+   Value=B
+   Flags=10000000
+ end
+ item: Set Variable
+   Variable=COMPONENTS
+   Value=AC
+   Flags=10000000
+ end
+ item: Set Variable
+   Variable=BRANDING
+   Value=0
+ end
+ item: If/While Statement
+   Variable=BRANDING
+   Value=1
+ end
+ item: Read INI Value
+   Variable=NAME
+   Pathname=%INST%\CUSTDATA.INI
+   Section=Registration
+   Item=Name
+ end
+ item: Read INI Value
+   Variable=COMPANY
+   Pathname=%INST%\CUSTDATA.INI
+   Section=Registration
+   Item=Company
+ end
+ item: If/While Statement
+   Variable=NAME
+ end
+ item: Set Variable
+   Variable=DOBRAND
+   Value=1
+ end
+ item: End Block
+ end
+ item: End Block
+ end
+ item: Display Graphic
+   Pathname=C:\TclBlast\Tclplus.bmp
+   X Position=16384
+   Y Position=16384
+   Flags=0000000000000010
+ end
+ item: Wizard Block
+   Direction Variable=DIRECTION
+   Display Variable=DISPLAY
+   Bitmap Pathname=%_WISE_%\DIALOGS\TEMPLATE\WIZARD.BMP
+   X Position=9
+   Y Position=10
+   Filler Color=8421440
+   Dialog=Select Program Manager Group
+   Dialog=Select Backup Directory
+   Dialog=Display Registration Information
+   Dialog=Get Registration Information
+   Variable=EXPLORER
+   Variable=DOBACKUP
+   Variable=DOBRAND
+   Variable=DOBRAND
+   Value=1
+   Value=A
+   Value=1
+   Value=1
+   Compare=0
+   Compare=1
+   Compare=0
+   Compare=1
+   Flags=00000011
+ end
+ item: Custom Dialog Set
+   Name=Welcome
+   Display Variable=DISPLAY
+   item: Dialog
+     Title=Welcome
+     Width=280
+     Height=224
+     Font Name=Helv
+     Font Size=8
+     item: Push Button
+       Rectangle=172 185 214 199
+       Variable=DIRECTION
+       Value=N
+       Create Flags=01010000000000010000000000000001
+       Text=&Next >
+     end
+     item: Push Button
+       Rectangle=222 185 264 199
+       Action=3
+       Create Flags=01010000000000010000000000000000
+       Text=Cancel
+     end
+     item: Static
+       Rectangle=9 177 263 178
+       Action=3
+       Create Flags=01010000000000000000000000000111
+     end
+     item: Static
+       Rectangle=83 8 121 33
+       Action=2
+       Enabled Color=00000000000000001111111111111111
+       Create Flags=01010000000000000000000000001011
+       Pathname=%_WISE_%\dialogs\template\install.grf
+     end
+     item: Static
+       Rectangle=121 10 258 44
+       Enabled Color=00000000000000001111111111111111
+       Create Flags=01010000000000000000000000000000
+       Text=Welcome to %APPTITLE% Setup program. This program will install %APPTITLE% (with plus-, dash-, Img-, and elide- patch) on your computer.
+     end
+     item: Static
+       Rectangle=90 45 260 175
+       Enabled Color=00000000000000001111111111111111
+       Create Flags=01010000000000000000000000000000
+       Text=It is strongly recommended that you exit all Windows programs before running this Setup Program.
+       Text=
+       Text=Click Cancel to quit Setup and close any programs you have running.  Click Next to continue with the Setup program.
+       Text=
+       Text=This software is provided 'as-is', without any express or implied warranty.  In no event will the author(s) be held liable for any damages arising from the use of this software.
+       Text=
+       Text=Permission is granted to anyone to use this software for any purpose, including commercial applications, and redistribute it freely.
+     end
+   end
+ end
+ item: Custom Dialog Set
+   Name=Select Destination Directory
+   Display Variable=DISPLAY
+   item: Dialog
+     Title=Choose Destination Location
+     Width=280
+     Height=224
+     Font Name=Helv
+     Font Size=8
+     item: Push Button
+       Rectangle=172 185 214 199
+       Variable=DIRECTION
+       Value=N
+       Create Flags=01010000000000010000000000000001
+       Text=&Next >
+     end
+     item: Push Button
+       Rectangle=130 185 172 199
+       Variable=DIRECTION
+       Value=B
+       Create Flags=01010000000000010000000000000000
+       Flags=0000000000000001
+       Text=< &Back
+     end
+     item: Push Button
+       Rectangle=222 185 264 199
+       Action=3
+       Create Flags=01010000000000010000000000000000
+       Text=Cancel
+     end
+     item: Static
+       Rectangle=9 177 263 178
+       Action=3
+       Create Flags=01010000000000000000000000000111
+     end
+     item: Static
+       Rectangle=90 10 260 122
+       Create Flags=01010000000000000000000000000000
+       Text=Setup will install %APPTITLE% in the following folder.
+       Text=
+       Text=To install into a different folder, click Browse, and select another folder. 
+       Text=
+       Text=You can choose not to install %APPTITLE% by clicking Cancel to exit Setup.
+     end
+     item: Static
+       Rectangle=90 134 260 162
+       Action=1
+       Create Flags=01010000000000000000000000000111
+       Text=Destination Folder
+     end
+     item: Push Button
+       Rectangle=213 143 255 157
+       Variable=MAINDIR_SAVE
+       Value=%MAINDIR%
+       Destination Dialog=1
+       Action=2
+       Create Flags=01010000000000010000000000000000
+       Text=B&rowse...
+     end
+     item: Static
+       Rectangle=95 146 211 157
+       Destination Dialog=2
+       Create Flags=01010000000000000000000000000000
+       Text=%MAINDIR%
+     end
+   end
+   item: Dialog
+     Title=Select Destination Directory
+     Width=221
+     Height=173
+     Font Name=Helv
+     Font Size=8
+     item: Listbox
+       Rectangle=5 2 160 149
+       Variable=MAINDIR
+       Create Flags=01010000100000010000000101000000
+       Flags=0000110000100010
+       Text=%MAINDIR%
+     end
+     item: Push Button
+       Rectangle=167 6 212 21
+       Create Flags=01010000000000010000000000000001
+       Text=OK
+     end
+     item: Push Button
+       Rectangle=167 25 212 40
+       Variable=MAINDIR
+       Value=%MAINDIR_SAVE%
+       Create Flags=01010000000000010000000000000000
+       Flags=0000000000000001
+       Text=Cancel
+     end
+   end
+ end
+ item: Custom Dialog Set
+   Name=Select Components
+   Display Variable=DISPLAY
+   Flags=00000001
+   item: Dialog
+     Title=Select Components 
+     Width=280
+     Height=224
+     Font Name=Helv
+     Font Size=8
+     item: Push Button
+       Rectangle=172 185 214 199
+       Variable=DIRECTION
+       Value=N
+       Create Flags=01010000000000010000000000000001
+       Text=&Next >
+     end
+     item: Push Button
+       Rectangle=130 185 172 199
+       Variable=DIRECTION
+       Value=B
+       Create Flags=01010000000000010000000000000000
+       Text=< &Back
+     end
+     item: Push Button
+       Rectangle=222 185 264 199
+       Action=3
+       Create Flags=01010000000000010000000000000000
+       Text=Cancel
+     end
+     item: Static
+       Rectangle=9 177 263 178
+       Action=3
+       Create Flags=01010000000000000000000000000111
+     end
+     item: Static
+       Rectangle=205 156 253 166
+       Variable=COMPONENTS
+       Value=MAINDIR
+       Create Flags=01010000000000000000000000000010
+     end
+     item: Static
+       Rectangle=205 148 253 157
+       Variable=COMPONENTS
+       Create Flags=01010000000000000000000000000010
+     end
+     item: Static
+       Rectangle=95 147 184 158
+       Create Flags=01010000000000000000000000000000
+       Text=Disk Space Required:
+     end
+     item: Static
+       Rectangle=95 157 190 167
+       Create Flags=01010000000000000000000000000000
+       Text=Disk Space Remaining:
+     end
+     item: Static
+       Rectangle=90 138 264 168
+       Action=1
+       Create Flags=01010000000000000000000000000111
+     end
+     item: Static
+       Rectangle=90 8 260 41
+       Create Flags=01010000000000000000000000000000
+       Text=In the options list below, select the checkboxes for the options that you would like to have installed.  The disk space fields reflect the requirements of the options you have selected.
+     end
+     item: Listbox
+       Rectangle=90 42 263 133
+       Variable=COMPONENTS
+       Create Flags=01010000101000010000000101010001
+       Flags=0000010001000111
+       Text=Windows Help
+       Text=Demos
+       Text=Development headers & stub libraries
+       Text=Development libraries (VC++ 5.0, no stubs)
+       Text=Development libraries (gcc-2.95, no stubs)
+       Text=
+       Text French=Windows Help
+       Text French=Demos
+       Text French=Development headers & stub libraries
+       Text French=Development libraries (VC++ 5.0, no stubs)
+       Text French=Static libraries (VC++ 5.0, no stubs)
+       Text French=
+       Text German=Windows Help
+       Text German=Demos
+       Text German=Development headers & stub libraries
+       Text German=Development libraries (VC++ 5.0, no stubs)
+       Text German=Static libraries (VC++ 5.0, no stubs)
+       Text German=
+       Text Spanish=Windows Help
+       Text Spanish=Demos
+       Text Spanish=Development headers & stub libraries
+       Text Spanish=Development libraries (VC++ 5.0, no stubs)
+       Text Spanish=Static libraries (VC++ 5.0, no stubs)
+       Text Spanish=
+       Text Italian=Windows Help
+       Text Italian=Demos
+       Text Italian=Development headers & stub libraries
+       Text Italian=Development libraries (VC++ 5.0, no stubs)
+       Text Italian=Static libraries (VC++ 5.0, no stubs)
+       Text Italian=
+     end
+   end
+ end
+ item: Custom Dialog Set
+   Name=Select Program Manager Group
+   Display Variable=DISPLAY
+   item: Dialog
+     Title=Select Program Manager Group
+     Width=280
+     Height=224
+     Font Name=Helv
+     Font Size=8
+     item: Push Button
+       Rectangle=172 185 214 199
+       Variable=DIRECTION
+       Value=N
+       Create Flags=01010000000000010000000000000001
+       Text=&Next >
+     end
+     item: Push Button
+       Rectangle=130 185 172 199
+       Variable=DIRECTION
+       Value=B
+       Create Flags=01010000000000010000000000000000
+       Flags=0000000000000001
+       Text=< &Back
+     end
+     item: Push Button
+       Rectangle=222 185 264 199
+       Action=3
+       Create Flags=01010000000000010000000000000000
+       Text=Cancel
+     end
+     item: Static
+       Rectangle=9 177 263 178
+       Action=3
+       Create Flags=01010000000000000000000000000111
+     end
+     item: Static
+       Rectangle=90 10 260 38
+       Create Flags=01010000000000000000000000000000
+       Text=Enter the name of the Program Manager group to add %APPTITLE% icons to:
+     end
+     item: Combobox
+       Rectangle=90 42 260 148
+       Variable=GROUP
+       Create Flags=01010000001000010000001100000001
+       Flags=0000000000000001
+       Text=%GROUP%
+       Text=
+     end
+   end
+ end
+ item: Custom Dialog Set
+   Name=Start Installation
+   Display Variable=DISPLAY
+   item: Dialog
+     Title=Start Installation
+     Width=280
+     Height=224
+     Font Name=Helv
+     Font Size=8
+     item: Push Button
+       Rectangle=172 185 214 199
+       Variable=DIRECTION
+       Value=N
+       Create Flags=01010000000000010000000000000001
+       Text=&Next >
+     end
+     item: Push Button
+       Rectangle=130 185 172 199
+       Variable=DIRECTION
+       Value=B
+       Create Flags=01010000000000010000000000000000
+       Text=< &Back
+     end
+     item: Push Button
+       Rectangle=222 185 264 199
+       Action=3
+       Create Flags=01010000000000010000000000000000
+       Text=Cancel
+     end
+     item: Static
+       Rectangle=9 177 263 178
+       Action=3
+       Create Flags=01010000000000000000000000000111
+     end
+     item: Static
+       Rectangle=90 10 260 70
+       Create Flags=01010000000000000000000000000000
+       Text=You are now ready to install %APPTITLE%.
+       Text=
+       Text=Press the Next button to begin the installation or the Back button to reenter the installation information.
+     end
+   end
+ end
+ item: If/While Statement
+   Variable=DISPLAY
+   Value=Select Destination Directory
+ end
+ item: Set Variable
+   Variable=BACKUP
+   Value=%MAINDIR%\BACKUP
+ end
+ item: End Block
+ end
+ item: End Block
+ end
+ item: If/While Statement
+   Variable=DOBACKUP
+   Value=A
+ end
+ item: Set Variable
+   Variable=BACKUPDIR
+   Value=%BACKUP%
+ end
+ item: End Block
+ end
+ item: If/While Statement
+   Variable=BRANDING
+   Value=1
+ end
+ item: If/While Statement
+   Variable=DOBRAND
+   Value=1
+ end
+ item: Edit INI File
+   Pathname=%INST%\CUSTDATA.INI
+   Settings=[Registration]
+   Settings=NAME=%NAME%
+   Settings=COMPANY=%COMPANY%
+   Settings=
+ end
+ item: End Block
+ end
+ item: End Block
+ end
+ item: Open/Close INSTALL.LOG
+ end
+ item: Include Script
+   Pathname=C:\Program Files\Wise\INCLUDE\Uninstal.WSE
+ end
+ item: Check Disk Space
+   Component=COMPONENTS
+ end
+ item: Install File
+   Source=c:\Winnt\system32\Msvcrt.dll
+   Destination=%SYS32%\MSVCRT.DLL
+   Flags=0000001010000011
+ end
+ item: If/While Statement
+   Variable=COMPONENTS
+   Value=A
+   Flags=00001010
+ end
+ item: Install File
+   Source=c:\TclBlast\82\tcl8.2.0\doc\Tcl82.hlp
+   Destination=%MAINDIR%\doc\tcl82.hlp
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82\tcl8.2.0\doc\Tcl82.cnt
+   Destination=%MAINDIR%\doc\tcl82.cnt
+   Flags=0000000010000010
+ end
+ item: End Block
+ end
+ item: If/While Statement
+   Variable=COMPONENTS
+   Value=B
+   Flags=00001010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\library\demos\*.tcl
+   Destination=%MAINDIR%\lib\tk8.2\demos
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\library\demos\browse
+   Destination=%MAINDIR%\lib\tk8.2\demos\browse.tcl
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\library\demos\hello
+   Destination=%MAINDIR%\lib\tk8.2\demos\hello.tcl
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\library\demos\images\*
+   Destination=%MAINDIR%\lib\tk8.2\demos\images
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\library\demos\ixset
+   Destination=%MAINDIR%\lib\tk8.2\demos\ixset.tcl
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\library\demos\license.terms
+   Destination=%MAINDIR%\lib\tk8.2\demos\license.terms
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\library\demos\Readme
+   Destination=%MAINDIR%\lib\tk8.2\demos\Readme
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\library\demos\rmt
+   Destination=%MAINDIR%\lib\tk8.2\demos\rmt.tcl
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\library\demos\rolodex
+   Destination=%MAINDIR%\lib\tk8.2\demos\rolodex.tcl
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\library\demos\square
+   Destination=%MAINDIR%\lib\tk8.2\demos\square.tcl
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\library\demos\tclIndex
+   Destination=%MAINDIR%\lib\tk8.2\demos\tclIndex
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\library\demos\tcolor
+   Destination=%MAINDIR%\lib\tk8.2\demos\tcolor.tcl
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\library\demos\timer
+   Destination=%MAINDIR%\lib\tk8.2\demos\timer.tcl
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\library\demos\widget
+   Destination=%MAINDIR%\lib\tk8.2\demos\widget.tcl
+   Flags=0000000010000010
+ end
+ item: End Block
+ end
+ item: If/While Statement
+   Variable=COMPONENTS
+   Value=C
+   Flags=00001010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\generic\tk.h
+   Destination=%MAINDIR%\include\tk.h
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tcl8.2.0\generic\tcl.h
+   Destination=%MAINDIR%\include\tcl.h
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tcl8.2.0\win\Release\tclstub82.lib
+   Destination=%MAINDIR%\lib\tclstub82.lib
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\win\Release\tkstub82.lib
+   Destination=%MAINDIR%\lib\tkstub82.lib
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=C:\TclBlast\82plus\tcl8.2.0\win\libtclstub82.a
+   Destination=%MAINDIR%\lib\libtclstub82.a
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=C:\TclBlast\82plus\tk8.2.0\win\libtkstub82.a
+   Destination=%MAINDIR%\lib\libtkstub82.a
+   Flags=0000000010000010
+ end
+ item: End Block
+ end
+ item: If/While Statement
+   Variable=COMPONENTS
+   Value=D
+   Flags=00001010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tcl8.2.0\win\Release\tcl82.lib
+   Destination=%MAINDIR%\lib\tcl82.lib
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\win\Release\tk82.lib
+   Destination=%MAINDIR%\lib\tk82.lib
+   Flags=0000000010000010
+ end
+ item: End Block
+ end
+ item: If/While Statement
+   Variable=COMPONENTS
+   Value=E
+   Flags=00001010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tcl8.2.0\win\libtcl82.a
+   Destination=%MAINDIR%\lib\libtcl82.a
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\win\libtk82.a
+   Destination=%MAINDIR%\lib\libtk82.a
+   Flags=0000000010000010
+ end
+ item: End Block
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\win\Release\tk82.dll
+   Destination=%MAINDIR%\bin\TK82.DLL
+   Flags=0000000010000010
+ end
+ remarked item: Install File
+   Source=c:\TclBlast\82plus\tcl8.2.0\win\Release\Tcl1682.dll
+   Destination=%MAINDIR%\bin\TCL1682.DLL
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\win\Release\wish82.exe
+   Destination=%MAINDIR%\bin\wish82.exe
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tcl8.2.0\win\Release\tclsh82.exe
+   Destination=%MAINDIR%\bin\tclsh82.exe
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tcl8.2.0\win\Release\tclpip82.dll
+   Destination=%MAINDIR%\bin\TCLPIP82.DLL
+   Flags=0000001010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tcl8.2.0\win\Release\tcl82.dll
+   Destination=%MAINDIR%\bin\TCL82.DLL
+   Flags=0000001010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tcl8.2.0\library\*.tcl
+   Destination=%MAINDIR%\lib\tcl8.2
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tcl8.2.0\library\http1.0\*.tcl
+   Destination=%MAINDIR%\lib\tcl8.2\http1.0
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tcl8.2.0\library\http2.1\*.tcl
+   Destination=%MAINDIR%\lib\tcl8.2\http2.1
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tcl8.2.0\library\msgcat1.0\*
+   Destination=%MAINDIR%\lib\tcl8.2\msgcat1.0
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tcl8.2.0\library\tcltest1.0\*.tcl
+   Destination=%MAINDIR%\lib\tcl8.2\tcltest1.0
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tcl8.2.0\library\encoding\*
+   Destination=%MAINDIR%\lib\tcl8.2\encoding
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tcl8.2.0\library\tclIndex
+   Destination=%MAINDIR%\lib\tcl8.2\tclIndex
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tcl8.2.0\library\license.terms
+   Destination=%MAINDIR%\lib\tcl8.2\license.terms
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tcl8.2.0\library\opt0.4\*.tcl
+   Destination=%MAINDIR%\lib\tcl8.2\opt0.4
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tcl8.2.0\win\Release\tclreg82.dll
+   Destination=%MAINDIR%\lib\tcl8.2\reg1.0\tclreg82.dll
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tcl8.2.0\win\pkgIndex.reg
+   Destination=%MAINDIR%\lib\tcl8.2\reg1.0\pkgIndex.tcl
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tcl8.2.0\win\Release\tcldde82.dll
+   Destination=%MAINDIR%\lib\tcl8.2\dde1.1\tcldde82.dll
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tcl8.2.0\win\pkgIndex.dde
+   Destination=%MAINDIR%\lib\tcl8.2\dde1.1\pkgIndex.tcl
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\library\*.tcl
+   Destination=%MAINDIR%\lib\tk8.2
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\win\pkgIndex.tk
+   Destination=%MAINDIR%\lib\tk8.2\pkgIndex.tcl
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\library\focus.tcl
+   Destination=%MAINDIR%\lib\tk8.2\focus.tcl
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\library\images\*
+   Destination=%MAINDIR%\lib\tk8.2\images
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\library\license.terms
+   Destination=%MAINDIR%\lib\tk8.2\license.terms
+   Flags=0000000010000010
+ end
+ item: Install File
+   Source=c:\TclBlast\82plus\tk8.2.0\library\tclIndex
+   Destination=%MAINDIR%\lib\tk8.2\tclIndex
+   Flags=0000000010000010
+ end
+ item: Set Variable
+   Variable=COMMON
+   Value=%COMMON%
+   Flags=00010100
+ end
+ item: Set Variable
+   Variable=MAINDIR
+   Value=%MAINDIR%
+   Flags=00010100
+ end
+ item: Check Configuration
+   Flags=10111011
+ end
+ item: Get Registry Key Value
+   Variable=STARTUPDIR
+   Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
+   Default=%WIN%\Start Menu\Programs\StartUp
+   Value Name=StartUp
+   Flags=00000010
+ end
+ item: Get Registry Key Value
+   Variable=DESKTOPDIR
+   Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
+   Default=%WIN%\Desktop
+   Value Name=Desktop
+   Flags=00000010
+ end
+ item: Get Registry Key Value
+   Variable=STARTMENUDIR
+   Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
+   Default=%WIN%\Start Menu
+   Value Name=Start Menu
+   Flags=00000010
+ end
+ item: Get Registry Key Value
+   Variable=GROUPDIR
+   Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
+   Default=%WIN%\Start Menu\Programs
+   Value Name=Programs
+   Flags=00000010
+ end
+ item: Get Registry Key Value
+   Variable=CSTARTUPDIR
+   Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
+   Default=%STARTUPDIR%
+   Value Name=Common Startup
+   Flags=00000100
+ end
+ item: Get Registry Key Value
+   Variable=CDESKTOPDIR
+   Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
+   Default=%DESKTOPDIR%
+   Value Name=Common Desktop
+   Flags=00000100
+ end
+ item: Get Registry Key Value
+   Variable=CSTARTMENUDIR
+   Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
+   Default=%STARTMENUDIR%
+   Value Name=Common Start Menu
+   Flags=00000100
+ end
+ item: Get Registry Key Value
+   Variable=CGROUPDIR
+   Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
+   Default=%GROUPDIR%
+   Value Name=Common Programs
+   Flags=00000100
+ end
+ item: Set Variable
+   Variable=CGROUP_SAVE
+   Value=%GROUP%
+ end
+ item: Set Variable
+   Variable=GROUP
+   Value=%GROUPDIR%\%GROUP%
+ end
+ item: Create Shortcut
+   Source=%MAINDIR%\bin\wish82.exe
+   Destination=%GROUP%\Wish.lnk
+   Icon Number=0
+ end
+ item: Create Shortcut
+   Source=%MAINDIR%\bin\tclsh82.exe
+   Destination=%GROUP%\Tclsh.lnk
+   Icon Number=0
+ end
+ item: Create Shortcut
+   Source=%MAINDIR%\doc\tcl82.hlp
+   Destination=%GROUP%\Tcl Help.lnk
+   Icon Number=0
+   Key Type=1536
+   Flags=00000001
+ end
+ item: Create Shortcut
+   Source=%MAINDIR%\lib\tk8.2\demos\widget.tcl
+   Destination=%GROUP%\Demos\Widget Tour.lnk
+   Icon Number=0
+   Key Type=1536
+   Flags=00000001
+ end
+ item: Else Statement
+ end
+ item: Add ProgMan Icon
+   Group=%GROUP%
+   Icon Name=Wish
+   Command Line=%MAINDIR%\bin\wish82.exe
+   Flags=01000000
+ end
+ item: Add ProgMan Icon
+   Group=%GROUP%
+   Icon Name=Tclsh
+   Command Line=%MAINDIR%\bin\tclsh82.exe
+   Flags=01000000
+ end
+ item: Add ProgMan Icon
+   Group=%GROUP%
+   Icon Name=Tcl Help
+   Command Line=%MAINDIR%\doc\tcl82.hlp
+   Flags=01000000
+ end
+ item: Add ProgMan Icon
+   Group=%GROUP%
+   Icon Name=Widget Tour
+   Command Line=%MAINDIR%\lib\tk8.2\demos\widget.tcl
+   Flags=01000000
+ end
+ item: End Block
+ end
+ item: Self-Register OCXs/DLLs
+   Description=Updating System Configuration, Please Wait...
+ end
+ item: Edit Registry
+   Total Keys=7
+   item: Key
+     Key=Software\Scriptics\Tcl\8.2
+     New Value=%MAINDIR%
+     Value Name=Root
+     Root=2
+   end
+   item: Key
+     Key=TclScript\DefaultIcon
+     New Value=%MAINDIR%\bin\tk82.dll,0
+     New Value=
+   end
+   item: Key
+     Key=.tcl
+     New Value=TclScript
+   end
+   item: Key
+     Key=TclScript
+     New Value=TclScript
+   end
+   item: Key
+     Key=TclScript\shell\open\command
+     New Value=%MAINDIR%\bin\wish82.exe "%%1"
+   end
+   item: Key
+     Key=TclScript\shell\edit
+     New Value=&Edit
+   end
+   item: Key
+     Key=TclScript\shell\edit\command
+     New Value=notepad "%%1"
+   end
+ end
+ item: Custom Dialog Set
+   Name=Finished
+   Display Variable=DISPLAY
+   item: Dialog
+     Title=Installation Complete
+     Width=280
+     Height=224
+     Font Name=Helv
+     Font Size=8
+     item: Push Button
+       Rectangle=170 185 212 199
+       Variable=DIRECTION
+       Value=N
+       Create Flags=01010000000000010000000000000001
+       Text=&Finish >
+     end
+     item: Push Button
+       Control Name=CANCEL
+       Rectangle=222 185 264 199
+       Action=3
+       Create Flags=01010000000000010000000000000000
+       Text=Cancel
+     end
+     item: Static
+       Rectangle=9 177 263 178
+       Action=3
+       Create Flags=01010000000000000000000000000111
+     end
+     item: Static
+       Rectangle=90 10 260 63
+       Enabled Color=00000000000000001111111111111111
+       Create Flags=01010000000000000000000000000000
+       Text=%APPTITLE% has been successfully installed.
+       Text=
+       Text=
+       Text=Press the Finish button to exit this installation.
+       Text=
+     end
+     item: Push Button
+       Control Name=BACK
+       Rectangle=128 185 170 199
+       Variable=DIRECTION
+       Value=B
+       Create Flags=01010000000000010000000000000000
+       Text=< &Back
+     end
+     item: Set Control Attribute
+       Control Name=BACK
+       Operation=1
+     end
+     item: Set Control Attribute
+       Control Name=CANCEL
+       Operation=1
+     end
+   end
+ end
*** win/tk82plus.dsp.orig	Fri Sep 24 21:25:43 1999
--- win/tk82plus.dsp	Fri Sep 24 21:25:43 1999
***************
*** 0 ****
--- 1,80 ----
+ # Microsoft Developer Studio Project File - Name="tk82plus" - Package Owner=<4>
+ # Microsoft Developer Studio Generated Build File, Format Version 5.00
+ # ** DO NOT EDIT **
+ 
+ # TARGTYPE "Win32 (x86) External Target" 0x0106
+ 
+ CFG=tk82plus - Win32 Debug
+ !MESSAGE This is not a valid makefile. To build this project using NMAKE,
+ !MESSAGE use the Export Makefile command and run
+ !MESSAGE 
+ !MESSAGE NMAKE /f "tk82plus.mak".
+ !MESSAGE 
+ !MESSAGE You can specify a configuration when running NMAKE
+ !MESSAGE by defining the macro CFG on the command line. For example:
+ !MESSAGE 
+ !MESSAGE NMAKE /f "tk82plus.mak" CFG="tk82plus - Win32 Debug"
+ !MESSAGE 
+ !MESSAGE Possible choices for configuration are:
+ !MESSAGE 
+ !MESSAGE "tk82plus - Win32 Release" (based on "Win32 (x86) External Target")
+ !MESSAGE "tk82plus - Win32 Debug" (based on "Win32 (x86) External Target")
+ !MESSAGE 
+ 
+ # Begin Project
+ # PROP Scc_ProjName ""
+ # PROP Scc_LocalPath ""
+ 
+ !IF  "$(CFG)" == "tk82plus - Win32 Release"
+ 
+ # PROP BASE Use_Debug_Libraries 0
+ # PROP BASE Output_Dir "Release"
+ # PROP BASE Intermediate_Dir "Release"
+ # PROP BASE Cmd_Line "NMAKE /f makefile.vc"
+ # PROP BASE Rebuild_Opt "/a"
+ # PROP BASE Target_File "wish82.exe"
+ # PROP BASE Bsc_Name "wish82.bsc"
+ # PROP BASE Target_Dir ""
+ # PROP Use_Debug_Libraries 0
+ # PROP Output_Dir "Release"
+ # PROP Intermediate_Dir "Release"
+ # PROP Cmd_Line "NMAKE /f makefile.vc all"
+ # PROP Rebuild_Opt "/a"
+ # PROP Target_File "wish82.exe"
+ # PROP Bsc_Name "wish82.bsc"
+ # PROP Target_Dir ""
+ 
+ !ELSEIF  "$(CFG)" == "tk82plus - Win32 Debug"
+ 
+ # PROP BASE Use_Debug_Libraries 1
+ # PROP BASE Output_Dir "Debug"
+ # PROP BASE Intermediate_Dir "Debug"
+ # PROP BASE Cmd_Line "NMAKE /f makefile.vc"
+ # PROP BASE Rebuild_Opt "/a"
+ # PROP BASE Target_File "wish82.exe"
+ # PROP BASE Bsc_Name "wish82.bsc"
+ # PROP BASE Target_Dir ""
+ # PROP Use_Debug_Libraries 1
+ # PROP Output_Dir "Debug"
+ # PROP Intermediate_Dir "Debug"
+ # PROP Cmd_Line "NMAKE /f makefile.vc all"
+ # PROP Rebuild_Opt "/a"
+ # PROP Target_File "wish82.exe"
+ # PROP Bsc_Name "wish82.bsc"
+ # PROP Target_Dir ""
+ 
+ !ENDIF 
+ 
+ # Begin Target
+ 
+ # Name "tk82plus - Win32 Release"
+ # Name "tk82plus - Win32 Debug"
+ 
+ !IF  "$(CFG)" == "tk82plus - Win32 Release"
+ 
+ !ELSEIF  "$(CFG)" == "tk82plus - Win32 Debug"
+ 
+ !ENDIF 
+ 
+ # End Target
+ # End Project
*** win/tkWin32Dll.c.orig	Fri Apr 16 03:51:48 1999
--- win/tkWin32Dll.c	Fri Sep 24 21:25:43 1999
***************
*** 13,26 ****
  
  #include "tkWinInt.h"
  
! static int tkPlatformId;
  
- /*
-  * The following declaration is for the VC++ DLL entry point.
-  */
- 
- BOOL APIENTRY		DllMain _ANSI_ARGS_((HINSTANCE hInst,
- 			    DWORD reason, LPVOID reserved));
  
  /*
   *----------------------------------------------------------------------
--- 13,22 ----
  
  #include "tkWinInt.h"
  
! #if defined(_MSC_VER) || defined(__GNUC__)
! #define DllEntryPoint DllMain
! #endif
  
  
  /*
   *----------------------------------------------------------------------
***************
*** 32,63 ****
   *	routine.
   *
   * Results:
!  *	See DllMain.
!  *
!  * Side effects:
!  *	See DllMain.
!  *
!  *----------------------------------------------------------------------
!  */
! 
! BOOL APIENTRY
! DllEntryPoint(hInst, reason, reserved)
!     HINSTANCE hInst;		/* Library instance handle. */
!     DWORD reason;		/* Reason this function is being called. */
!     LPVOID reserved;		/* Not used. */
! {
!     return DllMain(hInst, reason, reserved);
! }
! 
! /*
!  *----------------------------------------------------------------------
!  *
!  * DllMain --
!  *
!  *	DLL entry point.
!  *
!  * Results:
!  *	TRUE on sucess, FALSE on failure.
   *
   * Side effects:
   *	None.
--- 28,34 ----
   *	routine.
   *
   * Results:
!  *	TRUE on success, FALSE otherwise.
   *
   * Side effects:
   *	None.
***************
*** 66,77 ****
   */
  
  BOOL APIENTRY
! DllMain(hInstance, reason, reserved)
!     HINSTANCE hInstance;
!     DWORD reason;
!     LPVOID reserved;
  {
-     OSVERSIONINFO os;
  
      /*
       * If we are attaching to the DLL from a new process, tell Tk about
--- 37,47 ----
   */
  
  BOOL APIENTRY
! DllEntryPoint (
!     HINSTANCE hInstance,	/* Library instance handle. */
!     DWORD reason,		/* Reason this function is being called. */
!     LPVOID reserved)		/* Not used. */
  {
  
      /*
       * If we are attaching to the DLL from a new process, tell Tk about
***************
*** 80,119 ****
       */
      
      if (reason == DLL_PROCESS_ATTACH) {
- 	os.dwOSVersionInfoSize = sizeof(os);
- 	GetVersionEx(&os);
- 	tkPlatformId = os.dwPlatformId;
- 
          TkWinXInit(hInstance);
      } else if (reason == DLL_PROCESS_DETACH) {
          TkWinXCleanup(hInstance);
      }
      return(TRUE);
  }
- 
- /*
-  *----------------------------------------------------------------------
-  *
-  * TkWinGetPlatformId --
-  *
-  *	Determines whether running under NT, 95, or Win32s, to allow 
-  *	runtime conditional code.
-  *
-  * Results:
-  *	The return value is one of:
-  *	    VER_PLATFORM_WIN32s		Win32s on Windows 3.1. 
-  *	    VER_PLATFORM_WIN32_WINDOWS	Win32 on Windows 95.
-  *	    VER_PLATFORM_WIN32_NT	Win32 on Windows NT
-  *
-  * Side effects:
-  *	None.
-  *
-  *----------------------------------------------------------------------
-  */
- 
- int		
- TkWinGetPlatformId()
- {
-     return tkPlatformId;
- }
- 
--- 50,58 ----
*** win/tkWinDllEntry.c.orig	Fri Sep 24 21:25:43 1999
--- win/tkWinDllEntry.c	Fri Sep 24 21:25:43 1999
***************
*** 0 ****
--- 1,37 ----
+ /*
+  *	tkWinDllEntry.c
+  */
+ 
+ #include <windows.h>
+ 
+ #if defined(_MSC_VER) || defined(__GNUC__)
+ #define DllEntryPoint DllMain
+ #endif
+ 
+ 
+ /*
+  *----------------------------------------------------------------------
+  *
+  * DllEntryPoint --
+  *
+  *	This routine is called by gcc, VC++ Borland to invoke the
+  *	initialization code for Tcl.  It simply calls the DllMain
+  *	routine.
+  *
+  * Results:
+  *	TRUE.
+  *
+  * Side effects:
+  *	None.
+  *
+  *----------------------------------------------------------------------
+  */
+ 
+ BOOL APIENTRY
+ DllEntryPoint (
+     HINSTANCE hInst,		/* Library instance handle. */
+     DWORD reason,		/* Reason this function is being called. */
+     LPVOID reserved)		/* Not used. */
+ {
+     return TRUE;
+ }
*** win/tkWinFont.c.orig	Fri Apr 16 03:51:51 1999
--- win/tkWinFont.c	Fri Sep 24 21:25:44 1999
***************
*** 2202,2214 ****
      USHORT **endCountPtr,	/* Filled with malloced pointer to 
  				 * character range information. */
      int *symbolPtr)
!  {
!     int n, i, swapped, offset, cbData, segCount;
      DWORD cmapKey;
      USHORT *startCount, *endCount;
      CMAPTABLE cmapTable;
      ENCODINGTABLE encTable;
      SUBTABLE subTable;
      char *s;
  
      segCount = 0;
--- 2202,2215 ----
      USHORT **endCountPtr,	/* Filled with malloced pointer to 
  				 * character range information. */
      int *symbolPtr)
! {
!     int n, i, swapped, offset, cbData, segCount, charSet;
      DWORD cmapKey;
      USHORT *startCount, *endCount;
      CMAPTABLE cmapTable;
      ENCODINGTABLE encTable;
      SUBTABLE subTable;
+     TEXTMETRIC tm;
      char *s;
  
      segCount = 0;
***************
*** 2305,2310 ****
--- 2306,2323 ----
  		}
  	    }
  	}
+     } else if (GetTextMetrics(hdc, &tm)) {
+         charSet = tm.tmCharSet;
+         if (charSet == ANSI_CHARSET) {
+             segCount = 2;
+             cbData = segCount * sizeof(USHORT);
+             startCount = (USHORT *) ckalloc(cbData);
+             endCount = (USHORT *) ckalloc(cbData);
+             startCount[0] = 0x0020;
+             endCount[0] = 0x007f;
+             startCount[1] = 0x00a0;
+             endCount[1] = 0x00ff;
+         }
      }
      SelectObject(hdc, hFont);
  
*** win/tkWinInit.c.orig	Fri Apr 16 03:51:52 1999
--- win/tkWinInit.c	Fri Sep 24 21:25:44 1999
***************
*** 113,120 ****
  
  void
  TkpDisplayWarning(msg, title)
!     char *msg;			/* Message to be displayed. */
!     char *title;		/* Title of warning. */
  {
      MessageBox(NULL, msg, title, MB_OK | MB_ICONEXCLAMATION | MB_SYSTEMMODAL
  	    | MB_SETFOREGROUND | MB_TOPMOST);
--- 113,120 ----
  
  void
  TkpDisplayWarning(msg, title)
!     CONST char *msg;		/* Message to be displayed. */
!     CONST char *title;		/* Title of warning. */
  {
      MessageBox(NULL, msg, title, MB_OK | MB_ICONEXCLAMATION | MB_SYSTEMMODAL
  	    | MB_SETFOREGROUND | MB_TOPMOST);
*** win/tkWinInt.h.orig	Fri Apr 16 03:51:52 1999
--- win/tkWinInt.h	Fri Sep 24 21:25:44 1999
***************
*** 41,48 ****
  #define WS_EX_TOOLWINDOW	0x00000080L 
  #endif
  
- typedef struct TkFontAttributes TkFontAttributes;
- 
  /*
   * The TkWinDCState is used to save the state of a device context
   * so that it can be restored later.
--- 41,46 ----
*** win/tkWinPort.h.orig	Thu Jul 22 23:51:25 1999
--- win/tkWinPort.h	Fri Sep 24 21:25:44 1999
***************
*** 48,55 ****
--- 48,57 ----
  #    define hypot _hypot
  #endif /* _MSC_VER */
  
+ #ifndef __GNUC__
  #define strncasecmp strnicmp
  #define strcasecmp stricmp
+ #endif
  
  #define NBBY 8
  
*** win/tkWinTest.c.orig	Fri Apr 16 03:51:53 1999
--- win/tkWinTest.c	Fri Sep 24 21:25:44 1999
***************
*** 17,25 ****
--- 17,34 ----
  HWND tkWinCurrentDialog;
   
  /*
+  * TCL_STORAGE_CLASS is set unconditionally to DLLEXPORT because the
+  * Tkptest_Init declaration is in the source file itself, which is only
+  * accessed when we are building a library.
+  */
+ 
+ #undef TCL_STORAGE_CLASS
+ #define TCL_STORAGE_CLASS DLLEXPORT
+ /*
   * Forward declarations of procedures defined later in this file:
   */
  
+ EXTERN int		Tkptest_Init(Tcl_Interp *interp);
  int			TkplatformtestInit(Tcl_Interp *interp);
  static int		TestclipboardCmd(ClientData clientData,
  			    Tcl_Interp *interp, int argc, char **argv);
***************
*** 48,57 ****
  TkplatformtestInit(
      Tcl_Interp *interp)		/* Interpreter to add commands to. */
  {
      /*
       * Add commands for platform specific tests on MacOS here.
       */
!     
      Tcl_CreateCommand(interp, "testclipboard", TestclipboardCmd,
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
      Tcl_CreateCommand(interp, "testwinevent", TestwineventCmd,
--- 57,94 ----
  TkplatformtestInit(
      Tcl_Interp *interp)		/* Interpreter to add commands to. */
  {
+     return Tkptest_Init(interp);
+ }
+ /*
+  *----------------------------------------------------------------------
+  *
+  * Tkptest_Init --
+  *
+  *	Defines commands that test platform specific functionality for
+  *	Unix platforms.
+  *
+  * Results:
+  *	A standard Tcl result.
+  *
+  * Side effects:
+  *	Defines new commands.
+  *
+  *----------------------------------------------------------------------
+  */
+ 
+ int
+ Tkptest_Init(
+     Tcl_Interp *interp)		/* Interpreter to add commands to. */
+ {
      /*
       * Add commands for platform specific tests on MacOS here.
       */
!     if (Tcl_InitStubs(interp, TCL_VERSION, 1) == NULL) {
! 	return TCL_ERROR;
!     }
!     if (Tk_InitStubs(interp, TK_VERSION, 1) == NULL) {
! 	return TCL_ERROR;
!     }
      Tcl_CreateCommand(interp, "testclipboard", TestclipboardCmd,
  	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
      Tcl_CreateCommand(interp, "testwinevent", TestwineventCmd,
*** win/tkWinX.c.orig	Fri Jul  9 04:10:07 1999
--- win/tkWinX.c	Fri Sep 24 21:25:44 1999
***************
*** 19,31 ****
   * The zmouse.h file includes the definition for WM_MOUSEWHEEL.
   */
  
! #include <zmouse.h>
  
  /*
   * Definitions of extern variables supplied by this file.
   */
  
  int tkpIsWin32s = -1;
  
  /*
   * Declarations of static variables used in this file.
--- 19,32 ----
   * The zmouse.h file includes the definition for WM_MOUSEWHEEL.
   */
  
! #define WM_MOUSEWHEEL (WM_MOUSELAST+1)
  
  /*
   * Definitions of extern variables supplied by this file.
   */
  
  int tkpIsWin32s = -1;
+ static int tkPlatformId;
  
  /*
   * Declarations of static variables used in this file.
***************
*** 142,148 ****
  
      info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
      GetVersionEx(&info);
!     tkpIsWin32s = (info.dwPlatformId == VER_PLATFORM_WIN32s);
  
      if (childClassInitialized != 0) {
  	return;
--- 143,150 ----
  
      info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
      GetVersionEx(&info);
!     tkPlatformId = info.dwPlatformId;
!     tkpIsWin32s = (tkPlatformId == VER_PLATFORM_WIN32s);
  
      if (childClassInitialized != 0) {
  	return;
***************
*** 1128,1132 ****
  unsigned long
  TkpGetMS()
  {
!     return GetCurrentTime();
  }
--- 1130,1161 ----
  unsigned long
  TkpGetMS()
  {
!     return GetTickCount();
  }
+ 
+ /*
+  *----------------------------------------------------------------------
+  *
+  * TkWinGetPlatformId --
+  *
+  *	Determines whether running under NT, 95, or Win32s, to allow 
+  *	runtime conditional code.
+  *
+  * Results:
+  *	The return value is one of:
+  *	    VER_PLATFORM_WIN32s		Win32s on Windows 3.1. 
+  *	    VER_PLATFORM_WIN32_WINDOWS	Win32 on Windows 95.
+  *	    VER_PLATFORM_WIN32_NT	Win32 on Windows NT
+  *
+  * Side effects:
+  *	None.
+  *
+  *----------------------------------------------------------------------
+  */
+ 
+ int		
+ TkWinGetPlatformId()
+ {
+     return tkPlatformId;
+ }
+ 
*** win/winMain.c.orig	Wed Apr 28 20:18:07 1999
--- win/winMain.c	Fri Sep 24 21:25:44 1999
***************
*** 12,17 ****
--- 12,19 ----
   * RCS: @(#) $Id: winMain.c,v 1.7 1999/04/28 18:18:07 redman Exp $
   */
  
+ #undef TCL_USE_STUBS
+ 
  #include <tk.h>
  #define WIN32_LEAN_AND_MEAN
  #include <windows.h>
***************
*** 32,45 ****
   */
  
  static void		setargv _ANSI_ARGS_((int *argcPtr, char ***argvPtr));
! static void		WishPanic _ANSI_ARGS_(TCL_VARARGS(char *,format));
  
  #ifdef TK_TEST
  extern int		Tktest_Init(Tcl_Interp *interp);
  #endif /* TK_TEST */
  
  #ifdef TCL_TEST
! extern int		TclObjTest_Init _ANSI_ARGS_((Tcl_Interp *interp));
  extern int		Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp));
  #endif /* TCL_TEST */
  
--- 34,47 ----
   */
  
  static void		setargv _ANSI_ARGS_((int *argcPtr, char ***argvPtr));
! static void		WishPanic _ANSI_ARGS_(TCL_VARARGS(CONST char *,format));
  
  #ifdef TK_TEST
  extern int		Tktest_Init(Tcl_Interp *interp);
  #endif /* TK_TEST */
  
  #ifdef TCL_TEST
! extern int		Objtest_Init _ANSI_ARGS_((Tcl_Interp *interp));
  extern int		Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp));
  #endif /* TCL_TEST */
  
***************
*** 154,162 ****
      }
      Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init,
              (Tcl_PackageInitProc *) NULL);
!     if (TclObjTest_Init(interp) == TCL_ERROR) {
  	return TCL_ERROR;
      }
  #endif /* TCL_TEST */
  
  #ifdef TK_TEST
--- 156,166 ----
      }
      Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init,
              (Tcl_PackageInitProc *) NULL);
!     if (Objtest_Init(interp) == TCL_ERROR) {
  	return TCL_ERROR;
      }
+     Tcl_StaticPackage(interp, "Objtest", Objtest_Init,
+             (Tcl_PackageInitProc *) NULL);
  #endif /* TCL_TEST */
  
  #ifdef TK_TEST
***************
*** 192,204 ****
   */
  
  void
! WishPanic TCL_VARARGS_DEF(char *,arg1)
  {
      va_list argList;
      char buf[1024];
!     char *format;
!     
!     format = TCL_VARARGS_START(char *,arg1,argList);
      vsprintf(buf, format, argList);
  
      MessageBeep(MB_ICONEXCLAMATION);
--- 196,208 ----
   */
  
  void
! WishPanic TCL_VARARGS_DEF(CONST char *,arg1)
  {
      va_list argList;
      char buf[1024];
!     CONST char *format;
! 
!     format = TCL_VARARGS_START(CONST char *,arg1,argList);
      vsprintf(buf, format, argList);
  
      MessageBeep(MB_ICONEXCLAMATION);
