Commit Graph

358 Commits

Author SHA1 Message Date
Isuru Fernando
43a8b3c6c8 Add gssapi support to cmake 2024-05-08 10:06:39 +02:00
fanquake
2a75ef07be cmake: don't use builtin sha1 if not using ws
The builtin SHA1 (ZMQ_USE_BUILTIN_SHA1) is only used in the websocket
engine (ws_engine.cpp), so if websockets are disabled, i.e
-DENABLE_DRAFTS=OFF, don't add sha1.c to the sources list.
2024-03-25 18:51:39 +00:00
fanquake
4a5ece54b8 build: fix mkdtemp check on macOS
On macOS, mkdtemp is in unistd.h. Fix the CMake check so that is works.
This was discovered when comparing the output of the Autotools an CMake
build systems.
2024-03-25 13:24:30 +00:00
Min RK
481cc3fa2c halt build if CURVE requested but not found
ENABLE_CURVE is currently redundant with WITH_LIBSODIUM, as the only existing provider

now builds where requested configuration is not found fail rather than proceeding without requested features
2024-02-28 15:35:57 +00:00
Min RK
ff231d2673 Problem: cmake search for kqueue missing headers
Solution: include sys/types.h and sys/time.h as documented by kqueue
and used in autotools

fixes kqueue detection on openbsd
2024-02-23 14:25:17 +00:00
Florian Weimer
665d1d4657 Build with -D_DEFAULT_SOURCE along with -std=c11
On its own, -std=c11 hides POSIX and other extensions from C headers
such as <stdlib.h> when building against glibc.  This causes the
posix_memalign probe to fail incorrectly with compilers that do not
accept implicit function declarations.  _DEFAULT_SOURCE is ignored by
most non-GNU/Linux systems or not relevant in this context, so there
is no separate check for adding it.
2023-11-29 13:58:35 +00:00
Francesco Montorsi
b6ca9b2983 Feature: modernize API documentation
* migrate from the old, unmaintained "asciidoc-py" tool to the new "asciidoctor" generator
* migrate from asciidoc-py syntax to the modern Asciidoc syntax (especially page titles and section titles)
* remove the need of "xmlto" utility to create the manpage output; use asciidoctor for that
* add HTML output support to the doc/Makefile by using asciidoctor
* change API documentation files extension from .txt to .adoc to make it more explicit that they are Asciidoc-encoded (as a bonus several IDE plugins will autodetect the .adoc format as Asciidoc)
* remove asciidoc.conf: asciidoctor does not support that; this also required replacing the macro linkzmq into all documentation pages
* add a new Github action CI do deploy to Github Pages the static HTMLs produced by Asciidoctors
* removed references to the "xmlto" and "a2x" tools from the build and packaging systems: Asciidoctor can convert the documentation directly to e.g. pdf (via extended converters) and anyway there was no code/target for using "xmlto" and "a2x" tools anyway
2023-10-25 23:59:38 +02:00
Luca Boccassi
dbb7e3dc01 Problem: 4.3.5 is out, need new version
Solution: bump to 4.3.6
2023-10-09 12:21:03 +01:00
Guillaume DELACOURT
e0296d9cdd Checks for pthread setname and setaffinity API are compilation checks, not execution checks. 2023-06-12 00:12:26 +01:00
Luca Boccassi
da31917f4f Relicense from LGPL3 + exceptions to Mozilla Public License version 2.0
Relicense permission collected from all relevant authors as tallied at:
https://github.com/rlenferink/libzmq-relicense/blob/master/checklist.md
The relicense grants are collected under RELICENSE/ and will be moved
to the above repository in a later commit.

Fixes https://github.com/zeromq/libzmq/issues/2376
2023-06-05 20:31:47 +01:00
Luca Boccassi
ff47aeb791 Problem: no permission to relicense tweetnacl integration
Solution: remove implementation. Frank Hartmann <soundart@gmx.net>,
the author, rejected our request to relicense under MPL2, so we
have to remove his copyrighted work.
Tweetnacl is not security-supported and could not be used in
production environments anyway, the supported backend is libsodium.
2023-06-04 23:54:31 +01:00
Nicolas Benes
4d1dccaebd Fix pkg_config_defines in CMakeFile
PR #4545 sets `pkg_config_defines` too late, i.e. after the pkg-config
file is already generated. It must be set before `configure_file`.
2023-05-16 17:47:51 +01:00
Luca Boccassi
cc12997a17
Merge pull request #4545 from panicgh/pc-file-fix
Add missing pkg_config_defines when built with CMake
2023-05-12 10:16:57 +01:00
Dennis Gosnell
5381be6c71 Problem: don't link to openpgm when building with cmake
Solution: Add `target_link_libraries()` to `libzmq` for openpgm when
openpgm has been enabled.
2023-05-11 20:22:42 +09:00
Nicolas Benes
c079ca5cc4 Add missing pkg_config_defines when built with CMake
The pkg_config_defines variable was only set in configure.ac, but not in
CMake. This lead to the `-DZMQ_BUILD_DRAFT_API=1` flag to be omitted
from the generated pkg-config file.

Signed-off-by: Nicolas Benes <nbenes.gh@xandea.de>
2023-05-09 23:15:46 +02:00
James Choi
10e5847fa8 Add support for QNX 7.1 build
Signed-off-by: James Choi <chachoi@blackberry.com>
2023-04-11 15:48:07 -04:00
Leander Schulten
f508394909 Don't assume that GnuTLS is on the search path 2023-03-27 16:06:23 +02:00
Luca Boccassi
94bf58e43c
Merge pull request #4522 from stephanlachnit/p-cmake-fix-devpoll
CMake: fix devpoll detection not working properly
2023-03-05 17:49:19 +00:00
Stephan Lachnit
87065068ca
CMake: properly set ZMQ_HAVE_OPENPGM and ZMQ_HAVE_VMCI
Signed-off-by: Stephan Lachnit <stephanlachnit@debian.org>
2023-03-03 11:11:41 +01:00
Stephan Lachnit
6fc2a61d16
CMake: fix devpoll detection not working properly
Signed-off-by: Stephan Lachnit <stephanlachnit@debian.org>
2023-03-03 11:01:47 +01:00
Han Gao
48960c2293 fix: fix build on qemu-user
In qemu-user, CACHELINE_SIZE probe is undefined

Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-01-10 01:12:20 +08:00
Luca Boccassi
dfbfc59c3f
Merge pull request #4432 from Teebonne/patch-1
sodium, not Sodium
2022-12-06 14:39:21 +01:00
Krzysztof Rosiński
80e5bfeade fix missing sodium link_directories 2022-11-24 06:40:06 +01:00
Teebonne
8061a33e13
sodium, not Sodium
sodium, not Sodium
2022-10-01 15:29:42 +01:00
Bill Torpey
edfbb1ced6
default to not building tests if cmake version can't handle skipped tests (#4376)
* default to not building tests if cmake version can't handle skipped tests (see https://github.com/zeromq/libzmq/issues/4375)
2022-05-03 22:18:44 +01:00
Darkdragon-001
ff2987d24a Fix pkgconfig
Use CMake install variables instead of hardcoded values.
2022-03-15 12:12:21 +01:00
boscosiu
4d0f4ebd69 Problem: ZMQ_BUILD_DRAFT_API define is not propagated to dependent CMake projects
Solution: Add the definition to the relevant CMake targets in public scope.  Fixes #4194
2021-12-28 18:23:05 -08:00
myd7349
5eb0b00c87
Problem: In rare cases, afunix.h doesn't contain a definition for struct sockaddr_un (#4310)
* Problem: In rare cases, afunix.h doesn't contain a definition for struct sockaddr_un

According to https://github.com/microsoft/vcpkg/issues/21623,
struct sockaddr_un might be unavailable on some machines even afunix.h exists.

For example, on some machines, the content of afunix.h looks like this:
typedef struct _SOCKADDR_UN
{
     ADDRESS_FAMILY Family;
     wchar_t Path[63];
} SOCKADDR_UN, *PSOCKADDR_UN;

but on other machines, it may looks like this:
#define UNIX_PATH_MAX 108

