]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* ltmain.in: Applied Thomas Tanner's latest ild.diff. This
authorGary V. Vaughan <gary@gnu.org>
Tue, 9 Feb 1999 17:56:32 +0000 (17:56 +0000)
committerGary V. Vaughan <gary@gnu.org>
Tue, 9 Feb 1999 17:56:32 +0000 (17:56 +0000)
clashes with my change from 1999-02-03 below, but what I had was a
bit of a mess, so I also reverted that at the same time.
* configure.in: Thomas' latest ILD patch again.
* depdemo/Makefile.am: And here.

ChangeLog
configure.in
depdemo/Makefile.am
ltmain.in

index 4d486d82c8be5a1e6b025450e3eb0f539973e20a..fa3a70a9d840a4a331550885f7443e1bffff829e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+1999-02-09  Gary V. Vaughan  <gvaughan@oranda.demon.co.uk>
+
+       * ltmain.in: Applied Thomas Tanner's latest ild.diff.  This
+       clashes with my change from 1999-02-03 below, but what I had was a
+       bit of a mess, so I also reverted that at the same time.
+       * configure.in: Thomas' latest ILD patch again.
+       * depdemo/Makefile.am: And here.
+       
 1999-02-03  Gary V. Vaughan  <gvaughan@oranda.demon.co.uk>
 
        * ltmain.in (--mode=link): reinstate linking against ltlibraries.
index 19c9dccf3fe12fd75d06486ceb4ac89434f5a402..5cb68af0328ea61e7f3fbc3ddaf380042488d62b 100644 (file)
@@ -10,8 +10,8 @@ AM_INIT_AUTOMAKE(libtool, 1.2e)
 case "$VERSION" in
 changequote(,)
   *[acegikmoqsuwy]) 
-    TIMESTAMP=`sed 's%.*\$''Revision: \([^$]*\) \$ \$''Date: \([^$]*\) \$.*% (\1 \2)%;t end;d;: end' < ${srcdir}/ChangeLog`
 changequote([,])
+    TIMESTAMP=`${CONFIG_SHELL} ${srcdir}/mkstamp < ${srcdir}/ChangeLog`
     banner="Configuring $PACKAGE $VERSION$TIMESTAMP"
     dashes=`echo "$banner" | sed 's/./-/g'`
 
@@ -41,13 +41,13 @@ AC_PROG_AWK
 
 dnl all subdirectories that are configured on demand, but that must be
 dnl included in the distribution
-CONF_SUBDIRS="libltdl demo mdemo cdemo depdemo"
+CONF_SUBDIRS="libltdl demo mdemo depdemo cdemo"
 AC_SUBST(CONF_SUBDIRS)
 
-ACINCLUDE_M4_LIST="\$(srcdir)/acinclude.m4 "
+ACINCLUDE_M4_LIST="${srcdir}/acinclude.m4 "
 DIST_MAKEFILE_LIST=
 for dir in $CONF_SUBDIRS; do
-  ACINCLUDE_M4_LIST="$ACINCLUDE_M4_LIST\$(srcdir)/$dir/acinclude.m4 "
+  ACINCLUDE_M4_LIST="$ACINCLUDE_M4_LIST${srcdir}/$dir/acinclude.m4 "
   DIST_MAKEFILE_LIST="$DIST_MAKEFILE_LIST$dir/Makefile "
 done
 AC_SUBST(ACINCLUDE_M4_LIST)
index 2200ed484c9cd6a1e9547960378df9e8f79659ef..5dc42f1c1ccb12d1b293490905c7201c8880bbc7 100644 (file)
@@ -5,20 +5,20 @@ AUTOMAKE_OPTIONS = no-dependencies foreign
 lib_LTLIBRARIES = libl1.la libl2.la libl3.la libl4.la
 libl1_la_SOURCES = l1.c l1.h sysdep.h
 libl2_la_SOURCES = l2.c l2.h sysdep.h
-libl2_la_LDFLAGS = -ll1
+libl2_la_LIBADD = libl1.la
 libl3_la_SOURCES = l3.c l3.h sysdep.h
-libl3_la_LDFLAGS = -ll1 -ll2
+libl3_la_LIBADD = libl1.la libl2.la
 libl4_la_SOURCES = l4.c l4.h sysdep.h
-libl4_la_LDFLAGS = -ll3 $(LIBADD_M)
+libl4_la_LIBADD = libl3.la $(LIBADD_M)
 
 bin_PROGRAMS = depdemo.static depdemo
 
-depdemo_static_SOURCES = main.c
-depdemo_static_LDADD = -ll1 -ll2 -ll4
-depdemo_static_DEPENDENCIES = libl1.la libl2.la libl4.la
-depdemo_static_LDFLAGS = -static
-
 depdemo_SOURCES = main.c
-depdemo_LDADD = -ll1 -ll2 -ll4
+depdemo_LDADD = libl1.la libl2.la libl4.la
 depdemo_DEPENDENCIES = libl1.la libl2.la libl4.la
 
+depdemo_static_SOURCES = $(depdemo_SOURCES)
+depdemo_static_LDADD = $(depdemo_LDADD)
+depdemo_static_DEPENDENCIES = $(depdemo_DEPENDENCIES)
+depdemo_static_LDFLAGS = -static
+
index 297530fc8a6bb441bcc60f6fd3b7e531b18e5301..b6f9218c46c8f4405ba6762ac40f3d654102d40b 100644 (file)
--- a/ltmain.in
+++ b/ltmain.in
@@ -603,8 +603,11 @@ compiler."
     ;;
 
   # libtool link mode
-  link)
+  link | link-install)
     modename="$modename: link"
+    link_install=no
+    test "$mode" = "link-install" && link_install=yes
+    link_command="$nonopt"    
     C_compiler="$CC" # save it, to compile generated C sources
     CC="$nonopt"
     case "$host" in
@@ -651,21 +654,12 @@ compiler."
     compile_command="$CC"
     finalize_command="$CC"
 
-    compile_shlibpath=
-    finalize_shlibpath=
+    shlibpath=
     convenience=
     old_convenience=
     deplibs=
+    linkopts=
 
-    if test -n "$shlibpath_var"; then
-      # get the directories listed in $shlibpath_var
-      eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
-    else
-      libsearch_path=
-    fi
-    # ILD: now prepend the system-specific ones
-    # ILD: eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
-    
     avoid_version=no
     dlfiles=
     dlprefiles=
@@ -673,9 +667,7 @@ compiler."
     export_symbols=
     generated=
     hardcode_libdirs=
-    finalize_hardcode_libdirs=
     libobjs=
-    link_against_libtool_libs=
     ltlibs=
     module=no
     objs=
@@ -687,7 +679,7 @@ compiler."
     xrpath=
     perm_rpath=
     temp_rpath=
-    finalize_rpath=
+    thread_safe=no
     vinfo=
 
     # We need to know -static, to get the right output filenames.
@@ -712,13 +704,13 @@ compiler."
     while test $# -gt 0; do
       arg="$1"
       shift
+      link_command="$link_command $arg"
 
       # If the previous option needs an argument, assign it.
       if test -n "$prev"; then
        case "$prev" in
        output)
          compile_command="$compile_command @OUTPUT@"
-         finalize_command="$finalize_command @OUTPUT@"
          ;;
        esac
 
@@ -727,7 +719,6 @@ compiler."
          if test "$preload" = no; then
            # Add the symbol object into the linking commands.
            compile_command="$compile_command @SYMFILE@"
