Index: unix/Makefile.in
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/Makefile.in,v
retrieving revision 1.163
diff -u -r1.163 Makefile.in
--- unix/Makefile.in	24 Feb 2005 18:05:42 -0000	1.163
+++ unix/Makefile.in	17 Mar 2005 19:20:08 -0000
@@ -235,17 +235,16 @@
 AR			= @AR@
 RANLIB			= @RANLIB@
 SRC_DIR			= @srcdir@
-TOP_DIR			= $(SRC_DIR)/..
+TOP_DIR			= @TCL_SRC_DIR@
 BUILD_DIR		= @builddir@
 GENERIC_DIR		= $(TOP_DIR)/generic
 COMPAT_DIR		= $(TOP_DIR)/compat
 TOOL_DIR		= $(TOP_DIR)/tools
 UNIX_DIR		= $(SRC_DIR)
 MAC_OSX_DIR		= $(TOP_DIR)/macosx
-# Must be absolute because of the cd dltest $(DLTEST_DIR)/configure below.
-DLTEST_DIR		= @TCL_SRC_DIR@/unix/dltest
-# Must be absolute to so the corresponding tcltest's tcl_library is absolute.
-TCL_BUILDTIME_LIBRARY	= @TCL_SRC_DIR@/library
+PKGS_DIR		= $(TOP_DIR)/pkgs
+DLTEST_DIR		= $(TOP_DIR)/unix/dltest
+TCL_BUILDTIME_LIBRARY	= $(TOP_DIR)/library
 
 CC			= @CC@
 #CC			= purify -best-effort @CC@ -DPURIFY
@@ -443,7 +442,7 @@
 
 SRCS = $(GENERIC_SRCS) $(UNIX_SRCS) $(STUB_SRCS)
 
-all: binaries libraries doc
+all: binaries libraries doc packages
 
 binaries: ${LIB_FILE} $(STUB_LIB_FILE) $(TCL_BUILD_EXP_FILE) tclsh
 
@@ -481,6 +480,8 @@
 # the generated tcltest executable gets the build directory
 # burned into its ld search path. This keeps tcltest from
 # picking up an already installed version of the Tcl library.
+SHELL_ENV =	@LD_LIBRARY_PATH_VAR@=`pwd`:${@LD_LIBRARY_PATH_VAR@} \
+		TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"
 
 tcltest: ${TCLTEST_OBJS} ${TCL_LIB_FILE} ${BUILD_DLTEST}
 	$(MAKE) tcltest-real LIB_RUNTIME_DIR=`pwd`
@@ -496,49 +497,33 @@
 # args to tcltest, ie:
 #	% make test TESTFLAGS="-verbose bps -file fileName.test"
 
-test: tcltest
-	@LD_LIBRARY_PATH_VAR@=`pwd`:${@LD_LIBRARY_PATH_VAR@}; export @LD_LIBRARY_PATH_VAR@; \
-	TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
-	./tcltest $(TOP_DIR)/tests/all.tcl $(TESTFLAGS) $(TCLTESTARGS)
+test: tcltest test-packages
+	$(SHELL_ENV) ./tcltest $(TOP_DIR)/tests/all.tcl $(TESTFLAGS) $(TCLTESTARGS)
 
 # Useful target to launch a built tcltest with the proper path,...
 runtest: tcltest
-	@LD_LIBRARY_PATH_VAR@=`pwd`:${@LD_LIBRARY_PATH_VAR@}; export @LD_LIBRARY_PATH_VAR@; \
-	TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
-	./tcltest
+	$(SHELL_ENV) ./tcltest
 
 # Useful target for running the test suite with an unwritable current
 # directory...
 ro-test: tcltest
-	@LD_LIBRARY_PATH_VAR@=`pwd`:${@LD_LIBRARY_PATH_VAR@}; export @LD_LIBRARY_PATH_VAR@; \
-	TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
-	echo 'exec chmod -w .;package require tcltest;tcltest::temporaryDirectory /tmp;source ../tests/all.tcl;exec chmod +w .' | ./tcltest
+	echo 'exec chmod -w .;package require tcltest;tcltest::temporaryDirectory /tmp;source ../tests/all.tcl;exec chmod +w .' | $(SHELL_ENV) ./tcltest
 
 # This target can be used to run tclsh from the build directory
 # via `make shell SCRIPT=/tmp/foo.tcl`
 shell: tclsh