typedef struct sockaddr_un
{
    ADDRESS_FAMILY sun_family;
    char sun_path[UNIX_PATH_MAX];
} SOCKADDR_UN, *PSOCKADDR_UN;

Fixes #3949

References:
- [Enable Unix-domain sockets support on Windows](8f3ec75de4)
- [AF_UNIX equivalent for Windows](https://stackoverflow.com/questions/9029174/af-unix-equivalent-for-windows)
- https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/
2021-11-24 14:55:45 +00:00
Michael Ngarimu
7c625afcc0 Problem: (Windows) /GL /LTCG breaks builds when the compiler/linker of static library differs from compiler/linker of executable
Solution: Enable /GL and /LTCG if and only if building as a Release (i.e. non-DEBUG) DLL.

Resolves zeromq/libzmq#4287
2021-10-27 22:17:21 -07:00
Mark Jan van Kampen
c036d66286
Problem: newer cmake versions set CMAKE_C(XX)_FLAGS at a later stage not allowing a user to override the standard
Solution: check for C(XX)_STANDARD/CMAKE_C(XX)_STANDARD as well
Fixes #4284
2021-10-21 12:24:12 +02:00
E. G. Patrick Bos
9fbfa40bab Problem: when linking to libzmq in my project, I want zmq symbols to remain invisible to users of my library. There is no way to control this, since visibility is set automatically through ZMQ_EXPORT based on OS and compiler.
Solution: add a preprocessor variable ZMQ_NO_EXPORT that, when set, bypasses the automatic ZMQ_EXPORT determination block and just sets ZMQ_EXPORT to empty.

By combining this solution at configuration time with manually passing -fvisibility=hidden to CXXFLAGS, I solved my visibility problem. Just passing -fvisibility=hidden is not enough, because __attribute__ ((visibility ("default"))) has higher priority.
2021-10-07 10:48:58 +01:00
E. G. Patrick Bos
36e4c9b474
add zmq_ppoll
zmq_ppoll mostly mimics zmq_poll behavior, except for the added feature of being able to specify a signal mask. Signals in this mask will be blocked during execution of zmq_ppoll. Switching of the process' active signal mask happens atomically with the actual poll call, so that no race conditions can occur. This behavior is useful when one wants to gracefully handle POSIX signals without race conditions. See e.g. the discussion below https://250bpm.com/blog:12/ for an explanation.

Also includes two new tests:
1. test_zmq_ppoll_fd does the same thing as test_zmq_poll_fd, demonstrating backwards compatibility with zmq_poll when used with a default signal mask.
2. test_zmq_ppoll_signals demonstrates the use of zmq_ppoll with a signal mask, blocking out SIGTERM everywhere except in zmq_ppoll, allowing to handle the signal in one place without having to worry about race conditions.
2021-09-24 11:04:20 +02:00
Min RK
bcb659e00e
Problem: calling randombytes_close with libsodium can crash Contexts in other threads (#4242)
* add opt-out for randombytes_close

Problem: randombytes_close is either a no-op or unsafe when a Context is running.

Unfortunately, there does not appear to be a single always correct choice,
so let builders pick between two not-great options.

Opting out can leak an FD on /dev/urandom which may need to be closed explicitly.
However, with the default behavior,
using multiple contexts with CURVE can crash with no application-level workaround available.

randombytes_close is not threadsafe and calling it while still in use by a Context can cause a crash.

For implementations using /dev/[u]random, this can leave up to one leftover FD per process.

The libsodium docs suggest that this function rarely needs to be called explicitly.
2021-08-13 15:11:29 +01:00
Chris Thrasher
4756c04da0 Correct messages about whether or not the draft API is being built
If you cloned and built this repo or built it from a submodule, it
would always report "Build and install draft classes and methods"
which first might be wrong if ENABLE_DRAFTS is OFF but also didn't
match the tense of other similar messages about build options.
2021-08-02 21:13:14 -06:00
Chris Thrasher
4fc83178aa Use standard C11 and C++11
Retain GNU extensions for C99 and C++98 since testing old compilers
is especially difficult and these compilation modes exist to maintain
compatability.
2021-07-01 09:37:02 -06:00
Bill Torpey
ca8e30ed48
fixes for UBSAN warnings (#4223)
Problem: UBSAN shows warnings

Solution: fix alignment issues and signed to unsigned conversion
2021-06-29 13:02:35 +01:00
Chengye Ke
04c37982b1
Support so_busy_poll (#4188)
* Support so_busy_poll.
2021-05-14 23:05:56 +01:00
Luca Boccassi
cef3225370 Problem: 4.3.4 is out, need new version
Solution: bump to 4.3.5
2021-01-17 12:10:01 +00:00
Andy Heroff
2998ff34aa
Problem: No direct support for setting socket priority (#4118)
* Problem: No direct support for setting socket priority

Solution: Add ZMQ_PRIORITY socket option, which sets the
SO_PRIORITY socket option on the underlying socket. This
socket option is not supported under Windows. Check option
and set socket option on creation of underlying socket.
2021-01-06 22:22:41 +00:00
Stanisław Maciaś
26cbd4f43f if_nametoindex function is now used when available 2020-12-23 12:32:16 +01:00
Fabrice Fontaine
8cb5708829 src/compat.hpp: fix build with libbsd and strlcpy
Don't include bsd/string.h if strlcpy is also defined in string.h to
avoid the following build failure on uclibc:

In file included from src/compat.hpp:41:0,
                 from src/ipc_address.cpp:31:
/tmp/instance-0/output-1/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/bsd/string.h:44:54: error: declaration of 'size_t strlcpy(char*, const char*, size_t)' has a different exception specifier
 size_t strlcpy(char *dst, const char *src, size_t siz);
                                                      ^
In file included from src/compat.hpp:34:0,
                 from src/ipc_address.cpp:31:
/tmp/instance-0/output-1/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/string.h:424:15: error: from previous declaration 'size_t strlcpy(char*, const char*, size_t) throw ()'
 extern size_t strlcpy(char *__restrict dst, const char *__restrict src,
               ^

Fixes:
 - http://autobuild.buildroot.org/results/51220b1b82774e8f6f6ed8593c58d2e3c31a1531

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-11-02 07:58:01 +01:00
Stéphane Valès
86bf83bce8
Problem: cmake generates faulty xcode projects also for dynamic lib (#4042)
* apply the use of sources for xcode project also to dynamic library

Co-authored-by: Stéphane Valès <stephane@vales.fr@users.noreply.github.com>
Co-authored-by: stephane vales <vales@ingenuity.io>
2020-09-16 15:52:18 +01:00
Stéphane Valès
c098fa3c18
Problem: using targets in CMakeLists.txt creates a corrupted xcode project with cmake (#4041)
* use sources instead of objects only when generating an xcode project

Co-authored-by: Stéphane Valès <stephane@vales.fr@users.noreply.github.com>
Co-authored-by: stephane vales <vales@ingenuity.io>
2020-09-16 14:25:46 +01:00
Luca Boccassi
f2e364777e Problem: 4.3.3 is out, need new version
Solution: bump to 4.3.4
2020-09-07 11:12:14 +01:00
Luca Boccassi
a4dbdb614e Problem: some platforms do not have strnlen
Solution: move compat redefinition to compat.hpp header so that
it can be used from msg.cpp
2020-08-21 14:39:08 +01:00
fanquake
c14817075c
build: fix gethrtime() function check in CMake
This looks like a typo introduced by
2d8ef84760.
2020-07-07 21:45:08 +08:00
Bill Torpey
1cfd41c064 update sanitizer support
- enable undefined behavior sanitizer
- force release mode for sanitizer builds
2020-06-29 15:40:20 +01:00
mjvk
b6bb3ef925
Adds NORM support to cmake (#3951) 2020-06-07 10:39:02 +01:00
serg06
c89390f0f5 Make including Clang optional
I include libzmq in my cmake project, and I don't want clang-related targets popping up in Visual Studio's solution explorer.
2020-05-25 18:34:17 +01:00
serg06
2e87390656 Initialize some CMake variables as empty before build
This prevents a bug that occurs when a parent has a `sources` variable when doing `add_subdirectory("libzmq")`.
2020-05-25 18:33:52 +01:00