1 | # =========================================================================== |
---|
2 | # https://www.gnu.org/software/autoconf-archive/ax_lib_socket_nsl.html |
---|
3 | # =========================================================================== |
---|
4 | # |
---|
5 | # SYNOPSIS |
---|
6 | # |
---|
7 | # AX_LIB_SOCKET_NSL |
---|
8 | # |
---|
9 | # DESCRIPTION |
---|
10 | # |
---|
11 | # This macro figures out what libraries are required on this platform to |
---|
12 | # link sockets programs. |
---|
13 | # |
---|
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(). |
---|
19 | # |
---|
20 | # LICENSE |
---|
21 | # |
---|
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> |
---|
25 | # |
---|
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 |
---|
29 | # warranty. |
---|
30 | |
---|
31 | #serial 7 |
---|
32 | |
---|
33 | AU_ALIAS([LIB_SOCKET_NSL], [AX_LIB_SOCKET_NSL]) |
---|
34 | AC_DEFUN([AX_LIB_SOCKET_NSL], |
---|
35 | [ |
---|
36 | AC_SEARCH_LIBS([gethostbyname], [nsl]) |
---|
37 | AC_SEARCH_LIBS([socket], [socket], [], [ |
---|
38 | AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"], |
---|
39 | [], [-lnsl])]) |
---|
40 | ]) |
---|