]> arthur.barton.de Git - netatalk.git/blobdiff - macros/tcp-wrappers.m4
Merge 2-1
[netatalk.git] / macros / tcp-wrappers.m4
index 50a0ac2e1e483424b2721d05e72fcb21635a97e8..d770f049d1ea58ef1a0ed7e1481aae68bc562648 100644 (file)
@@ -1,4 +1,4 @@
-dnl $Id: tcp-wrappers.m4,v 1.2 2004-01-14 16:10:29 bfernhomberg Exp $
+dnl $Id: tcp-wrappers.m4,v 1.4 2008-08-11 20:44:03 didg Exp $
 
 AC_DEFUN([NETATALK_TCP_WRAPPERS], [
        check=maybe
@@ -6,25 +6,42 @@ AC_DEFUN([NETATALK_TCP_WRAPPERS], [
                [  --disable-tcp-wrappers  disable TCP wrappers support],
                [
                        if test "x$enableval" = "xno"; then
-                               check=no
+                               wrapcheck=no
                        else
-                               check=yes
+                               wrapcheck=yes
                        fi
                ]
        )
 
        enable=no
-       if test "x$check" != "xno"; then
-               AC_CHECK_LIB(wrap, tcpd_warn, enable=yes)
+       netatalk_cv_tcpwrap=no
+       if test "x$wrapcheck" != "xno"; then
+               saved_LIBS=$LIBS
+               W_LIBS="-lwrap" 
+               LIBS="$LIBS $W_LIBS"
+               AC_TRY_LINK([ int allow_severity = 0; int deny_severity = 0;]
+                       ,[hosts_access();]
+                       , netatalk_cv_tcpwrap=yes , 
+                       [
+                               LIBS=$saved_LIBS
+                               W_LIBS="-lwrap -lnsl" 
+                               LIBS="$LIBS $W_LIBS"
+                               AC_TRY_LINK([ int allow_severity = 0; int deny_severity = 0;]
+                                       ,[hosts_access();]
+                                       , netatalk_cv_tcpwrap=yes , netatalk_cv_tcpwrap=no)
+                       ]
+                       , netatalk_cv_tcpwrap=cross)
+
+               LIBS=$saved_LIBS
        fi
 
        AC_MSG_CHECKING([whether to enable the TCP wrappers])
-       if test "x$enable" = "xyes"; then
+       if test "x$netatalk_cv_tcpwrap" = "xyes"; then
                AC_DEFINE(TCPWRAP, 1, [Define if TCP wrappers should be used])
-               WRAP_LIBS="-lwrap"
+               WRAP_LIBS=$W_LIBS
                AC_MSG_RESULT([yes])
        else
-               if test "x$check" = "xyes"; then
+               if test "x$wrapcheck" = "xyes"; then
                        AC_MSG_ERROR([libwrap not found])
                else
                        AC_MSG_RESULT([no])