OSDN Git Service

gcc/testsuite/
[pf3gnuchains/gcc-fork.git] / libjava / testsuite / lib / libjava.exp
index 510e4ac..95a3138 100644 (file)
@@ -197,36 +197,8 @@ proc libjava_init { args } {
     }
 
     # Finally, add the gcc build directory so that we can find the
-    # shared libgcc.  This, like much of dejagnu, is hideous.
-    set libjava_libgcc_s_path {}
-
-    if { [istarget "*-*-darwin*"] } {
-       set so_extension "dylib"
-    } elseif { [istarget "*-*-cygwin*"] || [istarget "*-*-mingw*"] } {
-       set so_extension "dll"
-    } else {
-       set so_extension "so"
-    }
-    set gccdir [lookfor_file $tool_root_dir gcc/libgcc_s.${so_extension}]
-    if {$gccdir != ""} {
-       set gccdir [file dirname $gccdir]
-       lappend libjava_libgcc_s_path $gccdir
-       verbose "libjava_libgcc_s_path = $libjava_libgcc_s_path"
-       set compiler ${gccdir}/xgcc
-       if { [is_remote host] == 0 && [which $compiler] != 0 } {
-           foreach i "[exec $compiler --print-multi-lib]" {
-               set mldir ""
-               regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir
-               set mldir [string trimright $mldir "\;@"]
-               if { "$mldir" == "." } {
-                   continue
-               }
-               if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.${so_extension}.*]] >= 1 } {
-                   lappend libjava_libgcc_s_path "${gccdir}/${mldir}"
-               }
-           }
-       }
-    }
+    # shared libgcc.
+    set libjava_libgcc_s_path [find_libgcc_s $GCJ_UNDER_TEST]
 
     set libjava_initialized 1
 }
@@ -337,6 +309,8 @@ proc libjava_arguments {{mode compile}} {
     # Basically we want to build up a colon separated path list from
     # the value of $libjava.
 
+    # Add "." to the list so that we pick up shared libraries created
+    # by the testsuite itself.
     set lpath "."
     foreach dir [list $libjava] {
        foreach item [split $dir " "] {
@@ -470,8 +444,8 @@ proc gcj_invoke {program expectFile ld_library_additions} {
   global ld_library_path
 
   set ld_library_path "$libjava_ld_library_path"
-  if {[llength $ld_library_additions] > 0} {
-    append ld_library_path :[join $ld_library_additions :]
+  foreach path $ld_library_additions {
+    add_path ld_library_path $path
   }
 
   set_ld_library_path_env_vars
@@ -512,8 +486,8 @@ proc exec_gij {jarfile expectFile {ld_library_additions {}} {addl_flags {}}} {
   global ld_library_path
 
   set ld_library_path "$libjava_ld_library_path"
-  if {[llength $ld_library_additions] > 0} {
-  append ld_library_path :[join $ld_library_additions :]
+  foreach path $ld_library_additions {
+    add_path ld_library_path $path
   }
        
   set_ld_library_path_env_vars
@@ -562,8 +536,8 @@ proc libjava_invoke {errname testName optName executable inpfile resultfile
     global ld_library_path
 
     set ld_library_path "$libjava_ld_library_path"
-    if {[llength $ld_library_additions] > 0} {
-       append ld_library_path :[join $ld_library_additions :]
+    foreach path $ld_library_additions {
+       add_path ld_library_path $path
     }
 
     set_ld_library_path_env_vars