Merge branch 'master' of ssh://jra@git.samba.org/data/git/samba
[tprouty/samba.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
30    # check for native Linux AIO interface
31    AC_CHECK_HEADERS(libaio.h)
32    AC_CHECK_LIB_EXT(aio, AIO_LIBS, io_getevents)
33    if test x"$ac_cv_header_libaio_h" = x"yes" -a x"$ac_cv_lib_ext_aio_io_getevents" = x"yes";then
34       TEVENT_OBJ="$TEVENT_OBJ tevent_aio.o"
35       SMB_ENABLE(TEVENT_AIO,YES)
36       AC_DEFINE(HAVE_LINUX_AIO, 1, [Whether Linux AIO is available])
37    fi
38 fi
39
40 AC_SUBST(TEVENT_OBJ)
41 SMB_EXT_LIB(LIBAIO_LINUX, $AIO_LIBS)
42
43 TEVENT_CFLAGS="-I$teventdir"
44 AC_SUBST(TEVENT_CFLAGS)
45
46 TEVENT_LIBS="$AIO_LIBS"
47 AC_SUBST(TEVENT_LIBS)
48
49