SET(TAR "tar")
# Platform specific configuration
-IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_BSD_SOURCE -DFREEBSD")
+IF(CMAKE_SYSTEM_NAME MATCHES "^.*BSD$")
+ ADD_DEFINITIONS(-DFREEBSD -D_BSD_SOURCE)
CONFIGURE_FILE(freebsd/rspamd.sh.in freebsd/rspamd @ONLY)
IF(ENABLE_REDIRECTOR MATCHES "ON")
CONFIGURE_FILE(freebsd/redirector.sh.in freebsd/redirector @ONLY)
ENDIF(ENABLE_REDIRECTOR MATCHES "ON")
- MESSAGE(STATUS "Configuring for FreeBSD")
+ MESSAGE(STATUS "Configuring for BSD system")
# Find util library
ProcessPackage(LIBUTIL LIBRARY util INCLUDE libutil.h
ROOT ${LIBUTIL_ROOT_DIR} OPTIONAL)
ENDIF()
SET(POE_LOOP "Loop::Kqueue")
SET(TAR "gtar")
-ENDIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+ENDIF()
IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_BSD_SOURCE -DDARWIN")
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE -DLINUX")
+ ADD_DEFINITIONS(-D_GNU_SOURCE -DLINUX -D_XOPEN_SOURCE=600)
IF(BUILD_CPU_MODE STREQUAL "32")
- SET(CMAKE_C_FLAGS "-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE ${CMAKE_C_FLAGS}")
+ ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
ENDIF(BUILD_CPU_MODE STREQUAL "32")
# Workaround with architecture specific includes
IF(IS_DIRECTORY "/usr/include/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu/")
SET(CMAKE_C_FLAGS "${CMAKE_C_OPT_FLAGS} ${CMAKE_C_FLAGS} ${CMAKE_C_WARN_FLAGS}")
+ADD_DEFINITIONS(-DHAVE_CONFIG_H)
+
# Check platform specific includes
CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILES(sys/time.h HAVE_SYS_TIME_H)
CHECK_SYMBOL_EXISTS(getaddrinfo "sys/types.h;sys/socket.h;netdb.h" HAVE_GETADDRINFO)
CHECK_SYMBOL_EXISTS(sched_yield "sched.h" HAVE_SCHED_YIELD)
CHECK_SYMBOL_EXISTS(__get_cpuid "cpuid.h" HAVE_GET_CPUID)
+CHECK_SYMBOL_EXISTS(nftw "sys/types.h;ftw.h" HAVE_NFTW)
CHECK_SYMBOL_EXISTS(PCRE_CONFIG_JIT "pcre.h" HAVE_PCRE_JIT)
CHECK_SYMBOL_EXISTS(SOCK_SEQPACKET "sys/types.h;sys/socket.h" HAVE_SOCK_SEQPACKET)
CHECK_SYMBOL_EXISTS(I_SETSIG "sys/types.h;sys/ioctl.h" HAVE_SETSIG)
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/contrib/lgpl")
ENDIF(GLIB_COMPAT)
-ADD_DEFINITIONS(-DHAVE_CONFIG_H)
-
LIST(APPEND RSPAMD_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
LIST(APPEND RSPAMD_REQUIRED_LIBRARIES ucl)
LIST(APPEND RSPAMD_REQUIRED_LIBRARIES rdns)