Index: configure.in
===================================================================
RCS file: /cvsroot/tcl/thread/configure.in,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- configure.in	19 Mar 2005 01:39:58 -0000	1.22
+++ configure.in	25 Jul 2005 07:20:00 -0000	1.23
@@ -189,6 +189,8 @@
 TEA_MAKE_LIB
 
 #--------------------------------------------------------------------
+# Determine the name of the tclsh and wish executables in the
+# Tcl and Tk build directories and subst into the Makefile.
 # Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl
 # file during the install process.  Don't run the TCLSH_PROG through
 # ${CYGPATH} because it's being used directly by make.
@@ -197,7 +199,9 @@
 # Add WISH as well if this is a Tk extension.
 #--------------------------------------------------------------------
 
+TEA_BUILD_TCLSH
 TEA_PROG_TCLSH
+#TEA_BUILD_WISH
 #TEA_PROG_WISH
 
 #--------------------------------------------------------------------
Index: Makefile.in
===================================================================
RCS file: /cvsroot/tcl/thread/Makefile.in,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- Makefile.in	19 Mar 2005 01:40:24 -0000	1.23
+++ Makefile.in	25 Jul 2005 07:19:57 -0000	1.24
@@ -130,8 +130,17 @@
 		  @LD_LIBRARY_PATH_VAR@="$(EXTRA_PATH):$(@LD_LIBRARY_PATH_VAR@)" \
 		  PATH="$(EXTRA_PATH):$(PATH)" \
 		  TCLLIBPATH="$(top_builddir) $(top_builddir)/../lib"
-TCLSH_PROG	= @TCLSH_PROG@
-TCLSH		= $(TCLSH_ENV) $(TCLSH_PROG)
+
+# SYSTEM_TCLSH is a version of Tcl that is already installed
+# on the system. It is used to regenerate a pkgIndex.tcl
+# if needed. Note that is never going to be the same as the
+# version of tclsh in the Tcl build dir.
+
+SYSTEM_TCLSH	= @TCLSH_PROG@
+
+BUILD_TCLSH_PROG	= @BUILD_TCLSH@
+BUILD_TCLSH	= $(TCLSH_ENV) $(BUILD_TCLSH_PROG)
+
 SHARED_BUILD	= @SHARED_BUILD@
 
 INCLUDES	= @PKG_INCLUDES@ @TCL_INCLUDES@
@@ -213,13 +222,13 @@
 	done
 
 test: binaries libraries
-	$(TCLSH) `@CYGPATH@ $(srcdir)/tests/all.tcl` $(TESTFLAGS)
+	$(BUILD_TCLSH) `@CYGPATH@ $(srcdir)/tests/all.tcl` $(TESTFLAGS)
 
 shell: binaries libraries
-	@$(TCLSH) $(SCRIPT)
+	@$(BUILD_TCLSH) $(SCRIPT)
 
 gdb:
-	$(TCLSH_ENV) gdb $(TCLSH_PROG) $(SCRIPT)
+	$(TCLSH_ENV) gdb $(BUILD_TCLSH_PROG) $(SCRIPT)
 
 depend:
 
@@ -272,7 +281,7 @@
 #========================================================================
 
 pkgIndex.tcl:
-	( echo pkg_mkIndex . $(PKG_LIB_FILE) \; exit; ) | $(TCLSH)
+	( echo pkg_mkIndex . $(PKG_LIB_FILE) \; exit; ) | $(SYSTEM_TCLSH)
 
 pkgIndex.tcl-hand:
 	(echo 'package ifneeded $(PACKAGE_NAME) $(PACKAGE_VERSION) \
