* libltdl/m4/libtool.m4 (_LT_CHECK_SHAREDLIB_FROM_LINKLIB):
New macro sets sharedlib_from_linklib_cmd variable.
(_LT_DECL_DLLTOOL): New macro ensures DLLTOOL is always set.
* libltdl/config/ltmain.m4sh (func_generate_dlsyms): Use
$sharedlib_from_linklib_cmd instead of directly invoking
func_win32_dllname_for_implib when
libfile_$(transliterated implib name) does not exist.
(func_win32_libid): Accomodate pei-i386 import libs
as well as pe-i386.
(func_dlltool_identify): Removed.
(func_win32_dllname_for_implib): Removed. Replaced by...
(func_cygming_dll_for_implib): this,
(func_cygming_dll_for_implib_fallback): this,
(func_cygming_dll_for_implib_core): ...and this.
(func_cygming_implib_p): New function.
(func_cygming_ms_implib_p): New function.
---
This is a follow-on to:
http://lists.gnu.org/archive/html/libtool-patches/2009-01/msg2.html
If the end result of these two patches is acceptable, I'll squash it
before merging to master. But, here's the rationale for the changes
here:
1) Try to make it easier for Peter to add MSVC-specific versions
of this functionality, by invoking the IMPLIB-to-DLL function
via a libtool variable (*)
2) Set that variable during configure
3) While we're at it, even on cygwin/mingw, decide whether to
use dlltool --identify or the nm/objdump-based shell script
fallback also at configure time
4) Since Danny Smith reports that even on mingw, ld can link
against MS-style import libraries, then ensure that both
versions of the IMPLIB-to-DLL function can perform properly
whether the implib is binutils- or ms- style.
a) dlltool (two patches, both already accepted):
http://sourceware.org/ml/binutils/2009-01/msg00120.html
http://sourceware.org/ml/binutils/2009-01/msg00179.html
b) improved sed-fu in func_cygming_dll_for_implib_core
with wrapper func_cygming_dll_for_implib_fallback.
Wrapper determines `style' of the implib, and invokes
the *_core() function with the appropriate arguments.
(*) Peter could implement two functions for msvc, as well: one
that directly invokes the new dllname application, and the other
which uses different, msvc-specific sed-fu on the output of
$NM (which in this case is actually `dumpbin --symbols'?). Then
in _LT_CHECK_SHAREDLIB_FROM_LINKLIB the determination could be
make as to which one to use, when $host is mingw and $CC is msvc.
Of course, if dllname does not become an official part of msys,
then Peter's additions to _LT_CHECK_SHAREDLIB_FROM_LINKLIB
would just set $sharedlib_from_linklib_cmd to the function
containing the msvc-sed-fu.
Limitation: although I have beat this sed-fu to death *outside*
of libtool, and am pretty confident it works well, there is no
actual test of that code in the testsuite. This is because well-
behaved libtool clients -- and our tests are actually well-behaved
in this regard -- will only -dlpreopen *libtool*-built libraries.
In that case, Ralf's suggested libfile_$(transliterated implib name)
is used, because we have the .la file available which allows that
shortcut. The only time we need `dlltool --identify' is when
dlpreopening a non-libtool implib, where we have no .la file.
And the sed-fu is a fallback to THAT fallback.
Also: is there someplace that libtool variables like
$sharedlib_from_linklib_cmd should be documented?
I did run configure and the demo-shared/demo-make/demo-exec tests
with (a) old --identify-less dlltool and (b) new --identify
dlltool. In each case, configure picked the correct function
for $sharedlib_from_linklib_cmd, and those tests passed.
Full test suite on cygwin in progress. Assuming it passes,
ok for squash and push?
Next step: make an actual package out of impgen2/dllname,
upload to mingw/sourceforge, and see if I can't convince Cesar
and Keith that it should be included in the 'base' MSYS for
release 1.0.11.
--
Chuck
libltdl/config/ltmain.m4sh | 200 +---
libltdl/m4/libtool.m4 | 50 +++
2 files changed, 165 insertions(+), 85 deletions(-)
diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 503457c..d701436 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -2016,8 +2016,8 @@ extern \C\ {
dlprefile_dlbasename=$func_basename_result
else
# no lafile. user explicitly requested -dlpreopen import
library.
- func_win32_dllname_for_implib $dlprefile
- dlprefile_dlbasename=$func_win32_dllname_for_implib_result
+ eval '$sharedlib_from_linklib $dlprefile'
+ dlprefile_dlbasename=$sharedlib_from_linklib_result
fi
fi
$opt_dry_run || {
@@ -2217,7 +2217,7 @@ func_win32_libid ()
;;
*ar\ archive*) # could be an import, or static
if eval $OBJDUMP -f $1 | $SED -e '10q' 2/dev/null |
- $EGREP 'file format