From 4dc36c0dba23c93703450ad73ecbd0587d772e31 Mon Sep 17 00:00:00 2001 From: Matt Connolly Date: Fri, 27 Sep 2013 11:12:16 +0000 Subject: [PATCH 1/6] Add '-lssp' linker flag for Solaris. Check for libraries after host specific setup. --- configure.ac | 50 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 44e901a5..6a3a2420 100644 --- a/configure.ac +++ b/configure.ac @@ -63,10 +63,45 @@ LIBZMQ_CHECK_ENABLE_DEBUG # Check wheter to enable code coverage LIBZMQ_WITH_GCOV -# Checks for libraries -AC_CHECK_LIB([pthread], [pthread_create]) -AC_CHECK_LIB([rt], [clock_gettime]) -AC_CHECK_LIB([sodium], [sodium_init],,AC_MSG_WARN(libsodium is needed for CURVE security)) +# Allow libsodium to be installed in a custom path: + +AC_ARG_WITH([libsodium], + [AS_HELP_STRING([--with-libsodium], + [Specify libsodium prefix])], + [zmq_search_libsodium="yes"], + []) + +if test "x$zmq_search_libsodium" = "xyes"; then + if test -r "${with_libsodium}/include/sodium.h"; then + CXXFLAGS="-I${with_libsodium}/include ${CXXFLAGS}" + LDFLAGS="-L${with_libsodium}/lib ${LDFLAGS}" + fi +fi + +AC_ARG_WITH([libsodium-include-dir], + [AS_HELP_STRING([--with-libsodium-include-dir], + [Specify libsodium include prefix])], + [zmq_search_libsodium_include="yes"], + []) + +if test "x$zmq_search_libsodium_include" = "xyes"; then + if test -r "${with_libsodium_include_dir}/sodium.h"; then + CXXFLAGS="-I${with_libsodium_include_dir}/include ${CXXFLAGS}" + fi +fi + +AC_ARG_WITH([libsodium_lib_dir], + [AS_HELP_STRING([--with-libsodium-lib-dir], + [Specify libsodium library prefix])], + [zmq_search_libsodium_lib="yes"], + []) + +if test "x$zmq_search_libsodium_lib" = "xyes"; then + if test -r "${with_libsodium_lib_dir}/libsodium.{a|so|dylib}"; then + LDFLAGS="-L${with_libsodium}/lib ${LDFLAGS}" + fi +fi +>>>>>>> aa84e85... Add '-lssp' linker flag for Solaris. Check for libraries after host specific setup. # Set pedantic libzmq_pedantic="yes" @@ -122,6 +157,8 @@ case "${host_os}" in if test "x$solaris_has_atomic" = "xno"; then AC_DEFINE(ZMQ_FORCE_MUTEXES, 1, [Force to use mutexes]) fi + # ssp library is required for libsodium on Solaris-like systems + LDFLAGS="-lssp $LDFLAGS" ;; *freebsd*) # Define on FreeBSD to enable all library features @@ -215,6 +252,11 @@ case "${host_os}" in ;; esac +# Checks for libraries +AC_CHECK_LIB([pthread], [pthread_create]) +AC_CHECK_LIB([rt], [clock_gettime]) +AC_CHECK_LIB([sodium], [sodium_init],,AC_MSG_WARN(libsodium is needed for CURVE security)) + # # Check if the compiler supports -fvisibility=hidden flag. MinGW32 uses __declspec # From d1b686b644f834b319378d65935a23a59c997b5c Mon Sep 17 00:00:00 2001 From: Matt Connolly Date: Fri, 27 Sep 2013 11:20:09 +0000 Subject: [PATCH 2/6] Disable compiler warning for Solaris --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index 6a3a2420..bf4d9b19 100644 --- a/configure.ac +++ b/configure.ac @@ -159,6 +159,7 @@ case "${host_os}" in fi # ssp library is required for libsodium on Solaris-like systems LDFLAGS="-lssp $LDFLAGS" + CPPFLAGS="$CPPFLAGS -Wno-long-long" ;; *freebsd*) # Define on FreeBSD to enable all library features From 087ddac593570b8efb115d592318bafe7b6748e3 Mon Sep 17 00:00:00 2001 From: MinRK Date: Sat, 28 Sep 2013 15:42:00 -0700 Subject: [PATCH 3/6] declare z85_encode / decode in zmq_utils they are used by curve_keygen, but not available --- include/zmq_utils.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/zmq_utils.h b/include/zmq_utils.h index a40df7e2..4fe8fcd2 100644 --- a/include/zmq_utils.h +++ b/include/zmq_utils.h @@ -82,6 +82,12 @@ ZMQ_EXPORT void *zmq_threadstart (zmq_thread_fn* func, void* arg); /* Wait for thread to complete then free up resources. */ ZMQ_EXPORT void zmq_threadclose (void* thread); +/* Encode data with Z85 encoding. Returns encoded data */ +ZMQ_EXPORT char *zmq_z85_encode (char *dest, uint8_t *data, size_t size); + +/* Decode data with Z85 encoding. Returns decoded data */ +ZMQ_EXPORT uint8_t *zmq_z85_decode (uint8_t *dest, char *string); + #undef ZMQ_EXPORT #ifdef __cplusplus From bd6bca7c8209a5503eee1e2dba07c4674058e66a Mon Sep 17 00:00:00 2001 From: MinRK Date: Sat, 28 Sep 2013 15:42:52 -0700 Subject: [PATCH 4/6] include missing platform.hpp in curve_keygen it was excluded, so HAVE_SODIUM would never be defined, leading to curve_keygen always reporting "recompile with libsodium" --- tools/curve_keygen.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/curve_keygen.c b/tools/curve_keygen.c index c18c4621..eb1f0bbb 100644 --- a/tools/curve_keygen.c +++ b/tools/curve_keygen.c @@ -25,6 +25,7 @@ */ #include +#include #include #ifdef HAVE_LIBSODIUM # include From 4d82544c34990423a2195385b6a7d0cdb2c0abc0 Mon Sep 17 00:00:00 2001 From: Matt Connolly Date: Sun, 29 Sep 2013 21:19:50 +1000 Subject: [PATCH 5/6] config for libsodium in alternate path, using CPP flags for both C and C++ sources. --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index bf4d9b19..8df1838e 100644 --- a/configure.ac +++ b/configure.ac @@ -73,7 +73,7 @@ AC_ARG_WITH([libsodium], if test "x$zmq_search_libsodium" = "xyes"; then if test -r "${with_libsodium}/include/sodium.h"; then - CXXFLAGS="-I${with_libsodium}/include ${CXXFLAGS}" + CPPFLAGS="-I${with_libsodium}/include ${CPPFLAGS}" LDFLAGS="-L${with_libsodium}/lib ${LDFLAGS}" fi fi @@ -86,7 +86,7 @@ AC_ARG_WITH([libsodium-include-dir], if test "x$zmq_search_libsodium_include" = "xyes"; then if test -r "${with_libsodium_include_dir}/sodium.h"; then - CXXFLAGS="-I${with_libsodium_include_dir}/include ${CXXFLAGS}" + CPPFLAGS="-I${with_libsodium_include_dir}/include ${CPPFLAGS}" fi fi From 453ceb65b4a5e47fd8afe01035fda6b71512addb Mon Sep 17 00:00:00 2001 From: Pieter Hintjens Date: Sun, 29 Sep 2013 17:03:44 +0200 Subject: [PATCH 6/6] Fixed merge conflict error --- configure.ac | 1 - 1 file changed, 1 deletion(-) diff --git a/configure.ac b/configure.ac index 8df1838e..ac130181 100644 --- a/configure.ac +++ b/configure.ac @@ -101,7 +101,6 @@ if test "x$zmq_search_libsodium_lib" = "xyes"; then LDFLAGS="-L${with_libsodium}/lib ${LDFLAGS}" fi fi ->>>>>>> aa84e85... Add '-lssp' linker flag for Solaris. Check for libraries after host specific setup. # Set pedantic libzmq_pedantic="yes"