This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
[PATCH, try 3] On Windows, locate libraries using $PATH
- From: Peter Rosin <peda at lysator dot liu dot se>
- To: libffi-discuss at sourceware dot org
- Cc: Peter Rosin <peda at lysator dot liu dot se>
- Date: Wed, 21 Mar 2012 08:38:56 +0100
- Subject: [PATCH, try 3] On Windows, locate libraries using $PATH
- References: <1332277616-6408-1-git-send-email-peda@lysator.liu.se>
---
ChangeLog | 7 +++++++
testsuite/lib/target-libpath.exp | 21 +++++++++++++++++++++
2 files changed, 28 insertions(+), 0 deletions(-)
Hi! (again...)
This time with orig_path_saved initialized to zero...
Cheers,
Peter
diff --git a/ChangeLog b/ChangeLog
index bb5bc16..ea4ee0e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-03-21 Peter Rosin <peda@lysator.liu.se>
+
+ * testsuite/lib/target-libpath.exp [*-*-cygwin*, *-*-mingw*]
+ (set_ld_library_path_env_vars): Add the library search dir to
+ PATH (and save PATH for later).
+ (restore_ld_library_path_env_vars): Restore PATH.
+
2012-03-03 H.J. Lu <hongjiu.lu@intel.com>
* src/x86/ffi64.c (ffi_call): Cast the return value to unsigned
diff --git a/testsuite/lib/target-libpath.exp b/testsuite/lib/target-libpath.exp
index 8999aa4..6362007 100644
--- a/testsuite/lib/target-libpath.exp
+++ b/testsuite/lib/target-libpath.exp
@@ -25,6 +25,7 @@ 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_path_saved 0
#######################################
@@ -42,6 +43,7 @@ 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_path_saved
global orig_ld_library_path
global orig_ld_run_path
global orig_shlib_path
@@ -50,6 +52,7 @@ 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 orig_path
global GCC_EXEC_PREFIX
# Set the relocated compiler prefix, but only if the user hasn't specified one.
@@ -100,6 +103,10 @@ proc set_ld_library_path_env_vars { } {
set orig_dyld_library_path "$env(DYLD_LIBRARY_PATH)"
set orig_dyld_library_path_saved 1
}
+ if [info exists env(PATH)] {
+ set orig_path "$env(PATH)"
+ set orig_path_saved 1
+ }
}
# We need to set ld library path in the environment. Currently,
@@ -169,6 +176,13 @@ proc set_ld_library_path_env_vars { } {
} else {
setenv DYLD_LIBRARY_PATH "$ld_library_path"
}
+ if { [ istarget *-*-cygwin* ] || [ istarget *-*-mingw* ] } {
+ if { $orig_path_saved } {
+ setenv PATH "$ld_library_path:$orig_path"
+ } else {
+ setenv PATH "$ld_library_path"
+ }
+ }
verbose -log "set_ld_library_path_env_vars: ld_library_path=$ld_library_path"
}
@@ -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_path_saved
global orig_ld_library_path
global orig_ld_run_path
global orig_shlib_path
@@ -195,6 +210,7 @@ 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_path
if { $orig_environment_saved == 0 } {
return
@@ -240,6 +256,11 @@ proc restore_ld_library_path_env_vars { } {
} elseif [info exists env(DYLD_LIBRARY_PATH)] {
unsetenv DYLD_LIBRARY_PATH
}
+ if { $orig_path_saved } {
+ setenv PATH "$orig_path"
+ } elseif [info exists env(PATH)] {
+ unsetenv PATH
+ }
}
#######################################
--
1.7.9