1 dnl @synopsis LIB_SOCKET_NSL
3 dnl This macro figures out what libraries are required on this platform
4 dnl to link sockets programs.
6 dnl The common cases are not to need any extra libraries, or to need
7 dnl -lsocket and -lnsl. We need to avoid linking with libnsl unless we
8 dnl need it, though, since on some OSes where it isn't necessary it
9 dnl will totally break networking. Unisys also includes gethostbyname()
10 dnl in libsocket but needs libnsl for socket().
13 dnl @author Russ Allbery <rra@stanford.edu>
14 dnl @author Stepan Kasal <kasal@ucw.cz>
15 dnl @author Warren Young <warren@etr-usa.com>
16 dnl @version 2005-09-06
17 dnl @license AllPermissive
19 AC_DEFUN([LIB_SOCKET_NSL],
21 AC_SEARCH_LIBS([gethostbyname], [nsl])
22 AC_SEARCH_LIBS([socket], [socket], [], [
23 AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],