Hi! This is "For MSVC, embed the manifest as a resource in the executable." 9f550cb81d4dfe4fc8962f23a7eccb1152e5c4a5
and the relevant part of "patch msvc-documentation.patch" 06cfce005204bb8ca212aadab38b38c0202ea04e with @var changed to @code This patch depends on the just posted "Add MSVC support." patch. This patch was originally proposed here: http://lists.gnu.org/archive/html/libtool-patches/2008-08/msg00018.html And okeyed for the pr-msvc-support branch by Ralf here: http://lists.gnu.org/archive/html/libtool-patches/2008-08/msg00031.html I'm intend to reply to this message with testsuite results for the "Add MSVC support" patch plus this patch for various systems. Cheers, Peter
commit d742f2543f4d04cabe53f9b37822cdd535441d76 Author: Peter Rosin <peda@lysator.liu.se> Date: Wed Jun 23 14:14:05 2010 +0200 For MSVC, embed the manifest as a resource in the executable. * libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS) <postlink_cmds>: New tag variable. [ cygwin, mingw, cegcc ] <cl*>: Embed the manifest file as a resource. (_LT_LANG_CXX_CONFIG): Likewise. * libltdl/config/ltmain.m4sh (func_mode_link): After linking a program, replace @OUTPUT@ in $postlink_cmds and then execute the commands. * doc/libtool.texi (libtool script contents): Document new variable. Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de> diff --git a/ChangeLog b/ChangeLog index 1e2404e..1ee1b81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2010-06-23 Peter Rosin <peda@lysator.liu.se> + For MSVC, embed the manifest as a resource in the executable. + * libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS) <postlink_cmds>: + New tag variable. + [ cygwin, mingw, cegcc ] <cl*>: Embed the manifest file as a + resource. + (_LT_LANG_CXX_CONFIG): Likewise. + * libltdl/config/ltmain.m4sh (func_mode_link): After linking + a program, replace @OUTPUT@ in $postlink_cmds and then execute + the commands. + * doc/libtool.texi (libtool script contents): Document + new variable. + +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. diff --git a/doc/libtool.texi b/doc/libtool.texi index 7ae2c66..82a544e 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -6199,6 +6199,15 @@ Commands run after installing a shared or static library, respectively. Commands run after uninstalling a shared or static library, respectively. @end defvar +@defvar postlink_cmds +Commands necessary for finishing linking programs. @code{postlink_cmds} +are executed immediately after the program is linked. Any occurance of +the string @code{@@OUTPUT@@} in @code{postlink_cmds} is replaced by the +name of the created executable (i.e. not the wrapper, if a wrapper is +generated) prior to execution. Normally disabled (i.e. +@code{postlink_cmds} empty). +@end defvar + @defvar reload_cmds @defvarx reload_flag Commands to create a reloadable object. diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index a325e27..9618074 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -7448,6 +7448,11 @@ EOF exit_status=0 func_show_eval "$link_command" 'exit_status=$?' + if test -n "$postlink_cmds"; then + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' @@ -7493,6 +7498,12 @@ EOF $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + exit $EXIT_SUCCESS fi @@ -7526,6 +7537,11 @@ EOF func_show_eval "$link_command" 'exit $?' + if test -n "$postlink_cmds"; then + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + # Now create the wrapper script. func_verbose "creating $output" diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index f11a2d2..a0c723c 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -4858,6 +4858,10 @@ _LT_EOF _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' + _LT_TAGVAR(postlink_cmds, $1)='if test -e "@OUTPUT@.exe.manifest"; then + mt -manifest "@OUTPUT@.exe.manifest" -outputresource:"@OUTPUT@.exe"; + $RM "@OUTPUT@.exe.manifest"; + fi' ;; *) # Assume MSVC wrapper @@ -5411,6 +5415,8 @@ _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [postlink_cmds], [2], + [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented @@ -5834,6 +5840,10 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='if test -e "@OUTPUT@.exe.manifest"; then + mt -manifest "@OUTPUT@.exe.manifest" -outputresource:"@OUTPUT@.exe"; + $RM "@OUTPUT@.exe.manifest"; + fi' ;; *) # g++