-           finalize_command="$finalize_command @SYMFILE@"
            preload=yes
          fi
          case "$arg" in
@@ -776,7 +767,6 @@ compiler."
       -all-static)
        if test -n "$link_static_flag"; then
          compile_command="$compile_command $link_static_flag"
-         finalize_command="$finalize_command $link_static_flag"
        fi
        continue
        ;;
@@ -813,7 +803,6 @@ compiler."
          if test "$preload" = no; then
            # Add the symbol object into the linking commands.
            compile_command="$compile_command @SYMFILE@"
-           finalize_command="$finalize_command @SYMFILE@"
            preload=yes
          fi
        fi
@@ -830,33 +819,19 @@ compiler."
 
       -L*)
        dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'`
-       # We need an absolute path.
+       # We need an absolute path
        case "$dir" in
-       /* | [A-Za-z]:[/\\]*)
-         # Add the corresponding hardcode_libdir_flag, if it is not identical.
-         ;;
+       /* | [A-Za-z]:[/\\]*) ;;
        *)
          absdir=`cd "$dir" && pwd`
          if test -z "$absdir"; then
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
            exit 1
          fi
-         arg="-L$absdir"
-         ;;
-       esac
-       deplibs="$deplibs $arg"
-       lib_search_path="$lib_search_path `expr $arg : '-L\(.*\)'`"
-       case "$host" in
-       *-*-cygwin* | *-*-mingw* | *-*-os2*)
-         dllsearchdir="`expr $arg : '-L\(.*\)'`"
-         dllsearchdir=`cd "$dllsearchdir" && pwd || echo "$dllsearchdir"`
-         if test -n "$dllsearchpath"; then
-           dllsearchpath="$dllsearchpath:$dllsearchdir"
-         else
-           dllsearchpath="$dllsearchdir"
-         fi
+         dir="$absdir"
          ;;
        esac
+       deplibs="$deplibs -L$dir"
        continue
        ;;
 
@@ -907,11 +882,15 @@ compiler."
        # If we have no pic_flag, then this is the same as -all-static.
        if test -z "$pic_flag" && test -n "$link_static_flag"; then
          compile_command="$compile_command $link_static_flag"
-         finalize_command="$finalize_command $link_static_flag"
        fi
        continue
        ;;
 
+      -thread-safe)
+       thread_safe=yes
+       continue
+       ;;
+
       -version-info)
        prev=vinfo
        continue
@@ -919,7 +898,7 @@ compiler."
 
       # Some other compiler flag.
       -* | +*)
-       # Unknown arguments in both finalize_command and compile_command need
+       # Unknown arguments in compile_command need
        # to be aesthetically quoted because they are evaled later.
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
        case "$arg" in
@@ -974,7 +953,7 @@ compiler."
        # it will not redefine variable installed.
        installed=yes
 
-       # Read in the .la file
+       # Read the .la file
        # If there is no directory component, then add one.
        case "$arg" in
        */* | *\\*) . $arg ;;
@@ -992,9 +971,6 @@ compiler."
          exit 1
        fi
 
-       # Find the relevant object directory and library name.
-       name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
-
        if test "X$installed" = Xyes; then
          dir="$libdir"
        else
@@ -1006,28 +982,6 @@ compiler."
          fi
        fi
 
-       if test -n "$dependency_libs"; then
-         # Extract -R from dependency_libs
-         temp_deplibs=
-         for deplib in $dependency_libs; do
-           case "$deplib" in
-           -R*) xrpath="$xrpath "`echo "X$deplib" | $Xsed -e 's/^-R//'`;;
-           *) temp_deplibs="$temp_deplibs $deplib";;
-           esac
-         done
-         dependency_libs="$temp_deplibs"
-       fi
-
-       if test -z "$libdir"; then
-         # It is a libtool convenience library, so add in its objects.
-         convenience="$convenience $dir/$old_library"
-         old_convenience="$old_convenience $dir/$old_library"
-         deplibs="$deplibs$dependency_libs"
-         compile_command="$compile_command $dir/$old_library$dependency_libs"
-         finalize_command="$finalize_command $dir/$old_library$dependency_libs"
-         continue
-       fi
-
        # This library was specified with -dlopen.
        if test "$prev" = dlfiles; then
          dlfiles="$dlfiles $arg"
@@ -1053,220 +1007,29 @@ compiler."
          fi
          prev=
        fi
