From 1dfd4ca227102355c8b89c83d68a67dbd9276e24 Mon Sep 17 00:00:00 2001 From: Dagobert Michelsen Date: Tue, 1 Oct 2019 14:34:43 +0200 Subject: [PATCH] Link to libnsl.so if needed for inet_ntop() --- Makefile.am | 6 ++++++ configure.ac | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/Makefile.am b/Makefile.am index f8353d4c..bdb95a1b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1420,6 +1420,12 @@ test_plugin_network_LDADD = \ libplugin_mock.la \ libmetadata.la \ $(GCRYPT_LIBS) +if BUILD_WITH_LIBSOCKET +test_plugin_network_LDADD += -lsocket +endif +if BUILD_WITH_LIBNSL +test_plugin_network_LDADD += -lnsl +endif check_PROGRAMS += test_plugin_network endif diff --git a/configure.ac b/configure.ac index c190784d..4e585bd2 100644 --- a/configure.ac +++ b/configure.ac @@ -858,6 +858,17 @@ AC_CHECK_FUNCS([socket], AM_CONDITIONAL([BUILD_WITH_LIBSOCKET], [test "x$socket_needs_socket" = "xyes"]) AM_CONDITIONAL([BUILD_WITH_GNULIB], [test "x$socket_needs_gnulib" = "xyes"]) +AC_CHECK_FUNCS([inet_ntop], + [], + [ + AC_CHECK_LIB([nsl], [inet_ntop], + [inet_ntop_needs_nsl="yes"], + [AC_MSG_ERROR([cannot find inet_ntop() in libnsl])] + ) + ] +) +AM_CONDITIONAL([BUILD_WITH_LIBNSL], [test "x$inet_ntop_needs_nsl" = "xyes"]) + clock_gettime_needs_posix4="no" AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime="yes"], -- 2.11.0