libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: big diff for darwin


From: Robert Boehne x238
Subject: Re: big diff for darwin
Date: Thu, 20 Mar 2003 14:23:33 -0600

Approved, with minor modifications to port to CVS head.
Checking in the attached patch.

Thanks!

-- 
Robert Boehne             Software Engineer
Ricardo Software   Chicago Technical Center
TEL: (630)789-0003 x. 238
FAX: (630)789-0127
email:  rboehne AT ricardo-us DOT com
? missing
? latest-darwin-fixes.patch
? autom4te.cache
? install-sh
? mkinstalldirs
? COPYING
? INSTALL
? new-darwin.diff
? cdemo/autom4te.cache
? demo/autom4te.cache
? depdemo/autom4te.cache
? f77demo/autom4te.cache
? libltdl/missing
? libltdl/autom4te.cache
? libltdl/config-h.in
? libltdl/install-sh
? libltdl/mkinstalldirs
? mdemo/autom4te.cache
? pdemo/autom4te.cache
? tagdemo/autom4te.cache
Index: ChangeLog
===================================================================
RCS file: /cvsroot/libtool/libtool/ChangeLog,v
retrieving revision 1.1206
diff -u -r1.1206 ChangeLog
--- ChangeLog   20 Mar 2003 18:02:05 -0000      1.1206
+++ ChangeLog   20 Mar 2003 20:22:54 -0000
@@ -1,3 +1,22 @@
+2003-03-20  Peter O'Gorman  <address@hidden>
+       
+       * ltmain.in: Always use $echo not echo for consistency.
+       Changes for darwin building. Warn if linking against libs linked
+       with -module. Use module_cmds if available and building a module,
+       move convenience double lib check,
+       * libltdl/ltdl.c: ltdl support for darwin (first blush)
+       * libltdl/README: note that darwin is supported
+       * ltdl.m4: Changes for darwin, and for new shrext
+       * libtool.m4: Changed the way darwin builds stuff (make check passes)
+       added module_cmds, module_expsym_cmds and hardcode_automatic and put
+       them in the libtool script. check for zsh's removal of escapes. Allow
+       libraries to be stripped on darwin.
+       * TODO: Remove the todo about zsh's removal of excapes. note that zsh
+       echo works perfectly well, eval is screwed up. Seems to be fixed in
+       latest zsh.
+       * THANKS: added self :)
+       * f77demo/configure.ac: Use config.h or it doesn't work.
+
 2003-03-19  Robert Boehne  <address@hidden>
 
        * libtool.m4 (_LT_AC_TAGCONFIG): Add test around the macro that
Index: THANKS
===================================================================
RCS file: /cvsroot/libtool/libtool/THANKS,v
retrieving revision 1.33
diff -u -r1.33 THANKS
--- THANKS      28 Feb 2003 02:57:07 -0000      1.33
+++ THANKS      20 Mar 2003 20:22:54 -0000
@@ -40,6 +40,7 @@
 Ossama Othman                   address@hidden
 Paul Eggert                     address@hidden
 Peter Eisentraut                address@hidden
+Peter O'Gorman                  address@hidden
 Benjamin Reed                   address@hidden
 Pavel Roskin                    address@hidden
 Rainer Orth                     address@hidden
Index: TODO
===================================================================
RCS file: /cvsroot/libtool/libtool/TODO,v
retrieving revision 1.48
diff -u -r1.48 TODO
--- TODO        20 Jun 2002 06:58:38 -0000      1.48
+++ TODO        20 Mar 2003 20:22:54 -0000
@@ -1,9 +1,6 @@
 In the near future:
 ********************
 
-* Figure out why zsh echo builtin's removal of \ escapes is not detected
-  by libtool's echo selector.
-
 * Port the migration of all code from ltconfig into libtool.m4 to the
 multi-language-branch, so that CVS automake can remove its references
 to ltconfig.
Index: configure.ac
===================================================================
RCS file: /cvsroot/libtool/libtool/configure.ac,v
retrieving revision 1.12
diff -u -r1.12 configure.ac
--- configure.ac        20 Mar 2003 18:02:05 -0000      1.12
+++ configure.ac        20 Mar 2003 20:22:54 -0000
@@ -53,7 +53,7 @@
 ## Automake Initialisation. ##
 ## ------------------------ ##
 AM_INIT_AUTOMAKE(AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION)
-
+AM_CONFIG_HEADER([config.h:config-h.in])
 
 
 ## ------------------------------- ##
Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libtool.m4,v
retrieving revision 1.309
diff -u -r1.309 libtool.m4
--- libtool.m4  20 Mar 2003 18:02:05 -0000      1.309
+++ libtool.m4  20 Mar 2003 20:22:54 -0000
@@ -298,7 +298,9 @@
 elif test "X[$]1" = X--fallback-echo; then
   # Avoid inline document here, it may be left over
   :
-elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' && 
+     eval echo_test_var=`$echo '\\\t'` &&
+          test "X$echo_test_var" = "X\t"; then
   # Yippee, $echo works!
   :
 else
@@ -334,6 +336,8 @@
 fi
 
 if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+     eval echo_test_var=`$echo '\\\t'` &&
+          test "X$echo_test_var" = "X\t" &&
    echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
    test "X$echo_testing_string" = "X$echo_test_string"; then
   :
@@ -349,6 +353,8 @@
     IFS="$lt_save_ifs"
     if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
        test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+     eval echo_test_var=`$dir/echo '\\\t'` &&
+          test "X$echo_test_var" = "X\t" &&
        echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
        test "X$echo_testing_string" = "X$echo_test_string"; then
       echo="$dir/echo"
@@ -360,6 +366,8 @@
   if test "X$echo" = Xecho; then
     # We didn't find a better echo, so look for alternatives.
     if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+          eval echo_test_var=`print -r '\\\t'` &&
+          test "X$echo_test_var" = "X\t" &&
        echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
        test "X$echo_testing_string" = "X$echo_test_string"; then
       # This shell has a builtin print -r that does the trick.
@@ -376,6 +384,8 @@
       # Try using printf.
       echo='printf %s\n'
       if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+     eval echo_test_var=`$echo '\\\t'` &&
+          test "X$echo_test_var" = "X\t" &&
         echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
         test "X$echo_testing_string" = "X$echo_test_string"; then
        # Cool, printf works
@@ -823,6 +833,16 @@
     lt_cv_dlopen_libs=
    ;;
 
+  darwin*)
+  # if libdl is installed we need to link against it
+    AC_CHECK_LIB([dl], [dlopen],
+               [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ])
+   ;;
+    
   *)
     AC_CHECK_FUNC([shl_load],
          [lt_cv_dlopen="shl_load"],
@@ -1001,7 +1021,8 @@
 [AC_MSG_CHECKING([how to hardcode library paths into programs])
 _LT_AC_TAGVAR(hardcode_action, $1)=
 if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
-   test -n "$_LT_AC_TAGVAR(runpath_var $1)"; then
+   test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \
+   test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then
 
   # We can hardcode non-existant directories.
   if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
@@ -1045,8 +1066,21 @@
   test -z "$striplib" && striplib="$STRIP --strip-unneeded"
   AC_MSG_RESULT([yes])
 else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         AC_MSG_RESULT([yes])
+       else
   AC_MSG_RESULT([no])
 fi
+       ;;
+   *)
+  AC_MSG_RESULT([no])
+    ;;
+  esac  
+fi
 ])# AC_LIBTOOL_SYS_LIB_STRIP
 
 
@@ -2063,6 +2097,7 @@
   ;;
 
 darwin* | rhapsody*)
+  # this will be overwritten by pass_all, but leave it in just in case
   lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared 
library'
   lt_cv_file_magic_cmd='/usr/bin/file -L'
   case "$host_os" in
@@ -2073,6 +2108,7 @@
     lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
     ;;
   esac
+  lt_cv_deplibs_check_method=pass_all
   ;;
 
 freebsd*)
@@ -2278,7 +2314,7 @@
 LIBM=
 case $host in
 *-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
-  # These system don't have libm
+  # These system don't have libm, or don't need it
   ;;
 *-ncr-sysv4.3*)
   AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
@@ -2518,23 +2554,26 @@
       test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, 
$1)='-flat_namespace -undefined suppress'
       ;;
     esac
-    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
     # FIXME: Relying on posixy $() will cause problems for
     #        cross-compilation, but unfortunately the echo tests do not
     #        yet detect zsh echo's removal of \ escapes.  Also zsh mangles
     #         `"' quotes if we put them in here... so don't!
-    _LT_AC_TAGVAR(archive_cmds, $1)='$CC $(test .$module = .yes && echo 
-bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs 
$deplibs$compiler_flags $(test .$module != .yes && echo -install_name 
$rpath/$soname $verstring)'
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o 
$lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring'
+    _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle $allow_undefined_flag -o $lib 
$libobjs $deplibs$compiler_flags'
     # Don't fix this by using the ld -exported_symbols_list flag, it doesn't 
exist in older darwin ld's
     if test -z ${ZSH_VERSION} ; then
-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    
]*,," -e "s,^\(..*\),_&," < $export_symbols > 
$output_objdir/${libname}-symbols.expsym && $CC $(test .$module = .yes && echo 
-bundle || echo -dynamiclib) $allow_undefined_flag  -o $lib $libobjs 
$deplibs$compiler_flags $(test .$module != .yes && echo -install_name 
$rpath/$soname $verstring) && strip -s $output_objdir/${libname}-symbols.expsym 
-u ${lib}'
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    
]*,," -e "s,^\(..*\),_&," < $export_symbols > 
$output_objdir/${libname}-symbols.expsym && $CC -dynamiclib 
$allow_undefined_flag  -o $lib $libobjs $deplibs$compiler_flags -install_name 
$rpath/$soname $verstring && nmedit -s $output_objdir/${libname}-symbols.expsym 
${lib}'
+      _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    
]*,," -e "s,^\(..*\),_&," < $export_symbols > 
$output_objdir/${libname}-symbols.expsym && $CC -bundle $allow_undefined_flag  
-o $lib $libobjs $deplibs$compiler_flags && nmedit -s 
$output_objdir/${libname}-symbols.expsym ${lib}'
     else
       #just in case a default was set somewhere
       _LT_AC_TAGVAR(archive_expsym_cmds, $1)=''
+      _LT_AC_TAGVAR(module_expsym_cmds, $1)=''
     fi
     _LT_AC_TAGVAR(hardcode_direct, $1)=no
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
     _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
     ;;  
 esac
 AC_MSG_RESULT([$enable_shared])
@@ -2572,6 +2611,9 @@
 _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
 _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
 _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
 _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
 _LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
 _LT_AC_TAGVAR(no_undefined_flag, $1)=
@@ -2843,23 +2885,22 @@
       test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, 
$1)='-flat_namespace -undefined suppress'
       ;;
     esac
-    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-    # FIXME: Relying on posixy $() will cause problems for
-    #        cross-compilation, but unfortunately the echo tests do not
-    #        yet detect zsh echo's removal of \ escapes.  Also zsh mangles
-    #         `"' quotes if we put them in here... so don't!
-    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load 
-keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test 
.$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o 
$lib ${lib}-master.o $deplibs$compiler_flags $(test .$module != .yes && echo 
-install_name $rpath/$soname $verstring)'
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load 
-keep_private_externs -nostdlib -o ${lib}-master.o $libobjs $deplibs && $CC 
-dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags 
-install_name $rpath/$soname $verstring'
+      _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle ${wl}-bind_at_load 
$allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags'
+
     # Don't fix this by using the ld -exported_symbols_list flag, it doesn't 
exist in older darwin ld's
     if test -z ${ZSH_VERSION} ; then
-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    
]*,," -e "s,^\(..*\),_&," < $export_symbols > 
$output_objdir/${libname}-symbols.expsym && $CC -r ${wl}-bind_at_load 
-keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test 
.$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o 
$lib ${lib}-master.o $deplibs$compiler_flags $(test .$module != .yes && echo 
-install_name $rpath/$soname $verstring) && strip -s 
$output_objdir/${libname}-symbols.expsym -u ${lib}'
+        _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    
]*,," -e "s,^\(..*\),_&," < $export_symbols > 
$output_objdir/${libname}-symbols.expsym && $CC -r ${wl}-bind_at_load 
-keep_private_externs -nostdlib -o ${lib}-master.o $libobjs $deplibs && $CC 
-dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags 
-install_name $rpath/$soname $verstring && nmedit -s 
$output_objdir/${libname}-symbols.expsym ${lib}'
+        _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    
]*,," -e "s,^\(..*\),_&," < $export_symbols > 
$output_objdir/${libname}-symbols.expsym && $CC -bundle $allow_undefined_flag  
-o $lib $libobjs $deplibs$compiler_flags && nmedit -s 
$output_objdir/${libname}-symbols.expsym ${lib}'
     else
       #just in case a default was set somewhere
       _LT_AC_TAGVAR(archive_expsym_cmds, $1)=''
     fi
     _LT_AC_TAGVAR(hardcode_direct, $1)=no
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
     _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
     ;;
 
   dgux*)
@@ -3576,6 +3617,9 @@
 _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
 _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
 _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
 _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
 _LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
 _LT_AC_TAGVAR(no_undefined_flag, $1)=
@@ -3798,6 +3842,9 @@
     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \
     _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \
     _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \
+    _LT_AC_TAGVAR(hardcode_automatic, $1) \
+    _LT_AC_TAGVAR(module_cmds, $1) \
+    _LT_AC_TAGVAR(module_expsym_cmds, $1) \
     _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
     _LT_AC_TAGVAR(exclude_expsyms, $1) \
     _LT_AC_TAGVAR(include_expsyms, $1); do
@@ -3807,6 +3854,8 @@
     _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \
     _LT_AC_TAGVAR(archive_cmds, $1) | \
     _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \
+    _LT_AC_TAGVAR(module_cmds, $1) | \
+    _LT_AC_TAGVAR(module_expsym_cmds, $1) | \   
     _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \
     _LT_AC_TAGVAR(export_symbols_cmds, $1) | \
     extract_expsyms_cmds | reload_cmds | finish_cmds | \
@@ -4047,6 +4096,10 @@
 postinstall_cmds=$lt_postinstall_cmds
 postuninstall_cmds=$lt_postuninstall_cmds
 
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1)
+module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1)
+
 # Commands to strip libraries.
 old_striplib=$lt_old_striplib
 striplib=$lt_striplib
@@ -4137,6 +4190,10 @@
 # the resulting binary.
 hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)
 
+# Set to yes if building a shared library automatically hardcodes DIR into the 
library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1)
+
 # Variables whose values should be saved in libtool wrapper scripts and
 # restored at relink time.
 variables_saved_for_relink="$variables_saved_for_relink"
@@ -4919,6 +4976,9 @@
   _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
   _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
   _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+  _LT_AC_TAGVAR(hardcode_automatic, $1)=no
+  _LT_AC_TAGVAR(module_cmds, $1)=
+  _LT_AC_TAGVAR(module_expsym_cmds, $1)=  
   _LT_AC_TAGVAR(always_export_symbols, $1)=no
   _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | 
$global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
   # include_expsyms should be a list of space-separated symbols to be *always*
@@ -5258,23 +5318,27 @@
        test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, 
$1)='-flat_namespace -undefined suppress'
        ;;
       esac
-      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
       # FIXME: Relying on posixy $() will cause problems for
       #        cross-compilation, but unfortunately the echo tests do not
       #        yet detect zsh echo's removal of \ escapes.  Also zsh mangles
       #               `"' quotes if we put them in here... so don't!
