[Pdbg] [PATCH 3/3] configure: Add conditional build for libfdt
Amitay Isaacs
amitay at ozlabs.org
Fri May 10 14:11:27 AEST 2019
This allows to build against system libfdt if available.
Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
Makefile.am | 7 ++++++-
configure.ac | 7 ++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 8f9dff7..e25fdc2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,10 @@
AUTOMAKE_OPTIONS = foreign
AM_MAKEFLAGS = --no-print-directory
-SUBDIRS = libfdt
+if BUILD_LIBFDT
+MAYBE_LIBFDT = libfdt
+endif
+SUBDIRS = $(MAYBE_LIBFDT)
DIST_SUBDIRS = libfdt
GIT_SHA1 ?= `git --work-tree=$(top_srcdir) --git-dir=$(top_srcdir)/.git describe --always --long --dirty 2>/dev/null || echo unknown`
@@ -157,7 +160,9 @@ libpdbg_la_SOURCES = \
libpdbg/target.h \
libpdbg/xbus.c
+if BUILD_LIBFDT
libpdbg_la_LIBADD = libfdt/libfdt.la
+endif
include_HEADERS = libpdbg/libpdbg.h
diff --git a/configure.ac b/configure.ac
index 9c22e2e..d0d564a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,12 @@ AC_PATH_PROG([RAGEL], [ragel])
AC_SUBST([RAGEL])
AM_CONDITIONAL([HAVE_RAGEL], [test x"$ac_cv_path_RAGEL" != "x"])
-AC_CONFIG_SUBDIRS([libfdt])
+AC_CHECK_LIB([fdt], [fdt_check_header])
+AM_CONDITIONAL([BUILD_LIBFDT], [test x"$ac_cv_lib_fdt_fdt_check_header" != "xyes"])
+if test x"$ac_cv_lib_fdt_fdt_check_header" != "xyes" ; then
+ AC_CONFIG_SUBDIRS([libfdt])
+fi
+
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])
--
2.20.1
More information about the Pdbg
mailing list