summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-01-21 14:32:56 -0800
committerGarrett D'Amore <garrett@damore.org>2017-01-21 14:32:56 -0800
commit8d3f410962fed3b4a8e6e3962ebf3bb55f5f2b93 (patch)
treedb0b0d32d6939a390c4cd630d33f91075ef5d63e
parent0e2e1c40f4b22d940886de6e8555eeef9c076808 (diff)
downloadnng-8d3f410962fed3b4a8e6e3962ebf3bb55f5f2b93.tar.gz
nng-8d3f410962fed3b4a8e6e3962ebf3bb55f5f2b93.tar.bz2
nng-8d3f410962fed3b4a8e6e3962ebf3bb55f5f2b93.zip
Add more platforms (the *BSDs, SunOS/illumos) and update docs slightly.
-rw-r--r--CMakeLists.txt46
-rw-r--r--README.adoc19
-rw-r--r--src/platform/posix/posix_config.h10
3 files changed, 43 insertions, 32 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 68bb949d..af8d03f1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -87,31 +87,59 @@ endif()
#option (NNG_STATIC_LIB "Build static library instead of shared library." OFF)
option (NNG_ENABLE_DOC "Enable building documentation." ON)
-option (NNG_TESTS "Build and run nanomsg tests" ON)
-option (NNG_TOOLS "Build nanomsg tools" OFF)
+option (NNG_TESTS "Build and run tests" ON)
+option (NNG_TOOLS "Build extra tools" OFF)
option (NNG_ENABLE_NNGCAT "Enable building nngcat utility." ${NNG_TOOLS})
# Platform checks.
-find_package (Threads REQUIRED)
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
+ find_package (Threads REQUIRED)
add_definitions (-DPLATFORM_POSIX)
+
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ find_package (Threads REQUIRED)
+ add_definitions (-DPLATFORM_POSIX)
+ # macOS 10.12 and later have getentropy, but the older releases
+ # have ARC4_RANDOM, and that is sufficient to our needs.
+ add_definitions (-DNNG_USE_ARC4_RANDOM)
+
+ # macOS added some of CLOCK_MONOTONIC, but the implementation is
+ # broken and unreliable, so don't use it.
+ add_definitions (-DNNG_USE_CLOCKID=CLOCK_REALTIME)
+
+elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ find_package (Threads REQUIRED)
add_definitions (-DPLATFORM_POSIX)
- # XXX OVERRIDE THIS?
+
+elseif (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+ find_package (Threads REQUIRED)
+ add_definitions (-DPLATFORM_POSIX)
+
+elseif (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
+ find_package (Threads REQUIRED)
+ add_definitions (-DPLATFORM_POSIX)
+
+elseif (CMAKE_SYSTEM_NAME MATCHES "SunOS")
+ find_package (Threads REQUIRED)
+ add_definitions (-DPLATFORM_POSIX)
+
elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
add_definitions (-DPLATFORM_WINDOWS)
- set (NNG_HAVE_WINSOCK 1)
add_definitions (-D_CRT_SECURE_NO_WARNINGS)
add_definitions (-D_CRT_RAND_S)
# Target Windows Vista and later
add_definitions (-D_WIN32_WINNT=0x0600)
list (APPEND CMAKE_REQUIRED_DEFINITIONS -D_WIN32_WINNT=0x0600)
+
else ()
message (AUTHOR_WARNING "WARNING: This platform may or may not be supported: ${CMAKE_SYSTEM_NAME}")
message (AUTHOR_WARNING "${ISSUE_REPORT_MSG}")
+ # blithely hope for POSIX t work
+ find_package (Threads REQUIRED)
+ add_definitions (-DPLATFORM_POSIX)
endif ()
if (NNG_STATIC_LIB)
@@ -153,13 +181,14 @@ if (WIN32)
set(NNG_REQUIRED_LIBRARIES ${NNG_REQUIRED_LIBRARIES} mswsock)
set(NNG_REQUIRED_LIBRARIES ${NNG_REQUIRED_LIBRARIES} advapi32)
nng_check_sym (InitializeConditionVariable windows.h NNG_HAVE_CONDVAR)
- if (NOT NNG_HAVE_CONDVAR)
+ nng_check_sym (snprintf stdio.h NNG_HAVE_SNPRINTF)
+ if (NOT NNG_HAVE_CONDVAR OR NOT NNG_HAVE_SNPRINTF)
message (FATAL_ERROR
"Modern Windows API support is missing. "
"Versions of Windows prior to Vista are not supported. "
"Further, the 32-bit MinGW environment is not supported. "
"Ensure you have at least Windows Vista or newer, and are "
- "using either Visual Studio 2010 or newer or MinGW-W64.")
+ "using either Visual Studio 2013 or newer or MinGW-W64.")
endif()
else ()
# Unconditionally declare the following feature test macros. These are
@@ -179,9 +208,6 @@ else ()
nng_check_sym (AF_UNIX sys/socket.h NNG_HAVE_UNIX_SOCKETS)
nng_check_sym (backtrace_symbols_fd execinfo.h NNG_HAVE_BACKTRACE)
nng_check_struct_member(msghdr msg_control sys/socket.h NNG_HAVE_MSG_CONTROL)
-# if (NNG_HAVE_SEMAPHORE_RT OR NNG_HAVE_SEMAPHORE_PTHREAD)
-# add_definitions (-DNNG_HAVE_SEMAPHORE)
-# endif ()
endif ()
#check_c_source_compiles ("
diff --git a/README.adoc b/README.adoc
index 66d81fb4..62cdcd71 100644
--- a/README.adoc
+++ b/README.adoc
@@ -8,22 +8,17 @@ image:https://img.shields.io/appveyor/ci/nanomsg/nng/master.svg?label=windows[Wi
This repository represents a work in progress rewrite of the SP protocol
library called "libnanomsg". The work is being done by Garrett D'Amore,
-and at this juncture he is *not* soliciting assistance.
+and at this juncture he is *not* soliciting implementation assistance.
+Review and testing feedback is appreciated however.
-This is a work in progress, and is *not* for general use or publication.
-When the library is ready for broader consumption, an announcement will
-be posted on the nanomsg mailing list and website.
+This is a work in progress, and is *not* for suitable for product use or
+publication. When the library is ready for broader consumption, an
+announcement will be posted on the nanomsg mailing list and website.
If you are looking for the current production version of nanomsg, please
see the https://github.com/nanomsg/nanomsg site.
-Note that commit histories here are subject to change in the future --
-once the production reaches a point that we are ready to start using
-issue tracking and so forth, we will compress the existing deltas into
-a single commit. This is probably some number of weeks in the future.
-
If you want to build and test yourself, you need CMake version 3.1, and
-you can use standard CMake build recipes. At present only POSIX systems
-(Linux and MacOS) will build. Win32 is still outstanding.
+you can use standard CMake build recipes.
- - Garrett D'Amore (Dec. 31, 2016)
+ - Garrett D'Amore (Jan. 21, 2016)
diff --git a/src/platform/posix/posix_config.h b/src/platform/posix/posix_config.h
index e1bafd5c..234d57cc 100644
--- a/src/platform/posix/posix_config.h
+++ b/src/platform/posix/posix_config.h
@@ -42,16 +42,6 @@
#include <time.h>
-// These are things about systems we know about.
-#ifdef __APPLE__
-// MacOS X used to lack CLOCK_MONOTONIC. Now it has it, but its
-// buggy, condition variables set to use it wake early.
-#define NNG_USE_CLOCKID CLOCK_REALTIME
-// macOS 10.12 has getentropy(), but arc4random() is good enough
-// and works on older releases.
-#define NNG_USE_ARC4RANDOM 1
-#endif // __APPLE__
-
// It should never hurt to use DEVURANDOM, since if the device does not
// exist then we won't open it. (Provided: it would be bad if the device
// exists but has somehow very very different semantics. We don't know