From 020b39f3311e9d7489726f955c977f174c3c7f66 Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Wed, 17 Feb 2016 20:25:57 +0100 Subject: [PATCH] Detect several network libraries properly Closes #3369 --- configure.ac | 2 +- m4/ax_lib_socket_nsl.m4 | 40 ----------------------------------- m4/pdns_check_network_libs.m4 | 7 ++++++ 3 files changed, 8 insertions(+), 41 deletions(-) delete mode 100644 m4/ax_lib_socket_nsl.m4 create mode 100644 m4/pdns_check_network_libs.m4 diff --git a/configure.ac b/configure.ac index 3ab8ac340..ac1926d13 100644 --- a/configure.ac +++ b/configure.ac @@ -64,7 +64,7 @@ AS_IF([test "x$enable_hardening" != "xno"], [ AC_LD_RELRO ]) -AX_LIB_SOCKET_NSL +PDNS_CHECK_NETWORK_LIBS LT_PREREQ([2.2.2]) LT_INIT([disable-static dlopen]) diff --git a/m4/ax_lib_socket_nsl.m4 b/m4/ax_lib_socket_nsl.m4 deleted file mode 100644 index 058e97515..000000000 --- a/m4/ax_lib_socket_nsl.m4 +++ /dev/null @@ -1,40 +0,0 @@ -# =========================================================================== -# 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])]) -]) diff --git a/m4/pdns_check_network_libs.m4 b/m4/pdns_check_network_libs.m4 new file mode 100644 index 000000000..953d58eaa --- /dev/null +++ b/m4/pdns_check_network_libs.m4 @@ -0,0 +1,7 @@ +AC_DEFUN([PDNS_CHECK_NETWORK_LIBS],[ + AC_SEARCH_LIBS([inet_aton], [resolv]) + AC_SEARCH_LIBS([gethostbyname], [nsl]) + AC_SEARCH_LIBS([socket], [socket]) + AC_SEARCH_LIBS([gethostent], [nsl]) +]) + -- 2.40.0