xref: /libev/libev.m4 (revision 93823e6c)
1e3a38431SPaul Bohmdnl this file is part of libev, do not make local modifications
2e3a38431SPaul Bohmdnl http://software.schmorp.de/pkg/libev
3e3a38431SPaul Bohm
4e3a38431SPaul Bohmdnl libev support
5e3a38431SPaul BohmAC_CHECK_HEADERS(sys/inotify.h sys/epoll.h sys/event.h port.h poll.h sys/select.h sys/eventfd.h sys/signalfd.h)
6e3a38431SPaul Bohm
7e3a38431SPaul BohmAC_CHECK_FUNCS(inotify_init epoll_ctl kqueue port_create poll select eventfd signalfd)
8e3a38431SPaul Bohm
9e3a38431SPaul BohmAC_CHECK_FUNCS(clock_gettime, [], [
10e3a38431SPaul Bohm   dnl on linux, try syscall wrapper first
11e3a38431SPaul Bohm   if test $(uname) = Linux; then
12e3a38431SPaul Bohm      AC_MSG_CHECKING(for clock_gettime syscall)
13e3a38431SPaul Bohm      AC_LINK_IFELSE([AC_LANG_PROGRAM(
14e3a38431SPaul Bohm                      [#include <unistd.h>
15e3a38431SPaul Bohm                       #include <sys/syscall.h>
16e3a38431SPaul Bohm                       #include <time.h>],
17e3a38431SPaul Bohm                      [struct timespec ts; int status = syscall (SYS_clock_gettime, CLOCK_REALTIME, &ts)])],
18e3a38431SPaul Bohm                     [ac_have_clock_syscall=1
19*93823e6cSPaul Bohm                      AC_DEFINE(HAVE_CLOCK_SYSCALL, 1, Define to 1 to use the syscall interface for clock_gettime)
20e3a38431SPaul Bohm                      AC_MSG_RESULT(yes)],
21e3a38431SPaul Bohm                     [AC_MSG_RESULT(no)])
22e3a38431SPaul Bohm   fi
23e3a38431SPaul Bohm   if test -z "$LIBEV_M4_AVOID_LIBRT" && test -z "$ac_have_clock_syscall"; then
24e3a38431SPaul Bohm      AC_CHECK_LIB(rt, clock_gettime)
25e3a38431SPaul Bohm      unset ac_cv_func_clock_gettime
26e3a38431SPaul Bohm      AC_CHECK_FUNCS(clock_gettime)
27e3a38431SPaul Bohm   fi
28e3a38431SPaul Bohm])
29e3a38431SPaul Bohm
30e3a38431SPaul BohmAC_CHECK_FUNCS(nanosleep, [], [
31e3a38431SPaul Bohm   if test -z "$LIBEV_M4_AVOID_LIBRT"; then
32e3a38431SPaul Bohm      AC_CHECK_LIB(rt, nanosleep)
33e3a38431SPaul Bohm      unset ac_cv_func_nanosleep
34e3a38431SPaul Bohm      AC_CHECK_FUNCS(nanosleep)
35e3a38431SPaul Bohm   fi
36e3a38431SPaul Bohm])
37e3a38431SPaul Bohm
38*93823e6cSPaul Bohmif test -z "$LIBEV_M4_AVOID_LIBM"; then
39*93823e6cSPaul Bohm   LIBM=m
40*93823e6cSPaul Bohmfi
41*93823e6cSPaul BohmAC_SEARCH_LIBS(floor, $LIBM, [AC_DEFINE(HAVE_FLOOR, 1, Define to 1 if the floor function is available)])
42e3a38431SPaul Bohm
43