aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/lib/target-libpath.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/lib/target-libpath.exp')
-rw-r--r--gcc/testsuite/lib/target-libpath.exp37
1 files changed, 30 insertions, 7 deletions
diff --git a/gcc/testsuite/lib/target-libpath.exp b/gcc/testsuite/lib/target-libpath.exp
index 8999aa47980..c95cba6d784 100644
--- a/gcc/testsuite/lib/target-libpath.exp
+++ b/gcc/testsuite/lib/target-libpath.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,6 +25,8 @@ set orig_ld_library64_path_saved 0
set orig_ld_library_path_32_saved 0
set orig_ld_library_path_64_saved 0
set orig_dyld_library_path_saved 0
+set orig_gcc_exec_prefix_saved 0
+set orig_gcc_exec_prefix_checked 0
#######################################
@@ -42,6 +44,8 @@ proc set_ld_library_path_env_vars { } {
global orig_ld_library_path_32_saved
global orig_ld_library_path_64_saved
global orig_dyld_library_path_saved
+ global orig_gcc_exec_prefix_saved
+ global orig_gcc_exec_prefix_checked
global orig_ld_library_path
global orig_ld_run_path
global orig_shlib_path
@@ -50,11 +54,23 @@ proc set_ld_library_path_env_vars { } {
global orig_ld_library_path_32
global orig_ld_library_path_64
global orig_dyld_library_path
- global GCC_EXEC_PREFIX
+ global orig_gcc_exec_prefix
+ global TEST_GCC_EXEC_PREFIX
+ global env
- # Set the relocated compiler prefix, but only if the user hasn't specified one.
- if { [info exists GCC_EXEC_PREFIX] && ![info exists env(GCC_EXEC_PREFIX)] } {
- setenv GCC_EXEC_PREFIX "$GCC_EXEC_PREFIX"
+ # Save the original GCC_EXEC_PREFIX.
+ if { $orig_gcc_exec_prefix_checked == 0 } {
+ if [info exists env(GCC_EXEC_PREFIX)] {
+ set orig_gcc_exec_prefix "$env(GCC_EXEC_PREFIX)"
+ set orig_gcc_exec_prefix_saved 1
+ }
+ set orig_gcc_exec_prefix_checked 1
+ }
+
+ # Set GCC_EXEC_PREFIX for the compiler under test to pick up files not in
+ # the build tree from a specified location (normally the install tree).
+ if [info exists TEST_GCC_EXEC_PREFIX] {
+ setenv GCC_EXEC_PREFIX "$TEST_GCC_EXEC_PREFIX"
}
# Setting the ld library path causes trouble when testing cross-compilers.
@@ -63,8 +79,6 @@ proc set_ld_library_path_env_vars { } {
}
if { $orig_environment_saved == 0 } {
- global env
-
set orig_environment_saved 1
# Save the original environment.
@@ -187,6 +201,7 @@ proc restore_ld_library_path_env_vars { } {
global orig_ld_library_path_32_saved
global orig_ld_library_path_64_saved
global orig_dyld_library_path_saved
+ global orig_gcc_exec_prefix_saved
global orig_ld_library_path
global orig_ld_run_path
global orig_shlib_path
@@ -195,11 +210,19 @@ proc restore_ld_library_path_env_vars { } {
global orig_ld_library_path_32
global orig_ld_library_path_64
global orig_dyld_library_path
+ global orig_gcc_exec_prefix
+ global env
if { $orig_environment_saved == 0 } {
return
}
+ if { $orig_gcc_exec_prefix_saved } {
+ setenv GCC_EXEC_PREFIX "$orig_gcc_exec_prefix"
+ } elseif [info exists env(GCC_EXEC_PREFIX)] {
+ unsetenv GCC_EXEC_PREFIX
+ }
+
if { $orig_ld_library_path_saved } {
setenv LD_LIBRARY_PATH "$orig_ld_library_path"
} elseif [info exists env(LD_LIBRARY_PATH)] {