c35c0e
--- rpm-4.17.0/configure.ac	2021-09-03 11:42:16.790237970 +0200
c35c0e
+++ rpm-4.17.0.new/configure.ac	2021-09-10 17:53:28.904112791 +0200
c35c0e
@@ -248,14 +248,22 @@
c35c0e
 
c35c0e
 #=================
c35c0e
 # Check for libelf library. Prefer external, otherwise none.
c35c0e
-WITH_LIBELF_LIB=
c35c0e
-AC_CHECK_HEADER([libelf.h])
c35c0e
-AC_CHECK_HEADERS([gelf.h], [
c35c0e
-	AC_CHECK_LIB(elf, gelf_getvernaux, [
c35c0e
-	    AC_DEFINE(HAVE_LIBELF, 1, [Define to 1 if you have the 'elf' library (-lelf).])
c35c0e
-	    WITH_LIBELF_LIB="-lelf"
c35c0e
-	    WITH_LIBELF=yes
c35c0e
-	])
c35c0e
+AC_ARG_ENABLE([libelf],
c35c0e
+		[AS_HELP_STRING([--enable-libelf=@<:@yes/no/auto@:>@],
c35c0e
+				[build with libelf support (default=yes)])],
c35c0e
+		[enable_libelf="$enableval"],
c35c0e
+		[enable_libelf=yes])
c35c0e
+
c35c0e
+AS_IF([test "x$enable_libelf" != "xno"], [
c35c0e
+  WITH_LIBELF_LIB=
c35c0e
+  AC_CHECK_HEADER([libelf.h])
c35c0e
+  AC_CHECK_HEADERS([gelf.h], [
c35c0e
+    AC_CHECK_LIB(elf, gelf_getvernaux, [
c35c0e
+    AC_DEFINE(HAVE_LIBELF, 1, [Define to 1 if you have the 'elf' library (-lelf).])
c35c0e
+    WITH_LIBELF_LIB="-lelf"
c35c0e
+    WITH_LIBELF=yes
c35c0e
+    ])
c35c0e
+  ])
c35c0e
 ])
c35c0e
 AC_SUBST(WITH_LIBELF_LIB)
c35c0e
 AM_CONDITIONAL(LIBELF,[test "$WITH_LIBELF" = yes])
c35c0e
diff -ru rpm-4.16.0.orig/configure.ac rpm-4.16.0/configure.ac
c35c0e
--- rpm-4.16.0.orig/configure.ac        2021-09-10 20:08:26.243318920 +0200
c35c0e
+++ rpm-4.16.0/configure.ac     2021-09-10 20:11:20.091320179 +0200
c35c0e
@@ -498,6 +498,8 @@
c35c0e
c35c0e
 #=================
c35c0e
 # Check for elfutils libdw library with dwelf_elf_gnu_build_id.
c35c0e
+AS_IF([test "x$enable_libelf" != "xno"], [
c35c0e
+
c35c0e
 WITH_LIBDW_LIB=
c35c0e
 HAVE_LIBDW_STRTAB=
c35c0e
 AS_IF([test "$WITH_LIBELF" = yes],[
c35c0e
@@ -518,6 +520,7 @@
c35c0e
     ])
c35c0e
   ])
c35c0e
 ])
c35c0e
+])
c35c0e
 AC_SUBST(WITH_LIBDW_LIB)
c35c0e
 AM_CONDITIONAL(LIBDW,[test "$WITH_LIBDW" = yes])
c35c0e
 AM_CONDITIONAL(HAVE_LIBDW_STRTAB,[test "$HAVE_LIBDW_STRTAB" = yes])