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

2009-02-13 Thread Charles Wilson
Charles Wilson wrote:

 The attached, re-re-re-re-revised patch addresses these two issues, but
 is otherwise the same as take 4. 

Ping.
Most recent version is the take 5 attachment, in this message from two
weeks ago:
http://lists.gnu.org/archive/html/libtool-patches/2009-01/msg00232.html

ChangeLog repeated (with slight revisions) for convenience:

* libltdl/config/general.m4sh: Update copyright year.
(func_tr_sh): New function.
* libltdl/config/ltmain.m4sh (func_generate_dlsyms) [cygwin|mingw]:
Obtain DLL name corresponding to import library by using value
stored in unique variable libfile_$(transliterated implib name).
If that fails, use $sharedlib_from_linklib_cmd to extract DLL
name from import library directly. Also, properly extract dlsyms
from the import library.
(func_mode_link) [cygwin|mingw]: Prefer to dlpreopen DLLs
over static libs when both are available.  When dlpreopening
DLLs, use linklib (that is, import lib) as dlpreopen file,
rather than DLL. Store name of associated la file in
unique variable libfile_$(transliterated implib name)
for later use.
(func_win32_libid): Accomodate pei-i386 import libs
as well as pe-i386.
(func_cygming_dll_for_implib): New function.
(func_cygming_dll_for_implib_fallback): New function.
(func_cygming_dll_for_implib_fallback_core): New function.
(func_cygming_gnu_implib_p): New function.
(func_cygming_ms_implib_p): New function.
* libltdl/m4/libtool.m4 (_LT_CMD_GLOBAL_SYMBOLS): Adjust sed
expressions for lt_cv_sys_global_symbol_to_c_name_address and
lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
as trailing space after module name is optional.
(_LT_LINKER_SHLIBS) [cygwin|mingw][C++]:
Set exclude_expsyms correctly for $host. Simplify regular
expression in export_symbols_cmds.
(_LT_LINKER_SHLIBS) [cygwin|mingw|pw32][C]: Set exclude_expsyms
correctly for $host. Enable export_symbols_cmds to identify
DATA exports by _nm_ prefix.
(_LT_CHECK_SHAREDLIB_FROM_LINKLIB): New macro sets
sharedlib_from_linklib_cmd variable.
(_LT_DECL_DLLTOOL): New macro ensures DLLTOOL is always set.

--
Chuck




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

2009-01-21 Thread Charles Wilson
* libltdl/config/general.m4sh: Update copyright year.
(func_tr_sh): New function.
* libltdl/config/ltmain.m4sh (func_generate_dlsyms) [cygwin|mingw]:
Obtain DLL name corresponding to import library by using value
stored in unique variable libfile_$(transliterated implib name).
If that fails, use $sharedlib_from_linklib_cmd to extract DLL
name from import library directly. Also, properly extract dlsyms
from the import library.
(func_mode_link) [cygwin|mingw]: Prefer to dlpreopen DLLs
over static libs when both are available.  When dlpreopening
DLLs, use linklib (that is, import lib) as dlpreopen file,
rather than DLL. Store name of associated la file in
unique variable libfile_$(transliterated implib name)
for later use.
(func_win32_libid): Accomodate pei-i386 import libs
as well as pe-i386.
(func_cygming_dll_for_implib): New function.
(func_cygming_dll_for_implib_fallback): New function.
(func_cygming_dll_for_implib_core): New function.
(func_cygming_implib_p): New function.
(func_cygming_ms_implib_p): New function.
* libltdl/m4/libtool.m4 (_LT_CMD_GLOBAL_SYMBOLS): Adjust sed
expressions for lt_cv_sys_global_symbol_to_c_name_address and
lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
as trailing space after module name is optional.
(_LT_LINKER_SHLIBS) [cygwin|mingw][C++]:
Set exclude_expsyms correctly for $host. Simplify regular
expression in export_symbols_cmds.
(_LT_LINKER_SHLIBS) [cygwin|mingw|pw32][C]: Set exclude_expsyms
correctly for $host. Enable export_symbols_cmds to identify
DATA exports by _nm_ prefix.
(_LT_CHECK_SHAREDLIB_FROM_LINKLIB): New macro sets
sharedlib_from_linklib_cmd variable.
(_LT_DECL_DLLTOOL): New macro ensures DLLTOOL is always set.
---
This updated patch represents the promised combination of take 2
http://lists.gnu.org/archive/html/libtool-patches/2009-01/msg2.html
and take 3
http://lists.gnu.org/archive/html/libtool-patches/2009-01/msg00056.html
for easier reviewing, along with a minor change to func_tr_sh similar
to that suggested by Ralf W, and rebased to current master.

