[PATCH 1/3] configure: Add libelf as a requirement

Maxiwell S. Garcia maxiwell at linux.ibm.com
Tue Sep 10 00:19:06 AEST 2019


With this library, petitboot is able to open the ELF binary to check
information, like annotation in ELF notes section.

Signed-off-by: Maxiwell S. Garcia <maxiwell at linux.ibm.com>
---
 configure.ac         | 6 ++++++
 discover/Makefile.am | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 5d541fb..f3382e0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,6 +66,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([elf], [elf_begin],
+	[ELF_LIBS=-lelf],
+	[AC_MSG_FAILURE([The libelf development library is required by petitboot.  Try installing the package libelf-dev or elfutils-libelf-devel.])]
+)
+
 PKG_CHECK_EXISTS(libudev >= 218, [old_udev=no], [old_udev=yes])
 if test "$old_udev" = "yes" ; then
       AC_DEFINE(UDEV_LOGGING, 1, [Support old udev logging interface])
@@ -476,6 +481,7 @@ AS_IF(
 )
  
 AC_SUBST([UDEV_LIBS])
+AC_SUBST([ELF_LIBS])
 AC_SUBST([DEVMAPPER_LIBS])
 AC_SUBST([CRYPT_LIBS])
 AC_SUBST([FDT_LIBS])
diff --git a/discover/Makefile.am b/discover/Makefile.am
index bfe33fa..e2d0e93 100644
--- a/discover/Makefile.am
+++ b/discover/Makefile.am
@@ -58,7 +58,8 @@ discover_pb_discover_LDADD = \
 	discover/native/native-parser.ro \
 	discover/platform.ro \
 	$(core_lib) \
-	$(UDEV_LIBS)
+	$(UDEV_LIBS) \
+	$(ELF_LIBS)
 
 discover_pb_discover_LDFLAGS = \
 	$(AM_LDFLAGS) \
-- 
2.20.1



More information about the Petitboot mailing list