Re: [PATCH] [cygwin|mingw] fix dlpreopen with --disable-static take 3

2009-01-19 Thread Ralf Wildenhues
Hi Charles,

* Charles Wilson wrote on Fri, Jan 16, 2009 at 02:51:21PM CET:
 The unexpected failure was
  36: execute mode FAILED (execute-mode.at:193)
 but it is unrelated; it's a problem in cygwin-1.7's dos-style path
 detection...That's not a path!
 
 --- /dev/null   2006-11-30 19:00:00.0 -0500
 +++
 /usr/src/packages/libtool/git/build-cygwin-dlpreopen-fix-take2/tests/testsui
 te.dir/at-groups/36/stderr  2009-01-15 23:50:30.98180 -0500
 @@ -0,0 +1,6 @@
 +cygwin warning:
 +  MS-DOS style path detected: d\e
 +  Preferred POSIX equivalent is: d/e
 +  CYGWIN environment variable option nodosfilewarning turns off this
 warning.
 +  Consult the user's guide for more details about POSIX paths:
 +http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
 stdout:
 abc
 d\e
 f\g
 xyz
 36. execute-mode.at:25: 36. execute mode (execute-mode.at:25): FAILED 
 (execute-mode.at:193)

Thanks.  Applying this to avoid this failure.

Cheers,
Ralf

Avoid failure due to Cygwin path detection bug.
* tests/execute-mode.at (execute mode): Ignore noise on stderr;
Cygwin might consider `d\e' to be a DOS-style path and warn.
Report by Charles Wilson.

diff --git a/tests/execute-mode.at b/tests/execute-mode.at
index c3370da..a73cada 100644
--- a/tests/execute-mode.at
+++ b/tests/execute-mode.at
@@ -1,6 +1,6 @@
 # execute-mode.at -- libtool --mode=execute -*- Autotest -*-
 #
-#   Copyright (C) 2008 Free Software Foundation, Inc.
+#   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 #   Written by Ralf Wildenhues, 2008
 #
 #   This file is part of GNU Libtool.
@@ -190,7 +190,7 @@ do
   if test -z $arg1; then
 arg1=$arg2; continue
   fi
-  AT_CHECK([$LIBTOOL --mode=execute ./foo abc $arg1 $arg2 xyz], [], 
[stdout])
+  AT_CHECK([$LIBTOOL --mode=execute ./foo abc $arg1 $arg2 xyz], [], 
[stdout], [ignore])
   AT_CHECK([$FGREP $arg1 stdout], [], [ignore])
   AT_CHECK([$FGREP $arg2 stdout], [], [ignore])
   AT_CHECK([test `sed -n '/^abc$/,/^xyz$/p' stdout | wc -l` -eq 4])




Re: [PATCH] [cygwin|mingw] fix dlpreopen with --disable-static take 3

2009-01-16 Thread Charles Wilson
Charles Wilson wrote:

 Full test suite on cygwin in progress. Assuming it passes,
 ok for squash and push?

Results: old test suite:
===
All 113 tests passed
(11 tests were not run)
===

New test suite:
ERROR: 76 tests were run,
4 failed (3 expected failures).
5 tests were skipped.

The unexpected failure was
 36: execute mode FAILED (execute-mode.at:193)
but it is unrelated; it's a problem in cygwin-1.7's dos-style path
detection...That's not a path!

--- /dev/null   2006-11-30 19:00:00.0 -0500
+++
/usr/src/packages/libtool/git/build-cygwin-dlpreopen-fix-take2/tests/testsui
te.dir/at-groups/36/stderr  2009-01-15 23:50:30.98180 -0500
@@ -0,0 +1,6 @@
+cygwin warning:
+  MS-DOS style path detected: d\e
+  Preferred POSIX equivalent is: d/e
+  CYGWIN environment variable option nodosfilewarning turns off this
warning.
+  Consult the user's guide for more details about POSIX paths:
+http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
stdout:
abc
d\e
f\g
xyz
36. execute-mode.at:25: 36. execute mode (execute-mode.at:25): FAILED
(execute-m
ode.at:193)

OK?

--
Chuck




[PATCH] [cygwin|mingw] fix dlpreopen with --disable-static take 3

2009-01-15 Thread Charles Wilson
* 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