Index: unix/Makefile.in
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/Makefile.in,v
retrieving revision 1.63.2.4
diff -u -r1.63.2.4 Makefile.in
--- unix/Makefile.in	2001/04/03 23:00:17	1.63.2.4
+++ unix/Makefile.in	2001/07/02 12:47:22
@@ -161,8 +161,12 @@
 # "install" around;  better to use the install-sh script that comes
 # with the distribution, which is slower but guaranteed to work.
 
+INSTALL_STRIP_PROGRAM   = -s
+INSTALL_STRIP_LIBRARY  = -S -S
+
 INSTALL			= @srcdir@/install-sh -c
 INSTALL_PROGRAM		= ${INSTALL}
+INSTALL_LIBRARY		= ${INSTALL}
 INSTALL_DATA		= ${INSTALL} -m 644
 
 # The following specifies which Tcl executable to use for make targets
@@ -246,7 +250,7 @@
 ${AC_FLAGS} ${MATH_FLAGS} ${GENERIC_FLAGS} ${PROTO_FLAGS} ${MEM_DEBUG_FLAGS} \
 ${COMPILE_DEBUG_FLAGS} ${ENV_FLAGS} -DTCL_SHLIB_EXT=\"${SHLIB_SUFFIX}\"
 
-LIBS		= @DL_LIBS@ @LIBS@ $(MATH_LIBS) -lc
+LIBS		= @DL_LIBS@ @LIBS@ $(MATH_LIBS)
 
 DEPEND_SWITCHES	= ${CFLAGS} -I${GENERIC_DIR} -I${SRC_DIR} \
 ${AC_FLAGS} ${MATH_FLAGS} \
@@ -408,7 +412,9 @@
 ${TCL_LIB_FILE}: ${OBJS} ${STUB_LIB_FILE}
 	rm -f ${TCL_LIB_FILE}
 	@MAKE_LIB@
-	$(RANLIB) ${TCL_LIB_FILE}
+	if test "x@DL_OBJS@" = "xtclLoadAout.o"; then \
+		$(RANLIB) ${TCL_LIB_FILE}; \
+	fi
 
 ${STUB_LIB_FILE}: ${STUB_LIB_OBJS}
 	rm -f ${STUB_LIB_FILE}
@@ -504,14 +510,16 @@
 install: install-binaries install-libraries install-doc
 
 install-strip:
-	$(MAKE) install INSTALL_PROGRAM="$(INSTALL_PROGRAM) -s"
+	$(MAKE) install \
+		INSTALL_PROGRAM="$(INSTALL_PROGRAM) ${INSTALL_STRIP_PROGRAM}" \
+		INSTALL_LIBRARY="$(INSTALL_LIBRARY) ${INSTALL_STRIP_LIBRARY}"
 
 # Note: before running ranlib below, must cd to target directory because
 # some ranlibs write to current directory, and this might not always be
 # possible (e.g. if installing as root).
 
 install-binaries: binaries
-	@for i in $(LIB_INSTALL_DIR) $(BIN_INSTALL_DIR) ; \
+	@for i in $(LIB_INSTALL_DIR) $(BIN_INSTALL_DIR) $(SCRIPT_INSTALL_DIR); \
 	    do \
 	    if [ ! -d $$i ] ; then \
 		echo "Making directory $$i"; \
@@ -524,8 +532,10 @@
 	    chmod +x $(SRC_DIR)/install-sh; \
 	    fi
 	@echo "Installing $(TCL_LIB_FILE) to $(LIB_INSTALL_DIR)/"
-	@$(INSTALL_DATA) $(TCL_LIB_FILE) $(LIB_INSTALL_DIR)/$(TCL_LIB_FILE)
-	@(cd $(LIB_INSTALL_DIR); $(RANLIB) $(TCL_LIB_FILE))
+	@$(INSTALL_LIBRARY) $(TCL_LIB_FILE) $(LIB_INSTALL_DIR)/$(TCL_LIB_FILE)
+	@if test "x@DL_OBJS@" = "xtclLoadAout.o"; then \
+	    (cd $(LIB_INSTALL_DIR); $(RANLIB) $(TCL_LIB_FILE)); \
+	    fi
 	@chmod 555 $(LIB_INSTALL_DIR)/$(TCL_LIB_FILE)
 	@if test "$(TCL_BUILD_EXP_FILE)" != ""; then \
 	    echo "Installing $(TCL_EXP_FILE) to $(LIB_INSTALL_DIR)/"; \
