Convert CHECK to SEARCH to avoid unnecessarily linking in new libs
Allan Clark
allanc at chickenandporn.com
Thu Oct 1 21:19:50 CEST 2009
On Thu, Oct 1, 2009 at 09:02, Ton Voon <ton.voon at opsera.com> wrote:
> Hi Allan,
> On 30 Sep 2009, at 00:58, Allan Clark wrote:
>
> CVS delta 1.147 -> 1.148 includes un-dnl-ing some AC_CHECK_LIBS for
> USL/SVR4 -derivative Unix environments.
>
> Note that the act of CHECK_LIBS (main) -- which is used to avoid having to
> give an entry point/label -- is also replaced by the actual name of an entry
> point.
>
> For details, see also:
>
> http://www.gnu.org/software/autoconf/manual/html_node/Libraries.html
>
>
> The following change converts this Solaris edit to a SEARCH rather than a
> CHECK, which works on all platforms, and only adds additional librarires if
> the mentioned linker entry points are not already valid in the current list
> of libraries:
>
>
> --- configure.in.solaris 2009-09-30 00:48:17.000000000 +0100
> +++ configure.in 2009-09-30 00:51:37.000000000 +0100
> @@ -101,9 +101,8 @@
>
>
> dnl Checks for library functions.
> -AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
> -AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
> -AC_SUBST(SOCKETLIBS)
> +AC_SEARCH_LIBS([getservbyname],[nsl])
> +AC_SEARCH_LIBS([connect],[socket])
> AC_CHECK_FUNCS(initgroups setenv strdup strstr strtoul unsetenv)
>
> AC_MSG_CHECKING(for type of socket size)
>
>
>
> Note: this also drops the need for "SOCKETLIBS" tracking. Libs add the nsl
> (NameServices lib) and socket (yeah, socket) libraries only if the
> pre-existing libraries (libc, libC, et al) don't already provde the lib.
>
> This check is really intended for the merge-point where sockets moved from
> being environmental things to in-kernel things, and not all executables
> wanted to link with sockets included by default.
>
>
> Good point re: AC_SEARCH_LIBS rather than AC_CHECK_LIB, and good point re:
> checking for actual functions.
>
> 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)
Allan
--
http://tech.chickenandporn.com/tags/nagios/ "金鱼"
http://linkedin.com/in/goldfishSent from London, Eng, United Kingdom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20091001/5612ae9f/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