summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Polevoy <fx@thefx.co>2023-02-22 15:05:16 +0100
committerMichael Grunder <michael.grunder@gmail.com>2023-03-09 15:53:55 -0800
commitcd208812f922f3715b90e571bf9d4b048d3ac605 (patch)
tree86cd5ce6ef10349e6319470489eb9b5e99ac7a94
parent011f7093c001b6584252418fc9f657c374bdca66 (diff)
Attempt to find the correct path for openssl.
The installation path for openssl may vary depending on the way used for its installation and the macOS version. This commit attempts to find the correct path for openssl to use.
-rw-r--r--Makefile17
1 files changed, 14 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 016a771..223a101 100644
--- a/Makefile
+++ b/Makefile
@@ -100,9 +100,20 @@ ifeq ($(USE_SSL),1)
SSL_LDFLAGS=-lssl -lcrypto
endif
else
- OPENSSL_PREFIX?=/usr/local/opt/openssl
- CFLAGS+=-I$(OPENSSL_PREFIX)/include
- SSL_LDFLAGS+=-L$(OPENSSL_PREFIX)/lib -lssl -lcrypto
+ # On old OSX and macOS, MacPort and HomeBrew both used to install openssl
+ # into this directory. On newer machines, homebrew installs into its own
+ # opt/homebrew/ install prefix.
+ IS_OLD_PATH=$(shell sh -c 'test -d /usr/local/opt/openssl')
+
+ ifeq ($(IS_OLD_PATH),1)
+ OPENSSL_PREFIX?=/usr/local/opt/openssl
+ CFLAGS+=-I$(OPENSSL_PREFIX)/include
+ SSL_LDFLAGS+=-L$(OPENSSL_PREFIX)/lib -lssl -lcrypto
+ else
+ OPENSSL_PREFIX?=/opt/homebrew/opt/openssl
+ CFLAGS+=-I$(OPENSSL_PREFIX)/include
+ SSL_LDFLAGS+=-L$(OPENSSL_PREFIX)/lib -lssl -lcrypto
+ endif
endif
endif