g++.exp (g++_link_flags): Check whether LD_LIBRARY_PATH already contains $ld_library_...
authorRichard Sandiford <rsandifo@redhat.com>
Fri, 30 Jul 2004 10:34:12 +0000 (10:34 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Fri, 30 Jul 2004 10:34:12 +0000 (10:34 +0000)
* lib/g++.exp (g++_link_flags): Check whether LD_LIBRARY_PATH already
contains $ld_library_path.
* lib/gfortran.exp (gfortran_link_flags): Likewise.

From-SVN: r85329

gcc/testsuite/ChangeLog
gcc/testsuite/lib/g++.exp
gcc/testsuite/lib/gfortran.exp

index c0b972c54d21b9ddd86d3beeb474ec3c031ba91d..1db479c6b211791ab925433e8a335c1b27704b03 100644 (file)
@@ -1,3 +1,9 @@
+2004-07-30  Richard Sandiford  <rsandifo@redhat.com>
+
+       * lib/g++.exp (g++_link_flags): Check whether LD_LIBRARY_PATH already
+       contains $ld_library_path.
+       * lib/gfortran.exp (gfortran_link_flags): Likewise.
+
 2004-07-29  Richard Henderson  <rth@redhat.com>
 
        * g++.dg/template/sizeof8.C: Don't assume 32bit pointers.
index 161371b4afa28fe1776b17aabe4a26932906e3e2..df8e0a4b8f15c95b5e6adbd019eee56684e614c6 100644 (file)
@@ -177,9 +177,16 @@ proc g++_link_flags { paths } {
     # Doing this does cause trouble when testing cross-compilers.
     if {![is_remote target]} {
        global env;
-       if { [info exists env(LD_LIBRARY_PATH)] 
-            && $env(LD_LIBRARY_PATH) != "" } {
-               append ld_library_path ":$env(LD_LIBRARY_PATH)";
+       if [info exists env(LD_LIBRARY_PATH)] {
+           # If we've already added these directories once, keep the
+           # existing path.
+           if {$ld_library_path == $env(LD_LIBRARY_PATH)
+               || [string first $ld_library_path: \
+                                $env(LD_LIBRARY_PATH)] == 0} {
+               set ld_library_path $env(LD_LIBRARY_PATH)
+           } elseif { $env(LD_LIBRARY_PATH) != "" } {
+               append ld_library_path ":$env(LD_LIBRARY_PATH)"
+           }
        }
        setenv  LD_LIBRARY_PATH     $ld_library_path
        setenv  SHLIB_PATH          $ld_library_path
index 12236b45a91bfe9e75a26f56bc40bc3812c081eb..4303871e3f92c7dbb313d7081876447527e789fd 100644 (file)
@@ -121,10 +121,17 @@ proc gfortran_link_flags { paths } {
     # Doing this does cause trouble when testing cross-compilers.
     if {![is_remote target]} {
         global env;
-        if { [info exists env(LD_LIBRARY_PATH)]
-             && $env(LD_LIBRARY_PATH) != "" } {
-                append ld_library_path ":$env(LD_LIBRARY_PATH)";
-        }
+       if [info exists env(LD_LIBRARY_PATH)] {
+           # If we've already added these directories once, keep the
+           # existing path.
+           if {$ld_library_path == $env(LD_LIBRARY_PATH)
+               || [string first $ld_library_path: \
+                                $env(LD_LIBRARY_PATH)] == 0} {
+               set ld_library_path $env(LD_LIBRARY_PATH)
+           } elseif { $env(LD_LIBRARY_PATH) != "" } {
+               append ld_library_path ":$env(LD_LIBRARY_PATH)"
+           }
+       }
         setenv  LD_LIBRARY_PATH     $ld_library_path
         setenv  SHLIB_PATH          $ld_library_path
         setenv  LD_LIBRARYN32_PATH  $ld_library_path