Autogen update
[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                 TCPW_MSG="yes"
43                 ],[
44                 AC_MSG_ERROR([*** libwrap missing])
45                 
46             ])
47             LIBS="$saved_LIBS"
48         fi
49     ]
50   )
51   AC_SUBST(LIBWRAP)
52 ])