autoconf-patches
[Top][All Lists]
Advanced

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

[PATCH] AC_SEARCH_LIBS now searches for .lib files


From: Antonin Décimo
Subject: [PATCH] AC_SEARCH_LIBS now searches for .lib files
Date: Mon, 6 Jan 2025 17:55:08 +0100

MSVC doesn't use the -l option to link with libraries, which must be
listed with the .lib extension.
---

cl/clang-cl ignore the -l flag:
cl : Command line warning D9002 : ignoring unknown option '-lxxx'

Would it be a problem with "regular" compilers if the function was not
present in the file specified with -lxxx, but existed in a xxx.lib
file (!) in the cwd?

 NEWS                 | 4 ++++
 lib/autoconf/libs.m4 | 6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index b859fff6..c295bbd9 100644
--- a/NEWS
+++ b/NEWS
@@ -30,6 +30,10 @@ GNU Autoconf NEWS - User visible changes.
 
 *** AC_USE_SYSTEM_EXTENSIONS now defines _COSMO_SOURCE for Cosmopolitan Libc.
 
+*** AC_SEARCH_LIBS now searches for .lib files
+  MSVC doesn't use the -l option to link with libraries, which must be
+  listed with the .lib extension.
+
 ** Notable bug fixes
 
 *** AC_FUNC_STRNLEN now detects Android 5.0's broken strnlen.
diff --git a/lib/autoconf/libs.m4 b/lib/autoconf/libs.m4
index 6bfd9f87..0780b65f 100644
--- a/lib/autoconf/libs.m4
+++ b/lib/autoconf/libs.m4
@@ -50,13 +50,13 @@ AC_DEFUN([AC_SEARCH_LIBS],
 AC_CACHE_CHECK([for library containing $1], [ac_Search],
 [ac_func_search_save_LIBS=$LIBS
 AC_LANG_CONFTEST([AC_LANG_CALL([], [$1])])
-for ac_lib in '' $2
+for ac_lib in '' -l$2 $2.lib
 do
   if test -z "$ac_lib"; then
     ac_res="none required"
   else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib $5 $ac_func_search_save_LIBS"
+    ac_res=$ac_lib
+    LIBS="$ac_lib $5 $ac_func_search_save_LIBS"
   fi
   AC_LINK_IFELSE([], [AS_VAR_SET([ac_Search], [$ac_res])])
   AS_VAR_SET_IF([ac_Search], [break])
-- 
2.47.1




reply via email to

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