OSDN Git Service

Tcl8.3 upgrade merge.
authorirox <irox>
Sun, 9 Sep 2001 23:26:06 +0000 (23:26 +0000)
committerirox <irox>
Sun, 9 Sep 2001 23:26:06 +0000 (23:26 +0000)
17 files changed:
tcl/ChangeLog
tcl/configure
tcl/generic/tclAlloc.c
tcl/generic/tclEnv.c
tcl/generic/tclFileName.c
tcl/generic/tclInitScript.h
tcl/generic/tclPosixStr.c
tcl/unix/configure
tcl/unix/configure.in
tcl/unix/tclConfig.sh.in
tcl/win/Makefile.in
tcl/win/configure
tcl/win/configure.in
tcl/win/tclWin32Dll.c
tcl/win/tclWinFile.c
tcl/win/tclWinPipe.c
tcl/win/tclWinPort.h

index af80f84..781e462 100644 (file)
+2001-08-08  Mo DeJong  <mdejong@redhat.com>
+
+       * cygtcl.m4 (TCL_TOOL_PATH, TCL_TOOL_SHARED_LIB_LONGNAME):
+       Raise an error if the CYGPATH variable is not defined when
+       TCL_TOOL_PATH is invoked. Add cygwin to the list of hosts
+       that do not use a "lib" prefix for shared library names.
+       * unix/configure: Regen.
+       * win/configure: Regen.
+
+2001-08-06  Mo DeJong  <mdejong@redhat.com>
+
+       * cygtcl.m4 (TCL_TOOL_STATIC_LIB_LONGNAME,
+       TCL_TOOL_SHARED_LIB_LONGNAME,
+       TCL_TOOL_LIB_SHORTNAME): Use TCL_VENDOR_PREFIX instead
+       of VENDORPREFIX to support using these macros in
+       extensions that load tclConfig.sh.
+       * unix/configure: Regen.
+       * unix/configure.in: Subst VENDORPREFIX into tclConfig.sh.
+       * unix/tclConfig.sh.in: Add TCL_VENDOR_PREFIX.
+       * win/configure: Regen.
+       * win/tcl.m4 (SC_CONFIG_CFLAGS): Set vendor prefix to "rh"
+       instead of "sn" when compiling with VC++ or gcc. When
+       compiling with Cygwin set the prefix to "cyg". Set the
+       TCL_VENDOR_PREFIX to support the tcl tool macros in Tcl.
+       * win/tclConfig.sh.in: Add TCL_VENDOR_PREFIX.
+
+2001-08-06  Mo DeJong  <mdejong@redhat.com>
+
+       * win/Makefile.in: Subst DDE_DLL_FILE, DDE_LIB_FILE, REG_DLL_FILE,
+       REG_LIB_FILE, and PIPE_DLL_FILE from the configure script instead
+       of figuring them out in the Makefile.
+       * win/configure: Regen.
+       * win/configure.in: Use TCL_TOOL_STATIC_LIB_LONGNAME and
+       TCL_TOOL_SHARED_LIB_LONGNAME macros to figure out values for
+       DDE_DLL_FILE, DDE_LIB_FILE, REG_DLL_FILE, REG_LIB_FILE, and
+       PIPE_DLL_FILE and subst them into the Makefile.
+
+2001-08-01  Mo DeJong  <mdejong@redhat.com>
+
+       * cygtcl.m4 (TCL_TOOL_STATIC_LIB_LONGNAME,
+       TCL_TOOL_SHARED_LIB_LONGNAME): Rename
+       TCL_TOOL_LIB_LONGNAME to TCL_TOOL_STATIC_LIB_LONGNAME.
+       Add new TCL_TOOL_SHARED_LIB_LONGNAME to construct
+       shared library names in a cross platform way.
+       * unix/configure: Regen.
+       * unix/configure.in: Use TCL_TOOL_SHARED_LIB_LONGNAME
+       and TCL_TOOL_STATIC_LIB_LONGNAME to generate lib names.
+       * win/configure: Regen.
+       * win/configure.in: Use TCL_TOOL_SHARED_LIB_LONGNAME
+       and TCL_TOOL_STATIC_LIB_LONGNAME to generate lib names.
+
+2001-07-24  Mo DeJong  <mdejong@redhat.com>
+
+       * win/configure:
+       * win/tcl.m4 (SC_CONFIG_CFLAGS): Don't pass explicit
+       Cygwin libs on the command line since linking is now
+       done using $CC and not $LD.
+
+2001-07-24  Mo DeJong  <mdejong@redhat.com>
+
+       * win/tclWinThrd.c (Tcl_CreateThread, TclpThreadExit):
+       When building under Cygwin, call CreateThread instead
+       of _beginthreadex and call ExitThread instead of
+       _endthreadex. Cygwin does not support these msvcrt
+       methods and does not suffer from the memory leak
+       problems that prompted their use.
+
+2001-07-24  Mo DeJong  <mdejong@redhat.com>
+
+       * win/configure: Regen.
+       * win/tcl.m4 (SC_CONFIG_CFLAGS): Check for bug in
+       Cygwin version of windres and work around that
+       case by passing a POSIX path instead of a Windows
+       native path. One can't always pass a POSIX path
+       because the mingw native toolchain accepts only
+       Windows native paths.
+
+2001-07-24  Mo DeJong  <mdejong@redhat.com>
+
+       * win/tclWinThrd.c (Tcl_CreateThread): Close Windows
+       HANDLE returned by _beginthreadex. The MS documentation
+       states that this handle is not closed by a later call to
+       _endthreadex.
+
 2001-07-17  Frank Ch. Eigler  <fche@redhat.com>
 
-       * generic/tclInitScript.h (initScript): Check that nameofexecutable
-       is valid (file exists) before traversing it as a possible link.
+       * generic/tclInitScript.h (initScript): Check that nameofexecutable
+       is valid (file exists) before traversing it as a possible link.
+
+2001-07-16  Mo DeJong  <mdejong@redhat.com>
+
+       * generic/tcl.h: Define __WIN32__ when
+       __CYGWIN__ or __MINGW32__ is defined.
+       * generic/tclAlloc.c: Define caddr_t when
+       compiling with VC++ or mingw. This type is
+       already defined when compiling with Cygwin.
+
+2001-07-16  Mo DeJong  <mdejong@redhat.com>
+
+       * win/tclWinConsole.c:
+       * win/tclWinPipe.c:
+       * win/tclWinPort.h:
+       * win/tclWinThrd.c:
+       Remove unnecessary #includes of dos.h, direct.h,
+       and tchar.h. This will help the Cygwin porting
+       effort since these headers do not exist under Cygwin.
+
+2001-07-12  Mo DeJong  <mdejong@redhat.com>
+
+       * unix/Makefile.in:
+       * unix/configure: Regen.
+       * unix/configure.in:
+       * unix/tcl.m4:
+       * win/Makefile.in:
+       * win/configure: Regen.
+       * win/configure.in:
+       * win/tcl.m4:
+       Revert ill-conceived EXTRA_CFLAGS changes made on 2001-07-09.
+       The change ended up causing big problems with the
+       tclConfig.sh file since it exported EXTRA_CFLAGS and did
+       not deal with the debug/non-debug case.
+
+2001-07-11  Mo DeJong  <mdejong@redhat.com>
+
+       * unix/configure: Regen.
+       * unix/tcl.m4 (SC_CONFIG_CFLAGS): Avoid using AC_CHECK_TOOL
+       since Tcl's configure script is not setup properly.
+
+2001-07-11  Mo DeJong  <mdejong@redhat.com>
+
+       * unix/Makefile.in: Add AR variable for use in STLIB_LD.
+       * unix/configure: Regen.
+       * unix/configure.in: Use STLIB_LD when defining MAKE_LIB
+       and MAKE_STUB_LIB. Subst RANLIB and AR.
+       * unix/tcl.m4 (SC_CONFIG_CFLAGS): Add doc comment about
+       STLIB_LD command. Check ${AR} env var when setting
+       STLIB_LD and delay evaluation until make time.
+       * win/configure: Regen.
+       * win/tcl.m4 (SC_CONFIG_CFLAGS): Pass AR arguments in
+       STLIB_LD to better match the Unix implementation. Don't
+       bother defining AR when using VC++ since it is not used.
+
+2001-07-10  Mo DeJong  <mdejong@redhat.com>
+
+       * win/configure:
+       * win/tcl.m4 (SC_CONFIG_CFLAGS): Use STLIB_LD in MAKE_LIB instead
+       of AR which can be overridden on the make command line.
+
+2001-07-09  Mo DeJong  <mdejong@redhat.com>
+
+       * win/configure:
+       * win/tcl.m4 (SC_CONFIG_CFLAGS): Fix quoting of CYGPATH
+       argument to AC_CHECK_PROG.
+
+2001-07-09  Mo DeJong  <mdejong@redhat.com>
+
+       * unix/Makefile.in: Add EXTRA_CFLAGS_DEBUG and EXTRA_CFLAGS_OPTIMIZE
+       variables. These two do not actually differ in the unix version
+       but are there to keep in sync with the Windows version.
+       * unix/configure: Regen.
+       * unix/configure.in: Don't subst EXTRA_CFLAGS. Subst EXTRA_CFLAGS_DEFAULT,
+       EXTRA_CFLAGS_DEBUG, and EXTRA_CFLAGS_OPTIMIZE.
+       * unix/tcl.m4 (SC_ENABLE_SYMBOLS, SC_CONFIG_CFLAGS): Define
+       EXTRA_CFLAGS_DEFAULT based on the --enable-smbols option.
+       Set EXTRA_CFLAGS_DEBUG instead of EXTRA_CFLAGS and then set
+       EXTRA_CFLAGS_OPTIMIZE to the value of EXTRA_CFLAGS_DEBUG since
+       they are the same under Unix.
+       * win/Makefile.in: Add EXTRA_CFLAGS_DEBUG and EXTRA_CFLAGS_OPTIMIZE
+       variables. This is needed so that the proper runtime lib gets linked
+       into VC++ produced .obj files when CFLAGS is reset on the command line.
+       * win/configure: Regen.
+       * win/configure.in: Don't subst EXTRA_CFLAGS. Subst EXTRA_CFLAGS_DEFAULT,
+       EXTRA_CFLAGS_DEBUG, and EXTRA_CFLAGS_OPTIMIZE.
+       * win/tcl.m4 :(SC_ENABLE_SYMBOLS, SC_CONFIG_CFLAGS): Define
+       EXTRA_CFLAGS_DEFAULT based on the --enable-smbols option. Set
+       EXTRA_CFLAGS_DEBUG and EXTRA_CFLAGS_OPTIMIZE based on the runtime
+       option when compiled with VC++.
+
+2001-07-06  Mo DeJong  <mdejong@redhat.com>
+
+       * win/configure: Regen.
+       * win/tcl.m4 (SC_CONFIG_CFLAGS): Pass -e _WinMain@16 in
+       addition to the -mwindows flag to work around a problem
+       with ld when it incorrectly uses main() as the executable
+       entry point when both WinMain() and main() are available.
+
+2001-07-06  Mo DeJong  <mdejong@redhat.com>
+
+       * unix/configure: Regen.
+       * unix/configure.in: Replace call to SC_ENABLE_GCC with
+       AC_PROG_CC so that CC passed in from the caller is respected.
+       * unix/tcl.m4: Remove the unused SC_ENABLE_GCC macro.
+       * win/configure: Regen.
+       * win/configure.in: Replace call to SC_ENABLE_GCC with
+       AC_PROG_CC so that CC passed in from the caller is respected.
+       * win/tcl.m4: Remove unused SC_ENABLE_GCC macro.
+
+2001-07-06  Mo DeJong  <mdejong@redhat.com>
+
+       * win/Makefile.in: Subst DEPARG directly instead
+        of relying on a variable. This will make Cygwin
+        builds faster since an extra exec will be avoided.
+       * win/configure: Regen.
+       * win/configure.in: Subst DEPARG.
+       * win/tcl.m4 (SC_CONFIG_CFLAGS): Set DEPARG based
+       on CYGPATH.
+
+2001-06-26  Mo DeJong  <mdejong@redhat.com>
+
+       * cygtcl.m4 (TCL_TOOL_PATH): Use CYGPATH variable instead of
+       invoking cygpath directly. Handle cross compile by not
+       using CYGPATH when set to echo.
+       * unix/configure: Regen.
+       * win/Makefile.in: Remove PATHTYPE variable.
+       * win/configure: regen.
+       * win/configure.in: Remove PATHTYPE subst + extra CYGPATH subst.
+       * win/tcl.m4 (SC_CONFIG_CFLAGS): Remove PATHTYPE variable. Search
+       for cygpath in the PATH and set CYGPATH="cygpath -w" if found.
+       Remove old cross compiling hack.
+
+2001-06-26  Mo DeJong  <mdejong@redhat.com>
+
+       * win/Makefile.in: Don't use VPSEP in the VPATH,
+       just use : as the spearator.
+       * win/configure: Regen.
+       * win/configure.in: Don't subst VPSEP.
+       * win/tcl.m4 (SC_CONFIG_CFLAGS): Remove VPSEP.
+
+2001-06-25  Mo DeJong  <mdejong@redhat.com>
+
+       * win/configure: Regen.
+       * win/tcl.m4 (SC_CONFIG_CFLAGS): When building with
+       gcc, don't attempt to link with LD or support dllwrap.
+       Simply require a recent version of Cygwin gcc or Mingw
+       gcc that supports -shared. When linking, use gcc instead
+       of ld since gcc automatically includes libs like -lmsvcrt.
+
+2001-06-22  Mo DeJong  <mdejong@redhat.com>
+
+       * unix/Makefile.in: Set CFLAGS to @CFLAGS@ and @CFLAGS_DEFAULT@.
+       Set LDFLAGS to @LDFLAGS@ and @LDFLAGS_DEFAULT@. Add LDFLAGS_DEBUG
+       and LDFLAGS_OPTIMIZE to match the way CFLAGS_DEFAULT works.
+       This will support user set CFLAGS or LDFLAGS at configure time.
+       * unix/configure: Regen.
+       * unix/configure.in: Don't set CFLAGS to CFLAGS_DEFAULT, instead
+       subst CFLAGS_DEFAULT into the Makefile. Add AC_SUBST for CFLAGS_DEFAULT,
+       LDFLAGS_DEFAULT, LDFLAGS_DEBUG, and LDFLAGS_OPTIMIZE.
+       * unix/tcl.m4 (SC_ENABLE_SYMBOLS): Modify LDFLAGS_DEFAULT so that
+       it uses a Makefile variable just like CFLAGS_DEFAULT.
+       * win/Makefile.in: Set CFLAGS to @CFLAGS@ and @CFLAGS_DEFAULT@.
+       Set LDFLAGS to @LDFLAGS@ and @LDFLAGS_DEFAULT@.
+       This will support user set CFLAGS or LDFLAGS at configure time.
+       * win/configure: Regen.
+       * win/configure.in: Don't set CFLAGS or LDFLAGS, instead subst
+       CFLAGS_DEFAULT and LDFLAGS_DEFAULT into the Makefile.
+       * win/tcl.m4 (SC_ENABLE_SYMBOLS): Modify LDFLAGS_DEFAULT so that
+       it uses a Makefile variable just like CFLAGS_DEFAULT.
+
+2001-06-22  Mo DeJong  <mdejong@redhat.com>
+
+       * configure: Regen.
+       * configure.in: When a windows32 host is detected
+       configure in the win subdirectory.
+       * cygtcl.m4 (TCL_TOOL_PATH, TCL_TOOL_LIB_LONGNAME,
+       TCL_TOOL_LIB_SHORTNAME, TCL_TOOL_LIB_SPEC):
+       Add support for mingw32 and windows32 hosts. Remove
+       check for cygwin since we are really cross compiling
+       when building win32 executables.
+       * unix/configure: Regen.
+       * win/configure: Regen.
+
+2001-06-22  Mo DeJong  <mdejong@redhat.com>
+
+       * win/configure:
+       * win/tcl.m4 (SC_CONFIG_CFLAGS): Don't set LDFLAGS_DEBUG
+       to -g or LDFLAGS_OPTIMIZE to -O when compiling with gcc.
+       These flags are not needed and can cause problems with
+       the Cygwin version of ld.
+
+2001-06-20  Mo DeJong  <mdejong@redhat.com>
+
+       * generic/tcl.h: Define __WIN32__ when __MINGW32__
+       is defined to support building under Cygwin gcc
+       with the -mno-cygwin flag.
+
+2001-06-14  Mo DeJong  <mdejong@redhat.com>
+
+       * unix/Makefile.in: Avoid burning install TCL_LIBRARY into
+       tclUnixInit.o at compile time.
+       * unix/tclUnixInit.c (TclpInitLibraryPath): Fix location
+       independence by searching for Tcl library in share/tclX.X
+       instead of lib/tclX.X. This logic is no longer effected by a
+       burned in TCL_LIBRARY.
+       * win/tclWinInit.c (TclpInitLibraryPath): Search for Tcl library
+       in share/tclX.X instead of lib/tclX.X. Remove a couple of
+       Cygnus local hacks since they were not doing anything useful.
+
+2001-06-08  Mo DeJong  <mdejong@redhat.com>
+
+       * win/Makefile.in: Set TCL_LIBRARY to
+       $INSTALL/share/tcl8.3 instead of
+       $INSTALL/lib/tcl8.3.
+
+2001-06-08  Mo DeJong  <mdejong@redhat.com>
+
+       * win/tclConfig.sh.in: Correct the definition
+       of TCL_LIB_FULL_PATH. It was inclosed in `
+       characters instead of ' characters.
+
+2001-06-05  Mo DeJong  <mdejong@redhat.com>
+
+       * unix/configure: Regen.
+       * unix/tcl.m4 (SC_CONFIG_CFLAGS): Add a TCL_LIB_SUFFIX variable
+       to make the TCL_TOOL_LIB_SHORTNAME macro happy.
+       * unix/tclConfig.sh.in: Add TCL_LIB_SUFFIX variable.
+
+2001-06-05  Mo DeJong  <mdejong@redhat.com>
+
+       * cygtcl.m4 (TCL_TOOL_LIB_PATH): Call TCL_TOOL_PATH so that a
+       Windows native path is generated for PATH variables.
+       * unix/configure: Regen.
+       * win/configure: Regen.
+
+2001-06-01  Mo DeJong  <mdejong@redhat.com>
+
+       * cygtcl.m4 (TCL_TOOL_PATH, TCL_TOOL_LIB_SHORTNAME): Check that argument to
+       TCL_TOOL_PATH is not "". Use new TCL_LIB_SUFFIX variable in the
+       TCL_TOOL_LIB_SHORTNAME macro under Windows.
+       * unix/configure: Regen.
+       * win/configure: Regen.
+       * win/configure.in: Don't subst SHLIB_SUFFIX.
+       * win/tcl.m4 (SC_CONFIG_CFLAGS): Set TCL_LIB_SUFFIX so that Tcl
+       sees the same variable name that an extension will.
+       * win/tclConfig.sh.in: Set the TCL_SHLIB_SUFFIX and TCL_LIB_SUFFIX vars.
+
+2001-05-30  Mo DeJong  <mdejong@redhat.com>
+
+       * unix/configure: Regen.
+       * unix/tcl.m4 (SC_PATH_TCLCONFIG, SC_PATH_TKCONFIG):
+       Check in win subdirectory in addition to unix subdirectory for
+       tclConfig.sh and tkConfig.sh files.
+
+2001-05-30  Mo DeJong  <mdejong@redhat.com>
+
+       * cygtcl.m4: Add FIXME note.
+       * unix/configure: Regen.
+       * unix/tcl.m4 (SC_PATH_TCLCONFIG, SC_PATH_TKCONFIG):
+       Generate an error instead of a warning if the Tcl, or Tk
+       configuration files cannot be found.
+
+2001-05-26  Mo DeJong  <mdejong@redhat.com>
+
+       * cygtcl.m4 (TCL_TOOL_PATH, TCL_TOOL_LIB_LONGNAME,
+       TCL_TOOL_LIB_SHORTNAME, TCL_TOOL_LIB_SPEC): Create cross
+       platform versions of the TCL_TOOL* macros.
+       * unix/aclocal.m4: Include ../cygtcl.m4.
+       * unix/configure: Regen.
+       * unix/tcl.m4 (TCL_TOOL_PATH, TCL_TOOL_LIB_LONGNAME,
+       TCL_TOOL_LIB_SHORTNAME, TCL_TOOL_LIB_SPEC): Remove macros.
+       * win/aclocal.m4: Include ../cygtcl.m4.
+       * win/configure: Regen.
+       * win/tcl.m4 (TCL_TOOL_PATH, TCL_TOOL_LIB_LONGNAME,
+       TCL_TOOL_LIB_SHORTNAME, TCL_TOOL_LIB_SPEC): Remove macros.
+       
+2001-05-24  Mo DeJong  <mdejong@redhat.com>
+
+       * unix/configure: Regen.
+       * unix/configure.in: Add missing TCL_LIB_FULL_PATH
+       variable.
+
+2001-05-11  Mo DeJong  <mdejong@redhat.com>
+
+       * unix/configure:
+       * unix/tcl.m4 (SC_ENABLE_SYMBOLS):
+       * win/configure:
+       * win/tcl.m4 (SC_ENABLE_SYMBOLS): Back port of CFLAGS_DEFAULT fix
+       from Tcl 8.4. A Makefile variable name is now used for the CFLAGS.
+
+2001-05-09  Mo DeJong  <mdejong@redhat.com>
+
+       * win/tcl.m4 (TCL_TOOL_PATH): Assign literal macro
+       value to a tmp variable before running cygpath
+       thus avoiding a problem with a quoted argument.
+
+2001-05-09  Mo DeJong  <mdejong@redhat.com>
+
+       * unix/Makefile.in: Use TCL_STUB_LIB_FILE instead of
+       STUB_LIB_FILE subst when defining STUB_LIB_FILE.
+       * unix/configure: Regen.
+       * unix/configure.in: Use new path macros.
+       * unix/tcl.m4 (TCL_TOOL_LIB_LONGNAME, TCL_TOOL_LIB_SHORTNAME,
+       TCL_TOOL_LIB_SPEC, TCL_TOOL_LIB_PATH): Add macros
+       to deal with library path translations.
+       * win/Makefile.in: Add FIXME note.
+       * win/configure: Regen.
+       * win/configure.in: Use new path macros.
+       * win/tcl.m4 (TCL_TOOL_LIB_LONGNAME, TCL_TOOL_LIB_SHORTNAME,
+       TCL_TOOL_LIB_SPEC, TCL_TOOL_LIB_PATH): Add macros
+       to deal with library path translations.
+
+2001-04-09  Mo DeJong  <mdejong@redhat.com>
+
+       * unix/configure: Regen.
+       * unix/tcl.m4: Add placeholder TCL_TOOL_PATH macro.
+       * win/configure: Regen.
+       * win/configure.in: Set TCL_LIB_FLAG, TCL_BUILD_LIB_SPEC,
+       TCL_LIB_SPEC, TCL_LIB_FULL_PATH and subst them.
+       * win/tcl.m4: Add TCL_TOOL_PATH macro, it will call
+       cygpath -w and replace \ with / to create a native
+       Windows path that VC++ will understand.
+       * win/tclConfig.sh.in: Add TCL_LIB_FULL_PATH variable.
+
+2001-04-06  Christopher Faylor <cgf@redhat.com>
+
+       Throughout change __CYGWIN32__ to __CYGWIN__.
+       * cygwin/configure.in: When targeting cygwin, detect if C compiler
+       supports -mno-win32 flag and use it if so.
+       * cygwin/Makefile.in (EXTRA_CFLAGS): New variable.  Holds results of
+       -mno-win32 test.
+       (COMPILE): Add EXTRA_CFLAGS variable to options.
+       * generic/tclEnv.c: Only compile special Cygwin code if building under
+       Cygwin and want native windows understanding.
+       * win/tclWin32Dll.c (DllMain): #ifdef out CYGWIN impure_ptr stuff.
+       * win/Makefile.in: Add -D__USE_W32_SOCKETS to accomodate newer
+       newlib/w32api conventions.
+
+2001-04-05  Mo DeJong  <mdejong@redhat.com>
+
+       * win/configure: Regen.
+       * win/configure.in: Subst the TCL_LIB_VERSIONS_OK variable.
+       * win/tcl.m4: Add Cygnus local search for tcl8.1/win directory. Add
+       TCL_LIB_VERSIONS_OK variable, it will get substituted into the
+       tclConfig.sh file. Remve the SC_PROG_TCLSH macro.
+
+2001-04-05  Mo DeJong  <mdejong@redhat.com>
+
+       * generic/tclAlloc.c:
+       * win/tclWinPort.h:
+       Check for #define of WIN32 instead of VC++ specific symbol.
+
+2001-03-31  Mo DeJong  <mdejong@redhat.com>
+
+       * unix/Makefile.in: Remove second
+       assignment to SCRIPT_INSTALL_DIR
+       variable. This seems to have been
+       a merge error. It was installing
+       Tcl lib files in the lib directory
+       instead of share/tcl8.3.
+
+2001-03-28  Ian Roxborough  <irox@redhat.com>
+
+       * unix/tclConfig.sh.in: Set TCL_CFLAGS to CFLAGS,
+       otherwise tclConfig.sh won't work correctly.
+
+2000-09-15  Syd Polk  <spolk@redhat.com>
+
+       * Updated for the 8.3.2 release.
+
+2000-08-08  Jeff Hobbs  <hobbs@ajubasolutions.com>
+
+       8.3.2 RELEASE finalized
+
+       * changes: updated for release notes version of ChangeLog
+
+       * library/msgcat1.0/pkgIndex.tcl: 
+       * library/msgcat1.0/msgcat.tcl: bumped msgcat version to 1.1.
+
+2000-08-07  Jeff Hobbs  <hobbs@ajubasolutions.com>
+
+       * doc/ChnlStack.3:
+       * doc/CrtChannel.3: updated the docs to be aware of the
+       TCL_CHANNEL_VERSION_2 style of Tcl channels.
+
+       * generic/tclIO.c (Tcl_CreateChannel): added assertion to verify
+       that the new channel versioning will be binary compatible with
+       older channel drivers.
+
+       * BACKPORTED FROM 8.4 (HEAD) BRANCH:
+
+       * doc/memory.n: Man page for Tcl "memory" command, which is
+       created when TCL_MEM_DEBUG is defined at compile time.
+
+       * doc/TCL_MEM_DEBUG.3: Man page with overall information about
+       TCL_MEM_DEBUG usage.
+
+       * doc/DumpActiveMemory.3: Man page for Tcl_DumpActiveMemory,
+       Tcl_InitMemory, and Tcl_ValidateAllMemory [Bug: 1816, 1835].
+
+       * doc/Init.3: Man page for Tcl_Init [Bug: 1820].
+
+       * unix/Makefile.in: add tclsh.ico and tcl.spec to dist target
+
+       * unix/mkLinks: Regen'd with new mkLinks.tcl.
+       * unix/mkLinks.tcl: Fixed indentation, made link setup more
+       intelligent (only do one existance test per man page, instead of
+       one per function).
+
+       * doc/AddErrInfo.3:
+       * doc/ChnlStack.3:
+       * doc/Exit.3:
+       * doc/GetIndex.3:
+       * doc/Notifier.3:
+       * doc/Object.3:
+       * doc/RegExp.3:
+       * doc/SetResult.3:
+       * doc/SplitList.3:
+       * doc/Thread.3:  Added missing entries to NAME section.
+
+       * doc/AddErrInfo.3:
+       * doc/CrtObjCmd.3:
+       * doc/RecEvalObj.3: Changed Tcl_EvalObj to Tcl_EvalObjEx
+
+       * doc/library.n: Added entries for auto_qualify and auto_import
+       [Bug: 1271].
+       * doc/library.n: Fixed .SH NAME macro to include each function
+       documented on the page, so that mkLinks will know about the
+       functions listed there, and so that the Windows help file index
+       will get set up correctly [Bug: 1898, 5273].
+
+       * doc/expr.n: Added documentation for each of the math library
+       functions that expr supports [Bug: 1054].
+
+       * doc/regsub.n: correct regsub docs [Bug: 5346]
+
+       * doc/scan.n: minor doc fixes [Bug: 5396]
+
+       * doc/RegExp.3: Replaced instances of "Tcl_GetRegExpInfo" with
+       "Tcl_RegExpGetInfo", the correct name of the function [Bug: 5901].
+
+       * doc/package.n: Corrected information about [package forget]
+       arguments [Bug: 5418].
+
+       * generic/tclCkalloc.c: Fixed some function headers.
+
+       * tests/clock.test: Added test for "2 days 2 hours ago" style
+       specifications.
+
+       * generic/tclDate.c: Regenerated from tclGetDate.y.
+
+       * generic/tclGetDate.y: Tweaked grammar to properly handle the
+       "ago" keyword when it follows multiple relative unit specifiers,
+       as in "2 days 2 hours ago".  [Bug: 5497].
+
+       * generic/tclClock.c (FormatClock): correct code to handle locale
+       specific return values from strftime, if any. [Bug: 3345]
+
+       * unix/tclUnixInit.c (TclpSetInitialEncodings): attempt to
+       correct setlocale calls for XIM support and locale issues.
+       [BUG: 5422 3345 4236 2522 2521]
+
+       * library/init.tcl (auto_import): added check to see if a valid
+       pattern was coming in, to avoid simple error cases [Bug: 3326]
+
+       * library/history.tcl: Corrected an off-by-one error in HistIndex,
+       which was causing [history redo] to start its search at the wrong
+       event index. [Bug: 1269].
+
+       * generic/tclPosixStr.c (Tcl_SignalMsg): clarified #defines for
+       Linux on Sparc to compile correctly. [Bug: 5364]
+
+       * generic/tclEnv.c: cast cleanup [Bug: 5624]
+       * win/tclWinFCmd.c: cast cleanup [Bug: 5627]
+
+       * generic/tclIndexObj.c (Tcl_GetIndexFromObjStruct): Corrected
+       caching of the index ptr to account for offsets != sizeof(char *).
+       [Bug: 5153]
+
+       * tests/opt.test:
+       * library/opt0.4/optparse.tcl: Applied patch from [Bug: 5922], which 
+       corrected an incorrect use of [string match].
+
+       * tests/stringObj.test: Tweaked tests to avoid hardcoded
+       high-ASCII characters (which will fail in multibyte locales);
+       instead used \uXXXX syntax. [Bug: 3842].
+
+2000-08-05  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * generic/tclIOGT.c (TclChannelTransform): fixed segfault that
+       would occur when transforming a channel with a proc that did not
+       yet exist. (Kupries)
+
+       * generic/tclTest.c (TestChannelCmd): added some lint init'ing of
+       statePtr and chan vars.
+
+2000-07-28  Mo DeJong  <mdejong@redhat.com>
+
+       * win/Makefile.in:
+       * win/configure.in:
+       * win/tcl.m4:
+       * win/tclConfig.sh.in: Back port of gcc for windows
+       build system from 8.4.
+
+2000-07-26  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * merged core-8-3-1-io-rewrite back into core-8-3-1-branch.
+       The core-8-3-1-io-rewrite branch should now be considered defunct.
+
+       * generic/tclStubInit.c:
+       * generic/tclDecls.h:
+       * generic/tcl.decls:
+       * generic/tcl.h:
+       * generic/tclIO.c: moved the Tcl_Channel* macros from tcl.h to
+       tclIO.c and made them proper stubbed functions.  These are:
+       Tcl_ChannelName, Tcl_ChannelVersion, Tcl_ChannelBlockModeProc,
+       Tcl_ChannelCloseProc, Tcl_ChannelClose2Proc, Tcl_ChannelInputProc,
+       Tcl_ChannelOutputProc, Tcl_ChannelSeekProc, Tcl_ChannelSetOptionProc,
+       Tcl_ChannelGetOptionProc, Tcl_ChannelWatchProc,
+       Tcl_ChannelGetHandleProc, Tcl_ChannelFlushProc,
+       and Tcl_ChannelHandlerProc.  These should be used to access the
+       Tcl_ChannelType structure instead of direct pointer dereferencing.
+
+       * unix/Makefile.in: undid 07-25 Makefile.in changes because we
+       don't really want to force all private makefiles on everyone.
+       This needs to be addressed again in the future.  Best possible
+       solution is to create a tcl/ subdir in the installing include dir
+       (as is done already with the lib dir).
+
+       * tests/iogt.test: added RCS string, marked tests 2.* to be
+       unixOnly due to underlying system differences.
+
+       * tests/all.tcl: corrected additional sets by Kupries for testing.
+
+2000-07-26  Syd Polk  <spolk@redhat.com>
+
+       * win/tcl.m4: Building libraries is significantly different on Cygwin
+       now; rewhacked.
+       * win/configure.in: Ditto.
+       * win/Makefile.in: Ditto.
+       * win/configure: Regenerated.
+       * win/tclWinPort.h: tchar.h and direct.h are not defined on Cygwin,
+       nor or they needed.
+
+
+2000-07-25 Brent Welch <welch@ajubasolutions.com>
+
+       * unix/Makefile.in: Need to install all the Tcl headers because
+       Itcl depends on internal headers.
+
+2000-07-25 Andreas Kupries <a.kupries@westend.com>
+
+       * tests/iogt.test: (line 866f) New tests iogt-6.[01], highlighting
+         buffering trouble when stacking and unstacking transformations.
+         iogt-6.0 is solved, see the changes below. iogt-6.1 remains, for
+         now, due to the perceived complexity of solutions.
+
+       * generic/tclIO.h: (line 139f) struct Channel, added a buffer
+         queue, to hold data pushed back when stacking a transformation.
+
+       * generic/tclIO.c:
+         (line 91f, line 7434f) New internal function 'CopyBuffer'.
+         Derived from 'CopyAndTranslateBuffer', with translation
+         removed.
+         (line 1025f, line 1212f): Initialization of new queue.
+         (line 1164f, Tcl_StackChannel): Pushback of input queue.
+         (line 1293f, Tcl_UnstackChannel): Discard input and pushback.
+         (line 3748f, Tcl_ReadRaw): Modified to use data in the push back
+         area before going to the driver. Uses 'CopyBuffer', s.a.
+         (line 4702f, GetInput): Modified to use data in the push back
+         area before going to the driver.
+         (line 4867f, Tcl_Seek): Modified to take pushback of the topmost
+         channel in a stack into account.
+         (line 5620f, Tcl_InputBuffered): See above. Added
+         'Tcl_ChannelBuffered'. Analogue to 'Tcl_InputBuffered' but for
+         the buffer area in the channel.
+
+       * generic/tcl.decls: New public API 'Tcl_ChannelBuffered'. S.a.
+
+2000-07-19  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * tests/socket.test: removed doTestsWithRemoteServer constraint
+       from socket-12.*.  It requires 'exec', not a remote server.
+       Cleaned up some coding errors.
+
+2000-07-18 Brent Welch <welch@ajubasolutions.com>
+
+       * win/Makefile.in: Added rules for static tcldde and tclreg libraries.
+
+2000-07-17  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * README:
+       * win/README:
+       * win/README.binary:
+       * win/configure.in:
+       * unix/configure.in:
+       * unix/tcl.spec:
+       * tools/tcl.wse.in:
+       * generic/tcl.h (TCL_RELEASE_SERIAL): updated to patchlevel 8.3.2
+
+       * unix/Makefile.in:
+       * win/Makefile.in:
+       * win/makefile.vc: added tclIOGT.c to objects list to compile.
+
+       * generic/tclStubInit.c:
+       * generic/tclIntDecls.h:
+       * generic/tclInt.decls: commented out internal decls for
+       TclTestChannelCmd and TclTestChannelEventCmd as they were moved to
+       tclTest.c.  Added new decls for TclChannelEventScriptInvoker and
+       TclChannelTransform.
+
+       * generic/tclIO.h: new file that contains the main internal
+       structures of Tcl_Channel code to allow for multiple files to
+       access them.
+       * generic/tclTest.c:
+       * generic/tclIO.c: broke into 3 files - tclIO.c core code, tclIO.h
+       header code, and tclIOGT.c - the giot test code from Kupries.  The
+       channel test code also moved to tclTest.c.
+       * generic/tclIO.c (CloseChannel): stopped masking out of the
+       TCL_READABLE|TCL_WRITABLE bits from the state flags in
+       CloseChannel, instead adding extra intelligence to
+       CheckChannelErrors with a new CHANNEL_RAW_MODE bit for special
+       behavior when called from Raw channel APIs.
+
+2000-07-13  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * generic/tclIO.c (StackSetBlockMode): moved set of chanPtr
+       outside of blockModeProc check to avoid infinite loop when
+       blockModeProc was NULL (Kupries).  updated TransformSeekProc to
+       not call Tcl_Seek directly (Kupries).
+
+       * win/tclWinChan.c: updated fileChannelType to v2 channel struct
+       * win/tclWinConsole.c: updated consoleChannelType to v2 channel struct
+       * win/tclWinPipe.c: updated pipeChannelType to v2 channel struct
+       * win/tclWinSerial.c: updated serialChannelType to v2 channel struct
+       * win/tclWinSock.c: updated tcpChannelType to v2 channel struct
+
+2000-07-11  Brent Welch        <welch@ajubasolutions.com>
+
+       * win/tclConfig.sh.in: Cleaned up unix-specific autoconf variables.
+
+2000-07-11  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * tests/iogt.test: made tests [345].0 not run by default as they
+       were failing in the new design, but I'm not convinced that the
+       returned result isn't correct.
+
+       * generic/tclDecls.h:
+       * generic/tclStubInit.c:
+       * generic/tcl.decls: added Tcl_GetTopChannel C API that returns
+       the current top channel of a channel stack.  Tcl_GetChannel was
+       changed earlier to return the bottommost channel of a stack
+       because that is the one that is guaranteed to stay around the
+       longest, and this was needed to compensate for certain
+       operations that want to look at the state of the main channel.
+       Most channel APIs already compensate for grabbing the top, so it
+       shouldn't be needed often.
+
+       * generic/tclIO.c (Tcl_StackChannel, Tcl_UnstackChannel): Added
+       flushing of buffers (Kupries), removed use of DownChannel macro,
+       added Tcl_GetTopChannel public API to get to the top channel of
+       the channel stack (necessary for TLS).  Rewrote Tcl_NotifyChannel
+       for new channel design (Kupries).  Did some code cleanup in the
+       transform code.  tclIO.c must still be broken into bits (separate
+       out test code and giot code, create tclIO.h).
+
+2000-07-10  Andreas Kupries <a.kupries@westend.com>
+
+       * tests/iogt.test: Reverted some earlier changes as a fix by Jeff
+         revived the original and correct behaviour. IOW, the tests showed
+         a genuine error and I didn't see it :(.
+
+       * generic/tclIO.c (Tcl_Read|Write_Raw): Changed to directly use
+         the drivers and not DoRead|DoWrite. The latter use the buffering
+         system, encoding and eol-translation and this wreaks havoc with
+         the data going through the transformations. Both procedures use
+         CheckForchannelErrors and let it believe that there is no
+         background copy in progress or else stacked channels could not
+         be used for that.
+
+       * generic/tclIO.c (TclCopyChannel, CopyData): Moved access to the
+         topmost channel from the first to the second procedure to make
+         the decision about that at the last possible time (Callbacks can
+         change the stacking).
+
+       test suite: failures of iogt-[345].0
+       
+2000-07-06  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * tests/iogt.test: new tests for stacked channel stuff based off
+       new 'testchannel transform|unstack' code (Kupries IOGT extension).
+       * generic/tcl.decls:
+       * generic/tcl.h:
+       * generic/tclDecls.h:
+       * generic/tclStubsInit.c:
+       * generic/tclIO.c: complete rewrite of Tcl Channel code for
+       stacked channels.  Channels are now designed to work in a more
+       stacked fashion with a shared ChannelState data structure.
+
+2000-06-16  Syd Polk  <spolk@redhat.com>
+
+       * generic/tclEnv.c win/tclWin32Dll.c: Fix impurePtr to work with
+       modern Cygwin.
+       * win/tcl.m4: Use --compat-implib.
+       * win/configure: Regenerate.
+
+Sat Jun 10 22:43:00 2000  Christopher Faylor <cgf@cygnus.com>
+
+       * win/tclWinFile.c (TclMatchFiles): Revert Mon Jun 5 18:48:32 2000
+       Christopher Faylor <cgf@cygnus.com>.  Fails on Windows 95.
+
+Tue Jun  6 22:09:02 2000  Christopher Faylor <cgf@cygnus.com>
+
+       * win/Makefile.in: Set up and use autoconf variables throughout to
+       allow overriding variables from the make command line.
+
+Tue Jun  6 12:17:46 2000  Christopher Faylor <cgf@cygnus.com>
+
+       * generic/tclFilename.c (Tcl_TranslateFileName): Reinstate Mon Jun 5
+       18:18:32 2000 Christopher Faylor <cgf@cygnus.com> minus a typo.
+
+Tue Jun  6 17:05:20 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * generic/tclFileName.c (Tcl_TranslateFileName): Revert Mon Jun 5
+       18:48:32 2000 Christopher Faylor <cgf@cygnus.com>, didn't compile.
+
+Mon Jun  5 18:48:32 2000  Christopher Faylor <cgf@cygnus.com>
+
+       * generic/tclFileName.c (Tcl_TranslateFileName): Cygwin paths (and
+       Windows in general, actually) do not need to have '/'s translated into
+       '\'s.
+       (TclDoGlob): Ditto.
+       * win/tclWinFile.c (TclMatchFiles): Ditto.
+       * generic/tclInitScript.h: Look in "../bin/usr/share" as well as
+       "../bin/share".
+
+2000-06-02  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * generic/tclIO.c (CloseChannel): removed the &ing out of
+       (TCL_READABLE|TCL_WRITABLE) from the flags, as CloseChannel does
+       this on the next pass through for the top channel, and it appeared
+       to be causing hangs by not allowing the final flush.
+
+2000-06-01  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * generic/tclIO.c (CloseChannel): Rewrote CloseChannel code to
+       unstack a channel during the close process.  Fixed a refcount bug
+       in Tcl_UnstackChannel.  [Bug: 5623]
+       (CloseChannel): further extended CloseChannel in the stacked case
+       to effect certain operations on the next channel that would have
+       been done in Tcl_Close.  Also added CHANNEL_CLOSED and removed
+       (TCL_READABLE|TCL_WRITABLE) bits from chanPtr->flags.  Changed
+       final reset of the WatchProc to check the chanDownPtr's (next)
+       interestMask.
+
+2000-05-29  Sandeep Tamhankar <sandeep@scriptics.com>
+
+       * tests/http.test
+       * doc/http.n
+       * library/http2.3/http.tcl: Fixed bug 5741, where unsuccessful
+       geturl calls sometimes leaked memory and resources (sockets).  
+       Also, switched around some of the logic so that http::wait never 
+       throws an exception.  This is because in an asynchronous geturl, 
+       the command callback will probably end up doing all the error 
+       handling anyway, and in an asynchronous situation, the user
+       expects to check the state when the transaction completes, as
+       opposed to being thrown an exception.   For the http package, this
+       menas the user can check http::status for "error" and http::error
+       for the error message after doing the http::wait.
+
+2000-04-26  Jeff Hobbs  <hobbs@scriptics.com>
+
+       8.3.1 RELEASE
+
+       * README:
+       * mac/README:
+       * tools/tcl.wse.in:
+       * unix/README:
+       * unix/tcl.spec:
+       * win/README:
+       * win/README.binary: Updating URLs to reference dev.scriptics.com
+
+2000-04-25  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * unix/Makefile.in:
+       * win/Makefile.in:
+       * win/makefile.vc: updated for http change and some cleanup
+       * library/http2.[13]: moved dir http2.1 to http2.3 to match version
+
+       * doc/Utf.3: clarified docs for Tcl_(UniChar|Utf)AtIndex
+
+       * unix/tclUnixThrd.c: removed {}s around PTHREAD_MUTEX_INITIALIZER
+       [Bug: 5254]
+
+       * unix/tclLoadDyld.c (TclpLoadFile): removed use of interp->result
+
+2000-04-25  Eric Melski  <ericm@scriptics.com>
+
+       * unix/mkLinks: 
+       * doc/AddErrInfo.3: Added information about Tcl_LogCommandInfo
+       [Bug: 1818].
+
+2000-04-24  Eric Melski  <ericm@scriptics.com>
+
+       * unix/mkLinks: 
+       * doc/OpenFileChnl.3: Added man entry for Tcl_Ungets [Bug: 1834].
+
+       * unix/mkLinks: 
+       * doc/SourceRCFile.3: Man page for Tcl_SourceRCFile [Bug: 1833].
+
+       * unix/mkLinks: 
+       * doc/ParseCmd.3: Added documentation for Tcl_ParseVar [Bug: 1828].
+
+2000-04-24  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * unix/tclUnixNotfy.c (Tcl_FinalizeNotifier, NotifierThreadProc):
+       added write of 'q' into triggerPipe for notifier in threaded case,
+       so that Tcl doesn't hang when children are still running [Bug: 4139]
+
+       * unix/tclUnixThrd.c (Tcl_MutexLock): minor comment fixes.
+
+2000-04-23  Jim Ingham  <jingham@cygnus.com>
+
+       These changes make some error handling marginally better for Mac
+       sockets.  It is still somewhat flakey, however.
+
+       * mac/tclMacSock.c (TcpClose): Add timeouts to the close - these
+       don't seem to be honored, however.
+       Use a separate PB for the release, since an async connect socket
+       will still be using the original buffer.
+       Make sure TCPRelease returns noErr before freeing the recvBuff.
+       If the call returns an error, then the buffer is not right.
+       * mac/tclMacSock.c (CreateSocket): Add timeouts to the async
+       create. These don't seem to trigger, however.  Sigh...
+       * mac/tclMacSock.c (WaitForSocketEvent): If an TCP_ASYNC_CONNECT
+       socket errors out, then return EWOULDBLOCK & error out.
+       * mac/tclMacSock.c (NotifyRoutine): Added a NotifyRoutine for
+       experimenting with MacTCP.
+
+2000-04-22  Jim Ingham <jingham@cygnus.com>
+
+       * library/package.tcl (tclPkgUnknown): Fixed a typo in the Mac package
+       search part of tclPkgUnknown.
+
+2000-04-21  Sandeep Tamhankar <sandeep@scriptics.com>
+
+       * library/http2.1/http.tcl: Fixed a newly introduced bug where if
+       there's a -command callback and something goes wrong, geturl threw
+       an exception, called the callback, and unset the token.  I changed
+       it so that it will not call the callback when throwing an
+       exception (so the caller only finds out about a given error from
+       one place).  Also, fixed http::ncode so that it actually gives you
+       back the http return code (i.e. 200, 404, etc.) instead of the
+       first digit of the version of HTTP being used (i.e. 1).
+
+2000-04-21  Brent Welch <welch@scriptics.com>
+
+       * library/http2.1/http.tcl: More thrashing with the "server closes
+       without reading post data" scenario.  Reverted to the previous
+       filevent configuratiuon, which seems to work better with small
+       amounts of post data.  
+
+2000-04-20  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * generic/tclAlloc.c: wrapped caddr_t define to not be done on Unix
+       * unix/tclUnixPort.h: added Tclp*Alloc defines to allow the use of
+       USE_TCLALLOC on Unix. [Bug: 4731]
+
+2000-04-19  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * library/dde1.1/pkgIndex.tcl:
+       * library/reg1.0/pkgIndex.tcl:
+       * win/tclWinChan.c:
+       * win/tclWinThrd.c: converted CRLF to LF the */tcl.hpj.in files
+       were not converted, as it confuses hcw locally. [Bug: 5096]
+
+       * win/Makefile.in: expanded cleanup target for help files
+
+       * doc/Thread.3: minor macro cleanup
+
+       * generic/tclFileName.c (SplitUnixPath): added support for QNX
+       node ids.
+
+2000-04-18  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * README:
+       * generic/tcl.h:
+       * tools/tcl.wse.in:
+       * unix/configure.in:
+       * unix/tcl.spec:
+       * win/configure.in:
+       * win/README.binary: bumped version to 8.3.1
+
+       * win/tcl.hpj.in: updated copyright date
+
+       * generic/tclEnv.c: environment support for Mac OS/X
+       * unix/tclUnixPort.h: environment support for Mac OS/X
+       * unix/tclLoadDyld.c: new file for Mac OS/X dl functions
+       * unix/Makefile.in: added install-strip target; bindir, libdir,
+       mandir, includedir vars; tclLoadDyld.c target [Bug: 2527]
+
+       * unix/tclUnixChan.c (CreateSocket): force a socket back into
+       blocking mode (default state) after a -async connect succeeds.
+       [Bug: 4388]
+
+       * generic/tclEvent.c (TclInitSubsystems): Moved tclLibraryPath to
+       thread-local storage to prevent thread-related race condition.
+       [Bug: 5033]
+       * unix/tclAppInit.c (main): removed #ifdef TCL_TEST that sets the
+       library path as it was unnecessary and conflicts with move of
+       tclLibraryPath to thread-local storage.
+
+2000-04-18  Scott Redman  <redman@scriptics.com>
+
+       * win/Makefile.in:
+       * win/tcl.rc:
+       * win/tclsh.rc:
+       * win/tclsh.ico:  Modified copyright dates in Windows resource
+       files.  Added an icon for tclsh.exe.
+
+2000-04-17  Brent Welch <welch@scriptics.com>
+
+       * generic/tcl.h, generic/tclThreadTest.c, unix/tclUnixThrd.c,
+       win/tclWinThread.c, mac/tclMacThread.c:
+       Added Tcl_CreateThreadType and TCL_RETURN_THREAD_TYPE
+       macros for declaring the NewThread callback proc.
+
+2000-04-14  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * unix/tclUnixChan.c (TtyParseMode): Only allow setting mark/space
+       parity on platforms that support it [Bug: 5089]
+
+       * generic/tclBasic.c (Tcl_GetVersion): adjusted use of major/minor
+       to not conflict with global decl on some systems [Bug: 2882]
+
+       * doc/AppInit.3:
+       * doc/Async.3:
+       * doc/BackgdErr.3:
+       * doc/CrtChannel.3:
+       * doc/CrtInterp.3:
+       * doc/CrtMathFnc.3:
+       * doc/DString.3:
+       * doc/Eval.3:
+       * doc/ExprLong.3:
+       * doc/GetInt.3:
+       * doc/GetOpnFl.3:
+       * doc/Interp.3:
+       * doc/LinkVar.3:
+       * doc/OpenFileChnl.3:
+       * doc/OpenTcp.3:
+       * doc/PkgRequire.3:
+       * doc/RecordEval.3:
+       * doc/SetResult.3:
+       * doc/SplitList.3:
+       * doc/StaticPkg.3:
+       * doc/TraceVar.3:
+       * doc/Translate.3:
+       * doc/UpVar.3:
+       * doc/load.n: removed or updated references to interp->result use.
+
+2000-04-13  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * doc/regexp.n: doc clarification [Bug: 5037]
+       * doc/update.n: typo fix [Bug: 4996]
+
+       * unix/tcl.m4 (SC_ENABLE_THREADS): enhanced the detection of
+       pthread_mutex_init [Bug: 4359] and (SC_CONFIG_CFLAGS) added
+       --enable-64bit-vis switch for Sparc VIS compilation [Bug: 4995]
+
+2000-04-12  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * doc/dde.n: corrected dde poke docs. [Bug: 4991]
+
+2000-04-11  Eric Melski  <ericm@scriptics.com>
+
+       * win/tclWinPipe.c: Added "CONST" keyword to declaration of char
+       *native in TclpCreateTempFile, to supress compiler warnings.
+
+2000-04-10  Brent Welch <welch@scriptics.com>
+
+       * generic/tcl.h: Fixed Tcl_CreateThread declaration.
+       * library/tcltest1.0/tcltest.tcl: Fixed the "mainThread"
+       initialization to work with either testthread or the thread extension
+       * unix/tclUnixThrd.c: Fixed compiler warning when compiling
+       with -DTCL_THREADS
+
+2000-04-10  Eric Melski  <ericm@scriptics.com>
+
+       * win/tclWinPipe.c (TclpCreateTempFile): Added conversion of
+       contents string from UTF to native encoding [Bug: 4030].
+
+       * tests/regexp.test: Added tests for infinite looping in [regexp
+       -all].
+       
+       * generic/tclCmdMZ.c: Fixed infinite loop bug with [regexp -all]
+       [Bug: 4981].
+
+       * tests/*.test: Changed all occurances of "namespace import
+       ::tcltest" to "namespace import -force ::tcltest" [Bug: 3948].
+
+2000-04-09  Brent Welch <welch@scriptics.com>
+
+       * lib/httpd2.1/http.tcl: Worked on the "server closes before
+       reading post data" case, which unfortunately causes different
+       error cases on Solaris, which can read the reply, and Linux
+       and Windows, which cannot read anything.  This is all in the
+       loop-back case - client and server on the same host.  Also
+       unified the error handling so the "ioerror" status goes away
+       and errors are reflected in a more uniform way. Updated the
+       man page to document the behavior.
+
+2000-04-09  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * tests/reg.test (matchexpected): corrected tests to use tcltest
+       constraint types to skip certain tests.
+
+       * generic/tclBasic.c (Tcl_SetCommandInfo): comment fix
+
+       * unix/tclUnixThrd.c (Tcl_CreateThread): moved TCL_THREADS ifdef
+       inside of func as it is declared for non-threads builds as well.
+       In the non-threads case, it always returns TCL_ERROR (couldn't
+       create thread).
+
+2000-04-08  Andreas Kupries <a.kupries@westend.com>
+
+       * Overall change: Definition of a public API for the creation of
+         new threads.
+
+       * generic/tclInt.h (line 1802f): Removed the definition of
+       'TclpThreadCreate'. (line 793f) Removed the definition of
+       'Tcl_ThreadCreateProc'.
+
+       * generic/tcl.h (line 388f): Readded the definition of
+         'Tcl_ThreadCreateProc'. Added Win32 stuff send in by David
+         Graveraux <davygrvy@bigfoot.com> to that too (__stdcall,
+         ...). Added macros for the default stacksize and allowed flags.
+
+       * generic/tcl.decls (line 1356f): Added definition of
+         'Tcl_CreateThread', slot 393 of the stub table. Two new
+         arguments in the public API, for stacksize and flags.
+
+       * win/tclWinThrd.c:
+       * mac/tclMacThrd.c: Renamed TclpThreadCreate to Tcl_CreateThread,
+         added handling of the stacksize. Flags are currently ignored.
+
+       * unix/tclUnixThrd.c: See above, but handles joinable
+         flag. Ignores the specified stacksize if the macro
+         HAVE_PTHREAD_ATTR_SETSTACKSIZE is not defined.
+
+       * generic/tclThreadTest.c (line 363): See below.
+
+       * unix/tclUnixNotfy.c (line 210): Adapted to the changes
+         above. Uses default stacksize and no flags now.
+
+       * unic/tcl.m4 (line 382f): Added a check for
+         'pthread_attr_setstacksize' to detect platforms not implementing
+         this feature of pthreads. If it is implemented, configure will
+         define the macro HAVE_PTHREAD_ATTR_SETSTACKSIZE (See
+         unix/tclUnixThrd.c too).
+
+       * doc/Thread.3: Added Tcl_CreateThread and its arguments to the
+         list of described functions. Removed stuff about not providing a
+         public C-API for thread-creation.
+
+2000-04-07  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * doc/binary.n: clarified docs on sign extension in binary scan
+       [Bug: 3466]
+
+       * library/tcltest1.0/tcltest.tcl (initConstraints): removed win32s
+       references (no longer supported)
+
+       * tests/fCmd.test: marked test 8.1 knownBug because it is
+       dangerous on poorly configured systems [Bug: 3881]
+       and added 8.2 to keep essence of 8.1 tested.
+
+2000-04-05  Andreas Kupries <a.kupries@westend.com>
+
+       * generic/tclIO.c (Tcl_UnstackChannel, line 1831): Forcing
+       interest mask to the correct value after an unstack and
+       re-initialization of the notifier via the watchProc. Without this
+       the first fileevent after an unstack will come through and be
+       processed, but no more. [Bug: ??].
+
+2000-03-04  Brent Welch  <welch@scriptics.com>
+
+       * {win,unix}/Makefile.in: added dependency of tclStubInit.c on
+       tcl.decls and tclInt.decls
+       * generic/tclThread.c: Tweak so this compiles w/out TCL_THREADS
+       * generic/{tcl.decls,tclStubInit.c}:  Just touched the tcl.decls and
+       regenerated the tclStubInit.c file
+
+2000-03-29  Sandeep Tamhankar <sandeep@scriptics.com>
+
+       * library/http2.1/http.tcl: For the -querychannel option,
+       fconfigure the socket to be binary so that we don't translate
+       anything while reading the data.  This is because we determine the
+       content length of the data on the channel by using seek (to the end
+       of the file) and tell on the file handle, and we need the
+       content-length to match the amount of data actually sent, and
+       translation can affect the number of bytes posted.
+
+2000-04-03  Andreas Kupries <a.kupries@westend.com>
+
+       * Overall change: Definition of public API's for the finalization
+       of conditions and mutexes. [Bug: 4199].
+
+       * generic/tclInt.h: Removed definitions of TclFinalizeMutex and
+       TclFinalizeCondition.
+
+       * generic/tcl.decls: Added declarations of Tcl_MutexFinalize and
+       Tcl_ConditionFinalize.
+
+       * generic/tclThread.c: Renamed TclFinalizeMutex to
+       Tcl_MutexFinalize. Renamed TclFinalizeCondition to
+       Tcl_ConditionFinalize.
+
+       * generic/tclNotify.c: Changed usage of TclFinalizeMutex to
+       Tcl_MutexFinalize.
+
+       * unix/tclUnixNotfy.c: 
+       * generic/tclThreadTest.c: Changed usages of TclFinalizeCondition to
+       Tcl_ConditionFinalize.
+
+       * generic/tcl.h: Added empty macros for Tcl_MutexFinalize and
+       Tcl_ConditionFinalize, to be used when the core is compiled
+       without threads. 
+
+       * doc/Thread.3: Added description the new API's.
+
+2000-04-03  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * generic/tclCmdIL.c (InfoVarsCmd): checked for non-NULL procPtr
+       to prevent itcl info override crash [Bug: 4064]
+
+       * tests/foreach.test:
+       * tests/namespace.test:
+       * tests/var.test: Added lsorts to avoid random sorted return
+       problems. [Bug: 2682]
+
+       * tests/fileName.test: fixed 14.1 test fragility [Bug: 1482]
+
+       * tools/man2help2.tcl: fixed winhelp cross-linking error [Bug: 4156]
+       improved translation to winhelp [Bug: 3679]
+
+       * unix/Makefile.in (MAN_INSTALL_DIR): patch to accept --mandir
+       correctly [Bug: 4085]
+
+       * unix/dltest/pkg[a-e].c: Cleaned up test packages [Bug: 2293]
+
+2000-04-03  Eric Melski  <ericm@scriptics.com>
+
+       * unix/tclUnixFCmd.c (SetGroupAttribute): 
+       * unix/tclUnixFCmd.c (SetOwnerAttribute): Added (uid_t) and (gid_t) 
+       casts to avoid compiler warnings.
+
+2000-03-31  Eric Melski  <ericm@scriptics.com>
+
+       * generic/tclGet.c (Tcl_GetDouble): Added additional conditions to
+       error test (previously only errno was checked, but the return
+       value of strtod() should be checked as well).  [Bug: 4118].
+
+       * tests/exec.test: Added test for proper conversion of UTF data
+       when used with "<< $dataWithUTF" on exec's.
+
+       * unix/tclUnixPipe.c (TclpCreateTempFile): Added
+       Tcl_UtfToExternalDString call, so that if there is UTF content in
+       the string it will be properly converted to the system encoding
+       before being written [Bug: 4030].
+       (TclpCreateTempFile): Added a check on the return value of tmpnam;
+       some systems (Linux, for example) will start to return NULL after
+       tmpnam has been called TMP_MAX times; not checking for this can
+       have bad results (overwriting temp files, core dumps, etc.)
+
+2000-03-30  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * generic/tclBasic.c (Tcl_DeleteCommandFromToken): Added comments
+       noting the need to pair ckalloc with ckfree. [Bug: 4262]
+
+       * generic/tclInt.decls:
+       * generic/tclIntPlatDecls.h:
+       * generic/tclStubInit.c:
+       * win/tclWin32Dll.c: removed TclWinSynchSpawn (vestige of Win32s
+       support).
+
+       * win/tclWinReg.c: made use of TclWinGetPlatformId instead of
+       getting info again
+
+       * win/tclWinPort.h:
+       * win/Makefile.in:
+       * win/configure.in:
+       * win/tcl.m4: Added support for gcc/mingw on Windows [Bug: 4234]
+
+2000-03-29  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * generic/tclCompile.c (TclCleanupByteCode): made ByteCode cleanup
+       more aware of TCL_BYTECODE_PRECOMPILED flagged structs (gen'd by
+       tbcload), to correctly clean them up.
+
+       * generic/tclClock.c (FormatClock): moved check for empty format
+       earlier, commented 0 result return value
+
+2000-03-29  Sandeep Tamhankar <sandeep@scriptics.com>
+
+       * library/http2.1/http.tcl: Removed an unnecessary fileevent
+       statement from the error processing part of the Write method.
+       Also, fixed two potential memory leaks in wait and reset, in which
+       the state array wasn't being unset before throwing an exception.
+       Prior to this version, Brent checked in a fix to catch a
+       fileevent statement that was sometimes causing a stack trace when
+       geturl was called with -timeout.  I believe Brent's fix is
+       necessary because TLS closes bad sockets for secure connections,
+       and the fileevent was trying to act on a socket that no longer
+       existed.
+
+2000-03-27  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * tests/httpd: removed unnecessary 'puts stderr "Post Dispatch"'
+
+       * tests/namespace.test:
+       * generic/tclNamesp.c (Tcl_Export): added a uniq'ing test to the
+       export list so only one instance of each export pattern would
+       exist in the list.
+
+       * generic/tclExecute.c (TclExecuteByteCode): optimized case for
+       the empty string in ==/!= comparisons
+
+2000-03-27  Eric Melski  <ericm@scriptics.com>
+
+       * unix/tclUnixChan.c: Added (off_t) type casts in lseek() call
+       [Bug: 4409].
+
+       * unix/tclLoadAout.c: 
+       * unix/tclUnixPipe.c: Added (off_t) type casts in lseek() calls
+       [Bug: 4410].
+
+2000-03-22  Sandeep Tamhankar <sandeep@scriptics.com>
+
+       * library/http2.1/http.tcl: Fixed a bug where string query data
+       that was bigger than queryblocksize would get duplicate characters
+       at block boundaries.
+
+2000-03-22  Sandeep Tamhankar <sandeep@scriptics.com>
+
+       * library/http2.1/http.tcl: Fixed bug 4463, where we were getting
+       a stack trace if we tried to publish a project to a good host but
+       a port where there was no server listening.  It turned out the
+       problem was a stray fileevent that needed to be cleared.  Also,
+       fixed a bug where http::code could stack trace if called on a bad
+       token (one which didn't represent a successful geturl) by adding
+       an http element to the state array in geturl.
+
+2000-03-21  Eric Melski  <ericm@scriptics.com>
+
+       * tests/clock.test: Modified some tests that were not robust with
+       respect to the time zone in which they were run and were thus
+       failing.
+
+       * doc/clock.n: Clarified meaning of -gmt with respect to -base
+       when used with [clock scan] (-gmt does not affect the
+       interpretation of -base).
+
+2000-03-19  Sandeep Tamhankar <sandeep@scriptics.com>
+
+       * library/http2.1/http.tcl: geturl used to throw an exception when
+       the connection failed; I accidentally returned a token with the
+       error info, breaking backwards compatibility.  I changed it back
+       to throwing an exception, but unsetting the state array first
+       (thus still eliminating the original memory leak problem).
+
+2000-03-19  Sandeep Tamhankar <sandeep@scriptics.com>
+
+       * library/http2.1/http.tcl: Added -querychannel option and altered
+       some of Brent's modifications to allow asynchronous posts (via
+       -command).  Also modified -queryprogress so that it calls the
+       query callback as <callback> <token> <total size> <current size>
+       to be consistent with -progress.  Added -queryblocksize option
+       with default 8192 bytes for post blocksize.  Fixed a bunch of
+       potential memory leaks for the case when geturl receives bad args
+       or can't open a socket, etc.  Overall, the package really rocks
+       now.
+
+       * doc/http.n: Added -queryblocksize, -querychannel, and
+       -queryprogress.  Also, changed the description of -blocksize,
+       which states that the -progress callback will be called for each
+       block, to now qualify that with an "if -progress is specified".
+
+       * tests/http.test: Added a querychannel test for synchronous and
+       asynchronous posts, altered the queryprogress test such that the
+       callback conforms to the -progress format.  Also, had to use the
+       -queryblocksize option to do the post 16K at a time to match
+       Brent's expected results (and to test that -queryblocksize works).
+
+2000-03-15  Brent Welch <welch@scriptics.com>
+
+       * library/http2.1/http.tcl: Added -queryprogress callback to
+       http::geturl and also changed it so that writing the post data
+       is event driven if the queryprogress callback or a timeout is given.
+       This allows a timeout to occur when writing lots of post data.
+       The queryprogress callback is called after each block of query
+       data is posted.  It has the same signature as the -progress callback.
+
+2000-03-06  Eric Melski  <ericm@scriptics.com>
+
+       * library/package.tcl: Applied patch from Bug: 2570; rather than
+       setting geometry of slave interp to 0x0 when Tk was loaded, it now
+       does "wm withdraw .".  Both remove the main window from the
+       display, but the former caused some internal structures to get
+       initialized to zero, which caused crashes with some extensions.
+
+2000-03-02  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * library/package.tcl (tclPkgUnknown): extended to allow
+       recognizes changes in the auto_path while sourcing in other
+       pkgIndex.tcl files
+
+       * doc/FindExec.3: fixed doc for declaration of Tcl_FindExecutable
+       [Bug: 4275]
+
+       * generic/tclFileName.c (Tcl_TranslateFileName): Applied patch
+       from Newman to significantly speedup file split/join on Windows
+       (replaces regexp with custom parser).  [Bug: 2867]
+
+       * win/README.binary: change mailing lists from @consortium.org
+       to @scriptics.com [Bug: 4173]
+
+2000-02-28  Eric Melski  <ericm@scriptics.com>
+
+       * tests/clock.test: Added test for ISO bases < 100000
+
+       * generic/tclDate.c: (generated on Solaris)
+       * generic/tclGetDate.y: Changed condition for deciding if a number
+       is an ISO 8601 base from number >= 100000 to numberOfDigits >= 6.
+       Previously it would fail to recognize 000000 as an ISO base.
+
+2000-02-14  Eric Melski  <ericm@scriptics.com>
+
+       * unix/Makefile.in: Added rpm target to generate Tcl binary RPM.
+
+       * unix/tcl.spec: RPM specification file for a Tcl binary RPM for
+       Linux.
+
+2000-02-10  Jeff Hobbs  <hobbs@scriptics.com>
+
+       8.3.0 RELEASE
+
+       * changes: updated for 8.3.0 release
+
+       * doc/load.n: added notes about dll load errors on Windows
+
+       * unix/README:
+       * unix/Makefile.in (dist): removed porting.notes and porting.old
+       from distribution and CVS.  The information was very outdated.  Now
+       refer to http://dev.scriptics.com/services/support/platforms.html
+
+       * tests/unixInit.test: fixed japanese LANG encoding test [Bug: 3549]
+
+       * unix/configure.in:
+       * unix/tcl.m4: correct CFLAG_WARNING setting,
+       fixed gcc config for AIX,
+       added -export-dynamic to LDFLAGS for FreeBSD-3+ [Bug: 2998]
+
+       * win/tclWinLoad.c (TclpLoadFile): improved error message for load
+       failures, could perhaps be even more intelligent.
+
+2000-02-09  Jim Ingham  <jingham@cygnus.com>
+
+       * mac/tclMacSock.c: Don't panic when you get an error closing an async 
+       socket.  This doesn't seem to hurt anything, and we return the error so
+       the caller can do the right thing.
+
+       New Files:
+       * mac/MW_TclHeader.h:
+       * mac/MW_TclTestHeader.h:
+       * mac/MW_TclTestHeader.pch:
+       * mac/MW_TclAppleScriptHeader.h: More convenient to use .h prefix files
+       in the preference panels...
+
+       The above are curtesy of Daniel Steffen (steffen@math.mq.edu.au)
+
+2000-02-08  Eric Melski  <ericm@scriptics.com>
+
+       * tests/clock.test: Added tests for "next monthname" constructs.
+       * generic/tclDate.c: 
+       * generic/tclGetDate.y (Message): Added a grammar rule for "next
+       monthname" so that we can handle "next january" and similar
+       constructs (bug #4146).
+
+2000-02-08  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * README:
+       * tools/tcl.wse.in:
+       * unix/configure.in:
+       * win/configure.in:
+       * win/README:
+       * win/README.binary:
+       * generic/tcl.h (TCL_RELEASE_SERIAL): Moved to 8.3.0 patchlevel
+
+       * doc/library.n:
+       * library/auto.tcl: fixed crufty puts code and docs [Bug: 4122]
+
+       * library/tcltest1.0/tcltest.tcl: correctly protected searchDirectory
+       list to allow dirnames with spaces
+
+       * unix/tcl.m4: changed all -fpic to -fPIC
+
+       * generic/tclDecls.h:
+       * generic/tcl.decls: change Tcl_GetOpenFile to use decl of 'int
+       forWriting' instead of 'int write' to avoid shadowing [Bug: 4121]
+
+       * tests/httpold.test: changed test script to source in the httpd
+       server procs from httpd instead of having its own set.
+
+       * tests/httpd: improved query support in test httpd to handle fix
+       in http.tcl. [Bug: 4089 change 2000-02-01]
+
+       * unix/README: fixed notes about --enable-shared and add note
+       about --disable-shared.
+
+2000-02-07  Eric Melski  <ericm@scriptics.com>
+
+       * tests/package.test: 
+       * library/tclIndex: 
+       * library/package.tcl: Renamed ::package namespace to ::pkg.
+
+2000-02-03  Eric Melski <ericm@scriptics.com>
+
+       * doc/Package.n:
+       * doc/packagens.n: Renamed Package.n -> packagens.n because Windows 
+       can't deal with case-sensitive names.
+
+2000-02-02  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * tests/regexp.test: added tests for -all and -inline switches
+       * doc/regexp.n: added docs for -all and -inline switches
+       * generic/tclCmdMZ.c (Tcl_RegexpObjCmd): added extra comments for
+       new -all and -inline switches to regexp command
+
+2000-02-01  Eric Melski  <ericm@scriptics.com>
+
+       * library/init.tcl: Applied patch from rfe 1734 regarding
+       auto_load errors not setting error message and errorInfo properly.
+
+2000-02-01  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * win/Makefile.in (install-*): reduced verbosity of install
+
+       * generic/tclFileName.c (Tcl_JoinPath): improved support for special
+       QNX node id prefixes in pathnames [Bug: 4053]
+
+       * library/http1.0/http.tcl:
+       * library/http2.1/http.tcl: The query data POSTed was newline
+       terminated when it shouldn't be altered [Bug: 4089]
+
+2000-01-31  Eric Melski  <ericm@scriptics.com>
+
+       * tests/package.test: 
+       * library/tclIndex: 
+       * library/package.tcl: Added ::package namespace and
+       ::package::create function.
+
+       * library/init.tcl: Fixed problem with auto_load and determining
+       if commands were loaded.
+
+       * library/auto.tcl: "Fixed" issues with $ in files to be auto indexed.
+
+       * doc/Package.n: New man page for package::create function.
+
+       * doc/pkgMkIndex.n: Added additional information.
+
+       * doc/library.n: Added additional qualification regarding auto_mkindex.
+
+2000-01-28  Eric Melski  <ericm@scriptics.com>
+
+       * tests/pkg/magicchar2.tcl: 
+       * tests/autoMkindex.test: Test for auto loader fix (bug #2480).
+
+       * library/init.tcl: auto_load was using [info commands $name] to
+       determine if a given command was available; if the command name
+       had * or [] it, this would fail because info commands uses
+       glob-style matching.  This is fixed.  (Bug #2480).
+
+       * tests/pkg/spacename.tcl: 
+       * tests/pkgMkIndex.test: Tests for fix for bug #2360.
+
+       * library/package.tcl: Fixed to extract only the first element of
+       the list returned by auto_qualify (bug #2360).
+
+       * tests/pkg/magicchar.tcl: 
+       * tests/autoMkindex.test: Test for fix for bug #2611.
+
+       * library/auto.tcl: Fixed the regular expression that performs $
+       escaping before sourcing a file to index.  It was erroneously
+       adding \ escapes even to $'s that were already escaped,
+       effectively "un-escaping" those $'s.  (bug #2611).
+
+2000-01-27  Eric Melski  <ericm@scriptics.com>
+
+       * tests/autoMkindex.test: 
+       * library/auto.tcl: Applied patch (with slight modification) from
+       bug #2701:  auto_mkIndex uses platform dependent file paths.
+       Added test for fix.
+
+2000-01-27  Jennifer Hom  <jenn@scriptics.com>
+
+       * library/tcltest1.0/tcltest.tcl: Changed NormalizePath to
+       normalizePath and exported it as a public proc.  This proc 
+       creates an absolute path given the name of the variable containing
+       the path to modify.  The path is modified in place.
+       * library/tcltest1.0/pkgIndex.tcl: Added normalizePath.
+       * tests/all.tcl: Changed code to use normalizePath.
+
+2000-01-27  Eric Melski  <ericm@scriptics.com>
+
+       * tests/pkg/samename.tcl: test file for bug #1983
+       
+       * tests/pkgMkIndex.test: 
+       * doc/pkgMkIndex.n: 
+       * library/package.tcl: Per rfe #4097, optimized creation of direct
+       load packages to bypass computing the list of commands added by
+       the new package.  Also made direct loading the default, and added
+       a -lazy option.
+       Fixed bug #1983, dealing with pkg_mkIndex incorrectly handling
+       situations with two procs by the same name but in different
+       namespaces (ie, foo::baz and bar::baz).
+
+2000-01-26  Eric Melski  <ericm@scriptics.com>
+
+       * generic/tclNamesp.c: Undid fix for #956, which broke backwards
+       compatibility.
+
+       * doc/variable.n: 
+       * doc/trace.n: 
+       * doc/namespace.n: 
+       * doc/info.n: Added further information about differences between
+       "namespace which" and "info exists".
+
+       * doc/SetErrno.3: Added descriptions of ErrnoId() and ErrnoMsg()
+       functions.
+
+2000-01-25  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * unix/tcl.m4: modified EXTRA_CFLAGS to add -DHAVE_TZSET for
+       OSF1-V* and ULTRIX-4.* when not using gcc.  Also added higher min
+       stack size for OSF1-V* when building with threads. [Bug: 4063]
+
+       * generic/tclClock.c (FormatClock): inlined resultPtr, as it
+       conflicted with var creation for HAVE_TZSET #def [Bug: 4063]
+
+       * generic/tclCmdIL.c (Tcl_LsortObjCmd): fixed potential leak
+       when calling lsort -command with bad command [Bug: 4067]
+
+       * generic/tclFileName.c (Tcl_JoinPath): added support for special
+       QNX node id prefixes in pathnames [Bug: 4053]
+
+       * doc/ListObj.3: clarified Tcl_ListObjGetElements docs [Bug: 4080]
+
+       * doc/glob.n: clarified Mac path separator determination docs.
+
+       * win/makefile.vc: added some support for building helpfile on Windows
+
+2000-01-23  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * library/init.tcl (auto_execok): added 'start' to list of
+       recognized built-in commands for COMSPEC on NT. [Bug: 2858]
+
+       * unix/tclUnixPort.h: moved include of <utime.h> lower since some
+       systems (UTS) require sys/types.h to be included first [Bug: 4031]
+
+       * unix/tclUnixChan.c (CreateSocketAddress): changed comparison
+       with -1 to 0xFFFFFFFF, to ensure 32 bit comparison even on 64 bit
+       systems. [Bug: 3878]
+
+       * generic/tclFileName.c: improved guessing of path separator
+       for the Mac. (Darley)
+
+       * generic/tclInt.h:
+       * generic/tcl.decls: moved Tcl_ProcObjCmd to stubs table [Bug: 3827]
+       and removed 'register' from stub definition of
+       Tcl_AppendUnicodeToObj [Bug: 4038]
+
+2000-01-21  Eric Melski  <ericm@scriptics.com>
+
+       * unix/mkLinks: 
+       * doc/GetHostName.3: Man page for Tcl_GetHostName (bug #1817).
+
+       * doc/lreplace.n: Corrected man page with respect to treatment of
+       empty lists, and "prettied up" the page. (bug #1705).
+
+2000-01-20  Eric Melski  <ericm@scriptics.com>
+
+       * tests/namespace.test: Added test for undefined variables with
+       namespace which (bug #956).
+
+       * generic/tclNamesp.c: Added check for undefined variables in
+       NamespaceWhichCmd (bug #956).
+
+       * tests/var.test: Added tests for corrected variable behavior 
+       (bug #981).
+
+       * doc/upvar.n: Expanded explanation of upvar behavior with respect to
+       variable traces.  (bugs 3917 1433 2110).
+
+       * generic/tclVar.c: Changed behavior of variable command when name
+       refers to an element in an array (ie, "variable foo(x)") to always
+       return an error, regardless of existance of that element in the
+       array (now behavior is consistant with docs too) (bug #981).
+
+2000-01-20  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * generic/tclCmdIL.c (InfoBodyCmd): made [info body] return a
+       string if the body has been bytecompiled.
+       * generic/tclBasic.c (Tcl_EvalObjEx): added pedantic check for
+       originating proc body of bytecompiled code, #def'd out as the
+       change for [info body] should make it unnecessary
+
+       * unix/tclUnixNotfy.c (Tcl_InitNotifier): added cast for tsdPtr
+
+       * tests/set.test: added test for complex array elem name compiling
+       * generic/tclCompCmds.c (TclCompileSetCmd): Fixed parsing of array
+       elements during compiling, and slightly optimised same [Bug: 3889]
+
+       * doc/tclvars.n: added definitions for tcl_(non)wordchars
+
+       * doc/vwait.n: added notes about requirement for vwait var being
+       globally scoped [Bug: 3329]
+
+       * library/word.tcl: changed tcl_(non)wordchars settings to use
+       new unicode regexp char class escapes instead of char sequences
+
+2000-01-14  Eric Melski  <ericm@scriptics.com>
+
+       * tests/var.test: Added a test for the array multiple delete
+       protection in Tcl_UnsetVar2.
+
+       * generic/tclVar.c: Added protection in Tcl_UnsetVar2 against
+       attempts to multiply delete arrays when unsetting them (bug
+       #3453).  This could happen if there was an unset trace on an array
+       element and the trace proc made a global or upvar link to the
+       array, and then the array was unset at the global level.  See the
+       bug reference for more information.
+
+       * unix/tclUnixTime.c: New clock format format.
+
+       * compat/strftime.c: New clock format format.
+
+       * generic/tclGetDate.y: New clock scan format.
+
+2000-01-13  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * changes: updated changes file to reflect 8.3b2 mods
+
+       * README:
+       * generic/tcl.h:
+       * tools/tcl.wse.in:
+       * unix/configure.in:
+       * unix/tcl.m4:
+       * win/README.binary:
+       * win/configure.in: updated to patchlevel 8.3b2
+
+       * generic/regexec.c: added var initialization to prevent compiler
+       warning
+
+2000-01-13  Eric Melski  <ericm@scriptics.com>
+
+       * tests/cmdIL.test: Added tests for lsort -dictionary with
+       characters that occur between Z and a in ASCII.
+
+       * generic/tclCmdIL.c: Modified DictionaryCompare function (used by
+       lsort -dictionary) to do upper/lower case equivalency before doing
+       character comparisons, instead of after.  This fixes bug #1357, in
+       which lsort -dictionary [list ` AA c CC] and lsort -dictionary
+       [list AA c ` CC] gave different (and both wrong) results.
+
+2000-01-12  Eric Melski  <ericm@scriptics.com>
+
+       * tests/clock.test: Added tests for "next <day-of-week>" and
+       "<day-of-week>"
+       Added tests for "monday 1 week ago", etc, from RFE #3671.
+
+       * doc/tests/clock.test: Added numerous tests for clock scan.
+
+       * doc/generic/tclGetDate.y: Fixed some shift/reduce conflicts in
+       clock grammar.
+
+       * doc/doc/clock.n: Added documentation for new supported clock
+       scan formats and additional explanation of daylight savings time
+       correction algorithm.
+
+2000-01-12  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * doc/file.n:
+       * tests/unixFCmd.test:
+       * unix/tclUnixFCmd.c: added support for symbolic permissions
+       setting in SetPermissionsAttribute (file attr $file -perm ...)
+       [Bug: 3970]
+
+       * generic/tclClock.c: fixed support for 64bit handling of clock
+       values [Bug: 1806]
+
+       * generic/tclThreadTest.c: upped a buffer size to hold double
+
+       * tests/info.test:
+       * generic/tclCmdIL.c: fixed 'info procs ::namesp::*' behavior (Dejong)
+
+       * generic/tclNamesp.c: made imported commands also import their
+       compile proc [Bug: 2100]
+
+       * tests/expr.test:
+       * unix/Makefile.in:
+       * unix/configure.in:
+       * unix/tcl.m4: recognize strtod bug on Tru64 v5.0 [Bug: 3378]
+       and added tests to prevent unnecessary chmod +x in sources while
+       installing, as well as more intelligent setsockopt/gethostbyname
+       checks [Bug: 3366, 3389]
+
+       * unix/tclUnixThrd.c: added compile time support (through use of
+       the TCL_THREAD_STACK_MIN define) for increasing the default stack
+       size for a thread. [Bug: 3797, 1966]
+
+2000-01-11  Eric Melski  <ericm@scriptics.com>
+
+       * generic/tclGetDate.y: Added comments for the Convert function.
+       Added a fix for daylight savings time handling for relative time
+       spans of days, weeks or fortnights. (bug 3441, 3868).
+
+       * generic/tclDate.c: Fixed compiler warning issues.
+
+2000-01-10  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * compat/waitpid.c: use pid_t type instead of int [Bug: 3999]
+
+       * tests/utf.test: fixed test that allowed \8 as octal value
+       * generic/tclUtf.c: changed Tcl_UtfBackslash to not allow
+       non-octal digits (8,9) in \ooo substs. [Bug: 3975]
+
+       * generic/tcl.h: noted need to change win/tcl.m4 and
+       tools/tclSplash.bmp for minor version changes
+
+       * library/http2.1/http.tcl: trim value for $state(meta) key
+
+       * unix/tclUnixFile.c: fixed signature style on functions
+
+       * unix/Makefile.in: made sure tcl.m4 would be installed with dist
+
+       * unix/tcl.m4: added ELF support for NetBSD [Bug: 3959]
+
+2000-01-10  Eric Melski  <ericm@scriptics.com>
+
+       * generic/tclGetDate.y: Added rules for ISO 8601 formats (BUG #847):
+       CCYY-MM-DD
+       CCYYMMDD
+       YY-MM-DD
+       YYMMDD
+       CCYYMMDDTHHMMSS
+       CCYYMMDD HHMMSS
+       CCYYMMDDTHH:MM:SS
+       Fixed "clock scan <number>" to scan the number as an hour for the
+       current day, rather than a minute after 00:00 for the current day
+       (bug #2732).
+       
+
+2000-01-07  Eric Melski  <ericm@scriptics.com>
+
+       * generic/tclClock.c: Changed switch in Tcl_ClockObjCmd to use
+       enumerated values instead of constants. (ie, COMMAND_SCAN instead
+       of 3).
+
+1999-12-22  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * changes: updated changes file
+       * tools/tclSplash.bmp: updated to show 8.3
+
+1999-12-21  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * README:
+       * generic/tcl.h:
+       * mac/README:
+       * unix/configure.in:
+       * tools/tcl.wse.in:
+       * win/README.binary:
+       * win/configure.in: updated to patch level 8.3b1
+
+       * unix/Makefile.in: added -srcdir=... for 'make html'
+
+       * doc/Hash.3: fixed reference to ckfree [Bug: 3912]
+       * doc/RegExp.3: fixed calling params for Tcl_RegExecFromObj
+       * doc/open.n: fixed minor formatting errors
+       * doc/string.n: fixed minor formatting errors
+
+       * doc/lsort.n: added -unique docs
+       * tests/cmdIL.test:
+       * generic/tclCmdIL.c: added -unique option to lsort
+
+       * generic/tclThreadTest.c: changed thread ids to longs [Bug: 3902]
+
+       * mac/tclMacOSA.c: fixed applescript for I18N [Bug: 3644]
+
+       * win/mkd.bat:
+       * win/rmd.bat: removed necessity of tag.txt [Bug: 3874]
+
+       * win/tclWinThrd.c: changed CreateThread to _beginthreadex and
+       ExitThread to _endthreadex
+
+1999-12-12  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * doc/glob.n:
+       * tests/fileName.test:
+       * generic/tclInt.decls:
+       * generic/tclInt.h:
+       * generic/tclIntDecls.h:
+       * generic/tclStubInit.c:
+       * generic/tclEncoding.c:
+       * generic/tclFileName.c:
+       * mac/tclMacFile.c:
+       * unix/tclUnixFile.c:
+       * win/tclWinFile.c: enhanced the glob command with the new options
+       -types -path -directory and -join.  Deprecated TclpMatchFiles with
+       TclpMatchFilesTypes, extended TclGlob and TclDoGlob and added
+       GlobTypeData structure. [Bug: 2363]
+
+1999-12-10  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * tests/var.test:
+       * generic/tclCompile.c: fixed problem where setting to {} array
+       would intermittently not work. (Fontaine) [Bug: 3339]
+
+       * generic/tclCmdMZ.c:
+       * generic/tclExecute.c: optimized INST_TRY_CVT_TO_NUMERIC to
+       recognize boolean objects. (Spjuth) [Bug: 2815]
+
+       * tests/info.test:
+       * tests/parseOld.test:
+       * generic/tclCmdAH.c:
+       * generic/tclProc.c: changed Tcl_UplevelObjCmd (uplevel) and
+       Tcl_EvalObjCmd (eval) to use TCL_EVAL_DIRECT in the single arg
+       case as well, to take advantage of potential pure list input
+       optimization.  This means that it won't get byte compiled though,
+       which should be acceptable.
+       * generic/tclBasic.c: made Tcl_EvalObjEx pure list object aware in
+       the TCL_EVAL_DIRECT case for efficiency.
+       * generic/tclUtil.c: made Tcl_ConcatObj pure list object aware,
+       and return a list object in that case [Bug: 2098 2257]
+
+       * generic/tclMain.c: changed Tcl_Main to not constantly reuse the
+       commandPtr object (interactive case) as it could be shared. (Fellows)
+
+       * unix/configure.in:
+       * unix/tcl.m4:
+       * unix/tclUnixPipe.c: removed checking for compatible vfork
+       function and use of the vfork function.  Modern VM systems rarely
+       suffer any performance degradation when fork is used, and it
+       solves multiple problems with vfork.  Users that still want vfork
+       can add -Dfork=vfork to the compile flags. [Bug: 942 2228 1312]
+
+1999-12-09  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * win/aclocal.m4: made it just include tcl.m4
+
+       * doc/exec.n:
+       * doc/open.n:
+       * win/tclWin32Dll.c:
+       * win/tclWinChan.c:
+       * win/tclWinFCmd.c:
+       * win/tclWinInit.c:
+       * win/tclWinPipe.c:
+       * win/tclWinSock.c: removed all code that supported Win32s.  It
+       was no longer officially supported, and likely didn't work anyway.
+       * win/makefile.vc: removed 16 bit stuff, cleaned up.
+
+       * win/tcl16.rc:
+       * win/tclWin16.c:
+       * win/winDumpExts.c: these files have been removed from the
+       source tree (no longer necessary to build)
+
+1999-12-07  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * tests/io.test: removed 'knownBug' tests that were for
+       unsupported0, which is now fcopy (that already has tests)
+
+       * mac/tclMacPort.h: added utime.h include
+
+       * generic/tclDate.c:
+       * unix/Makefile.in: fixed make gendate to swap const with CONST
+       so it uses the Tcl defined CONST type [Bug: 3521]
+
+       * generic/tclIO.c: removed panic that could occur in FlushChannel
+       when a "blocking" channel would receive EAGAIN, instead treating
+       it the same as non-blocking. [Bug: 3773]
+
+       * generic/tclUtil.c: fixed Tcl_ScanCountedElement to not step
+       beyond the end of the counted string [Bug: 3336]
+
+1999-12-03  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * doc/load.n: added note about NT's buggy handling of './' with
+       LoadLibrary
+
+       * library/http2.1/http.tcl: fixed error handling in http::Event
+       [Bug: 3752]
+
+       * tests/env.test: removed knownBug limitation from working test
+       * tests/all.tcl: ensured that ::tcltest::testsDirectory would be
+       set to an absolute path
+
+       * tests/expr-old.test:
+       * tests/parseExpr.test:
+       * tests/string.test:
+       * generic/tclGet.c:
+       * generic/tclInt.h:
+       * generic/tclObj.c:
+       * generic/tclParseExpr.c:
+       * generic/tclUtil.c:
+       * generic/tclExecute.c: added TclCheckBadOctal routine to enhance
+       error message checking for when users use invalid octal numbers
+       (like 08), as well as replumbed the Expr*Funcs with a new
+       VerifyExprObjType to simplify type handling. [Bug: 2467]
+
+       * tests/expr.test:
+       * generic/tclCompile.c: fixed 'bad code length' error for
+       'expr + {[incr]}' case, with new test case [Bug: 3736]
+       and seg fault on 'expr + {[error]}' (different cause) that
+       was caused by a correct optimization that didn't correctly
+       track how it was modifying the source string in the opt.
+       The optimization was removed, which means that:
+               expr 1 + {[string length abc]}
+       will be not be compiled inline as before, but this should be
+       written:
+               expr {1 + [string length abc]}
+       which will be compiled inline for speed.  This prevents
+               expr 1 + {[mindless error]}
+       from seg faulting, and only affects optimizations for
+       degenerate cases [Bug: 3737]
+
+1999-12-01  Scott Redman <redman@scriptics.com>
+
+       * generic/tcl.decls :
+       * generic/tclMain.c :
+       * unix/tclAppInit.c: 
+       * win/tclAppInit.c: Added two new internal functions,
+       TclSetStartupScriptFileName() and TclGetStartupScriptFileName()
+       and added hooks into the main() code for supporting TclPro and
+       other "big" shells more easily without requiring a copy of the
+       main() code.
+       
+       * generic/tclEncoding.c:
+       * generic/tclEvent.c:  Moved encoding-related startup code from
+       tclEvent.c into the more appropriate tclEncoding.c.
+       
+1999-11-30  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * generic/tclIO.c: fix from Kupries for Tcl_UnstackChannel that
+       correctly handles resetting translation and encoding.
+
+       * generic/tclLoad.c: #def'd out the unloading of DLLs at finalize
+       time for Unix in TclFinalizeLoad. [Bug: 2560 3373]  Should be
+       parametrized to allow for user to specify unload or not.
+
+       * win/tclWinTime.c: fixed handling of %Z on NT for time zones
+       that don't have DST.
+
+1999-11-29  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * library/dde1.1/pkgIndex.tcl:
+       * library/reg1.0/pkgIndex.tcl: added supported for debugged
+       versions of the libraries
+
+       * unix/tclUnixPipe.c: fixed PipeBlockModeProc to properly set
+       isNonBlocking flag on pipe. [Bug: 1356 710]
+       removed spurious fcntl call from PipeBlockModeProc
+
+       * tests/scan.test:
+       * generic/tclScan.c: fixed scan where %[..] didn't match anything
+       and added test case [Bug: 3700]
+
+1999-11-24  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * doc/open.n:
+       * win/tclWinSerial.c: adopted patch from Schroedter to handle
+       fconfigure $sock -lasterror on Windows. [RFE: 3368]
+
+       * generic/tclCmdIL.c: made SORTMODE_INTEGER work with Longs
+       [Bug: 3652]
+
+1999-11-23  Scott Stanton  <stanton@scriptics.com>
+
+       * library/tcltest1.0/tcltest.tcl: Fixed bug where tcltest output
+       went to stdout instead of the specified output file in some
+       cases.
+
+1999-11-19  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * generic/tclProc.c: backed out change from 1999-11-18 as it
+       could affect return string from upvar as well.
+
+       * tools/tcl.wse.in: added tcltest1.0 library to distribution list
+
+       * doc/http.n:
+       * library/http2.1/http.tcl:
+       * library/http2.1/pkgIndex.tcl: updated http package to 2.2
+
+1999-11-18  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * unix/tcl.m4: added defined for _THREAD_SAFE in --enable-threads
+       case; added check for pthread_mutex_init in libc; in AIX case,
+       with --enable-threads ${CC}_r is used; fixed flags when using gcc
+       on SCO
+
+       * generic/tclProc.c: corrected error reporting for default case
+       at the global level for uplevel command.
+
+       * generic/tclIOSock.c: changed int to size_t type for len
+       in TclSockMinimumBuffers.
+
+       * generic/tclCkalloc.c: fixed Tcl_DbCkfree to return a value
+       on NULL input. [Bug: 3400]
+
+       * generic/tclStringObj.c: fixed support for passing in negative
+       length to Tcl_SetUnicodeObj, et al handling routines. [Bug: 3380]
+
+       * doc/scan.n:
+       * tests/scan.test:
+       * generic/tclScan.c: finished support for inline scan by
+       supporting XPG identifiers.
+
+       * doc/http.n:
+       * library/http2.1/http.tcl: added register and unregister
+       commands to http:: package (better support for tls/SSL),
+       as well as -type argument to http::geturl. [RFE: 2617]
+
+       * generic/tclBasic.c: removed extra decr of numLevels in
+       Tcl_EvalObjEx that could cause seg fault. (mjansen@wendt.de)
+
+       * generic/tclEvent.c: fixed possible lack of MutexUnlock in
+       Tcl_DeleteExitHandler [Bug: 3545]
+
+       * unix/tcl.m4: Added better pthreads library check and inclusion
+       of _THREAD_SAFE in --enable-threads case
+       Added support for gcc config on SCO
+
+       * doc/glob.n: added note about ..../ glob behavior on Win9*
+       * doc/tcltest.n: fixed minor example errors [Bug: 3551]
+
+1999-11-17 Brent Welch <welch@scriptics.com>
+       * library/http2.1/http.tcl: Correctly fixed the -timeout
+       problem mentioned in the 10-29 change.  Also added error
+       handling for failed writes on the socket during the protocol.
+
+1999-11-09  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * doc/open.n: corrected docs for 'a' open mode.
+
+       * generic/tclIOUtil.c: changed Tcl_Alloc to ckalloc
+
+       * generic/tclInt.h:
+       * generic/tclObj.c: rolled back changes from 1999-10-29
+       Purify noted new leaks with that code
+
+       * generic/tclParse.c: added code in Tcl_ParseBraces to test for
+       possible unbalanced open brace in a comment
+
+       * library/init.tcl: removed the installed binary directory from
+       the auto_path variable
+
+       * tools/tcl.wse.in: updated to 8.3a1, fixed install of twind.tcl
+       and koi8-r.enc files
+
+       * unix/tcl.m4: added recognition of pthreads library for AIX
+
+1999-10-29  Brent Welch <welch@scriptics.com>
+       * generic/tclInt.h: Modified the TclNewObj and TclDecrRefCount
+       in two ways.  First, in the case of TCL_THREADS, we do not use
+       the special Tcl_Obj allocator because that is a source of 
+       lock contention.  Second, general code cleanup to eliminate
+       duplicated code. In particular, TclDecrRefCount now uses
+       TclFreeObj instead of duplicating that code, so it is now
+       identical to Tcl_DecrRefCount.
+
+       * generic/tclObj.c: Changed Tcl_NewObj so it uses the
+       TclNewObj macro instead of duplicating the code.  Adjusted
+       TclFreeObj so it understands the TCL_THREADS case described
+       above.
+
+       * library/http2.1/http.tcl: Fixed a bug in the handling of
+       the state(status) variable when the -timeout flag is specified.
+       Previously it was possible to leave the status undefined
+       instead of empty, which caused errors in http::status
+
+1999-10-28  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * unix/aclocal.m4: made it just include tcl.m4
+
+       * library/tcltest1.0/tcltest.tcl: updated makeFile to return
+       full pathname of file created
+
+       * generic/tclStringObj.c: fixed Tcl_AppendStringsToObjVA so it only
+       iterates once over the va_list (avoiding a memcpy of it,
+       which is not portable).
+
+       * generic/tclEnv.c: fixed possible ABR error in environ array
+
+       * tests/scan.test:
+       * generic/tclScan.c: added support for use of inline scan,
+       XPG3 currently not included
+
+       * tests/incr.test:
+       * tests/set.test:
+       * generic/tclCompCmds.c: fixed improper bytecode handling of
+       'eval {set array($unknownvar) 5}' (also for incr) [Bug: 3184]
+
+       * win/tclWinTest.c: added testvolumetype command, as atime is
+       completely ignored for Windows FAT file systems
+       * win/tclWinPort.h: added sys/utime.h to includes
+       * unix/tclUnixPort.h: added utime.h to includes
+       * doc/file.n:
+       * tests/cmdAH.test:
+       * generic/tclCmdAH.c: added time arguments to atime and mtime
+       file command methods (support 'touch' functionality)
+
+1999-10-20  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * unix/tclUnixNotfy.c: fixed event/io threading problems by
+       making triggerPipe non-blocking [Bug: 2792]
+
+       * library/tcltest1.0/tcltest.tcl:
+       * generic/tclThreadTest.c: fixed mem leaks in threads
+
+       * generic/tclResult.c: fixed Tcl_AppendResultVA so it only
+       iterates once over the va_list (avoiding a memcpy of it,
+       which is not portable).
+
+       * generic/regc_color.c: fixed mem leak and assertion, from HS
+
+       * generic/tclCompile.c: removed savedChar trick that appeared to
+       be causing a segv when the literal table was released
+
+       * tests/string.test:
+       * generic/tclCmdMZ.c: fixed [string index] to return ByteArrayObj
+       when indexing into one (test case string-5.16) [Bug: 2871]
+
+       * library/http2.1/http.tcl: protected gets with catch [Bug: 2665]
+
+1999-10-19  Jennifer Hom  <jenn@scriptics.com>
+
+       * tests/tcltest.test:
+       * doc/tcltest.n:
+       * library/tcltest1.0/tcltest.tcl: Removed the extra return at the
+       end of the tcltest.tcl file, added version information about tcl.
+
+       Applied patches sent in by Andreas Kupries to add helper procs for
+       debug output, add 3 new flags (-testsdir, -load, -loadfile), and
+       internally refactors common code for dealing with paths into
+       separate procedures. [Bug: 2838, 2842]
+
+       Merged code from core-8-2-1 branch that changes the checks for the
+       value of tcl_interactive to also incorporate a check for the
+       existence of the variable.
+
+       * tests/autoMkindex.test:
+       * tests/pkgMkIndex.test: Explicitly cd to
+       ::tcltest::testsDirectory at the beginning of the test run
+
+       * tests/basic.test: Use version information defined in tcltest
+       instead of hardcoded version number
+
+       * tests/socket.test: package require tcltest before attempting to
+       use variable defined in tcltest namespace
+
+       * tests/unixInit.test: 
+       * tests/unixNotfy.test: Added explicit exits needed to avoid
+       problems when the tests area run in wish.
+       
+1999-10-12  Jim Ingham  <jingham@scriptics.com>
+
+       * mac/tclMacLoad.c: Stupid bug - we converted the filename to
+       external, but used the unconverted version.
+       * mac/tclMacFCmd.c: Fix a merge error in the bug fix for [Bug: 2869]
+
+1999-10-12  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * generic/regc_color.c:
+       * generic/regc_cvec.c:
+       * generic/regc_lex.c:
+       * generic/regc_locale.c:
+       * generic/regcomp.c:
+       * generic/regcustom.h:
+       * generic/regerrs.h:
+       * generic/regex.h:
+       * generic/regexec.c:
+       * generic/regguts.h:
+       * generic/tclRegexp.c:
+       * generic/tclTest.c:
+       * tests/reg.test: updated to Henry Spencer's new regexp engine
+       (mid-Sept 99).  Should greatly reduce stack space reqs.
+
+       * library/tcltest1.0/pkgIndex.tcl: fixed procs in pkgIndex.tcl file
+
+       * generic/tclEnv.c: fixed mem leak with putenv and DStrings
+       * doc/Encoding.3: corrected docs
+       * tests/basic.test: updated test cases for 8.3
+       * tests/encoding.test: fixed test case that change system
+       encoding to a double-byte one (this causes a bogus mem read
+       error for purify)
+       * unix/Makefile.in: purify has to use -best-effort to instrument
+       * unix/tclAppInit.c: identified potential mem leak when compiling
+       tcltest (not critical)
+       * unix/tclUnixPipe.c: fixed mem leak in TclpCreateProcess when
+       doing alloc between vfork and execvp.
+       * unix/tclUnixTest.c: fixed mem leak in findexecutable test command
+
+1999-10-05  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * {win,mac,unix,tools,}/README:
+       * win/README.binary:
+       * win/makefile.vc:
+       * {win,unix}/configure.in:
+       * generic/tcl.h:
+       * library/init.tcl: updated to 8.3a1 from 8.2.0.
+
+       * library/http2.1/http.tcl: fixed possible use of global c var.
+
+       * win/tclWinReg.c: fixed registry command to properly 'get'
+       HKEY_PERFORMANCE_DATA root key data.  Needs more work.
+       
+       * generic/tclNamesp.c:
+       * generic/tclVar.c:
+       * generic/tclCmdIL.c: fixed comment typos
+
+       * mac/tclMacFCmd.c: fixed filename stuff to support UTF-8 [Bug: 2869]
+
+       * win/tclWinSerial.c: changed SerialSetOptionProc to return
+       TCL_OK by default. (patch from Rolf Schroedter)
+
+1999-09-21  Jennifer Hom  <jenn@scriptics.com>
+
+       * library/tcltest1.0/tcltest.tcl: Applied patches sent in by
+       Andreas Kupries to fix typos in comments and ::tcltest::grep,
+       fix hook redefinition problems, and change "string compare" to
+       "string equal." [Bug: 2836, 2837, 2839, 2840]
+
+1999-09-20  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * tests/env.test:
+       * unix/Makefile.in: added support for AIX LIBPATH env var [Bug: 2793]
+       removed second definition of INCLUDE_INSTALL_DIR (the one that
+       referenced @includedir@) [Bug: 2805]
+       * unix/dltest/Makefile.in: added -lc to LIBS [Bug: 2794]
+
+1999-09-16  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * tests/timer.test: changed after delay in timer test 6.29 from
+       1 to 10. [Bug: 2796]
+
+       * tests/pkg.test:
+       * generic/tclPkg.c: fixed package version check to disallow 1.2..3
+       [Bug: 2539]
+
+       * unix/Makefile.in: fixed gendate target - this never worked
+       since RCS was intro'd.
+       * generic/tclGetDate.y: updated to reflect previous changes
+       to tclDate.c (leap year calc) and added CEST and UCT time zone
+       recognition.  Fixed 4 missing UCHAR() casts. [Bug: 2717, 954,
+       1245, 1249]
+
+       * generic/tclCkalloc.c: changed Tcl_DumpActiveMemory to really
+       dump to stderr and close it [Bug: 725] and changed Tcl_Ckrealloc
+       and Tcl_Ckfree to not bomb when NULL was passed in [Bug: 1719]
+       and changed Tcl_Alloc, et al to not panic when a alloc request
+       for zero came through and NULL was returned (valid on AIX, Tru64)
+       [Bug: 2795, etc]
+
+       * tests/clock.test:
+       * doc/clock.n:
+       * generic/tclClock.c: added -milliseconds switch to clock clicks
+       to guarantee that the return value of clicks is in the millisecs
+       granularity [Bug: 2682, 1332]
+
+1999-09-15  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * generic/tclIOCmd.c: fixed potential core dump in conjunction
+       with stacked channels with result obj manipulation in
+       Tcl_ReadChars [Bug: 2623]
+
+       * tests/format.test:
+       * generic/tclCmdAH.c: fixed translation of %0#s in format [Bug: 2605]
+
+       * doc/msgcat.n: fixed \\ bug in example [Bug: 2548]
+
+       * unix/tcl.m4:
+       * unix/aclocal.m4: added fix for FreeBSD-[1-2] recognition
+       [Bug: 2070] and fix for IRIX SHLIB_LB_LIBS. [Bug: 2610]
+
+       * doc/array.n:
+       * tests/var.test:
+       * tests/set.test:
+       * generic/tclVar.c: added an array unset operation, with docs
+       and tests.  Variation of [Bug: 1775].  Added fix in TclArraySet
+       to check when trying to set in a non-existent namespace. [Bug: 2613]
+
+1999-09-14  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * tests/linsert.test:
+       * doc/linsert.n:
+       * generic/tclCmdIL.c: fixed end-int interpretation of linsert
+       to correctly calculate value for end, added test and docs [Bug: 2693]
+
+       * doc/regexp.n:
+       * doc/regsub.n:
+       * tests/regexp.test:
+       * generic/tclCmdMZ.c: add -start switch to regexp and regsub
+       with docs and tests
+
+       * doc/switch.n: added proper use of comments to example.
+       * generic/tclCmdMZ.c: changed switch to complain when an error
+       occurs that seems to be due to a misplaced comment.
+
+       * generic/tclCmdMZ.c: fixed illegal ref for \[0-9] substitutions
+       in regsub [Bug: 2723]
+
+       * generic/tclCmdMZ.c: changed [string equal] to return an Int
+       type object (was a Boolean)
+
+1999-09-01  Jennifer Hom  <jenn@scriptics.com>
+
+       * library/tcltest1.0/tcltest.tcl: Process command-line arguments
+       only ::tcltest doesn't have a child namespace (requires that
+       command-line args are processed in that namespace)
+
+1999-09-01  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * generic/tclParseExpr.c: changed '"' to '\"' to make FreeBSD
+       happy [Bug: 2625]
+       * generic/tclProc.c: moved static buf to better location and
+       changed static msg that would overflow in ProcessProcResultCode
+       [Bug: 2483] and added Tcl_DStringFree to Tcl_ProcObjCmd.
+       Also reworked size of static buffers.
+       * tests/stringObj.test: added test 9.11
+       * generic/tclStringObj.c: changed Tcl_AppendObjToObj to
+       properly handle the 1-byte dest and mixed src case where
+       both had had Unicode string len checks made on them.  [Bug: 2678]
+       * unix/aclocal.m4:
+       * unix/tcl.m4: adjusted fix from 8-21 to add -bnoentry to the
+       AIX-* case and readjusted the range
+
+1999-08-31  Jennifer Hom  <jenn@scriptics.com>
+
+       * library/tcltest1.0/tcltest.tcl:
+       * doc/tcltest.n:
+       * tests/README: Modified testConstraints variable so that it isn't
+       unset every time ::tcltest::initConstraints is called and cleaned up
+       documentation in the README file and the man page.
+
+1999-08-27  Jennifer Hom  <jenn@scriptics.com>
+
+       * tests/env.test:
+       * tests/exec.test:
+       * tests/io.test:
+       * tests/event.test:
+       * tests/tcltest.test: Added 'exit' calls to scripts that the tests 
+       themselves write, and removed accidental checkin of knownBugThreaded
+       constraints for Solaris and Linux.
+       
+       * library/tcltest1.0/tcltest.tcl:  Modified tcltest so that
+       variables are only initialized to their default values if they did
+       not previously exist. 
+
+1999-08-26  Jennifer Hom  <jenn@scriptics.com>
+
+       * tests/tcltest.test:
+       * library/tcltest1.0/tcltest.tcl:  Added a -args flag that sets a
+       variable named ::tcltest::parameters based on whatever's being
+       sent in as the argument to the -args flag. 
+
+1999-08-23  Jennifer Hom  <jenn@scriptics.com>
+
+       * tests/tcltest.test: Added additional tests for -tmpdir, marked
+       all tests that use exec as unixOrPc.
+
+       * tests/encoding.test:
+       * tests/interp.test: 
+       * tests/macFCmd.test:
+       * tests/parseOld.test:
+       * tests/regexp.test: Applied patches from Jim Ingham to add
+       encoding to a Mac only interp test, change an error message in
+       macFCmd.tet, put a comment in parseOld.test, fix tests using the
+       testencoding path command, and put unixOrPc constraints on tests
+       that use exec. 
+
+1999-08-21  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * unix/aclocal.m4: Changed AIX-4.[2-9] check to AIX-4.[1-9]
+       [Bug: 1909]
+
+1999-08-20  Jeff Hobbs  <hobbs@scriptics.com>
+>>>>>>> 1.1.1.5
+
+<<<<<<< ChangeLog
+Thu Apr 20 17:01:19 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+=======
+       * generic/tclPosixStr.c: fixed typo [Bug: 2592]
+>>>>>>> 1.1.1.5
+
+<<<<<<< ChangeLog
+       From Alexandre Oliva <aoliva@cygnus.com>
+       * generic/tclPosixStr.c (Tcl_SignalId, Tcl_SignalMsg): Do not
+       issue SIGPWR case if it's the same as SIGLOST.
+=======
+       * doc/*: fixed various nroff bugs in man pages [Bug: 2503 2588]
+>>>>>>> 1.1.1.5
+
+<<<<<<< ChangeLog
+2000-01-26  DJ Delorie  <dj@cygnus.com>
+=======
+1999-08-19  Jeff Hobbs  <hobbs@scriptics.com>
+>>>>>>> 1.1.1.5
+
+<<<<<<< ChangeLog
+       * win/tclWin32Dll.c (DllMain): Use standard _imp__reent_data,
+       not old-style __imp_reent_data
+       * generic/tclEnv.c (environ): ditto for _imp____cygwin_environ
+
+2000-01-17  Drew Moseley  <dmoseley@cygnus.com>
+=======
+       * win/README.binary: fixed version info and some typos [Bug: 2561]
+       
+       * doc/interp.n: updated list of commands available in a safe
+       interpreter [Bug: 2526]
+
+       * generic/tclIO.c: changed Tcl_GetChannelNames* to use style guide
+       headers (pleases HP cc)
+>>>>>>> 1.1.1.5
+
+<<<<<<< ChangeLog
+       * cygwin/configure.in: Fixed bug in setting of shell variable which
+       caused it to be interpreted as a subcommand rather than a variable.
+       * cygwin/configure: Regenerated.
+=======
+1999-08-18  Jeff Hobbs  <hobbs@scriptics.com>
+>>>>>>> 1.1.1.5
+
+<<<<<<< ChangeLog
+1999-11-09  DJ Delorie  <dj@cygnus.com>
+=======
+       * doc/Eval.3: fixed doc on input args [Bug: 2114]
+
+       * doc/OpenFileChnl.3:
+       * doc/file.n:
+       * tests/cmdAH.test:
+       * tclIO.c:
+       * tclCmdAH.c: added "file channels ?pattern?" tcl command, with
+       associated Tcl_GetChannelNames and Tcl_GetChannelNamesEx public
+       C APIs (added to tcl.decls as well), with docs and tests.
+
+       * tests/expr.test:
+       * generic/tclCompile.c: add TCL_TOKEN_VARIABLE to the part types
+       that cause differed compilation for exprs, to correct the expr
+       double-evaluation problem for vars.  Added test cases.
+       Related to [Bug: 732]
+
+       * unix/Makefile.in: changed the dependency structure so that
+       install-* is dependent on * (ie - install-binaries is dependent
+       on binaries).
+       
+       * library/auto.tcl:
+       * library/init.tcl:
+       * library/ldAout.tcl:
+       * library/package.tcl:
+       * library/safe.tcl:
+       * library/word.tcl:
+       * library/http2.1/http.tcl:
+       * library/msgcat1.0/msgcat.tcl: updated libraries to better
+       Tcl style guide (no more string comparisons with == or !=, spacing
+       changes).
+
+1999-08-05  Jim Ingham  <jingham@cygnus.com>
+
+       * mac/tclMacProjects.sea.hqx: Rearrange the projects so that the build
+       directory is separate from the sources.  Much more convenient!
+
+1999-08-13  Scott Redman <redman@scriptics.com>
+
+       * /: 8.2.0 tagged for final release
+
+1999-08-12  Scott Stanton  <stanton@scriptics.com>
+
+       * win/Makefile.in: Added COMPILE_DEBUG_FLAGS macro to make it
+       easier to turn on compiler tracing.
+
+       * tests/parse.test: 
+       * generic/tclParse.c: Fixed bug in Tcl_EvalEx where the termOffset
+       was not being updated in cases where the evaluation returned a non
+       TCL_OK error code. [Bug: 2535]
+
+1999-08-12  Scott Redman  <redman@scriptics.com>
+
+       * win/tclWinSerial.c: Applied patch from Petteri Kettunen to
+       remove compiler warning.
+
+1999-08-10  Scott Redman  <redman@scriptics.com>
+
+       * generic/tclAlloc.c:
+       * generic/tclCmdIL.c:
+       * generic/tclIO.c:
+       * generic/tclThread.c:
+       * win/tclWinThrd.c:
+       * unix/tclUnixThrd.c: Fixed Brent's changes so that they work on
+       Windows (and he fixed the bug in the Unix thread implementation).
+
+1999-08-09  Brent Welch  <welch@scriptics.com>
+        
+       * generic/tcl.decls:
+       * generic/tclAlloc.c:
+       * generic/tclCkalloc.c:
+       * generic/tclCmdIL.c:
+       * generic/tclDecls.h: 
+       * generic/tclIO.c:
+       * generic/tclInt.decls:
+       * generic/tclIntDecls.h:
+       * generic/tclStubInit.c:
+       * generic/tclVar.c:
+       * mac/tclMacThrd.c:
+       * unix/tclUnixThrd.c:
+       * win/tclWinThrd.c: Added use of Tcl_GetAllocMutex to tclAlloc.c
+       and tclCkalloc.c so they can be linked against alternate thread
+       packages. Added Tcl_GetChannelNames to tclIO.c. Added
+       TclVarTraceExists hook so "info exists" triggers read traces
+       exactly like it did in Tcl 7.6. Stubs table changes to reflect new
+       internal and external APIs.
+
+1999-08-09  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * tests/string.test: added largest_int proc to adapt for >32 bit
+       machines and int overflow testing.
+       * tests/tcltest.test: fixed minor error in 8.2 result (from dgp)
+
+       * doc/Object.3: clarified Tcl_DecrRefCount docs [Bug: 1952]
+       * doc/array.n: clarified array pattern docs [Bug: 1330]
+       * doc/clock.n: fixed clock docs [Bug: 693]
+       * doc/lindex.n: clarified to account for new end-int behavior.
+       * doc/string.n: fixed formatting errors [Bug: 2188 2189]
+       * doc/tclvars.n: fixed doc error [Bug: 2042]
+       * library/init.tcl: fixed path handling in auto_execok (it could
+       miss including the normal path on some Windows machines) [Bug: 1276]
+
+1999-08-05  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * doc/tclvars.n: Made it clear that tcl_pkgPath was not set
+       for Windows (already mentioned in init.tcl) [Bug: 2455]
+       * generic/tclLiteral.c: fixed reference to bytes that might
+       not be null terminated (using objPtr->bytes, which is) [Bug: 2496]
+       * library/http2.1/http.tcl: Made use of "i" in init section use
+       local var and start at 0 (was 1). [Bug: 2502]
+
+1999-08-04  Scott Stanton  <stanton@scriptics.com>
+
+       * tests/reg.test: Added test for REG_EXPECT bug fixed by Henry's
+       patch.
+
+       * generic/regc_nfa.c: 
+       * generic/regcomp.c: 
+       * generic/rege_dfa.c:
+       * generic/regexec.c: 
+       * generic/regguts.h: Applied patches supplied by Henry Spencer to
+       greatly enhance the performance of certain classes of regular
+       expressions. [Bug: 2440, 2447]
+
+1999-08-03  Scott Redman  <redman@scriptics.com>
+>>>>>>> 1.1.1.5
+
+<<<<<<< ChangeLog
+       * cygwin/*: redone with automake for cygwin-specific info (from cgf)
+       to support cross-host builds
+=======
+       * win/tclWinInt.h: Remove function declarations in header that was
+       moved to tclInt.decls file in previous changes.
+>>>>>>> 1.1.1.5
+
+<<<<<<< ChangeLog
+1999-10-26  DJ Delorie  <dj@cygnus.com>
+
+       * cygwin/*: new; replicate unix/* setup (other modules look
+       in unix/* for "local" builds; we don't want them to find the
+       cygwin version)
+       * unix/Makefile.in: undo
+       * configure.in: For cygwin, build win and cygwin
+       * Makefile.in: re-enable multi-dir support
+
+Tue Oct 26 13:16:09 1999  Christopher Faylor <cgf@cygnus.com>
+
+       * win/configure.in: Add better detection of cross-compilation
+       environment.
+       * win/configure: Regenerate.
+=======
+1999-08-02  Scott Redman  <redman@scriptics.com>
+
+       * unix/configure.in:
+       * win/configure.in: Change beta level to b2.
+       
+       * generic/tcl.h:
+       * generic/tcl.decls:
+       * generic/tclDecls.h:
+       * generic/tclInt.h:
+       * generic/tclInt.decls:
+       * generic/tclIntDecls.h:
+       * generic/tclRegexp.h:
+       * generic/tclStubInit.c: Move some exported public and internal
+       functions to the stub tables.  Removed functions that are in the
+       stub tables (from this and previous changes) from the original
+       header files.
+
+1999-08-01  Scott Redman  <redman@scriptics.com>
+
+       * win/tclWinSock.c: Added comment block to SocketThread()
+       function.  Added code to avoid calling TerminateThread(), but
+       instead to send a message to the socket event window to tell it to
+       terminate its thread.
+
+1999-07-30  Jennifer Hom  <jenn@scriptics.com>
+
+       * tests/tcltest.test:
+       * library/tcltest1.0/tcltest.tcl: Exit with non-zero status if
+       there were problems with the way the test suite was started
+       (e.g. wrong # arguments).  
+
+1999-07-30  Jeff Hobbs  <hobbs@scriptics.com>
+
+       * generic/tclInt.decls: added declaractions necessary for the
+       Tcl test code to work wth stubs [Bug: 2445]
+
+1999-07-30    <redman@scriptics.com>
+
+       * win/tclWinPipe.c:
+       * win/Makefile.in: Fixing launching of 16-bit apps on Win9x from
+       wish.  The command line was primed with tclpip82.dll, but it was
+       ignored.  Fixed that, then fixed the gmake makefile to build
+       tclpip82.dll as an executable.
+
+       * win/tclWinSock.c: Applied small patch to get thread-specific
+       data after initializing the socket driver.
+
+       * unix/tclUnixThrd.c: Applied patch to fix threads on Irix 6.5.
+       Patch from James Dennett.  [Bug: 2450]
+
+       * tests/info.test: Enable test for tclParse.c change (info
+       complete).
+       
+1999-07-30    <hobbs@scriptics.com>
+
+       * tclIO.c: added fix for Kupries' trf patch [Bug: 2386]
+
+       * tclParse.c: fixed bug in info complete regarding nested square
+       brackets [Bug: 2382, 2466]
+       
+1999-07-29    <redman@scriptics.com>
+
+       * win/tclWinChan.c: Allow tcl to open CON and NUL, even for std
+       channels.  Checking for bad/unusable std channels was moved to Tk
+       since its only purpose was to check whether to use the Tk Console
+       Window for the std channels.  [Bug: 2393 2392 2209 2458]
+
+       * unix/mkLinks.tcl: Applied patch to avoid linking pack.n to
+       pack-old.n.  Patch from Don Porter. [Bug: 2469]
+
+       * doc/Encoding.n: Applied patch to fix typo in .SH NAME line.
+       Patch from Don Porter.  [Bug: 2451]
+       
+       * win/tclWinSock.c:  Free Win32 Event handles when destroying
+       the socket helper thread.
+
+1999-07-28    <jenn@scriptics.com>
+
+       * tests/tcltest.test:
+       * library/tcltest1.0/tcltest.tcl: Fixed the condition under which
+       ::tcltest::PrintError had an infinite loop problem and added a
+       test case for it.  Added an optional argument to
+       ::tcltest::getMatchingFiles telling it where to search for test
+       files. 
+
+1999-07-27    <redman@scriptics.com>
+
+       * tools/tclSplash.bmp:  Updated Windows installer bitmap
+       to ready Tcl/Tk Version 8.2.
+
+1999-07-26    <redman@scriptics.com>
+
+       * tests/tcltest.test:  Need to close the new core file, there
+       seems to be a hang in threaded WinNT if the file isn't closed.
+       Open issue, need to fix that hang.
+
+       * tests/httpold.test:  Add time delay in response from Http server
+       so that test cases can properly detect timeout conditions with
+       threads enabled on multi-CPU WinNT.
+
+       * tests/winFCmd.test:  Test case winFcmd-1.33 was looking for
+       c:\windows, which may not exist.  Instead, create a new directory
+       on c:\ and use it for the test.
+
+       * win/tclWinConsole.c:
+       * win/tclWinPipe.c:
+       * win/tclWinSock.c:  Fix terminating helper threads by holding any
+       mutexes from the primary thread while waiting for the helper
+       thread to terminate.  Without these changes, the test suite hangs
+       on WinNT with 2 CPUs and threads enabled.  Open issue, seems to be
+       a sporadic hang on dual CPU systems still (very rare).
+
+1999-07-26  Jennifer Hom  <jenn@scriptics.com>
+
+       * tests/tcltest.test:
+       * library/tcltest1.0/tcltest.tcl:
+       * doc/tcltest.n: Cleaned up code in ::tcltest::PrintError, revised
+       documentation, and added tests for the tcltest package.
+
+1999-07-23    <redman@scriptics.com>
+
+       * tests/info.test:
+       * generic/tclParse.c:  Removed patch for info command, breaks test
+       cases on Unix.  Patch was bad and needs to be redone
+       properly. [Bug: 2382]
+
+1999-07-22    <redman@scriptics.com>
+
+       * Changed version to 8.2b2.
+
+       * win/tclWinSock.c: Fixed hang with threads enabled, fixed
+       semaphores with threads disabled.
+
+       * win/safe.test: Fixed safe-6.3 with threads enabled.
+       
+       * win/Makefile.in:  Fixed calling of tcltest to fix safe.test
+       failures due to path TCL_LIBRARY path.
+
+       * win/tclWinPort.h: Block out include of sys/*.h in order to
+       build extensions with MetroWerks compiler for Win32. [Bug: 2385]
+       
+       * generic/tclCmdMZ.c:
+       * generic/tclIO.c: Fix ANSI-style prototypes based on patch from
+       Ulrich Ring.  [Bug: 2391]
+       
+       * unix/Makefile.in: Need to make install-sh executable before
+       calling (with chmod +x).  [Bug: 2413]
+       
+       * tests/var.test:
+       * generic/tclVar.c:  Fixed bug that caused a seg. fault when using
+       "array set a(b) {}", which is a bad array name anyway.  Now the
+       "array set" command will return an error in this case.  Added test
+       case and fixed existing test. [Bug: 2427]
+
+1999-07-21    <redman@scriptics.com>
+
+       * tests/info.test:
+       * generic/tclParse.c:  Applied patch to fix "info complete"
+       for the string {[a [b]}.  Patch from Peter Spjuth. [Bug: 2382]
+
+       * doc/Utf.3:
+       * generic/tcl.decls:
+       * generic/tclDecls.h:
+       * generic/tclUtf.c: Changed function declarations in
+       non-platform-specific public APIs to use "unsigned long" instead of
+       "size_t", which may not be defined on certain compilers (rather
+       than include sys/types.h, which may not exist).
+       
+       * unix/Makefile.in: Added the Windows configure script to the
+       distribution file list, already shipping configure.in and the .m4
+       files, but needed the configure script itself.
+       
+       * win/makefile.vc: Changed version number of DDE package in VC++
+       makefile to use 1.1 instead of 1.0.
+
+       * doc/open.n: Added documentation of \\.\comX notation for opening
+       serial ports on Windows (alternative to comX:).
+       
+       * tests/ioCmd.test:
+       * doc/open.n:
+       * win/tclWinSerial.c: Applied patch from Rolf Schroedter to add
+       -pollinterval option to fconfigure to modify the maxblocktime used
+       in the fileevent polling. Added documentation and fixed the test
+       case as well.
+       
+       * win/tclWinSock.c: Modified 8.1.0 version of the Win32 socket
+       driver to move the handling of the socket event window in a
+       separate thread.  It also turned out that Win95 & Win98 were, in
+       some cases, getting multiple FD_ACCEPTs but only handling one.
+       Added a count for the FD_ACCEPT to take care of this.  Tested on
+       NT4 SP3, NT4 SP4, Win95, and Win98.
+       [Bug: 2178 2256 2259 2329 2323 2355]
+
+1999-07-21    <jpeek@scriptics.com>
+
+       * README: Small tweaks to clean up typos and wording.
+
+1999-07-20  Melissa Hirschl  <hershey@matisse.scriptics.com>
+
+       * generic/tclInitScript.h: 
+       * unix/tclUnixInit.c: merged code with 8.0.5.  We now use an
+       intermediate global tcl var "tclDefaultLibrary" to keep the
+       "tcl_library" var from being set by the default value in the
+       Makefile.  Also fixed a bug in which caused the value of
+       TCL_LIBRARY env var to be ignored.
+       * unix/tclWinInit.c: just updated some comments.
+
+1999-07-19  Melissa Hirschl  <hershey@matisse.scriptics.com>
+
+       * library/http2.1/http.tcl: updated -useragent text to say version
+       2.1.
+
+1999-07-16    <redman@scriptics.com>
+
+       * generic/tcl.decls:
+       * generic/tclDecls.h:
+       * generic/tclStubInit.c:  Add Tcl_SetNotifier to stub table.
+       [Bug: 2364]
+       
+       * unix/aclocal.m4:
+       * unix/tcl.m4:  Add check for Alpha/Linux to correct the IEEE
+       floating flag to the compiler, should be -mieee.  Patch from Don
+       Porter.
+       
+       * tools/tcl.hpj.in: Change version number of .cnt file referenced
+       in .HPJ file.
+
+1999-07-15    <redman@scriptics.com>
+       
+       * tools/tcl.wse.in: Fixed naming of target files for Windows.
 
-2001-04-06  Christopher Faylor <cgf@redhat.com>
+1999-07-14    <jpeek@scriptics.com>
 
-       Throughout change __CYGWIN32__ to __CYGWIN__.
-       * cygwin/configure.in: When targeting cygwin, detect if C compiler
-       supports -mno-win32 flag and use it if so.
-       * cygwin/Makefile.in (EXTRA_CFLAGS): New variable.  Holds results of
-       -mno-win32 test.
-       (COMPILE): Add EXTRA_CFLAGS variable to options.
-       * generic/tclEnv.c: Only compile special Cygwin code if building under
-       Cygwin and want native windows understanding.
-       * win/tclWin32Dll.c (DllMain): #ifdef out CYGWIN impure_ptr stuff.
-       * win/Makefile.in: Add -D__USE_W32_SOCKETS to accomodate newer
-       newlib/w32api conventions.
+       * doc/re_syntax.n: Deleted sentence as suggested by Scott S.
 
-Sat Jun 10 22:43:00 2000  Christopher Faylor <cgf@cygnus.com>
+1999-07-12    <jpeek@scriptics.com>
 
-       * win/tclWinFile.c (TclMatchFiles): Revert Mon Jun 5 18:48:32 2000
-       Christopher Faylor <cgf@cygnus.com>.  Fails on Windows 95.
+       * doc/re_syntax.n: Removed two notes to myself (oops), cleaned
+       up wording, fixed changebars, made two examples easier to read.
 
-Tue Jun  6 22:09:02 2000  Christopher Faylor <cgf@cygnus.com>
+1999-07-11    <redman@scriptics.com>
 
-       * win/Makefile.in: Set up and use autoconf variables throughout to
-       allow overriding variables from the make command line.
+       * win/makefile.vc: Since the makefile.vc should continue to work
+       while we're working out bugs/issues in the new TEA-style
+       autoconf/configure/gmake build mechanism for Windows, the version
+       numbers of the Tcl libraries need to remain in sync.  Modified the
+       version numbers in the makefile to reflect the change to 8.2b1.
 
-Tue Jun  6 12:17:46 2000  Christopher Faylor <cgf@cygnus.com>
+1999-07-09    <redman@scriptics.com>
 
-       * generic/tclFilename.c (Tcl_TranslateFileName): Reinstate Mon Jun 5
-       18:18:32 2000 Christopher Faylor <cgf@cygnus.com> minus a typo.
+       * win/configure.in: Eval DLLSUFFIX, LIBSUFFIX, and EXESUFFIX in
+       the configure script so that substitutions get expanded before
+       being placed in the Makefile.  The "d" portion for debug libraries
+       and DLLs was not being set properly.
+       
+1999-07-08    <stanton@scriptics.com>
 
-Tue Jun  6 17:05:20 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+       * tests/string.test: 
+       * generic/tclCmdMZ.c: Fixed bug in string range bounds checking
+       code.
 
-       * generic/tclFileName.c (Tcl_TranslateFileName): Revert Mon Jun 5
-       18:48:32 2000 Christopher Faylor <cgf@cygnus.com>, didn't compile.
+1999-07-08  Jennifer Hom  <jenn@scriptics.com>
 
-Mon Jun  5 18:48:32 2000  Christopher Faylor <cgf@cygnus.com>
+       * doc/tcltest.n:
+       * library/tcltest1.0/tcltest.tcl: Removed -asidefromdir and
+       -relateddir flags, removed unused ::tcltest::dotests proc, cleaned
+       up implementation of core file checking, and fixed the code that
+       checks for 1-letter flag abbreviations.
 
-       * generic/tclFileName.c (Tcl_TranslateFileName): Cygwin paths (and
-       Windows in general, actually) do not need to have '/'s translated into
-       '\'s.
-       (TclDoGlob): Ditto.
-       * win/tclWinFile.c (TclMatchFiles): Ditto.
-       * generic/tclInitScript.h: Look in "../bin/usr/share" as well as
-       "../bin/share".
+1999-07-08    <stanton@scriptics.com>
 
-Thu Apr 20 17:01:19 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+       * win/Makefile.in: Added tcltest target so runtest works
+       properly.  Added missing names to the clean/distclean targets.
 
-       From Alexandre Oliva <aoliva@cygnus.com>
-       * generic/tclPosixStr.c (Tcl_SignalId, Tcl_SignalMsg): Do not
-       issue SIGPWR case if it's the same as SIGLOST.
+       * tests/reg.test: 
+       * generic/rege_dfa.c: Applied fix supplied by Henry Spencer for
+       bug in DFA state caching under lookahead conditions.  [Bug: 2318]
 
-2000-01-26  DJ Delorie  <dj@cygnus.com>
+1999-07-07    <stanton@scriptics.com>
+
+       * doc/fconfigure.n: Clarified default buffering behavior for the
+       standard channels. [Bug: 2335]
+
+1999-07-06    <redman@scriptics.com>
+
+       * win/tclWinSerial.c:  New implementation of serial port driver
+       from Rolf Shroedter (Rolf.Schroedter@dlr.de) that allows more than
+       one byte to be read from the port.  Implemented using polling
+       instead of threads, there is a max. 10ms latency between checking the
+       port for file events.  [Bug: 1980 2217]
+
+1999-07-06    <welch@scriptics.com>
+
+       * library/http2.0/http.tcl: Fixed the -timeout option so it
+       handles timeouts that occur during connection attempts to
+       hosts that are down (the only case that really matters!)
+
+1999-07-03    <welch@scriptics.com>
+
+       * doc/ChnlStack.3:
+       * generic/tcl.decls:
+       * generic/tclIO.c: Added a new variant of the "Trf patch"
+       from Andreas Kupres that adds new C APIs Tcl_StackChannel,
+       Tcl_UnstackChannel, and Tcl_GetStackedChannel.
+
+1999-07-03    <welch@scriptics.com>
+
+       * generic/tclNotify.c:
+       * unix/tclUnixNotfy.c:
+       * unix/tclXtTest.c:
+       * unix/tclXtNotify.c:
+       * win/tclWinNotify.c:
+       * mac/tclMacNotify.c: Added Tcl_SetNotifier and the associated
+       hook points in the notifiers to be able to replace the notifier
+       calls at runtime  The Xt notifier and test program use this hook.
+
+1999-07-03    <welch@scriptics.com>
+
+       * generic/tclParse.c: Changed parsing of variable names to
+       allow empty array names.  Now "$(foo)" is a variable reference!
+       Previous you had to use something like $::(foo), which is slower.
+       This change is requested by Jean-Luc Fontaine for his STOOOP
+       package.
+
+1999-07-01    <redman@scriptics.com>
+
+       * generic/tclCmdAH.c:
+       * generic/tclFCmd.c: Call TclStat instead of TclpStat in order to
+       allow Tcl_Stat hooks to work properly.
+
+1999-06-29  Jennifer Hom  <jenn@scriptics.com>
+
+       * library/tcltest1.0/pkgIndex.tcl:
+       * library/tcltest1.0/tcltest.tcl:
+       * doc/tcltest.n:
+       * tests/all.tcl: Added -preservecore, -limitconstraints, -help,
+       -file, -notfile, -relateddir and -asidefromdir flags to the
+       tcltest package along with exported proc
+       ::tcltest::getMatchingFiles.  The documentation was modified to
+       match and all.tcl was modified to use the new functionality
+       instead of implementing -file itself. 
+
+1999-06-28    <redman@scriptics.com>
+
+       * generic/tclIndexObj.c:
+       * doc/GetIndex.3:
+       * tests/binary.test:
+       * tests/winDde.test: Applied patch from Peter Hardie (with
+       changes) to fix problem with Tcl_GetIndexFromObj() when the key
+       being passed is the empty string.  It used to match "" and return
+       TCL_OK, but it should have returned TCL_ERROR instead.  Added test
+       case to "binary" and "dde" commands to check the behavior.  Added
+       documentation note as well.
+
+1999-06-26    <redman@scriptics.com>
+
+       * win/tclWinDde.c: Applied patch from Peter Hardie to add poke
+       command to dde.  Also rev'd version of dde package to 1.1.
+       [Bug: 1738]
+
+1999-06-25  Jennifer Hom  <jenn@scriptics.com>
+
+       * unix/Makefile.in:
+       * win/Makefile.in:
+       * library/tcltest1.0/pkgIndex.tcl:
+       * library/tcltest1.0/tcltest.tcl:
+       * library/tcltest1.0: Added initial implementation of the Tcl test
+       harness package.  This package was based on the defs.tcl file that
+       was part of the tests directory. Reversed the way that tests were
+       evaluated to fix a problem with false passes.
+
+       * doc/tcltest.n: Added documentation for the tcltest package.
+
+       * tests/README:
+       * tests/defs.tcl:
+       * tests/all.tcl: Modified all test files (tests/*.test) and
+       all.tcl to use the new tcltest package and removed references to
+       the defs.tcl file. Modified the README file to point to the man
+       page for tcltest. 
+       
+1999-06-25    <stanton@scriptics.com>
 
-       * win/tclWin32Dll.c (DllMain): Use standard _imp__reent_data,
-       not old-style __imp_reent_data
-       * generic/tclEnv.c (environ): ditto for _imp____cygwin_environ
+       * tests/reg.test: 
+       * generic/regexec.c: Fixed bugs in non-greedy quantifiers.
 
-2000-01-17  Drew Moseley  <dmoseley@cygnus.com>
+1999-06-23    <jpeek@scriptics.com>
 
-       * cygwin/configure.in: Fixed bug in setting of shell variable which
-       caused it to be interpreted as a subcommand rather than a variable.
-       * cygwin/configure: Regenerated.
+       * doc/re_syntax.n:
+       * doc/switch.n:
+       * doc/lsearch.n:
+       * doc/RegExp.3:
+       * doc/regexp.n:
+       * doc/regsub.n: Moved information about syntax of 8.1 regular
+       expressions from regexp(n) manpage into new re_syntax(n) page.
+       Added pointers from other manpages to new re_syntax(n) page.
 
-1999-11-09  DJ Delorie  <dj@cygnus.com>
+1999-06-23    <stanton@scriptics.com>
 
-       * cygwin/*: redone with automake for cygwin-specific info (from cgf)
-       to support cross-host builds
+       * unix/Makefile.in: Changed install-doc to install-man.
 
-1999-10-26  DJ Delorie  <dj@cygnus.com>
+       * tools/uniParse.tcl: 
+       * tools/uniClass.tcl: 
+       * tools/README: 
+       * tests/string.test: 
+       * generic/regc_locale.c: 
+       * generic/tclUniData.c: 
+       * generic/tclUtf.c: 
+       * doc/string.n: Updated Unicode character tables to reflect latest
+       Unicode 2.1 data.  Also rationalized "regexp" and "string is"
+       definitions of character classes.
 
-       * cygwin/*: new; replicate unix/* setup (other modules look
-       in unix/* for "local" builds; we don't want them to find the
-       cygwin version)
-       * unix/Makefile.in: undo
-       * configure.in: For cygwin, build win and cygwin
-       * Makefile.in: re-enable multi-dir support
+1999-06-21    <stanton@scriptics.com>
 
-Tue Oct 26 13:16:09 1999  Christopher Faylor <cgf@cygnus.com>
+       * unix/tclUnixThrd.c (TclpThreadCreate): Fixed memory leak where
+       thread attributes were not being released. [Bug: 2254]
 
-       * win/configure.in: Add better detection of cross-compilation
-       environment.
-       * win/configure: Regenerate.
+1999-06-17    <stanton@scriptics.com>
+
+       * tests/regexp.test: 
+       * generic/tclCmdMZ.c: 
+       * generic/tclCmdIL.c: Changed to use new regexp interfaces.  Added
+       -expanded, -line, -linestop, and -lineanchor switches to regsub.
+
+       * doc/RegExp.3: Documented the new regexp interfaces and
+       the compile/execute flags.
+       
+       * generic/tclTest.c: 
+       * generic/tclRegexp.h:
+       * generic/tclRegexp.c: 
+       * generic/tcl.h: 
+       * generic/tcl.decls: Renamed Tcl_RegExpMatchObj to
+       Tcl_RegExpExecObj and added a new Tcl_RegExpMatchObj that is
+       equivalent to Tcl_RegExpMatch.  Added public macros for the regexp
+       compile/execute flags.  Changed to store either an object pointer
+       or a string pointer in the TclRegexp structure.  Changed to avoid
+       adding a reference to the object or copying the string.
+
+       * generic/regcomp.c: lint
+
+       * tests/reg.test: 
+       * generic/regex.h: 
+       * generic/regc_lex.c: Added REG_BOSONLY flag to allow Expect to
+       iterate through a string an only find matches that start at the
+       current position within the string.
+
+1999-06-16  <wart@scriptics.com>
+
+       * unix/configure.in:
+       * unix/Makefile.in:
+       * unix/tcl.m4:
+       * unix/aclocal.m4: Numerous build changes to make Tcl conform to the
+       proposed TEA spec
+
+1999-06-16  Melissa Hirschl  <hershey@matisse.scriptics.com>
+
+       * generic/tclVar.c (Tcl_VariableObjCmd): fixed premature increment
+       in loop that was causing out-of-bounds reads on array "varName".
+
+1999-06-16    <stanton@scriptics.com>
+
+       * tests/execute.test:
+       * generic/tclExecute.c (TclExecuteByteCode): Fixed crash caused by
+       a bug in INST_LOAD_SCALAR1 where the scalar index was read as
+       a signed 1 byte value instead of unsigned.  [Bug: 2243]
+
+1999-06-14  Melissa Hirschl  <hershey@matisse.scriptics.com>
+
+       * doc/StringObj.3
+       * test/stringObj.test
+       * unix/Makefile.in
+       * win/Makefile.in
+       * win/makefile.vc
+       * generic/tclStringObj.c:
+       Merged String and Unicode object types.  Added new functions to
+       the puplic API:  Tcl_NewUnicodeObj, Tcl_SetUnicodeObj,
+       Tcl_GetUnicode, Tcl_GetUniChar, Tcl_GetCharLength, Tcl_GetRange,
+       Tcl_AppendUnicodeToObj.
+
+1999-06-09    <stanton@scriptics.com>
+
+       * generic/tclUnicodeObj.c: Lots of cleanup and simplification.
+       Fixed several memory bugs.  Added TclAppendUnicodeToObj.  
+
+       * generic/tclInt.h: Added declarations for various Unicode string
+       functions.  
+
+       * generic/tclRegexp.c: 
+       * generic/tclCmdMZ.c: Changed to use new Unicode string interfaces
+       for better performance. 
+       
+       * generic/tclRegexp.h: 
+       * generic/tclRegexp.c: 
+       * generic/tcl.h: 
+       * generic/tcl.decls: Added Tcl_RegExpMatchObj and
+       Tcl_RegExpGetInfo calls to access lower level regexp API.  These
+       features are needed by Expect.  This is a preliminary
+       implementation pending final review and cleanup.
+
+       * generic/tclCmdMZ.c:
+       * tests/string.test: Fixed bug where string map failed on null
+       strings. 
+
+       * generic/regexec.c: 
+       * unix/tclUnixNotfy.c: lint
+
+       * tools/genStubs.tcl: Changed to always write output in LF mode.
+
+1999-06-08    <stanton@scriptics.com>
+
+       * win/tclWinSock.c: Rolled back to the 8.1.0 implementation
+       because of serious problems with the new driver.  Basically no
+       incoming socket connections would be reported to a server port.
+       The 8.1.1 code needs to be redesigned and fixed correctly.
+
+1999-06-07  Melissa Hirschl  <hershey@matisse.scriptics.com>
+
+       * tests/string.test: 
+       * generic/tclVar.c (Tcl_SetVar2Ex):
+       * generic/tclStringObj.c (Tcl_AppendObjToObj):
+       * generic/tclCmdMZ.c (Tcl_StringObjCmd): optimized the string
+       index, string length, string range, and append command in cases
+       where the object's internal rep is a bytearray.  Objects with
+       other internal reps are converted to have the new unicode internal
+       rep.  
+
+       * unix/Makefile.in: 
+       * win/Makefile.in: 
+       * win/Makefile.vc: 
+       * tests/unicode.test: 
+       * generic/tclInt.h:
+       * generic/tclObj.c:
+       * generic/tclUnicodeObj.c: added a new object type to store the
+       unicode representation of a string.
+
+       * generic/tclTestObj.c: added the objtype option to the testobj
+       command.  This option returns the name of the type of internal rep
+       an object has.
+
+1999-06-04    <stanton@scriptics.com>
+
+       * win/configure.in: 
+       * win/Makefile.in: Windows build now handles static/dynamic
+       debug/nodebug builds and supports the standard targets using
+       Cygwin user tools plus GNU make and autoconf.
+
+1999-06-03    <stanton@scriptics.com>
+
+       * generic/tclCmdMZ.c (Tcl_StringObjCmd): 
+       * tests/string.test: Fixed bug where string equal/compare -nocase
+       reported wrong result on null strings. [Bug: 2138]
+
+1999-06-02    <stanton@scriptics.com>
+
+       * generic/tclUtf.c (Tcl_UtfNcasecmp): Fixed incorrect computation
+       of relative ordering. [Bug: 2135]
+
+1999-06-01    <stanton@scriptics.com>
+
+       * unix/configure.in: Fixed various small configure.in patches
+       submitted by Jan Nijtmans. [Bug: 2121]
+
+       * tests/reg.test: 
+       * generic/regc_color.c: 
+       * generic/regc_cvec.c: 
+       * generic/regc_lex.c: 
+       * generic/regc_locale.c: 
+       * generic/regc_nfa.c: 
+       * generic/regcomp.c: 
+       * generic/regcustom.h: 
+       * generic/rege_dfa.c: 
+       * generic/regerror.c: 
+       * generic/regerrs.h: 
+       * generic/regex.h: 
+       * generic/regexec.c: 
+       * generic/regfree.c: 
+       * generic/regfronts.c: 
+       * generic/regguts.h: 
+       * generic/tclCmdMZ.c: 
+       * generic/tclRegexp.c: 
+       * generic/tclRegexp.h: 
+       * generic/tclTest.c: Applied Henry Spencer's latest regexp patches
+       that fix an infinite loop bug and add support for testing whether
+       a string could match with additional input.  [Bug: 2117]
+
+1999-05-28    <stanton@scriptics.com>
+
+       * generic/tclObj.c: Changed to eliminate use of isupper/tolower in
+       favor of the Unicode versions.
+
+       * win/Makefile.in:
+       * win/configure.in: Added preliminary TEA implementation.
+
+       * win/tclWinDde.c: Fixed bug where dde calls were being passed an
+       invalid dde handle because Initialize had not been called.
+       [Bug: 2124]
+
+1999-05-26    <redman@scriptic.com>
+
+       * generic/tclThreadTest.c: Fixed race condition in testthread
+       code that showed up in the WinNT test suite intermittently.
+
+       * win/tclWinSock.c: Fixed a hang in the WinNT socket driver, wake
+       up the socket thread every 100ms to check for events on the
+       sockets that did not wake up the thread (race condition).
+
+1999-05-24    <stanton@scriptics.com>
+
+       * tools/genStubs.tcl: Changed to allow a list of platforms instead
+       of just one at a time.
+
+       * generic/tcl.decls: 
+       * generic/tclCmdMZ.c: 
+       * generic/tclDecls.h: 
+       * generic/tclInt.decls: 
+       * generic/tclIntDecls.h: 
+       * generic/tclPort.h: 
+       * generic/tclStubInit.c: 
+       * generic/tclStubLib.c: Various header file related changes and other
+       lint to try to get the Mac builds working.
+
+1999-05-21    <redman@scriptics.com>
+
+       * win/tclWinPipe.c: Fix bug when launching command.com on
+       Win95/98.  Need to wait for the procInfo.hProcess of the process that
+       was created, not the hProcess of the current process.  [Bug: 2105]
+
+1999-05-20    <redman@scriptics.com>
+
+       * library/init.tcl: Add the directory where the executable is, and
+       the ../lib directory relative to that, to the auto_path variable.
+       
+1999-05-19    <stanton@scriptics.com>
+
+       Merged in various changes submitted by Jeff Hobbs:
+       
+       * generic/tcl.decls: 
+       * generic/tclUtf.c: Added Tcl_UniCharIs* functions for control,
+       graph, print, and punct classes.
+
+       * generic/tclUtil.c:
+       * doc/StrMatch.3: Added Tcl_StringCaseMatch() implementation to
+       support case-insensitive globbing.
+       
+       * doc/string.n: 
+       * unix/mkLinks: 
+       * tests/string.test: 
+       * generic/tclCmdMZ.c: Added additional character class tests,
+       added -nocase switch to "string match", changed string first/last
+       to use offsets.
+
+1999-05-19    <redman@scriptics.com>
+
+       * generic/tcl.h: Add extern "C" block around entire header file for
+       C++ compilers to fix linkage issues.  Submitted by Don Porter and
+       Paul Duffin.
+
+       * generic/tclRegexp.c: Fix bug when the regexp cache is empty
+       and an empty pattern is used in regexp ( such as {} or "" ).
+
+1999-05-18    <stanton@scriptics.com>
+
+       * win/tclWinChan.c: Modified initialization code to avoid
+       inherenting closed or invalid channels.  If the standard input is
+       anything other than a console, file, serial port, or pipe, then we
+       fall back to the standard Tk window console.
+
+1999-05-14    <stanton@scriptics.com>
+
+       * generic/tclCmdAH.c (Tcl_ForObjCmd): Fixed crash caused by
+       failure to reset the result before evaluating the test
+       expression. 
+
+1999-05-14    <surles@scriptics.com>
+
+       * generic/tclBasic.c (Tcl_CreateInterp): Added introspection
+       variable for threaded interps.  If the interp was compiled with
+       threads enabled, the tcl_platform(threaded) variable will exist.
+
+1999-05-14    <redman@scriptics.com>
+
+       * generic/tclDate.c: Applied patch to fix 100-year and 400-year
+       boundaries in leap year code, from Isaac Hollander.  [Bug: 2066]
+
+1999-05-13    <stanton@scriptics.com>
+
+       * unix/Makefile.in:
+       * unix/tclAppInit.c: Minor cleanup related to Xt notifier.
+       
+       * unix/tclUnixInit.c (TclpSetInitialEncodings): Tcl now looks for
+       an encoding subfield in the LANG/LC_ALL variables in cases where
+       the locale is not found in the locale table.  Ensure that
+       setlocale() is called at least once so X11 will initialize
+       properly.  Also, forces the LC_NUMERIC locale to be "C" so numeric
+       processing in scripts is not affected by the current locale
+       setting. [Bug: 1989]
+
+       * generic/tclRegexp.c: Increased per-thread regexp cache to 30
+       slots.  This seems to be about the right number for larger
+       applications like exmh.  [Bug: 1063]
+
+1999-05-12    <stanton@scriptics.com>
+
+       * doc/tclsh.1: Updated references to rc script names to accurately
+       reflect the platform differences on Windows.
+
+       * tests/regexp.test: 
+       * generic/tclInt.h: 
+       * generic/tclBasic.c: 
+       * generic/tclRegexp.h:
+       * generic/tclRegexp.c: Replaced the per-interpreter regexp cache
+       with a per-thread cache.  Changed the Regexp object to take
+       advantage of this extra cache.  Added a reference count to the
+       TclRegexp type so regexps can be shared by multiple objects.
+       Removed the per-interp regexp cache from the interpreter.  Now
+       regexps can be used with no need for an interpreter. [Bug: 1063]
+
+       * win/tclWinInit.c (TclpSetVariables): Avoid calling GetUserName
+       if the value can be determined from the USERNAME environment
+       variable.  GetUserName is very slow.
+
+1999-05-07    <stanton@scriptics.com>
+
+       * win/winDumpExts.c: 
+       * win/makefile.vc: Removed incorrect patch. [Bug: 1998]
+       
+       * generic/tcl.decls: Replaced const with CONST.
+
+       * generic/tclResult.c (Tcl_AppendResultVA): 
+       * generic/tclStringObj.c (Tcl_AppendStringsToObjVA): Fixed to copy
+       arglist using memcpy instead of assignment so it works properly on
+       OS/390. [Bug: 1997]
+
+       * generic/tclLoadNone.c: Updated to use current interfaces, added
+       TclpUnloadFile. [Bug: 2003]
+
+       * win/winDumpExts.c: 
+       * win/makefile.vc: Changed to emit library name in defs
+       file. [Bug: 1998]
+
+       * unix/configure.in: Added fix for OS/390. [Bug: 1976]
+
+1999-05-06    <stanton@scriptics.com>
+
+       * tests/string.test: 
+       * generic/tclCmdMZ.c: 
+       * doc/string.n: Fixed bug in string equal/compare code when using
+       -length option.  Cleaned up docs a bit more.
+
+       * tests/http.test: Unset "data" array before running tests to
+       avoid failures due to previous tests.
+
+       * doc/string.n: 
+       * tests/cmdIL.test: 
+       * tests/cmdMZ.test: 
+       * tests/error.test: 
+       * tests/ioCmd.test: 
+       * tests/lindex.test: 
+       * tests/linsert.test: 
+       * tests/lrange.test: 
+       * tests/lreplace.test: 
+       * tests/string.test: 
+       * tests/cmdIL.test: 
+       * generic/tclUtil.c: 
+       * generic/tclCmdMZ.c: Replaced "string icompare/iequal" with
+       -nocase and -length switches to "string compare/equal".  Added a
+       -nocase option to "string map".  Changed index syntax to allow
+       integer or end?-integer? instead of a full expression.  This is
+       much simpler with safeTcl scripts since it avoids double
+       substitution issues.
+
+       * doc/Utf.3: 
+       * generic/tclStubInit.c: 
+       * generic/tclDecls.h: 
+       * generic/tclUtf.c:
+       * generic/tcl.decls: Added Tcl_UtfNcmp and Tcl_UtfNcasecmp.
+
+1999-05-05    <stanton@scriptics.com>
+
+       * win/makefile.vc: Added encoding directory to install-libraries
+       target.
+
+1999-05-03    <stanton@scriptics.com>
+
+       * doc/string.n: 
+       * tests/cmdMZ.test: 
+       * tests/string.test: 
+       * generic/tclCmdMZ.c (Tcl_StringObjCmd): Changed "string length"
+       to avoid regenerating the string rep of a ByteArray object.
+       
+       * tests/cmdIL.test: 
+       * tests/cmdMZ.test: 
+       * tests/error.test: 
+       * tests/lindex.test:
+       * tests/linsert.test: 
+       * tests/lrange.test: 
+       * tests/lreplace.test: 
+       * tests/string.test: 
+       * generic/tclCmdMZ.c (Tcl_StringObjCmd): 
+       * generic/tclUtil.c (TclGetIntForIndex): Applied Jeff Hobbs's
+       string patch which includes the following changes [Bug: 1845]:
+       
+           - string compare now takes optional length arg (for strncmp
+               behavior)
+                            
+            - added string equal (just a few lines of code blended
+                in with string compare)
+            
+            - added string icompare/iequal for case-insensitive comparisons
+            
+            - string index's index can now be ?end[+-]?expression
+                I made this change in the private TclGetIntForIndex,
+                which means that the list commands also benefit, as
+                well as string range, et al.
+            
+            - added [string repeat string count]
+                Repeats given string  number of times
+            
+            - added string replace, string equiv to lreplace
+              (quasi opposite of string range):
+                        string replace first last ?string?
+                Example of use, replacing end of string with ...
+                should the string be more than 16 chars long:
+                        string replace $string 16 end "..."
+                This just returns the string len < 16, so it
+                will only affect the long strings.
+            
+            - added optional first and last args to string to*
+                This allows you to just affect certain regions of
+                a string with the command (like just capping the
+                first letter).  I found the original totitle to
+                be too draconian to be useful.
+            
+            - added [string map charMap string]
+                where charMap is a {from to from to} list that equates to
+                what one might get from [array get].  Each  and 
+                can be multiple chars (or none at all).  For Tcl/CGI users,
+                this is a MAJOR speed booster.
+       
+       * generic/tclParse.c (Tcl_ParseCommand): Changed to avoid
+       modifying eval'ed strings that are already null terminated.
+       [Bug: 1793] 
+
+       * tests/binary.test: 
+       * generic/tclBinary.c (DupByteArrayInternalRep): Fixed bug where
+       type was not being set in duplicated object. [Bug: 1975, 2047]
+
+1999-04-30    <stanton@scriptics.com>
+       
+       * Changed version to 8.1.1.
+       
+1999-04-30    <stanton@scriptics.com>
+
+       * Merged changes from 8.1.0 branch:
+
+       * generic/tclParse.c: Fixed memory leak in CommandComplete.
+
+       * generic/tclPlatDecls.h: 
+       * generic/tclIntPlatDecls.h: 
+       * generic/tclIntDecls.h: 
+       * generic/tclDecls.h: 
+       * tools/genStubs.tcl: Added 'extern "C" {}' block around the stub
+       table pointer declaration so the stub library can be used from
+       C++. [Bug: 1934]
+
+       * Lots of documentation and other release engineering fixes.
+
+1999-04-28    <stanton@scriptics.com>
+
+       * mac/tclMacResource.c: 
+       * generic/tclListObj.c: 
+       * generic/tclObj.c: 
+       * generic/tclStringObj.c: Changed to avoid freeing the string
+       representation before freeing the internal rep.  This helps with
+       debugging since the string rep will still be valid when the free
+       proc is invoked.
+
+1999-04-27    <stanton@scriptics.com>
+
+       * generic/tclLiteral.c (TclHideLiteral): Fixed so hidden literals
+       get duplicated to avoid accidental sharing in the global object
+       table. 
+
+1999-04-23    <stanton@scriptics.com>
+
+       * generic/tclStubInit.c: 
+       * tools/genStubs.tcl: Changed to avoid the need for forward
+       declarations in stub initializers.
+
+1999-04-23    <stanton@scriptics.com>
+
+       * library/encoding/koi8-r.enc:
+       * tools/encoding/koi8-r.txt: Added support for the koi8-r Cyrillic
+       encoding. [Bug: 1771]
+
+1999-04-22    <stanton@scriptics.com>
+
+       * win/tclWinFCmd.c:
+       * win/tclWin32Dll.c: Changed uses of "try" to "__try", since that
+       is the actual keyword.  This eliminates the need for some -D flags
+       from the makefile.
+
+       * generic/tclPort.h: Added include of tcl.h since it defines
+       various Windows macros that are needed before deciding which
+       platform porting file to use.
+
+       * generic/tclEvent.c: lint
+
+       * win/tclWinInit.c (TclpInitPlatform): Added call to TclWinInit
+       when building a static library since DllMain will not be invoked.
+       This could break old code that explicitly called TclWinInit, but
+       should be simpler in the long run.
+
+1999-04-22  Scott Stanton  <stanton@scriptics.com>
+
+       * generic/tclInt.h: 
+       * generic/tclInt.decls: 
+       * generic/tclCompile.c: Added TclSetByteCodeFromAny that takes a
+       hook procedure to invoke after compilation but before the byte
+       codes are emitted.  This makes it possible to do postprocessing on
+       the compiled byte codes before the ByteCode is generated.
+
+       * generic/tclLiteral.c: Added TclHideLiteral and TclAddLiteralObj
+       to make it possible to create local unshared literal objects.
+       
+       * win/tclWinInit.c:
+       * unix/tclUnixInit.c: Changed initial search path to match that
+       found used by tcl_findLibrary.
+
+1999-04-22    <redman@scriptics.com>
+
+       * win/tclWinPort.h:
+       * win/tclWinSock.c: Added code to use WinSock 2.0 API on NT to
+       avoid creating a window to handle sockets.  API not available on
+       Win95 and needs to be fixed on Win98, until then continue to use
+       the older (window-based) scheme on those two OSes.
+       
+1999-04-15    <stanton@scriptics.com>
+
+       * Merged 8.1 back into the main trunk
+
+1999-04-13    <stanton@scriptics.com>
+
+       * library/encoding/gb2312.enc:
+       * library/encoding/euc-cn.enc:
+       * tools/encoding/gb2312.txt:
+       * tools/encoding/cp950.txt:
+       * tools/encoding/Makefile: Restored the double byte definition of
+       GB2312 and added the EUC-CN encoding.  EUC-CN is a variant of
+       GB2312 that shifts the characters into bytes with the high bit set
+       and includes ASCII as a subset. [Bug: 632]
+
+1999-04-13    <redman@scriptics.com>
+
+       * win/tclWinSock.c: Apply patch to allow write access to a socket
+       if FD_WRITE is sent but FD_CONNECT is not.  Some strange problem
+       with either Win32 or a socket driver.  [Bug: 1664 1776]
+
+1999-04-09    <redman@scriptics.com>
+
+       * unix/tclUnixNotfy.c: Fixed notifier deadlock situation when the
+       pipe used to talk back notifier thread is filled with data.  When
+       calling the write() function to feed data down that pipe, unlock
+       the notifierMutex to allow the notifier to wake up again.  Found
+       as a result of the focus.test for Tk hanging. [Bug: 1700]
+
+1999-04-06    <stanton@scriptics.com>
+
+       * tests/unixNotfy.test: Fixed hang in tests when built with thread
+       support. 
+
+       * tests/httpold.test: Fixed broken test that didn't wait long
+       enough for events to arrive.
 
-1999-10-20  DJ Delorie  <dj@cygnus.com>
+       * tests/unixInit.test: Fixed race condition in test.
+       
+       * tests/unixInit.test: 
+       * tests/fileName.test: Minor test nits.
+
+       * unix/tclUnixInit.c (TclpSetInitialEncodings): Fixed bad initial
+       encoding string.
+
+1999-04-06    <surles@scriptics.com>
+
+       * generic/tclVar.c: 
+       * generic/tclEnv.c: Moved the "array set" C level code into a
+       common routine (TclArraySet).  The TclSetupEnv routine now uses
+       this API to create an env array w/ no elements.
+
+       * generic/tclEnv.c:
+       * generic/tclWinInit.h:
+       * generic/tclUnixInit.h:
+       * generic/tclInt.h: Made the Env module I18N compliant.  Changed the
+       FindVariable routine to TclpFindVariable, that now does a case
+       insensitive string comparison on Windows, and not on UNIX. [Bug:
+       1299, 1500]
+
+1999-04-05    <stanton@scriptics.com>
+
+       * tests/io.test: Minor test cleanup.
+
+       * generic/tclEncoding.c (Tcl_CreateEncoding): Minor lint to make
+       it easier to compile on Digital-unix. [Bug: 1659]
+
+       * unix/configure.in: 
+       * unix/tclUnixPort.h: Applied patch for OS/390 to handle lack of
+       sys/param.h. [Bug: 1725]
+
+       * unix/configure.in: Fixed BSD/OS 4.* configuration to support
+       shared libraries properly. [Bug: 1730]
+       
+1999-04-05    <redman@scriptics.com>
+
+       * win/tclWinDde.c: decrease timeout value for DDE calls to 30k
+       [Bug: 1639]
+
+       * generic/tcl.decls:
+       * generic/tcl.h:
+       * generic/tclDecls.h:
+       * generic/tclInt.decls:
+       * generic/tclInt.h:
+       * generic/tclIntDecls.h:
+       * generic/tclStubInit.c:
+       * generic/tclUtil.c: Added more functions to the Tcl stubs table,
+       including all Tcl_ functions not already in it (except Cmd
+       functions) and Tcl_GetCwd() and Tcl_Chdir() (new functions).
+       
+       * tests/safe.test:
+       * doc/safe.n:
+       * generic/tclBasic.c:
+       * library/safe.tcl: The encoding command is not safe as-is, so
+       create a safe alias to mask out the "encoding system <name>" but
+       allow all other uses including "encoding system". Added test cases
+       and updated the man page for Safe Tcl.
+
+1999-04-05    <stanton@scriptics.com>
+
+       * tests/winTime.test: 
+       * win/tclWinTime.c: Fixed crash in clock command that occurred
+       when manipulating negative time values in timezones east of
+       GMT. [Bug: 1142, 1458]
+       
+       * tests/platform.test: 
+       * tests/fileName.test: Fixed broken tests.
+       
+       * generic/tclFileName.c: Moved global regexps into thread local
+       storage.
+
+       * tests/socket.test: Changed so tests don't reuse sockets,
+       since Windows is slow to release sockets.
+
+       * win/tclWinConsole.c: 
+       * win/tclWinPipe.c: 
+       * win/tclWinSerial.c: Fixed race condition where background
+       threads were terminated while they still held a lock in the
+       notifier. 
+
+1999-04-02    <stanton@scriptics.com>
+
+       * tests/http.test: Fixed bad test initialization code.
+
+       * generic/tclThreadTest.c (ThreadExitProc): Fixed bug where static
+       memory was being returned instead of a dynamically allocated
+       result in error cases.
+
+1999-04-02    <redman@scriptics.com>
+
+       * doc/dde.n:
+       * tools/tcl.wse.in:
+       * win/makefile.vc:
+       * win/pkgIndex.tcl:
+       * win/tclWinDde.c:  Add new DDE package, code removed from Tk now
+       separated into its own package.  Changed DDE-based send code into
+       "dde eval" command.  Can be loaded into tclsh (not just wish).
+       Windows only.
+
+1999-04-02    <stanton@scriptics.com>
+
+       * tests/expr.test: 
+       * tests/for-old.test: 
+       * tests/for.test: 
+       * tests/foreach.test: 
+       * tests/format.test: 
+       * tests/httpold.test: 
+       * tests/if.test: 
+       * tests/init.test: 
+       * tests/interp.test: 
+       * tests/while.test:  Added some tests for known bugs (marked with
+       knownBug constraint), and cleaned up a few bad tests.
+
+       * generic/regc_locale.c: 
+       * generic/regcustom.h: 
+       * generic/tcl.decls: 
+       * generic/tclCmdIL.c: 
+       * generic/tclCmdMZ.c: 
+       * generic/tclInt.h: 
+       * generic/tclRegexp.c: 
+       * generic/tclScan.c: 
+       * generic/tclTest.c:
+       * generic/tclUtf.c: 
+       * win/tclWinFCmd.c: 
+       * win/tclWinFile.c: Made various Unicode utility functions
+       public. The following functions were made public and added to the
+       stubs table: 
+               Tcl_UtfToUniCharDString, Tcl_UniCharToUtfDString,
+               Tcl_UniCharLen, Tcl_UniCharNcmp, Tcl_UniCharIsAlnum,
+               Tcl_UniCharIsAlpha, Tcl_UniCharIsDigit, Tcl_UniCharIsLower,
+               Tcl_UniCharIsSpace, Tcl_UniCharIsUpper, Tcl_UniCharIsWordChar
+
+1999-04-01    <stanton@scriptics.com>
+
+       * tests/registry.test: 
+       * win/tclWinReg.c: Internationalized the registry code.  It now
+       uses Unicode interfaces on NT. [Bug: 1197]
+
+       * tests/parse.test: 
+       * generic/tclParse.c: Fixed crash due to multiple frees in parser
+       during error cleanup when parsing commands with more tokens than
+       will fit in the static area of the parse structure. [Bug: 1681]
+
+       * generic/tclInt.h: Removed duplicate declarations.
+
+       * generic/tclInt.decls: 
+       * generic/tcl.decls: Added Tcl_WinUtfToTChar and Tcl_WinTCharToUtf
+       to the tclPlat table.
+
+1999-04-01    <redman@scriptics.com>
+
+       * generic/tcl.decls:
+       * generic/tcl.h:
+       * generic/tclBasic.c:
+       * generic/tclDecls.h:
+       * generic/StubInit.c:
+       * tools/genStubs.tcl:
+       * unix/Makefile.in:
+       * win/makefile.vc: Applied patch from Jan Nijtmans to fix Ultrix
+       multiple symbol definition problem.  Now, even Tcl includes a copy
+       of the Tcl stub library.  Also fixed TCL_MEM_DEBUG mode (for Tk).
+
+1999-03-31    <redman@scriptics.com>
+
+       * win/tclWinConsole.c: WinNT has a bug when reading a single
+       character from the console.  Rewrote the code for the console to
+       read an entire line at a time using the reader thread.
+
+1999-03-30    <stanton@scriptics.com>
+
+       * unix/Makefile.in: Removed trailing backslash that broke the
+       "depend" target.
+
+       * unix/tclUnixInit.c (TclpSetInitialEncodings): Changed to avoid
+       calling setlocale().  We now look directly at env(LANG) and
+       env(LC_CTYPE) instead. [Bug: 1636]
+
+       * generic/tclFileName.c: 
+       * generic/tclDecls.h: 
+       * generic/tcl.decls: Removed CONST from Tcl_JoinPath and
+       Tcl_TranslateFileName because it changes the signature of
+       Tcl_JoinPath in an incompatible manner.
+
+       * generic/tclInt.h: 
+       * generic/tclLoad.c (TclFinalizeLoad): 
+       * generic/tclEvent.c (Tcl_Finalize): Defer unloading of loadable
+       modules until all exit handlers have been invoked.
+       [Bug: 998, 1273, 1573, 1593]
+
+1999-03-29    <stanton@scriptics.com>
+
+       * generic/tclFileName.c: 
+       * generic/tclDecls.h: 
+       * generic/tcl.decls: Added CONST to Tcl_JoinPath and
+       Tcl_TranslateFileName.
+
+1999-03-29    <redman@scriptics.com>
+
+       * tools/genStubs.tcl:
+       * unix/configure.in:
+       * unix/Makefile.in:
+       * win/makefile.vc:
+       * generic/tcl.h:
+       * generic/tclBasic.c:
+       * generic/tclDecls.h:
+       * generic/tclIntDecls.h:
+       * generic/tclPlatDecls.h:
+       * generic/tclIntPlatDecls.h: Removed the stub functions and
+       changed the stub macros to just use the name without params. Pass
+       &tclStubs into the interp (don't use tclStubsPtr because of
+       collisions with the stubs on Solaris).
+       
+1999-03-27    <redman@scriptics.com>
+
+       * win/makefile.bc: Removed makefile for Borland compiler, no
+       longer supported.
+
+1999-03-26    <redman@scriptics.com>
+
+       * win/tclWinSerial.c:
+       * win/tclWinConsole.c:
+       * win/tclWinPipe.c: Don't close the Win32 handle for a channel if
+       it's a stdio handle (GetStdHandle()) during shutdown of a thread
+       to prevent it from destroying the stdio of other threads.
+
+1999-03-26    <suresh@scriptics.com>
+
+       * unix/configure.in
+       --nameble-shared is now the default and build Tcl as a shared
+       library; specify --disable-shared to build a static Tcl library
+       and shell.
+
+1999-03-25    <stanton@scriptics.com>
+
+       * tests/interp.test: 
+       * generic/tclInterp.c (AliasObjCmd): Changed so aliases are
+       invoked at current scope in the target interpreter instead of at
+       the global scope.  This was an incompatibility introduced in 8.1
+       that is being removed. [Bug: 1153, 1556]
+       
+       * library/encoding/big5.enc:
+       * library/encoding/gb2312.enc:
+       * tools/encoding/big5.enc:
+       * tools/encoding/gb2312.enc: Added ASCII to big5 and gb2312
+       encodings. [Bug: 632]
+       
+       * generic/tclPkg.c (Tcl_PkgRequireEx): Fixed broken clientData
+       initialization in package code.
+
+       * unix/Makefile.in (dist): Added tcl.decls and tclInt.decls to
+       source distribution. [Bug: 1571]
+
+       * doc/Thread.3: Updated documentation of Tcl_MutexLock to indicate
+       that the recursive locking behavior is undefined.  On Windows, it
+       does not block, on Unix it deadlocks. [Bug: 1275]
+
+1999-03-24    <stanton@scriptics.com>
+
+       * tests/execute.test: 
+       * generic/tclExecute.c (TclExecuteByteCode): Fixed expression code
+       that incorrectly returned floating point values for integers if
+       the internal rep happened to be a double.  Now we check to see if
+       the object has a string rep that looks like an integer before
+       using the double internal rep. [Bug: 1516]
+
+1999-03-24    <redman@scriptics.com>
+
+       * generic/tclAlloc.c:
+       * generic/tclEncoding.c:
+       * generic/tclProc.c:
+       * unix/tclUnixTime.c:
+       * win/tclWinSerial.c: Fixed compilation warnings/errors for VC++
+       5.0 and 6.0 and HP-UX native compiler without -Aa or -Ae. 
+       [Bug: 1323 1518 1324 1583 1585 1586]
+
+       * win/tclWinSock.c: Make sockets thread-safe on Windows. The
+       current implementation uses windows to handle events on the
+       socket, one for each thread (thread local storage). Previously,
+       there was only one window shared between threads, which didn't
+       work. [Bug: 1326]
+
+1999-03-23    <stanton@scriptics.com>
+
+       * tools/tcl.wse: Fixed file association to look in the right place
+       for the wish icon. [Bug: 1544]
+
+       * tests/winNotify.test: 
+       * tests/ioCmd.test: 
+       * tests/event.test: Changed to use new style conditionals.
+
+       * tests/encoding.test: Fixed nonportable test.
+
+       * unix/dltest/configure.in: 
+       * unix/dltest/Makefile.in: Added missing DBGX macros. [Bug: 1564]
+
+       * tests/winNotify.test: 
+       * mac/tclMacNotify.c: 
+       * win/tclWinNotify.c: 
+       * unix/tclUnixNotfy.c:
+       * generic/tclNotify.c: Added a new Tcl_ServiceModeHook interface
+       that is invoked whenever the service mode changes.  This is needed
+       to allow the Windows notifier to create a communication window the
+       first time Tcl is about to enter an external modal event loop
+       instead of at startup time.  This will avoid the various problems
+       that people have been seeing where the system hangs when tclsh
+       is running outside of the event loop. [Bug: 783]
+
+       * generic/tclInt.h: 
+       * generic/tcl.decls: Renamed TclpAlertNotifier back to
+       Tcl_AlertNotifier since it is part of the public notifier driver
+       API.
+
+1999-03-23    <redman@scriptics.com>
+
+       * win/tclWinSerial.c: Fixed problem with fileevent on the serial
+       port and nonblocking mode.  Gets no longer hangs, fileevents fire
+       whenever there is any character data on the port.
+       
+       * tests/winConsole.test:
+       * win/tclWinConsole.c: Fixed problem with fileevents and gets from
+       a console stdin.  Previously, fileevents were firing before an
+       entire line was available for reading, which meant that when you
+       did a gets or read, it blocked (even in nonblocking mode). Now, it
+       should work the same as Unix: fileevents fire when an entire line
+       is ready, and gets and read do not block in non-blocking mode.
+       Added an interactive test case to check for this.
+
+1999-03-22    <stanton@scriptics.com>
+
+       * tests/reg.test: 
+       * generic/regc_color.c: Applied regexp bug fix from Henry Spencer.
+
+1999-03-19    <redman@scriptics.com>
+
+       * generic/tclCmdIL.c: Fixed the initialization of an array so that
+       the Sun 5.0 C compiler wouldn't complain.
+
+       * unix/configure.in: Added support for --enable-64bit.  For now,
+       this is only supported on Solaris 7 64bit (SunOS 5.7) using the Sun 
+       compiler (not gcc).
+       
+1999-03-18    <stanton@scriptics.com>
+
+       * win/tclWinChan.c (TclpOpenFileChannel, Tcl_MakeFileChannel):
+       Changed to only test for console or comm handles when the type is
+       FILE_TYPE_CHAR to avoid useless tests on simple files.  Also
+       reordered tests so consoles are tested first as this is more
+       common.
+
+       * win/makefile.vc: Regularized usage of mkd and rmd and rm.
+
+       * library/encoding/shiftjis.enc: 
+       * tools/encoding/shiftjis.txt: Missing/incorrect characters in
+       shift-jis table. [Bug: 1008, 1526]
+
+       * generic/tclInt.decls:
+       * generic/tcl.decls: Eliminated use of "string" and "list" from
+       argument lists to avoid conflicts with C++ STL. [Bug: 1181]
+
+       * win/tclWinFile.c (TclpMatchFiles): Changed to ignore the
+       FS_CASE_IS_PRESERVED bit and always return exactly what we get
+       from the system.
+
+1999-03-17    <stanton@GASPODE>
+
+       * win/README.binary: 
+       * win/README: 
+       * unix/configure.in: 
+       * generic/tcl.h: 
+       * README: Updated version to 8.1b3.
+
+1999-03-14    <stanton@GASPODE>
+
+       * win/tclWinConsole.c: 
+       * win/tclWinPipe.c: 
+       * win/tclWinSerial.c: Changed so channel drivers wait for the
+       reader/writer threads to exit before returning during a close
+       operation.  This ensures that the main thread is the last thread
+       to exit, so the process return value is set properly.
+
+       * generic/tclIntDecls.h: 
+       * generic/tclIntPlatDecls.h: 
+       * generic/tclIntPlatStubs.c: 
+       * generic/tclIntStubs.c: 
+       * generic/tclPlatDecls.h: 
+       * generic/tclPlatStubs.c: 
+       * generic/tclStubInit.c: 
+       * generic/tclStubs.c: Fixed bad eol characters.
+       
+       * generic/tclInt.decls: Changed "const" to "CONST" in
+       declarations for better portability.
+
+       * generic/tcl.decls: Renamed panic and panicVA to Tcl_Panic and
+       Tcl_PanicVA in the stub files.
+
+       * generic/tclInterp.c (Tcl_MakeSafe): Remove tcl_platform(user)
+       from safe interps.
+
+1999-03-11    <stanton@GASPODE>
+
+       * unix/Makefile.in:
+       * unix/configure.in: Include compat files in the stub library in
+       addition to the main library.  Compat files are now built for
+       dynamic use in all cases.
+       
+       * generic/tcl.h: Changed magic number so it doesn't match the plus
+       patch, at Jan's request.
+       
+       * unix/tclConfig.sh.in:
+       * unix/dltest/Makefile.in:
+       * unix/dltest/configure.in:
+       * unix/dltest/pkga.c:
+       * unix/dltest/pkgb.c:
+       * unix/dltest/pkgc.c:
+       * unix/dltest/pkgd.c:
+       * unix/dltest/pkge.c:
+       * unix/dltest/pkgf.c: Changed package tests to build against the
+       stubs library.
+
+1999-03-10    <stanton@GASPODE>
+
+       * generic/tcl.h: 
+       * generic/tcl.decls: Changed Tcl_ReleaseType from an enum to
+       macros so it can be used in .rc files.
+       Added Tcl_GetString.
+
+       * mac/tclMacNotify.c:
+       * generic/tclNotify.c:
+       * generic/tclInt.h: 
+       * win/tclWinNotify.c: 
+       * generic/tcl.h: Renamed Tcl_AlertNotifier to TclpAlertNotifier.
+
+       * generic/tclInt.decls: Added TclWinAddProcess to make it possible
+       for expect to use Tcl_WaitForPid().  This patch is from Gordon
+       Chaffee. 
+
+       * mac/tclMacPort.h: 
+       * win/tclWinInit.c: 
+       * unix/tclUnixPort.h: 
+       * generic/tclAsync.c: Added TclpAsyncMark to fix bug in async
+       handling on Windows where async events don't wake up the event
+       loop.  This patch comes from Gordon Chaffee.
+
+       * generic/tcl.decls: Fixed declarations of reserved slots.
+       
+1999-03-10    <redman@scriptic.com>
+
+       * generic/tclCompile.h: Ensure that the ByteCode struct is binary
+       compatible with the version in 8.0.6.
+
+       * generic/tcl.h:
+       * generic/tclBasic.c: Add Tcl_GetVersion() function to the public
+       C API to allow programs to check the version number of the Tcl
+       library at runtime.  Also added an enum to clarify the release
+       level (alpha, beta, final).
+
+1999-03-09    <stanton@GASPODE>
+
+       * Integrated changes from Tcl 8.0 including:
+               stubs mechanism
+               configure patches from Jan Nijtmans
+               rename of panic to Tcl_Panic
+       
+1999-03-08    <lfb@scriptics.com>
+
+       * win/tclWin32Dll.c: Removed Dll instance from thread-local
+       storage.
+
+1999-03-08    <stanton@GASPODE>
+       
+       * generic/tcl.h: Moved Tcl_Mutex, etc. macros above the inclusion
+       of tclDecls.h to avoid macro conflicts.
+
+       * generic/tclInt.h:
+       * generic/regc_color.c: 
+       * generic/regcomp.c:
+       * generic/tclCmdIL.c:
+       * generic/tclCmdAH.c:
+       * generic/tclIOCmd.c:
+       * generic/tclParse.c:
+       * generic/tclStringObj.c:
+       * unix/tclUnixNotfy.c: Cleaned up various compiler warnings,
+       eliminated UCHAR bugs.
+       
+       * unix/tclUnixNotfy.c:
+       * unix/tclUnixThrd.c:
+       * generic/tclThreadTest.c:
+       * mac/tclMacThrd.c: Changed TclpCondition*() to Tcl_Condition*().
+       
+       * INTEGRATED PATCHES FROM 8.0.6:
+
+       * generic/tcl.decls:
+       * generic/tcl.h:
+       * generic/tclBasic.c: 
+       * generic/tclDecls.h:
+       * generic/tclInt.decls:
+       * generic/tclInt.h: 
+       * generic/tclIntDecls.h:
+       * generic/tclIntPlatDecls.h:
+       * generic/tclIntPlatStubs.c:
+       * generic/tclIntStubs.c:
+       * generic/tclPlatDecls.h:
+       * generic/tclPlatStubs.c:
+       * generic/tclStubInit.c:
+       * generic/tclStubLib.c:
+       * generic/tclStubs.c:
+       * tools/genStubs.tcl:
+       * unix/configure.in:
+       * unix/Makefile.in:
+       * unix/tclConfig.sh.in:
+       * win/makefile.vc:  
+       * win/tclWinPort.h: Added Tcl stubs implementation.  There are
+       now two new macros USE_TCL_STUBS and USE_TCL_STUB_PROCS that
+       enable use of stubs and disable stub macros respectively.  All of
+       the public and private function declarations from tcl.h and
+       tclInt.h have moved into the *.decls files and the *Stubs.c and
+       *Decls.h files are generated using the genStubs.tcl script.
+
+       * unix/Makefile.in:
+       * unix/configure.in: 
+       * unix/ldAix: Enhanced AIX shared library support.
+
+       * win/tclWinSock.c: Removed a bunch of extraneous PASCAL FAR
+       attributes from internal functions.
+
+       * win/tclWinReg.c: Changed registry package to use stubs mechanism
+       so it no longer depends on the specific version of Tcl.
+
+       * doc/AddErrInfo.3: 
+       * doc/Eval.3: 
+       * doc/PkgRequire.3: 
+       * doc/SetResult.3: 
+       * doc/StringObj.3: 
+       * generic/tcl.h:
+       * generic/tclBasic.c: 
+       * generic/tclPanic.c:
+       * generic/tclStringObj.c:
+       * generic/tclUtil.c:
+       * unix/mkLinks: Added va_list versions of all VARARGS
+       functions so they can be invoked from the stub functions.
+
+       * doc/package.n: 
+       * doc/PkgRequire.3: 
+       * generic/tclPkg.c: Added Tcl_PkgProvideEx, Tcl_RequireEx,
+       Tcl_PresentEx, and Tcl_PkgPresent.  Added "package present"
+       command.
+
+       * generic/tclFileName.c: 
+       * mac/tclMacFile.c: 
+       * mac/tclMacShLib.exp: 
+       * unix/tclUnixFile.c: 
+       * win/tclWinFile.c: Changed so TclGetUserHome is defined on
+       all platforms, even though it is currently a noop on mac and
+       windows, and renamed it to TclpGetUserHome.
+
+       * generic/tclPanic.c:
+       * generic/panic.c: Renamed panic to Tcl_Panic.
+       
+1999-02-25    <redman@scriptics.com>
+
+       * win/makefile.vc: Added tclWinConsole.c and tclWinSerial.c
+       
+       * win/tclWinConsole.c: New code to properly deal with fileevents
+       and nonblocking mode on consoles.
+       
+       * win/tclWinSerial.c: New code to properly deal with fileevents
+       and nonblocking mode on serial ports.
+
+       * win/tclWinPipe.c: 
+       * win/tclWinPort.h: Exported functions to allow creation of pipe
+       channels from tclWinChan.c
+
+       * win/tclWinChan.c: Check the type of a channel, including for the
+       standard (stdin/stdout/stderr), and use the correct channel type
+       to create the channel (file, serial, console, or pipe).
+
+1999-02-11    <stanton@GASPODE>
+
+       * README: 
+       * generic/tcl.h: 
+       * win/README.binary: 
+       * win/README: 
+       * unix/configure.in: 
+       * mac/README: Updated version numbers to 8.1b2.
+
+1999-02-10    <stanton@GASPODE>
+
+       * library/auto.tcl: Fixed auto_mkindex so it handles .tbc files.
+       Did some general cleanup to handle bad eval statements that didn't
+       use "list".
+
+       * unix/mkLinks:
+       * doc/SetVar.3:
+       * generic/tcl.h:
+       * generic/tclVar.c: Restored Tcl_ObjGetVar2 and Tcl_ObjSetVar2
+       from 8.0. Renamed Tcl_Get/SetObjVar2 to Tcl_GetVar2Ex and
+       Tcl_SetVar2Ex.
+>>>>>>> 1.1.1.5
+
+1999-02-10    <stanton@GASPODE>
+
+       INTEGRATED PATCHES FROM 8.0.5b2: 
+
+       * test/winPipe.test: Changed to remove echoArgs.tcl temporary file
+       when done.
+       
+       * tests/cmdAH.test:
+       * generic/tclFileName.c (TclGetExtension): Changed behavior so the
+       split happens at the last period in the name instead of the first
+       period of the last run of periods.  So, "foo..o" is split into
+       "foo." and ".o" now. [Bug: 1126]
+       
+       * win/makefile.vc: Added better support for paths with spaces in
+       the name. Added .lib and support .dlls to the install-binaries
+       target.  Added generate of a pkgIndex.tcl script to the
+       install-libraries target.
+
+       * win/tclAppInit.c: 
+       * unix/tclAppInit.c: 
+       * mac/tclMacAppInit.c: 
+       * generic/tclTest.c: Changed some EXTERN declarations to extern
+       since they are not defining exported interfaces.  This avoids
+       generating useless declspec() attributes and makes the windows
+       makefile simpler.
+
+       * generic/tcl.h: Moved Tcl_AppInit declaration to end and cleared
+       out TCL_STORAGE_CLASS so it is not declared with a declspec().
+
+       * tests/interp.test:
+       * generic/tclInterp.c (DeleteAlias): Changed to use
+       Tcl_DeleteCommandFromToken so we handle renames properly. This
+       avoids senseless panic. [Bug: 736]
+
+       * unix/tclUnixChan.c: 
+       * win/tclWinSock.c: 
+       * doc/socket.n: Applied Gordon Chaffee's patch to handle failures
+       during asynchronous socket connection operations.  This adds a new
+       "-error" fconfgure option to socket channels. [Bug: 893]
+
+       * generic/tclProc.c:
+       * generic/tclNamesp.c:
+       * generic/tclInt.h: 
+       * generic/tclCmdIL.c: 
+       * generic/tclBasic.c: 
+       * generic/tclVar.c: Applied patch from Viktor Dukhovni to
+       rationalize TCL_LEAVE_ERR_MSG behavior when creating variables.
+       
+       * generic/tclVar.c: Fixed bug in namespace tail computation.
+       Fixed bug where upvar could resurrect a namespace variable whose
+       namespace had been deleted.
+
+       * generic/tclCompile.c (TclCompileExprCmd): Eliminated yet another
+       bogus optimization in expression compilation.
+
+       * unix/configure.in: Added branch for BSD/OS-4* to shared library
+       case statement. [Bug: 975]
+       Fixed to correctly handle IRIX 6.5 n32 library support. [Bug: 1117]
+       
+       * win/winDumpExts.c: Patched to be pickier about stripping
+       @'s. [Bug: 920]
+
+       * library/http2.0/http.tcl: Added catch around eof test in
+       CopyDone since the user may have already called http::reset.
+       [Bug: 1108] 
+
+       * unix/configure.in: Changed Linux and IRIX to set SHLIB_LIBS to
+       LIBS so shared libraries are linked with the system
+       libraries. [Bug: 1018]
+
+       * generic/tclCompile.c (CompileExprWord): Fixed exception stack
+       overflow bug caused by missing statement. [Bug: 928]
+
+       * generic/tclIOCmd.c: 
+       * generic/tclBasic.c: Objectified the "open" command. [Bug: 1113] 
+
+       * generic/tclPosixStr.c (Tcl_ErrnoId, Tcl_ErrnoMsg): When using
+       egcs, ENOTSUP and EOPNOTSUPP are the same, so now we handle that
+       case. [Bug: 1137]
+
+       * library/init.tcl: Various small changes requested by Jan Nijtmans.
+       - If the variable $tcl_library contains the empty string, this
+       empty string will be put in $auto_path. This is not useful at all,
+       it only slows down later package processing.
+       - If the variable tcl_pkgPath is not set, the "unset __dir"
+       fails. Thich makes init.tcl totally unusable. Better put a "catch"
+       around it. 
+       - In the function tcl_findLibraries, the "string match" function
+       only works correctly if $tcl_patchLevel is in one of the forms
+       "?.?a?", "?.?b?" or "?.?.?". Could a "regexp" be used instead,
+       then it allows anything to be appended to the patchLevel
+       string. And it is more efficient.
+       - The tclPkgSetup function assumes that if $type != "load" then
+       the type must be "source". This needn't be true. Some users want
+       to add their own setup types.
+       [RFE: 1138] [Bug: 978]
+
+       * win/tclWinReg.c: 
+       * doc/registry.n: Added support for HKEY_PERFORMANCE_DATA and
+       HKEY_DYN_DATA keys. [Bug: 1109]
+
+       * win/tclWinInit.c (TclPlatformInit): Added code to ensure
+       tcl_pkgPath is set to "" when no registry entry is found. [Bug: 978]
+
+1999-02-01    <stanton@GASPODE>
+
+       * generic/tclBasic.c:
+       * generic/tclCmdAH.c:
+       * generic/tclCmdIL.c:
+       * generic/tclCmdMZ.c:
+       * generic/tclExecute.c:
+       * generic/tclHistory.c:
+       * generic/tclIO.c:
+       * generic/tclIOUtil.c:
+       * generic/tclInterp.c:
+       * generic/tclMain.c:
+       * generic/tclNamesp.c:
+       * generic/tclParse.c:
+       * generic/tclProc.c:
+       * generic/tclTest.c:
+       * generic/tclTimer.c:
+       * generic/tcl.h: Made eval interfaces compatible with 8.0 by
+       renaming Tcl_EvalObj to Tcl_EvalObjEx, renaming Tcl_Eval2 to
+       Tcl_EvalEx and restoring Tcl_EvalObj and Tcl_GlobalEvalObj
+       interfaces so they match Tcl 8.0.
+
+1999-01-28    <stanton@GASPODE>
+
+       * Merged Tcl 8.0.5b1 changes.
+       
+       * generic/tclUtil.c (Tcl_DStringSetLength): Changed so the buffer
+       overallocates in a manner similar to Tcl_DStringAppend.  This
+       should improve performance for TclUniCharToUtfDString.
+
+1998-12-11    === Tcl 8.1b1 Release ===
+       
+1998-12-10    <stanton@GASPODE>
 
-       * Makefile.in: temporarily disable second subdirectory
+2000-03-21  Syd Polk  <spolk@cygnus.com>
 
-1999-10-19  DJ Delorie  <dj@cygnus.com>
+       * configure.in: Check for cygwin, not cygwin32.
+       * configure: Regenerate.
+
+       * generic/tclInitScript.h: Added newline at end of file to make
+       current gcc happy.
 
-       * Makefile.in: support two subdirectories
-       * configure[.in]: for Cygwin, build both win and unix variants
-       * generic/tclEnv.c: include windows.h for cygwin
-       * generic/tclPort.h: If building the unix variant for cygwin,
-       pretend we're a unix machine instead of a windows machine.
-       * unix/Makefile.in: don't list -lc; it breaks on cygwin.
-       * unix/tclUnixFCmd.c: don't support fifos on cygwin
+1999-12-06  Mo DeJong <mdejong@cygnus.com>
 
-1999-08-05  DJ Delorie  <dj@cygnus.com>
+       * win/Makefile.in: added cl flags needed for VC++ 6.0
 
-       * win/tclWinInit.c (TclPlatformInit): add tcl_pkgPath hack
+1999-06-21  Syd Polk  <spolk@cygnus.com>
 
-1999-05-18  Fred Fish  <fnf@cygnus.com>
+       * generic/tclIO.c: Bug fixes from Scriptics to get exit status
+       correct on pipe channels.
 
-       * generic/tclPosixStr.c (Tcl_ErrnoId): Avoid duplicate case when
-       ENOTSUP and EOPNOTSUPP are defined to the same thing.
-       (Tcl_ErrnoMsg): Ditto.
+1999-04-22  Syd Polk  <spolk@cygnus.com>
 
-Fri Feb 26 17:40:55 1999  Geoffrey Noer  <noer@cygnus.com>
+       * unix/Makefile.in: Don't install tcl.h for install-libaries.
 
-        * win/configure.in: change "cygwin32*" to "cygwin*"
-        * win/configure: Regenerated.
-        * configure.in: Change "cygwin32*" to "cygwin*"
-        * configure: Regenerate.
+1999-02-16  Syd Polk  <spolk@cygnus.com>
+    
+       * win/configure.in: TCL_SRC_DIR needs to have forward slashes
+       for the MS build.
+       * win/configure: Regenerate.
+       * win/tclWinInit.c: Stupid Visual C++ compiler has limit on
+       number of characters in string constant.
 
 1999-02-11  Syd Polk  <spolk@cygnus.com>
 
-       * unix/configure.in: Forgot to AC_SUBST TCL_LIB_FULL_PATH
-       * unix/configure: Regenerated.
+       * generic/tclInitScript.h: The tclInit proc that Jim Ingham wrote
+       blew MS's string buffer away, so I hacked the original in for the
+       Microsoft build, which only SN is using anyway. Yuck.
 
-1999-02-10  Syd Polk  <spolk@cygnus.com>
+1999-02-08  Syd Polk  <spolk@cygnus.com>
 
+<<<<<<< ChangeLog
        * unix/configure.in unix/tclConfig.sh.in: Export TCL_LIB_FULL_PATH
        for dependencies.
+=======
+       * unix/configure.in: Fixed problem with test in --enable-symbols.
+>>>>>>> 1.1.1.5
        * unix/configure: Regenerated.
+       * library/auto.tcl: Fixed a problem with the regsub inside of
+       auto_mkindex since the regsub semantics changed.
 
-1999-01-27  James Ingham  <jingham@cygnus.com>
+1999-02-04  James Ingham  <jingham@cygnus.com> 
 
-       * generic/tclInitScript.h: Added two missing \n\'s to initScript
-       *generic/tclCmdIL.c: Fixed #ifdef that was giving gcc warning.
+       * generic/tclInitScript.h: Change the tclInit proc to find the Tcl 
+       library in both build & install trees.
+       * library/auto.tcl (tcl_findLibrary): Change tcl_findLibrary to
+       search around the executible for the tclConfig.sh, and then use
+       this to find the source tree.  This works in many more cases than
+       the Scriptics version.
 
-1999-01-20  James Ingham  <jingham@cygnus.com>
+       * configure.in: If no value is given for --enable-symbols, use the 
+       value from AC_PROG_CC, this adds -g for gcc.
 
+<<<<<<< ChangeLog
        * library/init.tcl (auto_mkindex_parser::mkindex): Clean out the parser
        interpreter completely between each file, rather than
        trying to remove imports by hand.  The latter method loses with
        IncrTcl, since that imports the class command by hand, and if you
        ever do "namespace import itcl::*" in your code, this will get
        undone.
+=======
+1999-01-19  Ben Elliston  <bje@cygnus.com>
+>>>>>>> 1.1.1.5
 
-Tue Nov 24 18:27:40 1998  Jim Ingham    jingham@cygnus.com
+       * tools/encoding/shiftjis.txt: Map tilde in ShiftJIS to tilde in
+       Unicode.
 
-        * Import of Tcl8.0.4 from Scriptics.
+       * library/encoding/shiftjis.enc: Regenerate.
 
-Thu Sep 17 17:03:18 1998  Martin M. Hunt  <hunt@cygnus.com>
+1998-12-21  Syd Polk  <spolk@cygnus.com>
 
-       * configure: Rebuilt
-       * unix/configure: Rebuilt
+       * generic/tclCompExpr.c: Remove another instance of string
+       blasting.
 
-Tue Aug 25 18:13:30 1998  Jim Ingham    <jingham@cygnus.com>
+       * generic/tclLiteral.c (TclDeleteLiteralTable): Make code 
+       that detects infinite loops exit gracefully in production
+       build and panic in development build.
 
-        * init.tcl (tcl_findLibrary): Added an argument determining
-        whether to source a packages init file into the TclPro
-        debugger or not.
+1998-12-21  Khamis Abuelkomboz  <khamis@cygnus.com>
 
-Thu Aug 20 14:32:59 1998  Jim Ingham    jingham@cygnus.com
+       * generic/tclLiteral.c (TclDeleteLiteralTable): added a daemon to catch
+       a hanging bug by deleteing a literal.
 
-       * Import of Tcl 8.0.3 from Scriptics, with our modifications.
-       I also changed the Sciptics startup code so it can find our
-        libraries whether in the build tree or the install tree.
+1998-12-19  Syd Polk  <spolk@cygnus.com>
 
-1998-07-03  Ben Elliston  <bje@cygnus.com>
+        * generic/tclCompile.c (tclCompileScript): Localize modifying 
+       the compiled string to the call which needs it. This prevents 
+       the string getting hashed incorrectly later.
 
-       Patches from Ian Roxborough <irox@cygnus.com>.
-       * generic/tclCmdIL.c (Tcl_LsearchObjCmd): Additional test when
-       compiling with Microsoft Visual C++.
+       * generic/tclAlloc.c: Latest patch from Scriptics.
 
-       * win/configure.in: Add AC_OBJEXT macro invocation.
+1998-12-16  Syd Polk  <spolk@cygnus.com>
 
-       * win/configure: Regenerate.
+       * tools/encoding/shiftjis.txt: Unicode character 0xFF5E
+       was missing from the shiftjis table.
+       * library/encoding/shiftjis.enc: Regnerated.
+
+1998-12-16  Ben Elliston  <bje@sanguine.cygnus.com>
+
+       * generic/tclBasic.c (builtInCmds): Add `encoding'. Patch from
+       Scriptics.
+
+       * generic/tclCmdAH.c (Tcl_EncodingObjCmd): New function. Patch
+       from Scriptics.
 
-       * win/Makefile.in: Don't assume object files end in `.o'.
+       * generic/tclEncoding.c: Changed at the same time as the rest of
+       these files, so it might be important. Patch from Scriptics.
 
-       * win/tclWinPort.h (PASCAL): Define when compiling with Microsoft
-       Visual C++.
+       * doc/encoding.n: New file. From Scriptics.
 
-       * win/tclWinSock.c (PASCAL): Likewise.
+1998-12-03  Syd Polk  <spolk@cygnus.com>
+
+       * generic/tclIO.c: Integrated more complete fix to
+       channel problem from Scott Stanton at Scriptics.
+
+1998-12-02  Syd Polk  <spolk@cygnus.com>
+
+       * generic/tclIO.c: Fixed problem when writing out to a
+       channel set to -crlf translations.
+
+1998-12-02  Ian Roxborough  <irox@cygnus.com>
+
+       * win/tclWinChan.c: Merged in WishCon0.1 Changes to
+       support pipe IO at console level of a WishShell.
+
+1998-11-24  Syd Polk  <spolk@cygnus.com>
+
+       * win/Makefile.in: Under MSVC, use the Tcl dumpexts method
+       to generate exports.
+       * win/tclWinPort.h tclWinSock.c: Do not #define PASCAL away. 
+       It is needed in calls to DLLs.
+
+1998-11-18  Syd Polk  <spolk@cygnus.com>
+
+       * generic/tclAlloc.c: Made sure that blocks are allocated on
+       eight-byte boundaries.
+       * unix/tclUnixPort.h: Added a CYGNUS LOCAL comment.
+
+1998-11-09  Ben Elliston  <bje@cygnus.com>
+
+       * generic/tclVar.c (TclGetIndexedScalar): Fix a general problem
+       with compiled local variables that are upvar'ed. Contributed by
+       Scott Stanton <stanton@scriptics.com>.
+
+1998-11-04  Ian Roxborough  <irox@cygnus.com>
        
-Tue Jun 30 18:56:27 1998 Jim Ingham <jingham@cygnus.com>
+       * win/tclWinPort.h: #endif in the wrong place and missing ')'.
+
+1998-11-06  Syd Polk  <spolk@cygnus.com>
+
+       * win/tclWinPort.h: Updated from Scriptics. Tcl_Realloc no longer
+       fails with blocks that are more than 64K.
+
+1998-11-04  Ian Roxborough  <irox@cygnus.com>
+
+       * generic/panic.c (panic): Removed a #define _DEBUG,
+       under MSVC if you want an exception Breakpoint instead
+       of a panic dialog, CFLAGS must contain -D_DEBUG.
 
-       * generic/tclListObj.c (Tcl_SetListObj, SetListFromAny) Import a 
-       change to the list code from tcl8.1 which prevents a crash 
-       when you do Tcl_SetListObj(obj, 0, NULL) on an object which 
-       has been created with Tcl_NewObj, but never written into.
+1998-11-03  Ian Roxborough  <irox@cygnus.com>
 
-Thu Jun 18 10:25:00 1998  Syd Polk  <spolk@cygnus.com>
+       * generic/panic.c (panic): If compiling with Microsoft, have this
+       generate an exception Breakpoint.
+
+1998-11-03  Syd Polk  <spolk@cygnus.com>
+
+       * generic/panic.c: If compiling with Microsoft, have this generate
+       a core dump so that we can actually see where it is happening when
+       we have co stdout/stderr.
+
+1998-10-29  Syd Polk  <spolk@cygnus.com>
+
+       * win/configure.in: Removed check for caddr_t. This configure.in
+       is not really ready for autoheader and the other garbage.
+       * win/configure: Regenerated.
+       * generic/tclAlloc.c: Put declaration of caddr_t inside of 
+       #ifdef _MSC_VER. It appears that this is the only compiler that
+       is missing this typedef.
+
+1998-10-29  Syd Polk  <spolk@cygnus.com>
+
+       * win/Makefile.in: The directory for encodings is called 'encoding',
+       not 'encodings'.
+
+1998-10-29  Syd Polk  <spolk@cygnus.com>
+
+       * unix/configure.in: Fix merge problem with socket libraries. Run
+       autoconf test for caddr_t.
+       * unix/configure: Regenerate.
+       * win/configure.in Run autoconf test for caddr_t.
+       * win/configure: Regnerate.
+       * generic/tclAlloc.c: Remove declaration of caddr_t. Should be
+       provided by configure now.
+
+1998-10-28  Syd Polk  <spolk@cygnus.com>
+
+       * unix/Makefile.in: Install encodings from make install.
+       * win/Makefile.in: Install encodings from make install.
+
+1998-10-28  Ben Elliston  <bje@cygnus.com>
+
+       * win/configure.in (TCL_BUILD_INCLUDES): Remove. Do not subst.
+       * win/configure: Regenerate.
+
+1998-10-26  Syd Polk  <spolk@cygnus.com>
+
+       * win/Makefile.in: Fix references to old opt0.1 library.
+
+1998-10-20  Syd Polk  <spolk@cygnus.com>
+
+       * unix/Makefile.in: Fix references to old opt0.1 library.
+
+1998-10-19  Ben Elliston  <bje@cygnus.com>
+
+       * unix/configure.in: Compute a value for @TCL_BUILD_INCLUDES@.
+
+       * unix/configure: Regenerate.
+
+       * unix/tclConfig.sh.in (TCL_BUILD_INCLUDES): Set.
        
-       * The import from Tcl 8.1a2 created all of the files that wer
-       in the Tcl 8.1a2 distribution but not in devo. Since they
-       are on their own branch, I removed them from devo.
+       * win/configure.in: Compute a value for @TCL_BUILD_INCLUDES@.
+
+       * win/configure: Regenerate.
 
-Fri Jun 12 11:42:30 1998  Ian Lance Taylor  <ian@cygnus.com>
+1998-10-14  Syd Polk  <spolk@cygnus.com>
 
-       * win/install-sh: Remove.
+       * win/configure.in Makefile.in: More fixes for the tcl8.l build
+       * win/configure: Regenerated
 
-Fri Jun 12 11:42:10 1998  Mumit Khan  <khan@xraylith.wisc.edu>
+1998-10-14  Syd Polk  <spolk@cygnus.com>
 
-       * configure.in (*-*-mingw32*): Support.
-       * win/Makefile.in (TCL_ALLOC_OBJ, DLL_LDLIBS, DLL_LDFLAGS): New 
-       variables.
-       (TCLOBJS): Use TCL_ALLOC_OBJ.
-       ($(TMPDIR)/tclcyg.def): Ignore errors.
-       ($(TMPDIR)/tclplugin.def): Likewise.
-       ($(TCLDLL),$(TCLPLUGINDLL,$(TCLREGDLL)): Cleanup DLL build flags 
-       and use TCL_ALLOC_OBJ, DLL_LDLIBS and DLL_LDFLAGS.
-       * win/configure.in: Call AC_CANONICAL_HOST.
-       (TCL_ALLOC_OBJ, DLL_LDLIBS, DLL_LDFLAGS): Define and substitute.
-       (TCL_PATCH_LEVEL): Bump to p2.
-       * win/tclWinPort.h (environ, hypot, exception): Define for Mingw32.
-       (EDEADLOCK): Undefine for Mingw32.
-       * win/configure: Rebuild.
+       * generic/tclCmdIL.c (SortCompare}: Support as much of the old
+       comparison semantics as possible. It is now possible to do
+       lsort -command {foo bar} {1 3 45}.
+       * tests/cmdIL.test (cmdIL-3.16}: Restore test.
 
-Fri May 29 17:11:01 1998  Ian Lance Taylor  <ian@cygnus.com>
+1998-10-08  Syd Polk  <spolk@cygnus.com>
 
-       * win/Makefile.in (install-minimal): Don't create
-       INCLUDE_INSTALL_DIR.
+       * generic/tclCmdIL.c (SortCompare): Make the comparison callback
+       object based for performance.
+       * tests/cmdIL.test (cmdIL-3.16): Test relied on incorrect behavior
+       of old string based comparison callback, which was a bug. Corrected
+       test.
+       * unix/configure.in: Minor fixes for gcc
+       * unix/configure: Regenerated
+       * unix/dltest/configure.in: GCC needs -f writeable-strings
+       * unix/dltest/Makefile.in: Fixed invalid TCL_CFLAGS reference
+       * unix/dltest/configure: Regenerated.
 
-Sun May 24 11:18:28 1998  Khamis Abuelkomboz  <khamis@mxbig.multix.de>
+1998-10-01  Ben Elliston  <bje@cygnus.com>
 
-       * generic/tclCmdIL.c (Tcl_LsearchObjCmd): using strnicmp for MSVC,
-       strncasecmp otherwise.
+       * generic/tclCmdIL.c (InfoEncodingsCmd): New function. Implement a
+       Tcl ``info encodings'' command.
+       (Tcl_InfoObjCmd): Detect ``encodings'' subcommand.
 
-Fri May 22 16:56:53 1998  Khamis Abuelkomboz  <khamis@mxbig.multix.de>
+       * doc/info.n: Update documentation.
+       
+1998-09-29  Syd Polk  <spolk@cygnus.com>
+
+       * win/Makefile.in: Still some hard-coded references to 8.0.
+       Fix problems with try and except
+       * win/configure.in: Likewise
+       * win/configure: Regenerated
+       * win/tclWin32Dll.c: try and except not supported under gcc.
+
+1998-09-28  Syd Polk  <spolk@cygnus.com>
+       
+       * generic/tclClock.c: timezone needs to be declared somewhere
+       * win/Makefile.in: Fixed OBJEXT problems
+       * win/tclWinFile.c win/tclWinInit.c: Fixed merge problems
+       * win/tclWinPipe.c: Removed Cygnus thread stuff to use the tcl 8.1
+       thread stuff instead.
 
-       * generic/tclCmdIL.c (NOCASE): let lsearch accept "-nocase"
-       (DICTIONARY): likewise, a synonym for "nocase".
-       So you can call lsearch with a "-nocase" or "-dictionary" flag to
-       use strcasecmp to find an item.
+1998-09-28  Syd Polk  <spolk@cygnus.com>
+
+        * win/configure.in: Merged from 4.2 branch
+        * win/configure: Regenerated
+       * win/Makefile.in: Updated for tcl8.1.
+
+Wed Aut 19 17:48:00 PDT 1998  Syd Polk  <spolk@cygnus.com>
+       
+       * 8.1 integration continues.
 
 Thu Apr 30 18:10:15 1998  Geoffrey Noer  <noer@cygnus.com>
 
@@ -924,3 +5375,4 @@ Sun Nov  8 21:56:26 1992  david d `zoo' zuhn  (zoo at cirdan.cygnus.com)
 
        * New file for GNU/Cygnus distribution of TCL.
 
+
index c7b3e66..4c230f4 100755 (executable)
@@ -28,6 +28,7 @@ program_suffix=NONE
 program_transform_name=s,x,x,
 silent=
 site=
+sitefile=
 srcdir=
 target=NONE
 verbose=
@@ -142,6 +143,7 @@ Configuration:
   --help                  print this message
   --no-create             do not create output files
   --quiet, --silent       do not print \`checking...' messages
+  --site-file=FILE        use FILE as the site file
   --version               print the version of autoconf that created configure
 Directory and file names:
   --prefix=PREFIX         install architecture-independent files in PREFIX
@@ -312,6 +314,11 @@ EOF
   -site=* | --site=* | --sit=*)
     site="$ac_optarg" ;;
 
+  -site-file | --site-file | --site-fil | --site-fi | --site-f)
+    ac_prev=sitefile ;;
+  -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*)
+    sitefile="$ac_optarg" ;;
+
   -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
     ac_prev=srcdir ;;
   -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
@@ -477,12 +484,16 @@ fi
 srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
 
 # Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
-  if test "x$prefix" != xNONE; then
-    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
-  else
-    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+if test -z "$sitefile"; then
+  if test -z "$CONFIG_SITE"; then
+    if test "x$prefix" != xNONE; then
+      CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+    else
+      CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+    fi
   fi
+else
+  CONFIG_SITE="$sitefile"
 fi
 for ac_site_file in $CONFIG_SITE; do
   if test -r "$ac_site_file"; then
@@ -548,7 +559,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:552: checking host system type" >&5
+echo "configure:563: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -570,13 +581,7 @@ echo "$ac_t""$host" 1>&6
 
 
 case "${host}" in
-*-*-cygwin*)
-       CONFIGDIR="win"
-       
-       CONFIGDIR2="cygwin"
-       
-       ;;
-*-*-mingw32*)
+*cygwin* | *mingw32* | *windows32*)
        CONFIGDIR="win"
        
        ;;
@@ -606,7 +611,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
 esac
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:610: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:615: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -632,7 +637,7 @@ else
   SET_MAKE="MAKE=${MAKE-make}"
 fi
 
-subdirs="$CONFIGDIR $CONFIGDIR2"
+subdirs="$CONFIGDIR"
 
 trap '' 1 2 15
 cat > confcache <<\EOF
@@ -784,7 +789,6 @@ s%@host_cpu@%$host_cpu%g
 s%@host_vendor@%$host_vendor%g
 s%@host_os@%$host_os%g
 s%@CONFIGDIR@%$CONFIGDIR%g
-s%@CONFIGDIR2@%$CONFIGDIR2%g
 s%@SET_MAKE@%$SET_MAKE%g
 s%@subdirs@%$subdirs%g
 
@@ -795,7 +799,7 @@ cat >> $CONFIG_STATUS <<\EOF
 
 # Split the substitutions into bite-sized pieces for seds with
 # small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_max_sed_cmds=60 # Maximum number of lines to put in a sed script.
 ac_file=1 # Number of current file.
 ac_beg=1 # First line for current file.
 ac_end=$ac_max_sed_cmds # Line after last line for current file.
@@ -919,7 +923,7 @@ if test "$no_recursion" != yes; then
     esac
   done
 
-  for ac_config_dir in $CONFIGDIR $CONFIGDIR2; do
+  for ac_config_dir in $CONFIGDIR; do
 
     # Do not complain, so a configure script can configure whichever
     # parts of a large source tree are present.
index 3b2cfdb..44c4e94 100644 (file)
@@ -8,6 +8,7 @@
  *
  * Copyright (c) 1983 Regents of the University of California.
  * Copyright (c) 1996-1997 Sun Microsystems, Inc.
+ * Copyright (c) 1998-1999 by Scriptics Corporation.
  *
  * Portions contributed by Chris Kingsley, Jack Jansen and Ray Johnson.
  *
 #include "tclInt.h"
 #include "tclPort.h"
 
+#if USE_TCLALLOC
+
 #ifdef TCL_DEBUG
 #   define DEBUG
 /* #define MSTATS */
 #   define RCHECK
 #endif
 
-#ifndef __CYGWIN__
+/*
+ * With gcc this will already be defined. This should really
+ * make use of AC_CHECK_TYPE(caddr_t) but that can wait
+ * until we use config.h properly.
+ */
+
+#if defined(MAC_TCL) || defined(_MSC_VER) || defined(__MINGW32__)
 typedef unsigned long caddr_t;
 #endif
 
 /*
- * The overhead on a block is at least 4 bytes.  When free, this space
+ * The overhead on a block is at least 8 bytes.  When free, this space
  * contains a pointer to the next free block, and the bottom two bits must
  * be zero.  When in use, the first byte is set to MAGIC, and the second
  * byte is the size index.  The remaining bytes are for alignment.
@@ -43,6 +52,7 @@ typedef unsigned long caddr_t;
 
 union overhead {
     union overhead *ov_next;   /* when free */
+    unsigned char ov_padding[8]; /* Ensure the structure is 8-byte aligned. */
     struct {
        unsigned char   ovu_magic0;     /* magic number */
        unsigned char   ovu_index;      /* bucket # */
@@ -51,13 +61,14 @@ union overhead {
 #ifdef RCHECK
        unsigned short  ovu_rmagic;     /* range magic number */
        unsigned long   ovu_size;       /* actual block size */
+       unsigned short  ovu_unused2;    /* padding to 8-byte align */
 #endif
     } ovu;
 #define ov_magic0      ovu.ovu_magic0
 #define ov_magic1      ovu.ovu_magic1
 #define ov_index       ovu.ovu_index
 #define ov_rmagic      ovu.ovu_rmagic
-#define ov_size        ovu.ovu_size
+#define ov_size                ovu.ovu_size
 };
 
 
@@ -82,6 +93,36 @@ union overhead {
 #define MAXMALLOC      (1<<(NBUCKETS+2))
 static union overhead *nextf[NBUCKETS];
 
+/* 
+ * The following structure is used to keep track of all system memory 
+ * currently owned by Tcl.  When finalizing, all this memory will
+ * be returned to the system.
+ */
+
+struct block {
+    struct block *nextPtr;     /* Linked list. */
+    struct block *prevPtr;     /* Linked list for big blocks, ensures 8-byte 
+                                * alignment for suballocated blocks. */
+};
+
+static struct block *blockList;                /* Tracks the suballocated blocks. */
+static struct block bigBlocks = {      /* Big blocks aren't suballocated. */
+    &bigBlocks, &bigBlocks
+};
+
+/*
+ * The allocator is protected by a special mutex that must be
+ * explicitly initialized.  Futhermore, because Tcl_Alloc may be
+ * used before anything else in Tcl, we make this module self-initializing
+ * after all with the allocInit variable.
+ */
+
+#ifdef TCL_THREADS
+static Tcl_Mutex *allocMutexPtr;
+#endif
+static int allocInit = 0;
+
+
 #ifdef MSTATS
 
 /*
@@ -106,6 +147,91 @@ static     unsigned int nmalloc[NBUCKETS+1];
  */
 
 static void            MoreCore _ANSI_ARGS_((int bucket));
+
+\f
+/*
+ *-------------------------------------------------------------------------
+ *
+ * TclInitAlloc --
+ *
+ *     Initialize the memory system.
+ *
+ * Results:
+ *     None.
+ *
+ * Side effects:
+ *     Initialize the mutex used to serialize allocations.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void
+TclInitAlloc()
+{
+    if (!allocInit) {
+       allocInit = 1;
+#ifdef TCL_THREADS
+       allocMutexPtr = Tcl_GetAllocMutex();
+#endif
+    }
+}
+\f
+/*
+ *-------------------------------------------------------------------------
+ *
+ * TclFinalizeAllocSubsystem --
+ *
+ *     Release all resources being used by this subsystem, including 
+ *     aggressively freeing all memory allocated by TclpAlloc() that 
+ *     has not yet been released with TclpFree().
+ *     
+ *     After this function is called, all memory allocated with 
+ *     TclpAlloc() should be considered unusable.
+ *
+ * Results:
+ *     None.
+ *
+ * Side effects:
+ *     This subsystem is self-initializing, since memory can be 
+ *     allocated before Tcl is formally initialized.  After this call,
+ *     this subsystem has been reset to its initial state and is 
+ *     usable again.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void
+TclFinalizeAllocSubsystem()
+{
+    int i;
+    struct block *blockPtr, *nextPtr;
+
+    Tcl_MutexLock(allocMutexPtr);
+    for (blockPtr = blockList; blockPtr != NULL; blockPtr = nextPtr) {
+       nextPtr = blockPtr->nextPtr;
+       TclpSysFree(blockPtr);
+    }
+    blockList = NULL;
+
+    for (blockPtr = bigBlocks.nextPtr; blockPtr != &bigBlocks; ) {
+       nextPtr = blockPtr->nextPtr;
+       TclpSysFree(blockPtr);
+       blockPtr = nextPtr;
+    }
+    bigBlocks.nextPtr = &bigBlocks;
+    bigBlocks.prevPtr = &bigBlocks;
+
+    for (i = 0; i < NBUCKETS; i++) {
+       nextf[i] = NULL;
+#ifdef MSTATS
+       nmalloc[i] = 0;
+#endif
+    }
+#ifdef MSTATS
+    nmalloc[i] = 0;
+#endif
+    Tcl_MutexUnlock(allocMutexPtr);
+}
 \f
 /*
  *----------------------------------------------------------------------
@@ -124,21 +250,39 @@ static void               MoreCore _ANSI_ARGS_((int bucket));
  */
 
 char *
-TclpAlloc(
-    unsigned int nbytes)       /* Number of bytes to allocate. */
+TclpAlloc(nbytes)
+    unsigned int nbytes;       /* Number of bytes to allocate. */
 {
     register union overhead *op;
     register long bucket;
     register unsigned amt;
+    struct block *bigBlockPtr;
 
+    if (!allocInit) {
+       /*
+        * We have to make the "self initializing" because Tcl_Alloc
+        * may be used before any other part of Tcl.  E.g., see
+        * main() for tclsh!
+        */
+       TclInitAlloc();
+    }
+    Tcl_MutexLock(allocMutexPtr);
     /*
      * First the simple case: we simple allocate big blocks directly
      */
     if (nbytes + OVERHEAD >= MAXMALLOC) {
-       op = (union overhead *)TclpSysAlloc(nbytes+OVERHEAD, 0);
-       if (op == NULL) {
+       bigBlockPtr = (struct block *) TclpSysAlloc((unsigned) 
+               (sizeof(struct block) + OVERHEAD + nbytes), 0);
+       if (bigBlockPtr == NULL) {
+           Tcl_MutexUnlock(allocMutexPtr);
            return NULL;
        }
+       bigBlockPtr->nextPtr = bigBlocks.nextPtr;
+       bigBlocks.nextPtr = bigBlockPtr;
+       bigBlockPtr->prevPtr = &bigBlocks;
+       bigBlockPtr->nextPtr->prevPtr = bigBlockPtr;
+
+       op = (union overhead *) (bigBlockPtr + 1);
        op->ov_magic0 = op->ov_magic1 = MAGIC;
        op->ov_index = 0xff;
 #ifdef MSTATS
@@ -153,6 +297,7 @@ TclpAlloc(
        op->ov_rmagic = RMAGIC;
        *(unsigned short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC;
 #endif
+       Tcl_MutexUnlock(allocMutexPtr);
        return (void *)(op+1);
     }
     /*
@@ -170,6 +315,7 @@ TclpAlloc(
     while (nbytes + OVERHEAD > amt) {
        amt <<= 1;
        if (amt == 0) {
+           Tcl_MutexUnlock(allocMutexPtr);
            return (NULL);
        }
        bucket++;
@@ -183,6 +329,7 @@ TclpAlloc(
     if ((op = nextf[bucket]) == NULL) {
        MoreCore(bucket);
        if ((op = nextf[bucket]) == NULL) {
+           Tcl_MutexUnlock(allocMutexPtr);
            return (NULL);
        }
     }
@@ -204,6 +351,7 @@ TclpAlloc(
     op->ov_rmagic = RMAGIC;
     *(unsigned short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC;
 #endif
+    Tcl_MutexUnlock(allocMutexPtr);
     return ((char *)(op + 1));
 }
 \f
@@ -214,6 +362,8 @@ TclpAlloc(
  *
  *     Allocate more memory to the indicated bucket.
  *
+ *     Assumes Mutex is already held.
+ *
  * Results:
  *     None.
  *
@@ -224,13 +374,14 @@ TclpAlloc(
  */
 
 static void
-MoreCore(
-    int bucket)                /* What bucket to allocat to. */
+MoreCore(bucket)
+    int bucket;                /* What bucket to allocat to. */
 {
     register union overhead *op;
     register long sz;          /* size of desired block */
     long amt;                  /* amount to allocate */
     int nblks;                 /* how many blocks we get */
+    struct block *blockPtr;
 
     /*
      * sbrk_size <= 0 only for big, FLUFFY, requests (about
@@ -243,11 +394,16 @@ MoreCore(
     nblks = amt / sz;
     ASSERT(nblks*sz == amt);
 
-    op = (union overhead *)TclpSysAlloc(amt, 1);
+    blockPtr = (struct block *) TclpSysAlloc((unsigned) 
+           (sizeof(struct block) + amt), 1);
     /* no more room! */
-    if (op == NULL) {
+    if (blockPtr == NULL) {
        return;
     }
+    blockPtr->nextPtr = blockList;
+    blockList = blockPtr;
+
+    op = (union overhead *) (blockPtr + 1);
     
     /*
      * Add new memory allocated to that on
@@ -278,21 +434,24 @@ MoreCore(
  */
 
 void
-TclpFree(
-    char *cp)          /* Pointer to memory to free. */
+TclpFree(cp)
+    char *cp;          /* Pointer to memory to free. */
 {   
     register long size;
     register union overhead *op;
+    struct block *bigBlockPtr;
 
     if (cp == NULL) {
        return;
     }
 
+    Tcl_MutexLock(allocMutexPtr);
     op = (union overhead *)((caddr_t)cp - sizeof (union overhead));
 
     ASSERT(op->ov_magic0 == MAGIC);            /* make sure it was in use */
     ASSERT(op->ov_magic1 == MAGIC);
     if (op->ov_magic0 != MAGIC || op->ov_magic1 != MAGIC) {
+       Tcl_MutexUnlock(allocMutexPtr);
        return;
     }
 
@@ -303,7 +462,11 @@ TclpFree(
 #ifdef MSTATS
        nmalloc[NBUCKETS]--;
 #endif
-       TclpSysFree(op);
+       bigBlockPtr = (struct block *) op - 1;
+       bigBlockPtr->prevPtr->nextPtr = bigBlockPtr->nextPtr;
+       bigBlockPtr->nextPtr->prevPtr = bigBlockPtr->prevPtr;
+       TclpSysFree(bigBlockPtr);
+       Tcl_MutexUnlock(allocMutexPtr);
        return;
     }
     ASSERT(size < NBUCKETS);
@@ -312,6 +475,7 @@ TclpFree(
 #ifdef MSTATS
     nmalloc[size]--;
 #endif
+    Tcl_MutexUnlock(allocMutexPtr);
 }
 \f
 /*
@@ -331,12 +495,13 @@ TclpFree(
  */
 
 char *
-TclpRealloc(
-    char *cp,                  /* Pointer to alloced block. */
-    unsigned int nbytes)       /* New size of memory. */
+TclpRealloc(cp, nbytes)
+    char *cp;                  /* Pointer to alloced block. */
+    unsigned int nbytes;       /* New size of memory. */
 {   
     int i;
     union overhead *op;
+    struct block *bigBlockPtr;
     int expensive;
     unsigned long maxsize;
 
@@ -344,11 +509,14 @@ TclpRealloc(
        return (TclpAlloc(nbytes));
     }
 
+    Tcl_MutexLock(allocMutexPtr);
+
     op = (union overhead *)((caddr_t)cp - sizeof (union overhead));
 
     ASSERT(op->ov_magic0 == MAGIC);            /* make sure it was in use */
     ASSERT(op->ov_magic1 == MAGIC);
     if (op->ov_magic0 != MAGIC || op->ov_magic1 != MAGIC) {
+       Tcl_MutexUnlock(allocMutexPtr);
        return NULL;
     }
 
@@ -361,10 +529,28 @@ TclpRealloc(
      */
 
     if (i == 0xff) {
-       op = (union overhead *) TclpSysRealloc(op, nbytes+OVERHEAD);
-       if (op == NULL) {
+       struct block *prevPtr, *nextPtr;
+       bigBlockPtr = (struct block *) op - 1;
+       prevPtr = bigBlockPtr->prevPtr;
+       nextPtr = bigBlockPtr->nextPtr;
+       bigBlockPtr = (struct block *) TclpSysRealloc(bigBlockPtr, 
+               sizeof(struct block) + OVERHEAD + nbytes);
+       if (bigBlockPtr == NULL) {
+           Tcl_MutexUnlock(allocMutexPtr);
            return NULL;
        }
+
+       if (prevPtr->nextPtr != bigBlockPtr) {
+           /*
+            * If the block has moved, splice the new block into the list where
+            * the old block used to be. 
+            */
+
+           prevPtr->nextPtr = bigBlockPtr;
+           nextPtr->prevPtr = bigBlockPtr;
+       }
+
+       op = (union overhead *) (bigBlockPtr + 1);
 #ifdef MSTATS
        nmalloc[NBUCKETS]++;
 #endif
@@ -376,6 +562,7 @@ TclpRealloc(
        op->ov_size = (nbytes + RSLOP - 1) & ~(RSLOP - 1);
        *(unsigned short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC;
 #endif
+       Tcl_MutexUnlock(allocMutexPtr);
        return (char *)(op+1);
     }
     maxsize = 1 << (i+3);
@@ -388,7 +575,9 @@ TclpRealloc(
 
     if (expensive) {
        void *newp;
-               
+
+       Tcl_MutexUnlock(allocMutexPtr);
+
        newp = TclpAlloc(nbytes);
        if ( newp == NULL ) {
            return NULL;
@@ -408,6 +597,7 @@ TclpRealloc(
     op->ov_size = (nbytes + RSLOP - 1) & ~(RSLOP - 1);
     *(unsigned short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC;
 #endif
+    Tcl_MutexUnlock(allocMutexPtr);
     return(cp);
 }
 \f
@@ -431,14 +621,15 @@ TclpRealloc(
 
 #ifdef MSTATS
 void
-mstats(
-    char *s)   /* Where to write info. */
+mstats(s)
+    char *s;   /* Where to write info. */
 {
     register int i, j;
     register union overhead *p;
     int totfree = 0,
        totused = 0;
 
+    Tcl_MutexLock(allocMutexPtr);
     fprintf(stderr, "Memory allocation statistics %s\nTclpFree:\t", s);
     for (i = 0; i < NBUCKETS; i++) {
        for (j = 0, p = nextf[i]; p; p = p->ov_next, j++)
@@ -454,5 +645,82 @@ mstats(
            totused, totfree);
     fprintf(stderr, "\n\tNumber of big (>%d) blocks in use: %d\n", 
            MAXMALLOC, nmalloc[NBUCKETS]);
+    Tcl_MutexUnlock(allocMutexPtr);
 }
 #endif
+
+#else  /* !USE_TCLALLOC */
+\f
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclpAlloc --
+ *
+ *     Allocate more memory.
+ *
+ * Results:
+ *     None.
+ *
+ * Side effects:
+ *     None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+char *
+TclpAlloc(nbytes)
+    unsigned int nbytes;       /* Number of bytes to allocate. */
+{
+    return (char*) malloc(nbytes);
+}
+\f
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclpFree --
+ *
+ *     Free memory.
+ *
+ * Results:
+ *     None.
+ *
+ * Side effects:
+ *     None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TclpFree(cp)
+    char *cp;          /* Pointer to memory to free. */
+{   
+    free(cp);
+    return;
+}
+\f
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclpRealloc --
+ *
+ *     Reallocate memory.
+ *
+ * Results:
+ *     None.
+ *
+ * Side effects:
+ *     None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+char *
+TclpRealloc(cp, nbytes)
+    char *cp;                  /* Pointer to alloced block. */
+    unsigned int nbytes;       /* New size of memory. */
+{   
+    return (char*) realloc(cp, nbytes);
+}
+
+#endif /* !USE_TCLALLOC */
+
index 0ae6c25..294ec21 100644 (file)
@@ -7,7 +7,7 @@
  *     the "env" arrays in sync with the system environment variables.
  *
  * Copyright (c) 1991-1994 The Regents of the University of California.
- * Copyright (c) 1994-1996 Sun Microsystems, Inc.
+ * Copyright (c) 1994-1998 Sun Microsystems, Inc.
  *
  * See the file "license.terms" for information on usage and redistribution
  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 #include "tclInt.h"
 #include "tclPort.h"
 
+TCL_DECLARE_MUTEX(envMutex)    /* To serialize access to environ */
+
 /* CYGNUS LOCAL */
 #if defined(__CYGWIN__) && defined(__WIN32__)
 
 /* Under cygwin, the environment is imported from the cygwin DLL.  */
 
-extern char ***_imp____cygwin_environ;
+__declspec(dllimport) extern char **__cygwin_environ;
 
-#define environ (*_imp____cygwin_environ)
+#define environ (__cygwin_environ)
 
 /* We need to use a special putenv function to handle PATH.  */
 #ifndef USE_PUTENV
 #define USE_PUTENV
 #endif
 #define putenv TclCygwin32Putenv
-
 #endif
 /* END CYGNUS LOCAL */
 
-/*
- * The structure below is used to keep track of all of the interpereters
- * for which we're managing the "env" array.  It's needed so that they
- * can all be updated whenever an environment variable is changed
- * anywhere.
- */
-
-typedef struct EnvInterp {
-    Tcl_Interp *interp;                /* Interpreter for which we're managing
-                                * the env array. */
-    struct EnvInterp *nextPtr; /* Next in list of all such interpreters,
-                                * or zero. */
-} EnvInterp;
+#ifdef TCL_THREADS
 
-static EnvInterp *firstInterpPtr = NULL;
-                               /* First in list of all managed interpreters,
-                                * or NULL if none. */
+static Tcl_Mutex envMutex;     /* To serialize access to environ */
+#endif
 
 static int cacheSize = 0;      /* Number of env strings in environCache. */
 static char **environCache = NULL;
@@ -68,14 +56,20 @@ static int environSize = 0; /* Non-zero means that the environ array was
 #endif
 
 /*
+ * For MacOS X
+ */
+#if defined(__APPLE__) && defined(__DYNAMIC__)
+#include <crt_externs.h>
+char **environ = NULL;
+#endif
+
+/*
  * Declarations for local procedures defined in this file:
  */
 
 static char *          EnvTraceProc _ANSI_ARGS_((ClientData clientData,
                            Tcl_Interp *interp, char *name1, char *name2,
                            int flags));
-static int             FindVariable _ANSI_ARGS_((CONST char *name,
-                           int *lengthPtr));
 static void            ReplaceString _ANSI_ARGS_((CONST char *oldStr,
                            char *newStr));
 void                   TclSetEnv _ANSI_ARGS_((CONST char *name,
@@ -103,7 +97,7 @@ static void          TclCygwin32Putenv _ANSI_ARGS_((CONST char *string));
  *     The interpreter is added to a list of interpreters managed
  *     by us, so that its view of envariables can be kept consistent
  *     with the view in other interpreters.  If this is the first
- *     call to Tcl_SetupEnv, then additional initialization happens,
+ *     call to TclSetupEnv, then additional initialization happens,
  *     such as copying the environment to dynamically-allocated space
  *     for ease of management.
  *
@@ -115,73 +109,66 @@ TclSetupEnv(interp)
     Tcl_Interp *interp;                /* Interpreter whose "env" array is to be
                                 * managed. */
 {
-    EnvInterp *eiPtr;
-    char *p, *p2;
-    Tcl_DString ds;
-    int i, sz;
-
-#ifdef MAC_TCL
-    if (environ == NULL) {
-       environSize = TclMacCreateEnv();
-    }
-#endif
-
-    /*
-     * Next, initialize the DString we are going to use for copying
-     * the names of the environment variables.
-     */
+    Tcl_DString envString;
+    char *p1, *p2;
+    int i;
 
-    Tcl_DStringInit(&ds);
-    
     /*
-     * Next, add the interpreter to the list of those that we manage.
+     * For MacOS X
      */
-
-    eiPtr = (EnvInterp *) ckalloc(sizeof(EnvInterp));
-    eiPtr->interp = interp;
-    eiPtr->nextPtr = firstInterpPtr;
-    firstInterpPtr = eiPtr;
+#if defined(__APPLE__) && defined(__DYNAMIC__)
+    environ = *_NSGetEnviron();
+#endif
 
     /*
-     * Store the environment variable values into the interpreter's
-     * "env" array, and arrange for us to be notified on future
-     * writes and unsets to that array.
+     * Synchronize the values in the environ array with the contents
+     * of the Tcl "env" variable.  To do this:
+     *    1) Remove the trace that fires when the "env" var is unset.
+     *    2) Unset the "env" variable.
+     *    3) If there are no environ variables, create an empty "env"
+     *       array.  Otherwise populate the array with current values.
+     *    4) Add a trace that synchronizes the "env" array.
      */
-
-    (void) Tcl_UnsetVar2(interp, "env", (char *) NULL, TCL_GLOBAL_ONLY);
-    for (i = 0; ; i++) {
-       p = environ[i];
-       if (p == NULL) {
-           break;
-       }
-       for (p2 = p; *p2 != '='; p2++) {
-           if (*p2 == 0) {
+    
+    Tcl_UntraceVar2(interp, "env", (char *) NULL,
+           TCL_GLOBAL_ONLY | TCL_TRACE_WRITES | TCL_TRACE_UNSETS |
+           TCL_TRACE_READS | TCL_TRACE_ARRAY,  EnvTraceProc,
+           (ClientData) NULL);
+    
+    Tcl_UnsetVar2(interp, "env", (char *) NULL, TCL_GLOBAL_ONLY); 
+    
+    if (environ[0] == NULL) {
+       Tcl_Obj *varNamePtr;
+       
+       varNamePtr = Tcl_NewStringObj("env", -1);
+       Tcl_IncrRefCount(varNamePtr);
+       TclArraySet(interp, varNamePtr, NULL);  
+       Tcl_DecrRefCount(varNamePtr);
+    } else {
+       Tcl_MutexLock(&envMutex);
+       for (i = 0; environ[i] != NULL; i++) {
+           p1 = Tcl_ExternalToUtfDString(NULL, environ[i], -1, &envString);
+           p2 = strchr(p1, '=');
+           if (p2 == NULL) {
                /*
-                * This condition doesn't seem like it should ever happen,
-                * but it does seem to happen occasionally under some
+                * This condition seem to happen occasionally under some
                 * versions of Solaris; ignore the entry.
                 */
-
-               goto nextEntry;
+               
+               continue;
            }
+           p2++;
+           p2[-1] = '\0';
+           Tcl_SetVar2(interp, "env", p1, p2, TCL_GLOBAL_ONLY);        
+           Tcl_DStringFree(&envString);
        }
-        sz = p2 - p;
-        Tcl_DStringSetLength(&ds, 0);
-        Tcl_DStringAppend(&ds, p, sz);
-       (void) Tcl_SetVar2(interp, "env", Tcl_DStringValue(&ds),
-                p2+1, TCL_GLOBAL_ONLY);
-       nextEntry:
-       continue;
+       Tcl_MutexUnlock(&envMutex);
     }
-    Tcl_TraceVar2(interp, "env", (char *) NULL,
-           TCL_GLOBAL_ONLY | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
-           EnvTraceProc, (ClientData) NULL);
 
-    /*
-     * Finally clean up the DString.
-     */
-
-    Tcl_DStringFree(&ds);
+    Tcl_TraceVar2(interp, "env", (char *) NULL,
+           TCL_GLOBAL_ONLY | TCL_TRACE_WRITES | TCL_TRACE_UNSETS |
+           TCL_TRACE_READS | TCL_TRACE_ARRAY,  EnvTraceProc,
+           (ClientData) NULL);
 }
 \f
 /*
@@ -200,8 +187,7 @@ TclSetupEnv(interp)
  *     None.
  *
  * Side effects:
- *     The environ array gets updated, as do all of the interpreters
- *     that we manage.
+ *     The environ array gets updated.
  *
  *----------------------------------------------------------------------
  */
@@ -209,33 +195,29 @@ TclSetupEnv(interp)
 void
 TclSetEnv(name, value)
     CONST char *name;          /* Name of variable whose value is to be
-                                * set. */
-    CONST char *value;         /* New value for variable. */
+                                * set (UTF-8). */
+    CONST char *value;         /* New value for variable (UTF-8). */
 {
+    Tcl_DString envString;
     int index, length, nameLength;
-    char *p, *oldValue;
-    EnvInterp *eiPtr;
-
-#ifdef MAC_TCL
-    if (environ == NULL) {
-       environSize = TclMacCreateEnv();
-    }
-#endif
+    char *p, *p2, *oldValue;
 
     /*
      * Figure out where the entry is going to go.  If the name doesn't
-     * already exist, enlarge the array if necessary to make room.  If
-     * the name exists, free its old entry.
+     * already exist, enlarge the array if necessary to make room.  If the
+     * name exists, free its old entry.
      */
 
-    index = FindVariable(name, &length);
+    Tcl_MutexLock(&envMutex);
+    index = TclpFindVariable(name, &length);
+
     if (index == -1) {
 #ifndef USE_PUTENV
-       if ((length+2) > environSize) {
+       if ((length + 2) > environSize) {
            char **newEnviron;
 
            newEnviron = (char **) ckalloc((unsigned)
-                   ((length+5) * sizeof(char *)));
+                   ((length + 5) * sizeof(char *)));
 
            /* CYGNUS LOCAL: Added to avoid an error from Purify,
                although I don't personally see where the error would
@@ -248,14 +230,16 @@ TclSetEnv(name, value)
                ckfree((char *) environ);
            }
            environ = newEnviron;
-           environSize = length+5;
+           environSize = length + 5;
        }
        index = length;
-       environ[index+1] = NULL;
+       environ[index + 1] = NULL;
 #endif
        oldValue = NULL;
        nameLength = strlen(name);
     } else {
+       char *env;
+
        /*
         * Compare the new value to the existing value.  If they're
         * the same then quit immediately (e.g. don't rewrite the
@@ -264,61 +248,61 @@ TclSetEnv(name, value)
         * of the same value among the interpreters.
         */
 
-       if (strcmp(value, environ[index]+length+1) == 0) {
+       env = Tcl_ExternalToUtfDString(NULL, environ[index], -1, &envString);
+       if (strcmp(value, (env + length + 1)) == 0) {
+           Tcl_DStringFree(&envString);
+           Tcl_MutexUnlock(&envMutex);
            return;
        }
+       Tcl_DStringFree(&envString);
+
        oldValue = environ[index];
        nameLength = length;
     }
        
 
     /*
-     * Create a new entry.
+     * Create a new entry.  Build a complete UTF string that contains
+     * a "name=value" pattern.  Then convert the string to the native
+     * encoding, and set the environ array value.
      */
 
     p = (char *) ckalloc((unsigned) (nameLength + strlen(value) + 2));
     strcpy(p, name);
     p[nameLength] = '=';
     strcpy(p+nameLength+1, value);
+    p2 = Tcl_UtfToExternalDString(NULL, p, -1, &envString);
 
     /*
-     * Update the system environment.
+     * Copy the native string to heap memory.
      */
+    
+    p = (char *) ckrealloc(p, (unsigned) (strlen(p2) + 1));
+    strcpy(p, p2);
+    Tcl_DStringFree(&envString);
 
 #ifdef USE_PUTENV
+    /*
+     * Update the system environment.
+     */
+
     putenv(p);
+    index = TclpFindVariable(name, &length);
 #else
     environ[index] = p;
 #endif
 
     /*
-     * Replace the old value with the new value in the cache.
-     */
-
-    ReplaceString(oldValue, p);
-
-    /*
-     * Update all of the interpreters.
+     * Watch out for versions of putenv that copy the string (e.g. VC++).
+     * In this case we need to free the string immediately.  Otherwise
+     * update the string in the cache.
      */
 
-    /* CYGNUS LOCAL: The original code was bogus.  If we are being
-       called because of a trace on the env array, then the call to
-       Tcl_SetVar2 would free value.  We avoid that by checking
-       whether the value is the same before calling Tcl_SetVar2.
-
-       NOTE: This is not necessary in tcl8.1a2 which handles this in a
-       completely different, and better, way.  */
-
-    for (eiPtr= firstInterpPtr; eiPtr != NULL; eiPtr = eiPtr->nextPtr) {
-       CONST char *v;
-
-       v = Tcl_GetVar2(eiPtr->interp, "env", (char *) name, TCL_GLOBAL_ONLY);
-       if (v == NULL || (v != value && strcmp (v, value) != 0)) {
-           (void) Tcl_SetVar2(eiPtr->interp, "env", (char *) name,
-                   (char *) value, TCL_GLOBAL_ONLY);
-       }
+    if ((index != -1) && (environ[index] == p)) {
+       ReplaceString(oldValue, p);
     }
 
+    Tcl_MutexUnlock(&envMutex);
 }
 \f
 /*
@@ -347,8 +331,9 @@ TclSetEnv(name, value)
 int
 Tcl_PutEnv(string)
     CONST char *string;                /* Info about environment variable in the
-                                * form NAME=value. */
+                                * form NAME=value. (native) */
 {
+    Tcl_DString nameString;   
     int nameLength;
     char *name, *value;
 
@@ -357,23 +342,24 @@ Tcl_PutEnv(string)
     }
 
     /*
-     * Separate the string into name and value parts, then call
-     * TclSetEnv to do all of the real work.
+     * First convert the native string to UTF.  Then separate the
+     * string into name and value parts, and call TclSetEnv to do
+     * all of the real work.
      */
 
-    value = strchr(string, '=');
+    name = Tcl_ExternalToUtfDString(NULL, string, -1, &nameString);
+    value = strchr(name, '=');
     if (value == NULL) {
        return 0;
     }
-    nameLength = value - string;
+    nameLength = value - name;
     if (nameLength == 0) {
        return 0;
     }
-    name = (char *) ckalloc((unsigned) nameLength+1);
-    memcpy((VOID *) name, (VOID *) string, (size_t) nameLength);
-    name[nameLength] = 0;
+
+    value[0] = '\0';
     TclSetEnv(name, value+1);
-    ckfree(name);
+    Tcl_DStringFree(&nameString);
     return 0;
 }
 \f
@@ -399,24 +385,20 @@ Tcl_PutEnv(string)
 
 void
 TclUnsetEnv(name)
-    CONST char *name;                  /* Name of variable to remove. */
+    CONST char *name;          /* Name of variable to remove (UTF-8). */
 {
-    EnvInterp *eiPtr;
     char *oldValue;
-    int length, index;
+    unsigned int length;
+    int index;
 #ifdef USE_PUTENV
+    Tcl_DString envString;
     char *string;
 #else
     char **envPtr;
 #endif
 
-#ifdef MAC_TCL
-    if (environ == NULL) {
-       environSize = TclMacCreateEnv();
-    }
-#endif
-
-    index = FindVariable(name, &length);
+    Tcl_MutexLock(&envMutex);
+    index = TclpFindVariable(name, &length);
 
     /*
      * First make sure that the environment variable exists to avoid
@@ -424,6 +406,7 @@ TclUnsetEnv(name)
      */
     
     if (index == -1) {
+       Tcl_MutexUnlock(&envMutex);
        return;
     }
     /*
@@ -442,8 +425,23 @@ TclUnsetEnv(name)
     memcpy((VOID *) string, (VOID *) name, (size_t) length);
     string[length] = '=';
     string[length+1] = '\0';
+    
+    Tcl_UtfToExternalDString(NULL, string, -1, &envString);
+    string = ckrealloc(string, (unsigned) (Tcl_DStringLength(&envString)+1));
+    strcpy(string, Tcl_DStringValue(&envString));
+    Tcl_DStringFree(&envString);
+
     putenv(string);
-    ckfree(string);
+
+    /*
+     * Watch out for versions of putenv that copy the string (e.g. VC++).
+     * In this case we need to free the string immediately.  Otherwise
+     * update the string in the cache.
+     */
+
+    if (environ[index] == string) {
+       ReplaceString(oldValue, string);
+    }
 #else
     for (envPtr = environ+index+1; ; envPtr++) {
        envPtr[-1] = *envPtr;
@@ -451,34 +449,25 @@ TclUnsetEnv(name)
            break;
        }
     }
-#endif
-
-    /*
-     * Replace the old value in the cache.
-     */
-
     ReplaceString(oldValue, NULL);
+#endif
 
-    /*
-     * Update all of the interpreters.
-     */
-
-    for (eiPtr = firstInterpPtr; eiPtr != NULL; eiPtr = eiPtr->nextPtr) {
-       (void) Tcl_UnsetVar2(eiPtr->interp, "env", (char *) name,
-               TCL_GLOBAL_ONLY);
-    }
+    Tcl_MutexUnlock(&envMutex);
 }
 \f
 /*
- *----------------------------------------------------------------------
+ *---------------------------------------------------------------------------
  *
  * TclGetEnv --
  *
  *     Retrieve the value of an environment variable.
  *
  * Results:
- *     Returns a pointer to a static string in the environment,
- *     or NULL if the value was not found.
+ *     The result is a pointer to a string specifying the value of the
+ *     environment variable, or NULL if that environment variable does
+ *     not exist.  Storage for the result string is allocated in valuePtr;
+ *     the caller must call Tcl_DStringFree() when the result is no
+ *     longer needed.
  *
  * Side effects:
  *     None.
@@ -487,23 +476,36 @@ TclUnsetEnv(name)
  */
 
 char *
-TclGetEnv(name)
-    CONST char *name;          /* Name of variable to find. */
+TclGetEnv(name, valuePtr)
+    CONST char *name;          /* Name of environment variable to find
+                                * (UTF-8). */
+    Tcl_DString *valuePtr;     /* Uninitialized or free DString in which
+                                * the value of the environment variable is
+                                * stored. */
 {
     int length, index;
+    char *result;
 
-#ifdef MAC_TCL
-    if (environ == NULL) {
-       environSize = TclMacCreateEnv();
-    }
-#endif
-
-    index = FindVariable(name, &length);
-    if ((index != -1) &&  (*(environ[index]+length) == '=')) {
-       return environ[index]+length+1;
-    } else {
-       return NULL;
+    Tcl_MutexLock(&envMutex);
+    index = TclpFindVariable(name, &length);
+    result = NULL;
+    if (index != -1) {
+       Tcl_DString envStr;
+       
+       result = Tcl_ExternalToUtfDString(NULL, environ[index], -1, &envStr);
+       result += length;
+       if (*result == '=') {
+           result++;
+           Tcl_DStringInit(valuePtr);
+           Tcl_DStringAppend(valuePtr, result, -1);
+           result = Tcl_DStringValue(valuePtr);
+       } else {
+           result = NULL;
+       }
+       Tcl_DStringFree(&envStr);
     }
+    Tcl_MutexUnlock(&envMutex);
+    return result;
 }
 \f
 /*
@@ -512,9 +514,8 @@ TclGetEnv(name)
  * EnvTraceProc --
  *
  *     This procedure is invoked whenever an environment variable
- *     is modified or deleted.  It propagates the change to the
- *     "environ" array and to any other interpreters for whom
- *     we're managing an "env" array.
+ *     is read, modified or deleted.  It propagates the change to the global
+ *     "environ" array.
  *
  * Results:
  *     Always returns NULL to indicate success.
@@ -535,38 +536,24 @@ EnvTraceProc(clientData, interp, name1, name2, flags)
     Tcl_Interp *interp;                /* Interpreter whose "env" variable is
                                 * being modified. */
     char *name1;               /* Better be "env". */
-    char *name2;               /* Name of variable being modified, or
-                                * NULL if whole array is being deleted. */
+    char *name2;               /* Name of variable being modified, or NULL
+                                * if whole array is being deleted (UTF-8). */
     int flags;                 /* Indicates what's happening. */
 {
     /*
-     * First see if the whole "env" variable is being deleted.  If
-     * so, just forget about this interpreter.
+     * For array traces, let TclSetupEnv do all the work.
      */
 
-    if (name2 == NULL) {
-       register EnvInterp *eiPtr, *prevPtr;
+    if (flags & TCL_TRACE_ARRAY) {
+       TclSetupEnv(interp);
+       return NULL;
+    }
 
-       if ((flags & (TCL_TRACE_UNSETS|TCL_TRACE_DESTROYED))
-               != (TCL_TRACE_UNSETS|TCL_TRACE_DESTROYED)) {
-           panic("EnvTraceProc called with confusing arguments");
-       }
-       eiPtr = firstInterpPtr;
-       if (eiPtr->interp == interp) {
-           firstInterpPtr = eiPtr->nextPtr;
-       } else {
-           for (prevPtr = eiPtr, eiPtr = eiPtr->nextPtr; ;
-                   prevPtr = eiPtr, eiPtr = eiPtr->nextPtr) {
-               if (eiPtr == NULL) {
-                   panic("EnvTraceProc couldn't find interpreter");
-               }
-               if (eiPtr->interp == interp) {
-                   prevPtr->nextPtr = eiPtr->nextPtr;
-                   break;
-               }
-           }
-       }
-       ckfree((char *) eiPtr);
+    /*
+     * If name2 is NULL, then return and do nothing.
+     */
+     
+    if (name2 == NULL) {
        return NULL;
     }
 
@@ -575,9 +562,32 @@ EnvTraceProc(clientData, interp, name1, name2, flags)
      */
 
     if (flags & TCL_TRACE_WRITES) {
-       TclSetEnv(name2, Tcl_GetVar2(interp, "env", name2, TCL_GLOBAL_ONLY));
+       char *value;
+       
+       value = Tcl_GetVar2(interp, "env", name2, TCL_GLOBAL_ONLY);
+       TclSetEnv(name2, value);
     }
 
+    /*
+     * If a value is being read, call TclGetEnv to do all of the work.
+     */
+
+    if (flags & TCL_TRACE_READS) {
+       Tcl_DString valueString;
+       char *value;
+
+       value = TclGetEnv(name2, &valueString);
+       if (value == NULL) {
+           return "no such variable";
+       }
+       Tcl_SetVar2(interp, name1, name2, value, 0);
+       Tcl_DStringFree(&valueString);
+    }
+
+    /*
+     * For unset traces, let TclUnsetEnv do all the work.
+     */
+
     if (flags & TCL_TRACE_UNSETS) {
        TclUnsetEnv(name2);
     }
@@ -646,7 +656,7 @@ ReplaceString(oldStr, newStr)
         * We need to grow the cache in order to hold the new string.
         */
 
-       newCache = (char **) ckalloc((size_t) allocatedSize);
+       newCache = (char **) ckalloc((unsigned) allocatedSize);
         (VOID *) memset(newCache, (int) 0, (size_t) allocatedSize);
         
        if (environCache) {
@@ -664,50 +674,6 @@ ReplaceString(oldStr, newStr)
 /*
  *----------------------------------------------------------------------
  *
- * FindVariable --
- *
- *     Locate the entry in environ for a given name.
- *
- * Results:
- *     The return value is the index in environ of an entry with the
- *     name "name", or -1 if there is no such entry.   The integer at
- *     *lengthPtr is filled in with the length of name (if a matching
- *     entry is found) or the length of the environ array (if no matching
- *     entry is found).
- *
- * Side effects:
- *     None.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-FindVariable(name, lengthPtr)
-    CONST char *name;          /* Name of desired environment variable. */
-    int *lengthPtr;            /* Used to return length of name (for
-                                * successful searches) or number of non-NULL
-                                * entries in environ (for unsuccessful
-                                * searches). */
-{
-    int i;
-    register CONST char *p1, *p2;
-
-    for (i = 0, p1 = environ[i]; p1 != NULL; i++, p1 = environ[i]) {
-       for (p2 = name; *p2 == *p1; p1++, p2++) {
-           /* NULL loop body. */
-       }
-       if ((*p1 == '=') && (*p2 == '\0')) {
-           *lengthPtr = p2-name;
-           return i;
-       }
-    }
-    *lengthPtr = i;
-    return -1;
-}
-\f
-/*
- *----------------------------------------------------------------------
- *
  * TclFinalizeEnvironment --
  *
  *     This function releases any storage allocated by this module
@@ -827,3 +793,4 @@ TclCygwin32Putenv(str)
 
 #endif /* __CYGWIN__ */
 /* END CYGNUS LOCAL */
+
index b8fda1a..e340c40 100644 (file)
@@ -4,7 +4,8 @@
  *     This file contains routines for converting file names betwen
  *     native and network form.
  *
- * Copyright (c) 1995-1996 Sun Microsystems, Inc.
+ * Copyright (c) 1995-1998 Sun Microsystems, Inc.
+ * Copyright (c) 1998-1999 by Scriptics Corporation.
  *
  * See the file "license.terms" for information on usage and redistribution
  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 #include "tclRegexp.h"
 
 /*
- * This variable indicates whether the cleanup procedure has been
- * registered for this file yet.
- */
-
-static int initialized = 0;
-
-/*
  * The following regular expression matches the root portion of a Windows
  * absolute or volume relative path.  It will match both UNC and drive relative
  * paths.
  */
 
-#define WIN_ROOT_PATTERN "^(([a-zA-Z]:)|[/\\][/\\]+([^/\\]+)[/\\]+([^/\\]+)|([/\\]))([/\\])*"
+#define WIN_ROOT_PATTERN "^(([a-zA-Z]:)|[/\\\\][/\\\\]+([^/\\\\]+)[/\\\\]+([^/\\\\]+)|([/\\\\]))([/\\\\])*"
 
 /*
  * The following regular expression matches the root portion of a Macintosh
@@ -44,8 +38,12 @@ static int initialized = 0;
  * for use in filename matching.
  */
 
-static regexp *winRootPatternPtr = NULL;
-static regexp *macRootPatternPtr = NULL;
+typedef struct ThreadSpecificData {
+    int initialized;
+    Tcl_Obj *macRootPatternPtr;
+} ThreadSpecificData;
+
+static Tcl_ThreadDataKey dataKey;
 
 /*
  * The following variable is set in the TclPlatformInit call to one
@@ -55,26 +53,63 @@ static regexp *macRootPatternPtr = NULL;
 TclPlatformType tclPlatform = TCL_PLATFORM_UNIX;
 
 /*
+ * The "globParameters" argument of the globbing functions is an 
+ * or'ed combination of the following values:
+ */
+
+#define GLOBMODE_NO_COMPLAIN      1
+#define GLOBMODE_JOIN             2
+#define GLOBMODE_DIR              4
+
+/*
  * Prototypes for local procedures defined in this file:
  */
 
 static char *          DoTildeSubst _ANSI_ARGS_((Tcl_Interp *interp,
-                           char *user, Tcl_DString *resultPtr));
-static char *          ExtractWinRoot _ANSI_ARGS_((char *path,
-                           Tcl_DString *resultPtr, int offset));
+                           CONST char *user, Tcl_DString *resultPtr));
+static CONST char *    ExtractWinRoot _ANSI_ARGS_((CONST char *path,
+                           Tcl_DString *resultPtr, int offset, Tcl_PathType *typePtr));
 static void            FileNameCleanup _ANSI_ARGS_((ClientData clientData));
+static void            FileNameInit _ANSI_ARGS_((void));
 static int             SkipToChar _ANSI_ARGS_((char **stringPtr,
                            char *match));
-static char *          SplitMacPath _ANSI_ARGS_((char *path,
+static char *          SplitMacPath _ANSI_ARGS_((CONST char *path,
                            Tcl_DString *bufPtr));
-static char *          SplitWinPath _ANSI_ARGS_((char *path,
+static char *          SplitWinPath _ANSI_ARGS_((CONST char *path,
                            Tcl_DString *bufPtr));
-static char *          SplitUnixPath _ANSI_ARGS_((char *path,
+static char *          SplitUnixPath _ANSI_ARGS_((CONST char *path,
                            Tcl_DString *bufPtr));
 \f
 /*
  *----------------------------------------------------------------------
  *
+ * FileNameInit --
+ *
+ *     This procedure initializes the patterns used by this module.
+ *
+ * Results:
+ *     None.
+ *
+ * Side effects:
+ *     Compiles the regular expressions.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+FileNameInit()
+{
+    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
+    if (!tsdPtr->initialized) {
+       tsdPtr->initialized = 1;
+       tsdPtr->macRootPatternPtr = Tcl_NewStringObj(MAC_ROOT_PATTERN, -1);
+       Tcl_CreateThreadExitHandler(FileNameCleanup, NULL);
+    }
+}
+\f
+/*
+ *----------------------------------------------------------------------
+ *
  * FileNameCleanup --
  *
  *     This procedure is a Tcl_ExitProc used to clean up the static
@@ -93,15 +128,9 @@ static void
 FileNameCleanup(clientData)
     ClientData clientData;     /* Not used. */
 {
-    if (winRootPatternPtr != NULL) {
-       ckfree((char *)winRootPatternPtr);
-        winRootPatternPtr = (regexp *) NULL;
-    }
-    if (macRootPatternPtr != NULL) {
-       ckfree((char *)macRootPatternPtr);
-        macRootPatternPtr = (regexp *) NULL;
-    }
-    initialized = 0;
+    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
+    Tcl_DecrRefCount(tsdPtr->macRootPatternPtr);
+    tsdPtr->initialized = 0;
 }
 \f
 /*
@@ -124,55 +153,87 @@ FileNameCleanup(clientData)
  *----------------------------------------------------------------------
  */
 
-static char *
-ExtractWinRoot(path, resultPtr, offset)
-    char *path;                        /* Path to parse. */
+static CONST char *
+ExtractWinRoot(path, resultPtr, offset, typePtr)
+    CONST char *path;          /* Path to parse. */
     Tcl_DString *resultPtr;    /* Buffer to hold result. */
     int offset;                        /* Offset in buffer where result should be
                                 * stored. */
+    Tcl_PathType *typePtr;     /* Where to store pathType result */
 {
-    int length;
+    FileNameInit();
 
-    /*
-     * Initialize the path name parser for Windows path names.
-     */
 
-    if (winRootPatternPtr == NULL) {
-       winRootPatternPtr = TclRegComp(WIN_ROOT_PATTERN);
-       if (!initialized) {
-           Tcl_CreateExitHandler(FileNameCleanup, NULL);
-           initialized = 1;
-       }
+    if (path[0] == '/' || path[0] == '\\') {
+       /* Might be a UNC or Vol-Relative path */
+       char *host, *share, *tail;
+       int hlen, slen;
+       if (path[1] != '/' && path[1] != '\\') {
+           Tcl_DStringSetLength(resultPtr, offset);
+           *typePtr = TCL_PATH_VOLUME_RELATIVE;
+           Tcl_DStringAppend(resultPtr, "/", 1);
+           return &path[1];
     }
+       host = (char *)&path[2];
 
-    /*
-     * Match the root portion of a Windows path name.
-     */
+       /* Skip seperators */
+       while (host[0] == '/' || host[0] == '\\') host++;
 
-    if (!TclRegExec(winRootPatternPtr, path, path)) {
-       return path;
-    }
+       for (hlen = 0; host[hlen];hlen++) {
+           if (host[hlen] == '/' || host[hlen] == '\\')
+               break;
+       }
+       if (host[hlen] == 0 || host[hlen+1] == 0) {
+           *typePtr = TCL_PATH_VOLUME_RELATIVE;
+           Tcl_DStringAppend(resultPtr, "/", 1);
+           return &path[2];
+       }
+       Tcl_DStringSetLength(resultPtr, offset);
+       share = &host[hlen];
 
-    Tcl_DStringSetLength(resultPtr, offset);
+       /* Skip seperators */
+       while (share[0] == '/' || share[0] == '\\') share++;
 
-    if (winRootPatternPtr->startp[2] != NULL) {
-       Tcl_DStringAppend(resultPtr, winRootPatternPtr->startp[2], 2);
-       if (winRootPatternPtr->startp[6] != NULL) {
-           Tcl_DStringAppend(resultPtr, "/", 1);
+       for (slen = 0; share[slen];slen++) {
+           if (share[slen] == '/' || share[slen] == '\\')
+               break;
        }
-    } else if (winRootPatternPtr->startp[4] != NULL) {
        Tcl_DStringAppend(resultPtr, "//", 2);
-       length = winRootPatternPtr->endp[3]
-           - winRootPatternPtr->startp[3];
-       Tcl_DStringAppend(resultPtr, winRootPatternPtr->startp[3], length);
+       Tcl_DStringAppend(resultPtr, host, hlen);
        Tcl_DStringAppend(resultPtr, "/", 1);
-       length = winRootPatternPtr->endp[4]
-           - winRootPatternPtr->startp[4];
-       Tcl_DStringAppend(resultPtr, winRootPatternPtr->startp[4], length);
+       Tcl_DStringAppend(resultPtr, share, slen);
+
+       tail = &share[slen];
+
+       /* Skip seperators */
+       while (tail[0] == '/' || tail[0] == '\\') tail++;
+
+       *typePtr = TCL_PATH_ABSOLUTE;
+       return tail;
+    } else if (path[1] == ':') {
+       /* Might be a drive sep */
+       Tcl_DStringSetLength(resultPtr, offset);
+
+       if (path[2] != '/' && path[2] != '\\') {
+           *typePtr = TCL_PATH_VOLUME_RELATIVE;
+           Tcl_DStringAppend(resultPtr, path, 2);
+           return &path[2];
     } else {
+           char *tail = (char*)&path[3];
+
+           /* Skip seperators */
+           while (tail[0] == '/' || tail[0] == '\\') tail++;
+
+           *typePtr = TCL_PATH_ABSOLUTE;
+           Tcl_DStringAppend(resultPtr, path, 2);
        Tcl_DStringAppend(resultPtr, "/", 1);
+
+    return tail;
+       }
+    } else {
+       *typePtr = TCL_PATH_RELATIVE;
+       return path;
     }
-    return winRootPatternPtr->endp[0];
 }
 \f
 /*
@@ -197,7 +258,9 @@ Tcl_PathType
 Tcl_GetPathType(path)
     char *path;
 {
+    ThreadSpecificData *tsdPtr;
     Tcl_PathType type = TCL_PATH_ABSOLUTE;
+    Tcl_RegExp re;
 
     switch (tclPlatform) {
        case TCL_PLATFORM_UNIX:
@@ -214,50 +277,37 @@ Tcl_GetPathType(path)
            if (path[0] == ':') {
                type = TCL_PATH_RELATIVE;
            } else if (path[0] != '~') {
+               tsdPtr = TCL_TSD_INIT(&dataKey);
 
                /*
                 * Since we have eliminated the easy cases, use the
                 * root pattern to look for the other types.
                 */
 
-               if (!macRootPatternPtr) {
-                   macRootPatternPtr = TclRegComp(MAC_ROOT_PATTERN);
-                   if (!initialized) {
-                       Tcl_CreateExitHandler(FileNameCleanup, NULL);
-                       initialized = 1;
-                   }
-               }
-               if (!TclRegExec(macRootPatternPtr, path, path)
-                       || (macRootPatternPtr->startp[2] != NULL)) {
+               FileNameInit();
+               re = Tcl_GetRegExpFromObj(NULL, tsdPtr->macRootPatternPtr,
+                       REG_ADVANCED);
+
+               if (!Tcl_RegExpExec(NULL, re, path, path)) {
                    type = TCL_PATH_RELATIVE;
+               } else {
+                   char *unixRoot, *dummy;
+
+                   Tcl_RegExpRange(re, 2, &unixRoot, &dummy);
+                   if (unixRoot) {
+                       type = TCL_PATH_RELATIVE;
+                   }
                }
            }
            break;
        
        case TCL_PLATFORM_WINDOWS:
            if (path[0] != '~') {
+               Tcl_DString ds;
 
-               /*
-                * Since we have eliminated the easy cases, check for
-                * drive relative paths using the regular expression.
-                */
-
-               if (!winRootPatternPtr) {
-                   winRootPatternPtr = TclRegComp(WIN_ROOT_PATTERN);
-                   if (!initialized) {
-                       Tcl_CreateExitHandler(FileNameCleanup, NULL);
-                       initialized = 1;
-                   }
-               }
-               if (TclRegExec(winRootPatternPtr, path, path)) {
-                   if (winRootPatternPtr->startp[5]
-                           || (winRootPatternPtr->startp[2]
-                                   && !(winRootPatternPtr->startp[6]))) {
-                       type = TCL_PATH_VOLUME_RELATIVE;
-                   }
-               } else {
-                   type = TCL_PATH_RELATIVE;
-               }
+               Tcl_DStringInit(&ds);
+               (VOID)ExtractWinRoot(path, &ds, 0, &type);
+               Tcl_DStringFree(&ds);
            }
            break;
     }
@@ -292,7 +342,7 @@ Tcl_GetPathType(path)
 
 void
 Tcl_SplitPath(path, argcPtr, argvPtr)
-    char *path;                        /* Pointer to string containing a path. */
+    CONST char *path;          /* Pointer to string containing a path. */
     int *argcPtr;              /* Pointer to location to fill in with
                                 * the number of elements in the path. */
     char ***argvPtr;           /* Pointer to place to store pointer to array
@@ -301,6 +351,7 @@ Tcl_SplitPath(path, argcPtr, argvPtr)
     int i, size;
     char *p;
     Tcl_DString buffer;
+
     Tcl_DStringInit(&buffer);
 
     /*
@@ -385,16 +436,29 @@ Tcl_SplitPath(path, argcPtr, argvPtr)
 
 static char *
 SplitUnixPath(path, bufPtr)
-    char *path;                        /* Pointer to string containing a path. */
+    CONST char *path;          /* Pointer to string containing a path. */
     Tcl_DString *bufPtr;       /* Pointer to DString to use for the result. */
 {
     int length;
-    char *p, *elementStart;
+    CONST char *p, *elementStart;
 
     /*
      * Deal with the root directory as a special case.
      */
 
+#ifdef __QNX__
+    /*
+     * Check for QNX //<node id> prefix
+     */
+    if ((path[0] == '/') && (path[1] == '/')
+           && isdigit(UCHAR(path[2]))) { /* INTL: digit */
+       path += 3;
+       while (isdigit(UCHAR(*path))) { /* INTL: digit */
+           ++path;
+       }
+    }
+#endif
+
     if (path[0] == '/') {
        Tcl_DStringAppend(bufPtr, "/", 2);
        p = path+1;
@@ -447,13 +511,14 @@ SplitUnixPath(path, bufPtr)
 
 static char *
 SplitWinPath(path, bufPtr)
-    char *path;                        /* Pointer to string containing a path. */
+    CONST char *path;          /* Pointer to string containing a path. */
     Tcl_DString *bufPtr;       /* Pointer to DString to use for the result. */
 {
     int length;
-    char *p, *elementStart;
+    CONST char *p, *elementStart;
+    Tcl_PathType type = TCL_PATH_ABSOLUTE;
 
-    p = ExtractWinRoot(path, bufPtr, 0);
+    p = ExtractWinRoot(path, bufPtr, 0, &type);
 
     /*
      * Terminate the root portion, if we matched something.
@@ -505,88 +570,98 @@ SplitWinPath(path, bufPtr)
 
 static char *
 SplitMacPath(path, bufPtr)
-    char *path;                        /* Pointer to string containing a path. */
+    CONST char *path;          /* Pointer to string containing a path. */
     Tcl_DString *bufPtr;       /* Pointer to DString to use for the result. */
 {
     int isMac = 0;             /* 1 if is Mac-style, 0 if Unix-style path. */
     int i, length;
-    char *p, *elementStart;
+    CONST char *p, *elementStart;
+    Tcl_RegExp re;
+    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
 
     /*
      * Initialize the path name parser for Macintosh path names.
      */
 
-    if (macRootPatternPtr == NULL) {
-       macRootPatternPtr = TclRegComp(MAC_ROOT_PATTERN);
-       if (!initialized) {
-           Tcl_CreateExitHandler(FileNameCleanup, NULL);
-           initialized = 1;
-       }
-    }
+    FileNameInit();
 
     /*
      * Match the root portion of a Mac path name.
      */
 
     i = 0;                     /* Needed only to prevent gcc warnings. */
-    if (TclRegExec(macRootPatternPtr, path, path) == 1) {
+
+    re = Tcl_GetRegExpFromObj(NULL, tsdPtr->macRootPatternPtr, REG_ADVANCED);
+
+    if (Tcl_RegExpExec(NULL, re, path, path) == 1) {
+       char *start, *end;
+
        /*
         * Treat degenerate absolute paths like / and /../.. as
         * Mac relative file names for lack of anything else to do.
         */
 
-       if (macRootPatternPtr->startp[2] != NULL) {
+       Tcl_RegExpRange(re, 2, &start, &end);
+       if (start) {
            Tcl_DStringAppend(bufPtr, ":", 1);
-           Tcl_DStringAppend(bufPtr, path, macRootPatternPtr->endp[0]
-                   - macRootPatternPtr->startp[0] + 1);
+           Tcl_RegExpRange(re, 0, &start, &end);
+           Tcl_DStringAppend(bufPtr, path, end - start + 1);
            return Tcl_DStringValue(bufPtr);
        }
 
-       if (macRootPatternPtr->startp[5] != NULL) {
-
+       Tcl_RegExpRange(re, 5, &start, &end);
+       if (start) {
            /*
             * Unix-style tilde prefixed paths.
             */
 
            isMac = 0;
            i = 5;
-       } else if (macRootPatternPtr->startp[7] != NULL) {
-
-           /*
-            * Mac-style tilde prefixed paths.
-            */
+       } else {
+           Tcl_RegExpRange(re, 7, &start, &end);
+           if (start) {
+               /*
+                * Mac-style tilde prefixed paths.
+                */
 
-           isMac = 1;
-           i = 7;
-       } else if (macRootPatternPtr->startp[10] != NULL) {
+               isMac = 1;
+               i = 7;
+           } else {
+               Tcl_RegExpRange(re, 10, &start, &end);
+               if (start) {
 
-           /*
-            * Normal Unix style paths.
-            */
+                   /*
+                    * Normal Unix style paths.
+                    */
 
-           isMac = 0;
-           i = 10;
-       } else if (macRootPatternPtr->startp[12] != NULL) {
+                   isMac = 0;
+                   i = 10;
+               } else {
+                   Tcl_RegExpRange(re, 12, &start, &end);
+                   if (start) {
 
-           /*
-            * Normal Mac style paths.
-            */
+                       /*
+                        * Normal Mac style paths.
+                        */
 
-           isMac = 1;
-           i = 12;
+                       isMac = 1;
+                       i = 12;
+                   }
+               }
+           }
        }
 
-       length = macRootPatternPtr->endp[i]
-           - macRootPatternPtr->startp[i];
+       Tcl_RegExpRange(re, i, &start, &end);
+       length = end - start;
 
        /*
         * Append the element and terminate it with a : and a null.  Note that
         * we are forcing the DString to contain an extra null at the end.
         */
 
-       Tcl_DStringAppend(bufPtr, macRootPatternPtr->startp[i], length);
+       Tcl_DStringAppend(bufPtr, start, length);
        Tcl_DStringAppend(bufPtr, ":", 2);
-       p = macRootPatternPtr->endp[i];
+       p = end;
     } else {
        isMac = (strchr(path, ':') != NULL);
        p = path;
@@ -690,7 +765,9 @@ Tcl_JoinPath(argc, argv, resultPtr)
 {
     int oldLength, length, i, needsSep;
     Tcl_DString buffer;
-    char *p, c, *dest;
+    char c, *dest;
+    CONST char *p;
+    Tcl_PathType type = TCL_PATH_ABSOLUTE;
 
     Tcl_DStringInit(&buffer);
     oldLength = Tcl_DStringLength(resultPtr);
@@ -706,6 +783,18 @@ Tcl_JoinPath(argc, argv, resultPtr)
                 * beginning of the path.
                 */
 
+#ifdef __QNX__
+               /*
+                * Check for QNX //<node id> prefix
+                */
+               if (*p && (strlen(p) > 3) && (p[0] == '/') && (p[1] == '/')
+                       && isdigit(UCHAR(p[2]))) { /* INTL: digit */
+                   p += 3;
+                   while (isdigit(UCHAR(*p))) { /* INTL: digit */
+                       ++p;
+                   }
+               }
+#endif
                if (*p == '/') {
                    Tcl_DStringSetLength(resultPtr, oldLength);
                    Tcl_DStringAppend(resultPtr, "/", 1);
@@ -767,7 +856,7 @@ Tcl_JoinPath(argc, argv, resultPtr)
             */
 
            for (i = 0; i < argc; i++) {
-               p = ExtractWinRoot(argv[i], resultPtr, oldLength);
+               p = ExtractWinRoot(argv[i], resultPtr, oldLength, &type);
                length = Tcl_DStringLength(resultPtr);
                
                /*
@@ -884,25 +973,27 @@ Tcl_JoinPath(argc, argv, resultPtr)
 }
 \f
 /*
- *----------------------------------------------------------------------
+ *---------------------------------------------------------------------------
  *
  * Tcl_TranslateFileName --
  *
  *     Converts a file name into a form usable by the native system
- *     interfaces.  If the name starts with a tilde, it will produce
- *     a name where the tilde and following characters have been
- *     replaced by the home directory location for the named user.
+ *     interfaces.  If the name starts with a tilde, it will produce a
+ *     name where the tilde and following characters have been replaced
+ *     by the home directory location for the named user.
  *
  * Results:
- *     The result is a pointer to a static string containing
- *     the new name.  If there was an error in processing the
- *     name, then an error message is left in interp->result
- *     and the return value is NULL.  The result will be stored
- *     in bufferPtr; the caller must call Tcl_DStringFree(bufferPtr)
- *     to free the name if the return value was not NULL.
+ *     The return value is a pointer to a string containing the name
+ *     after tilde substitution.  If there was no tilde substitution,
+ *     the return value is a pointer to a copy of the original string.
+ *     If there was an error in processing the name, then an error
+ *     message is left in the interp's result (if interp was not NULL)
+ *     and the return value is NULL.  Space for the return value is
+ *     allocated in bufferPtr; the caller must call Tcl_DStringFree()
+ *     to free the space if the return value was not NULL.
  *
  * Side effects:
- *     Information may be left in bufferPtr.
+ *     None.
  *
  *----------------------------------------------------------------------
  */
@@ -911,13 +1002,12 @@ char *
 Tcl_TranslateFileName(interp, name, bufferPtr)
     Tcl_Interp *interp;                /* Interpreter in which to store error
                                 * message (if necessary). */
-    char *name;                        /* File name, which may begin with "~"
-                                * (to indicate current user's home directory)
-                                * or "~<user>" (to indicate any user's
-                                * home directory). */
-    Tcl_DString *bufferPtr;    /* May be used to hold result.  Must not hold
-                                * anything at the time of the call, and need
-                                * not even be initialized. */
+    char *name;                        /* File name, which may begin with "~" (to
+                                * indicate current user's home directory) or
+                                * "~<user>" (to indicate any user's home
+                                * directory). */
+    Tcl_DString *bufferPtr;    /* Uninitialized or free DString filled
+                                * with name after tilde substitution. */
 {
     register char *p;
 
@@ -930,11 +1020,11 @@ Tcl_TranslateFileName(interp, name, bufferPtr)
        char **argv;
        Tcl_DString temp;
 
-       Tcl_SplitPath(name, &argc, &argv);
+       Tcl_SplitPath(name, &argc, (char ***) &argv);
        
        /*
-        * Strip the trailing ':' off of a Mac path
-        * before passing the user name to DoTildeSubst.
+        * Strip the trailing ':' off of a Mac path before passing the user
+        * name to DoTildeSubst.
         */
 
        if (tclPlatform == TCL_PLATFORM_MAC) {
@@ -950,12 +1040,12 @@ Tcl_TranslateFileName(interp, name, bufferPtr)
            return NULL;
        }
        Tcl_DStringInit(bufferPtr);
-       Tcl_JoinPath(argc, argv, bufferPtr);
+       Tcl_JoinPath(argc, (char **) argv, bufferPtr);
        Tcl_DStringFree(&temp);
        ckfree((char*)argv);
     } else {
        Tcl_DStringInit(bufferPtr);
-       Tcl_JoinPath(1, &name, bufferPtr);
+       Tcl_JoinPath(1, (char **) &name, bufferPtr);
     }
 
     /*
@@ -1033,15 +1123,12 @@ TclGetExtension(name)
     }
 
     /*
-     * Back up to the first period in a series of contiguous dots.
-     * This is needed so foo..o will be split on the first dot.
+     * In earlier versions, we used to back up to the first period in a series
+     * so that "foo..o" would be split into "foo" and "..o".  This is a
+     * confusing and usually incorrect behavior, so now we split at the last
+     * period in the name.
      */
 
-    if (p != NULL) {
-       while ((p > name) && *(p-1) == '.') {
-           p--;
-       }
-    }
     return p;
 }
 \f
@@ -1056,9 +1143,10 @@ TclGetExtension(name)
  * Results:
  *     The result is a pointer to a static string containing the home
  *     directory in native format.  If there was an error in processing
- *     the substitution, then an error message is left in interp->result
- *     and the return value is NULL.  On success, the results are appended
- *     to resultPtr, and the contents of resultPtr are returned.
+ *     the substitution, then an error message is left in the interp's
+ *     result and the return value is NULL.  On success, the results
+ *     are appended to resultPtr, and the contents of resultPtr are
+ *     returned.
  *
  * Side effects:
  *     Information may be left in resultPtr.
@@ -1070,16 +1158,17 @@ static char *
 DoTildeSubst(interp, user, resultPtr)
     Tcl_Interp *interp;                /* Interpreter in which to store error
                                 * message (if necessary). */
-    char *user;                        /* Name of user whose home directory should be
+    CONST char *user;          /* Name of user whose home directory should be
                                 * substituted, or "" for current user. */
-    Tcl_DString *resultPtr;    /* May be used to hold result.  Must not hold
-                                * anything at the time of the call, and need
-                                * not even be initialized. */
+    Tcl_DString *resultPtr;    /* Initialized DString filled with name
+                                * after tilde substitution. */
 {
     char *dir;
 
     if (*user == '\0') {
-       dir = TclGetEnv("HOME");
+       Tcl_DString dirString;
+       
+       dir = TclGetEnv("HOME", &dirString);
        if (dir == NULL) {
            if (interp) {
                Tcl_ResetResult(interp);
@@ -1089,10 +1178,9 @@ DoTildeSubst(interp, user, resultPtr)
            return NULL;
        }
        Tcl_JoinPath(1, &dir, resultPtr);
+       Tcl_DStringFree(&dirString);
     } else {
-       
-       /* lint, TclGetuserHome() always NULL under windows. */
-       if (TclGetUserHome(user, resultPtr) == NULL) {  
+       if (TclpGetUserHome(user, resultPtr) == NULL) { 
            if (interp) {
                Tcl_ResetResult(interp);
                Tcl_AppendResult(interp, "user \"", user, "\" doesn't exist",
@@ -1107,7 +1195,7 @@ DoTildeSubst(interp, user, resultPtr)
 /*
  *----------------------------------------------------------------------
  *
- * Tcl_GlobCmd --
+ * Tcl_GlobObjCmd --
  *
  *     This procedure is invoked to process the "glob" Tcl command.
  *     See the user documentation for details on what it does.
@@ -1123,42 +1211,116 @@ DoTildeSubst(interp, user, resultPtr)
 
        /* ARGSUSED */
 int
-Tcl_GlobCmd(dummy, interp, argc, argv)
+Tcl_GlobObjCmd(dummy, interp, objc, objv)
     ClientData dummy;                  /* Not used. */
     Tcl_Interp *interp;                        /* Current interpreter. */
-    int argc;                          /* Number of arguments. */
-    char **argv;                       /* Argument strings. */
+    int objc;                          /* Number of arguments. */
+    Tcl_Obj *CONST objv[];             /* Argument objects. */
 {
-    int i, noComplain, firstArg;
-    char c;
-    int result = TCL_OK;
-    Tcl_DString buffer;
-    char *separators, *head, *tail;
-
-    noComplain = 0;
-    for (firstArg = 1; (firstArg < argc) && (argv[firstArg][0] == '-');
-           firstArg++) {
-       if (strcmp(argv[firstArg], "-nocomplain") == 0) {
-           noComplain = 1;
-       } else if (strcmp(argv[firstArg], "--") == 0) {
-           firstArg++;
-           break;
-       } else {
-           Tcl_AppendResult(interp, "bad switch \"", argv[firstArg],
-                   "\": must be -nocomplain or --", (char *) NULL);
-           return TCL_ERROR;
+    int index, i, globFlags, pathlength, length, join, dir, result;
+    char *string, *pathOrDir, *separators;
+    Tcl_Obj *typePtr, *resultPtr, *look;
+    Tcl_DString prefix, directory;
+    static char *options[] = {
+       "-directory", "-join", "-nocomplain", "-path", "-types", "--", NULL
+    };
+    enum options {
+       GLOB_DIR, GLOB_JOIN, GLOB_NOCOMPLAIN, GLOB_PATH, GLOB_TYPE, GLOB_LAST
+    };
+    enum pathDirOptions {PATH_NONE = -1 , PATH_GENERAL = 0, PATH_DIR = 1};
+    GlobTypeData *globTypes = NULL;
+
+    globFlags = 0;
+    join = 0;
+    dir = PATH_NONE;
+    pathOrDir = NULL;
+    typePtr = NULL;
+    resultPtr = Tcl_GetObjResult(interp);
+    for (i = 1; i < objc; i++) {
+       if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0, &index)
+               != TCL_OK) {
+           string = Tcl_GetStringFromObj(objv[i], &length);
+           if (string[0] == '-') {
+               /*
+                * It looks like the command contains an option so signal
+                * an error
+                */
+               return TCL_ERROR;
+           } else {
+               /*
+                * This clearly isn't an option; assume it's the first
+                * glob pattern.  We must clear the error
+                */
+               Tcl_ResetResult(interp);
+               break;
+           }
+       }
+       switch (index) {
+           case GLOB_NOCOMPLAIN:                       /* -nocomplain */
+               globFlags |= GLOBMODE_NO_COMPLAIN;
+               break;
+           case GLOB_DIR:                              /* -dir */
+               if (i == (objc-1)) {
+                   Tcl_AppendToObj(resultPtr,
+                           "missing argument to \"-directory\"", -1);
+                   return TCL_ERROR;
+               }
+               if (dir != -1) {
+                   Tcl_AppendToObj(resultPtr,
+                           "\"-directory\" cannot be used with \"-path\"",
+                           -1);
+                   return TCL_ERROR;
+               }
+               dir = PATH_DIR;
+               globFlags |= GLOBMODE_DIR;
+               pathOrDir = Tcl_GetStringFromObj(objv[i+1], &pathlength);
+               i++;
+               break;
+           case GLOB_JOIN:                             /* -join */
+               join = 1;
+               break;
+           case GLOB_PATH:                             /* -path */
+               if (i == (objc-1)) {
+                   Tcl_AppendToObj(resultPtr,
+                           "missing argument to \"-path\"", -1);
+                   return TCL_ERROR;
+               }
+               if (dir != -1) {
+                   Tcl_AppendToObj(resultPtr,
+                           "\"-path\" cannot be used with \"-directory\"",
+                           -1);
+                   return TCL_ERROR;
+               }
+               dir = PATH_GENERAL;
+               pathOrDir = Tcl_GetStringFromObj(objv[i+1], &pathlength);
+               i++;
+               break;
+           case GLOB_TYPE:                             /* -types */
+               if (i == (objc-1)) {
+                   Tcl_AppendToObj(resultPtr,
+                           "missing argument to \"-types\"", -1);
+                   return TCL_ERROR;
+               }
+               typePtr = objv[i+1];
+               if (Tcl_ListObjLength(interp, typePtr, &length) != TCL_OK) {
+                   return TCL_ERROR;
+               }
+               i++;
+               break;
+           case GLOB_LAST:                             /* -- */
+               i++;
+               goto endOfForLoop;
+               break;
        }
     }
-    if (firstArg >= argc) {
-       Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
-               " ?switches? name ?name ...?\"", (char *) NULL);
+    endOfForLoop:
+    if (objc - i < 1) {
+        Tcl_WrongNumArgs(interp, 1, objv, "?switches? name ?name ...?");
        return TCL_ERROR;
     }
 
-    Tcl_DStringInit(&buffer);
-    separators = NULL;         /* Needed only to prevent gcc warnings. */
-    for (i = firstArg; i < argc; i++) {
-       switch (tclPlatform) {
+    separators = NULL;         /* lint. */
+    switch (tclPlatform) {
        case TCL_PLATFORM_UNIX:
            separators = "/";
            break;
@@ -1166,102 +1328,430 @@ Tcl_GlobCmd(dummy, interp, argc, argv)
            separators = "/\\:";
            break;
        case TCL_PLATFORM_MAC:
-           separators = (strchr(argv[i], ':') == NULL) ? "/" : ":";
+           separators = ":";
            break;
-       }
-
-       Tcl_DStringSetLength(&buffer, 0);
+    }
+    if (dir == PATH_GENERAL) {
+       char *last;
 
        /*
-        * Perform tilde substitution, if needed.
+        * Find the last path separator in the path
         */
+       last = pathOrDir + pathlength;
+       for (; last != pathOrDir; last--) {
+           if (strchr(separators, *(last-1)) != NULL) {
+               break;
+           }
+       }
+       if (last == pathOrDir + pathlength) {
+           /* It's really a directory */
+           dir = 1;
+       } else {
+           Tcl_DString pref;
+           char *search, *find;
+           Tcl_DStringInit(&pref);
+           Tcl_DStringInit(&directory);
+           if (last == pathOrDir) {
+               /* The whole thing is a prefix */
+               Tcl_DStringAppend(&pref, pathOrDir, -1);
+               pathOrDir = NULL;
+           } else {
+               /* Have to split off the end */
+               Tcl_DStringAppend(&pref, last, pathOrDir+pathlength-last);
+               Tcl_DStringAppend(&directory, pathOrDir, last-pathOrDir-1);
+               pathOrDir = Tcl_DStringValue(&directory);
+           }
+           /* Need to quote 'prefix' */
+           Tcl_DStringInit(&prefix);
+           search = Tcl_DStringValue(&pref);
+           while ((find = (strpbrk(search, "\\[]*?{}"))) != NULL) {
+               Tcl_DStringAppend(&prefix, search, find-search);
+               Tcl_DStringAppend(&prefix, "\\", 1);
+               Tcl_DStringAppend(&prefix, find, 1);
+               search = find+1;
+               if (*search == '\0') {
+                   break;
+               }
+           }
+           if (*search != '\0') {
+               Tcl_DStringAppend(&prefix, search, -1);
+           }
+           Tcl_DStringFree(&pref);
+       }
+    }
 
-       if (argv[i][0] == '~') {
-           char *p;
-
-           /*
-            * Find the first path separator after the tilde.
-            */
-
-           for (tail = argv[i]; *tail != '\0'; tail++) {
-               if (*tail == '\\') {
-                   if (strchr(separators, tail[1]) != NULL) {
-                       break;
-                   }
-               } else if (strchr(separators, *tail) != NULL) {
+    if (typePtr != NULL) {
+       /* 
+        * The rest of the possible type arguments (except 'd') are
+        * platform specific.  We don't complain when they are used
+        * on an incompatible platform.
+        */
+       Tcl_ListObjLength(interp, typePtr, &length);
+       globTypes = (GlobTypeData*) ckalloc(sizeof(GlobTypeData));
+       globTypes->type = 0;
+       globTypes->perm = 0;
+       globTypes->macType = NULL;
+       globTypes->macCreator = NULL;
+       while(--length >= 0) {
+           int len;
+           char *str;
+           Tcl_ListObjIndex(interp, typePtr, length, &look);
+           str = Tcl_GetStringFromObj(look, &len);
+           if (strcmp("readonly", str) == 0) {
+               globTypes->perm |= TCL_GLOB_PERM_RONLY;
+           } else if (strcmp("hidden", str) == 0) {
+               globTypes->perm |= TCL_GLOB_PERM_HIDDEN;
+           } else if (len == 1) {
+               switch (str[0]) {
+                 case 'r':
+                   globTypes->perm |= TCL_GLOB_PERM_R;
+                   break;
+                 case 'w':
+                   globTypes->perm |= TCL_GLOB_PERM_W;
+                   break;
+                 case 'x':
+                   globTypes->perm |= TCL_GLOB_PERM_X;
+                   break;
+                 case 'b':
+                   globTypes->type |= TCL_GLOB_TYPE_BLOCK;
+                   break;
+                 case 'c':
+                   globTypes->type |= TCL_GLOB_TYPE_CHAR;
+                   break;
+                 case 'd':
+                   globTypes->type |= TCL_GLOB_TYPE_DIR;
+                   break;
+                 case 'p':
+                   globTypes->type |= TCL_GLOB_TYPE_PIPE;
                    break;
+                 case 'f':
+                   globTypes->type |= TCL_GLOB_TYPE_FILE;
+                   break;
+                 case 'l':
+                   globTypes->type |= TCL_GLOB_TYPE_LINK;
+                   break;
+                 case 's':
+                   globTypes->type |= TCL_GLOB_TYPE_SOCK;
+                   break;
+                 default:
+                   goto badTypesArg;
+               }
+           } else if (len == 4) {
+               /* This is assumed to be a MacOS file type */
+               if (globTypes->macType != NULL) {
+                   goto badMacTypesArg;
+               }
+               globTypes->macType = look;
+               Tcl_IncrRefCount(look);
+           } else {
+               Tcl_Obj* item;
+               if ((Tcl_ListObjLength(NULL, look, &len) == TCL_OK) &&
+                       (len == 3)) {
+                   Tcl_ListObjIndex(interp, look, 0, &item);
+                   if (!strcmp("macintosh", Tcl_GetString(item))) {
+                       Tcl_ListObjIndex(interp, look, 1, &item);
+                       if (!strcmp("type", Tcl_GetString(item))) {
+                           Tcl_ListObjIndex(interp, look, 2, &item);
+                           if (globTypes->macType != NULL) {
+                               goto badMacTypesArg;
+                           }
+                           globTypes->macType = item;
+                           Tcl_IncrRefCount(item);
+                           continue;
+                       } else if (!strcmp("creator", Tcl_GetString(item))) {
+                           Tcl_ListObjIndex(interp, look, 2, &item);
+                           if (globTypes->macCreator != NULL) {
+                               goto badMacTypesArg;
+                           }
+                           globTypes->macCreator = item;
+                           Tcl_IncrRefCount(item);
+                           continue;
+                       }
+                   }
                }
+               /*
+                * Error cases
+                */
+               badTypesArg:
+               Tcl_AppendToObj(resultPtr, "bad argument to \"-types\": ", -1);
+               Tcl_AppendObjToObj(resultPtr, look);
+               result = TCL_ERROR;
+               goto endOfGlob;
+               badMacTypesArg:
+               Tcl_AppendToObj(resultPtr,
+                       "only one MacOS type or creator argument to \"-types\" allowed", -1);
+               result = TCL_ERROR;
+               goto endOfGlob;
            }
+       }
+    }
 
-           /*
-            * Determine the home directory for the specified user.  Note that
-            * we don't allow special characters in the user name.
-            */
-
-           c = *tail;
-           *tail = '\0';
-           p = strpbrk(argv[i]+1, "\\[]*?{}");
-           if (p == NULL) {
-               head = DoTildeSubst(interp, argv[i]+1, &buffer);
-           } else {
-               if (!noComplain) {
-                   Tcl_ResetResult(interp);
-                   Tcl_AppendResult(interp, "globbing characters not ",
-                           "supported in user names", (char *) NULL);
+    /* 
+     * Now we perform the actual glob below.  This may involve joining
+     * together the pattern arguments, dealing with particular file types
+     * etc.  We use a 'goto' to ensure we free any memory allocated along
+     * the way.
+     */
+    objc -= i;
+    objv += i;
+    /* 
+     * We re-retrieve this, in case it was changed in 
+     * the Tcl_ResetResult above 
+     */
+    resultPtr = Tcl_GetObjResult(interp);
+    result = TCL_OK;
+    if (join) {
+       if (dir != PATH_GENERAL) {
+           Tcl_DStringInit(&prefix);
+       }
+       for (i = 0; i < objc; i++) {
+           string = Tcl_GetStringFromObj(objv[i], &length);
+           Tcl_DStringAppend(&prefix, string, length);
+           if (i != objc -1) {
+               Tcl_DStringAppend(&prefix, separators, 1);
+           }
+       }
+       if (TclGlob(interp, Tcl_DStringValue(&prefix), pathOrDir,
+               globFlags, globTypes) != TCL_OK) {
+           result = TCL_ERROR;
+           goto endOfGlob;
+       }
+    } else {
+       if (dir == PATH_GENERAL) {
+           Tcl_DString str;
+           for (i = 0; i < objc; i++) {
+               Tcl_DStringInit(&str);
+               if (dir == PATH_GENERAL) {
+                   Tcl_DStringAppend(&str, Tcl_DStringValue(&prefix),
+                           Tcl_DStringLength(&prefix));
+               }
+               string = Tcl_GetStringFromObj(objv[i], &length);
+               Tcl_DStringAppend(&str, string, length);
+               if (TclGlob(interp, Tcl_DStringValue(&str), pathOrDir,
+                       globFlags, globTypes) != TCL_OK) {
+                   result = TCL_ERROR;
+                   Tcl_DStringFree(&str);
+                   goto endOfGlob;
                }
-               head = NULL;
            }
-           *tail = c;
-           if (head == NULL) {
-               if (noComplain) {
-                   Tcl_ResetResult(interp);
-                   continue;
-               } else {
+           Tcl_DStringFree(&str);
+       } else {
+           for (i = 0; i < objc; i++) {
+               string = Tcl_GetString(objv[i]);
+               if (TclGlob(interp, string, pathOrDir,
+                       globFlags, globTypes) != TCL_OK) {
                    result = TCL_ERROR;
-                   goto done;
+                   goto endOfGlob;
                }
            }
-           if (head != Tcl_DStringValue(&buffer)) {
-               Tcl_DStringAppend(&buffer, head, -1);
+       }
+    }
+    if ((globFlags & GLOBMODE_NO_COMPLAIN) == 0) {
+       if (Tcl_ListObjLength(interp, Tcl_GetObjResult(interp),
+               &length) != TCL_OK) {
+           /* This should never happen.  Maybe we should be more dramatic */
+           result = TCL_ERROR;
+           goto endOfGlob;
+       }
+       if (length == 0) {
+           Tcl_AppendResult(interp, "no files matched glob pattern",
+                   (join || (objc == 1)) ? " \"" : "s \"", (char *) NULL);
+           if (join) {
+               Tcl_AppendResult(interp, Tcl_DStringValue(&prefix),
+                       (char *) NULL);
+           } else {
+               char *sep = "";
+               for (i = 0; i < objc; i++) {
+                   string = Tcl_GetString(objv[i]);
+                   Tcl_AppendResult(interp, sep, string, (char *) NULL);
+                   sep = " ";
+               }
+           }
+           Tcl_AppendResult(interp, "\"", (char *) NULL);
+           result = TCL_ERROR;
+       }
+    }
+  endOfGlob:
+    if (join || (dir == PATH_GENERAL)) {
+       Tcl_DStringFree(&prefix);
+       if (dir == PATH_GENERAL) {
+           Tcl_DStringFree(&directory);
+       }
+    }
+    if (globTypes != NULL) {
+       if (globTypes->macType != NULL) {
+           Tcl_DecrRefCount(globTypes->macType);
+       }
+       if (globTypes->macCreator != NULL) {
+           Tcl_DecrRefCount(globTypes->macCreator);
+       }
+       ckfree((char *) globTypes);
+    }
+    return result;
+}
+\f
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclGlob --
+ *
+ *     This procedure prepares arguments for the TclDoGlob call.
+ *     It sets the separator string based on the platform, performs
+ *      tilde substitution, and calls TclDoGlob.
+ *
+ * Results:
+ *     The return value is a standard Tcl result indicating whether
+ *     an error occurred in globbing.  After a normal return the
+ *     result in interp (set by TclDoGlob) holds all of the file names
+ *     given by the dir and rem arguments.  After an error the
+ *     result in interp will hold an error message.
+ *
+ * Side effects:
+ *     The currentArgString is written to.
+ *
+ *----------------------------------------------------------------------
+ */
+
+       /* ARGSUSED */
+int
+TclGlob(interp, pattern, unquotedPrefix, globFlags, types)
+    Tcl_Interp *interp;                /* Interpreter for returning error message
+                                * or appending list of matching file names. */
+    char *pattern;             /* Glob pattern to match. Must not refer
+                                * to a static string. */
+    char *unquotedPrefix;      /* Prefix to glob pattern, if non-null, which
+                                * is considered literally.  May be static. */
+    int globFlags;             /* Stores or'ed combination of flags */
+    GlobTypeData *types;       /* Struct containing acceptable types.
+                                * May be NULL. */
+{
+    char *separators;
+    char *head, *tail, *start;
+    char c;
+    int result;
+    Tcl_DString buffer;
+
+    separators = NULL;         /* lint. */
+    switch (tclPlatform) {
+       case TCL_PLATFORM_UNIX:
+           separators = "/";
+           break;
+       case TCL_PLATFORM_WINDOWS:
+           separators = "/\\:";
+           break;
+       case TCL_PLATFORM_MAC:
+           if (unquotedPrefix == NULL) {
+               separators = (strchr(pattern, ':') == NULL) ? "/" : ":";
+           } else {
+               separators = ":";
+           }
+           break;
+    }
+
+    Tcl_DStringInit(&buffer);
+    if (unquotedPrefix != NULL) {
+       start = unquotedPrefix;
+    } else {
+       start = pattern;
+    }
+
+    /*
+     * Perform tilde substitution, if needed.
+     */
+
+    if (start[0] == '~') {
+       
+       /*
+        * Find the first path separator after the tilde.
+        */
+       for (tail = start; *tail != '\0'; tail++) {
+           if (*tail == '\\') {
+               if (strchr(separators, tail[1]) != NULL) {
+                   break;
+               }
+           } else if (strchr(separators, *tail) != NULL) {
+               break;
            }
-       } else {
-           tail = argv[i];
        }
 
-       result = TclDoGlob(interp, separators, &buffer, tail);
-       if (result != TCL_OK) {
-           if (noComplain) {
+       /*
+        * Determine the home directory for the specified user.  Note that
+        * we don't allow special characters in the user name.
+        */
+       
+       c = *tail;
+       *tail = '\0';
+       /*
+        * I don't think we need to worry about special characters in
+        * the user name anymore (Vince Darley, June 1999), since the
+        * new code is designed to handle special chars.
+        */
+#ifndef NOT_NEEDED_ANYMORE
+       head = DoTildeSubst(interp, start+1, &buffer);
+#else
+       
+       if (strpbrk(start+1, "\\[]*?{}") == NULL) {
+           head = DoTildeSubst(interp, start+1, &buffer);
+       } else {
+           if (!(globFlags & GLOBMODE_NO_COMPLAIN)) {
+               Tcl_ResetResult(interp);
+               Tcl_AppendResult(interp, "globbing characters not ",
+                       "supported in user names", (char *) NULL);
+           }
+           head = NULL;
+       }
+#endif
+       *tail = c;
+       if (head == NULL) {
+           if (globFlags & GLOBMODE_NO_COMPLAIN) {
                /*
                 * We should in fact pass down the nocomplain flag 
-                * or save the interp result or use another mecanism
+                * or save the interp result or use another mechanism
                 * so the interp result is not mangled on errors in that case.
                 * but that would a bigger change than reasonable for a patch
                 * release.
                 * (see fileName.test 15.2-15.4 for expected behaviour)
                 */
                Tcl_ResetResult(interp);
-               result = TCL_OK;
-               continue;
+               return TCL_OK;
            } else {
-               goto done;
+               return TCL_ERROR;
            }
        }
+       if (head != Tcl_DStringValue(&buffer)) {
+           Tcl_DStringAppend(&buffer, head, -1);
+       }
+       if (unquotedPrefix != NULL) {
+           Tcl_DStringAppend(&buffer, tail, -1);
+           tail = pattern;
+       }
+    } else {
+       tail = pattern;
+       if (unquotedPrefix != NULL) {
+           Tcl_DStringAppend(&buffer,unquotedPrefix,-1);
+       }
     }
-
-    if ((*interp->result == 0) && !noComplain) {
-       char *sep = "";
-
-       Tcl_AppendResult(interp, "no files matched glob pattern",
-               (argc == 2) ? " \"" : "s \"", (char *) NULL);
-       for (i = firstArg; i < argc; i++) {
-           Tcl_AppendResult(interp, sep, argv[i], (char *) NULL);
-           sep = " ";
+    /* 
+     * If the prefix is a directory, make sure it ends in a directory
+     * separator.
+     */
+    if (unquotedPrefix != NULL) {
+       if (globFlags & GLOBMODE_DIR) {
+           c = Tcl_DStringValue(&buffer)[Tcl_DStringLength(&buffer)-1];
+           if (strchr(separators, c) == NULL) {
+               Tcl_DStringAppend(&buffer,separators,1);
+           }
        }
-       Tcl_AppendResult(interp, "\"", (char *) NULL);
-       result = TCL_ERROR;
     }
-done:
+
+    result = TclDoGlob(interp, separators, &buffer, tail, types);
     Tcl_DStringFree(&buffer);
+    if (result != TCL_OK) {
+       if (globFlags & GLOBMODE_NO_COMPLAIN) {
+           Tcl_ResetResult(interp);
+           return TCL_OK;
+       }
+    }
     return result;
 }
 \f
@@ -1325,7 +1815,11 @@ SkipToChar(stringPtr, match)
  *     This recursive procedure forms the heart of the globbing
  *     code.  It performs a depth-first traversal of the tree
  *     given by the path name to be globbed.  The directory and
- *     remainder are assumed to be native format paths.
+ *     remainder are assumed to be native format paths.  The prefix 
+ *     contained in 'headPtr' is not used as a glob pattern, simply
+ *     as a path specifier, so it can contain unquoted glob-sensitive
+ *     characters (if the directories to which it points contain
+ *     such strange characters).
  *
  * Results:
  *     The return value is a standard Tcl result indicating whether
@@ -1341,19 +1835,23 @@ SkipToChar(stringPtr, match)
  */
 
 int
-TclDoGlob(interp, separators, headPtr, tail)
+TclDoGlob(interp, separators, headPtr, tail, types)
     Tcl_Interp *interp;                /* Interpreter to use for error reporting
                                 * (e.g. unmatched brace). */
     char *separators;          /* String containing separator characters
                                 * that should be used to identify globbing
                                 * boundaries. */
     Tcl_DString *headPtr;      /* Completely expanded prefix. */
-    char *tail;                        /* The unexpanded remainder of the path. */
+    char *tail;                        /* The unexpanded remainder of the path.
+                                * Must not be a pointer to a static string. */
+    GlobTypeData *types;       /* List object containing list of acceptable types.
+                                * May be NULL. */
 {
     int baseLength, quoted, count;
     int result = TCL_OK;
-    char *p, *openBrace, *closeBrace, *name, *firstSpecialChar, savedChar;
+    char *name, *p, *openBrace, *closeBrace, *firstSpecialChar, savedChar;
     char lastChar = 0;
+    
     int length = Tcl_DStringLength(headPtr);
 
     if (length > 0) {
@@ -1505,7 +2003,7 @@ TclDoGlob(interp, separators, headPtr, tail)
            Tcl_DStringAppend(&newName, element, p-element);
            Tcl_DStringAppend(&newName, closeBrace+1, -1);
            result = TclDoGlob(interp, separators,
-                   headPtr, Tcl_DStringValue(&newName));
+                   headPtr, Tcl_DStringValue(&newName), types);
            if (result != TCL_OK) {
                break;
            }
@@ -1524,6 +2022,12 @@ TclDoGlob(interp, separators, headPtr, tail)
      */
 
     if (*p != '\0') {
+
+       /*
+        * Note that we are modifying the string in place.  This won't work
+        * if the string is a static.
+        */
+
         savedChar = *p;
         *p = '\0';
         firstSpecialChar = strpbrk(tail, "*[]?\\");
@@ -1537,15 +2041,15 @@ TclDoGlob(interp, separators, headPtr, tail)
         * Look for matching files in the current directory.  The
         * implementation of this function is platform specific, but may
         * recursively call TclDoGlob.  For each file that matches, it will
-        * add the match onto the interp->result, or call TclDoGlob if there
+        * add the match onto the interp's result, or call TclDoGlob if there
         * are more characters to be processed.
         */
 
-       return TclMatchFiles(interp, separators, headPtr, tail, p);
+       return TclpMatchFilesTypes(interp, separators, headPtr, tail, p, types);
     }
     Tcl_DStringAppend(headPtr, tail, p-tail);
     if (*p != '\0') {
-       return TclDoGlob(interp, separators, headPtr, p);
+       return TclDoGlob(interp, separators, headPtr, p, types);
     }
 
     /*
@@ -1555,22 +2059,26 @@ TclDoGlob(interp, separators, headPtr, tail)
      */
 
     switch (tclPlatform) {
-       case TCL_PLATFORM_MAC:
+       case TCL_PLATFORM_MAC: {
            if (strchr(Tcl_DStringValue(headPtr), ':') == NULL) {
                Tcl_DStringAppend(headPtr, ":", 1);
            }
            name = Tcl_DStringValue(headPtr);
-           if (TclAccess(name, F_OK) == 0) {
+           if (TclpAccess(name, F_OK) == 0) {
                if ((name[1] != '\0') && (strchr(name+1, ':') == NULL)) {
-                   Tcl_AppendElement(interp, name+1);
+                   Tcl_ListObjAppendElement(interp, Tcl_GetObjResult(interp), 
+                                            Tcl_NewStringObj(name + 1,-1));
                } else {
-                   Tcl_AppendElement(interp, name);
+                   Tcl_ListObjAppendElement(interp, Tcl_GetObjResult(interp), 
+                                            Tcl_NewStringObj(name,-1));
                }
            }
            break;
+       }
        case TCL_PLATFORM_WINDOWS: {
            int exists;
 #ifndef __CYGWIN__
+
            /*
             * We need to convert slashes to backslashes before checking
             * for the existence of the file.  Once we are done, we need
@@ -1593,18 +2101,20 @@ TclDoGlob(interp, separators, headPtr, tail)
            }
 #endif
            name = Tcl_DStringValue(headPtr);
-           exists = (TclAccess(name, F_OK) == 0);
+           exists = (TclpAccess(name, F_OK) == 0);
+
            for (p = name; *p != '\0'; p++) {
                if (*p == '\\') {
                    *p = '/';
                }
            }
            if (exists) {
-               Tcl_AppendElement(interp, name);
+               Tcl_ListObjAppendElement(interp, Tcl_GetObjResult(interp), 
+                                        Tcl_NewStringObj(name,-1));
            }
            break;
        }
-       case TCL_PLATFORM_UNIX:
+       case TCL_PLATFORM_UNIX: {
            if (Tcl_DStringLength(headPtr) == 0) {
                if ((*name == '\\' && name[1] == '/') || (*name == '/')) {
                    Tcl_DStringAppend(headPtr, "/", 1);
@@ -1613,11 +2123,14 @@ TclDoGlob(interp, separators, headPtr, tail)
                }
            }
            name = Tcl_DStringValue(headPtr);
-           if (TclAccess(name, F_OK) == 0) {
-               Tcl_AppendElement(interp, name);
+           if (TclpAccess(name, F_OK) == 0) {
+               Tcl_ListObjAppendElement(interp, Tcl_GetObjResult(interp), 
+                                        Tcl_NewStringObj(name,-1));
            }
            break;
+       }
     }
 
     return TCL_OK;
 }
+
index a9d5cda..7494923 100644 (file)
@@ -3,16 +3,10 @@
  *
  *     This file contains Unix & Windows common init script
  *      It is not used on the Mac. (the mac init script is in tclMacInit.c)
- *     This file should only be included once in the entire set of C
- *     source files for Tcl (by the respective platform initialization
- *     C source file, tclUnixInit.c and tclWinInit.c) and thus the
- *     presence of the routine, TclSetPreInitScript, below, should be
- *     harmless.
  *
  * Copyright (c) 1998 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * Copyright (c) 1999 by Scriptics Corporation.
+ * All rights reserved.
  *
  * RCS: @(#) $Id$
  */
  *                               from a static C variable that was set at
  *                               compile time
  *
- *     <executable directory>/../lib/tcl$tcl_version
- *                             - look for a lib/tcl<ver> in a sibling of
- *                               the bin directory (e.g. install hierarchy)
- *
- *     <executable directory>/../../lib/tcl$tcl_version
- *                             - look for a lib/tcl<ver> in a sibling of
- *                               the bin/arch directory
- *
- *     <executable directory>/../library
- *                             - look in build directory
- *
- *     <executable directory>/../../library
- *                             - look in build directory from unix/arch
- *
- *     <executable directory>/../../tcl$tcl_patchLevel/library
- *                             - look for tcl build directory relative
- *                               to a parallel build directory (e.g. Tk)
- *
- *     <executable directory>/../../../tcl$tcl_patchLevel/library
- *                             - look for tcl build directory relative
- *                               to a parallel build directory from
- *                               down inside unix/arch directory
+ *     $tcl_libPath            - this value is initialized by a call to
+ *                               TclGetLibraryPath called from Tcl_Init.
  *
  * The first directory on this path that contains a valid init.tcl script
  * will be set as the value of tcl_library.
@@ -64,9 +38,8 @@
 
 static char initScript[] = "if {[info proc tclInit]==\"\"} {\n\
   proc tclInit {} {\n\
-    global tcl_library tcl_version tcl_patchLevel errorInfo\n\
-    global tcl_pkgPath env tclDefaultLibrary\n\
-    global tcl_platform\n\
+    global tcl_libPath tcl_library errorInfo\n\
+    global env tclDefaultLibrary\n\
     rename tclInit {}\n\
     set errors {}\n\
     set dirs {}\n\
@@ -76,73 +49,16 @@ static char initScript[] = "if {[info proc tclInit]==\"\"} {\n\
        if {[info exists env(TCL_LIBRARY)]} {\n\
            lappend dirs $env(TCL_LIBRARY)\n\
        }\n\
-        # CYGNUS LOCAL: I've changed this alot.  \n\
-        # Basically we only care about two cases,\n\
-        # if we are installed, and if we are in the devo tree...\n\
-        # The next few are for if we are installed:\n\
-        # NB. We also want this to work if the user is actually\n\
-        # running a link and not the actual program.  So look for a\n\
-        # link and chase it down to its source.\n\
-        set execName [info nameofexecutable]\n\
-        if {[file exists $execName] && [string compare [file type $execName] \"link\"] == 0} {\n\
-            set execName [file readlink $execName]\n\
-            if {[string compare [file pathtype $execName] \"relative\"] == 0} {\n\
-              set execName [file join [pwd] $execName]\n\
-            }\n\
-        }\n\
-       set parentDir [file dirname [file dirname $execName]]\n\
-        lappend dirs [file join $parentDir share tcl$tcl_version]\n\
-        lappend dirs [file join $parentDir \"usr\" share tcl$tcl_version]\n\
-       lappend dirs [file join [file dirname $parentDir] share tcl$tcl_version]\n\
-        # NOW, let's try to find it in the build tree...\n\
-        # Rather than play all the games Scriptics does, if we are in the build\n\
-        # tree there will be a tclConfig.sh relative to the executible's directory, and we \n\
-        # can read it and get the source dir from there...\n\
-        #\n\
-        # We duplicate all the directories in the search, one w/o the version and one with.\n\
-        # Most modules use ../../tcl/{unix,win}\n\
-        lappend configDirs [file join [file dirname $parentDir] tcl$tcl_version $tcl_platform(platform)]\n\
-        lappend configDirs [file join [file dirname $parentDir] tcl             $tcl_platform(platform)]\n\
-        # This one gets tclsh...\n\
-        lappend configDirs $execName \n\
-        # This one is for gdb, and any other app which has its executible in the top directory.\n\
-        lappend configDirs [file join $parentDir tcl$tcl_version $tcl_platform(platform)]\n\
-        lappend configDirs [file join $parentDir tcl             $tcl_platform(platform)]\n\
-        # This last will handle itclsh & itkwish (../../../tcl/{unix,win}):\n\
-        lappend configDirs [file join [file dirname [file dirname $parentDir]] tcl$tcl_version $tcl_platform(platform)]\n\
-        lappend configDirs [file join [file dirname [file dirname $parentDir]] tcl             $tcl_platform(platform)]\n\
-        \n\
-        foreach i $configDirs {\n\
-            set configFile [file join $i tclConfig.sh]\n\
-            if {[file exists $configFile]} {\n\
-                if {![catch {open $configFile r} fileH]} {\n\
-                    set srcDir {}\n\
-                    while {[gets $fileH line] >= 0} {\n\
-                        if {[regexp {^TCL_SRC_DIR='([^']*)'} $line dummy srcDir]} {\n\
-                            break\n\
-                        }\n\
-                    }\n\
-                    close $fileH\n\
-                    if {$srcDir != \"\"} {\n\
-                        lappend dirs [file join $srcDir library]\n\
-                        break\n\
-                    }\n\
-                }\n\
-            }\n\
-        }\n\
+       lappend dirs $tclDefaultLibrary\n\
+       unset tclDefaultLibrary\n\
+        set dirs [concat $dirs $tcl_libPath]\n\
     }\n\
-    # I also moved this from just after TCL_LIBRARY to last.\n\
-    # I only want to use the compiled in library if I am really lost, because\n\
-    # otherwise if I have installed once, but am working in the build directory,\n\
-    # I will always pick up the installed files, which will be very confusing...\n\
-    lappend dirs $tclDefaultLibrary\n\
-    unset tclDefaultLibrary\n\
     foreach i $dirs {\n\
        set tcl_library $i\n\
        set tclfile [file join $i init.tcl]\n\
        if {[file exists $tclfile]} {\n\
            if {![catch {uplevel #0 [list source $tclfile]} msg]} {\n\
-               return\n\
+               return\n\
            } else {\n\
                append errors \"$tclfile: $msg\n$errorInfo\n\"\n\
            }\n\
@@ -158,6 +74,7 @@ static char initScript[] = "if {[info proc tclInit]==\"\"} {\n\
 }\n\
 tclInit";
 
+
 /*
  * A pointer to a string that holds an initialization script that if non-NULL
  * is evaluated in Tcl_Init() prior to the the built-in initialization script
index d317a1d..2055f19 100644 (file)
@@ -336,7 +336,7 @@ Tcl_ErrnoId()
 #ifdef ENXIO
        case ENXIO: return "ENXIO";
 #endif
-#if defined(EOPNOTSUPP) && (!defined(ENOTSUP) || (EOPNOTSUPP != ENOTSUP))
+#if defined(EOPNOTSUPP) &&  (!defined(ENOTSUP) || (ENOTSUP != EOPNOTSUPP))
        case EOPNOTSUPP: return "EOPNOTSUPP";
 #endif
 #ifdef EPERM
@@ -736,7 +736,7 @@ Tcl_ErrnoMsg(err)
        case ENOPKG: return "package not installed";
 #endif
 #ifdef ENOPROTOOPT
-       case ENOPROTOOPT: return "bad proocol option";
+       case ENOPROTOOPT: return "bad protocol option";
 #endif
 #ifdef ENOSPC
        case ENOSPC: return "no space left on device";
@@ -783,7 +783,7 @@ Tcl_ErrnoMsg(err)
 #ifdef ENXIO
        case ENXIO: return "no such device or address";
 #endif
-#if defined(EOPNOTSUPP) && (!defined(ENOTSUP) || (EOPNOTSUPP != ENOTSUP))
+#if defined(EOPNOTSUPP) &&  (!defined(ENOTSUP) || (ENOTSUP != EOPNOTSUPP))
        case EOPNOTSUPP: return "operation not supported on socket";
 #endif
 #ifdef EPERM
@@ -1172,3 +1172,4 @@ Tcl_SignalMsg(sig)
     }
     return "unknown signal";
 }
+
index 601508f..57036b6 100755 (executable)
@@ -12,9 +12,17 @@ ac_help=
 ac_default_prefix=/usr/local
 # Any additions from configure.in:
 ac_help="$ac_help
+  --enable-threads        build with threads"
+ac_help="$ac_help
+  --enable-64bit          enable 64bit support (where applicable)"
+ac_help="$ac_help
+  --enable-64bit-vis      enable 64bit Sparc VIS support"
+ac_help="$ac_help
   --disable-load          disallow dynamic loading and "load" command"
 ac_help="$ac_help
-  --enable-shared         build libtcl as a shared library"
+  --enable-symbols        build with debugging symbols [--disable-symbols]"
+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
@@ -536,14 +544,18 @@ else
 fi
 
 
-# SCCS: @(#) configure.in 1.18 98/08/12 17:29:39
+# RCS: @(#) $Id$
 
-TCL_VERSION=8.0
+TCL_VERSION=8.3
 TCL_MAJOR_VERSION=8
-TCL_MINOR_VERSION=0
-TCL_PATCH_LEVEL=".3"
+TCL_MINOR_VERSION=3
+TCL_PATCH_LEVEL=".2"
 VERSION=${TCL_VERSION}
 
+#------------------------------------------------------------------------
+# Handle the --prefix=... option
+#------------------------------------------------------------------------
+
 if test "${prefix}" = "NONE"; then
     prefix=/usr/local
 fi
@@ -552,40 +564,14 @@ if test "${exec_prefix}" = "NONE"; then
 fi
 TCL_SRC_DIR=`cd $srcdir/..; pwd`
 
-# Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:559: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$RANLIB"; then
-  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_RANLIB="ranlib"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
-  echo "$ac_t""$RANLIB" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
+#------------------------------------------------------------------------
+# Standard compiler checks
+#------------------------------------------------------------------------
 
-    # Extract the first word of "gcc", so it can be a program name with args.
+# Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:589: checking for $ac_word" >&5
+echo "configure:575: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -615,7 +601,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:619: checking for $ac_word" >&5
+echo "configure:605: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -666,7 +652,7 @@ fi
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:670: checking for $ac_word" >&5
+echo "configure:656: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -698,7 +684,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:702: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:688: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -709,12 +695,12 @@ cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 713 "configure"
+#line 699 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -740,12 +726,12 @@ if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:744: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:730: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:749: checking whether we are using GNU C" >&5
+echo "configure:735: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -754,7 +740,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:758: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:744: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -773,7 +759,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:777: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:763: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -804,6 +790,157 @@ else
   fi
 fi
 
+# Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:797: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_RANLIB="ranlib"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:826: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    # This must be in double quotes, not single quotes, because CPP may get
+  # substituted into the Makefile and "${CC-cc}" will confuse make.
+  CPP="${CC-cc} -E"
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp.
+  cat > conftest.$ac_ext <<EOF
+#line 841 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:847: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -E -traditional-cpp"
+  cat > conftest.$ac_ext <<EOF
+#line 858 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:864: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -nologo -E"
+  cat > conftest.$ac_ext <<EOF
+#line 875 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:881: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+  ac_cv_prog_CPP="$CPP"
+fi
+  CPP="$ac_cv_prog_CPP"
+else
+  ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+for ac_hdr in unistd.h limits.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:909: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 914 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:919: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
 
 # CYGNUS LOCAL
 # dje/win32
@@ -840,7 +977,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:844: checking for a BSD compatible install" >&5
+echo "configure:981: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -904,94 +1041,14 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 # This modifies the value of $CC to have the POSIX flag added
 # so everything will configure correctly.
 #--------------------------------------------------------------------
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:909: checking how to run the C preprocessor" >&5
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
-fi
-if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-    # This must be in double quotes, not single quotes, because CPP may get
-  # substituted into the Makefile and "${CC-cc}" will confuse make.
-  CPP="${CC-cc} -E"
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp.
-  cat > conftest.$ac_ext <<EOF
-#line 924 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:930: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  :
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  CPP="${CC-cc} -E -traditional-cpp"
-  cat > conftest.$ac_ext <<EOF
-#line 941 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:947: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  :
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  CPP="${CC-cc} -nologo -E"
-  cat > conftest.$ac_ext <<EOF
-#line 958 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:964: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  :
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  CPP=/lib/cpp
-fi
-rm -f conftest*
-fi
-rm -f conftest*
-fi
-rm -f conftest*
-  ac_cv_prog_CPP="$CPP"
-fi
-  CPP="$ac_cv_prog_CPP"
-else
-  ac_cv_prog_CPP="$CPP"
-fi
-echo "$ac_t""$CPP" 1>&6
-
 
 echo $ac_n "checking to see if this is LynxOS""... $ac_c" 1>&6
-echo "configure:990: checking to see if this is LynxOS" >&5
+echo "configure:1047: checking to see if this is LynxOS" >&5
 if eval "test \"`echo '$''{'ac_cv_os_lynx'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 995 "configure"
+#line 1052 "configure"
 #include "confdefs.h"
 /*
  * The old Lynx "cc" only defines "Lynx", but the newer one uses "__Lynx__"
@@ -1021,12 +1078,12 @@ if test "$ac_cv_os_lynx" = "yes" ; then
 EOF
 
   echo $ac_n "checking whether -mposix or -X is available""... $ac_c" 1>&6
-echo "configure:1025: checking whether -mposix or -X is available" >&5
+echo "configure:1082: checking whether -mposix or -X is available" >&5
   if eval "test \"`echo '$''{'ac_cv_c_posix_flag'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1030 "configure"
+#line 1087 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1042,7 +1099,7 @@ int main() {
   
 ; return 0; }
 EOF
-if { (eval echo configure:1046: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1103: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_posix_flag=" -mposix"
 else
 fi
 
 
-# set the warning flags depending on whether or not we are using gcc
-if test "${GCC}" = "yes" ; then
-    CFLAGS_WARNING="-Wall -Wconversion"
+#------------------------------------------------------------------------
+# Threads support
+#------------------------------------------------------------------------
+
+
+    echo $ac_n "checking for building with threads""... $ac_c" 1>&6
+echo "configure:1128: checking for building with threads" >&5
+    # Check whether --enable-threads or --disable-threads was given.
+if test "${enable_threads+set}" = set; then
+  enableval="$enable_threads"
+  tcl_ok=$enableval
 else
-    CFLAGS_WARNING=""
+  tcl_ok=no
 fi
 
-#--------------------------------------------------------------------
-#      Supply substitutes for missing POSIX library procedures, or
-#      set flags so Tcl uses alternate procedures.
-#--------------------------------------------------------------------
 
-# Check if Posix compliant getcwd exists, if not we'll use getwd.
-for ac_func in getcwd
-do
+    if test "$tcl_ok" = "yes"; then
+       echo "$ac_t""yes" 1>&6
+       TCL_THREADS=1
+       cat >> confdefs.h <<\EOF
+#define TCL_THREADS 1
+EOF
+
+       cat >> confdefs.h <<\EOF
+#define _REENTRANT 1
+EOF
+
+       cat >> confdefs.h <<\EOF
+#define _THREAD_SAFE 1
+EOF
+
+       echo $ac_n "checking for pthread_mutex_init in -lpthread""... $ac_c" 1>&6
+echo "configure:1154: checking for pthread_mutex_init in -lpthread" >&5
+ac_lib_var=`echo pthread'_'pthread_mutex_init | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lpthread  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1162 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char pthread_mutex_init();
+
+int main() {
+pthread_mutex_init()
+; return 0; }
+EOF
+if { (eval echo configure:1173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  tcl_ok=yes
+else
+  echo "$ac_t""no" 1>&6
+tcl_ok=no
+fi
+
+       if test "$tcl_ok" = "no"; then
+           # Check a little harder for __pthread_mutex_init in the same
+           # library, as some systems hide it there until pthread.h is
+           # defined.  We could alternatively do an AC_TRY_COMPILE with
+           # pthread.h, but that will work with libpthread really doesn't
+           # exist, like AIX 4.2.  [Bug: 4359]
+           echo $ac_n "checking for __pthread_mutex_init in -lpthread""... $ac_c" 1>&6
+echo "configure:1201: checking for __pthread_mutex_init in -lpthread" >&5
+ac_lib_var=`echo pthread'_'__pthread_mutex_init | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lpthread  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1209 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char __pthread_mutex_init();
+
+int main() {
+__pthread_mutex_init()
+; return 0; }
+EOF
+if { (eval echo configure:1220: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  tcl_ok=yes
+else
+  echo "$ac_t""no" 1>&6
+tcl_ok=no
+fi
+
+       fi
+
+       if test "$tcl_ok" = "yes"; then
+           # The space is needed
+           THREADS_LIBS=" -lpthread"
+       else
+           echo $ac_n "checking for pthread_mutex_init in -lpthreads""... $ac_c" 1>&6
+echo "configure:1248: checking for pthread_mutex_init in -lpthreads" >&5
+ac_lib_var=`echo pthreads'_'pthread_mutex_init | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lpthreads  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1256 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char pthread_mutex_init();
+
+int main() {
+pthread_mutex_init()
+; return 0; }
+EOF
+if { (eval echo configure:1267: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  tcl_ok=yes
+else
+  echo "$ac_t""no" 1>&6
+tcl_ok=no
+fi
+
+           if test "$tcl_ok" = "yes"; then
+               # The space is needed
+               THREADS_LIBS=" -lpthreads"
+           else
+               echo $ac_n "checking for pthread_mutex_init in -lc""... $ac_c" 1>&6
+echo "configure:1293: checking for pthread_mutex_init in -lc" >&5
+ac_lib_var=`echo c'_'pthread_mutex_init | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lc  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1301 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char pthread_mutex_init();
+
+int main() {
+pthread_mutex_init()
+; return 0; }
+EOF
+if { (eval echo configure:1312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  tcl_ok=yes
+else
+  echo "$ac_t""no" 1>&6
+tcl_ok=no
+fi
+
+               if test "$tcl_ok" = "no"; then
+                   TCL_THREADS=0
+                   echo "configure: warning: "Don t know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile..."" 1>&2
+               fi
+           fi
+       fi
+
+       # Does the pthread-implementation provide
+       # 'pthread_attr_setstacksize' ?
+
+       for ac_func in pthread_attr_setstacksize
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1346: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1351 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1374: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+    else
+       TCL_THREADS=0
+       echo "$ac_t""no (default)" 1>&6
+    fi
+
+
+#------------------------------------------------------------------------
+# If we're using GCC, see if the compiler understands -pipe.  If so, use it.
+# It makes compiling go faster.  (This is only a performance feature.)
+#------------------------------------------------------------------------
+
+if test -z "$no_pipe"; then
+if test -n "$GCC"; then
+  echo $ac_n "checking if the compiler understands -pipe""... $ac_c" 1>&6
+echo "configure:1412: checking if the compiler understands -pipe" >&5
+  OLDCC="$CC"  
+  CC="$CC -pipe"
+  cat > conftest.$ac_ext <<EOF
+#line 1416 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:1423: \"$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*
+  CC="$OLDCC"
+    echo "$ac_t""no" 1>&6
+fi
+rm -f conftest*
+fi  
+fi
+
+#--------------------------------------------------------------------
+#      Supply substitutes for missing POSIX library procedures, or
+#      set flags so Tcl uses alternate procedures.
+#--------------------------------------------------------------------
+
+# Check if Posix compliant getcwd exists, if not we'll use getwd.
+for ac_func in getcwd
+do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1081: checking for $ac_func" >&5
+echo "configure:1446: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1086 "configure"
+#line 1451 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1105,7 +1470,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1109: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1474: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1139,12 +1504,12 @@ done
 for ac_func in opendir strstr
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1143: checking for $ac_func" >&5
+echo "configure:1508: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1148 "configure"
+#line 1513 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1167,7 +1532,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1171: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1197,12 +1562,12 @@ done
 for ac_func in strtol tmpnam waitpid
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1201: checking for $ac_func" >&5
+echo "configure:1566: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1206 "configure"
+#line 1571 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1225,7 +1590,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1252,12 +1617,12 @@ done
 
 
 echo $ac_n "checking for strerror""... $ac_c" 1>&6
-echo "configure:1256: checking for strerror" >&5
+echo "configure:1621: checking for strerror" >&5
 if eval "test \"`echo '$''{'ac_cv_func_strerror'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1261 "configure"
+#line 1626 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char strerror(); below.  */
@@ -1280,7 +1645,7 @@ strerror();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_strerror=yes"
 else
@@ -1304,12 +1669,12 @@ EOF
 fi
 
 echo $ac_n "checking for getwd""... $ac_c" 1>&6
-echo "configure:1308: checking for getwd" >&5
+echo "configure:1673: checking for getwd" >&5
 if eval "test \"`echo '$''{'ac_cv_func_getwd'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1313 "configure"
+#line 1678 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char getwd(); below.  */
@@ -1332,7 +1697,7 @@ getwd();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_getwd=yes"
 else
@@ -1356,12 +1721,12 @@ EOF
 fi
 
 echo $ac_n "checking for wait3""... $ac_c" 1>&6
-echo "configure:1360: checking for wait3" >&5
+echo "configure:1725: checking for wait3" >&5
 if eval "test \"`echo '$''{'ac_cv_func_wait3'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1365 "configure"
+#line 1730 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char wait3(); below.  */
@@ -1384,7 +1749,7 @@ wait3();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1753: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_wait3=yes"
 else
@@ -1408,12 +1773,12 @@ EOF
 fi
 
 echo $ac_n "checking for uname""... $ac_c" 1>&6
-echo "configure:1412: checking for uname" >&5
+echo "configure:1777: checking for uname" >&5
 if eval "test \"`echo '$''{'ac_cv_func_uname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1417 "configure"
+#line 1782 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char uname(); below.  */
@@ -1436,7 +1801,7 @@ uname();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1440: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1805: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_uname=yes"
 else
@@ -1459,153 +1824,58 @@ EOF
 
 fi
 
-
-#--------------------------------------------------------------------
-#      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").
-#--------------------------------------------------------------------
-
-echo $ac_n "checking for sin""... $ac_c" 1>&6
-echo "configure:1472: checking for sin" >&5
-if eval "test \"`echo '$''{'ac_cv_func_sin'+set}'`\" = set"; then
+echo $ac_n "checking for realpath""... $ac_c" 1>&6
+echo "configure:1829: checking for realpath" >&5
+if eval "test \"`echo '$''{'ac_cv_func_realpath'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1477 "configure"
+#line 1834 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char sin(); below.  */
+    which can conflict with char realpath(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char sin();
+char realpath();
 
 int main() {
 
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_sin) || defined (__stub___sin)
+#if defined (__stub_realpath) || defined (__stub___realpath)
 choke me
 #else
-sin();
+realpath();
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:1500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_sin=yes"
+  eval "ac_cv_func_realpath=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_sin=no"
+  eval "ac_cv_func_realpath=no"
 fi
 rm -f conftest*
 fi
 
-if eval "test \"`echo '$ac_cv_func_'sin`\" = yes"; then
+if eval "test \"`echo '$ac_cv_func_'realpath`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  MATH_LIBS=""
+  :
 else
   echo "$ac_t""no" 1>&6
-MATH_LIBS="-lm"
+cat >> confdefs.h <<\EOF
+#define NO_REALPATH 1
+EOF
+
 fi
 
-echo $ac_n "checking for main in -lieee""... $ac_c" 1>&6
-echo "configure:1521: checking for main in -lieee" >&5
-ac_lib_var=`echo ieee'_'main | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-lieee  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1529 "configure"
-#include "confdefs.h"
-
-int main() {
-main()
-; return 0; }
-EOF
-if { (eval echo configure:1536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  MATH_LIBS="-lieee $MATH_LIBS"
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-
-#--------------------------------------------------------------------
-#       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
-    echo $ac_n "checking for gettimeofday in -lbsd""... $ac_c" 1>&6
-echo "configure:1567: checking for gettimeofday in -lbsd" >&5
-ac_lib_var=`echo bsd'_'gettimeofday | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-lbsd  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1575 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char gettimeofday();
-
-int main() {
-gettimeofday()
-; return 0; }
-EOF
-if { (eval echo configure:1586: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  libbsd=yes
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-    if test $libbsd = yes; then
-       MATH_LIBS="$MATH_LIBS -lbsd"
-    fi
-fi
 
 #--------------------------------------------------------------------
 #      Supply substitutes for missing POSIX header files.  Special
@@ -1616,10 +1886,12 @@ fi
 #            as strstr
 #--------------------------------------------------------------------
 
-echo $ac_n "checking dirent.h""... $ac_c" 1>&6
-echo "configure:1621: checking dirent.h" >&5
-cat > conftest.$ac_ext <<EOF
-#line 1623 "configure"
+
+
+    echo $ac_n "checking dirent.h""... $ac_c" 1>&6
+echo "configure:1893: checking dirent.h" >&5
+    cat > conftest.$ac_ext <<EOF
+#line 1895 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <dirent.h>
@@ -1645,7 +1917,7 @@ closedir(d);
 
 ; return 0; }
 EOF
-if { (eval echo configure:1649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   tcl_ok=yes
 else
@@ -1655,26 +1927,28 @@ else
   tcl_ok=no
 fi
 rm -f conftest*
-if test $tcl_ok = no; then
-    cat >> confdefs.h <<\EOF
+
+    if test $tcl_ok = no; then
+       cat >> confdefs.h <<\EOF
 #define NO_DIRENT_H 1
 EOF
 
-fi
-echo "$ac_t""$tcl_ok" 1>&6
-ac_safe=`echo "errno.h" | sed 'y%./+-%__p_%'`
+    fi
+
+    echo "$ac_t""$tcl_ok" 1>&6
+    ac_safe=`echo "errno.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for errno.h""... $ac_c" 1>&6
-echo "configure:1668: checking for errno.h" >&5
+echo "configure:1942: checking for errno.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1673 "configure"
+#line 1947 "configure"
 #include "confdefs.h"
 #include <errno.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1678: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1952: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1699,19 +1973,19 @@ EOF
 
 fi
 
-ac_safe=`echo "float.h" | sed 'y%./+-%__p_%'`
+    ac_safe=`echo "float.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for float.h""... $ac_c" 1>&6
-echo "configure:1705: checking for float.h" >&5
+echo "configure:1979: checking for float.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1710 "configure"
+#line 1984 "configure"
 #include "confdefs.h"
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1715: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1989: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1736,19 +2010,19 @@ EOF
 
 fi
 
-ac_safe=`echo "values.h" | sed 'y%./+-%__p_%'`
+    ac_safe=`echo "values.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for values.h""... $ac_c" 1>&6
-echo "configure:1742: checking for values.h" >&5
+echo "configure:2016: checking for values.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1747 "configure"
+#line 2021 "configure"
 #include "confdefs.h"
 #include <values.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1752: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2026: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1773,19 +2047,19 @@ EOF
 
 fi
 
-ac_safe=`echo "limits.h" | sed 'y%./+-%__p_%'`
+    ac_safe=`echo "limits.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for limits.h""... $ac_c" 1>&6
-echo "configure:1779: checking for limits.h" >&5
+echo "configure:2053: checking for limits.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1784 "configure"
+#line 2058 "configure"
 #include "confdefs.h"
 #include <limits.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1789: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2063: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1810,19 +2084,19 @@ EOF
 
 fi
 
-ac_safe=`echo "stdlib.h" | sed 'y%./+-%__p_%'`
+    ac_safe=`echo "stdlib.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for stdlib.h""... $ac_c" 1>&6
-echo "configure:1816: checking for stdlib.h" >&5
+echo "configure:2090: checking for stdlib.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1821 "configure"
+#line 2095 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1826: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2100: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1844,8 +2118,8 @@ else
 tcl_ok=0
 fi
 
-cat > conftest.$ac_ext <<EOF
-#line 1849 "configure"
+    cat > conftest.$ac_ext <<EOF
+#line 2123 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -1858,8 +2132,8 @@ else
 fi
 rm -f conftest*
 
-cat > conftest.$ac_ext <<EOF
-#line 1863 "configure"
+    cat > conftest.$ac_ext <<EOF
+#line 2137 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -1872,8 +2146,8 @@ else
 fi
 rm -f conftest*
 
-cat > conftest.$ac_ext <<EOF
-#line 1877 "configure"
+    cat > conftest.$ac_ext <<EOF
+#line 2151 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -1886,25 +2160,25 @@ else
 fi
 rm -f conftest*
 
-if test $tcl_ok = 0; then
-    cat >> confdefs.h <<\EOF
+    if test $tcl_ok = 0; then
+       cat >> confdefs.h <<\EOF
 #define NO_STDLIB_H 1
 EOF
 
-fi
-ac_safe=`echo "string.h" | sed 'y%./+-%__p_%'`
+    fi
+    ac_safe=`echo "string.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for string.h""... $ac_c" 1>&6
-echo "configure:1898: checking for string.h" >&5
+echo "configure:2172: checking for string.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1903 "configure"
+#line 2177 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1908: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2182: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1926,8 +2200,8 @@ else
 tcl_ok=0
 fi
 
-cat > conftest.$ac_ext <<EOF
-#line 1931 "configure"
+    cat > conftest.$ac_ext <<EOF
+#line 2205 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -1940,8 +2214,8 @@ else
 fi
 rm -f conftest*
 
-cat > conftest.$ac_ext <<EOF
-#line 1945 "configure"
+    cat > conftest.$ac_ext <<EOF
+#line 2219 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -1954,25 +2228,30 @@ else
 fi
 rm -f conftest*
 
-if test $tcl_ok = 0; then
-    cat >> confdefs.h <<\EOF
+
+    # See also memmove check below for a place where NO_STRING_H can be
+    # set and why.
+
+    if test $tcl_ok = 0; then
+       cat >> confdefs.h <<\EOF
 #define NO_STRING_H 1
 EOF
 
-fi
-ac_safe=`echo "sys/wait.h" | sed 'y%./+-%__p_%'`
+    fi
+
+    ac_safe=`echo "sys/wait.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for sys/wait.h""... $ac_c" 1>&6
-echo "configure:1966: checking for sys/wait.h" >&5
+echo "configure:2245: checking for sys/wait.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1971 "configure"
+#line 2250 "configure"
 #include "confdefs.h"
 #include <sys/wait.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1976: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2255: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1997,19 +2276,19 @@ EOF
 
 fi
 
-ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
+    ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
-echo "configure:2003: checking for dlfcn.h" >&5
+echo "configure:2282: checking for dlfcn.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2008 "configure"
+#line 2287 "configure"
 #include "confdefs.h"
 #include <dlfcn.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2013: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2292: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2034,21 +2313,24 @@ EOF
 
 fi
 
-for ac_hdr in unistd.h
+
+    # OS/390 lacks sys/param.h (and doesn't need it, by chance).
+
+    for ac_hdr in unistd.h sys/param.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2042: checking for $ac_hdr" >&5
+echo "configure:2324: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2047 "configure"
+#line 2329 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2052: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2334: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2075,19 +2357,23 @@ fi
 done
 
 
+
+
 #---------------------------------------------------------------------------
 #      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.
 #---------------------------------------------------------------------------
 
-echo $ac_n "checking termios vs. termio vs. sgtty""... $ac_c" 1>&6
-echo "configure:2086: checking termios vs. termio vs. sgtty" >&5
-if test "$cross_compiling" = yes; then
+
+    echo $ac_n "checking termios vs. termio vs. sgtty""... $ac_c" 1>&6
+echo "configure:2371: checking termios vs. termio vs. sgtty" >&5
+
+    if test "$cross_compiling" = yes; then
   tk_ok=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 2091 "configure"
+#line 2377 "configure"
 #include "confdefs.h"
 
 #include <termios.h>
@@ -2103,7 +2389,7 @@ main()
     return 1;
 }
 EOF
-if { (eval echo configure:2107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   tk_ok=termios
 else
@@ -2115,17 +2401,18 @@ fi
 rm -fr conftest*
 fi
 
-if test $tk_ok = termios; then
-    cat >> confdefs.h <<\EOF
+
+    if test $tk_ok = termios; then
+       cat >> confdefs.h <<\EOF
 #define USE_TERMIOS 1
 EOF
 
-else
-if test "$cross_compiling" = yes; then
+    else
+       if test "$cross_compiling" = yes; then
   tk_ok=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 2129 "configure"
+#line 2416 "configure"
 #include "confdefs.h"
 
 #include <termio.h>
@@ -2138,9 +2425,9 @@ main()
        return 0;
     }
     return 1;
-}
+    }
 EOF
-if { (eval echo configure:2144: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2431: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   tk_ok=termio
 else
@@ -2152,17 +2439,18 @@ fi
 rm -fr conftest*
 fi
 
-if test $tk_ok = termio; then
-    cat >> confdefs.h <<\EOF
+
+    if test $tk_ok = termio; then
+       cat >> confdefs.h <<\EOF
 #define USE_TERMIO 1
 EOF
 
-else
-if test "$cross_compiling" = yes; then
+    else
+       if test "$cross_compiling" = yes; then
   tk_ok=none
 else
   cat > conftest.$ac_ext <<EOF
-#line 2166 "configure"
+#line 2454 "configure"
 #include "confdefs.h"
 
 #include <sgtty.h>
@@ -2178,7 +2466,7 @@ main()
     return 1;
 }
 EOF
-if { (eval echo configure:2182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2470: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   tk_ok=sgtty
 else
@@ -2190,15 +2478,16 @@ fi
 rm -fr conftest*
 fi
 
-if test $tk_ok = sgtty; then
-    cat >> confdefs.h <<\EOF
+    if test $tk_ok = sgtty; then
+       cat >> confdefs.h <<\EOF
 #define USE_SGTTY 1
 EOF
 
-fi
-fi
-fi
-echo "$ac_t""$tk_ok" 1>&6
+    fi
+    fi
+    fi
+    echo "$ac_t""$tk_ok" 1>&6
+
 
 #--------------------------------------------------------------------
 #      Include sys/select.h if it exists and if it supplies things
@@ -2211,16 +2500,16 @@ echo "$ac_t""$tk_ok" 1>&6
 #--------------------------------------------------------------------
 
 echo $ac_n "checking fd_set and sys/select""... $ac_c" 1>&6
-echo "configure:2215: checking fd_set and sys/select" >&5
+echo "configure:2504: checking fd_set and sys/select" >&5
 cat > conftest.$ac_ext <<EOF
-#line 2217 "configure"
+#line 2506 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int main() {
 fd_set readMask, writeMask;
 ; return 0; }
 EOF
-if { (eval echo configure:2224: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2513: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   tk_ok=yes
 else
@@ -2232,7 +2521,7 @@ fi
 rm -f conftest*
 if test $tk_ok = no; then
     cat > conftest.$ac_ext <<EOF
-#line 2236 "configure"
+#line 2525 "configure"
 #include "confdefs.h"
 #include <sys/select.h>
 EOF
@@ -2262,21 +2551,56 @@ fi
 #       Find out all about time handling differences.
 #------------------------------------------------------------------------------
 
-for ac_hdr in sys/time.h
+echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
+echo "configure:2556: checking whether struct tm is in sys/time.h or time.h" >&5
+if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2561 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <time.h>
+int main() {
+struct tm *tp; tp->tm_sec;
+; return 0; }
+EOF
+if { (eval echo configure:2569: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_struct_tm=time.h
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_struct_tm=sys/time.h
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_struct_tm" 1>&6
+if test $ac_cv_struct_tm = sys/time.h; then
+  cat >> confdefs.h <<\EOF
+#define TM_IN_SYS_TIME 1
+EOF
+
+fi
+
+
+    for ac_hdr in sys/time.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2270: checking for $ac_hdr" >&5
+echo "configure:2594: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2275 "configure"
+#line 2599 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2280: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2604: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2302,13 +2626,13 @@ else
 fi
 done
 
-echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:2307: checking whether time.h and sys/time.h may both be included" >&5
+    echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+echo "configure:2631: checking whether time.h and sys/time.h may both be included" >&5
 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2312 "configure"
+#line 2636 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -2317,7 +2641,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:2321: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2645: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -2337,47 +2661,13 @@ EOF
 
 fi
 
-echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:2342: checking whether struct tm is in sys/time.h or time.h" >&5
-if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 2347 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <time.h>
-int main() {
-struct tm *tp; tp->tm_sec;
-; return 0; }
-EOF
-if { (eval echo configure:2355: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  ac_cv_struct_tm=time.h
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_struct_tm=sys/time.h
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_struct_tm" 1>&6
-if test $ac_cv_struct_tm = sys/time.h; then
-  cat >> confdefs.h <<\EOF
-#define TM_IN_SYS_TIME 1
-EOF
-
-fi
-
-echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
-echo "configure:2376: checking for tm_zone in struct tm" >&5
+    echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
+echo "configure:2666: checking for tm_zone in struct tm" >&5
 if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2381 "configure"
+#line 2671 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_cv_struct_tm>
@@ -2385,7 +2675,7 @@ int main() {
 struct tm tm; tm.tm_zone;
 ; return 0; }
 EOF
-if { (eval echo configure:2389: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2679: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_tm_zone=yes
 else
@@ -2405,12 +2695,12 @@ EOF
 
 else
   echo $ac_n "checking for tzname""... $ac_c" 1>&6
-echo "configure:2409: checking for tzname" >&5
+echo "configure:2699: checking for tzname" >&5
 if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2414 "configure"
+#line 2704 "configure"
 #include "confdefs.h"
 #include <time.h>
 #ifndef tzname /* For SGI.  */
@@ -2420,7 +2710,7 @@ int main() {
 atoi(*tzname);
 ; return 0; }
 EOF
-if { (eval echo configure:2424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2714: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_var_tzname=yes
 else
@@ -2442,23 +2732,23 @@ EOF
 fi
 
 
-echo $ac_n "checking tm_tzadj in struct tm""... $ac_c" 1>&6
-echo "configure:2447: checking tm_tzadj in struct tm" >&5
-cat > conftest.$ac_ext <<EOF
-#line 2449 "configure"
+    echo $ac_n "checking tm_tzadj in struct tm""... $ac_c" 1>&6
+echo "configure:2737: checking tm_tzadj in struct tm" >&5
+    cat > conftest.$ac_ext <<EOF
+#line 2739 "configure"
 #include "confdefs.h"
 #include <time.h>
 int main() {
 struct tm tm; tm.tm_tzadj;
 ; return 0; }
 EOF
-if { (eval echo configure:2456: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2746: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define HAVE_TM_TZADJ 1
 EOF
 
-         echo "$ac_t""yes" 1>&6
+           echo "$ac_t""yes" 1>&6
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
@@ -2467,23 +2757,23 @@ else
 fi
 rm -f conftest*
 
-echo $ac_n "checking tm_gmtoff in struct tm""... $ac_c" 1>&6
-echo "configure:2472: checking tm_gmtoff in struct tm" >&5
-cat > conftest.$ac_ext <<EOF
-#line 2474 "configure"
+    echo $ac_n "checking tm_gmtoff in struct tm""... $ac_c" 1>&6
+echo "configure:2762: checking tm_gmtoff in struct tm" >&5
+    cat > conftest.$ac_ext <<EOF
+#line 2764 "configure"
 #include "confdefs.h"
 #include <time.h>
 int main() {
 struct tm tm; tm.tm_gmtoff;
 ; return 0; }
 EOF
-if { (eval echo configure:2481: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2771: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define HAVE_TM_GMTOFF 1
 EOF
 
-         echo "$ac_t""yes" 1>&6
+           echo "$ac_t""yes" 1>&6
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
@@ -2492,31 +2782,31 @@ else
 fi
 rm -f conftest*
 
-#
-# Its important to include time.h in this check, as some systems (like convex)
-# have timezone functions, etc.
-#
-have_timezone=no
-echo $ac_n "checking long timezone variable""... $ac_c" 1>&6
-echo "configure:2502: checking long timezone variable" >&5
-cat > conftest.$ac_ext <<EOF
-#line 2504 "configure"
+    #
+    # Its important to include time.h in this check, as some systems
+    # (like convex) have timezone functions, etc.
+    #
+    have_timezone=no
+    echo $ac_n "checking long timezone variable""... $ac_c" 1>&6
+echo "configure:2792: checking long timezone variable" >&5
+    cat > conftest.$ac_ext <<EOF
+#line 2794 "configure"
 #include "confdefs.h"
 #include <time.h>
 int main() {
 extern long timezone;
-         timezone += 1;
-         exit (0);
+           timezone += 1;
+           exit (0);
 ; return 0; }
 EOF
-if { (eval echo configure:2513: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2803: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   have_timezone=yes
-        cat >> confdefs.h <<\EOF
+           cat >> confdefs.h <<\EOF
 #define HAVE_TIMEZONE_VAR 1
 EOF
 
-         echo "$ac_t""yes" 1>&6
+           echo "$ac_t""yes" 1>&6
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
@@ -2525,30 +2815,29 @@ else
 fi
 rm -f conftest*
 
-#
-# On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
-#
-if test "$have_timezone" = no; then
-   echo $ac_n "checking time_t timezone variable""... $ac_c" 1>&6
-echo "configure:2534: checking time_t timezone variable" >&5
-   cat > conftest.$ac_ext <<EOF
-#line 2536 "configure"
+    #
+    # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
+    #
+    if test "$have_timezone" = no; then
+    echo $ac_n "checking time_t timezone variable""... $ac_c" 1>&6
+echo "configure:2824: checking time_t timezone variable" >&5
+    cat > conftest.$ac_ext <<EOF
+#line 2826 "configure"
 #include "confdefs.h"
 #include <time.h>
 int main() {
 extern time_t timezone;
-         timezone += 1;
-         exit (0);
+           timezone += 1;
+           exit (0);
 ; return 0; }
 EOF
-if { (eval echo configure:2545: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2835: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  have_timezone=yes
-        cat >> confdefs.h <<\EOF
+  cat >> confdefs.h <<\EOF
 #define HAVE_TIMEZONE_VAR 1
 EOF
 
-         echo "$ac_t""yes" 1>&6
+           echo "$ac_t""yes" 1>&6
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
@@ -2556,21 +2845,21 @@ else
   echo "$ac_t""no" 1>&6
 fi
 rm -f conftest*
-fi
+    fi
 
-#
-# On some systems (eg Solaris 2.5.1, timezone is not declared in
-# time.h unless you jump through hoops.  Instead of that, we just
-# declare it ourselves when necessary.
-#
-if test "$have_timezone" = yes; then
-   echo $ac_n "checking for timezone declaration""... $ac_c" 1>&6
-echo "configure:2569: checking for timezone declaration" >&5
-   
-   tzrx='^[    ]*extern.*timezone'
-   
-   cat > conftest.$ac_ext <<EOF
-#line 2574 "configure"
+    #
+    # On some systems (eg Solaris 2.5.1), timezone is not declared in
+    # time.h unless you jump through hoops.  Instead of that, we just
+    # declare it ourselves when necessary.
+    #
+    if test "$have_timezone" = yes; then
+       echo $ac_n "checking for timezone declaration""... $ac_c" 1>&6
+echo "configure:2858: checking for timezone declaration" >&5
+       
+       tzrx='^[        ]*extern.*timezone'
+       
+       cat > conftest.$ac_ext <<EOF
+#line 2863 "configure"
 #include "confdefs.h"
 #include <time.h>
 EOF
@@ -2578,70 +2867,268 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "$tzrx" >/dev/null 2>&1; then
   rm -rf conftest*
   
-     cat >> confdefs.h <<\EOF
+       cat >> confdefs.h <<\EOF
 #define HAVE_TIMEZONE_DECL 1
 EOF
 
-     echo "$ac_t""found" 1>&6
+       echo "$ac_t""found" 1>&6
 else
   rm -rf conftest*
   echo "$ac_t""missing" 1>&6
 fi
 rm -f conftest*
 
-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 $libbsd = yes; then
-    cat >> confdefs.h <<\EOF
-#define USE_DELTA_FOR_TZ 1
-EOF
+    fi
 
-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.
+    #
 
-#--------------------------------------------------------------------
-#      Some systems (e.g., IRIX 4.0.5) lack the st_blksize field
-#      in struct stat.
-#--------------------------------------------------------------------
-echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6
-echo "configure:2613: checking for st_blksize in struct stat" >&5
-if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then
+    if test "`uname -s`" = "AIX" ; then
+       echo $ac_n "checking for gettimeofday in -lbsd""... $ac_c" 1>&6
+echo "configure:2893: checking for gettimeofday in -lbsd" >&5
+ac_lib_var=`echo bsd'_'gettimeofday | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2618 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lbsd  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2901 "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#include <sys/stat.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char gettimeofday();
+
 int main() {
-struct stat s; s.st_blksize;
+gettimeofday()
 ; return 0; }
 EOF
-if { (eval echo configure:2626: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2912: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ac_cv_struct_st_blksize=yes
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_cv_struct_st_blksize=no
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
-fi
+LIBS="$ac_save_LIBS"
 
-echo "$ac_t""$ac_cv_struct_st_blksize" 1>&6
-if test $ac_cv_struct_st_blksize = yes; then
-  cat >> confdefs.h <<\EOF
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  libbsd=yes
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+       if test $libbsd = yes; then
+           cat >> confdefs.h <<\EOF
+#define USE_DELTA_FOR_TZ 1
+EOF
+
+       fi
+    fi
+
+
+#--------------------------------------------------------------------
+#      Some systems (e.g., IRIX 4.0.5) lack the st_blksize field
+#      in struct stat.  But we might be able to use fstatfs instead.
+#--------------------------------------------------------------------
+echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6
+echo "configure:2946: checking for st_blksize in struct stat" >&5
+if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2951 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+int main() {
+struct stat s; s.st_blksize;
+; return 0; }
+EOF
+if { (eval echo configure:2959: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_struct_st_blksize=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_struct_st_blksize=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_struct_st_blksize" 1>&6
+if test $ac_cv_struct_st_blksize = yes; then
+  cat >> confdefs.h <<\EOF
 #define HAVE_ST_BLKSIZE 1
 EOF
 
 fi
 
+echo $ac_n "checking for fstatfs""... $ac_c" 1>&6
+echo "configure:2980: checking for fstatfs" >&5
+if eval "test \"`echo '$''{'ac_cv_func_fstatfs'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2985 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char fstatfs(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char fstatfs();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_fstatfs) || defined (__stub___fstatfs)
+choke me
+#else
+fstatfs();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3008: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_fstatfs=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_fstatfs=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'fstatfs`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
+else
+  echo "$ac_t""no" 1>&6
+cat >> confdefs.h <<\EOF
+#define NO_FSTATFS 1
+EOF
+
+fi
+
+
+#--------------------------------------------------------------------
+#       Some system have no memcmp or it does not work with 8 bit
+#       data, this checks it and add memcmp.o to LIBOBJS if needed
+#--------------------------------------------------------------------
+echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
+echo "configure:3037: checking for 8-bit clean memcmp" >&5
+if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_memcmp_clean=no
+else
+  cat > conftest.$ac_ext <<EOF
+#line 3045 "configure"
+#include "confdefs.h"
+
+main()
+{
+  char c0 = 0x40, c1 = 0x80, c2 = 0x81;
+  exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
+}
+
+EOF
+if { (eval echo configure:3055: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_func_memcmp_clean=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_func_memcmp_clean=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6
+test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
+
+
+#--------------------------------------------------------------------
+#       Some system like SunOS 4 and other BSD like systems
+#       have no memmove (we assume they have bcopy instead).
+#       {The replacement define is in compat/string.h}
+#--------------------------------------------------------------------
+echo $ac_n "checking for memmove""... $ac_c" 1>&6
+echo "configure:3079: checking for memmove" >&5
+if eval "test \"`echo '$''{'ac_cv_func_memmove'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 3084 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char memmove(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char memmove();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_memmove) || defined (__stub___memmove)
+choke me
+#else
+memmove();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_memmove=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_memmove=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'memmove`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
+else
+  echo "$ac_t""no" 1>&6
+cat >> confdefs.h <<\EOF
+#define NO_MEMMOVE 1
+EOF
+ cat >> confdefs.h <<\EOF
+#define NO_STRING_H 1
+EOF
+
+fi
+
 
 #--------------------------------------------------------------------
 #      On some systems strstr is broken: it returns a pointer even
@@ -2649,12 +3136,12 @@ fi
 #--------------------------------------------------------------------
 
 echo $ac_n "checking proper strstr implementation""... $ac_c" 1>&6
-echo "configure:2653: checking proper strstr implementation" >&5
+echo "configure:3140: checking proper strstr implementation" >&5
 if test "$cross_compiling" = yes; then
   tcl_ok=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 2658 "configure"
+#line 3145 "configure"
 #include "confdefs.h"
 
 extern int strstr();
@@ -2664,7 +3151,7 @@ int main()
 }
 
 EOF
-if { (eval echo configure:2668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   tcl_ok=yes
 else
@@ -2690,12 +3177,12 @@ fi
 #--------------------------------------------------------------------
 
 echo $ac_n "checking for strtoul""... $ac_c" 1>&6
-echo "configure:2694: checking for strtoul" >&5
+echo "configure:3181: checking for strtoul" >&5
 if eval "test \"`echo '$''{'ac_cv_func_strtoul'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2699 "configure"
+#line 3186 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char strtoul(); below.  */
@@ -2718,7 +3205,7 @@ strtoul();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2722: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_strtoul=yes"
 else
@@ -2742,7 +3229,7 @@ if test "$cross_compiling" = yes; then
   tcl_ok=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 2746 "configure"
+#line 3233 "configure"
 #include "confdefs.h"
 
 extern int strtoul();
@@ -2758,7 +3245,7 @@ int main()
     exit(0);
 }
 EOF
-if { (eval echo configure:2762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3249: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -2781,12 +3268,12 @@ fi
 #--------------------------------------------------------------------
 
 echo $ac_n "checking for strtod""... $ac_c" 1>&6
-echo "configure:2785: checking for strtod" >&5
+echo "configure:3272: checking for strtod" >&5
 if eval "test \"`echo '$''{'ac_cv_func_strtod'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2790 "configure"
+#line 3277 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char strtod(); below.  */
@@ -2809,7 +3296,7 @@ strtod();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2813: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3300: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_strtod=yes"
 else
@@ -2833,7 +3320,7 @@ if test "$cross_compiling" = yes; then
   tcl_ok=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 2837 "configure"
+#line 3324 "configure"
 #include "confdefs.h"
 
 extern double strtod();
@@ -2849,7 +3336,7 @@ int main()
     exit(0);
 }
 EOF
-if { (eval echo configure:2853: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3340: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -2873,13 +3360,14 @@ fi
 #      "fixstrtod" that corrects the error.
 #--------------------------------------------------------------------
 
-echo $ac_n "checking for strtod""... $ac_c" 1>&6
-echo "configure:2878: checking for strtod" >&5
+
+    echo $ac_n "checking for strtod""... $ac_c" 1>&6
+echo "configure:3366: checking for strtod" >&5
 if eval "test \"`echo '$''{'ac_cv_func_strtod'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2883 "configure"
+#line 3371 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char strtod(); below.  */
@@ -2902,7 +3390,7 @@ strtod();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_strtod=yes"
 else
@@ -2922,29 +3410,34 @@ else
 tcl_strtod=0
 fi
 
-if test "$tcl_strtod" = 1; then
-    echo $ac_n "checking for Solaris strtod bug""... $ac_c" 1>&6
-echo "configure:2928: checking for Solaris strtod bug" >&5
-    if test "$cross_compiling" = yes; then
+    if test "$tcl_strtod" = 1; then
+       echo $ac_n "checking for Solaris2.4/Tru64 strtod bugs""... $ac_c" 1>&6
+echo "configure:3416: checking for Solaris2.4/Tru64 strtod bugs" >&5
+       if test "$cross_compiling" = yes; then
   tcl_ok=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 2933 "configure"
+#line 3421 "configure"
 #include "confdefs.h"
 
-extern double strtod();
-int main()
-{
-    char *string = "NaN";
-    char *term;
-    strtod(string, &term);
-    if ((term != string) && (term[-1] == 0)) {
-       exit(1);
-    }
-    exit(0);
-}
-EOF
-if { (eval echo configure:2948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+           extern double strtod();
+           int main()
+           {
+               char *string = "NaN", *spaceString = " ";
+               char *term;
+               double value;
+               value = strtod(string, &term);
+               if ((term != string) && (term[-1] == 0)) {
+                   exit(1);
+               }
+               value = strtod(spaceString, &term);
+               if (term == (spaceString+1)) {
+                   exit(1);
+               }
+               exit(0);
+           }
+EOF
+if { (eval echo configure:3441: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   tcl_ok=1
 else
@@ -2956,17 +3449,18 @@ fi
 rm -fr conftest*
 fi
 
-    if test $tcl_ok = 1; then
-       echo "$ac_t""ok" 1>&6
-    else
-       echo "$ac_t""buggy" 1>&6
-       LIBOBJS="$LIBOBJS fixstrtod.o"
-       cat >> confdefs.h <<\EOF
+       if test "$tcl_ok" = 1; then
+           echo "$ac_t""ok" 1>&6
+       else
+           echo "$ac_t""buggy" 1>&6
+           LIBOBJS="$LIBOBJS fixstrtod.o"
+           cat >> confdefs.h <<\EOF
 #define strtod fixstrtod
 EOF
 
+       fi
     fi
-fi
+
 
 #--------------------------------------------------------------------
 #      Check for various typedefs and provide substitutes if
@@ -2974,12 +3468,12 @@ fi
 #--------------------------------------------------------------------
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2978: checking for ANSI C header files" >&5
+echo "configure:3472: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2983 "configure"
+#line 3477 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -2987,7 +3481,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2991: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3485: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3004,7 +3498,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 3008 "configure"
+#line 3502 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -3022,7 +3516,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 3026 "configure"
+#line 3520 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -3043,7 +3537,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 3047 "configure"
+#line 3541 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -3054,7 +3548,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:3058: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -3078,12 +3572,12 @@ EOF
 fi
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:3082: checking for mode_t" >&5
+echo "configure:3576: checking for mode_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3087 "configure"
+#line 3581 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3111,12 +3605,12 @@ EOF
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:3115: checking for pid_t" >&5
+echo "configure:3609: checking for pid_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3120 "configure"
+#line 3614 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3144,12 +3638,12 @@ EOF
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:3148: checking for size_t" >&5
+echo "configure:3642: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3153 "configure"
+#line 3647 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3177,12 +3671,12 @@ EOF
 fi
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:3181: checking for uid_t in sys/types.h" >&5
+echo "configure:3675: checking for uid_t in sys/types.h" >&5
 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3186 "configure"
+#line 3680 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -3219,12 +3713,12 @@ fi
 #--------------------------------------------------------------------
 
 echo $ac_n "checking for opendir""... $ac_c" 1>&6
-echo "configure:3223: checking for opendir" >&5
+echo "configure:3717: checking for opendir" >&5
 if eval "test \"`echo '$''{'ac_cv_func_opendir'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3228 "configure"
+#line 3722 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char opendir(); below.  */
@@ -3247,7 +3741,7 @@ opendir();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3251: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3745: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_opendir=yes"
 else
@@ -3280,9 +3774,9 @@ fi
 #--------------------------------------------------------------------
 
 echo $ac_n "checking union wait""... $ac_c" 1>&6
-echo "configure:3284: checking union wait" >&5
+echo "configure:3778: checking union wait" >&5
 cat > conftest.$ac_ext <<EOF
-#line 3286 "configure"
+#line 3780 "configure"
 #include "confdefs.h"
 #include <sys/types.h> 
 #include <sys/wait.h>
@@ -3294,7 +3788,7 @@ WIFEXITED(x);             /* Generates compiler error if WIFEXITED
 
 ; return 0; }
 EOF
-if { (eval echo configure:3298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3792: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   tcl_ok=yes
 else
@@ -3318,9 +3812,9 @@ fi
 #--------------------------------------------------------------------
 
 echo $ac_n "checking matherr support""... $ac_c" 1>&6
-echo "configure:3322: checking matherr support" >&5
+echo "configure:3816: checking matherr support" >&5
 cat > conftest.$ac_ext <<EOF
-#line 3324 "configure"
+#line 3818 "configure"
 #include "confdefs.h"
 #include <math.h>
 int main() {
@@ -3331,7 +3825,7 @@ x.type = SING;
 
 ; return 0; }
 EOF
-if { (eval echo configure:3335: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3829: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   tcl_ok=yes
 else
@@ -3358,12 +3852,12 @@ fi
 #--------------------------------------------------------------------
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:3362: checking return type of signal handlers" >&5
+echo "configure:3856: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3367 "configure"
+#line 3861 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -3380,7 +3874,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:3384: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3878: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -3399,12 +3893,12 @@ EOF
 
 
 echo $ac_n "checking for vfork""... $ac_c" 1>&6
-echo "configure:3403: checking for vfork" >&5
+echo "configure:3897: checking for vfork" >&5
 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3408 "configure"
+#line 3902 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char vfork(); below.  */
@@ -3427,7 +3921,7 @@ vfork();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3431: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_vfork=yes"
 else
@@ -3449,12 +3943,12 @@ fi
 
 if test "$tcl_ok" = 1; then
     echo $ac_n "checking vfork/signal bug""... $ac_c" 1>&6
-echo "configure:3453: checking vfork/signal bug" >&5;
+echo "configure:3947: checking vfork/signal bug" >&5;
     if test "$cross_compiling" = yes; then
   tcl_ok=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 3458 "configure"
+#line 3952 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -3482,7 +3976,7 @@ main()
     exit((gotSignal) ? 0 : 1);
 }
 EOF
-if { (eval echo configure:3486: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   tcl_ok=1
 else
@@ -3515,12 +4009,12 @@ fi
 #--------------------------------------------------------------------
 
 echo $ac_n "checking for strncasecmp""... $ac_c" 1>&6
-echo "configure:3519: checking for strncasecmp" >&5
+echo "configure:4013: checking for strncasecmp" >&5
 if eval "test \"`echo '$''{'ac_cv_func_strncasecmp'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3524 "configure"
+#line 4018 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char strncasecmp(); below.  */
@@ -3543,7 +4037,7 @@ strncasecmp();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_strncasecmp=yes"
 else
@@ -3565,7 +4059,7 @@ fi
 
 if test "$tcl_ok" = 0; then
     echo $ac_n "checking for strncasecmp in -lsocket""... $ac_c" 1>&6
-echo "configure:3569: checking for strncasecmp in -lsocket" >&5
+echo "configure:4063: checking for strncasecmp in -lsocket" >&5
 ac_lib_var=`echo socket'_'strncasecmp | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3573,7 +4067,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3577 "configure"
+#line 4071 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3584,7 +4078,7 @@ int main() {
 strncasecmp()
 ; return 0; }
 EOF
-if { (eval echo configure:3588: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3608,7 +4102,7 @@ fi
 fi
 if test "$tcl_ok" = 0; then
     echo $ac_n "checking for strncasecmp in -linet""... $ac_c" 1>&6
-echo "configure:3612: checking for strncasecmp in -linet" >&5
+echo "configure:4106: checking for strncasecmp in -linet" >&5
 ac_lib_var=`echo inet'_'strncasecmp | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3616,7 +4110,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-linet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3620 "configure"
+#line 4114 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3627,7 +4121,7 @@ int main() {
 strncasecmp()
 ; return 0; }
 EOF
-if { (eval echo configure:3631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4125: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3665,12 +4159,12 @@ fi
 #--------------------------------------------------------------------
 
 echo $ac_n "checking for BSDgettimeofday""... $ac_c" 1>&6
-echo "configure:3669: checking for BSDgettimeofday" >&5
+echo "configure:4163: checking for BSDgettimeofday" >&5
 if eval "test \"`echo '$''{'ac_cv_func_BSDgettimeofday'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3674 "configure"
+#line 4168 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char BSDgettimeofday(); below.  */
@@ -3693,7 +4187,7 @@ BSDgettimeofday();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4191: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_BSDgettimeofday=yes"
 else
@@ -3714,12 +4208,12 @@ EOF
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for gettimeofday""... $ac_c" 1>&6
-echo "configure:3718: checking for gettimeofday" >&5
+echo "configure:4212: checking for gettimeofday" >&5
 if eval "test \"`echo '$''{'ac_cv_func_gettimeofday'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3723 "configure"
+#line 4217 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gettimeofday(); below.  */
@@ -3742,7 +4236,7 @@ gettimeofday();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4240: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_gettimeofday=yes"
 else
@@ -3768,9 +4262,9 @@ fi
 fi
 
 echo $ac_n "checking for gettimeofday declaration""... $ac_c" 1>&6
-echo "configure:3772: checking for gettimeofday declaration" >&5
+echo "configure:4266: checking for gettimeofday declaration" >&5
 cat > conftest.$ac_ext <<EOF
-#line 3774 "configure"
+#line 4268 "configure"
 #include "confdefs.h"
 #include <sys/time.h>
 EOF
@@ -3792,98 +4286,20 @@ rm -f conftest*
 
 
 #--------------------------------------------------------------------
-#      Interactive UNIX requires -linet instead of -lsocket, plus it
-#      needs net/errno.h to define the socket-related error codes.
-#--------------------------------------------------------------------
-
-echo $ac_n "checking for main in -linet""... $ac_c" 1>&6
-echo "configure:3801: checking for main in -linet" >&5
-ac_lib_var=`echo inet'_'main | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-linet  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 3809 "configure"
-#include "confdefs.h"
-
-int main() {
-main()
-; return 0; }
-EOF
-if { (eval echo configure:3816: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  LIBS="$LIBS -linet"
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-ac_safe=`echo "net/errno.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for net/errno.h""... $ac_c" 1>&6
-echo "configure:3838: checking for net/errno.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 3843 "configure"
-#include "confdefs.h"
-#include <net/errno.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3848: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
-#define HAVE_NET_ERRNO_H 1
-EOF
-
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-
-#--------------------------------------------------------------------
 #      The following code checks to see whether it is possible to get
 #      signed chars on this platform.  This is needed in order to
 #      properly generate sign-extended ints from character values.
 #--------------------------------------------------------------------
 
 echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6
-echo "configure:3880: checking whether char is unsigned" >&5
+echo "configure:4296: checking whether char is unsigned" >&5
 if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test "$GCC" = yes; then
   # GCC predefines this symbol on systems where it applies.
 cat > conftest.$ac_ext <<EOF
-#line 3887 "configure"
+#line 4303 "configure"
 #include "confdefs.h"
 #ifdef __CHAR_UNSIGNED__
   yes
@@ -3905,7 +4321,7 @@ if test "$cross_compiling" = yes; then
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 3909 "configure"
+#line 4325 "configure"
 #include "confdefs.h"
 /* volatile prevents gcc2 from optimizing the test away on sparcs.  */
 #if !defined(__STDC__) || __STDC__ != 1
@@ -3915,7 +4331,7 @@ main() {
   volatile char c = 255; exit(c < 0);
 }
 EOF
-if { (eval echo configure:3919: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_char_unsigned=yes
 else
@@ -3939,9 +4355,9 @@ EOF
 fi
 
 echo $ac_n "checking signed char declarations""... $ac_c" 1>&6
-echo "configure:3943: checking signed char declarations" >&5
+echo "configure:4359: checking signed char declarations" >&5
 cat > conftest.$ac_ext <<EOF
-#line 3945 "configure"
+#line 4361 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3951,7 +4367,7 @@ p = 0;
 
 ; return 0; }
 EOF
-if { (eval echo configure:3955: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4371: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   tcl_ok=yes
 else
@@ -3969,44 +4385,277 @@ EOF
 
 fi
 
+
 #--------------------------------------------------------------------
-#      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.
+# Look for libraries that we will need when compiling the Tcl shell
 #--------------------------------------------------------------------
 
-# CYGNUS LOCAL: Store any socket library(ies) in the cache, and don't
-# mess up the cache values of the functions we check for.
-echo $ac_n "checking for socket libraries""... $ac_c" 1>&6
-echo "configure:3994: checking for socket libraries" >&5
-if eval "test \"`echo '$''{'tcl_cv_lib_sockets'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  tcl_cv_lib_sockets=
-  tcl_checkBoth=0
-  unset ac_cv_func_connect
-  echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:4002: checking for connect" >&5
-if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
+
+    #--------------------------------------------------------------------
+    # 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").
+    #--------------------------------------------------------------------
+
+    echo $ac_n "checking for sin""... $ac_c" 1>&6
+echo "configure:4403: checking for sin" >&5
+if eval "test \"`echo '$''{'ac_cv_func_sin'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4007 "configure"
+#line 4408 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char connect(); below.  */
+    which can conflict with char sin(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char sin();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_sin) || defined (__stub___sin)
+choke me
+#else
+sin();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:4431: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_sin=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_sin=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'sin`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  MATH_LIBS=""
+else
+  echo "$ac_t""no" 1>&6
+MATH_LIBS="-lm"
+fi
+
+    echo $ac_n "checking for main in -lieee""... $ac_c" 1>&6
+echo "configure:4452: checking for main in -lieee" >&5
+ac_lib_var=`echo ieee'_'main | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lieee  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4460 "configure"
+#include "confdefs.h"
+
+int main() {
+main()
+; return 0; }
+EOF
+if { (eval echo configure:4467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  MATH_LIBS="-lieee $MATH_LIBS"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+    #--------------------------------------------------------------------
+    # 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
+       echo $ac_n "checking for gettimeofday in -lbsd""... $ac_c" 1>&6
+echo "configure:4499: checking for gettimeofday in -lbsd" >&5
+ac_lib_var=`echo bsd'_'gettimeofday | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lbsd  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4507 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char gettimeofday();
+
+int main() {
+gettimeofday()
+; return 0; }
+EOF
+if { (eval echo configure:4518: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  libbsd=yes
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+       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.
+    #--------------------------------------------------------------------
+
+    echo $ac_n "checking for main in -linet""... $ac_c" 1>&6
+echo "configure:4550: checking for main in -linet" >&5
+ac_lib_var=`echo inet'_'main | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-linet  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4558 "configure"
+#include "confdefs.h"
+
+int main() {
+main()
+; return 0; }
+EOF
+if { (eval echo configure:4565: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="$LIBS -linet"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    ac_safe=`echo "net/errno.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for net/errno.h""... $ac_c" 1>&6
+echo "configure:4587: checking for net/errno.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 4592 "configure"
+#include "confdefs.h"
+#include <net/errno.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:4597: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_NET_ERRNO_H 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+    #--------------------------------------------------------------------
+    #  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.
+    #--------------------------------------------------------------------
+
+    # CYGNUS LOCAL: Store any socket library(ies) in the cache, and don't
+    # mess up the cache values of the functions we check for.
+    echo $ac_n "checking for socket libraries""... $ac_c" 1>&6
+echo "configure:4643: checking for socket libraries" >&5
+if eval "test \"`echo '$''{'tcl_cv_lib_sockets'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  tcl_cv_lib_sockets=
+           tcl_checkBoth=0
+           unset ac_cv_func_connect
+           echo $ac_n "checking for connect""... $ac_c" 1>&6
+echo "configure:4651: checking for connect" >&5
+if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 4656 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char connect(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4026,7 +4675,7 @@ connect();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_connect=yes"
 else
@@ -4046,10 +4695,10 @@ else
 tcl_checkSocket=1
 fi
 
-  if test "$tcl_checkSocket" = 1; then
-      unset ac_cv_func_connect
-      echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:4053: checking for main in -lsocket" >&5
+           if test "$tcl_checkSocket" = 1; then
+               unset ac_cv_func_connect
+               echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
+echo "configure:4702: checking for main in -lsocket" >&5
 ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4057,14 +4706,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4061 "configure"
+#line 4710 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:4068: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4085,18 +4734,18 @@ else
 tcl_checkBoth=1
 fi
 
-  fi
-  if test "$tcl_checkBoth" = 1; then
-      tcl_oldLibs=$LIBS
-      LIBS="$LIBS -lsocket -lnsl"
-      unset ac_cv_func_accept
-      echo $ac_n "checking for accept""... $ac_c" 1>&6
-echo "configure:4095: checking for accept" >&5
+           fi
+           if test "$tcl_checkBoth" = 1; then
+               tcl_oldLibs=$LIBS
+               LIBS="$LIBS -lsocket -lnsl"
+               unset ac_cv_func_accept
+               echo $ac_n "checking for accept""... $ac_c" 1>&6
+echo "configure:4744: checking for accept" >&5
 if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4100 "configure"
+#line 4749 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char accept(); below.  */
@@ -4119,7 +4768,7 @@ accept();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4123: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_accept=yes"
 else
@@ -4134,24 +4783,24 @@ fi
 if eval "test \"`echo '$ac_cv_func_'accept`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   tcl_checkNsl=0
-                    tcl_cv_lib_sockets="-lsocket -lnsl"
+                   tcl_cv_lib_sockets="-lsocket -lnsl"
 else
   echo "$ac_t""no" 1>&6
 fi
 
-      unset ac_cv_func_accept
-      LIBS=$tcl_oldLibs
-  fi
-  unset ac_cv_func_gethostbyname
-  tcl_oldLibs=$LIBS
-  LIBS="$LIBS $tcl_cv_lib_sockets"
-  echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:4150: checking for gethostbyname" >&5
+               unset ac_cv_func_accept
+               LIBS=$tcl_oldLibs
+           fi
+           unset ac_cv_func_gethostbyname
+            tcl_oldLibs=$LIBS
+           LIBS="$LIBS $tcl_cv_lib_sockets"
+           echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
+echo "configure:4799: checking for gethostbyname" >&5
 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4155 "configure"
+#line 4804 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -4174,7 +4823,7 @@ gethostbyname();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_gethostbyname=yes"
 else
@@ -4192,7 +4841,7 @@ if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:4196: checking for main in -lnsl" >&5
+echo "configure:4845: checking for main in -lnsl" >&5
 ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4200,14 +4849,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4204 "configure"
+#line 4853 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:4211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
 
 fi
 
-  unset ac_cv_func_gethostbyname
-  LIBS=$tcl_oldLIBS
-
+           unset ac_cv_func_gethostbyname
+            LIBS=$tcl_oldLIBS
+       
 fi
 
 echo "$ac_t""$tcl_cv_lib_sockets" 1>&6
-test -z "$tcl_cv_lib_sockets" || LIBS="$LIBS $tcl_cv_lib_sockets"
+    test -z "$tcl_cv_lib_sockets" || LIBS="$LIBS $tcl_cv_lib_sockets"
+    
+    # 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}'
+    
+    
+
+
+# Add the threads support libraries
+
+LIBS="$LIBS$THREADS_LIBS"
 
 #--------------------------------------------------------------------
-#      The statements below define a collection of symbols related to
-#      dynamic loading and shared libraries:
-#
-#      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.
-#      LD_FLAGS -      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}.
+# The statements below define a collection of compile flags.  This
+# macro depends on the value of SHARED_BUILD, and should be called
+# after SC_ENABLE_SHARED checks the configure switches.
 #--------------------------------------------------------------------
 
-# 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.
 
-echo $ac_n "checking system version (for dynamic loading)""... $ac_c" 1>&6
-echo "configure:4297: checking system version (for dynamic loading)" >&5
-if test -f /usr/lib/NextStep/software_version; then
-    system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
+
+    # Step 0.a: Enable 64 bit support?
+
+    echo $ac_n "checking if 64bit support is requested""... $ac_c" 1>&6
+echo "configure:4913: checking if 64bit support is requested" >&5
+    # Check whether --enable-64bit or --disable-64bit was given.
+if test "${enable_64bit+set}" = set; then
+  enableval="$enable_64bit"
+  :
 else
-    system=`uname -s`-`uname -r`
-    if test "$?" -ne 0 ; then
-       echo "$ac_t""unknown (can't find uname command)" 1>&6
-       system=unknown
+  enableval="no"
+fi
+
+
+    if test "$enableval" = "yes"; then
+       do64bit=yes
     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
-       echo "$ac_t""$system" 1>&6
+       do64bit=no
     fi
+    echo "$ac_t""$do64bit" 1>&6
+
+    # Step 0.b: Enable Solaris 64 bit VIS support?
+
+    echo $ac_n "checking if 64bit Sparc VIS support is requested""... $ac_c" 1>&6
+echo "configure:4933: checking if 64bit Sparc VIS support is requested" >&5
+    # Check whether --enable-64bit-vis or --disable-64bit-vis was given.
+if test "${enable_64bit_vis+set}" = set; then
+  enableval="$enable_64bit_vis"
+  :
+else
+  enableval="no"
 fi
 
-# Step 2: check for existence of -ldl library.  This is needed because
-# Linux can use either -ldl or -ldld for dynamic loading.
 
-echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:4323: checking for dlopen in -ldl" >&5
+    if test "$enableval" = "yes"; then
+       # Force 64bit on with VIS
+       do64bit=yes
+       do64bitVIS=yes
+    else
+       do64bitVIS=no
+    fi
+    echo "$ac_t""$do64bitVIS" 1>&6
+
+    # 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.
+
+    echo $ac_n "checking system version (for dynamic loading)""... $ac_c" 1>&6
+echo "configure:4957: checking system version (for dynamic loading)" >&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
+           echo "$ac_t""unknown (can't find uname command)" 1>&6
+           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 }' /etc/.relid'`
+           fi
+           if test "`uname -s`" = "AIX" ; then
+               system=AIX-`uname -v`.`uname -r`
+           fi
+           echo "$ac_t""$system" 1>&6
+       fi
+    fi
+
+    echo $ac_n "checking if gcc is being used""... $ac_c" 1>&6
+echo "configure:4980: checking if gcc is being used" >&5
+    if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
+       using_gcc="yes"
+    else
+       using_gcc="no"
+    fi
+
+    echo "$ac_t""$using_gcc ($CC)" 1>&6
+
+    # Step 2: check for existence of -ldl library.  This is needed because
+    # Linux can use either -ldl or -ldld for dynamic loading.
+
+    echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:4993: checking for dlopen in -ldl" >&5
 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4327,7 +4997,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4331 "configure"
+#line 5001 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4338,7 +5008,7 @@ int main() {
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:4342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4360,82 +5030,149 @@ have_dl=no
 fi
 
 
-# Step 3: set configuration options based on system name and version.
+    # Step 3: set configuration options based on system name and version.
 
-fullSrcDir=`cd $srcdir; pwd`
-TCL_SHARED_LIB_SUFFIX=""
-TCL_UNSHARED_LIB_SUFFIX=""
-TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
-ECHO_VERSION='`echo ${VERSION}`'
-TCL_LIB_VERSIONS_OK=ok
-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="tclLoadDl.o"
-       DL_LIBS="-ldl"
-       LD_FLAGS=""
-       LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
-       AIX=yes
-       TCL_SHARED_LIB_SUFFIX='${VERSION}.a'
-       ;;
-    AIX-*)
-       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="tclLoadDl.o tclLoadAix.o"
-       DL_LIBS="-lld"
-       LD_FLAGS=""
-       LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
-       TCL_SHARED_LIB_SUFFIX='${VERSION}.a'
-       ;;
-    BSD/OS-2.1*|BSD/OS-3*)
-       SHLIB_CFLAGS=""
-       SHLIB_LD="shlicc -r"
-       SHLIB_LD_LIBS='${LIBS}'
-       SHLIB_SUFFIX=".so"
-       DL_OBJS="tclLoadDl.o"
-       DL_LIBS="-ldl"
-       LD_FLAGS=""
-       LD_SEARCH_FLAGS=""
-       ;;
-    dgux*)
-       SHLIB_CFLAGS="-K PIC"
-       SHLIB_LD="cc -G"
-       SHLIB_LD_LIBS=""
-       SHLIB_SUFFIX=".so"
-       DL_OBJS="tclLoadDl.o"
-       DL_LIBS="-ldl"
-       LD_FLAGS=""
-       LD_SEARCH_FLAGS=""
-       ;;
-    HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*|HP-UX-*.11.*)
-        # CYGNUS LOCAL: Handle gcc and versions of HP-UX that can't
-        # do dynamic linking.
-        echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
-echo "configure:4420: checking for shl_load in -ldld" >&5
-ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+    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
+    if test "$using_gcc" = "yes" ; then
+       CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int"
+    else
+       CFLAGS_WARNING=""
+    fi
+    TCL_NEEDS_EXP_FILE=0
+    TCL_BUILD_EXP_FILE=""
+    TCL_EXP_FILE=""
+    # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:5057: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_save_LIBS="$LIBS"
-LIBS="-ldld  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 4428 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char shl_load();
-
-int main() {
-shl_load()
-; return 0; }
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AR="ar"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+AR="$ac_cv_prog_AR"
+if test -n "$AR"; then
+  echo "$ac_t""$AR" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    STLIB_LD='${AR} cr'
+    case $system in
+       AIX-4.[2-9])
+           if test "${TCL_THREADS}" = "1" -a "$using_gcc" = "no" ; then
+               # AIX requires the _r compiler when gcc isn't being used
+               if test "${CC}" != "cc_r" ; then
+                   CC=${CC}_r
+               fi
+               echo "$ac_t""Using $CC for compiling with threads" 1>&6
+           fi
+           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="tclLoadDl.o"
+           DL_LIBS="-ldl"
+           LDFLAGS=""
+           LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+           TCL_NEEDS_EXP_FILE=1
+           TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
+           ;;
+       AIX-*)
+           if test "${TCL_THREADS}" = "1" -a "$using_gcc" = "no" ; then
+               # AIX requires the _r compiler when gcc isn't being used
+               if test "${CC}" != "cc_r" ; then
+                   CC=${CC}_r
+               fi
+               echo "$ac_t""Using $CC for compiling with threads" 1>&6
+           fi
+           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="tclLoadDl.o"
+           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="tclLoadDl.o"
+           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="tclLoadDl.o"
+           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="tclLoadDl.o"
+           DL_LIBS="-ldl"
+           LDFLAGS=""
+           LD_SEARCH_FLAGS=""
+           ;;
+       HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*|HP-UX-*.11.*)
+           SHLIB_SUFFIX=".sl"
+           echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
+echo "configure:5157: checking for shl_load in -ldld" >&5
+ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldld  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5165 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char shl_load();
+
+int main() {
+shl_load()
+; return 0; }
 EOF
-if { (eval echo configure:4439: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5176: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4456,114 +5193,92 @@ else
 tcl_ok=no
 fi
 
-        if test "$tcl_ok" = "yes"; then
-          if test "$GCC" = yes; then
-             SHLIB_CFLAGS="-fPIC"
-             SHLIB_LD="$CC -shared -fPIC"
-          else
-             SHLIB_CFLAGS="+z"
-             SHLIB_LD="ld -b"
-          fi
-
-          SHLIB_LD_LIBS=""
-          SHLIB_SUFFIX=".sl"
-          DL_OBJS="tclLoadShl.o"
-          DL_LIBS="-ldld"
-
-          # The GNU linker requires the -export-dynamic
-          # option to make all symbols visible in the dynamic symbol
-          # table.  Note that the HP linker will give errors
-          # -export-dynamic, but will still exit successfully.
-          # Adding a -L option will make it fail.
-          hold_ldflags=$LDFLAGS
-          echo $ac_n "checking for the ld -export-dynamic flag""... $ac_c" 1>&6
-echo "configure:4481: checking for the ld -export-dynamic flag" >&5
-          LDFLAGS="${LDFLAGS} -Wl,-export-dynamic -L`pwd`"
-          cat > conftest.$ac_ext <<EOF
-#line 4484 "configure"
-#include "confdefs.h"
-
-int main() {
-int i;
-; return 0; }
-EOF
-if { (eval echo configure:4491: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  found=yes
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  found=no
-fi
-rm -f conftest*
-          LDFLAGS=$hold_ldflags
-          echo "$ac_t""$found" 1>&6
-          if test $found = yes; then
-             LD_FLAGS="-Wl,-export-dynamic"
-             LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
-          else
-             LD_FLAGS="-Wl,-E"
-             LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
-          fi
-       fi
-       # END CYGNUS LOCAL
-       ;;
-    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=""
-       LD_FLAGS="-Wl,-D,08000000"
-       LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
-       TCL_SHARED_LIB_SUFFIX='${VERSION}.a'
-       ;;
-    IRIX-5.*|IRIX-6.*)
-       SHLIB_CFLAGS=""
-       SHLIB_LD="ld -n32 -shared -rdata_shared"
-       SHLIB_LD_LIBS=""
-       SHLIB_SUFFIX=".so"
-       DL_OBJS="tclLoadDl.o"
-       DL_LIBS=""
-       LD_FLAGS=""
-       LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
-       ;;
-    IRIX64-6.*)
-       SHLIB_CFLAGS=""
-       SHLIB_LD="ld -n32 -shared -rdata_shared -rpath /usr/local/lib"
-       SHLIB_LD_LIBS=""
-       SHLIB_SUFFIX=".so"
-       DL_OBJS="tclLoadDl.o"
-       DL_LIBS=""
-       LD_FLAGS=""
-       LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
-       ;;
-    Linux*)
-       SHLIB_CFLAGS="-fPIC"
-       SHLIB_LD_LIBS=""
-       SHLIB_SUFFIX=".so"
-       if test "$have_dl" = yes; then
-           SHLIB_LD="${CC} -shared"
+           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='${LIBS}'
+           SHLIB_SUFFIX=".so"
            DL_OBJS="tclLoadDl.o"
-           DL_LIBS="-ldl"
-           LD_FLAGS="-rdynamic"
-           LD_SEARCH_FLAGS=""
-       else
-           ac_safe=`echo "dld.h" | sed 'y%./+-%__p_%'`
+           DL_LIBS=""
+           LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+           if test "$using_gcc" = "yes" ; 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="tclLoadDl.o"
+           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="tclLoadDl.o"
+               DL_LIBS="-ldl"
+               LDFLAGS="-rdynamic"
+               LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+           else
+               ac_safe=`echo "dld.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for dld.h""... $ac_c" 1>&6
-echo "configure:4557: checking for dld.h" >&5
+echo "configure:5272: checking for dld.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4562 "configure"
+#line 5277 "configure"
 #include "confdefs.h"
 #include <dld.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4567: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5282: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4580,52 +5295,55 @@ fi
 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   
-               SHLIB_LD="ld -shared"
-               DL_OBJS="tclLoadDld.o"
-               DL_LIBS="-ldld"
-               LD_FLAGS=""
-               LD_SEARCH_FLAGS=""
+                   SHLIB_LD="ld -shared"
+                   DL_OBJS="tclLoadDld.o"
+                   DL_LIBS="-ldld"
+                   LDFLAGS=""
+                   LD_SEARCH_FLAGS=""
 else
   echo "$ac_t""no" 1>&6
 fi
 
-       fi
-       ;;
-    MP-RAS-02*)
-       SHLIB_CFLAGS="-K PIC"
-       SHLIB_LD="cc -G"
-       SHLIB_LD_LIBS=""
-       SHLIB_SUFFIX=".so"
-       DL_OBJS="tclLoadDl.o"
-       DL_LIBS="-ldl"
-       LD_FLAGS=""
-       LD_SEARCH_FLAGS=""
-       ;;
-    MP-RAS-*)
-       SHLIB_CFLAGS="-K PIC"
-       SHLIB_LD="cc -G"
-       SHLIB_LD_LIBS=""
-       SHLIB_SUFFIX=".so"
-       DL_OBJS="tclLoadDl.o"
-       DL_LIBS="-ldl"
-       LD_FLAGS="-Wl,-Bexport"
-       LD_SEARCH_FLAGS=""
-       ;;
-    NetBSD-*|FreeBSD-*|OpenBSD-*)
-       # Not available on all versions:  check for include file.
-       ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
+           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="tclLoadDl.o"
+           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="tclLoadDl.o"
+           DL_LIBS="-ldl"
+           LDFLAGS="-Wl,-Bexport"
+           LD_SEARCH_FLAGS=""
+           ;;
+       NetBSD-*|FreeBSD-[1-2].*|OpenBSD-*)
+           # Not available on all versions:  check for include file.
+           ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
-echo "configure:4619: checking for dlfcn.h" >&5
+echo "configure:5337: checking for dlfcn.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4624 "configure"
+#line 5342 "configure"
 #include "confdefs.h"
 #include <dlfcn.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4629: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5347: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   
-           SHLIB_CFLAGS="-fpic"
+               # NetBSD/SPARC needs -fPIC, -fpic will not do.
+               SHLIB_CFLAGS="-fPIC"
+               SHLIB_LD="ld -Bshareable -x"
+               SHLIB_LD_LIBS=""
+               SHLIB_SUFFIX=".so"
+               DL_OBJS="tclLoadDl.o"
+               DL_LIBS=""
+               LDFLAGS=""
+               LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+               echo $ac_n "checking for ELF""... $ac_c" 1>&6
+echo "configure:5374: checking for ELF" >&5
+               cat > conftest.$ac_ext <<EOF
+#line 5376 "configure"
+#include "confdefs.h"
+
+#ifdef __ELF__
+       yes
+#endif
+               
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  echo "$ac_t""yes" 1>&6
+                   SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so'
+else
+  rm -rf conftest*
+  echo "$ac_t""no" 1>&6
+                   SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
+               
+fi
+rm -f conftest*
+
+           
+else
+  echo "$ac_t""no" 1>&6
+
+               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'
+           
+fi
+
+
+           # 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="tclLoadDl.o"
            DL_LIBS=""
-           LD_FLAGS=""
+           LDFLAGS="-export-dynamic"
            LD_SEARCH_FLAGS=""
-           TCL_SHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.so.1.0'
-       
-else
-  echo "$ac_t""no" 1>&6
-
+           ;;
+       NEXTSTEP-*)
            SHLIB_CFLAGS=""
-           SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
+           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
+           cat >> confdefs.h <<\EOF
+#define _OE_SOCKETS 1
+EOF
+  # 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="tclLoadDl.o"
+           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="tclLoadDl.o"
+           DL_LIBS=""
+           LDFLAGS=""
+           LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+           if test "$using_gcc" = "no" ; then
+               EXTRA_CFLAGS="-DHAVE_TZSET -std1"
+           fi
+           # see pthread_intro(3) for pthread support on osf1, k.furukawa
+           if test "${TCL_THREADS}" = "1" ; then
+               EXTRA_CFLAGS="${EXTRA_CFLAGS} -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
+               if test "$using_gcc" = "no" ; then
+                   EXTRA_CFLAGS="${EXTRA_CFLAGS} -pthread"
+                   LDFLAGS="-pthread"
+               else
+                   LIBS=`echo $LIBS | sed s/-lpthreads//`
+                   LIBS="$LIBS -lpthread -lmach -lexc"
+               fi
+           fi
+
+           ;;
+       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=""
-           LD_FLAGS=""
+           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.
+           if test "$using_gcc" = "yes" ; then
+               SHLIB_CFLAGS="-fPIC -melf"
+               LDFLAGS="-melf -Wl,-Bexport"
+           else
+               SHLIB_CFLAGS="-Kpic -belf"
+               LDFLAGS="-belf -Wl,-Bexport"
+           fi
+           SHLIB_LD="ld -G"
+           SHLIB_LD_LIBS=""
+           SHLIB_SUFFIX=".so"
+           DL_OBJS="tclLoadDl.o"
+           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="tclLoadDl.o"
+           DL_LIBS="-ldl"
+           LDFLAGS=""
+           LD_SEARCH_FLAGS=""
+           ;;
+       SunOS-4*)
+           SHLIB_CFLAGS="-PIC"
+           SHLIB_LD="ld"
+           SHLIB_LD_LIBS=""
+           SHLIB_SUFFIX=".so"
+           DL_OBJS="tclLoadDl.o"
+           DL_LIBS="-ldl"
+           LDFLAGS=""
            LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
-           TCL_SHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.a'
-       
-fi
 
+           # 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
 
-       # FreeBSD doesn't handle version numbers with dots.
+           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"
 
-       TCL_UNSHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.a'
-       TCL_LIB_VERSIONS_OK=nodots
-       ;;
-    NEXTSTEP-*)
-       SHLIB_CFLAGS=""
-       SHLIB_LD="cc -nostdlib -r"
-       SHLIB_LD_LIBS=""
-       SHLIB_SUFFIX=".so"
-       DL_OBJS="tclLoadNext.o"
-       DL_LIBS=""
-       LD_FLAGS=""
-       LD_SEARCH_FLAGS=""
-       ;;
-    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=""
-       LD_FLAGS=""
-       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="tclLoadDl.o"
-       DL_LIBS=""
-       LD_FLAGS=""
-       LD_SEARCH_FLAGS=""
-       ;;
-    OSF1-V*)
-        # Digital OSF/1
-       SHLIB_CFLAGS=""
-       SHLIB_LD='ld -shared -expect_unresolved "*"'
-       SHLIB_LD_LIBS=""
-       SHLIB_SUFFIX=".so"
-       DL_OBJS="tclLoadDl.o"
-       DL_LIBS=""
-       LD_FLAGS=""
-       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=""
-       LD_FLAGS="-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="tclLoadDl.o"
-       DL_LIBS=""
-       LD_FLAGS="-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="tclLoadDl.o"
-       DL_LIBS="-ldl"
-       LD_FLAGS=""
-       LD_SEARCH_FLAGS=""
-       ;;
-    SunOS-4*)
-        # CYGNUS LOCAL: gcc uses a different option than native cc.
-        if test "$GCC" = yes; then
-          SHLIB_CFLAGS="-fPIC"
-          SHLIB_LD="$CC -shared -fPIC"
-       else
-          SHLIB_CFLAGS="-PIC"
-          SHLIB_LD="ld"
-       fi
-       # END CYGNUS LOCAL
-
-       SHLIB_LD_LIBS=""
-       SHLIB_SUFFIX=".so"
-       DL_OBJS="tclLoadDl.o"
-       DL_LIBS="-ldl"
-       LD_FLAGS=""
-       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
-
-       TCL_SHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.so.1.0'
-       TCL_UNSHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.a'
-       TCL_LIB_VERSIONS_OK=nodots
-       ;;
-    SunOS-5*)
-        # CYGNUS LOCAL: gcc uses a different option than native cc.
-        if test "$GCC" = yes; then
-          SHLIB_CFLAGS="-fPIC"
-          SHLIB_LD="$CC -shared -fPIC"
-       else
-          SHLIB_CFLAGS="-KPIC"
-          SHLIB_LD="/usr/ccs/bin/ld -G -z text"
-       fi
-       # END CYGNUS LOCAL
-
-       # 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="tclLoadDl.o"
-       DL_LIBS="-ldl"
-       # CYGNUS LOCAL: The GNU linker requires the -export-dynamic
-       # option to make all symbols visible in the dynamic symbol
-       # table.
-       hold_ldflags=$LDFLAGS
-       echo $ac_n "checking for the ld -export-dynamic flag""... $ac_c" 1>&6
-echo "configure:4804: checking for the ld -export-dynamic flag" >&5
-       LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
-       cat > conftest.$ac_ext <<EOF
-#line 4807 "configure"
-#include "confdefs.h"
+           # Note: need the LIBS below, otherwise Tk won't find Tcl's
+           # symbols when dynamically loaded into tclsh.
 
-int main() {
-int i;
-; return 0; }
-EOF
-if { (eval echo configure:4814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  found=yes
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  found=no
-fi
-rm -f conftest*
-       LDFLAGS=$hold_ldflags
-       echo "$ac_t""$found" 1>&6
-       if test $found = yes; then
-          LD_FLAGS="-Wl,-export-dynamic"
-          LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
-       else
-          LD_FLAGS=""
-          LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
-       fi
-       # END CYGNUS LOCAL
-       ;;
-    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=""
-       # CYGNUS LOCAL: The GNU linker doesn't accept `-D 08000000'.  It
-       # doesn't appear to be needed, either.
-       hold_ldflags="$LDFLAGS"
-       echo $ac_n "checking whether ld accepts -D 08000000""... $ac_c" 1>&6
-echo "configure:4846: checking whether ld accepts -D 08000000" >&5
-       LD_FLAGS="-Wl,-D,08000000"
-       LDFLAGS="${LDFLAGS} -Wl,-D,08000000"
-       cat > conftest.$ac_ext <<EOF
-#line 4850 "configure"
-#include "confdefs.h"
+           SHLIB_LD_LIBS='${LIBS}'
+           SHLIB_SUFFIX=".so"
+           DL_OBJS="tclLoadDl.o"
+           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 "$using_gcc" = "no" ; then
+                           do64bit_ok=yes
+                           if test "$do64bitVIS" = "yes" ; then
+                               EXTRA_CFLAGS="-xarch=v9a"
+                               LDFLAGS="-xarch=v9a"
+                           else
+                               EXTRA_CFLAGS="-xarch=v9"
+                               LDFLAGS="-xarch=v9"
+                           fi
+                       else 
+                           echo "configure: warning: "64bit mode not supported with GCC on $system"" 1>&2
+                       fi
+               else
+                   echo "configure: warning: "64bit mode only supported sparcv9 system"" 1>&2
+               fi
+           fi
+           
+           # Note: need the LIBS below, otherwise Tk won't find Tcl's
+           # symbols when dynamically loaded into tclsh.
 
-int main() {
-int i;
-; return 0; }
-EOF
-if { (eval echo configure:4857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  found=yes
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  found=no
-fi
-rm -f conftest*
-       LDFLAGS=$hold_ldflags
-       echo "$ac_t""$found" 1>&6
-       if test $found = yes; then
-          LD_FLAGS="-Wl,-D,08000000"
-       else
-          LD_FLAGS=""
-       fi
-       # END CYGNUS LOCAL
-       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="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.
-       hold_ldflags=$LDFLAGS
-       echo $ac_n "checking for ld accepts -Bexport flag""... $ac_c" 1>&6
-echo "configure:4888: checking for ld accepts -Bexport flag" >&5
-       LDFLAGS="${LDFLAGS} -Wl,-Bexport"
-       cat > conftest.$ac_ext <<EOF
-#line 4891 "configure"
+           SHLIB_LD_LIBS='${LIBS}'
+           SHLIB_SUFFIX=".so"
+           DL_OBJS="tclLoadDl.o"
+           DL_LIBS="-ldl"
+           if test "$using_gcc" = "yes" ; 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}'
+           if test "$using_gcc" = "no" ; then
+               EXTRA_CFLAGS="-DHAVE_TZSET -std1"
+           fi
+           ;;
+       UNIX_SV* | UnixWare-5*)
+           SHLIB_CFLAGS="-KPIC"
+           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.
+           hold_ldflags=$LDFLAGS
+           echo $ac_n "checking for ld accepts -Bexport flag""... $ac_c" 1>&6
+echo "configure:5631: checking for ld accepts -Bexport flag" >&5
+           LDFLAGS="${LDFLAGS} -Wl,-Bexport"
+           cat > conftest.$ac_ext <<EOF
+#line 5634 "configure"
 #include "confdefs.h"
 
 int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:4898: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5641: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   found=yes
 else
@@ -4904,81 +5647,47 @@ else
   found=no
 fi
 rm -f conftest*
-       LDFLAGS=$hold_ldflags
-       echo "$ac_t""$found" 1>&6
-       if test $found = yes; then
-         LD_FLAGS="-Wl,-Bexport"
-       else
-         LD_FLAGS=""
-       fi
-       LD_SEARCH_FLAGS=""
-       ;;
-esac
-
-# 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
-    echo $ac_n "checking sys/exec.h""... $ac_c" 1>&6
-echo "configure:4940: checking sys/exec.h" >&5
-    cat > conftest.$ac_ext <<EOF
-#line 4942 "configure"
-#include "confdefs.h"
-#include <sys/exec.h>
-int main() {
-
-       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;
+           LDFLAGS=$hold_ldflags
+           echo "$ac_t""$found" 1>&6
+           if test $found = yes; then
+           LDFLAGS="-Wl,-Bexport"
+           else
+           LDFLAGS=""
+           fi
+           LD_SEARCH_FLAGS=""
+           ;;
+    esac
 
-; return 0; }
-EOF
-if { (eval echo configure:4960: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  tcl_ok=usable
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  tcl_ok=unusable
-fi
-rm -f conftest*
-    echo "$ac_t""$tcl_ok" 1>&6
-    if test $tcl_ok = usable; then
-       cat >> confdefs.h <<\EOF
-#define USE_SYS_EXEC_H 1
-EOF
+    if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
+    echo "configure: warning: "64bit support being disabled -- don\'t know magic for this platform"" 1>&2
+    fi
 
-    else
-       echo $ac_n "checking a.out.h""... $ac_c" 1>&6
-echo "configure:4978: checking a.out.h" >&5
+    # 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
+       echo $ac_n "checking sys/exec.h""... $ac_c" 1>&6
+echo "configure:5687: checking sys/exec.h" >&5
        cat > conftest.$ac_ext <<EOF
-#line 4980 "configure"
+#line 5689 "configure"
 #include "confdefs.h"
-#include <a.out.h>
+#include <sys/exec.h>
 int main() {
 
            struct exec foo;
@@ -4991,10 +5700,10 @@ int main() {
 #endif
            flag = (foo.a_magic == OMAGIC);
            return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
-       
+    
 ; return 0; }
 EOF
-if { (eval echo configure:4998: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5707: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   tcl_ok=usable
 else
@@ -5007,16 +5716,16 @@ rm -f conftest*
        echo "$ac_t""$tcl_ok" 1>&6
        if test $tcl_ok = usable; then
            cat >> confdefs.h <<\EOF
-#define USE_A_OUT_H 1
+#define USE_SYS_EXEC_H 1
 EOF
 
        else
-           echo $ac_n "checking sys/exec_aout.h""... $ac_c" 1>&6
-echo "configure:5016: checking sys/exec_aout.h" >&5
+           echo $ac_n "checking a.out.h""... $ac_c" 1>&6
+echo "configure:5725: checking a.out.h" >&5
            cat > conftest.$ac_ext <<EOF
-#line 5018 "configure"
+#line 5727 "configure"
 #include "confdefs.h"
-#include <sys/exec_aout.h>
+#include <a.out.h>
 int main() {
 
                struct exec foo;
@@ -5027,12 +5736,12 @@ int main() {
 #else
                seek = N_TXTOFF (foo);
 #endif
-               flag = (foo.a_midmag == OMAGIC);
+               flag = (foo.a_magic == OMAGIC);
                return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
            
 ; return 0; }
 EOF
-if { (eval echo configure:5036: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5745: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   tcl_ok=usable
 else
@@ -5045,19 +5754,57 @@ rm -f conftest*
            echo "$ac_t""$tcl_ok" 1>&6
            if test $tcl_ok = usable; then
                cat >> confdefs.h <<\EOF
-#define USE_SYS_EXEC_AOUT_H 1
+#define USE_A_OUT_H 1
 EOF
 
            else
-               DL_OBJS=""
+               echo $ac_n "checking sys/exec_aout.h""... $ac_c" 1>&6
+echo "configure:5763: checking sys/exec_aout.h" >&5
+               cat > conftest.$ac_ext <<EOF
+#line 5765 "configure"
+#include "confdefs.h"
+#include <sys/exec_aout.h>
+int main() {
+
+                   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;
+               
+; return 0; }
+EOF
+if { (eval echo configure:5783: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  tcl_ok=usable
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  tcl_ok=unusable
+fi
+rm -f conftest*
+               echo "$ac_t""$tcl_ok" 1>&6
+               if test $tcl_ok = usable; then
+                   cat >> confdefs.h <<\EOF
+#define USE_SYS_EXEC_AOUT_H 1
+EOF
+
+               else
+                   DL_OBJS=""
+               fi
            fi
        fi
     fi
-fi
 
-# Step 5: disable dynamic loading if requested via a command-line switch.
+    # Step 5: disable dynamic loading if requested via a command-line switch.
 
-# Check whether --enable-load or --disable-load was given.
+    # Check whether --enable-load or --disable-load was given.
 if test "${enable_load+set}" = set; then
   enableval="$enable_load"
   tcl_ok=$enableval
@@ -5065,51 +5812,97 @@ else
   tcl_ok=yes
 fi
 
-if test "$tcl_ok" = "no"; then
-    DL_OBJS=""
-fi
+    if test "$tcl_ok" = "no"; then
+       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"
-    echo "on this system."
-    SHLIB_CFLAGS=""
-    SHLIB_LD=""
-    SHLIB_SUFFIX=""
-    DL_OBJS="tclLoadNone.o"
-    DL_LIBS=""
-    LD_FLAGS=""
-    LD_SEARCH_FLAGS=""
-    BUILD_DLTEST=""
-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"
+       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 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 "$using_gcc" = "yes" ; then
+           case $system in
+               AIX-*)
+                   ;;
+               BSD/OS*)
+                   ;;
+               IRIX*)
+                   ;;
+               NetBSD-*|FreeBSD-*|OpenBSD-*)
+                   ;;
+               RISCos-*)
+                   ;;
+               SCO_SV-3.2*)
+                   ;;
+               ULTRIX-4.*)
+                   ;;
+               *)
+                   SHLIB_CFLAGS="-fPIC"
+                   ;;
+           esac
+       fi
+    fi
 
-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
+    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
+
+# CYGNUS LOCAL
+    TCL_LIB_SUFFIX=.a
+    
+# END CYGNUS LOCAL
+
+    
+    
+    
+    
+
+
+
+    echo $ac_n "checking for build with symbols""... $ac_c" 1>&6
+echo "configure:5883: 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"
+  tcl_ok=$enableval
+else
+  tcl_ok=no
 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
+
+
+TCL_DBGX=${DBGX}
+
 #--------------------------------------------------------------------
 #      The statements below check for systems where POSIX-style
 #      non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented. 
@@ -5117,21 +5910,22 @@ fi
 #      FIONBIO approach instead.
 #--------------------------------------------------------------------
 
-for ac_hdr in sys/ioctl.h
+
+    for ac_hdr in sys/ioctl.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5125: checking for $ac_hdr" >&5
+echo "configure:5919: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5130 "configure"
+#line 5924 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5135: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5929: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5157,21 +5951,21 @@ else
 fi
 done
 
-for ac_hdr in sys/filio.h
+    for ac_hdr in sys/filio.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5165: checking for $ac_hdr" >&5
+echo "configure:5959: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5170 "configure"
+#line 5964 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5175: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5969: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5197,71 +5991,71 @@ else
 fi
 done
 
-echo $ac_n "checking FIONBIO vs. O_NONBLOCK for nonblocking I/O""... $ac_c" 1>&6
-echo "configure:5202: checking FIONBIO vs. O_NONBLOCK for nonblocking I/O" >&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
+    echo $ac_n "checking FIONBIO vs. O_NONBLOCK for nonblocking I/O""... $ac_c" 1>&6
+echo "configure:5996: checking FIONBIO vs. O_NONBLOCK for nonblocking I/O" >&5
+    if test -f /usr/lib/NextStep/software_version; then
+       system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
     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`
+       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 }' /etc/.relid'`
+           fi
+           if test "`uname -s`" = "AIX" ; then
+               system=AIX-`uname -v`.`uname -r`
+           fi
        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).
+    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*)
-       cat >> confdefs.h <<\EOF
+       OSF*)
+           cat >> confdefs.h <<\EOF
 #define USE_FIONBIO 1
 EOF
 
-       echo "$ac_t""FIONBIO" 1>&6
-       ;;
-    SunOS-4*)
-       cat >> confdefs.h <<\EOF
+           echo "$ac_t""FIONBIO" 1>&6
+           ;;
+       SunOS-4*)
+           cat >> confdefs.h <<\EOF
 #define USE_FIONBIO 1
 EOF
 
-       echo "$ac_t""FIONBIO" 1>&6
-       ;;
-    ULTRIX-4.*)
-       cat >> confdefs.h <<\EOF
+           echo "$ac_t""FIONBIO" 1>&6
+           ;;
+       ULTRIX-4.*)
+           cat >> confdefs.h <<\EOF
 #define USE_FIONBIO 1
 EOF
 
-       echo "$ac_t""FIONBIO" 1>&6
-       ;;
-    *)
-       echo "$ac_t""O_NONBLOCK" 1>&6
-       ;;
-esac
+           echo "$ac_t""FIONBIO" 1>&6
+           ;;
+       *)
+           echo "$ac_t""O_NONBLOCK" 1>&6
+           ;;
+    esac
+
 
 #--------------------------------------------------------------------
 #      The statements below define a collection of symbols related to
 #      building libtcl as a shared library instead of a static library.
 #--------------------------------------------------------------------
 
-realRanlib=$RANLIB
-if test "$TCL_SHARED_LIB_SUFFIX" = "" ; then
-    TCL_SHARED_LIB_SUFFIX='${VERSION}${SHLIB_SUFFIX}'
-fi
-if test "$TCL_UNSHARED_LIB_SUFFIX" = "" ; then
-    TCL_UNSHARED_LIB_SUFFIX='${VERSION}.a'
-fi
-# Check whether --enable-shared or --disable-shared was given.
+TCL_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
+TCL_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}
+
+
+    echo $ac_n "checking how to build libraries""... $ac_c" 1>&6
+echo "configure:6058: checking how to build libraries" >&5
+    # Check whether --enable-shared or --disable-shared was given.
 if test "${enable_shared+set}" = set; then
   enableval="$enable_shared"
   tcl_ok=$enableval
@@ -5269,24 +6063,61 @@ else
   tcl_ok=no
 fi
 
-# CYGNUS LOCAL: need extra variables for this information.
-TCL_SHARED_LIB_FILE=dummy1
-TCL_UNSHARED_LIB_FILE=dummy2
-# END CYGNUS LOCAL
-if test "$tcl_ok" = "yes" -a "${SHLIB_SUFFIX}" != "" ; then
-    TCL_SHARED_BUILD=1
+
+    if test "${enable_shared+set}" = set; then
+       enableval="$enable_shared"
+       tcl_ok=$enableval
+    else
+       tcl_ok=no
+    fi
+
+    if test "$tcl_ok" = "yes" ; then
+       echo "$ac_t""shared" 1>&6
+       SHARED_BUILD=1
+    else
+       echo "$ac_t""static" 1>&6
+       SHARED_BUILD=0
+       cat >> confdefs.h <<\EOF
+#define STATIC_BUILD 1
+EOF
+
+    fi
+
+
+if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != "" ; then
     TCL_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
     TCL_LD_SEARCH_FLAGS="${LD_SEARCH_FLAGS}"
-    eval "TCL_LIB_FILE=libtcl${TCL_SHARED_LIB_SUFFIX}"
-    TCL_SHARED_LIB_FILE="$TCL_LIB_FILE"
+    
+  libname=tcl
+  suffix=${TCL_SHARED_LIB_SUFFIX}
+
+  case "${host}" in
+    *windows32* | *mingw32* | *cygwin*)
+      eval "long_libname=\"${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+    ;;
+    *)
+      eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+    ;;
+  esac
+
+  eval "long_libname=${long_libname}"
+
+  # Trick to replace DBGX with TCL_DBGX
+  DBGX='${TCL_DBGX}'
+  eval "long_libname=${long_libname}"
+
+  TCL_LIB_FILE=$long_libname
+
+    
+    # FIXME: Why does MAKE_LIB not use a generic LIB_FILE variable
+    # that is replaced with the Makefiles specific stub lib name?
     if test "x$DL_OBJS" = "xtclLoadAout.o"; then
-       MAKE_LIB="ar cr \${TCL_LIB_FILE} \${OBJS}"
+       MAKE_LIB="\${STLIB_LD} \${TCL_LIB_FILE} \${OBJS}"
     else
        MAKE_LIB="\${SHLIB_LD} -o \${TCL_LIB_FILE} \${OBJS} ${SHLIB_LD_LIBS}"
        RANLIB=":"
     fi
 else
-    TCL_SHARED_BUILD=0
     case $system in
         BSD/OS*)
            ;;
@@ -5299,10 +6130,33 @@ else
            ;;
     esac
     TCL_SHLIB_CFLAGS=""
-    TCL_LD_SEARCH_FLAGS=""
-    eval "TCL_LIB_FILE=libtcl${TCL_UNSHARED_LIB_SUFFIX}"
-    TCL_UNSHARED_LIB_FILE="$TCL_LIB_FILE"
-    MAKE_LIB="$AR cr ${TCL_LIB_FILE} \${OBJS}"
+    TCL_LD_SEARCH_FLAGS="${LD_SEARCH_FLAGS}"
+    
+  libname=tcl
+  suffix=${TCL_UNSHARED_LIB_SUFFIX}
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "$GCC" != yes; then
+        eval "long_libname=\"${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+      else
+        eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+      fi
+    ;;
+    *)
+      eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+    ;;
+  esac
+
+  eval "long_libname=${long_libname}"
+
+  # Trick to replace DBGX with TCL_DBGX
+  DBGX='${TCL_DBGX}'
+  eval "long_libname=${long_libname}"
+
+  TCL_LIB_FILE=$long_libname
+    
+    MAKE_LIB="\${STLIB_LD} \${TCL_LIB_FILE} \${OBJS}"
 fi
 
 # Note:  in the following variable, it's important to use the absolute
 # AIX remembers this path and will attempt to use it at run-time to look
 # up the Tcl library.
 
-if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
-    TCL_BUILD_LIB_SPEC="-L`pwd` -ltcl${VERSION}"
-    TCL_LIB_SPEC="-L${exec_prefix}/lib -ltcl${VERSION}"
+if test "$SHARED_BUILD" = "0" -o $TCL_NEEDS_EXP_FILE = 0; then
+    
+  libname=tcl
+  version=$TCL_VERSION
+
+  if test "$TCL_LIB_SUFFIX" = "" ; then
+    { echo "configure: error: The TCL_LIB_SUFFIX variable is not defined" 1>&2; exit 1; }
+  fi
+
+  # If the . character is not allowed in lib name, remove it from version
+  if test "${TCL_LIB_VERSIONS_OK}" != "ok"; then
+        version=`echo $version | tr -d .`
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "$GCC" != yes; then
+        eval "short_libname=\"${TCL_VENDOR_PREFIX}${libname}${version}${TCL_LIB_SUFFIX}\""
+      else
+        short_libname="-l${TCL_VENDOR_PREFIX}${libname}${version}${TCL_DBGX}"
+      fi
+    ;;
+    *)
+      short_libname="-l${TCL_VENDOR_PREFIX}${libname}${version}\${TCL_DBGX}"
+    ;;
+  esac
+
+  TCL_LIB_FLAG=$short_libname
+
+    
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "$GCC" != yes; then
+        
+  val="`pwd`/${TCL_LIB_FLAG}"
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable TCL_BUILD_LIB_SPEC" 1>&2; exit 1; }
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        TCL_BUILD_LIB_SPEC=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        TCL_BUILD_LIB_SPEC="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      TCL_BUILD_LIB_SPEC=$val
+    ;;
+  esac
+
+      else
+        
+  val=`pwd`
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable dirname" 1>&2; exit 1; }
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        dirname=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        dirname="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      dirname=$val
+    ;;
+  esac
+
+        TCL_BUILD_LIB_SPEC="-L${dirname} ${TCL_LIB_FLAG}"
+      fi
+    ;;
+    *)
+      TCL_BUILD_LIB_SPEC="-L`pwd` ${TCL_LIB_FLAG}"
+    ;;
+  esac
+
+    
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "$GCC" != yes; then
+        
+  val="${exec_prefix}/lib/${TCL_LIB_FLAG}"
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable TCL_LIB_SPEC" 1>&2; exit 1; }
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        TCL_LIB_SPEC=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        TCL_LIB_SPEC="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      TCL_LIB_SPEC=$val
+    ;;
+  esac
+
+      else
+        
+  val=${exec_prefix}/lib
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable dirname" 1>&2; exit 1; }
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        dirname=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        dirname="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      dirname=$val
+    ;;
+  esac
+
+        TCL_LIB_SPEC="-L${dirname} ${TCL_LIB_FLAG}"
+      fi
+    ;;
+    *)
+      TCL_LIB_SPEC="-L${exec_prefix}/lib ${TCL_LIB_FLAG}"
+    ;;
+  esac
+
 else
-    TCL_BUILD_LIB_SPEC="-L`pwd` -ltcl`echo ${VERSION} | tr -d .`"
-    TCL_LIB_SPEC="-L${exec_prefix}/lib -ltcl`echo ${VERSION} | tr -d .`"
+    # FIXME: This if branch needs to be updated with respect
+    # to the library macro changes above!
+    TCL_BUILD_EXP_FILE="lib.exp"
+    eval "TCL_EXP_FILE=libtcl${TCL_EXPORT_FILE_SUFFIX}"
+
+    # Replace DBGX with TCL_DBGX
+    eval "TCL_EXP_FILE=\"${TCL_EXP_FILE}\""
+    
+    if test "$using_gcc" = "yes" ; then
+       TCL_BUILD_LIB_SPEC="-Wl,-bI:`pwd`/${TCL_BUILD_EXP_FILE} -L`pwd`"
+       TCL_LIB_SPEC="-Wl,-bI:${exec_prefix}/lib/${TCL_EXP_FILE} -L`pwd`"    
+    else
+       TCL_BUILD_LIB_SPEC="-bI:`pwd`/${TCL_BUILD_EXP_FILE}"
+       TCL_LIB_SPEC="-bI:${exec_prefix}/lib/${TCL_EXP_FILE}"    
+    fi
 fi
 
-TCL_LIB_FULL_PATH="`pwd`/${TCL_LIB_FILE}"
+  
+  val="`pwd`/${TCL_LIB_FILE}"
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable TCL_LIB_FULL_PATH" 1>&2; exit 1; }
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        TCL_LIB_FULL_PATH=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        TCL_LIB_FULL_PATH="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      TCL_LIB_FULL_PATH=$val
+    ;;
+  esac
+
+
+
+VERSION='${VERSION}'
+eval "CFG_TCL_SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}"
+eval "CFG_TCL_UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}"
+eval "CFG_TCL_EXPORT_FILE_SUFFIX=${TCL_EXPORT_FILE_SUFFIX}"
+VERSION=${TCL_VERSION}
 
 #--------------------------------------------------------------------
 #      The statements below define the symbol TCL_PACKAGE_PATH, which
@@ -5333,6 +6403,302 @@ else
     TCL_PACKAGE_PATH="${prefix}/lib"
 fi
 
+#--------------------------------------------------------------------
+#       The statements below define various symbols relating to Tcl
+#       stub support. Note that the STUB_LIB_FILE variable must
+#       be set in the Makefile before running MAKE_STUB_LIB.
+#--------------------------------------------------------------------
+
+MAKE_STUB_LIB="\${STLIB_LD} \${STUB_LIB_FILE} \${STUB_LIB_OBJS}"
+
+
+  libname=tclstub
+  suffix=${TCL_UNSHARED_LIB_SUFFIX}
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "$GCC" != yes; then
+        eval "long_libname=\"${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+      else
+        eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+      fi
+    ;;
+    *)
+      eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+    ;;
+  esac
+
+  eval "long_libname=${long_libname}"
+
+  # Trick to replace DBGX with TCL_DBGX
+  DBGX='${TCL_DBGX}'
+  eval "long_libname=${long_libname}"
+
+  TCL_STUB_LIB_FILE=$long_libname
+
+
+
+  libname=tclstub
+  version=$TCL_VERSION
+
+  if test "$TCL_LIB_SUFFIX" = "" ; then
+    { echo "configure: error: The TCL_LIB_SUFFIX variable is not defined" 1>&2; exit 1; }
+  fi
+
+  # If the . character is not allowed in lib name, remove it from version
+  if test "${TCL_LIB_VERSIONS_OK}" != "ok"; then
+        version=`echo $version | tr -d .`
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "$GCC" != yes; then
+        eval "short_libname=\"${TCL_VENDOR_PREFIX}${libname}${version}${TCL_LIB_SUFFIX}\""
+      else
+        short_libname="-l${TCL_VENDOR_PREFIX}${libname}${version}${TCL_DBGX}"
+      fi
+    ;;
+    *)
+      short_libname="-l${TCL_VENDOR_PREFIX}${libname}${version}\${TCL_DBGX}"
+    ;;
+  esac
+
+  TCL_STUB_LIB_FLAG=$short_libname
+
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "$GCC" != yes; then
+        
+  val="`pwd`/${TCL_STUB_LIB_FLAG}"
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable TCL_BUILD_STUB_LIB_SPEC" 1>&2; exit 1; }
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        TCL_BUILD_STUB_LIB_SPEC=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        TCL_BUILD_STUB_LIB_SPEC="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      TCL_BUILD_STUB_LIB_SPEC=$val
+    ;;
+  esac
+
+      else
+        
+  val=`pwd`
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable dirname" 1>&2; exit 1; }
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        dirname=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        dirname="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      dirname=$val
+    ;;
+  esac
+
+        TCL_BUILD_STUB_LIB_SPEC="-L${dirname} ${TCL_STUB_LIB_FLAG}"
+      fi
+    ;;
+    *)
+      TCL_BUILD_STUB_LIB_SPEC="-L`pwd` ${TCL_STUB_LIB_FLAG}"
+    ;;
+  esac
+
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "$GCC" != yes; then
+        
+  val="${exec_prefix}/lib/${TCL_STUB_LIB_FLAG}"
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable TCL_STUB_LIB_SPEC" 1>&2; exit 1; }
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        TCL_STUB_LIB_SPEC=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        TCL_STUB_LIB_SPEC="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      TCL_STUB_LIB_SPEC=$val
+    ;;
+  esac
+
+      else
+        
+  val=${exec_prefix}/lib
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable dirname" 1>&2; exit 1; }
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        dirname=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        dirname="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      dirname=$val
+    ;;
+  esac
+
+        TCL_STUB_LIB_SPEC="-L${dirname} ${TCL_STUB_LIB_FLAG}"
+      fi
+    ;;
+    *)
+      TCL_STUB_LIB_SPEC="-L${exec_prefix}/lib ${TCL_STUB_LIB_FLAG}"
+    ;;
+  esac
+
+
+
+  
+  val="`pwd`/${TCL_STUB_LIB_FILE}"
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable TCL_BUILD_STUB_LIB_PATH" 1>&2; exit 1; }
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        TCL_BUILD_STUB_LIB_PATH=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        TCL_BUILD_STUB_LIB_PATH="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      TCL_BUILD_STUB_LIB_PATH=$val
+    ;;
+  esac
+
+
+
+  
+  val="${exec_prefix}/lib/${TCL_STUB_LIB_FILE}"
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable TCL_STUB_LIB_PATH" 1>&2; exit 1; }
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        TCL_STUB_LIB_PATH=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        TCL_STUB_LIB_PATH="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      TCL_STUB_LIB_PATH=$val
+    ;;
+  esac
+
+
+
+#------------------------------------------------------------------------
+# tclConfig.sh refers to this by a different name
+#------------------------------------------------------------------------
+
+TCL_SHARED_BUILD=${SHARED_BUILD}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
@@ -5360,10 +6726,8 @@ fi
 
 
 
-# CYGNUS LOCAL
 
 
-# END CYGNUS LOCAL
 
 trap '' 1 2 15
 cat > confcache <<\EOF
@@ -5510,28 +6874,56 @@ s%@includedir@%$includedir%g
 s%@oldincludedir@%$oldincludedir%g
 s%@infodir@%$infodir%g
 s%@mandir@%$mandir%g
-s%@RANLIB@%$RANLIB%g
 s%@CC@%$CC%g
+s%@RANLIB@%$RANLIB%g
+s%@CPP@%$CPP%g
 s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
 s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
 s%@INSTALL_DATA@%$INSTALL_DATA%g
-s%@CPP@%$CPP%g
 s%@LIBOBJS@%$LIBOBJS%g
-s%@BUILD_DLTEST@%$BUILD_DLTEST%g
+s%@TCL_LIBS@%$TCL_LIBS%g
+s%@MATH_LIBS@%$MATH_LIBS%g
+s%@AR@%$AR%g
+s%@TCL_LIB_SUFFIX@%$TCL_LIB_SUFFIX%g
 s%@DL_LIBS@%$DL_LIBS%g
+s%@CFLAGS_DEBUG@%$CFLAGS_DEBUG%g
+s%@CFLAGS_OPTIMIZE@%$CFLAGS_OPTIMIZE%g
+s%@CFLAGS_WARNING@%$CFLAGS_WARNING%g
+s%@TCL_STUB_LIB_FILE@%$TCL_STUB_LIB_FILE%g
+s%@TCL_STUB_LIB_FLAG@%$TCL_STUB_LIB_FLAG%g
+s%@TCL_BUILD_STUB_LIB_SPEC@%$TCL_BUILD_STUB_LIB_SPEC%g
+s%@TCL_STUB_LIB_SPEC@%$TCL_STUB_LIB_SPEC%g
+s%@TCL_BUILD_STUB_LIB_PATH@%$TCL_BUILD_STUB_LIB_PATH%g
+s%@TCL_STUB_LIB_PATH@%$TCL_STUB_LIB_PATH%g
+s%@MAKE_STUB_LIB@%$MAKE_STUB_LIB%g
+s%@BUILD_DLTEST@%$BUILD_DLTEST%g
+s%@CFLAGS_DEFAULT@%$CFLAGS_DEFAULT%g
+s%@CFG_TCL_SHARED_LIB_SUFFIX@%$CFG_TCL_SHARED_LIB_SUFFIX%g
+s%@CFG_TCL_UNSHARED_LIB_SUFFIX@%$CFG_TCL_UNSHARED_LIB_SUFFIX%g
+s%@CFG_TCL_EXPORT_FILE_SUFFIX@%$CFG_TCL_EXPORT_FILE_SUFFIX%g
+s%@TCL_DBGX@%$TCL_DBGX%g
 s%@DL_OBJS@%$DL_OBJS%g
-s%@LD_FLAGS@%$LD_FLAGS%g
+s%@EXTRA_CFLAGS@%$EXTRA_CFLAGS%g
+s%@LDFLAGS_DEFAULT@%$LDFLAGS_DEFAULT%g
+s%@LDFLAGS_DEBUG@%$LDFLAGS_DEBUG%g
+s%@LDFLAGS_OPTIMIZE@%$LDFLAGS_OPTIMIZE%g
 s%@MAKE_LIB@%$MAKE_LIB%g
-s%@MATH_LIBS@%$MATH_LIBS%g
+s%@TCL_SHARED_BUILD@%$TCL_SHARED_BUILD%g
 s%@SHLIB_CFLAGS@%$SHLIB_CFLAGS%g
 s%@SHLIB_LD@%$SHLIB_LD%g
+s%@STLIB_LD@%$STLIB_LD%g
 s%@SHLIB_LD_LIBS@%$SHLIB_LD_LIBS%g
 s%@SHLIB_SUFFIX@%$SHLIB_SUFFIX%g
 s%@TCL_BUILD_LIB_SPEC@%$TCL_BUILD_LIB_SPEC%g
 s%@TCL_LD_SEARCH_FLAGS@%$TCL_LD_SEARCH_FLAGS%g
+s%@TCL_LDFLAGS_DEBUG@%$TCL_LDFLAGS_DEBUG%g
+s%@TCL_LDFLAGS_OPTIMIZE@%$TCL_LDFLAGS_OPTIMIZE%g
 s%@TCL_LIB_FILE@%$TCL_LIB_FILE%g
 s%@TCL_LIB_FULL_PATH@%$TCL_LIB_FULL_PATH%g
 s%@TCL_LIB_FLAG@%$TCL_LIB_FLAG%g
+s%@TCL_NEEDS_EXP_FILE@%$TCL_NEEDS_EXP_FILE%g
+s%@TCL_BUILD_EXP_FILE@%$TCL_BUILD_EXP_FILE%g
+s%@TCL_EXP_FILE@%$TCL_EXP_FILE%g
 s%@TCL_LIB_SPEC@%$TCL_LIB_SPEC%g
 s%@TCL_LIB_VERSIONS_OK@%$TCL_LIB_VERSIONS_OK%g
 s%@TCL_MAJOR_VERSION@%$TCL_MAJOR_VERSION%g
@@ -5539,13 +6931,12 @@ s%@TCL_MINOR_VERSION@%$TCL_MINOR_VERSION%g
 s%@TCL_PACKAGE_PATH@%$TCL_PACKAGE_PATH%g
 s%@TCL_PATCH_LEVEL@%$TCL_PATCH_LEVEL%g
 s%@TCL_SHARED_LIB_SUFFIX@%$TCL_SHARED_LIB_SUFFIX%g
-s%@TCL_SHARED_BUILD@%$TCL_SHARED_BUILD%g
 s%@TCL_SHLIB_CFLAGS@%$TCL_SHLIB_CFLAGS%g
 s%@TCL_SRC_DIR@%$TCL_SRC_DIR%g
+s%@TCL_BIN_DIR@%$TCL_BIN_DIR%g
 s%@TCL_UNSHARED_LIB_SUFFIX@%$TCL_UNSHARED_LIB_SUFFIX%g
 s%@TCL_VERSION@%$TCL_VERSION%g
-s%@TCL_SHARED_LIB_FILE@%$TCL_SHARED_LIB_FILE%g
-s%@TCL_UNSHARED_LIB_FILE@%$TCL_UNSHARED_LIB_FILE%g
+s%@VENDORPREFIX@%$VENDORPREFIX%g
 
 CEOF
 EOF
@@ -5554,7 +6945,7 @@ cat >> $CONFIG_STATUS <<\EOF
 
 # Split the substitutions into bite-sized pieces for seds with
 # small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_max_sed_cmds=60 # Maximum number of lines to put in a sed script.
 ac_file=1 # Number of current file.
 ac_beg=1 # First line for current file.
 ac_end=$ac_max_sed_cmds # Line after last line for current file.
@@ -5658,3 +7049,4 @@ chmod +x $CONFIG_STATUS
 rm -fr confdefs* $ac_clean_files
 test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
 
+
index a00c889..1572528 100755 (executable)
@@ -1,3 +1,4 @@
+#! /bin/bash -norc
 dnl    This file is an input file used by the GNU "autoconf" program to
 dnl    generate the file "configure", which is run during Tcl installation
 dnl    to configure the system for the local environment.
@@ -7,14 +8,18 @@ AC_PREREQ(2.5)
 # END CYGNUS LOCAL
 
 AC_INIT(../generic/tcl.h)
-# SCCS: @(#) configure.in 1.18 98/08/12 17:29:39
+# RCS: @(#) $Id$
 
-TCL_VERSION=8.0
+TCL_VERSION=8.3
 TCL_MAJOR_VERSION=8
-TCL_MINOR_VERSION=0
-TCL_PATCH_LEVEL=".3"
+TCL_MINOR_VERSION=3
+TCL_PATCH_LEVEL=".2"
 VERSION=${TCL_VERSION}
 
+#------------------------------------------------------------------------
+# Handle the --prefix=... option
+#------------------------------------------------------------------------
+
 if test "${prefix}" = "NONE"; then
     prefix=/usr/local
 fi
@@ -23,17 +28,14 @@ if test "${exec_prefix}" = "NONE"; then
 fi
 TCL_SRC_DIR=`cd $srcdir/..; pwd`
 
+#------------------------------------------------------------------------
+# Standard compiler checks
+#------------------------------------------------------------------------
+
+AC_PROG_CC
 AC_PROG_RANLIB
-dnl CYGNUS LOCAL: allow gcc without a special flag
-dnl AC_ARG_ENABLE(gcc, [  --enable-gcc            allow use of gcc if available],
-dnl    [tcl_ok=$enableval], [tcl_ok=no])
-dnl if test "$tcl_ok" = "yes"; then
-    AC_PROG_CC
-dnl else
-dnl    CC=${CC-cc}
-dnl AC_SUBST(CC)
-dnl fi
-dnl END CYGNUS LOCAL
+
+AC_HAVE_HEADERS(unistd.h limits.h)
 
 # CYGNUS LOCAL
 # dje/win32
@@ -54,11 +56,27 @@ AC_PROG_INSTALL
 #--------------------------------------------------------------------
 CY_AC_TCL_LYNX_POSIX
 
-# set the warning flags depending on whether or not we are using gcc
-if test "${GCC}" = "yes" ; then
-    CFLAGS_WARNING="-Wall -Wconversion"
-else
-    CFLAGS_WARNING=""
+#------------------------------------------------------------------------
+# Threads support
+#------------------------------------------------------------------------
+
+SC_ENABLE_THREADS
+
+#------------------------------------------------------------------------
+# If we're using GCC, see if the compiler understands -pipe.  If so, use it.
+# It makes compiling go faster.  (This is only a performance feature.)
+#------------------------------------------------------------------------
+
+if test -z "$no_pipe"; then
+if test -n "$GCC"; then
+  AC_MSG_CHECKING([if the compiler understands -pipe])
+  OLDCC="$CC"  
+  CC="$CC -pipe"
+  AC_TRY_COMPILE(,,
+    AC_MSG_RESULT(yes),
+    CC="$OLDCC"
+    AC_MSG_RESULT(no))
+fi  
 fi
 
 #--------------------------------------------------------------------
@@ -78,31 +96,7 @@ AC_CHECK_FUNC(strerror, , AC_DEFINE(NO_STRERROR))
 AC_CHECK_FUNC(getwd, , AC_DEFINE(NO_GETWD))
 AC_CHECK_FUNC(wait3, , AC_DEFINE(NO_WAIT3))
 AC_CHECK_FUNC(uname, , AC_DEFINE(NO_UNAME))
-
-#--------------------------------------------------------------------
-#      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
+AC_CHECK_FUNC(realpath, , AC_DEFINE(NO_REALPATH))
 
 #--------------------------------------------------------------------
 #      Supply substitutes for missing POSIX header files.  Special
@@ -113,51 +107,7 @@ fi
 #            as strstr
 #--------------------------------------------------------------------
 
-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)
-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))
-AC_HAVE_HEADERS(unistd.h)
+SC_MISSING_POSIX_HEADERS
 
 #---------------------------------------------------------------------------
 #      Determine which interface to use to talk to the serial port.
@@ -165,57 +115,7 @@ AC_HAVE_HEADERS(unistd.h)
 #      some compilers to recognize them as preprocessor directives.
 #---------------------------------------------------------------------------
 
-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_SERIAL_PORT
 
 #--------------------------------------------------------------------
 #      Include sys/select.h if it exists and if it supplies things
@@ -245,82 +145,27 @@ fi
 #       Find out all about time handling differences.
 #------------------------------------------------------------------------------
 
-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);],
-        [have_timezone=yes
-        AC_DEFINE(HAVE_TIMEZONE_VAR)
-         AC_MSG_RESULT(yes)],
-         AC_MSG_RESULT(no))
-fi
-
-#
-# On some systems (eg Solaris 2.5.1, timezone is not declared in
-# time.h unless you jump through hoops.  Instead of that, we just
-# declare it ourselves when necessary.
-#
-if test "$have_timezone" = yes; then
-   AC_MSG_CHECKING(for timezone declaration)
-   changequote(<<,>>)
-   tzrx='^[    ]*extern.*timezone'
-   changequote([,])
-   AC_EGREP_HEADER($tzrx, time.h, [
-     AC_DEFINE(HAVE_TIMEZONE_DECL)
-     AC_MSG_RESULT(found)], AC_MSG_RESULT(missing))
-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 $libbsd = yes; then
-    AC_DEFINE(USE_DELTA_FOR_TZ)
-fi
+SC_TIME_HANDLER
 
 #--------------------------------------------------------------------
 #      Some systems (e.g., IRIX 4.0.5) lack the st_blksize field
-#      in struct stat.
+#      in struct stat.  But we might be able to use fstatfs instead.
 #--------------------------------------------------------------------
 AC_STRUCT_ST_BLKSIZE
+AC_CHECK_FUNC(fstatfs, , AC_DEFINE(NO_FSTATFS))
+
+#--------------------------------------------------------------------
+#       Some system have no memcmp or it does not work with 8 bit
+#       data, this checks it and add memcmp.o to LIBOBJS if needed
+#--------------------------------------------------------------------
+AC_FUNC_MEMCMP
+
+#--------------------------------------------------------------------
+#       Some system like SunOS 4 and other BSD like systems
+#       have no memmove (we assume they have bcopy instead).
+#       {The replacement define is in compat/string.h}
+#--------------------------------------------------------------------
+AC_CHECK_FUNC(memmove, , AC_DEFINE(NO_MEMMOVE) AC_DEFINE(NO_STRING_H))
 
 #--------------------------------------------------------------------
 #      On some systems strstr is broken: it returns a pointer even
@@ -398,29 +243,7 @@ fi
 #      "fixstrtod" that corrects the error.
 #--------------------------------------------------------------------
 
-AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
-if test "$tcl_strtod" = 1; then
-    AC_MSG_CHECKING([for Solaris 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);
-}], tcl_ok=1, tcl_ok=0, tcl_ok=0)
-    if test $tcl_ok = 1; then
-       AC_MSG_RESULT(ok)
-    else
-       AC_MSG_RESULT(buggy)
-       LIBOBJS="$LIBOBJS fixstrtod.o"
-       AC_DEFINE(strtod, fixstrtod)
-    fi
-fi
+SC_BUGGY_STRTOD
 
 #--------------------------------------------------------------------
 #      Check for various typedefs and provide substitutes if
@@ -562,14 +385,6 @@ AC_EGREP_HEADER(gettimeofday, sys/time.h, AC_MSG_RESULT(present), [
 ])
 
 #--------------------------------------------------------------------
-#      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))
-
-#--------------------------------------------------------------------
 #      The following code checks to see whether it is possible to get
 #      signed chars on this platform.  This is needed in order to
 #      properly generate sign-extended ints from character values.
@@ -586,642 +401,28 @@ if test $tcl_ok = yes; then
     AC_DEFINE(HAVE_SIGNED_CHAR)
 fi
 
-#--------------------------------------------------------------------
-#      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.
-#--------------------------------------------------------------------
-
-# CYGNUS LOCAL: Store any socket library(ies) in the cache, and don't
-# mess up the cache values of the functions we check for.
-AC_CACHE_CHECK([for socket libraries], tcl_cv_lib_sockets,
- [tcl_cv_lib_sockets=
-  tcl_checkBoth=0
-  unset ac_cv_func_connect
-  AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
-  if test "$tcl_checkSocket" = 1; then
-      unset ac_cv_func_connect
-      AC_CHECK_LIB(socket, main, tcl_cv_lib_sockets="-lsocket",
-                  tcl_checkBoth=1)
-  fi
-  if test "$tcl_checkBoth" = 1; then
-      tcl_oldLibs=$LIBS
-      LIBS="$LIBS -lsocket -lnsl"
-      unset ac_cv_func_accept
-      AC_CHECK_FUNC(accept,
-                   [tcl_checkNsl=0
-                    tcl_cv_lib_sockets="-lsocket -lnsl"])
-      unset ac_cv_func_accept
-      LIBS=$tcl_oldLibs
-  fi
-  unset ac_cv_func_gethostbyname
-  tcl_oldLibs=$LIBS
-  LIBS="$LIBS $tcl_cv_lib_sockets"
-  AC_CHECK_FUNC(gethostbyname, ,
-               [AC_CHECK_LIB(nsl, main,
-                             [tcl_cv_lib_sockets="$tcl_cv_lib_sockets -lnsl"])])
-  unset ac_cv_func_gethostbyname
-  LIBS=$tcl_oldLIBS
-])
-test -z "$tcl_cv_lib_sockets" || LIBS="$LIBS $tcl_cv_lib_sockets"
 
 #--------------------------------------------------------------------
-#      The statements below define a collection of symbols related to
-#      dynamic loading and shared libraries:
-#
-#      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.
-#      LD_FLAGS -      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}.
+# Look for libraries that we will need when compiling the Tcl shell
 #--------------------------------------------------------------------
 
-# 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.
+SC_TCL_LINK_LIBS
 
-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
+# Add the threads support libraries
 
-# 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.
-
-fullSrcDir=`cd $srcdir; pwd`
-TCL_SHARED_LIB_SUFFIX=""
-TCL_UNSHARED_LIB_SUFFIX=""
-TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
-ECHO_VERSION='`echo ${VERSION}`'
-TCL_LIB_VERSIONS_OK=ok
-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="tclLoadDl.o"
-       DL_LIBS="-ldl"
-       LD_FLAGS=""
-       LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
-       AIX=yes
-       TCL_SHARED_LIB_SUFFIX='${VERSION}.a'
-       ;;
-    AIX-*)
-       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="tclLoadDl.o tclLoadAix.o"
-       DL_LIBS="-lld"
-       LD_FLAGS=""
-       LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
-       TCL_SHARED_LIB_SUFFIX='${VERSION}.a'
-       ;;
-    BSD/OS-2.1*|BSD/OS-3*)
-       SHLIB_CFLAGS=""
-       SHLIB_LD="shlicc -r"
-       SHLIB_LD_LIBS='${LIBS}'
-       SHLIB_SUFFIX=".so"
-       DL_OBJS="tclLoadDl.o"
-       DL_LIBS="-ldl"
-       LD_FLAGS=""
-       LD_SEARCH_FLAGS=""
-       ;;
-    dgux*)
-       SHLIB_CFLAGS="-K PIC"
-       SHLIB_LD="cc -G"
-       SHLIB_LD_LIBS=""
-       SHLIB_SUFFIX=".so"
-       DL_OBJS="tclLoadDl.o"
-       DL_LIBS="-ldl"
-       LD_FLAGS=""
-       LD_SEARCH_FLAGS=""
-       ;;
-    HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*|HP-UX-*.11.*)
-        # CYGNUS LOCAL: Handle gcc and versions of HP-UX that can't
-        # do dynamic linking.
-        AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
-        if test "$tcl_ok" = "yes"; then
-          if test "$GCC" = yes; then
-             SHLIB_CFLAGS="-fPIC"
-             SHLIB_LD="$CC -shared -fPIC"
-          else
-             SHLIB_CFLAGS="+z"
-             SHLIB_LD="ld -b"
-          fi
-
-          SHLIB_LD_LIBS=""
-          SHLIB_SUFFIX=".sl"
-          DL_OBJS="tclLoadShl.o"
-          DL_LIBS="-ldld"
-
-          # The GNU linker requires the -export-dynamic
-          # option to make all symbols visible in the dynamic symbol
-          # table.  Note that the HP linker will give errors
-          # -export-dynamic, but will still exit successfully.
-          # Adding a -L option will make it fail.
-          hold_ldflags=$LDFLAGS
-          AC_MSG_CHECKING(for the ld -export-dynamic flag)
-          LDFLAGS="${LDFLAGS} -Wl,-export-dynamic -L`pwd`"
-          AC_TRY_LINK(, [int i;], found=yes, found=no)
-          LDFLAGS=$hold_ldflags
-          AC_MSG_RESULT($found)
-          if test $found = yes; then
-             LD_FLAGS="-Wl,-export-dynamic"
-             LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
-          else
-             LD_FLAGS="-Wl,-E"
-             LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
-          fi
-       fi
-       # END CYGNUS LOCAL
-       ;;
-    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=""
-       LD_FLAGS="-Wl,-D,08000000"
-       LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
-       TCL_SHARED_LIB_SUFFIX='${VERSION}.a'
-       ;;
-    IRIX-5.*|IRIX-6.*)
-       SHLIB_CFLAGS=""
-       SHLIB_LD="ld -n32 -shared -rdata_shared"
-       SHLIB_LD_LIBS=""
-       SHLIB_SUFFIX=".so"
-       DL_OBJS="tclLoadDl.o"
-       DL_LIBS=""
-       LD_FLAGS=""
-       LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
-       ;;
-    IRIX64-6.*)
-       SHLIB_CFLAGS=""
-       SHLIB_LD="ld -n32 -shared -rdata_shared -rpath /usr/local/lib"
-       SHLIB_LD_LIBS=""
-       SHLIB_SUFFIX=".so"
-       DL_OBJS="tclLoadDl.o"
-       DL_LIBS=""
-       LD_FLAGS=""
-       LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
-       ;;
-    Linux*)
-       SHLIB_CFLAGS="-fPIC"
-       SHLIB_LD_LIBS=""
-       SHLIB_SUFFIX=".so"
-       if test "$have_dl" = yes; then
-           SHLIB_LD="${CC} -shared"
-           DL_OBJS="tclLoadDl.o"
-           DL_LIBS="-ldl"
-           LD_FLAGS="-rdynamic"
-           LD_SEARCH_FLAGS=""
-       else
-           AC_CHECK_HEADER(dld.h, [
-               SHLIB_LD="ld -shared"
-               DL_OBJS="tclLoadDld.o"
-               DL_LIBS="-ldld"
-               LD_FLAGS=""
-               LD_SEARCH_FLAGS=""])
-       fi
-       ;;
-    MP-RAS-02*)
-       SHLIB_CFLAGS="-K PIC"
-       SHLIB_LD="cc -G"
-       SHLIB_LD_LIBS=""
-       SHLIB_SUFFIX=".so"
-       DL_OBJS="tclLoadDl.o"
-       DL_LIBS="-ldl"
-       LD_FLAGS=""
-       LD_SEARCH_FLAGS=""
-       ;;
-    MP-RAS-*)
-       SHLIB_CFLAGS="-K PIC"
-       SHLIB_LD="cc -G"
-       SHLIB_LD_LIBS=""
-       SHLIB_SUFFIX=".so"
-       DL_OBJS="tclLoadDl.o"
-       DL_LIBS="-ldl"
-       LD_FLAGS="-Wl,-Bexport"
-       LD_SEARCH_FLAGS=""
-       ;;
-    NetBSD-*|FreeBSD-*|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="tclLoadDl.o"
-           DL_LIBS=""
-           LD_FLAGS=""
-           LD_SEARCH_FLAGS=""
-           TCL_SHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.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=""
-           LD_FLAGS=""
-           LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
-           TCL_SHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.a'
-       ])
-
-       # FreeBSD doesn't handle version numbers with dots.
-
-       TCL_UNSHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.a'
-       TCL_LIB_VERSIONS_OK=nodots
-       ;;
-    NEXTSTEP-*)
-       SHLIB_CFLAGS=""
-       SHLIB_LD="cc -nostdlib -r"
-       SHLIB_LD_LIBS=""
-       SHLIB_SUFFIX=".so"
-       DL_OBJS="tclLoadNext.o"
-       DL_LIBS=""
-       LD_FLAGS=""
-       LD_SEARCH_FLAGS=""
-       ;;
-    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=""
-       LD_FLAGS=""
-       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="tclLoadDl.o"
-       DL_LIBS=""
-       LD_FLAGS=""
-       LD_SEARCH_FLAGS=""
-       ;;
-    OSF1-V*)
-        # Digital OSF/1
-       SHLIB_CFLAGS=""
-       SHLIB_LD='ld -shared -expect_unresolved "*"'
-       SHLIB_LD_LIBS=""
-       SHLIB_SUFFIX=".so"
-       DL_OBJS="tclLoadDl.o"
-       DL_LIBS=""
-       LD_FLAGS=""
-       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=""
-       LD_FLAGS="-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="tclLoadDl.o"
-       DL_LIBS=""
-       LD_FLAGS="-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="tclLoadDl.o"
-       DL_LIBS="-ldl"
-       LD_FLAGS=""
-       LD_SEARCH_FLAGS=""
-       ;;
-    SunOS-4*)
-        # CYGNUS LOCAL: gcc uses a different option than native cc.
-        if test "$GCC" = yes; then
-          SHLIB_CFLAGS="-fPIC"
-          SHLIB_LD="$CC -shared -fPIC"
-       else
-          SHLIB_CFLAGS="-PIC"
-          SHLIB_LD="ld"
-       fi
-       # END CYGNUS LOCAL
-
-       SHLIB_LD_LIBS=""
-       SHLIB_SUFFIX=".so"
-       DL_OBJS="tclLoadDl.o"
-       DL_LIBS="-ldl"
-       LD_FLAGS=""
-       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
-
-       TCL_SHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.so.1.0'
-       TCL_UNSHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.a'
-       TCL_LIB_VERSIONS_OK=nodots
-       ;;
-    SunOS-5*)
-        # CYGNUS LOCAL: gcc uses a different option than native cc.
-        if test "$GCC" = yes; then
-          SHLIB_CFLAGS="-fPIC"
-          SHLIB_LD="$CC -shared -fPIC"
-       else
-          SHLIB_CFLAGS="-KPIC"
-          SHLIB_LD="/usr/ccs/bin/ld -G -z text"
-       fi
-       # END CYGNUS LOCAL
-
-       # 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="tclLoadDl.o"
-       DL_LIBS="-ldl"
-       # CYGNUS LOCAL: The GNU linker requires the -export-dynamic
-       # option to make all symbols visible in the dynamic symbol
-       # table.
-       hold_ldflags=$LDFLAGS
-       AC_MSG_CHECKING(for the ld -export-dynamic flag)
-       LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
-       AC_TRY_LINK(, [int i;], found=yes, found=no)
-       LDFLAGS=$hold_ldflags
-       AC_MSG_RESULT($found)
-       if test $found = yes; then
-          LD_FLAGS="-Wl,-export-dynamic"
-          LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
-       else
-          LD_FLAGS=""
-          LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
-       fi
-       # END CYGNUS LOCAL
-       ;;
-    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=""
-       # CYGNUS LOCAL: The GNU linker doesn't accept `-D 08000000'.  It
-       # doesn't appear to be needed, either.
-       hold_ldflags="$LDFLAGS"
-       AC_MSG_CHECKING(whether ld accepts -D 08000000)
-       LD_FLAGS="-Wl,-D,08000000"
-       LDFLAGS="${LDFLAGS} -Wl,-D,08000000"
-       AC_TRY_LINK(, [int i;], found=yes, found=no)
-       LDFLAGS=$hold_ldflags
-       AC_MSG_RESULT($found)
-       if test $found = yes; then
-          LD_FLAGS="-Wl,-D,08000000"
-       else
-          LD_FLAGS=""
-       fi
-       # END CYGNUS LOCAL
-       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="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.
-       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
-         LD_FLAGS="-Wl,-Bexport"
-       else
-         LD_FLAGS=""
-       fi
-       LD_SEARCH_FLAGS=""
-       ;;
-esac
-
-# 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
+LIBS="$LIBS$THREADS_LIBS"
 
-# Step 5: disable dynamic loading if requested via a command-line switch.
+#--------------------------------------------------------------------
+# The statements below define a collection of compile flags.  This
+# macro depends on the value of SHARED_BUILD, and should be called
+# after SC_ENABLE_SHARED checks the configure switches.
+#--------------------------------------------------------------------
 
-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
+SC_CONFIG_CFLAGS
 
-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"
-    echo "on this system."
-    SHLIB_CFLAGS=""
-    SHLIB_LD=""
-    SHLIB_SUFFIX=""
-    DL_OBJS="tclLoadNone.o"
-    DL_LIBS=""
-    LD_FLAGS=""
-    LD_SEARCH_FLAGS=""
-    BUILD_DLTEST=""
-fi
+SC_ENABLE_SYMBOLS
 
-# 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
+TCL_DBGX=${DBGX}
 
 #--------------------------------------------------------------------
 #      The statements below check for systems where POSIX-style
@@ -1230,83 +431,32 @@ fi
 #      FIONBIO approach instead.
 #--------------------------------------------------------------------
 
-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_BLOCKING_STYLE
 
 #--------------------------------------------------------------------
 #      The statements below define a collection of symbols related to
 #      building libtcl as a shared library instead of a static library.
 #--------------------------------------------------------------------
 
-realRanlib=$RANLIB
-if test "$TCL_SHARED_LIB_SUFFIX" = "" ; then
-    TCL_SHARED_LIB_SUFFIX='${VERSION}${SHLIB_SUFFIX}'
-fi
-if test "$TCL_UNSHARED_LIB_SUFFIX" = "" ; then
-    TCL_UNSHARED_LIB_SUFFIX='${VERSION}.a'
-fi
-AC_ARG_ENABLE(shared,
-    [  --enable-shared         build libtcl as a shared library],
-    [tcl_ok=$enableval], [tcl_ok=no])
-# CYGNUS LOCAL: need extra variables for this information.
-TCL_SHARED_LIB_FILE=dummy1
-TCL_UNSHARED_LIB_FILE=dummy2
-# END CYGNUS LOCAL
-if test "$tcl_ok" = "yes" -a "${SHLIB_SUFFIX}" != "" ; then
-    TCL_SHARED_BUILD=1
+TCL_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
+TCL_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}
+
+SC_ENABLE_SHARED
+
+if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != "" ; then
     TCL_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
     TCL_LD_SEARCH_FLAGS="${LD_SEARCH_FLAGS}"
-    eval "TCL_LIB_FILE=libtcl${TCL_SHARED_LIB_SUFFIX}"
-    TCL_SHARED_LIB_FILE="$TCL_LIB_FILE"
+    TCL_TOOL_SHARED_LIB_LONGNAME(TCL_LIB_FILE, tcl, ${TCL_SHARED_LIB_SUFFIX})
+    
+    # FIXME: Why does MAKE_LIB not use a generic LIB_FILE variable
+    # that is replaced with the Makefiles specific stub lib name?
     if test "x$DL_OBJS" = "xtclLoadAout.o"; then
-       MAKE_LIB="ar cr \${TCL_LIB_FILE} \${OBJS}"
+       MAKE_LIB="\${STLIB_LD} \${TCL_LIB_FILE} \${OBJS}"
     else
        MAKE_LIB="\${SHLIB_LD} -o \${TCL_LIB_FILE} \${OBJS} ${SHLIB_LD_LIBS}"
        RANLIB=":"
     fi
 else
-    TCL_SHARED_BUILD=0
     case $system in
         BSD/OS*)
            ;;
@@ -1319,10 +469,9 @@ else
            ;;
     esac
     TCL_SHLIB_CFLAGS=""
-    TCL_LD_SEARCH_FLAGS=""
-    eval "TCL_LIB_FILE=libtcl${TCL_UNSHARED_LIB_SUFFIX}"
-    TCL_UNSHARED_LIB_FILE="$TCL_LIB_FILE"
-    MAKE_LIB="$AR cr ${TCL_LIB_FILE} \${OBJS}"
+    TCL_LD_SEARCH_FLAGS="${LD_SEARCH_FLAGS}"
+    TCL_TOOL_STATIC_LIB_LONGNAME(TCL_LIB_FILE, tcl, ${TCL_UNSHARED_LIB_SUFFIX})    
+    MAKE_LIB="\${STLIB_LD} \${TCL_LIB_FILE} \${OBJS}"
 fi
 
 # Note:  in the following variable, it's important to use the absolute
@@ -1330,15 +479,34 @@ fi
 # AIX remembers this path and will attempt to use it at run-time to look
 # up the Tcl library.
 
-if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
-    TCL_BUILD_LIB_SPEC="-L`pwd` -ltcl${VERSION}"
-    TCL_LIB_SPEC="-L${exec_prefix}/lib -ltcl${VERSION}"
+if test "$SHARED_BUILD" = "0" -o $TCL_NEEDS_EXP_FILE = 0; then
+    TCL_TOOL_LIB_SHORTNAME(TCL_LIB_FLAG, tcl, $TCL_VERSION)
+    TCL_TOOL_LIB_SPEC(TCL_BUILD_LIB_SPEC, `pwd`, ${TCL_LIB_FLAG})
+    TCL_TOOL_LIB_SPEC(TCL_LIB_SPEC, ${exec_prefix}/lib, ${TCL_LIB_FLAG})
 else
-    TCL_BUILD_LIB_SPEC="-L`pwd` -ltcl`echo ${VERSION} | tr -d .`"
-    TCL_LIB_SPEC="-L${exec_prefix}/lib -ltcl`echo ${VERSION} | tr -d .`"
+    # FIXME: This if branch needs to be updated with respect
+    # to the library macro changes above!
+    TCL_BUILD_EXP_FILE="lib.exp"
+    eval "TCL_EXP_FILE=libtcl${TCL_EXPORT_FILE_SUFFIX}"
+
+    # Replace DBGX with TCL_DBGX
+    eval "TCL_EXP_FILE=\"${TCL_EXP_FILE}\""
+    
+    if test "$using_gcc" = "yes" ; then
+       TCL_BUILD_LIB_SPEC="-Wl,-bI:`pwd`/${TCL_BUILD_EXP_FILE} -L`pwd`"
+       TCL_LIB_SPEC="-Wl,-bI:${exec_prefix}/lib/${TCL_EXP_FILE} -L`pwd`"    
+    else
+       TCL_BUILD_LIB_SPEC="-bI:`pwd`/${TCL_BUILD_EXP_FILE}"
+       TCL_LIB_SPEC="-bI:${exec_prefix}/lib/${TCL_EXP_FILE}"    
+    fi
 fi
+TCL_TOOL_LIB_PATH(TCL_LIB_FULL_PATH, `pwd`, ${TCL_LIB_FILE})
 
-TCL_LIB_FULL_PATH="`pwd`/${TCL_LIB_FILE}"
+VERSION='${VERSION}'
+eval "CFG_TCL_SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}"
+eval "CFG_TCL_UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}"
+eval "CFG_TCL_EXPORT_FILE_SUFFIX=${TCL_EXPORT_FILE_SUFFIX}"
+VERSION=${TCL_VERSION}
 
 #--------------------------------------------------------------------
 #      The statements below define the symbol TCL_PACKAGE_PATH, which
@@ -1353,21 +521,67 @@ else
     TCL_PACKAGE_PATH="${prefix}/lib"
 fi
 
+#--------------------------------------------------------------------
+#       The statements below define various symbols relating to Tcl
+#       stub support. Note that the STUB_LIB_FILE variable must
+#       be set in the Makefile before running MAKE_STUB_LIB.
+#--------------------------------------------------------------------
+
+MAKE_STUB_LIB="\${STLIB_LD} \${STUB_LIB_FILE} \${STUB_LIB_OBJS}"
+
+TCL_TOOL_STATIC_LIB_LONGNAME(TCL_STUB_LIB_FILE, tclstub, ${TCL_UNSHARED_LIB_SUFFIX})
+
+TCL_TOOL_LIB_SHORTNAME(TCL_STUB_LIB_FLAG, tclstub, $TCL_VERSION)
+TCL_TOOL_LIB_SPEC(TCL_BUILD_STUB_LIB_SPEC, `pwd`, ${TCL_STUB_LIB_FLAG})
+TCL_TOOL_LIB_SPEC(TCL_STUB_LIB_SPEC, ${exec_prefix}/lib, ${TCL_STUB_LIB_FLAG})
+
+TCL_TOOL_LIB_PATH(TCL_BUILD_STUB_LIB_PATH, `pwd`, ${TCL_STUB_LIB_FILE})
+TCL_TOOL_LIB_PATH(TCL_STUB_LIB_PATH, ${exec_prefix}/lib, ${TCL_STUB_LIB_FILE})
+
+#------------------------------------------------------------------------
+# tclConfig.sh refers to this by a different name
+#------------------------------------------------------------------------
+
+TCL_SHARED_BUILD=${SHARED_BUILD}
+
+AC_SUBST(TCL_STUB_LIB_FILE)
+AC_SUBST(TCL_STUB_LIB_FLAG)
+AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
+AC_SUBST(TCL_STUB_LIB_SPEC)
+AC_SUBST(TCL_BUILD_STUB_LIB_PATH)
+AC_SUBST(TCL_STUB_LIB_PATH)
+AC_SUBST(MAKE_STUB_LIB)
+
 AC_SUBST(BUILD_DLTEST)
-AC_SUBST(DL_LIBS)
+AC_SUBST(CFLAGS_DEFAULT)
+AC_SUBST(CFG_TCL_SHARED_LIB_SUFFIX)
+AC_SUBST(CFG_TCL_UNSHARED_LIB_SUFFIX)
+AC_SUBST(CFG_TCL_EXPORT_FILE_SUFFIX)
+AC_SUBST(TCL_DBGX)
 AC_SUBST(DL_OBJS)
-AC_SUBST(LD_FLAGS)
+AC_SUBST(EXTRA_CFLAGS)
+AC_SUBST(LDFLAGS_DEFAULT)
+AC_SUBST(LDFLAGS_DEBUG)
+AC_SUBST(LDFLAGS_OPTIMIZE)
+AC_SUBST(AR)
+AC_SUBST(RANLIB)
 AC_SUBST(MAKE_LIB)
-AC_SUBST(MATH_LIBS)
+AC_SUBST(TCL_SHARED_BUILD)
 AC_SUBST(SHLIB_CFLAGS)
 AC_SUBST(SHLIB_LD)
+AC_SUBST(STLIB_LD)
 AC_SUBST(SHLIB_LD_LIBS)
 AC_SUBST(SHLIB_SUFFIX)
 AC_SUBST(TCL_BUILD_LIB_SPEC)
 AC_SUBST(TCL_LD_SEARCH_FLAGS)
+AC_SUBST(TCL_LDFLAGS_DEBUG)
+AC_SUBST(TCL_LDFLAGS_OPTIMIZE)
 AC_SUBST(TCL_LIB_FILE)
 AC_SUBST(TCL_LIB_FULL_PATH)
 AC_SUBST(TCL_LIB_FLAG)
+AC_SUBST(TCL_NEEDS_EXP_FILE)
+AC_SUBST(TCL_BUILD_EXP_FILE)
+AC_SUBST(TCL_EXP_FILE)
 AC_SUBST(TCL_LIB_SPEC)
 AC_SUBST(TCL_LIB_VERSIONS_OK)
 AC_SUBST(TCL_MAJOR_VERSION)
@@ -1375,14 +589,12 @@ AC_SUBST(TCL_MINOR_VERSION)
 AC_SUBST(TCL_PACKAGE_PATH)
 AC_SUBST(TCL_PATCH_LEVEL)
 AC_SUBST(TCL_SHARED_LIB_SUFFIX)
-AC_SUBST(TCL_SHARED_BUILD)
 AC_SUBST(TCL_SHLIB_CFLAGS)
 AC_SUBST(TCL_SRC_DIR)
+AC_SUBST(TCL_BIN_DIR)
 AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
 AC_SUBST(TCL_VERSION)
-# CYGNUS LOCAL
-AC_SUBST(TCL_SHARED_LIB_FILE)
-AC_SUBST(TCL_UNSHARED_LIB_FILE)
-# END CYGNUS LOCAL
+AC_SUBST(VENDORPREFIX)
 
 AC_OUTPUT(Makefile tclConfig.sh)
+
index dc6d237..342831e 100644 (file)
@@ -23,6 +23,10 @@ TCL_CC='@CC@'
 # -D flags for use with the C compiler.
 TCL_DEFS='@DEFS@'
 
+# Extensions written in gcc need -fwritable-strings. Use TCL_CFLAGS for
+# any other flags required for extensions.
+TCL_CFLAGS='@CFLAGS@'
+
 # If TCL was built with debugging symbols, generated libraries contain
 # this string at the end of the library name (before the extension).
 TCL_DBGX=@TCL_DBGX@
@@ -31,6 +35,10 @@ TCL_DBGX=@TCL_DBGX@
 TCL_CFLAGS_DEBUG='@CFLAGS_DEBUG@'
 TCL_CFLAGS_OPTIMIZE='@CFLAGS_OPTIMIZE@'
 
+# Default linker flags used in an optimized and debuggable build, respectively.
+TCL_LDFLAGS_DEBUG='@LDFLAGS_DEBUG@'
+TCL_LDFLAGS_OPTIMIZE='@LDFLAGS_OPTIMIZE@'
+
 # Flag, 1: we built a shared lib, 0 we didn't
 TCL_SHARED_BUILD=@TCL_SHARED_BUILD@
 
@@ -43,6 +51,15 @@ TCL_BIN_DIR='@TCL_BIN_DIR@'
 # The fullpath of the Tcl library (used for dependency checking)
 TCL_LIB_FULL_PATH='@TCL_LIB_FULL_PATH@'
 
+# Flag to indicate whether shared libraries need export files.
+TCL_NEEDS_EXP_FILE=@TCL_NEEDS_EXP_FILE@
+
+# String that can be evaluated to generate the part of the export file
+# name that comes after the "libxxx" (includes version number, if any,
+# extension, and anything else needed).  May depend on the variables
+# VERSION.  On most UNIX systems this is ${VERSION}.exp.
+TCL_EXPORT_FILE_SUFFIX='@CFG_TCL_EXPORT_FILE_SUFFIX@'
+
 # Additional libraries to use when linking Tcl.
 TCL_LIBS='@DL_LIBS@ @LIBS@ @MATH_LIBS@'
 
@@ -57,12 +74,18 @@ TCL_EXEC_PREFIX='@exec_prefix@'
 # Flags to pass to cc when compiling the components of a shared library:
 TCL_SHLIB_CFLAGS='@SHLIB_CFLAGS@'
 
+# Flags to pass to cc to get warning messages
+TCL_CFLAGS_WARNING='@CFLAGS_WARNING@'
+
 # Extra flags to pass to cc:
 TCL_EXTRA_CFLAGS='@EXTRA_CFLAGS@'
 
 # Base command to use for combining object files into a shared library:
 TCL_SHLIB_LD='@SHLIB_LD@'
 
+# Base command to use for combining object files into a shared library:
+TCL_STLIB_LD='@STLIB_LD@'
+
 # Either '$LIBS' (if dependent libraries should be included when linking
 # shared libraries) or an empty string.  See Tcl's configure.in for more
 # explanation.
@@ -71,13 +94,17 @@ TCL_SHLIB_LD_LIBS='@SHLIB_LD_LIBS@'
 # Suffix to use for the name of a shared library.
 TCL_SHLIB_SUFFIX='@SHLIB_SUFFIX@'
 
+# Suffix to use in the name of an unshared library.
+# FIXME: Comments in tcl.m4 about this var are incorrect!
+TCL_LIB_SUFFIX='@TCL_LIB_SUFFIX@'
+
 # Library file(s) to include in tclsh and other base applications
 # in order to provide facilities needed by DLOBJ above.
 TCL_DL_LIBS='@DL_LIBS@'
 
 # Flags to pass to the compiler when linking object files into
 # an executable tclsh or tcltest binary.
-TCL_LD_FLAGS='@LD_FLAGS@'
+TCL_LD_FLAGS='@LDFLAGS@'
 
 # 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
@@ -114,13 +141,13 @@ TCL_LIB_VERSIONS_OK='@TCL_LIB_VERSIONS_OK@'
 # extension, and anything else needed).  May depend on the variables
 # VERSION and SHLIB_SUFFIX.  On most UNIX systems this is
 # ${VERSION}${SHLIB_SUFFIX}.
-TCL_SHARED_LIB_SUFFIX='@TCL_SHARED_LIB_SUFFIX@'
+TCL_SHARED_LIB_SUFFIX='@CFG_TCL_SHARED_LIB_SUFFIX@'
 
 # String that can be evaluated to generate the part of an unshared library
 # name that comes after the "libxxx" (includes version number, if any,
 # extension, and anything else needed).  May depend on the variable
 # VERSION.  On most UNIX systems this is ${VERSION}.a.
-TCL_UNSHARED_LIB_SUFFIX='@TCL_UNSHARED_LIB_SUFFIX@'
+TCL_UNSHARED_LIB_SUFFIX='@CFG_TCL_UNSHARED_LIB_SUFFIX@'
 
 # Location of the top-level source directory from which Tcl was built.
 # This is the directory that contains a README file as well as
@@ -134,3 +161,29 @@ TCL_SRC_DIR='@TCL_SRC_DIR@'
 # "package require" commands.  Contains the "prefix" directory plus also
 # the "exec_prefix" directory, if it is different.
 TCL_PACKAGE_PATH='@TCL_PACKAGE_PATH@'
+
+# Tcl supports stub.
+TCL_SUPPORTS_STUBS=1
+
+# The name of the Tcl stub library (.a):
+TCL_STUB_LIB_FILE='@TCL_STUB_LIB_FILE@'
+
+# -l flag to pass to the linker to pick up the Tcl stub library
+TCL_STUB_LIB_FLAG='@TCL_STUB_LIB_FLAG@'
+
+# String to pass to linker to pick up the Tcl stub library from its
+# build directory.
+TCL_BUILD_STUB_LIB_SPEC='@TCL_BUILD_STUB_LIB_SPEC@'
+
+# String to pass to linker to pick up the Tcl stub library from its
+# installed directory.
+TCL_STUB_LIB_SPEC='@TCL_STUB_LIB_SPEC@'
+
+# Path to the Tcl stub library in the build directory.
+TCL_BUILD_STUB_LIB_PATH='@TCL_BUILD_STUB_LIB_PATH@'
+
+# Path to the Tcl stub library in the install directory.
+TCL_STUB_LIB_PATH='@TCL_STUB_LIB_PATH@'
+
+# Vendor prefix to be added to lib names
+TCL_VENDOR_PREFIX=@VENDORPREFIX@
index 97691d9..f43ed26 100644 (file)
-# Copyright (c) 1995-1996 Sun Microsystems, Inc.
-
-# This file is CYGNUS LOCAL.  It is a copy of makefile.vc from the
-# standard tcl distribution, modified to work with cygwin 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 = @prefix@
-exec_prefix = @exec_prefix@
-VPATH = @srcdir@:@srcdir@/../generic:@srcdir@/../compat
-srcdir = @srcdir@
-libdir = @libdir@
-bindir = @bindir@
-includedir = @includedir@
-datadir = @datadir@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-CC = @CC@
-CFLAGS = @CFLAGS@
-NM = @NM@
-AS = @AS@
-LD = @LD@
-DLLTOOL = @DLLTOOL@
-WINDRES = @WINDRES@
-
-DLL_LDFLAGS = @DLL_LDFLAGS@
-DLL_LDLIBS = @DLL_LDLIBS@
-TCL_ALLOC_OBJ = @TCL_ALLOC_OBJ@
-
-OBJEXT=@OBJEXT@
-
-# Current Tcl version;  used in various names.
-
-DIRVERSION = @TCL_VERSION@
+#
+# This file is a Makefile for Tcl.  If it has the name "Makefile.in"
+# then it is a template for a Makefile;  to generate the actual Makefile,
+# run "./configure", which is a configuration script generated by the
+# "autoconf" program (constructs like "@foo@" will get replaced in the
+# actual Makefile.
+#
+# RCS: @(#) $Id$
+
+VERSION = @TCL_VERSION@
+
+#----------------------------------------------------------------
+# Things you can change to personalize the Makefile for your own
+# site (you can make these changes in either Makefile.in or
+# Makefile, but changes to Makefile will get lost if you re-run
+# the configuration script).
+#----------------------------------------------------------------
+
+# Default top-level directories in which to install architecture-
+# specific files (exec_prefix) and machine-independent files such
+# as scripts (prefix).  The values specified here may be overridden
+# at configure-time with the --exec-prefix and --prefix options
+# to the "configure" script.
+
+prefix                 = @prefix@
+exec_prefix            = @exec_prefix@
+bindir                 = @bindir@
+libdir                 = @libdir@
+includedir             = @includedir@
+mandir                 = @mandir@
 
 # 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 =
+INSTALL_ROOT   =
 
-# Directory from which applications will reference the library of Tcl
+# Directory from which applications will reference the libary of Tcl
 # scripts (note: you can set the TCL_LIBRARY environment variable at
 # run-time to override this value):
-TCL_LIBRARY =  $(datadir)/tcl$(DIRVERSION)
-
-# Path name to use when installing library scripts:
-SCRIPT_INSTALL_DIR =   $(INSTALL_ROOT)$(TCL_LIBRARY)
+TCL_LIBRARY    = @datadir@/tcl$(VERSION)
 
-# Directory in which to install libtcl.so or libtcl.a:
-LIB_INSTALL_DIR =      $(INSTALL_ROOT)$(libdir)
+# Path to use at runtime to refer to LIB_INSTALL_DIR:
+LIB_RUNTIME_DIR                = $(libdir)
 
 # Directory in which to install the program tclsh:
-BIN_INSTALL_DIR =      $(INSTALL_ROOT)$(bindir)
+BIN_INSTALL_DIR                = $(INSTALL_ROOT)$(bindir)
+
+# Directory in which to install the .a or .so binary for the Tcl library:
+LIB_INSTALL_DIR                = $(INSTALL_ROOT)$(libdir)
+
+# Path name to use when installing library scripts.
+SCRIPT_INSTALL_DIR     = $(INSTALL_ROOT)$(TCL_LIBRARY)
 
 # Directory in which to install the include file tcl.h:
-INCLUDE_INSTALL_DIR =  $(INSTALL_ROOT)$(includedir)
+INCLUDE_INSTALL_DIR    = $(INSTALL_ROOT)$(includedir)
+
+# Top-level directory in which to install manual entries:
+MAN_INSTALL_DIR                = $(INSTALL_ROOT)$(mandir)
+
+# Directory in which to install manual entry for tclsh:
+MAN1_INSTALL_DIR = $(MAN_INSTALL_DIR)/man1
+
+# Directory in which to install manual entries for Tcl's C library
+# procedures:
+MAN3_INSTALL_DIR = $(MAN_INSTALL_DIR)/man3
+
+# Directory in which to install manual entries for the built-in
+# Tcl commands:
+MANN_INSTALL_DIR = $(MAN_INSTALL_DIR)/mann
+
+# Libraries built with optimization switches have this additional extension
+TCL_DBGX = @TCL_DBGX@
+
+# warning flags
+CFLAGS_WARNING = @CFLAGS_WARNING@
+
+# The default switches for optimization or debugging
+CFLAGS_DEBUG    = @CFLAGS_DEBUG@
+CFLAGS_OPTIMIZE        = @CFLAGS_OPTIMIZE@
+
+# To enable compilation debugging reverse the comment characters on
+# one of the following lines.
+COMPILE_DEBUG_FLAGS =
+#COMPILE_DEBUG_FLAGS = -DTCL_COMPILE_DEBUG
+#COMPILE_DEBUG_FLAGS = -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS
+
+# The default switches for optimization or debugging
+LDFLAGS_DEBUG    = @LDFLAGS_DEBUG@
+LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@
+
+# To change the compiler switches, for example to change from optimization to
+# debugging symbols, change the following line:
+#CFLAGS =              $(CFLAGS_DEBUG)
+#CFLAGS =              $(CFLAGS_OPTIMIZE)
+#CFLAGS =              $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE)
+CFLAGS =               @CFLAGS@ @CFLAGS_DEFAULT@
+
+# Special compiler flags to use when building man2tcl on Windows.
+MAN2TCLFLAGS =         @MAN2TCLFLAGS@
+
+SRC_DIR                        = @srcdir@
+ROOT_DIR               = @srcdir@/..
+GENERIC_DIR            = @srcdir@/../generic
+WIN_DIR                        = @srcdir@
+COMPAT_DIR             = @srcdir@/../compat
+
+# This converts a POSIX path to a Windows native path
+CYGPATH                        = @CYGPATH@
+
+GENERIC_DIR_NATIVE     = $(shell $(CYGPATH) '$(GENERIC_DIR)')
+WIN_DIR_NATIVE         = $(shell $(CYGPATH) '$(WIN_DIR)')
+ROOT_DIR_NATIVE                = $(shell $(CYGPATH) '$(ROOT_DIR)')
+
+LIBRARY_DIR   = $(shell echo '$(ROOT_DIR_NATIVE)/library' | sed 's/\\/\//g' )
+
+VENDORPREFIX           = @VENDORPREFIX@
+DLLSUFFIX              = @DLLSUFFIX@
+LIBSUFFIX              = @LIBSUFFIX@
+EXESUFFIX              = @EXESUFFIX@
+LIBPREFIX              = @LIBPREFIX@
+
+TCL_STUB_LIB_FILE      = @TCL_STUB_LIB_FILE@
+TCL_DLL_FILE           = @TCL_DLL_FILE@
+TCL_LIB_FILE           = @TCL_LIB_FILE@
+GNU_TCL_LIB_FILE       = @GNU_TCL_LIB_FILE@
+MSVC_TCL_LIB_FILE      = @MSVC_TCL_LIB_FILE@
+DDE_DLL_FILE           = @DDE_DLL_FILE@
+DDE_LIB_FILE           = @DDE_LIB_FILE@
+REG_DLL_FILE           = @REG_DLL_FILE@
+REG_LIB_FILE           = @REG_LIB_FILE@
+PIPE_DLL_FILE          = @PIPE_DLL_FILE@
+
+SHARED_LIBRARIES       = $(TCL_DLL_FILE) $(TCL_STUB_LIB_FILE) \
+                         $(DDE_DLL_FILE) $(REG_DLL_FILE) $(PIPE_DLL_FILE)
+STATIC_LIBRARIES       = $(TCL_LIB_FILE) $(REG_LIB_FILE) $(DDE_LIB_FILE)
+
+TCLSH                  = tclsh$(VER)${EXESUFFIX}
+TCLTEST                        = tcltest${EXEEXT}
+CAT32                  = cat32$(EXEEXT)
+MAN2TCL                        = man2tcl$(EXEEXT)
+
+SET_MAKE=@SET_MAKE@
+
+# Setting the VPATH variable to a list of paths will cause the 
+# makefile to look into these paths when resolving .c to .obj
+# dependencies.
+
+VPATH = $(GENERIC_DIR):$(WIN_DIR):$(COMPAT_DIR)
+
+AR             = @AR@
+RANLIB         = @RANLIB@
+CC             = @CC@
+RC             = @RC@
+RES            = @RES@
+AC_FLAGS       = @EXTRA_CFLAGS@ @DEFS@
+CPPFLAGS       = @CPPFLAGS@
+LDFLAGS                = @LDFLAGS@ @LDFLAGS_DEFAULT@
+LDFLAGS_CONSOLE        = @LDFLAGS_CONSOLE@
+LDFLAGS_WINDOW = @LDFLAGS_WINDOW@
+EXEEXT         = @EXEEXT@
+OBJEXT         = @OBJEXT@
+STLIB_LD       = @STLIB_LD@
+SHLIB_LD       = @SHLIB_LD@
+SHLIB_LD_LIBS  = @SHLIB_LD_LIBS@ $(LIBS)
+SHLIB_CFLAGS   = @SHLIB_CFLAGS@
+SHLIB_SUFFIX   = @SHLIB_SUFFIX@
+VER            = @TCL_MAJOR_VERSION@@TCL_MINOR_VERSION@
+DOTVER         = @TCL_MAJOR_VERSION@.@TCL_MINOR_VERSION@
+LIBS           = @LIBS@
+
+RMDIR          = rm -rf
+MKDIR          = mkdir -p
+SHELL          = @SHELL@
+RM             = rm -f
+COPY           = cp
+
+CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${TCL_SHLIB_CFLAGS} \
+-I"${GENERIC_DIR_NATIVE}" -I"${WIN_DIR_NATIVE}" ${AC_FLAGS} \
+${COMPILE_DEBUG_FLAGS}
+
+CC_OBJNAME = @CC_OBJNAME@
+CC_EXENAME = @CC_EXENAME@
+
+STUB_CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \
+-I"${GENERIC_DIR_NATIVE}" -I"${WIN_DIR_NATIVE}" ${AC_FLAGS} \
+${COMPILE_DEBUG_FLAGS}
+
+TCLTEST_OBJS = \
+       tclTest.$(OBJEXT) \
+       tclTestObj.$(OBJEXT) \
+       tclTestProcBodyObj.$(OBJEXT) \
+       tclThreadTest.$(OBJEXT) \
+       tclWinTest.$(OBJEXT) \
+       testMain.$(OBJEXT)
+
+GENERIC_OBJS = \
+       regcomp.$(OBJEXT) \
+       regexec.$(OBJEXT) \
+       regfree.$(OBJEXT) \
+       regerror.$(OBJEXT) \
+       tclAlloc.$(OBJEXT) \
+       tclAsync.$(OBJEXT) \
+       tclBasic.$(OBJEXT) \
+       tclBinary.$(OBJEXT) \
+       tclCkalloc.$(OBJEXT) \
+       tclClock.$(OBJEXT) \
+       tclCmdAH.$(OBJEXT) \
+       tclCmdIL.$(OBJEXT) \
+       tclCmdMZ.$(OBJEXT) \
+       tclCompCmds.$(OBJEXT) \
+       tclCompExpr.$(OBJEXT) \
+       tclCompile.$(OBJEXT) \
+       tclDate.$(OBJEXT) \
+       tclEncoding.$(OBJEXT) \
+       tclEnv.$(OBJEXT) \
+       tclEvent.$(OBJEXT) \
+       tclExecute.$(OBJEXT) \
+       tclFCmd.$(OBJEXT) \
+       tclFileName.$(OBJEXT) \
+       tclGet.$(OBJEXT) \
+       tclHash.$(OBJEXT) \
+       tclHistory.$(OBJEXT) \
+       tclIndexObj.$(OBJEXT) \
+       tclInterp.$(OBJEXT) \
+       tclIO.$(OBJEXT) \
+       tclIOCmd.$(OBJEXT) \
+       tclIOGT.$(OBJEXT) \
+       tclIOSock.$(OBJEXT) \
+       tclIOUtil.$(OBJEXT) \
+       tclLink.$(OBJEXT) \
+       tclLiteral.$(OBJEXT) \
+       tclListObj.$(OBJEXT) \
+       tclLoad.$(OBJEXT) \
+       tclMain.$(OBJEXT) \
+       tclNamesp.$(OBJEXT) \
+       tclNotify.$(OBJEXT) \
+       tclObj.$(OBJEXT) \
+       tclPanic.$(OBJEXT) \
+       tclParse.$(OBJEXT) \
+       tclParseExpr.$(OBJEXT) \
+       tclPipe.$(OBJEXT) \
+       tclPkg.$(OBJEXT) \
+       tclPosixStr.$(OBJEXT) \
+       tclPreserve.$(OBJEXT) \
+       tclProc.$(OBJEXT) \
+       tclRegexp.$(OBJEXT) \
+       tclResolve.$(OBJEXT) \
+       tclResult.$(OBJEXT) \
+       tclScan.$(OBJEXT) \
+       tclStringObj.$(OBJEXT) \
+       tclStubInit.$(OBJEXT) \
+       tclStubLib.$(OBJEXT) \
+       tclThread.$(OBJEXT) \
+       tclTimer.$(OBJEXT) \
+       tclUtf.$(OBJEXT) \
+       tclUtil.$(OBJEXT) \
+       tclVar.$(OBJEXT)
+
+WIN_OBJS = \
+       tclWin32Dll.$(OBJEXT) \
+       tclWinChan.$(OBJEXT) \
+       tclWinConsole.$(OBJEXT) \
+       tclWinSerial.$(OBJEXT) \
+       tclWinError.$(OBJEXT) \
+       tclWinFCmd.$(OBJEXT) \
+       tclWinFile.$(OBJEXT) \
+       tclWinInit.$(OBJEXT) \
+       tclWinLoad.$(OBJEXT) \
+       tclWinMtherr.$(OBJEXT) \
+       tclWinNotify.$(OBJEXT) \
+       tclWinPipe.$(OBJEXT) \
+       tclWinSock.$(OBJEXT) \
+       tclWinThrd.$(OBJEXT) \
+       tclWinTime.$(OBJEXT) 
+
+COMPAT_OBJS = \
+       strftime.$(OBJEXT)
+
+PIPE_OBJS = stub16.$(OBJEXT)
+
+DDE_OBJS = tclWinDde.$(OBJEXT)
+
+REG_OBJS = tclWinReg.$(OBJEXT)
+
+STUB_OBJS = tclStubLib.$(OBJEXT)
+
+TCLSH_OBJS = tclAppInit.$(OBJEXT)
+
+TCL_OBJS = ${GENERIC_OBJS} ${WIN_OBJS} ${COMPAT_OBJS}
+
+TCL_DOCS = "$(ROOT_DIR_NATIVE)"/doc/*.[13n]
+
+all: binaries libraries doc
+
+tcltest: $(TCLTEST)
+
+binaries: @LIBRARIES@ $(TCLSH)
+
+libraries:
+
+doc:
+
+winhelp: $(ROOT_DIR)/tools/man2help.tcl $(MAN2TCL)
+       TCL_LIBRARY="$(LIBRARY_DIR)"; export TCL_LIBRARY; \
+       ./$(TCLSH) "$(ROOT_DIR_NATIVE)"/tools/man2help.tcl tcl "$(VER)" $(TCL_DOCS)
+       hcw /c /e tcl.hpj
+
+$(MAN2TCL): $(ROOT_DIR)/tools/man2tcl.c
+       $(CC) $(CFLAGS_OPTIMIZE) $(MAN2TCLFLAGS) -o $(MAN2TCL) "$(ROOT_DIR_NATIVE)"/tools/man2tcl.c
+
+$(TCLSH): $(TCL_LIB_FILE) $(TCLSH_OBJS) tclsh.$(RES)
+       $(CC) $(CFLAGS) $(TCLSH_OBJS) $(TCL_LIB_FILE) $(LIBS) \
+        tclsh.$(RES) $(CC_EXENAME) 
+
+$(TCLTEST): $(TCL_LIB_FILE) $(TCLTEST_OBJS) $(CAT32) tclsh.$(RES)
+       $(CC) $(CFLAGS) $(TCLTEST_OBJS) $(TCL_LIB_FILE) $(LIBS) \
+        tclsh.$(RES) $(CC_EXENAME) 
 
-#
-# Visual C++ 2.x and 4.0 makefile
-#
-# 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.
+cat32.$(OBJEXT): cat.c
+       $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
 
-#
-# 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++.
-#
-# TOOLS16 = location of VC++ 1.5 16-bit tools, needed to build thunking
-#          library.  This information is optional; if the 16-bit compiler
-#          is not available, then the 16-bit code will not be built.  
-#          Tcl will still run without the 16-bit code, but...
-#              A. Under Windows 3.X you will any calls to the exec command
-#                 will return an error.
-#              B. A 16-bit program to test the behavior of the exec
-#                 command under NT and 95 will not be built.
-#
+$(CAT32): cat32.$(OBJEXT)
+       $(CC) $(CFLAGS) cat32.$(OBJEXT) $(CC_EXENAME) $(LDFLAGS_CONSOLE)
 
-ROOT           = $(srcdir)/..
-TMPDIR         = .
-TOOLS32                = c:\msdev
-TOOLS16                = c:\msvc
-
-# Set this to the appropriate value of /MACHINE: for your platform
-MACHINE        = IX86
-
-# Comment the following line to compile with symbols
-NODEBUG=1
-
-# uncomment one of the following lines to compile with TCL_MEM_DEBUG, 
-# TCL_MEM_DEBUG, or TCL_COMPILE_DEBUG
-#DEBUGDEFINES  = -DTCL_MEM_DEBUG
-#DEBUGDEFINES  = -DTCL_MEM_DEBUG -DTCL_COMPILE_DEBUG
-#DEBUGDEFINES  = -DTCL_MEM_DEBUG -DTCL_COMPILE_STATS
-#DEBUGDEFINES  = -DTCL_MEM_DEBUG -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS
-
-######################################################################
-# Do not modify below this line
-######################################################################
-
-VERSION = 80
-
-TCLLIB         = libtcl$(VERSION).a
-TCLDLL         = cygtcl$(VERSION).dll
-TCLPLUGINLIB   = libtcl$(VERSION)p.a
-TCLPLUGINDLL   = cygtcl$(VERSION)p.dll
-TCL16DLL       = # tcl16$(VERSION).dll
-TCLSH          = cygtclsh$(VERSION).exe
-TCLSHP         = cygtclshp$(VERSION).exe
-TCLTEST                = tcltest.exe
-DUMPEXTS       = # $(TMPDIR)\dumpexts.exe
-TCLPIPEDLL     = cygtclpip$(VERSION).dll
-TCLREGDLL      = cygtclreg$(VERSION).dll
-CAT16          = # cat16.exe
-CAT32          = cat32.exe
-
-ifeq ($(OBJEXT),obj)
-
-TCL_ALLOC_OBJ=$(TMPDIR)/tclAlloc.$(OBJEXT)
-
-endif
-
-TCLSHOBJS = \
-       $(TMPDIR)/tclAppInit.$(OBJEXT)
-
-TCLTESTOBJS = \
-       $(TMPDIR)/tclTest.$(OBJEXT) \
-       $(TMPDIR)/tclTestObj.$(OBJEXT) \
-        $(TMPDIR)/tclTestProcBodyObj.$(OBJEXT) \
-       $(TMPDIR)/tclWinTest.$(OBJEXT) \
-       $(TMPDIR)/testMain.$(OBJEXT)
-
-TCLOBJS = \
-       $(TMPDIR)/panic.$(OBJEXT) \
-       $(TMPDIR)/regexp.$(OBJEXT) \
-       $(TMPDIR)/strftime.$(OBJEXT) \
-       $(TCL_ALLOC_OBJ) \
-       $(TMPDIR)/tclAsync.o \
-       $(TMPDIR)/tclBasic.o \
-       $(TMPDIR)/tclBinary.o \
-       $(TMPDIR)/tclCkalloc.o \
-       $(TMPDIR)/tclClock.o \
-       $(TMPDIR)/tclCmdAH.o \
-       $(TMPDIR)/tclCmdIL.o \
-       $(TMPDIR)/tclCmdMZ.o \
-       $(TMPDIR)/tclCompExpr.o \
-       $(TMPDIR)/tclCompile.o \
-       $(TMPDIR)/tclDate.o \
-       $(TMPDIR)/tclEnv.o \
-       $(TMPDIR)/tclEvent.o \
-       $(TMPDIR)/tclExecute.o \
-       $(TMPDIR)/tclFCmd.o \
-       $(TMPDIR)/tclFileName.o \
-       $(TMPDIR)/tclGet.o \
-       $(TMPDIR)/tclHash.o \
-       $(TMPDIR)/tclHistory.o \
-       $(TMPDIR)/tclIndexObj.o \
-       $(TMPDIR)/tclInterp.o \
-       $(TMPDIR)/tclIO.o \
-       $(TMPDIR)/tclIOCmd.o \
-       $(TMPDIR)/tclIOSock.o \
-       $(TMPDIR)/tclIOUtil.o \
-       $(TMPDIR)/tclLink.o \
-       $(TMPDIR)/tclListObj.o \
-       $(TMPDIR)/tclLoad.o \
-       $(TMPDIR)/tclMain.o \
-       $(TMPDIR)/tclNamesp.o \
-       $(TMPDIR)/tclNotify.o \
-       $(TMPDIR)/tclObj.o \
-       $(TMPDIR)/tclParse.o \
-       $(TMPDIR)/tclPipe.o \
-       $(TMPDIR)/tclPkg.o \
-       $(TMPDIR)/tclPosixStr.o \
-       $(TMPDIR)/tclPreserve.o \
-       $(TMPDIR)/tclProc.o \
-        $(TMPDIR)/tclResolve.o \
-       $(TMPDIR)/tclStringObj.o \
-       $(TMPDIR)/tclTimer.o \
-       $(TMPDIR)/tclUtil.o \
-       $(TMPDIR)/tclVar.o \
-       $(TMPDIR)/tclWin32Dll.o \
-       $(TMPDIR)/tclWinChan.o \
-       $(TMPDIR)/tclWinError.o \
-       $(TMPDIR)/tclWinFCmd.o \
-       $(TMPDIR)/tclWinFile.o \
-       $(TMPDIR)/tclWinInit.o \
-       $(TMPDIR)/tclWinLoad.o \
-       $(TMPDIR)/tclWinMtherr.o \
-       $(TMPDIR)/tclWinNotify.o \
-       $(TMPDIR)/tclWinPipe.o \
-       $(TMPDIR)/tclWinSock.o \
-       $(TMPDIR)/tclWinTime.o 
-
-cc32           = $(TOOLS32)\bin\cl.exe
-link32         = $(TOOLS32)\bin\link.exe
-rc32           = $(TOOLS32)\bin\rc.exe
-include32      = -I$(TOOLS32)\include
-
-cc16           = $(TOOLS16)\bin\cl.exe
-link16         = $(TOOLS16)\bin\link.exe
-rc16           = $(TOOLS16)\bin\rc.exe
-include16      = -I$(TOOLS16)\include
-
-WINDIR          = $(ROOT)/win
-GENERICDIR     = $(ROOT)/generic
-
-TCL_INCLUDES   = -I$(WINDIR) -I$(GENERICDIR)
-TCL_DEFINES    = -D__WIN32__ -D__USE_W32_SOCKETS $(DEBUGDEFINES)
-
-TCL_CFLAGS     = $(cdebug) $(cflags) $(cvarsdll) \
-                       $(TCL_INCLUDES) $(TCL_DEFINES) $(CFLAGS)
-CON_CFLAGS     = $(cdebug) $(cflags) $(cvars) -DCONSOLE
-DOS_CFLAGS     = $(cdebug) $(cflags) $(include16) -AL 
-DLL16_CFLAGS   = $(cdebug) $(cflags) $(include16) -ALw
-
-linkdebug =
-conlflags = -Wl,--subsystem,console -mwindows
-conlibsdll =
-
-######################################################################
-# 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 = -Wl,--subsystem,console -mwindows
-guilflags = -mwindows
-dlllflags =
-
-#!IF "$(MACHINE)" == "PPC"
-#libc = libc.lib
-#libcdll = crtdll.lib
-#!ELSE
-#libc = libc.lib oldnames.lib
-#libcdll = msvcrt.lib oldnames.lib
-#!ENDIF
-
-ifeq ($(OBJEXT),o)
-
-baselibs   = -lkernel32 $(optlibs) -ladvapi32 -luser32
-winlibs    = $(baselibs) -lgdi32 -lcomdlg32 -lwinspool
-
-else
-
-baselibs   = kernel32.lib $(optlibs) advapi32.lib user32.lib
-winlibs    = $(baselibs) gdi32.lib comdlg32.lib winspool.lib
-libcdll    = msvcrt.lib oldnames.lib
-
-endif
-
-guilibs           = $(libc) $(winlibs)
-conlibs           = $(libc) $(baselibs)
-guilibsdll = $(libcdll) $(winlibs)
-conlibsdll = $(libcdll) $(baselibs)
-
-######################################################################
-# Compile flags
-######################################################################
-
-#!IFDEF NODEBUG
-#cdebug = -Ox
-#!ELSE
-#cdebug = -Z7 -Od -WX
-#!ENDIF
-
-# declarations common to all compiler options
-ccommon = -c -W3 -nologo -YX -Dtry=__try -Dexcept=__except
-
-#!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
-cvarsmt    = $(cvars) -D_MT
-cvarsdll   = $(cvarsmt) -D_DLL
-
-######################################################################
-# Project specific targets
-######################################################################
-
-release:    $(TCLSH) dlls $(TCLLIB)
-dlls:      $(TCLDLL) $(TCLPIPEDLL) $(TCLREGDLL)
-all:       $(TCLSH) dlls $(CAT16) $(CAT32) $(TCLLIB)
-tcltest:    $(TCLTEST) dlls $(CAT16) $(CAT32)
-plugin:            $(TCLPLUGINDLL) $(TCLSHP)
-test:      $(TCLTEST) dlls $(CAT16) $(CAT32) 
-       ( echo cd $(ROOT)/tests\; source all ) | $(TCLTEST)
-
-install: install-binaries install-libraries
-
-install-binaries: $(TCLDLL) $(TCLLIB) $(TCLSH) $(TCLPIPEDLL)
-       @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 $(TCLLIB)"
-       @$(INSTALL_DATA) $(TCLLIB) $(LIB_INSTALL_DIR)/$(TCLLIB)
-       @chmod 555 $(LIB_INSTALL_DIR)/$(TCLLIB)
-       @echo "Installing tclsh"
-       @$(INSTALL_PROGRAM) $(TCLSH) $(BIN_INSTALL_DIR)/$(TCLSH)
-       @echo "Installing tclConfig.sh"
-       @$(INSTALL_DATA) ../unix/tclConfig.sh $(LIB_INSTALL_DIR)/tclConfig.sh
+# The following targets are configured by autoconf to generate either
+# a shared library or static library
 
-install-libraries:
-       @echo "Installing DLL"
-       @$(INSTALL_DATA) $(TCLDLL) $(BIN_INSTALL_DIR)/$(TCLDLL)
-       @$(INSTALL_DATA) $(TCLPIPEDLL) $(BIN_INSTALL_DIR)/$(TCLPIPEDLL)
-       @$(INSTALL_DATA) $(TCLREGDLL) $(BIN_INSTALL_DIR)/$(TCLREGDLL)
-       @for i in $(INSTALL_ROOT)@datadir@ $(INCLUDE_INSTALL_DIR) \
-               $(SCRIPT_INSTALL_DIR) ; \
-           do \
-           if [ ! -d $$i ] ; then \
-               echo "Making directory $$i"; \
-               mkdir $$i; \
-               chmod 755 $$i; \
-               else true; \
-               fi; \
-           done;
-       @for i in http2.0 http1.0 opt0.1 ; \
+${TCL_STUB_LIB_FILE}: ${STUB_OBJS}
+       @$(RM) ${TCL_STUB_LIB_FILE}
+       @MAKE_LIB@ ${STUB_OBJS}
+       @POST_MAKE_LIB@
+
+${GNU_TCL_LIB_FILE}: ${TCL_DLL_FILE}
+
+${TCL_DLL_FILE}: ${TCL_OBJS} tcl.$(RES)
+       @$(RM) ${TCL_DLL_FILE}
+       @MAKE_DLL@ ${TCL_OBJS} tcl.$(RES) $(SHLIB_LD_LIBS)
+
+${MSVC_TCL_LIB_FILE}: ${TCL_OBJS} ${TCL_DLL_FILE}
+       @$(RM) ${TCL_LIB_FILE}
+       @MAKE_LIB@ ${TCL_OBJS}
+       @POST_MAKE_LIB@
+
+${DDE_DLL_FILE}: ${DDE_OBJS} ${TCL_STUB_LIB_FILE}
+       @$(RM) ${DDE_DLL_FILE}
+       @MAKE_DLL@ ${DDE_OBJS} $(TCL_STUB_LIB_FILE) $(SHLIB_LD_LIBS)
+
+${DDE_LIB_FILE}: ${DDE_OBJS} ${TCL_LIB_FILE}
+       @$(RM) ${DDE_LIB_FILE}
+       @MAKE_LIB@ ${DDE_OBJS} ${TCL_LIB_FILE}
+
+${REG_DLL_FILE}: ${REG_OBJS} ${TCL_STUB_LIB_FILE}
+       @$(RM) ${REG_DLL_FILE}
+       @MAKE_DLL@ ${REG_OBJS} ${TCL_STUB_LIB_FILE} $(SHLIB_LD_LIBS)
+
+${REG_LIB_FILE}: ${REG_OBJS} ${TCL_LIB_FILE}
+       @$(RM) ${REG_LIB_FILE}
+       @MAKE_LIB@ ${REG_OBJS} ${TCL_LIB_FILE}
+
+# PIPE_DLL_FILE is actually an executable, don't build it
+# like a DLL.
+
+${PIPE_DLL_FILE}: ${PIPE_OBJS}
+       @$(RM) ${PIPE_DLL_FILE}
+       @MAKE_EXE@ $(CFLAGS) ${PIPE_OBJS} $(LIBS)
+
+# Add the object extension to the implicit rules.  By default .obj is not
+# automatically added.
+
+.SUFFIXES: .${OBJEXT}
+.SUFFIXES: .$(RES)
+.SUFFIXES: .rc
+
+# Special case object targets
+
+tclWinInit.${OBJEXT}: tclWinInit.c
+       $(CC) -c $(CC_SWITCHES) -DBUILD_tcl $(EXTFLAGS) @DEPARG@ $(CC_OBJNAME)
+
+testMain.${OBJEXT}: tclAppInit.c
+       $(CC) -c $(CC_SWITCHES) -DTCL_TEST @DEPARG@ $(CC_OBJNAME)
+
+tclTest.${OBJEXT}: tclTest.c
+       $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
+
+tclTestObj.${OBJEXT}: tclTestObj.c
+       $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
+
+tclWinTest.${OBJEXT}: tclWinTest.c
+       $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
+
+tclAppInit.${OBJEXT} : tclAppInit.c
+       $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
+
+# The following objects should be built using the stub interfaces
+
+tclWinReg.${OBJEXT} : tclWinReg.c
+       $(CC) -c $(CC_SWITCHES) -DUSE_TCL_STUBS @DEPARG@ $(CC_OBJNAME)
+
+tclWinDde.${OBJEXT} : tclWinDde.c
+       $(CC) -c $(CC_SWITCHES) -DUSE_TCL_STUBS @DEPARG@ $(CC_OBJNAME)
+
+# The following objects are part of the stub library and should not
+# be built as DLL objects but none of the symbols should be exported
+
+tclStubLib.${OBJEXT}: tclStubLib.c
+       $(CC) -c $(CC_SWITCHES) -DSTATIC_BUILD @DEPARG@ $(CC_OBJNAME)
+
+
+# Implicit rule for all object files that will end up in the Tcl library
+
+.c.${OBJEXT}:
+       $(CC) -c $(CC_SWITCHES) -DBUILD_tcl @DEPARG@ $(CC_OBJNAME)
+
+.rc.$(RES):
+       $(RC) @RC_OUT@ $@ @RC_TYPE@ @RC_INCLUDE@ "$(GENERIC_DIR_NATIVE)" @RC_INCLUDE@ "$(WIN_DIR_NATIVE)" @DEPARG@
+
+install: all install-binaries install-libraries install-doc
+
+install-binaries:
+       @$(MKDIR) -p "$(BIN_INSTALL_DIR)"
+       @$(MKDIR) -p "$(LIB_INSTALL_DIR)"
+       $(COPY) tclConfig.sh $(LIB_INSTALL_DIR)/tclConfig.sh
+       @for i in dde1.1 reg1.0; \
            do \
-           if [ ! -d $(SCRIPT_INSTALL_DIR)/$$i ] ; then \
-               echo "Making directory $(SCRIPT_INSTALL_DIR)/$$i"; \
-               mkdir $(SCRIPT_INSTALL_DIR)/$$i; \
-               chmod 755 $(SCRIPT_INSTALL_DIR)/$$i; \
+           if [ ! -d $(LIB_INSTALL_DIR)/$$i ] ; then \
+               echo "Making directory $(LIB_INSTALL_DIR)/$$i"; \
+               $(MKDIR) $(LIB_INSTALL_DIR)/$$i; \
                else true; \
                fi; \
            done;
-       @echo "Installing tcl.h"
-       @$(INSTALL_DATA) $(GENERICDIR)/tcl.h $(INCLUDE_INSTALL_DIR)/tcl.h
-       @for i in $(ROOT)/library/*.tcl $(ROOT)/library/tclIndex $(WINDIR)/tclAppInit.c; \
+       @for i in $(TCL_DLL_FILE) $(TCLSH) $(PIPE_DLL_FILE); \
            do \
-           echo "Installing $$i"; \
-           $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \
-           done;
-       @for i in http2.0 http1.0 opt0.1 ; \
+           if [ -f $$i ]; then \
+               echo "Installing $$i"; \
+               $(COPY) $$i "$(BIN_INSTALL_DIR)"; \
+           fi; \
+           done
+       @for i in $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE); \
            do \
-           for j in $(ROOT)/library/$$i/*.tcl ; \
-               do \
-               echo "Installing $$j"; \
-               $(INSTALL_DATA) $$j $(SCRIPT_INSTALL_DIR)/$$i; \
-               done; \
-           done;
+           if [ -f $$i ]; then \
+               echo "Installing $$i"; \
+               $(COPY) $$i "$(LIB_INSTALL_DIR)"; \
+           fi; \
+           done
+       @if [ -f $(DDE_DLL_FILE) ]; then \
+           echo installing $(DDE_DLL_FILE); \
+           $(COPY) $(DDE_DLL_FILE) $(LIB_INSTALL_DIR)/dde1.1; \
+           $(COPY) $(ROOT_DIR)/library/dde1.1/pkgIndex.tcl $(LIB_INSTALL_DIR)/dde1.1; \
+           fi
+       @if [ -f $(DDE_LIB_FILE) ]; then \
+           echo installing $(DDE_LIB_FILE); \
+           $(COPY) $(DDE_LIB_FILE) $(LIB_INSTALL_DIR)/dde1.1; \
+           fi
+       @if [ -f $(REG_DLL_FILE) ]; then \
+           echo installing $(REG_DLL_FILE); \
+           $(COPY) $(REG_DLL_FILE) $(LIB_INSTALL_DIR)/reg1.0; \
+           $(COPY) $(ROOT_DIR)/library/reg1.0/pkgIndex.tcl $(LIB_INSTALL_DIR)/reg1.0; \
+           fi
+       @if [ -f $(REG_LIB_FILE) ]; then \
+           echo installing $(REG_LIB_FILE); \
+           $(COPY) $(REG_LIB_FILE) $(LIB_INSTALL_DIR)/reg1.0; \
+           fi
 
-install-minimal:
-       @echo "Installing DLL"
-       @$(INSTALL_DATA) $(TCLDLL) $(BIN_INSTALL_DIR)/$(TCLDLL)
-       @$(INSTALL_DATA) $(TCLPIPEDLL) $(BIN_INSTALL_DIR)/$(TCLPIPEDLL)
-       @$(INSTALL_DATA) $(TCLREGDLL) $(BIN_INSTALL_DIR)/$(TCLREGDLL)
-       @for i in $(INSTALL_ROOT)@datadir@ $(SCRIPT_INSTALL_DIR) ; \
+install-libraries:
+       @for i in $(prefix)/lib $(INCLUDE_INSTALL_DIR) \
+               $(SCRIPT_INSTALL_DIR); \
            do \
            if [ ! -d $$i ] ; then \
                echo "Making directory $$i"; \
-               mkdir $$i; \
-               chmod 755 $$i; \
+               $(MKDIR) $$i; \
                else true; \
                fi; \
            done;
-       @for i in http2.0 http1.0 opt0.1 ; \
+       @for i in http1.0 http2.3 opt0.4 encoding msgcat1.0 tcltest1.0; \
            do \
            if [ ! -d $(SCRIPT_INSTALL_DIR)/$$i ] ; then \
                echo "Making directory $(SCRIPT_INSTALL_DIR)/$$i"; \
-               mkdir $(SCRIPT_INSTALL_DIR)/$$i; \
-               chmod 755 $(SCRIPT_INSTALL_DIR)/$$i; \
+               $(MKDIR) $(SCRIPT_INSTALL_DIR)/$$i; \
                else true; \
                fi; \
            done;
-       @for i in $(ROOT)/library/*.tcl $(ROOT)/library/tclIndex; \
+       @echo "Installing header files";
+       @for i in "$(GENERIC_DIR)/tcl.h" "$(GENERIC_DIR)/tclDecls.h" ; \
            do \
-           echo "Installing $$i"; \
-           $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \
+           $(COPY) "$$i" "$(INCLUDE_INSTALL_DIR)"; \
            done;
-       @for i in http2.0 http1.0 opt0.1 ; \
+       @echo "Installing library files to $(SCRIPT_INSTALL_DIR)";
+       @for i in $(ROOT_DIR)/library/*.tcl $(ROOT_DIR)/library/tclIndex; \
            do \
-           for j in $(ROOT)/library/$$i/*.tcl ; \
+           $(COPY) "$$i" "$(SCRIPT_INSTALL_DIR)"; \
+           done;
+       @for i in http2.3 http1.0 opt0.4 msgcat1.0 tcltest1.0; \
+           do \
+           echo "Installing library $$i directory"; \
+           for j in $(ROOT_DIR)/library/$$i/*.tcl; \
                do \
-               echo "Installing $$j"; \
-               $(INSTALL_DATA) $$j $(SCRIPT_INSTALL_DIR)/$$i; \
+               $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/$$i"; \
                done; \
            done;
+       @echo "Installing encodings"
+       @for i in $(ROOT_DIR)/library/encoding/*.enc ; do \
+               $(COPY) "$$i" "$(SCRIPT_INSTALL_DIR)/encoding"; \
+       done;
 
-# $(DUMPEXTS): $(WINDIR)/winDumpExts.c
-#      $(CC) -c $(CON_CFLAGS) $?
-#      $(CC) $(linkdebug) $(conlflags) -o $@ $(TMPDIR)/winDumpExts.$(OBJEXT)bj $(guilibs)
-
-
-ifeq ($(OBJEXT),o)
-
-$(TCLDLL): $(TCLOBJS) tclres.$(OBJEXT) $(TMPDIR)/tclcyg.def
-       $(CC) -s $(DLL_LDFLAGS) -Wl,--base-file,tcl.base -o $(TCLDLL) $(TCLOBJS) tclres.$(OBJEXT) $(DLL_LDLIBS) -mwindows -Wl,-e,_DllMain@12 -Wl,--image-base,0x66000000
-       $(DLLTOOL) --as=$(AS) --dllname $(TCLDLL) --def $(TMPDIR)/tclcyg.def --base-file tcl.base --output-exp tcl.exp
-       $(CC) -s $(DLL_LDFLAGS) -Wl,--base-file,tcl.base,tcl.exp -o $(TCLDLL) $(TCLOBJS) tclres.$(OBJEXT) $(DLL_LDLIBS) -mwindows -Wl,-e,_DllMain@12 -Wl,--image-base,0x66000000
-       $(DLLTOOL) --as=$(AS) --dllname $(TCLDLL) --def $(TMPDIR)/tclcyg.def --base-file tcl.base --output-exp tcl.exp
-       $(CC) $(DLL_LDFLAGS) -Wl,tcl.exp -o $(TCLDLL) $(TCLOBJS) tclres.$(OBJEXT) $(DLL_LDLIBS) -mwindows -Wl,-e,_DllMain@12 -Wl,--image-base,0x66000000
-
-else
-
-$(TCLDLL): $(TCLOBJS) $(TMPDIR)/tclcyg.def tclres.$(OBJEXT)
-       link.exe $(ldebug) $(dlllflags) -dll -def:$(TMPDIR)/tclcyg.def -NODEFAULTLIB \
-               -out:$(TCLDLL) tclres.$(OBJEXT) $(guilibsdll) $(TCLOBJS) \
-               -entry:_DllMainCRTStartup@12
-       mv cygtcl80.lib $(TCLLIB)
-endif
-
-
-ifeq ($(OBJEXT),o)
-
-$(TCLLIB): $(TMPDIR)/tclcyg.def 
-       $(DLLTOOL) --as=$(AS) --dllname $(TCLDLL) --def $(TMPDIR)/tclcyg.def --output-lib $(TCLLIB)
-
-else
-
-$(TCLLIB): $(TCLDLL)
-
-endif
-
-$(TCLPLUGINLIB): $(TMPDIR)/plugin.def
-       $(DLLTOOL) --as=$(AS) --dllname $(TCLPLUGINDLL) --def $(TMPDIR)/plugin.def --output-lib $(TCLPLUGINLIB)
-
-$(TCLPLUGINDLL): $(TCLOBJS) $(TMPDIR)/plugin.def tclres.$(OBJEXT)
-       $(CC) -s $(DLL_LDFLAGS) -Wl,--base-file,tclplugin.base -o $(TCLPLUGINDLL) $(TCLOBJS) tclres.$(OBJEXT) $(DLL_LDLIBS) -mwindows -Wl,-e,_DllMain@12 -Wl,--image-base,0x66600000
-       $(DLLTOOL) --as=$(AS) --dllname $(TCLPLUGINDLL) --def $(TMPDIR)/plugin.def --base-file tclplugin.base --output-exp tcl.exp
-       $(CC) -s $(DLL_LDFLAGS) -Wl,--base-file,tclplugin.base -Wl,tcl.exp -o $(TCLPLUGINDLL) $(TCLOBJS) tclres.$(OBJEXT) $(DLL_LDLIBS) -mwindows -Wl,-e,_DllMain@12 -Wl,--image-base,0x66600000
-       $(DLLTOOL) --as=$(AS) --dllname $(TCLPLUGINDLL) --def $(TMPDIR)/plugin.def --base-file tclplugin.base --output-exp tcl.exp
-       $(CC) $(DLL_LDFLAGS) -Wl,tcl.exp -o $(TCLPLUGINDLL) $(TCLOBJS) tclres.$(OBJEXT) $(DLL_LDLIBS) -mwindows -Wl,-e,_DllMain@12 -Wl,--image-base,0x66600000
-
-ifeq ($(OBJEXT),o)
-
-$(TCLSH): $(TCLSHOBJS) tclshres.$(OBJEXT) $(TCLLIB)
-       $(CC) $(linkdebug) $(conlflags) -Wl,--stack=0x2300000 \
-               -o $@ $(conlibsdll) $(TCLSHOBJS) tclshres.$(OBJEXT) $(TCLLIB)
-
-else
-
-$(TCLSH): $(TCLSHOBJS) tclshres.$(OBJEXT) $(TCLLIB)
-       link $(linkdebug) $(conlflags) $(tclsh_flags) -NODEFAULTLIB -subsystem:console -entry:mainCRTStartup \
-               -out:$@ $(conlibsdll) $(TCLSHOBJS) tclshres.$(OBJEXT) $(TCLLIB)
-
-endif
-
-$(TCLSHP): $(TCLSHOBJS) $(TCLPLUGINLIB) tclshres.$(OBJEXT)
-       $(CC) $(linkdebug) $(conlflags) -Wl,--stack=0x2300000 \
-               -o $@ $(conlibsdll) $(TCLSHOBJS) tclshres.$(OBJEXT) $(TCLPLUGINLIB)
-
-$(TCLTEST): $(TCLTESTOBJS) tclshres.$(OBJEXT) $(TCLLIB)
-       $(CC) $(linkdebug) $(conlflags) -Wl,--stack=0x2300000 \
-                -o $@ $(conlibsdll) $(TCLTESTOBJS) tclshres.$(OBJEXT) $(TCLLIB)
-
-# $(TCL16DLL):  $(WINDIR)\tcl16.rc $(WINDIR)\tclWin16.c
-#      if exist $(cc16) $(cc16) @<<
-# $(DLL16_CFLAGS) -Fo$(TMPDIR)\ $(WINDIR)\tclWin16.c
-# <<                         
-#      @copy << $(TMPDIR)\tclWin16.def > nul
-# LIBRARY $(@B);dll
-# EXETYPE WINDOWS
-# CODE PRELOAD MOVEABLE DISCARDABLE
-# DATA PRELOAD MOVEABLE SINGLE
-# HEAPSIZE 1024 
-# EXPORTS
-#      WEP @1 RESIDENTNAME
-#      UTPROC @2 
-# << 
-#      if exist $(cc16) $(link16) /NOLOGO /ONERROR:NOEXE /NOE @<<
-# $(TMPDIR)\tclWin16.obj
-# $@
-# nul
-# $(TOOLS16)\lib\ ldllcew oldnames libw toolhelp
-# $(TMPDIR)\tclWin16.def
-# <<
-#      if exist $(cc16) $(rc16) -i $(GENERICDIR) $(TCL_DEFINES) $(WINDIR)\tcl16.rc $@
-
-ifeq ($(OBJEXT),o)
-
-$(TCLPIPEDLL): $(WINDIR)/stub16.c
-       $(CC) -c $(CON_CFLAGS) $(WINDIR)/stub16.c
-       $(CC) $(linkdebug) $(conlflags) -o $@ $(TMPDIR)/stub16.$(OBJEXT) $(guilibs)
-else
-
-$(TCLPIPEDLL): $(WINDIR)/stub16.c
-       $(CC) -c $(CON_CFLAGS) -Fo$(TMPDIR)/ $(WINDIR)/stub16.c
-       link $(ldebug) $(conlflags) -out:$@ $(TMPDIR)/stub16.obj $(guilibsdll)
-endif
-
-ifeq ($(OBJEXT),o)
-
-$(TCLREGDLL): $(TMPDIR)/tclWinReg.$(OBJEXT) $(TCLLIB)
-       echo EXPORTS > $(TMPDIR)/tclreg.def
-       echo Registry_Init >> $(TMPDIR)/tclreg.def
-       $(CC) -s $(DLL_LDFLAGS) -Wl,--base-file,tclreg.base -o $(TCLREGDLL) $(TMPDIR)/tclWinReg.$(OBJEXT) $(TCLLIB) $(DLL_LDLIBS) -ladvapi32 -mwindows -Wl,-e,_DllEntryPoint@12 -Wl,--image-base,0x66200000
-       $(DLLTOOL) --as=$(AS) --dllname $(TCLREGDLL) --def $(TMPDIR)/tclreg.def --base-file tclreg.base --output-exp tclreg.exp
-       $(CC) -s $(DLL_LDFLAGS) -Wl,--base-file,tclreg.base -Wl,tclreg.exp -o $(TCLREGDLL) $(TMPDIR)/tclWinReg.$(OBJEXT) $(TCLLIB) $(DLL_LDLIBS) -ladvapi32 -mwindows -Wl,-e,_DllEntryPoint@12 -Wl,--image-base,0x66200000
-       $(DLLTOOL) --as=$(AS) --dllname $(TCLREGDLL) --def $(TMPDIR)/tclreg.def --base-file tclreg.base --output-exp tclreg.exp
-       $(CC) $(DLL_LDFLAGS) -Wl,tclreg.exp -o $(TCLREGDLL) $(TMPDIR)/tclWinReg.$(OBJEXT) $(TCLLIB) $(DLL_LDLIBS) -ladvapi32 -mwindows -Wl,-e,_DllEntryPoint@12 -Wl,--image-base,0x66200000
-       rm -f $(TMPDIR)/tclreg.def
-else
-$(TCLREGDLL): $(TMPDIR)/tclWinReg.obj
-       link $(ldebug) $(dlllflags) -out:$@ $(TMPDIR)/tclWinReg.obj \
-               $(conlibsdll) $(TCLLIB) -entry:_DllMainCRTStartup@12
-endif
-
-ifeq ($(OBJEXT),o)
-
-$(CAT32): $(WINDIR)/cat.c
-       $(CC) -c $(CON_CFLAGS) $?
-       $(CC) -o $@ -Wl,-stack,16384 $(TMPDIR)/cat.$(OBJEXT) $(conlibs)
-
-else
-
-$(CAT32): $(WINDIR)/cat.c
-       $(CC) $(CON_CFLAGS) -Fo$(TMPDIR)/ $(WINDIR)/cat.c
-       link -subsystem:console -entry:mainCRTStartup -out:$@ -stack:16384 $(TMPDIR)/cat.obj $(conlibs)
-endif
-
-# $(CAT16): $(WINDIR)\cat.c
-#      if exist $(cc16) $(cc16) $(DOS_CFLAGS) -Fo$(TMPDIR)\ $?
-#      set LIB=$(TOOLS16)\lib
-#      if exist $(cc16) $(link16) /NOLOGO /ONERROR:NOEXE /NOI /STACK:16384 \
-#              $(TMPDIR)\cat.obj,$@,nul,llibce.lib,nul
-
-$(TMPDIR)/tclcyg.def: $(DUMPEXTS) $(TCLOBJS)
-       echo 'EXPORTS' > tmp.def
-       -for o in $(TCLOBJS); do \
-         $(NM) --extern-only --defined-only $$o | sed -e 's/[^ ]* [^ ]* //' -e 's/^_//' | fgrep -v DllEntryPoint | fgrep -v DllMain | fgrep -v impure_ptr >> tmp.def; \
-       done
-       mv tmp.def $(TMPDIR)/tclcyg.def
-
-$(TMPDIR)/plugin.def: $(DUMPEXTS) $(TCLOBJS)
-       echo 'EXPORTS' > tmp.def
-       -for o in $(TCLOBJS); do \
-         $(NM) --extern-only --defined-only $$o | sed -e 's/[^ ]* [^ ]* //' -e 's/^_//' | fgrep -v DllEntryPoint | fgrep -v DllMain | fgrep -v impure_ptr >> tmp.def; \
-       done
-       mv tmp.def $(TMPDIR)/plugin.def
-
-#
-# Special case object file targets
-#
-
-$(TMPDIR)/testMain.$(OBJEXT): $(WINDIR)/tclAppInit.c
-       $(CC) -c -o $(TMPDIR)/testMain.$(OBJEXT) $(TCL_CFLAGS) -DTCL_TEST $?
-
-#
-# Implicit rules
-#
-
-.SUFFIXES: .S .c .o .obj .s
-ifeq ($(OBJEXT),o)
-.c.$(OBJEXT):
-       $(CC) -c $(TCL_CFLAGS) $<
-else
-.c.$(OBJEXT):
-       $(CC) -c $(TCL_CFLAGS) -Dtry=__try -Dexcept=__except $<
-endif
+install-doc:
 
-ifeq ($(OBJEXT),o)
+test: binaries $(TCLTEST)
+       TCL_LIBRARY="$(LIBRARY_DIR)"; export TCL_LIBRARY; \
+       ./$(TCLTEST) "$(ROOT_DIR_NATIVE)/tests/all.tcl" $(TESTFLAGS) \
+       | ./$(CAT32)
 
-tclres.$(OBJEXT): $(srcdir)/tcl.rc
-       $(WINDRES) --include $(GENERICDIR) --include $(WINDIR) --define __WIN32__ --define VS_VERSION_INFO=1 $(srcdir)/tcl.rc tclres.$(OBJEXT)
+# Useful target to launch a built tcltest with the proper path,...
+runtest: tcltest
+       @TCL_LIBRARY="$(LIBRARY_DIR)"; export TCL_LIBRARY; \
+           ./tcltest
 
-tclshres.$(OBJEXT): $(srcdir)/tclsh.rc
-       $(WINDRES) --include $(GENERICDIR) --include $(WINDIR) --define __WIN32__ --define VS_VERSION_INFO=1 $(srcdir)/tclsh.rc tclshres.$(OBJEXT)
+depend:
 
-else
-
-tclres.$(OBJEXT): $(srcdir)/tcl.rc
-       rc -i$(GENERICDIR) -i$(WINDIR) -d__WIN32__ -dVS_VERSION_INFO=1 -fotclres.$(OBJEXT) $(srcdir)/tcl.rc 
+Makefile: $(SRC_DIR)/Makefile.in config.status
+       $(SHELL) config.status
 
-tclshres.$(OBJEXT): $(srcdir)/tclsh.rc
-       rc -i$(GENERICDIR) -i$(WINDIR) -d__WIN32__ -dVS_VERSION_INFO=1 -fotclshres.$(OBJEXT) $(srcdir)/tclsh.rc 
+config.status: $(WIN_DIR)/configure
+       $(SHELL) config.status --recheck
 
-endif
+cleanhelp:
+       $(RM) *.hlp *.cnt *.GID *.rtf man2tcl.exe
 
-#{$(WINDIR)}.rc{$(TMPDIR)}.res:
-#      $(rc32) -fo $@ -r -i $(GENERICDIR) -i $(WINDIR) -D__WIN32__ \
-#              $(TCL_DEFINES) $<
+clean: cleanhelp
+       $(RM) *.lib *.a *.exp *.dll *.$(RES) *.${OBJEXT} *~ \#* TAGS a.out
+       $(RM) $(TCLSH) $(TCLTEST) $(CAT32)
+       $(RM) *.pch *.ilk *.pdb
 
-clean:
-       rm -f *.exp *.a *.dll *.exe $(TMPDIR)/*.$(OBJEXT) *.res *.def
-       rm -f tcl.base tclreg.base tclplugin.base
+distclean: clean
+       $(RM) Makefile config.status config.cache config.log tclConfig.sh \
+               tcl.hpj
 
-Makefile: $(WINDIR)/Makefile.in config.status
-       $(SHELL) config.status
+#
+# Regenerate the stubs files.
+#
 
-config.status: $(WINDIR)/configure
-       ./config.status --recheck
+# FIXME: We can't depend on TCLSH here since it is not yet built!
+
+$(GENERIC_DIR)/tclStubInit.c: $(GENERIC_DIR)/tcl.decls \
+               $(GENERIC_DIR)/tclInt.decls
+       @TCL_LIBRARY="$(ROOT_DIR_NATIVE)/library"; export TCL_LIBRARY; \
+       $(TCLSH) "$(ROOT_DIR_NATIVE)\tools\genStubs.tcl" \
+           "$(GENERIC_DIR_NATIVE)" \
+           "$(GENERIC_DIR_NATIVE)\tcl.decls" \
+            "$(GENERIC_DIR_NATIVE)\tclInt.decls"
+
+genstubs:
+       @TCL_LIBRARY="$(ROOT_DIR_NATIVE)/library"; export TCL_LIBRARY; \
+       $(TCLSH) "$(ROOT_DIR_NATIVE)\tools\genStubs.tcl" \
+           "$(GENERIC_DIR_NATIVE)" \
+           "$(GENERIC_DIR_NATIVE)\tcl.decls" \
+            "$(GENERIC_DIR_NATIVE)\tclInt.decls"
index 151256a..45e2034 100755 (executable)
 ac_help=
 ac_default_prefix=/usr/local
 # Any additions from configure.in:
+ac_help="$ac_help
+  --enable-threads        build with threads"
+ac_help="$ac_help
+  --enable-shared         build and link with shared libraries [--enable-shared]"
+ac_help="$ac_help
+  --enable-symbols        build with debugging symbols [--disable-symbols]"
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
@@ -533,6 +539,12 @@ fi
 
 
 
+TCL_VERSION=8.3
+TCL_MAJOR_VERSION=8
+TCL_MINOR_VERSION=3
+TCL_PATCH_LEVEL=".2"
+VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION
+
 if test "${prefix}" = "NONE"; then
     prefix=/usr/local
 fi
@@ -540,57 +552,14 @@ if test "${exec_prefix}" = "NONE"; then
     exec_prefix=$prefix
 fi
 
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
-  if test -f $ac_dir/install-sh; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install-sh -c"
-    break
-  elif test -f $ac_dir/install.sh; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install.sh -c"
-    break
-  fi
-done
-if test -z "$ac_aux_dir"; then
-  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-
-# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:570: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
-  case $nonopt in
-  NONE)
-    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
-    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
-    fi ;;
-  *) host_alias=$nonopt ;;
-  esac ;;
-esac
-
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
+#------------------------------------------------------------------------
+# Standard compiler checks
+#------------------------------------------------------------------------
 
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:594: checking for $ac_word" >&5
+echo "configure:563: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -620,7 +589,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:624: checking for $ac_word" >&5
+echo "configure:593: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -671,7 +640,7 @@ fi
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:675: checking for $ac_word" >&5
+echo "configure:644: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -703,7 +672,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:707: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:676: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -714,12 +683,12 @@ cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 718 "configure"
+#line 687 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:692: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -745,12 +714,12 @@ if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:749: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:718: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:754: checking whether we are using GNU C" >&5
+echo "configure:723: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -759,7 +728,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:763: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:732: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -778,7 +747,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:782: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:751: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -809,32 +778,55 @@ else
   fi
 fi
 
-echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:814: checking for object suffix" >&5
-if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  rm -f conftest*
-echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:820: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  for ac_file in conftest.*; do
-    case $ac_file in
-    *.c) ;;
-    *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
-    esac
-  done
-else
-  { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; }
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
 fi
-rm -f conftest*
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
 
-echo "$ac_t""$ac_cv_objext" 1>&6
-OBJEXT=$ac_cv_objext
-ac_objext=$ac_cv_objext
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:809: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+  case $nonopt in
+  NONE)
+    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+    fi ;;
+  *) host_alias=$nonopt ;;
+  esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:838: checking build system type" >&5
+echo "configure:830: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -857,488 +849,1937 @@ else
   ac_tool_prefix=
 fi
 
-# Extract the first word of "${ac_tool_prefix}nm", so it can be a program name with args.
-set dummy ${ac_tool_prefix}nm; ac_word=$2
+# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:864: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then
+echo "configure:856: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test -n "$NM"; then
-  ac_cv_prog_NM="$NM" # Let the user override the test.
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
 else
   IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
   for ac_dir in $ac_dummy; do
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_NM="${ac_tool_prefix}nm"
+      ac_cv_prog_AR="${ac_tool_prefix}ar"
       break
     fi
   done
   IFS="$ac_save_ifs"
 fi
 fi
-NM="$ac_cv_prog_NM"
-if test -n "$NM"; then
-  echo "$ac_t""$NM" 1>&6
+AR="$ac_cv_prog_AR"
+if test -n "$AR"; then
+  echo "$ac_t""$AR" 1>&6
 else
   echo "$ac_t""no" 1>&6
 fi
 
 
-if test -z "$ac_cv_prog_NM"; then
+if test -z "$ac_cv_prog_AR"; then
 if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "nm", so it can be a program name with args.
-set dummy nm; ac_word=$2
+  # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:896: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then
+echo "configure:888: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test -n "$NM"; then
-  ac_cv_prog_NM="$NM" # Let the user override the test.
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
 else
   IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
   for ac_dir in $ac_dummy; do
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_NM="nm"
+      ac_cv_prog_AR="ar"
       break
     fi
   done
   IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_NM" && ac_cv_prog_NM="nm"
+  test -z "$ac_cv_prog_AR" && ac_cv_prog_AR=":"
 fi
 fi
-NM="$ac_cv_prog_NM"
-if test -n "$NM"; then
-  echo "$ac_t""$NM" 1>&6
+AR="$ac_cv_prog_AR"
+if test -n "$AR"; then
+  echo "$ac_t""$AR" 1>&6
 else
   echo "$ac_t""no" 1>&6
 fi
 
 else
-  NM="nm"
+  AR=":"
 fi
 fi
 
-
-# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
-set dummy ${ac_tool_prefix}as; ac_word=$2
+# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:932: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
+echo "configure:923: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test -n "$AS"; then
-  ac_cv_prog_AS="$AS" # Let the user override the test.
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
 else
   IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
   for ac_dir in $ac_dummy; do
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_AS="${ac_tool_prefix}as"
+      ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
       break
     fi
   done
   IFS="$ac_save_ifs"
 fi
 fi
-AS="$ac_cv_prog_AS"
-if test -n "$AS"; then
-  echo "$ac_t""$AS" 1>&6
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
 else
   echo "$ac_t""no" 1>&6
 fi
 
 
-if test -z "$ac_cv_prog_AS"; then
+if test -z "$ac_cv_prog_RANLIB"; then
 if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "as", so it can be a program name with args.
-set dummy as; ac_word=$2
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:964: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
+echo "configure:955: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test -n "$AS"; then
-  ac_cv_prog_AS="$AS" # Let the user override the test.
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
 else
   IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
   for ac_dir in $ac_dummy; do
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_AS="as"
+      ac_cv_prog_RANLIB="ranlib"
       break
     fi
   done
   IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="as"
+  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
 fi
 fi
-AS="$ac_cv_prog_AS"
-if test -n "$AS"; then
-  echo "$ac_t""$AS" 1>&6
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
 else
   echo "$ac_t""no" 1>&6
 fi
 
 else
-  AS="as"
+  RANLIB=":"
 fi
 fi
 
-
-# Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ld; ac_word=$2
+# Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args.
+set dummy ${ac_tool_prefix}windres; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1000: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
+echo "configure:990: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test -n "$LD"; then
-  ac_cv_prog_LD="$LD" # Let the user override the test.
+  if test -n "$RC"; then
+  ac_cv_prog_RC="$RC" # Let the user override the test.
 else
   IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
   for ac_dir in $ac_dummy; do
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_LD="${ac_tool_prefix}ld"
+      ac_cv_prog_RC="${ac_tool_prefix}windres"
       break
     fi
   done
   IFS="$ac_save_ifs"
 fi
 fi
-LD="$ac_cv_prog_LD"
-if test -n "$LD"; then
-  echo "$ac_t""$LD" 1>&6
+RC="$ac_cv_prog_RC"
+if test -n "$RC"; then
+  echo "$ac_t""$RC" 1>&6
 else
   echo "$ac_t""no" 1>&6
 fi
 
 
-if test -z "$ac_cv_prog_LD"; then
+if test -z "$ac_cv_prog_RC"; then
 if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "ld", so it can be a program name with args.
-set dummy ld; ac_word=$2
+  # Extract the first word of "windres", so it can be a program name with args.
+set dummy windres; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1032: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
+echo "configure:1022: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test -n "$LD"; then
-  ac_cv_prog_LD="$LD" # Let the user override the test.
+  if test -n "$RC"; then
+  ac_cv_prog_RC="$RC" # Let the user override the test.
 else
   IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
   for ac_dir in $ac_dummy; do
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_LD="ld"
+      ac_cv_prog_RC="windres"
       break
     fi
   done
   IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_LD" && ac_cv_prog_LD="ld"
+  test -z "$ac_cv_prog_RC" && ac_cv_prog_RC=":"
 fi
 fi
-LD="$ac_cv_prog_LD"
-if test -n "$LD"; then
-  echo "$ac_t""$LD" 1>&6
+RC="$ac_cv_prog_RC"
+if test -n "$RC"; then
+  echo "$ac_t""$RC" 1>&6
 else
   echo "$ac_t""no" 1>&6
 fi
 
 else
-  LD="ld"
+  RC=":"
 fi
 fi
 
 
-# Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1068: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+#--------------------------------------------------------------------
+# Checks to see if the make progeam sets the $MAKE variable.
+#--------------------------------------------------------------------
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:1060: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test -n "$RANLIB"; then
-  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+  cat > conftestmake <<\EOF
+all:
+       @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+  eval ac_cv_prog_make_${ac_make}_set=yes
 else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_RANLIB="ranlib"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+  eval ac_cv_prog_make_${ac_make}_set=no
 fi
+rm -f conftestmake
 fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
-  echo "$ac_t""$RANLIB" 1>&6
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  SET_MAKE=
 else
   echo "$ac_t""no" 1>&6
+  SET_MAKE="MAKE=${MAKE-make}"
 fi
 
-# Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
-set dummy ${ac_tool_prefix}dlltool; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1098: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
+
+#--------------------------------------------------------------------
+# These two macros perform additinal compiler test.
+#--------------------------------------------------------------------
+
+echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+echo "configure:1092: checking for Cygwin environment" >&5
+if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test -n "$DLLTOOL"; then
-  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+  cat > conftest.$ac_ext <<EOF
+#line 1097 "configure"
+#include "confdefs.h"
+
+int main() {
+
+#ifndef __CYGWIN__
+#define __CYGWIN__ __CYGWIN32__
+#endif
+return __CYGWIN__;
+; return 0; }
+EOF
+if { (eval echo configure:1108: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_cygwin=yes
 else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_cygwin=no
 fi
+rm -f conftest*
+rm -f conftest*
 fi
-DLLTOOL="$ac_cv_prog_DLLTOOL"
-if test -n "$DLLTOOL"; then
-  echo "$ac_t""$DLLTOOL" 1>&6
+
+echo "$ac_t""$ac_cv_cygwin" 1>&6
+CYGWIN=
+test "$ac_cv_cygwin" = yes && CYGWIN=yes
+
+#--------------------------------------------------------------------
+# Determines the correct binary file extension (.o, .obj, .exe etc.)
+#--------------------------------------------------------------------
+
+echo $ac_n "checking for object suffix""... $ac_c" 1>&6
+echo "configure:1130: checking for object suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  echo "$ac_t""no" 1>&6
+  rm -f conftest*
+echo 'int i = 1;' > conftest.$ac_ext
+if { (eval echo configure:1136: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  for ac_file in conftest.*; do
+    case $ac_file in
+    *.c) ;;
+    *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
+    esac
+  done
+else
+  { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; }
+fi
+rm -f conftest*
 fi
 
+echo "$ac_t""$ac_cv_objext" 1>&6
+OBJEXT=$ac_cv_objext
+ac_objext=$ac_cv_objext
 
-if test -z "$ac_cv_prog_DLLTOOL"; then
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "dlltool", so it can be a program name with args.
-set dummy dlltool; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1130: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
+echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+echo "configure:1154: checking for mingw32 environment" >&5
+if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test -n "$DLLTOOL"; then
-  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+  cat > conftest.$ac_ext <<EOF
+#line 1159 "configure"
+#include "confdefs.h"
+
+int main() {
+return __MINGW32__;
+; return 0; }
+EOF
+if { (eval echo configure:1166: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_mingw32=yes
 else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_DLLTOOL="dlltool"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="dlltool"
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_mingw32=no
 fi
+rm -f conftest*
+rm -f conftest*
 fi
-DLLTOOL="$ac_cv_prog_DLLTOOL"
-if test -n "$DLLTOOL"; then
-  echo "$ac_t""$DLLTOOL" 1>&6
+
+echo "$ac_t""$ac_cv_mingw32" 1>&6
+MINGW32=
+test "$ac_cv_mingw32" = yes && MINGW32=yes
+
+
+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+echo "configure:1185: checking for executable suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  echo "$ac_t""no" 1>&6
+  if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+  ac_cv_exeext=.exe
+else
+  rm -f conftest*
+  echo 'int main () { return 0; }' > conftest.$ac_ext
+  ac_cv_exeext=
+  if { (eval echo configure:1195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+    for file in conftest.*; do
+      case $file in
+      *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+      *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+      esac
+    done
+  else
+    { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+  fi
+  rm -f conftest*
+  test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
 fi
+fi
+
+EXEEXT=""
+test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+echo "$ac_t""${ac_cv_exeext}" 1>&6
+ac_exeext=$EXEEXT
+
+
+#--------------------------------------------------------------------
+# Check whether --enable-threads or --disable-threads was given.
+#--------------------------------------------------------------------
 
+
+    echo $ac_n "checking for building with threads""... $ac_c" 1>&6
+echo "configure:1222: checking for building with threads" >&5
+    # Check whether --enable-threads or --disable-threads was given.
+if test "${enable_threads+set}" = set; then
+  enableval="$enable_threads"
+  tcl_ok=$enableval
 else
-  DLLTOOL="dlltool"
+  tcl_ok=no
 fi
+
+
+    if test "$tcl_ok" = "yes"; then
+       echo "$ac_t""yes" 1>&6
+       TCL_THREADS=1
+       cat >> confdefs.h <<\EOF
+#define TCL_THREADS 1
+EOF
+
+    else
+       TCL_THREADS=0
+       echo "$ac_t""no (default)" 1>&6
+    fi
+
+
+#--------------------------------------------------------------------
+# The statements below define a collection of symbols related to
+# building libtcl as a shared library instead of a static library.
+#--------------------------------------------------------------------
+
+
+    echo $ac_n "checking how to build libraries""... $ac_c" 1>&6
+echo "configure:1252: checking how to build libraries" >&5
+    # Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+  enableval="$enable_shared"
+  tcl_ok=$enableval
+else
+  tcl_ok=yes
 fi
 
 
-# Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args.
-set dummy ${ac_tool_prefix}windres; ac_word=$2
+    if test "${enable_shared+set}" = set; then
+       enableval="$enable_shared"
+       tcl_ok=$enableval
+    else
+       tcl_ok=yes
+    fi
+
+    if test "$tcl_ok" = "yes" ; then
+       echo "$ac_t""shared" 1>&6
+       SHARED_BUILD=1
+    else
+       echo "$ac_t""static" 1>&6
+       SHARED_BUILD=0
+       cat >> confdefs.h <<\EOF
+#define STATIC_BUILD 1
+EOF
+
+    fi
+
+
+#--------------------------------------------------------------------
+# The statements below define a collection of compile flags.  This 
+# macro depends on the value of SHARED_BUILD, and should be called
+# after SC_ENABLE_SHARED checks the configure switches.
+#--------------------------------------------------------------------
+
+
+    TCL_LIB_VERSIONS_OK=nodots
+
+    # Extract the first word of "cygpath", so it can be a program name with args.
+set dummy cygpath; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1166: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
+echo "configure:1294: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CYGPATH'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test -n "$WINDRES"; then
-  ac_cv_prog_WINDRES="$WINDRES" # Let the user override the test.
+  if test -n "$CYGPATH"; then
+  ac_cv_prog_CYGPATH="$CYGPATH" # Let the user override the test.
 else
   IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
   for ac_dir in $ac_dummy; do
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_WINDRES="${ac_tool_prefix}windres"
+      ac_cv_prog_CYGPATH="cygpath -w"
       break
     fi
   done
   IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_CYGPATH" && ac_cv_prog_CYGPATH="echo"
 fi
 fi
-WINDRES="$ac_cv_prog_WINDRES"
-if test -n "$WINDRES"; then
-  echo "$ac_t""$WINDRES" 1>&6
+CYGPATH="$ac_cv_prog_CYGPATH"
+if test -n "$CYGPATH"; then
+  echo "$ac_t""$CYGPATH" 1>&6
 else
   echo "$ac_t""no" 1>&6
 fi
 
 
-if test -z "$ac_cv_prog_WINDRES"; then
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "windres", so it can be a program name with args.
-set dummy windres; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1198: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$WINDRES"; then
-  ac_cv_prog_WINDRES="$WINDRES" # Let the user override the test.
+    # Check for a bug in gcc's windres that causes the
+    # compile to fail when a Windows native path is
+    # passed into windres. The mingw toolchain requires
+    # Windows native paths while Cygwin should work
+    # with both. Avoid the bug by passing a POSIX
+    # path when using the Cygwin toolchain.
+
+    if test "$GCC" = "yes" && test "$CYGPATH" != "echo" ; then
+        conftest=/tmp/conftest.rc
+        echo "STRINGTABLE BEGIN" > $conftest
+        echo "101 \"name\"" >> $conftest
+        echo "END" >> $conftest
+
+        echo $ac_n "checking for Windows native path bug in windres""... $ac_c" 1>&6
+echo "configure:1336: checking for Windows native path bug in windres" >&5
+        cyg_conftest=`$CYGPATH $conftest`
+        if { ac_try='$RC -o conftest.res.o $cyg_conftest'; { (eval echo configure:1338: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } ; then
+            echo "$ac_t""no" 1>&6
+        else
+            echo "$ac_t""yes" 1>&6
+            CYGPATH=echo
+        fi
+        conftest=
+        cyg_conftest=
+    fi
+
+    if test "$CYGPATH" = "echo" || test "$ac_cv_cygwin" = "yes"; then
+        DEPARG='"$<"'
+    else
+        DEPARG='"$(shell $(CYGPATH) $<)"'
+    fi
+
+    # CYGNUS LOCAL
+    VENDORPREFIX="rh"
+    # END CYGNUS LOCAL
+
+    # set various compiler flags depending on whether we are using gcc or cl
+
+    echo $ac_n "checking compiler flags""... $ac_c" 1>&6
+echo "configure:1361: checking compiler flags" >&5
+    if test "${GCC}" = "yes" ; then
+
+       # CYGNUS LOCAL
+       if test "$ac_cv_cygwin" = "yes" ; then
+           VENDORPREFIX="cyg"
+       fi
+       # END CYGNUS LOCAL
+
+       SHLIB_LD=""
+       SHLIB_LD_LIBS=""
+       LIBS=""
+       LIBS_GUI="-lgdi32 -lcomdlg32"
+       STLIB_LD="${AR} cr"
+       RC_OUT=-o
+       RC_TYPE=
+       RC_INCLUDE=--include
+       RES=res.o
+       MAKE_LIB="\${STLIB_LD} \$@"
+       POST_MAKE_LIB="\${RANLIB} \$@"
+       MAKE_EXE="\${CC} -o \$@"
+       LIBPREFIX="lib${VENDORPREFIX}"
+
+       if test "${SHARED_BUILD}" = "0" ; then
+           # static
+            echo "$ac_t""using static flags" 1>&6
+           runtime=
+           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
+
+           # ad-hoc check to see if CC supports -shared.
+           if "${CC}" -shared 2>&1 | egrep ': -shared not supported' >/dev/null; then
+               { echo "configure: error: ${CC} does not support the -shared option.
+               You will need to upgrade to a newer version of the toolchain." 1>&2; exit 1; }
+           fi
+
+           runtime=
+           # Link with gcc since ld does not link to default libs like
+           # -luser32 and -lmsvcrt. We also need to add CFLAGS so important
+           # flags like -mno-cygwin get passed in to CC.
+           SHLIB_LD='${CC} -shared ${CFLAGS}'
+           # Add SHLIB_LD_LIBS to the Make rule, not here.
+           MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -o \$@ ${extra_ldflags} \
+               -Wl,--out-implib,\$(patsubst %.dll,lib%.a,\$@)"
+
+           LIBSUFFIX="\${DBGX}.a"
+           DLLSUFFIX="\${DBGX}.dll"
+           EXESUFFIX="\${DBGX}.exe"
+           LIBRARIES="\${SHARED_LIBRARIES}"
+       fi
+
+       CFLAGS_DEBUG=-g
+       CFLAGS_OPTIMIZE=-O
+       CFLAGS_WARNING="-Wall -Wconversion"
+       LDFLAGS_DEBUG=
+       LDFLAGS_OPTIMIZE=
+
+       # Specify the CC output file names based on the target name
+       CC_OBJNAME="-o \$@"
+       CC_EXENAME="-o \$@"
+
+       # Specify linker flags depending on the type of app being 
+       # built -- Console vs. Window.
+       #
+       # We need to pass -e _WinMain@16 so that ld will use
+       # WinMain() instead of main() as the entry point. We can't
+       # use autoconf to check for this case since it would need
+       # to run an executable and that does not work when
+       # cross compiling. Remove this -e workaround once we
+       # require a gcc that does not have this bug.
+       LDFLAGS_CONSOLE="-mconsole ${extra_ldflags}"
+       LDFLAGS_WINDOW="-mwindows -e _WinMain@16 ${extra_ldflags}"
+    else
+       SHLIB_LD="link -dll -nologo"
+       SHLIB_LD_LIBS="user32.lib advapi32.lib"
+       LIBS="user32.lib advapi32.lib"
+       LIBS_GUI="gdi32.lib comdlg32.lib"
+       STLIB_LD="lib -nologo"
+       RC="rc"
+       RC_OUT=-fo
+       RC_TYPE=-r
+       RC_INCLUDE=-i
+       RES=res
+       MAKE_LIB="\${STLIB_LD} -out:\$@"
+       POST_MAKE_LIB=
+       MAKE_EXE="\${CC} -Fe\$@"
+       LIBPREFIX=${VENDORPREFIX}
+
+       if test "${SHARED_BUILD}" = "0" ; then
+           # static
+            echo "$ac_t""using static flags" 1>&6
+           runtime=-MT
+           MAKE_DLL="echo "
+           LIBSUFFIX="s\${DBGX}.lib"
+           LIBRARIES="\${STATIC_LIBRARIES}"
+           EXESUFFIX="s\${DBGX}.exe"
+           DLLSUFFIX=""
+       else
+           # dynamic
+            echo "$ac_t""using shared flags" 1>&6
+           runtime=-MD
+           # Add SHLIB_LD_LIBS to the Make rule, not here.
+           MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -out:\$@"
+           LIBSUFFIX="\${DBGX}.lib"
+           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_OPTIMIZE="-nologo -Oti -Gs -GD ${runtime}"
+       CFLAGS_WARNING="-W3"
+       LDFLAGS_DEBUG="-debug:full -debugtype:cv"
+       LDFLAGS_OPTIMIZE="-release"
+
+       # Specify the CC output file names based on the target name
+       CC_OBJNAME="-Fo\$@"
+       CC_EXENAME="-Fe\"\$(shell \$(CYGPATH) '\$@')\""
+
+       # Specify linker flags depending on the type of app being 
+       # built -- Console vs. Window.
+       LDFLAGS_CONSOLE="-link -subsystem:console"
+       LDFLAGS_WINDOW="-link -subsystem:windows"
+    fi
+
+    # Define the same variables as used in tclConfig.sh so that macros
+    # that depend on these variables work for both Tcl and extensions.
+    TCL_LIB_SUFFIX=$LIBSUFFIX
+    TCL_VENDOR_PREFIX=$VENDORPREFIX
+
+
+#--------------------------------------------------------------------
+# Set the default compiler switches based on the --enable-symbols 
+# option.  This macro depends on C flags, and should be called
+# after SC_CONFIG_CFLAGS macro is called.
+#--------------------------------------------------------------------
+
+
+    echo $ac_n "checking for build with symbols""... $ac_c" 1>&6
+echo "configure:1508: 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"
+  tcl_ok=$enableval
 else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_WINDRES="windres"
-      break
+  tcl_ok=no
+fi
+
+
+    if test "$tcl_ok" = "yes"; then
+       CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
+       LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
+       DBGX=d
+       echo "$ac_t""yes" 1>&6
+    else
+       CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
+       LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
+       DBGX=""
+       echo "$ac_t""no" 1>&6
     fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_WINDRES" && ac_cv_prog_WINDRES="windres"
+
+
+#------------------------------------------------------------------------------
+#       Find out all about time handling differences.
+#------------------------------------------------------------------------------
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1536: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    # This must be in double quotes, not single quotes, because CPP may get
+  # substituted into the Makefile and "${CC-cc}" will confuse make.
+  CPP="${CC-cc} -E"
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp.
+  cat > conftest.$ac_ext <<EOF
+#line 1551 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1557: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -E -traditional-cpp"
+  cat > conftest.$ac_ext <<EOF
+#line 1568 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1574: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -nologo -E"
+  cat > conftest.$ac_ext <<EOF
+#line 1585 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1591: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP=/lib/cpp
+fi
+rm -f conftest*
 fi
+rm -f conftest*
 fi
-WINDRES="$ac_cv_prog_WINDRES"
-if test -n "$WINDRES"; then
-  echo "$ac_t""$WINDRES" 1>&6
+rm -f conftest*
+  ac_cv_prog_CPP="$CPP"
+fi
+  CPP="$ac_cv_prog_CPP"
+else
+  ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
+echo "configure:1616: checking whether struct tm is in sys/time.h or time.h" >&5
+if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1621 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <time.h>
+int main() {
+struct tm *tp; tp->tm_sec;
+; return 0; }
+EOF
+if { (eval echo configure:1629: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_struct_tm=time.h
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_struct_tm=sys/time.h
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_struct_tm" 1>&6
+if test $ac_cv_struct_tm = sys/time.h; then
+  cat >> confdefs.h <<\EOF
+#define TM_IN_SYS_TIME 1
+EOF
+
+fi
+
+
+    for ac_hdr in sys/time.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1654: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1659 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1664: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
 else
   echo "$ac_t""no" 1>&6
 fi
+done
+
+    echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+echo "configure:1691: checking whether time.h and sys/time.h may both be included" >&5
+if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1696 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+int main() {
+struct tm *tp;
+; return 0; }
+EOF
+if { (eval echo configure:1705: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_header_time=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_time=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_time" 1>&6
+if test $ac_cv_header_time = yes; then
+  cat >> confdefs.h <<\EOF
+#define TIME_WITH_SYS_TIME 1
+EOF
+
+fi
+
+    echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
+echo "configure:1726: checking for tm_zone in struct tm" >&5
+if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1731 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <$ac_cv_struct_tm>
+int main() {
+struct tm tm; tm.tm_zone;
+; return 0; }
+EOF
+if { (eval echo configure:1739: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_struct_tm_zone=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_struct_tm_zone=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_struct_tm_zone" 1>&6
+if test "$ac_cv_struct_tm_zone" = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_TM_ZONE 1
+EOF
+
+else
+  echo $ac_n "checking for tzname""... $ac_c" 1>&6
+echo "configure:1759: checking for tzname" >&5
+if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1764 "configure"
+#include "confdefs.h"
+#include <time.h>
+#ifndef tzname /* For SGI.  */
+extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
+#endif
+int main() {
+atoi(*tzname);
+; return 0; }
+EOF
+if { (eval echo configure:1774: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ac_cv_var_tzname=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_var_tzname=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_var_tzname" 1>&6
+  if test $ac_cv_var_tzname = yes; then
+    cat >> confdefs.h <<\EOF
+#define HAVE_TZNAME 1
+EOF
+
+  fi
+fi
+
+
+    echo $ac_n "checking tm_tzadj in struct tm""... $ac_c" 1>&6
+echo "configure:1797: checking tm_tzadj in struct tm" >&5
+    cat > conftest.$ac_ext <<EOF
+#line 1799 "configure"
+#include "confdefs.h"
+#include <time.h>
+int main() {
+struct tm tm; tm.tm_tzadj;
+; return 0; }
+EOF
+if { (eval echo configure:1806: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  cat >> confdefs.h <<\EOF
+#define HAVE_TM_TZADJ 1
+EOF
+
+           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
+fi
+rm -f conftest*
+
+    echo $ac_n "checking tm_gmtoff in struct tm""... $ac_c" 1>&6
+echo "configure:1822: checking tm_gmtoff in struct tm" >&5
+    cat > conftest.$ac_ext <<EOF
+#line 1824 "configure"
+#include "confdefs.h"
+#include <time.h>
+int main() {
+struct tm tm; tm.tm_gmtoff;
+; return 0; }
+EOF
+if { (eval echo configure:1831: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  cat >> confdefs.h <<\EOF
+#define HAVE_TM_GMTOFF 1
+EOF
+
+           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
+fi
+rm -f conftest*
+
+    #
+    # Its important to include time.h in this check, as some systems
+    # (like convex) have timezone functions, etc.
+    #
+    have_timezone=no
+    echo $ac_n "checking long timezone variable""... $ac_c" 1>&6
+echo "configure:1852: checking long timezone variable" >&5
+    cat > conftest.$ac_ext <<EOF
+#line 1854 "configure"
+#include "confdefs.h"
+#include <time.h>
+int main() {
+extern long timezone;
+           timezone += 1;
+           exit (0);
+; return 0; }
+EOF
+if { (eval echo configure:1863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  have_timezone=yes
+           cat >> confdefs.h <<\EOF
+#define HAVE_TIMEZONE_VAR 1
+EOF
+
+           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
+fi
+rm -f conftest*
+
+    #
+    # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
+    #
+    if test "$have_timezone" = no; then
+    echo $ac_n "checking time_t timezone variable""... $ac_c" 1>&6
+echo "configure:1884: checking time_t timezone variable" >&5
+    cat > conftest.$ac_ext <<EOF
+#line 1886 "configure"
+#include "confdefs.h"
+#include <time.h>
+int main() {
+extern time_t timezone;
+           timezone += 1;
+           exit (0);
+; return 0; }
+EOF
+if { (eval echo configure:1895: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  cat >> confdefs.h <<\EOF
+#define HAVE_TIMEZONE_VAR 1
+EOF
+
+           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
+fi
+rm -f conftest*
+    fi
+
+    #
+    # On some systems (eg Solaris 2.5.1), timezone is not declared in
+    # time.h unless you jump through hoops.  Instead of that, we just
+    # declare it ourselves when necessary.
+    #
+    if test "$have_timezone" = yes; then
+       echo $ac_n "checking for timezone declaration""... $ac_c" 1>&6
+echo "configure:1918: checking for timezone declaration" >&5
+       
+       tzrx='^[        ]*extern.*timezone'
+       
+       cat > conftest.$ac_ext <<EOF
+#line 1923 "configure"
+#include "confdefs.h"
+#include <time.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "$tzrx" >/dev/null 2>&1; then
+  rm -rf conftest*
+  
+       cat >> confdefs.h <<\EOF
+#define HAVE_TIMEZONE_DECL 1
+EOF
+
+       echo "$ac_t""found" 1>&6
+else
+  rm -rf conftest*
+  echo "$ac_t""missing" 1>&6
+fi
+rm -f conftest*
+
+    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
+       echo $ac_n "checking for gettimeofday in -lbsd""... $ac_c" 1>&6
+echo "configure:1953: checking for gettimeofday in -lbsd" >&5
+ac_lib_var=`echo bsd'_'gettimeofday | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lbsd  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1961 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char gettimeofday();
+
+int main() {
+gettimeofday()
+; return 0; }
+EOF
+if { (eval echo configure:1972: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  libbsd=yes
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+       if test $libbsd = yes; then
+           cat >> confdefs.h <<\EOF
+#define USE_DELTA_FOR_TZ 1
+EOF
+
+       fi
+    fi
+
+
+TCL_DBGX=${DBGX}
+
+#--------------------------------------------------------------------
+# man2tcl needs this so that it can use errno.h
+#--------------------------------------------------------------------
+
+ac_safe=`echo "errno.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for errno.h""... $ac_c" 1>&6
+echo "configure:2009: checking for errno.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2014 "configure"
+#include "confdefs.h"
+#include <errno.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2019: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
+else
+  echo "$ac_t""no" 1>&6
+MAN2TCLFLAGS="-DNO_ERRNO_H"
+fi
+
+
+
+#------------------------------------------------------------------------
+# tclConfig.sh refers to this by a different name
+#------------------------------------------------------------------------
+
+TCL_SHARED_BUILD=${SHARED_BUILD}
+
+#--------------------------------------------------------------------
+# Perform final evaluations of variables with possible substitutions.
+#--------------------------------------------------------------------
+
+NODOT_VERSION=${VER}
+
+TCL_SHARED_LIB_SUFFIX="\${NODOT_VERSION}${DLLSUFFIX}"
+TCL_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
+TCL_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
+
+
+  val="`cd $srcdir/..; pwd`"
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable TCL_SRC_DIR" 1>&2; exit 1; }
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        TCL_SRC_DIR=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        TCL_SRC_DIR="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      TCL_SRC_DIR=$val
+    ;;
+  esac
+
+
+
+
+  libname=tcl
+  suffix=${TCL_UNSHARED_LIB_SUFFIX}
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "$GCC" != yes; then
+        eval "long_libname=\"${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+      else
+        eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+      fi
+    ;;
+    *)
+      eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+    ;;
+  esac
+
+  eval "long_libname=${long_libname}"
+
+  # Trick to replace DBGX with TCL_DBGX
+  DBGX='${TCL_DBGX}'
+  eval "long_libname=${long_libname}"
+
+  TCL_LIB_FILE=$long_libname
+
+
+  libname=tcl
+  suffix=${TCL_SHARED_LIB_SUFFIX}
+
+  case "${host}" in
+    *windows32* | *mingw32* | *cygwin*)
+      eval "long_libname=\"${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+    ;;
+    *)
+      eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+    ;;
+  esac
+
+  eval "long_libname=${long_libname}"
+
+  # Trick to replace DBGX with TCL_DBGX
+  DBGX='${TCL_DBGX}'
+  eval "long_libname=${long_libname}"
+
+  TCL_DLL_FILE=$long_libname
+
+
+if test "$GCC" = "yes"; then
+    GNU_TCL_LIB_FILE=${TCL_LIB_FILE}
+    MSVC_TCL_LIB_FILE=
+else
+    GNU_TCL_LIB_FILE=
+    MSVC_TCL_LIB_FILE=${TCL_LIB_FILE}
+fi
+TCL_BIN_DIR=`pwd`
+
+
+
+  libname=tcl
+  version=$TCL_VERSION
+
+  if test "$TCL_LIB_SUFFIX" = "" ; then
+    { echo "configure: error: The TCL_LIB_SUFFIX variable is not defined" 1>&2; exit 1; }
+  fi
+
+  # If the . character is not allowed in lib name, remove it from version
+  if test "${TCL_LIB_VERSIONS_OK}" != "ok"; then
+        version=`echo $version | tr -d .`
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "$GCC" != yes; then
+        eval "short_libname=\"${TCL_VENDOR_PREFIX}${libname}${version}${TCL_LIB_SUFFIX}\""
+      else
+        short_libname="-l${TCL_VENDOR_PREFIX}${libname}${version}${TCL_DBGX}"
+      fi
+    ;;
+    *)
+      short_libname="-l${TCL_VENDOR_PREFIX}${libname}${version}\${TCL_DBGX}"
+    ;;
+  esac
+
+  TCL_LIB_FLAG=$short_libname
+
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "$GCC" != yes; then
+        
+  val="`pwd`/${TCL_LIB_FLAG}"
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable TCL_BUILD_LIB_SPEC" 1>&2; exit 1; }
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        TCL_BUILD_LIB_SPEC=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        TCL_BUILD_LIB_SPEC="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      TCL_BUILD_LIB_SPEC=$val
+    ;;
+  esac
+
+      else
+        
+  val=`pwd`
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable dirname" 1>&2; exit 1; }
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        dirname=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        dirname="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      dirname=$val
+    ;;
+  esac
+
+        TCL_BUILD_LIB_SPEC="-L${dirname} ${TCL_LIB_FLAG}"
+      fi
+    ;;
+    *)
+      TCL_BUILD_LIB_SPEC="-L`pwd` ${TCL_LIB_FLAG}"
+    ;;
+  esac
+
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "$GCC" != yes; then
+        
+  val="${exec_prefix}/lib/${TCL_LIB_FLAG}"
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable TCL_LIB_SPEC" 1>&2; exit 1; }
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        TCL_LIB_SPEC=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        TCL_LIB_SPEC="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      TCL_LIB_SPEC=$val
+    ;;
+  esac
 
-else
-  WINDRES="windres"
-fi
-fi
+      else
+        
+  val=${exec_prefix}/lib
 
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable dirname" 1>&2; exit 1; }
+  fi
 
-# Find a good install program.  We prefer a C program (faster),
-# so one script is as good as another.  But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1243: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-    IFS="${IFS=        }"; ac_save_IFS="$IFS"; IFS=":"
-  for ac_dir in $PATH; do
-    # Account for people who put trailing slashes in PATH elements.
-    case "$ac_dir/" in
-    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        dirname=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        dirname="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
     *)
-      # OSF1 and SCO ODT 3.0 have their own names for install.
-      # Don't use installbsd from OSF since it installs stuff as root
-      # by default.
-      for ac_prog in ginstall scoinst install; do
-        if test -f $ac_dir/$ac_prog; then
-         if test $ac_prog = install &&
-            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
-           # AIX install.  It has an incompatible calling convention.
-           :
-         else
-           ac_cv_path_install="$ac_dir/$ac_prog -c"
-           break 2
-         fi
-       fi
-      done
-      ;;
-    esac
-  done
-  IFS="$ac_save_IFS"
+      # Default to a no-op under Unix or Cygwin gcc
+      dirname=$val
+    ;;
+  esac
 
-fi
-  if test "${ac_cv_path_install+set}" = set; then
-    INSTALL="$ac_cv_path_install"
-  else
-    # As a last resort, use the slow shell script.  We don't cache a
-    # path for INSTALL within a source directory, because that will
-    # break other packages using the cache if that directory is
-    # removed, or if the path is relative.
-    INSTALL="$ac_install_sh"
+        TCL_LIB_SPEC="-L${dirname} ${TCL_LIB_FLAG}"
+      fi
+    ;;
+    *)
+      TCL_LIB_SPEC="-L${exec_prefix}/lib ${TCL_LIB_FLAG}"
+    ;;
+  esac
+
+
+  
+  val="`pwd`/${TCL_LIB_FILE}"
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable TCL_LIB_FULL_PATH" 1>&2; exit 1; }
   fi
-fi
-echo "$ac_t""$INSTALL" 1>&6
 
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        TCL_LIB_FULL_PATH=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        TCL_LIB_FULL_PATH="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      TCL_LIB_FULL_PATH=$val
+    ;;
+  esac
+
+
+
+
+
+  libname=tclstub
+  suffix=${TCL_UNSHARED_LIB_SUFFIX}
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "$GCC" != yes; then
+        eval "long_libname=\"${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+      else
+        eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+      fi
+    ;;
+    *)
+      eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+    ;;
+  esac
+
+  eval "long_libname=${long_libname}"
+
+  # Trick to replace DBGX with TCL_DBGX
+  DBGX='${TCL_DBGX}'
+  eval "long_libname=${long_libname}"
+
+  TCL_STUB_LIB_FILE=$long_libname
+
+
+  libname=tclstub
+  version=$TCL_VERSION
+
+  if test "$TCL_LIB_SUFFIX" = "" ; then
+    { echo "configure: error: The TCL_LIB_SUFFIX variable is not defined" 1>&2; exit 1; }
+  fi
+
+  # If the . character is not allowed in lib name, remove it from version
+  if test "${TCL_LIB_VERSIONS_OK}" != "ok"; then
+        version=`echo $version | tr -d .`
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "$GCC" != yes; then
+        eval "short_libname=\"${TCL_VENDOR_PREFIX}${libname}${version}${TCL_LIB_SUFFIX}\""
+      else
+        short_libname="-l${TCL_VENDOR_PREFIX}${libname}${version}${TCL_DBGX}"
+      fi
+    ;;
+    *)
+      short_libname="-l${TCL_VENDOR_PREFIX}${libname}${version}\${TCL_DBGX}"
+    ;;
+  esac
+
+  TCL_STUB_LIB_FLAG=$short_libname
+
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "$GCC" != yes; then
+        
+  val="`pwd`/${TCL_STUB_LIB_FLAG}"
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable TCL_BUILD_STUB_LIB_SPEC" 1>&2; exit 1; }
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        TCL_BUILD_STUB_LIB_SPEC=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        TCL_BUILD_STUB_LIB_SPEC="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      TCL_BUILD_STUB_LIB_SPEC=$val
+    ;;
+  esac
+
+      else
+        
+  val=`pwd`
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable dirname" 1>&2; exit 1; }
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        dirname=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        dirname="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      dirname=$val
+    ;;
+  esac
+
+        TCL_BUILD_STUB_LIB_SPEC="-L${dirname} ${TCL_STUB_LIB_FLAG}"
+      fi
+    ;;
+    *)
+      TCL_BUILD_STUB_LIB_SPEC="-L`pwd` ${TCL_STUB_LIB_FLAG}"
+    ;;
+  esac
+
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "$GCC" != yes; then
+        
+  val="${exec_prefix}/lib/${TCL_STUB_LIB_FLAG}"
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable TCL_STUB_LIB_SPEC" 1>&2; exit 1; }
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        TCL_STUB_LIB_SPEC=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        TCL_STUB_LIB_SPEC="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      TCL_STUB_LIB_SPEC=$val
+    ;;
+  esac
+
+      else
+        
+  val=${exec_prefix}/lib
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable dirname" 1>&2; exit 1; }
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        dirname=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        dirname="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      dirname=$val
+    ;;
+  esac
+
+        TCL_STUB_LIB_SPEC="-L${dirname} ${TCL_STUB_LIB_FLAG}"
+      fi
+    ;;
+    *)
+      TCL_STUB_LIB_SPEC="-L${exec_prefix}/lib ${TCL_STUB_LIB_FLAG}"
+    ;;
+  esac
+
+
+  
+  val="`pwd`/${TCL_STUB_LIB_FILE}"
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable TCL_BUILD_STUB_LIB_PATH" 1>&2; exit 1; }
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        TCL_BUILD_STUB_LIB_PATH=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        TCL_BUILD_STUB_LIB_PATH="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      TCL_BUILD_STUB_LIB_PATH=$val
+    ;;
+  esac
+
+
+
+  
+  val="${exec_prefix}/lib/${TCL_STUB_LIB_FILE}"
+
+  if test "$val" = "" ; then
+    { echo "configure: error: Empty value for variable TCL_STUB_LIB_PATH" 1>&2; exit 1; }
+  fi
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "${CYGPATH}" = ""; then
+        { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+      elif test "${CYGPATH}" = "echo"; then
+        # No cygpath when cross compiling
+        TCL_STUB_LIB_PATH=$val
+      else
+        # store literal argument text in a variable
+        val=$val
+        # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+        val="`${CYGPATH} $val`"
+        # Convert path like C:\Tmp\foo to C:/Tmp/foo
+        TCL_STUB_LIB_PATH="`echo $val | sed -e s#\\\\\\\\#/#g`"
+      fi
+    ;;
+    *)
+      # Default to a no-op under Unix or Cygwin gcc
+      TCL_STUB_LIB_PATH=$val
+    ;;
+  esac
+
+
+
+
+
+  libname=tcldde
+  suffix=${TCL_SHARED_LIB_SUFFIX}
+
+  case "${host}" in
+    *windows32* | *mingw32* | *cygwin*)
+      eval "long_libname=\"${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+    ;;
+    *)
+      eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+    ;;
+  esac
+
+  eval "long_libname=${long_libname}"
+
+  # Trick to replace DBGX with TCL_DBGX
+  DBGX='${TCL_DBGX}'
+  eval "long_libname=${long_libname}"
+
+  DDE_DLL_FILE=$long_libname
+
+
+  libname=tcldde
+  suffix=${TCL_UNSHARED_LIB_SUFFIX}
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "$GCC" != yes; then
+        eval "long_libname=\"${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+      else
+        eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+      fi
+    ;;
+    *)
+      eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+    ;;
+  esac
+
+  eval "long_libname=${long_libname}"
+
+  # Trick to replace DBGX with TCL_DBGX
+  DBGX='${TCL_DBGX}'
+  eval "long_libname=${long_libname}"
+
+  DDE_LIB_FILE=$long_libname
+
+
+
+  libname=tclreg
+  suffix=${TCL_SHARED_LIB_SUFFIX}
+
+  case "${host}" in
+    *windows32* | *mingw32* | *cygwin*)
+      eval "long_libname=\"${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+    ;;
+    *)
+      eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+    ;;
+  esac
+
+  eval "long_libname=${long_libname}"
+
+  # Trick to replace DBGX with TCL_DBGX
+  DBGX='${TCL_DBGX}'
+  eval "long_libname=${long_libname}"
+
+  REG_DLL_FILE=$long_libname
+
+
+  libname=tclreg
+  suffix=${TCL_UNSHARED_LIB_SUFFIX}
+
+  case "${host}" in
+    *windows32* | *mingw32*)
+      if test "$GCC" != yes; then
+        eval "long_libname=\"${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+      else
+        eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+      fi
+    ;;
+    *)
+      eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+    ;;
+  esac
+
+  eval "long_libname=${long_libname}"
+
+  # Trick to replace DBGX with TCL_DBGX
+  DBGX='${TCL_DBGX}'
+  eval "long_libname=${long_libname}"
+
+  REG_LIB_FILE=$long_libname
+
+
+
+  libname=tclpip
+  suffix=${TCL_SHARED_LIB_SUFFIX}
+
+  case "${host}" in
+    *windows32* | *mingw32* | *cygwin*)
+      eval "long_libname=\"${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+    ;;
+    *)
+      eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+    ;;
+  esac
+
+  eval "long_libname=${long_libname}"
+
+  # Trick to replace DBGX with TCL_DBGX
+  DBGX='${TCL_DBGX}'
+  eval "long_libname=${long_libname}"
+
+  PIPE_DLL_FILE=$long_libname
+
+
+
+eval "DLLSUFFIX=${DLLSUFFIX}"
+eval "LIBPREFIX=${LIBPREFIX}"
+eval "LIBSUFFIX=${LIBSUFFIX}"
+eval "EXESUFFIX=${EXESUFFIX}"
+
+CFG_TCL_SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}
+CFG_TCL_UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}
+CFG_TCL_EXPORT_FILE_SUFFIX=${TCL_EXPORT_FILE_SUFFIX}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
 
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 
-# needed for the subtle differences between cygwin and mingw32
-case "${host}" in
-*-*-cygwin*)
-       TCL_ALLOC_OBJ=
-       DLL_LDLIBS=-lcygwin
-       DLL_LDFLAGS='-nostartfiles -Wl,--dll'
-       ;;
-*-*-mingw32*)
-       TCL_ALLOC_OBJ='$(TMPDIR)/tclAlloc.o'
-       DLL_LDLIBS=
-       DLL_LDFLAGS='-mdll'
-       ;;
-esac
 
 
 
 
 
-# The following variables are just for tclConfig.sh, not for Makefile. 
-LIBOBJS=
 
-TCL_VERSION=8.0
-TCL_MAJOR_VERSION=8
-TCL_MINOR_VERSION=0
-TCL_PATCH_LEVEL=p2
-VERSION=${TCL_VERSION}
-DL_LIBS=
-MATH_LIBS=-lm
-SHLIB_CFLAGS=
-SHLIB_LD=
-SHLIB_LD_LIBS=
-SHLIB_SUFFIX=
-LD_FLAGS=
-TCL_LD_SEARCH_FLAGS=
-TCL_BUILD_LIB_SPEC="-L`pwd` -ltcl`echo ${VERSION} | tr -d .`"
-TCL_LIB_SPEC="-L${exec_prefix}/lib -ltcl`echo ${VERSION} | tr -d .`"
-TCL_LIB_VERSIONS_OK=nodots
-TCL_SHARED_LIB_SUFFIX=
-TCL_UNSHARED_LIB_SUFFIX="`echo ${VERSION} | tr -d .`.a"
-eval "TCL_LIB_FILE=libtcl${TCL_UNSHARED_LIB_SUFFIX}"
-TCL_SRC_DIR=`cd $srcdir/..; pwd`
-if test "$prefix" != "$exec_prefix"; then
-    TCL_PACKAGE_PATH="${exec_prefix}/lib ${prefix}/lib"
-else
-    TCL_PACKAGE_PATH="${prefix}/lib"
-fi
-TCL_BIN_DIR=`pwd`
 
 
 
@@ -1474,9 +2915,8 @@ do
 done
 
 ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
 
-trap 'rm -fr `echo "Makefile ../unix/tclConfig.sh" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+trap 'rm -fr `echo "Makefile tclConfig.sh tcl.hpj" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 EOF
 cat >> $CONFIG_STATUS <<EOF
 
@@ -1508,53 +2948,90 @@ s%@includedir@%$includedir%g
 s%@oldincludedir@%$oldincludedir%g
 s%@infodir@%$infodir%g
 s%@mandir@%$mandir%g
+s%@CC@%$CC%g
 s%@host@%$host%g
 s%@host_alias@%$host_alias%g
 s%@host_cpu@%$host_cpu%g
 s%@host_vendor@%$host_vendor%g
 s%@host_os@%$host_os%g
-s%@CC@%$CC%g
-s%@OBJEXT@%$OBJEXT%g
 s%@build@%$build%g
 s%@build_alias@%$build_alias%g
 s%@build_cpu@%$build_cpu%g
 s%@build_vendor@%$build_vendor%g
 s%@build_os@%$build_os%g
-s%@NM@%$NM%g
-s%@AS@%$AS%g
-s%@LD@%$LD%g
+s%@AR@%$AR%g
 s%@RANLIB@%$RANLIB%g
-s%@DLLTOOL@%$DLLTOOL%g
-s%@WINDRES@%$WINDRES%g
-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
-s%@TCL_ALLOC_OBJ@%$TCL_ALLOC_OBJ%g
-s%@DLL_LDFLAGS@%$DLL_LDFLAGS%g
-s%@DLL_LDLIBS@%$DLL_LDLIBS%g
-s%@LIBOBJS@%$LIBOBJS%g
-s%@DL_LIBS@%$DL_LIBS%g
-s%@LD_FLAGS@%$LD_FLAGS%g
-s%@MATH_LIBS@%$MATH_LIBS%g
-s%@SHLIB_CFLAGS@%$SHLIB_CFLAGS%g
-s%@SHLIB_LD@%$SHLIB_LD%g
-s%@SHLIB_LD_LIBS@%$SHLIB_LD_LIBS%g
-s%@SHLIB_SUFFIX@%$SHLIB_SUFFIX%g
-s%@TCL_BUILD_LIB_SPEC@%$TCL_BUILD_LIB_SPEC%g
-s%@TCL_LD_SEARCH_FLAGS@%$TCL_LD_SEARCH_FLAGS%g
-s%@TCL_LIB_FILE@%$TCL_LIB_FILE%g
-s%@TCL_LIB_SPEC@%$TCL_LIB_SPEC%g
-s%@TCL_LIB_VERSIONS_OK@%$TCL_LIB_VERSIONS_OK%g
+s%@RC@%$RC%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@OBJEXT@%$OBJEXT%g
+s%@EXEEXT@%$EXEEXT%g
+s%@CYGPATH@%$CYGPATH%g
+s%@CPP@%$CPP%g
+s%@MAN2TCLFLAGS@%$MAN2TCLFLAGS%g
+s%@TCL_VERSION@%$TCL_VERSION%g
 s%@TCL_MAJOR_VERSION@%$TCL_MAJOR_VERSION%g
 s%@TCL_MINOR_VERSION@%$TCL_MINOR_VERSION%g
-s%@TCL_PACKAGE_PATH@%$TCL_PACKAGE_PATH%g
+s%@TCL_LIB_VERSIONS_OK@%$TCL_LIB_VERSIONS_OK%g
 s%@TCL_PATCH_LEVEL@%$TCL_PATCH_LEVEL%g
-s%@TCL_SHARED_LIB_SUFFIX@%$TCL_SHARED_LIB_SUFFIX%g
-s%@TCL_SHLIB_CFLAGS@%$TCL_SHLIB_CFLAGS%g
+s%@TCL_LIB_FILE@%$TCL_LIB_FILE%g
+s%@GNU_TCL_LIB_FILE@%$GNU_TCL_LIB_FILE%g
+s%@MSVC_TCL_LIB_FILE@%$MSVC_TCL_LIB_FILE%g
+s%@TCL_DLL_FILE@%$TCL_DLL_FILE%g
+s%@TCL_LIB_FLAG@%$TCL_LIB_FLAG%g
+s%@TCL_BUILD_LIB_SPEC@%$TCL_BUILD_LIB_SPEC%g
+s%@TCL_LIB_SPEC@%$TCL_LIB_SPEC%g
+s%@TCL_LIB_FULL_PATH@%$TCL_LIB_FULL_PATH%g
+s%@TCL_STUB_LIB_FILE@%$TCL_STUB_LIB_FILE%g
+s%@TCL_STUB_LIB_FLAG@%$TCL_STUB_LIB_FLAG%g
+s%@TCL_BUILD_STUB_LIB_SPEC@%$TCL_BUILD_STUB_LIB_SPEC%g
+s%@TCL_STUB_LIB_SPEC@%$TCL_STUB_LIB_SPEC%g
+s%@TCL_BUILD_STUB_LIB_PATH@%$TCL_BUILD_STUB_LIB_PATH%g
+s%@TCL_STUB_LIB_PATH@%$TCL_STUB_LIB_PATH%g
+s%@DDE_DLL_FILE@%$DDE_DLL_FILE%g
+s%@DDE_LIB_FILE@%$DDE_LIB_FILE%g
+s%@REG_DLL_FILE@%$REG_DLL_FILE%g
+s%@REG_LIB_FILE@%$REG_LIB_FILE%g
+s%@PIPE_DLL_FILE@%$PIPE_DLL_FILE%g
 s%@TCL_SRC_DIR@%$TCL_SRC_DIR%g
-s%@TCL_UNSHARED_LIB_SUFFIX@%$TCL_UNSHARED_LIB_SUFFIX%g
-s%@TCL_VERSION@%$TCL_VERSION%g
 s%@TCL_BIN_DIR@%$TCL_BIN_DIR%g
+s%@TCL_DBGX@%$TCL_DBGX%g
+s%@CFG_TCL_SHARED_LIB_SUFFIX@%$CFG_TCL_SHARED_LIB_SUFFIX%g
+s%@CFG_TCL_UNSHARED_LIB_SUFFIX@%$CFG_TCL_UNSHARED_LIB_SUFFIX%g
+s%@CFG_TCL_EXPORT_FILE_SUFFIX@%$CFG_TCL_EXPORT_FILE_SUFFIX%g
+s%@TCL_SHARED_BUILD@%$TCL_SHARED_BUILD%g
+s%@DEPARG@%$DEPARG%g
+s%@CFLAGS_DEFAULT@%$CFLAGS_DEFAULT%g
+s%@CFLAGS_DEBUG@%$CFLAGS_DEBUG%g
+s%@CFLAGS_OPTIMIZE@%$CFLAGS_OPTIMIZE%g
+s%@CFLAGS_WARNING@%$CFLAGS_WARNING%g
+s%@EXTRA_CFLAGS@%$EXTRA_CFLAGS%g
+s%@STLIB_LD@%$STLIB_LD%g
+s%@SHLIB_LD@%$SHLIB_LD%g
+s%@SHLIB_LD_LIBS@%$SHLIB_LD_LIBS%g
+s%@SHLIB_CFLAGS@%$SHLIB_CFLAGS%g
+s%@CC_OBJNAME@%$CC_OBJNAME%g
+s%@CC_EXENAME@%$CC_EXENAME%g
+s%@TCL_LD_SEARCH_FLAGS@%$TCL_LD_SEARCH_FLAGS%g
+s%@LDFLAGS_DEFAULT@%$LDFLAGS_DEFAULT%g
+s%@LDFLAGS_DEBUG@%$LDFLAGS_DEBUG%g
+s%@LDFLAGS_OPTIMIZE@%$LDFLAGS_OPTIMIZE%g
+s%@LDFLAGS_CONSOLE@%$LDFLAGS_CONSOLE%g
+s%@LDFLAGS_WINDOW@%$LDFLAGS_WINDOW%g
+s%@RC_OUT@%$RC_OUT%g
+s%@RC_TYPE@%$RC_TYPE%g
+s%@RC_INCLUDE@%$RC_INCLUDE%g
+s%@RES@%$RES%g
+s%@LIBS_GUI@%$LIBS_GUI%g
+s%@DLLSUFFIX@%$DLLSUFFIX%g
+s%@VENDORPREFIX@%$VENDORPREFIX%g
+s%@LIBPREFIX@%$LIBPREFIX%g
+s%@LIBSUFFIX@%$LIBSUFFIX%g
+s%@EXESUFFIX@%$EXESUFFIX%g
+s%@LIBRARIES@%$LIBRARIES%g
+s%@MAKE_LIB@%$MAKE_LIB%g
+s%@POST_MAKE_LIB@%$POST_MAKE_LIB%g
+s%@MAKE_DLL@%$MAKE_DLL%g
+s%@MAKE_EXE@%$MAKE_EXE%g
 
 CEOF
 EOF
@@ -1563,7 +3040,7 @@ cat >> $CONFIG_STATUS <<\EOF
 
 # Split the substitutions into bite-sized pieces for seds with
 # small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_max_sed_cmds=60 # Maximum number of lines to put in a sed script.
 ac_file=1 # Number of current file.
 ac_beg=1 # First line for current file.
 ac_end=$ac_max_sed_cmds # Line after last line for current file.
@@ -1596,7 +3073,7 @@ EOF
 
 cat >> $CONFIG_STATUS <<EOF
 
-CONFIG_FILES=\${CONFIG_FILES-"Makefile ../unix/tclConfig.sh"}
+CONFIG_FILES=\${CONFIG_FILES-"Makefile tclConfig.sh tcl.hpj"}
 EOF
 cat >> $CONFIG_STATUS <<\EOF
 for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
@@ -1631,10 +3108,6 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
     top_srcdir="$ac_dots$ac_given_srcdir" ;;
   esac
 
-  case "$ac_given_INSTALL" in
-  [/$]*) INSTALL="$ac_given_INSTALL" ;;
-  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
-  esac
 
   echo creating "$ac_file"
   rm -f "$ac_file"
@@ -1650,7 +3123,6 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
 s%@configure_input@%$configure_input%g
 s%@srcdir@%$srcdir%g
 s%@top_srcdir@%$top_srcdir%g
-s%@INSTALL@%$INSTALL%g
 " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
 fi; done
 rm -f conftest.s*
@@ -1667,3 +3139,4 @@ chmod +x $CONFIG_STATUS
 rm -fr confdefs* $ac_clean_files
 test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
 
+
index e5fd5b3..55a0741 100755 (executable)
@@ -1,13 +1,17 @@
-dnl    The file is CYGNUS LOCAL.  It is used for cygwin.
-
-dnl    This file is an input file used by the GNU "autoconf" program to
-dnl    generate the file "configure", which is run during Tcl installation
-dnl    to configure the system for the local environment.
-
-AC_PREREQ(2.5)
+# This file is an input file used by the GNU "autoconf" program to
+# generate the file "configure", which is run during Tcl installation
+# to configure the system for the local environment.
+#
+# RCS: @(#) $Id$
 
 AC_INIT(../generic/tcl.h)
 
+TCL_VERSION=8.3
+TCL_MAJOR_VERSION=8
+TCL_MINOR_VERSION=3
+TCL_PATCH_LEVEL=".2"
+VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION
+
 if test "${prefix}" = "NONE"; then
     prefix=/usr/local
 fi
@@ -15,92 +19,216 @@ if test "${exec_prefix}" = "NONE"; then
     exec_prefix=$prefix
 fi
 
-AC_CANONICAL_HOST
+#------------------------------------------------------------------------
+# Standard compiler checks
+#------------------------------------------------------------------------
 
 AC_PROG_CC
+
+AC_CHECK_TOOL(AR, ar, :)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(RC, windres, :)
+
+#--------------------------------------------------------------------
+# Checks to see if the make progeam sets the $MAKE variable.
+#--------------------------------------------------------------------
+
+AC_PROG_MAKE_SET
+
+#--------------------------------------------------------------------
+# These two macros perform additinal compiler test.
+#--------------------------------------------------------------------
+
+AC_CYGWIN
+
+#--------------------------------------------------------------------
+# Determines the correct binary file extension (.o, .obj, .exe etc.)
+#--------------------------------------------------------------------
+
 AC_OBJEXT
-AC_CHECK_TOOL(NM, nm, nm)
-AC_SUBST(NM)
-AC_CHECK_TOOL(AS, as, as)
-AC_SUBST(AS)
-AC_CHECK_TOOL(LD, ld, ld)
-AC_SUBST(LD)
-AC_PROG_RANLIB
-AC_CHECK_TOOL(DLLTOOL, dlltool, dlltool)
-AC_SUBST(DLLTOOL)
-AC_CHECK_TOOL(WINDRES, windres, windres)
-AC_SUBST(WINDRES)
-AC_PROG_INSTALL
-
-# needed for the subtle differences between cygwin and mingw32
-case "${host}" in
-*-*-cygwin*)
-       TCL_ALLOC_OBJ=
-       DLL_LDLIBS=-lcygwin
-       DLL_LDFLAGS='-nostartfiles -Wl,--dll'
-       ;;
-*-*-mingw32*)
-       TCL_ALLOC_OBJ='$(TMPDIR)/tclAlloc.o'
-       DLL_LDLIBS=
-       DLL_LDFLAGS='-mdll'
-       ;;
-esac
-
-AC_SUBST(TCL_ALLOC_OBJ)
-AC_SUBST(DLL_LDFLAGS)
-AC_SUBST(DLL_LDLIBS)
-
-# The following variables are just for tclConfig.sh, not for Makefile. 
-LIBOBJS=
-AC_SUBST(LIBOBJS)
-TCL_VERSION=8.0
-TCL_MAJOR_VERSION=8
-TCL_MINOR_VERSION=0
-TCL_PATCH_LEVEL=p2
-VERSION=${TCL_VERSION}
-DL_LIBS=
-MATH_LIBS=-lm
-SHLIB_CFLAGS=
-SHLIB_LD=
-SHLIB_LD_LIBS=
-SHLIB_SUFFIX=
-LD_FLAGS=
-TCL_LD_SEARCH_FLAGS=
-TCL_BUILD_LIB_SPEC="-L`pwd` -ltcl`echo ${VERSION} | tr -d .`"
-TCL_LIB_SPEC="-L${exec_prefix}/lib -ltcl`echo ${VERSION} | tr -d .`"
-TCL_LIB_VERSIONS_OK=nodots
-TCL_SHARED_LIB_SUFFIX=
-TCL_UNSHARED_LIB_SUFFIX="`echo ${VERSION} | tr -d .`.a"
-eval "TCL_LIB_FILE=libtcl${TCL_UNSHARED_LIB_SUFFIX}"
-TCL_SRC_DIR=`cd $srcdir/..; pwd`
-if test "$prefix" != "$exec_prefix"; then
-    TCL_PACKAGE_PATH="${exec_prefix}/lib ${prefix}/lib"
+AC_EXEEXT
+
+#--------------------------------------------------------------------
+# Check whether --enable-threads or --disable-threads was given.
+#--------------------------------------------------------------------
+
+SC_ENABLE_THREADS
+
+#--------------------------------------------------------------------
+# The statements below define a collection of symbols related to
+# building libtcl as a shared library instead of a static library.
+#--------------------------------------------------------------------
+
+SC_ENABLE_SHARED
+
+#--------------------------------------------------------------------
+# The statements below define a collection of compile flags.  This 
+# macro depends on the value of SHARED_BUILD, and should be called
+# after SC_ENABLE_SHARED checks the configure switches.
+#--------------------------------------------------------------------
+
+SC_CONFIG_CFLAGS
+
+#--------------------------------------------------------------------
+# Set the default compiler switches based on the --enable-symbols 
+# option.  This macro depends on C flags, and should be called
+# after SC_CONFIG_CFLAGS macro is called.
+#--------------------------------------------------------------------
+
+SC_ENABLE_SYMBOLS
+
+#------------------------------------------------------------------------------
+#       Find out all about time handling differences.
+#------------------------------------------------------------------------------
+
+SC_TIME_HANDLER
+
+TCL_DBGX=${DBGX}
+
+#--------------------------------------------------------------------
+# man2tcl needs this so that it can use errno.h
+#--------------------------------------------------------------------
+
+AC_CHECK_HEADER(errno.h, , MAN2TCLFLAGS="-DNO_ERRNO_H")
+AC_SUBST(MAN2TCLFLAGS)
+
+#------------------------------------------------------------------------
+# tclConfig.sh refers to this by a different name
+#------------------------------------------------------------------------
+
+TCL_SHARED_BUILD=${SHARED_BUILD}
+
+#--------------------------------------------------------------------
+# Perform final evaluations of variables with possible substitutions.
+#--------------------------------------------------------------------
+
+NODOT_VERSION=${VER}
+
+TCL_SHARED_LIB_SUFFIX="\${NODOT_VERSION}${DLLSUFFIX}"
+TCL_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
+TCL_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
+
+TCL_TOOL_PATH(TCL_SRC_DIR, "`cd $srcdir/..; pwd`")
+
+dnl CYGNUS LOCAL - Can't conflict with installed tcl package
+
+TCL_TOOL_STATIC_LIB_LONGNAME(TCL_LIB_FILE, tcl, ${TCL_UNSHARED_LIB_SUFFIX})
+TCL_TOOL_SHARED_LIB_LONGNAME(TCL_DLL_FILE, tcl, ${TCL_SHARED_LIB_SUFFIX})
+
+if test "$GCC" = "yes"; then
+    GNU_TCL_LIB_FILE=${TCL_LIB_FILE}
+    MSVC_TCL_LIB_FILE=
 else
-    TCL_PACKAGE_PATH="${prefix}/lib"
+    GNU_TCL_LIB_FILE=
+    MSVC_TCL_LIB_FILE=${TCL_LIB_FILE}
 fi
 TCL_BIN_DIR=`pwd`
 
-AC_SUBST(DL_LIBS)
-AC_SUBST(LD_FLAGS)
-AC_SUBST(MATH_LIBS)
-AC_SUBST(SHLIB_CFLAGS)
-AC_SUBST(SHLIB_LD)
-AC_SUBST(SHLIB_LD_LIBS)
-AC_SUBST(SHLIB_SUFFIX)
-AC_SUBST(TCL_BUILD_LIB_SPEC)
-AC_SUBST(TCL_LD_SEARCH_FLAGS)
-AC_SUBST(TCL_LIB_FILE)
-AC_SUBST(TCL_LIB_SPEC)
-AC_SUBST(TCL_LIB_VERSIONS_OK)
+
+TCL_TOOL_LIB_SHORTNAME(TCL_LIB_FLAG, tcl, $TCL_VERSION)
+TCL_TOOL_LIB_SPEC(TCL_BUILD_LIB_SPEC, `pwd`, ${TCL_LIB_FLAG})
+TCL_TOOL_LIB_SPEC(TCL_LIB_SPEC, ${exec_prefix}/lib, ${TCL_LIB_FLAG})
+TCL_TOOL_LIB_PATH(TCL_LIB_FULL_PATH, `pwd`, ${TCL_LIB_FILE})
+
+
+TCL_TOOL_STATIC_LIB_LONGNAME(TCL_STUB_LIB_FILE, tclstub, ${TCL_UNSHARED_LIB_SUFFIX})
+TCL_TOOL_LIB_SHORTNAME(TCL_STUB_LIB_FLAG, tclstub, $TCL_VERSION)
+TCL_TOOL_LIB_SPEC(TCL_BUILD_STUB_LIB_SPEC, `pwd`, ${TCL_STUB_LIB_FLAG})
+TCL_TOOL_LIB_SPEC(TCL_STUB_LIB_SPEC, ${exec_prefix}/lib, ${TCL_STUB_LIB_FLAG})
+TCL_TOOL_LIB_PATH(TCL_BUILD_STUB_LIB_PATH, `pwd`, ${TCL_STUB_LIB_FILE})
+TCL_TOOL_LIB_PATH(TCL_STUB_LIB_PATH, ${exec_prefix}/lib, ${TCL_STUB_LIB_FILE})
+
+
+TCL_TOOL_SHARED_LIB_LONGNAME(DDE_DLL_FILE, tcldde, ${TCL_SHARED_LIB_SUFFIX})
+TCL_TOOL_STATIC_LIB_LONGNAME(DDE_LIB_FILE, tcldde, ${TCL_UNSHARED_LIB_SUFFIX})
+
+TCL_TOOL_SHARED_LIB_LONGNAME(REG_DLL_FILE, tclreg, ${TCL_SHARED_LIB_SUFFIX})
+TCL_TOOL_STATIC_LIB_LONGNAME(REG_LIB_FILE, tclreg, ${TCL_UNSHARED_LIB_SUFFIX})
+
+TCL_TOOL_SHARED_LIB_LONGNAME(PIPE_DLL_FILE, tclpip, ${TCL_SHARED_LIB_SUFFIX})
+
+
+eval "DLLSUFFIX=${DLLSUFFIX}"
+eval "LIBPREFIX=${LIBPREFIX}"
+eval "LIBSUFFIX=${LIBSUFFIX}"
+eval "EXESUFFIX=${EXESUFFIX}"
+
+CFG_TCL_SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}
+CFG_TCL_UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}
+CFG_TCL_EXPORT_FILE_SUFFIX=${TCL_EXPORT_FILE_SUFFIX}
+
+AC_SUBST(TCL_VERSION)
 AC_SUBST(TCL_MAJOR_VERSION)
 AC_SUBST(TCL_MINOR_VERSION)
-AC_SUBST(TCL_PACKAGE_PATH)
+AC_SUBST(TCL_LIB_VERSIONS_OK)
 AC_SUBST(TCL_PATCH_LEVEL)
-AC_SUBST(TCL_SHARED_LIB_SUFFIX)
-AC_SUBST(TCL_SHLIB_CFLAGS)
+AC_SUBST(TCL_LIB_FILE)
+AC_SUBST(GNU_TCL_LIB_FILE)
+AC_SUBST(MSVC_TCL_LIB_FILE)
+AC_SUBST(TCL_DLL_FILE)
+AC_SUBST(TCL_LIB_FLAG)
+AC_SUBST(TCL_BUILD_LIB_SPEC)
+AC_SUBST(TCL_LIB_SPEC)
+AC_SUBST(TCL_LIB_FULL_PATH)
+AC_SUBST(TCL_STUB_LIB_FILE)
+AC_SUBST(TCL_STUB_LIB_FLAG)
+AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
+AC_SUBST(TCL_STUB_LIB_SPEC)
+AC_SUBST(TCL_BUILD_STUB_LIB_PATH)
+AC_SUBST(TCL_STUB_LIB_PATH)
+
+AC_SUBST(DDE_DLL_FILE)
+AC_SUBST(DDE_LIB_FILE)
+AC_SUBST(REG_DLL_FILE)
+AC_SUBST(REG_LIB_FILE)
+AC_SUBST(PIPE_DLL_FILE)
+
 AC_SUBST(TCL_SRC_DIR)
-AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
-AC_SUBST(TCL_VERSION)
 AC_SUBST(TCL_BIN_DIR)
+AC_SUBST(TCL_DBGX)
+AC_SUBST(CFG_TCL_SHARED_LIB_SUFFIX)
+AC_SUBST(CFG_TCL_UNSHARED_LIB_SUFFIX)
+AC_SUBST(CFG_TCL_EXPORT_FILE_SUFFIX)
+AC_SUBST(TCL_SHARED_BUILD)
+
+AC_SUBST(CYGPATH)
+AC_SUBST(DEPARG)
+AC_SUBST(CFLAGS_DEFAULT)
+AC_SUBST(CFLAGS_DEBUG)
+AC_SUBST(CFLAGS_OPTIMIZE)
+AC_SUBST(CFLAGS_WARNING)
+AC_SUBST(EXTRA_CFLAGS)
+AC_SUBST(STLIB_LD)
+AC_SUBST(SHLIB_LD)
+AC_SUBST(SHLIB_LD_LIBS)
+AC_SUBST(SHLIB_CFLAGS)
+AC_SUBST(CC_OBJNAME)
+AC_SUBST(CC_EXENAME)
+AC_SUBST(TCL_LD_SEARCH_FLAGS)
+AC_SUBST(LDFLAGS_DEFAULT)
+AC_SUBST(LDFLAGS_DEBUG)
+AC_SUBST(LDFLAGS_OPTIMIZE)
+AC_SUBST(LDFLAGS_CONSOLE)
+AC_SUBST(LDFLAGS_WINDOW)
+AC_SUBST(AR)
+AC_SUBST(RANLIB)
+AC_SUBST(RC)
+AC_SUBST(RC_OUT)
+AC_SUBST(RC_TYPE)
+AC_SUBST(RC_INCLUDE)
+AC_SUBST(RES)
+AC_SUBST(LIBS)
+AC_SUBST(LIBS_GUI)
+AC_SUBST(DLLSUFFIX)
+AC_SUBST(VENDORPREFIX)
+AC_SUBST(LIBPREFIX)
+AC_SUBST(LIBSUFFIX)
+AC_SUBST(EXESUFFIX)
+AC_SUBST(LIBRARIES)
+AC_SUBST(MAKE_LIB)
+AC_SUBST(POST_MAKE_LIB)
+AC_SUBST(MAKE_DLL)
+AC_SUBST(MAKE_EXE)
+
+AC_OUTPUT(Makefile tclConfig.sh tcl.hpj)
 
-AC_OUTPUT(Makefile ../unix/tclConfig.sh)
index 7f83a7b..f7f8332 100644 (file)
@@ -1,10 +1,10 @@
 /* 
  * tclWin32Dll.c --
  *
- *     This file contains the DLL entry point which sets up the 32-to-16-bit
- *     thunking code for SynchSpawn if the library is running under Win32s.
+ *     This file contains the DLL entry point.
  *
  * Copyright (c) 1995-1996 Sun Microsystems, Inc.
+ * Copyright (c) 1998-2000 Scriptics Corporation.
  *
  * See the file "license.terms" for information on usage and redistribution
  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 
 #include "tclWinInt.h"
 
-typedef DWORD (WINAPI * UT32PROC)(LPVOID lpBuff, DWORD dwUserDefined,
+/*
+ * The following data structures are used when loading the thunking 
+ * library for execing child processes under Win32s.
+ */
+
+typedef DWORD (WINAPI UT32PROC)(LPVOID lpBuff, DWORD dwUserDefined,
        LPVOID *lpTranslationList);
 
-typedef BOOL (WINAPI * PUTREGISTER)(HANDLE hModule, LPCSTR SixteenBitDLL,
-       LPCSTR InitName, LPCSTR ProcName, UT32PROCThirtyTwoBitThunk,
+typedef BOOL (WINAPI UTREGISTER)(HANDLE hModule, LPCSTR SixteenBitDLL,
+       LPCSTR InitName, LPCSTR ProcName, UT32PROC **ThirtyTwoBitThunk,
        FARPROC UT32Callback, LPVOID Buff);
 
-typedef VOID (WINAPI * PUTUNREGISTER)(HANDLE hModule);
-
-static PUTUNREGISTER UTUnRegister = NULL;
-static int           tclProcessesAttached = 0;
+typedef VOID (WINAPI UTUNREGISTER)(HANDLE hModule);
 
-/*
- * The following data structure is used to keep track of all of the DLL's
- * opened by Tcl so that they can be freed with the Tcl.dll is unloaded.
+/* 
+ * The following variables keep track of information about this DLL
+ * on a per-instance basis.  Each time this DLL is loaded, it gets its own 
+ * new data segment with its own copy of all static and global information.
  */
 
-typedef struct LibraryList {
-    HINSTANCE handle;
-    struct LibraryList *nextPtr;
-} LibraryList;
-
-static LibraryList *libraryList = NULL;        /* List of currently loaded DLL's.  */
-
-static HINSTANCE tclInstance;  /* Global library instance handle. */
-static int tclPlatformId;      /* Running under NT, 95, or Win32s? */
+static HINSTANCE hInstance;    /* HINSTANCE of this DLL. */
+static int platformId;         /* Running under NT, or 95/98? */
 
 /*
- * Declarations for functions that are only used in this file.
+ * The following function tables are used to dispatch to either the
+ * wide-character or multi-byte versions of the operating system calls,
+ * depending on whether the Unicode calls are available.
  */
 
-static void            UnloadLibraries _ANSI_ARGS_((void));
+static TclWinProcs asciiProcs = {
+    0,
+
+    (BOOL (WINAPI *)(CONST TCHAR *, LPDCB)) BuildCommDCBA,
+    (TCHAR *(WINAPI *)(TCHAR *)) CharLowerA,
+    (BOOL (WINAPI *)(CONST TCHAR *, CONST TCHAR *, BOOL)) CopyFileA,
+    (BOOL (WINAPI *)(CONST TCHAR *, LPSECURITY_ATTRIBUTES)) CreateDirectoryA,
+    (HANDLE (WINAPI *)(CONST TCHAR *, DWORD, DWORD, SECURITY_ATTRIBUTES *, 
+           DWORD, DWORD, HANDLE)) CreateFileA,
+    (BOOL (WINAPI *)(CONST TCHAR *, TCHAR *, LPSECURITY_ATTRIBUTES, 
+           LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, CONST TCHAR *, 
+           LPSTARTUPINFOA, LPPROCESS_INFORMATION)) CreateProcessA,
+    (BOOL (WINAPI *)(CONST TCHAR *)) DeleteFileA,
+    (HANDLE (WINAPI *)(CONST TCHAR *, WIN32_FIND_DATAT *)) FindFirstFileA,
+    (BOOL (WINAPI *)(HANDLE, WIN32_FIND_DATAT *)) FindNextFileA,
+    (BOOL (WINAPI *)(WCHAR *, LPDWORD)) GetComputerNameA,
+    (DWORD (WINAPI *)(DWORD, WCHAR *)) GetCurrentDirectoryA,
+    (DWORD (WINAPI *)(CONST TCHAR *)) GetFileAttributesA,
+    (DWORD (WINAPI *)(CONST TCHAR *, DWORD nBufferLength, WCHAR *, 
+           TCHAR **)) GetFullPathNameA,
+    (DWORD (WINAPI *)(HMODULE, WCHAR *, int)) GetModuleFileNameA,
+    (DWORD (WINAPI *)(CONST TCHAR *, WCHAR *, DWORD)) GetShortPathNameA,
+    (UINT (WINAPI *)(CONST TCHAR *, CONST TCHAR *, UINT uUnique, 
+           WCHAR *)) GetTempFileNameA,
+    (DWORD (WINAPI *)(DWORD, WCHAR *)) GetTempPathA,
+    (BOOL (WINAPI *)(CONST TCHAR *, WCHAR *, DWORD, LPDWORD, LPDWORD, LPDWORD,
+           WCHAR *, DWORD)) GetVolumeInformationA,
+    (HINSTANCE (WINAPI *)(CONST TCHAR *)) LoadLibraryA,
+    (TCHAR (WINAPI *)(WCHAR *, CONST TCHAR *)) lstrcpyA,
+    (BOOL (WINAPI *)(CONST TCHAR *, CONST TCHAR *)) MoveFileA,
+    (BOOL (WINAPI *)(CONST TCHAR *)) RemoveDirectoryA,
+    (DWORD (WINAPI *)(CONST TCHAR *, CONST TCHAR *, CONST TCHAR *, DWORD, 
+           WCHAR *, TCHAR **)) SearchPathA,
+    (BOOL (WINAPI *)(CONST TCHAR *)) SetCurrentDirectoryA,
+    (BOOL (WINAPI *)(CONST TCHAR *, DWORD)) SetFileAttributesA,
+};
+
+static TclWinProcs unicodeProcs = {
+    1,
+
+    (BOOL (WINAPI *)(CONST TCHAR *, LPDCB)) BuildCommDCBW,
+    (TCHAR *(WINAPI *)(TCHAR *)) CharLowerW,
+    (BOOL (WINAPI *)(CONST TCHAR *, CONST TCHAR *, BOOL)) CopyFileW,
+    (BOOL (WINAPI *)(CONST TCHAR *, LPSECURITY_ATTRIBUTES)) CreateDirectoryW,
+    (HANDLE (WINAPI *)(CONST TCHAR *, DWORD, DWORD, SECURITY_ATTRIBUTES *, 
+           DWORD, DWORD, HANDLE)) CreateFileW,
+    (BOOL (WINAPI *)(CONST TCHAR *, TCHAR *, LPSECURITY_ATTRIBUTES, 
+           LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, CONST TCHAR *, 
+           LPSTARTUPINFOA, LPPROCESS_INFORMATION)) CreateProcessW,
+    (BOOL (WINAPI *)(CONST TCHAR *)) DeleteFileW,
+    (HANDLE (WINAPI *)(CONST TCHAR *, WIN32_FIND_DATAT *)) FindFirstFileW,
+    (BOOL (WINAPI *)(HANDLE, WIN32_FIND_DATAT *)) FindNextFileW,
+    (BOOL (WINAPI *)(WCHAR *, LPDWORD)) GetComputerNameW,
+    (DWORD (WINAPI *)(DWORD, WCHAR *)) GetCurrentDirectoryW,
+    (DWORD (WINAPI *)(CONST TCHAR *)) GetFileAttributesW,
+    (DWORD (WINAPI *)(CONST TCHAR *, DWORD nBufferLength, WCHAR *, 
+           TCHAR **)) GetFullPathNameW,
+    (DWORD (WINAPI *)(HMODULE, WCHAR *, int)) GetModuleFileNameW,
+    (DWORD (WINAPI *)(CONST TCHAR *, WCHAR *, DWORD)) GetShortPathNameW,
+    (UINT (WINAPI *)(CONST TCHAR *, CONST TCHAR *, UINT uUnique, 
+           WCHAR *)) GetTempFileNameW,
+    (DWORD (WINAPI *)(DWORD, WCHAR *)) GetTempPathW,
+    (BOOL (WINAPI *)(CONST TCHAR *, WCHAR *, DWORD, LPDWORD, LPDWORD, LPDWORD, 
+           WCHAR *, DWORD)) GetVolumeInformationW,
+    (HINSTANCE (WINAPI *)(CONST TCHAR *)) LoadLibraryW,
+    (TCHAR (WINAPI *)(WCHAR *, CONST TCHAR *)) lstrcpyW,
+    (BOOL (WINAPI *)(CONST TCHAR *, CONST TCHAR *)) MoveFileW,
+    (BOOL (WINAPI *)(CONST TCHAR *)) RemoveDirectoryW,
+    (DWORD (WINAPI *)(CONST TCHAR *, CONST TCHAR *, CONST TCHAR *, DWORD, 
+           WCHAR *, TCHAR **)) SearchPathW,
+    (BOOL (WINAPI *)(CONST TCHAR *)) SetCurrentDirectoryW,
+    (BOOL (WINAPI *)(CONST TCHAR *, DWORD)) SetFileAttributesW,
+};
+
+TclWinProcs *tclWinProcs;
+static Tcl_Encoding tclWinTCharEncoding;
 
 /*
  * The following declaration is for the VC++ DLL entry point.
  */
 
-BOOL APIENTRY          DllMain _ANSI_ARGS_((HINSTANCE hInst,
-                           DWORD reason, LPVOID reserved));
-
-#ifdef __WIN32__
-#ifndef STATIC_BUILD
+BOOL APIENTRY          DllMain(HINSTANCE hInst, DWORD reason, 
+                               LPVOID reserved);
 
 /* CYGNUS LOCAL */
 #ifdef __CYGWIN__0
 /* CYGWIN requires an impure pointer variable, which must be
    explicitly initialized when the DLL starts up.  */
 struct _reent *_impure_ptr;
-extern struct _reent *_imp__reent_data;
+extern struct _reent __declspec(dllimport) reent_data;
 #endif
 /* END CYGNUS LOCAL */
+
+#ifdef __WIN32__
+#ifndef STATIC_BUILD
+
 \f
 /*
  *----------------------------------------------------------------------
@@ -122,24 +196,18 @@ DllMain(hInst, reason, reserved)
 #ifdef __CYGWIN__0
     /* Cygwin requires the impure data pointer to be initialized
        when the DLL starts up.  */
-    _impure_ptr = _imp__reent_data;
+    _impure_ptr = &reent_data;
 #endif
     /* END CYGNUS LOCAL */
 
     switch (reason) {
     case DLL_PROCESS_ATTACH:
-       if (tclProcessesAttached++) {
-           return FALSE;         /* Not the first initialization. */
-       }
-
        TclWinInit(hInst);
        return TRUE;
 
     case DLL_PROCESS_DETACH:
-
-       tclProcessesAttached--;
-       if (tclProcessesAttached == 0) {
-            Tcl_Finalize();
+       if (hInst == hInstance) {
+           Tcl_Finalize();
        }
        break;
     }
@@ -153,6 +221,28 @@ DllMain(hInst, reason, reserved)
 /*
  *----------------------------------------------------------------------
  *
+ * TclWinGetTclInstance --
+ *
+ *     Retrieves the global library instance handle.
+ *
+ * Results:
+ *     Returns the global library instance handle.
+ *
+ * Side effects:
+ *     None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+HINSTANCE
+TclWinGetTclInstance()
+{
+    return hInstance;
+}
+\f
+/*
+ *----------------------------------------------------------------------
+ *
  * TclWinInit --
  *
  *     This function initializes the internal state of the tcl library.
@@ -161,8 +251,7 @@ DllMain(hInst, reason, reserved)
  *     None.
  *
  * Side effects:
- *     Initializes the 16-bit thunking library, and the tclPlatformId
- *     variable.
+ *     Initializes the tclPlatformId variable.
  *
  *----------------------------------------------------------------------
  */
@@ -173,248 +262,257 @@ TclWinInit(hInst)
 {
     OSVERSIONINFO os;
 
-    tclInstance = hInst;
-    os.dwOSVersionInfoSize = sizeof(os);
+    hInstance = hInst;
+    os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
     GetVersionEx(&os);
-    tclPlatformId = os.dwPlatformId;
+    platformId = os.dwPlatformId;
 
     /*
-     * The following code stops Windows 3.x from automatically putting 
-     * up Sharing Violation dialogs, e.g, when someone tries to
-     * access a file that is locked or a drive with no disk in it.
-     * Tcl already returns the appropriate error to the caller, and they 
-     * can decide to put up their own dialog in response to that failure.  
-     *
-     * Under 95 and NT, the system doesn't automatically put up dialogs 
-     * when the above operations fail.
+     * We no longer support Win32s, so just in case someone manages to
+     * get a runtime there, make sure they know that.
      */
 
-    if (tclPlatformId == VER_PLATFORM_WIN32s) {
-       SetErrorMode(SetErrorMode(0) | SEM_FAILCRITICALERRORS);
+    if (platformId == VER_PLATFORM_WIN32s) {
+       panic("Win32s is not a supported platform");    
     }
+
+    tclWinProcs = &asciiProcs;
 }
 \f
 /*
  *----------------------------------------------------------------------
  *
- * TclpFinalize --
+ * TclWinGetPlatformId --
  *
- *     Clean up the Windows specific library state.
+ *     Determines whether running under NT, 95, or Win32s, to allow 
+ *     runtime conditional code.
  *
  * Results:
- *     None.
+ *     The return value is one of:
+ *         VER_PLATFORM_WIN32s         Win32s on Windows 3.1. (not supported)
+ *         VER_PLATFORM_WIN32_WINDOWS  Win32 on Windows 95.
+ *         VER_PLATFORM_WIN32_NT       Win32 on Windows NT
  *
  * Side effects:
- *     Unloads any DLLs and cleans up the thunking library, if
- *     necessary.
+ *     None.
  *
  *----------------------------------------------------------------------
  */
 
-void
-TclpFinalize()
+int            
+TclWinGetPlatformId()
 {
-    /*
-     * Unregister the Tcl thunk.
-     */
-
-    if (UTUnRegister != NULL) {
-       UTUnRegister(tclInstance);
-       UTUnRegister = NULL;
-    }
-
-    /*
-     * Cleanup any dynamically loaded libraries.
-     */
-
-    UnloadLibraries();
+    return platformId;
 }
 \f
 /*
- *----------------------------------------------------------------------
+ *-------------------------------------------------------------------------
  *
- * TclWinLoadLibrary --
+ * TclWinNoBackslash --
  *
- *     This function is a wrapper for the system LoadLibrary.  It is
- *     responsible for adding library handles to the library list so
- *     the libraries can be freed when tcl.dll is unloaded.
+ *     We're always iterating through a string in Windows, changing the
+ *     backslashes to slashes for use in Tcl.
  *
  * Results:
- *     Returns the handle of the newly loaded library, or NULL on
- *     failure.
+ *     All backslashes in given string are changed to slashes.
  *
  * Side effects:
- *     Loads the specified library into the process.
+ *     None.
  *
- *----------------------------------------------------------------------
+ *-------------------------------------------------------------------------
  */
 
-HINSTANCE
-TclWinLoadLibrary(name)
-    char *name;                        /* Library file to load. */
+char *
+TclWinNoBackslash(
+    char *path)                        /* String to change. */
 {
-    HINSTANCE handle;
-    LibraryList *ptr;
-
-    handle = LoadLibrary(name);
-    if (handle != NULL) {
-       ptr = (LibraryList*) ckalloc(sizeof(LibraryList));
-       ptr->handle = handle;
-       ptr->nextPtr = libraryList;
-       libraryList = ptr;
-    } else {
-       TclWinConvertError(GetLastError());
+    char *p;
+
+    for (p = path; *p != '\0'; p++) {
+       if (*p == '\\') {
+           *p = '/';
+       }
     }
-    return handle;
+    return path;
 }
 \f
 /*
  *----------------------------------------------------------------------
  *
- * UnloadLibraries --
+ * TclpCheckStackSpace --
  *
- *     Frees any dynamically allocated libraries loaded by Tcl.
+ *     Detect if we are about to blow the stack.  Called before an 
+ *     evaluation can happen when nesting depth is checked.
  *
  * Results:
- *     None.
+ *     1 if there is enough stack space to continue; 0 if not.
  *
  * Side effects:
- *     Frees the libraries on the library list as well as the list.
+ *     None.
  *
  *----------------------------------------------------------------------
  */
 
-static void
-UnloadLibraries()
+int
+TclpCheckStackSpace()
 {
-    LibraryList *ptr;
+    /*
+     * We can recurse only if there is at least TCL_WIN_STACK_THRESHOLD
+     * bytes of stack space left.  alloca() is cheap on windows; basically
+     * it just subtracts from the stack pointer causing the OS to throw an
+     * exception if the stack pointer is set below the bottom of the stack.
+     */
 
-    while (libraryList != NULL) {
-       FreeLibrary(libraryList->handle);
-       ptr = libraryList->nextPtr;
-       ckfree((char*)libraryList);
-       libraryList = ptr;
-    }
+#ifndef __GNUC__
+    __try {
+       alloca(TCL_WIN_STACK_THRESHOLD);
+       return 1;
+    /* CYGNUS LOCAL */
+    } __except (1) {}
+#else
+    return alloca(TCL_WIN_STACK_THRESHOLD) != NULL;
+#endif
+
+    return 0;
 }
+
 \f
 /*
  *----------------------------------------------------------------------
  *
- * TclWinSynchSpawn --
+ * TclWinGetPlatform --
  *
- *     32-bit entry point to the 16-bit SynchSpawn code.
+ *     This is a kludge that allows the test library to get access
+ *     the internal tclPlatform variable.
  *
  * Results:
- *     1 on success, 0 on failure.
+ *     Returns a pointer to the tclPlatform variable.
  *
  * Side effects:
- *     Spawns a command and waits for it to complete.
+ *     None.
  *
  *----------------------------------------------------------------------
  */
-int 
-TclWinSynchSpawn(void *args, int type, void **trans, Tcl_Pid *pidPtr)
-{
-    static UT32PROC UTProc = NULL;
-    static int utErrorCode;
-
-    if (UTUnRegister == NULL) {
-       /*
-        * Load the Universal Thunking routines from kernel32.dll.
-        */
 
-       HINSTANCE hKernel;
-       PUTREGISTER UTRegister;
-       char buffer[] = "TCL16xx.DLL";
-
-       hKernel = TclWinLoadLibrary("Kernel32.Dll");
-       if (hKernel == NULL) {
-           return 0;
-       }
-
-       UTRegister = (PUTREGISTER) GetProcAddress(hKernel, "UTRegister");
-       UTUnRegister = (PUTUNREGISTER) GetProcAddress(hKernel, "UTUnRegister");
-       if (!UTRegister || !UTUnRegister) {
-           UnloadLibraries();
-           return 0;
-       }
-
-       /*
-        * Construct the complete name of tcl16xx.dll.
-        */
-
-       buffer[5] = '0' + TCL_MAJOR_VERSION;
-       buffer[6] = '0' + TCL_MINOR_VERSION;
-
-       /*
-        * Register the Tcl thunk.
-        */
-
-       if (UTRegister(tclInstance, buffer, NULL, "UTProc", &UTProc, NULL,
-               NULL) == FALSE) {
-           utErrorCode = GetLastError();
-       }
-    }
-
-    if (UTProc == NULL) {
-       /*
-        * The 16-bit thunking DLL wasn't found.  Return error code that
-        * indicates this problem.
-        */
-
-       SetLastError(utErrorCode);
-       return 0;
-    }
-
-    UTProc(args, type, trans);
-    *pidPtr = 0;
-    return 1;
+TclPlatformType *
+TclWinGetPlatform()
+{
+    return &tclPlatform;
 }
 \f
 /*
- *----------------------------------------------------------------------
+ *---------------------------------------------------------------------------
  *
- * TclWinGetTclInstance --
+ * TclWinSetInterfaces --
  *
- *     Retrieves the global library instance handle.
+ *     A helper proc that allows the test library to change the
+ *     tclWinProcs structure to dispatch to either the wide-character
+ *     or multi-byte versions of the operating system calls, depending
+ *     on whether Unicode is the system encoding.
  *
  * Results:
- *     Returns the global library instance handle.
+ *     None.
  *
  * Side effects:
  *     None.
  *
- *----------------------------------------------------------------------
+ *---------------------------------------------------------------------------
  */
 
-HINSTANCE
-TclWinGetTclInstance()
+void
+TclWinSetInterfaces(
+    int wide)                  /* Non-zero to use wide interfaces, 0
+                                * otherwise. */
 {
-    return tclInstance;
+    Tcl_FreeEncoding(tclWinTCharEncoding);
+
+    if (wide) {
+       tclWinProcs = &unicodeProcs;
+       tclWinTCharEncoding = Tcl_GetEncoding(NULL, "unicode");
+    } else {
+       tclWinProcs = &asciiProcs;
+       tclWinTCharEncoding = NULL;
+    }
 }
 \f
 /*
- *----------------------------------------------------------------------
- *
- * TclWinGetPlatformId --
- *
- *     Determines whether running under NT, 95, or Win32s, to allow 
- *     runtime conditional code.
+ *---------------------------------------------------------------------------
+ *
+ * Tcl_WinUtfToTChar, Tcl_WinTCharToUtf --
+ *
+ *     Convert between UTF-8 and Unicode when running Windows NT or 
+ *     the current ANSI code page when running Windows 95.
+ *
+ *     On Mac, Unix, and Windows 95, all strings exchanged between Tcl
+ *     and the OS are "char" oriented.  We need only one Tcl_Encoding to
+ *     convert between UTF-8 and the system's native encoding.  We use
+ *     NULL to represent that encoding.
+ *
+ *     On NT, some strings exchanged between Tcl and the OS are "char"
+ *     oriented, while others are in Unicode.  We need two Tcl_Encoding
+ *     APIs depending on whether we are targeting a "char" or Unicode
+ *     interface.  
+ *
+ *     Calling Tcl_UtfToExternal() or Tcl_ExternalToUtf() with an
+ *     encoding of NULL should always used to convert between UTF-8
+ *     and the system's "char" oriented encoding.  The following two
+ *     functions are used in Windows-specific code to convert between
+ *     UTF-8 and Unicode strings (NT) or "char" strings(95).  This saves
+ *     you the trouble of writing the following type of fragment over and
+ *     over:
+ *
+ *             if (running NT) {
+ *                 encoding <- Tcl_GetEncoding("unicode");
+ *                 nativeBuffer <- UtfToExternal(encoding, utfBuffer);
+ *                 Tcl_FreeEncoding(encoding);
+ *             } else {
+ *                 nativeBuffer <- UtfToExternal(NULL, utfBuffer);
+ *             }
+ *
+ *     By convention, in Windows a TCHAR is a character in the ANSI code
+ *     page on Windows 95, a Unicode character on Windows NT.  If you
+ *     plan on targeting a Unicode interfaces when running on NT and a
+ *     "char" oriented interface while running on 95, these functions
+ *     should be used.  If you plan on targetting the same "char"
+ *     oriented function on both 95 and NT, use Tcl_UtfToExternal()
+ *     with an encoding of NULL.
  *
  * 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
+ *     The result is a pointer to the string in the desired target
+ *     encoding.  Storage for the result string is allocated in
+ *     dsPtr; the caller must call Tcl_DStringFree() when the result
+ *     is no longer needed.
  *
  * Side effects:
  *     None.
  *
- *----------------------------------------------------------------------
+ *---------------------------------------------------------------------------
  */
 
-int            
-TclWinGetPlatformId()
+TCHAR *
+Tcl_WinUtfToTChar(string, len, dsPtr)
+    CONST char *string;                /* Source string in UTF-8. */
+    int len;                   /* Source string length in bytes, or < 0 for
+                                * strlen(). */
+    Tcl_DString *dsPtr;                /* Uninitialized or free DString in which 
+                                * the converted string is stored. */
+{
+    return (TCHAR *) Tcl_UtfToExternalDString(tclWinTCharEncoding, 
+           string, len, dsPtr);
+}
+
+char *
+Tcl_WinTCharToUtf(string, len, dsPtr)
+    CONST TCHAR *string;       /* Source string in Unicode when running
+                                * NT, ANSI when running 95. */
+    int len;                   /* Source string length in bytes, or < 0 for
+                                * platform-specific string length. */
+    Tcl_DString *dsPtr;                /* Uninitialized or free DString in which 
+                                * the converted string is stored. */
 {
-    return tclPlatformId;
+    return Tcl_ExternalToUtfDString(tclWinTCharEncoding, 
+           (CONST char *) string, len, dsPtr);
 }
+
+
+
index a167012..57f5d62 100644 (file)
@@ -6,7 +6,7 @@
  *      files, which can be manipulated through the Win32 console redirection
  *      interfaces.
  *
- * Copyright (c) 1995-1996 Sun Microsystems, Inc.
+ * Copyright (c) 1995-1998 Sun Microsystems, Inc.
  *
  * See the file "license.terms" for information on usage and redistribution
  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 
 #include "tclWinInt.h"
 #include <sys/stat.h>
-#ifndef __WIN32__
+
 #include <shlobj.h>
-#endif
+#include <lmaccess.h>          /* For TclpGetUserHome(). */
 
-/*
- * The variable below caches the name of the current working directory
- * in order to avoid repeated calls to getcwd.  The string is malloc-ed.
- * NULL means the cache needs to be refreshed.
- */
+static time_t          ToCTime(FILETIME fileTime);
+
+typedef NET_API_STATUS NET_API_FUNCTION NETUSERGETINFOPROC
+       (LPWSTR servername, LPWSTR username, DWORD level, LPBYTE *bufptr);
+
+typedef NET_API_STATUS NET_API_FUNCTION NETAPIBUFFERFREEPROC
+       (LPVOID Buffer);
 
-static char *currentDir =  NULL;
+typedef NET_API_STATUS NET_API_FUNCTION NETGETDCNAMEPROC
+       (LPWSTR servername, LPWSTR domainname, LPBYTE *bufptr);
 
 \f
 /*
- *----------------------------------------------------------------------
+ *---------------------------------------------------------------------------
  *
- * Tcl_FindExecutable --
+ * TclpFindExecutable --
  *
  *     This procedure computes the absolute path name of the current
  *     application, given its argv[0] value.
  *
  * Results:
- *     None.
+ *     A dirty UTF string that is the path to the executable.  At this
+ *     point we may not know the system encoding.  Convert the native
+ *     string value to UTF using the default encoding.  The assumption
+ *     is that we will still be able to parse the path given the path
+ *     name contains ASCII string and '/' chars do not conflict with
+ *     other UTF chars.
  *
  * Side effects:
- *     The variable tclExecutableName gets filled in with the file
+ *     The variable tclNativeExecutableName gets filled in with the file
  *     name for the application, if we figured it out.  If we couldn't
- *     figure it out, Tcl_FindExecutable is set to NULL.
+ *     figure it out, tclNativeExecutableName is set to NULL.
  *
- *----------------------------------------------------------------------
+ *---------------------------------------------------------------------------
  */
 
-void
-Tcl_FindExecutable(argv0)
-    char *argv0;               /* The value of the application's argv[0]. */
+char *
+TclpFindExecutable(argv0)
+    CONST char *argv0;         /* The value of the application's argv[0]
+                                * (native). */
 {
-    Tcl_DString buffer;
-    int length;
-
-    Tcl_DStringInit(&buffer);
+    Tcl_DString ds;
+    WCHAR wName[MAX_PATH];
 
-    if (tclExecutableName != NULL) {
-       ckfree(tclExecutableName);
-       tclExecutableName = NULL;
+    if (argv0 == NULL) {
+       return NULL;
+    }
+    if (tclNativeExecutableName != NULL) {
+       return tclNativeExecutableName;
     }
 
     /*
@@ -67,26 +76,28 @@ Tcl_FindExecutable(argv0)
      * create this process.
      */
 
-    Tcl_DStringSetLength(&buffer, MAX_PATH+1);
-    length = GetModuleFileName(NULL, Tcl_DStringValue(&buffer), MAX_PATH+1);
-    if (length > 0) {
-       tclExecutableName = (char *) ckalloc((unsigned) (length + 1));
-       strcpy(tclExecutableName, Tcl_DStringValue(&buffer));
-    }
-    Tcl_DStringFree(&buffer);
+    (*tclWinProcs->getModuleFileNameProc)(NULL, wName, MAX_PATH);
+    Tcl_WinTCharToUtf((TCHAR *) wName, -1, &ds);
+
+    tclNativeExecutableName = ckalloc((unsigned) (Tcl_DStringLength(&ds) + 1));
+    strcpy(tclNativeExecutableName, Tcl_DStringValue(&ds));
+    Tcl_DStringFree(&ds);
+
+    TclWinNoBackslash(tclNativeExecutableName);
+    return tclNativeExecutableName;
 }
 \f
 /*
  *----------------------------------------------------------------------
  *
- * TclMatchFiles --
+ * TclpMatchFilesTypes --
  *
  *     This routine is used by the globbing code to search a
  *     directory for all files which match a given pattern.
  *
  * Results: 
  *     If the tail argument is NULL, then the matching files are
- *     added to the interp->result.  Otherwise, TclDoGlob is called
+ *     added to the the interp's result.  Otherwise, TclDoGlob is called
  *     recursively for each matching subdirectory.  The return value
  *     is a standard Tcl result indicating whether an error occurred
  *     in globbing.
@@ -97,25 +108,30 @@ Tcl_FindExecutable(argv0)
  *---------------------------------------------------------------------- */
 
 int
-TclMatchFiles(interp, separators, dirPtr, pattern, tail)
-    Tcl_Interp *interp;                /* Interpreter to receive results. */
-    char *separators;          /* Directory separators to pass to TclDoGlob. */
-    Tcl_DString *dirPtr;       /* Contains path to directory to search. */
-    char *pattern;             /* Pattern to match against. */
-    char *tail;                        /* Pointer to end of pattern.  Tail must
-                                * point to a location in pattern. */
+TclpMatchFilesTypes(
+    Tcl_Interp *interp,                /* Interpreter to receive results. */
+    char *separators,          /* Directory separators to pass to TclDoGlob. */
+    Tcl_DString *dirPtr,       /* Contains path to directory to search. */
+    char *pattern,             /* Pattern to match against. */
+    char *tail,                        /* Pointer to end of pattern.  Tail must
+                                * point to a location in pattern and must
+                                * not be static.*/
+    GlobTypeData *types)       /* Object containing list of acceptable types.
+                                * May be NULL. */
 {
-    char drivePattern[4] = "?:\\";
-    char *newPattern, *p, *dir, *root, c;
-    char *src, *dest;
-    int length, matchDotFiles;
-    int result = TCL_OK;
-    int baseLength = Tcl_DStringLength(dirPtr);
-    Tcl_DString buffer;
-    DWORD atts, volFlags;
+    char drivePat[] = "?:\\";
+    const char *message;
+    char *dir, *newPattern, *root;
+    int matchDotFiles;
+    int dirLength, result = TCL_OK;
+    Tcl_DString dirString, patternString;
+    DWORD attr, volFlags;
     HANDLE handle;
-    WIN32_FIND_DATA data;
+    WIN32_FIND_DATAT data;
     BOOL found;
+    Tcl_DString ds;
+    TCHAR *nativeName;
+    Tcl_Obj *resultPtr;
 
     /*
      * Convert the path to normalized form since some interfaces only
@@ -123,31 +139,37 @@ TclMatchFiles(interp, separators, dirPtr, pattern, tail)
      * separator character.
      */
 
-    Tcl_DStringInit(&buffer);
-    if (baseLength == 0) {
-       Tcl_DStringAppend(&buffer, ".", 1);
+    dirLength = Tcl_DStringLength(dirPtr);
+    Tcl_DStringInit(&dirString);
+    if (dirLength == 0) {
+       Tcl_DStringAppend(&dirString, ".\\", 2);
     } else {
-       Tcl_DStringAppend(&buffer, Tcl_DStringValue(dirPtr),
+       char *p;
+
+       Tcl_DStringAppend(&dirString, Tcl_DStringValue(dirPtr),
                Tcl_DStringLength(dirPtr));
-    }
-    for (p = Tcl_DStringValue(&buffer); *p != '\0'; p++) {
-       if (*p == '/') {
-           *p = '\\';
+       for (p = Tcl_DStringValue(&dirString); *p != '\0'; p++) {
+           if (*p == '/') {
+               *p = '\\';
+           }
+       }
+       p--;
+       if ((*p != '\\') && (*p != ':')) {
+           Tcl_DStringAppend(&dirString, "\\", 1);
        }
     }
-    p--;
-    if (*p != '\\' && *p != ':') {
-       Tcl_DStringAppend(&buffer, "\\", 1);
-    }
-    dir = Tcl_DStringValue(&buffer);
-    
+    dir = Tcl_DStringValue(&dirString);
+
     /*
      * First verify that the specified path is actually a directory.
      */
 
-    atts = GetFileAttributes(dir);
-    if ((atts == 0xFFFFFFFF) || ((atts & FILE_ATTRIBUTE_DIRECTORY) == 0)) {
-       Tcl_DStringFree(&buffer);
+    nativeName = Tcl_WinUtfToTChar(dir, Tcl_DStringLength(&dirString), &ds);
+    attr = (*tclWinProcs->getFileAttributesProc)(nativeName);
+    Tcl_DStringFree(&ds);
+
+    if ((attr == 0xffffffff) || ((attr & FILE_ATTRIBUTE_DIRECTORY) == 0)) {
+       Tcl_DStringFree(&dirString);
        return TCL_OK;
     }
 
@@ -160,82 +182,67 @@ TclMatchFiles(interp, separators, dirPtr, pattern, tail)
 
     switch (Tcl_GetPathType(dir)) {
        case TCL_PATH_RELATIVE:
-           found = GetVolumeInformation(NULL, NULL, 0, NULL,
-                   NULL, &volFlags, NULL, 0);
+           found = GetVolumeInformationA(NULL, NULL, 0, NULL, NULL, 
+                   &volFlags, NULL, 0);
            break;
        case TCL_PATH_VOLUME_RELATIVE:
-           if (*dir == '\\') {
+           if (dir[0] == '\\') {
                root = NULL;
            } else {
-               root = drivePattern;
-               *root = *dir;
+               root = drivePat;
+               *root = dir[0];
            }
-           found = GetVolumeInformation(root, NULL, 0, NULL,
-                   NULL, &volFlags, NULL, 0);
+           found = GetVolumeInformationA(root, NULL, 0, NULL, NULL, 
+                   &volFlags, NULL, 0);
            break;
        case TCL_PATH_ABSOLUTE:
            if (dir[1] == ':') {
-               root = drivePattern;
-               *root = *dir;
-               found = GetVolumeInformation(root, NULL, 0, NULL,
-                       NULL, &volFlags, NULL, 0);
+               root = drivePat;
+               *root = dir[0];
+               found = GetVolumeInformationA(root, NULL, 0, NULL, NULL, 
+                       &volFlags, NULL, 0);
            } else if (dir[1] == '\\') {
-               p = strchr(dir+2, '\\');
-               p = strchr(p+1, '\\');
+               char *p;
+
+               p = strchr(dir + 2, '\\');
+               p = strchr(p + 1, '\\');
                p++;
-               c = *p;
-               *p = 0;
-               found = GetVolumeInformation(dir, NULL, 0, NULL,
-                       NULL, &volFlags, NULL, 0);
-               *p = c;
+               nativeName = Tcl_WinUtfToTChar(dir, p - dir, &ds);
+               found = (*tclWinProcs->getVolumeInformationProc)(nativeName, 
+                       NULL, 0, NULL, NULL, &volFlags, NULL, 0);
+               Tcl_DStringFree(&ds);
            }
            break;
     }
 
-    if (!found) {
-       Tcl_DStringFree(&buffer);
-       TclWinConvertError(GetLastError());
-       Tcl_ResetResult(interp);
-       Tcl_AppendResult(interp, "couldn't read volume information for \"",
-               dirPtr->string, "\": ", Tcl_PosixError(interp), (char *) NULL);
-       return TCL_ERROR;
+    if (found == 0) {
+       message = "couldn't read volume information for \"";
+       goto error;
     }
-    
+
     /*
      * In Windows, although some volumes may support case sensitivity, Windows
      * doesn't honor case.  So in globbing we need to ignore the case
      * of file names.
      */
 
-    length = tail - pattern;
-    newPattern = ckalloc(length+1);
-    for (src = pattern, dest = newPattern; src < tail; src++, dest++) {
-       *dest = (char) tolower(*src);
-    }
-    *dest = '\0';
-    
+    Tcl_DStringInit(&patternString);
+    newPattern = Tcl_DStringAppend(&patternString, pattern, tail - pattern);
+    Tcl_UtfToLower(newPattern);
+
     /*
      * We need to check all files in the directory, so append a *.*
      * to the path. 
      */
 
-
-    dir = Tcl_DStringAppend(&buffer, "*.*", 3);
-
-    /*
-     * Now open the directory for reading and iterate over the contents.
-     */
-
-    handle = FindFirstFile(dir, &data);
-    Tcl_DStringFree(&buffer);
+    dir = Tcl_DStringAppend(&dirString, "*.*", 3);
+    nativeName = Tcl_WinUtfToTChar(dir, -1, &ds);
+    handle = (*tclWinProcs->findFirstFileProc)(nativeName, &data);
+    Tcl_DStringFree(&ds);
 
     if (handle == INVALID_HANDLE_VALUE) {
-       TclWinConvertError(GetLastError());
-       Tcl_ResetResult(interp);
-       Tcl_AppendResult(interp, "couldn't read directory \"",
-               dirPtr->string, "\": ", Tcl_PosixError(interp), (char *) NULL);
-       ckfree(newPattern);
-       return TCL_ERROR;
+       message = "couldn't read directory \"";
+       goto error;
     }
 
     /*
@@ -267,42 +274,43 @@ TclMatchFiles(interp, separators, dirPtr, pattern, tail)
      * Now iterate over all of the files in the directory.
      */
 
-    Tcl_DStringInit(&buffer);
-    for (found = 1; found; found = FindNextFile(handle, &data)) {
-       char *matchResult;
+    resultPtr = Tcl_GetObjResult(interp);
+    for (found = 1; found != 0; 
+           found = (*tclWinProcs->findNextFileProc)(handle, &data)) {
+       TCHAR *nativeMatchResult;
+       char *name, *fname;
 
-       /*
-        * Ignore hidden files.
-        */
-
-       if (!matchDotFiles && (data.cFileName[0] == '.')) {
-           continue;
+       if (tclWinProcs->useWide) {
+           nativeName = (TCHAR *) data.w.cFileName;
+       } else {
+           nativeName = (TCHAR *) data.a.cFileName;
        }
+       name = Tcl_WinTCharToUtf(nativeName, -1, &ds);
 
        /*
         * Check to see if the file matches the pattern.  We need to convert
         * the file name to lower case for comparison purposes.  Note that we
         * are ignoring the case sensitivity flag because Windows doesn't honor
         * case even if the volume is case sensitive.  If the volume also
-        * doesn't preserve case, then we return the lower case form of the
-        * name, otherwise we return the system form.
+        * doesn't preserve case, then we previously returned the lower case
+        * form of the name.  This didn't seem quite right since there are
+        * non-case-preserving volumes that actually return mixed case.  So now
+        * we are returning exactly what we get from the system.
         */
 
-       matchResult = NULL;
-       Tcl_DStringSetLength(&buffer, 0);
-       Tcl_DStringAppend(&buffer, data.cFileName, -1);
-       for (p = buffer.string; *p != '\0'; p++) {
-           *p = (char) tolower(*p);
-       }
-       if (Tcl_StringMatch(buffer.string, newPattern)) {
-           if (volFlags & FS_CASE_IS_PRESERVED) {
-               matchResult = data.cFileName;
-           } else {
-               matchResult = buffer.string;
-           }   
+       Tcl_UtfToLower(name);
+       nativeMatchResult = NULL;
+
+       if ((matchDotFiles == 0) && (name[0] == '.')) {
+           /*
+            * Ignore hidden files.
+            */
+       } else if (Tcl_StringMatch(name, newPattern) != 0) {
+           nativeMatchResult = nativeName;
        }
+        Tcl_DStringFree(&ds);
 
-       if (matchResult == NULL) {
+       if (nativeMatchResult == NULL) {
            continue;
        }
 
@@ -313,141 +321,690 @@ TclMatchFiles(interp, separators, dirPtr, pattern, tail)
         * file to the result.
         */
 
-       Tcl_DStringSetLength(dirPtr, baseLength);
-       Tcl_DStringAppend(dirPtr, matchResult, -1);
+       name = Tcl_WinTCharToUtf(nativeMatchResult, -1, &ds);
+       Tcl_DStringAppend(dirPtr, name, -1);
+       Tcl_DStringFree(&ds);
+
+       fname = Tcl_DStringValue(dirPtr);
+       nativeName = Tcl_WinUtfToTChar(fname, Tcl_DStringLength(dirPtr), &ds);
+       attr = (*tclWinProcs->getFileAttributesProc)(nativeName);
+       Tcl_DStringFree(&ds);
+
        if (tail == NULL) {
-           Tcl_AppendElement(interp, dirPtr->string);
-       } else {
-           atts = GetFileAttributes(dirPtr->string);
-           if (atts & FILE_ATTRIBUTE_DIRECTORY) {
-               Tcl_DStringAppend(dirPtr, "/", 1);
-               result = TclDoGlob(interp, separators, dirPtr, tail);
-               if (result != TCL_OK) {
-                   break;
+           int typeOk = 1;
+           if (types != NULL) {
+               if (types->perm != 0) {
+                   if (
+                       ((types->perm & TCL_GLOB_PERM_RONLY) &&
+                               !(attr & FILE_ATTRIBUTE_READONLY)) ||
+                       ((types->perm & TCL_GLOB_PERM_HIDDEN) &&
+                               !(attr & FILE_ATTRIBUTE_HIDDEN)) ||
+                       ((types->perm & TCL_GLOB_PERM_R) &&
+                               (TclpAccess(fname, R_OK) != 0)) ||
+                       ((types->perm & TCL_GLOB_PERM_W) &&
+                               (TclpAccess(fname, W_OK) != 0)) ||
+                       ((types->perm & TCL_GLOB_PERM_X) &&
+                               (TclpAccess(fname, X_OK) != 0))
+                       ) {
+                       typeOk = 0;
+                   }
                }
+               if (typeOk && types->type != 0) {
+                   struct stat buf;
+                   /*
+                    * We must match at least one flag to be listed
+                    */
+                   typeOk = 0;
+                   if (TclpLstat(fname, &buf) >= 0) {
+                       /*
+                        * In order bcdpfls as in 'find -t'
+                        */
+                       if (
+                           ((types->type & TCL_GLOB_TYPE_BLOCK) &&
+                                   S_ISBLK(buf.st_mode)) ||
+                           ((types->type & TCL_GLOB_TYPE_CHAR) &&
+                                   S_ISCHR(buf.st_mode)) ||
+                           ((types->type & TCL_GLOB_TYPE_DIR) &&
+                                   S_ISDIR(buf.st_mode)) ||
+                           ((types->type & TCL_GLOB_TYPE_PIPE) &&
+                                   S_ISFIFO(buf.st_mode)) ||
+                           ((types->type & TCL_GLOB_TYPE_FILE) &&
+                                   S_ISREG(buf.st_mode))
+#ifdef S_ISLNK
+                           || ((types->type & TCL_GLOB_TYPE_LINK) &&
+                                   S_ISLNK(buf.st_mode))
+#endif
+#ifdef S_ISSOCK
+                           || ((types->type & TCL_GLOB_TYPE_SOCK) &&
+                                   S_ISSOCK(buf.st_mode))
+#endif
+                           ) {
+                           typeOk = 1;
+                       }
+                   } else {
+                       /* Posix error occurred */
+                   }
+               }               
+           } 
+           if (typeOk) {
+               Tcl_ListObjAppendElement(interp, resultPtr, 
+                       Tcl_NewStringObj(fname, Tcl_DStringLength(dirPtr)));
+           }
+       } else if (attr & FILE_ATTRIBUTE_DIRECTORY) {
+           Tcl_DStringAppend(dirPtr, "/", 1);
+           result = TclDoGlob(interp, separators, dirPtr, tail, types);
+           if (result != TCL_OK) {
+               break;
            }
        }
+       Tcl_DStringSetLength(dirPtr, dirLength);
     }
 
-    Tcl_DStringFree(&buffer);
     FindClose(handle);
-    ckfree(newPattern);
+    Tcl_DStringFree(&dirString);
+    Tcl_DStringFree(&patternString);
+
     return result;
+
+    error:
+    Tcl_DStringFree(&dirString);
+    TclWinConvertError(GetLastError());
+    Tcl_ResetResult(interp);
+    Tcl_AppendResult(interp, message, Tcl_DStringValue(dirPtr), "\": ", 
+           Tcl_PosixError(interp), (char *) NULL);
+    return TCL_ERROR;
+}
+\f
+/* 
+ * TclpMatchFiles --
+ * 
+ * This function is now obsolete.  Call the above function 
+ * 'TclpMatchFilesTypes' instead.
+ */
+int
+TclpMatchFiles(
+    Tcl_Interp *interp,                /* Interpreter to receive results. */
+    char *separators,          /* Directory separators to pass to TclDoGlob. */
+    Tcl_DString *dirPtr,       /* Contains path to directory to search. */
+    char *pattern,             /* Pattern to match against. */
+    char *tail)                        /* Pointer to end of pattern.  Tail must
+                                * point to a location in pattern and must
+                                * not be static.*/
+{
+    return TclpMatchFilesTypes(interp,separators,dirPtr,pattern,tail,NULL);
 }
 \f
 /*
  *----------------------------------------------------------------------
  *
- * TclChdir --
+ * TclpGetUserHome --
  *
- *     Change the current working directory.
+ *     This function takes the passed in user name and finds the
+ *     corresponding home directory specified in the password file.
  *
  * Results:
- *     The result is a standard Tcl result.  If an error occurs and 
- *     interp isn't NULL, an error message is left in interp->result.
+ *     The result is a pointer to a string specifying the user's home
+ *     directory, or NULL if the user's home directory could not be
+ *     determined.  Storage for the result string is allocated in
+ *     bufferPtr; the caller must call Tcl_DStringFree() when the result
+ *     is no longer needed.
  *
  * Side effects:
- *     The working directory for this application is changed.  Also
- *     the cache maintained used by TclGetCwd is deallocated and
- *     set to NULL.
+ *     None.
  *
  *----------------------------------------------------------------------
  */
 
+char *
+TclpGetUserHome(name, bufferPtr)
+    CONST char *name;          /* User name for desired home directory. */
+    Tcl_DString *bufferPtr;    /* Uninitialized or free DString filled
+                                * with name of user's home directory. */
+{
+    char *result;
+    HINSTANCE netapiInst;
+
+    result = NULL;
+
+    Tcl_DStringInit(bufferPtr);
+
+    netapiInst = LoadLibraryA("netapi32.dll");
+    if (netapiInst != NULL) {
+       NETAPIBUFFERFREEPROC *netApiBufferFreeProc;
+       NETGETDCNAMEPROC *netGetDCNameProc;
+       NETUSERGETINFOPROC *netUserGetInfoProc;
+
+       netApiBufferFreeProc = (NETAPIBUFFERFREEPROC *)
+               GetProcAddress(netapiInst, "NetApiBufferFree");
+       netGetDCNameProc = (NETGETDCNAMEPROC *) 
+               GetProcAddress(netapiInst, "NetGetDCName");
+       netUserGetInfoProc = (NETUSERGETINFOPROC *) 
+               GetProcAddress(netapiInst, "NetUserGetInfo");
+       if ((netUserGetInfoProc != NULL) && (netGetDCNameProc != NULL)
+               && (netApiBufferFreeProc != NULL)) {
+           USER_INFO_1 *uiPtr;
+           Tcl_DString ds;
+           int nameLen, badDomain;
+           char *domain;
+           WCHAR *wName, *wHomeDir, *wDomain;
+           WCHAR buf[MAX_PATH];
+
+           badDomain = 0;
+           nameLen = -1;
+           wDomain = NULL;
+           domain = strchr(name, '@');
+           if (domain != NULL) {
+               Tcl_DStringInit(&ds);
+               wName = Tcl_UtfToUniCharDString(domain + 1, -1, &ds);
+               badDomain = (*netGetDCNameProc)(NULL, wName,
+                       (LPBYTE *) &wDomain);
+               Tcl_DStringFree(&ds);
+               nameLen = domain - name;
+           }
+           if (badDomain == 0) {
+               Tcl_DStringInit(&ds);
+               wName = Tcl_UtfToUniCharDString(name, nameLen, &ds);
+               if ((*netUserGetInfoProc)(wDomain, wName, 1, 
+                       (LPBYTE *) &uiPtr) == 0) {
+                   wHomeDir = uiPtr->usri1_home_dir;
+                   if ((wHomeDir != NULL) && (wHomeDir[0] != L'\0')) {
+                       Tcl_UniCharToUtfDString(wHomeDir, lstrlenW(wHomeDir),
+                               bufferPtr);
+                   } else {
+                       /* 
+                        * User exists but has no home dir.  Return
+                        * "{Windows Drive}:/users/default".
+                        */
+
+                       GetWindowsDirectoryW(buf, MAX_PATH);
+                       Tcl_UniCharToUtfDString(buf, 2, bufferPtr);
+                       Tcl_DStringAppend(bufferPtr, "/users/default", -1);
+                   }
+                   result = Tcl_DStringValue(bufferPtr);
+                   (*netApiBufferFreeProc)((void *) uiPtr);
+               }
+               Tcl_DStringFree(&ds);
+           }
+           if (wDomain != NULL) {
+               (*netApiBufferFreeProc)((void *) wDomain);
+           }
+       }
+       FreeLibrary(netapiInst);
+    }
+    if (result == NULL) {
+       /*
+        * Look in the "Password Lists" section of system.ini for the 
+        * local user.  There are also entries in that section that begin 
+        * with a "*" character that are used by Windows for other 
+        * purposes; ignore user names beginning with a "*".
+        */
+
+       char buf[MAX_PATH];
+
+       if (name[0] != '*') {
+           if (GetPrivateProfileStringA("Password Lists", name, "", buf, 
+                   MAX_PATH, "system.ini") > 0) {
+               /* 
+                * User exists, but there is no such thing as a home 
+                * directory in system.ini.  Return "{Windows drive}:/".
+                */
+
+               GetWindowsDirectoryA(buf, MAX_PATH);
+               Tcl_DStringAppend(bufferPtr, buf, 3);
+               result = Tcl_DStringValue(bufferPtr);
+           }
+       }
+    }
+
+    return result;
+}
+\f
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TclpAccess --
+ *
+ *     This function replaces the library version of access(), fixing the
+ *     following bugs:
+ * 
+ *     1. access() returns that all files have execute permission.
+ *
+ * Results:
+ *     See access documentation.
+ *
+ * Side effects:
+ *     See access documentation.
+ *
+ *---------------------------------------------------------------------------
+ */
+
 int
-TclChdir(interp, dirName)
-    Tcl_Interp *interp;                /* If non NULL, used for error reporting. */
-    char *dirName;                     /* Path to new working directory. */
+TclpAccess(
+    CONST char *path,          /* Path of file to access (UTF-8). */
+    int mode)                  /* Permission setting. */
 {
-    if (currentDir != NULL) {
-       ckfree(currentDir);
-       currentDir = NULL;
+    Tcl_DString ds;
+    TCHAR *nativePath;
+    DWORD attr;
+
+    nativePath = Tcl_WinUtfToTChar(path, -1, &ds);
+    attr = (*tclWinProcs->getFileAttributesProc)(nativePath);
+    Tcl_DStringFree(&ds);
+
+    if (attr == 0xffffffff) {
+       /*
+        * File doesn't exist. 
+        */
+
+       TclWinConvertError(GetLastError());
+       return -1;
+    }
+
+    if ((mode & W_OK) && (attr & FILE_ATTRIBUTE_READONLY)) {
+       /*
+        * File is not writable.
+        */
+
+       Tcl_SetErrno(EACCES);
+       return -1;
     }
-    /* CYGNUS LOCAL: On cygwin, we must use chdir.  Otherwise, the
-       cygwin notion of the current directory will get messed up.  */
+
+    if (mode & X_OK) {
+        CONST char *p;
+
+       if (attr & FILE_ATTRIBUTE_DIRECTORY) {
+           /*
+            * Directories are always executable. 
+            */
+           
+           return 0;
+       }
+       p = strrchr(path, '.');
+       if (p != NULL) {
+           p++;
+           if ((stricmp(p, "exe") == 0)
+                   || (stricmp(p, "com") == 0)
+                   || (stricmp(p, "bat") == 0)) {
+               /*
+                * File that ends with .exe, .com, or .bat is executable.
+                */
+
+               return 0;
+           }
+       }
+       Tcl_SetErrno(EACCES);
+       return -1;
+    }
+
+    return 0;
+}
+\f
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclpChdir --
+ *
+ *     This function replaces the library version of chdir().
+ *
+ * Results:
+ *     See chdir() documentation.
+ *
+ * Side effects:
+ *     See chdir() documentation.  
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TclpChdir(path)
+    CONST char *path;          /* Path to new working directory (UTF-8). */
+{
+    int result;
+    Tcl_DString ds;
+    TCHAR *nativePath;
+
+    nativePath = Tcl_WinUtfToTChar(path, -1, &ds);
+    result = (*tclWinProcs->setCurrentDirectoryProc)(nativePath);
+    Tcl_DStringFree(&ds);
+
 #ifdef __CYGWIN__
-    if (chdir(dirName) < 0) {
-#else
-    if (!SetCurrentDirectory(dirName)) {
-       TclWinConvertError(GetLastError());
+    /* We use chdir on Cygwin which follows POSIX return code. */
+    result = !result;
 #endif
+
+    if (result == 0) {
+       TclWinConvertError(GetLastError());
+       return -1;
+    }
+    return 0;
+}
+\f
+#ifdef __CYGWIN__
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TclpReadlink --
+ *
+ *     This function replaces the library version of readlink().
+ *
+ * Results:
+ *     The result is a pointer to a string specifying the contents
+ *     of the symbolic link given by 'path', or NULL if the symbolic
+ *     link could not be read.  Storage for the result string is
+ *     allocated in bufferPtr; the caller must call Tcl_DStringFree()
+ *     when the result is no longer needed.
+ *
+ * Side effects:
+ *     See readlink() documentation.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+char *
+TclpReadlink(path, linkPtr)
+    CONST char *path;          /* Path of file to readlink (UTF-8). */
+    Tcl_DString *linkPtr;      /* Uninitialized or free DString filled
+                                * with contents of link (UTF-8). */
+{
+    char link[MAXPATHLEN];
+    int length;
+    char *native;
+    Tcl_DString ds;
+
+    native = Tcl_UtfToExternalDString(NULL, path, -1, &ds);
+    length = readlink(native, link, sizeof(link));     /* INTL: Native. */
+    Tcl_DStringFree(&ds);
+    
+    if (length < 0) {
+       return NULL;
+    }
+
+    Tcl_ExternalToUtfDString(NULL, link, length, linkPtr);
+    return Tcl_DStringValue(linkPtr);
+}
+#endif /* __CYGWIN__ */
+\f
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclpGetCwd --
+ *
+ *     This function replaces the library version of getcwd().
+ *
+ * Results:
+ *     The result is a pointer to a string specifying the current
+ *     directory, or NULL if the current directory could not be
+ *     determined.  If NULL is returned, an error message is left in the
+ *     interp's result.  Storage for the result string is allocated in
+ *     bufferPtr; the caller must call Tcl_DStringFree() when the result
+ *     is no longer needed.
+ *
+ * Side effects:
+ *     None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+char *
+TclpGetCwd(interp, bufferPtr)
+    Tcl_Interp *interp;                /* If non-NULL, used for error reporting. */
+    Tcl_DString *bufferPtr;    /* Uninitialized or free DString filled
+                                * with name of current directory. */
+{
+    WCHAR buffer[MAX_PATH];
+    char *p;
+
+    if ((*tclWinProcs->getCurrentDirectoryProc)(MAX_PATH, buffer) == 0) {
+       TclWinConvertError(GetLastError());
        if (interp != NULL) {
-           Tcl_AppendResult(interp, "couldn't change working directory to \"",
-                   dirName, "\": ", Tcl_PosixError(interp), (char *) NULL);
+           Tcl_AppendResult(interp,
+                   "error getting working directory name: ",
+                   Tcl_PosixError(interp), (char *) NULL);
+       }
+       return NULL;
+    }
+
+    /*
+     * Watch for the wierd Windows c:\\UNC syntax.
+     */
+
+    if (tclWinProcs->useWide) {
+       WCHAR *native;
+
+       native = (WCHAR *) buffer;
+       if ((native[0] != '\0') && (native[1] == ':') 
+               && (native[2] == '\\') && (native[3] == '\\')) {
+           native += 2;
+       }
+       Tcl_WinTCharToUtf((TCHAR *) native, -1, bufferPtr);
+    } else {
+       char *native;
+
+       native = (char *) buffer;
+       if ((native[0] != '\0') && (native[1] == ':') 
+               && (native[2] == '\\') && (native[3] == '\\')) {
+           native += 2;
+       }
+       Tcl_WinTCharToUtf((TCHAR *) native, -1, bufferPtr);
+    }
+
+    /*
+     * Convert to forward slashes for easier use in scripts.
+     */
+             
+    for (p = Tcl_DStringValue(bufferPtr); *p != '\0'; p++) {
+       if (*p == '\\') {
+           *p = '/';
        }
-       return TCL_ERROR;
     }
-    return TCL_OK;
+    return Tcl_DStringValue(bufferPtr);
 }
 \f
 /*
  *----------------------------------------------------------------------
  *
- * TclGetCwd --
+ * TclpStat --
  *
- *     Return the path name of the current working directory.
+ *     This function replaces the library version of stat(), fixing 
+ *     the following bugs:
+ *
+ *     1. stat("c:") returns an error.
+ *     2. Borland stat() return time in GMT instead of localtime.
+ *     3. stat("\\server\mount") would return error.
+ *     4. Accepts slashes or backslashes.
+ *     5. st_dev and st_rdev were wrong for UNC paths.
  *
  * Results:
- *     The result is the full path name of the current working
- *     directory, or NULL if an error occurred while figuring it
- *     out.  If an error occurs and interp isn't NULL, an error
- *     message is left in interp->result.
+ *     See stat documentation.
  *
  * Side effects:
- *     The path name is cached to avoid having to recompute it
- *     on future calls;  if it is already cached, the cached
- *     value is returned.
+ *     See stat documentation.
  *
  *----------------------------------------------------------------------
  */
 
-char *
-TclGetCwd(interp)
-    Tcl_Interp *interp;                /* If non NULL, used for error reporting. */
+int
+TclpStat(path, statPtr)
+    CONST char *path;          /* Path of file to stat (UTF-8). */
+    struct stat *statPtr;      /* Filled with results of stat call. */
 {
-    static char buffer[MAXPATHLEN+1];
-    char *bufPtr, *p;
-
-    if (currentDir == NULL) {
-       if (GetCurrentDirectory(MAXPATHLEN+1, buffer) == 0) {
-           TclWinConvertError(GetLastError());
-           if (interp != NULL) {
-               if (errno == ERANGE) {
-                   Tcl_SetResult(interp,
-                           "working directory name is too long",
-                           TCL_STATIC);
-               } else {
-                   Tcl_AppendResult(interp,
-                           "error getting working directory name: ",
-                           Tcl_PosixError(interp), (char *) NULL);
-               }
-           }
-           return NULL;
+    Tcl_DString ds;
+    TCHAR *nativePath;
+    WIN32_FIND_DATAT data;
+    HANDLE handle;
+    DWORD attr;
+    WCHAR nativeFullPath[MAX_PATH];
+    TCHAR *nativePart;
+    char *p, *fullPath;
+    int dev, mode;
+
+    /*
+     * Eliminate file names containing wildcard characters, or subsequent 
+     * call to FindFirstFile() will expand them, matching some other file.
+     */
+
+    if (strpbrk(path, "?*") != NULL) {
+       Tcl_SetErrno(ENOENT);
+       return -1;
+    }
+
+    nativePath = Tcl_WinUtfToTChar(path, -1, &ds);
+    handle = (*tclWinProcs->findFirstFileProc)(nativePath, &data);
+    if (handle == INVALID_HANDLE_VALUE) {
+       /* 
+        * FindFirstFile() doesn't work on root directories, so call
+        * GetFileAttributes() to see if the specified file exists.
+        */
+
+       attr = (*tclWinProcs->getFileAttributesProc)(nativePath);
+       if (attr == 0xffffffff) {
+           Tcl_DStringFree(&ds);
+           Tcl_SetErrno(ENOENT);
+           return -1;
        }
-       /*
-        * Watch for the wierd Windows '95 c:\\UNC syntax.
+
+       /* 
+        * Make up some fake information for this file.  It has the 
+        * correct file attributes and a time of 0.
         */
 
-       if (buffer[0] != '\0' && buffer[1] == ':' && buffer[2] == '\\'
-               && buffer[3] == '\\') {
-           bufPtr = &buffer[2];
+       memset(&data, 0, sizeof(data));
+       data.a.dwFileAttributes = attr;
+    } else {
+       FindClose(handle);
+    }
+
+    (*tclWinProcs->getFullPathNameProc)(nativePath, MAX_PATH, nativeFullPath,
+           &nativePart);
+
+    Tcl_DStringFree(&ds);
+    fullPath = Tcl_WinTCharToUtf((TCHAR *) nativeFullPath, -1, &ds);
+
+    dev = -1;
+    if ((fullPath[0] == '\\') && (fullPath[1] == '\\')) {
+       char *p;
+       DWORD dw;
+       TCHAR *nativeVol;
+       Tcl_DString volString;
+
+       p = strchr(fullPath + 2, '\\');
+       p = strchr(p + 1, '\\');
+       if (p == NULL) {
+           /*
+            * Add terminating backslash to fullpath or 
+            * GetVolumeInformation() won't work.
+            */
+
+           fullPath = Tcl_DStringAppend(&ds, "\\", 1);
+           p = fullPath + Tcl_DStringLength(&ds);
        } else {
-           bufPtr = buffer;
+           p++;
        }
-
+       nativeVol = Tcl_WinUtfToTChar(fullPath, p - fullPath, &volString);
+       dw = (DWORD) -1;
+       (*tclWinProcs->getVolumeInformationProc)(nativeVol, NULL, 0, &dw,
+               NULL, NULL, NULL, 0);
        /*
-        * Convert to forward slashes for easier use in scripts.
+        * GetFullPathName() turns special devices like "NUL" into "\\.\NUL", 
+        * but GetVolumeInformation() returns failure for "\\.\NUL".  This 
+        * will cause "NUL" to get a drive number of -1, which makes about 
+        * as much sense as anything since the special devices don't live on 
+        * any drive.
         */
 
-       for (p = bufPtr; *p != '\0'; p++) {
-           if (*p == '\\') {
-               *p = '/';
-           }
+       dev = dw;
+       Tcl_DStringFree(&volString);
+    } else if ((fullPath[0] != '\0') && (fullPath[1] == ':')) {
+       dev = Tcl_UniCharToLower(fullPath[0]) - 'a';
+    }
+    Tcl_DStringFree(&ds);
+
+    attr = data.a.dwFileAttributes;
+    mode  = (attr & FILE_ATTRIBUTE_DIRECTORY) ? S_IFDIR | S_IEXEC : S_IFREG;
+    mode |= (attr & FILE_ATTRIBUTE_READONLY) ? S_IREAD : S_IREAD | S_IWRITE;
+    p = strrchr(path, '.');
+    if (p != NULL) {
+       if ((lstrcmpiA(p, ".exe") == 0) 
+               || (lstrcmpiA(p, ".com") == 0) 
+               || (lstrcmpiA(p, ".bat") == 0)
+               || (lstrcmpiA(p, ".pif") == 0)) {
+           mode |= S_IEXEC;
        }
     }
-    return bufPtr;
+
+    /*
+     * Propagate the S_IREAD, S_IWRITE, S_IEXEC bits to the group and 
+     * other positions.
+     */
+
+    mode |= (mode & 0x0700) >> 3;
+    mode |= (mode & 0x0700) >> 6;
+    
+    statPtr->st_dev    = (dev_t) dev;
+    statPtr->st_ino    = 0;
+    statPtr->st_mode   = (unsigned short) mode;
+    statPtr->st_nlink  = 1;
+    statPtr->st_uid    = 0;
+    statPtr->st_gid    = 0;
+    statPtr->st_rdev   = (dev_t) dev;
+    statPtr->st_size   = data.a.nFileSizeLow;
+    statPtr->st_atime  = ToCTime(data.a.ftLastAccessTime);
+    statPtr->st_mtime  = ToCTime(data.a.ftLastWriteTime);
+    statPtr->st_ctime  = ToCTime(data.a.ftCreationTime);
+    return 0;
 }
-\f
+
+static time_t
+ToCTime(
+    FILETIME fileTime)         /* UTC Time to convert to local time_t. */
+{
+    FILETIME localFileTime;
+    SYSTEMTIME systemTime;
+    struct tm tm;
+
+    if (FileTimeToLocalFileTime(&fileTime, &localFileTime) == 0) {
+       return 0;
+    }
+    if (FileTimeToSystemTime(&localFileTime, &systemTime) == 0) {
+       return 0;
+    }
+    tm.tm_sec = systemTime.wSecond;
+    tm.tm_min = systemTime.wMinute;
+    tm.tm_hour = systemTime.wHour;
+    tm.tm_mday = systemTime.wDay;
+    tm.tm_mon = systemTime.wMonth - 1;
+    tm.tm_year = systemTime.wYear - 1900;
+    tm.tm_wday = 0;
+    tm.tm_yday = 0;
+    tm.tm_isdst = -1;
+
+    return mktime(&tm);
+}
+
+#if 0
+
+    /*
+     * Borland's stat doesn't take into account localtime.
+     */
+
+    if ((result == 0) && (buf->st_mtime != 0)) {
+       TIME_ZONE_INFORMATION tz;
+       int time, bias;
+
+       time = GetTimeZoneInformation(&tz);
+       bias = tz.Bias;
+       if (time == TIME_ZONE_ID_DAYLIGHT) {
+           bias += tz.DaylightBias;
+       }
+       bias *= 60;
+       buf->st_atime -= bias;
+       buf->st_ctime -= bias;
+       buf->st_mtime -= bias;
+    }
+
+#endif
+
+
 #if 0
 /*
  *-------------------------------------------------------------------------
@@ -526,130 +1083,5 @@ TclWinResolveShortcut(bufferPtr)
     return 0;
 }
 #endif
-\f
-/*
- *----------------------------------------------------------------------
- *
- * TclpStat, TclpLstat --
- *
- *     These functions replace the library versions of stat and lstat.
- *
- *     The stat and lstat functions provided by some Windows compilers 
- *     are incomplete.  Ideally, a complete rewrite of stat would go
- *     here; now, the only fix is that stat("c:") used to return an
- *     error instead infor for current dir on specified drive.
- *
- * Results:
- *     See stat documentation.
- *
- * Side effects:
- *     See stat documentation.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TclpStat(path, buf)
-    CONST char *path;          /* Path of file to stat (in current CP). */
-    struct stat *buf;          /* Filled with results of stat call. */
-{
-    char name[4];
-    int result;
-
-    if ((strlen(path) == 2) && (path[1] == ':')) {
-       strcpy(name, path);
-       name[2] = '.';
-       name[3] = '\0';
-       path = name;
-    }
-
-#undef stat
-
-    result = stat(path, buf);
-
-#if ! defined (_MSC_VER) && ! defined (__CYGWIN__)
-
-    /*
-     * Borland's stat doesn't take into account localtime.
-     */
-
-    if ((result == 0) && (buf->st_mtime != 0)) {
-       TIME_ZONE_INFORMATION tz;
-       int time, bias;
-
-       time = GetTimeZoneInformation(&tz);
-       bias = tz.Bias;
-       if (time == TIME_ZONE_ID_DAYLIGHT) {
-           bias += tz.DaylightBias;
-       }
-       bias *= 60;
-       buf->st_atime -= bias;
-       buf->st_ctime -= bias;
-       buf->st_mtime -= bias;
-    }
-
-#endif
 
-    return result;
-}
-\f
-/*
- *---------------------------------------------------------------------------
- *
- * TclpAccess --
- *
- *     This function replaces the library version of access.
- *
- *     The library version of access returns that all files have execute
- *     permission.
- *
- * Results:
- *     See access documentation.
- *
- * Side effects:
- *     See access documentation.
- *
- *---------------------------------------------------------------------------
- */
-
-int
-TclpAccess(
-    CONST char *path,          /* Path of file to access (in current CP). */
-    int mode)                  /* Permission setting. */
-{
-    int result;
-    CONST char *p;
-
-#undef access
-
-    result = access(path, mode);
-
-    if (result == 0) {
-       if (mode & 1) {
-           if (GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY) {
-               /*
-                * Directories are always executable. 
-                */
-
-               return 0;
-           }
-           p = strrchr(path, '.');
-           if (p != NULL) {
-               p++;
-               if ((stricmp(p, "exe") == 0)
-                       || (stricmp(p, "com") == 0)
-                       || (stricmp(p, "bat") == 0)) {
-                   /*
-                    * File that ends with .exe, .com, or .bat is executable.
-                    */
-
-                   return 0;
-               }
-           }
-           errno = EACCES;
-           return -1;
-       }
-    }
-    return result;
-}
 
index 1660599..8d7288c 100644 (file)
@@ -19,6 +19,7 @@
 #include <dos.h>
 #endif
 /* END CYGNUS LOCAL */
+
 #include <fcntl.h>
 #include <io.h>
 #include <sys/stat.h>
 static int initialized = 0;
 
 /*
+ * The pipeMutex locks around access to the initialized and procList variables,
+ * and it is used to protect background threads from being terminated while
+ * they are using APIs that hold locks.
+ */
+
+TCL_DECLARE_MUTEX(pipeMutex)
+
+/*
  * The following defines identify the various types of applications that 
  * run under windows.  There is special case code for the various types.
  */
@@ -43,10 +52,9 @@ static int initialized = 0;
 /*
  * The following constants and structures are used to encapsulate the state
  * of various types of files used in a pipeline.
+ * This used to have a 1 && 2 that supported Win32s.
  */
 
-#define WIN32S_PIPE 1          /* Win32s emulated pipe. */
-#define WIN32S_TMPFILE 2       /* Win32s emulated temporary file. */
 #define WIN_FILE 3             /* Basic Win32 file. */
 
 /*
@@ -60,36 +68,6 @@ typedef struct WinFile {
 } WinFile;
 
 /*
- * The following structure is used to keep track of temporary files under
- * Win32s and delete the disk file when the open handle is closed.
- * The type field will be WIN32S_TMPFILE.
- */
-
-typedef struct TmpFile {
-    WinFile file;              /* Common part. */
-    char name[MAX_PATH];       /* Name of temp file. */
-} TmpFile;
-
-/*
- * The following structure represents a synchronous pipe under Win32s.
- * The type field will be WIN32S_PIPE.  The handle field will refer to
- * an open file when Tcl is reading from the "pipe", otherwise it is
- * INVALID_HANDLE_VALUE.
- */
-
-typedef struct WinPipe {
-    WinFile file;              /* Common part. */
-    struct WinPipe *otherPtr;  /* Pointer to the WinPipe structure that
-                                * corresponds to the other end of this 
-                                * pipe. */
-    char *fileName;            /* The name of the staging file that gets 
-                                * the data written to this pipe.  Malloc'd.
-                                * and shared by both ends of the pipe.  Only
-                                * when both ends are freed will fileName be
-                                * freed and the file it refers to deleted. */
-} WinPipe;
-
-/*
  * This list is used to map from pids to process handles.
  */
 
@@ -102,21 +80,25 @@ typedef struct ProcInfo {
 static ProcInfo *procList;
 
 /*
- * State flags used in the PipeInfo structure below.
+ * Bit masks used in the flags field of the PipeInfo structure below.
  */
 
 #define PIPE_PENDING   (1<<0)  /* Message is pending in the queue. */
 #define PIPE_ASYNC     (1<<1)  /* Channel is non-blocking. */
-#define PIPE_READABLE  (1<<2)  /* Pipe is readable. */
-#define PIPE_CLOSED    (1<<3)  /* Pipe is being closed. */
-#define PIPE_HAS_THREAD        (1<<4)  /* Pipe has an associated thread. */
-#define PIPE_READAHEAD (1<<5)  /* Readahead byte is valid. */
+
+/*
+ * Bit masks used in the sharedFlags field of the PipeInfo structure below.
+ */
+
+#define PIPE_EOF       (1<<2)  /* Pipe has reached EOF. */
+#define PIPE_EXTRABYTE (1<<3)  /* The reader thread has consumed one byte. */
 
 /*
  * This structure describes per-instance data for a pipe based channel.
  */
 
 typedef struct PipeInfo {
+    struct PipeInfo *nextPtr;  /* Pointer to next registered pipe. */
     Tcl_Channel channel;       /* Pointer to channel structure. */
     int validMask;             /* OR'ed combination of TCL_READABLE,
                                 * TCL_WRITABLE, or TCL_EXCEPTION: indicates
@@ -130,20 +112,56 @@ typedef struct PipeInfo {
     TclFile errorFile;         /* Error output from pipe. */
     int numPids;               /* Number of processes attached to pipe. */
     Tcl_Pid *pidPtr;           /* Pids of attached processes. */
-    struct PipeInfo *nextPtr;  /* Pointer to next registered pipe. */
-    /* CYGNUS LOCAL: Several new fields.  */
-    HANDLE flagsMutex;         /* Mutex to control access to flags. */
-    HANDLE mutex;              /* Mutex for read fields.  */
-    HANDLE tryReadEvent;       /* Event to tell thread to try a read.  */
-    char readAhead;            /* Read ahead byte.  */
+    Tcl_ThreadId threadId;     /* Thread to which events should be reported.
+                                * This value is used by the reader/writer
+                                * threads. */
+    HANDLE writeThread;                /* Handle to writer thread. */
+    HANDLE readThread;         /* Handle to reader thread. */
+    HANDLE writable;           /* Manual-reset event to signal when the
+                                * writer thread has finished waiting for
+                                * the current buffer to be written. */
+    HANDLE readable;           /* Manual-reset event to signal when the
+                                * reader thread has finished waiting for
+                                * input. */
+    HANDLE startWriter;                /* Auto-reset event used by the main thread to
+                                * signal when the writer thread should attempt
+                                * to write to the pipe. */
+    HANDLE startReader;                /* Auto-reset event used by the main thread to
+                                * signal when the reader thread should attempt
+                                * to read from the pipe. */
+    DWORD writeError;          /* An error caused by the last background
+                                * write.  Set to 0 if no error has been
+                                * detected.  This word is shared with the
+                                * writer thread so access must be
+                                * synchronized with the writable object.
+                                */
+    char *writeBuf;            /* Current background output buffer.
+                                * Access is synchronized with the writable
+                                * object. */
+    int writeBufLen;           /* Size of write buffer.  Access is
+                                * synchronized with the writable
+                                * object. */
+    int toWrite;               /* Current amount to be written.  Access is
+                                * synchronized with the writable object. */
+    int readFlags;             /* Flags that are shared with the reader
+                                * thread.  Access is synchronized with the
+                                * readable object.  */
+    char extraByte;            /* Buffer for extra character consumed by
+                                * reader thread.  This byte is shared with
+                                * the reader thread so access must be
+                                * synchronized with the readable object. */
 } PipeInfo;
 
-/*
- * The following pointer refers to the head of the list of pipes
- * that are being watched for file events.
- */
+typedef struct ThreadSpecificData {
+    /*
+     * The following pointer refers to the head of the list of pipes
+     * that are being watched for file events.
+     */
+    
+    PipeInfo *firstPipePtr;
+} ThreadSpecificData;
 
-static PipeInfo *firstPipePtr;
+static Tcl_ThreadDataKey dataKey;
 
 /*
  * The following structure is what is added to the Tcl event queue when
@@ -163,38 +181,31 @@ typedef struct PipeEvent {
  * Declarations for functions used only in this file.
  */
 
-static int     ApplicationType(Tcl_Interp *interp, const char *fileName,
-                   char *fullName);
-static void    BuildCommandLine(int argc, char **argv, Tcl_DString *linePtr);
-static void    CopyChannel(HANDLE dst, HANDLE src);
-static BOOL    HasConsole(void);
-static TclFile MakeFile(HANDLE handle);
-static char *  MakeTempFile(Tcl_DString *namePtr);
-static int     PipeBlockModeProc(ClientData instanceData, int mode);
-static void    PipeCheckProc _ANSI_ARGS_((ClientData clientData,
-                   int flags));
-static int     PipeCloseProc(ClientData instanceData, Tcl_Interp *interp);
-static int     PipeEventProc(Tcl_Event *evPtr, int flags);
-static void    PipeExitHandler(ClientData clientData);
-static int     PipeGetHandleProc(ClientData instanceData, int direction,
-                   ClientData *handlePtr);
-static void    PipeInit(void);
-static int     PipeInputProc(ClientData instanceData, char *buf, int toRead,
-                   int *errorCode);
-static int     PipeOutputProc(ClientData instanceData, char *buf, int toWrite,
-                   int *errorCode);
-static void    PipeWatchProc(ClientData instanceData, int mask);
-static void    PipeSetupProc _ANSI_ARGS_((ClientData clientData,
-                   int flags));
-static int     TempFileName(char name[MAX_PATH]);
-
-/* CYGNUS LOCAL.  */
-static int     PipeGetFlags _ANSI_ARGS_((PipeInfo *));
-static void    PipeSetFlag _ANSI_ARGS_((PipeInfo *, int));
-static void    PipeResetFlag _ANSI_ARGS_((PipeInfo *, int));
-static DWORD   PipeThread _ANSI_ARGS_((LPVOID arg));
-static LRESULT CALLBACK        PipeProc _ANSI_ARGS_((HWND hwnd, UINT message,
-                           WPARAM wParam, LPARAM lParam));
+static int             ApplicationType(Tcl_Interp *interp,
+                           const char *fileName, char *fullName);
+static void            BuildCommandLine(const char *executable, int argc, 
+                           char **argv, Tcl_DString *linePtr);
+static BOOL            HasConsole(void);
+static int             PipeBlockModeProc(ClientData instanceData, int mode);
+static void            PipeCheckProc(ClientData clientData, int flags);
+static int             PipeClose2Proc(ClientData instanceData,
+                           Tcl_Interp *interp, int flags);
+static int             PipeEventProc(Tcl_Event *evPtr, int flags);
+static void            PipeExitHandler(ClientData clientData);
+static int             PipeGetHandleProc(ClientData instanceData,
+                           int direction, ClientData *handlePtr);
+static void            PipeInit(void);
+static int             PipeInputProc(ClientData instanceData, char *buf,
+                           int toRead, int *errorCode);
+static int             PipeOutputProc(ClientData instanceData, char *buf,
+                           int toWrite, int *errorCode);
+static DWORD WINAPI    PipeReaderThread(LPVOID arg);
+static void            PipeSetupProc(ClientData clientData, int flags);
+static void            PipeWatchProc(ClientData instanceData, int mask);
+static DWORD WINAPI    PipeWriterThread(LPVOID arg);
+static void            ProcExitHandler(ClientData clientData);
+static int             TempFileName(WCHAR name[MAX_PATH]);
+static int             WaitForRead(PipeInfo *infoPtr, int blocking);
 
 /*
  * This structure describes the channel type structure for command pipe
@@ -203,8 +214,8 @@ static LRESULT CALLBACK     PipeProc _ANSI_ARGS_((HWND hwnd, UINT message,
 
 static Tcl_ChannelType pipeChannelType = {
     "pipe",                    /* Type name. */
-    PipeBlockModeProc,         /* Set blocking or non-blocking mode.*/
-    PipeCloseProc,             /* Close proc. */
+    TCL_CHANNEL_VERSION_2,     /* v2 channel */
+    TCL_CLOSE2PROC,            /* Close proc. */
     PipeInputProc,             /* Input proc. */
     PipeOutputProc,            /* Output proc. */
     NULL,                      /* Seek proc. */
@@ -212,203 +223,105 @@ static Tcl_ChannelType pipeChannelType = {
     NULL,                      /* Get option proc. */
     PipeWatchProc,             /* Set up notifier to watch the channel. */
     PipeGetHandleProc,         /* Get an OS handle from channel. */
+    PipeClose2Proc,            /* close2proc */
+    PipeBlockModeProc,         /* Set blocking or non-blocking mode.*/
+    NULL,                      /* flush proc. */
+    NULL,                      /* handler proc. */
 };
-
-/* CYGNUS LOCAL: Event notification window.  */
-
-static HWND pipeHwnd;
-
-#define PIPE_MESSAGE (WM_USER + 1)
 \f
-/* CYGNUS LOCAL: Because we use a thread that manipulates the flags
-   field, we use helper routines for the field.  */
-
-static int
-PipeGetFlags(pipe)
-    PipeInfo *pipe;
-{
-    int flags;
-
-    WaitForSingleObject(pipe->flagsMutex, INFINITE);
-    flags = pipe->flags;
-    ReleaseMutex(pipe->flagsMutex);
-    return flags;
-}
-
-static void
-PipeSetFlag(pipe, flag)
-    PipeInfo *pipe;
-    int flag;
-{
-    WaitForSingleObject(pipe->flagsMutex, INFINITE);
-    pipe->flags |= flag;
-    ReleaseMutex(pipe->flagsMutex);
-}
+/*
+ *----------------------------------------------------------------------
+ *
+ * PipeInit --
+ *
+ *     This function initializes the static variables for this file.
+ *
+ * Results:
+ *     None.
+ *
+ * Side effects:
+ *     Creates a new event source.
+ *
+ *----------------------------------------------------------------------
+ */
 
 static void
-PipeResetFlag(pipe, flag)
-    PipeInfo *pipe;
-    int flag;
-{
-    WaitForSingleObject(pipe->flagsMutex, INFINITE);
-    pipe->flags &= ~ (flag);
-    ReleaseMutex(pipe->flagsMutex);
-}
-
-/* CYGNUS LOCAL: We use a thread to detect when a pipe may be read.
-   The thread runs this function.  The argument is the pipe to read.  */
-
-static DWORD
-PipeThread(arg)
-    LPVOID arg;
+PipeInit()
 {
-    PipeInfo *pipe = (PipeInfo *) arg;
-    WinFile *file = (WinFile*) pipe->readFile;
-    HANDLE handle = file->handle;
-
-    while (1) {
-       char b;
-       DWORD got;
-
-       WaitForSingleObject(pipe->tryReadEvent, INFINITE);
-
-       if (PipeGetFlags(pipe) & PIPE_CLOSED) {
-           break;
-       }
-
-       WaitForSingleObject(pipe->mutex, INFINITE);
-
-       if ((PipeGetFlags(pipe) & PIPE_READAHEAD) == 0) {
-           if (ReadFile(handle, &b, 1, &got, NULL) && got == 1) {
-               pipe->readAhead = b;
-               PipeSetFlag(pipe, PIPE_READAHEAD);
-           }
-       }
-
-       PipeSetFlag(pipe, PIPE_READABLE);
+    ThreadSpecificData *tsdPtr;
 
-       /* We've indicated that the pipe is readable, so ignore any
-           recent requests to do so.  */
-       ResetEvent(pipe->tryReadEvent);
-
-       ReleaseMutex(pipe->mutex);
+    /*
+     * Check the initialized flag first, then check again in the mutex.
+     * This is a speed enhancement.
+     */
 
-       if (PipeGetFlags(pipe) & PIPE_CLOSED) {
-           break;
+    if (!initialized) {
+       Tcl_MutexLock(&pipeMutex);
+       if (!initialized) {
+           initialized = 1;
+           procList = NULL;
+           Tcl_CreateExitHandler(ProcExitHandler, NULL);
        }
-
-       /* Post a message to wake up the event loop.  */
-       PostMessage(pipeHwnd, PIPE_MESSAGE, 0, (LPARAM) pipe);
+       Tcl_MutexUnlock(&pipeMutex);
     }
 
-    /* PipeCloseProc will set PIPE_CLOSED when the pipe is ready to be
-       closed and freed.  */
-
-    CloseHandle(pipe->flagsMutex);
-    CloseHandle(pipe->tryReadEvent);
-    CloseHandle(pipe->mutex);
-    ckfree((char *)pipe);
-    return 0;
-}
-
-/* CYGNUS LOCAL: This function is called when the PipeThread posts a
-   message.  */
-
-static LRESULT CALLBACK
-PipeProc(hwnd, message, wParam, lParam)
-    HWND hwnd;
-    UINT message;
-    WPARAM wParam;
-    LPARAM lParam;
-{
-    if (message != PIPE_MESSAGE) {
-       return DefWindowProc(hwnd, message, wParam, lParam);
+    tsdPtr = (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);
+    if (tsdPtr == NULL) {
+       tsdPtr = TCL_TSD_INIT(&dataKey);
+       tsdPtr->firstPipePtr = NULL;
+       Tcl_CreateEventSource(PipeSetupProc, PipeCheckProc, NULL);
+       Tcl_CreateThreadExitHandler(PipeExitHandler, NULL);
     }
-
-    /* This function really only exists to wake up the event loop.  We
-       don't actually have to do anything.  */
-
-    return 0;
 }
 \f
 /*
  *----------------------------------------------------------------------
  *
- * PipeInit --
+ * PipeExitHandler --
  *
- *     This function initializes the static variables for this file.
+ *     This function is called to cleanup the pipe module before
+ *     Tcl is unloaded.
  *
  * Results:
  *     None.
  *
  * Side effects:
- *     Creates a new event source.
+ *     Removes the pipe event source.
  *
  *----------------------------------------------------------------------
  */
 
 static void
-PipeInit()
+PipeExitHandler(
+    ClientData clientData)     /* Old window proc */
 {
-    WNDCLASS class;
-
-    initialized = 1;
-    firstPipePtr = NULL;
-    procList = NULL;
-    Tcl_CreateEventSource(PipeSetupProc, PipeCheckProc, NULL);
-    Tcl_CreateExitHandler(PipeExitHandler, NULL);
-
-    /* CYGNUS LOCAL: Create a window for asynchronous notification.  */
-
-    class.style = 0;
-    class.cbClsExtra = 0;
-    class.cbWndExtra = 0;
-    class.hInstance = TclWinGetTclInstance();
-    class.hbrBackground = NULL;
-    class.lpszMenuName = NULL;
-    class.lpszClassName = "TclPipe";
-    class.lpfnWndProc = PipeProc;
-    class.hIcon = NULL;
-    class.hCursor = NULL;
-
-    if (RegisterClass(&class)) {
-       pipeHwnd = CreateWindow("TclPipe", "TclPipe", WS_TILED, 0, 0,
-               0, 0, NULL, NULL, class.hInstance, NULL);
-    } else {
-       pipeHwnd = NULL;
-       TclWinConvertError(GetLastError());
-    }
+    Tcl_DeleteEventSource(PipeSetupProc, PipeCheckProc, NULL);
 }
 \f
 /*
  *----------------------------------------------------------------------
  *
- * PipeExitHandler --
+ * ProcExitHandler --
  *
- *     This function is called to cleanup the pipe module before
+ *     This function is called to cleanup the process list before
  *     Tcl is unloaded.
  *
  * Results:
  *     None.
  *
  * Side effects:
- *     Removes the pipe event source.
+ *     Resets the process list.
  *
  *----------------------------------------------------------------------
  */
 
 static void
-PipeExitHandler(clientData)
-    ClientData clientData;     /* Old window proc */
+ProcExitHandler(
+    ClientData clientData)     /* Old window proc */
 {
-    Tcl_DeleteEventSource(PipeSetupProc, PipeCheckProc, NULL);
+    Tcl_MutexLock(&pipeMutex);
     initialized = 0;
-    /* CYGNUS LOCAL: Delete the window.  */
-    UnregisterClass("TclPipe", TclWinGetTclInstance());
-    if (pipeHwnd != NULL) {
-       DestroyWindow(pipeHwnd);
-       pipeHwnd = NULL;
-    }
+    Tcl_MutexUnlock(&pipeMutex);
 }
 \f
 /*
@@ -429,36 +342,42 @@ PipeExitHandler(clientData)
  */
 
 void
-PipeSetupProc(data, flags)
-    ClientData data;           /* Not used. */
-    int flags;                 /* Event flags as passed to Tcl_DoOneEvent. */
+PipeSetupProc(
+    ClientData data,           /* Not used. */
+    int flags)                 /* Event flags as passed to Tcl_DoOneEvent. */
 {
     PipeInfo *infoPtr;
     Tcl_Time blockTime = { 0, 0 };
+    int block = 1;
+    WinFile *filePtr;
+    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
 
     if (!(flags & TCL_FILE_EVENTS)) {
        return;
     }
     
     /*
-     * Check to see if there is a watched pipe.  If so, poll.
+     * Look to see if any events are already pending.  If they are, poll.
      */
 
-    for (infoPtr = firstPipePtr; infoPtr != NULL; infoPtr = infoPtr->nextPtr) {
-       /* CYGNUS LOCAL: Only poll for a readable pipe if it really is
-           readable.  */
-       if ((infoPtr->watchMask &~ TCL_READABLE)
-           || ((infoPtr->watchMask & TCL_READABLE)
-               && ((PipeGetFlags(infoPtr) & PIPE_HAS_THREAD) == 0
-                   || (PipeGetFlags(infoPtr) & PIPE_READABLE)))) {
-           Tcl_SetMaxBlockTime(&blockTime);
-           break;
-       } else if (infoPtr->watchMask & TCL_READABLE) {
-           /* CYGNUS LOCAL: Tell the thread to try a read, and let us
-               know when it is done.  */
-           SetEvent(infoPtr->tryReadEvent);
+    for (infoPtr = tsdPtr->firstPipePtr; infoPtr != NULL; 
+           infoPtr = infoPtr->nextPtr) {
+       if (infoPtr->watchMask & TCL_WRITABLE) {
+           filePtr = (WinFile*) infoPtr->writeFile;
+           if (WaitForSingleObject(infoPtr->writable, 0) != WAIT_TIMEOUT) {
+               block = 0;
+           }
+       }
+       if (infoPtr->watchMask & TCL_READABLE) {
+           filePtr = (WinFile*) infoPtr->readFile;
+           if (WaitForRead(infoPtr, 0) >= 0) {
+               block = 0;
+           }
        }
     }
+    if (!block) {
+       Tcl_SetMaxBlockTime(&blockTime);
+    }
 }
 \f
 /*
@@ -479,31 +398,50 @@ PipeSetupProc(data, flags)
  */
 
 static void
-PipeCheckProc(data, flags)
-    ClientData data;           /* Not used. */
-    int flags;                 /* Event flags as passed to Tcl_DoOneEvent. */
+PipeCheckProc(
+    ClientData data,           /* Not used. */
+    int flags)                 /* Event flags as passed to Tcl_DoOneEvent. */
 {
     PipeInfo *infoPtr;
     PipeEvent *evPtr;
+    WinFile *filePtr;
+    int needEvent;
+    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
 
     if (!(flags & TCL_FILE_EVENTS)) {
        return;
     }
     
     /*
-     * Queue events for any watched pipes that don't already have events
+     * Queue events for any ready pipes that don't already have events
      * queued.
      */
 
-    for (infoPtr = firstPipePtr; infoPtr != NULL; infoPtr = infoPtr->nextPtr) {
-       /* CYGNUS LOCAL: Only poll for a readable pipe if it really is
-           readable.  */
-       if (((infoPtr->watchMask &~ TCL_READABLE)
-           || ((infoPtr->watchMask & TCL_READABLE)
-               && ((PipeGetFlags(infoPtr) & PIPE_HAS_THREAD) == 0
-                   || (PipeGetFlags(infoPtr) & PIPE_READABLE))))
-           && !(PipeGetFlags(infoPtr) & PIPE_PENDING)) {
-           PipeSetFlag(infoPtr, PIPE_PENDING);
+    for (infoPtr = tsdPtr->firstPipePtr; infoPtr != NULL; 
+           infoPtr = infoPtr->nextPtr) {
+       if (infoPtr->flags & PIPE_PENDING) {
+           continue;
+       }
+       
+       /*
+        * Queue an event if the pipe is signaled for reading or writing.
+        */
+
+       needEvent = 0;
+       filePtr = (WinFile*) infoPtr->writeFile;
+       if ((infoPtr->watchMask & TCL_WRITABLE) &&
+               (WaitForSingleObject(infoPtr->writable, 0) != WAIT_TIMEOUT)) {
+           needEvent = 1;
+       }
+       
+       filePtr = (WinFile*) infoPtr->readFile;
+       if ((infoPtr->watchMask & TCL_READABLE) &&
+               (WaitForRead(infoPtr, 0) >= 0)) {
+           needEvent = 1;
+       }
+
+       if (needEvent) {
+           infoPtr->flags |= PIPE_PENDING;
            evPtr = (PipeEvent *) ckalloc(sizeof(PipeEvent));
            evPtr->header.proc = PipeEventProc;
            evPtr->infoPtr = infoPtr;
@@ -515,7 +453,7 @@ PipeCheckProc(data, flags)
 /*
  *----------------------------------------------------------------------
  *
- * MakeFile --
+ * TclWinMakeFile --
  *
  *     This function constructs a new TclFile from a given data and
  *     type value.
@@ -529,9 +467,9 @@ PipeCheckProc(data, flags)
  *----------------------------------------------------------------------
  */
 
-static TclFile
-MakeFile(handle)
-    HANDLE handle;             /* Type-specific data. */
+TclFile
+TclWinMakeFile(
+    HANDLE handle)             /* Type-specific data. */
 {
     WinFile *filePtr;
 
@@ -545,37 +483,6 @@ MakeFile(handle)
 /*
  *----------------------------------------------------------------------
  *
- * TclpMakeFile --
- *
- *     Make a TclFile from a channel.
- *
- * Results:
- *     Returns a new TclFile or NULL on failure.
- *
- * Side effects:
- *     None.
- *
- *----------------------------------------------------------------------
- */
-
-TclFile
-TclpMakeFile(channel, direction)
-    Tcl_Channel channel;       /* Channel to get file from. */
-    int direction;             /* Either TCL_READABLE or TCL_WRITABLE. */
-{
-    HANDLE handle;
-
-    if (Tcl_GetChannelHandle(channel, direction, 
-           (ClientData *) &handle) == TCL_OK) {
-       return MakeFile(handle);
-    } else {
-       return (TclFile) NULL;
-    }
-}
-\f
-/*
- *----------------------------------------------------------------------
- *
  * TempFileName --
  *
  *     Gets a temporary file name and deals with the fact that the
@@ -596,117 +503,58 @@ TclpMakeFile(channel, direction)
 
 static int
 TempFileName(name)
-    char name[MAX_PATH];       /* Buffer in which name for temporary 
+    WCHAR name[MAX_PATH];      /* Buffer in which name for temporary 
                                 * file gets stored. */
 {
-    if ((GetTempPath(MAX_PATH, name) == 0) ||
-           (GetTempFileName(name, "TCL", 0, name) == 0)) {
-       name[0] = '.';
-       name[1] = '\0';
-       if (GetTempFileName(name, "TCL", 0, name) == 0) {
-           return 0;
+    TCHAR *prefix;
+
+    prefix = (tclWinProcs->useWide) ? (TCHAR *) L"TCL" : (TCHAR *) "TCL";
+    if ((*tclWinProcs->getTempPathProc)(MAX_PATH, name) != 0) {
+       if ((*tclWinProcs->getTempFileNameProc)((TCHAR *) name, prefix, 0, 
+               name) != 0) {
+           return 1;
        }
     }
-    return 1;
+    if (tclWinProcs->useWide) {
+       ((WCHAR *) name)[0] = '.';
+       ((WCHAR *) name)[1] = '\0';
+    } else {
+       ((char *) name)[0] = '.';
+       ((char *) name)[1] = '\0';
+    }
+    return (*tclWinProcs->getTempFileNameProc)((TCHAR *) name, prefix, 0, 
+           name);
 }
 \f
 /*
  *----------------------------------------------------------------------
  *
- * TclpCreateTempFile --
+ * TclpMakeFile --
  *
- *     This function opens a unique file with the property that it
- *     will be deleted when its file handle is closed.  The temporary
- *     file is created in the system temporary directory.
+ *     Make a TclFile from a channel.
  *
  * Results:
- *     Returns a valid TclFile, or NULL on failure.
+ *     Returns a new TclFile or NULL on failure.
  *
  * Side effects:
- *     Creates a new temporary file.
+ *     None.
  *
  *----------------------------------------------------------------------
  */
 
 TclFile
-TclpCreateTempFile(contents, namePtr)
-    char *contents;            /* String to write into temp file, or NULL. */
-    Tcl_DString *namePtr;      /* If non-NULL, pointer to initialized 
-                                * DString that is filled with the name of 
-                                * the temp file that was created. */
+TclpMakeFile(channel, direction)
+    Tcl_Channel channel;       /* Channel to get file from. */
+    int direction;             /* Either TCL_READABLE or TCL_WRITABLE. */
 {
-    char name[MAX_PATH];
     HANDLE handle;
 
-    if (TempFileName(name) == 0) {
-       return NULL;
-    }
-
-    handle = CreateFile(name, GENERIC_READ | GENERIC_WRITE, 0, NULL,
-           CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY|FILE_FLAG_DELETE_ON_CLOSE,
-           NULL);
-    if (handle == INVALID_HANDLE_VALUE) {
-       goto error;
-    }
-
-    /*
-     * Write the file out, doing line translations on the way.
-     */
-
-    if (contents != NULL) {
-       DWORD result, length;
-       char *p;
-       
-       for (p = contents; *p != '\0'; p++) {
-           if (*p == '\n') {
-               length = p - contents;
-               if (length > 0) {
-                   if (!WriteFile(handle, contents, length, &result, NULL)) {
-                       goto error;
-                   }
-               }
-               if (!WriteFile(handle, "\r\n", 2, &result, NULL)) {
-                   goto error;
-               }
-               contents = p+1;
-           }
-       }
-       length = p - contents;
-       if (length > 0) {
-           if (!WriteFile(handle, contents, length, &result, NULL)) {
-               goto error;
-           }
-       }
-    }
-
-    if (SetFilePointer(handle, 0, NULL, FILE_BEGIN) == 0xFFFFFFFF) {
-       goto error;
-    }
-
-    if (namePtr != NULL) {
-        Tcl_DStringAppend(namePtr, name, -1);
-    }
-
-    /*
-     * Under Win32s a file created with FILE_FLAG_DELETE_ON_CLOSE won't
-     * actually be deleted when it is closed, so we have to do it ourselves.
-     */
-
-    if (TclWinGetPlatformId() == VER_PLATFORM_WIN32s) {
-       TmpFile *tmpFilePtr = (TmpFile *) ckalloc(sizeof(TmpFile));
-       tmpFilePtr->file.type = WIN32S_TMPFILE;
-       tmpFilePtr->file.handle = handle;
-       strcpy(tmpFilePtr->name, name);
-       return (TclFile)tmpFilePtr;
+    if (Tcl_GetChannelHandle(channel, direction, 
+           (ClientData *) &handle) == TCL_OK) {
+       return TclWinMakeFile(handle);
     } else {
-       return MakeFile(handle);
+       return (TclFile) NULL;
     }
-
-  error:
-    TclWinConvertError(GetLastError());
-    CloseHandle(handle);
-    DeleteFile(name);
-    return NULL;
 }
 \f
 /*
@@ -728,13 +576,14 @@ TclpCreateTempFile(contents, namePtr)
 
 TclFile
 TclpOpenFile(path, mode)
-    char *path;
-    int mode;
+    CONST char *path;          /* The name of the file to open. */
+    int mode;                  /* In what mode to open the file? */
 {
     HANDLE handle;
     DWORD accessMode, createMode, shareMode, flags;
-    SECURITY_ATTRIBUTES sec;
-
+    Tcl_DString ds;
+    TCHAR *nativePath;
+    
     /*
      * Map the access bits to the NT access mode.
      */
@@ -778,28 +627,21 @@ TclpOpenFile(path, mode)
            break;
     }
 
+    nativePath = Tcl_WinUtfToTChar(path, -1, &ds);
+
     /*
      * If the file is not being created, use the existing file attributes.
      */
 
     flags = 0;
     if (!(mode & O_CREAT)) {
-       flags = GetFileAttributes(path);
+       flags = (*tclWinProcs->getFileAttributesProc)(nativePath);
        if (flags == 0xFFFFFFFF) {
            flags = 0;
        }
     }
 
     /*
-     * Set up the security attributes so this file is not inherited by
-     * child processes.
-     */
-
-    sec.nLength = sizeof(sec);
-    sec.lpSecurityDescriptor = NULL;
-    sec.bInheritHandle = 0;
-
-    /*
      * Set up the file sharing mode.  We want to allow simultaneous access.
      */
 
@@ -809,10 +651,14 @@ TclpOpenFile(path, mode)
      * Now we get to create the file.
      */
 
-    handle = CreateFile(path, accessMode, shareMode, &sec, createMode, flags,
-            (HANDLE) NULL);
+    handle = (*tclWinProcs->createFileProc)(nativePath, accessMode, 
+           shareMode, NULL, createMode, flags, NULL);
+    Tcl_DStringFree(&ds);
+
     if (handle == INVALID_HANDLE_VALUE) {
-       DWORD err = GetLastError();
+       DWORD err;
+       
+       err = GetLastError();
        if ((err & 0xffffL) == ERROR_OPEN_FAILED) {
            err = (mode & O_CREAT) ? ERROR_FILE_EXISTS : ERROR_FILE_NOT_FOUND;
        }
@@ -828,65 +674,131 @@ TclpOpenFile(path, mode)
        SetFilePointer(handle, 0, NULL, FILE_END);
     }
 
-    return MakeFile(handle);
+    return TclWinMakeFile(handle);
 }
 \f
 /*
  *----------------------------------------------------------------------
  *
- * TclpCreatePipe --
+ * TclpCreateTempFile --
  *
- *      Creates an anonymous pipe.  Under Win32s, creates a temp file
- *     that is used to simulate a pipe.
+ *     This function opens a unique file with the property that it
+ *     will be deleted when its file handle is closed.  The temporary
+ *     file is created in the system temporary directory.
  *
  * Results:
- *      Returns 1 on success, 0 on failure. 
+ *     Returns a valid TclFile, or NULL on failure.
  *
  * Side effects:
- *      Creates a pipe.
+ *     Creates a new temporary file.
  *
  *----------------------------------------------------------------------
  */
 
-int
-TclpCreatePipe(readPipe, writePipe)
-    TclFile *readPipe; /* Location to store file handle for
-                                * read side of pipe. */
-    TclFile *writePipe;        /* Location to store file handle for
-                                * write side of pipe. */
+TclFile
+TclpCreateTempFile(contents)
+    CONST char *contents;      /* String to write into temp file, or NULL. */
 {
-    HANDLE readHandle, writeHandle;
+    WCHAR name[MAX_PATH];
+    CONST char *native;
+    Tcl_DString dstring;
+    HANDLE handle;
 
-    if (CreatePipe(&readHandle, &writeHandle, NULL, 0) != 0) {
-       *readPipe = MakeFile(readHandle);
-       *writePipe = MakeFile(writeHandle);
-       return 1;
+    if (TempFileName(name) == 0) {
+       return NULL;
     }
 
-    if (TclWinGetPlatformId() == VER_PLATFORM_WIN32s) {
-       WinPipe *readPipePtr, *writePipePtr;
-       char buf[MAX_PATH];
-
-       if (TempFileName(buf) != 0) {
-           readPipePtr = (WinPipe *) ckalloc(sizeof(WinPipe));
-           writePipePtr = (WinPipe *) ckalloc(sizeof(WinPipe));
+    handle = (*tclWinProcs->createFileProc)((TCHAR *) name, 
+           GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 
+           FILE_ATTRIBUTE_TEMPORARY|FILE_FLAG_DELETE_ON_CLOSE, NULL);
+    if (handle == INVALID_HANDLE_VALUE) {
+       goto error;
+    }
 
-           readPipePtr->file.type = WIN32S_PIPE;
-           readPipePtr->otherPtr = writePipePtr;
-           readPipePtr->fileName = strcpy(ckalloc(strlen(buf) + 1), buf);
-           readPipePtr->file.handle = INVALID_HANDLE_VALUE;
-           writePipePtr->file.type = WIN32S_PIPE;
-           writePipePtr->otherPtr = readPipePtr;
-           writePipePtr->fileName = readPipePtr->fileName;
-           writePipePtr->file.handle = INVALID_HANDLE_VALUE;
+    /*
+     * Write the file out, doing line translations on the way.
+     */
 
-           *readPipe = (TclFile)readPipePtr;
-           *writePipe = (TclFile)writePipePtr;
+    if (contents != NULL) {
+       DWORD result, length;
+       CONST char *p;
 
-           return 1;
+       /*
+        * Convert the contents from UTF to native encoding
+        */
+       native = Tcl_UtfToExternalDString(NULL, contents, -1, &dstring);
+       
+       for (p = native; *p != '\0'; p++) {
+           if (*p == '\n') {
+               length = p - native;
+               if (length > 0) {
+                   if (!WriteFile(handle, native, length, &result, NULL)) {
+                       goto error;
+                   }
+               }
+               if (!WriteFile(handle, "\r\n", 2, &result, NULL)) {
+                   goto error;
+               }
+               native = p+1;
+           }
+       }
+       length = p - native;
+       if (length > 0) {
+           if (!WriteFile(handle, native, length, &result, NULL)) {
+               goto error;
+           }
+       }
+       Tcl_DStringFree(&dstring);
+       if (SetFilePointer(handle, 0, NULL, FILE_BEGIN) == 0xFFFFFFFF) {
+           goto error;
        }
     }
 
+    return TclWinMakeFile(handle);
+
+  error:
+    /* Free the native representation of the contents if necessary */
+    if (contents != NULL) {
+       Tcl_DStringFree(&dstring);
+    }
+
+    TclWinConvertError(GetLastError());
+    CloseHandle(handle);
+    (*tclWinProcs->deleteFileProc)((TCHAR *) name);
+    return NULL;
+}
+\f
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclpCreatePipe --
+ *
+ *      Creates an anonymous pipe.
+ *
+ * Results:
+ *      Returns 1 on success, 0 on failure. 
+ *
+ * Side effects:
+ *      Creates a pipe.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TclpCreatePipe(
+    TclFile *readPipe, /* Location to store file handle for
+                                * read side of pipe. */
+    TclFile *writePipe)        /* Location to store file handle for
+                                * write side of pipe. */
+{
+    HANDLE readHandle, writeHandle;
+
+    if (CreatePipe(&readHandle, &writeHandle, NULL, 0) != 0) {
+       *readPipe = TclWinMakeFile(readHandle);
+       *writePipe = TclWinMakeFile(writeHandle);
+       return 1;
+    }
+
     TclWinConvertError(GetLastError());
     return 0;
 }
@@ -909,45 +821,33 @@ TclpCreatePipe(readPipe, writePipe)
  */
 
 int
-TclpCloseFile(file)
-    TclFile file;      /* The file to close. */
+TclpCloseFile(
+    TclFile file)      /* The file to close. */
 {
     WinFile *filePtr = (WinFile *) file;
-    WinPipe *pipePtr;
 
     switch (filePtr->type) {
        case WIN_FILE:
-       case WIN32S_TMPFILE:
-           if (CloseHandle(filePtr->handle) == FALSE) {
-               TclWinConvertError(GetLastError());
-               ckfree((char *) filePtr);
-               return -1;
-           }
            /*
-            * Simulate deleting the file on close for Win32s.
+            * Don't close the Win32 handle if the handle is a standard channel
+            * during the exit process.  Otherwise, one thread may kill the
+            * stdio of another.
             */
 
-           if (filePtr->type == WIN32S_TMPFILE) {
-               DeleteFile(((TmpFile*)filePtr)->name);
-           }
-           break;
-
-       case WIN32S_PIPE:
-           pipePtr = (WinPipe *) file;
-
-           if (pipePtr->otherPtr != NULL) {
-               pipePtr->otherPtr->otherPtr = NULL;
-           } else {
-               if (pipePtr->file.handle != INVALID_HANDLE_VALUE) {
-                   CloseHandle(pipePtr->file.handle);
+           if (!TclInExit() 
+                   || ((GetStdHandle(STD_INPUT_HANDLE) != filePtr->handle)
+                           && (GetStdHandle(STD_OUTPUT_HANDLE) != filePtr->handle)
+                           && (GetStdHandle(STD_ERROR_HANDLE) != filePtr->handle))) {
+               if (CloseHandle(filePtr->handle) == FALSE) {
+                   TclWinConvertError(GetLastError());
+                   ckfree((char *) filePtr);
+                   return -1;
                }
-               DeleteFile(pipePtr->fileName);
-               ckfree((char *) pipePtr->fileName);
            }
            break;
 
        default:
-           panic("Tcl_CloseFile: unexpected file type");
+           panic("TclpCloseFile: unexpected file type");
     }
 
     ckfree((char *) filePtr);
@@ -974,16 +874,19 @@ TclpCloseFile(file)
  */
 
 unsigned long
-TclpGetPid(pid)
-    Tcl_Pid pid;               /* The HANDLE of the child process. */
+TclpGetPid(
+    Tcl_Pid pid)               /* The HANDLE of the child process. */
 {
     ProcInfo *infoPtr;
-    
+
+    Tcl_MutexLock(&pipeMutex);
     for (infoPtr = procList; infoPtr != NULL; infoPtr = infoPtr->nextPtr) {
        if (infoPtr->hProcess == (HANDLE) pid) {
+           Tcl_MutexUnlock(&pipeMutex);
            return infoPtr->dwProcessId;
        }
     }
+    Tcl_MutexUnlock(&pipeMutex);
     return (unsigned long) -1;
 }
 \f
@@ -994,9 +897,8 @@ TclpGetPid(pid)
  *
  *     Create a child process that has the specified files as its 
  *     standard input, output, and error.  The child process runs
- *     synchronously under Win32s and asynchronously under Windows NT
- *     and Windows 95, and runs with the same environment variables
- *     as the creating process.
+ *     asynchronously under Windows NT and Windows 9x, and runs
+ *     with the same environment variables as the creating process.
  *
  *     The complete Windows search path is searched to find the specified 
  *     executable.  If an executable by the given name is not found, 
@@ -1005,7 +907,7 @@ TclpGetPid(pid)
  *
  * Results:
  *     The return value is TCL_ERROR and an error message is left in
- *     interp->result if there was a problem creating the child 
+ *     the interp's result if there was a problem creating the child 
  *     process.  Otherwise, the return value is TCL_OK and *pidPtr is
  *     filled with the process id of the child process.
  * 
@@ -1016,214 +918,53 @@ TclpGetPid(pid)
  */
 
 int
-TclpCreateProcess(interp, argc, argv, inputFile, outputFile, errorFile, 
-       pidPtr)
-    Tcl_Interp *interp;                /* Interpreter in which to leave errors that
+TclpCreateProcess(
+    Tcl_Interp *interp,                /* Interpreter in which to leave errors that
                                 * occurred when creating the child process.
                                 * Error messages from the child process
                                 * itself are sent to errorFile. */
-    int argc;                  /* Number of arguments in following array. */
-    char **argv;               /* Array of argument strings.  argv[0]
+    int argc,                  /* Number of arguments in following array. */
+    char **argv,               /* Array of argument strings.  argv[0]
                                 * contains the name of the executable
                                 * converted to native format (using the
                                 * Tcl_TranslateFileName call).  Additional
                                 * arguments have not been converted. */
-    TclFile inputFile;         /* If non-NULL, gives the file to use as
+    TclFile inputFile,         /* If non-NULL, gives the file to use as
                                 * input for the child process.  If inputFile
                                 * file is not readable or is NULL, the child
                                 * will receive no standard input. */
-    TclFile outputFile;                /* If non-NULL, gives the file that
+    TclFile outputFile,                /* If non-NULL, gives the file that
                                 * receives output from the child process.  If
                                 * outputFile file is not writeable or is
                                 * NULL, output from the child will be
                                 * discarded. */
-    TclFile errorFile;         /* If non-NULL, gives the file that
+    TclFile errorFile,         /* If non-NULL, gives the file that
                                 * receives errors from the child process.  If
                                 * errorFile file is not writeable or is NULL,
                                 * errors from the child will be discarded.
                                 * errorFile may be the same as outputFile. */
-    Tcl_Pid *pidPtr;           /* If this procedure is successful, pidPtr
+    Tcl_Pid *pidPtr)           /* If this procedure is successful, pidPtr
                                 * is filled with the process id of the child
                                 * process. */
 {
     int result, applType, createFlags;
-    Tcl_DString cmdLine;
-    STARTUPINFO startInfo;
+    Tcl_DString cmdLine;       /* Complete command line (TCHAR). */
+    STARTUPINFOA startInfo;
     PROCESS_INFORMATION procInfo;
     SECURITY_ATTRIBUTES secAtts;
     HANDLE hProcess, h, inputHandle, outputHandle, errorHandle;
-    char execPath[MAX_PATH];
-    char *originalName;
+    char execPath[MAX_PATH * TCL_UTF_MAX];
     WinFile *filePtr;
 
-    if (!initialized) {
-       PipeInit();
-    }
+    PipeInit();
 
     applType = ApplicationType(interp, argv[0], execPath);
     if (applType == APPL_NONE) {
        return TCL_ERROR;
     }
-    originalName = argv[0];
-    argv[0] = execPath;
 
     result = TCL_ERROR;
     Tcl_DStringInit(&cmdLine);
-
-    if (TclWinGetPlatformId() == VER_PLATFORM_WIN32s) {
-       /*
-        * Under Win32s, there are no pipes.  In order to simulate pipe
-        * behavior, the child processes are run synchronously and their
-        * I/O is redirected from/to temporary files before the next 
-        * stage of the pipeline is started.
-        */
-
-       MSG msg;
-       DWORD status;
-       DWORD args[4];
-       void *trans[5];
-       char *inputFileName, *outputFileName;
-       Tcl_DString inputTempFile, outputTempFile;
-
-       BuildCommandLine(argc, argv, &cmdLine);
-
-       ZeroMemory(&startInfo, sizeof(startInfo));
-       startInfo.cb = sizeof(startInfo);
-
-       Tcl_DStringInit(&inputTempFile);
-       Tcl_DStringInit(&outputTempFile);
-       outputHandle = INVALID_HANDLE_VALUE;
-
-       inputFileName = NULL;
-       outputFileName = NULL;
-       if (inputFile != NULL) {
-           filePtr = (WinFile *) inputFile;
-           switch (filePtr->type) {
-               case WIN_FILE:
-               case WIN32S_TMPFILE: {
-                   h = INVALID_HANDLE_VALUE;
-                   inputFileName = MakeTempFile(&inputTempFile);
-                   if (inputFileName != NULL) {
-                       h = CreateFile(inputFileName, GENERIC_WRITE, 0, 
-                               NULL, CREATE_ALWAYS, 0, NULL);
-                   }
-                   if (h == INVALID_HANDLE_VALUE) {
-                       Tcl_AppendResult(interp, "couldn't duplicate input handle: ", 
-                               Tcl_PosixError(interp), (char *) NULL);
-                       goto end32s;
-                   }
-                   CopyChannel(h, filePtr->handle);
-                   CloseHandle(h);
-                   break;
-               }
-               case WIN32S_PIPE: {
-                   inputFileName = ((WinPipe*)inputFile)->fileName;
-                   break;
-               }
-           }
-       }
-       if (inputFileName == NULL) {
-           inputFileName = "nul";
-       }
-       if (outputFile != NULL) {
-           filePtr = (WinFile *)outputFile;
-           if (filePtr->type == WIN_FILE) {
-               outputFileName = MakeTempFile(&outputTempFile);
-               if (outputFileName == NULL) {
-                   Tcl_AppendResult(interp, "couldn't duplicate output handle: ",
-                           Tcl_PosixError(interp), (char *) NULL);
-                   goto end32s;
-               }
-               outputHandle = filePtr->handle;
-           } else if (filePtr->type == WIN32S_PIPE) {
-               outputFileName = ((WinPipe*)outputFile)->fileName;
-           }
-       }
-       if (outputFileName == NULL) {
-           outputFileName = "nul";
-       }
-
-       if (applType == APPL_DOS) {
-           args[0] = (DWORD) Tcl_DStringValue(&cmdLine);
-           args[1] = (DWORD) inputFileName;
-           args[2] = (DWORD) outputFileName;
-           trans[0] = &args[0];
-           trans[1] = &args[1];
-           trans[2] = &args[2];
-           trans[3] = NULL;
-           if (TclWinSynchSpawn(args, 0, trans, pidPtr) != 0) {
-               result = TCL_OK;
-           }
-       } else if (applType == APPL_WIN3X) {
-           args[0] = (DWORD) Tcl_DStringValue(&cmdLine);
-           trans[0] = &args[0];
-           trans[1] = NULL;
-           if (TclWinSynchSpawn(args, 1, trans, pidPtr) != 0) {
-               result = TCL_OK;
-           }
-       } else {
-           if (CreateProcess(NULL, Tcl_DStringValue(&cmdLine), NULL, NULL, 
-                   FALSE, DETACHED_PROCESS, NULL, NULL, &startInfo, 
-                   &procInfo) != 0) {
-               CloseHandle(procInfo.hThread);
-               while (1) {
-                   if (GetExitCodeProcess(procInfo.hProcess, &status) == FALSE) {
-                       break;
-                   }
-                   if (status != STILL_ACTIVE) {
-                       break;
-                   }
-                   if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) == TRUE) {
-                       TranslateMessage(&msg);
-                       DispatchMessage(&msg);
-                   }
-               }
-               *pidPtr = (Tcl_Pid) procInfo.hProcess;
-               if (*pidPtr != 0) {
-                   ProcInfo *procPtr = (ProcInfo *) ckalloc(sizeof(ProcInfo));
-                   procPtr->hProcess = procInfo.hProcess;
-                   procPtr->dwProcessId = procInfo.dwProcessId;
-                   procPtr->nextPtr = procList;
-                   procList = procPtr;
-               }
-               result = TCL_OK;
-           }
-       }
-       if (result != TCL_OK) {
-           TclWinConvertError(GetLastError());
-           Tcl_AppendResult(interp, "couldn't execute \"", originalName,
-                   "\": ", Tcl_PosixError(interp), (char *) NULL);
-       }
-
-       end32s:
-       if (outputHandle != INVALID_HANDLE_VALUE) {
-           /*
-            * Now copy stuff from temp file to actual output handle. Don't
-            * close outputHandle because it is associated with the output
-            * file owned by the caller.
-            */
-
-           h = CreateFile(outputFileName, GENERIC_READ, 0, NULL, OPEN_ALWAYS,
-                   0, NULL);
-           if (h != INVALID_HANDLE_VALUE) {
-               CopyChannel(outputHandle, h);
-           }
-           CloseHandle(h);
-       }
-
-       if (inputFileName == Tcl_DStringValue(&inputTempFile)) {
-           DeleteFile(inputFileName);
-       }
-       
-       if (outputFileName == Tcl_DStringValue(&outputTempFile)) {
-           DeleteFile(outputFileName);
-       }
-
-       Tcl_DStringFree(&inputTempFile);
-       Tcl_DStringFree(&outputTempFile);
-        Tcl_DStringFree(&cmdLine);
-       return result;
-    }
     hProcess = GetCurrentProcess();
 
     /*
@@ -1326,7 +1067,7 @@ TclpCreateProcess(interp, argc, argv, inputFile, outputFile, errorFile,
                CloseHandle(h);
            }
        } else {
-           startInfo.hStdOutput = CreateFile("NUL:", GENERIC_WRITE, 0,
+           startInfo.hStdOutput = CreateFileA("NUL:", GENERIC_WRITE, 0,
                    &secAtts, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
        }
     } else {
@@ -1346,7 +1087,7 @@ TclpCreateProcess(interp, argc, argv, inputFile, outputFile, errorFile,
         * deep sink.
         */
 
-       startInfo.hStdError = CreateFile("NUL:", GENERIC_WRITE, 0,
+       startInfo.hStdError = CreateFileA("NUL:", GENERIC_WRITE, 0,
                &secAtts, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
     } else {
        DuplicateHandle(hProcess, errorHandle, hProcess, &startInfo.hStdError, 
@@ -1433,8 +1174,7 @@ TclpCreateProcess(interp, argc, argv, inputFile, outputFile, errorFile,
                startInfo.dwFlags |= STARTF_USESHOWWINDOW;
                createFlags = CREATE_NEW_CONSOLE;
            }
-           /* CYGNUS LOCAL: We name the DLL cygtclpip.  */
-           Tcl_DStringAppend(&cmdLine, "cygtclpip" STRINGIFY(TCL_MAJOR_VERSION) 
+           Tcl_DStringAppend(&cmdLine, "tclpip" STRINGIFY(TCL_MAJOR_VERSION) 
                    STRINGIFY(TCL_MINOR_VERSION) ".dll ", -1);
        }
     }
@@ -1458,18 +1198,24 @@ TclpCreateProcess(interp, argc, argv, inputFile, outputFile, errorFile,
      * using ab~1.def instead of "a b.default").  
      */
 
-    BuildCommandLine(argc, argv, &cmdLine);
+    BuildCommandLine(execPath, argc, argv, &cmdLine);
 
-    if (!CreateProcess(NULL, Tcl_DStringValue(&cmdLine), NULL, NULL, TRUE, 
-           createFlags, NULL, NULL, &startInfo, &procInfo)) {
+    if ((*tclWinProcs->createProcessProc)(NULL, 
+           (TCHAR *) Tcl_DStringValue(&cmdLine), NULL, NULL, TRUE, 
+           createFlags, NULL, NULL, &startInfo, &procInfo) == 0) {
        TclWinConvertError(GetLastError());
-       Tcl_AppendResult(interp, "couldn't execute \"", originalName,
+       Tcl_AppendResult(interp, "couldn't execute \"", argv[0],
                "\": ", Tcl_PosixError(interp), (char *) NULL);
        goto end;
     }
 
+    /*
+     * This wait is used to force the OS to give some time to the DOS
+     * process.
+     */
+
     if (applType == APPL_DOS) {
-       WaitForSingleObject(hProcess, 50);
+       WaitForSingleObject(procInfo.hProcess, 50);
     }
 
     /* 
@@ -1486,11 +1232,7 @@ TclpCreateProcess(interp, argc, argv, inputFile, outputFile, errorFile,
 
     *pidPtr = (Tcl_Pid) procInfo.hProcess;
     if (*pidPtr != 0) {
-       ProcInfo *procPtr = (ProcInfo *) ckalloc(sizeof(ProcInfo));
-       procPtr->hProcess = procInfo.hProcess;
-       procPtr->dwProcessId = procInfo.dwProcessId;
-       procPtr->nextPtr = procList;
-       procList = procPtr;
+       TclWinAddProcess(procInfo.hProcess, procInfo.dwProcessId);
     }
     result = TCL_OK;
 
@@ -1529,7 +1271,9 @@ TclpCreateProcess(interp, argc, argv, inputFile, outputFile, errorFile,
 static BOOL
 HasConsole()
 {
-    HANDLE handle = CreateFile("CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE,
+    HANDLE handle;
+    
+    handle = CreateFileA("CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE,
            NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
 
     if (handle != INVALID_HANDLE_VALUE) {
@@ -1577,18 +1321,22 @@ HasConsole()
  */
 
 static int
-ApplicationType(interp, originalName, fullPath)
+ApplicationType(interp, originalName, fullName)
     Tcl_Interp *interp;                /* Interp, for error message. */
     const char *originalName;  /* Name of the application to find. */
-    char fullPath[MAX_PATH];   /* Filled with complete path to 
+    char fullName[];           /* Filled with complete path to 
                                 * application. */
 {
-    int applType, i;
+    int applType, i, nameLen, found;
     HANDLE hFile;
-    char *ext, *rest;
+    TCHAR *rest;
+    char *ext;
     char buf[2];
-    DWORD read;
+    DWORD attr, read;
     IMAGE_DOS_HEADER header;
+    Tcl_DString nameBuf, ds;
+    TCHAR *nativeName;
+    WCHAR nativeFullPath[MAX_PATH];
     static char extensions[][5] = {"", ".com", ".exe", ".bat"};
 
     /* Look for the program as an external program.  First try the name
@@ -1605,29 +1353,43 @@ ApplicationType(interp, originalName, fullPath)
      */
 
     applType = APPL_NONE;
+    Tcl_DStringInit(&nameBuf);
+    Tcl_DStringAppend(&nameBuf, originalName, -1);
+    nameLen = Tcl_DStringLength(&nameBuf);
+
     for (i = 0; i < (int) (sizeof(extensions) / sizeof(extensions[0])); i++) {
-       lstrcpyn(fullPath, originalName, MAX_PATH - 5);
-        lstrcat(fullPath, extensions[i]);
-       
-       SearchPath(NULL, fullPath, NULL, MAX_PATH, fullPath, &rest);
+       Tcl_DStringSetLength(&nameBuf, nameLen);
+       Tcl_DStringAppend(&nameBuf, extensions[i], -1);
+        nativeName = Tcl_WinUtfToTChar(Tcl_DStringValue(&nameBuf), 
+               Tcl_DStringLength(&nameBuf), &ds);
+       found = (*tclWinProcs->searchPathProc)(NULL, nativeName, NULL, 
+               MAX_PATH, nativeFullPath, &rest);
+       Tcl_DStringFree(&ds);
+       if (found == 0) {
+           continue;
+       }
 
        /*
         * Ignore matches on directories or data files, return if identified
         * a known type.
         */
 
-       if (GetFileAttributes(fullPath) & FILE_ATTRIBUTE_DIRECTORY) {
+       attr = (*tclWinProcs->getFileAttributesProc)((TCHAR *) nativeFullPath);
+       if ((attr == 0xffffffff) || (attr & FILE_ATTRIBUTE_DIRECTORY)) {
            continue;
        }
+       strcpy(fullName, Tcl_WinTCharToUtf((TCHAR *) nativeFullPath, -1, &ds));
+       Tcl_DStringFree(&ds);
 
-       ext = strrchr(fullPath, '.');
-       if ((ext != NULL) && (strcmpi(ext, ".bat") == 0)) {
+       ext = strrchr(fullName, '.');
+       if ((ext != NULL) && (stricmp(ext, ".bat") == 0)) {
            applType = APPL_DOS;
            break;
        }
-
-       hFile = CreateFile(fullPath, GENERIC_READ, FILE_SHARE_READ, NULL, 
-               OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+       
+       hFile = (*tclWinProcs->createFileProc)((TCHAR *) nativeFullPath, 
+               GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 
+               FILE_ATTRIBUTE_NORMAL, NULL);
        if (hFile == INVALID_HANDLE_VALUE) {
            continue;
        }
@@ -1644,7 +1406,7 @@ ApplicationType(interp, originalName, fullPath)
             */
 
            CloseHandle(hFile);
-           if ((ext != NULL) && (strcmpi(ext, ".com") == 0)) {
+           if ((ext != NULL) && (strcmp(ext, ".com") == 0)) {
                applType = APPL_DOS;
                break;
            }
@@ -1688,6 +1450,7 @@ ApplicationType(interp, originalName, fullPath)
        }
        break;
     }
+    Tcl_DStringFree(&nameBuf);
 
     if (applType == APPL_NONE) {
        TclWinConvertError(GetLastError());
@@ -1704,7 +1467,10 @@ ApplicationType(interp, originalName, fullPath)
         * application name from the arguments.
         */
 
-       GetShortPathName(fullPath, fullPath, MAX_PATH);
+       (*tclWinProcs->getShortPathNameProc)((TCHAR *) nativeFullPath, 
+               nativeFullPath, MAX_PATH);
+       strcpy(fullName, Tcl_WinTCharToUtf((TCHAR *) nativeFullPath, -1, &ds));
+       Tcl_DStringFree(&ds);
     }
     return applType;
 }
@@ -1729,18 +1495,32 @@ ApplicationType(interp, originalName, fullPath)
  */
 
 static void
-BuildCommandLine(argc, argv, linePtr)
-    int argc;                  /* Number of arguments. */
-    char **argv;               /* Argument strings. */
-    Tcl_DString *linePtr;      /* Initialized Tcl_DString that receives the
-                                * command line. */
+BuildCommandLine(
+    CONST char *executable,    /* Full path of executable (including 
+                                * extension).  Replacement for argv[0]. */
+    int argc,                  /* Number of arguments. */
+    char **argv,               /* Argument strings in UTF. */
+    Tcl_DString *linePtr)      /* Initialized Tcl_DString that receives the
+                                * command line (TCHAR). */
 {
-    char *start, *special;
+    CONST char *arg, *start, *special;
     int quote, i;
+    Tcl_DString ds;
 
+    Tcl_DStringInit(&ds);
+
+    /*
+     * Prime the path.
+     */
+    
+    Tcl_DStringAppend(&ds, Tcl_DStringValue(linePtr), -1);
+    
     for (i = 0; i < argc; i++) {
-       if (i > 0) {
-           Tcl_DStringAppend(linePtr, " ", 1); 
+       if (i == 0) {
+           arg = executable;
+       } else {
+           arg = argv[i];
+           Tcl_DStringAppend(&ds, " ", 1);
        }
 
        quote = 0;
@@ -1748,21 +1528,21 @@ BuildCommandLine(argc, argv, linePtr)
            quote = 1;
        } else {
            for (start = argv[i]; *start != '\0'; start++) {
-               if (isspace(*start)) {
+               if (isspace(*start)) { /* INTL: ISO space. */
                    quote = 1;
                    break;
                }
            }
        }
        if (quote) {
-           Tcl_DStringAppend(linePtr, "\"", 1);
+           Tcl_DStringAppend(&ds, "\"", 1);
        }
 
-       start = argv[i];            
-       for (special = argv[i]; ; ) {
+       start = arg;        
+       for (special = arg; ; ) {
            if ((*special == '\\') && 
                    (special[1] == '\\' || special[1] == '"')) {
-               Tcl_DStringAppend(linePtr, start, special - start);
+               Tcl_DStringAppend(&ds, start, special - start);
                start = special;
                while (1) {
                    special++;
@@ -1772,19 +1552,19 @@ BuildCommandLine(argc, argv, linePtr)
                         * N * 2 + 1 backslashes then a quote.
                         */
 
-                       Tcl_DStringAppend(linePtr, start, special - start);
+                       Tcl_DStringAppend(&ds, start, special - start);
                        break;
                    }
                    if (*special != '\\') {
                        break;
                    }
                }
-               Tcl_DStringAppend(linePtr, start, special - start);
+               Tcl_DStringAppend(&ds, start, special - start);
                start = special;
            }
            if (*special == '"') {
-               Tcl_DStringAppend(linePtr, start, special - start);
-               Tcl_DStringAppend(linePtr, "\\\"", 2);
+               Tcl_DStringAppend(&ds, start, special - start);
+               Tcl_DStringAppend(&ds, "\\\"", 2);
                start = special + 1;
            }
            if (*special == '\0') {
@@ -1792,85 +1572,13 @@ BuildCommandLine(argc, argv, linePtr)
            }
            special++;
        }
-       Tcl_DStringAppend(linePtr, start, special - start);
+       Tcl_DStringAppend(&ds, start, special - start);
        if (quote) {
-           Tcl_DStringAppend(linePtr, "\"", 1);
-       }
-    }
-}
-\f
-/*
- *----------------------------------------------------------------------
- *
- * MakeTempFile --
- *
- *     Helper function for TclpCreateProcess under Win32s.  Makes a 
- *     temporary file that _won't_ go away automatically when it's file
- *     handle is closed.  Used for simulated pipes, which are written
- *     in one pass and reopened and read in the next pass.
- *
- * Results:
- *     namePtr is filled with the name of the temporary file.
- *
- * Side effects:
- *     A temporary file with the name specified by namePtr is created.  
- *     The caller is responsible for deleting this temporary file.
- *
- *----------------------------------------------------------------------
- */
-
-static char *
-MakeTempFile(namePtr)
-    Tcl_DString *namePtr;      /* Initialized Tcl_DString that is filled 
-                                * with the name of the temporary file that 
-                                * was created. */
-{
-    char name[MAX_PATH];
-
-    if (TempFileName(name) == 0) {
-       return NULL;
-    }
-
-    Tcl_DStringAppend(namePtr, name, -1);
-    return Tcl_DStringValue(namePtr);
-}
-\f
-/*
- *----------------------------------------------------------------------
- *
- * CopyChannel --
- *
- *     Helper function used by TclpCreateProcess under Win32s.  Copies
- *     what remains of source file to destination file; source file 
- *     pointer need not be positioned at the beginning of the file if
- *     all of source file is not desired, but data is copied up to end 
- *     of source file.
- *
- * Results:
- *     None.
- *
- * Side effects:
- *     None.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-CopyChannel(dst, src)
-    HANDLE dst;                        /* Destination file. */
-    HANDLE src;                        /* Source file. */
-{
-    char buf[8192];
-    DWORD dwRead, dwWrite;
-
-    while (ReadFile(src, buf, sizeof(buf), &dwRead, NULL) != FALSE) {
-       if (dwRead == 0) {
-           break;
-       }
-       if (WriteFile(dst, buf, dwRead, &dwWrite, NULL) == FALSE) {
-           break;
+           Tcl_DStringAppend(&ds, "\"", 1);
        }
     }
+    Tcl_WinUtfToTChar(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds), linePtr);
+    Tcl_DStringFree(&ds);
 }
 \f
 /*
@@ -1892,32 +1600,32 @@ CopyChannel(dst, src)
  */
 
 Tcl_Channel
-TclpCreateCommandChannel(readFile, writeFile, errorFile, numPids, pidPtr)
-    TclFile readFile;          /* If non-null, gives the file for reading. */
-    TclFile writeFile;         /* If non-null, gives the file for writing. */
-    TclFile errorFile;         /* If non-null, gives the file where errors
+TclpCreateCommandChannel(
+    TclFile readFile,          /* If non-null, gives the file for reading. */
+    TclFile writeFile,         /* If non-null, gives the file for writing. */
+    TclFile errorFile,         /* If non-null, gives the file where errors
                                 * can be read. */
-    int numPids;               /* The number of pids in the pid array. */
-    Tcl_Pid *pidPtr;           /* An array of process identifiers. */
+    int numPids,               /* The number of pids in the pid array. */
+    Tcl_Pid *pidPtr)           /* An array of process identifiers. */
 {
-    char channelName[20];
+    char channelName[16 + TCL_INTEGER_SPACE];
     int channelId;
+    DWORD id;
     PipeInfo *infoPtr = (PipeInfo *) ckalloc((unsigned) sizeof(PipeInfo));
 
-    if (!initialized) {
-       PipeInit();
-    }
+    PipeInit();
 
     infoPtr->watchMask = 0;
     infoPtr->flags = 0;
+    infoPtr->readFlags = 0;
     infoPtr->readFile = readFile;
     infoPtr->writeFile = writeFile;
     infoPtr->errorFile = errorFile;
     infoPtr->numPids = numPids;
     infoPtr->pidPtr = pidPtr;
-
-    /* CYGNUS LOCAL: Mutex for flags.  */
-    infoPtr->flagsMutex = CreateMutex(NULL, FALSE, NULL);
+    infoPtr->writeBuf = 0;
+    infoPtr->writeBufLen = 0;
+    infoPtr->writeError = 0;
 
     /*
      * Use one of the fds associated with the channel as the
@@ -1925,13 +1633,7 @@ TclpCreateCommandChannel(readFile, writeFile, errorFile, numPids, pidPtr)
      */
 
     if (readFile) {
-       WinPipe *pipePtr = (WinPipe *) readFile;
-       if (pipePtr->file.type == WIN32S_PIPE
-               && pipePtr->file.handle == INVALID_HANDLE_VALUE) {
-           pipePtr->file.handle = CreateFile(pipePtr->fileName, GENERIC_READ,
-                   0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
-       }
-       channelId = (int) pipePtr->file.handle;
+       channelId = (int) ((WinFile*)readFile)->handle;
     } else if (writeFile) {
        channelId = (int) ((WinFile*)writeFile)->handle;
     } else if (errorFile) {
@@ -1941,10 +1643,33 @@ TclpCreateCommandChannel(readFile, writeFile, errorFile, numPids, pidPtr)
     }
 
     infoPtr->validMask = 0;
+
+    infoPtr->threadId = Tcl_GetCurrentThread();
+
     if (readFile != NULL) {
+       /*
+        * Start the background reader thread.
+        */
+
+       infoPtr->readable = CreateEvent(NULL, TRUE, TRUE, NULL);
+       infoPtr->startReader = CreateEvent(NULL, FALSE, FALSE, NULL);
+       infoPtr->readThread = CreateThread(NULL, 8000, PipeReaderThread,
+               infoPtr, 0, &id);
+       SetThreadPriority(infoPtr->readThread, THREAD_PRIORITY_HIGHEST); 
         infoPtr->validMask |= TCL_READABLE;
+    } else {
+       infoPtr->readThread = 0;
     }
     if (writeFile != NULL) {
+       /*
+        * Start the background writeer thwrite.
+        */
+
+       infoPtr->writable = CreateEvent(NULL, TRUE, TRUE, NULL);
+       infoPtr->startWriter = CreateEvent(NULL, FALSE, FALSE, NULL);
+       infoPtr->writeThread = CreateThread(NULL, 8000, PipeWriterThread,
+               infoPtr, 0, &id);
+       SetThreadPriority(infoPtr->readThread, THREAD_PRIORITY_HIGHEST); 
         infoPtr->validMask |= TCL_WRITABLE;
     }
 
@@ -1952,9 +1677,11 @@ TclpCreateCommandChannel(readFile, writeFile, errorFile, numPids, pidPtr)
      * For backward compatibility with previous versions of Tcl, we
      * use "file%d" as the base name for pipes even though it would
      * be more natural to use "pipe%d".
+     * Use the pointer to keep the channel names unique, in case
+     * channels share handles (stdin/stdout).
      */
 
-    sprintf(channelName, "file%d", channelId);
+    wsprintfA(channelName, "file%lx", infoPtr);
     infoPtr->channel = Tcl_CreateChannel(&pipeChannelType, channelName,
             (ClientData) infoPtr, infoPtr->validMask);
 
@@ -1977,26 +1704,26 @@ TclpCreateCommandChannel(readFile, writeFile, errorFile, numPids, pidPtr)
  * TclGetAndDetachPids --
  *
  *     Stores a list of the command PIDs for a command channel in
- *     interp->result.
+ *     the interp's result.
  *
  * Results:
  *     None.
  *
  * Side effects:
- *     Modifies interp->result.
+ *     Modifies the interp's result.
  *
  *----------------------------------------------------------------------
  */
 
 void
-TclGetAndDetachPids(interp, chan)
-    Tcl_Interp *interp;
-    Tcl_Channel chan;
+TclGetAndDetachPids(
+    Tcl_Interp *interp,
+    Tcl_Channel chan)
 {
     PipeInfo *pipePtr;
     Tcl_ChannelType *chanTypePtr;
     int i;
-    char buf[20];
+    char buf[TCL_INTEGER_SPACE];
 
     /*
      * Punt if the channel is not a command channel.
@@ -2009,7 +1736,7 @@ TclGetAndDetachPids(interp, chan)
 
     pipePtr = (PipeInfo *) Tcl_GetChannelInstanceData(chan);
     for (i = 0; i < pipePtr->numPids; i++) {
-        sprintf(buf, "%lu", TclpGetPid(pipePtr->pidPtr[i]));
+        wsprintfA(buf, "%lu", TclpGetPid(pipePtr->pidPtr[i]));
         Tcl_AppendElement(interp, buf);
         Tcl_DetachPids(1, &(pipePtr->pidPtr[i]));
     }
@@ -2036,9 +1763,9 @@ TclGetAndDetachPids(interp, chan)
  */
 
 static int
-PipeBlockModeProc(instanceData, mode)
-    ClientData instanceData;   /* Instance data for channel. */
-    int mode;                  /* TCL_MODE_BLOCKING or
+PipeBlockModeProc(
+    ClientData instanceData,   /* Instance data for channel. */
+    int mode)                  /* TCL_MODE_BLOCKING or
                                  * TCL_MODE_NONBLOCKING. */
 {
     PipeInfo *infoPtr = (PipeInfo *) instanceData;
@@ -2051,9 +1778,9 @@ PipeBlockModeProc(instanceData, mode)
      */
 
     if (mode == TCL_MODE_NONBLOCKING) {
-       PipeSetFlag(infoPtr, PIPE_ASYNC);
+       infoPtr->flags |= PIPE_ASYNC;
     } else {
-       PipeResetFlag(infoPtr, PIPE_ASYNC);
+       infoPtr->flags &= ~(PIPE_ASYNC);
     }
     return 0;
 }
@@ -2061,7 +1788,7 @@ PipeBlockModeProc(instanceData, mode)
 /*
  *----------------------------------------------------------------------
  *
- * PipeCloseProc --
+ * PipeClose2Proc --
  *
  *     Closes a pipe based IO channel.
  *
@@ -2075,82 +1802,158 @@ PipeBlockModeProc(instanceData, mode)
  */
 
 static int
-PipeCloseProc(instanceData, interp)
-    ClientData instanceData;   /* Pointer to PipeInfo structure. */
-    Tcl_Interp *interp;                /* For error reporting. */
+PipeClose2Proc(
+    ClientData instanceData,   /* Pointer to PipeInfo structure. */
+    Tcl_Interp *interp,                /* For error reporting. */
+    int flags)                 /* Flags that indicate which side to close. */
 {
     PipeInfo *pipePtr = (PipeInfo *) instanceData;
     Tcl_Channel errChan;
     int errorCode, result;
     PipeInfo *infoPtr, **nextPtrPtr;
+    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
 
-    /*
-     * Remove the file from the list of watched files.
-     */
+    errorCode = 0;
+    if ((!flags || (flags == TCL_CLOSE_READ))
+           && (pipePtr->readFile != NULL)) {
+       /*
+        * Clean up the background thread if necessary.  Note that this
+        * must be done before we can close the file, since the 
+        * thread may be blocking trying to read from the pipe.
+        */
 
-    for (nextPtrPtr = &firstPipePtr, infoPtr = *nextPtrPtr; infoPtr != NULL;
-           nextPtrPtr = &infoPtr->nextPtr, infoPtr = *nextPtrPtr) {
-       if (infoPtr == (PipeInfo *)pipePtr) {
-           *nextPtrPtr = infoPtr->nextPtr;
-           break;
-       }
-    }
+       if (pipePtr->readThread) {
+           /*
+            * Forcibly terminate the background thread.  We cannot rely on the
+            * thread to cleanly terminate itself because we have no way of
+            * closing the pipe handle without blocking in the case where the
+            * thread is in the middle of an I/O operation.  Note that we need
+            * to guard against terminating the thread while it is in the
+            * middle of Tcl_ThreadAlert because it won't be able to release
+            * the notifier lock.
+            */
 
-    errorCode = 0;
-    if (pipePtr->readFile != NULL) {
+           Tcl_MutexLock(&pipeMutex);
+           TerminateThread(pipePtr->readThread, 0);
+
+           /*
+            * Wait for the thread to terminate.  This ensures that we are
+            * completely cleaned up before we leave this function. 
+            */
+
+           WaitForSingleObject(pipePtr->readThread, INFINITE);
+           Tcl_MutexUnlock(&pipeMutex);
+
+           CloseHandle(pipePtr->readThread);
+           CloseHandle(pipePtr->readable);
+           CloseHandle(pipePtr->startReader);
+           pipePtr->readThread = NULL;
+       }
        if (TclpCloseFile(pipePtr->readFile) != 0) {
            errorCode = errno;
        }
+       pipePtr->validMask &= ~TCL_READABLE;
+       pipePtr->readFile = NULL;
     }
-    if (pipePtr->writeFile != NULL) {
+    if ((!flags || (flags & TCL_CLOSE_WRITE))
+           && (pipePtr->writeFile != NULL)) {
+       /*
+        * Wait for the writer thread to finish the current buffer, then
+        * terminate the thread and close the handles.  If the channel is
+        * nonblocking, there should be no pending write operations.
+        */
+
+       if (pipePtr->writeThread) {
+           WaitForSingleObject(pipePtr->writable, INFINITE);
+
+           /*
+            * Forcibly terminate the background thread.  We cannot rely on the
+            * thread to cleanly terminate itself because we have no way of
+            * closing the pipe handle without blocking in the case where the
+            * thread is in the middle of an I/O operation.  Note that we need
+            * to guard against terminating the thread while it is in the
+            * middle of Tcl_ThreadAlert because it won't be able to release
+            * the notifier lock.
+            */
+
+           Tcl_MutexLock(&pipeMutex);
+           TerminateThread(pipePtr->writeThread, 0);
+
+           /*
+            * Wait for the thread to terminate.  This ensures that we are
+            * completely cleaned up before we leave this function. 
+            */
+
+           WaitForSingleObject(pipePtr->writeThread, INFINITE);
+           Tcl_MutexUnlock(&pipeMutex);
+
+
+           CloseHandle(pipePtr->writeThread);
+           CloseHandle(pipePtr->writable);
+           CloseHandle(pipePtr->startWriter);
+           pipePtr->writeThread = NULL;
+       }
        if (TclpCloseFile(pipePtr->writeFile) != 0) {
            if (errorCode == 0) {
                errorCode = errno;
            }
        }
+       pipePtr->validMask &= ~TCL_WRITABLE;
+       pipePtr->writeFile = NULL;
     }
-    
+
+    pipePtr->watchMask &= pipePtr->validMask;
+
+    /*
+     * Don't free the channel if any of the flags were set.
+     */
+
+    if (flags) {
+       return errorCode;
+    }
+
+    /*
+     * Remove the file from the list of watched files.
+     */
+
+    for (nextPtrPtr = &(tsdPtr->firstPipePtr), infoPtr = *nextPtrPtr;
+           infoPtr != NULL;
+           nextPtrPtr = &infoPtr->nextPtr, infoPtr = *nextPtrPtr) {
+       if (infoPtr == (PipeInfo *)pipePtr) {
+           *nextPtrPtr = infoPtr->nextPtr;
+           break;
+       }
+    }
+
     /*
      * Wrap the error file into a channel and give it to the cleanup
-     * routine.  If we are running in Win32s, just delete the error file
-     * immediately, because it was never used.
+     * routine.
      */
 
     if (pipePtr->errorFile) {
        WinFile *filePtr;
-       OSVERSIONINFO os;
 
-       os.dwOSVersionInfoSize = sizeof(os);
-       GetVersionEx(&os);
-       if (os.dwPlatformId == VER_PLATFORM_WIN32s) {
-           TclpCloseFile(pipePtr->errorFile);
-           errChan = NULL;
-       } else {
-           filePtr = (WinFile*)pipePtr->errorFile;
-           errChan = Tcl_MakeFileChannel((ClientData) filePtr->handle,
-                   TCL_READABLE);
-       }
+       filePtr = (WinFile*)pipePtr->errorFile;
+       errChan = Tcl_MakeFileChannel((ClientData) filePtr->handle,
+               TCL_READABLE);
+       ckfree((char *) filePtr);
     } else {
         errChan = NULL;
     }
+
     result = TclCleanupChildren(interp, pipePtr->numPids, pipePtr->pidPtr,
             errChan);
+
     if (pipePtr->numPids > 0) {
         ckfree((char *) pipePtr->pidPtr);
     }
 
-    /* CYGNUS LOCAL: If the pipe has a thread, let the thread free the
-       structure.  */
-    if (PipeGetFlags(pipePtr) & PIPE_HAS_THREAD) {
-       WaitForSingleObject(pipePtr->flagsMutex, INFINITE);
-       pipePtr->flags |= PIPE_CLOSED;
-       SetEvent(pipePtr->tryReadEvent);
-       ReleaseMutex(pipePtr->flagsMutex);
-    } else {
-       CloseHandle(pipePtr->flagsMutex);
-       ckfree((char*) pipePtr);
+    if (pipePtr->writeBuf != NULL) {
+       ckfree(pipePtr->writeBuf);
     }
 
+    ckfree((char*) pipePtr);
+
     if (errorCode == 0) {
         return result;
     }
@@ -2176,107 +1979,75 @@ PipeCloseProc(instanceData, interp)
  */
 
 static int
-PipeInputProc(instanceData, buf, bufSize, errorCode)
-    ClientData instanceData;           /* Pipe state. */
-    char *buf;                         /* Where to store data read. */
-    int bufSize;                       /* How much space is available
+PipeInputProc(
+    ClientData instanceData,           /* Pipe state. */
+    char *buf,                         /* Where to store data read. */
+    int bufSize,                       /* How much space is available
                                          * in the buffer? */
-    int *errorCode;                    /* Where to store error code. */
+    int *errorCode)                    /* Where to store error code. */
 {
     PipeInfo *infoPtr = (PipeInfo *) instanceData;
     WinFile *filePtr = (WinFile*) infoPtr->readFile;
-    DWORD count;
-    DWORD bytesRead;
-    int gotReadAhead = 0;
-    int origBufSize = bufSize;
+    DWORD count, bytesRead = 0;
+    int result;
+
+    *errorCode = 0;
+    /*
+     * Synchronize with the reader thread.
+     */
+
+    result = WaitForRead(infoPtr, (infoPtr->flags & PIPE_ASYNC) ? 0 : 1);
+
+    /*
+     * If an error occurred, return immediately.
+     */
 
-    /* CYGNUS LOCAL: If the pipe has a thread, lock it.  */
-    if (PipeGetFlags(infoPtr) & PIPE_HAS_THREAD) {
-       WaitForSingleObject(infoPtr->mutex, INFINITE);
+    if (result == -1) {
+       *errorCode = errno;
+       return -1;
     }
 
-    *errorCode = 0;
-    if (filePtr->type == WIN32S_PIPE) {
-       if (((WinPipe *)filePtr)->otherPtr != NULL) {
-           panic("PipeInputProc: child process isn't finished writing");
-       }
-       if (filePtr->handle == INVALID_HANDLE_VALUE) {
-           filePtr->handle = CreateFile(((WinPipe *)filePtr)->fileName,
-                   GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL,
-                   NULL);
-       }
-       if (filePtr->handle == INVALID_HANDLE_VALUE) {
-           goto error;
-       }
-    } else {
+    if (infoPtr->readFlags & PIPE_EXTRABYTE) {
        /*
-        * Pipes will block until the requested number of bytes has been
-        * read.  To avoid blocking unnecessarily, we look ahead and only
-        * read as much as is available.
+        * The reader thread consumed 1 byte as a side effect of
+        * waiting so we need to move it into the buffer.
         */
 
-       if (PeekNamedPipe(filePtr->handle, (LPVOID) NULL, (DWORD) 0,
-               (LPDWORD) NULL, &count, (LPDWORD) NULL) == TRUE) {
-           if ((count != 0) && ((DWORD) bufSize > count)) {
-               bufSize = (int) count;
+       *buf = infoPtr->extraByte;
+       infoPtr->readFlags &= ~PIPE_EXTRABYTE;
+       buf++;
+       bufSize--;
+       bytesRead = 1;
 
-               /*
-                * This code is commented out because on Win95 we don't get
-                * notifier of eof on a pipe unless we try to read it.
-                * The correct solution is to move to threads.
-                */
-
-/*         } else if ((count == 0) && (PipeGetFlags(infoPtr) & PIPE_ASYNC)) { */
-/*             errno = *errorCode = EAGAIN; */
-/*             return -1; */
-           } else if ((count == 0) && !(PipeGetFlags(infoPtr) & PIPE_ASYNC)) {
-               bufSize = 1;
-           }
-       } else {
-           goto error;
-       }
-    }
+       /*
+        * If further read attempts would block, return what we have.
+        */
 
-    /* CYGNUS LOCAL: Check for the readahead byte.  */
-    if (PipeGetFlags(infoPtr) & PIPE_READAHEAD) {
-       *buf++ = infoPtr->readAhead;
-       PipeResetFlag(infoPtr, PIPE_READAHEAD);
-       if (bufSize <= 1) {
-           PipeResetFlag(infoPtr, PIPE_READABLE);
-           ReleaseMutex(infoPtr->mutex);
-           return 1;
-       }
-       gotReadAhead = 1;
-       if (bufSize == origBufSize) {
-           --bufSize;
+       if (result == 0) {
+           return bytesRead;
        }
     }
 
     /*
-     * Note that we will block on reads from a console buffer until a
-     * full line has been entered.  The only way I know of to get
-     * around this is to write a console driver.  We should probably
-     * do this at some point, but for now, we just block.
+     * Attempt to read bufSize bytes.  The read will return immediately
+     * if there is any data available.  Otherwise it will block until
+     * at least one byte is available or an EOF occurs.
      */
 
-    if (ReadFile(filePtr->handle, (LPVOID) buf, (DWORD) bufSize, &bytesRead,
-            (LPOVERLAPPED) NULL) == FALSE) {
-       goto error;
-    }
-    
-    if (PipeGetFlags(infoPtr) & PIPE_HAS_THREAD) {
-       PipeResetFlag(infoPtr, PIPE_READABLE);
-       ReleaseMutex(infoPtr->mutex);
-    }
+    if (ReadFile(filePtr->handle, (LPVOID) buf, (DWORD) bufSize, &count,
+           (LPOVERLAPPED) NULL) == TRUE) {
+       return bytesRead + count;
+    } else if (bytesRead) {
+       /*
+        * Ignore errors if we have data to return.
+        */
 
-    return bytesRead + gotReadAhead;
+       return bytesRead;
+    }
 
-    error:
     TclWinConvertError(GetLastError());
-    if (PipeGetFlags(infoPtr) & PIPE_HAS_THREAD) {
-       ReleaseMutex(infoPtr->mutex);
-    }
     if (errno == EPIPE) {
+       infoPtr->readFlags |= PIPE_EOF;
        return 0;
     }
     *errorCode = errno;
@@ -2302,27 +2073,78 @@ PipeInputProc(instanceData, buf, bufSize, errorCode)
  */
 
 static int
-PipeOutputProc(instanceData, buf, toWrite, errorCode)
-    ClientData instanceData;           /* Pipe state. */
-    char *buf;                         /* The data buffer. */
-    int toWrite;                       /* How many bytes to write? */
-    int *errorCode;                    /* Where to store error code. */
+PipeOutputProc(
+    ClientData instanceData,           /* Pipe state. */
+    char *buf,                         /* The data buffer. */
+    int toWrite,                       /* How many bytes to write? */
+    int *errorCode)                    /* Where to store error code. */
 {
     PipeInfo *infoPtr = (PipeInfo *) instanceData;
     WinFile *filePtr = (WinFile*) infoPtr->writeFile;
-    DWORD bytesWritten;
+    DWORD bytesWritten, timeout;
     
     *errorCode = 0;
-    if (WriteFile(filePtr->handle, (LPVOID) buf, (DWORD) toWrite,
-           &bytesWritten, (LPOVERLAPPED) NULL) == FALSE) {
-        TclWinConvertError(GetLastError());
-        if (errno == EPIPE) {
-            return 0;
-        }
-        *errorCode = errno;
-        return -1;
+    timeout = (infoPtr->flags & PIPE_ASYNC) ? 0 : INFINITE;
+    if (WaitForSingleObject(infoPtr->writable, timeout) == WAIT_TIMEOUT) {
+       /*
+        * The writer thread is blocked waiting for a write to complete
+        * and the channel is in non-blocking mode.
+        */
+
+       errno = EAGAIN;
+       goto error;
+    }
+    
+    /*
+     * Check for a background error on the last write.
+     */
+
+    if (infoPtr->writeError) {
+       TclWinConvertError(infoPtr->writeError);
+       infoPtr->writeError = 0;
+       goto error;
+    }
+
+    if (infoPtr->flags & PIPE_ASYNC) {
+       /*
+        * The pipe is non-blocking, so copy the data into the output
+        * buffer and restart the writer thread.
+        */
+
+       if (toWrite > infoPtr->writeBufLen) {
+           /*
+            * Reallocate the buffer to be large enough to hold the data.
+            */
+
+           if (infoPtr->writeBuf) {
+               ckfree(infoPtr->writeBuf);
+           }
+           infoPtr->writeBufLen = toWrite;
+           infoPtr->writeBuf = ckalloc(toWrite);
+       }
+       memcpy(infoPtr->writeBuf, buf, toWrite);
+       infoPtr->toWrite = toWrite;
+       ResetEvent(infoPtr->writable);
+       SetEvent(infoPtr->startWriter);
+       bytesWritten = toWrite;
+    } else {
+       /*
+        * In the blocking case, just try to write the buffer directly.
+        * This avoids an unnecessary copy.
+        */
+
+       if (WriteFile(filePtr->handle, (LPVOID) buf, (DWORD) toWrite,
+               &bytesWritten, (LPOVERLAPPED) NULL) == FALSE) {
+           TclWinConvertError(GetLastError());
+           goto error;
+       }
     }
     return bytesWritten;
+
+    error:
+    *errorCode = errno;
+    return -1;
+
 }
 \f
 /*
@@ -2347,16 +2169,16 @@ PipeOutputProc(instanceData, buf, toWrite, errorCode)
  */
 
 static int
-PipeEventProc(evPtr, flags)
-    Tcl_Event *evPtr;          /* Event to service. */
-    int flags;                 /* Flags that indicate what events to
+PipeEventProc(
+    Tcl_Event *evPtr,          /* Event to service. */
+    int flags)                 /* Flags that indicate what events to
                                 * handle, such as TCL_FILE_EVENTS. */
 {
     PipeEvent *pipeEvPtr = (PipeEvent *)evPtr;
     PipeInfo *infoPtr;
     WinFile *filePtr;
     int mask;
-/*    DWORD count;*/
+    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
 
     if (!(flags & TCL_FILE_EVENTS)) {
        return 0;
@@ -2369,9 +2191,10 @@ PipeEventProc(evPtr, flags)
      * event is in the queue.
      */
 
-    for (infoPtr = firstPipePtr; infoPtr != NULL; infoPtr = infoPtr->nextPtr) {
+    for (infoPtr = tsdPtr->firstPipePtr; infoPtr != NULL;
+           infoPtr = infoPtr->nextPtr) {
        if (pipeEvPtr->infoPtr == infoPtr) {
-           PipeResetFlag(infoPtr, PIPE_PENDING);
+           infoPtr->flags &= ~(PIPE_PENDING);
            break;
        }
     }
@@ -2385,42 +2208,26 @@ PipeEventProc(evPtr, flags)
     }
 
     /*
-     * If we aren't on Win32s, check to see if the pipe is readable.  Note
+     * Check to see if the pipe is readable.  Note
      * that we can't tell if a pipe is writable, so we always report it
-     * as being writable.
+     * as being writable unless we have detected EOF.
      */
 
-    filePtr = (WinFile*) ((PipeInfo*)infoPtr)->readFile;
-    if (filePtr->type != WIN32S_PIPE) {
+    filePtr = (WinFile*) ((PipeInfo*)infoPtr)->writeFile;
+    mask = 0;
+    if ((infoPtr->watchMask & TCL_WRITABLE) &&
+           (WaitForSingleObject(infoPtr->writable, 0) != WAIT_TIMEOUT)) {
+       mask = TCL_WRITABLE;
+    }
 
-       /* CYGNUS LOCAL: Check PIPE_READABLE if we have a thread.  */
-       if (PipeGetFlags(infoPtr) & PIPE_HAS_THREAD) {
-           mask = TCL_WRITABLE;
-           if (PipeGetFlags(infoPtr) & PIPE_READABLE) {
-               mask |= TCL_READABLE;
-           }
+    filePtr = (WinFile*) ((PipeInfo*)infoPtr)->readFile;
+    if ((infoPtr->watchMask & TCL_READABLE) &&
+           (WaitForRead(infoPtr, 0) >= 0)) {
+       if (infoPtr->readFlags & PIPE_EOF) {
+           mask = TCL_READABLE;
        } else {
-           mask = TCL_WRITABLE|TCL_READABLE;
+           mask |= TCL_READABLE;
        }
-
-/*     if (PeekNamedPipe(filePtr->handle, (LPVOID) NULL, (DWORD) 0, */
-/*             (LPDWORD) NULL, &count, (LPDWORD) NULL) == TRUE) { */
-/*         if (count != 0) { */
-/*             mask |= TCL_READABLE; */
-/*         } */
-/*     } else { */
-
-           /*
-            * If the pipe has been closed by the other side, then 
-            * mark the pipe as readable, but not writable.
-            */
-
-/*         if (GetLastError() == ERROR_BROKEN_PIPE) { */
-/*             mask = TCL_READABLE; */
-/*         } */
-/*     } */
-    } else {
-       mask = TCL_READABLE | TCL_WRITABLE;
     }
 
     /*
@@ -2449,41 +2256,29 @@ PipeEventProc(evPtr, flags)
  */
 
 static void
-PipeWatchProc(instanceData, mask)
-    ClientData instanceData;           /* Pipe state. */
-    int mask;                          /* What events to watch for; OR-ed
+PipeWatchProc(
+    ClientData instanceData,           /* Pipe state. */
+    int mask)                          /* What events to watch for, OR-ed
                                          * combination of TCL_READABLE,
                                          * TCL_WRITABLE and TCL_EXCEPTION. */
 {
     PipeInfo **nextPtrPtr, *ptr;
     PipeInfo *infoPtr = (PipeInfo *) instanceData;
     int oldMask = infoPtr->watchMask;
+    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
 
     /*
-     * For now, we just send a message to ourselves so we can poll the
-     * channel for readable events.
+     * Since most of the work is handled by the background threads,
+     * we just need to update the watchMask and then force the notifier
+     * to poll once. 
      */
 
     infoPtr->watchMask = mask & infoPtr->validMask;
     if (infoPtr->watchMask) {
        Tcl_Time blockTime = { 0, 0 };
-
-       /* CYGNUS LOCAL: Set up a thread if necessary.  */
-       if ((infoPtr->watchMask & TCL_READABLE) != 0
-           && (PipeGetFlags(infoPtr) & PIPE_HAS_THREAD) == 0) {
-           HANDLE thread;
-           DWORD tid;
-
-           infoPtr->tryReadEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
-           infoPtr->mutex = CreateMutex(NULL, FALSE, NULL);
-           PipeSetFlag(infoPtr, PIPE_HAS_THREAD);
-           thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) PipeThread, infoPtr, 0, &tid);
-           CloseHandle(thread);
-       }
-
        if (!oldMask) {
-           infoPtr->nextPtr = firstPipePtr;
-           firstPipePtr = infoPtr;
+           infoPtr->nextPtr = tsdPtr->firstPipePtr;
+           tsdPtr->firstPipePtr = infoPtr;
        }
        Tcl_SetMaxBlockTime(&blockTime);
     } else {
@@ -2492,7 +2287,7 @@ PipeWatchProc(instanceData, mask)
             * Remove the pipe from the list of watched pipes.
             */
 
-           for (nextPtrPtr = &firstPipePtr, ptr = *nextPtrPtr;
+           for (nextPtrPtr = &(tsdPtr->firstPipePtr), ptr = *nextPtrPtr;
                 ptr != NULL;
                 nextPtrPtr = &ptr->nextPtr, ptr = *nextPtrPtr) {
                if (infoPtr == ptr) {
@@ -2523,26 +2318,16 @@ PipeWatchProc(instanceData, mask)
  */
 
 static int
-PipeGetHandleProc(instanceData, direction, handlePtr)
-    ClientData instanceData;   /* The pipe state. */
-    int direction;             /* TCL_READABLE or TCL_WRITABLE */
-    ClientData *handlePtr;     /* Where to store the handle.  */
+PipeGetHandleProc(
+    ClientData instanceData,   /* The pipe state. */
+    int direction,             /* TCL_READABLE or TCL_WRITABLE */
+    ClientData *handlePtr)     /* Where to store the handle.  */
 {
     PipeInfo *infoPtr = (PipeInfo *) instanceData;
     WinFile *filePtr; 
 
     if (direction == TCL_READABLE && infoPtr->readFile) {
        filePtr = (WinFile*) infoPtr->readFile;
-       if (filePtr->type == WIN32S_PIPE) {
-           if (filePtr->handle == INVALID_HANDLE_VALUE) {
-               filePtr->handle = CreateFile(((WinPipe *)filePtr)->fileName,
-                       GENERIC_READ, 0, NULL, OPEN_ALWAYS,
-                       FILE_ATTRIBUTE_NORMAL, NULL);
-           }
-           if (filePtr->handle == INVALID_HANDLE_VALUE) {
-               return TCL_ERROR;
-           }
-       }
        *handlePtr = (ClientData) filePtr->handle;
        return TCL_OK;
     }
@@ -2574,19 +2359,17 @@ PipeGetHandleProc(instanceData, direction, handlePtr)
  */
 
 Tcl_Pid
-Tcl_WaitPid(pid, statPtr, options)
-    Tcl_Pid pid;
-    int *statPtr;
-    int options;
+Tcl_WaitPid(
+    Tcl_Pid pid,
+    int *statPtr,
+    int options)
 {
     ProcInfo *infoPtr, **prevPtrPtr;
     int flags;
     Tcl_Pid result;
     DWORD ret;
 
-    if (!initialized) {
-       PipeInit();
-    }
+    PipeInit();
 
     /*
      * If no pid is specified, do nothing.
@@ -2601,6 +2384,7 @@ Tcl_WaitPid(pid, statPtr, options)
      * Find the process on the process list.
      */
 
+    Tcl_MutexLock(&pipeMutex);
     prevPtrPtr = &procList;
     for (infoPtr = procList; infoPtr != NULL;
            prevPtrPtr = &infoPtr->nextPtr, infoPtr = infoPtr->nextPtr) {
@@ -2608,12 +2392,13 @@ Tcl_WaitPid(pid, statPtr, options)
            break;
        }
     }
+    Tcl_MutexUnlock(&pipeMutex);
 
     /*
      * If the pid is not one of the processes we know about (we started it)
      * then do nothing.
      */
-    
+                    
     if (infoPtr == NULL) {
         *statPtr = 0;
        return 0;
@@ -2643,11 +2428,11 @@ Tcl_WaitPid(pid, statPtr, options)
        /* A cygwin program that exits because of a signal will set
            the exit status to 0x10000 | (sig << 8).  Fix that back
            into a standard Unix wait status.  */
-       if ((*statPtr & 0x10000) != 0
-           && (*statPtr & 0xff00) != 0
-           && (*statPtr & ~ 0x1ff00) == 0) {
-           *statPtr = (*statPtr >> 8) & 0xff;
-       } else
+       if ((*statPtr & 0x10000) != 0
+           && (*statPtr & 0xff00) != 0
+           && (*statPtr & ~ 0x1ff00) == 0) {
+           *statPtr = (*statPtr >> 8) & 0xff;
+       } else
 #endif
        *statPtr = ((*statPtr << 8) & 0xff00);
        result = pid;
@@ -2671,6 +2456,38 @@ Tcl_WaitPid(pid, statPtr, options)
 /*
  *----------------------------------------------------------------------
  *
+ * TclWinAddProcess --
+ *
+ *     Add a process to the process list so that we can use
+ *     Tcl_WaitPid on the process.
+ *
+ * Results:
+ *     None
+ *
+ * Side effects:
+ *     Adds the specified process handle to the process list so
+ *     Tcl_WaitPid knows about it.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TclWinAddProcess(hProcess, id)
+    HANDLE hProcess;           /* Handle to process */
+    DWORD id;                  /* Global process identifier */
+{
+    ProcInfo *procPtr = (ProcInfo *) ckalloc(sizeof(ProcInfo));
+    procPtr->hProcess = hProcess;
+    procPtr->dwProcessId = id;
+    Tcl_MutexLock(&pipeMutex);
+    procPtr->nextPtr = procList;
+    procList = procPtr;
+    Tcl_MutexUnlock(&pipeMutex);
+}
+\f
+/*
+ *----------------------------------------------------------------------
+ *
  * Tcl_PidObjCmd --
  *
  *     This procedure is invoked to process the "pid" Tcl command.
@@ -2687,18 +2504,18 @@ Tcl_WaitPid(pid, statPtr, options)
 
        /* ARGSUSED */
 int
-Tcl_PidObjCmd(dummy, interp, objc, objv)
-    ClientData dummy;          /* Not used. */
-    Tcl_Interp *interp;                /* Current interpreter. */
-    int objc;                  /* Number of arguments. */
-    Tcl_Obj *CONST *objv;      /* Argument strings. */
+Tcl_PidObjCmd(
+    ClientData dummy,          /* Not used. */
+    Tcl_Interp *interp,                /* Current interpreter. */
+    int objc,                  /* Number of arguments. */
+    Tcl_Obj *CONST *objv)      /* Argument strings. */
 {
     Tcl_Channel chan;
     Tcl_ChannelType *chanTypePtr;
     PipeInfo *pipePtr;
     int i;
     Tcl_Obj *resultPtr;
-    char buf[20];
+    char buf[TCL_INTEGER_SPACE];
 
     if (objc > 2) {
        Tcl_WrongNumArgs(interp, 1, objv, "?channelId?");
@@ -2706,7 +2523,7 @@ Tcl_PidObjCmd(dummy, interp, objc, objv)
     }
     if (objc == 1) {
        resultPtr = Tcl_GetObjResult(interp);
-       sprintf(buf, "%lu", (unsigned long) getpid());
+       wsprintfA(buf, "%lu", (unsigned long) getpid());
        Tcl_SetStringObj(resultPtr, buf, -1);
     } else {
         chan = Tcl_GetChannel(interp, Tcl_GetStringFromObj(objv[1], NULL),
@@ -2722,10 +2539,305 @@ Tcl_PidObjCmd(dummy, interp, objc, objv)
         pipePtr = (PipeInfo *) Tcl_GetChannelInstanceData(chan);
        resultPtr = Tcl_GetObjResult(interp);
         for (i = 0; i < pipePtr->numPids; i++) {
-           sprintf(buf, "%lu", TclpGetPid(pipePtr->pidPtr[i]));
+           wsprintfA(buf, "%lu", TclpGetPid(pipePtr->pidPtr[i]));
            Tcl_ListObjAppendElement(/*interp*/ NULL, resultPtr,
                    Tcl_NewStringObj(buf, -1));
        }
     }
     return TCL_OK;
 }
+\f
+/*
+ *----------------------------------------------------------------------
+ *
+ * WaitForRead --
+ *
+ *     Wait until some data is available, the pipe is at
+ *     EOF or the reader thread is blocked waiting for data (if the
+ *     channel is in non-blocking mode).
+ *
+ * Results:
+ *     Returns 1 if pipe is readable.  Returns 0 if there is no data
+ *     on the pipe, but there is buffered data.  Returns -1 if an
+ *     error occurred.  If an error occurred, the threads may not
+ *     be synchronized.
+ *
+ * Side effects:
+ *     Updates the shared state flags and may consume 1 byte of data
+ *     from the pipe.  If no error occurred, the reader thread is
+ *     blocked waiting for a signal from the main thread.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WaitForRead(
+    PipeInfo *infoPtr,         /* Pipe state. */
+    int blocking)              /* Indicates whether call should be
+                                * blocking or not. */
+{
+    DWORD timeout, count;
+    HANDLE *handle = ((WinFile *) infoPtr->readFile)->handle;
+
+    while (1) {
+       /*
+        * Synchronize with the reader thread.
+        */
+       
+       timeout = blocking ? INFINITE : 0;
+       if (WaitForSingleObject(infoPtr->readable, timeout) == WAIT_TIMEOUT) {
+           /*
+            * The reader thread is blocked waiting for data and the channel
+            * is in non-blocking mode.
+            */
+
+           errno = EAGAIN;
+           return -1;
+       }
+
+       /*
+        * At this point, the two threads are synchronized, so it is safe
+        * to access shared state.
+        */
+
+
+       /*
+        * If the pipe has hit EOF, it is always readable.
+        */
+
+       if (infoPtr->readFlags & PIPE_EOF) {
+           return 1;
+       }
+    
+       /*
+        * Check to see if there is any data sitting in the pipe.
+        */
+
+       if (PeekNamedPipe(handle, (LPVOID) NULL, (DWORD) 0,
+               (LPDWORD) NULL, &count, (LPDWORD) NULL) != TRUE) {
+           TclWinConvertError(GetLastError());
+           /*
+            * Check to see if the peek failed because of EOF.
+            */
+
+           if (errno == EPIPE) {
+               infoPtr->readFlags |= PIPE_EOF;
+               return 1;
+           }
+
+           /*
+            * Ignore errors if there is data in the buffer.
+            */
+
+           if (infoPtr->readFlags & PIPE_EXTRABYTE) {
+               return 0;
+           } else {
+               return -1;
+           }
+       }
+
+       /*
+        * We found some data in the pipe, so it must be readable.
+        */
+
+       if (count > 0) {
+           return 1;
+       }
+
+       /*
+        * The pipe isn't readable, but there is some data sitting
+        * in the buffer, so return immediately.
+        */
+
+       if (infoPtr->readFlags & PIPE_EXTRABYTE) {
+           return 0;
+       }
+
+       /*
+        * There wasn't any data available, so reset the thread and
+        * try again.
+        */
+    
+       ResetEvent(infoPtr->readable);
+       SetEvent(infoPtr->startReader);
+    }
+}
+\f
+/*
+ *----------------------------------------------------------------------
+ *
+ * PipeReaderThread --
+ *
+ *     This function runs in a separate thread and waits for input
+ *     to become available on a pipe.
+ *
+ * Results:
+ *     None.
+ *
+ * Side effects:
+ *     Signals the main thread when input become available.  May
+ *     cause the main thread to wake up by posting a message.  May
+ *     consume one byte from the pipe for each wait operation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static DWORD WINAPI
+PipeReaderThread(LPVOID arg)
+{
+    PipeInfo *infoPtr = (PipeInfo *)arg;
+    HANDLE *handle = ((WinFile *) infoPtr->readFile)->handle;
+    DWORD count, err;
+    int done = 0;
+
+    while (!done) {
+       /*
+        * Wait for the main thread to signal before attempting to wait.
+        */
+
+       WaitForSingleObject(infoPtr->startReader, INFINITE);
+
+       /*
+        * Try waiting for 0 bytes.  This will block until some data is
+        * available on NT, but will return immediately on Win 95.  So,
+        * if no data is available after the first read, we block until
+        * we can read a single byte off of the pipe.
+        */
+
+       if ((ReadFile(handle, NULL, 0, &count, NULL) == FALSE)
+               || (PeekNamedPipe(handle, NULL, 0, NULL, &count,
+                       NULL) == FALSE)) {
+           /*
+            * The error is a result of an EOF condition, so set the
+            * EOF bit before signalling the main thread.
+            */
+
+           err = GetLastError();
+           if (err == ERROR_BROKEN_PIPE) {
+               infoPtr->readFlags |= PIPE_EOF;
+               done = 1;
+           } else if (err == ERROR_INVALID_HANDLE) {
+               break;
+           }
+       } else if (count == 0) {
+           if (ReadFile(handle, &(infoPtr->extraByte), 1, &count, NULL)
+                   != FALSE) {
+               /*
+                * One byte was consumed as a side effect of waiting
+                * for the pipe to become readable.
+                */
+
+               infoPtr->readFlags |= PIPE_EXTRABYTE;
+           } else {
+               err = GetLastError();
+               if (err == ERROR_BROKEN_PIPE) {
+                   /*
+                    * The error is a result of an EOF condition, so set the
+                    * EOF bit before signalling the main thread.
+                    */
+
+                   infoPtr->readFlags |= PIPE_EOF;
+                   done = 1;
+               } else if (err == ERROR_INVALID_HANDLE) {
+                   break;
+               }
+           }
+       }
+
+               
+       /*
+        * Signal the main thread by signalling the readable event and
+        * then waking up the notifier thread.
+        */
+
+       SetEvent(infoPtr->readable);
+       
+       /*
+        * Alert the foreground thread.  Note that we need to treat this like
+        * a critical section so the foreground thread does not terminate
+        * this thread while we are holding a mutex in the notifier code.
+        */
+
+       Tcl_MutexLock(&pipeMutex);
+       Tcl_ThreadAlert(infoPtr->threadId);
+       Tcl_MutexUnlock(&pipeMutex);
+    }
+    return 0;
+}
+\f
+/*
+ *----------------------------------------------------------------------
+ *
+ * PipeWriterThread --
+ *
+ *     This function runs in a separate thread and writes data
+ *     onto a pipe.
+ *
+ * Results:
+ *     Always returns 0.
+ *
+ * Side effects:
+ *     Signals the main thread when an output operation is completed.
+ *     May cause the main thread to wake up by posting a message.  
+ *
+ *----------------------------------------------------------------------
+ */
+
+static DWORD WINAPI
+PipeWriterThread(LPVOID arg)
+{
+
+    PipeInfo *infoPtr = (PipeInfo *)arg;
+    HANDLE *handle = ((WinFile *) infoPtr->writeFile)->handle;
+    DWORD count, toWrite;
+    char *buf;
+    int done = 0;
+
+    while (!done) {
+       /*
+        * Wait for the main thread to signal before attempting to write.
+        */
+
+       WaitForSingleObject(infoPtr->startWriter, INFINITE);
+
+       buf = infoPtr->writeBuf;
+       toWrite = infoPtr->toWrite;
+
+       /*
+        * Loop until all of the bytes are written or an error occurs.
+        */
+
+       while (toWrite > 0) {
+           if (WriteFile(handle, buf, toWrite, &count, NULL) == FALSE) {
+               infoPtr->writeError = GetLastError();
+               done = 1; 
+               break;
+           } else {
+               toWrite -= count;
+               buf += count;
+           }
+       }
+       
+       /*
+        * Signal the main thread by signalling the writable event and
+        * then waking up the notifier thread.
+        */
+
+       SetEvent(infoPtr->writable);
+
+       /*
+        * Alert the foreground thread.  Note that we need to treat this like
+        * a critical section so the foreground thread does not terminate
+        * this thread while we are holding a mutex in the notifier code.
+        */
+
+       Tcl_MutexLock(&pipeMutex);
+       Tcl_ThreadAlert(infoPtr->threadId);
+       Tcl_MutexUnlock(&pipeMutex);
+    }
+    return 0;
+}
+
+
+
+
index da52797..d5605ef 100644 (file)
@@ -5,7 +5,7 @@
  *     differences between Windows and Unix. It should be the only
  *     file that contains #ifdefs to handle different flavors of OS.
  *
- * Copyright (c) 1994-1996 Sun Microsystems, Inc.
+ * Copyright (c) 1994-1997 Sun Microsystems, Inc.
  *
  * See the file "license.terms" for information on usage and redistribution
  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 #ifndef _TCLWINPORT
 #define _TCLWINPORT
 
-#define WIN32_LEAN_AND_MEAN
-#define __USE_W32_SOCKETS
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
-#include <winsock.h>
+#ifndef _TCLINT
+#   include "tclInt.h"
+#endif
 
-#include <malloc.h>
-#include <stdio.h>
+#ifdef CHECK_UNICODE_CALLS
+
+#define _UNICODE
+#define UNICODE
+
+#define __TCHAR_DEFINED
+typedef float *_TCHAR;
+
+#define _TCHAR_DEFINED
+typedef float *TCHAR;
 
+#endif
+
+/*
+ *---------------------------------------------------------------------------
+ * The following sets of #includes and #ifdefs are required to get Tcl to
+ * compile under the windows compilers.
+ *---------------------------------------------------------------------------
+ */
+
+#include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
+
 #include <errno.h>
+#include <fcntl.h>
+#include <float.h>
+#include <io.h>
+#include <malloc.h>
 #include <process.h>
 #include <signal.h>
+#include <string.h>
+
+/*
+ * Need to block out these includes for building extensions with MetroWerks
+ * compiler for Win32.
+ */
+
+#ifndef __MWERKS__
 #include <sys/stat.h>
 #include <sys/timeb.h>
+#include <sys/utime.h>
+#endif
+
 #include <time.h>
-#include <io.h>
-#include <fcntl.h>
-#include <float.h>
 
-#ifdef _MSC_VER
-#define PASCAL
-#endif
+#include <winsock2.h>
+
+#define WIN32_LEAN_AND_MEAN
+#define __USE_W32_SOCKETS
+#include <windows.h>
+#undef WIN32_LEAN_AND_MEAN
 
 #ifdef BUILD_tcl
 # undef TCL_STORAGE_CLASS
@@ -63,8 +94,8 @@
 #endif
 
 /*
- * The following defines wrap the system memory allocation routines for
- * use by tclAlloc.c.
+ * The following defines redefine the Windows Socket errors as
+ * BSD errors so Tcl_PosixError can do the right thing.
  */
 
 /* On cygwin, we just use the supplied malloc and free, rather than
                                            (DWORD)0, (HGLOBAL)ptr))
 #define TclpSysRealloc(ptr, size)      ((void*)HeapReAlloc(GetProcessHeap(), \
                                            (DWORD)0, (LPVOID)ptr, (DWORD)size))
-#endif
-
-/*
- * The default platform eol translation on Windows is TCL_TRANSLATE_CRLF:
- */
-
-#define        TCL_PLATFORM_TRANSLATION        TCL_TRANSLATE_CRLF
-
-/*
- * Declare dynamic loading extension macro.
- */
 
-#define TCL_SHLIB_EXT ".dll"
+#ifndef EWOULDBLOCK
+#define EWOULDBLOCK             EAGAIN
+#endif
+#ifndef EALREADY
+#define EALREADY       149     /* operation already in progress */
+#endif
+#ifndef ENOTSOCK
+#define ENOTSOCK       95      /* Socket operation on non-socket */
+#endif
+#ifndef EDESTADDRREQ
+#define EDESTADDRREQ   96      /* Destination address required */
+#endif
+#ifndef EMSGSIZE
+#define EMSGSIZE       97      /* Message too long */
+#endif
+#ifndef EPROTOTYPE
+#define EPROTOTYPE     98      /* Protocol wrong type for socket */
+#endif
+#ifndef ENOPROTOOPT
+#define ENOPROTOOPT    99      /* Protocol not available */
+#endif
+#ifndef EPROTONOSUPPORT
+#define EPROTONOSUPPORT        120     /* Protocol not supported */
+#endif
+#ifndef ESOCKTNOSUPPORT
+#define ESOCKTNOSUPPORT        121     /* Socket type not supported */
+#endif
+#ifndef EOPNOTSUPP
+#define EOPNOTSUPP     122     /* Operation not supported on socket */
+#endif
+#ifndef EPFNOSUPPORT
+#define EPFNOSUPPORT   123     /* Protocol family not supported */
+#endif
+#ifndef EAFNOSUPPORT
+#define EAFNOSUPPORT   124     /* Address family not supported */
+#endif
+#ifndef EADDRINUSE
+#define EADDRINUSE     125     /* Address already in use */
+#endif
+#ifndef EADDRNOTAVAIL
+#define EADDRNOTAVAIL  126     /* Can't assign requested address */
+#endif
+#ifndef ENETDOWN
+#define ENETDOWN       127     /* Network is down */
+#endif
+#ifndef ENETUNREACH
+#define ENETUNREACH    128     /* Network is unreachable */
+#endif
+#ifndef ENETRESET
+#define ENETRESET      129     /* Network dropped connection on reset */
+#endif
+#ifndef ECONNABORTED
+#define ECONNABORTED   130     /* Software caused connection abort */
+#endif
+#ifndef ECONNRESET
+#define ECONNRESET     131     /* Connection reset by peer */
+#endif
+#ifndef ENOBUFS
+#define ENOBUFS                132     /* No buffer space available */
+#endif
+#ifndef EISCONN
+#define EISCONN                133     /* Socket is already connected */
+#endif
+#ifndef ENOTCONN
+#define ENOTCONN       134     /* Socket is not connected */
+#endif
+#ifndef ESHUTDOWN
+#define ESHUTDOWN      143     /* Can't send after socket shutdown */
+#endif
+#ifndef ETOOMANYREFS
+#define ETOOMANYREFS   144     /* Too many references: can't splice */
+#endif
+#ifndef ETIMEDOUT
+#define ETIMEDOUT      145     /* Connection timed out */
+#endif
+#ifndef ECONNREFUSED
+#define ECONNREFUSED   146     /* Connection refused */
+#endif
+#ifndef ELOOP
+#define ELOOP          90      /* Symbolic link loop */
+#endif
+#ifndef EHOSTDOWN
+#define EHOSTDOWN      147     /* Host is down */
+#endif
+#ifndef EHOSTUNREACH
+#define EHOSTUNREACH   148     /* No route to host */
+#endif
+#ifndef ENOTEMPTY
+#define ENOTEMPTY      93      /* directory not empty */
+#endif
+#ifndef EUSERS
+#define EUSERS         94      /* Too many users (for UFS) */
+#endif
+#ifndef EDQUOT
+#define EDQUOT         49      /* Disc quota exceeded */
+#endif
+#ifndef ESTALE
+#define ESTALE         151     /* Stale NFS file handle */
+#endif
+#ifndef EREMOTE
+#define EREMOTE                66      /* The object is remote */
+#endif
 
 /*
  * Supply definitions for macros to query wait status, if not already
 #endif
 
 /*
- * Define MAXPATHLEN in terms of MAXPATH if available
+ * Define access mode constants if they aren't already defined.
  */
 
-#ifndef MAXPATH
-#define MAXPATH MAX_PATH
-#endif /* MAXPATH */
-
-#ifndef MAXPATHLEN
-#define MAXPATHLEN MAXPATH
-#endif /* MAXPATHLEN */
-
 #ifndef F_OK
 #    define F_OK 00
 #endif
 # endif
 
 /*
+ * Define MAXPATHLEN in terms of MAXPATH if available
+ */
+
+#ifndef MAXPATH
+#define MAXPATH MAX_PATH
+#endif /* MAXPATH */
+
+#ifndef MAXPATHLEN
+#define MAXPATHLEN MAXPATH
+#endif /* MAXPATHLEN */
+
+/*
  * Define pid_t and uid_t if they're not already defined.
  */
 
 #endif
 
 /*
- * Provide a stub definition for TclGetUserHome().
- */
-
-#define TclGetUserHome(name,bufferPtr) (NULL)
-
-/*
  * Visual C++ has some odd names for common functions, so we need to
  * define a few macros to handle them.  Also, it defines EDEADLOCK and
  * EDEADLK as the same value, which confuses Tcl_ErrnoId().
  */
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
 #    define environ _environ
 #    define hypot _hypot
 #    define exception _exception
 #    undef EDEADLOCK
-#endif /* _MSC_VER */
+#    if defined(__MINGW32__) && !defined(__MSVCRT__)
+#      define timezone _timezone
+#    endif
+#endif /* _MSC_VER || __MINGW32__ */
+
+#ifdef __CYGWIN__
+/* On cygwin32, the environment is imported from the cygwin32 DLL.  */
+__declspec(dllimport) extern char **__cygwin_environ;
+#    define environ __cygwin_environ
+#    define putenv TclCygwinPutenv
+#    define timezone _timezone
+extern int chdir (const char*);
+#endif /* __CYGWIN__ */
 
 /*
- * When building DLLs using GCC on mingw32, we must import environ via 
- * indirection. This hack will eventually go away once GCC understands 
- * dllimport attribute and mingw32 headers are fixed.
+ *---------------------------------------------------------------------------
+ * The following macros and declarations represent the interface between 
+ * generic and windows-specific parts of Tcl.  Some of the macros may 
+ * override functions declared in tclInt.h.
+ *---------------------------------------------------------------------------
  */
 
+
 #ifdef __MINGW32__
      extern char *** __imp__environ_dll;
 #    define environ (*__imp__environ_dll)
 #endif /* __MINGW32__ */
 
 /*
- * The following defines redefine the Windows Socket errors as
- * BSD errors so Tcl_PosixError can do the right thing.
+ * The default platform eol translation on Windows is TCL_TRANSLATE_CRLF:
  */
 
-#ifndef EWOULDBLOCK
-#define EWOULDBLOCK             EAGAIN
-#endif
-#ifndef EALREADY
-#define EALREADY       149     /* operation already in progress */
-#endif
-#ifndef ENOTSOCK
-#define ENOTSOCK       95      /* Socket operation on non-socket */
-#endif
-#ifndef EDESTADDRREQ
-#define EDESTADDRREQ   96      /* Destination address required */
-#endif
-#ifndef EMSGSIZE
-#define EMSGSIZE       97      /* Message too long */
-#endif
-#ifndef EPROTOTYPE
-#define EPROTOTYPE     98      /* Protocol wrong type for socket */
-#endif
-#ifndef ENOPROTOOPT
-#define ENOPROTOOPT    99      /* Protocol not available */
-#endif
-#ifndef EPROTONOSUPPORT
-#define EPROTONOSUPPORT        120     /* Protocol not supported */
-#endif
-#ifndef ESOCKTNOSUPPORT
-#define ESOCKTNOSUPPORT        121     /* Socket type not supported */
-#endif
-#ifndef EOPNOTSUPP
-#define EOPNOTSUPP     122     /* Operation not supported on socket */
-#endif
-#ifndef EPFNOSUPPORT
-#define EPFNOSUPPORT   123     /* Protocol family not supported */
-#endif
-#ifndef EAFNOSUPPORT
-#define EAFNOSUPPORT   124     /* Address family not supported */
-#endif
-#ifndef EADDRINUSE
-#define EADDRINUSE     125     /* Address already in use */
-#endif
-#ifndef EADDRNOTAVAIL
-#define EADDRNOTAVAIL  126     /* Can't assign requested address */
-#endif
-#ifndef ENETDOWN
-#define ENETDOWN       127     /* Network is down */
-#endif
-#ifndef ENETUNREACH
-#define ENETUNREACH    128     /* Network is unreachable */
-#endif
-#ifndef ENETRESET
-#define ENETRESET      129     /* Network dropped connection on reset */
-#endif
-#ifndef ECONNABORTED
-#define ECONNABORTED   130     /* Software caused connection abort */
-#endif
-#ifndef ECONNRESET
-#define ECONNRESET     131     /* Connection reset by peer */
-#endif
-#ifndef ENOBUFS
-#define ENOBUFS                132     /* No buffer space available */
-#endif
-#ifndef EISCONN
-#define EISCONN                133     /* Socket is already connected */
-#endif
-#ifndef ENOTCONN
-#define ENOTCONN       134     /* Socket is not connected */
-#endif
-#ifndef ESHUTDOWN
-#define ESHUTDOWN      143     /* Can't send after socket shutdown */
-#endif
-#ifndef ETOOMANYREFS
-#define ETOOMANYREFS   144     /* Too many references: can't splice */
-#endif
-#ifndef ETIMEDOUT
-#define ETIMEDOUT      145     /* Connection timed out */
-#endif
-#ifndef ECONNREFUSED
-#define ECONNREFUSED   146     /* Connection refused */
-#endif
-#ifndef ELOOP
-#define ELOOP          90      /* Symbolic link loop */
-#endif
-#ifndef EHOSTDOWN
-#define EHOSTDOWN      147     /* Host is down */
-#endif
-#ifndef EHOSTUNREACH
-#define EHOSTUNREACH   148     /* No route to host */
-#endif
-#ifndef ENOTEMPTY
-#define ENOTEMPTY      93      /* directory not empty */
-#endif
-#ifndef EUSERS
-#define EUSERS         94      /* Too many users (for UFS) */
-#endif
-#ifndef EDQUOT
-#define EDQUOT         49      /* Disc quota exceeded */
-#endif
-#ifndef ESTALE
-#define ESTALE         151     /* Stale NFS file handle */
-#endif
-#ifndef EREMOTE
-#define EREMOTE                66      /* The object is remote */
-#endif
+#define        TCL_PLATFORM_TRANSLATION        TCL_TRANSLATE_CRLF
+
+
+/*
+ * Declare dynamic loading extension macro.
+ */
+
+#define TCL_SHLIB_EXT ".dll"
 
 /*
  * The following define ensures that we use the native putenv
  */
 
 #define USE_PUTENV     1
-    
+
+/*
+ * The following defines wrap the system memory allocation routines for
+ * use by tclAlloc.c.
+ */
+
+#define TclpSysAlloc(size, isBin)      ((void*)HeapAlloc(GetProcessHeap(), \
+                                           (DWORD)0, (DWORD)size))
+#define TclpSysFree(ptr)               (HeapFree(GetProcessHeap(), \
+                                           (DWORD)0, (HGLOBAL)ptr))
+#define TclpSysRealloc(ptr, size)      ((void*)HeapReAlloc(GetProcessHeap(), \
+                                           (DWORD)0, (LPVOID)ptr, (DWORD)size))
+
 /*
  * The following defines map from standard socket names to our internal
  * wrappers that redirect through the winSock function table (see the
 #define setsockopt     TclWinSetSockOpt
 
 /*
- * The following implements the Windows method for exiting the process.
+ * The following macros have trivial definitions, allowing generic code to 
+ * address platform-specific issues.
  */
-#define TclPlatformExit(status) exit(status)
 
+#define TclpReleaseFile(file)  ckfree((char *) file)
 
 /*
- * The following declarations belong in tclInt.h, but depend on platform
- * specific types (e.g. struct tm).
+ * The following macros and declarations wrap the C runtime library 
+ * functions.
  */
 
-EXTERN struct tm *     TclpGetDate _ANSI_ARGS_((const time_t *tp,
-                           int useGMT));
-EXTERN unsigned long   TclpGetPid _ANSI_ARGS_((Tcl_Pid pid));
-EXTERN size_t          TclStrftime _ANSI_ARGS_((char *s, size_t maxsize,
-                           const char *format, const struct tm *t));
+#define TclpExit               exit
+#define TclpLstat              TclpStat
 
 /*
- * The following prototypes and defines replace the Windows versions
- * of POSIX function that various compilier vendors didn't implement 
- * well or consistantly.
+ * Declarations for Windows-only functions.
  */
 
-#define lstat          TclStat
+EXTERN Tcl_Channel  TclWinOpenSerialChannel _ANSI_ARGS_((HANDLE handle,
+                        char *channelName, int permissions));
+                                        
+EXTERN Tcl_Channel  TclWinOpenConsoleChannel _ANSI_ARGS_((HANDLE handle,
+                        char *channelName, int permissions));
 
-EXTERN int             TclpStat _ANSI_ARGS_((CONST char *path, 
-                           struct stat *buf));
-EXTERN int             TclpAccess _ANSI_ARGS_((CONST char *path, 
-                           int mode));
+EXTERN Tcl_Channel  TclWinOpenFileChannel _ANSI_ARGS_((HANDLE handle,
+                        char *channelName, int permissions, int appendMode));
 
-#define TclpReleaseFile(file)  ckfree((char *) file)
+EXTERN TclFile TclWinMakeFile _ANSI_ARGS_((HANDLE handle));
 
 /*
- * Declarations for Windows specific functions.
+ * Platform specific mutex definition used by memory allocators.
+ * These mutexes are statically allocated and explicitly initialized.
+ * Most modules do not use this, but instead use Tcl_Mutex types and
+ * Tcl_MutexLock and Tcl_MutexUnlock that are self-initializing.
  */
 
-EXTERN void            TclWinConvertError _ANSI_ARGS_((DWORD errCode));
-EXTERN void            TclWinConvertWSAError _ANSI_ARGS_((DWORD errCode));
-EXTERN struct servent * PASCAL FAR
-                       TclWinGetServByName _ANSI_ARGS_((const char FAR *nm,
-                           const char FAR *proto));
-EXTERN int PASCAL FAR  TclWinGetSockOpt _ANSI_ARGS_((SOCKET s, int level,
-                           int optname, char FAR * optval, int FAR *optlen));
-EXTERN HINSTANCE       TclWinGetTclInstance _ANSI_ARGS_((void));
-EXTERN HINSTANCE       TclWinLoadLibrary _ANSI_ARGS_((char *name));
-EXTERN u_short PASCAL FAR
-                       TclWinNToHS _ANSI_ARGS_((u_short ns));
-EXTERN int PASCAL FAR  TclWinSetSockOpt _ANSI_ARGS_((SOCKET s, int level,
-                           int optname, const char FAR * optval, int optlen));
+#ifdef TCL_THREADS
+typedef CRITICAL_SECTION TclpMutex;
+EXTERN void    TclpMutexInit _ANSI_ARGS_((TclpMutex *mPtr));
+EXTERN void    TclpMutexLock _ANSI_ARGS_((TclpMutex *mPtr));
+EXTERN void    TclpMutexUnlock _ANSI_ARGS_((TclpMutex *mPtr));
+#else
+typedef int TclpMutex;
+#define        TclpMutexInit(a)
+#define        TclpMutexLock(a)
+#define        TclpMutexUnlock(a)
+#endif /* TCL_THREADS */
+
+#include "tclPlatDecls.h"
+#include "tclIntPlatDecls.h"
 
 # undef TCL_STORAGE_CLASS
 # define TCL_STORAGE_CLASS DLLIMPORT
 
 #endif /* _TCLWINPORT */
+