@@ -534,11 +544,11 @@
 	    fi
 	@echo "Installing tclsh as $(BIN_INSTALL_DIR)/tclsh$(VERSION)"
 	@$(INSTALL_PROGRAM) tclsh $(BIN_INSTALL_DIR)/tclsh$(VERSION)
-	@echo "Installing tclConfig.sh to $(LIB_INSTALL_DIR)/"
-	@$(INSTALL_DATA) tclConfig.sh $(LIB_INSTALL_DIR)/tclConfig.sh
+	@echo "Installing tclConfig.sh to $(SCRIPT_INSTALL_DIR)/"
+	@$(INSTALL_DATA) tclConfig.sh $(SCRIPT_INSTALL_DIR)/tclConfig.sh
 	@if test "$(TCL_STUB_LIB_FILE)" != "" ; then \
 	    echo "Installing $(TCL_STUB_LIB_FILE) to $(LIB_INSTALL_DIR)/"; \
-	    $(INSTALL_DATA) $(STUB_LIB_FILE) \
+	    $(INSTALL_LIBRARY) $(STUB_LIB_FILE) \
 			 $(LIB_INSTALL_DIR)/$(TCL_STUB_LIB_FILE); \
 	    fi
 
Index: unix/configure.in
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/configure.in,v
retrieving revision 1.57.2.2
diff -u -r1.57.2.2 configure.in
--- unix/configure.in	2001/04/03 22:54:39	1.57.2.2
+++ unix/configure.in	2001/07/02 12:47:22
@@ -379,8 +379,7 @@
     if test "x$DL_OBJS" = "xtclLoadAout.o"; then
 	MAKE_LIB="ar cr \${TCL_LIB_FILE} \${OBJS}"
     else
-	MAKE_LIB="\${SHLIB_LD} -o \${TCL_LIB_FILE} \${OBJS} ${SHLIB_LD_LIBS}"
-	RANLIB=":"
+	MAKE_LIB="\${SHLIB_LD} ${TCL_SHLIB_LD_EXTRAS} -o \${TCL_LIB_FILE} \${OBJS} ${SHLIB_LD_LIBS}"
     fi
 else
     case $system in
@@ -513,8 +512,8 @@
 AC_SUBST(SHLIB_SUFFIX)
 AC_SUBST(TCL_BUILD_LIB_SPEC)
 AC_SUBST(TCL_LD_SEARCH_FLAGS)
-AC_SUBST(TCL_LDFLAGS_DEBUG)
-AC_SUBST(TCL_LDFLAGS_OPTIMIZE)
+AC_SUBST(LDFLAGS_DEBUG)      #AC_SUBST(TCL_LDFLAGS_DEBUG)
+AC_SUBST(LDFLAGS_OPTIMIZE)   #AC_SUBST(TCL_LDFLAGS_OPTIMIZE)
 AC_SUBST(TCL_LIB_FILE)
 AC_SUBST(TCL_LIB_FLAG)
 AC_SUBST(TCL_NEEDS_EXP_FILE)
Index: unix/mkLinks
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/mkLinks,v
retrieving revision 1.12.2.2
diff -u -r1.12.2.2 mkLinks
--- unix/mkLinks	2001/04/03 22:54:39	1.12.2.2
+++ unix/mkLinks	2001/07/02 12:47:22
@@ -960,10 +960,10 @@
     rm -f Tcl_WrongNumArgs.3
     ln WrongNumArgs.3 Tcl_WrongNumArgs.3
 fi
-if test -r http.n; then
-    rm -f Http.n
-    ln http.n Http.n
-fi
+#if test -r http.n; then
+#    rm -f Http.n
+#    ln http.n Http.n
+#fi
 if test -r library.n; then
     rm -f auto_execok.n
     rm -f auto_import.n
