summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authordas <das>2001-11-23 01:39:42 (GMT)
committerdas <das>2001-11-23 01:39:42 (GMT)
commit54c5936b6021be7a0d149ce218e7bba30faf984e (patch)
tree979fa41979efaf22cb7e936f182fc2a2d165e934 /unix
parent5bf5a16c3a6e83b4297123ae905297ac723f7f81 (diff)
downloadtcl-54c5936b6021be7a0d149ce218e7bba30faf984e.zip
tcl-54c5936b6021be7a0d149ce218e7bba30faf984e.tar.gz
tcl-54c5936b6021be7a0d149ce218e7bba30faf984e.tar.bz2
*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)
Diffstat (limited to 'unix')
-rw-r--r--unix/Makefile.in24
-rw-r--r--unix/configure.in5
-rwxr-xr-xunix/install-sh5
-rw-r--r--unix/mkLinks7
-rw-r--r--unix/mkLinks.tcl12
-rw-r--r--unix/tclLoadDyld.c97
-rw-r--r--unix/tclMtherr.c5
7 files changed, 91 insertions, 64 deletions
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 17fbffd..485e67e 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -5,7 +5,7 @@
# "autoconf" program (constructs like "@foo@" will get replaced in the
# actual Makefile.
#
-# RCS: @(#) $Id: Makefile.in,v 1.87 2001/11/20 10:15:06 hobbs Exp $
+# RCS: @(#) $Id: Makefile.in,v 1.88 2001/11/23 01:39:56 das Exp $
VERSION = @TCL_VERSION@
@@ -166,8 +166,12 @@ SHELL = /bin/sh
# "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 @@ doc:
${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 @@ dltest/Makefile: $(DLTEST_DIR)/configure $(DLTEST_DIR)/Makefile.in tclConfig.sh
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 @@ install-binaries: binaries
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-binaries: binaries
@$(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 @@ dist: $(UNIX_DIR)/configure mklinks
$(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
diff --git a/unix/configure.in b/unix/configure.in
index fcbe009..3d8bf8e 100644
--- a/unix/configure.in
+++ b/unix/configure.in
@@ -3,7 +3,7 @@ dnl This file is an input file used by the GNU "autoconf" program to
dnl generate the file "configure", which is run during Tcl installation
dnl to configure the system for the local environment.
#
-# RCS: @(#) $Id: configure.in,v 1.75 2001/11/16 20:55:39 hobbs Exp $
+# RCS: @(#) $Id: configure.in,v 1.76 2001/11/23 01:39:50 das Exp $
AC_INIT(../generic/tcl.h)
@@ -392,8 +392,7 @@ if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != "" ; then
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
diff --git a/unix/install-sh b/unix/install-sh
index 0ff4b6a..a9a1f27 100755
--- a/unix/install-sh
+++ b/unix/install-sh
@@ -62,6 +62,11 @@ while [ x"$1" != x ]; do
shift
continue;;
+ -S) stripcmd="$stripprog $2"
+ shift
+ shift
+ continue;;
+
*) if [ x"$src" = x ]
then
src=$1
diff --git a/unix/mkLinks b/unix/mkLinks
index 8b671bc..b5c2022 100644
--- a/unix/mkLinks
+++ b/unix/mkLinks
@@ -23,10 +23,15 @@ fi
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,10 +1169,12 @@ if test -r WrongNumArgs.3; then
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
rm -f auto_import.n
diff --git a/unix/mkLinks.tcl b/unix/mkLinks.tcl
index 45a6131..ba99145 100644
--- a/unix/mkLinks.tcl
+++ b/unix/mkLinks.tcl
@@ -30,10 +30,15 @@ fi
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,12 +66,19 @@ foreach file $argv {
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
}
end {
diff --git a/unix/tclLoadDyld.c b/unix/tclLoadDyld.c
index 3fde4b9..e62a8b2 100644
--- a/unix/tclLoadDyld.c
+++ b/unix/tclLoadDyld.c
@@ -2,17 +2,16 @@
* 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.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclLoadDyld.c,v 1.5 2001/09/28 01:21:53 dgp Exp $
+ * RCS: @(#) $Id: tclLoadDyld.c,v 1.6 2001/11/23 01:40:10 das Exp $
*/
#include "tclInt.h"
@@ -58,63 +57,55 @@ TclpLoadFile(interp, pathPtr, sym1, sym2, proc1Ptr, proc2Ptr,
* function which should be used for
* this file. */
{
- NSObjectFileImageReturnCode err;
- NSObjectFileImage image;
- NSModule module;
- NSSymbol symbol;
- char *name;
+ NSSymbol symbol;
+ enum DYLD_BOOL dyld_return;
+ Tcl_DString newName, ds;
+ char *native;
- 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;
- }
+ 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.
+ */
- name = (char*)malloc(sizeof(char)*(strlen(sym1)+2));
- sprintf(name, "_%s", sym1);
- symbol = NSLookupAndBindSymbol(name);
- free(name);
- *proc1Ptr = NSAddressOfSymbol(symbol);
+ 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(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;
}
diff --git a/unix/tclMtherr.c b/unix/tclMtherr.c
index d1150f6..f9c61bc 100644
--- a/unix/tclMtherr.c
+++ b/unix/tclMtherr.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclMtherr.c,v 1.3 1999/04/16 00:48:04 stanton Exp $
+ * RCS: @(#) $Id: tclMtherr.c,v 1.4 2001/11/23 01:40:13 das Exp $
*/
#include "tclInt.h"
@@ -61,6 +61,9 @@ struct exception {
*----------------------------------------------------------------------
*/
+#ifdef __APPLE_CC__
+__private_extern__
+#endif
int
matherr(xPtr)
struct exception *xPtr; /* Describes error that occurred. */