summarylogtreecommitdiffstats
path: root/0001-Allow-building-without-tools.patch
blob: 1b05ad21b59c420f6998b74d3a1de5c799672aaf (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
54
55
56
57
58
59
60
61
62
63
From f2a166b01445fe412b5bff1b71256aebd62d1fcb Mon Sep 17 00:00:00 2001
From: Daniel VanBritsom <danthemann15@yahoo.com>
Date: Fri, 6 Oct 2023 21:10:09 -0400
Subject: [PATCH] Allow building --without-tools

---
 configure.ac      | 18 +++++++++++++-----
 tools/Makefile.am |  2 ++
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index e15231f..2b12d8f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,11 +47,6 @@ AC_TYPE_UINT8_T
 # Checks for library functions.
 AC_CHECK_FUNCS([strdup strerror strcasecmp strndup malloc realloc calloc])
 
-# Checks for libraries.
-AC_CHECK_HEADERS([readline/readline.h], [],
-	[AC_MSG_ERROR([Please install readline development headers])]
-)
-
 # Check additional platform flags
 AC_MSG_CHECKING([for platform-specific build settings])
 case ${host_os} in
@@ -100,6 +95,19 @@ if test "$ac_cv_attribute_constructor" = "yes"; then
   AC_DEFINE(HAVE_ATTRIBUTE_CONSTRUCTOR, 1, [Define if the C compiler supports constructor/destructor attributes])
 fi
 
+AC_ARG_WITH([tools],
+	[AS_HELP_STRING([--with-tools], [Build irecovery tools. (requires readline) [default=yes]])],
+	[],
+	[with_tools=yes])
+
+AS_IF([test "x$with_tools" = "xyes"], [
+	AC_DEFINE(BUILD_TOOLS, 1, [Define if we are building irecovery tools])
+	AC_CHECK_HEADERS([readline/readline.h], [],
+		[AC_MSG_ERROR([Please install readline development headers])]
+	)]
+)
+AM_CONDITIONAL(BUILD_TOOLS, test "x$with_tools" = "xyes")
+
 AC_ARG_WITH([dummy],
 	[AS_HELP_STRING([--with-dummy], [Use no USB driver at all [default=no]. This is only useful if you just want to query the device list by product type or hardware model. All other operations are no-ops or will return IRECV_E_UNSUPPORTED.])],
 	[],
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 03728b2..ebb085c 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -1,3 +1,4 @@
+if BUILD_TOOLS
 AM_CPPFLAGS = -I$(top_srcdir)/include
 
 AM_CFLAGS = $(GLOBAL_CFLAGS) $(libusb_CFLAGS)
@@ -9,3 +10,4 @@ irecovery_SOURCES = irecovery.c
 irecovery_CFLAGS = $(AM_CFLAGS)
 irecovery_LDFLAGS = $(AM_LDFLAGS)
 irecovery_LDADD = $(top_builddir)/src/libirecovery-1.0.la
+endif
-- 
2.44.0