libtool-patches
[Top][All Lists]
Advanced

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

another darwin patch


From: Peter O'Gorman
Subject: another darwin patch
Date: Sun, 2 Mar 2003 22:28:58 +0900

Hi,
Still passes all but the hardcode and fortran tests.
Changed the check_method to pass_all (we can link against static archives). used nmedit instead of strip in the archive_expsym_cmds, otherwise it is broken Warn on all platforms if linking against a shared lib which was linked with -module
Allow stripping of shared libs
libm is not required ( but if it is there it is no problem either )
explicitly state link_all_deplibs is needed
Use the full path to the depdeplib
move the convenience library duplicate removal stuff up, and make it faster.

Peter



Index: ChangeLog
===================================================================
RCS file: /cvsroot/libtool/libtool/ChangeLog,v
retrieving revision 1.1204
diff -u -d -b -w -r1.1204 ChangeLog
--- ChangeLog   2 Mar 2003 10:13:46 -0000       1.1204
+++ ChangeLog   2 Mar 2003 12:32:25 -0000
@@ -1,3 +1,11 @@
+2003-03-02  Peter O'Gorman  <address@hidden>
+
+       * libtool.m4 (darwin): Allow libs to be stripped, use pass_all, fix
+       some problems with expsym_cmds.
+       
+       * ltmain.in: Add a warning about linking against libs linked with
+       the -module flag. Fix some darwin issues.
+
 2003-03-02  Alexandre Oliva  <address@hidden>

        * libtool.m4 (AC_PROG_LD): Use $CC instead of GCC.
Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libtool.m4,v
retrieving revision 1.308
diff -u -d -b -w -r1.308 libtool.m4
--- libtool.m4  2 Mar 2003 10:13:46 -0000       1.308
+++ libtool.m4  2 Mar 2003 12:32:35 -0000
@@ -1045,7 +1045,22 @@
   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
+       # I am not sure about the archive strip, so commented it out
+       #  old_striplib="$STRIP -x"
+         striplib="$STRIP -x"
+         AC_MSG_RESULT([yes])
+       else
+  AC_MSG_RESULT([no])
+fi
+       ;;
+   *)
   AC_MSG_RESULT([no])
+    ;;
+  esac
 fi
 ])# AC_LIBTOOL_SYS_LIB_STRIP

@@ -2051,6 +2066,7 @@
   ;;

 darwin* | rhapsody*)
+  # this will be overwritten bu 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
@@ -2061,6 +2077,7 @@
     lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
     ;;
   esac
+  lt_cv_deplibs_check_method=pass_all
   ;;

 freebsd*)
@@ -2266,7 +2283,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")
@@ -2506,7 +2523,6 @@
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
@@ -2514,7 +2530,7 @@
_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)' # 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 $(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) && nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
     else
       #just in case a default was set somewhere
       _LT_AC_TAGVAR(archive_expsym_cmds, $1)=''
@@ -2523,6 +2539,7 @@
     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
     _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
     _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])
@@ -2831,7 +2848,6 @@
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
@@ -2839,7 +2855,7 @@
_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)' # 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 && $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) && nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
     else
       #just in case a default was set somewhere
       _LT_AC_TAGVAR(archive_expsym_cmds, $1)=''
@@ -2848,6 +2864,7 @@
     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
     _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
     _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
     ;;

   dgux*)
@@ -5246,7 +5263,6 @@
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
@@ -5254,7 +5270,7 @@
_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)' # 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 && $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) && nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
       else
         #just in case a default was set somewhere
         _LT_AC_TAGVAR(archive_expsym_cmds, $1)=''
@@ -5263,6 +5279,7 @@
       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
       ;;

     dgux*)
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.326
diff -u -d -b -w -r1.326 ltmain.in
--- ltmain.in   28 Feb 2003 15:27:35 -0000      1.326
+++ ltmain.in   2 Mar 2003 12:32:40 -0000
@@ -1981,8 +1981,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 +2026,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 +2119,7 @@
          continue
        fi

+
        if test "$linkmode" = prog && test "$pass" != link; then
          newlib_search_path="$newlib_search_path $ladir"
          deplibs="$lib $deplibs"
@@ -2203,6 +2206,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.
@@ -2294,10 +2308,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" ;;
@@ -2523,9 +2550,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"
                ;;
@@ -3481,6 +3519,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
@@ -3562,18 +3611,7 @@
        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

        if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
@@ -5029,6 +5067,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'





reply via email to

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