PATCH: PR testsuite/12040: GDB Fortran tests use g77 instead of gfortran

H.J. Lu
2010-09-20T13:59:03Z

This isn't a proper fix since it depends on we load lib/ada.exp before
any Fortran tests. I think ada.exp is the wrong place to provide
GDB functions. It should be placed in something like gdb-support.exp and
ada.exp/fortran.exp can just load it.

H.J.
---
2010-09-20 H.J. Lu <hongjiu.lu@intel.com>

PR testsuite/12040
* lib/ada.exp (gdb_find_gfortran): New.
(gdb_default_target_compile): Use it.

diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp
index 055d4d3..1e686bc 100644
--- a/gdb/testsuite/lib/ada.exp
+++ b/gdb/testsuite/lib/ada.exp
@@ -41,6 +41,25 @@ proc gdb_find_gnatmake {} {
return $GM
}

+proc gdb_find_gfortran {} {
+ global tool_root_dir
+
+ if ![is_remote host] {
+ set file [lookfor_file $tool_root_dir gfortran]
+ if { $file == "" } {
+ set file [lookfor_file $tool_root_dir gcc/gfortran]
+ }
+ if { $file != "" } {
+ set CC "$file -B[file dirname $file]/"
+ } else {
+ set CC [transform gfortran]
+ }
+ } else {
+ set CC [transform gfortran]
+ }
+ return $CC
+}
+
# FIXME:brobecker/2004-03-31:
# The following function is a copy of the function of the same name provided
# by dejagnu, except that it has been modified to add support for building
@@ -112,7 +131,7 @@ proc gdb_default_target_compile {source destfile type options} {
if [board_info $dest exists f77compiler] {
set compiler [target_info f77compiler]
} else {
- set compiler [find_g77]
+ set compiler [gdb_find_gfortran]
}
}