@@ -1005,9 +1005,9 @@
 if test -r safe.n; then
     rm -f SafeBase.n
     ln safe.n SafeBase.n
-fi
-if test -r tcltest.n; then
-    rm -f Tcltest.n
-    ln tcltest.n Tcltest.n
 fi
+#if test -r tcltest.n; then
+#    rm -f Tcltest.n
+#    ln tcltest.n Tcltest.n
+#fi
 exit 0
Index: unix/tcl.m4
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tcl.m4,v
retrieving revision 1.22.2.3
diff -u -r1.22.2.3 tcl.m4
--- unix/tcl.m4	2001/04/06 18:42:39	1.22.2.3
+++ unix/tcl.m4	2001/07/02 12:47:22
@@ -895,14 +895,16 @@
 	    ;;
 	Rhapsody-*|Darwin-*)
 	    SHLIB_CFLAGS="-fno-common"
-	    SHLIB_LD="cc -dynamiclib \${LDFLAGS} -compatibility_version ${TCL_MAJOR_VERSION} -current_version \${VERSION} -install_name \${LIB_RUNTIME_DIR}/\${TCL_LIB_FILE}"
-	    SHLIB_LD_LIBS=""
+	    SHLIB_LD="cc -dynamiclib \${LDFLAGS}"
+            TCL_SHLIB_LD_EXTRAS="-compatibility_version ${TCL_MAJOR_VERSION} -current_version \${VERSION} -install_name \${LIB_RUNTIME_DIR}/\${TCL_LIB_FILE} -prebind -seg1addr a000000"
+	    SHLIB_LD_LIBS="${LIBS}"
 	    SHLIB_SUFFIX=".dylib"
 	    DL_OBJS="tclLoadDyld.o"
 	    DL_LIBS=""
-	    LDFLAGS=""
+	    LDFLAGS="-prebind"
 	    LD_SEARCH_FLAGS=""
 	    CFLAGS_OPTIMIZE="-O3"
+	    EXTRA_CFLAGS="-arch ppc -pipe"
 	    ;;
 	NEXTSTEP-*)
 	    SHLIB_CFLAGS=""
Index: unix/tclLoadDyld.c
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tclLoadDyld.c,v
retrieving revision 1.2.2.1
diff -u -r1.2.2.1 tclLoadDyld.c
--- unix/tclLoadDyld.c	2001/04/06 18:42:39	1.2.2.1
+++ unix/tclLoadDyld.c	2001/07/02 12:47:22
@@ -2,10 +2,9 @@
  * tclLoadDyld.c --
  *
  *     This procedure provides a version of the TclLoadFile that
- *     works with NeXT/Apple's dyld dynamic loading.  This file
+ *     works with Apple's dyld dynamic loading.  This file
  *     provided by Wilfredo Sanchez (wsanchez@apple.com).
- *     The works on Mac OS X and Mac OS X Server.
- *     It should work with OpenStep, but it's not been tried.
+ *     This works on Mac OS X.
  *
  * Copyright (c) 1995 Apple Computer, Inc.
  *
@@ -18,11 +17,6 @@
 #include "tclInt.h"
 #include <mach-o/dyld.h>
 
-/* For compatibility with older API. */
-#ifndef NSLINKMODULE_OPTION_PRIVATE
-#define NSLINKMODULE_OPTION_PRIVATE TRUE
-#endif
-
 /*
  *----------------------------------------------------------------------
  *
@@ -58,69 +52,53 @@
 				 * file which will be passed back to 
 				 * TclpUnloadFile() to unload the file. */
 {
-    NSObjectFileImageReturnCode	err;
-    NSObjectFileImage		image;
-    NSModule			module;
-    NSSymbol			symbol;
-    char			*name;
-
-    err = NSCreateObjectFileImageFromFile(fileName, &image);
-    if (err != NSObjectFileImageSuccess) {
-	switch (err) {
-	    case NSObjectFileImageFailure:
-		Tcl_SetResult(interp, "dyld: general failure", TCL_STATIC);
-		break;
-	    case NSObjectFileImageInappropriateFile:
-		Tcl_SetResult(interp, "dyld: inappropriate Mach-O file",
-			TCL_STATIC);
-		break;
-	    case NSObjectFileImageArch:
-		Tcl_SetResult(interp,
-			"dyld: inappropriate Mach-O architecture", TCL_STATIC);
-		break;
-	    case NSObjectFileImageFormat:
-		Tcl_SetResult(interp, "dyld: invalid Mach-O file format",
-			TCL_STATIC);
-		break;
-	    case NSObjectFileImageAccess:
-		Tcl_SetResult(interp, "dyld: permission denied", TCL_STATIC);
-		break;
-	    default:
-		Tcl_SetResult(interp, "dyld: unknown failure", TCL_STATIC);
-		break;
-	}
+    NSSymbol symbol;
+    enum DYLD_BOOL dyld_return;
+    Tcl_DString newName, ds;
+    char *native;
+
+    native = Tcl_UtfToExternalDString(NULL, fileName, -1, &ds);
+    dyld_return = NSAddLibrary(native);
+    Tcl_DStringFree(&ds);
+    
+    if (dyld_return !=  TRUE) {
+	Tcl_AppendResult(interp, "dyld: couldn't add library \"", fileName,
+		"\": ", Tcl_PosixError(interp), (char *) NULL);
 	return TCL_ERROR;
     }
-
-    module = NSLinkModule(image, fileName, NSLINKMODULE_OPTION_PRIVATE);
 
-    if (module == NULL) {
-	Tcl_SetResult(interp, "dyld: falied to link module", TCL_STATIC);
-	return TCL_ERROR;
+    /* 
+     * dyld adds an underscore to the beginning of symbol names.
+     */
+
+    native = Tcl_UtfToExternalDString(NULL, sym1, -1, &ds);
+    Tcl_DStringInit(&newName);
+    Tcl_DStringAppend(&newName, "_", 1);
+    native = Tcl_DStringAppend(&newName, native, -1);
+    if(NSIsSymbolNameDefined(native)) {
+        symbol = NSLookupAndBindSymbol(native);
+        *proc1Ptr = NSAddressOfSymbol(symbol);
+        *clientDataPtr = NSModuleForSymbol(symbol);
+    } else {
+        *proc1Ptr=NULL;
+        *clientDataPtr=NULL;
     }
+    Tcl_DStringFree(&newName);
+    Tcl_DStringFree(&ds);
 
-    name = (char*)malloc(sizeof(char)*(strlen(sym1)+2));
-    sprintf(name, "_%s", sym1);
-#ifdef NSLINKMODULE_OPTION_PRIVATE
-    symbol = NSLookupSymbolInModule(module, name);
-#else
-    symbol = NSLookupAndBindSymbol(name);
-#endif
-    free(name);
-    *proc1Ptr = NSAddressOfSymbol(symbol);
-
-    name = (char*)malloc(sizeof(char)*(strlen(sym2)+2));
-    sprintf(name, "_%s", sym2);
-#ifdef NSLINKMODULE_OPTION_PRIVATE
-    symbol = NSLookupSymbolInModule(module, name);
-#else
-    symbol = NSLookupAndBindSymbol(name);
-#endif
-    free(name);
-    *proc2Ptr = NSAddressOfSymbol(symbol);
-
-    *clientDataPtr = module;
-
+    native = Tcl_UtfToExternalDString(NULL, sym2, -1, &ds);
+    Tcl_DStringInit(&newName);
+    Tcl_DStringAppend(&newName, "_", 1);
+    native = Tcl_DStringAppend(&newName, native, -1);
+    if(NSIsSymbolNameDefined(native)) {
+        symbol = NSLookupAndBindSymbol(native);
+        *proc2Ptr = NSAddressOfSymbol(symbol);
+    } else {
+        *proc2Ptr=NULL;
+    }
+    Tcl_DStringFree(&newName);
+    Tcl_DStringFree(&ds);
+    
     return TCL_OK;
 }
 
