[Pdbg] [PATCH] configure: Use system installed libfdt if available
Amitay Isaacs
amitay at ozlabs.org
Thu Aug 16 16:50:15 AEST 2018
On Thu, 2018-08-16 at 16:36 +1000, Alistair Popple wrote:
> Actually for some projects it would be useful if we could explicitly
> point to
> particular libfdt installation to use. Would this be hard to add? Eg.
> ./configure --with-libfdt=<path to libfdt>
That's not hard. However, autoconf doesn't have a nice way of defining
a library which is either external or in-tree. So we will end up with
lots of ifdef in Makefile.am, specially with all the tests I am adding
which link against libpdbg and libfdt.
I would really like a way to create symlinks to external libfdt if it
was specified, then the ifdef logic is only in one place.
Let me think on this one a little more.
>
> Thanks.
>
> - Alistair
>
> On Monday, 13 August 2018 6:01:36 PM AEST Amitay Isaacs wrote:
> > 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])
> >
>
>
Amitay.
--
There is only one pretty child in the world, and every mother has it. -
Chinese Proverb
More information about the Pdbg
mailing list