Index: Makefile.in
===================================================================
RCS file: /cvsroot/tcl/sampleextension/Makefile.in,v
retrieving revision 1.56
diff -u -r1.56 Makefile.in
--- Makefile.in	23 Jun 2005 10:01:46 -0000	1.56
+++ Makefile.in	25 Jul 2005 02:30:46 -0000
@@ -136,10 +136,21 @@
 		  PATH="$(EXTRA_PATH):$(PATH)" \
 		  TCLLIBPATH="$(TCLLIBPATH)"
 #		  TK_LIBRARY=`@CYGPATH@ $(TK_SRC_DIR)/library`
-TCLSH_PROG	= @TCLSH_PROG@
-TCLSH		= $(TCLSH_ENV) $(TCLSH_PROG)
-#WISH_PROG	= @WISH_PROG@
-#WISH		= $(TCLSH_ENV) $(WISH_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)
+
+#BUILD_WISH_PROG	= @BUILD_WISH@
+#BUILD_WISH	= $(TCLSH_ENV) $(BUILD_WISH_PROG)
+
+
 SHARED_BUILD	= @SHARED_BUILD@
 
 INCLUDES	= @PKG_INCLUDES@ @TCL_INCLUDES@
@@ -233,13 +244,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:
 
@@ -292,7 +303,7 @@
 #========================================================================
 
 pkgIndex.tcl: $(PKG_LIB_FILE)
-	( 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) \
Index: configure.in
===================================================================
RCS file: /cvsroot/tcl/sampleextension/configure.in,v
retrieving revision 1.40
diff -u -r1.40 configure.in
--- configure.in	28 Apr 2005 13:20:09 -0000	1.40
+++ configure.in	25 Jul 2005 02:30:46 -0000
@@ -168,6 +168,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.
@@ -176,7 +178,9 @@
 # Add WISH as well if this is a Tk extension.
 #--------------------------------------------------------------------
 
+TEA_BUILD_TCLSH
 TEA_PROG_TCLSH
+#TEA_BUILD_WISH
 #TEA_PROG_WISH
 
 #--------------------------------------------------------------------
