1 # ===========================================================================
2 # http://www.gnu.org/software/autoconf-archive/ax_lib_socket_nsl.html
3 # ===========================================================================
11 # This macro figures out what libraries are required on this platform to
12 # link sockets programs.
14 # The common cases are not to need any extra libraries, or to need
15 # -lsocket and -lnsl. We need to avoid linking with libnsl unless we need
16 # it, though, since on some OSes where it isn't necessary it will totally
17 # break networking. Unisys also includes gethostbyname() in libsocket but
18 # needs libnsl for socket().
22 # Copyright (c) 2008 Russ Allbery <rra@stanford.edu>
23 # Copyright (c) 2008 Stepan Kasal <kasal@ucw.cz>
24 # Copyright (c) 2008 Warren Young <warren@etr-usa.com>
26 # Copying and distribution of this file, with or without modification, are
27 # permitted in any medium without royalty provided the copyright notice
28 # and this notice are preserved. This file is offered as-is, without any
33 AU_ALIAS([LIB_SOCKET_NSL], [AX_LIB_SOCKET_NSL])
34 AC_DEFUN([AX_LIB_SOCKET_NSL],
36 AC_SEARCH_LIBS([gethostbyname], [nsl])
37 AC_SEARCH_LIBS([socket], [socket], [], [
38 AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],