From patchwork Mon Aug 13 08:01:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 956884 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41pp8t3zXZz9s8T for ; Mon, 13 Aug 2018 18:01:50 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="Pg7kc/w6"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41pp8t1jk8zF0bZ for ; Mon, 13 Aug 2018 18:01:50 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="Pg7kc/w6"; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41pp8j3hZ1zDr5t for ; Mon, 13 Aug 2018 18:01:41 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="Pg7kc/w6"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 41pp8j0QfQz9sBD; Mon, 13 Aug 2018 18:01:41 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1534147301; bh=fI2FP4VsQYt/B4gOOY0WVG2lBt8QQN+Iz/bUCytwV8A=; h=From:To:Cc:Subject:Date:From; b=Pg7kc/w6ngeeWTotFi9HN3gfqocRUVXoXm9+3ExVVa1ceP3bqmqtMZ4E7t/KCD00m JBD03yMiyVhFMWekJ3B69SAaGpA9Hedpl3vG/u96lU5h99x94mniPeooMHKR11QNhs jenAk1x5h4k6keVIk5SovI4GcH9NKkkTIhnpN0wGdIqz1/nkh3oZJoguzSNMWOWI/8 3OvgwGBDD0XhcGH6xgp6LwipoVDFGr70w5fLlqcJ2o0zijvQN6es8gFtc7O3FjngMa VNjqezFZ4SoQKx30i8e0Aaljc9ZmDvCN0FUew6+V3tYUc7lJT5yufaSstppmG7XgIY kZ92YqFfEwOtg== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Mon, 13 Aug 2018 18:01:36 +1000 Message-Id: <20180813080136.610368-1-amitay@ozlabs.org> X-Mailer: git-send-email 2.17.1 Subject: [Pdbg] [PATCH] configure: Use system installed libfdt if available X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Amitay Isaacs MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs --- Makefile.am | 17 ++++++++++++++++- configure.ac | 11 +++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 571660d..215f997 100644 --- a/Makefile.am +++ b/Makefile.am @@ -78,17 +78,26 @@ pdbg_SOURCES = \ src/parsers.h \ src/progress.h +if LIBFDT_INTERNAL pdbg_LDADD = $(DT_objects) libpdbg.la libfdt.la libccan.a \ -L.libs -lrt +else +pdbg_LDADD = $(DT_objects) libpdbg.la libccan.a \ + -L.libs -lrt -lfdt +endif pdbg_LDFLAGS = -Wl,--whole-archive,-lpdbg,--no-whole-archive pdbg_CFLAGS = -I$(top_srcdir)/libpdbg -Wall -Werror -DGIT_SHA1=\"${GIT_SHA1}\" \ $(ARCH_FLAGS) +if LIBFDT_INTERNAL lib_LTLIBRARIES = libpdbg.la libfdt.la +else +lib_LTLIBRARIES = libpdbg.la +endif +if LIBFDT_INTERNAL libfdt_la_CFLAGS = -I$(top_srcdir)/libfdt -DHAVE_LITTLE_ENDIAN -libpdbg_la_CFLAGS = -I$(top_srcdir)/libfdt -DHAVE_LITTLE_ENDIAN -Wall -Werror libfdt_la_SOURCES = \ libfdt/fdt.c \ @@ -104,6 +113,12 @@ libfdt_la_SOURCES = \ libfdt/libfdt_env.h \ libfdt/libfdt.h \ libfdt/libfdt_internal.h +endif + +libpdbg_la_CFLAGS = -DHAVE_LITTLE_ENDIAN -Wall -Werror +if LIBFDT_INTERNAL +libpdbg_la_CFLAGS += -I$(top_srcdir)/libfdt +endif libpdbg_la_SOURCES = \ libpdbg/libpdbg.c \ diff --git a/configure.ac b/configure.ac index e48e80f..6d910ab 100644 --- a/configure.ac +++ b/configure.ac @@ -17,6 +17,17 @@ if test x"$ac_cv_path_DTC" = x ; then fi AC_SUBST([DTC]) +AC_CHECK_HEADER([libfdt.h]) +AC_CHECK_LIB([fdt], [fdt_check_header]) +if test x"$ac_cv_header_libfdt_h" = "xno" || \ + test x"$ac_cv_lib_fdt_fdt_check_header" = "xno" ; then + AC_MSG_NOTICE([Using in-tree fdt library]) + AM_CONDITIONAL([LIBFDT_INTERNAL], [true]) +else + AC_MSG_NOTICE([Using system-installed fdt library]) + AM_CONDITIONAL([LIBFDT_INTERNAL], [false]) +fi + AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile])