Re: MSVC: Add MSVC support.

2010-07-01 Thread Peter Rosin

Hi!


This is what I'm intending to push when the 72 hours have passed for
the updated patch I'm about to send in the other thread, i.e.
MSVC: For MSVC, embed the manifest as a resource in the executable.


Both patches pushed.

Cheers,
Peter



Re: MSVC: Add MSVC support.

2010-06-28 Thread Peter Rosin

Hi Ralf,

Thanks for the review!

Den 2010-06-24 06:51 skrev Ralf Wildenhues:

How about this:

* Changes in supported systems or compilers:
   - Initial support for the Microsoft C/C++ Compiler with help from
 (proposed changes to) the compile script in Automake.

And then fiddle the NEWS entry to specify the needed Automake version
when one is known?


How about for unreleased Automake 1.12, that should be safe.


This is what I'm intending to push when the 72 hours have passed for
the updated patch I'm about to send in the other thread, i.e.
MSVC: For MSVC, embed the manifest as a resource in the executable.

I'm only posting this here, since that patch depends on this one
and I don't want to push that patch until this patch is pushable.

I.e. this is just FYI.

Cheers,
Peter
commit 570e58da9c2fce4a93b097dc33f9578b5871837e
Author: Peter Rosin peda@lysator.liu.se
Date:   Thu Jun 24 07:28:16 2010 +0200

Add MSVC support.

* libltdl/m4/libtool.m4 (_LT_SYS_DYNAMIC_LINKER)
(_LT_LINKER_SHLIBS, _LT_LANG_CXX_CONFIG) [mingw, cygwin]: Add
support for the Microsoft C/C++ Compiler (cl) relying on help
from the compile script in Automake.
* NEWS: Add note of the above.

diff --git a/ChangeLog b/ChangeLog
index e939f43..12e9168 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-06-24  Peter Rosin  peda@lysator.liu.se
+
+	Add MSVC support.
+	* libltdl/m4/libtool.m4 (_LT_SYS_DYNAMIC_LINKER)
+	(_LT_LINKER_SHLIBS, _LT_LANG_CXX_CONFIG) [mingw, cygwin]: Add
+	support for the Microsoft C/C++ Compiler (cl) relying on help
+	from the compile script in Automake.
+	* NEWS: Add note of the above.
+
 2010-06-28  Gary V. Vaughan  gary@gnu.org
 
 	Add func_append_quoted and do inline func_append substitutions.
diff --git a/NEWS b/NEWS
index 33531dc..5735b01 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,10 @@ New in 2.2.12 2010-08-??: git version 2.2.11a, Libtool team:
   - On non-cygwin Windows systems, we now lookup potential library
 file names without regard to file name case.
 
+* Changes in supported systems or compilers:
+  - Initial support for the Microsoft C/C++ Compiler, with help from
+the compile script in unreleased Automake 1.12.
+
 New in 2.2.10 2010-06-10: git version 2.2.9a, Libtool team:
 
 * New features:
diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index 01a9c41..18eedb3 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -2198,8 +2198,9 @@ cygwin* | mingw* | pw32* | cegcc*)
   need_version=no
   need_lib_prefix=no
 
-  case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+  case $GCC,$cc_basename in
+  yes,*)
+# gcc
 library_names_spec='$libname.dll.a'
 # DLL is installed to $(libdir)/../bin by postinstall_cmds
 postinstall_cmds='base_file=`basename \${file}`~
