g++.exp (g++_include_flags): Override libgloss.exp version with one that knows about...
authorH.J. Lu <hjl@gnu.org>
Tue, 27 Jun 2000 18:01:02 +0000 (18:01 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Tue, 27 Jun 2000 18:01:02 +0000 (18:01 +0000)
2000-06-27  H.J. Lu  <hjl@gnu.org>
            Loren J. Rittle  <ljrittle@acm.org>

        * lib/g++.exp (g++_include_flags): Override libgloss.exp
        version with one that knows about the new gcc tree structure.
        (g++_link_flags): Same.

Co-Authored-By: Loren J. Rittle <ljrittle@acm.org>
From-SVN: r34735

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

index 76c2d7d963c3a709ca7a8d4c4b51083f97c47969..aedd567c035eff5cf8fbfac85c674f85ba97801e 100644 (file)
@@ -1,3 +1,10 @@
+2000-06-27  H.J. Lu  <hjl@gnu.org>
+            Loren J. Rittle  <ljrittle@acm.org>
+
+        * lib/g++.exp (g++_include_flags): Override libgloss.exp
+        version with one that knows about the new gcc tree structure.
+        (g++_link_flags): Same.
+       
 2000-06-26  Zack Weinberg  <zack@wolery.cumb.org>
 
        * gcc.dg/20000419-1.c, gcc.dg/cpp-mi.c, gcc.dg/cpp-tradwarn1.c,
index 917a063f472aa8445184736560f1ae492c2de59a..47ce3738613d5d5c2b704b49d8e8cf0c076c5417 100644 (file)
@@ -62,6 +62,100 @@ proc g++_version { } {
     }
 }
 
+#
+# provide new versions of g++_include_flags and g++_link_flags (both
+# originally from libgloss.exp) which know about the new gcc tree structure
+#
+proc g++_include_flags { args } {
+    global srcdir
+
+    if [is_remote host] {
+      return ""
+    }
+
+    set gccpath [get_multilibs]
+    set libio_dir ""
+    set flags ""
+
+    set dir [lookfor_file ${srcdir} libg++]
+    if { ${dir} != "" } {
+      append flags "-I${dir} -I${dir}/src "
+    }
+    set odir_v2 [lookfor_file ${gccpath} libstdc++]
+    set sdir_v2 [lookfor_file ${srcdir} libstdc++]
+    if { ${odir_v2} != "" } {
+      append flags "-I${sdir_v2} -I${sdir_v2}/stl "
+    }
+    set odir_v3 [lookfor_file ${gccpath} libstdc++-v3]
+    set sdir_v3 [lookfor_file ${srcdir} libstdc++-v3]
+    if { ${odir_v3} != "" } {
+      append flags [exec ${odir_v3}/mkcheck 2 ${odir_v3} ${sdir_v3}]
+    }
+
+    if { ${odir_v2} != "" && ${odir_v3} != ""} {
+      send_error "ERROR: can't handle both libstdc++ and libstdc++-v3 appearing in build tree.\n"
+      exit 1
+    }
+
+    return "$flags"
+}
+
+proc g++_link_flags { args } {
+    global srcdir
+    global ld_library_path
+
+    set gccpath [get_multilibs];
+    set libio_dir ""
+    set flags ""
+    set ld_library_path "."
+
+    if { $gccpath != "" } {
+      if [file exists "${gccpath}/lib/libstdc++.a"] {
+          append ld_library_path ":${gccpath}/lib"
+      }
+      if [file exists "${gccpath}/libg++/libg++.a"] {
+          append flags "-L${gccpath}/libg++ "
+          append ld_library_path ":${gccpath}/libg++"
+      }
+      if [file exists "${gccpath}/libstdc++/libstdc++.a"] {
+          append flags "-L${gccpath}/libstdc++ "
+          append ld_library_path ":${gccpath}/libstdc++"
+      }
+      if [file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.a"] {
+          append flags " -L${gccpath}/libstdc++-v3/src/.libs "
+          append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs"
+      }
+      if [file exists "${gccpath}/libiberty/libiberty.a"] {
+          append flags "-L${gccpath}/libiberty "
+      }
+      if [file exists "${gccpath}/librx/librx.a"] {
+          append flags "-L${gccpath}/librx "
+      }
+    } else {
+      global tool_root_dir;
+
+      set libgpp [lookfor_file ${tool_root_dir} libg++];
+      if { $libgpp != "" } {
+          append flags "-L${libgpp} ";
+          append ld_library_path ":${libgpp}"
+      }
+      set libstdcpp [lookfor_file ${tool_root_dir} libstdc++];
+      if { $libstdcpp != "" } {
+          append flags "-L${libstdcpp} ";
+          append ld_library_path ":${libstdcpp}"
+      }
+      set libiberty [lookfor_file ${tool_root_dir} libiberty];
+      if { $libiberty != "" } {
+          append flags "-L${libiberty} ";
+      }
+      set librx [lookfor_file ${tool_root_dir} librx];
+      if { $librx != "" } {
+          append flags "-L${librx} ";
+      }
+    }
+    return "$flags"
+}
+
 #
 # g++_init -- called at the start of each subdir of tests
 #