From patchwork Sat May 16 16:36:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 473057 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3EB1B140D17 for ; Sun, 17 May 2015 02:36:29 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EB8474B8E5; Sat, 16 May 2015 18:36:25 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1szbTjtLycMx; Sat, 16 May 2015 18:36:25 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3D2604B8E2; Sat, 16 May 2015 18:36:25 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3B75D4B8E2 for ; Sat, 16 May 2015 18:36:22 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7NUWp2ruJifd for ; Sat, 16 May 2015 18:36:22 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail.free-electrons.com (down.free-electrons.com [37.187.137.238]) by theia.denx.de (Postfix) with ESMTP id 086874B8E0 for ; Sat, 16 May 2015 18:36:17 +0200 (CEST) Received: by mail.free-electrons.com (Postfix, from userid 106) id 19DF6363; Sat, 16 May 2015 18:36:20 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (132.230.147.77.rev.sfr.net [77.147.230.132]) by mail.free-electrons.com (Postfix) with ESMTPSA id BF94A258; Sat, 16 May 2015 18:36:19 +0200 (CEST) From: Thomas Petazzoni To: u-boot@lists.denx.de Date: Sat, 16 May 2015 18:36:15 +0200 Message-Id: <1431794175-11866-1-git-send-email-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 2.1.0 Cc: Thomas Petazzoni Subject: [U-Boot] [PATCHv2] tools: use pkg-config when available to get SSL flags X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 --- Changes since v1: - Use both libssl and libcrypto when calling pkg-config, because some symbols of libcrypto are used directly by u-boot. This wasn't visible with static linking because -lssl -lcrypto are returned by pkg-config, but was visible with dynamic linking since only -lssl was returned by pkg-config. tools/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/Makefile b/tools/Makefile index 4bbb153..8ff9c2e 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 libcrypto 2> /dev/null || echo "-lssl -lcrypto") endif HOSTLOADLIBES_dumpimage := $(HOSTLOADLIBES_mkimage)