Tcl Source Code

Artifact [fdb1500313]
Login

Artifact fdb15003135fe71987c597db20b34a6cf22013de:

Attachment "tcl8.4a4-darwin.patch" to ticket [435258ffff] added by das 2001-11-23 08:38:27.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tcl/tcl/ChangeLog,v
retrieving revision 1.724
diff -u -3 -r1.724 ChangeLog
--- ChangeLog	2001/11/23 01:25:45	1.724
+++ ChangeLog	2001/11/23 01:34:14
@@ -1,5 +1,16 @@
 2001-11-23  Daniel Steffen <[email protected]>
 
+	*unix/Makefile.in:
+	*unix/configure.in:
+	*unix/install-sh:
+	*unix/mkLinks:
+	*unix/mkLinks.tcl:
+	*unix/tclLoadDyld.c:
+	*unix/tclMtherr.c: Mac OSX support: build system, dynamic code loading
+	and support for case-insensitive filesystems in mkLinks (patch #435258)
+
+2001-11-23  Daniel Steffen <[email protected]>
+
 	**  upport to 8.4 of mac code changes for 8.3.3 & various new
 	**  changes for 8.4, some already backported to 8.3.4 (patch #435658)
 
Index: unix/Makefile.in
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/Makefile.in,v
retrieving revision 1.87
diff -u -3 -r1.87 Makefile.in
--- unix/Makefile.in	2001/11/20 10:15:06	1.87
+++ unix/Makefile.in	2001/11/23 01:34:06
@@ -166,8 +166,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
@@ -415,7 +419,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}
@@ -530,7 +536,9 @@
 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
@@ -550,8 +558,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)/"; \
@@ -564,7 +574,7 @@
 	@$(INSTALL_DATA) tclConfig.sh $(LIB_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
 
@@ -1222,7 +1232,7 @@
 		$(TOP_DIR)/mac/*.c $(TOP_DIR)/mac/*.h $(TOP_DIR)/mac/*.r \
 		$(DISTDIR)/mac
 	cp -p $(TOP_DIR)/mac/porting.notes $(TOP_DIR)/mac/README $(DISTDIR)/mac
-	cp -p $(TOP_DIR)/mac/*.exp $(TOP_DIR)/mac/*.pch $(DISTDIR)/mac
+	cp -p $(TOP_DIR)/mac/*.pch $(DISTDIR)/mac
 	cp -p $(TOP_DIR)/mac/*.doc $(TOP_DIR)/mac/*.html $(DISTDIR)/mac
 	cp -p $(TOP_DIR)/license.terms $(DISTDIR)/mac
 	mkdir $(DISTDIR)/unix/dltest
Index: unix/configure.in
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/configure.in,v
retrieving revision 1.75
diff -u -3 -r1.75 configure.in
--- unix/configure.in	2001/11/16 20:55:39	1.75
+++ unix/configure.in	2001/11/23 01:34:06
@@ -392,8 +392,7 @@
     if test "x$DL_OBJS" = "xtclLoadAout.o"; then
 	MAKE_LIB="\${STLIB_LD} \[$]@ \${OBJS}"
     else
-	MAKE_LIB="\${SHLIB_LD} -o \[$]@ \${OBJS} ${SHLIB_LD_LIBS}"
-	RANLIB=":"
+	MAKE_LIB="\${SHLIB_LD} ${TCL_SHLIB_LD_EXTRAS} -o \[$]@ \${OBJS} ${SHLIB_LD_LIBS}"
     fi
 else
     case $system in
Index: unix/install-sh
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/install-sh,v
retrieving revision 1.1
diff -u -3 -r1.1 install-sh
--- unix/install-sh	1998/03/26 14:58:46	1.1
+++ unix/install-sh	2001/11/23 01:34:06
@@ -62,6 +62,11 @@
 	    shift
 	    continue;;
 
+	-S) stripcmd="$stripprog $2"
+	    shift
+	    shift
+	    continue;;
+
 	*)  if [ x"$src" = x ]
 	    then
 		src=$1
Index: unix/mkLinks
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/mkLinks,v
retrieving revision 1.34
diff -u -3 -r1.34 mkLinks
--- unix/mkLinks	2001/11/21 02:59:13	1.34
+++ unix/mkLinks	2001/11/23 01:34:06
@@ -23,10 +23,15 @@
 cd $1
 echo foo > xyzzyTestingAVeryLongFileName.foo
 x=`echo xyzzyTe*`
+echo foo > xyzzyTestingaverylongfilename.foo
+y=`echo xyzzyTestingav*`
 rm xyzzyTe*
 if test "$x" != "xyzzyTestingAVeryLongFileName.foo"; then
     exit
 fi
+if test "$y" != "xyzzyTestingaverylongfilename.foo"; then
+    CASEINSENSITIVEFS=1
+fi
 
 if test -r Access.3; then
     rm -f Tcl_Access.3
@@ -1164,9 +1169,11 @@
     rm -f Tcl_WrongNumArgs.3
     ln WrongNumArgs.3 Tcl_WrongNumArgs.3
 fi
+if test "${CASEINSENSITIVEFS:-}" != "1"; then
 if test -r http.n; then
     rm -f Http.n
     ln http.n Http.n
+fi
 fi
 if test -r library.n; then
     rm -f auto_execok.n
Index: unix/mkLinks.tcl
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/mkLinks.tcl,v
retrieving revision 1.3
diff -u -3 -r1.3 mkLinks.tcl
--- unix/mkLinks.tcl	2000/04/26 22:36:11	1.3
+++ unix/mkLinks.tcl	2001/11/23 01:34:06
@@ -30,10 +30,15 @@
 cd $1
 echo foo > xyzzyTestingAVeryLongFileName.foo
 x=`echo xyzzyTe*`
+echo foo > xyzzyTestingaverylongfilename.foo
+y=`echo xyzzyTestingav*`
 rm xyzzyTe*
 if test "$x" != "xyzzyTestingAVeryLongFileName.foo"; then
     exit
 fi
+if test "$y" != "xyzzyTestingaverylongfilename.foo"; then
+    CASEINSENSITIVEFS=1
+fi
 }
 
 foreach file $argv {
@@ -61,10 +66,17 @@
 			append lnOutput "    ln $tail $name$ext\n"
 		    }
 		}
+		if { [llength $namelist] == 1 && [string compare -nocase $tail [lindex $namelist 0]] ==0} {
+		    puts {if test "${CASEINSENSITIVEFS:-}" != "1"; then}
+		    set state fi
+		}
 		if { [llength $namelist] } {
 		    puts "if test -r $tail; then"
 		    puts -nonewline $rmOutput
 		    puts -nonewline $lnOutput
+		    puts "fi"
+		}
+		if { $state == "fi" } {
 		    puts "fi"
 		}
 		set state end
Index: unix/tclLoadDyld.c
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tclLoadDyld.c,v
retrieving revision 1.5
diff -u -3 -r1.5 tclLoadDyld.c
--- unix/tclLoadDyld.c	2001/09/28 01:21:53	1.5
+++ unix/tclLoadDyld.c	2001/11/23 01:34:06
@@ -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 ([email protected]).
- *     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.
  *
@@ -58,63 +57,55 @@
 				 * function which should be used for
 				 * this file. */
 {
-    NSObjectFileImageReturnCode	err;
-    NSObjectFileImage		image;
-    NSModule			module;
-    NSSymbol			symbol;
-    char			*name;
-
-    char *fileName = Tcl_GetString(pathPtr);
-    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_FSGetNativePath(pathPtr);
+    dyld_return = NSAddLibrary(native);
+    
+    if (dyld_return !=  TRUE) {
+	Tcl_AppendResult(interp, "dyld: couldn't add library \"",
+		Tcl_GetString(pathPtr),
+		"\": ", Tcl_PosixError(interp), (char *) NULL);
 	return TCL_ERROR;
     }
 
-    module = NSLinkModule(image, fileName, TRUE);
+    *unloadProcPtr = &TclpUnloadFile;
 
-    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);
-    symbol = NSLookupAndBindSymbol(name);
-    free(name);
-    *proc1Ptr = NSAddressOfSymbol(symbol);
-
-    name = (char*)malloc(sizeof(char)*(strlen(sym2)+2));
-    sprintf(name, "_%s", sym2);
-    symbol = NSLookupAndBindSymbol(name);
-    free(name);
-    *proc2Ptr = NSAddressOfSymbol(symbol);
+    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);
 
-    *clientDataPtr = module;
-    *unloadProcPtr = &TclpUnloadFile;
-    
     return TCL_OK;
 }
 
Index: unix/tclMtherr.c
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tclMtherr.c,v
retrieving revision 1.3
diff -u -3 -r1.3 tclMtherr.c
--- unix/tclMtherr.c	1999/04/16 00:48:04	1.3
+++ unix/tclMtherr.c	2001/11/23 01:34:06
@@ -61,6 +61,9 @@
  *----------------------------------------------------------------------
  */
 
+#ifdef __APPLE_CC__
+__private_extern__
+#endif
 int
 matherr(xPtr)
     struct exception *xPtr;	/* Describes error that occurred. */