diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 21:30:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 21:30:40 +0000 |
commit | 133a45c109da5310add55824db21af5239951f93 (patch) | |
tree | ba6ac4c0a950a0dda56451944315d66409923918 /cmake/OSDep.cmake | |
parent | Initial commit. (diff) | |
download | rspamd-133a45c109da5310add55824db21af5239951f93.tar.xz rspamd-133a45c109da5310add55824db21af5239951f93.zip |
Adding upstream version 3.8.1.upstream/3.8.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/OSDep.cmake')
-rw-r--r-- | cmake/OSDep.cmake | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/cmake/OSDep.cmake b/cmake/OSDep.cmake new file mode 100644 index 0000000..78f6549 --- /dev/null +++ b/cmake/OSDep.cmake @@ -0,0 +1,65 @@ +# Platform specific configuration +IF(CMAKE_SYSTEM_NAME MATCHES "^.*BSD$|DragonFly") + ADD_COMPILE_OPTIONS(-DFREEBSD -D_BSD_SOURCE) + SET(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_BSD_SOURCE") + CONFIGURE_FILE(freebsd/rspamd.sh.in freebsd/rspamd @ONLY) + MESSAGE(STATUS "Configuring for BSD system") + # Find util library + ProcessPackage(LIBUTIL LIBRARY util INCLUDE libutil.h + ROOT ${LIBUTIL_ROOT_DIR} OPTIONAL) + IF(WITH_LIBUTIL) + SET(HAVE_LIBUTIL_H 1) + LIST(APPEND CMAKE_REQUIRED_LIBRARIES util) + CHECK_FUNCTION_EXISTS(pidfile_open HAVE_PIDFILE) + CHECK_FUNCTION_EXISTS(pidfile_fileno HAVE_PIDFILE_FILENO) + ENDIF() + IF(CMAKE_SYSTEM_NAME MATCHES "^NetBSD$") + LIST(APPEND CMAKE_REQUIRED_LIBRARIES rt) + ENDIF() + SET(TAR "gtar") +ENDIF() + +IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + ADD_COMPILE_OPTIONS(-D_BSD_SOURCE -DDARWIN) + SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -undefined dynamic_lookup") + IF(ENABLE_LUAJIT MATCHES "ON") + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pagezero_size 10000 -image_base 100000000") + ENDIF(ENABLE_LUAJIT MATCHES "ON") + MESSAGE(STATUS "Configuring for Darwin") + SET(TAR "gnutar") + SET(CMAKE_FIND_FRAMEWORK "NEVER") +ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + +IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") + ADD_COMPILE_OPTIONS(-D_GNU_SOURCE -DLINUX) + SET(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE") + # Workaround with architecture specific includes + #IF(IS_DIRECTORY "/usr/include/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu/") + # INCLUDE_DIRECTORIES("/usr/include/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu/") + # LIST(APPEND CMAKE_REQUIRED_INCLUDES "/usr/include/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu/") + #ENDIF(IS_DIRECTORY "/usr/include/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu/") + + LIST(APPEND CMAKE_REQUIRED_LIBRARIES rt) + LIST(APPEND CMAKE_REQUIRED_LIBRARIES dl) + LIST(APPEND CMAKE_REQUIRED_LIBRARIES resolv) + MESSAGE(STATUS "Configuring for Linux") + IF(EXISTS "/etc/debian_version") + SET(LINUX_START_SCRIPT "rspamd_debian.in") + ELSE(EXISTS "/etc/debian_version") + SET(LINUX_START_SCRIPT "rspamd_rh.in") + ENDIF(EXISTS "/etc/debian_version") +ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux") + +IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") + ADD_COMPILE_OPTIONS(-D__EXTENSIONS__ -DSOLARIS -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112) + LIST(APPEND CMAKE_REQUIRED_LIBRARIES rt) + LIST(APPEND CMAKE_REQUIRED_LIBRARIES dl) + LIST(APPEND CMAKE_REQUIRED_LIBRARIES resolv) + LIST(APPEND CMAKE_REQUIRED_LIBRARIES nsl) + LIST(APPEND CMAKE_REQUIRED_LIBRARIES socket) + LIST(APPEND CMAKE_REQUIRED_LIBRARIES umem) + # Ugly hack, but FindOpenSSL on Solaris does not link with libcrypto + SET(CMAKE_VERBOSE_MAKEFILE ON) + SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) + SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:${RSPAMD_LIBDIR}") +ENDIF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
\ No newline at end of file |