aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-06-20 12:21:38 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-06-20 12:21:38 +0100
commit9a357fb2821fd418a02a7b9429c26875ee257556 (patch)
treef2a157727d553c7e9d76ec9195d7734d64b3fe14
parent6e9bcfeda6ec1fa63643629a72a0c707c53c26e0 (diff)
downloadrspamd-9a357fb2821fd418a02a7b9429c26875ee257556.tar.gz
rspamd-9a357fb2821fd418a02a7b9429c26875ee257556.zip
Fix portability on Solaris.
-rw-r--r--CMakeLists.txt12
-rw-r--r--config.h.in2
-rw-r--r--src/aio_event.c2
-rw-r--r--src/webui.c28
4 files changed, 40 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 81ff69b0c..6441322da 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -269,7 +269,7 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
ENDIF(NOT BUILD_CPU_MODE)
IF("${CMAKE_C_COMPILER_ID}" MATCHES SunPro)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Xa -xregs=no%frameptr -xstrconst")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Xa -xregs=no%frameptr -xstrconst -xc99")
set(SUN_BUILD32 "-xtarget=generic")
set(SUN_BUILD64 "-xtagret=generic64")
IF(ENABLE_OPTIMIZATION MATCHES "ON")
@@ -326,6 +326,7 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
LIST(APPEND CMAKE_REQUIRED_LIBRARIES dl)
LIST(APPEND CMAKE_REQUIRED_LIBRARIES resolv)
LIST(APPEND CMAKE_REQUIRED_LIBRARIES nsl)
+ LIST(APPEND CMAKE_REQUIRED_LIBRARIES socket)
LIST(APPEND CMAKE_REQUIRED_LIBRARIES umem)
SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
@@ -626,6 +627,11 @@ FIND_PATH(LIBEVENT_INCLUDE event.h PATHS /opt/include
/usr/local/include
DOC "Path where the libevent header files can be found")
+FIND_PATH(LIBEVENT_EVHTTP evhttp.h PATHS /opt/include
+ /usr/include
+ /usr/local/include
+ DOC "Path where the libevhttp header files can be found")
+
GET_FILENAME_COMPONENT(LIBEVENT_PATH "${LIBEVENT_LIBRARY}" PATH)
INCLUDE_DIRECTORIES("${LIBEVENT_INCLUDE}")
LINK_DIRECTORIES("${LIBEVENT_PATH}")
@@ -759,7 +765,9 @@ CHECK_C_COMPILER_FLAG(-Wunused-variable SUPPORT_WUNUSED_VAR)
CHECK_C_COMPILER_FLAG(-Wno-pointer-sign SUPPORT_WPOINTER_SIGN)
CHECK_C_COMPILER_FLAG(-Wstrict-prototypes SUPPORT_WSTRICT_PROTOTYPES)
CHECK_C_COMPILER_FLAG(-pedantic SUPPORT_PEDANTIC_FLAG)
-CHECK_C_COMPILER_FLAG("-std=c99" SUPPORT_STD_FLAG)
+IF(NOT "${CMAKE_C_COMPILER_ID}" MATCHES SunPro)
+ CHECK_C_COMPILER_FLAG("-std=c99" SUPPORT_STD_FLAG)
+ENDIF(NOT "${CMAKE_C_COMPILER_ID}" MATCHES SunPro)
IF(SUPPORT_W)
SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -W")
ENDIF(SUPPORT_W)
diff --git a/config.h.in b/config.h.in
index b7fae4c6d..e930e520f 100644
--- a/config.h.in
+++ b/config.h.in
@@ -60,6 +60,8 @@
#cmakedefine HAVE_MACHINE_ENDIAN_H 1
#cmakedefine HAVE_SYS_CDEFS_H 1
+#cmakedefine LIBEVENT_EVHTTP 1
+
#ifdef HAVE_ENDIAN_H
#include <endian.h>
#else
diff --git a/src/aio_event.c b/src/aio_event.c
index 4f1bf95d4..60cd95295 100644
--- a/src/aio_event.c
+++ b/src/aio_event.c
@@ -179,7 +179,7 @@ struct aio_context {
aio_context_t io_ctx;
#elif defined(HAVE_AIO_H)
/* POSIX aio */
- struct event rtsigs[SIGRTMAX - SIGRTMIN];
+ struct event rtsigs[128];
#endif
};
diff --git a/src/webui.c b/src/webui.c
index ab7e711fd..0260632fb 100644
--- a/src/webui.c
+++ b/src/webui.c
@@ -38,7 +38,7 @@
#include "rrd.h"
#include "json/jansson.h"
-#include <evhttp.h>
+
#if (_EVENT_NUMERIC_VERSION > 0x02010000) && defined(HAVE_OPENSSL)
#define HAVE_WEBUI_SSL
#include <openssl/ssl.h>
@@ -47,6 +47,15 @@
#include <event2/bufferevent.h>
#include <event2/util.h>
#include <event2/bufferevent_ssl.h>
+#include <event2/http.h>
+#include <event2/http_struct.h>
+#include <event2/http_compat.h>
+#else
+#ifdef LIBEVENT_EVHTTP
+# include <evhttp.h>
+#else
+# warning "Your libevent version is too old for webui work and therefore it will be disabled"
+#endif
#endif
/* Another workaround for old libevent */
@@ -97,6 +106,7 @@ worker_t webui_worker = {
TRUE /* Killable */
};
+#if defined(LIBEVENT_EVHTTP) || (defined(_EVENT_NUMERIC_VERSION) && (_EVENT_NUMERIC_VERSION > 0x02010000))
/*
* Worker's context
*/
@@ -1804,4 +1814,20 @@ start_webui_worker (struct rspamd_worker *worker)
close_log (rspamd_main->logger);
exit (EXIT_SUCCESS);
}
+#else
+
+gpointer
+init_webui_worker (void)
+{
+ return NULL;
+}
+/*
+ * Start worker process
+ */
+void
+start_webui_worker (struct rspamd_worker *worker)
+{
+ exit (EXIT_SUCCESS);
+}
+#endif