]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libtool.m4 (darwin): Revamp darwin platform support.
authorPeter O'Gorman <peter@pogma.com>
Sun, 23 Feb 2003 23:49:34 +0000 (23:49 +0000)
committerRobert Boehne <rboehne@gnu.org>
Sun, 23 Feb 2003 23:49:34 +0000 (23:49 +0000)
* ltdl.m4 (darwin): Support dlcompat if found.
* ltmain.in: Make sure ranlib is run if needed when piecewise
linking.

ChangeLog
libtool.m4
ltdl.m4
ltmain.in

index dc83a1eb4ccd31acc06af6f9d39153e2509bd62c..b33d685df665ddb5993074ebc2ca68569b3ea087 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2003-02-23  Peter O'Gorman  <peter@pogma.com>
+
+       * libtool.m4 (darwin): Revamp darwin platform support.
+       * ltdl.m4 (darwin): Support dlcompat if found.
+       * ltmain.in: Make sure ranlib is run if needed when piecewise
+       linking.
+
 2003-02-23  Alexandre Duret-Lutz  <adl@gnu.org>
 
        * ltmain.in (--help): Show mailing-address for bug reports.
index b9b0fec7fd9bbba21bd8c5753f714f82f5fc99e6..38ee823f4a7ec08bbfdb21473c7399275b8b4dda 100644 (file)
@@ -1240,7 +1240,8 @@ darwin* | rhapsody*)
   shlibpath_var=DYLD_LIBRARY_PATH
   shrext='$(test .$module = .yes && echo .so || echo .dylib)'
   # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
-  sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g"`
+  sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
   ;;
 
 dgux*)
@@ -2263,7 +2264,7 @@ AC_DEFUN([AC_CHECK_LIBM],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 LIBM=
 case $host in
-*-*-beos* | *-*-cygwin* | *-*-pw32*)
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
   # These system don't have libm
   ;;
 *-ncr-sysv4.3*)
@@ -2494,6 +2495,33 @@ aix4*)
     test "$enable_shared" = yes && enable_static=no
   fi
   ;;
+  darwin* | rhapsody*)
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    case "$host_os" in
+    rhapsody* | darwin1.[[012]])
+      _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'
+      ;;
+    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)'
+    # 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}'
+    else
+      #just in case a default was set somewhere
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)=''
+    fi
+    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
+    ;;  
 esac
 AC_MSG_RESULT([$enable_shared])
 
@@ -2783,17 +2811,22 @@ case $host_os in
       _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress'
       ;;
     *) # Darwin 1.3 on
-      _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress'
+      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)'
-    # We need to add '_' to the symbols in $export_symbols first
-    #_LT_AC_TAGVAR(archive_expsym_cmds, $1)="$_LT_AC_TAGVAR(archive_cmds, $1)"' && strip -s $export_symbols'
+    # 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}'
+    else
+      #just in case a default was set somewhere
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)=''
+       fi
     _LT_AC_TAGVAR(hardcode_direct, $1)=yes
     _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
     _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
@@ -5176,17 +5209,22 @@ EOF
        _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress'
        ;;
       *) # Darwin 1.3 on
-       _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress'
+       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)'
-      # We need to add '_' to the symbols in $export_symbols first
-      #_LT_AC_TAGVAR(archive_expsym_cmds, $1)="$_LT_AC_TAGVAR(archive_cmds, $1)"' && strip -s $export_symbols'
+      # 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}'
+      else
+        #just in case a default was set somewhere
+        _LT_AC_TAGVAR(archive_expsym_cmds, $1)=''
+      fi
       _LT_AC_TAGVAR(hardcode_direct, $1)=yes
       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
       _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
diff --git a/ltdl.m4 b/ltdl.m4
index 26fb06680bd462168f60e2ea922be6bdbee684b0..25f982ef61395c9ef9b6e83ad9b89d767e8f3c14 100644 (file)
--- a/ltdl.m4
+++ b/ltdl.m4
@@ -137,6 +137,11 @@ AC_CACHE_CHECK([whether deplibs are loaded by dlopen],
   aix[[45]]*)
     libltdl_cv_sys_dlopen_deplibs=yes
     ;;
+  darwin*)
+    # Assuming the user has installed a libdl from somewhere, this is true
+    # If you are looking for one http://www.opendarwin.org/projects/dlcompat
+    libltdl_cv_sys_dlopen_deplibs=yes
+    ;;   
   gnu*)
     libltdl_cv_sys_dlopen_deplibs=yes
     ;;
@@ -210,6 +215,12 @@ AC_CACHE_CHECK([which extension is used for shared libraries],
   libltdl_cv_shlibext=`cat conftest`
   rm -f conftest
   ])
+  # 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".])
index 9d7dc2d50e0ba221d6d259dae41b0b5d9d588915..ebf0ec7fd7837734857bb77e40702bd59dd82c72 100644 (file)
--- a/ltmain.in
+++ b/ltmain.in
@@ -2489,6 +2489,7 @@ EOF
          if test "$link_all_deplibs" != no; then
            # Add the search paths of all dependency libraries
            for deplib in $dependency_libs; do
+             depdepl=
              case $deplib in
              -L*) path="$deplib" ;;
              *.la)
@@ -2506,7 +2507,7 @@ EOF
                  ;;
                esac
                if grep "^installed=no" $deplib > /dev/null; then
-                 path="-L$absdir/$objdir"
+                 path="$absdir/$objdir"
                else
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
                  if test -z "$libdir"; then
@@ -2516,12 +2517,33 @@ EOF
                  if test "$absdir" != "$libdir"; then
                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
                  fi
-                 path="-L$absdir"
+                 path="$absdir"
                fi
+               depdepl=
+               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"
+                 ;;
+               esac 
+               path="-L$path"
+               ;;
+                 -l*)
+               case $host in
+               *-*-darwin*)
+           depdepl=$deplib
+                 ;;
+               *) continue ;;
+               esac              
                ;;
              *) continue ;;
              esac
              case " $deplibs " in
+             *" $depdepl "*) ;;
+             *) deplibs="$deplibs $depdepl" ;;
+             esac            
+             case " $deplibs " in
              *" $path "*) ;;
              *) deplibs="$deplibs $path" ;;
              esac
@@ -3902,8 +3924,10 @@ EOF
       case $host in
       *darwin*)
         # Don't allow lazy linking, it breaks C++ global constructors
+        if test "$tagname" = CXX ; then
         compile_command="$compile_command ${wl}-bind_at_load"
         finalize_command="$finalize_command ${wl}-bind_at_load"
+        fi
         ;;
       esac
 
@@ -4856,6 +4880,11 @@ fi\
            $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
            AR_FLAGS=cq
          fi
+         # Is there a better way of finding the last object in the list?
+         for obj in $save_oldobjs
+         do
+           last_oldobj=$obj
+         done  
          for obj in $save_oldobjs
          do
            oldobjs="$objlist $obj"
@@ -4867,6 +4896,9 @@ fi\
            else
              # the above command should be used before it gets too long
              oldobjs=$objlist
+             if test "$obj" = "$last_oldobj" ; then
+               RANLIB=$save_RANLIB
+             fi  
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
              objlist=