Convert CHECK to SEARCH to avoid unnecessarily linking in new libs

Ton Voon ton.voon at opsera.com
Fri Oct 2 11:03:43 CEST 2009


On 1 Oct 2009, at 20:19, Allan Clark wrote:

> On Thu, Oct 1, 2009 at 09:02, Ton Voon <ton.voon at opsera.com> wrote:
>
> However, I would still want SOCKETLIBS to be set otherwise the  
> libraries will get linked to other parts of Nagios that do not need  
> it, like CGIs and nagiostats. So I propose:
>
>  dnl Checks for library functions.
> -AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
> -AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
> +AC_SEARCH_LIBS([getservbyname],[nsl],[SOCKETLIBS="$SOCKETLIBS - 
> lnsl"])
> +AC_SEARCH_LIBS([connect],[socket],[SOCKETLIBS="$SOCKETLIBS - 
> lsocket"])
>  AC_SUBST(SOCKETLIBS)
>  AC_CHECK_FUNCS(initgroups setenv strdup strstr strtoul unsetenv)
>
> Comments?
>
> Makes sense... still accomplishes the objective of my suggestion :)
>
> (my vote: go for it)

The patch as above breaks on systems where getservbyname is in libc,  
which was contrary to my understanding of AC_SEARCH_LIBS.

Fortunately, I cribbed the idea off gnulib's macro for getaddrinfo.m4  
to find the missing logic. I think the latest commits now work as  
expected.

Ton

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20091002/9c1a4d1d/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list