g++.exp (g++_link_flags): Use gcc-set-multilib-library-path.
authorMark Mitchell <mark@codesourcery.com>
Sat, 26 Mar 2005 01:50:32 +0000 (01:50 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sat, 26 Mar 2005 01:50:32 +0000 (01:50 +0000)
* lib/g++.exp (g++_link_flags): Use gcc-set-multilib-library-path.
(g++_init): Make sure that CXXFLAGS is set.
* lib/gcc-defs.exp (gcc-set-multilib-library-path): New function.
* lib/gcc-dg.exp: Use gcc-set-multilib-library-path.
* lib/gfortran.exp (gfortran_link_flags): Likewise.
* lib/objc.exp (objc_init): Likewise.
* lib/treelang.exp (treelang_init): Likewise.

From-SVN: r97076

gcc/testsuite/ChangeLog
gcc/testsuite/lib/g++.exp
gcc/testsuite/lib/gcc-defs.exp
gcc/testsuite/lib/gcc-dg.exp
gcc/testsuite/lib/gfortran.exp
gcc/testsuite/lib/objc.exp
gcc/testsuite/lib/treelang.exp

index 24ac11d1c1dfff76ca210f10dcb5c6ff56324f9e..9e5cdf9fedc37a596671d280472eb4a7ac60d618 100644 (file)
@@ -1,3 +1,13 @@
+2005-03-25  Mark Mitchell  <mark@codesourcery.com>
+
+       * lib/g++.exp (g++_link_flags): Use gcc-set-multilib-library-path.
+       (g++_init): Make sure that CXXFLAGS is set.
+       * lib/gcc-defs.exp (gcc-set-multilib-library-path): New function.
+       * lib/gcc-dg.exp: Use gcc-set-multilib-library-path.
+       * lib/gfortran.exp (gfortran_link_flags): Likewise. 
+       * lib/objc.exp (objc_init): Likewise.
+       * lib/treelang.exp (treelang_init): Likewise.
+
 2005-03-25  Pat Haugen  <pthaugen@us.ibm.com>
 
        PR tree-optimization/20470
index bc2bf60fb7d28ff0dd7af7910f5c035fc7bfd627..e1fa69f836b1ade7fc53b18933c41f966b75f71c 100644 (file)
@@ -97,7 +97,6 @@ proc g++_include_flags { paths } {
 #
 
 proc g++_link_flags { paths } {
-    global rootme
     global srcdir
     global ld_library_path
     global GXX_UNDER_TEST
@@ -129,21 +128,7 @@ proc g++_link_flags { paths } {
       if [file exists "${gccpath}/librx/librx.a"] {
           append flags "-L${gccpath}/librx "
       }
-      append ld_library_path ":${rootme}"
-      set compiler [lindex $GXX_UNDER_TEST 0]
-      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 ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
-           append ld_library_path ":${rootme}/${mldir}"
-         }
-       }
-      }
+      append ld_library_path [gcc-set-multilib-library-path $GXX_UNDER_TEST]
     } else {
       global tool_root_dir
 
@@ -185,6 +170,7 @@ proc g++_init { args } {
     global gluefile wrap_flags
     global objdir srcdir
     global ALWAYS_CXXFLAGS
+    global CXXFLAGS
     global TOOL_EXECUTABLE TOOL_OPTIONS
     global GXX_UNDER_TEST
     global TESTING_IN_BUILD_TREE
@@ -227,6 +213,10 @@ proc g++_init { args } {
 
     g++_maybe_build_wrapper "${tmpdir}/g++-testglue.o"
 
+    if {![info exists CXXFLAGS]} {
+       set CXXFLAGS ""
+    }
+
     set ALWAYS_CXXFLAGS ""
 
     if ![is_remote host] {
index 87e8564e97ae4bafb127be6c0aabf6279d7a06f7..c48b5399ac08a28766354ba62625e98dbf5ef0e1 100644 (file)
@@ -219,3 +219,35 @@ proc dg-additional-files-options { options source } {
 
     return $options
 }
+
+# Return a colon-separate list of directories to search for libraries
+# for COMPILER, including multilib directories.
+
+proc gcc-set-multilib-library-path { compiler } {
+    global rootme
+
+    # ??? rootme will not be set when testing an installed compiler.
+    # In that case, we should perhaps use some other method to find
+    # libraries.
+    if {![info exists rootme]} {
+       return ""
+    }
+
+    set libpath ":${rootme}"
+    set compiler [lindex $compiler 0]
+    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 ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
+               append libpath ":${rootme}/${mldir}"
+           }
+       }
+    }
+
+    return $libpath
+}
index ee16d2efc6762021543bb77384d24e65a33a07f3..aecce0f5eb5d586d1bc013be3073cb047d4f107b 100644 (file)
@@ -52,28 +52,12 @@ if ![info exists GCC_UNDER_TEST] {
     set GCC_UNDER_TEST "[find_gcc]"
 }
 
-global rootme
-global ld_library_path
 global orig_environment_saved
 
 # This file may be sourced, so don't override environment settings
 # that have been previously setup.
 if { $orig_environment_saved == 0 } {
-    set ld_library_path "${rootme}"
-    set compiler [lindex $GCC_UNDER_TEST 0]
-    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 ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
-               append ld_library_path ":${rootme}/${mldir}"
-           }
-       }
-    }
+    append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
     set_ld_library_path_env_vars
 }
 
