summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authormichael-grunder <michael.grunder@gmail.com>2023-03-01 15:01:45 -0800
committerMichael Grunder <michael.grunder@gmail.com>2023-03-09 15:53:55 -0800
commit4ca8e73f66105585c167086db52ce66a6ea14afe (patch)
treef97dd39cc4132f9539789255509aa7b538857f79 /Makefile
parentcd208812f922f3715b90e571bf9d4b048d3ac605 (diff)
Rework searching for openssl
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile38
1 files changed, 17 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index 223a101..2194ae0 100644
--- a/Makefile
+++ b/Makefile
@@ -92,29 +92,25 @@ ifeq ($(TEST_ASYNC),1)
endif
ifeq ($(USE_SSL),1)
- ifeq ($(uname_S),Linux)
- ifdef OPENSSL_PREFIX
- CFLAGS+=-I$(OPENSSL_PREFIX)/include
- SSL_LDFLAGS+=-L$(OPENSSL_PREFIX)/lib -lssl -lcrypto
- else
- SSL_LDFLAGS=-lssl -lcrypto
- endif
- else
- # 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
+ ifndef OPENSSL_PREFIX
+ ifeq ($(uname_S),Darwin)
+ SEARCH_PATH1=/opt/homebrew/opt/openssl
+ SEARCH_PATH2=/usr/local/opt/openssl
+
+ ifneq ($(wildcard $(SEARCH_PATH1)),)
+ OPENSSL_PREFIX=$(SEARCH_PATH1)
+ else ifneq($(wildcard $(SEARCH_PATH2)),)
+ OPENSSL_PREFIX=$(SEARCH_PATH2)
+ endif
endif
endif
+
+ ifdef OPENSSL_PREFIX
+ CFLAGS+=-I$(OPENSSL_PREFIX)/include
+ SSL_LDFLAGS+=-L$(OPENSSL_PREFIX)/lib
+ endif
+
+ SSL_LDFLAGS+=-lssl -lcrypto
endif
ifeq ($(uname_S),FreeBSD)