From 3b286d116f8fb8438b8ae52669d2c1778b7a370b Mon Sep 17 00:00:00 2001 From: Samuel Mendoza-Jonas Date: Tue, 5 Apr 2016 14:46:14 +1000 Subject: [PATCH] configure.ac: Add checks for libflash and libdevmapper libdevmapper is a hard dependency since snapshots were introduced, so add an unconditional configure-time check for it. Also add a check for libflash library and headers if --enable-mtd is set. Signed-off-by: Samuel Mendoza-Jonas --- configure.ac | 26 ++++++++++++++++++++++++++ discover/Makefile.am | 2 +- lib/Makefile.am | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 08685ec..1b9b980 100644 --- a/configure.ac +++ b/configure.ac @@ -57,6 +57,11 @@ AC_CHECK_LIB([udev], [udev_new], [AC_MSG_FAILURE([The libudev development library is required by petitboot. Try installing the package libudev-dev or libudev-devel.])] ) +AC_CHECK_LIB([devmapper], [dm_task_create], + [DEVMAPPER_LIBS=-ldevmapper], + [AC_MSG_FAILURE([The libdevmapper development library is required by petitboot. Try installing the package libdevmapper-dev or libdevmapper-devel.])] +) + AC_ARG_WITH([fdt], AS_HELP_STRING([--without-fdt], [Build without libfdt (default: no)])) @@ -186,6 +191,25 @@ AS_IF([test "x$enable_mtd" = "xyes"], [] ) +AS_IF( + [test "x$enable_mtd" = "xyes"], + AC_CHECK_LIB([flash], [arch_flash_init], + [LIBFLASH_LIBS=-lflash], + [AC_MSG_FAILURE([--enable-mtd requires the libflash library])] + ) +) +AS_IF( + [test "x$enable_mtd" = "xyes"], + [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $libflash_CFLAGS" + AC_CHECK_HEADERS( + [libflash/libflash.h], + [], + [AC_MSG_FAILURE([--enable-mtd given but libflash/libflash.h not found])] + ) + CPPFLAGS="$SAVE_CPPFLAGS" + ] +) + AC_ARG_ENABLE( [ps3], [AS_HELP_STRING( @@ -285,7 +309,9 @@ AS_IF( ) AC_SUBST([UDEV_LIBS]) +AC_SUBST([DEVMAPPER_LIBS]) AC_SUBST([FDT_LIBS]) +AC_SUBST([LIBFLASH_LIBS]) AC_SUBST([LIBTOOL_DEPS]) AC_SUBST([DESTDIR]) AC_SUBST([pkgsysconfdir], ["${sysconfdir}/${package}"]) diff --git a/discover/Makefile.am b/discover/Makefile.am index f55f1cd..899c9a6 100644 --- a/discover/Makefile.am +++ b/discover/Makefile.am @@ -62,7 +62,7 @@ discover_pb_discover_LDADD = \ discover_pb_discover_LDFLAGS = \ $(AM_LDFLAGS) \ - -ldevmapper + $(DEVMAPPER_LIBS) discover_pb_discover_CPPFLAGS = \ $(AM_CPPFLAGS) \ diff --git a/lib/Makefile.am b/lib/Makefile.am index a3ae943..09bc1aa 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -61,7 +61,7 @@ lib_libpbcore_la_CPPFLAGS += \ lib_libpbcore_la_LDFLAGS = \ $(AM_LDFLAGS) \ - -l:libflash.so + $(LIBFLASH_LIBS) lib_libpbcore_la_SOURCES += \ lib/flash/flash.c -- 2.39.2