ProcessPackage(GLIB2 glib-2.0>=2.28)
ProcessPackage(GTHREAD gthread-2.0)
-ProcessPackage(HIREDIS hiredis libhiredis)
ProcessPackage(PCRE pcre libpcre pcre3 libpcre3)
ProcessPackage(GMIME2 gmime-2.6 gmime-2.4 gmime-2.0)
ProcessPackage(LIBEVENT event libevent)
SET(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};-lpcre")
ENDIF(PCRE_LIBRARY)
# Libhiredis pc file is so special
-FIND_PATH(LIBHIREDIS_INCLUDE hiredis.h
+IF(ENABLE_HIREDIS MATCHES "ON")
+ ProcessPackage(HIREDIS hiredis libhiredis)
+ SET(WITH_HIREDIS 1)
+ FIND_PATH(LIBHIREDIS_INCLUDE hiredis.h
HINTS "${RSPAMD_SEARCH_PATH}"
PATH_SUFFIXES "include" "include/hiredis"
PATHS ${RSPAMD_DEFAULT_INCLUDE_PATHS}
DOC "Path where the hiredis header files can be found")
-IF(LIBHIREDIS_INCLUDE)
- INCLUDE_DIRECTORIES("${LIBHIREDIS_INCLUDE}")
-ENDIF(LIBHIREDIS_INCLUDE)
+ IF(LIBHIREDIS_INCLUDE)
+ INCLUDE_DIRECTORIES("${LIBHIREDIS_INCLUDE}")
+ ENDIF(LIBHIREDIS_INCLUDE)
+ENDIF(ENABLE_HIREDIS MATCHES "ON")
+
# Google performance tools
LIST(APPEND RSPAMD_REQUIRED_LIBRARIES profiler)
ENDIF(ENABLE_GPERF_TOOLS MATCHES "ON")
-LIST(APPEND RSPAMD_REQUIRED_LIBRARIES hiredis)
+IF(ENABLE_HIREDIS MATCHES "ON")
+ LIST(APPEND RSPAMD_REQUIRED_LIBRARIES hiredis)
+ENDIF(ENABLE_HIREDIS MATCHES "ON")
IF(GLIB_COMPAT)
LIST(APPEND RSPAMD_REQUIRED_LIBRARIES glibadditions)
ENDIF(GLIB_COMPAT)
${CMAKE_CURRENT_SOURCE_DIR}/tokenizers/osb.c)
SET(CLASSIFIERSSRC ${CMAKE_CURRENT_SOURCE_DIR}/classifiers/bayes.c)
-
-SET(BACKENDSSRC ${CMAKE_CURRENT_SOURCE_DIR}/backends/mmaped_file.c
- ${CMAKE_CURRENT_SOURCE_DIR}/backends/redis.c)
+SET(BACKENDSSRC ${CMAKE_CURRENT_SOURCE_DIR}/backends/mmaped_file.c)
+IF(ENABLE_HIREDIS MATCHES "ON")
+ SET(BACKENDSSRC ${BACKENDSSRC}
+ ${CMAKE_CURRENT_SOURCE_DIR}/backends/redis.c)
+ENDIF(ENABLE_HIREDIS MATCHES "ON")
SET(CACHESSRC ${CMAKE_CURRENT_SOURCE_DIR}/learn_cache/sqlite3_cache.c)
SET(RSPAMD_STAT ${LIBSTATSRC}
#include "lua_common.h"
#include "dns.h"
+#ifdef WITH_HIREDIS
#include "hiredis.h"
#include "async.h"
#include "adapters/libevent.h"
+#endif
#define REDIS_DEFAULT_TIMEOUT 1.0
{NULL, NULL}
};
+#ifdef WITH_HIREDIS
/**
* Struct for userdata representation
*/
return 1;
}
+#else
+static int
+lua_redis_make_request (lua_State *L)
+{
+ msg_warn ("rspamd is compiled with no redis support");
+
+ lua_pushboolean (L, FALSE);
+
+ return 1;
+}
+#endif
static gint
lua_load_redis (lua_State * L)