Test suite on cygwin/native in progress. Assumming test suite passes, OK?
Comments, Review, Discussion?


 libltdl/config/general.m4sh |   19 -
 libltdl/config/ltmain.m4sh  |  226 +++
 libltdl/m4/libtool.m4   |   62 +++-
 3 files changed, 282 insertions(+), 25 deletions(-)

diff --git a/libltdl/config/general.m4sh b/libltdl/config/general.m4sh
index 4bc304c..e839070 100644
--- a/libltdl/config/general.m4sh
+++ b/libltdl/config/general.m4sh
@@ -1,6 +1,6 @@
 m4_if([general.m4sh -- general shell script boiler plate -*- Autoconf -*-
 
-   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
Written by Gary V. Vaughan, 2004
 
This file is part of GNU Cvs-utils.
@@ -412,5 +412,22 @@ func_show_eval_locale ()
   fi
 fi
 }
+
+# func_tr_sh
+# Turn $1 into a string suitable for a shell variable name.
+# Result is stored in $func_tr_sh_result.  All characters
+# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
+# if $1 begins with a digit, a '_' is prepended as well.
+func_tr_sh ()
+{
+  case $1 in
+  [0-9]* | *[!a-zA-Z0-9_]*)
+func_tr_sh_result=`$ECHO $1 | $SED 's/^\([0-9]\)/_\1/; 
s/[^a-zA-Z0-9_]/_/g'`
+;;
+  * )
+func_tr_sh_result=$1
+;;
+  esac
+}
 ]])
 
diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 760f647..984abd2 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -2000,10 +2000,49 @@ extern \C\ {
  func_verbose extracting global C symbols from \`$dlprefile'
  func_basename $dlprefile
  name=$func_basename_result
- $opt_dry_run || {
-   eval '$ECHO : $name   $nlist'
-   eval $NM $dlprefile 2/dev/null | $global_symbol_pipe  '$nlist'
- }
+  case $host in
+   *cygwin* | *mingw* | *cegcc* )
+ # if an import library, we need to obtain dlname
+ if func_win32_import_lib_p $dlprefile; then
+   func_tr_sh $dlprefile
+   eval curr_lafile=\$libfile_$func_tr_sh_result
+   dlprefile_dlbasename=
+   if test -n $curr_lafile  func_lalib_p $curr_lafile; then
+ # Use subshell, to avoid clobbering current variable values
+ dlprefile_dlname=`source $curr_lafile  echo $dlname`
+ if test -n $dlprefile_dlname ; then
+   func_basename $dlprefile_dlname
+   dlprefile_dlbasename=$func_basename_result
+ else
+   # no lafile. user explicitly requested -dlpreopen import 
library.
+   eval '$sharedlib_from_linklib $dlprefile'
+   dlprefile_dlbasename=$sharedlib_from_linklib_result
+ fi
+   fi
+   $opt_dry_run || {
+ if test -n $dlprefile_dlbasename ; then

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

2009-01-21 Thread Charles Wilson
Charles Wilson wrote:
 Test suite on cygwin/native in progress. Assumming test suite passes, OK?
 Comments, Review, Discussion?

All tests pass (cygwin/native):

Old suite:
===
All 113 tests passed
(11 tests were not run)
===

New suite:
76 tests behaved as expected.
5 tests were skipped.

--
Chuck





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

2009-01-21 Thread Charles Wilson
Charles Wilson wrote:
Reviewing my own submission...
 (func_cygming_dll_for_implib_core): New function.

This function is actually called
func_cygming_dll_for_implib_fallback_core
Need to correct log history.

 (func_cygming_implib_p): New function.

Confusing. There is already a func_win32_implib_p which is less specific
(returns true when [effectively]
  func_cygming_implib_p || func_cygming_ms_implib_p || (any other kind
of implib)
This one should be called func_cygming_gnu_implib_p as a parallel with
the _cygming_ms_ one.

--
Chuck