+2003-03-28 Peter O'Gorman <peter@pogma.com>
+
+ * 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 <rboehne@gnu.org>
* bootstrap: Add f77demo to the directories that AUTOHEADER
# include <mach-o/dyld.h>
#endif
#include <mach-o/getsect.h>
-/*
- 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
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++)
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)
#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;
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)
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