[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: correctly including -lnsl and -lsocket on Solaris without impacting
From: |
Stephane Bortzmeyer |
Subject: |
Re: correctly including -lnsl and -lsocket on Solaris without impacting other OS's |
Date: |
Fri, 27 Apr 2007 11:42:24 +0200 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
On Fri, Apr 20, 2007 at 01:10:22PM +0000,
address@hidden <address@hidden> wrote
a message of 93 lines which said:
> The three specific checks for "Solaris" find the libraries, but
> don't set the appropriate HAVE_<function-name> variables in
> config.h.
This is what I use (stolen from lynx, according to the comments I've
put in the file) and it seems to work on Solaris, Tru64, NetBSD and
glibc/Linux systems.
acinclude.m4:
dnl Useful macros to check libraries which are not implicit
dnl in Solaris, for instance.
AC_DEFUN([CF_LIB_NSL],
[
AC_CHECK_LIB(nsl,gethostbyname,
[
AC_MSG_CHECKING(if libnsl is mandatory)
AC_TRY_LINK([#include <sys/types.h>
#include <netinet/in.h>
char *domain; ],
[gethostbyname(domain)], dnl
[AC_MSG_RESULT(no)], dnl
[AC_MSG_RESULT(yes); LIBS="${LIBS} -lnsl"])
])
])
AC_DEFUN([CF_LIB_SOCKET],
[
AC_CHECK_LIB(socket,socket,
[
AC_MSG_CHECKING(if libsocket is mandatory)
AC_TRY_LINK([#include <sys/types.h>
#include <netinet/in.h>
union
{
HEADER hdr;
u_char buf[512];
}
response;
char *domain;
int requested_type; ],
[socket (AF_INET, SOCK_STREAM, 0) ], dnl
[AC_MSG_RESULT(no)], dnl
[AC_MSG_RESULT(yes); LIBS="${LIBS} -lsocket"])
])
])
configure.ac:
CF_LIB_SOCKET
CF_LIB_NSL