@@ -2232,13 +2233,42 @@ m4_if([$1], [],[
   library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
   ;;
 esac
+dynamic_linker='Win32 ld.exe'
+;;
+
+  *,cl*)
+# Native MSVC
+libname_spec='$name'
+soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}.lib'
+sys_lib_search_path_spec=$LIB
+if $ECHO $sys_lib_search_path_spec | [$GREP ';[c-zC-Z]:/' /dev/null]; then
+  # It is most probably a Windows format PATH.
+  sys_lib_search_path_spec=`$ECHO $sys_lib_search_path_spec | $SED -e 's/;/ /g'`
+else
+  sys_lib_search_path_spec=`$ECHO $sys_lib_search_path_spec | $SED -e s/$PATH_SEPARATOR/ /g`
+fi
+# FIXME: find the short name or the path components, as spaces are
+# common. (e.g. Program Files - PROGRA~1)
+# DLL is installed to $(libdir)/../bin by postinstall_cmds
+postinstall_cmds='base_file=`basename \${file}`~
+  dlpath=`$SHELL 21 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+  dldir=$destdir/`dirname \$dlpath`~
+  test -d \$dldir || mkdir -p \$dldir~
+  $install_prog $dir/$dlname \$dldir/$dlname'
+postuninstall_cmds='dldll=`$SHELL 21 -c '\''. $file; echo \$dlname'\''`~
+  dlpath=$dir/\$dldll~
+   $RM \$dlpath'
+shlibpath_overrides_runpath=yes
+dynamic_linker='Win32 link.exe'
 ;;
 
   *)
+# Assume MSVC wrapper
 library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+dynamic_linker='Win32 ld.exe'
 ;;
   esac
-  dynamic_linker='Win32 ld.exe'
   # FIXME: first we should search . and the directory the executable is in
   shlibpath_var=PATH
   ;;
@@ -4248,13 +4278,18 @@ m4_if([$1], [CXX], [
 ;;
   pw32*)
 _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds
-  ;;
+;;
   cygwin* | mingw* | cegcc*)
-_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ 

MSVC: Add MSVC support.

2010-06-23 Thread Peter Rosin

Hi!

This is basically
Add MSVC support.
9c848f1e8acdf435d019aa80f3f0b0aeb45613f7

but with some things removed, which makes it depend on
the proposed changes to the compile script in automake.

This patch should be a NOP unless you are using the
Microsoft C/C++ Compiler (aka MSVC, aka cl) and are
on a windows $host.

Since it changes the indentation of some other code
I'm attaching a diff -b (msvc-b.diff) as well as the
exported change from git (msvc.patch).

There are many failures in the testsuite with MSVC
with this patch, at least for MSVC 2005 which is the
compiler I'm using by default, due to problems with
manifests. See below. So I'm not publishing any
testsuite results this time, they are too just
disappointing. Please hold.

For this patch I'm looking for an ok to commit, but
I'm going to hold the actual commit until I have done
a couple of more things:

* I have a similar ok for one more patch (.manifest
  related, 9f550cb81d4dfe4fc8962f23a7eccb1152e5c4a5)
* I have run the testsuite on Cygwin, MinGW/gcc and
  MinGW/msvc and verified that there are no regressions.
* maybe (if you think I should) wait for the proposed
  compile script to be commited to automake.

Cheers,
Peter
commit bc206b38ba3a10d106e84acd1a4eb4ba31bfe101
Author: Peter Rosin peda@lysator.liu.se
Date:   Wed Jun 23 10:52:58 2010 +0200

Add MSVC support.

* libltdl/m4/libtool.m4: Add support for Microsoft Visual C.
* NEWS: Add note of the above.

diff --git a/ChangeLog b/ChangeLog
index 18e346d..1e2404e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-06-23  Peter Rosin  peda@lysator.liu.se
+
+	Add MSVC support.
+	* libltdl/m4/libtool.m4: Add support for Microsoft Visual C.
+	* NEWS: Add note of the above.
+
 2010-06-21  Gary V. Vaughan  gary@gnu.org
 
 	Ensure getopts.m4sh is compatible with Autoconf-2.61 and newer.
diff --git a/NEWS b/NEWS
index 33531dc..b25f096 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,9 @@ New in 2.2.12 2010-08-??: git version 2.2.11a, Libtool team:
   - On non-cygwin Windows systems, we now lookup potential library
 file names without regard to file name case.
 
+* Changes in supported systems or compilers:
+  - Initial support for the Microsoft C/C++ Compiler w/o cccl.
+
 New in 2.2.10 2010-06-10: git version 2.2.9a, Libtool team:
 
 * New features:
diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index b93dd0c..f11a2d2 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -2201,8 +2201,9 @@ cygwin* | mingw* | pw32* | cegcc*)
   need_version=no
   need_lib_prefix=no
 
-  case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+  case $GCC,$cc_basename in
+  yes,* | yes,* | yes,*)
+# gcc
 library_names_spec='$libname.dll.a'
 # DLL is installed to $(libdir)/../bin by postinstall_cmds
 postinstall_cmds='base_file=`basename \${file}`~
@@ -2235,13 +2236,42 @@ m4_if([$1], [],[
   library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
   ;;
 esac
+dynamic_linker='Win32 ld.exe'
+;;
+
+  *,cl*)
+# Native MSVC
+libname_spec='$name'
+soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}.lib'
+sys_lib_search_path_spec=$LIB
+if $ECHO $sys_lib_search_path_spec | [$GREP ';[c-zC-Z]:/' /dev/null]; then
+  # It is most probably a Windows format PATH.
+  sys_lib_search_path_spec=`$ECHO $sys_lib_search_path_spec | $SED -e 's/;/ /g'`
+else
+  sys_lib_search_path_spec=`$ECHO $sys_lib_search_path_spec | $SED -e s/$PATH_SEPARATOR/ /g`
+fi
+# FIXME: find the short name or the path components, as spaces are
+# common. (e.g. Program Files - PROGRA~1)
+# DLL is installed to $(libdir)/../bin by postinstall_cmds
+postinstall_cmds='base_file=`basename \${file}`~
+  dlpath=`$SHELL 21 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+  dldir=$destdir/`dirname \$dlpath`~
+  test -d \$dldir || mkdir -p \$dldir~
+  $install_prog $dir/$dlname \$dldir/$dlname'
+postuninstall_cmds='dldll=`$SHELL 21 -c '\''. $file; echo \$dlname'\''`~
+  dlpath=$dir/\$dldll~
+   $RM \$dlpath'
+shlibpath_overrides_runpath=yes
+dynamic_linker='Win32 link.exe'
 ;;
 
   *)
+# Assume MSVC wrapper
 library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+dynamic_linker='Win32 ld.exe'
 ;;
   esac
-  dynamic_linker='Win32 ld.exe'
   # FIXME: first we should search . and the directory the executable is in
   shlibpath_var=PATH
   ;;
@@ -4251,13 +4281,18 @@ m4_if([$1], [CXX], [
 ;;
   pw32*)
 _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds
-  ;;
+;;
   cygwin* | mingw* | cegcc*)
-_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e 

Re: MSVC: Add MSVC support.

2010-06-23 Thread Ralf Wildenhues
* Peter Rosin wrote on Wed, Jun 23, 2010 at 04:26:22PM CEST:
 For this patch I'm looking for an ok to commit, but
 I'm going to hold the actual commit until I have done
 a couple of more things:
 
 * I have a similar ok for one more patch (.manifest
   related, 9f550cb81d4dfe4fc8962f23a7eccb1152e5c4a5)
 * I have run the testsuite on Cygwin, MinGW/gcc and
   MinGW/msvc and verified that there are no regressions.

You have my OK to commit this patch, provided that you do the above
testing, address the nits below, and wait 72h for other comments.
Thanks.

 * maybe (if you think I should) wait for the proposed
   compile script to be commited to automake.

Not for me.  If you want this available somewhere then I suggest you put
Automake plus your proposed patches up on a github somewhere until the
copyright assignment is done, which might easily take weeks.  Please
make it clear in the .git/description that it is not an official tree.

 +2010-06-23  Peter Rosin  p...@lysator.liu.se
 +
 + Add MSVC support.
 + * libltdl/m4/libtool.m4: Add support for Microsoft Visual C.
 + * NEWS: Add note of the above.

Please rewrite this ChangeLog entry to be a good one, mentioning the
macros you change, the systems, compilers affected, in the format
used otherwise in the ChangeLog.

 --- a/NEWS
 +++ b/NEWS
 @@ -7,6 +7,9 @@ New in 2.2.12 2010-08-??: git version 2.2.11a, Libtool team:
- On non-cygwin Windows systems, we now lookup potential library
  file names without regard to file name case.
  
 +* Changes in supported systems or compilers:
 +  - Initial support for the Microsoft C/C++ Compiler w/o cccl.

Please no abbreviations like w/o here, this is text for the user.  Also,
the 'compile' script is needed now, no?

 --- a/libltdl/m4/libtool.m4
 +++ b/libltdl/m4/libtool.m4
 @@ -2201,8 +2201,9 @@ cygwin* | mingw* | pw32* | cegcc*)
need_version=no
need_lib_prefix=no
  
 -  case $GCC,$host_os in
 -  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
 +  case $GCC,$cc_basename in
 +  yes,* | yes,* | yes,*)

`X | X | X' is equivalent to `X'.

 @@ -2235,13 +2236,42 @@ m4_if([$1], [],[
library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo 
 ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
;;
  esac
 +dynamic_linker='Win32 ld.exe'
 +;;
 +
 +  *,cl*)
 +# Native MSVC
 +libname_spec='$name'
 +soname_spec='${libname}`echo ${release} | $SED -e 
 's/[[.]]/-/g'`${versuffix}${shared_ext}'
 +library_names_spec='${libname}`echo ${release} | $SED -e 
 's/[[.]]/-/g'`${versuffix}.lib'
 +sys_lib_search_path_spec=$LIB
 +if $ECHO $sys_lib_search_path_spec | [$GREP ';[c-zC-Z]:/' /dev/null]; 
 then
 +  # It is most probably a Windows format PATH.
 +  sys_lib_search_path_spec=`$ECHO $sys_lib_search_path_spec | $SED -e 
 's/;/ /g'`
 +else
 +  sys_lib_search_path_spec=`$ECHO $sys_lib_search_path_spec | $SED -e 
 s/$PATH_SEPARATOR/ /g`
 +fi
 +# FIXME: find the short name or the path components, as spaces are
 +# common. (e.g. Program Files - PROGRA~1)
 +# DLL is installed to $(libdir)/../bin by postinstall_cmds
 +postinstall_cmds='base_file=`basename \${file}`~
 +  dlpath=`$SHELL 21 -c '\''. $dir/'\''\${base_file}'\''i; echo 
 \$dlname'\''`~
 +  dldir=$destdir/`dirname \$dlpath`~
 +  test -d \$dldir || mkdir -p \$dldir~
 +  $install_prog $dir/$dlname \$dldir/$dlname'
 +postuninstall_cmds='dldll=`$SHELL 21 -c '\''. $file; echo 
 \$dlname'\''`~
 +  dlpath=$dir/\$dldll~
 +   $RM \$dlpath'
 +shlibpath_overrides_runpath=yes
 +dynamic_linker='Win32 link.exe'
  ;;
  
*)
 +# Assume MSVC wrapper
  library_names_spec='${libname}`echo ${release} | $SED -e 
 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
 +dynamic_linker='Win32 ld.exe'
  ;;
esac
 -  dynamic_linker='Win32 ld.exe'
# FIXME: first we should search . and the directory the executable is in
shlibpath_var=PATH
;;
 @@ -4253,8 +4283,13 @@ m4_if([$1], [CXX], [
  _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds
;;
cygwin* | mingw* | cegcc*)
 +case $cc_basename in
 +cl*) ;;
 +*)
  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | 
 $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 
 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ 
 ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq  $export_symbols'
