-AC_CHECK_DECLS([freeaddrinfo, gai_strerror, getaddrinfo, getnameinfo],
- [], [], [#include "src/have.h"]
-)
+dnl Operating system specific checks
+case $host_os in
+ *linux*)
+ AC_CHECK_HEADERS([linux/if_tun.h],
+ [], [AC_MSG_ERROR([Required header file missng])], [#include "$srcdir/src/have.h"]
+ )
+ ;;
+ *bsd*|*dragonfly*|*darwin*)
+ AC_CHECK_HEADERS([net/if_tun.h net/if_utun.h net/tun/if_tun.h net/if_tap.h net/tap/if_tap.h],
+ [], [], [#include "$srcdir/src/have.h"]
+ )
+ ;;
+ *solaris*)
+ AC_CHECK_FUNC(socket, [], [AC_CHECK_LIB(socket, connect)])
+ ;;
+ *)
+ ;;
+esac