cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomidnl * I/O loop function
cca227d2929386ee11e4aa23464681ef35eb9679Aki TuomiAC_DEFUN([DOVECOT_IOLOOP], [
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi have_ioloop=no
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi if test "$ioloop" = "best" || test "$ioloop" = "epoll"; then
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi AC_CACHE_CHECK([whether we can use epoll],i_cv_epoll_works,[
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi AC_TRY_RUN([
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi return epoll_create(5) < 1;
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi i_cv_epoll_works=yes
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi i_cv_epoll_works=no
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi if test $i_cv_epoll_works = yes; then
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi AC_DEFINE(IOLOOP_EPOLL,, [Implement I/O loop with Linux 2.6 epoll()])
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi have_ioloop=yes
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi ioloop=epoll
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi if test "$ioloop" = "epoll" ; then
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi AC_MSG_ERROR([epoll ioloop requested but epoll_create() is not available])
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi if test "$ioloop" = "best" || test "$ioloop" = "kqueue"; then
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi if test "$ac_cv_func_kqueue" = yes && test "$ac_cv_func_kevent" = yes; then
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi AC_DEFINE(IOLOOP_KQUEUE,, [Implement I/O loop with BSD kqueue()])
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi ioloop=kqueue
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi have_ioloop=yes
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi elif test "$ioloop" = "kqueue"; then
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi AC_MSG_ERROR([kqueue ioloop requested but kqueue() is not available])
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi if test "$ioloop" = "best" || test "$ioloop" = "poll"; then
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi AC_CHECK_FUNC(poll, [
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi AC_DEFINE(IOLOOP_POLL,, [Implement I/O loop with poll()])
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi have_ioloop=yes
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi if test "$have_ioloop" = "no"; then
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi AC_DEFINE(IOLOOP_SELECT,, [Implement I/O loop with select()])
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi ioloop="select"