blob: d363c3dbc8c32f55396f9b11ea8c4585de1b0d4a (
plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
SET(LIBEVSRC ev.c)
CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILES(sys/inotify.h HAVE_SYS_INOTIFY_H)
CHECK_INCLUDE_FILES(sys/epoll.h HAVE_SYS_EPOLL_H)
CHECK_INCLUDE_FILES(sys/event.h HAVE_SYS_EVENT_H)
CHECK_INCLUDE_FILES(sys/queue.h HAVE_SYS_QUEUE_H)
CHECK_INCLUDE_FILES(sys/stat.h HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILES(sys/signalfd.h HAVE_SYS_SIGNALFD_H)
CHECK_INCLUDE_FILES(port.h HAVE_PORT_H)
CHECK_INCLUDE_FILES(poll.h HAVE_POLL_H)
CHECK_INCLUDE_FILES(sys/select.h HAVE_SYS_SELECT_H)
CHECK_INCLUDE_FILES(sys/eventfd.h HAVE_SYS_EVENTFD_H)
IF(HAVE_SYS_INOTIFY_H)
CHECK_SYMBOL_EXISTS(inotify_init "sys/types.h;sys/inotify.h" HAVE_INOTIFY_INIT)
ENDIF()
IF(HAVE_SYS_EPOLL_H)
CHECK_SYMBOL_EXISTS(epoll_ctl "sys/types.h;sys/epoll.h" HAVE_EPOLL_CTL)
ENDIF()
IF(HAVE_SYS_EVENT_H)
CHECK_SYMBOL_EXISTS(kqueue "sys/types.h;sys/event.h;sys/time.h" HAVE_KQUEUE)
ENDIF()
IF(HAVE_PORT_H)
CHECK_SYMBOL_EXISTS(port_create port.h HAVE_PORT_CREATE)
ENDIF()
IF(HAVE_POLL_H)
CHECK_SYMBOL_EXISTS(poll poll.h HAVE_POLL)
ENDIF()
IF(HAVE_SYS_SELECT_H)
CHECK_SYMBOL_EXISTS(select sys/select.h HAVE_SELECT)
ENDIF()
IF(HAVE_SYS_EVENTFD_H)
CHECK_SYMBOL_EXISTS(eventfd sys/eventfd.h HAVE_EVENTFD)
ENDIF()
IF(HAVE_SYS_SIGNALFD_H)
CHECK_SYMBOL_EXISTS(signalfd sys/signalfd.h HAVE_EVENTFD)
ENDIF()
CHECK_SYMBOL_EXISTS(time.h nanosleep HAVE_NANOSLEEP)
# check first without rt
CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME)
CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_LIBRT)
# then check with rt
CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_CLOCK_GETTIME)
CHECK_LIBRARY_EXISTS(m ceil "" HAVE_LIBM)
IF(ENABLE_FULL_DEBUG MATCHES "OFF")
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
endif ()
ENDIF()
CONFIGURE_FILE(config.h.in libev-config.h)
ADD_LIBRARY(rspamd-ev STATIC ${LIBEVSRC})
ADD_DEFINITIONS("-DEV_CONFIG_H=\"${CMAKE_CURRENT_BINARY_DIR}/libev-config.h\""
-DEV_MULTIPLICITY=1
-DEV_USE_FLOOR=1
-DEV_NO_THREADS=1 # We do not have threads in Rspamd!
-DEV_FEATURES=127 # Enable all features
)
IF(HAVE_EVENTFD)
ADD_DEFINITIONS(-DEV_USE_EVENTFD=1)
ENDIF()
IF(ENABLE_FULL_DEBUG MATCHES "ON")
ADD_DEFINITIONS(-DEV_VERIFY=3)
ENDIF()
|