;;
 +esac
 +;;
*)
  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | 
 $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq  $export_symbols'
;;
 @@ -4797,6 +4832,35 @@ _LT_EOF
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
 +  case $cc_basename in
 +  cl*)
 + # Native MSVC
 + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
 + 

Re: MSVC: Add MSVC support.

2010-06-23 Thread Peter Rosin

Den 2010-06-23 20:29 skrev Ralf Wildenhues:

* Peter Rosin wrote on Wed, Jun 23, 2010 at 04:26:22PM CEST:

For this patch I'm looking for an ok to commit, but
I'm going to hold the actual commit until I have done
a couple of more things:

* I have a similar ok for one more patch (.manifest
   related, 9f550cb81d4dfe4fc8962f23a7eccb1152e5c4a5)
* I have run the testsuite on Cygwin, MinGW/gcc and
   MinGW/msvc and verified that there are no regressions.


You have my OK to commit this patch, provided that you do the above
testing, address the nits below, and wait 72h for other comments.
Thanks.


Cool!


* maybe (if you think I should) wait for the proposed
   compile script to be commited to automake.


Not for me.  If you want this available somewhere then I suggest you put
Automake plus your proposed patches up on a github somewhere until the
copyright assignment is done, which might easily take weeks.  Please
make it clear in the .git/description that it is not an official tree.