-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load 
-keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test 
.$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o 
$lib ${lib}-master.o $deplibs$compiler_flags $(test .$module != .yes && echo 
-install_name $rpath/$soname $verstring)'
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load 
-keep_private_externs -nostdlib -o ${lib}-master.o $libobjs $deplibs && $CC 
-dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags 
-install_name $rpath/$soname $verstring'
+      _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle ${wl}-bind_at_load 
$allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags'
+
       # Don't fix this by using the ld -exported_symbols_list flag, it doesn't 
exist in older darwin ld's
       if test -z ${ZSH_VERSION} ; then
-        _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    
]*,," -e "s,^\(..*\),_&," < $export_symbols > 
$output_objdir/${libname}-symbols.expsym && $CC -r ${wl}-bind_at_load 
-keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test 
.$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o 
$lib ${lib}-master.o $deplibs$compiler_flags $(test .$module != .yes && echo 
-install_name $rpath/$soname $verstring) && strip -s 
$output_objdir/${libname}-symbols.expsym -u ${lib}'
+        _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    
]*,," -e "s,^\(..*\),_&," < $export_symbols > 
$output_objdir/${libname}-symbols.expsym && $CC -r ${wl}-bind_at_load 
-keep_private_externs -nostdlib -o ${lib}-master.o $libobjs $deplibs && $CC 
-dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags 
-install_name $rpath/$soname $verstring && nmedit -s 
$output_objdir/${libname}-symbols.expsym ${lib}'
+        _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    
]*,," -e "s,^\(..*\),_&," < $export_symbols > 
$output_objdir/${libname}-symbols.expsym && $CC -bundle $allow_undefined_flag  
-o $lib $libobjs $deplibs$compiler_flags && nmedit -s 
$output_objdir/${libname}-symbols.expsym ${lib}'
       else
         #just in case a default was set somewhere
         _LT_AC_TAGVAR(archive_expsym_cmds, $1)=''
+        _LT_AC_TAGVAR(module_expsym_cmds, $1)=''
       fi
       _LT_AC_TAGVAR(hardcode_direct, $1)=no
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
       _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
       ;;
 
     dgux*)
Index: ltdl.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/ltdl.m4,v
retrieving revision 1.46
diff -u -r1.46 ltdl.m4
--- ltdl.m4     23 Feb 2003 23:49:34 -0000      1.46
+++ ltdl.m4     20 Mar 2003 20:22:54 -0000
@@ -95,7 +95,7 @@
 
 AC_CHECK_HEADERS([assert.h ctype.h errno.h malloc.h memory.h stdlib.h \
                  stdio.h unistd.h])
-AC_CHECK_HEADERS([dl.h sys/dl.h dld.h])
+AC_CHECK_HEADERS([dl.h sys/dl.h dld.h mach-o/dyld.h])
 AC_CHECK_HEADERS([string.h strings.h], [break])
 
 AC_CHECK_FUNCS([strchr index], [break])
@@ -205,22 +205,12 @@
 # ----------------
 AC_DEFUN([AC_LTDL_SHLIBEXT],
 [AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER])
-AC_CACHE_CHECK([which extension is used for shared libraries],
+AC_CACHE_CHECK([which extension is used for loadable modules],
   [libltdl_cv_shlibext],
-  [ac_last=
-  for ac_spec in $library_names_spec; do
-    ac_last="$ac_spec"
-  done
-  echo "$ac_last" | [sed 's/\[.*\]//;s/^[^.]*//;s/\$.*$//;s/\.$//'] > conftest
-  libltdl_cv_shlibext=`cat conftest`
-  rm -f conftest
+[
+module=yes
+eval libltdl_cv_shlibext=$shrext
   ])
-  # The above does not work on darwin, due to the test's in the 
library_names_spec
-  # The test description should probably say "which extension is used for 
loadable
-  # modules"
-  case "$host_os" in
-    darwin*) libltdl_cv_shlibext=".so" ;;
-  esac  
 if test -n "$libltdl_cv_shlibext"; then
   AC_DEFINE_UNQUOTED(LTDL_SHLIB_EXT, "$libltdl_cv_shlibext",
     [Define to the extension used for shared libraries, say, ".so".])
@@ -339,7 +329,10 @@
          [AC_CHECK_LIB([dld], [dld_link],
                [AC_DEFINE([HAVE_DLD], [1],
                           [Define if you have the GNU dld library.])
-               LIBADD_DL="$LIBADD_DL -ldld"
+               LIBADD_DL="$LIBADD_DL -ldld"],
+               [AC_CHECK_FUNC([_dyld_func_lookup],
+                      [AC_DEFINE([HAVE_DYLD], [1],
+                         [Define if you have the _dyld_func_lookup 
function.])])
           ])
         ])
       ])
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.327
diff -u -r1.327 ltmain.in
--- ltmain.in   17 Mar 2003 00:52:48 -0000      1.327
+++ ltmain.in   20 Mar 2003 20:22:54 -0000
@@ -97,8 +97,8 @@
 : ${IFS="      "}
 
 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
-  echo "$modename: not configured to build any kind of library" 1>&2
-  echo "Fatal configuration error.  See the $PACKAGE docs for more 
information." 1>&2
+  $echo "$modename: not configured to build any kind of library" 1>&2
+  $echo "Fatal configuration error.  See the $PACKAGE docs for more 
information." 1>&2
   exit 1
 fi
 
@@ -151,13 +151,12 @@
     esac
     ;;
   esac
-  echo $win32_libid_type
+  $echo $win32_libid_type
 }
 
 # End of Shell function definitions
 #####################################
 
-
 # Parse our command line options once, thoroughly.
 while test "$#" -gt 0
 do
@@ -181,7 +180,7 @@
       # Check whether tagname contains only valid characters
       case $tagname in
       *[!-_A-Za-z0-9,/]*)
-       echo "$progname: invalid tag name: $tagname" 1>&2
+       $echo "$progname: invalid tag name: $tagname" 1>&2
        exit 1
        ;;
       esac
@@ -197,7 +196,7 @@
          # Evaluate the configuration.
          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: 
'$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
        else
-         echo "$progname: ignoring unknown tag $tagname" 1>&2
+         $echo "$progname: ignoring unknown tag $tagname" 1>&2
        fi
        ;;
       esac
@@ -219,11 +218,11 @@
     ;;
 
   --version)
-    echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
-    echo
-    echo "Copyright (C) 2003  Free Software Foundation, Inc."
-    echo "This is free software; see the source for copying conditions.  There 
is NO"
-    echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE."
+    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
+    $echo
+    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
+    $echo "This is free software; see the source for copying conditions.  
There is NO"
+    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE."
     exit 0
     ;;
 
@@ -237,7 +236,7 @@
     ;;
 
   --debug)
-    echo "$progname: enabling shell trace mode"
+    $echo "$progname: enabling shell trace mode"
     set -x
     ;;
 
@@ -246,16 +245,16 @@
     ;;
 
   --features)
-    echo "host: $host"
+    $echo "host: $host"
     if test "$build_libtool_libs" = yes; then
-      echo "enable shared libraries"
+      $echo "enable shared libraries"
     else
-      echo "disable shared libraries"
+      $echo "disable shared libraries"
     fi
     if test "$build_old_libs" = yes; then
-      echo "enable static libraries"
+      $echo "enable static libraries"
     else
-      echo "disable static libraries"
+      $echo "disable static libraries"
     fi
     exit 0
     ;;
@@ -547,11 +546,11 @@
        # was found and let the user know that the "--tag" command
        # line option must be used.
        if test -z "$tagname"; then
-         echo "$modename: unable to infer tagged configuration"
-         echo "$modename: specify a tag with \`--tag'" 1>&2
+         $echo "$modename: unable to infer tagged configuration"
+         $echo "$modename: specify a tag with \`--tag'" 1>&2
          exit 1
 #        else
-#          echo "$modename: using $tagname tagged configuration"
+#          $echo "$modename: using $tagname tagged configuration"
        fi
        ;;
       esac
@@ -615,7 +614,7 @@
       done
     elif test "$need_locks" = warn; then
       if test -f "$lockfile"; then
