From eeb3d9cc7c07965a5d3817321e67491c6eb097f4 Mon Sep 17 00:00:00 2001 From: Peter O'Gorman Date: Sat, 29 Mar 2003 04:09:00 +0000 Subject: [PATCH] * libltdl/ltdl.c (dyld): Remove some debug printf's, fix a bug. * ltmain.in (darwin): Only link against shared libraries when doing link_all_deplibs. --- ChangeLog | 6 ++++++ libltdl/ltdl.c | 14 +++++--------- ltmain.in | 38 +++++++++++++++++++++++--------------- 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index f4d7a6854..346f995c5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-03-28 Peter O'Gorman + + * libltdl/ltdl.c (dyld): Remove some debug printf's, fix a bug. + * ltmain.in (darwin): Only link against shared libraries when doing + link_all_deplibs. + 2003-03-25 Robert Boehne * bootstrap: Add f77demo to the directories that AUTOHEADER diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index 6680ddf22..e3ce820c1 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -1583,10 +1583,6 @@ static struct lt_user_dlloader sys_dld = { # include #endif #include -/* - sectname __mod_term_func - segname __DATA -*/ /* We have to put some stuff here that isn't in older dyld.h files */ #ifndef ENUM_DYLD_BOOL @@ -1729,7 +1725,6 @@ lt_int_dyld_NSlookupSymbolInLinkedLibs(symbol,mh) unsigned long offset = sizeof(struct mach_header); NSSymbol retSym = 0; const struct mach_header *mh1; - fprintf(stderr,"Symbol: %s\n",symbol); if ((ltdl_NSLookupSymbolInImage) && NSIsSymbolNameDefined(symbol) ) { for (j = 0; j < mh->ncmds; j++) @@ -1737,8 +1732,6 @@ lt_int_dyld_NSlookupSymbolInLinkedLibs(symbol,mh) lc = (struct load_command*)(((unsigned long)mh) + offset); if ((LC_LOAD_DYLIB == lc->cmd) || (LC_LOAD_WEAK_DYLIB == lc->cmd)) { - fprintf(stderr,"Symbol %s\n",(char*)(((struct dylib_command*)lc)->dylib.name.offset + - (unsigned long)lc)); mh1=lt_int_dyld_match_loaded_lib_by_install_name((char*)(((struct dylib_command*)lc)->dylib.name.offset + (unsigned long)lc)); if (!mh1) @@ -1855,8 +1848,11 @@ sys_dyld_close (loader_data, module) #ifdef __ppc__ flags += NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES; #endif - retCode = NSUnLinkModule(module,flags); - + if (!NSUnLinkModule(module,flags)) + { + retCode=1; + LT_DLMUTEX_SETERROR (lt_int_dyld_error(LT_DLSTRERROR(CANNOT_CLOSE))); + } } return retCode; diff --git a/ltmain.in b/ltmain.in index 1b13c1ccb..eb7432ee1 100644 --- a/ltmain.in +++ b/ltmain.in @@ -2515,7 +2515,6 @@ EOF if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do - depdepl= case $deplib in -L*) path="$deplib" ;; *.la) @@ -2548,28 +2547,37 @@ EOF depdepl= case $host in *-*-darwin*) - depdepl=`$echo "X$deplib" | ${SED} -e 's,.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - newlib_search_path="$newlib_search_path $path" - if grep "^installed=no" $deplib > /dev/null; then - # FIXME - ugly - if test -f "$path/lib${depdepl}.dylib" ; then - eval depdepl=$path/lib${depdepl}.dylib - else - # We shouldn't get here - depdepl="-l$depdepl" + # we do not want to link against static libs, but need to link against shared + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$path/$depdepl" ; then + depdepl="$path/$depdepl" fi - else - depdepl="-l$depdepl" + newlib_search_path="$newlib_search_path $path" + path="" fi ;; - # end ugly FIXME - esac + *) path="-L$path" + ;; + esac + ;; -l*) case $host in *-*-darwin*) - depdepl=$deplib + # Again, we only want to link against shared libraries + eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` + for tmp in $newlib_search_path ; do + if test -f "$tmp/lib$tmp_libs.dylib" ; then + eval depdepl="$tmp/lib$tmp_libs.dylib" + break + fi + done + path="" ;; *) continue ;; esac -- 2.47.2