[Pdbg] [PATCH] configure: Use system installed libfdt if available
Amitay Isaacs
amitay at ozlabs.org
Mon Aug 13 18:01:36 AEST 2018
Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
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])
--
2.17.1
More information about the Pdbg
mailing list