--- a/configure
+++ b/configure
@@ -5366,12 +5366,12 @@
         _flags_filter=msvc_flags_link
         _ld_lib='%.lib'
         _ld_path='-libpath:'
-    elif VSLANG=1033 $_cc -nologo- 2>&1 | grep -q ^Microsoft || { $_cc -v 2>&1 | grep -q clang && $_cc -? > /dev/null 2>&1; }; then
+    elif VSLANG=1033 $_cc -nologo- 2>&1 | grep -q 'Microsoft.*\(C/C++\|Linker\|链接器\)' || { $_cc -v 2>&1 | grep -q clang && $_cc -? > /dev/null 2>&1; }; then
         _type=msvc
-        if VSLANG=1033 $_cc -nologo- 2>&1 | grep -q ^Microsoft; then
+        if VSLANG=1033 $_cc -nologo- 2>&1 | grep -q 'Microsoft.*\(C/C++\|Linker\|链接器\)'; then
             # Depending on the tool (cl.exe or link.exe), the version number
             # is printed on the first line of stderr or stdout
-            _ident=$(VSLANG=1033 $_cc 2>&1 | grep ^Microsoft | head -n1 | tr -d '\r')
+            _ident=$(VSLANG=1033 $_cc 2>&1 | grep 'Microsoft.*\(C/C++\|Linker\|链接器\)' | head -n1 | LC_ALL=C tr -cd '\11\40-\176')
         else
             _ident=$($_cc --version 2>/dev/null | head -n1 | tr -d '\r')
         fi
@@ -5386,7 +5386,7 @@
         _DEPCXXFLAGS='$(CXXFLAGS)'
         _cflags_speed="-O2"
         _cflags_size="-O1"
-        if $_cc -nologo- 2>&1 | grep -q Linker; then
+        if $_cc -nologo- 2>&1 | grep -q 'Linker\|链接器'; then
             _ld_o='-out:$@'
             _flags_filter=msvc_flags_link
         else