That's not worth it. At least not to me...


+2010-06-23  Peter Rosinp...@lysator.liu.se
+
+   Add MSVC support.
+   * libltdl/m4/libtool.m4: Add support for Microsoft Visual C.
+   * NEWS: Add note of the above.


Please rewrite this ChangeLog entry to be a good one, mentioning the
macros you change, the systems, compilers affected, in the format
used otherwise in the ChangeLog.


Ouch. That was a pretty bad entry indeed. Is this good enough?

2010-06-23  Peter Rosin  p...@lysator.liu.se

Add MSVC support.
* libltdl/m4/libtool.m4 (_LT_SYS_DYNAMIC_LINKER)
(_LT_LINKER_SHLIBS, _LT_LANG_CXX_CONFIG) [mingw, cygwin]: Add
support for the Microsoft C/C++ Compiler (cl) relying on help
from the compile script in Automake.
* NEWS: Add note of the above.



--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,9 @@ New in 2.2.12 2010-08-??: git version 2.2.11a, Libtool team:
- On non-cygwin Windows systems, we now lookup potential library
  file names without regard to file name case.

+* Changes in supported systems or compilers:
+  - Initial support for the Microsoft C/C++ Compiler w/o cccl.


Please no abbreviations like w/o here, this is text for the user.  Also,
the 'compile' script is needed now, no?


How about this:

* Changes in supported systems or compilers:
  - Initial support for the Microsoft C/C++ Compiler with help from
(proposed changes to) the compile script in Automake.

And then fiddle the NEWS entry to specify the needed Automake version
when one is known?


+  yes,* | yes,* | yes,*)


`X | X | X' is equivalent to `X'.


How silly. *fixing*


It strikes me as a bit inconsistent that here, the default case will be
g++, and above, the default case is non-GCC.  I'm not actually sure
which is better, in the presence of other compilers users want to see
supported, but I think we should be consistent in handling between C and
C++.


It's just the way it is. In the C case, there is a big divider between
GNU and non-GNU. For C++ it all jumbled together. Fixing that is out
of scope I presume. The difference is perhaps even more visible by the
fact that the cccl port (if it even deserves to be called a port) is
not C++ aware AFAICT.

Cheers,
Peter