-	@LD_LIBRARY_PATH_VAR@=`pwd`:${@LD_LIBRARY_PATH_VAR@}; export @LD_LIBRARY_PATH_VAR@; \
-	TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
-	./tclsh $(SCRIPT)
+	$(SHELL_ENV) ./tclsh $(SCRIPT)
 
 # This target can be used to run tclsh inside either gdb or insight
 gdb: tclsh
-	@echo "set env @LD_LIBRARY_PATH_VAR@=`pwd`:${@LD_LIBRARY_PATH_VAR@}" > gdb.run
-	@echo "set env TCL_LIBRARY=${TCL_BUILDTIME_LIBRARY}" >> gdb.run
-	$(GDB) ./tclsh --command=gdb.run
-	rm gdb.run
+	$(SHELL_ENV) $(GDB) ./tclsh
 
 # This target can be used to run tclsh inside ddd
 ddd: tclsh
-	@echo "set env @LD_LIBRARY_PATH_VAR@=`pwd`:${@LD_LIBRARY_PATH_VAR@}" > gdb.run
-	@echo "set env TCL_LIBRARY=${TCL_BUILDTIME_LIBRARY}" >> gdb.run
-	$(DDD) -command=gdb.run ./tclsh
-	rm gdb.run
+	$(SHELL_ENV) $(DDD) ./tclsh
 
 valgrind: tclsh tcltest
-	@LD_LIBRARY_PATH_VAR@=`pwd`:${@LD_LIBRARY_PATH_VAR@}; export @LD_LIBRARY_PATH_VAR@; \
-	TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
-	valgrind --num-callers=8 --leak-resolution=high -v --leak-check=yes --show-reachable=yes $(VALGRINDARGS) ./tcltest $(TOP_DIR)/tests/all.tcl -singleproc 1 $(TESTFLAGS) $(TCLTESTARGS)
+	$(SHELL_ENV) valgrind --num-callers=8 --leak-resolution=high -v --leak-check=yes --show-reachable=yes $(VALGRINDARGS) ./tcltest $(TOP_DIR)/tests/all.tcl -singleproc 1 $(TESTFLAGS) $(TCLTESTARGS)
 
 # The following target outputs the name of the top-level source directory
 # for Tcl (it is used by Tk's configure script, for example).  The
@@ -582,7 +567,7 @@
 dltest.marker:
 	cd dltest ; $(MAKE)
 
-install: install-binaries install-libraries install-doc
+install: install-binaries install-libraries install-doc install-packages
 
 install-strip:
 	$(MAKE) install \
@@ -751,12 +736,12 @@
 #tclConfig.h: $(UNIX_DIR)/tclConfig.h.in
 #	$(SHELL) config.status
 
-clean:
+clean: clean-packages
 	rm -f *.a *.o libtcl* core errs *~ \#* TAGS *.E a.out \
 		errors tclsh tcltest lib.exp
 	cd dltest ; $(MAKE) clean
 
-distclean: clean
+distclean: distclean-packages clean
 	rm -rf Makefile config.status config.cache config.log tclConfig.sh \
 		$(PACKAGE).* prototype #tclConfig.h
 	cd dltest ; $(MAKE) distclean
