include/
[external/binutils.git] / ld / testsuite / config / default.exp
index d268fd9..043a885 100644 (file)
@@ -1,10 +1,12 @@
 # Basic expect script for LD Regression Tests
-#   Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2001, 2003
+#   Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2001, 2003, 2005, 2007, 2009
 #   Free Software Foundation, Inc.
 #
+# This file is part of the GNU Binutils.
+#
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
 # 
 # This program is distributed in the hope that it will be useful,
@@ -14,7 +16,8 @@
 # 
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
 #
 # Written by Jeffrey Wheat (cassidy@cygnus.com)
 #
@@ -47,9 +50,7 @@ if ![info exists strip] then {
     set strip [findfile $base_dir/../binutils/strip-new $base_dir/../binutils/strip-new [transform strip]]
 }
 
-if {![file isdirectory tmpdir]} then {
-    catch "exec mkdir tmpdir" status
-}
+remote_exec host "mkdir -p tmpdir"
 
 # Make a symlink from tmpdir/as to the assembler in the build tree, so
 # that we can use a -B option to gcc to force it to use the newly
@@ -114,9 +115,17 @@ proc get_link_files {varname} {
     global srcdir
     global CC
     if ![info exists $varname] {
-       set status [catch "exec sh -c \"host='$target_triplet' && CC='$CC' && . $srcdir/../configure.host && eval echo \\$$varname\"" result]
+       #configure.host returns variables that can be substituted into
+       #makefile rules, with embedded shell variable expansions.
+       #make wants $$shell_var, we want $shell_var ...
+       set cmd "host='$target_triplet' && . $srcdir/../configure.host && sed -e 's,\\\$\\\$,\$,g' <<EOF\n\$$varname\nEOF"
+       set status [catch "exec sh -c [list $cmd]" result]
+       if $status { error "Error getting native link files: $result" }
+       set cmd "CC='$CC' && eval echo \"$result\""
+       set status [catch "exec sh -c [list $cmd]" result]
        if $status { error "Error getting native link files: $result" }
        set $varname $result
+       send_log "$varname = $result\n"
     }
 }