xref: /aosp_15_r20/external/mtools/m4/ax_lib_socket_nsl.m4 (revision d5c9a868b113e0ec0db2f27bc2ce8a253e77c4b0)
1*d5c9a868SElliott Hughes# ===========================================================================
2*d5c9a868SElliott Hughes#    https://www.gnu.org/software/autoconf-archive/ax_lib_socket_nsl.html
3*d5c9a868SElliott Hughes# ===========================================================================
4*d5c9a868SElliott Hughes#
5*d5c9a868SElliott Hughes# SYNOPSIS
6*d5c9a868SElliott Hughes#
7*d5c9a868SElliott Hughes#   AX_LIB_SOCKET_NSL
8*d5c9a868SElliott Hughes#
9*d5c9a868SElliott Hughes# DESCRIPTION
10*d5c9a868SElliott Hughes#
11*d5c9a868SElliott Hughes#   This macro figures out what libraries are required on this platform to
12*d5c9a868SElliott Hughes#   link sockets programs.
13*d5c9a868SElliott Hughes#
14*d5c9a868SElliott Hughes#   The common cases are not to need any extra libraries, or to need
15*d5c9a868SElliott Hughes#   -lsocket and -lnsl. We need to avoid linking with libnsl unless we need
16*d5c9a868SElliott Hughes#   it, though, since on some OSes where it isn't necessary it will totally
17*d5c9a868SElliott Hughes#   break networking. Unisys also includes gethostbyname() in libsocket but
18*d5c9a868SElliott Hughes#   needs libnsl for socket().
19*d5c9a868SElliott Hughes#
20*d5c9a868SElliott Hughes# LICENSE
21*d5c9a868SElliott Hughes#
22*d5c9a868SElliott Hughes#   Copyright (c) 2008 Russ Allbery <[email protected]>
23*d5c9a868SElliott Hughes#   Copyright (c) 2008 Stepan Kasal <[email protected]>
24*d5c9a868SElliott Hughes#   Copyright (c) 2008 Warren Young <[email protected]>
25*d5c9a868SElliott Hughes#
26*d5c9a868SElliott Hughes#   Copying and distribution of this file, with or without modification, are
27*d5c9a868SElliott Hughes#   permitted in any medium without royalty provided the copyright notice
28*d5c9a868SElliott Hughes#   and this notice are preserved. This file is offered as-is, without any
29*d5c9a868SElliott Hughes#   warranty.
30*d5c9a868SElliott Hughes
31*d5c9a868SElliott Hughes#serial 7
32*d5c9a868SElliott Hughes
33*d5c9a868SElliott HughesAU_ALIAS([LIB_SOCKET_NSL], [AX_LIB_SOCKET_NSL])
34*d5c9a868SElliott HughesAC_DEFUN([AX_LIB_SOCKET_NSL],
35*d5c9a868SElliott Hughes[
36*d5c9a868SElliott Hughes	AC_SEARCH_LIBS([gethostbyname], [nsl])
37*d5c9a868SElliott Hughes	AC_SEARCH_LIBS([socket], [socket], [], [
38*d5c9a868SElliott Hughes		AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
39*d5c9a868SElliott Hughes		[], [-lnsl])])
40*d5c9a868SElliott Hughes])
41