* libltdl/config/ltmain.m4sh (func_mode_link): When prefer_static_libs, ensure old_library name is used as linklib when possible. --- This patch corrects the (long-standing?) failure of mdemo-exec.test on mingw, but also some non-fatal anomalies in cygwin on the same tests. Basically, when dlopen'ing static libraries, but when both shared and static libs exist, the extracted symbol names put into the lt__PROGRAM__LTX_preloaded_symbols array were mistakenly extracted from the import library instead of the static one. For PE/COFF, this makes a difference; and on mingw that difference caused the mdemo_static test to fail.
Test results: cygwin ------ old test suite: All 122 tests passed (2 tests were not run) new test suite: 111 tests behaved as expected. 9 tests were skipped. mingw ----- old test suite: All 122 tests passed (2 tests were not run) new test suite: 108 tests behaved as expected. 12 tests were skipped. OK to push? -- Chuck libltdl/config/ltmain.m4sh | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index d8e0fe1..6ae2e43 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -5650,9 +5650,15 @@ func_mode_link () # Get the name of the library we link against. linklib= - for l in $old_library $library_names; do - linklib="$l" - done + if test -n "$old_library" && + { test "$prefer_static_libs" = yes || + test "$prefer_static_libs,$installed" = "built,no"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib="$l" + done + fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi -- 1.7.1