summaryrefslogtreecommitdiffstats
path: root/netdata-installer.sh
diff options
context:
space:
mode:
authorVladimir Kobal <vlad@prokk.net>2022-02-02 17:52:47 +0200
committerGitHub <noreply@github.com>2022-02-02 17:52:47 +0200
commit944a76b98c6c36ebb403c7f9e748876169fdb929 (patch)
tree1fef11824dae85017bc4b463aa5657ed0969a403 /netdata-installer.sh
parentc12e5c1137332967243a4ca0f6b2e505c716b9d4 (diff)
Fix compilation errors for OpenSSL on macOS (#12048)
Co-authored-by: Ilya Mashchenko <ilya@netdata.cloud>
Diffstat (limited to 'netdata-installer.sh')
-rwxr-xr-xnetdata-installer.sh20
1 files changed, 17 insertions, 3 deletions
diff --git a/netdata-installer.sh b/netdata-installer.sh
index 2336611a24..058e596014 100755
--- a/netdata-installer.sh
+++ b/netdata-installer.sh
@@ -27,9 +27,23 @@ fi
# -----------------------------------------------------------------------------
# Pull in OpenSSL properly if on macOS
-if [ "$(uname -s)" = 'Darwin' ] && [ -d /usr/local/opt/openssl/include ]; then
- export C_INCLUDE_PATH="/usr/local/opt/openssl/include"
- export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
+if [ "$(uname -s)" = 'Darwin' ]; then
+ if brew --prefix > /dev/null 2>&1; then
+ if brew --prefix --installed openssl > /dev/null 2>&1; then
+ HOMEBREW_OPENSSL_PREFIX=$(brew --prefix --installed openssl)
+ elif brew --prefix --installed openssl@3 > /dev/null 2>&1; then
+ HOMEBREW_OPENSSL_PREFIX=$(brew --prefix --installed openssl@3)
+ elif brew --prefix --installed openssl@1.1 > /dev/null 2>&1; then
+ HOMEBREW_OPENSSL_PREFIX=$(brew --prefix --installed openssl@1.1)
+ fi
+ if [ -n "${HOMEBREW_OPENSSL_PREFIX}" ]; then
+ export CFLAGS="${CFLAGS} -I${HOMEBREW_OPENSSL_PREFIX}/include"
+ export LDFLAGS="${LDFLAGS} -L${HOMEBREW_OPENSSL_PREFIX}/lib"
+ fi
+ HOMEBREW_PREFIX=$(brew --prefix)
+ export CFLAGS="${CFLAGS} -I${HOMEBREW_PREFIX}/include"
+ export LDFLAGS="${LDFLAGS} -L${HOMEBREW_PREFIX}/lib"
+ fi
fi
# -----------------------------------------------------------------------------