File: lib_socket_nsl.m4

package info (click to toggle)
lcm 1.3.1%2Brepack1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,784 kB
  • sloc: ansic: 16,184; java: 6,843; cs: 2,266; cpp: 1,594; python: 989; makefile: 348; xml: 252; sh: 62
file content (38 lines) | stat: -rw-r--r-- 1,145 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
##### http://autoconf-archive.cryp.to/lib_socket_nsl.html
#
# SYNOPSIS
#
#   LIB_SOCKET_NSL
#
# DESCRIPTION
#
#   This macro figures out what libraries are required on this platform
#   to link sockets programs.
#
#   The common cases are not to need any extra libraries, or to need
#   -lsocket and -lnsl. We need to avoid linking with libnsl unless we
#   need it, though, since on some OSes where it isn't necessary it
#   will totally break networking. Unisys also includes gethostbyname()
#   in libsocket but needs libnsl for socket().
#
# LAST MODIFICATION
#
#   2005-09-06
#
# COPYLEFT
#
#   Copyright (c) 2005 Russ Allbery <rra@stanford.edu>
#   Copyright (c) 2005 Stepan Kasal <kasal@ucw.cz>
#   Copyright (c) 2005 Warren Young <warren@etr-usa.com>
#
#   Copying and distribution of this file, with or without
#   modification, are permitted in any medium without royalty provided
#   the copyright notice and this notice are preserved.

AC_DEFUN([LIB_SOCKET_NSL],
[
	AC_SEARCH_LIBS([gethostbyname], [nsl])
	AC_SEARCH_LIBS([socket], [socket], [], [
		AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
		[], [-lnsl])])
])