diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-05-19 13:43:26 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-05-19 13:43:26 +0100 |
commit | b4cfe06003e7bfb3e5c1e83058267f4224fe07d2 (patch) | |
tree | 313cc381538982d7aec1173a5f3a40c74e2b4540 /src | |
parent | 90cc2d3b54b7cf6253d9cc467f4a540005a6fa5d (diff) | |
download | rspamd-b4cfe06003e7bfb3e5c1e83058267f4224fe07d2.tar.gz rspamd-b4cfe06003e7bfb3e5c1e83058267f4224fe07d2.zip |
Make hiredis optional dependency.
Diffstat (limited to 'src')
-rw-r--r-- | src/libstat/CMakeLists.txt | 8 | ||||
-rw-r--r-- | src/lua/lua_redis.c | 14 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/libstat/CMakeLists.txt b/src/libstat/CMakeLists.txt index bf9aa94e4..f31cf4cf4 100644 --- a/src/libstat/CMakeLists.txt +++ b/src/libstat/CMakeLists.txt @@ -6,10 +6,12 @@ SET(TOKENIZERSSRC ${CMAKE_CURRENT_SOURCE_DIR}/tokenizers/tokenizers.c ${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} diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c index 275df0a35..9cf10bb10 100644 --- a/src/lua/lua_redis.c +++ b/src/lua/lua_redis.c @@ -24,9 +24,11 @@ #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 @@ -62,6 +64,7 @@ static const struct luaL_reg redislib_m[] = { {NULL, NULL} }; +#ifdef WITH_HIREDIS /** * Struct for userdata representation */ @@ -461,6 +464,17 @@ lua_redis_make_request (lua_State *L) 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) |