

set(LIBEV_VERSION 4.33)

set(CMAKE_REQUIRED_LIBRARIES m)

check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME)
check_symbol_exists(SYS_clock_gettime "syscall.h" HAVE_CLOCK_SYSCALL)
find_path(HAVE_DLFCN_H dlfcn.h)
check_symbol_exists(epoll_ctl "sys/epoll.h" HAVE_EPOLL_CTL)
check_symbol_exists(eventfd "sys/eventfd.h" HAVE_EVENTFD)
check_symbol_exists(floor "math.h" HAVE_FLOOR)
check_symbol_exists(inotify_init "sys/inotify.h" HAVE_INOTIFY_INI)
find_path(HAVE_INTTYPES_H inttypes.h)
check_symbol_exists(kernel_rwf_t "linux/fs.h" HAVE_KERNEL_RWF_T)
check_symbol_exists(kqueue "sys/event.h" HAVE_KQUEUE)
find_library(HAVE_LIBRT rt)
find_path(HAVE_LINUX_AIO_ABI_H linux/aio_abi.h)
find_path(HAVE_LINUX_FS_H linux/fs.h)
find_path(HAVE_MEMORY_H memory.h)
check_symbol_exists(nanosleep "time.h" HAVE_NANOSLEEP)
check_symbol_exists(poll "poll.h" HAVE_POLL)
find_path(HAVE_POLL_H poll.h)
check_symbol_exists(port_create "port.h" HAVE_PORT_CREATE)
find_path(HAVE_PORT_H port.h)
check_symbol_exists(select "sys/select.h" HAVE_SELECT)
check_symbol_exists(signalfd "sys/signalfd.h" HAVE_SIGNALFD)
find_path(HAVE_STDINT_H stdint.h)
find_path(HAVE_STDLIB_H stdlib.h)
find_path(HAVE_STRINGS_H strings.h)
find_path(HAVE_STRING_H string.h)
find_path(HAVE_SYS_EPOLL_H sys/epoll.h)
find_path(HAVE_SYS_EVENTFD_H sys/eventfd.h)
find_path(HAVE_SYS_EVENT_H sys/event.h)
find_path(HAVE_SYS_INOTIFY_H sys/inotify.h)
find_path(HAVE_SYS_SELECT_H sys/select.h)
find_path(HAVE_SYS_SIGNALFD_H sys/signalfd.h)
find_path(HAVE_SYS_STAT_H sys/stat.h)
find_path(HAVE_SYS_TIMERFD_H sys/timerfd.h)
find_path(HAVE_SYS_TYPES_H sys/types.h)
find_path(HAVE_UNISTD_H unistd.h)

configure_file(deps/libev/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/deps/libev/config.h)