-       if test "$build_libtool_libs" = yes && test -n "$library_names"; then
-         link_against_libtool_libs="$link_against_libtool_libs $arg"
-         if test -n "$shlibpath_var"; then
-           # Make sure the rpath contains only unique directories.
-           case "$temp_rpath " in
-           *" $dir "*) ;;
-           *) temp_rpath="$temp_rpath $dir" ;;
-           esac
-         fi
-
-         # This is the magic to use -rpath.
-         if test -n "$hardcode_libdir_flag_spec"; then
-           saved_libdir="$libdir"
-           libdir="$dir"
-
-           # We need an absolute path.
-           case "$libdir" in
-           /* | [A-Za-z]:[/\\]*) ;;
-           *)
-             absdir=`cd "$libdir" && pwd`
-             if test -z "$absdir"; then
-               $echo "$modename: cannot determine absolute directory name of \`$libdir'" 1>&2
-             else
-               libdir="$absdir"
-             fi
-             ;;
-           esac
-           if test -n "$hardcode_libdir_separator"; then
-             if test -z "$hardcode_libdirs"; then
-               # Put the magic libdir with the hardcode flag.
-               hardcode_libdirs="$libdir"
-               libdir="@HARDCODE_LIBDIRS@"
-             else
-               # Just accumulate the unique libdirs.
-               case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
-               *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
-                 ;;
-               *)
-                 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
-                 ;;
-               esac
-               libdir=
-             fi
-           fi
-
-           if test -n "$libdir"; then
-             eval flag=\"$hardcode_libdir_flag_spec\"
-
-             compile_command="$compile_command $flag"
-           fi
-
-           libdir="$saved_libdir"
-           if test -n "$hardcode_libdir_separator"; then
-             if test -z "$finalize_hardcode_libdirs"; then
-               # Put the magic libdir with the hardcode flag.
-               finalize_hardcode_libdirs="$libdir"
-               libdir="@HARDCODE_LIBDIRS@"
-             else
-               # Just accumulate the unique libdirs.
-               case "$hardcode_libdir_separator$finalize_hardcode_libdirs$hardcode_libdir_separator" in
-               *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
-                 ;;
-               *)
-                 finalize_hardcode_libdirs="$finalize_hardcode_libdirs$hardcode_libdir_separator$libdir"
-                 ;;
-               esac
-               libdir=
-             fi
-           fi
-
-           if test -n "$libdir"; then
-             eval flag=\"$hardcode_libdir_flag_spec\"
-
-             finalize_command="$finalize_command $flag"
-           fi
-           # libdir is also use after "$hardcode_action" case
-           libdir="$saved_libdir"
-         elif test -n "$runpath_var"; then
-           # Do the same for the permanent run path.
-           case "$dir" in
-           /* | [A-Za-z]:[/\\]*) absdir="$dir";;
-           *)
-             absdir=`cd "$dir" && pwd`
-             if test -z "$absdir"; then
-               $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
-               absdir="$dir"
-             fi
-             ;;
-           esac
-           case "$perm_rpath " in
-           *" $absdir "*) ;;
-           *) perm_rpath="$perm_rpath $absdir" ;;
-           esac
-           case "$finalize_perm_rpath " in
-           *" $libdir "*) ;;
-           *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
-           esac
-         fi
-
-
-         lib_linked=yes
-         case "$hardcode_action" in
-         immediate | unsupported)
-           if test "$hardcode_direct" = no; then
-             compile_command="$compile_command $dir/$linklib"
-             deplibs="$deplibs $dir/$linklib"
-             case "$host" in
-             *-*-cygwin* | *-*-mingw* | *-*-os2*)
-               dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
-               if test -n "$dllsearchpath"; then
-                 dllsearchpath="$dllsearchpath:$dllsearchdir"
-               else
-                 dllsearchpath="$dllsearchdir"
-               fi
-               ;;
-             esac
-           elif test "$hardcode_minus_L" = no; then
-             case "$host" in
-             *-*-sunos*)
-               compile_shlibpath="$compile_shlibpath$dir:"
-               ;;
-             esac
-             compile_command="$compile_command -L$dir -l$name"
-             deplibs="$deplibs -L$dir -l$name"
-           elif test "$hardcode_shlibpath_var" = no; then
-             compile_shlibpath="$compile_shlibpath$dir:"
-             compile_command="$compile_command -l$name"
-             deplibs="$deplibs -l$name"
-           else
-             lib_linked=no
-           fi
-           ;;
-
-         relink)
-           # We need an absolute path.
-           case "$dir" in
-           /* | [A-Za-z]:[/\\]*) ;;
-           *)
-             absdir=`cd "$dir" && pwd`
-             if test -z "$absdir"; then
-               $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
-               exit 1
-             fi
-             dir="$absdir"
-             ;;
-           esac
-
-           if test "$hardcode_direct" = yes; then
-             compile_command="$compile_command $dir/$linklib"
-             deplibs="$deplibs $dir/$linklib"
-           elif test "$hardcode_minus_L" = yes; then
-             compile_command="$compile_command -L$dir -l$name"
-             deplibs="$deplibs -L$dir -l$name"
-           elif test "$hardcode_shlibpath_var" = yes; then
-             compile_shlibpath="$compile_shlibpath$dir:"
-             compile_command="$compile_command -l$name"
-             deplibs="$deplibs -l$name"
-           else
-             lib_linked=no
-           fi
-           ;;
-
-         *)
-           lib_linked=no
-           ;;
-         esac
 
-         if test "$lib_linked" != yes; then
-           $echo "$modename: configuration error: unsupported hardcode properties"
-           exit 1
-         fi
-
-         # Finalize command for both is simple: just hardcode it.
-         if test "$hardcode_direct" = yes; then
-           finalize_command="$finalize_command $libdir/$linklib"
-         elif test "$hardcode_minus_L" = yes; then
-           finalize_command="$finalize_command -L$libdir -l$name"
-         elif test "$hardcode_shlibpath_var" = yes; then
-           finalize_shlibpath="$finalize_shlibpath$libdir:"
-           finalize_command="$finalize_command -l$name"
-         else
-           # We cannot seem to hardcode it, guess we'll fake it.
-           finalize_command="$finalize_command -L$libdir -l$name"
-         fi
-       else
-         # Transform directly to old archives if we don't build new libraries.
-         if test -n "$pic_flag" && test -z "$old_library"; then
-           $echo "$modename: cannot find static library for \`$arg'" 1>&2
+       dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+       test "X$dir" = "X$arg" && dir="."
+       # We need an absolute path.
+       case "$dir" in
+       /* | [A-Za-z]:[/\\]*) ;;
+       *)
+         absdir=`cd "$dir" && pwd`
+         if test -z "$absdir"; then
+           $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
            exit 1
          fi
-
-         # Here we assume that one of hardcode_direct or hardcode_minus_L
-         # is not unsupported.  This is valid on all known static and
-         # shared platforms.
-         if test "$hardcode_direct" != unsupported; then
-           test -n "$old_library" && linklib="$old_library"
-           compile_command="$compile_command $dir/$linklib"
-           finalize_command="$finalize_command $dir/$linklib"
-         else
-           compile_command="$compile_command -L$dir -l$name"
-           finalize_command="$finalize_command -L$dir -l$name"
-         fi
-       fi
-
-       # Add in any libraries that this one depends upon.
-       compile_command="$compile_command$dependency_libs"
-       finalize_command="$finalize_command$dependency_libs"
+         dir="$absdir"
+         ;;
+       esac
+       name=`echo "X$arg" | $Xsed -e 's%^.*/%%'`
+       deplibs="$deplibs $dir/$name"
        continue
        ;;
 
       # Some other compiler argument.
       *)
-       # Unknown arguments in both finalize_command and compile_command need
+       # Unknown arguments in compile_command need
        # to be aesthetically quoted because they are evaled later.
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
        case "$arg" in
@@ -1280,7 +1043,6 @@ compiler."
       # Now actually substitute the argument into the commands.
       if test -n "$arg"; then
        compile_command="$compile_command $arg"
-       finalize_command="$finalize_command $arg"
       fi
     done
 
@@ -1316,8 +1078,18 @@ compiler."
       esac
     done
     deplibs="$newdeplibs"
-    eval sys_search_path=\"$sys_lib_search_path\"
-    lib_search_path="$lib_search_path $sys_search_path"
+
+    if test -n "$shlibpath_var"; then
+      # get the directories listed in $shlibpath_var
+      eval shlib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+    else
+      shlib_search_path=
+    fi
+    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+    lib_search_path="$lib_search_path $sys_lib_search_path $shlib_search_path"
+
+    # Quote the link command for shipping.
+    link_command=`$echo "X$link_command" | $Xsed -e "$sed_quote_subst"`
 
     case "$output" in
     "")
@@ -1327,11 +1099,6 @@ compiler."
       ;;
 
     *.a | *.lib)
-      if test -n "$link_against_libtool_libs"; then
-       $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
-       exit 1
-      fi
-
       if test -n "$deplibs"; then
        $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
       fi
@@ -1405,15 +1172,6 @@ compiler."
        exit 1
       fi
 
-      # If the following section is uncommented, then it is impossible to
-      # link with ltlibrary deplibs...
-      
-      # How the heck are we supposed to write a wrapper for a shared library?
-      #if test -n "$link_against_libtool_libs"; then
-      #         $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
-      #         exit 1
-      #fi
-
       if test -n "$dlfiles$dlprefiles"; then
        $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
       fi
@@ -1422,7 +1180,20 @@ compiler."
       if test $# -gt 2; then
        $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
       fi