-       echo "\
+       $echo "\
 *** ERROR, $lockfile exists and contains:
 `cat $lockfile 2>/dev/null`
 
@@ -629,7 +628,7 @@
        $run $rm $removelist
        exit 1
       fi
-      echo $srcfile > "$lockfile"
+      $echo $srcfile > "$lockfile"
     fi
 
     if test -n "$fix_srcfile_path"; then
@@ -687,7 +686,7 @@
 
       if test "$need_locks" = warn &&
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
-       echo "\
+       $echo "\
 *** ERROR, $lockfile contains:
 `cat $lockfile 2>/dev/null`
 
@@ -757,7 +756,7 @@
 
       if test "$need_locks" = warn &&
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
-       echo "\
+       $echo "\
 *** ERROR, $lockfile contains:
 `cat $lockfile 2>/dev/null`
 
@@ -1645,11 +1644,11 @@
        # was found and let the user know that the "--tag" command
        # line option must be used.
        if test -z "$tagname"; then
-         echo "$modename: unable to infer tagged configuration"
-         echo "$modename: specify a tag with \`--tag'" 1>&2
+         $echo "$modename: unable to infer tagged configuration"
+         $echo "$modename: specify a tag with \`--tag'" 1>&2
          exit 1
 #       else
-#         echo "$modename: using $tagname tagged configuration"
+#         $echo "$modename: using $tagname tagged configuration"
        fi
        ;;
       esac
@@ -1911,17 +1910,17 @@
          case $linkmode in
          lib)
            if test "$deplibs_check_method" != pass_all; then
-             echo
-             echo "*** Warning: Trying to link with static lib archive 
$deplib."
-             echo "*** I have the capability to make that library 
automatically link in when"
-             echo "*** you link to this library.  But I can only do this if 
you have a"
-             echo "*** shared version of the library, which you do not appear 
to have"
-             echo "*** because the file extensions .$libext of this argument 
makes me believe"
-             echo "*** that it is just a static archive that I should not used 
here."
+             $echo
+             $echo "*** Warning: Trying to link with static lib archive 
$deplib."
+             $echo "*** I have the capability to make that library 
automatically link in when"
+             $echo "*** you link to this library.  But I can only do this if 
you have a"
+             $echo "*** shared version of the library, which you do not appear 
to have"
+             $echo "*** because the file extensions .$libext of this argument 
makes me believe"
+             $echo "*** that it is just a static archive that I should not 
used here."
            else
-             echo
-             echo "*** Warning: Linking the shared library $output against the"
-             echo "*** static library $deplib is not portable!"
+             $echo
+             $echo "*** Warning: Linking the shared library $output against 
the"
+             $echo "*** static library $deplib is not portable!"
              deplibs="$deplib $deplibs"
            fi
            continue
@@ -1981,8 +1980,9 @@
        library_names=
        old_library=
        # If the library was installed with an old release of libtool,
-       # it will not redefine variable installed.
+       # it will not redefine variables installed, or shouldnotlink
        installed=yes
+       shouldnotlink=no
 
        # Read the .la file
        case $lib in
@@ -2025,6 +2025,7 @@
          continue
        fi # $pass = conv
 
+    
        # Get the name of the library we link against.
        linklib=
        for l in $old_library $library_names; do
@@ -2117,6 +2118,7 @@
          continue
        fi
 
+    
        if test "$linkmode" = prog && test "$pass" != link; then
          newlib_search_path="$newlib_search_path $ladir"
          deplibs="$lib $deplibs"
@@ -2203,6 +2205,17 @@
            need_relink=yes
          fi
          # This is a shared library
+       
+      # Warn about portability, can't link against -module's on some systems 
(darwin)
+      if test "$shouldnotlink" = yes && test "$pass" = link ; then
+           $echo
+           if test "$linkmode" = prog; then
+             $echo "*** Warning: Linking the executable $output against the 
loadable module"
+           else
+             $echo "*** Warning: Linking the shared library $output against 
the loadable module"
+           fi
+           $echo "*** $linklib is not portable!"    
+      fi         
          if test "$linkmode" = lib &&
             test "$hardcode_into_libs" = yes; then
            # Hardcode the library path.
@@ -2252,8 +2265,8 @@
 
            # Make a new name for the extract_expsyms_cmds to use
            soroot="$soname"
-           soname=`echo $soroot | ${SED} -e 's/^.*\///'`
-           newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
+           soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
+           newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
 
            # If the library has no export list, then create one now
            if test -f "$output_objdir/$soname-def"; then :
@@ -2294,10 +2307,23 @@
            case $hardcode_action in
            immediate | unsupported)
              if test "$hardcode_direct" = no; then
+               add="$dir/$linklib"
                case $host in
                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
+                 *-*-darwin* )
+                   # if the lib is a module then we can not link against it, 
someone
+                   # is ignoring the new warnings I added
+                   if test -z `otool -XD $add` ; then
+                     $echo "** Warning, lib $linklib is a module, not a shared 
library"
+                     if test -z "$old_library" ; then
+                       $echo
+                       $echo "** And there doesn't seem to be a static archive 
available"
+                       $echo "** The link will probably fail, sorry"
+                     else
+                       add="$dir/$old_library"
+                     fi 
+                   fi
                esac
-               add="$dir/$linklib"
              elif test "$hardcode_minus_L" = no; then
                case $host in
                *-*-sunos*) add_shlibpath="$dir" ;;
@@ -2421,21 +2447,21 @@
 
            # Just print a warning and add the library to dependency_libs so
            # that the program can be linked against the static library.
-           echo
-           echo "*** Warning: This system can not link to static lib archive 
$lib."
-           echo "*** I have the capability to make that library automatically 
link in when"
-           echo "*** you link to this library.  But I can only do this if you 
have a"
-           echo "*** shared version of the library, which you do not appear to 
have."
+           $echo
+           $echo "*** Warning: This system can not link to static lib archive 
$lib."
+           $echo "*** I have the capability to make that library automatically 
link in when"
+           $echo "*** you link to this library.  But I can only do this if you 
have a"
+           $echo "*** shared version of the library, which you do not appear 
to have."
            if test "$module" = yes; then
-             echo "*** But as you try to build a module library, libtool will 
still create "
-             echo "*** a static module, that should work as long as the 
dlopening application"
-             echo "*** is linked with the -dlopen flag to resolve symbols at 
runtime."
+             $echo "*** But as you try to build a module library, libtool will 
still create "
+             $echo "*** a static module, that should work as long as the 
dlopening application"
+             $echo "*** is linked with the -dlopen flag to resolve symbols at 
runtime."
              if test -z "$global_symbol_pipe"; then
-               echo
-               echo "*** However, this would only work if libtool was able to 
extract symbol"
-               echo "*** lists from a program, using \`nm' or equivalent, but 
libtool could"
-               echo "*** not find such a program.  So, this module is probably 
useless."
-               echo "*** \`nm' from GNU binutils and a full rebuild may help."
+               $echo
+               $echo "*** However, this would only work if libtool was able to 
extract symbol"
+               $echo "*** lists from a program, using \`nm' or equivalent, but 
libtool could"
+               $echo "*** not find such a program.  So, this module is 
probably useless."
+               $echo "*** \`nm' from GNU binutils and a full rebuild may help."
              fi
              if test "$build_old_libs" = no; then
                build_libtool_libs=module
@@ -2523,9 +2549,20 @@
                case $host in
                *-*-darwin*)
                  depdepl=`$echo "X$deplib" | ${SED} -e 's,.*/,,' -e 's,^lib,,' 
-e 's,\.la$,,'`
-                 depdepl="-l$depdepl"
                  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"
+                  fi
+                 else
+                   depdepl="-l$depdepl"
+                 fi
                  ;;
+                 # end ugly FIXME
                esac 
                path="-L$path"
                ;;
@@ -2716,9 +2753,9 @@
          $echo "$modename: cannot build libtool library \`$output' from 
