xref: /netbsd-src/external/bsd/am-utils/dist/m4/macros/check_libwrap_severity.m4 (revision a53f50b9b44dc9467ccc9c464999b1d1c509cb0c)
1*a53f50b9Schristosdnl ######################################################################
2*a53f50b9Schristosdnl check if libwrap (if exists), requires the caller to define the variables
3*a53f50b9Schristosdnl deny_severity and allow_severity.
4*a53f50b9SchristosAC_DEFUN([AMU_CHECK_LIBWRAP_SEVERITY],
5*a53f50b9Schristos[
6*a53f50b9SchristosAC_CACHE_CHECK([if libwrap wants caller to define allow_severity and deny_severity], ac_cv_need_libwrap_severity_vars, [
7*a53f50b9Schristos# save, then reset $LIBS back to original value
8*a53f50b9SchristosSAVEDLIBS="$LIBS"
9*a53f50b9SchristosLIBS="$LIBS -lwrap"
10*a53f50b9Schristos# run program one without defining our own severity variables
11*a53f50b9SchristosAC_TRY_RUN(
12*a53f50b9Schristos[
13*a53f50b9Schristosint main()
14*a53f50b9Schristos{
15*a53f50b9Schristos   exit(0);
16*a53f50b9Schristos}
17*a53f50b9Schristos],[ac_tmp_val1="yes"],[ac_tmp_val1="no"])
18*a53f50b9Schristos# run program two with defining our own severity variables
19*a53f50b9SchristosAC_TRY_RUN(
20*a53f50b9Schristos[
21*a53f50b9Schristosint deny_severity, allow_severity, rfc931_timeout;
22*a53f50b9Schristosint main()
23*a53f50b9Schristos{
24*a53f50b9Schristos   exit(0);
25*a53f50b9Schristos}
26*a53f50b9Schristos],[ac_tmp_val2="yes"],[ac_tmp_val2="no"])
27*a53f50b9Schristos# restore original value of $LIBS
28*a53f50b9SchristosLIBS="$SAVEDLIBS"
29*a53f50b9Schristos# now decide what to do
30*a53f50b9Schristosif test "$ac_tmp_val1" = "no" && test "$ac_tmp_val2" = "yes"
31*a53f50b9Schristosthen
32*a53f50b9Schristos	ac_cv_need_libwrap_severity_vars="yes"
33*a53f50b9Schristoselse
34*a53f50b9Schristos	ac_cv_need_libwrap_severity_vars="no"
35*a53f50b9Schristosfi
36*a53f50b9Schristos])
37*a53f50b9Schristosif test "$ac_cv_need_libwrap_severity_vars" = "yes"
38*a53f50b9Schristosthen
39*a53f50b9Schristos	AC_DEFINE(NEED_LIBWRAP_SEVERITY_VARIABLES)
40*a53f50b9Schristosfi
41*a53f50b9Schristos])
42