]> git.decadent.org.uk Git - nfs-utils.git/blob - aclocal/tcp-wrappers.m4
Imported Debian patch 1.0.9-6
[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     [
8         if test "x$withval" != "xno" ; then
9             saved_LIBS="$LIBS"
10             saved_LDFLAGS="$LDFLAGS"
11             saved_CPPFLAGS="$CPPFLAGS"
12             if test -n "${withval}" -a "${withval}" != "yes"; then
13                 if test -d "${withval}/lib"; then
14                     if test -n "${need_dash_r}"; then
15                         LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
16                     else
17                         LDFLAGS="-L${withval}/lib ${LDFLAGS}"
18                     fi
19                 else
20                     if test -n "${need_dash_r}"; then
21                         LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
22                     else
23                         LDFLAGS="-L${withval} ${LDFLAGS}"
24                     fi
25                 fi
26                 if test -d "${withval}/include"; then
27                     CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
28                 else
29                     CPPFLAGS="-I${withval} ${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     ]
52   )
53   AC_SUBST(LIBWRAP)
54   AC_SUBST(HAVE_LIBWRAP)
55   AC_SUBST(HAVE_TCP_WRAPPER)
56 ])