1dnl Check for LIBWRAP compiler flags. On success, set nut_have_libwrap="yes" 2dnl and set LIBWRAP_CFLAGS and LIBWRAP_LIBS. On failure, set 3dnl nut_have_libwrap="no". This macro can be run multiple times, but will 4dnl do the checking only once. 5 6AC_DEFUN([NUT_CHECK_LIBWRAP], 7[ 8if test -z "${nut_have_libwrap_seen}"; then 9 nut_have_libwrap_seen=yes 10 11 dnl save LIBS 12 LIBS_ORIG="${LIBS}" 13 LIBS="" 14 15 AC_CHECK_HEADERS(tcpd.h, [nut_have_libwrap=yes], [nut_have_libwrap=no], [AC_INCLUDES_DEFAULT]) 16 AC_SEARCH_LIBS(yp_get_default_domain, nsl, [], [nut_have_libwrap=no]) 17 18 dnl The line below does not work on Solaris 10. 19 dnl AC_SEARCH_LIBS(request_init, wrap, [], [nut_have_libwrap=no]) 20 AC_MSG_CHECKING(for library containing request_init) 21 AC_LANG_PUSH([C]) 22 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 23#include <tcpd.h> 24int allow_severity = 0, deny_severity = 0; 25 ]], [[ request_init(0); ]])], [ 26 AC_MSG_RESULT(none required) 27 ], [ 28 LIBS="${LIBS} -lwrap" 29 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 30#include <tcpd.h> 31int allow_severity = 0, deny_severity = 0; 32 ]], [[ request_init(0); ]])], [ 33 AC_MSG_RESULT(-lwrap) 34 ], [ 35 AC_MSG_RESULT(no) 36 nut_have_libwrap=no 37 ]) 38 ]) 39 AC_LANG_POP([C]) 40 41 if test "${nut_have_libwrap}" = "yes"; then 42 AC_DEFINE(HAVE_WRAP, 1, [Define to enable libwrap support]) 43 LIBWRAP_CFLAGS="" 44 LIBWRAP_LIBS="${LIBS}" 45 fi 46 47 dnl restore original LIBS 48 LIBS="${LIBS_ORIG}" 49fi 50]) 51