]> git.decadent.org.uk Git - nfs-utils.git/blob - aclocal/tcp-wrappers.m4
mount.nfs: Remove get_my_ipv4addr() from append_addr_opt()
[nfs-utils.git] / aclocal / tcp-wrappers.m4
1 # Check whether user wants TCP wrappers support
2 AC_DEFUN([AC_TCP_WRAPPERS],[
3   TCPW_MSG="no"
4   AC_ARG_WITH(tcp-wrappers,
5     [  --with-tcp-wrappers[[=PATH]]      Enable tcpwrappers support
6                  (optionally in PATH)],
7     with_tcpw=$withval, with_tcpw=yes)
8         if test "x$with_tcpw" != "xno" ; then
9             saved_LIBS="$LIBS"
10             saved_LDFLAGS="$LDFLAGS"
11             saved_CPPFLAGS="$CPPFLAGS"
12             if test -n "${with_tcpw}" -a "${with_tcpw}" != "yes"; then
13                 if test -d "${with_tcpw}/lib"; then
14                     if test -n "${need_dash_r}"; then
15                         LDFLAGS="-L${with_tcpw}/lib -R${with_tcpw}/lib ${LDFLAGS}"
16                     else
17                         LDFLAGS="-L${with_tcpw}/lib ${LDFLAGS}"
18                     fi
19                 else
20                     if test -n "${need_dash_r}"; then
21                         LDFLAGS="-L${with_tcpw} -R${with_tcpw} ${LDFLAGS}"
22                     else
23                         LDFLAGS="-L${with_tcpw} ${LDFLAGS}"
24                     fi
25                 fi
26                 if test -d "${with_tcpw}/include"; then
27                     CPPFLAGS="-I${with_tcpw}/include ${CPPFLAGS}"
28                 else
29                     CPPFLAGS="-I${with_tcpw} ${CPPFLAGS}"
30                 fi
31             fi
32             LIBWRAP="-lwrap"
33             LIBS="$LIBWRAP $LIBS"
34             AC_MSG_CHECKING(for libwrap)
35             AC_LINK_IFELSE([AC_LANG_PROGRAM([[
36                 #include <tcpd.h>
37                 int deny_severity = 0, allow_severity = 0;
38                 ]], [[hosts_access(0);]])],[
39                 AC_MSG_RESULT(yes)
40                 AC_SUBST(LIBWRAP)
41                 AC_DEFINE([LIBWRAP], [1], [tcp-wrapper])
42                 AC_DEFINE([HAVE_LIBWRAP], [1], [tcp-wrapper])
43                 AC_DEFINE([HAVE_TCP_WRAPPER], [1], [tcp-wrapper])
44                 TCPW_MSG="yes"
45                 ],[
46                 AC_MSG_ERROR([*** libwrap missing])
47                 
48             ])
49             LIBS="$saved_LIBS"
50         fi
51   AC_SUBST(LIBWRAP)
52   AC_SUBST(HAVE_LIBWRAP)
53   AC_SUBST(HAVE_TCP_WRAPPER)
54 ])