Skip to content

Commit

Permalink
Makefile.openssl can now search and link with either only libcrypto o…
Browse files Browse the repository at this point in the history
…r both libcrypto and libssl
  • Loading branch information
tcresson authored and sobomax committed Nov 9, 2023
1 parent f0488b5 commit 216909f
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions Makefile.openssl
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,39 @@
# Needed to build with openssl 3.x
DEFS += -Wno-deprecated-declarations

# normalize USE_ONLY_CRYPTO value
ifeq ($(USE_ONLY_CRYPTO),)
USE_ONLY_CRYPTO=false
endif

ifeq ($(CROSS_COMPILE),)
ifeq ($(USE_ONLY_CRYPTO),false)
SSL_BUILDER=$(shell \
if pkg-config --exists libssl libcrypto; then \
echo 'pkg-config libssl libcrypto'; \
fi)
else
SSL_BUILDER=$(shell \
if pkg-config --exists libssl; then \
echo 'pkg-config libssl'; \
if pkg-config --exists libcrypto; then \
echo 'pkg-config libcrypto'; \
fi)
endif
endif

ifneq ($(SSL_BUILDER),)
DEFS += $(shell $(SSL_BUILDER) --cflags)
LIBS += $(shell $(SSL_BUILDER) --libs) -lcrypto
LIBS += $(shell $(SSL_BUILDER) --libs)
else
DEFS += -I$(LOCALBASE)/ssl/include \
-I$(LOCALBASE)/include
LIBS += -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib \
-L$(LOCALBASE)/lib64 -L$(LOCALBASE)/ssl/lib64 \
-lssl -lcrypto
-lcrypto
ifeq ($(USE_ONLY_CRYPTO),false)
LIBS += -lssl
endif
endif


# enable this flag to increase performance by not serializing openssl
# connect/accept/read/write operations, at the cost of possible crashes
Expand Down

0 comments on commit 216909f

Please sign in to comment.