git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] configure: use AC_SEARCH_LIBS instead of AC_CHECK_LIB

From
NSNicolas Sebrecht <nicolas.s.dev@gmx.fr>
Date
Jul 19, 2009, 12:48 UTC
Message-ID
<a52be8ba36206abc5ff5c91a759036a931e2658c.1248007036.git.nicolas.s.dev@gmx.fr>
In-Reply-To
<m34ot9c67t.fsf_-_@localhost.localdomain>
Show 27 quoted lines
> It looks like some recent bug in configure.ac, as I have run
> ./configure without "make configure" and it had
> 
>   NO_LIBGEN_H=@NO_LIBGEN_H@
>   NEEDS_RESOLV=@NEEDS_RESOLV@
> 
>   SNPRINTF_RETURNS_BOGUS=
> 
> and when I did "rm configure ; make configure ; ./configure"
> it gave me
> 
>   NO_LIBGEN_H=
>   NEEDS_RESOLV=
> 
>   SNPRINTF_RETURNS_BOGUS=UnfortunatelyYes
> 
> I have tried to find which commit introduced this regression.
> 
>  $ git bisect start origin v1.6.3 v1.6.3.2 -- configure.ac config.mak.in
>  $ git bisect run ~/git/test.sh
> 
> finds ecc395c (Makefile: add NEEDS_LIBGEN to optionally add -lgen to
> compile arguments, 2009-07-10) as a first bad commit.  But I don't see
> how it could have changed it... Strange...
> 
> CC-ed Brandon Casey, author of blamed changeset, and David Syzdek who
> offered at some time help with maintaining autoconf.
Thank you, I did the same investigation here. :-)

AC_CHECK_LIB may fail to check the good libraries. Use AC_SEARCH_LIBS instead as pointed out by the autotool documentation.

http://www.gnu.org/software/autoconf/manual/html_node/Libraries.html#Libraries
Signed-off-by: Nicolas Sebrecht <nicolas.s.dev@gmx.fr>
---
 configure.ac |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/configure.ac b/configure.ac
index 74d0af5..48dd5f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -339,9 +339,9 @@ AC_MSG_NOTICE([CHECKS for libraries])
 
 GIT_STASH_FLAGS($OPENSSLDIR)
 
-AC_CHECK_LIB([crypto], [SHA1_Init],
+AC_SEARCH_LIBS([SHA1_Init], [crypto],
 [NEEDS_SSL_WITH_CRYPTO=],
-[AC_CHECK_LIB([ssl], [SHA1_Init],
+[AC_SEARCH_LIBS([SHA1_Init], [ssl],
  [NEEDS_SSL_WITH_CRYPTO=YesPlease
   NEEDS_SSL_WITH_CRYPTO=],
  [NO_OPENSSL=YesPlease])])
@@ -358,7 +358,7 @@ AC_SUBST(NO_OPENSSL)
 
 GIT_STASH_FLAGS($CURLDIR)
 
-AC_CHECK_LIB([curl], [curl_global_init],
+AC_SEARCH_LIBS([curl_global_init], [curl],
 [NO_CURL=],
 [NO_CURL=YesPlease])
 
@@ -372,7 +372,7 @@ AC_SUBST(NO_CURL)
 
 GIT_STASH_FLAGS($EXPATDIR)
 
-AC_CHECK_LIB([expat], [XML_ParserCreate],
+AC_SEARCH_LIBS([XML_ParserCreate], [expat],
 [NO_EXPAT=],
 [NO_EXPAT=YesPlease])
 
@@ -469,7 +469,7 @@ AC_SUBST(NO_DEFLATE_BOUND)
 #
 # Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
 # Patrick Mauritz).
-AC_CHECK_LIB([c], [socket],
+AC_SEARCH_LIBS([socket], [c],
 [NEEDS_SOCKET=],
 [NEEDS_SOCKET=YesPlease])
 AC_SUBST(NEEDS_SOCKET)
@@ -479,13 +479,13 @@ test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket"
 # Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
 # Notably on Solaris hstrerror resides in libresolv and on Solaris 7
 # inet_ntop and inet_pton additionally reside there.
-AC_CHECK_LIB([resolv], [hstrerror],
+AC_SEARCH_LIBS([hstrerror], [resolv],
 [NEEDS_RESOLV=],
 [NEEDS_RESOLV=YesPlease])
 AC_SUBST(NEEDS_RESOLV)
 test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv"
 
-AC_CHECK_LIB([gen], [basename],
+AC_SEARCH_LIBS([basename], [gen],
 [NEEDS_LIBGEN=],
 [NEEDS_LIBGEN=YesPlease])
 AC_SUBST(NEEDS_LIBGEN)
@@ -647,7 +647,7 @@ AC_SUBST(SNPRINTF_RETURNS_BOGUS)
 
 
 ## Checks for library functions.
-## (in default C library and libraries checked by AC_CHECK_LIB)
+## (in default C library and libraries checked by AC_SEARCH_LIBS)
 AC_MSG_NOTICE([CHECKS for library functions])
 #
 # Define NO_LIBGEN_H if you don't have libgen.h.
-- 
1.6.4.rc1.170.ge727
Previous: Jakub NarebskiNext: Nicolas Sebrecht
Message 12 of 32 in “[test failure] t4114 binary file becomes symlink”
  1. Nicolas SebrechtJul 18, 2009
  2. Jeff KingJul 18, 2009
  3. [test failure] Re: t4114 binary file becomes symlinkNicolas Sebrecht, Jul 18, 2009
  4. Jeff KingJul 18, 2009
  5. Junio C HamanoJul 18, 2009
  6. [test failure] Re: t4114 binary file becomes symlinkNicolas Sebrecht, Jul 18, 2009
  7. Linus TorvaldsJul 18, 2009
  8. Johannes SixtJul 18, 2009
  9. [test failure] Re: t4114 binary file becomes symlinkNicolas Sebrecht, Jul 18, 2009
  10. [test failure] Re: t4114 binary file becomes symlinkNicolas Sebrecht, Jul 18, 2009
  11. ./configure misdetects SNPRINTF_RETURNS_BOGUS (was: [test failure] t4114 binary file becomes symlink)Jakub Narebski, Jul 19, 2009
  12. configure: use AC_SEARCH_LIBS instead of AC_CHECK_LIBNicolas Sebrecht, Jul 19, 2009
  13. Re: configure: use AC_SEARCH_LIBS instead of AC_CHECK_LIBNicolas Sebrecht, Jul 19, 2009
  14. Junio C HamanoJul 19, 2009
  15. Eric BlakeJul 19, 2009
  16. Brandon CaseyJul 21, 2009
  17. Brandon CaseyJul 21, 2009
  18. Paolo BonziniJul 21, 2009
  19. Brandon CaseyJul 21, 2009
  20. configure.ac: rework/fix the NEEDS_RESOLV and NEEDS_LIBGEN testsBrandon Casey, Jul 21, 2009
  21. Junio C HamanoJul 21, 2009
  22. Brandon CaseyJul 22, 2009
  23. config.mak.in: continue fixing NEEDS_LIBGEN autoconfigure featureBrandon Casey, Jul 22, 2009
  24. Junio C HamanoJul 22, 2009
  25. Brandon CaseyJul 23, 2009
  26. Johannes SixtJul 18, 2009
  27. Jeff KingJul 18, 2009
  28. [test failure] Re: t4114 binary file becomes symlinkNicolas Sebrecht, Jul 18, 2009
  29. Johannes SixtJul 19, 2009
  30. Jeff KingJul 20, 2009
  31. Johannes SixtJul 20, 2009
  32. Linus TorvaldsJul 20, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.