non-libtool objects on this host:$objs" 2>&1
          exit 1
        else
-         echo
-         echo "*** Warning: Linking the shared library $output against the 
non-libtool"
-         echo "*** objects $objs is not portable!"
+         $echo
+         $echo "*** Warning: Linking the shared library $output against the 
non-libtool"
+         $echo "*** objects $objs is not portable!"
          libobjs="$libobjs $objs"
        fi
       fi
@@ -2888,7 +2925,7 @@
 
        *)
          $echo "$modename: unknown library version type \`$version_type'" 1>&2
-         echo "Fatal configuration error.  See the $PACKAGE docs for more 
information." 1>&2
+         $echo "Fatal configuration error.  See the $PACKAGE docs for more 
information." 1>&2
          exit 1
          ;;
        esac
@@ -2937,7 +2974,7 @@
        # Remove our outputs, but don't remove object files since they
        # may have been created when compiling PIC objects.
        removelist=
-       tempremovelist=`echo "$output_objdir/*"`
+       tempremovelist=`$echo "$output_objdir/*"`
        for p in $tempremovelist; do
          case $p in
            *.$objext)
@@ -2964,9 +3001,9 @@
 
       # Eliminate all temporary directories.
       for path in $notinst_path; do
-       lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
-       deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
-       dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
+       lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
+       deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
+       dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % 
%g'`
       done
 
       if test -n "$xrpath"; then
@@ -3087,13 +3124,13 @@
                    newdeplibs="$newdeplibs $i"
                  else
                    droppeddeps=yes
-                   echo
-                   echo "*** Warning: dynamic linker does not accept needed 
library $i."
-                   echo "*** I have the capability to make that library 
automatically link in when"
-                   echo "*** you link to this library.  But I can only do this 
if you have a"
-                   echo "*** shared version of the library, which I believe 
you do not have"
-                   echo "*** because a test_compile did reveal that the linker 
did not use it for"
-                   echo "*** its dynamic dependency list that programs get 
resolved with at runtime."
+                   $echo
+                   $echo "*** Warning: dynamic linker does not accept needed 
library $i."
+                   $echo "*** I have the capability to make that library 
automatically link in when"
+                   $echo "*** you link to this library.  But I can only do 
this if you have a"
+                   $echo "*** shared version of the library, which I believe 
you do not have"
+                   $echo "*** because a test_compile did reveal that the 
linker did not use it for"
+                   $echo "*** its dynamic dependency list that programs get 
resolved with at runtime."
                  fi
                fi
              else
@@ -3129,22 +3166,22 @@
                      newdeplibs="$newdeplibs $i"
                    else
                      droppeddeps=yes
-                     echo
-                     echo "*** Warning: dynamic linker does not accept needed 
library $i."
-                     echo "*** I have the capability to make that library 
automatically link in when"
-                     echo "*** you link to this library.  But I can only do 
this if you have a"
-                     echo "*** shared version of the library, which you do not 
appear to have"
-                     echo "*** because a test_compile did reveal that the 
linker did not use this one"
-                     echo "*** as a dynamic dependency that programs can get 
resolved with at runtime."
+                     $echo
+                     $echo "*** Warning: dynamic linker does not accept needed 
library $i."
+                     $echo "*** I have the capability to make that library 
automatically link in when"
+                     $echo "*** you link to this library.  But I can only do 
this if you have a"
+                     $echo "*** shared version of the library, which you do 
not appear to have"
+                     $echo "*** because a test_compile did reveal that the 
linker did not use this one"
+                     $echo "*** as a dynamic dependency that programs can get 
resolved with at runtime."
                    fi
                  fi
                else
                  droppeddeps=yes
-                 echo
-                 echo "*** Warning!  Library $i is needed by this library but 
I was not able to"
-                 echo "***  make it link in!  You will probably need to 
install it or some"
-                 echo "*** library that it depends on before this library will 
be fully"
-                 echo "*** functional.  Installing it before continuing would 
be even better."
+                 $echo
+                 $echo "*** Warning!  Library $i is needed by this library but 
I was not able to"
+                 $echo "***  make it link in!  You will probably need to 
install it or some"
+                 $echo "*** library that it depends on before this library 
will be fully"
+                 $echo "*** functional.  Installing it before continuing would 
be even better."
                fi
              else
                newdeplibs="$newdeplibs $i"
@@ -3202,17 +3239,17 @@
              fi
              if test -n "$a_deplib" ; then
                droppeddeps=yes
-               echo
-               echo "*** Warning: linker path does not have real file for 
library $a_deplib."
-               echo "*** I have the capability to make that library 
automatically link in when"
-               echo "*** you link to this library.  But I can only do this if 
you have a"
-               echo "*** shared version of the library, which you do not 
appear to have"
-               echo "*** because I did check the linker path looking for a 
file starting"
+               $echo
+               $echo "*** Warning: linker path does not have real file for 
library $a_deplib."
+               $echo "*** I have the capability to make that library 
automatically link in when"
+               $echo "*** you link to this library.  But I can only do this if 
you have a"
+               $echo "*** shared version of the library, which you do not 
appear to have"
+               $echo "*** because I did check the linker path looking for a 
file starting"
                if test -z "$potlib" ; then
-                 echo "*** with $libname but no candidates were found. (...for 
file magic test)"
+                 $echo "*** with $libname but no candidates were found. 
(...for file magic test)"
                else
-                 echo "*** with $libname and none of the candidates passed a 
file format test"
-                 echo "*** using a file magic. Last file checked: $potlib"
+                 $echo "*** with $libname and none of the candidates passed a 
file format test"
+                 $echo "*** using a file magic. Last file checked: $potlib"
                fi
              fi
            else
@@ -3242,7 +3279,7 @@
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
                  for potent_lib in $potential_libs; do
                    potlib="$potent_lib" # see symlink-check above in 
file_magic test
-                   if eval echo \"$potent_lib\" 2>/dev/null \
+                   if eval $echo \"$potent_lib\" 2>/dev/null \
                        | ${SED} 10q \
                        | $EGREP "$match_pattern_regex" > /dev/null; then
                      newdeplibs="$newdeplibs $a_deplib"
@@ -3254,17 +3291,17 @@
              fi
              if test -n "$a_deplib" ; then
                droppeddeps=yes
-               echo
-               echo "*** Warning: linker path does not have real file for 
library $a_deplib."
-               echo "*** I have the capability to make that library 
automatically link in when"
-               echo "*** you link to this library.  But I can only do this if 
you have a"
-               echo "*** shared version of the library, which you do not 
appear to have"
-               echo "*** because I did check the linker path looking for a 
file starting"
+               $echo
+               $echo "*** Warning: linker path does not have real file for 
library $a_deplib."
+               $echo "*** I have the capability to make that library 
automatically link in when"
+               $echo "*** you link to this library.  But I can only do this if 
you have a"
+               $echo "*** shared version of the library, which you do not 
appear to have"
+               $echo "*** because I did check the linker path looking for a 
file starting"
                if test -z "$potlib" ; then
-                 echo "*** with $libname but no candidates were found. (...for 
regex pattern test)"
+                 $echo "*** with $libname but no candidates were found. 
(...for regex pattern test)"
                else
-                 echo "*** with $libname and none of the candidates passed a 
file format test"
-                 echo "*** using a regex pattern. Last file checked: $potlib"
+                 $echo "*** with $libname and none of the candidates passed a 
file format test"
+                 $echo "*** using a regex pattern. Last file checked: $potlib"
                fi
              fi
            else
@@ -3285,13 +3322,13 @@
          fi
          if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
            | grep . >/dev/null; then
-           echo
+           $echo
            if test "X$deplibs_check_method" = "Xnone"; then
-             echo "*** Warning: inter-library dependencies are not supported 
in this platform."
+             $echo "*** Warning: inter-library dependencies are not supported 
in this platform."
            else
-             echo "*** Warning: inter-library dependencies are not known to be 
supported."
+             $echo "*** Warning: inter-library dependencies are not known to 
be supported."
            fi
-           echo "*** All declared inter-library dependencies are being 
dropped."
+           $echo "*** All declared inter-library dependencies are being 
dropped."
            droppeddeps=yes
          fi
          ;;
@@ -3311,17 +3348,17 @@
 
        if test "$droppeddeps" = yes; then
          if test "$module" = yes; then
-           echo
-           echo "*** Warning: libtool could not satisfy all declared 
inter-library"
-           echo "*** dependencies of module $libname.  Therefore, libtool will 
create"
-           echo "*** a static module, that should work as long as the 
dlopening"
-           echo "*** application is linked with the -dlopen flag."
+           $echo
+           $echo "*** Warning: libtool could not satisfy all declared 
inter-library"
+           $echo "*** dependencies of module $libname.  Therefore, libtool 
will create"
+           $echo "*** a static module, that should work as long as the 
dlopening"
+           $echo "*** application is linked with the -dlopen flag."
            if test -z "$global_symbol_pipe"; then
-             echo
-             echo "*** However, this would only work if libtool was able to 
extract symbol"
-             echo "*** lists from a program, using \`nm' or equivalent, but 
libtool could"
-             echo "*** not find such a program.  So, this module is probably 
useless."
-             echo "*** \`nm' from GNU binutils and a full rebuild may help."
+             $echo
+             $echo "*** However, this would only work if libtool was able to 
extract symbol"
+             $echo "*** lists from a program, using \`nm' or equivalent, but 
libtool could"
+             $echo "*** not find such a program.  So, this module is probably 
useless."
+             $echo "*** \`nm' from GNU binutils and a full rebuild may help."
            fi
            if test "$build_old_libs" = no; then
              oldlibs="$output_objdir/$libname.$libext"
@@ -3331,16 +3368,16 @@
              build_libtool_libs=no
            fi
          else
-           echo "*** The inter-library dependencies that have been dropped 
here will be"
-           echo "*** automatically added whenever a program is linked with 
this library"
-           echo "*** or is declared to -dlopen it."
+           $echo "*** The inter-library dependencies that have been dropped 
here will be"
+           $echo "*** automatically added whenever a program is linked with 
this library"
+           $echo "*** or is declared to -dlopen it."
 
            if test "$allow_undefined" = no; then
-             echo
-             echo "*** Since this library must not contain undefined symbols,"
-             echo "*** because either the platform does not support them or"
-             echo "*** it was explicitly requested with -no-undefined,"
-             echo "*** libtool will only create a static version of it."
+             $echo
+             $echo "*** Since this library must not contain undefined symbols,"
+             $echo "*** because either the platform does not support them or"
+             $echo "*** it was explicitly requested with -no-undefined,"
+             $echo "*** libtool will only create a static version of it."
              if test "$build_old_libs" = no; then
                oldlibs="$output_objdir/$libname.$libext"
                build_libtool_libs=module
@@ -3481,6 +3518,17 @@
          $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
        fi
 
+       tmp_deplibs=
+       for test_deplib in $deplibs; do
+               case " $convenience " in
+               *" $test_deplib "*) ;;
+               *) 
+                       tmp_deplibs="$tmp_deplibs $test_deplib"
+                       ;;
+               esac
+       done
+       deplibs="$tmp_deplibs" 
+
        if test -n "$convenience"; then
          if test -n "$whole_archive_flag_spec"; then
            save_libobjs=$libobjs
@@ -3559,21 +3607,18 @@
        fi
 
        # Do each of the archive commands.
+       if test "$module" = yes && test -n "$module_cmds" ; then
+         if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+           eval cmds=\"$module_expsym_cmds\"
+         else
+           eval cmds=\"$module_cmds\"
+         fi
+       else
        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
          eval cmds=\"$archive_expsym_cmds\"
        else
-         save_deplibs="$deplibs"
-         for conv in $convenience; do
-           tmp_deplibs=
-           for test_deplib in $deplibs; do
-             if test "$test_deplib" != "$conv"; then
-               tmp_deplibs="$tmp_deplibs $test_deplib"
-             fi
-           done
-           deplibs="$tmp_deplibs"
-         done
          eval cmds=\"$archive_cmds\"
-         deplibs="$save_deplibs"
+         fi
        fi
 
        if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
@@ -3896,7 +3941,7 @@
 
     prog)
       case $host in
-       *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
+       *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
       esac
       if test -n "$vinfo"; then
        $echo "$modename: warning: \`-version-info' is ignored for programs" 
1>&2
@@ -4104,8 +4149,8 @@
 
          for arg in $dlprefiles; do
            $show "extracting global C symbols from \`$arg'"
-           name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
-           $run eval 'echo ": $name " >> "$nlist"'
+           name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
+           $run eval '$echo ": $name " >> "$nlist"'
            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
          done
 
@@ -4134,7 +4179,7 @@
            if test -f "$nlist"S; then
              eval "$global_symbol_to_cdecl"' < "$nlist"S >> 
"$output_objdir/$dlsyms"'
            else
-             echo '/* NONE */' >> "$output_objdir/$dlsyms"
+             $echo '/* NONE */' >> "$output_objdir/$dlsyms"
            fi
 
            $echo >> "$output_objdir/$dlsyms" "\
@@ -4367,19 +4412,19 @@
        # win32 will think the script is a binary if it has
        # a .exe suffix, so we strip it off here.
        case $output in
-         *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
+         *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
        esac
        # test for cygwin because mv fails w/o .exe extensions
        case $host in
          *cygwin*)
            exeext=.exe
-           outputname=`echo $outputname|${SED} 's,.exe$,,'` ;;
+           outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
          *) exeext= ;;
        esac
        case $host in
          *cygwin* | *mingw* )
-           cwrappersource=`echo ${objdir}/lt-${output}.c`
-           cwrapper=`echo ${output}.exe`
+           cwrappersource=`$echo ${objdir}/lt-${output}.c`
+           cwrapper=`$echo ${output}.exe`
            $rm $cwrappersource $cwrapper
            trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
 
@@ -4666,7 +4711,7 @@
 "
 
        if test "$fast_install" = yes; then
-         echo >> $output "\
+         $echo >> $output "\
   program=lt-'$outputname'$exeext
   progdir=\"\$thisdir/$objdir\"
 
@@ -4682,7 +4727,7 @@
       $rm \"\$progdir/\$file\"
     fi"
 
-         echo >> $output "\
+         $echo >> $output "\
 
     # relink executable if necessary
     if test -n \"\$relink_command\"; then
@@ -4700,13 +4745,13 @@
     $rm \"\$progdir/\$file\"
   fi"
        else
-         echo >> $output "\
+         $echo >> $output "\
   program='$outputname'
   progdir=\"\$thisdir/$objdir\"
 "
        fi
 
-       echo >> $output "\
+       $echo >> $output "\
 
   if test -f \"\$progdir/\$program\"; then"
 
@@ -4758,7 +4803,7 @@
     # The program doesn't exist.
     \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
     \$echo \"This script is just a wrapper for \$program.\" 1>&2
-    echo \"See the $PACKAGE documentation for more information.\" 1>&2
+    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
     exit 1
   fi
 fi\
@@ -5030,6 +5075,9 @@
 # Is this an already installed library?
 installed=$installed
 
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
 # Files to dlopen/dlpreopen
 dlopen='$dlfiles'
 dlpreopen='$dlprefiles'
@@ -5388,7 +5436,7 @@
        case $file in
          *.exe)
            if test ! -f "$file"; then
-             file=`echo $file|${SED} 's,.exe$,,'`
+             file=`$echo $file|${SED} 's,.exe$,,'`
              stripped_ext=".exe"
            fi
            ;;
@@ -5397,7 +5445,7 @@
        # Do a test to see if this is really a libtool program.
        case $host in
        *cygwin*|*mingw*)
-           wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
+           wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
            ;;
        *)
            wrapper=$file
@@ -5503,7 +5551,7 @@
            destfile=$destfile.exe
            ;;
          *:*.exe)
