+AC_CHECK_FUNCS([epoll_ctl eventfd kevent kevent64 kqueue poll])
+
+# event-related fun
+
+if test "$ac_cv_header_sys_epoll_h" = yes -a "$ac_cv_func_epoll_ctl" = yes; then
+ AC_DEFINE([HAVE_EPOLL], [1], [Define if you have epoll support.])
+fi
+
+if test "$ac_cv_header_sys_event_h" = yes -a "$ac_cv_func_kqueue" = yes; then
+ AC_DEFINE([HAVE_KQUEUE], [1], [Define if you have kqueue support.])
+fi
+
+if test "$ac_cv_header_poll_h" = yes -a "$ac_cv_func_poll" = yes; then
+ AC_DEFINE([HAVE_POLL], [1], [Define if you have poll support.])
+fi
+
+dnl--------------------------------------------------------------------
+dnl * Deal with arguments telling us iconv is somewhere odd
+dnl--------------------------------------------------------------------
+
+AC_ARG_WITH([iconv-includes],
+ [AC_HELP_STRING([--with-iconv-includes],
+ [directory containing iconv.h])],
+ [ICONV_INCLUDE_DIRS=$withval; CPPFLAGS="-I$withval"],
+ [ICONV_INCLUDE_DIRS=])
+
+AC_ARG_WITH([iconv-libraries],
+ [AC_HELP_STRING([--with-iconv-libraries],
+ [directory containing iconv library])],
+ [ICONV_LIB_DIRS=$withval; LDFLAGS="-L$withval"],
+ [ICONV_LIB_DIRS=])
+
+AC_SUBST(ICONV_INCLUDE_DIRS)
+AC_SUBST(ICONV_LIB_DIRS)
+