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)
#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
#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
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})