diff mbox

[U-Boot] tools: use pkg-config when available to get SSL flags

Message ID 1431464398-15602-1-git-send-email-thomas.petazzoni@free-electrons.com
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Thomas Petazzoni May 12, 2015, 8:59 p.m. UTC
Instead of hardcoding -lssl -lcrypto as the flags needed to build
mkimage with FIT signature enabled, use pkg-config when
available. This allows to properly support cases where static linking
is used, which requires linking with -lz, since OpenSSL uses zlib
internally.

We gracefully fallback on the previous behavior of hardcoding -lssl
-lcrypto if pkg-config is not available or fails with an error.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 tools/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/tools/Makefile b/tools/Makefile
index 4bbb153..e1bcd59 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -122,7 +122,8 @@  endif
 
 # MXSImage needs LibSSL
 ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_FIT_SIGNATURE),)
-HOSTLOADLIBES_mkimage += -lssl -lcrypto
+HOSTLOADLIBES_mkimage += \
+	$(shell pkg-config --libs libssl 2> /dev/null || echo "-lssl -lcrypto")
 endif
 
 HOSTLOADLIBES_dumpimage := $(HOSTLOADLIBES_mkimage)