From 4e17ec5a298b118e7f86df8d470abf06d3d5dbad Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 26 Jan 2011 18:16:39 +0100 Subject: [PATCH] fixes for solaris 10 configure.in: * don't use assembler when building with native linker and --with-embedded. Embedded uses PIC and our assembler sources aren't PIC * workaround for OpenSolaris Bug 6611808 extra/libevent/devpoll.c: compiler warning extra/yassl/src/buffer.cpp: include config.h first to make sure that _FILE_OFFSET_BITS is defined before including system headers extra/yassl/taocrypt/benchmark/benchmark.cpp: include config.h first to make sure that _FILE_OFFSET_BITS is defined before including system headers extra/yassl/taocrypt/test/test.cpp: include config.h first to make sure that _FILE_OFFSET_BITS is defined before including system headers include/my_pthread.h: workaround for OpenSolaris Bug 6611808 --- configure.in | 36 ++++++++++++++++++++ extra/yassl/src/buffer.cpp | 3 ++ extra/yassl/taocrypt/benchmark/benchmark.cpp | 4 +++ extra/yassl/taocrypt/test/test.cpp | 4 +++ include/my_pthread.h | 4 +++ 5 files changed, 51 insertions(+) diff --git a/configure.in b/configure.in index fdcad1db195..b124c0fac0a 100644 --- a/configure.in +++ b/configure.in @@ -715,6 +715,17 @@ AC_ARG_ENABLE(assembler, [ ENABLE_ASSEMBLER=no ] ) +# Don't use assembler if building on Solaris with native linker +# and with embedded. Because our asm code is not PIC and solaris ld +# aborts with an error when creating .so +if test "x$ENABLE_ASSEMBLER" = "xyes" -a \ + "x$LD_VERSION_SCRIPT" = "x" -a \ + "x$with_embedded_server" = "xyes" -a \ + `expr "$SYSTEM_TYPE" : "^.*solaris"` -gt 0; then + ENABLE_ASSEMBLER=no + AC_MSG_WARN([No assembler functions when non-GNU linker is used and embedded-server is enabled]) +fi + AC_MSG_CHECKING(if we should use assembler functions) # For now we only support assembler on i386 and sparc systems AM_CONDITIONAL(ASSEMBLER_x86, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "i386" && $CCAS $CCASFLAGS -c strings/strings-x86.s -o checkassembler >/dev/null 2>&1 && test -f checkassembler && (rm -f checkassembler; exit 0;)) @@ -1595,6 +1606,31 @@ else fi fi +# +# Solaris bug http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6611808 +# Detect and work around. +# +AC_MSG_CHECKING([for OpenSolaris Bug 6611808]) +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -Werror" +AC_COMPILE_IFELSE([ + #include + void dummy() {} + int main() + { + pthread_once_t once_control = { PTHREAD_ONCE_INIT }; + pthread_once(&once_control, dummy); + return 0; + } +], [ + AC_DEFINE([PTHREAD_ONCE_INITIALIZER], [{PTHREAD_ONCE_INIT}], + [See OpenSolaris Bug 6611808]) + AC_MSG_RESULT([yes]) +], [ + AC_MSG_RESULT([no]) +]); +CFLAGS="$save_CFLAGS" + #---START: Used in for client configure # Must be checked after, because strtok_r may be in -lpthread # On AIX strtok_r is in libc_r diff --git a/extra/yassl/src/buffer.cpp b/extra/yassl/src/buffer.cpp index 66107dbe0a9..5bd69905772 100644 --- a/extra/yassl/src/buffer.cpp +++ b/extra/yassl/src/buffer.cpp @@ -21,6 +21,9 @@ * with SSL types and sockets */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include // memcpy #include "runtime.hpp" diff --git a/extra/yassl/taocrypt/benchmark/benchmark.cpp b/extra/yassl/taocrypt/benchmark/benchmark.cpp index bb725a90187..1d38b080d0d 100644 --- a/extra/yassl/taocrypt/benchmark/benchmark.cpp +++ b/extra/yassl/taocrypt/benchmark/benchmark.cpp @@ -1,6 +1,10 @@ // benchmark.cpp // TaoCrypt benchmark +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include diff --git a/extra/yassl/taocrypt/test/test.cpp b/extra/yassl/taocrypt/test/test.cpp index 0af278404ab..09836a2ef56 100644 --- a/extra/yassl/taocrypt/test/test.cpp +++ b/extra/yassl/taocrypt/test/test.cpp @@ -1,6 +1,10 @@ // test.cpp // test taocrypt functionality +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include diff --git a/include/my_pthread.h b/include/my_pthread.h index 9ada1d90712..f1b9320a075 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -223,7 +223,11 @@ extern int my_pthread_getprio(pthread_t thread_id); typedef void *(* pthread_handler)(void *); #define my_pthread_once_t pthread_once_t +#if defined(PTHREAD_ONCE_INITIALIZER) +#define MY_PTHREAD_ONCE_INIT PTHREAD_ONCE_INITIALIZER +#else #define MY_PTHREAD_ONCE_INIT PTHREAD_ONCE_INIT +#endif #define my_pthread_once(C,F) pthread_once(C,F) /* Test first for RTS or FSU threads */