]> source.dussan.org Git - rspamd.git/commitdiff
Fix portability on Solaris.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 20 Jun 2013 11:21:38 +0000 (12:21 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 20 Jun 2013 11:21:38 +0000 (12:21 +0100)
CMakeLists.txt
config.h.in
src/aio_event.c
src/webui.c

index 81ff69b0c59be7fba3dd115f92e3f230c95edd57..6441322da47a4162e52517c35ae1e524e4ec37ae 100644 (file)
@@ -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)
index b7fae4c6dc3c1234e60707adeed276366896d74b..e930e520f0b28bdfb5312c0c53a512eeba87d9ee 100644 (file)
@@ -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 
index 4f1bf95d416c35fc7606c3c8a5f4b4e518357907..60cd95295db087aae337dcf172bef934191260b3 100644 (file)
@@ -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
 };
 
index ab7e711fd34428ab1adbabc12bed3983c2fd1fec..0260632fb5dfe189523dc9bbaa4f482b48e598f9 100644 (file)
@@ -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>
 #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