* libltdl/config/ltmain.m4sh (func_emit_cwrapperexe_src:main): Call lt_update_exe_path before lt_update_lib_path, to ensure that the temporary rpath values (which include the OBJDIRs of uninstalled libtool libraries) precede installation and final -rpath directories. (func_emit_wrapper): Prepend $dllsearchpath to PATH before prepending $temp_rpath to $shlibpath_var; similar rationale as above. Reported by Jon Turney <jon.tur...@dronecode.org.uk> --- As promised here: http://lists.gnu.org/archive/html/libtool-patches/2010-09/msg00191.html
Tested on cygwin; no regressions: old: All 122 tests passed (2 tests were not run) new: 111 tests behaved as expected. 9 tests were skipped. OK to push? libltdl/config/ltmain.m4sh | 31 ++++++++++++++++++++++--------- 1 files changed, 22 insertions(+), 9 deletions(-) diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 7bbca85..2371a14 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -3293,6 +3293,22 @@ func_exec_program () if test -f \"\$progdir/\$program\"; then" + # fixup the dll searchpath if we need to. + # + # For Windows, this must occur prior to any manipulation of + # $shlibpath (which, ON Windows, is PATH). That way, we ensure + # that the $dllsearchpath value is prepended to $PATH first, and + # that the temporary rpath values (which contain the actual + # location of uninstalled DLLs, in their respective OBJDIR + # directories) are prepended second. This ensures that just-built + # uninstalled libraries supersede installed ones. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ @@ -3307,14 +3323,6 @@ func_exec_program () " fi - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $ECHO "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. @@ -3703,8 +3711,13 @@ EOF lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ lt_setenv ("DUALCASE", "1"); /* for MSK sh */ - lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); + /* For Windows, this order is important: it ensures that the $dllsearchpath + value is prepended first, and that the temporary rpath values (which + contain the actual location of uninstalled DLLs, in their respective + OBJDIR directories) are prepended second. This ensures that just-built + uninstalled libraries supersede installed ones. */ lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); + lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", nonnull (lt_argv_zero)); -- 1.7.1