MSVC doesn't support the -l option, instead it expects the exact library file name. Retain the -l option as long as possible as libtool recognizes -l internally. Then, as late as possible transform the -l option to an exact file name (-lfoo -> foo.lib). This patch is against Libtool 2.2 * libltdl/m4/libtool.m4: Add tag variable dashl_xform which specifies how to transform -l options for the linker. * libltdl/config/ltmain.m4sh (func_mode_link): Transform -l options using dashl_xform right before creating the program or library. Index: libtool/libltdl/config/ltmain.m4sh =================================================================== --- libtool.orig/libltdl/config/ltmain.m4sh +++ libtool/libltdl/config/ltmain.m4sh @@ -5092,6 +5092,13 @@ func_mode_link () *) tmp_libs="$tmp_libs $deplib" ;; esac ;; + -l*) + if test -n "$dashl_xform" -a "$linkmode" = prog; then + func_stripname '-l' '' "$deplib" + deplib=`$ECHO "X$func_stripname_result" | $Xsed -e $dashl_xform` + fi + tmp_libs="$tmp_libs $deplib" + ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done @@ -5720,6 +5727,9 @@ EOF if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then + if test -n "$dashl_xform"; then + a_deplib=`$ECHO "X$name" | $Xsed -e $dashl_xform` + fi newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 Index: libtool/libltdl/m4/libtool.m4 =================================================================== --- libtool.orig/libltdl/m4/libtool.m4 +++ libtool/libltdl/m4/libtool.m4 @@ -5228,6 +5228,8 @@ _LT_TAGDECL([], [dashL_envvar_spec], [1] [When moving paths with dashL_envvar, prepend this to each path]) _LT_TAGDECL([], [compile_tag], [1], [Add tag specific option for the compiler]) +_LT_TAGDECL([], [dashl_xform], [1], + [Transform -l options for the linker]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects])