## Problem
Every macOS job in CI currently fails: `turnserver` segfaults on the
first TLS client in `examples/run_tests.sh` (e.g. run 37231739523 on
#2093, which only touches `dbd_sqlite.c`).
Cause: Homebrew's `openssl` formula now resolves to `openssl@4` (4.0.3),
but the libevent bottle's `libevent_openssl` still links `openssl@3`.
coturn builds against OpenSSL 4 and passes its `SSL*` to libevent
running on OpenSSL 3 via `bufferevent_openssl_socket_new`, which crashes
in `SSL_set_bio`. macOS two-level namespaces keep both copies loaded.
## Changes
- `.github/workflows/macos.yml`: install `openssl@3` and export
`OPENSSL_ROOT_DIR` / `PKG_CONFIG_PATH` for both the autotools and CMake
jobs.
- `cmake/CheckLibeventOpenSSL.cmake` (new), used from
`src/apps/common/CMakeLists.txt`: on macOS, fail configure when
`libevent_openssl` links a different OpenSSL major than the one found.
- `configure`: same check for the autotools build (Darwin only).
- `TURN_ALLOW_OPENSSL_MISMATCH` (CMake option / env var) overrides the
check.
## Testing
On macOS (both `openssl@3` 3.6.5 and `openssl@4` 4.0.3 installed):
- CMake configure with the default OpenSSL (`openssl@4`) fails with the
new error. With `-DOPENSSL_ROOT_DIR=$(brew --prefix openssl@3)` it
passes, and `-DTURN_ALLOW_OPENSSL_MISMATCH=ON` also passes.
- `./configure` with `openssl@4` first on `PKG_CONFIG_PATH` aborts; with
`openssl@3` first it passes, and the override also passes.
- With the `openssl@3` build: `ctest` 21/21, and `run_tests.sh`
(TCP/TLS/UDP/DTLS), `run_tests_conf`, `dtls_default`, `ipv6_relay`,
`mobility_quota`, `mobility_resume_flood`, `stateless_binding`,
`stateless_nonce` all pass with no FAIL or segfault.
On Linux (Docker): CMake configure, build and `ctest` (20/20) pass; the
check is a no-op there. I did not complete the Linux `run_tests*.sh`
pass.
The PR's own macOS CI jobs are the real end-to-end check.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>