autoconf-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] Document traps of AC_CHECK_LIB for standard functions


From: Paul Eggert
Subject: Re: [PATCH] Document traps of AC_CHECK_LIB for standard functions
Date: Thu, 09 Dec 2004 13:32:54 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Thanks for the documentation suggestions.  I condensed it down to the
following patch, which I installed.

2004-12-09  Paul Eggert  <address@hidden>

        * doc/autoconf.texi (Libraries): Clarify problems with AC_CHECK_LIB
        and suggest AC_SEARCH_LIBS.  Suggested by Noah Misch and Stepan Kasal.

--- autoconf.texi.~1.847.~      2004-12-06 13:16:26 -0800
+++ autoconf.texi       2004-12-09 13:29:26 -0800
@@ -3583,10 +3583,10 @@ library archive files.
 
 @defmac AC_CHECK_LIB (@var{library}, @var{function}, @ovar{action-if-found}, 
@ovar{action-if-not-found}, @ovar{other-libraries})
 @acindex{CHECK_LIB}
-Depending on the current language(@pxref{Language Choice}), try to
-ensure that the C, C++, or Fortran function @var{function} is
-available by checking whether a test program can be linked with the
-library @var{library} to get the function.  @var{library} is the base
+Test whether the library @var{library} is available by trying to link
+a test program that calls function @var{function} with the library.
address@hidden should be a function provided by the library.
+Use the base
 name of the library; e.g., to check for @option{-lmp}, use @samp{mp} as
 the @var{library} argument.
 
@@ -3610,6 +3610,14 @@ that @var{library} is present, because l
 always fail with unresolved symbols.  The @var{other-libraries} argument
 should be limited to cases where it is desirable to test for one library
 in the presence of another that is not already in @code{LIBS}.
+
address@hidden requires some care in usage, and should be avoided
+in some common cases.  Many standard functions like @code{gethostbyname}
+appear the standard C library on some hosts, and in special libraries
+like @code{nsl} on other hosts.  On some hosts the special libraries
+contain variant implementations that you may not want to use.  These
+days it is normally better to use @code{AC_SEARCH_LIBS(gethostbyname,
+nsl)} instead of @code{AC_CHECK_LIB(nsl, gethostbyname)}.
 @end defmac
 
 




reply via email to

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