configure: filter link flags separately for MSVC

This avoids adding flags that cl.exe doesn't understand.

Fixes cases where external libraries pkg-config file adds `-L` to the
cflags, strip it before passing to cl.exe.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
This commit is contained in:
Kacper Michajłow
2025-07-20 19:21:58 +02:00
parent 5b3d6c0460
commit 50408c55ac
Vendored
+9 -2
View File
@@ -4925,7 +4925,7 @@ msvc_common_flags(){
-lstdc++) ;;
-l*) echo ${flag#-l}.lib ;;
-LARGEADDRESSAWARE) echo $flag ;;
-L*) echo -libpath:${flag#-L} ;;
-L*) [ "$_flags_type" = "link" ] && echo -libpath:${flag#-L} ;;
-Wl,*) ;;
*) echo $flag ;;
esac
@@ -4947,6 +4947,12 @@ msvc_flags(){
done
}
msvc_flags_link(){
_flags_type=link
msvc_flags "$@"
unset _flags_type
}
icl_flags(){
msvc_common_flags "$@"
for flag; do
@@ -5173,12 +5179,13 @@ probe_cc(){
_cflags_noopt="-O1"
if $_cc -nologo- 2>&1 | grep -q Linker; then
_ld_o='-out:$@'
_flags_filter=msvc_flags_link
else
_ld_o='-Fe$@'
_flags_filter=msvc_flags
fi
_cc_o='-Fo$@'
_cc_e='-P -Fi$@'
_flags_filter=msvc_flags
_ld_lib='lib%.a'
_ld_path='-libpath:'
_flags='-nologo'