Unverified Commit 8c338f4d authored by Dominik Charousset's avatar Dominik Charousset Committed by GitHub

Merge pull request #955

OpenBSD support
parents cd92c25e 59f61c9b
...@@ -168,7 +168,12 @@ math(EXPR CAF_VERSION_PATCH "${VERSION_INT} % 100") ...@@ -168,7 +168,12 @@ math(EXPR CAF_VERSION_PATCH "${VERSION_INT} % 100")
# create full version string # create full version string
set(CAF_VERSION set(CAF_VERSION
"${CAF_VERSION_MAJOR}.${CAF_VERSION_MINOR}.${CAF_VERSION_PATCH}") "${CAF_VERSION_MAJOR}.${CAF_VERSION_MINOR}.${CAF_VERSION_PATCH}")
# set the library version for our shared library targets
if(CMAKE_HOST_SYSTEM_NAME MATCHES "OpenBSD")
set(CAF_LIB_VERSION "${CAF_VERSION_MAJOR}.${CAF_VERSION_MINOR}")
else()
set(CAF_LIB_VERSION "${CAF_VERSION}")
endif()
################################################################################ ################################################################################
# set output paths for binaries and libraries if not provided by the user # # set output paths for binaries and libraries if not provided by the user #
......
...@@ -181,7 +181,7 @@ if (NOT CAF_BUILD_STATIC_ONLY) ...@@ -181,7 +181,7 @@ if (NOT CAF_BUILD_STATIC_ONLY)
set_target_properties(libcaf_core_shared set_target_properties(libcaf_core_shared
PROPERTIES PROPERTIES
SOVERSION ${CAF_VERSION} SOVERSION ${CAF_VERSION}
VERSION ${CAF_VERSION} VERSION ${CAF_LIB_VERSION}
OUTPUT_NAME caf_core OUTPUT_NAME caf_core
) )
install(TARGETS libcaf_core_shared install(TARGETS libcaf_core_shared
......
...@@ -209,6 +209,8 @@ ...@@ -209,6 +209,8 @@
# endif # endif
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__)
# define CAF_BSD # define CAF_BSD
#elif defined(__OpenBSD__)
# define CAF_BSD
#elif defined(__CYGWIN__) #elif defined(__CYGWIN__)
# define CAF_CYGWIN # define CAF_CYGWIN
#elif defined(WIN32) || defined(_WIN32) #elif defined(WIN32) || defined(_WIN32)
......
...@@ -64,7 +64,7 @@ if (NOT CAF_BUILD_STATIC_ONLY) ...@@ -64,7 +64,7 @@ if (NOT CAF_BUILD_STATIC_ONLY)
set_target_properties(libcaf_io_shared set_target_properties(libcaf_io_shared
PROPERTIES PROPERTIES
SOVERSION ${CAF_VERSION} SOVERSION ${CAF_VERSION}
VERSION ${CAF_VERSION} VERSION ${CAF_LIB_VERSION}
OUTPUT_NAME caf_io) OUTPUT_NAME caf_io)
install(TARGETS libcaf_io_shared install(TARGETS libcaf_io_shared
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
......
...@@ -288,8 +288,10 @@ bool interfaces::get_endpoint(const std::string& host, uint16_t port, ...@@ -288,8 +288,10 @@ bool interfaces::get_endpoint(const std::string& host, uint16_t port,
hint.ai_socktype = SOCK_DGRAM; hint.ai_socktype = SOCK_DGRAM;
if (preferred) if (preferred)
hint.ai_family = *preferred == protocol::network::ipv4 ? AF_INET : AF_INET6; hint.ai_family = *preferred == protocol::network::ipv4 ? AF_INET : AF_INET6;
#ifdef AI_V4MAPPED
if (hint.ai_family == AF_INET6) if (hint.ai_family == AF_INET6)
hint.ai_flags = AI_V4MAPPED; hint.ai_flags = AI_V4MAPPED;
#endif
addrinfo* tmp = nullptr; addrinfo* tmp = nullptr;
if (getaddrinfo(host.c_str(), port_hint, &hint, &tmp) != 0) if (getaddrinfo(host.c_str(), port_hint, &hint, &tmp) != 0)
return false; return false;
......
...@@ -93,9 +93,9 @@ const int ec_out_of_memory = ENOMEM; ...@@ -93,9 +93,9 @@ const int ec_out_of_memory = ENOMEM;
const int ec_interrupted_syscall = EINTR; const int ec_interrupted_syscall = EINTR;
#endif #endif
// platform-dependent SIGPIPE setup // Platform-dependent setup for supressing SIGPIPE.
#if defined(CAF_MACOS) || defined(CAF_IOS) || defined(CAF_BSD) #if defined(CAF_MACOS) || defined(CAF_IOS) || defined(__FreeBSD__)
// Use the socket option but no flags to recv/send on macOS/iOS/BSD. // Set the SO_NOSIGPIPE socket option on macOS, iOS and FreeBSD.
const int no_sigpipe_socket_flag = SO_NOSIGPIPE; const int no_sigpipe_socket_flag = SO_NOSIGPIPE;
const int no_sigpipe_io_flag = 0; const int no_sigpipe_io_flag = 0;
#elif defined(CAF_WINDOWS) #elif defined(CAF_WINDOWS)
...@@ -103,7 +103,7 @@ const int no_sigpipe_io_flag = 0; ...@@ -103,7 +103,7 @@ const int no_sigpipe_io_flag = 0;
const int no_sigpipe_socket_flag = 0; const int no_sigpipe_socket_flag = 0;
const int no_sigpipe_io_flag = 0; const int no_sigpipe_io_flag = 0;
#else #else
// Use flags to recv/send on Linux/Android but no socket option. // Pass MSG_NOSIGNAL to recv/send on Linux/Android/OpenBSD.
const int no_sigpipe_socket_flag = 0; const int no_sigpipe_socket_flag = 0;
const int no_sigpipe_io_flag = MSG_NOSIGNAL; const int no_sigpipe_io_flag = MSG_NOSIGNAL;
#endif #endif
......
...@@ -28,7 +28,7 @@ if(NOT CAF_BUILD_STATIC_ONLY) ...@@ -28,7 +28,7 @@ if(NOT CAF_BUILD_STATIC_ONLY)
set_target_properties(libcaf_opencl_shared set_target_properties(libcaf_opencl_shared
PROPERTIES PROPERTIES
SOVERSION "${CAF_VERSION}" SOVERSION "${CAF_VERSION}"
VERSION "${CAF_VERSION}" VERSION "${CAF_LIB_VERSION}"
OUTPUT_NAME caf_opencl) OUTPUT_NAME caf_opencl)
install(TARGETS libcaf_opencl_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(TARGETS libcaf_opencl_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif() endif()
......
...@@ -32,7 +32,7 @@ if (NOT CAF_BUILD_STATIC_ONLY) ...@@ -32,7 +32,7 @@ if (NOT CAF_BUILD_STATIC_ONLY)
set_target_properties(libcaf_openssl_shared set_target_properties(libcaf_openssl_shared
PROPERTIES PROPERTIES
SOVERSION ${CAF_VERSION} SOVERSION ${CAF_VERSION}
VERSION ${CAF_VERSION} VERSION ${CAF_LIB_VERSION}
OUTPUT_NAME caf_openssl) OUTPUT_NAME caf_openssl)
if (CYGWIN) if (CYGWIN)
install(TARGETS libcaf_openssl_shared RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS libcaf_openssl_shared RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
......
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