[Top][All Lists]

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

Re: [patch #6448] [MSVC 7/7] Add MSVC Support

From: Peter Rosin
Subject: Re: [patch #6448] [MSVC 7/7] Add MSVC Support
Date: Thu, 07 Aug 2008 10:10:29 +0200
User-agent: Thunderbird (Windows/20080708)

Peter Rosin skrev:
Peter Rosin skrev:
Ralf Wildenhues skrev:
* Peter Rosin wrote on Tue, Aug 05, 2008 at 10:38:14AM CEST:
  29:       static linking flags for programs
m-all-static.exe.manifest isn't installed

What does the manifest file do?

The manifest is an XML file that describes how the executable should
be run. In this case it contains a hint where the side-by-side (SxS)
assembly containing the C runtime (msvcrt80.dll) is. The manifest can
also specify if a file should be executed with elevated priviliges (or

I'm no manifest guru, so the above is perhaps not 100% accurate.

Side note, the mainfest could perhaps be used to support some version
of hardcode_libdir?

The crude fix is to (un)install the mainfest file, the nice fix
is to embed it as a resource in the executable using the manifest
tool (mt.exe).

Here's a patch to fix the manifest failures. Maybe this should be
wrapped up in a postlink_cmds variable instead to match the existing

Replying to self as usual, sorry about the mail flood...

The previous patch was not enough, program linking happened in more than
one place. Here's a new patch that fixes that and also adds the
postlink_cmds variable as mentioned above.

This patch actually fixes all mainfest problems. Tests 39 and 40 now
succeed, but 29 still fails, but 29 now stumbles later when the MSVC
toolchain can't handle static/shared linking of non-libtool libraries.
(The static library is always selected for non-libtool libs, as it gets
the preferred name, foo.lib. The import lib gets the name foo-0.lib and
is only found if there is a

2008-08-07  Peter Rosin  <address@hidden>

        * libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS) <postlink_cmds>:
        New tag variable.
        [ cygwin, mingw, cegcc ] <cl*>: Embed the manifest file as a
        (_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.
diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 35ae02f..b78d7ac 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -7340,6 +7340,11 @@ EOF
        func_show_eval "$link_command" 'exit_status=$?'
+       if test -n "$postlink_cmds"; then
+         postlink_cmds=`$ECHO "X$postlink_cmds" | $Xsed -e 
+         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}"'
@@ -7385,6 +7390,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=`$ECHO "X$postlink_cmds" | $Xsed -e 
+         func_execute_cmds "$postlink_cmds" 'exit $?'
+       fi
        exit $EXIT_SUCCESS
@@ -7418,6 +7429,11 @@ EOF
       func_show_eval "$link_command" 'exit $?'
+      if test -n "$postlink_cmds"; then
+       postlink_cmds=`$ECHO "X$postlink_cmds" | $Xsed -e 
+       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 37c0f71..bd71b88 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -4812,6 +4812,10 @@ _LT_EOF
        _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
        _LT_TAGVAR(compile_tag, $1)=-TC
        _LT_TAGVAR(dashl_xform, $1)='s/\(.*\)/\1.lib/'
+       _LT_TAGVAR(postlink_cmds, $1)='if test -e "@address@hidden"; then
+           mt -manifest "@address@hidden" -outputresource:"@address@hidden";
+           $RM "@address@hidden";
+         fi'
        # Assume MSVC wrapper
@@ -5356,6 +5367,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 
+_LT_TAGDECL([], [postlink_cmds], [2],
+    [Commands necessary for finishing linking programs])
 _LT_TAGDECL([], [file_list_spec], [1],
     [Specify filename containing input files])
 _LT_TAGDECL([], [dashL_envvar], [1],
@@ -5803,6 +5816,10 @@ if test "$_lt_caught_CXX_error" != yes; then
          _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
          _LT_TAGVAR(compile_tag, $1)=-TP
          _LT_TAGVAR(dashl_xform, $1)='s/\(.*\)/\1.lib/'
+         _LT_TAGVAR(postlink_cmds, $1)='if test -e "@address@hidden"; then
+             mt -manifest "@address@hidden" -outputresource:"@address@hidden";
+             $RM "@address@hidden";
+           fi'
          # g++

reply via email to

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