Commit dd4b93dd authored by Constantin Rack's avatar Constantin Rack

Merge pull request #1790 from hintjens/master

Problem: use of libsodium vs. tweetnacl is confused
parents 42ab88e4 ddbbe3b4
...@@ -127,6 +127,8 @@ test_udp ...@@ -127,6 +127,8 @@ test_udp
test_large_msg test_large_msg
test_use_fd_ipc test_use_fd_ipc
test_use_fd_tcp test_use_fd_tcp
test_pre_allocated_fd_ipc
test_pre_allocated_fd_tcp
tests/test*.log tests/test*.log
tests/test*.trs tests/test*.trs
src/platform.hpp* src/platform.hpp*
......
# CMake build script for ZeroMQ # CMake build script for ZeroMQ
cmake_minimum_required(VERSION 2.8.12) cmake_minimum_required (VERSION 2.8.12)
project(ZeroMQ) project (ZeroMQ)
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}") list (INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}")
option(WITH_OPENPGM "Build with support for OpenPGM" OFF) option (WITH_OPENPGM "Build with support for OpenPGM" OFF)
option(WITH_VMCI "Build with support for VMware VMCI socket" OFF) option (WITH_VMCI "Build with support for VMware VMCI socket" OFF)
if(APPLE) if (APPLE)
option(ZMQ_BUILD_FRAMEWORK "Build as OS X framework" ON) option (ZMQ_BUILD_FRAMEWORK "Build as OS X framework" ON)
endif() endif ()
option(WITH_SODIUM "Build with libsodium" ON) # Select curve encryption library, defaults to tweetnacl
option(WITH_TWEETNACL "Build with tweetnacl" ON) # To use libsodium instead, use --with-libsodium (must be installed)
# To disable curve, use --disable-curve
if(WITH_SODIUM) option (WITH_LIBSODIUM "Use libsodium instead of built-in tweetnacl" OFF)
find_package(Sodium) option (ENABLE_CURVE "Enable CURVE security" ON)
if(SODIUM_FOUND)
add_definitions(-DHAVE_LIBSODIUM)
include_directories(${SODIUM_INCLUDE_DIRS})
endif()
endif()
if(WITH_TWEETNACL)
message(STATUS "Building with TweetNaCL")
set(USE_TWEETNACL ON)
add_definitions(-DHAVE_TWEETNACL)
include_directories(
tweetnacl/contrib/randombytes
tweetnacl/src
)
set(TWEETNACL_SOURCES if (NOT ENABLE_CURVE)
tweetnacl/src/tweetnacl.c message (STATUS "CURVE security is disabled")
)
if(WIN32) elseif (WITH_SODIUM)
list(APPEND TWEETNACL_SOURCES tweetnacl/contrib/randombytes/winrandom.c) find_package (Sodium)
else() if (SODIUM_FOUND)
list(APPEND TWEETNACL_SOURCES tweetnacl/contrib/randombytes/devurandom.c) message (STATUS "Using libsodium for CURVE security")
endif() add_definitions (-DZMQ_HAVE_CURVE -DHAVE_LIBSODIUM)
endif() include_directories (${SODIUM_INCLUDE_DIRS})
set(POLLER "" CACHE STRING "Choose polling system. valid values are # On Solaris, libsodium depends on libssp
if (${CMAKE_SYSTEM_NAME} matches "SunOS")
target_link_libraries (libzmq ssp)
endif ()
else ()
message (FATAL_ERROR
"libsodium is not installed. Install it, then run CMake again")
endif ()
else ()
message (STATUS "Using tweetnacl for CURVE security")
add_definitions (-DZMQ_HAVE_CURVE -DHAVE_TWEETNACL)
include_directories (tweetnacl/contrib/randombytes tweetnacl/src)
list (APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/tweetnacl/src/tweetnacl.c)
# TODO: this should be a single coherent source file
if (WIN32)
list (APPEND sources
${CMAKE_CURRENT_SOURCE_DIR}/tweetnacl/contrib/randombytes/winrandom.c)
else ()
list (APPEND sources
${CMAKE_CURRENT_SOURCE_DIR}/tweetnacl/contrib/randombytes/devurandom.c)
endif ()
endif ()
set (POLLER "" CACHE STRING "Choose polling system. valid values are
kqueue, epoll, devpoll, poll or select [default=autodetect]") kqueue, epoll, devpoll, poll or select [default=autodetect]")
include(CheckFunctionExists) include (CheckFunctionExists)
include(CheckTypeSize) include (CheckTypeSize)
if(POLLER STREQUAL "")
set(CMAKE_REQUIRED_INCLUDES sys/event.h) if (POLLER STREQUAL "")
check_function_exists(kqueue HAVE_KQUEUE) set (CMAKE_REQUIRED_INCLUDES sys/event.h)
set(CMAKE_REQUIRED_INCLUDES ) check_function_exists (kqueue HAVE_KQUEUE)
if(HAVE_KQUEUE) set (CMAKE_REQUIRED_INCLUDES)
set(POLLER "kqueue") if (HAVE_KQUEUE)
else() set (POLLER "kqueue")
set(CMAKE_REQUIRED_INCLUDES sys/epoll.h)
check_function_exists(epoll_create HAVE_EPOLL)
set(CMAKE_REQUIRED_INCLUDES )
if(HAVE_EPOLL)
set(POLLER "epoll")
else()
set(CMAKE_REQUIRED_INCLUDES sys/devpoll.h)
check_type_size("struct pollfd" DEVPOLL)
set(CMAKE_REQUIRED_INCLUDES )
if(HAVE_DEVPOLL)
set(POLLER "devpoll")
else()
set(CMAKE_REQUIRED_INCLUDES poll.h)
check_function_exists(poll HAVE_POLL)
set(CMAKE_REQUIRED_INCLUDES )
if(HAVE_POLL)
set(POLLER "poll")
else()
if(WIN32)
set(CMAKE_REQUIRED_INCLUDES winsock2.h)
set(HAVE_SELECT 1)
else()
set(CMAKE_REQUIRED_INCLUDES sys/select.h)
check_function_exists(select HAVE_SELECT)
endif() endif()
set(CMAKE_REQUIRED_INCLUDES ) endif ()
if(HAVE_SELECT)
set(POLLER "select") if (POLLER STREQUAL "")
else() set (CMAKE_REQUIRED_INCLUDES sys/epoll.h)
message(FATAL_ERROR check_function_exists (epoll_create HAVE_EPOLL)
set (CMAKE_REQUIRED_INCLUDES)
if (HAVE_EPOLL)
set (POLLER "epoll")
endif ()
endif ()
if (POLLER STREQUAL "")
set (CMAKE_REQUIRED_INCLUDES sys/devpoll.h)
check_type_size ("struct pollfd" DEVPOLL)
set (CMAKE_REQUIRED_INCLUDES)
if (HAVE_DEVPOLL)
set (POLLER "devpoll")
endif ()
endif ()
if (POLLER STREQUAL "")
set (CMAKE_REQUIRED_INCLUDES poll.h)
check_function_exists (poll HAVE_POLL)
set (CMAKE_REQUIRED_INCLUDES)
if (HAVE_POLL)
set (POLLER "poll")
endif ()
endif ()
if (POLLER STREQUAL "")
if (WIN32)
set (CMAKE_REQUIRED_INCLUDES winsock2.h)
set (HAVE_SELECT 1)
else ()
set (CMAKE_REQUIRED_INCLUDES sys/select.h)
check_function_exists (select HAVE_SELECT)
set (CMAKE_REQUIRED_INCLUDES)
endif ()
if (HAVE_SELECT)
set (POLLER "select")
else ()
message (FATAL_ERROR
"Could not autodetect polling method") "Could not autodetect polling method")
endif() endif ()
endif() endif ()
endif()
endif()
endif()
endif()
if( NOT POLLER STREQUAL "kqueue"
AND NOT POLLER STREQUAL "epoll"
AND NOT POLLER STREQUAL "devpoll"
AND NOT POLLER STREQUAL "poll"
AND NOT POLLER STREQUAL "select")
message(FATAL_ERROR "Invalid polling method")
endif()
if(NOT ${POLLER} STREQUAL "")
string(TOUPPER ${POLLER} UPPER_POLLER)
set(ZMQ_USE_${UPPER_POLLER} 1)
endif()
set(ZMQ_CMAKE_MODULES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/Modules)
list(APPEND CMAKE_MODULE_PATH ${ZMQ_CMAKE_MODULES_DIR})
include(TestZMQVersion)
include(ZMQSourceRunChecks)
include(CheckIncludeFiles)
include(CheckLibraryExists)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckCSourceCompiles)
include(CheckCSourceRuns)
include(CMakeDependentOption)
include(CheckCXXSymbolExists)
check_include_files(ifaddrs.h ZMQ_HAVE_IFADDRS)
check_include_files(windows.h ZMQ_HAVE_WINDOWS)
check_include_files(sys/uio.h ZMQ_HAVE_UIO)
check_include_files(sys/eventfd.h ZMQ_HAVE_EVENTFD)
check_library_exists(ws2_32 fopen "" HAVE_WS2_32) # TODO: Why doesn't something logical like WSAStartup work?
check_library_exists(ws2 fopen "" HAVE_WS2)
check_library_exists(rpcrt4 fopen "" HAVE_RPCRT4) # UuidCreateSequential
check_library_exists(iphlpapi fopen "" HAVE_IPHLAPI) # GetAdaptersAddresses
check_cxx_symbol_exists(SO_PEERCRED sys/socket.h ZMQ_HAVE_SO_PEERCRED)
check_cxx_symbol_exists(LOCAL_PEERCRED sys/socket.h ZMQ_HAVE_LOCAL_PEERCRED)
find_library(RT_LIBRARY rt)
find_package(Threads)
if(WIN32 AND NOT CYGWIN)
if(NOT HAVE_WS2_32 AND NOT HAVE_WS2)
message(FATAL_ERROR "Cannot link to ws2_32 or ws2")
endif()
if(NOT HAVE_RPCRT4) if (POLLER STREQUAL "kqueue"
message(FATAL_ERROR "Cannot link to rpcrt4") OR POLLER STREQUAL "epoll"
endif() OR POLLER STREQUAL "devpoll"
OR POLLER STREQUAL "poll"
OR POLLER STREQUAL "select")
message (STATUS "Detected ${POLLER} polling method")
string (TOUPPER ${POLLER} UPPER_POLLER)
set (ZMQ_USE_${UPPER_POLLER} 1)
else ()
message (FATAL_ERROR "Invalid polling method")
endif ()
if(NOT HAVE_IPHLAPI) set (ZMQ_CMAKE_MODULES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/Modules)
message(FATAL_ERROR "Cannot link to iphlapi") list (APPEND CMAKE_MODULE_PATH ${ZMQ_CMAKE_MODULES_DIR})
endif()
endif()
set(CMAKE_REQUIRED_LIBRARIES rt) include (TestZMQVersion)
check_function_exists(clock_gettime HAVE_CLOCK_GETTIME) include (ZMQSourceRunChecks)
set(CMAKE_REQUIRED_LIBRARIES ) include (CheckIncludeFiles)
include (CheckLibraryExists)
include (CheckCCompilerFlag)
include (CheckCXXCompilerFlag)
include (CheckCSourceCompiles)
include (CheckCSourceRuns)
include (CMakeDependentOption)
include (CheckCXXSymbolExists)
set(CMAKE_REQUIRED_INCLUDES unistd.h) check_include_files (ifaddrs.h ZMQ_HAVE_IFADDRS)
check_function_exists(fork HAVE_FORK) check_include_files (windows.h ZMQ_HAVE_WINDOWS)
set(CMAKE_REQUIRED_INCLUDES ) check_include_files (sys/uio.h ZMQ_HAVE_UIO)
check_include_files (sys/eventfd.h ZMQ_HAVE_EVENTFD)
set(CMAKE_REQUIRED_INCLUDES sys/time.h) check_library_exists (ws2_32 fopen "" HAVE_WS2_32) # TODO: Why doesn't something logical like WSAStartup work?
check_function_exists(gethrtime HAVE_GETHRTIME) check_library_exists (ws2 fopen "" HAVE_WS2)
set(CMAKE_REQUIRED_INCLUDES ) check_library_exists (rpcrt4 fopen "" HAVE_RPCRT4) # UuidCreateSequential
check_library_exists (iphlpapi fopen "" HAVE_IPHLAPI) # GetAdaptersAddresses
add_definitions(-D_REENTRANT -D_THREAD_SAFE) check_cxx_symbol_exists (SO_PEERCRED sys/socket.h ZMQ_HAVE_SO_PEERCRED)
add_definitions(-DZMQ_USING_CMAKE) check_cxx_symbol_exists (LOCAL_PEERCRED sys/socket.h ZMQ_HAVE_LOCAL_PEERCRED)
option(ENABLE_EVENTFD "Enable/disable eventfd" ZMQ_HAVE_EVENTFD) find_library (RT_LIBRARY rt)
macro(zmq_check_cxx_flag_prepend flag) find_package (Threads)
check_cxx_compiler_flag("${flag}" HAVE_FLAG_${flag})
if(HAVE_FLAG_${flag})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
endif()
endmacro()
if (WIN32 AND NOT CYGWIN)
if (NOT HAVE_WS2_32 AND NOT HAVE_WS2)
message (FATAL_ERROR "Cannot link to ws2_32 or ws2")
endif ()
if(MSVC) if (NOT HAVE_RPCRT4)
zmq_check_cxx_flag_prepend("/W3") message (FATAL_ERROR "Cannot link to rpcrt4")
endif ()
if(MSVC_IDE) if (NOT HAVE_IPHLAPI)
set(MSVC_TOOLSET "-${CMAKE_VS_PLATFORM_TOOLSET}") message (FATAL_ERROR "Cannot link to iphlapi")
else() endif ()
set(MSVC_TOOLSET "") endif ()
endif()
else()
zmq_check_cxx_flag_prepend("-Wall")
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") set (CMAKE_REQUIRED_LIBRARIES rt)
zmq_check_cxx_flag_prepend("-Wextra") check_function_exists (clock_gettime HAVE_CLOCK_GETTIME)
endif() set (CMAKE_REQUIRED_LIBRARIES)
zmq_check_cxx_flag_prepend("-Wno-long-long") set (CMAKE_REQUIRED_INCLUDES unistd.h)
zmq_check_cxx_flag_prepend("-Wno-uninitialized") check_function_exists (fork HAVE_FORK)
set (CMAKE_REQUIRED_INCLUDES)
option(LIBZMQ_PEDANTIC "" ON) set (CMAKE_REQUIRED_INCLUDES sys/time.h)
option(LIBZMQ_WERROR "" OFF) check_function_exists (gethrtime HAVE_GETHRTIME)
set (CMAKE_REQUIRED_INCLUDES)
if(LIBZMQ_PEDANTIC) add_definitions (-D_REENTRANT -D_THREAD_SAFE)
zmq_check_cxx_flag_prepend("-pedantic") add_definitions (-DZMQ_USING_CMAKE)
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Intel") option (ENABLE_EVENTFD "Enable/disable eventfd" ZMQ_HAVE_EVENTFD)
zmq_check_cxx_flag_prepend("-strict-ansi")
endif()
if(${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro") macro (zmq_check_cxx_flag_prepend flag)
zmq_check_cxx_flag_prepend("-compat=5") check_cxx_compiler_flag ("${flag}" HAVE_FLAG_${flag})
endif()
endif() if (HAVE_FLAG_${flag})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
endif ()
endmacro ()
if (MSVC)
zmq_check_cxx_flag_prepend ("/W3")
if (MSVC_IDE)
set (MSVC_TOOLSET "-${CMAKE_VS_PLATFORM_TOOLSET}")
else ()
set (MSVC_TOOLSET "")
endif ()
else ()
zmq_check_cxx_flag_prepend ("-Wall")
endif ()
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
zmq_check_cxx_flag_prepend ("-Wextra")
endif ()
# TODO: why is -Wno-long-long defined differently than in configure.ac?
zmq_check_cxx_flag_prepend ("-Wno-long-long")
zmq_check_cxx_flag_prepend ("-Wno-uninitialized")
option (LIBZMQ_PEDANTIC "" ON)
option (LIBZMQ_WERROR "" OFF)
if (LIBZMQ_PEDANTIC)
zmq_check_cxx_flag_prepend ("-pedantic")
if (${CMAKE_CXX_COMPILER_ID} MATCHES "Intel")
zmq_check_cxx_flag_prepend ("-strict-ansi")
endif ()
if(LIBZMQ_WERROR) if (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
zmq_check_cxx_flag_prepend("-Werror") zmq_check_cxx_flag_prepend ("-compat=5")
zmq_check_cxx_flag_prepend("-errwarn=%all") endif ()
endif() endif ()
if (LIBZMQ_WERROR)
zmq_check_cxx_flag_prepend ("-Werror")
zmq_check_cxx_flag_prepend ("-errwarn=%all")
endif ()
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc") if (CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc")
zmq_check_cxx_flag_prepend("-mcpu=v9") zmq_check_cxx_flag_prepend ("-mcpu=v9")
endif() endif ()
if(${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro") if (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
zmq_check_cxx_flag_prepend("-features=zla") zmq_check_cxx_flag_prepend ("-features=zla")
endif() endif ()
if(CMAKE_SYSTEM_NAME MATCHES "SunOS" OR CMAKE_SYSTEM_NAME MATCHES "NetBSD") if (CMAKE_SYSTEM_NAME MATCHES "SunOS" OR CMAKE_SYSTEM_NAME MATCHES "NetBSD")
message(STATUS "Checking whether atomic operations can be used") message (STATUS "Checking whether atomic operations can be used")
check_c_source_compiles( check_c_source_compiles (
" "
#include <atomic.h> #include <atomic.h>
int main() int main ()
{ {
uint32_t value; uint32_t value;
atomic_cas_32(&value, 0, 0); atomic_cas_32 (&value, 0, 0);
return 0; return 0;
} }
" "
HAVE_ATOMIC_H) HAVE_ATOMIC_H)
if(NOT HAVE_ATOMIC_H) if (NOT HAVE_ATOMIC_H)
set(ZMQ_FORCE_MUTEXES 1) set (ZMQ_FORCE_MUTEXES 1)
endif() endif ()
endif() endif ()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
zmq_check_sock_cloexec() zmq_check_sock_cloexec ()
zmq_check_so_keepalive() zmq_check_so_keepalive ()
zmq_check_tcp_keepcnt() zmq_check_tcp_keepcnt ()
zmq_check_tcp_keepidle() zmq_check_tcp_keepidle ()
zmq_check_tcp_keepintvl() zmq_check_tcp_keepintvl ()
zmq_check_tcp_keepalive() zmq_check_tcp_keepalive ()
if( CMAKE_SYSTEM_NAME MATCHES "Linux" if ( CMAKE_SYSTEM_NAME MATCHES "Linux"
OR CMAKE_SYSTEM_NAME MATCHES "GNU/kFreeBSD" OR CMAKE_SYSTEM_NAME MATCHES "GNU/kFreeBSD"
OR CMAKE_SYSTEM_NAME MATCHES "GNU/Hurd" OR CMAKE_SYSTEM_NAME MATCHES "GNU/Hurd"
OR CYGWIN) OR CYGWIN)
add_definitions(-D_GNU_SOURCE) add_definitions (-D_GNU_SOURCE)
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
add_definitions(-D__BSD_VISIBLE) add_definitions (-D__BSD_VISIBLE)
elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD") elseif (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
add_definitions(-D_NETBSD_SOURCE) add_definitions (-D_NETBSD_SOURCE)
elseif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") elseif (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
add_definitions(-D_OPENBSD_SOURCE) add_definitions (-D_OPENBSD_SOURCE)
elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS") elseif (CMAKE_SYSTEM_NAME MATCHES "SunOS")
add_definitions(-D_PTHREADS) add_definitions (-D_PTHREADS)
elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX") elseif (CMAKE_SYSTEM_NAME MATCHES "HP-UX")
add_definitions(-D_POSIX_C_SOURCE=200112L) add_definitions (-D_POSIX_C_SOURCE=200112L)
zmq_check_cxx_flag_prepend(-Ae) zmq_check_cxx_flag_prepend (-Ae)
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin") elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_definitions(-D_DARWIN_C_SOURCE) add_definitions (-D_DARWIN_C_SOURCE)
endif() endif ()
set(CMAKE_PYTHON_VERSION 2.7 2.6 2.5 2.4) set (CMAKE_PYTHON_VERSION 2.7 2.6 2.5 2.4)
find_package(PythonInterp) find_package (PythonInterp)
find_package(AsciiDoc) find_package (AsciiDoc)
cmake_dependent_option(WITH_DOC "Build Reference Guide documentation(requires DocBook)" ON cmake_dependent_option (WITH_DOC "Build Reference Guide documentation (requires DocBook)" ON
"PYTHON_FOUND;ASCIIDOC_FOUND" OFF) "PYTHON_FOUND;ASCIIDOC_FOUND" OFF)
if(MSVC) if (MSVC)
if(WITH_OPENPGM) if (WITH_OPENPGM)
# set(OPENPGM_ROOT "" CACHE PATH "Location of OpenPGM") # set (OPENPGM_ROOT "" CACHE PATH "Location of OpenPGM")
set(OPENPGM_VERSION_MAJOR 5) set (OPENPGM_VERSION_MAJOR 5)
set(OPENPGM_VERSION_MINOR 2) set (OPENPGM_VERSION_MINOR 2)
set(OPENPGM_VERSION_MICRO 122) set (OPENPGM_VERSION_MICRO 122)
if(CMAKE_CL_64) if (CMAKE_CL_64)
find_path(OPENPGM_ROOT include/pgm/pgm.h find_path (OPENPGM_ROOT include/pgm/pgm.h
PATHS PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
NO_DEFAULT_PATH NO_DEFAULT_PATH
) )
message(STATUS "OpenPGM x64 detected - ${OPENPGM_ROOT}") message (STATUS "OpenPGM x64 detected - ${OPENPGM_ROOT}")
else() else ()
find_path(OPENPGM_ROOT include/pgm/pgm.h find_path (OPENPGM_ROOT include/pgm/pgm.h
PATHS PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
NO_DEFAULT_PATH NO_DEFAULT_PATH
) )
message(STATUS "OpenPGM x86 detected - ${OPENPGM_ROOT}") message (STATUS "OpenPGM x86 detected - ${OPENPGM_ROOT}")
endif(CMAKE_CL_64) endif (CMAKE_CL_64)
set(OPENPGM_INCLUDE_DIRS ${OPENPGM_ROOT}/include) set (OPENPGM_INCLUDE_DIRS ${OPENPGM_ROOT}/include)
set(OPENPGM_LIBRARY_DIRS ${OPENPGM_ROOT}/lib) set (OPENPGM_LIBRARY_DIRS ${OPENPGM_ROOT}/lib)
set(OPENPGM_LIBRARIES set (OPENPGM_LIBRARIES
optimized libpgm${MSVC_TOOLSET}-mt-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib optimized libpgm${MSVC_TOOLSET}-mt-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib
debug libpgm${MSVC_TOOLSET}-mt-gd-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib) debug libpgm${MSVC_TOOLSET}-mt-gd-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib)
endif() endif ()
else() else ()
if(WITH_OPENPGM) if (WITH_OPENPGM)
message(FATAL_ERROR "WITH_OPENPGM not implemented") message (FATAL_ERROR "WITH_OPENPGM not implemented")
# DSO symbol visibility for openpgm # DSO symbol visibility for openpgm
if(HAVE_FLAG_VISIBILITY_HIDDEN) if (HAVE_FLAG_VISIBILITY_HIDDEN)
elseif(HAVE_FLAG_LDSCOPE_HIDDEN) elseif (HAVE_FLAG_LDSCOPE_HIDDEN)
endif() endif ()
endif() endif ()
endif() endif ()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# force off-tree build # force off-tree build
if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) if (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
message(FATAL_ERROR "CMake generation is not allowed within the source directory! message (FATAL_ERROR "CMake generation is not allowed within the source directory!
Remove the CMakeCache.txt file and try again from another folder, e.g.: Remove the CMakeCache.txt file and try again from another folder, e.g.:
rm CMakeCache.txt rm CMakeCache.txt
...@@ -336,50 +355,50 @@ Remove the CMakeCache.txt file and try again from another folder, e.g.: ...@@ -336,50 +355,50 @@ Remove the CMakeCache.txt file and try again from another folder, e.g.:
cd cmake-make cd cmake-make
cmake .. cmake ..
") ")
endif() endif ()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# default to Release build # default to Release build
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
# CMAKE_BUILD_TYPE is not used for multi-configuration generators like Visual Studio/XCode # CMAKE_BUILD_TYPE is not used for multi-configuration generators like Visual Studio/XCode
# which instead use CMAKE_CONFIGURATION_TYPES # which instead use CMAKE_CONFIGURATION_TYPES
set(CMAKE_BUILD_TYPE Release CACHE STRING set (CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE) FORCE)
endif() endif ()
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin) set (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib) set (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# platform specifics # platform specifics
if (WIN32) if (WIN32)
# NB: May require tweaking for highly connected applications. # Socket limit is 4K (can be raised arbitrarily)
add_definitions (-DFD_SETSIZE=4096) add_definitions (-DFD_SETSIZE=4096)
add_definitions (-D_CRT_SECURE_NO_WARNINGS) add_definitions (-D_CRT_SECURE_NO_WARNINGS)
endif () endif ()
if(MSVC) if (MSVC)
# Parallel make. # Parallel make.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
# Optimization flags. # Optimization flags.
# http://msdn.microsoft.com/en-us/magazine/cc301698.aspx # http://msdn.microsoft.com/en-us/magazine/cc301698.aspx
if(NOT ${CMAKE_BUILD_TYPE} MATCHES "Debug") if (NOT ${CMAKE_BUILD_TYPE} MATCHES "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GL") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GL")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LTCG") set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LTCG")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LTCG") set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LTCG")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /LTCG") set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /LTCG")
endif() endif ()
endif() endif ()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# source files # source files
set(cxx-sources set (cxx-sources
address.cpp address.cpp
client.cpp client.cpp
clock.cpp clock.cpp
...@@ -464,22 +483,22 @@ set(cxx-sources ...@@ -464,22 +483,22 @@ set(cxx-sources
udp_engine.cpp udp_engine.cpp
udp_address.cpp) udp_address.cpp)
set(rc-sources version.rc) set (rc-sources version.rc)
if(MINGW) if (MINGW)
# Generate the right type when using -m32 or -m64 # Generate the right type when using -m32 or -m64
macro(set_rc_arch rc_target) macro (set_rc_arch rc_target)
set(CMAKE_RC_COMPILER_INIT windres) set (CMAKE_RC_COMPILER_INIT windres)
enable_language(RC) enable_language (RC)
set(CMAKE_RC_COMPILE_OBJECT set (CMAKE_RC_COMPILE_OBJECT
"<CMAKE_RC_COMPILER> <FLAGS> -O coff --target=${rc_target} <DEFINES> -i <SOURCE> -o <OBJECT>") "<CMAKE_RC_COMPILER> <FLAGS> -O coff --target=${rc_target} <DEFINES> -i <SOURCE> -o <OBJECT>")
endmacro() endmacro ()
if (NOT CMAKE_SYSTEM_PROCESSOR ) if (NOT CMAKE_SYSTEM_PROCESSOR)
set (CMAKE_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR} ) set (CMAKE_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR})
endif () endif ()
if( CMAKE_SYSTEM_PROCESSOR MATCHES "i386" if ( CMAKE_SYSTEM_PROCESSOR MATCHES "i386"
OR CMAKE_SYSTEM_PROCESSOR MATCHES "i486" OR CMAKE_SYSTEM_PROCESSOR MATCHES "i486"
OR CMAKE_SYSTEM_PROCESSOR MATCHES "i586" OR CMAKE_SYSTEM_PROCESSOR MATCHES "i586"
OR CMAKE_SYSTEM_PROCESSOR MATCHES "i686" OR CMAKE_SYSTEM_PROCESSOR MATCHES "i686"
...@@ -488,18 +507,18 @@ if(MINGW) ...@@ -488,18 +507,18 @@ if(MINGW)
OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64"
OR CMAKE_SYSTEM_PROCESSOR MATCHES "amd64") OR CMAKE_SYSTEM_PROCESSOR MATCHES "amd64")
if(CMAKE_SIZEOF_VOID_P EQUAL 8) if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set_rc_arch("pe-x86-64") set_rc_arch ("pe-x86-64")
else() else ()
set_rc_arch("pe-i386") set_rc_arch ("pe-i386")
endif() endif ()
endif() endif ()
endif() endif ()
include_directories(include ${CMAKE_CURRENT_BINARY_DIR}) include_directories (include ${CMAKE_CURRENT_BINARY_DIR})
set(public_headers include/zmq.h) set (public_headers include/zmq.h)
set(readme-docs AUTHORS set (readme-docs AUTHORS
COPYING COPYING
COPYING.LESSER COPYING.LESSER
MAINTAINERS MAINTAINERS
...@@ -508,57 +527,54 @@ set(readme-docs AUTHORS ...@@ -508,57 +527,54 @@ set(readme-docs AUTHORS
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# optional modules # optional modules
if(WITH_OPENPGM) if (WITH_OPENPGM)
add_definitions(-DZMQ_HAVE_OPENPGM) add_definitions (-DZMQ_HAVE_OPENPGM)
include_directories(${OPENPGM_INCLUDE_DIRS}) include_directories (${OPENPGM_INCLUDE_DIRS})
link_directories(${OPENPGM_LIBRARY_DIRS}) link_directories (${OPENPGM_LIBRARY_DIRS})
set(OPTIONAL_LIBRARIES ${OPENPGM_LIBRARIES}) set (OPTIONAL_LIBRARIES ${OPENPGM_LIBRARIES})
endif(WITH_OPENPGM) endif (WITH_OPENPGM)
if(WITH_VMCI) if (WITH_VMCI)
add_definitions(-DZMQ_HAVE_VMCI) add_definitions (-DZMQ_HAVE_VMCI)
include_directories(${VMCI_INCLUDE_DIRS}) include_directories (${VMCI_INCLUDE_DIRS})
list(APPEND cxx-sources vmci_address.cpp vmci_connecter.cpp vmci_listener.cpp vmci.cpp) list (APPEND cxx-sources vmci_address.cpp vmci_connecter.cpp vmci_listener.cpp vmci.cpp)
endif(WITH_VMCI) endif (WITH_VMCI)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# source generators # source generators
foreach(source ${cxx-sources}) foreach (source ${cxx-sources})
list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/src/${source}) list (APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/src/${source})
endforeach() endforeach ()
if(USE_TWEETNACL) foreach (source ${rc-sources})
foreach(source ${TWEETNACL_SOURCES}) list (APPEND sources ${CMAKE_CURRENT_BINARY_DIR}/${source})
list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/${source}) configure_file (${CMAKE_CURRENT_SOURCE_DIR}/src/${source}.in ${CMAKE_CURRENT_BINARY_DIR}/${source})
endforeach() endforeach ()
endif()
foreach(source ${rc-sources}) # Delete any src/platform.hpp left by configure
list(APPEND sources ${CMAKE_CURRENT_BINARY_DIR}/${source}) file (REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/src/platform.hpp)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/${source}.in ${CMAKE_CURRENT_BINARY_DIR}/${source})
endforeach()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/platform.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/platform.hpp) configure_file (${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/platform.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/platform.hpp)
list(APPEND sources ${CMAKE_CURRENT_BINARY_DIR}/platform.hpp) list (APPEND sources ${CMAKE_CURRENT_BINARY_DIR}/platform.hpp)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/libzmq.pc.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/libzmq.pc @ONLY) configure_file (${CMAKE_CURRENT_SOURCE_DIR}/src/libzmq.pc.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/libzmq.pc @ONLY)
set(zmq-pkgconfig ${CMAKE_CURRENT_BINARY_DIR}/libzmq.pc) set (zmq-pkgconfig ${CMAKE_CURRENT_BINARY_DIR}/libzmq.pc)
if(NOT ZMQ_BUILD_FRAMEWORK) if (NOT ZMQ_BUILD_FRAMEWORK)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libzmq.pc DESTINATION lib/pkgconfig) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libzmq.pc DESTINATION lib/pkgconfig)
endif() endif ()
if(MSVC) if (MSVC)
if(CMAKE_CL_64) if (CMAKE_CL_64)
set(nsis-template ${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/NSIS.template64.in) set (nsis-template ${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/NSIS.template64.in)
else() else ()
set(nsis-template ${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/NSIS.template32.in) set (nsis-template ${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/NSIS.template32.in)
endif() endif ()
add_custom_command( add_custom_command (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
ARGS -E ARGS -E
...@@ -566,16 +582,16 @@ if(MSVC) ...@@ -566,16 +582,16 @@ if(MSVC)
${nsis-template} ${nsis-template}
${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in ${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in
DEPENDS ${nsis-template}) DEPENDS ${nsis-template})
endif() endif ()
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc) file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc)
file(GLOB docs RELATIVE ${CMAKE_CURRENT_BINARY_DIR}/ "${CMAKE_CURRENT_SOURCE_DIR}/doc/*.txt") file (GLOB docs RELATIVE ${CMAKE_CURRENT_BINARY_DIR}/ "${CMAKE_CURRENT_SOURCE_DIR}/doc/*.txt")
set(html-docs) set (html-docs)
foreach(txt ${docs}) foreach (txt ${docs})
string(REGEX REPLACE ".*/(.*)\\.txt" "\\1.html" html ${txt}) string (REGEX REPLACE ".*/ (.*)\\.txt" "\\1.html" html ${txt})
set(src ${txt}) set (src ${txt})
set(dst doc/${html}) set (dst doc/${html})
add_custom_command( add_custom_command (
OUTPUT ${dst} OUTPUT ${dst}
COMMAND ${PYTHON_EXECUTABLE} COMMAND ${PYTHON_EXECUTABLE}
ARGS -x ARGS -x
...@@ -589,303 +605,303 @@ foreach(txt ${docs}) ...@@ -589,303 +605,303 @@ foreach(txt ${docs})
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${src} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${src}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating ${html}") COMMENT "Generating ${html}")
if(WITH_DOC) if (WITH_DOC)
list(APPEND html-docs ${CMAKE_CURRENT_BINARY_DIR}/${dst}) list (APPEND html-docs ${CMAKE_CURRENT_BINARY_DIR}/${dst})
endif() endif ()
endforeach() endforeach ()
if(ZMQ_BUILD_FRAMEWORK) if (ZMQ_BUILD_FRAMEWORK)
add_custom_command( add_custom_command (
TARGET libzmq TARGET libzmq
POST_BUILD POST_BUILD
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
ARGS -E make_directory "${CMAKE_LIBRARY_OUTPUT_PATH}/ZeroMQ.framework/Versions/${ZMQ_VERSION}/MacOS" ARGS -E make_directory "${CMAKE_LIBRARY_OUTPUT_PATH}/ZeroMQ.framework/Versions/${ZMQ_VERSION}/MacOS"
COMMENT "Perf tools") COMMENT "Perf tools")
endif() endif ()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# output # output
if(MSVC) if (MSVC)
add_library(libzmq SHARED ${sources} ${public_headers} ${html-docs} ${readme-docs} ${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in) add_library (libzmq SHARED ${sources} ${public_headers} ${html-docs} ${readme-docs} ${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in)
target_link_libraries(libzmq ${OPTIONAL_LIBRARIES}) target_link_libraries (libzmq ${OPTIONAL_LIBRARIES})
set_target_properties(libzmq PROPERTIES set_target_properties (libzmq PROPERTIES
PUBLIC_HEADER "${public_headers}" PUBLIC_HEADER "${public_headers}"
RELEASE_POSTFIX "${MSVC_TOOLSET}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" RELEASE_POSTFIX "${MSVC_TOOLSET}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
RELWITHDEBINFO_POSTFIX "${MSVC_TOOLSET}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" RELWITHDEBINFO_POSTFIX "${MSVC_TOOLSET}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
DEBUG_POSTFIX "${MSVC_TOOLSET}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" DEBUG_POSTFIX "${MSVC_TOOLSET}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"
COMPILE_DEFINITIONS "DLL_EXPORT") COMPILE_DEFINITIONS "DLL_EXPORT")
add_library(libzmq-static STATIC ${sources}) add_library (libzmq-static STATIC ${sources})
set_target_properties(libzmq-static PROPERTIES set_target_properties (libzmq-static PROPERTIES
PUBLIC_HEADER "${public_headers}" PUBLIC_HEADER "${public_headers}"
RELEASE_POSTFIX "${MSVC_TOOLSET}-mt-s-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" RELEASE_POSTFIX "${MSVC_TOOLSET}-mt-s-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
RELWITHDEBINFO_POSTFIX "${MSVC_TOOLSET}-mt-s-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" RELWITHDEBINFO_POSTFIX "${MSVC_TOOLSET}-mt-s-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
DEBUG_POSTFIX "${MSVC_TOOLSET}-mt-sgd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" DEBUG_POSTFIX "${MSVC_TOOLSET}-mt-sgd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
COMPILE_FLAGS "/D ZMQ_STATIC" COMPILE_FLAGS "/D ZMQ_STATIC"
OUTPUT_NAME "libzmq-static") OUTPUT_NAME "libzmq-static")
else() else ()
add_library(libzmq SHARED ${sources} ${public_headers} ${html-docs} ${readme-docs} ${zmq-pkgconfig}) add_library (libzmq SHARED ${sources} ${public_headers} ${html-docs} ${readme-docs} ${zmq-pkgconfig})
set_target_properties(libzmq PROPERTIES set_target_properties (libzmq PROPERTIES
COMPILE_DEFINITIONS "DLL_EXPORT" COMPILE_DEFINITIONS "DLL_EXPORT"
PUBLIC_HEADER "${public_headers}" PUBLIC_HEADER "${public_headers}"
VERSION ${ZMQ_VERSION} VERSION ${ZMQ_VERSION}
SOVERSION "${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.0" SOVERSION "${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.0"
OUTPUT_NAME "libzmq" OUTPUT_NAME "libzmq"
PREFIX "") PREFIX "")
if(ZMQ_BUILD_FRAMEWORK) if (ZMQ_BUILD_FRAMEWORK)
set_target_properties(libzmq PROPERTIES set_target_properties (libzmq PROPERTIES
FRAMEWORK TRUE FRAMEWORK TRUE
MACOSX_FRAMEWORK_IDENTIFIER "org.zeromq.libzmq" MACOSX_FRAMEWORK_IDENTIFIER "org.zeromq.libzmq"
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${ZMQ_VERSION} MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${ZMQ_VERSION}
MACOSX_FRAMEWORK_BUNDLE_VERSION ${ZMQ_VERSION}) MACOSX_FRAMEWORK_BUNDLE_VERSION ${ZMQ_VERSION})
set_source_files_properties(${html-docs} PROPERTIES set_source_files_properties (${html-docs} PROPERTIES
MACOSX_PACKAGE_LOCATION doc) MACOSX_PACKAGE_LOCATION doc)
set_source_files_properties(${readme-docs} PROPERTIES set_source_files_properties (${readme-docs} PROPERTIES
MACOSX_PACKAGE_LOCATION etc) MACOSX_PACKAGE_LOCATION etc)
set_source_files_properties(${zmq-pkgconfig} PROPERTIES set_source_files_properties (${zmq-pkgconfig} PROPERTIES
MACOSX_PACKAGE_LOCATION lib/pkgconfig) MACOSX_PACKAGE_LOCATION lib/pkgconfig)
endif() endif ()
add_library(libzmq-static STATIC ${sources} ${public_headers} ${html-docs} ${readme-docs} ${zmq-pkgconfig}) add_library (libzmq-static STATIC ${sources} ${public_headers} ${html-docs} ${readme-docs} ${zmq-pkgconfig})
set_target_properties(libzmq-static PROPERTIES set_target_properties (libzmq-static PROPERTIES
PUBLIC_HEADER "${public_headers}" PUBLIC_HEADER "${public_headers}"
COMPILE_DEFINITIONS "ZMQ_STATIC" COMPILE_DEFINITIONS "ZMQ_STATIC"
OUTPUT_NAME "libzmq-static" OUTPUT_NAME "libzmq-static"
PREFIX "") PREFIX "")
endif() endif ()
target_link_libraries(libzmq ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries (libzmq ${CMAKE_THREAD_LIBS_INIT})
if(SODIUM_FOUND) if (SODIUM_FOUND)
target_link_libraries(libzmq ${SODIUM_LIBRARIES}) target_link_libraries (libzmq ${SODIUM_LIBRARIES})
endif() endif ()
if(HAVE_WS2_32) if (HAVE_WS2_32)
target_link_libraries(libzmq ws2_32) target_link_libraries (libzmq ws2_32)
elseif(HAVE_WS2) elseif (HAVE_WS2)
target_link_libraries(libzmq ws2) target_link_libraries (libzmq ws2)
endif() endif ()
if(HAVE_RPCRT4) if (HAVE_RPCRT4)
target_link_libraries(libzmq rpcrt4) target_link_libraries (libzmq rpcrt4)
endif() endif ()
if(HAVE_IPHLAPI) if (HAVE_IPHLAPI)
target_link_libraries(libzmq iphlpapi) target_link_libraries (libzmq iphlpapi)
endif() endif ()
if(RT_LIBRARY) if (RT_LIBRARY)
target_link_libraries(libzmq ${RT_LIBRARY}) target_link_libraries (libzmq ${RT_LIBRARY})
endif() endif ()
set(perf-tools local_lat set (perf-tools local_lat
remote_lat remote_lat
local_thr local_thr
remote_thr remote_thr
inproc_lat inproc_lat
inproc_thr) inproc_thr)
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") # Why? if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") # Why?
option(WITH_PERF_TOOL "Build with perf-tools" ON) option (WITH_PERF_TOOL "Build with perf-tools" ON)
else() else ()
option(WITH_PERF_TOOL "Build with perf-tools" OFF) option (WITH_PERF_TOOL "Build with perf-tools" OFF)
endif() endif ()
if(WITH_PERF_TOOL) if (WITH_PERF_TOOL)
foreach(perf-tool ${perf-tools}) foreach (perf-tool ${perf-tools})
add_executable(${perf-tool} perf/${perf-tool}.cpp) add_executable (${perf-tool} perf/${perf-tool}.cpp)
target_link_libraries(${perf-tool} libzmq) target_link_libraries (${perf-tool} libzmq)
if(RT_LIBRARY) if (RT_LIBRARY)
target_link_libraries(${perf-tool} ${RT_LIBRARY}) target_link_libraries (${perf-tool} ${RT_LIBRARY})
endif() endif ()
if(ZMQ_BUILD_FRAMEWORK) if (ZMQ_BUILD_FRAMEWORK)
# Copy perf-tools binaries into Framework # Copy perf-tools binaries into Framework
add_custom_command( add_custom_command (
TARGET libzmq ${perf-tool} TARGET libzmq ${perf-tool}
POST_BUILD POST_BUILD
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
ARGS -E copy "$<TARGET_FILE:${perf-tool}>" "${LIBRARY_OUTPUT_PATH}/ZeroMQ.framework/Versions/${ZMQ_VERSION_STRING}/MacOS/${perf-tool}" ARGS -E copy "$<TARGET_FILE:${perf-tool}>" "${LIBRARY_OUTPUT_PATH}/ZeroMQ.framework/Versions/${ZMQ_VERSION_STRING}/MacOS/${perf-tool}"
VERBATIM VERBATIM
COMMENT "Perf tools") COMMENT "Perf tools")
else() else ()
install(TARGETS ${perf-tool} install (TARGETS ${perf-tool}
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
COMPONENT PerfTools) COMPONENT PerfTools)
endif() endif ()
endforeach() endforeach ()
endif() endif ()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# tests # tests
set(ZMQ_BUILD_TESTS ON CACHE BOOL "Build the tests for ZeroMQ") set (ZMQ_BUILD_TESTS ON CACHE BOOL "Build the tests for ZeroMQ")
if(ZMQ_BUILD_TESTS) if (ZMQ_BUILD_TESTS)
enable_testing() # Enable testing only works in root scope enable_testing () # Enable testing only works in root scope
ADD_SUBDIRECTORY(tests) ADD_SUBDIRECTORY (tests)
endif() endif ()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# installer # installer
if(MSVC) if (MSVC)
install(TARGETS libzmq libzmq-static install (TARGETS libzmq libzmq-static
ARCHIVE DESTINATION lib ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib LIBRARY DESTINATION lib
PUBLIC_HEADER DESTINATION include PUBLIC_HEADER DESTINATION include
COMPONENT SDK) COMPONENT SDK)
if(CMAKE_BUILD_TYPE STREQUAL "Debug") if (CMAKE_BUILD_TYPE STREQUAL "Debug")
install(TARGETS libzmq libzmq-static install (TARGETS libzmq libzmq-static
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib ARCHIVE DESTINATION lib
PUBLIC_HEADER DESTINATION include PUBLIC_HEADER DESTINATION include
COMPONENT SDK) COMPONENT SDK)
if(NOT CMAKE_PDB_OUTPUT_DIRECTORY) if (NOT CMAKE_PDB_OUTPUT_DIRECTORY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/bin/libzmq${MSVC_TOOLSET}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}.pdb DESTINATION lib install (FILES ${CMAKE_CURRENT_BINARY_DIR}/bin/libzmq${MSVC_TOOLSET}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}.pdb DESTINATION lib
COMPONENT SDK) COMPONENT SDK)
endif() endif ()
else() else ()
install(TARGETS libzmq install (TARGETS libzmq
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
PUBLIC_HEADER DESTINATION include PUBLIC_HEADER DESTINATION include
COMPONENT Runtime) COMPONENT Runtime)
endif() endif ()
else() else ()
install(TARGETS libzmq libzmq-static install (TARGETS libzmq libzmq-static
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib LIBRARY DESTINATION lib
FRAMEWORK DESTINATION "Library/Frameworks" FRAMEWORK DESTINATION "Library/Frameworks"
PUBLIC_HEADER DESTINATION include) PUBLIC_HEADER DESTINATION include)
endif() endif ()
# install(FILES ${public_headers} # install (FILES ${public_headers}
# DESTINATION include # DESTINATION include
# COMPONENT SDK) # COMPONENT SDK)
#if(NOT ZMQ_BUILD_FRAMEWORK) #if (NOT ZMQ_BUILD_FRAMEWORK)
# file(GLOB private_headers "${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp") # file (GLOB private_headers "${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp")
# install(FILES ${sources} ${private_headers} DESTINATION src/zmq # install (FILES ${sources} ${private_headers} DESTINATION src/zmq
# COMPONENT SourceCode) # COMPONENT SourceCode)
#endif() #endif ()
foreach(readme ${readme-docs}) foreach (readme ${readme-docs})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${readme} ${CMAKE_CURRENT_BINARY_DIR}/${readme}.txt) configure_file (${CMAKE_CURRENT_SOURCE_DIR}/${readme} ${CMAKE_CURRENT_BINARY_DIR}/${readme}.txt)
if(NOT ZMQ_BUILD_FRAMEWORK) if (NOT ZMQ_BUILD_FRAMEWORK)
if(MSVC) if (MSVC)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${readme}.txt DESTINATION .) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${readme}.txt DESTINATION .)
else() else ()
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${readme}.txt DESTINATION share/zmq) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${readme}.txt DESTINATION share/zmq)
endif() endif ()
endif() endif ()
endforeach() endforeach ()
if(WITH_DOC) if (WITH_DOC)
if(NOT ZMQ_BUILD_FRAMEWORK) if (NOT ZMQ_BUILD_FRAMEWORK)
install(FILES ${html-docs} DESTINATION doc/zmq COMPONENT RefGuide) install (FILES ${html-docs} DESTINATION doc/zmq COMPONENT RefGuide)
endif() endif ()
endif() endif ()
if(MSVC) if (MSVC)
include(InstallRequiredSystemLibraries) include (InstallRequiredSystemLibraries)
if(CMAKE_CL_64) if (CMAKE_CL_64)
set(arch_name "x64") set (arch_name "x64")
else() else ()
set(arch_name "x86") set (arch_name "x86")
endif() endif ()
set(CPACK_NSIS_DISPLAY_NAME "ZeroMQ ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}(${arch_name})") set (CPACK_NSIS_DISPLAY_NAME "ZeroMQ ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH} (${arch_name})")
set(CPACK_PACKAGE_FILE_NAME "ZeroMQ-${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}-${arch_name}") set (CPACK_PACKAGE_FILE_NAME "ZeroMQ-${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}-${arch_name}")
# TODO: I think this part was intended to be used when running cpack # TODO: I think this part was intended to be used when running cpack
# separately from cmake but I don't know how that works. # separately from cmake but I don't know how that works.
# #
# macro(add_crt_version version) # macro (add_crt_version version)
# set(rel_dir "${CMAKE_CURRENT_BINARY_DIR}/build/${arch_name}/${version};ZeroMQ;ALL;/") # set (rel_dir "${CMAKE_CURRENT_BINARY_DIR}/build/${arch_name}/${version};ZeroMQ;ALL;/")
# set(debug_dir "${CMAKE_CURRENT_BINARY_DIR}/debug/${arch_name}/${version};ZeroMQ;ALL;/") # set (debug_dir "${CMAKE_CURRENT_BINARY_DIR}/debug/${arch_name}/${version};ZeroMQ;ALL;/")
# if(EXISTS ${rel_dir}) # if (EXISTS ${rel_dir})
# list(APPEND CPACK_INSTALL_CMAKE_PROJECTS ${rel_dir}) # list (APPEND CPACK_INSTALL_CMAKE_PROJECTS ${rel_dir})
# endif() # endif ()
# if(EXISTS ${debug_dir}) # if (EXISTS ${debug_dir})
# list(APPEND CPACK_INSTALL_CMAKE_PROJECTS ${rel_dir}) # list (APPEND CPACK_INSTALL_CMAKE_PROJECTS ${rel_dir})
# endmacro() # endmacro ()
# endmacro() # endmacro ()
# add_crt_version(v110) # add_crt_version (v110)
# add_crt_version(v100) # add_crt_version (v100)
# add_crt_version(v90) # add_crt_version (v90)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_BINARY_DIR}") set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_BINARY_DIR}")
set(CPACK_GENERATOR "NSIS") set (CPACK_GENERATOR "NSIS")
set(CPACK_PACKAGE_NAME "ZeroMQ") set (CPACK_PACKAGE_NAME "ZeroMQ")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "ZeroMQ lightweight messaging kernel") set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "ZeroMQ lightweight messaging kernel")
set(CPACK_PACKAGE_VENDOR "Miru") set (CPACK_PACKAGE_VENDOR "Miru")
set(CPACK_NSIS_CONTACT "Steven McCoy <Steven.McCoy@miru.hk>") set (CPACK_NSIS_CONTACT "Steven McCoy <Steven.McCoy@miru.hk>")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}\\\\COPYING.txt") set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}\\\\COPYING.txt")
# set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_BINARY_DIR}\\\\README.txt") # set (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_BINARY_DIR}\\\\README.txt")
# set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_BINARY_DIR}\\\\WELCOME.txt") # set (CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_BINARY_DIR}\\\\WELCOME.txt")
# There is a bug in NSI that does not handle full unix paths properly. Make # There is a bug in NSI that does not handle full unix paths properly. Make
# sure there is at least one set of four(4) backslashes. # sure there is at least one set of four (4) backslashes.
set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\installer.ico") set (CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\installer.ico")
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\installer.ico") set (CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\installer.ico")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\branding.bmp") set (CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\branding.bmp")
set(CPACK_NSIS_COMPRESSOR "/SOLID lzma") set (CPACK_NSIS_COMPRESSOR "/SOLID lzma")
set(CPACK_PACKAGE_VERSION ${ZMQ_VERSION}) set (CPACK_PACKAGE_VERSION ${ZMQ_VERSION})
set(CPACK_PACKAGE_VERSION_MAJOR ${ZMQ_VERSION_MAJOR}) set (CPACK_PACKAGE_VERSION_MAJOR ${ZMQ_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${ZMQ_VERSION_MINOR}) set (CPACK_PACKAGE_VERSION_MINOR ${ZMQ_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${ZMQ_VERSION_PATCH}) set (CPACK_PACKAGE_VERSION_PATCH ${ZMQ_VERSION_PATCH})
# set(CPACK_PACKAGE_INSTALL_DIRECTORY "ZMQ Install Directory") # set (CPACK_PACKAGE_INSTALL_DIRECTORY "ZMQ Install Directory")
# set(CPACK_TEMPORARY_DIRECTORY "ZMQ Temporary CPack Directory") # set (CPACK_TEMPORARY_DIRECTORY "ZMQ Temporary CPack Directory")
include(CPack) include (CPack)
cpack_add_component_group(Development cpack_add_component_group (Development
DISPLAY_NAME "ZeroMQ software development kit" DISPLAY_NAME "ZeroMQ software development kit"
EXPANDED) EXPANDED)
cpack_add_component(PerfTools cpack_add_component (PerfTools
DISPLAY_NAME "ZeroMQ performance tools" DISPLAY_NAME "ZeroMQ performance tools"
INSTALL_TYPES FullInstall DevInstall) INSTALL_TYPES FullInstall DevInstall)
cpack_add_component(SourceCode cpack_add_component (SourceCode
DISPLAY_NAME "ZeroMQ source code" DISPLAY_NAME "ZeroMQ source code"
DISABLED DISABLED
INSTALL_TYPES FullInstall) INSTALL_TYPES FullInstall)
cpack_add_component(SDK cpack_add_component (SDK
DISPLAY_NAME "ZeroMQ headers and libraries" DISPLAY_NAME "ZeroMQ headers and libraries"
INSTALL_TYPES FullInstall DevInstall INSTALL_TYPES FullInstall DevInstall
GROUP Development) GROUP Development)
if(WITH_DOC) if (WITH_DOC)
cpack_add_component(RefGuide cpack_add_component (RefGuide
DISPLAY_NAME "ZeroMQ reference guide" DISPLAY_NAME "ZeroMQ reference guide"
INSTALL_TYPES FullInstall DevInstall INSTALL_TYPES FullInstall DevInstall
GROUP Development) GROUP Development)
endif() endif ()
cpack_add_component(Runtime cpack_add_component (Runtime
DISPLAY_NAME "ZeroMQ runtime files" DISPLAY_NAME "ZeroMQ runtime files"
REQUIRED REQUIRED
INSTALL_TYPES FullInstall DevInstall MinInstall) INSTALL_TYPES FullInstall DevInstall MinInstall)
cpack_add_install_type(FullInstall cpack_add_install_type (FullInstall
DISPLAY_NAME "Full install, including source code") DISPLAY_NAME "Full install, including source code")
cpack_add_install_type(DevInstall cpack_add_install_type (DevInstall
DISPLAY_NAME "Developer install, headers and libraries") DISPLAY_NAME "Developer install, headers and libraries")
cpack_add_install_type(MinInstall cpack_add_install_type (MinInstall
DISPLAY_NAME "Minimal install, runtime only") DISPLAY_NAME "Minimal install, runtime only")
endif() endif ()
# Export this for library to help build this as a sub-project # Export this for library to help build this as a sub-project
set(ZEROMQ_LIBRARY libzmq CACHE STRING "ZeroMQ library") set (ZEROMQ_LIBRARY libzmq CACHE STRING "ZeroMQ library")
# Workaround for MSVS10 to avoid the Dialog Hell # Workaround for MSVS10 to avoid the Dialog Hell
# FIXME: This could be removed with future version of CMake. # FIXME: This could be removed with future version of CMake.
if(MSVC_VERSION EQUAL 1600) if (MSVC_VERSION EQUAL 1600)
set(ZMQ_SLN_FILENAME "${CMAKE_CURRENT_BINARY_DIR}/ZeroMQ.sln") set (ZMQ_SLN_FILENAME "${CMAKE_CURRENT_BINARY_DIR}/ZeroMQ.sln")
if(EXISTS "${ZMQ_SLN_FILENAME}") if (EXISTS "${ZMQ_SLN_FILENAME}")
file(APPEND "${ZMQ_SLN_FILENAME}" "\n# This should be regenerated!\n") file (APPEND "${ZMQ_SLN_FILENAME}" "\n# This should be regenerated!\n")
endif() endif ()
endif() endif ()
...@@ -269,11 +269,6 @@ src_libzmq_la_CPPFLAGS = ...@@ -269,11 +269,6 @@ src_libzmq_la_CPPFLAGS =
src_libzmq_la_CXXFLAGS = @LIBZMQ_EXTRA_CXXFLAGS@ src_libzmq_la_CXXFLAGS = @LIBZMQ_EXTRA_CXXFLAGS@
src_libzmq_la_LIBADD = src_libzmq_la_LIBADD =
if HAVE_SODIUM
src_libzmq_la_CPPFLAGS += ${sodium_CFLAGS}
src_libzmq_la_LIBADD += ${sodium_LIBS}
endif
if USE_TWEETNACL if USE_TWEETNACL
src_libzmq_la_SOURCES += \ src_libzmq_la_SOURCES += \
tweetnacl/src/tweetnacl.c \ tweetnacl/src/tweetnacl.c \
...@@ -283,6 +278,11 @@ src_libzmq_la_CXXFLAGS += \ ...@@ -283,6 +278,11 @@ src_libzmq_la_CXXFLAGS += \
-I$(top_builddir)/tweetnacl/src -I$(top_builddir)/tweetnacl/src
endif endif
if USE_LIBSODIUM
src_libzmq_la_CPPFLAGS += ${sodium_CFLAGS}
src_libzmq_la_LIBADD += ${sodium_LIBS}
endif
if HAVE_PGM if HAVE_PGM
src_libzmq_la_CPPFLAGS += ${pgm_CFLAGS} src_libzmq_la_CPPFLAGS += ${pgm_CFLAGS}
src_libzmq_la_LIBADD += ${pgm_LIBS} src_libzmq_la_LIBADD += ${pgm_LIBS}
......
...@@ -67,8 +67,6 @@ LIBZMQ_CHECK_ENABLE_DEBUG ...@@ -67,8 +67,6 @@ LIBZMQ_CHECK_ENABLE_DEBUG
# Check wheter to enable code coverage # Check wheter to enable code coverage
LIBZMQ_WITH_GCOV LIBZMQ_WITH_GCOV
AC_MSG_CHECKING([if TIPC is available and supports nonblocking connect]) AC_MSG_CHECKING([if TIPC is available and supports nonblocking connect])
AC_RUN_IFELSE( AC_RUN_IFELSE(
...@@ -103,7 +101,6 @@ AC_RUN_IFELSE( ...@@ -103,7 +101,6 @@ AC_RUN_IFELSE(
AC_MSG_RESULT([$libzmq_tipc_support]) AC_MSG_RESULT([$libzmq_tipc_support])
AC_ARG_WITH([relaxed], AC_ARG_WITH([relaxed],
[AS_HELP_STRING([--with-relaxed], [AS_HELP_STRING([--with-relaxed],
[Switch off pedantic compiler])], [Switch off pedantic compiler])],
...@@ -423,58 +420,49 @@ if test "x$require_libgssapi_krb5_ext" != "xno"; then ...@@ -423,58 +420,49 @@ if test "x$require_libgssapi_krb5_ext" != "xno"; then
AC_MSG_ERROR(libgssapi_krb5 is needed for GSSAPI security)) AC_MSG_ERROR(libgssapi_krb5 is needed for GSSAPI security))
fi fi
# build using libsodium # Select curve encryption library, defaults to tweetnacl
have_sodium_library="no" # To use libsodium instead, use --with-libsodium (must be installed)
# To disable curve, use --disable-curve
AC_ARG_WITH([libsodium], [AS_HELP_STRING([--with-libsodium],
[require libzmq build with libsodium crypto library. Requires pkg-config [default=check]])], AC_ARG_WITH([libsodium],
[require_libsodium_ext=$withval], AS_HELP_STRING([--with-libsodium], [Use libsodium instead of built-in tweetnacl [default=no]]))
[require_libsodium_ext=check])
AS_IF([test "x$with_libsodium" = "xyes"], [
AC_ARG_WITH([tweetnacl], [AS_HELP_STRING([--with-tweetnacl], PKG_CHECK_MODULES([sodium], [libsodium], [libsodium_found=yes], [
[build libzmq with bundled tweetnacl crypto library [default=no]])], AC_MSG_ERROR(libsodium is not installed. Install it, then run configure again)
[require_libsodium_ext=no
with_tweetnacl=yes
AC_MSG_CHECKING(for sodium)
AC_MSG_RESULT(tweetnacl)],
[with_tweetnacl=check])
# conditionally require libsodium package
if test "x$require_libsodium_ext" != "xno"; then
PKG_CHECK_MODULES([sodium], [libsodium],
[
have_sodium_library=yes
with_tweetnacl=no
],
[
if test "x$require_libsodium_ext" == "xyes"; then
AC_MSG_ERROR(libsodium has been requested but not found)
else
AC_MSG_RESULT([ libsodium not found, using tweetnacl])
have_sodium_library=no
with_tweetnacl=yes
fi
]) ])
fi ])
AC_ARG_ENABLE([curve],
AS_HELP_STRING([--disable-curve], [Disable CURVE security [default=no]]))
if test "x$have_sodium_library" != "xno"; then if test "x$enable_curve" == "xno"; then
AC_DEFINE(HAVE_LIBSODIUM, 1, [The libsodium library is to be used.]) curve_library=""
AC_MSG_NOTICE([CURVE security is disabled])
# ssp library is required for libsodium on Solaris-like systems elif test "x$with_libsodium" == "xyes"; then
AC_MSG_NOTICE([Using libsodium for CURVE security])
AC_DEFINE(ZMQ_HAVE_CURVE, [1], [Using curve encryption])
AC_DEFINE(HAVE_LIBSODIUM, [1], [Using libsodium for curve encryption])
curve_library="libsodium"
# On Solaris, libsodium depends on libssp
case "${host_os}" in case "${host_os}" in
*solaris*) *solaris*)
LDFLAGS="-lssp $LDFLAGS" LDFLAGS="-lssp $LDFLAGS"
CPPFLAGS="$CPPFLAGS -Wno-long-long" CPPFLAGS="-Wno-long-long $CPPFLAGS"
;; ;;
esac esac
elif test "x$with_tweetnacl" != "xno"; then else
AC_DEFINE(HAVE_LIBSODIUM, 1, [Sodium is provided by tweetnacl.]) AC_MSG_NOTICE([Using tweetnacl for CURVE security])
AC_DEFINE(HAVE_TWEETNACL, 1, [Using tweetnacl.]) AC_DEFINE(ZMQ_HAVE_CURVE, [1], [Using curve encryption])
libzmq_pedantic="no" AC_DEFINE(HAVE_TWEETNACL, [1], [Using tweetnacl for curve encryption])
curve_library="tweetnacl"
libzmq_pedantic="no" # Disable pedantic warnings
fi fi
AM_CONDITIONAL(HAVE_SODIUM, test "x$have_sodium_library" != "xno") AM_CONDITIONAL(USE_LIBSODIUM, test "$curve_library" == "sodium")
AM_CONDITIONAL(USE_TWEETNACL, test "x$with_tweetnacl" != "xno") AM_CONDITIONAL(USE_TWEETNACL, test "$curve_library" == "tweetnacl")
# build using pgm # build using pgm
have_pgm_library="no" have_pgm_library="no"
...@@ -507,8 +495,6 @@ AC_ARG_WITH([norm], ...@@ -507,8 +495,6 @@ AC_ARG_WITH([norm],
[with_norm_ext=$withval], [with_norm_ext=$withval],
[with_norm_ext=no]) [with_norm_ext=no])
AC_MSG_CHECKING("with_norm_ext = ${with_norm_ext}") AC_MSG_CHECKING("with_norm_ext = ${with_norm_ext}")
if test "x$with_norm_ext" != "xno"; then if test "x$with_norm_ext" != "xno"; then
......
...@@ -48,12 +48,10 @@ ...@@ -48,12 +48,10 @@
#include "err.hpp" #include "err.hpp"
#include "msg.hpp" #include "msg.hpp"
#ifdef HAVE_LIBSODIUM #if defined (HAVE_TWEETNACL)
#ifdef HAVE_TWEETNACL # include "randombytes.h"
#include "randombytes.h" #elif defined (HAVE_LIBSODIUM)
#else # include "sodium.h"
#include "sodium.h"
#endif
#endif #endif
#ifdef ZMQ_HAVE_VMCI #ifdef ZMQ_HAVE_VMCI
...@@ -63,7 +61,7 @@ ...@@ -63,7 +61,7 @@
#define ZMQ_CTX_TAG_VALUE_GOOD 0xabadcafe #define ZMQ_CTX_TAG_VALUE_GOOD 0xabadcafe
#define ZMQ_CTX_TAG_VALUE_BAD 0xdeadbeef #define ZMQ_CTX_TAG_VALUE_BAD 0xdeadbeef
int clipped_maxsocket(int max_requested) int clipped_maxsocket (int max_requested)
{ {
if (max_requested >= zmq::poller_t::max_fds () && zmq::poller_t::max_fds () != -1) if (max_requested >= zmq::poller_t::max_fds () && zmq::poller_t::max_fds () != -1)
// -1 because we need room for the reaper mailbox. // -1 because we need room for the reaper mailbox.
...@@ -127,8 +125,8 @@ zmq::ctx_t::~ctx_t () ...@@ -127,8 +125,8 @@ zmq::ctx_t::~ctx_t ()
// If we've done any Curve encryption, we may have a file handle // If we've done any Curve encryption, we may have a file handle
// to /dev/urandom open that needs to be cleaned up. // to /dev/urandom open that needs to be cleaned up.
#ifdef HAVE_LIBSODIUM #ifdef ZMQ_HAVE_CURVE
randombytes_close(); randombytes_close ();
#endif #endif
// Remove the tag, so that the object is considered dead. // Remove the tag, so that the object is considered dead.
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "platform.hpp" #include "platform.hpp"
#ifdef HAVE_LIBSODIUM #ifdef ZMQ_HAVE_CURVE
#ifdef ZMQ_HAVE_WINDOWS #ifdef ZMQ_HAVE_WINDOWS
#include "windows.hpp" #include "windows.hpp"
......
...@@ -30,15 +30,16 @@ ...@@ -30,15 +30,16 @@
#ifndef __ZMQ_CURVE_CLIENT_HPP_INCLUDED__ #ifndef __ZMQ_CURVE_CLIENT_HPP_INCLUDED__
#define __ZMQ_CURVE_CLIENT_HPP_INCLUDED__ #define __ZMQ_CURVE_CLIENT_HPP_INCLUDED__
#ifdef ZMQ_HAVE_CURVE
#include "platform.hpp" #include "platform.hpp"
#include "mutex.hpp" #include "mutex.hpp"
#ifdef HAVE_LIBSODIUM #if defined (HAVE_TWEETNACL)
#ifdef HAVE_TWEETNACL # include "tweetnacl_base.h"
#include "tweetnacl_base.h" # include "randombytes.h"
#include "randombytes.h" #elif defined (HAVE_LIBSODIUM)
#else # include "sodium.h"
#include "sodium.h"
#endif #endif
#if crypto_box_NONCEBYTES != 24 \ #if crypto_box_NONCEBYTES != 24 \
...@@ -46,7 +47,7 @@ ...@@ -46,7 +47,7 @@
|| crypto_box_SECRETKEYBYTES != 32 \ || crypto_box_SECRETKEYBYTES != 32 \
|| crypto_box_ZEROBYTES != 32 \ || crypto_box_ZEROBYTES != 32 \
|| crypto_box_BOXZEROBYTES != 16 || crypto_box_BOXZEROBYTES != 16
#error "libsodium not built properly" # error "libsodium not built properly"
#endif #endif
#include "mechanism.hpp" #include "mechanism.hpp"
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "platform.hpp" #include "platform.hpp"
#ifdef HAVE_LIBSODIUM #ifdef ZMQ_HAVE_CURVE
#ifdef ZMQ_HAVE_WINDOWS #ifdef ZMQ_HAVE_WINDOWS
#include "windows.hpp" #include "windows.hpp"
......
...@@ -30,15 +30,17 @@ ...@@ -30,15 +30,17 @@
#ifndef __ZMQ_CURVE_SERVER_HPP_INCLUDED__ #ifndef __ZMQ_CURVE_SERVER_HPP_INCLUDED__
#define __ZMQ_CURVE_SERVER_HPP_INCLUDED__ #define __ZMQ_CURVE_SERVER_HPP_INCLUDED__
#ifdef ZMQ_HAVE_CURVE
#include "platform.hpp" #include "platform.hpp"
#ifdef HAVE_LIBSODIUM #if defined (HAVE_TWEETNACL)
#ifdef HAVE_TWEETNACL # include "tweetnacl_base.h"
#include "tweetnacl_base.h" # include "randombytes.h"
#include "randombytes.h" #elif defined (HAVE_LIBSODIUM)
#else # include "sodium.h"
#include "sodium.h"
#endif #endif
#if crypto_box_NONCEBYTES != 24 \ #if crypto_box_NONCEBYTES != 24 \
|| crypto_box_PUBLICKEYBYTES != 32 \ || crypto_box_PUBLICKEYBYTES != 32 \
|| crypto_box_SECRETKEYBYTES != 32 \ || crypto_box_SECRETKEYBYTES != 32 \
...@@ -47,7 +49,7 @@ ...@@ -47,7 +49,7 @@
|| crypto_secretbox_NONCEBYTES != 24 \ || crypto_secretbox_NONCEBYTES != 24 \
|| crypto_secretbox_ZEROBYTES != 32 \ || crypto_secretbox_ZEROBYTES != 32 \
|| crypto_secretbox_BOXZEROBYTES != 16 || crypto_secretbox_BOXZEROBYTES != 16
#error "libsodium not built properly" # error "libsodium not built properly"
#endif #endif
#include "mechanism.hpp" #include "mechanism.hpp"
......
...@@ -320,7 +320,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, ...@@ -320,7 +320,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
} }
break; break;
# if defined ZMQ_HAVE_SO_PEERCRED || defined ZMQ_HAVE_LOCAL_PEERCRED #if defined ZMQ_HAVE_SO_PEERCRED || defined ZMQ_HAVE_LOCAL_PEERCRED
case ZMQ_IPC_FILTER_UID: case ZMQ_IPC_FILTER_UID:
if (optvallen_ == 0 && optval_ == NULL) { if (optvallen_ == 0 && optval_ == NULL) {
ipc_uid_accept_filters.clear (); ipc_uid_accept_filters.clear ();
...@@ -344,9 +344,9 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, ...@@ -344,9 +344,9 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
return 0; return 0;
} }
break; break;
# endif #endif
# if defined ZMQ_HAVE_SO_PEERCRED #if defined ZMQ_HAVE_SO_PEERCRED
case ZMQ_IPC_FILTER_PID: case ZMQ_IPC_FILTER_PID:
if (optvallen_ == 0 && optval_ == NULL) { if (optvallen_ == 0 && optval_ == NULL) {
ipc_pid_accept_filters.clear (); ipc_pid_accept_filters.clear ();
...@@ -358,7 +358,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, ...@@ -358,7 +358,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
return 0; return 0;
} }
break; break;
# endif #endif
case ZMQ_PLAIN_SERVER: case ZMQ_PLAIN_SERVER:
if (is_int && (value == 0 || value == 1)) { if (is_int && (value == 0 || value == 1)) {
...@@ -403,8 +403,8 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, ...@@ -403,8 +403,8 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
} }
break; break;
// If libsodium isn't installed, these options provoke EINVAL // If curve encryption isn't built, these options provoke EINVAL
# ifdef HAVE_LIBSODIUM #ifdef ZMQ_HAVE_CURVE
case ZMQ_CURVE_SERVER: case ZMQ_CURVE_SERVER:
if (is_int && (value == 0 || value == 1)) { if (is_int && (value == 0 || value == 1)) {
as_server = value; as_server = value;
...@@ -496,7 +496,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, ...@@ -496,7 +496,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
} }
} }
break; break;
# endif #endif
case ZMQ_CONFLATE: case ZMQ_CONFLATE:
if (is_int && (value == 0 || value == 1)) { if (is_int && (value == 0 || value == 1)) {
...@@ -506,7 +506,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, ...@@ -506,7 +506,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
break; break;
// If libgssapi isn't installed, these options provoke EINVAL // If libgssapi isn't installed, these options provoke EINVAL
# ifdef HAVE_LIBGSSAPI_KRB5 #ifdef HAVE_LIBGSSAPI_KRB5
case ZMQ_GSSAPI_SERVER: case ZMQ_GSSAPI_SERVER:
if (is_int && (value == 0 || value == 1)) { if (is_int && (value == 0 || value == 1)) {
as_server = value; as_server = value;
...@@ -538,7 +538,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, ...@@ -538,7 +538,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
return 0; return 0;
} }
break; break;
# endif #endif
case ZMQ_HANDSHAKE_IVL: case ZMQ_HANDSHAKE_IVL:
if (is_int && value >= 0) { if (is_int && value >= 0) {
...@@ -577,7 +577,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, ...@@ -577,7 +577,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
} }
break; break;
# ifdef ZMQ_HAVE_VMCI #ifdef ZMQ_HAVE_VMCI
case ZMQ_VMCI_BUFFER_SIZE: case ZMQ_VMCI_BUFFER_SIZE:
if (optvallen_ == sizeof (uint64_t)) { if (optvallen_ == sizeof (uint64_t)) {
vmci_buffer_size = *((uint64_t*) optval_); vmci_buffer_size = *((uint64_t*) optval_);
...@@ -605,7 +605,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, ...@@ -605,7 +605,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
return 0; return 0;
} }
break; break;
# endif #endif
case ZMQ_USE_FD: case ZMQ_USE_FD:
if (is_int && value >= -1) { if (is_int && value >= -1) {
...@@ -888,8 +888,8 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_) ...@@ -888,8 +888,8 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
} }
break; break;
// If libsodium isn't installed, these options provoke EINVAL // If curve encryption isn't built, these options provoke EINVAL
# ifdef HAVE_LIBSODIUM #ifdef ZMQ_HAVE_CURVE
case ZMQ_CURVE_SERVER: case ZMQ_CURVE_SERVER:
if (is_int) { if (is_int) {
*value = as_server && mechanism == ZMQ_CURVE; *value = as_server && mechanism == ZMQ_CURVE;
...@@ -932,7 +932,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_) ...@@ -932,7 +932,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
return 0; return 0;
} }
break; break;
# endif #endif
case ZMQ_CONFLATE: case ZMQ_CONFLATE:
if (is_int) { if (is_int) {
...@@ -942,7 +942,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_) ...@@ -942,7 +942,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
break; break;
// If libgssapi isn't installed, these options provoke EINVAL // If libgssapi isn't installed, these options provoke EINVAL
# ifdef HAVE_LIBGSSAPI_KRB5 #ifdef HAVE_LIBGSSAPI_KRB5
case ZMQ_GSSAPI_SERVER: case ZMQ_GSSAPI_SERVER:
if (is_int) { if (is_int) {
*value = as_server && mechanism == ZMQ_GSSAPI; *value = as_server && mechanism == ZMQ_GSSAPI;
......
...@@ -39,20 +39,20 @@ ...@@ -39,20 +39,20 @@
#endif #endif
#if defined ZMQ_USE_KQUEUE #if defined ZMQ_USE_KQUEUE
#include "kqueue.hpp" # include "kqueue.hpp"
#elif defined ZMQ_USE_EPOLL #elif defined ZMQ_USE_EPOLL
#include "epoll.hpp" # include "epoll.hpp"
#elif defined ZMQ_USE_DEVPOLL #elif defined ZMQ_USE_DEVPOLL
#include "devpoll.hpp" # include "devpoll.hpp"
#elif defined ZMQ_USE_POLL #elif defined ZMQ_USE_POLL
#include "poll.hpp" # include "poll.hpp"
#elif defined ZMQ_USE_SELECT #elif defined ZMQ_USE_SELECT
#include "select.hpp" # include "select.hpp"
#elif defined ZMQ_HAVE_GNU #elif defined ZMQ_HAVE_GNU
#define ZMQ_USE_POLL # define ZMQ_USE_POLL
#include "poll.hpp" # include "poll.hpp"
#else #else
#error None of the ZMQ_USE_* macros defined # error None of the ZMQ_USE_* macros defined
#endif #endif
#if defined ZMQ_USE_SELECT #if defined ZMQ_USE_SELECT
......
...@@ -682,7 +682,7 @@ bool zmq::stream_engine_t::handshake () ...@@ -682,7 +682,7 @@ bool zmq::stream_engine_t::handshake ()
plain_client_t (options); plain_client_t (options);
alloc_assert (mechanism); alloc_assert (mechanism);
} }
#ifdef HAVE_LIBSODIUM #ifdef ZMQ_HAVE_CURVE
else else
if (options.mechanism == ZMQ_CURVE if (options.mechanism == ZMQ_CURVE
&& memcmp (greeting_recv + 12, "CURVE\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 20) == 0) { && memcmp (greeting_recv + 12, "CURVE\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 20) == 0) {
......
...@@ -1211,7 +1211,8 @@ int zmq_poller_wait (void *poller_, zmq_poller_event_t *event, long timeout_) ...@@ -1211,7 +1211,8 @@ int zmq_poller_wait (void *poller_, zmq_poller_event_t *event, long timeout_)
return -1; return -1;
} }
zmq::socket_poller_t::event_t e = {}; zmq::socket_poller_t::event_t e;
memset (&e, 0, sizeof (e));
int rc = ((zmq::socket_poller_t*)poller_)->wait (&e, timeout_); int rc = ((zmq::socket_poller_t*)poller_)->wait (&e, timeout_);
...@@ -1360,7 +1361,7 @@ int zmq_has (const char *capability) ...@@ -1360,7 +1361,7 @@ int zmq_has (const char *capability)
if (strcmp (capability, "norm") == 0) if (strcmp (capability, "norm") == 0)
return true; return true;
#endif #endif
#if defined (HAVE_LIBSODIUM) #if defined (ZMQ_HAVE_CURVE)
if (strcmp (capability, "curve") == 0) if (strcmp (capability, "curve") == 0)
return true; return true;
#endif #endif
......
...@@ -43,15 +43,13 @@ ...@@ -43,15 +43,13 @@
#include "windows.hpp" #include "windows.hpp"
#endif #endif
#ifdef HAVE_LIBSODIUM #if defined (HAVE_TWEETNACL)
#ifdef HAVE_TWEETNACL # include "tweetnacl_base.h"
#include "tweetnacl_base.h" # include "randombytes.h"
#else #elif defined (HAVE_LIBSODIUM)
#include "sodium.h" # include "sodium.h"
#endif
#endif #endif
void zmq_sleep (int seconds_) void zmq_sleep (int seconds_)
{ {
#if defined ZMQ_HAVE_WINDOWS #if defined ZMQ_HAVE_WINDOWS
...@@ -185,17 +183,17 @@ uint8_t *zmq_z85_decode (uint8_t *dest, const char *string) ...@@ -185,17 +183,17 @@ uint8_t *zmq_z85_decode (uint8_t *dest, const char *string)
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// Generate a public/private keypair with libsodium. // Generate a public/private keypair with tweetnacl or libsodium.
// Generated keys will be 40 byte z85-encoded strings. // Generated keys will be 40 byte z85-encoded strings.
// Returns 0 on success, -1 on failure, setting errno. // Returns 0 on success, -1 on failure, setting errno.
// Sets errno = ENOTSUP in the absence of libsodium. // Sets errno = ENOTSUP in the absence of a CURVE library.
int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key) int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key)
{ {
#ifdef HAVE_LIBSODIUM #if defined (ZMQ_HAVE_CURVE)
# if crypto_box_PUBLICKEYBYTES != 32 \ # if crypto_box_PUBLICKEYBYTES != 32 \
|| crypto_box_SECRETKEYBYTES != 32 || crypto_box_SECRETKEYBYTES != 32
# error "libsodium not built correctly" # error "CURVE encryption library not built correctly"
# endif # endif
uint8_t public_key [32]; uint8_t public_key [32];
...@@ -210,7 +208,7 @@ int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key) ...@@ -210,7 +208,7 @@ int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key)
zmq_z85_encode (z85_secret_key, secret_key, 32); zmq_z85_encode (z85_secret_key, secret_key, 32);
return 0; return 0;
#else // requires libsodium #else
(void) z85_public_key, (void) z85_secret_key; (void) z85_public_key, (void) z85_secret_key;
errno = ENOTSUP; errno = ENOTSUP;
return -1; return -1;
......
...@@ -55,7 +55,7 @@ int main (void) ...@@ -55,7 +55,7 @@ int main (void)
assert (!zmq_has ("norm")); assert (!zmq_has ("norm"));
#endif #endif
#if defined (HAVE_LIBSODIUM) #if defined (ZMQ_HAVE_CURVE)
assert (zmq_has ("curve")); assert (zmq_has ("curve"));
#else #else
assert (!zmq_has ("curve")); assert (!zmq_has ("curve"));
......
...@@ -102,11 +102,10 @@ static void zap_handler (void *handler) ...@@ -102,11 +102,10 @@ static void zap_handler (void *handler)
int main (void) int main (void)
{ {
#ifndef HAVE_LIBSODIUM #ifndef ZMQ_HAVE_CURVE
printf ("libsodium not installed, skipping CURVE test\n"); printf ("CURVE encryption not installed, skipping test\n");
return 0; return 0;
#endif #endif
// Generate new keypairs for this test // Generate new keypairs for this test
int rc = zmq_curve_keypair (client_public, client_secret); int rc = zmq_curve_keypair (client_public, client_secret);
assert (rc == 0); assert (rc == 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment