diff -u -p -x configure -x autom4te.cache -x .DS_Store -r -N -x defs.old orig/trfcrypt2.0p3/Makefile.in trfcrypt/Makefile.in --- orig/trfcrypt2.0p3/Makefile.in Sat Mar 31 22:40:10 2001 +++ trfcrypt/Makefile.in Wed Mar 5 13:44:10 2003 @@ -287,12 +287,12 @@ install-binaries: binaries install-lib-b #======================================================================== install-libraries: libraries - $(mkinstalldirs) $(includedir) + $(mkinstalldirs) $(DESTDIR)$(includedir) -# @echo "Installing header files in $(includedir)" +# @echo "Installing header files in $(DESTDIR)$(includedir)" # @for i in $(GENERIC_HDRS) ; do \ # echo "Installing $$i" ; \ -# $(INSTALL_DATA) $$i $(includedir) ; \ +# $(INSTALL_DATA) $$i $(DESTDIR)$(includedir) ; \ # done; #======================================================================== @@ -442,6 +442,9 @@ tclLoadShl.$(OBJEXT): $(TRC_COMPATDIR)/t tclLoadAout.$(OBJEXT): $(TRC_COMPATDIR)/tclLoadAout.c $(COMPILE) -c `@CYGPATH@ $(TRC_COMPATDIR)/tclLoadAout.c` -o $@ +tclLoadDyld.$(OBJEXT): $(TRC_COMPATDIR)/tclLoadDyld.c + $(COMPILE) -c `@CYGPATH@ $(TRC_COMPATDIR)/tclLoadDyld.c` -o $@ + tclLoadNone.$(OBJEXT): $(TRC_COMPATDIR)/tclLoadNone.c $(COMPILE) -c `@CYGPATH@ $(TRC_COMPATDIR)/tclLoadNone.c` -o $@ @@ -507,7 +510,7 @@ install-lib-binaries: installdirs else :; fi; \ done if test "x$(MAKE_LIB)" = "x$(MAKE_SHARED_LIB)"; then \ - $(TCLSH_PROG) mkIndex.tcl $(lib_BINARIES); \ + cd $(DESTDIR)/ && $(TCLSH_PROG) $(CURDIR)/mkIndex.tcl $(lib_BINARIES); \ fi #======================================================================== diff -u -p -x configure -x autom4te.cache -x .DS_Store -r -N -x defs.old orig/trfcrypt2.0p3/compat/tclLoadDyld.c trfcrypt/compat/tclLoadDyld.c --- orig/trfcrypt2.0p3/compat/tclLoadDyld.c Thu Jan 1 01:00:00 1970 +++ trfcrypt/compat/tclLoadDyld.c Tue Sep 24 10:04:43 2002 @@ -0,0 +1,166 @@ +/* + * tclLoadDyld.c -- + * + * This procedure provides a version of the TclLoadFile that + * works with Apple's dyld dynamic loading. This file + * provided by Wilfredo Sanchez (wsanchez@apple.com). + * 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.12 2002/07/24 13:51:18 das Exp $ + */ + +#include +#include + +#include "tcl.h" + +typedef struct Tcl_DyldModuleHandle { + struct Tcl_DyldModuleHandle *nextModuleHandle; + NSModule module; +} Tcl_DyldModuleHandle; + +typedef struct Tcl_DyldLoadHandle { + const struct mach_header *dyld_lib; + Tcl_DyldModuleHandle *firstModuleHandle; +} Tcl_DyldLoadHandle; + +/* + *---------------------------------------------------------------------- + * + * TclpDlopen -- + * + * Dynamically loads a binary code file into memory and returns + * a handle to the new code. + * + * Results: + * A standard Tcl completion code. If an error occurs, an error + * message is left in the interpreter's result. + * + * Side effects: + * New code suddenly appears in memory. + * + *---------------------------------------------------------------------- + */ + +VOID * +dlopen(path, flags) + CONST char *path; + int flags; +{ + Tcl_DyldLoadHandle *dyldLoadHandle; + const struct mach_header *dyld_lib; + + dyld_lib = NSAddImage(path, + NSADDIMAGE_OPTION_WITH_SEARCHING | + NSADDIMAGE_OPTION_RETURN_ON_ERROR); + + if (!dyld_lib) { + return NULL; + } + dyldLoadHandle = (Tcl_DyldLoadHandle *) ckalloc(sizeof(Tcl_DyldLoadHandle)); + if (!dyldLoadHandle) return NULL; + dyldLoadHandle->dyld_lib = dyld_lib; + dyldLoadHandle->firstModuleHandle = NULL; + return (Tcl_LoadHandle) dyldLoadHandle; +} + +char * +dlerror() +{ + NSLinkEditErrors editError; + char *name, *msg; + NSLinkEditError(&editError, &errno, &name, &msg); + return msg; +} + +/* + *---------------------------------------------------------------------- + * + * TclpFindSymbol -- + * + * Looks up a symbol, by name, through a handle associated with + * a previously loaded piece of code (shared library). + * + * Results: + * Returns a pointer to the function associated with 'symbol' if + * it is found. Otherwise returns NULL and may leave an error + * message in the interp's result. + * + *---------------------------------------------------------------------- + */ +VOID *dlsym(handle, symbol) + VOID *handle; + CONST char *symbol; +{ + NSSymbol nsSymbol; + CONST char *native; + Tcl_DString newName, ds; + Tcl_PackageInitProc* proc = NULL; + Tcl_DyldLoadHandle *dyldLoadHandle = (Tcl_DyldLoadHandle *) handle; + /* + * dyld adds an underscore to the beginning of symbol names. + */ + + native = Tcl_UtfToExternalDString(NULL, symbol, -1, &ds); + Tcl_DStringInit(&newName); + Tcl_DStringAppend(&newName, "_", 1); + native = Tcl_DStringAppend(&newName, native, -1); + nsSymbol = NSLookupSymbolInImage(dyldLoadHandle->dyld_lib, native, + NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW | + NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR); + if(nsSymbol) { + Tcl_DyldModuleHandle *dyldModuleHandle; + proc = NSAddressOfSymbol(nsSymbol); + dyldModuleHandle = (Tcl_DyldModuleHandle *) ckalloc(sizeof(Tcl_DyldModuleHandle)); + if (dyldModuleHandle) { + dyldModuleHandle->module = NSModuleForSymbol(nsSymbol); + dyldModuleHandle->nextModuleHandle = dyldLoadHandle->firstModuleHandle; + dyldLoadHandle->firstModuleHandle = dyldModuleHandle; + } + } + Tcl_DStringFree(&newName); + Tcl_DStringFree(&ds); + + return proc; +} + +/* + *---------------------------------------------------------------------- + * + * TclpUnloadFile -- + * + * Unloads a dynamically loaded binary code file from memory. + * Code pointers in the formerly loaded file are no longer valid + * after calling this function. + * + * Results: + * None. + * + * Side effects: + * Code dissapears from memory. + * Note that this is a no-op on older (OpenStep) versions of dyld. + * + *---------------------------------------------------------------------- + */ + +int +dlclose(handle) + VOID *handle; +{ + Tcl_DyldLoadHandle *dyldLoadHandle = (Tcl_DyldLoadHandle *) handle; + Tcl_DyldModuleHandle *dyldModuleHandle = dyldLoadHandle->firstModuleHandle; + void *ptr; + + while (dyldModuleHandle) { + NSUnLinkModule(dyldModuleHandle->module, NSUNLINKMODULE_OPTION_NONE); + ptr = dyldModuleHandle; + dyldModuleHandle = dyldModuleHandle->nextModuleHandle; + ckfree(ptr); + } + ckfree(dyldLoadHandle); +} diff -u -p -x configure -x autom4te.cache -x .DS_Store -r -N -x defs.old orig/trfcrypt2.0p3/configure.in trfcrypt/configure.in --- orig/trfcrypt2.0p3/configure.in Sat Mar 31 22:40:10 2001 +++ trfcrypt/configure.in Tue Sep 24 10:03:56 2002 @@ -301,7 +301,7 @@ SC_PROG_TCLSH # Check which of the loader modules we need to get at shared libraries dynamically SHARED_LIBS="" -TEST_SUFFIX="${SHLIB_SUFFIX}" +TEST_SUFFIX="${TCL_SHLIB_SUFFIX}" if test "$DL_LIBS" = "-ldl"; then DL_OBJS="" dirs="/lib/libdl${TEST_SUFFIX}* /usr/lib/libdl${TEST_SUFFIX}*" @@ -312,7 +312,7 @@ if test "$DL_LIBS" = "-ldl"; then fi done elif test "$DL_LIBS" = "-ldld"; then - if test "$SHLIB_SUFFIX" = ".sl"; then + if test "$TCL_SHLIB_SUFFIX" = ".sl"; then DL_OBJS="tclLoadShl.o" else DL_OBJS="tclLoadDld.o" @@ -328,13 +328,15 @@ elif test "$DL_LIBS" = "-lld"; then DL_OBJS="tclLoadAix.o" SHARED_LIBS="${TCL_LIB_SPEC} -lld" TEST_SUFFIX=".a" -elif test "$SHLIB_SUFFIX" = "..o" -o "$SHLIB_SUFFIX" = ".a"; then +elif test "$TCL_SHLIB_SUFFIX" = "..o" -o "$TCL_SHLIB_SUFFIX" = ".a"; then DL_OBJS="tclLoadAout.o" if test "x${SHLIB_CFLAGS}" = "x-G 0"; then TEST_SUFFIX="_G0.a" else TEST_SUFFIX=".a" fi +elif test "$TCL_SHLIB_SUFFIX" = ".dylib"; then + DL_OBJS="tclLoadDyld.o" else DL_OBJS="" fi diff -u -p -x configure -x autom4te.cache -x .DS_Store -r -N -x defs.old orig/trfcrypt2.0p3/mkIndex.tcl.in trfcrypt/mkIndex.tcl.in --- orig/trfcrypt2.0p3/mkIndex.tcl.in Sat Mar 31 21:29:35 2001 +++ trfcrypt/mkIndex.tcl.in Wed Mar 5 13:38:45 2003 @@ -90,7 +90,7 @@ set libdir @libdir@ set package @PACKAGE@ set version @VERSION@ -cd $libdir +cd ./$libdir puts "Making pkgIndex.tcl in [file join [pwd] $package]" if {$tcl_platform(platform) == "unix"} { @@ -106,6 +106,7 @@ if {$tcl_platform(platform) == "unix"} { exec chmod a+x $lib } } + catch {package require Trf} puts "eval pkg_mkIndex -verbose $package $libraryPathList *.tcl" eval pkg_mkIndex -load Trf -verbose $package $libraryPathList *.tcl } diff -u -p -x configure -x autom4te.cache -x .DS_Store -r -N -x defs.old orig/trfcrypt2.0p3/trfcrypt.m4 trfcrypt/trfcrypt.m4 --- orig/trfcrypt2.0p3/trfcrypt.m4 Sat Mar 31 21:56:12 2001 +++ trfcrypt/trfcrypt.m4 Tue Sep 24 10:03:20 2002 @@ -355,7 +355,7 @@ AC_CACHE_CHECK(for trf library, if test -n "$trfcrypt_cv_lib_TRF_LIB"; then break fi - for libsuff in .so ".so.*" .sl .a; do + for libsuff in .so ".so.*" .sl .a .dylib; do if test -n "$trfcrypt_cv_lib_TRF_LIB"; then break fi