]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
configure.ac: Add option --with-libarchive
authorAaron Merey <amerey@redhat.com>
Thu, 9 Oct 2025 00:31:20 +0000 (20:31 -0400)
committerAaron Merey <amerey@redhat.com>
Tue, 14 Oct 2025 13:57:27 +0000 (09:57 -0400)
libarchive is required to build debuginfod server and optional for
eu-srcfiles (it enables the --zip option). If neither debuginfod server
nor eu-srcfiles --zip are needed, libarchive can be excluded from the
build.

Currently there is no way to exclude libarchive from the build if
PKG_CHECK_MODULES finds it at configure time.  While debuginfod server
can be disabled with --disable-debuginfod, eu-srcfiles is
unconditionally built with libarchive if it is found.

Add configure option --with-libarchive so that this behavior can be
overridden.

--without-libarchive and --enable-debuginfod cannot be used together.

https://sourceware.org/bugzilla/show_bug.cgi?id=33521

Signed-off-by: Aaron Merey <amerey@redhat.com>
configure.ac

index b8531aa711775637f38c979ed5b4edf8710d08da..84635cd01a6e3baa4feb7f89c1d949339d9b74c7 100644 (file)
@@ -892,7 +892,21 @@ fi
 PKG_CHECK_MODULES([libmicrohttpd],[libmicrohttpd >= 0.9.33],[],[enable_debuginfod=no])
 PKG_CHECK_MODULES([oldlibmicrohttpd],[libmicrohttpd < 0.9.51],[old_libmicrohttpd=yes],[old_libmicrohttpd=no])
 PKG_CHECK_MODULES([sqlite3],[sqlite3 >= 3.7.17],[have_sqlite3=yes],[have_sqlite3=no])
-PKG_CHECK_MODULES([libarchive],[libarchive >= 3.1.2],[have_libarchive=yes],[have_libarchive=no])
+#
+# Check for libarchive unless its usage is disabled.
+AC_ARG_WITH([libarchive],
+  [AS_HELP_STRING([--with-libarchive],
+                  [use libarchive])],
+  [], [with_libarchive=auto])
+have_libarchive=no
+AS_IF([test "x$with_libarchive" != "xno"], [
+  PKG_CHECK_MODULES([libarchive], [libarchive >= 3.1.2],
+    [have_libarchive=yes],
+    [have_libarchive=no])
+])
+AS_IF([test "x$with_libarchive" = "xyes" -a "x$have_libarchive" != "xyes"], [
+  AC_MSG_ERROR([--with-libarchive was given, but libarchive >= 3.1.2 not found])
+])
 #
 # pronounce judgement on ability to build server, overridden by =yes/=no
 if test "x$enable_debuginfod" = "xno"; then