index 8762c90683813716220749551560e85d17286f82..43a104e1f51301f2cf5cf5618163d1fa964021bb 100644 (file)
@@ -73,7 +73,6 @@ proc gfortran_version { } {
 #
 
 proc gfortran_link_flags { paths } {
-    global rootme
     global srcdir
     global ld_library_path
     global GFORTRAN_UNDER_TEST
@@ -94,21 +93,8 @@ proc gfortran_link_flags { paths } {
       if [file exists "${gccpath}/libiberty/libiberty.a"] {
           append flags "-L${gccpath}/libiberty "
       }
-      append ld_library_path ":${rootme}"
-      set compiler [lindex $GFORTRAN_UNDER_TEST 0]
-      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 ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
-           append ld_library_path ":${rootme}/${mldir}"
-         }
-       }
-      }
+      append ld_library_path \
+       [gcc-set-multilib-library-path $GFORTRAN_UNDER_TEST]
     }
 
     set_ld_library_path_env_vars
index d016a379bb7d4e1cd5045ad7d3a63997692e3847..fe86b0e2bff4389fea7aba8145c126cc6b23817f 100644 (file)
@@ -115,21 +115,7 @@ proc objc_init { args } {
 
     objc_maybe_build_wrapper "${tmpdir}/objc-testglue.o"
 
-    set objc_libgcc_s_path "${rootme}"
-    set compiler [lindex $OBJC_UNDER_TEST 0]
-    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 ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
-               append objc_libgcc_s_path ":${rootme}/${mldir}"
-           }
-       }
-    }
+    append objc_libgcc_s_path [gcc-set-multilib-library-path $OBJC_UNDER_TEST]
 }
 
 proc objc_target_compile { source dest type options } {
index 8ce830d4c80407983732a6d64461a980fecc3edb..aba9379793c072c531aa263e443d64687fe4183e 100644 (file)
@@ -84,7 +84,6 @@ proc default_treelang_version { } {
 set treelang_initialized 0
 
 proc treelang_init { args } {
-    global rootme
     global tmpdir
     global libdir
     global gluefile wrap_flags
@@ -115,21 +114,8 @@ proc treelang_init { args } {
 
     treelang_maybe_build_wrapper "${tmpdir}/treelang-testglue.o"
 
-    set treelang_libgcc_s_path "${rootme}"
-    set compiler [lindex $TREELANG_UNDER_TEST 0]
-    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 ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
-               append treelang_libgcc_s_path ":${rootme}/${mldir}"
-           }
-       }
-    }
+    set treelang_libgcc_s_path \
+       [gcc-set-multilib-library-path $TREELANG_UNDER_TEST]
 }
 
 proc treelang_target_compile { source dest type options } {