From 9af3df4e9d1ecfc070fe79d0cd20e035986b33b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 22 Jul 2014 21:59:31 +0200 Subject: [PATCH] Simplify network libraries detection with AC_SEARCH_LIBS AC_SEARCH_LIBS first tries to link without any lib, then tries each library, and sets $LIBS correctly in any case. cf. https://www.flameeyes.eu/autotools-mythbuster/autoconf/finding.html --- configure.ac | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 2a7bee0d..360af621 100644 --- a/configure.ac +++ b/configure.ac @@ -197,17 +197,9 @@ case "$host_os" in esac -AC_CHECK_FUNC(socket, [], [ - AC_CHECK_LIB(socket, socket, [ - LIBS="$LIBS -lsocket" - ]) -]) +AC_SEARCH_LIBS([socket], [socket]) -AC_CHECK_FUNC(inet_addr, [], [ - AC_CHECK_LIB(nsl, inet_addr, [ - LIBS="$LIBS -lnsl" - ]) -]) +AC_SEARCH_LIBS([inet_addr], [nsl]) dnl * gcc specific options if test "x$ac_cv_prog_gcc" = "xyes"; then