aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-06-22 17:39:03 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-06-22 17:39:03 +0400
commite9d2ad6a1b942cb5bbba9a268cc7e0108a0145ea (patch)
treea22232f181b0b6e0af3056869c666578fa30c0c0 /CMakeLists.txt
parentd81433607b87acf08bab4ccb5a01f1c992dfb8bb (diff)
downloadrspamd-e9d2ad6a1b942cb5bbba9a268cc7e0108a0145ea.tar.gz
rspamd-e9d2ad6a1b942cb5bbba9a268cc7e0108a0145ea.zip
* Rewrite buffered input for line policy (again)
* Fix issue with links that are ip addresses in numeric form in surbl * On Darwin use BSD style sendfile definition * Reorganize platform specific knobs in CMakeLists * Use gettimeofday on systems that have not clock_getres * Use ftime for dns trans id generation on systems without clock_getres
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt111
1 files changed, 52 insertions, 59 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 805c5cf80..7be021fca 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,6 +38,47 @@ INCLUDE(FindPkgConfig)
INCLUDE(CheckCCompilerFlag)
INCLUDE(FindPerl)
+# Initial set
+SET(CMAKE_REQUIRED_LIBRARIES m)
+SET(CMAKE_REQUIRED_INCLUDES sys/mman.h stdlib.h stdio.h unistd.h time.h sched.h)
+
+# Platform specific routines
+IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_BSD_SOURCE -DFREEBSD")
+ CONFIGURE_FILE(freebsd/rspamd.sh.in freebsd/rspamd.sh @ONLY)
+
+ IF(ENABLE_REDIRECTOR MATCHES "ON")
+ CONFIGURE_FILE(freebsd/redirector.sh.in freebsd/redirector.sh @ONLY)
+ ENDIF(ENABLE_REDIRECTOR MATCHES "ON")
+ IF(NOT ETC_PREFIX)
+ SET(ETC_PREFIX /usr/local/etc)
+ SET(PREFIX /usr/local)
+ ENDIF(NOT ETC_PREFIX)
+ LIST(APPEND CMAKE_REQUIRED_LIBRARIES intl)
+
+ENDIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+
+IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_BSD_SOURCE -DDARWIN")
+
+ IF(NOT ETC_PREFIX)
+ SET(ETC_PREFIX /usr/local/etc)
+ SET(PREFIX /usr/local)
+ ENDIF(NOT ETC_PREFIX)
+ LIST(APPEND CMAKE_REQUIRED_LIBRARIES intl)
+
+ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+
+IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE -DLINUX")
+ IF(NOT ETC_PREFIX)
+ SET(ETC_PREFIX /etc)
+ SET(PREFIX /usr)
+ ENDIF(NOT ETC_PREFIX)
+ LIST(APPEND CMAKE_REQUIRED_LIBRARIES rt)
+ LIST(APPEND CMAKE_REQUIRED_LIBRARIES dl)
+ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+
IF(ENABLE_PERL MATCHES "ON")
IF(NOT PERL_EXECUTABLE)
@@ -145,8 +186,6 @@ ENDIF(ENABLE_STATIC MATCHES "ON")
INCLUDE_DIRECTORIES(${GLIB2_INCLUDE_DIRS})
LINK_DIRECTORIES(${GLIB2_LIBRARY_DIRS})
-SET(CMAKE_REQUIRED_LIBRARIES m)
-SET(CMAKE_REQUIRED_INCLUDES sys/mman.h stdlib.h stdio.h unistd.h time.h sched.h)
# Check for libevent
@@ -278,6 +317,9 @@ CHECK_INCLUDE_FILES(sys/sendfile.h HAVE_SYS_SENDFILE_H)
IF(HAVE_SYS_WAIT_H)
LIST(APPEND CMAKE_REQUIRED_INCLUDES sys/wait.h)
ENDIF(HAVE_SYS_WAIT_H)
+IF(HAVE_TIME_H)
+ LIST(APPEND CMAKE_REQUIRED_INCLUDES time.h)
+ENDIF(HAVE_TIME_H)
CHECK_FUNCTION_EXISTS(setproctitle HAVE_SETPROCTITLE)
CHECK_FUNCTION_EXISTS(getpagesize HAVE_GETPAGESIZE)
@@ -289,6 +331,7 @@ CHECK_FUNCTION_EXISTS(flock HAVE_FLOCK)
CHECK_FUNCTION_EXISTS(tanhl HAVE_TANHL)
CHECK_FUNCTION_EXISTS(sendfile HAVE_SENDFILE)
CHECK_FUNCTION_EXISTS(mkstemp HAVE_MKSTEMP)
+CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME)
CHECK_SYMBOL_EXISTS(PATH_MAX limits.h HAVE_PATH_MAX)
CHECK_SYMBOL_EXISTS(MAXPATHLEN sys/param.h HAVE_MAXPATHLEN)
@@ -296,9 +339,14 @@ CHECK_SYMBOL_EXISTS(MAP_SHARED sys/mman.h HAVE_MMAP_SHARED)
CHECK_SYMBOL_EXISTS(MAP_ANON sys/mman.h HAVE_MMAP_ANON)
CHECK_SYMBOL_EXISTS(MAP_NOCORE sys/mman.h HAVE_MMAP_NOCORE)
CHECK_SYMBOL_EXISTS(_SC_NPROCESSORS_ONLN unistd.h HAVE_SC_NPROCESSORS_ONLN)
-CHECK_SYMBOL_EXISTS(CLOCK_PROCESS_CPUTIME_ID time.h HAVE_CLOCK_PROCESS_CPUTIME_ID)
CHECK_SYMBOL_EXISTS(SA_SIGINFO signal.h HAVE_SA_SIGINFO)
-CHECK_SYMBOL_EXISTS(CLOCK_VIRTUAL time.h HAVE_CLOCK_VIRTUAL)
+
+IF(HAVE_CLOCK_GETTIME)
+ CHECK_SYMBOL_EXISTS(CLOCK_PROCESS_CPUTIME_ID time.h HAVE_CLOCK_PROCESS_CPUTIME_ID)
+ CHECK_SYMBOL_EXISTS(CLOCK_VIRTUAL time.h HAVE_CLOCK_VIRTUAL)
+ELSE(HAVE_CLOCK_GETTIME)
+ CHECK_INCLUDE_FILES(sys/timeb.h HAVE_SYS_TIMEDB_H)
+ENDIF(HAVE_CLOCK_GETTIME)
CHECK_C_SOURCE_COMPILES ("#include <sys/types.h>
int main (int argc, char **argv) {
@@ -358,28 +406,6 @@ ENDIF(SUPPORT_WPOINTER_SIGN)
SET(CMAKE_C_FLAGS "${CMAKE_C_OPT_FLAGS} ${CMAKE_C_FLAGS} ${CMAKE_C_WARN_FLAGS}")
-# Platform specific routines
-IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_BSD_SOURCE -DFREEBSD")
- CONFIGURE_FILE(freebsd/rspamd.sh.in freebsd/rspamd.sh @ONLY)
-
- IF(ENABLE_REDIRECTOR MATCHES "ON")
- CONFIGURE_FILE(freebsd/redirector.sh.in freebsd/redirector.sh @ONLY)
- ENDIF(ENABLE_REDIRECTOR MATCHES "ON")
- IF(NOT ETC_PREFIX)
- SET(ETC_PREFIX /usr/local/etc)
- SET(PREFIX /usr/local)
- ENDIF(NOT ETC_PREFIX)
-
-ENDIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
-
-IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE -DLINUX")
- IF(NOT ETC_PREFIX)
- SET(ETC_PREFIX /etc)
- SET(PREFIX /usr)
- ENDIF(NOT ETC_PREFIX)
-ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
IF(ENABLE_REDIRECTOR MATCHES "ON")
CONFIGURE_FILE(utils/redirector.pl.in utils/redirector.pl @ONLY)
@@ -538,10 +564,6 @@ ENDIF(PERL_EXECUTABLE)
TARGET_LINK_LIBRARIES(rspamd rspamd_lua)
TARGET_LINK_LIBRARIES(rspamd "${LUA_LIBRARY}")
-TARGET_LINK_LIBRARIES(rspamd m)
-IF(LIBUTIL_LIBRARY)
- TARGET_LINK_LIBRARIES(rspamd util)
-ENDIF(LIBUTIL_LIBRARY)
IF(LIBJUDY_LIBRARY)
TARGET_LINK_LIBRARIES(rspamd Judy)
ENDIF(LIBJUDY_LIBRARY)
@@ -557,12 +579,6 @@ ENDIF(GMIME2_FOUND)
IF(ENABLE_STATIC MATCHES "ON")
TARGET_LINK_LIBRARIES(rspamd ${PCRE_LIBRARIES})
ENDIF(ENABLE_STATIC MATCHES "ON")
-IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
- TARGET_LINK_LIBRARIES(rspamd rt)
- TARGET_LINK_LIBRARIES(rspamd dl)
-ELSE(CMAKE_SYSTEM_NAME STREQUAL "Linux")
- TARGET_LINK_LIBRARIES(rspamd intl)
-ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
IF(ENABLE_GPERF_TOOLS MATCHES "ON")
TARGET_LINK_LIBRARIES(rspamd profiler)
@@ -570,10 +586,6 @@ ENDIF(ENABLE_GPERF_TOOLS MATCHES "ON")
ADD_EXECUTABLE(test/rspamd-test ${TESTDEPENDS} ${CONTRIBSRC} ${TESTSRC})
SET_TARGET_PROPERTIES(test/rspamd-test PROPERTIES LINKER_LANGUAGE C)
-TARGET_LINK_LIBRARIES(test/rspamd-test m)
-IF(LIBUTIL_LIBRARY)
- TARGET_LINK_LIBRARIES(test/rspamd-test util)
-ENDIF(LIBUTIL_LIBRARY)
TARGET_LINK_LIBRARIES(test/rspamd-test event)
TARGET_LINK_LIBRARIES(test/rspamd-test ${GLIB2_LIBRARIES})
IF(GMIME2_FOUND)
@@ -584,18 +596,9 @@ ENDIF(GMIME2_FOUND)
IF(ENABLE_STATIC MATCHES "ON")
TARGET_LINK_LIBRARIES(test/rspamd-test ${PCRE_LIBRARIES})
ENDIF(ENABLE_STATIC MATCHES "ON")
-IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
- TARGET_LINK_LIBRARIES(test/rspamd-test rt)
-ELSE(CMAKE_SYSTEM_NAME STREQUAL "Linux")
- TARGET_LINK_LIBRARIES(test/rspamd-test intl)
-ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
ADD_EXECUTABLE(utils/url-extracter ${UTILSDEPENDS} ${CONTRIBSRC} ${UTILSSRC})
SET_TARGET_PROPERTIES(utils/url-extracter PROPERTIES LINKER_LANGUAGE C)
-TARGET_LINK_LIBRARIES(utils/url-extracter m)
-IF(LIBUTIL_LIBRARY)
- TARGET_LINK_LIBRARIES(utils/url-extracter util)
-ENDIF(LIBUTIL_LIBRARY)
TARGET_LINK_LIBRARIES(utils/url-extracter ${GLIB2_LIBRARIES})
IF(GMIME2_FOUND)
TARGET_LINK_LIBRARIES(utils/url-extracter ${GMIME2_LIBRARIES})
@@ -605,11 +608,6 @@ ENDIF(GMIME2_FOUND)
IF(ENABLE_STATIC MATCHES "ON")
TARGET_LINK_LIBRARIES(utils/url-extracter ${PCRE_LIBRARIES})
ENDIF(ENABLE_STATIC MATCHES "ON")
-IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
- TARGET_LINK_LIBRARIES(utils/url-extracter rt)
-ELSE(CMAKE_SYSTEM_NAME STREQUAL "Linux")
- TARGET_LINK_LIBRARIES(utils/url-extracter intl)
-ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
ADD_EXECUTABLE(utils/expression-parser ${UTILSDEPENDS} ${CONTRIBSRC} ${EXPRSRC})
SET_TARGET_PROPERTIES(utils/expression-parser PROPERTIES LINKER_LANGUAGE C)
@@ -626,11 +624,6 @@ ENDIF(GMIME2_FOUND)
IF(ENABLE_STATIC MATCHES "ON")
TARGET_LINK_LIBRARIES(utils/expression-parser ${PCRE_LIBRARIES})
ENDIF(ENABLE_STATIC MATCHES "ON")
-IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
- TARGET_LINK_LIBRARIES(utils/expression-parser rt)
-ELSE(CMAKE_SYSTEM_NAME STREQUAL "Linux")
- TARGET_LINK_LIBRARIES(utils/expression-parser intl)
-ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
##################### INSTALLATION ##########################################