libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MSVC: Add MSVC support.


From: Ralf Wildenhues
Subject: Re: MSVC: Add MSVC support.
Date: Wed, 23 Jun 2010 20:29:50 +0200
User-agent: Mutt/1.5.20 (2010-04-22)

* 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  <address@hidden>
> +
> +     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 2>&1 -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 2>&1 -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)=' '
> +     _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
> +     _LT_TAGVAR(always_export_symbols, $1)=yes
> +     _LT_TAGVAR(file_list_spec, $1)='@'
> +     # Tell ltmain to make .lib files, not .a files.
> +     libext=lib
> +     # Tell ltmain to make .dll files, not .so files.
> +     shrext_cmds=".dll"
> +     # FIXME: Setting linknames here is a bad hack.
> +     _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs 
> $compiler_flags $deplibs -Wl,-dll~linknames='
> +     _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q 
> $export_symbols`" = xEXPORTS; then
> +         sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e 
> '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
> +       else
> +         sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < 
> $export_symbols > $output_objdir/$soname.exp;
> +       fi~
> +       $CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs 
> @$output_objdir/$soname.exp -Wl,-DLL~
> +       linknames='
> +     # The linker will not automatically build a static lib if we build a 
> DLL.
> +     # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
> +     _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
> +     _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | 
> $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ 
> ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | 
> uniq > $export_symbols'
> +     # Don't use ranlib
> +     _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
> +     ;;
> +      *)
> +     # Assume MSVC wrapper
>        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
>        _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
>        # Tell ltmain to make .lib files, not .a files.
> @@ -4812,6 +4876,8 @@ _LT_EOF
>        _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
>        _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
>        ;;
> +      esac
> +      ;;
>  
>      darwin* | rhapsody*)
>        _LT_DARWIN_LINKER_FEATURES($1)
> @@ -5741,6 +5807,36 @@ if test "$_lt_caught_CXX_error" != yes; then
>          ;;
>  
>        cygwin* | mingw* | pw32* | cegcc*)
> +     case $GXX,$cc_basename in
> +     ,cl* | no,cl*)

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++.

> +       # Native MSVC
> +       # hardcode_libdir_flag_spec is actually meaningless, as there is
> +       # no search path for DLLs.
> +       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
> +       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
> +       _LT_TAGVAR(always_export_symbols, $1)=yes
> +       _LT_TAGVAR(file_list_spec, $1)='@'
> +       # Tell ltmain to make .lib files, not .a files.
> +       libext=lib
> +       # Tell ltmain to make .dll files, not .so files.
> +       shrext_cmds=".dll"
> +       # FIXME: Setting linknames here is a bad hack.
> +       _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs 
> $compiler_flags $deplibs -Wl,-dll~linknames='
> +       _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q 
> $export_symbols`" = xEXPORTS; then
> +           $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e 
> '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
> +         else
> +           $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < 
> $export_symbols > $output_objdir/$soname.exp;
> +         fi~
> +         $CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs 
> @$output_objdir/$soname.exp -Wl,-DLL~
> +         linknames='
> +       # The linker will not automatically build a static lib if we build a 
> DLL.
> +       # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
> +       _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
> +       # Don't use ranlib
> +       _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
> +       ;;
> +     *)
> +       # g++
>          # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
>          # as there is no search path for DLLs.
>          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'

Cheers,
Ralf



reply via email to

[Prev in Thread] Current Thread [Next in Thread]