diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt index 40b503746e..0d7b315486 100644 --- a/c/CMakeLists.txt +++ b/c/CMakeLists.txt @@ -105,14 +105,19 @@ elseif (SASL_IMPL STREQUAL none) endif () # Set Compiler extra flags for Solaris when using SunStudio -if(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro" ) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mt" ) +if (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mt -D_REENTRANT") endif() -if(CMAKE_C_COMPILER_ID STREQUAL "SunPro" ) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mt") +if (CMAKE_C_COMPILER_ID STREQUAL "SunPro") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mt -D_REENTRANT") endif() +# Set linker's extra flags for Solaris (used by SunStudio and GCC without discrimination) +if (CMAKE_HOST_SOLARIS) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lsocket") +endif(CMAKE_HOST_SOLARIS) + # Link in openssl if present if (SSL_IMPL STREQUAL openssl) set (pn_ssl_impl src/ssl/openssl.c) @@ -231,9 +236,18 @@ if (CMAKE_COMPILER_IS_GNUCC) set (COMPILE_WARNING_FLAGS "${CXX_WARNING_FLAGS}") endif (NOT BUILD_WITH_CXX) + if (CMAKE_HOST_SOLARIS) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__EXTENSIONS__") + endif (CMAKE_HOST_SOLARIS) + if (ENABLE_UNDEFINED_ERROR) - set (CATCH_UNDEFINED "-Wl,--no-undefined") - set (ALLOW_UNDEFINED "-Wl,--allow-shlib-undefined") + if (CMAKE_HOST_SOLARIS) + set (CATCH_UNDEFINED "-zdefs") + set (ALLOW_UNDEFINED "-znodefs") + else(CMAKE_HOST_SOLARIS) + set (CATCH_UNDEFINED "-Wl,--no-undefined") + set (ALLOW_UNDEFINED "-Wl,--allow-shlib-undefined") + endif(CMAKE_HOST_SOLARIS) endif (ENABLE_UNDEFINED_ERROR) if (ENABLE_LINKTIME_OPTIMIZATION) diff --git a/c/src/reactor/io/posix/io.c b/c/src/reactor/io/posix/io.c index 5a0de3b10f..949fc8bd89 100644 --- a/c/src/reactor/io/posix/io.c +++ b/c/src/reactor/io/posix/io.c @@ -274,7 +274,7 @@ static ssize_t nosigpipe_send(int fd, const void *buffer, size_t size) { if (!sigpipeIsPending) { sigemptyset(&newSignals); sigaddset(&newSignals, SIGPIPE); - if (sigmaskErr = pthread_sigmask(SIG_BLOCK, (const sigset_t *)&newSignals, (sigset_t *)&oldSignals)) + if ((sigmaskErr = pthread_sigmask(SIG_BLOCK, (const sigset_t *)&newSignals, (sigset_t *)&oldSignals)) != 0) { errno = sigmaskErr; return -1; @@ -288,7 +288,7 @@ static ssize_t nosigpipe_send(int fd, const void *buffer, size_t size) { while (-1 == sigtimedwait(&newSignals, NULL, &(struct timespec){ 0, 0 }) && errno == EINTR) ; //do nothing } - if (sigmaskErr = pthread_sigmask(SIG_SETMASK, (const sigset_t *)&oldSignals, (sigset_t *)NULL)) + if ((sigmaskErr = pthread_sigmask(SIG_SETMASK, (const sigset_t *)&oldSignals, (sigset_t *)NULL)) != 0) { errno = sigmaskErr; return -1;