]> git.karo-electronics.de Git - karo-tx-uboot.git/commitdiff
tools: use pkg-config when available to get SSL flags
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sat, 16 May 2015 16:36:15 +0000 (18:36 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 8 Sep 2015 20:47:08 +0000 (22:47 +0200)
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

index 6c3b4c4291f772e065068b2755b65da56bc087ab..00f09a95b7bee74d8d57a08c6f0c33d42f908f91 100644 (file)
@@ -122,7 +122,8 @@ endif
 
 # MXSImage needs LibSSL
 ifneq ($(CONFIG_SOC_MX23)$(CONFIG_SOC_MX28)$(CONFIG_FIT_SIGNATURE),)
-HOSTLOADLIBES_mkimage += -lssl -lcrypto
+HOSTLOADLIBES_mkimage += \
+       $(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto")
 endif
 
 HOSTLOADLIBES_dumpimage := $(HOSTLOADLIBES_mkimage)
@@ -208,8 +209,6 @@ HOST_EXTRACFLAGS += -include $(srctree)/include/libfdt_env.h \
                $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \
                -I$(srctree)/lib/libfdt \
                -I$(srctree)/tools \
-                -include $(srctree)/include/linux/kconfig.h \
-               -Wno-variadic-macros \
                -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE) \
                -DUSE_HOSTCC \
                -D__KERNEL_STRICT_NAMES \