From 3a15f566e953c9811f85641c627fdfcc91bacf0b Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 30 Jul 2004 10:34:12 +0000 Subject: [PATCH] g++.exp (g++_link_flags): Check whether LD_LIBRARY_PATH already contains $ld_library_path. * 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 | 6 ++++++ gcc/testsuite/lib/g++.exp | 13 ++++++++++--- gcc/testsuite/lib/gfortran.exp | 15 +++++++++++---- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c0b972c54d2..1db479c6b21 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2004-07-30 Richard Sandiford + + * 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 * g++.dg/template/sizeof8.C: Don't assume 32bit pointers. diff --git a/gcc/testsuite/lib/g++.exp b/gcc/testsuite/lib/g++.exp index 161371b4afa..df8e0a4b8f1 100644 --- a/gcc/testsuite/lib/g++.exp +++ b/gcc/testsuite/lib/g++.exp @@ -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 diff --git a/gcc/testsuite/lib/gfortran.exp b/gcc/testsuite/lib/gfortran.exp index 12236b45a91..4303871e3f9 100644 --- a/gcc/testsuite/lib/gfortran.exp +++ b/gcc/testsuite/lib/gfortran.exp @@ -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 -- 2.30.2