From a1ed7314137dfa5a96e7600ea1d3c6d127697d59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Tue, 22 Mar 2016 05:49:00 +0000 Subject: Add ax_lib_socket_nsl.m4 macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add SOCKET_LIBS and NSL_LIBS to global LIBS variables on platforms where it is required. Make configure checks for getaddrinfo/gethostname unconditional, that is handled with #ifdefs if necessary. Change-Id: Ia874038454fb9cf3bdbf8e6fd829f319e331837e Reviewed-on: https://code.wireshark.org/review/14560 Reviewed-by: João Valverde --- m4/ax_lib_socket_nsl.m4 | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 m4/ax_lib_socket_nsl.m4 (limited to 'm4') diff --git a/m4/ax_lib_socket_nsl.m4 b/m4/ax_lib_socket_nsl.m4 new file mode 100644 index 0000000000..058e975157 --- /dev/null +++ b/m4/ax_lib_socket_nsl.m4 @@ -0,0 +1,40 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_lib_socket_nsl.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_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(). +# +# LICENSE +# +# Copyright (c) 2008 Russ Allbery +# Copyright (c) 2008 Stepan Kasal +# Copyright (c) 2008 Warren Young +# +# 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. This file is offered as-is, without any +# warranty. + +#serial 6 + +AU_ALIAS([LIB_SOCKET_NSL], [AX_LIB_SOCKET_NSL]) +AC_DEFUN([AX_LIB_SOCKET_NSL], +[ + AC_SEARCH_LIBS([gethostbyname], [nsl]) + AC_SEARCH_LIBS([socket], [socket], [], [ + AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"], + [], [-lnsl])]) +]) -- cgit v1.2.3