summaryrefslogtreecommitdiff
blob: 522610f9fb574c765e9c7b467346099234e3c448 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From: Nathan Phillip Brink <binki@gentoo.org>
Subject: Prevent libarchive check from being automagic.

--- a/configure.in
+++ b/configure.in
@@ -231,22 +231,28 @@
 dnl XXX I don't understand why this is even necessary.
-have_libarchive=""
-orig_LIBS="$LIBS"
-AC_CHECK_LIB(archive, archive_read_new, [LIBS="$LIBS -larchive"])
-AC_MSG_CHECKING(whether libarchive works the way I expect)
-AC_TRY_LINK([#include <archive.h>], [
-	struct archive *x; 
-	const char *s = "bogus.zip";
-	x = archive_read_new();
-	archive_read_support_format_all(x);
-	archive_read_open_file(x, s, 10240);
-], have_libarchive="yes")
-if test "x$have_libarchive" = "x"; then
-	LIBS="$orig_LIBS"
-	AC_MSG_RESULT(no)
-else
-	AC_MSG_RESULT(yes)
-	AC_DEFINE(HAVE_LIBARCHIVE)
-fi
+AC_ARG_WITH([libarchive], [AS_HELP_STRING([--without-libarchive], [Disable libarchive support.])],
+	[], [with_libarchive=maybe])
+AS_IF([test "x$with_libarchive" != "xno"],
+	[
+	have_libarchive=""
+	orig_LIBS="$LIBS"
+	AC_CHECK_LIB(archive, archive_read_new, [LIBS="$LIBS -larchive"])
+	AC_MSG_CHECKING(whether libarchive works the way I expect)
+	AC_TRY_LINK([#include <archive.h>], [
+		struct archive *x; 
+		const char *s = "bogus.zip";
+		x = archive_read_new();
+		archive_read_support_format_all(x);
+		archive_read_open_file(x, s, 10240);
+	], have_libarchive="yes")
+	if test "x$have_libarchive" = "x"; then
+		LIBS="$orig_LIBS"
+		AC_MSG_RESULT(no)
+		AS_IF([test "x$with_libarchive" = "xyes"],
+			[AC_MSG_ERROR([--with-libarchive was specified but libarchive could not be found. Please do not specify --with-libarchive or install libarchive.])])
+	else
+		AC_MSG_RESULT(yes)
+		AC_DEFINE(HAVE_LIBARCHIVE)
+	fi])
 
 dnl -----
 AC_ARG_WITH(ssl,