From: Vsevolod Stakhov Date: Thu, 20 Jun 2013 11:21:38 +0000 (+0100) Subject: Fix portability on Solaris. X-Git-Tag: 0.6.0~284 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9a357fb2821fd418a02a7b9429c26875ee257556;p=rspamd.git Fix portability on Solaris. --- 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 #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 + #if (_EVENT_NUMERIC_VERSION > 0x02010000) && defined(HAVE_OPENSSL) #define HAVE_WEBUI_SSL #include @@ -47,6 +47,15 @@ #include #include #include +#include +#include +#include +#else +#ifdef LIBEVENT_EVHTTP +# include +#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