-           destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
+           destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
            ;;
          esac
          ;;
@@ -5590,40 +5638,40 @@
     # Exit here if they wanted silent mode.
     test "$show" = : && exit 0
 
-    echo 
"----------------------------------------------------------------------"
-    echo "Libraries have been installed in:"
+    $echo 
"----------------------------------------------------------------------"
+    $echo "Libraries have been installed in:"
     for libdir in $libdirs; do
-      echo "   $libdir"
+      $echo "   $libdir"
     done
-    echo
-    echo "If you ever happen to want to link against installed libraries"
-    echo "in a given directory, LIBDIR, you must either use libtool, and"
-    echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
-    echo "flag during linking and do at least one of the following:"
+    $echo
+    $echo "If you ever happen to want to link against installed libraries"
+    $echo "in a given directory, LIBDIR, you must either use libtool, and"
+    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+    $echo "flag during linking and do at least one of the following:"
     if test -n "$shlibpath_var"; then
-      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
-      echo "     during execution"
+      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+      $echo "     during execution"
     fi
     if test -n "$runpath_var"; then
-      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
-      echo "     during linking"
+      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+      $echo "     during linking"
     fi
     if test -n "$hardcode_libdir_flag_spec"; then
       libdir=LIBDIR
       eval flag=\"$hardcode_libdir_flag_spec\"
 
-      echo "   - use the \`$flag' linker flag"
+      $echo "   - use the \`$flag' linker flag"
     fi
     if test -n "$admincmds"; then
-      echo "   - have your system administrator run these commands:$admincmds"
+      $echo "   - have your system administrator run these commands:$admincmds"
     fi
     if test -f /etc/ld.so.conf; then
-      echo "   - have your system administrator add LIBDIR to 
\`/etc/ld.so.conf'"
+      $echo "   - have your system administrator add LIBDIR to 
\`/etc/ld.so.conf'"
     fi
-    echo
-    echo "See any operating system documentation about shared libraries for"
-    echo "more information, such as the ld(1) and ld.so(8) manual pages."
-    echo 
"----------------------------------------------------------------------"
+    $echo
+    $echo "See any operating system documentation about shared libraries for"
+    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
+    $echo 
"----------------------------------------------------------------------"
     exit 0
     ;;
 
@@ -5902,8 +5950,8 @@
          noexename=$name
          case $file in
          *.exe) 
-           file=`echo $file|${SED} 's,.exe$,,'`
-           noexename=`echo $name|${SED} 's,.exe$,,'`
+           file=`$echo $file|${SED} 's,.exe$,,'`
+           noexename=`$echo $name|${SED} 's,.exe$,,'`
            # $file with .exe has already been added to rmfiles,
            # add $file without .exe
            rmfiles="$rmfiles $file"
@@ -6151,7 +6199,7 @@
   ;;
 esac
 
-echo
+$echo
 $echo "Try \`$modename --help' for more information about other modes."
 
 exit 0
@@ -6173,7 +6221,7 @@
 # ### END LIBTOOL TAG CONFIG: disable-shared
 
 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
-build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; 
esac`
 # ### END LIBTOOL TAG CONFIG: disable-static
 
 # Local Variables:
Index: libltdl/README
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/README,v
retrieving revision 1.2
diff -u -r1.2 README
--- libltdl/README      17 Jul 1999 09:00:53 -0000      1.2
+++ libltdl/README      20 Mar 2003 20:22:54 -0000
@@ -6,4 +6,5 @@
 * LoadLibrary (Win16 and Win32)
 * load_add_on (BeOS)
 * GNU DLD (emulates dynamic linking for static libraries)
+* dyld (darwin/Mac OS X)
 * libtool's dlpreopen
Index: libltdl/ltdl.c
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/ltdl.c,v
retrieving revision 1.172
diff -u -r1.172 ltdl.c
--- libltdl/ltdl.c      31 Oct 2002 00:52:39 -0000      1.172
+++ libltdl/ltdl.c      20 Mar 2003 20:22:54 -0000
@@ -1575,8 +1575,350 @@
 
 #endif /* HAVE_DLD */
 
