From 9a7d618a609d11ebfbcd189a45b468402520441b Mon Sep 17 00:00:00 2001 From: Meylis Annagurbanov Date: Sat, 29 Aug 2026 11:06:03 +0500 Subject: [PATCH] configure: ask brew for the OpenSSL prefix on macOS On macOS, configure exports a hardcoded OPENSSL_ROOT_DIR of /usr/local/opt/openssl/. That is the Homebrew prefix on Intel Macs; on Apple Silicon Homebrew installs to /opt/homebrew, so the directory does not exist. Nothing is broken today: CMake's FindOpenSSL treats OPENSSL_ROOT_DIR as a hint rather than an exclusive search path, so it ignores the dead directory and finds OpenSSL anyway. The problem is the log line, which confidently names a path that exists on no Apple Silicon machine and sends anyone debugging an OpenSSL pickup down a false trail. Ask brew for the real prefix, preferring openssl@3 and falling back to openssl, and keep the previous value as a last resort so behaviour is unchanged where Homebrew is absent. --- configure | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 21aedd71..ad7cf33d 100755 --- a/configure +++ b/configure @@ -32,8 +32,16 @@ fi if [ -z ${OPENSSL_ROOT_DIR} ]; then unameOut="$(uname -s)" if [ "$unameOut" = "Darwin" ]; then - echo "Environment variable OPENSSL_ROOT_DIR not set, using default Homebrew path: /usr/local/opt/openssl/" - export OPENSSL_ROOT_DIR="/usr/local/opt/openssl/" + # Homebrew's prefix differs by architecture: /opt/homebrew on Apple + # Silicon, /usr/local on Intel. Ask brew rather than hardcoding one. + if command -v brew > /dev/null 2>&1; then + OPENSSL_ROOT_DIR="$(brew --prefix openssl@3 2>/dev/null || brew --prefix openssl 2>/dev/null)" + fi + if [ -z "${OPENSSL_ROOT_DIR}" ]; then + OPENSSL_ROOT_DIR="/usr/local/opt/openssl/" + fi + echo "Environment variable OPENSSL_ROOT_DIR not set, using ${OPENSSL_ROOT_DIR}" + export OPENSSL_ROOT_DIR fi fi