]> source.dussan.org Git - rspamd.git/commitdiff
Add detecting of libfetch/libcurl for rcl.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 18 Aug 2013 23:09:50 +0000 (00:09 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 18 Aug 2013 23:09:50 +0000 (00:09 +0100)
CMakeLists.txt
config.h.in
lib/CMakeLists.txt

index b4bea8495e1cd72b2e17cade3f493bcb99be879b..f2be7bad499a7cac9753da31c73102bba8dfdb9b 100644 (file)
@@ -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)
index b3b1b0f2e3cf21a43cde1029aa9b2733195c08f2..31a0dd2d63c9e75c551844ab66bd40f8e1ee3a36 100644 (file)
 #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
index af140352306cec244defb2090ee6ffa8b7b0d62c..c4b29d933441bf2d95e5b9f2e2521ca8f4ffd08d 100644 (file)
@@ -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})