+/* --- DYLD() MACOSX/DARWIN INTERFACE LOADER --- */
+#if HAVE_DYLD
 
 
+#if HAVE_MACH_O_DYLD_H
+# 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
+# define ENUM_DYLD_BOOL
+# undef FALSE
+# undef TRUE
+ enum DYLD_BOOL {
+    FALSE,
+    TRUE
+ };
+#endif
+#ifndef LC_REQ_DYLD
+# define LC_REQ_DYLD 0x80000000
+#endif
+#ifndef LC_LOAD_WEAK_DYLIB
+# define LC_LOAD_WEAK_DYLIB (0x18 | LC_REQ_DYLD)
+#endif
+static const struct mach_header * (*ltdl_NSAddImage)(const char *image_name, 
unsigned long options) = 0;
+static NSSymbol (*ltdl_NSLookupSymbolInImage)(const struct mach_header 
*image,const char *symbolName, unsigned long options) = 0;
+static enum DYLD_BOOL (*ltdl_NSIsSymbolNameDefinedInImage)(const struct 
mach_header *image, const char *symbolName) = 0;
+static enum DYLD_BOOL (*ltdl_NSMakePrivateModulePublic)(NSModule module) = 0;
+
+#ifndef NSADDIMAGE_OPTION_NONE
+#define NSADDIMAGE_OPTION_NONE                          0x0    
+#endif
+#ifndef NSADDIMAGE_OPTION_RETURN_ON_ERROR
+#define NSADDIMAGE_OPTION_RETURN_ON_ERROR               0x1
+#endif    
+#ifndef NSADDIMAGE_OPTION_WITH_SEARCHING
+#define NSADDIMAGE_OPTION_WITH_SEARCHING                0x2
+#endif    
+#ifndef NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED
+#define NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED         0x4
+#endif
+#ifndef NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME
+#define NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME 0x8
+#endif
+#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_BIND
+#define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND            0x0
+#endif   
+#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW
+#define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW        0x1
+#endif
+#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_FULLY
+#define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_FULLY      0x2
+#endif
+#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR
+#define NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR 0x4
+#endif
+
+
+static const char *
+lt_int_dyld_error(othererror)
+       char* othererror;
+{
+/* return the dyld error string, or the passed in error string if none */
+       NSLinkEditErrors ler;
+       int lerno;
+       const char *errstr;
+       const char *file;
+       NSLinkEditError(&ler,&lerno,&file,&errstr);     
+       if (!errstr || !strlen(errstr)) errstr = othererror;
+       return errstr;
+}
+ 
+static const struct mach_header *
+lt_int_dyld_get_mach_header_from_nsmodule(module)
+       NSModule module;
+{
+/* There should probably be an apple dyld api for this */
+       int i=_dyld_image_count();
+       int j;
+       const char *modname=NSNameOfModule(module);
+       const struct mach_header *mh=NULL;
+       if (!modname) return NULL;
+       for (j = 0; j < i; j++)
+       {
+               if (!strcmp(_dyld_get_image_name(j),modname))
+               {
+                       mh=_dyld_get_image_header(j);
+                       break;
+               }
+       }
+       return mh;
+}
+
+static const char* lt_int_dyld_lib_install_name(mh)
+       const struct mach_header *mh;
+{      
+/* NSAddImage is also used to get the loaded image, but it only works if the 
lib
+   is installed, for uninstalled libs we need to check the install_names 
against
+   each other. Note that this is still broken if DYLD_IMAGE_SUFFIX is set and a
+   different lib was loaded as a result
+*/
+       int j;
+       struct load_command *lc;
+       unsigned long offset = sizeof(struct mach_header);
+       const struct mach_header *mh1;
+       const char* retStr=NULL;
+       for (j = 0; j < mh->ncmds; j++)
+       {
+               lc = (struct load_command*)(((unsigned long)mh) + offset);
+               if (LC_ID_DYLIB == lc->cmd)
+               {
+                       retStr=(char*)(((struct 
dylib_command*)lc)->dylib.name.offset + 
+                                                                       
(unsigned long)lc);
+               }
+               offset += lc->cmdsize;
+       }
+       return retStr;
+}
+
+static const struct mach_header *
+lt_int_dyld_match_loaded_lib_by_install_name(const char *name)
+{
+       int i=_dyld_image_count();
+       int j;
+       const struct mach_header *mh=NULL;
+       const char *id=NULL;    
+       for (j = 0; j < i; j++)
+       {
+               id=lt_int_dyld_lib_install_name(_dyld_get_image_header(j));
+               if ((id) && (!strcmp(id,name)))
+               {
+                       mh=_dyld_get_image_header(j);
+                       break;
+               }
+       }
+       return mh;
+}
+       
+static NSSymbol
+lt_int_dyld_NSlookupSymbolInLinkedLibs(symbol,mh)
+       const char *symbol;
+       const struct mach_header *mh;
+{
+       /* Safe to assume our mh is good */
+       int j;
+       struct load_command *lc;
+       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)
+                               {       
+                                       /* Maybe NSAddImage can find it */      
                                                                                
        
+                                       mh1=ltdl_NSAddImage((char*)(((struct 
dylib_command*)lc)->dylib.name.offset + 
+                                                                               
(unsigned long)lc),
+                                                                               
NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED + 
+                                                                               
NSADDIMAGE_OPTION_WITH_SEARCHING +
+                                                                               
NSADDIMAGE_OPTION_RETURN_ON_ERROR );
+                               }                                               
+                               if (mh1)
+                               {
+                                       retSym = ltdl_NSLookupSymbolInImage(mh1,
+                                                                               
        symbol,
+                                                                               
        NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW 
+                                                                               
        | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR
+                                                                               
        );
+                                       if (retSym) break;                      
                        
+                               }                                               
+                       }
+                       offset += lc->cmdsize;
+               }
+       }
+       return retSym;
+}
+
+static int
+sys_dyld_init()
+{
+       int retCode = 0;
+       int err = 0;
+       if (!_dyld_present()) { 
+               retCode=1;
+       }
+       else {
+      err = _dyld_func_lookup("__dyld_NSAddImage",(unsigned 
long*)&ltdl_NSAddImage);
+      err = _dyld_func_lookup("__dyld_NSLookupSymbolInImage",(unsigned 
long*)&ltdl_NSLookupSymbolInImage);
+      err = _dyld_func_lookup("__dyld_NSIsSymbolNameDefinedInImage",(unsigned 
long*)&ltdl_NSIsSymbolNameDefinedInImage);
+      err = _dyld_func_lookup("__dyld_NSMakePrivateModulePublic",(unsigned 
long*)&ltdl_NSMakePrivateModulePublic);
+    }
+ return retCode;
+}
+
+static lt_module
+sys_dyld_open (loader_data, filename)
+     lt_user_data loader_data;
+     const char *filename;
+{
+       lt_module   module   = 0;
+       NSObjectFileImage ofi = 0;
+       NSObjectFileImageReturnCode ofirc;
+       
+       if (!filename) 
+               return (lt_module)-1;
+       ofirc = NSCreateObjectFileImageFromFile(filename, &ofi);
+       switch (ofirc)
+       {
+               case NSObjectFileImageSuccess:
+                       module = NSLinkModule(ofi, filename,
+                                               
NSLINKMODULE_OPTION_RETURN_ON_ERROR
+                                                | NSLINKMODULE_OPTION_PRIVATE
+                                                | NSLINKMODULE_OPTION_BINDNOW);
+                       NSDestroyObjectFileImage(ofi);
+                       if (module)
+                               ltdl_NSMakePrivateModulePublic(module);
+                       break;
+               case NSObjectFileImageInappropriateFile:
+                   if (ltdl_NSIsSymbolNameDefinedInImage && 
ltdl_NSLookupSymbolInImage)
+                   {
+                               module = (lt_module)ltdl_NSAddImage(filename, 
NSADDIMAGE_OPTION_RETURN_ON_ERROR);       
+                               break;
+                       }       
+               default:
+                       LT_DLMUTEX_SETERROR 
(lt_int_dyld_error(LT_DLSTRERROR(CANNOT_OPEN)));
+                       return 0;
+       }
+       if (!module) LT_DLMUTEX_SETERROR 
(lt_int_dyld_error(LT_DLSTRERROR(CANNOT_OPEN)));
+  return module;
+}
+
+static int
+sys_dyld_close (loader_data, module)
+     lt_user_data loader_data;
+     lt_module module;
+{
+       int retCode = 0;
+       int flags = 0;
+       unsigned long size=0;
+       if (module == (lt_module)-1) return 0;
+#ifdef __BIG_ENDIAN__          
+       if (((struct mach_header *)module)->magic == MH_MAGIC)
+#else          
+    if (((struct mach_header *)module)->magic == MH_CIGAM)
+#endif 
+       {
+         LT_DLMUTEX_SETERROR("Can not close a dylib");
+         retCode = 1;
+       }
+       else
+       {
+#if 1
+/* Currently, if a module contains c++ static destructors and it is unloaded, 
we
+   get a segfault in atexit(), due to compiler and dynamic loader differences 
of
+   opinion, this works around that.
+*/   
+               if ((const struct section *)NULL != 
+                  
getsectbynamefromheader(lt_int_dyld_get_mach_header_from_nsmodule(module),
+                  "__DATA","__mod_term_func"))
+               {
+                       flags += NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED;
+               } 
+#endif         
+#ifdef __ppc__
+                       flags += NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES;
+#endif
+               retCode = NSUnLinkModule(module,flags);                         
                                                                
+       
+       }
+       
+ return retCode;
+}
+
+static lt_ptr
+sys_dyld_sym (loader_data, module, symbol)
+     lt_user_data loader_data;
+     lt_module module;
+     const char *symbol;
+{
+       lt_ptr address = 0;
+       NSSymbol *nssym = 0;
+       void *unused;
+       const struct mach_header *mh=NULL;
+       if (module == (lt_module)-1)
+       {
+               _dyld_lookup_and_bind(symbol,(unsigned long*)&address,&unused);
+               return address;
+       }
+#ifdef __BIG_ENDIAN__          
+       if (((struct mach_header *)module)->magic == MH_MAGIC)
+#else          
+    if (((struct mach_header *)module)->magic == MH_CIGAM)
+#endif    
+       {
+           if (ltdl_NSIsSymbolNameDefinedInImage && ltdl_NSLookupSymbolInImage)
+           {
+               mh=module;
+                       if (ltdl_NSIsSymbolNameDefinedInImage((struct 
mach_header*)module,symbol)) 
+                       {
+                               nssym = ltdl_NSLookupSymbolInImage((struct 
mach_header*)module,
+                                                                               
        symbol,
+                                                                               
        NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW 
+                                                                               
        | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR
+                                                                               
        );
+                       }
+           }   
+  
+       }    
+  else {
+       nssym = NSLookupSymbolInModule(module, symbol);
+       }
+       if (!nssym) 
+       {
+               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)));
+               return NULL;
+       }       
+       return NSAddressOfSymbol(nssym);
+}
+
+static struct lt_user_dlloader sys_dyld =
+  { "_", sys_dyld_open, sys_dyld_close, sys_dyld_sym, 0, 0 };
+
+
+#endif /* HAVE_DYLD */
+
 
 /* --- DLPREOPEN() INTERFACE LOADER --- */
 
@@ -1871,6 +2213,10 @@
 #endif
 #if HAVE_DLD
       errors += lt_dlloader_add (lt_dlloader_next (0), &sys_dld, "dld");
+#endif
+#if HAVE_DYLD
+       errors += lt_dlloader_add (lt_dlloader_next (0), &sys_dyld, "dyld");
+       errors += sys_dyld_init();
 #endif
       errors += lt_dlloader_add (lt_dlloader_next (0), &presym, "dlpreload");
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]