OSDN Git Service

* lib/g++.exp (g++_link_flags): Use gcc-set-multilib-library-path.
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 26 Mar 2005 01:50:32 +0000 (01:50 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 26 Mar 2005 01:50:32 +0000 (01:50 +0000)
(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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@97076 138bc75d-0d04-0410-961f-82ee72b054a4

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 24ac11d..9e5cdf9 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 bc2bf60..e1fa69f 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 87e8564..c48b539 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 ee16d2e..aecce0f 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 8762c90..43a104e 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 d016a37..fe86b0e 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 8ce830d..aba9379 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 } {