-      install_libdir="$2"
+      dir="$2"
+      # We need an absolute path.
+      case "$dir" in
+      /* | [A-Za-z]:[/\\]*) ;;
+      *)
+       absdir=`cd "$dir" && pwd`
+       if test -z "$absdir"; then
+         $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+       else
+         dir="$absdir"
+       fi
+       ;;
+      esac
+      install_libdir="$dir"
 
       oldlibs=
       if test -z "$rpath"; then
@@ -1433,7 +1204,6 @@ compiler."
          build_libtool_libs=convenience
          build_old_libs=yes
        fi
-       dependency_libs="$deplibs"
 
        if test -n "$vinfo"; then
          $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
@@ -1623,113 +1393,225 @@ compiler."
       release_save=$release
       versuffix_save=$versuffix
       major_save=$major
-        
+       
+      #################
+      # ILD code
+      #################
+      $echo "deplibs:     $deplibs"
+      $echo "search path: $lib_search_path"
+
+      olddeplibs="$deplibs"
+      
       # Find libtool libraries and add their dependencies and directories
-      newdeplibs=      # libraries to link (uninstalled library)
-      inst_deplibs=    # libraries to link (installed library)
-      alldeplibs=      # all dependency libraries (uninstalled library)
-      inst_alldeplibs= # all dependency libraries (installed library)
-      remove_path=     # paths that contain uninstalled libtool libraries
+      deplibs=         # libraries to link (used in archive_cmds)
+      alldependency_libs= # all dependency libraries
+      uninst_path=     # paths that contain uninstalled libtool libraries
       new_lib_search_path=
-      for deplib in $deplibs; do
-       newdeplibs="$newdeplibs $deplib"
-       inst_deplibs="$inst_deplibs $deplib"
-       alldeplibs="$alldeplibs $deplib"
-       inst_alldeplibs="$inst_alldeplibs $deplib"
-       found=
-       name="`expr $deplib : '-l\(.*\)'`"
-       # If $name is empty we are operating on a -L argument.
-       if test -n "$name"; then
+      for deplib in $olddeplibs; do
+       lib=
+       case "$deplib" in
+       -L*)
+         $echo "$deplib is a directory"
+         new_lib_search_path="$new_lib_search_path `expr $deplib : '-L\(.*\)'`"
+         deplibs="$deplibs $deplib"
+         alldependency_libs="$alldependency_libs $deplib"
+         continue
+         ;;
+       -l*)
+         name="`expr $deplib : '-l\(.*\)'`"
          libname=`eval \\$echo \"$libname_spec\"`
+         found=no
          for searchdir in $lib_search_path; do
            # Search the libtool library
-           if test -f "$searchdir/$libname.la"; then
-             lib="$searchdir/$libname.la"
-             dlname=
-             libdir=
-             library_names=
-             old_library=
-             inst_dependency_libs=
+           lib="$searchdir/$libname.la"
+           if test -f "$lib"; then
+             found=yes
+             break
+           fi
+         done
+         if test "$found" != yes; then
+           $echo "$deplib is not a libtool library"
+           deplibs="$deplibs $deplib"
+           alldependency_libs="$alldependency_libs $deplib"
+           continue
+         fi
+         ;;
+       *)
+         lib="$deplib"
+         if test -f "$lib"; then :
+         else
+           $echo "$modename: cannot find the library \`$lib'" 1>&2
+           exit 1
+         fi
+         ;;
+       esac
+       $echo "$deplib is a libtool library"
+       dlname=
+       libdir=
+       library_names=
+       old_library=
 
-             # Check to see that this really is a libtool archive.
-             if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
-             else
-               $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
-               exit 1
-             fi
+       # Check to see that this really is a libtool archive.
+       if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+       else
+         $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+         exit 1
+       fi
 
-             # If the library was installed with an old release of libtool,
-             # it will not redefine variable installed.
-             installed=yes
+       # If the library was installed with an old release of libtool,
+       # it will not redefine variable installed.
+       installed=yes
 
-             # Read in the .la file
-             . $lib
+       # Read the .la file
+       . $lib
 
-             # Get the name of the library we link against.
-             linklib=
-             for l in $old_library $library_names; do
-               linklib="$l"
-             done
+       # Get the name of the library we link against.
+       linklib=
+       for l in $old_library $library_names; do
+         linklib="$l"
+       done
 
-             if test -z "$linklib"; then
-               $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
-               exit 1
-             fi
+       if test -z "$linklib"; then
+         $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+         exit 1
+       fi
 
-             if test "$build_libtool_libs" = yes; then
-               if test -z "$library_names" && test "$deplibs_check_method" != pass_all; then
-                 echo
-                 echo "*** Warning: This library needs some functionality provided by $libname."
-                 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."
-                 break
-               fi
-               ############################
-               # TODO: hardcode libraries
-               ############################          
+       if test "X$installed" = Xyes; then
+         dir="$libdir"
+         case "$dir" in
+         /* | [A-Za-z]:[/\\]*) absdir="$dir";;
+         *)
+           absdir=`cd "$dir" && pwd`
+           if test -z "$absdir"; then
+             $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+             exit 1
+           fi
+           dir="$absdir"
+           ;;
+         esac
+       else
+         searchdir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
+         dir="$searchdir/$objdir"
+         # Remove this search path later
+         uninst_path="$uninst_path $searchdir"
+       fi
+
+       # Find the relevant object directory and library name.
+       name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
+       # FIXME: libraries without lib prefix require direct hardcoding
+
+       if test -z "$libdir"; then
+         # It is a libtool convenience library.
+         $echo "$modename: cannot link libtool libraries against convenience libraries" 1>&2
+         exit 1
+       fi
+
+       if test "$build_libtool_libs" = yes && test -n "$library_names"; then
+         # This is the magic to use -rpath.
+         if test -n "$hardcode_libdir_flag_spec"; then
+           saved_libdir="$libdir"
+           test $link_install = no && libdir="$dir"
+
+           if test -n "$hardcode_libdir_separator"; then
+             if test -z "$hardcode_libdirs"; then
+               # Put the magic libdir with the hardcode flag.
+               hardcode_libdirs="$libdir"
+               libdir="@HARDCODE_LIBDIRS@"
+             else
+               # Just accumulate the unique libdirs.
+               case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
+               *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+                 ;;
+               *)
+                 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+                 ;;
+               esac
+               libdir=
              fi
-             
-             if test "X$installed" = Xyes; then
-               dir="$libdir"
+           fi
+           if test -n "$libdir"; then
+             eval flag=\"$hardcode_libdir_flag_spec\"
+  
+             deplibs="$deplibs $flag"
+           fi
+           # libdir is also use after "$hardcode_action" case
+           libdir="$saved_libdir"
+         fi
+           
+         if test $link_install = no; then
+           lib_linked=yes
+           case "$hardcode_action" in
+           immediate | unsupported)
+             if test "$hardcode_direct" = no; then
+               deplibs="$deplibs $dir/$linklib"
+             elif test "$hardcode_minus_L" = no; then
+               case "$host" in
+               *-*-sunos*)
+                 shlibpath="$shlibpath$dir:"
+                 ;;
+               esac
+               deplibs="$deplibs -L$dir -l$name"
+             elif test "$hardcode_shlibpath_var" = no; then
+               shlibpath="$shlibpath$dir:"
+               deplibs="$deplibs -l$name"
              else
-               dir="$searchdir/$objdir"
-               # Remove this search path later
-               remove_path="$remove_path $searchdir"
+               lib_linked=no
              fi
+             ;;
+           relink)
+             if test "$hardcode_direct" = yes; then
+               deplibs="$deplibs $dir/$linklib"
+             elif test "$hardcode_minus_L" = yes; then
+               deplibs="$deplibs -L$dir -l$name"
+             elif test "$hardcode_shlibpath_var" = yes; then
+               shlibpath="$shlibpath$dir:"
+               deplibs="$deplibs -l$name"
+             else
+               lib_linked=no
+             fi
+             ;;
+           *)
+             lib_linked=no
+             ;;
+           esac
 
-             # Link against this library
-             newdeplibs="$newdeplibs -L$dir"
-             alldeplibs="$alldeplibs -L$dir $dependency_libs"
-             new_lib_search_path="$new_lib_search_path $dir"
-             
-             case " $sys_search_path " in 
-             *" $libdir "*) ;;
-             *)
-               # Add path only if it isn't a system search path
-               inst_deplibs="$inst_deplibs -L$libdir"
-               inst_alldeplibs="$inst_alldeplibs -L$libdir"
-               ;;
-             esac
-
-             # Set to dependency_libs if not defined
-             test -z "$inst_dependency_libs" && inst_dependency_libs="$dependency_libs"
-             inst_alldeplibs="$inst_alldeplibs $inst_dependency_libs"
-
-             found=yes
-             break
+           if test "$lib_linked" != yes; then
+             $echo "$modename: configuration error: unsupported hardcode properties"
+             exit 1
            fi
-         done
-         if test -z "$found"; then
-           # Not a libtool library
-           $echo "$deplib is a not libtool library"
          else
-           $echo "$deplib is a libtool library"
+           # Install command for both is simple: just hardcode it.
+           if test "$hardcode_direct" = yes; then
+             deplibs="$deplibs $libdir/$linklib"
+           elif test "$hardcode_minus_L" = yes; then
+             deplibs="$deplibs -L$libdir -l$name"
+           elif test "$hardcode_shlibpath_var" = yes; then
+             shlibpath="$shlibpath$libdir:"
+             deplibs="$deplibs -l$name"
+           else
+             # We cannot seem to hardcode it, guess we'll fake it.
+             deplibs="$deplibs -L$libdir -l$name"
+           fi
          fi
+       elif test "$build_libtool_libs" = yes && test "$deplibs_check_method" != pass_all; then
+         echo
+         echo "*** Warning: This library needs some functionality provided by $libname."
+         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."
+         continue
        else
-         $echo "$deplib is a directory"
-         new_lib_search_path="$new_lib_search_path `expr $deplib : '-L\(.*\)'`"
+         # Check for old archives if we don't build new libraries.
+         if test -n "$pic_flag" && test -z "$old_library"; then
+           $echo "$modename: cannot find static library for \`$lib'" 1>&2
+           exit 1
+         fi
        fi
+
+       new_lib_search_path="$new_lib_search_path $dir"
+
+       # Link against this library
+       alldependency_libs="$alldependency_libs $dependency_libs $lib"
       done
 
       # Make sure lib_search_path contains only unique directories.
@@ -1740,68 +1622,72 @@ compiler."
        *) lib_search_path="$lib_search_path $dir" ;;
        esac
       done
-      lib_search_path="$lib_search_path $sys_search_path"
+      lib_search_path="$lib_search_path $sys_lib_search_path"
       
-      # Make sure deplibs contains only unique libraries and directories.
-      deplibs=
-      for deplib in $newdeplibs; do
-       case "$deplibs " in
+      # Make sure alldependency_libs contains only unique libraries and directories.
+      dependency_libs=
+      for deplib in $alldependency_libs; do
+       case "$dependency_libs " in
        *" $deplib "*) ;;
-       *) deplibs="$deplibs $deplib" ;;
+       *) dependency_libs="$dependency_libs $deplib" ;;
        esac
       done
       
-      # Make sure inst_deplibs contains only unique libraries and directories.
-      newinst_deplibs=
-      for deplib in $inst_deplibs; do
-       case "$newinst_deplibs " in
-       *" $deplib "*) ;;
-       *) newinst_deplibs="$newinst_deplibs $deplib" ;;
-       esac
-      done
-      inst_deplibs=$newinst_deplibs
-      
-      # Make sure alldeplibs contains only unique libraries and directories.
-      newalldeplibs=
-      for deplib in $alldeplibs; do
-       case "$newalldeplibs " in
-       *" $deplib "*) ;;
-       *) newalldeplibs="$newalldeplibs $deplib" ;;
-       esac
-      done
-      alldeplibs=$newalldeplibs
-      
-      # Make sure inst_alldeplibs contains only unique libraries and directories.
-      newinst_alldeplibs=
-      for deplib in $inst_alldeplibs; do
-       case "$newinst_alldeplibs " in
-       *" $deplib "*) ;;
-       *) newinst_alldeplibs="$newinst_alldeplibs $deplib" ;;
-       esac
-      done
-      inst_alldeplibs=$newinst_alldeplibs
-
       # Eliminate all temporary directories.
-      for path in $remove_path; do
+      for path in $uninst_path; do
        lib_search_path=`echo "$lib_search_path" | sed -e 's% $path % %g'`
        deplibs=`echo "$deplibs" | sed -e 's% -L$path % %g'`
-       inst_deplibs=`echo "$inst_deplibs" | sed -e 's% -L$path % %g'`
-       alldeplibs=`echo "$alldeplibs" | sed -e 's% -L$path % %g'`
-       inst_alldeplibs=`echo "$inst_alldeplibs" | sed -e 's% -L$path % %g'`
+       dependency_libs=`echo "$dependency_libs" | sed -e 's% -L$path % %g'`
       done
       
-      $echo "noinst deplibs:     $deplibs"
-      $echo "inst deplibs:       $inst_deplibs"
-      $echo "noinst all deplibs: $alldeplibs"
-      $echo "inst all deplibs:   $inst_alldeplibs"
-      $echo "search path:       '$lib_search_path'"
+      $echo "deplibs:         $deplibs"
+      $echo "dependency_libs: $dependency_libs"
+      $echo "search path:     $lib_search_path"
 
-      if test -n "$rpath"; then
-       # Building not a libtool convenience library.
-       dependency_libs="$alldeplibs"
-       inst_dependency_libs="$inst_alldeplibs"
+      if test -n "$xrpath"; then
+       # If the user specified any rpath flags, then add them.
+       temp_xrpath=
+       for libdir in $xrpath; do
+         temp_xrpath="$temp_xrpath -R$libdir"
+         if test -n "$hardcode_libdir_flag_spec"; then
+           saved_libdir="$libdir"
+           if test -n "$hardcode_libdir_separator"; then
+             if test -z "$hardcode_libdirs"; then
+               # Put the magic libdir with the hardcode flag.
+               hardcode_libdirs="$libdir"
+               libdir="@HARDCODE_LIBDIRS@"
+             else
+               # Just accumulate the unique libdirs.
+               case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
+               *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+                 ;;
+               *)
+                 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+                 ;;
+               esac
+               libdir=
+             fi
+           fi
+
+           if test -n "$libdir"; then
+             eval flag=\"$hardcode_libdir_flag_spec\"
+
+             deplibs="$deplibs $flag"
+           fi
+
+           libdir="$saved_libdir"
+         fi
+       done
+       dependency_libs="$temp_xrpath $dependency_libs"
       fi
 
+      # Substitute the hardcoded libdirs into the compile commands.
+      if test -n "$hardcode_libdir_separator"; then
+       deplibs=`$echo "X$deplibs" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
+      fi
+
+      $echo "deplibs:     $deplibs"
+      
       # Restore the variables
       versuffix=$versuffix_save
       major=$major_save
@@ -1968,6 +1854,13 @@ EOF
        none | unknown | *) newdeplibs=""
          if $echo "X$deplibs" | $Xsed -e 's/ -lc$//' -e 's/[   ]//g' \
             | grep . >/dev/null; then
+           echo
+           if test "X$deplibs_check_method" = "Xnone"; then
+             echo "*** Warning: inter-library dependencies are not supported in this platform."
+           else
+             echo "*** Warning: inter-library dependencies are not known to be supported."
+           fi
+           echo "*** All declared inter-library dependencies are being dropped."
            droppeddeps=yes
          fi
          ;;
@@ -1978,27 +1871,34 @@ EOF
        libname=$libname_save
        name=$name_save
 
-       if test "$module,$droppeddeps" = "yes,yes"; then
-         echo
-         echo "*** Warning: libtool could not satisfy all dependencies of module $libname"
-         echo "*** Therefore, instead of creating a dynamic module that would not run, "
-         echo "*** libtool will create a static module.  As long as the dlopening"
-         echo "*** application is linked with the -dlopen flag, this should be enough."
-         if test -z "$global_symbol_pipe"; then
+       if test "$droppeddeps" = yes; then
+         if test "$module" = yes; 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 mostly useless."
-         fi
-         if test "$build_old_libs" = no; then
-           oldlibs="$output_objdir/$libname.$libext"
-           build_libtool_libs=module
-           build_old_libs=yes
+           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."
+           fi
+           if test "$build_old_libs" = no; then
+             oldlibs="$output_objdir/$libname.$libext"
+             build_libtool_libs=module
+             build_old_libs=yes
+           else
+             build_libtool_libs=no
+           fi
+           dlname=
+           library_names=
          else
-           build_libtool_libs=no
+           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."
          fi
-         dlname=
-         library_names=
        fi
       fi
 
@@ -2025,6 +1925,16 @@ EOF
          linknames="$linknames $link"
        done
 
+       # Ensure that we have .o objects for linkers which dislike .lo
+       # (e.g. aix) incase we are running --disable-static
+        for obj in $libobjs; do
+          oldobj=`echo $obj | $Xsed -e "$lo2o"`
+          test -f $oldobj || ${LN_S} $obj $oldobj
+        done
+
+       # Use standard objects if they are pic
+        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
        if test -n "$whole_archive_flag_spec"; then
          if test -n "$convenience"; then
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
@@ -2079,64 +1989,210 @@ EOF
          dlname="$soname"
        fi
       fi
-      ;;
+      ;;
+
+    *.lo | *.o | *.obj)
+      if test -n "$deplibs"; then
+       $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+      fi
+
+      if test -n "$dlfiles$dlprefiles"; then
+       $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+       $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$xrpath"; then
+       $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+       $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$release"; then
+       $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+      fi
+
+      case "$output" in
+      *.lo)
+       if test -n "$objs"; then
+         $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+         exit 1
+       fi
+       libobj="$output"
+       obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+       ;;
+      *)
+       libobj=
+       obj="$output"
+       ;;
+      esac
+
+      # Delete the old objects.
+      $run $rm $obj $libobj
+
+      # Create the old-style object.
+      reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
+
+      output="$obj"
+      eval cmds=\"$reload_cmds\"
+      IFS="${IFS=      }"; save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+       IFS="$save_ifs"
+       $show "$cmd"
+       $run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+
+      # Exit if we aren't doing a library object file.
+      test -z "$libobj" && exit 0
+
+      if test "$build_libtool_libs" != yes; then
+       # Create an invalid libtool object if no PIC, so that we don't
+       # accidentally link it into a program.
+       $show "echo timestamp > $libobj"
+       $run eval "echo timestamp > $libobj" || exit $?
+       exit 0
+      fi
+
+      if test -n "$pic_flag"; then
+       # Only do commands if we really have different PIC objects.
+       reload_objs="$libobjs"
+       output="$libobj"
+       eval cmds=\"$reload_cmds\"
+       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
+       for cmd in $cmds; do
+         IFS="$save_ifs"
+         $show "$cmd"
+         $run eval "$cmd" || exit $?
+       done
+       IFS="$save_ifs"
+      else
+       # Just create a symlink.
+       $show $rm $libobj
+       $run $rm $libobj
+       $show "$LN_S $obj $libobj"
+       $run $LN_S $obj $libobj || exit $?
+      fi
 
-    *.lo | *.o | *.obj)
-      if test -n "$link_against_libtool_libs"; then
-       $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
-       exit 1
-      fi
+      exit 0
+      ;;
 
-      if test -n "$deplibs"; then
-       $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+    # Anything else should be a program.
+    *)
+      if test -n "$vinfo"; then
+       $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
       fi
 
-      if test -n "$dlfiles$dlprefiles"; then
-       $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+      if test -n "$release"; then
+       $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
       fi
 
       $echo "old deplibs: $deplibs"
       $echo "search path: $lib_search_path"
 
       # Find libtool libraries and add their dependencies/rpaths
-      newdeplibs=
-      for deplib in $deplibs; do
-       newdeplibs="$newdeplibs $deplib"
-       name="`expr $deplib : '-l\(.*\)'`"
-       # If $name is empty we are operating on a -L argument.
-       if test -n "$name"; then
+      olddeplibs="$deplibs"
+      deplibs=
+      new_lib_search_path=
+      for deplib in $olddeplibs; do
+       lib=
+       case "$deplib" in
+       -L*)
+         $echo "$deplib is a directory"
+         new_lib_search_path="$new_lib_search_path `expr $deplib : '-L\(.*\)'`"
+         deplibs="$deplibs $deplib"
+         continue
+         ;;
+       -l*)
+         name="`expr $deplib : '-l\(.*\)'`"
          libname=`eval \\$echo \"$libname_spec\"`
+         found=no
          for searchdir in $lib_search_path; do
-           if test -f "$searchdir/$libname.la"; then
-             lib="$searchdir/$libname.la"
-             dlname=
-             libdir=
-             library_names=
-             old_library=
-             inst_dependency_libs=
+           # Search the libtool library
+           lib="$searchdir/$libname.la"
+           if test -f "$lib"; then
+             found=yes
+             break
+           fi
+         done
+         if test "$found" != yes; then
+           $echo "$deplib is not a libtool library"
+           deplibs="$deplibs $deplib"
+           continue
+         fi
+         ;;
+       *)
+         lib="$deplib"
+         if test -f "$lib"; then :
+         else
+           $echo "$modename: cannot find the library \`$lib'" 1>&2
+           exit 1
+         fi
+         ;;
+       esac
+       $echo "$deplib is a libtool library"
+       dlname=
+       libdir=
+       library_names=
+       old_library=
 
-             # Check to see that this really is a libtool archive.
-             if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
-             else
-               $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
-               exit 1
-             fi
+       # Check to see that this really is a libtool archive.
+       if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+       else
+         $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+         exit 1
+       fi
 
-             # Read in the .la file
-             # If there is no directory component, then add one.
-             . $lib
+       # If the library was installed with an old release of libtool,
+       # it will not redefine variable installed.
+       installed=yes
 
-             if test "$build_libtool_libs" = no || test "$deplibs_check_method" = none; then
-               # Add in any libraries that this one depends upon.
-               newdeplibs="$newdeplibs$dependency_libs"
-             fi
+       # Read the .la file
+       . $lib
 
-             break
-           fi
-         done
+       # Get the name of the library we link against.
+       linklib=
+       for l in $old_library $library_names; do
+         linklib="$l"
+       done
+
+       if test -z "$linklib"; then
+         $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+         exit 1
+       fi
+
+       new_lib_search_path="$new_lib_search_path $dir"
+       deplibs="$deplibs $lib"
+
+       if test "$build_libtool_libs" = no || test "$deplibs_check_method" = none; then
+         # Add in any libraries that this one depends upon.
+         deplibs="$deplibs $dependency_libs"
        fi
-      done
        
+       for dir in $dependency_libs; do
+         case "$dir" in
+         -L*)
+           new_lib_search_path="$new_lib_search_path `expr $dir : '-L\(.*\)'`"
+           ;;
+         *) ;;
+         esac
+       done
+      done
+
+      # Make sure lib_search_path contains only unique directories.
+      lib_search_path=
+      for dir in $new_lib_search_path; do
+       case "$lib_search_path " in
+       *" $dir "*) ;;
+       *) lib_search_path="$lib_search_path $dir" ;;
+       esac
+      done
+      lib_search_path="$lib_search_path $sys_lib_search_path"
+      
       # Make sure deplibs contains only unique libraries and directories.
       deplibs=
       for deplib in $newdeplibs; do
@@ -2149,6 +2205,7 @@ EOF
 
       # Find libtool libraries and add their directories
       newdeplibs=
+      link_against_libtool_libs=
       for deplib in $deplibs; do
        found=
        name="`expr $deplib : '-l\(.*\)'`"
@@ -2206,7 +2263,6 @@ EOF
                convenience="$convenience $dir/$old_library"
                old_convenience="$old_convenience $dir/$old_library"
                compile_command="$compile_command $dir/$old_library"
-               finalize_command="$finalize_command $dir/$old_library"
                continue
              fi
 
@@ -2244,7 +2300,6 @@ EOF
                    eval flag=\"$hardcode_libdir_flag_spec\"
 
                    compile_command="$compile_command $flag"
-                   finalize_command="$finalize_command $flag"
                  fi
                elif test -n "$runpath_var"; then
                  # Do the same for the permanent run path.
@@ -2259,17 +2314,6 @@ EOF
                immediate | unsupported)
                  if test "$hardcode_direct" = no; then
                    compile_command="$compile_command $dir/$linklib"
-                   case "$host" in
-                   *-*-cygwin* | *-*-mingw* | *-*-os2*)
-                     compile_dependencylibs="$compile_dependencylibs -L$dir -l$name"
-                     dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
-                     if test -n "$dllsearchpath"; then
-                       dllsearchpath="$dllsearchpath:$dllsearchdir"
-                     else
-                       dllsearchpath="$dllsearchdir"
-                     fi
-                     ;;
-                   esac
                  elif test "$hardcode_minus_L" = no; then
                    case "$host" in
                    *-*-sunos*)
@@ -2321,18 +2365,19 @@ EOF
                  exit 1
                fi
 
-               # Finalize command for both is simple: just hardcode it.
+               # Install command for both is simple: just hardcode it.
                if test "$hardcode_direct" = yes; then
-                 finalize_command="$finalize_command $libdir/$linklib"
+                 compile_command="$compile_command $libdir/$linklib"
                elif test "$hardcode_minus_L" = yes; then
-                 finalize_command="$finalize_command -L$libdir -l$name"
+                 compile_command="$compile_command -L$libdir -l$name"
                elif test "$hardcode_shlibpath_var" = yes; then
-                 finalize_shlibpath="$finalize_shlibpath$libdir:"
-                 finalize_command="$finalize_command -l$name"
+                 compile_shlibpath="$compile_shlibpath$libdir:"
+                 compile_command="$compile_command -l$name"
                else
                  # We cannot seem to hardcode it, guess we'll fake it.
-                 finalize_command="$finalize_command -L$libdir -l$name"
+                 compile_command="$compile_command -L$libdir -l$name"
                fi
+               
              else
                # Transform directly to old archives if we don't build new libraries.
                if test -n "$pic_flag" && test -z "$old_library"; then
@@ -2346,10 +2391,8 @@ EOF
                if test "$hardcode_direct" != unsupported; then
                  test -n "$old_library" && linklib="$old_library"
                  compile_command="$compile_command $dir/$linklib"
-                 finalize_command="$finalize_command $dir/$linklib"
                else
                  compile_command="$compile_command -L$dir -l$name"
-                 finalize_command="$finalize_command -L$dir -l$name"
                fi
              fi
 
@@ -2381,104 +2424,13 @@ EOF
            
       # Add in any non-libtool libraries.
       compile_command="$compile_command $deplibs"
-      finalize_command="$finalize_command $deplibs"
-             
-      if test -n "$rpath"; then
-       $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
-      fi
-
-      if test -n "$xrpath"; then
-       $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
-      fi
-
-      if test -n "$vinfo"; then
-       $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
-      fi
-
-      if test -n "$release"; then
-       $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
-      fi
-
-      case "$output" in
-      *.lo)
-       if test -n "$objs"; then
-         $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
-         exit 1
-       fi
-       libobj="$output"
-       obj=`$echo "X$output" | $Xsed -e "$lo2o"`
-       ;;
-      *)
-       libobj=
-       obj="$output"
-       ;;
-      esac
-
-      # Delete the old objects.
-      $run $rm $obj $libobj
-
-      # Create the old-style object.
-      reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
-
-      output="$obj"
-      eval cmds=\"$reload_cmds\"
-      IFS="${IFS=      }"; save_ifs="$IFS"; IFS='~'
-      for cmd in $cmds; do
-       IFS="$save_ifs"
-       $show "$cmd"
-       $run eval "$cmd" || exit $?
-      done
-      IFS="$save_ifs"
-
-      # Exit if we aren't doing a library object file.
-      test -z "$libobj" && exit 0
-
-      if test "$build_libtool_libs" != yes; then
-       # Create an invalid libtool object if no PIC, so that we don't
-       # accidentally link it into a program.
-       $show "echo timestamp > $libobj"
-       $run eval "echo timestamp > $libobj" || exit $?
-       exit 0
-      fi
-
-      if test -n "$pic_flag"; then
-       # Only do commands if we really have different PIC objects.
-       reload_objs="$libobjs"
-       output="$libobj"
-       eval cmds=\"$reload_cmds\"
-       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
-       for cmd in $cmds; do
-         IFS="$save_ifs"
-         $show "$cmd"
-         $run eval "$cmd" || exit $?
-       done
-       IFS="$save_ifs"
-      else
-       # Just create a symlink.
-       $show $rm $libobj
-       $run $rm $libobj
-       $show "$LN_S $obj $libobj"
-       $run $LN_S $obj $libobj || exit $?
-      fi
-
-      exit 0
-      ;;
-
-    # Anything else should be a program.
-    *)
-      if test -n "$vinfo"; then
-       $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
-      fi
-
-      if test -n "$release"; then
-       $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
-      fi
 
       if test -n "$rpath$xrpath"; then
        # If the user specified any rpath flags, then add them.
        for libdir in $rpath $xrpath; do
          if test -n "$hardcode_libdir_flag_spec"; then
            saved_libdir="$libdir"
+           test $link_install = no && libdir="$dir"
            if test -n "$hardcode_libdir_separator"; then
              if test -z "$hardcode_libdirs"; then
                # Put the magic libdir with the hardcode flag.
@@ -2504,38 +2456,11 @@ EOF
            fi
 
            libdir="$saved_libdir"
-           if test -n "$hardcode_libdir_separator"; then
-             if test -z "$finalize_hardcode_libdirs"; then
-               # Put the magic libdir with the hardcode flag.
-               finalize_hardcode_libdirs="$libdir"
-               libdir="@HARDCODE_LIBDIRS@"
-             else
-               # Just accumulate the unique libdirs.
-               case "$hardcode_libdir_separator$finalize_hardcode_libdirs$hardcode_libdir_separator" in
-               *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
-                 ;;
-               *)
-                 finalize_hardcode_libdirs="$finalize_hardcode_libdirs$hardcode_libdir_separator$libdir"
-                 ;;
-               esac
-               libdir=
-             fi
-           fi
-
-           if test -n "$libdir"; then
-             eval flag=\"$hardcode_libdir_flag_spec\"
-
-             finalize_command="$finalize_command $flag"
-           fi
          elif test -n "$runpath_var"; then
            case "$perm_rpath " in
            *" $libdir "*) ;;
            *) perm_rpath="$perm_rpath $libdir" ;;
            esac
-           case "$finalize_perm_rpath " in
-           *" $libdir "*) ;;
-           *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
-           esac
          fi
        done
       fi
@@ -2543,7 +2468,6 @@ EOF
       # Substitute the hardcoded libdirs into the compile commands.
       if test -n "$hardcode_libdir_separator"; then
        compile_command=`$echo "X$compile_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
-       finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$finalize_hardcode_libdirs%g"`
       fi
 
       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
@@ -2556,7 +2480,6 @@ EOF
       if test -n "$libobjs" && test "$build_old_libs" = yes; then
        # Transform all the library objects into standard objects.
        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-       finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
       fi
 
       if test "$export_dynamic" = yes || test -n "$dlfiles$dlprefiles" && test -n "$NM" && test -n "$global_symbol_pipe"; then
@@ -2693,7 +2616,6 @@ static const void *lt_preloaded_setup() {
 
          # Transform the symbol file into the correct name.
          compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"`
-         finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"`
          ;;
        *)
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
@@ -2710,7 +2632,6 @@ static const void *lt_preloaded_setup() {
 
        # Nullify the symbol file.
        compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
-       finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
       fi
 
       if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
@@ -2725,8 +2646,11 @@ static const void *lt_preloaded_setup() {
       fi
 
       # Replace the output file specification.
-      compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
-      finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'T%g'`
+      if test $link_install = no; then
+        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+      else
+        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'T%g'`
+      fi
 
       # Create the binary in the object directory, then wrap it.
       if test ! -d $output_objdir; then
@@ -2762,9 +2686,6 @@ static const void *lt_preloaded_setup() {
       if test -n "$compile_shlibpath"; then
        compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
       fi
-      if test -n "$finalize_shlibpath"; then
-       finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
-      fi
 
       if test -n "$runpath_var"; then
         if test -n "$perm_rpath"; then
@@ -2775,14 +2696,6 @@ static const void *lt_preloaded_setup() {
          done
          compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
        fi
-        if test -n "$finalize_perm_rpath"; then
-         # We should set the runpath_var.
-         rpath=
-         for dir in $finalize_perm_rpath; do
-           rpath="$rpath$dir:"
-         done
-         finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
-       fi
       fi
 
       if test "$hardcode_action" = relink; then
@@ -2797,9 +2710,6 @@ static const void *lt_preloaded_setup() {
       # Now create the wrapper script.
       $show "creating $output"
 
-      # Quote the finalize command for shipping.
-      finalize_command=`$echo "X$finalize_command" | $Xsed -e "$sed_quote_subst"`
-
       # Quote $echo for shipping.
       if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
        case "$0" in
@@ -2846,7 +2756,8 @@ if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
 if test \"\$libtool_install_magic\" = \"$magic\"; then
   # install mode needs the following variables:
   link_against_libtool_libs='$link_against_libtool_libs'
-  finalize_command=\"cd `pwd | sed -e $sed_quote_subst`; $finalize_command\"
+  link_command=\"$link_command\"
+  link_dir=\"`pwd | sed -e $sed_quote_subst`\"
 else
   # When we are sourced in execute mode, \$file and \$echo are already set.
   if test \"\$libtool_execute_magic\" != \"$magic\"; then
@@ -2911,14 +2822,6 @@ else
 "
        fi
 
-       # fixup the dll searchpath if we need to.
-       if test -n "$dllsearchpath"; then
-         $echo >> $output "\
-    # Add the dll search path components to the executable PATH
-    PATH=$dllsearchpath:\$PATH
-"
-       fi
-
        $echo >> $output "\
     if test \"\$libtool_execute_magic\" != \"$magic\"; then
       # Run the actual program with our arguments.
@@ -3025,14 +2928,6 @@ fi\
       test "$build_old_libs" = yes && old_library="$libname.$libext"
       $show "creating $output"
 
-      if test -n "$xrpath"; then
-       temp_xrpath=
-       for libdir in $xrpath; do
-         temp_xrpath="$temp_xrpath -R$libdir"
-       done
-       dependency_libs="$temp_xrpath $dependency_libs"
-      fi
-
       # Only create the output if not a dry run.
       if test -z "$run"; then
        $echo > $output "\
@@ -3051,9 +2946,6 @@ old_library='$old_library'
 # Libraries that this one depends upon.
 dependency_libs='$dependency_libs'
 
-# Libraries that this one depends upon (installed).
-inst_dependency_libs='$inst_dependency_libs'
-
 # Version information for $libname.
 current=$current
 age=$age
@@ -3063,7 +2955,10 @@ revision=$revision
 installed=no
 
 # Directory that this library needs to be installed in:
-libdir='$install_libdir'\
+libdir='$install_libdir'
+
+link_command=\"$link_command\"
+link_dir=\"`pwd | sed -e $sed_quote_subst`\"\
 "
       fi
 
@@ -3310,13 +3205,31 @@ libdir='$install_libdir'\
        fi
 
        # TODO: relink if necessary
+       if test "$hardcode_action" = relink; then
+         if test "$finalize" = yes; then
+           $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
+           finalize_command="cd $link_dir; $SHELL $0 -mode=link-install $link_command"
+           $show "$finalize_command"
+           if $run eval "$finalize_command"; then :
+           else
+             echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+             continue
+           fi
+           file="$objdir/$file"T
+         else
+           $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
+         fi
+       else
+         # Install the binary that we compiled earlier.
+         file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+       fi
 
        # Install the pseudo-library for information purposes.
        name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
        instname="$dir/$name"i
        $show "Creating $instname"
        $rm "$instname"
-       sed -e 's/^installed=no$/installed=yes/' -e 's/^dependency_libs=.*/dependency_libs=$inst_dependency_libs/' "$file" > "$instname"
+       sed -e 's/^installed=no$/installed=yes/' "$file" > "$instname"
        $show "$install_prog $instname $destdir/$name"
        $run eval "$install_prog $instname $destdir/$name" || exit $?
        $show "$rm $instname"
