File: ioloop.m4

package info (click to toggle)
dovecot 1%3A2.4.1%2Bdfsg1-6
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 46,224 kB
  • sloc: ansic: 596,204; makefile: 7,825; sh: 6,005; cpp: 1,866; perl: 487; yacc: 412; lex: 320; python: 253; xml: 232
file content (54 lines) | stat: -rw-r--r-- 1,624 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
dnl * I/O loop function
AC_DEFUN([DOVECOT_IOLOOP], [
  have_ioloop=no
  
  AS_IF([test "$ioloop" = "best" || test "$ioloop" = "epoll"], [
    AC_CACHE_CHECK([whether we can use epoll],i_cv_epoll_works,[
      AC_RUN_IFELSE([AC_LANG_PROGRAM([[
        #include <sys/epoll.h>
      ]], [[
        return epoll_create(5) < 1;
      ]])],[
        i_cv_epoll_works=yes
      ], [
        i_cv_epoll_works=no
      ],[])
    ])
    AS_IF([test $i_cv_epoll_works = yes], [
      AC_DEFINE(IOLOOP_EPOLL,, [Implement I/O loop with Linux 2.6 epoll()])
      have_ioloop=yes
      ioloop=epoll
    ], [
      AS_IF([test "$ioloop" = "epoll"], [
        AC_MSG_ERROR([epoll ioloop requested but epoll_create() is not available])
      ])
    ])
  ])
  
  AS_IF([test "$ioloop" = "best" || test "$ioloop" = "kqueue"], [
      AS_IF([test "$ac_cv_func_kqueue" = yes && test "$ac_cv_func_kevent" = yes], [
        AC_DEFINE(IOLOOP_KQUEUE,, [Implement I/O loop with BSD kqueue()])
        ioloop=kqueue
        have_ioloop=yes
      ], [test "$ioloop" = "kqueue"], [
        AC_MSG_ERROR([kqueue ioloop requested but kqueue() is not available])
      ])
  ])
  
  AS_IF([test "$ioloop" = "best" || test "$ioloop" = "poll"], [
    AC_CHECK_FUNC(poll, [
      AC_DEFINE(IOLOOP_POLL,, [Implement I/O loop with poll()])
      ioloop=poll
      have_ioloop=yes
    ], [
      AS_IF([test "$ioloop" = "poll"], [
        AC_MSG_ERROR([pool ioloop requested but poll() is not available])
      ])
     ])
  ])
  
  AS_IF([test "$have_ioloop" = "no"], [
    AC_DEFINE(IOLOOP_SELECT,, [Implement I/O loop with select()])
    ioloop="select"
  ])
])