]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* ltmain.in (finalize_hardcode_libdirs, finalize_rpath): in
authorEdouard G. Parmelan <Edouard.Parmelan@France.NCR.COM>
Fri, 22 Jan 1999 10:01:10 +0000 (10:01 +0000)
committerAlexandre Oliva <aoliva@redhat.com>
Fri, 22 Jan 1999 10:01:10 +0000 (10:01 +0000)
platforms that use -rpath, programs must be finalized at
installation time, otherwise build-tree programs will
prefer installed libraries over build-tree ones

ChangeLog
ltmain.in

index 80b2c679e07513e8a1c919b53818db8da24d9c87..9a57d5a60878530a6f2f3d1f2e8453c3eeb0492d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+1999-01-22  Edouard G. Parmelan  <Edouard.Parmelan@France.NCR.COM>
+
+       * ltmain.in (finalize_hardcode_libdirs, finalize_rpath): in
+       platforms that use -rpath, programs must be finalized at
+       installation time, otherwise build-tree programs will
+       prefer installed libraries over build-tree ones
+
 1999-01-22  Alexandre Oliva  <oliva@dcc.unicamp.br>
 
        * mdemo/Makefile.am (../libltdl/libtool): if it does not exist,
index b11e58587ba5ae4e02fe0a15e34e2ffc9c93838d..f0d03b202f880aca01edcc5e222cb354251d8cc2 100644 (file)
--- a/ltmain.in
+++ b/ltmain.in
@@ -672,6 +672,7 @@ compiler."
     export_symbols=
     generated=
     hardcode_libdirs=
+    finalize_hardcode_libdirs=
     libobjs=
     link_against_libtool_libs=
     ltlibs=
@@ -685,6 +686,7 @@ compiler."
     xrpath=
     perm_rpath=
     temp_rpath=
+    finalize_rpath=
     vinfo=
 
     # We need to know -static, to get the right output filenames.
@@ -1058,6 +1060,21 @@ compiler."
 
          # 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.
@@ -1080,13 +1097,53 @@ compiler."
              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 "*) ;;
-           *) perm_rpath="$perm_rpath $libdir" ;;
+           *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
            esac
          fi
 
@@ -1942,6 +1999,7 @@ EOF
        # 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"
            if test -n "$hardcode_libdir_separator"; then
              if test -z "$hardcode_libdirs"; then
                # Put the magic libdir with the hardcode flag.
@@ -1964,6 +2022,30 @@ EOF
              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
          elif test -n "$runpath_var"; then
@@ -1971,6 +2053,10 @@ EOF
            *" $libdir "*) ;;
            *) perm_rpath="$perm_rpath $libdir" ;;
            esac
+           case "$finalize_perm_rpath " in
+           *" $libdir "*) ;;
+           *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+           esac
          fi
        done
       fi
@@ -1978,7 +2064,7 @@ 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@%$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%/[^/]*$%%'`
@@ -2201,14 +2287,23 @@ static const void *lt_preloaded_setup() {
        finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
       fi
 
-      if test -n "$runpath_var" && test -n "$perm_rpath"; then
-       # We should set the runpath_var.
-       rpath=
-       for dir in $perm_rpath; do
-         rpath="$rpath$dir:"
-       done
-       compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
-       finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
+      if test -n "$runpath_var"; then
+        if test -n "$perm_rpath"; then
+         # We should set the runpath_var.
+         rpath=
+         for dir in $perm_rpath; do
+           rpath="$rpath$dir:"
+         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