@@ -1264,6 +1249,83 @@
 	mv RPMS/i386/*.rpm .
 	rm -rf RPMS THIS.TCL.SPEC
 
+
+#
+# Bundled Package targets
+#
+
+# somehow we need to propagate configure args like --enable-64bit
+PKG_CFG_ARGS   =	@PKG_CFG_ARGS@
+PKG_DIR                = ./pkgs
+
+packages:
+	@builddir=`pwd`; \
+	for i in $(PKGS_DIR)/*; do \
+	  if [ -d $$i ]; then \
+	    if [ -x $$i/configure ]; then \
+	        pkg=`basename $$i`; \
+	        echo "Building package '$$pkg'"; \
+	        mkdir -p $(PKG_DIR)/$$pkg; \
+	        if [ ! -f $(PKG_DIR)/$$pkg/Makefile ]; then \
+	            ( cd $(PKG_DIR)/$$pkg; \
+	              $$i/configure --with-tcl=$(PWD) --with-tclinclude=$(GENERIC_DIR) $(PKG_CFG_ARGS); ) \
+	        fi; \
+	        ( cd $(PKG_DIR)/$$pkg; $(MAKE); ) \
+	    fi; \
+	  fi; \
+	done; \
+	cd $$builddir
+
+install-packages: packages
+	@builddir=`pwd`; \
+	for i in $(PKGS_DIR)/*; do \
+	  if [ -d $$i ]; then \
+	    pkg=`basename $$i`; \
+	    if [ -f $(PKG_DIR)/$$pkg/Makefile ]; then \
+	        echo "Installing package '$$pkg'"; \
+	        ( cd $(PKG_DIR)/$$pkg; $(MAKE) install "DESTDIR=$(INSTALL_ROOT)"; ) \
+	    fi; \
+	  fi; \
+	done; \
+	cd $$builddir
+
+test-packages: tcltest packages
+	@builddir=`pwd`; \
+	for i in $(PKGS_DIR)/*; do \
+	  if [ -d $$i ]; then \
+	    pkg=`basename $$i`; \
+	    if [ -f $(PKG_DIR)/$$pkg/Makefile ]; then \
+	        echo "Testing package '$$pkg'"; \
+	        ( cd $(PKG_DIR)/$$pkg; $(MAKE) "LD_LIBRARY_PATH=$$builddir:${LD_LIBRARY_PATH}" "TCL_LIBRARY=${TCL_BUILDTIME_LIBRARY}" "TCLLIBPATH=$$builddir/pkgs" test "TCLSH_PROG=$$builddir/tcltest"; ) \
+	    fi; \
+	  fi; \
+	done; \
+	cd $$builddir
+
+clean-packages:
+	@builddir=`pwd`; \
+	for i in $(PKGS_DIR)/*; do \
+	  if [ -d $$i ]; then \
+	    pkg=`basename $$i`; \
+	    if [ -f $(PKG_DIR)/$$pkg/Makefile ]; then \
+	        ( cd $(PKG_DIR)/$$pkg; $(MAKE) clean; ) \
+	    fi; \
+	  fi; \
+	done; \
+	cd $$builddir
+
+distclean-packages:
+	@builddir=`pwd`; \
+	for i in $(PKGS_DIR)/*; do \
+	  if [ -d $$i ]; then \
+	    pkg=`basename $$i`; \
+	    if [ -f $(PKG_DIR)/$$pkg/Makefile ]; then \
+	        ( cd $(PKG_DIR)/$$pkg; $(MAKE) distclean; ) \
+	    fi; \
+	  fi; \
+	done; \
+	cd $$builddir
+
 #
 # Target to create a proper Tcl distribution from information in the
 # master source directory.  DISTDIR must be defined to indicate where
Index: unix/configure
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/configure,v
retrieving revision 1.141
diff -u -r1.141 configure
--- unix/configure	15 Mar 2005 01:24:26 -0000	1.141
+++ unix/configure	17 Mar 2005 19:20:09 -0000
@@ -308,7 +308,7 @@
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAN_FLAGS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP TCL_THREADS RANLIB ac_ct_RANLIB AR LIBOBJS TCL_LIBS DL_LIBS DL_OBJS PLAT_OBJS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING LDFLAGS_DEBUG LDFLAGS_OPTIMIZE CC_SEARCH_FLAGS LD_SEARCH_FLAGS STLIB_LD SHLIB_LD TCL_SHLIB_LD_EXTRAS TK_SHLIB_LD_EXTRAS SHLIB_LD_LIBS SHLIB_CFLAGS SHLIB_SUFFIX MAKE_LIB MAKE_STUB_LIB INSTALL_LIB INSTALL_STUB_LIB CFLAGS_DEFAULT LDFLAGS_DEFAULT TCL_VERSION TCL_MAJOR_VERSION TCL_MINOR_VERSION TCL_PATCH_LEVEL TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_STUB_LIB_PATH TCL_INCLUDE_SPEC TCL_BUILD_STUB_LIB_SPEC TCL_BUILD_STUB_LIB_PATH TCL_SRC_DIR CFG_TCL_SHARED_LIB_SUFFIX CFG_TCL_UNSHARED_LIB_SUFFIX CFG_TCL_EXPORT_FILE_SUFFIX TCL_SHARED_BUILD LD_LIBRARY_PATH_VAR TCL_BUILD_LIB_SPEC TCL_NEEDS_EXP_FILE TCL_BUILD_EXP_FILE TCL_EXP_FILE TCL_LIB_VERSIONS_OK TCL_SHARED_LIB_SUFFIX TCL_UNSHARED_LIB_SUFFIX TCL_HAS_LONGLONG BUILD_DLTEST TCL_PACKAGE_PATH'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAN_FLAGS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP TCL_THREADS RANLIB ac_ct_RANLIB AR LIBOBJS TCL_LIBS DL_LIBS DL_OBJS PLAT_OBJS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING LDFLAGS_DEBUG LDFLAGS_OPTIMIZE CC_SEARCH_FLAGS LD_SEARCH_FLAGS STLIB_LD SHLIB_LD TCL_SHLIB_LD_EXTRAS TK_SHLIB_LD_EXTRAS SHLIB_LD_LIBS SHLIB_CFLAGS SHLIB_SUFFIX MAKE_LIB MAKE_STUB_LIB INSTALL_LIB INSTALL_STUB_LIB CFLAGS_DEFAULT LDFLAGS_DEFAULT TCL_VERSION TCL_MAJOR_VERSION TCL_MINOR_VERSION TCL_PATCH_LEVEL PKG_CFG_ARGS TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_STUB_LIB_PATH TCL_INCLUDE_SPEC TCL_BUILD_STUB_LIB_SPEC TCL_BUILD_STUB_LIB_PATH TCL_SRC_DIR CFG_TCL_SHARED_LIB_SUFFIX CFG_TCL_UNSHARED_LIB_SUFFIX CFG_TCL_EXPORT_FILE_SUFFIX TCL_SHARED_BUILD LD_LIBRARY_PATH_VAR TCL_BUILD_LIB_SPEC TCL_NEEDS_EXP_FILE TCL_BUILD_EXP_FILE TCL_EXP_FILE TCL_LIB_VERSIONS_OK TCL_SHARED_LIB_SUFFIX TCL_UNSHARED_LIB_SUFFIX TCL_HAS_LONGLONG BUILD_DLTEST TCL_PACKAGE_PATH'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -1328,6 +1328,8 @@
 TCL_PATCH_LEVEL="a3"
 VERSION=${TCL_VERSION}
 
+PKG_CFG_ARGS=$@
+
 #------------------------------------------------------------------------
 # Handle the --prefix=... option
 #------------------------------------------------------------------------
@@ -14915,6 +14917,7 @@
 
 
 
+
                               ac_config_files="$ac_config_files Makefile dltest/Makefile tclConfig.sh"
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -15581,6 +15584,7 @@
 s,@TCL_MAJOR_VERSION@,$TCL_MAJOR_VERSION,;t t
 s,@TCL_MINOR_VERSION@,$TCL_MINOR_VERSION,;t t
 s,@TCL_PATCH_LEVEL@,$TCL_PATCH_LEVEL,;t t
+s,@PKG_CFG_ARGS@,$PKG_CFG_ARGS,;t t
 s,@TCL_LIB_FILE@,$TCL_LIB_FILE,;t t
 s,@TCL_LIB_FLAG@,$TCL_LIB_FLAG,;t t
 s,@TCL_LIB_SPEC@,$TCL_LIB_SPEC,;t t
Index: unix/configure.in
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/configure.in,v
retrieving revision 1.127
diff -u -r1.127 configure.in
--- unix/configure.in	30 Jan 2005 18:38:55 -0000	1.127
+++ unix/configure.in	17 Mar 2005 19:20:09 -0000
@@ -16,6 +16,8 @@
 TCL_PATCH_LEVEL="a3"
 VERSION=${TCL_VERSION}
 
+PKG_CFG_ARGS=$@
+
 #------------------------------------------------------------------------
 # Handle the --prefix=... option
 #------------------------------------------------------------------------
@@ -539,6 +541,7 @@
 AC_SUBST(TCL_MAJOR_VERSION)
 AC_SUBST(TCL_MINOR_VERSION)
 AC_SUBST(TCL_PATCH_LEVEL)
+AC_SUBST(PKG_CFG_ARGS)
 
 AC_SUBST(TCL_LIB_FILE)
 AC_SUBST(TCL_LIB_FLAG)
