aboutsummaryrefslogtreecommitdiffstats
path: root/m4/libwrap.m4
blob: 000b0bab209479b493be99f7205adc32bebc2601 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
dnl
dnl Usage:
dnl AC_CHECK_LIBWRAP([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl

AC_DEFUN([AC_CHECK_LIBWRAP],
         [dnl start

    AC_ARG_ENABLE([libwrap],
        [AS_HELP_STRING([--disable-libwrap],
        [use libwrap (default enabled)])], ,
        [
           AC_CHECK_HEADERS([tcpd.h],
                           [],
                           [AC_MSG_ERROR([tpcd.h libwrap header not found])]
                           $3)

           AC_CHECK_LIB([wrap],
                        [request_init],
                        [],
                        [AC_MSG_ERROR([libwrap not found !])]
                        $3)

           AC_DEFINE(HAVE_LIBWRAP, 1, [define to enable libwrap library])

           LIBWRAP_CFLAGS=""
           LIBWRAP_LDFLAGS="-lwrap"

           AC_SUBST([LIBWRAP_CFLAGS])
           AC_SUBST([LIBWRAP_LDFLAGS])

           dnl ACTION-IF-FOUND
           $2

        ]) dnl AC_ARG_ENABLE

]) dnl AC_DEFUN