@@ -3382,7 +3295,8 @@ libdir='$install_libdir'\
        # Do a test to see if this is really a libtool program.
        if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
          link_against_libtool_libs=
-         finalize_command=
+         link_command=
+         link_dir=
 
          # If there is no directory component, then add one.
          case "$file" in
@@ -3391,7 +3305,7 @@ libdir='$install_libdir'\
          esac
 
          # Check the variables that should have been set.
-         if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then
+         if test -z "$link_against_libtool_libs" || test -z "$link_command" || test -z "$link_dir"; then
            $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
            exit 1
          fi
@@ -3401,11 +3315,7 @@ libdir='$install_libdir'\
            # Check to see that each library is installed.
            libdir=
            if test -f "$lib"; then
-             # If there is no directory component, then add one.
-             case "$lib" in
-             */* | *\\*) . $lib ;;
-             *) . ./$lib ;;
-             esac
+            . $lib
            fi
            libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
            if test -n "$libdir" && test ! -f "$libfile"; then
@@ -3417,6 +3327,7 @@ libdir='$install_libdir'\
          if test "$hardcode_action" = relink; then
            if test "$finalize" = yes; then
              $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
+             finalize_command="cd $link_dir; $SHELL $0 -mode=link-install $link_command"
              $show "$finalize_command"
              if $run eval "$finalize_command"; then :
              else