@@ -756,6 +756,34 @@ IF(LIBUTIL_LIBRARY) | |||
DOC "Path to libutil header") | |||
ENDIF(LIBUTIL_LIBRARY) | |||
# Find libfetch (for FreeBSD) | |||
FIND_LIBRARY(LIBFETCH_LIBRARY NAMES fetch PATHS PATH_SUFFIXES lib64 lib | |||
PATHS | |||
~/Library/Frameworks | |||
/Library/Frameworks | |||
/usr/local | |||
/usr | |||
/sw | |||
/opt/local | |||
/opt/csw | |||
/opt | |||
DOC "Path where the libfetch library can be found") | |||
IF(LIBFETCH_LIBRARY) | |||
FIND_FILE(HAVE_FETCH_H NAMES fetch.h PATHS /usr/include | |||
/opt/include | |||
/usr/local/include | |||
DOC "Path to libfetch header") | |||
ELSE(LIBFETCH_LIBRARY) | |||
# Try to find libcurl | |||
INCLUDE(FindCURL) | |||
IF(NOT CURL_FOUND) | |||
MESSAGE(WARNING "Neither libcurl nor libfetch were found, no support of URL includes in configuration") | |||
ELSE(NOT CURL_FOUND) | |||
INCLUDE_DIRECTORIES("${CURL_INCLUDE_DIRS}") | |||
ENDIF(NOT CURL_FOUND) | |||
ENDIF(LIBFETCH_LIBRARY) | |||
# Process with warn flags | |||
SET(CMAKE_C_WARN_FLAGS "") | |||
CHECK_C_COMPILER_FLAG(-Wall SUPPORT_WALL) |
@@ -200,6 +200,9 @@ | |||
#cmakedefine GLIB_HASH_COMPAT 1 | |||
#cmakedefine PARAM_H_HAS_BITSET 1 | |||
#cmakedefine HAVE_FETCH_H 1 | |||
#cmakedefine CURL_FOUND 1 | |||
#if (defined(__i386__) || defined(__x86_64__) || defined(_M_IX86)) | |||
/* Use murmur hash for UTHash for these platforms */ | |||
#define HASH_FUNCTION HASH_MUR | |||
@@ -422,6 +425,12 @@ | |||
#include <google/profiler.h> | |||
#endif | |||
#ifdef HAVE_FETCH_H | |||
#include <fetch.h> | |||
#elif defined(CURL_FOUND) | |||
#include <curl/curl.h> | |||
#endif | |||
#include <errno.h> | |||
#include <signal.h> | |||
#ifdef HAVE_SIGINFO_H |
@@ -77,6 +77,13 @@ TARGET_LINK_LIBRARIES(rspamd-util ${CMAKE_REQUIRED_LIBRARIES}) | |||
TARGET_LINK_LIBRARIES(rspamd-util pcre) | |||
TARGET_LINK_LIBRARIES(rspamd-util ${GLIB2_LIBRARIES}) | |||
TARGET_LINK_LIBRARIES(rspamd-util event) | |||
IF(HAVE_FETCH_H) | |||
TARGET_LINK_LIBRARIES(rspamd-util fetch) | |||
ELSE(HAVE_FETCH_H) | |||
IF(CURL_FOUND) | |||
TARGET_LINK_LIBRARIES(rspamd-util ${CURL_LIBRARIES}) | |||
ENDIF(CURL_FOUND) | |||
ENDIF(HAVE_FETCH_H) | |||
IF(NOT DEBIAN_BUILD) | |||
SET_TARGET_PROPERTIES(rspamd-util PROPERTIES VERSION ${RSPAMD_VERSION}) |