From 9bfa9cf6b9554aec8374e19eb143d35efdcf3c32 Mon Sep 17 00:00:00 2001 From: Peter O'Gorman Date: Fri, 1 Aug 2003 19:08:14 +0000 Subject: [PATCH] * libtool.m4 (darwin): Use "-undefined dynamic_lookup" if the user set MACOSX_DEPLOYMENT_TARGET to 10.3 or greater. * libltdl/ltdl.c (dyld): Save the error from the first lookup to report in lt_dlerror(). Otherwise the error is always "Symbol _foo not in /usr/lib/libSystem.dylib". Thanks to Chris Zubrzycki for reporting this. --- ChangeLog | 9 +++++++++ libltdl/ltdl.c | 5 ++++- libtool.m4 | 39 ++++++++++++++++++++++++++++++++++++--- 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0ba2bfaf1..5a70aaf6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2003-08-01 Peter O'Gorman + + * libtool.m4 (darwin): Use "-undefined dynamic_lookup" if the + user set MACOSX_DEPLOYMENT_TARGET to 10.3 or greater. + * libltdl/ltdl.c (dyld): Save the error from the first lookup + to report in lt_dlerror(). Otherwise the error is always + "Symbol _foo not in /usr/lib/libSystem.dylib". + Thanks to Chris Zubrzycki for reporting this. + 2003-08-01 Robert Boehne * libltdl/ltdl.h: Tweak the header to support visual studio. diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index b6de7dbe2..d45de1550 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -1870,6 +1870,7 @@ sys_dyld_sym (loader_data, module, symbol) NSSymbol *nssym = 0; void *unused; const struct mach_header *mh=NULL; + char saveError[256] = "Symbol not found"; if (module == (lt_module)-1) { _dyld_lookup_and_bind(symbol,(unsigned long*)&address,&unused); @@ -1900,12 +1901,14 @@ sys_dyld_sym (loader_data, module, symbol) } if (!nssym) { + strncpy(saveError, lt_int_dyld_error(LT_DLSTRERROR(SYMBOL_NOT_FOUND)), 255); + saveError[255] = 0; if (!mh) mh=lt_int_dyld_get_mach_header_from_nsmodule(module); nssym = lt_int_dyld_NSlookupSymbolInLinkedLibs(symbol,mh); } if (!nssym) { - LT_DLMUTEX_SETERROR (lt_int_dyld_error(LT_DLSTRERROR(SYMBOL_NOT_FOUND))); + LT_DLMUTEX_SETERROR (saveError); return NULL; } return NSAddressOfSymbol(nssym); diff --git a/libtool.m4 b/libtool.m4 index 7b08d2809..88a2816cf 100644 --- a/libtool.m4 +++ b/libtool.m4 @@ -2567,7 +2567,18 @@ aix4*) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' ;; *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' + ;; + esac + fi ;; esac output_verbose_link_cmd='echo' @@ -2893,7 +2904,18 @@ case $host_os in _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' ;; *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' + ;; + esac + fi ;; esac lt_int_apple_cc_single_mod=no @@ -5344,7 +5366,18 @@ EOF _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' ;; *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' + ;; + esac + fi ;; esac lt_int_apple_cc_single_mod=no -- 2.47.2