2001-12-18  Mo DeJong  <mdejong@users.sourceforge.net>

	* unix/Makefile.in: Use new BUILD_TCLSH variable
	to detect when we need to build a dynamic executable
	that does not contain a burned in shared library path.
	The avoids a problem when a user is building a new
	version of Tcl but already has an older version
	installed in the same prefix.
	Build the tcltest executable without a burned in
	shared library path to avoid the same problem.
	Update shell and gdb targets to use this new
	BUILD_TCLSH variable.
	* unix/README: Cleanup outdated README notes.
	Inform people that they should run "make shell"
	to launch Tcl from the build directory.
	* unix/configure: Regen.
	* unix/configure.in: Define BUILD_TCLSH.

Index: unix/Makefile.in
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/Makefile.in,v
retrieving revision 1.90
diff -u -r1.90 Makefile.in
--- unix/Makefile.in	2001/12/19 11:03:20	1.90
+++ unix/Makefile.in	2001/12/19 11:52:49
@@ -181,6 +181,15 @@
 # make dist.
 TCL_EXE			= tclsh
 
+# BUILD_TCLSH stores the name of the Tcl executable that is to be
+# run out of the build directory. This variable is set to "tclsh"
+# in the static build case and "Btclsh" when building shared.
+# This is needed to make sure a new copy of Tcl run from the
+# build directory does not accidently pick up a previously
+# install shared library.
+
+BUILD_TCLSH		= @BUILD_TCLSH@
+
 # The symbols below provide support for dynamic loading and shared
 # libraries.  See configure.in for a description of what the
 # symbols mean.  The values of the symbols are normally set by the
@@ -440,13 +449,19 @@
 objs: ${OBJS}
 
 
+# Tcl binary that will be installed (can have burned in shlib path)
 tclsh: ${TCLSH_OBJS} ${TCL_LIB_FILE}
 	${CC} ${LDFLAGS} ${TCLSH_OBJS} @TCL_BUILD_LIB_SPEC@ ${LIBS} \
 		@TCL_LD_SEARCH_FLAGS@ -o tclsh
 
+# Tcl binary that lives in build directory (no burned in shlib path)
+Btclsh: tclsh
+	${CC} ${LDFLAGS} ${TCLSH_OBJS} @TCL_BUILD_LIB_SPEC@ ${LIBS} \
+		-o Btclsh
+
 tcltest: ${TCLTEST_OBJS} ${TCL_LIB_FILE} ${BUILD_DLTEST}
 	${CC} ${LDFLAGS} ${TCLTEST_OBJS} @TCL_BUILD_LIB_SPEC@ ${LIBS} \
-		@TCL_LD_SEARCH_FLAGS@ -o tcltest
+		-o tcltest
 
 
 # Note, in the target below TCL_LIBRARY needs to be set or else
@@ -471,22 +486,22 @@
 	TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
 	./tcltest
 
-# This target can be used to run tclsh from the build directory
+# This target can be used to run Tcl from the build directory
 # via `make shell SCRIPT=/tmp/foo.tcl`
-shell: tclsh
+shell: $(BUILD_TCLSH)
 	@LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}; export LD_LIBRARY_PATH; \
 	LIBPATH=`pwd`:${LIBPATH}; export LIBPATH; \
 	SHLIB_PATH=`pwd`:${SHLIB_PATH}; export SHLIB_PATH; \
 	TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
-	./tclsh $(SCRIPT)
+	./$(BUILD_TCLSH) $(SCRIPT)
 
-# This target can be used to run tclsh inside either gdb or insight
-gdb: tclsh
+# This target can be used to run Tcl inside either gdb or insight
+gdb: $(BUILD_TCLSH)
 	@echo "set env LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}" > gdb.run
 	@echo "set env LIBPATH=`pwd`:${LIBPATH}" >> gdb.run
 	@echo "set env SHLIB_PATH=`pwd`:${SHLIB_PATH}" >> gdb.run
 	@echo "set env TCL_LIBRARY=${TCL_BUILDTIME_LIBRARY}" >> gdb.run
-	gdb ./tclsh --command=gdb.run
+	gdb ./$(BUILD_TCLSH) --command=gdb.run
 	rm gdb.run
 
 # The following target outputs the name of the top-level source directory
@@ -680,7 +695,7 @@
 
 clean:
 	rm -f *.a *.o libtcl* core errs *~ \#* TAGS *.E a.out \
-		errors tclsh tcltest lib.exp
+		errors tclsh Btclsh tcltest lib.exp
 	cd dltest ; $(MAKE) clean
 
 distclean: clean
Index: unix/README
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/README,v
retrieving revision 1.17
diff -u -r1.17 README
--- unix/README	2001/08/07 02:44:40	1.17
+++ unix/README	2001/12/19 11:52:49
@@ -34,15 +34,12 @@
     platform, or if you have applied patches, type "make distclean" to
     discard all the configuration information computed previously.
 
-(c) If there is no "configure" script in this directory it is because you
-    are working out of the source repository (i.e., CVS) instead of working
-    from a source distribution.  In this case you need to use "autoconf"
-    to generate the configure script.  It runs with no arguments.
-    Remember to run it here and down in the dltest directory.
+(c) If you need to reconfigure because you changed one of the .in or
+    .m4 files, you will need to run autoconf to create a new
+    ./configure script.
 
     (in the tcl/unix directory)
     autoconf
-    cd dltest ; autoconf ; cd ..
 
 (d) Type "./configure".  This runs a configuration script created by GNU
     autoconf, which configures Tcl for your system and creates a
@@ -102,14 +99,8 @@
     can override these choices by modifying the "prefix" and
     "exec_prefix" variables in the Makefile.
 
-(h) At this point you can play with Tcl by invoking the "tclsh"
-    program and typing Tcl commands.  However, if you haven't installed
-    Tcl then you'll first need to set your TCL_LIBRARY variable to
-    hold the full path name of the "library" subdirectory.  Note that
-    the installed versions of tclsh, libtcl.a, and libtcl.so have a
-    version number in their names, such as "tclsh8.4" or "libtcl8.4.so";
-    to use the installed versions, either specify the version number
-    or create a symbolic link (e.g. from "tclsh" to "tclsh8.4").
+(h) At this point you can play with Tcl by running "make shell"
+    and typing Tcl commands at the prompt.
 
 If you have trouble compiling Tcl, see the URL noted above about working
 platforms.  It contains information that people have provided about changes
Index: unix/configure.in
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/configure.in,v
retrieving revision 1.77
diff -u -r1.77 configure.in
--- unix/configure.in	2001/12/19 11:03:20	1.77
+++ unix/configure.in	2001/12/19 11:52:49
@@ -491,6 +491,14 @@
 # Install time header dir can be set via --includedir
 eval "TCL_INCLUDE_SPEC=\"-I${includedir}\""
 
+# Special build time binary name when building shared.
+if test "${SHARED_BUILD}" = "1"; then
+    BUILD_TCLSH=Btclsh
+else
+    BUILD_TCLSH=tclsh
+fi
+AC_SUBST(BUILD_TCLSH)
+
 #------------------------------------------------------------------------
 # tclConfig.sh refers to this by a different name
 #------------------------------------------------------------------------
