Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / external / bsd / am-utils / dist / m4 / macros / check_libwrap_severity.m4
blob955ba55ab9d02dab1380fa6ddf418e174489f8d0
1 dnl ######################################################################
2 dnl check if libwrap (if exists), requires the caller to define the variables
3 dnl deny_severity and allow_severity.
4 AC_DEFUN([AMU_CHECK_LIBWRAP_SEVERITY],
6 AC_CACHE_CHECK([if libwrap wants caller to define allow_severity and deny_severity], ac_cv_need_libwrap_severity_vars, [
7 # save, then reset $LIBS back to original value
8 SAVEDLIBS="$LIBS"
9 LIBS="$LIBS -lwrap"
10 # run program one without defining our own severity variables
11 AC_TRY_RUN(
13 int main()
15    exit(0);
17 ],[ac_tmp_val1="yes"],[ac_tmp_val1="no"])
18 # run program two with defining our own severity variables
19 AC_TRY_RUN(
21 int deny_severity, allow_severity, rfc931_timeout;
22 int main()
24    exit(0);
26 ],[ac_tmp_val2="yes"],[ac_tmp_val2="no"])
27 # restore original value of $LIBS
28 LIBS="$SAVEDLIBS"
29 # now decide what to do
30 if test "$ac_tmp_val1" = "no" && test "$ac_tmp_val2" = "yes"
31 then
32         ac_cv_need_libwrap_severity_vars="yes"
33 else
34         ac_cv_need_libwrap_severity_vars="no"
37 if test "$ac_cv_need_libwrap_severity_vars" = "yes"
38 then
39         AC_DEFINE(NEED_LIBWRAP_SEVERITY_VARIABLES)