--- tcl.m4.orig	Tue Jul 26 15:09:23 2005
+++ tcl.m4	Thu Aug  4 22:12:55 2005
@@ -2976,6 +2976,61 @@
     fi
 ])
 
+AC_DEFUN(TEA_ENABLE_FRAMEWORK, [
+    AC_MSG_CHECKING(whether to build as a framework)
+
+    AC_ARG_ENABLE(framework,
+        AC_HELP_STRING(--enable-framework@<:@=INSTALLDIR@:>@, \
+	Build (MacOSX|Darwin) framework),
+[
+	case $enableval in
+	yes) 
+		enableval=/Library/Frameworks
+	esac
+	case $enableval in
+	no)
+        AC_MSG_RESULT(no)
+		BUILD_FRAMEWORK_TRUE="#"
+		BUILD_FRAMEWORK_FALSE=
+		FRAMEWORK=
+		FRAMEWORKDIR=no-framework
+		FRAMEWORKPREFIX=
+		FRAMEWORKINSTALLDIR=
+		enable_framework=
+		;;
+	*)
+        AC_MSG_RESULT($enableval)
+		BUILD_FRAMEWORK_TRUE=
+		BUILD_FRAMEWORK_FALSE="#"
+		if test x"$1" == "x" ; then
+			FRAMEWORK=${PACKAGE_NAME}
+		else
+			FRAMEWORK=$1
+		fi
+		FRAMEWORKDIR=$FRAMEWORK.framework
+		FRAMEWORKPREFIX=$enableval
+		FRAMEWORKINSTALLDIR=$FRAMEWORKPREFIX/$FRAMEWORKDIR
+	esac
+	],[
+        AC_MSG_RESULT(no)
+	BUILD_FRAMEWORK_TRUE="#"
+	BUILD_FRAMEWORK_FALSE=
+        FRAMEWORK=
+        FRAMEWORKDIR=no-framework
+        FRAMEWORKPREFIX=
+        FRAMEWORKINSTALLDIR=
+        enable_framework=
+    ])
+
+    AC_SUBST(BUILD_FRAMEWORK_TRUE)
+    AC_SUBST(BUILD_FRAMEWORK_FALSE)
+    AC_SUBST(FRAMEWORK)
+    AC_SUBST(FRAMEWORKDIR)
+    AC_SUBST(FRAMEWORKPREFIX)
+    AC_SUBST(FRAMEWORKINSTALLDIR)
+
+])
+
 #------------------------------------------------------------------------
 # TEA_SETUP_COMPILER_CC --
 #
@@ -3813,6 +3868,81 @@
 ])
 
 #------------------------------------------------------------------------
+# TEA_PACKAGE_CONFIG --
+#
+#	Set variables necessary to create the AC_PACKAGE_NAME[Config.sh] file
+#
+# Results:
+#
+#	Subst the following vars:
+#		AC_PACKAGE_NAME[_SRC_DIR]
+#		AC_PACKAGE_NAME[_LIB_FILE]
+#		AC_PACKAGE_NAME[_LIB_SPEC]
+#
+#------------------------------------------------------------------------
+
+AC_DEFUN(TEA_PACKAGE_CONFIG, [
+    #------------------------------------------------------------------
+    [# These are for] AC_PACKAGE_NAME[Config.sh]
+    #------------------------------------------------------------------
+    # pkglibdir must be a fully qualified path and (not ${exec_prefix}/lib)
+    if test x"{FRAMEWORK}" != x; then
+        eval pkglibdir="${FRAMEWORKINSTALLDIR}/Versions/${PACKAGE_VERSION}"
+        eval PKG_LIB_PREFIX=../../
+        eval PKG_LIB_FILE=${FRAMEWORK}
+        eval AC_PACKAGE_NAME[_LIB_FILE]=${FRAMEWORK}
+    else
+        eval pkglibdir="${libdir}/${PACKAGE_NAME}${PACKAGE_VERSION}"
+        eval PKG_LIB_PREFIX=
+    fi
+    AC_SUBST(PKG_LIB_PREFIX)
+
+    if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
+        eval AC_PACKAGE_NAME[_LIB_FLAG]="-l${PACKAGE_NAME}${PACKAGE_VERSION}${DBGX}"
+        eval AC_PACKAGE_NAME[_STUB_LIB_FLAG]="-l${PACKAGE_NAME}stub${PACKAGE_VERSION}${DBGX}"
+    else
+        eval AC_PACKAGE_NAME[_LIB_FLAG]="-l${PACKAGE_NAME}`echo ${PACKAGE_VERSION} | tr -d .`${DBGX}"
+        eval AC_PACKAGE_NAME[STUB_LIB_FLAG]="-l${PACKAGE_NAME}stub`echo ${PACKAGE_VERSION} | tr -d .`${DBGX}"
+    fi
+
+
+    AC_PACKAGE_NAME[_BUILD_LIB_SPEC]="-L`pwd` ${AC_PACKAGE_NAME[_LIB_FLAG]}"
+    AC_PACKAGE_NAME[_LIB_SPEC]="-L${pkglibdir} ${AC_PACKAGE_NAME[_LIB_FLAG]}"
+
+    AC_PACKAGE_NAME[_BUILD_STUB_LIB_SPEC]="-L`pwd` ${AC_PACKAGE_NAME[_STUB_LIB_FLAG]}"
+    AC_PACKAGE_NAME[_STUB_LIB_SPEC]="-L${pkglibdir} ${AC_PACKAGE_NAME[_STUB_LIB_FLAG]}"
+    AC_PACKAGE_NAME[_BUILD_STUB_LIB_PATH]="`pwd`/${AC_PACKAGE_NAME[_STUB_LIB_FILE]}"
+    AC_PACKAGE_NAME[_STUB_LIB_PATH]="${pkglibdir}/${AC_PACKAGE_NAME[_STUB_LIB_FILE]}"
+
+    if test x"${FRAMEWORK}" != x; then
+            AC_PACKAGE_NAME[_LIB_FLAG]="-framework ${FRAMEWORK}"
+	    AC_PACKAGE_NAME[_LIB_SPEC]="-F${FRAMEWORKINSTALLDIR} ${AC_PACKAGE_NAME[_LIB_FLAG]}"
+    fi
+
+    AC_SUBST(AC_PACKAGE_NAME[_BUILD_LIB_SPEC])
+    AC_SUBST(AC_PACKAGE_NAME[_LIB_SPEC])
+    AC_SUBST(AC_PACKAGE_NAME[_BUILD_STUB_LIB_SPEC])
+    AC_SUBST(AC_PACKAGE_NAME[_STUB_LIB_SPEC])
+    AC_SUBST(AC_PACKAGE_NAME[_BUILD_STUB_LIB_PATH])
+    AC_SUBST(AC_PACKAGE_NAME[_STUB_LIB_PATH])
+
+    [#] AC_PACKAGE_NAME[_SRC_DIR] must be a fully qualified path
+    eval AC_PACKAGE_NAME[_SRC_DIR]="$srcdir"
+    AC_PACKAGE_NAME[_SRC_DIR]=`cd "${AC_PACKAGE_NAME[_SRC_DIR]}"; pwd`
+    AC_SUBST(AC_PACKAGE_NAME[_SRC_DIR])
+
+    if test x"${FRAMEWORK}" != x; then
+	POST_INSTALL_LIB_BINARIES="cd ${FRAMEWORKINSTALLDIR} && ln -s Versions/${PACKAGE_VERSION}/${FRAMEWORK} && ln -s Versions/${PACKAGE_VERSION}/Resources && ln -s Versions/${PACKAGE_VERSION}/${PACKAGE_NAME}Config.sh"
+	POST_INSTALL_LIBRARIES="cd ${FRAMEWORKINSTALLDIR} && ln -s Versions/${PACKAGE_VERSION}/Headers"
+    else
+	POST_INSTALL_LIBRARIES=
+	POST_INSTALL_LIB_BINARIES=
+    fi
+    AC_SUBST(POST_INSTALL_LIBRARIES)
+    AC_SUBST(POST_INSTALL_LIB_BINARIES)
+])
+
+#------------------------------------------------------------------------
 # TEA_PATH_CELIB --
 #
 #	Locate Keuchel's celib emulation layer for targeting Win/CE
@@ -3920,3 +4050,5 @@
 	fi
     fi
 ])
+
+
