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 1/3] 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 From 1f9ad64ee559b05463c09796ef20b4dbe0daa37d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 22 Jul 2014 22:36:49 +0200 Subject: [PATCH 2/3] Simplify socklen_t type detection The previous version of AC_CHECK_TYPE() which didn't accept passing headers is obsolete anyway. The new one can be told which headers to include. Also test for sys/socket.h just for sanity. cf. https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Obsolete-Macros.html https://www.gnu.org/software/autoconf/manual/autoconf-2.64/html_node/Generic-Types.html https://svn.opendnssec.org/home/jerry/memory-usage/ldns-1.6.10/acx_nlnetlabs.m4 --- configure.ac | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac index 360af621..f587b93c 100644 --- a/configure.ac +++ b/configure.ac @@ -20,7 +20,7 @@ AC_PATH_PROG(perlpath, perl) AC_CHECK_HEADERS(unistd.h dirent.h sys/ioctl.h sys/resource.h) # check posix headers.. -AC_CHECK_HEADERS(sys/time.h sys/utsname.h regex.h) +AC_CHECK_HEADERS(sys/socket.h sys/time.h sys/utsname.h regex.h) AC_SYS_LARGEFILE @@ -206,21 +206,13 @@ if test "x$ac_cv_prog_gcc" = "xyes"; then CFLAGS="$CFLAGS -Wall" fi -dnl * socklen_t - AC_CHECK_TYPE() would be _really_ useful if it only would -dnl * accept header files where to find the typedef.. -AC_MSG_CHECKING([for socklen_t]) -AC_CACHE_VAL(irssi_cv_type_socklen_t, -[AC_TRY_COMPILE([ -#include -#include ], -[socklen_t t = 0; return((int)t); ], -irssi_cv_type_socklen_t=yes, -irssi_cv_type_socklen_t=no, -)]) -if test $irssi_cv_type_socklen_t = no; then -AC_DEFINE(socklen_t, int, Define to 'int' if doesn't define.) -fi -AC_MSG_RESULT($irssi_cv_type_socklen_t) +AC_CHECK_TYPE(socklen_t, , + [AC_DEFINE([socklen_t], [int], [Define to 'int' if doesn't define.])], [ +AC_INCLUDES_DEFAULT +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +]) AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) From c855fef06405e720cb1ceea98665af74136b61ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 22 Jul 2014 23:14:12 +0200 Subject: [PATCH 3/3] Drop AC_ISC_POSIX which is obsolete It's actually a NOOP in latest autoconf. cf. https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Obsolete-Macros.html#index-AC_005fISC_005fPOSIX-2084 --- configure.ac | 1 - 1 file changed, 1 deletion(-) diff --git a/configure.ac b/configure.ac index f587b93c..047ffbbe 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,6 @@ AM_INIT_AUTOMAKE([1.9 no-define foreign]) AM_MAINTAINER_MODE -AC_ISC_POSIX AC_PROG_CC AC_PROG_CPP AM_PROG_LIBTOOL