]> git.pond.sub.org Git - empserver/blob - m4/lib_socket_nsl.m4
Move auxiliary build tools to build-aux/
[empserver] / m4 / lib_socket_nsl.m4
1 ##### http://autoconf-archive.cryp.to/lib_socket_nsl.html
2 #
3 # SYNOPSIS
4 #
5 #   LIB_SOCKET_NSL
6 #
7 # DESCRIPTION
8 #
9 #   This macro figures out what libraries are required on this platform
10 #   to link sockets programs.
11 #
12 #   The common cases are not to need any extra libraries, or to need
13 #   -lsocket and -lnsl. We need to avoid linking with libnsl unless we
14 #   need it, though, since on some OSes where it isn't necessary it
15 #   will totally break networking. Unisys also includes gethostbyname()
16 #   in libsocket but needs libnsl for socket().
17 #
18 # LAST MODIFICATION
19 #
20 #   2005-09-06
21 #
22 # COPYLEFT
23 #
24 #   Copyright (c) 2005 Russ Allbery <rra@stanford.edu>
25 #   Copyright (c) 2005 Stepan Kasal <kasal@ucw.cz>
26 #   Copyright (c) 2005 Warren Young <warren@etr-usa.com>
27 #
28 #   Copying and distribution of this file, with or without
29 #   modification, are permitted in any medium without royalty provided
30 #   the copyright notice and this notice are preserved.
31
32 AC_DEFUN([LIB_SOCKET_NSL],
33 [
34         AC_SEARCH_LIBS([gethostbyname], [nsl])
35         AC_SEARCH_LIBS([socket], [socket], [], [
36                 AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
37                 [], [-lnsl])])
38 ])