s4:lib/tevent: add lib/events/ compat and let things compile
[metze/samba/wip.git] / lib / tevent / libtevent.m4
1 dnl find the tevent sources. This is meant to work both for
2 dnl standalone builds, and builds of packages using libtevent
3 if test x"$teventdir" = "x"; then
4         teventdir=""
5         teventpaths="$srcdir $srcdir/../lib/tevent $srcdir/tevent $srcdir/../tevent"
6         for d in $teventpaths; do
7                 if test -f "$d/tevent.c"; then
8                         teventdir="$d"
9                         AC_SUBST(teventdir)
10                         break;
11                 fi
12         done
13         if test x"$teventdir" = "x"; then
14            AC_MSG_ERROR([cannot find libtevent source in $teventpaths])
15         fi
16 fi
17
18 TEVENT_OBJ="tevent.o tevent_select.o tevent_signal.o tevent_timed.o tevent_standard.o tevent_debug.o tevent_util.o"
19 AC_LIBREPLACE_NETWORK_CHECKS
20
21 SMB_ENABLE(TEVENT_EPOLL, NO)
22 SMB_ENABLE(TEVENT_AIO, NO)
23 AC_CHECK_HEADERS(sys/epoll.h)
24 AC_CHECK_FUNCS(epoll_create)
25 if test x"$ac_cv_header_sys_epoll_h" = x"yes" -a x"$ac_cv_func_epoll_create" = x"yes"; then
26    TEVENT_OBJ="$TEVENT_OBJ tevent_epoll.o"
27    SMB_ENABLE(TEVENT_EPOLL,YES)
28    AC_DEFINE(HAVE_EPOLL, 1, [Whether epoll available])
29    #TODO: remove HAVE_EVENTS_EPOLL and use HAVE_EPOLL
30    AC_DEFINE(HAVE_EVENTS_EPOLL, 1, [Whether epoll available])
31
32    # check for native Linux AIO interface
33    AC_CHECK_HEADERS(libaio.h)
34    AC_CHECK_LIB_EXT(aio, AIO_LIBS, io_getevents)
35    if test x"$ac_cv_header_libaio_h" = x"yes" -a x"$ac_cv_lib_ext_aio_io_getevents" = x"yes";then
36       TEVENT_OBJ="$TEVENT_OBJ tevent_aio.o"
37       SMB_ENABLE(TEVENT_AIO,YES)
38       AC_DEFINE(HAVE_LINUX_AIO, 1, [Whether Linux AIO is available])
39    fi
40 fi
41
42 AC_SUBST(TEVENT_OBJ)
43 SMB_EXT_LIB(LIBAIO_LINUX, $AIO_LIBS)
44
45 TEVENT_CFLAGS="-I$teventdir"
46 AC_SUBST(TEVENT_CFLAGS)
47
48 TEVENT_LIBS="$AIO_LIBS"
49 AC_SUBST(TEVENT_LIBS)
50
51