mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2026-09-19 09:51:28 +03:00
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.
This commit is contained in:
@@ -32,8 +32,16 @@ fi
|
|||||||
if [ -z ${OPENSSL_ROOT_DIR} ]; then
|
if [ -z ${OPENSSL_ROOT_DIR} ]; then
|
||||||
unameOut="$(uname -s)"
|
unameOut="$(uname -s)"
|
||||||
if [ "$unameOut" = "Darwin" ]; then
|
if [ "$unameOut" = "Darwin" ]; then
|
||||||
echo "Environment variable OPENSSL_ROOT_DIR not set, using default Homebrew path: /usr/local/opt/openssl/"
|
# Homebrew's prefix differs by architecture: /opt/homebrew on Apple
|
||||||
export OPENSSL_ROOT_DIR="/usr/local/opt/openssl/"
|
# 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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user