Hi David,
(moving to libtool-patc...@...)
Den 2009-09-03 20:24 skrev David Byron:
You want to send -DEBUG to link.exe, not to cl.exe. I'm
sure you know this, but simply adding -DEBUG to LDFLAGS is
not the way you do this. The correct way would be to use
-Wl,-DEBUG. If the msvc stuff were complete, libtool would
then feed -DEBUG to the linker. But this does not
currently work, and the main reason is that the -link
option to cl.exe is different. It feeds all options
(instead of just one) after the -link option on the
command line to the linker, so it would be very bad to
just transform -Wl,foo into -link foo.
Makes sense.
Can someone show me how to do this without hacking the
libtool file?
You can work around the above -Wl,foo limitation in two
ways.
2) Use a response file, like this:
$ cat linkdebug
-link -DEBUG
$ /bin/sh ./libtool --tag=CC --mode=link cl @linkdebug -MD -Zi \
-no-undefined -export-symbols symfile -o libfoo.la \
-rpath /usr/local/lib libfoo_la-public.lo libfoo_la-private.lo
This works well, though way I integrated it with autoconf and automake is a
bit cumbersome. Trouble is, it works so it's harder to motivate to dive in
and fix libtool to do the right thing with -Wl,-DEBUG.
Here's a couple of patches that implements support for -Wl, and
-Xlinker for MSVC. The first one (rename-dashL_envvar-tolinker_envvar.patch)
is just a rename, to reduce confusion, and the second patch
(-Xlinker-msvc.patch) contains the new code...
Ok for the pr-msvc-support branch?
Cheers,
Peter
2009-09-09 Peter Rosin p...@lysator.liu.se
Make -Wl,FLAG and -Xlinker FLAG work on MSVC.
* libltdl/m4/libtool.m4 (_LT_COMPILER_PIC) [MSVC]: Set
lt_prog_compiler_wl to @lt_envvar@ to signal that linker options
should be passed via the $linker_envvar variable.
* libltdl/config/ltmain.m4sh (func_to_linker_envvar): Also move
@lt_output@ options to the $linker_envvar variable.
(func_mode_link) [linkmode=lib]: Look for options to move to the
$linker_envvar in $compiler_flags as well. Echo the final
content of the linker_envvar.
(func_mode_link) [linkmode=prog]: Look for options to move to the
$linker_envvar in $compile_command and $finalize_command as well.
* tests/flags.at: Don't expect to find @lt_envvar@ in the output
if $wl is set to that.
* doc/libtool.texi (linker_envvar): Document the @lt_envvar@ hook.
2009-09-09 Peter Rosin p...@lysator.liu.se
Rename dashL_envvar into linker_envvar.
* libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS, _LT_LANG_CXX_CONFIG):
Rename dashL_envvar into linker_envvar. The new name makes it
less confusing to pass other linker options via the variable.
* libltdl/config/ltmain.m4sh (func_dashL_to_envvar): Rename...
(func_to_linker_envvar): ...to this, and operate on linker_envvar
instead of dashL_envvar.
(func_mode_link): Adjust to above renames.
* doc/libtool.texi: Document changes.
diff --git a/doc/libtool.texi b/doc/libtool.texi
index 610117e..9aa3d4b 100644
--- a/doc/libtool.texi
+++ b/doc/libtool.texi
@@ -5876,13 +5876,6 @@ convenience archives or a set of object file names can
be passed via
linker-specific options or linker scripts.
@end defvar
-...@defvar dashL_envvar
-When linking, move all paths specified with @option{-L} options to
-this variable, for toolchains where it makes sense to pass the library
-search paths in an environment variable. Normally disabled (i.e.
-...@var{dashl_envvar} empty).
-...@end defvar
-
@defvar dashL_envvar_spec
When moving library search paths with @var{dashL_envvar}, prepend this
to each @option{-L} path that is added to @var{dashL_envvar}. Unused
@@ -6107,6 +6100,13 @@ Linker flag (passed through the C compiler) used to
prevent dynamic
linking.
@end defvar
+...@defvar linker_envvar
+When linking, move all paths specified with @option{-L} options to
+this variable, for toolchains where it makes sense to pass the library
+search paths in an environment variable. Normally disabled (i.e.
+...@var{linker_envvar} empty).
+...@end defvar
+
@defvar macro_version
@defvarx macro_revision
The release and revision from which the libtool.m4 macros were
diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 40ff9d3..5fc8d0b 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -634,8 +634,8 @@ func_infer_tag ()
}
-# func_dashL_to_envvar deplibs_variable deplibs...
-func_dashL_to_envvar ()
+# func_to_linker_envvar deplibs_variable deplibs...
+func_to_linker_envvar ()
{
deplibs_variable=$1
shift
@@ -653,7 +653,7 @@ func_dashL_to_envvar ()
env_path=`cygpath -w $env_path`
;;
esac
- eval $dashL_envvar=\\$$dashL_envvar $dashL_envvar_spec$env_path\
+ eval $linker_envvar=\\$$linker_envvar $dashL_envvar_spec$env_path\
;;
*)
tmp_libs=$tmp_libs $deplib
@@