summaryrefslogtreecommitdiffstats
path: root/patches/udisks-1.0.0/libsgutils-optional.diff
blob: 75ee410806a578bb67dfcde2cea9c09cca4f15d5 (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
64
65
66
67
68
From: Michael Olbrich <m.olbrich@pengutronix.de>
Subject: make sgutils2 dependency optional

This patch adds a configure option for sgutils2.
When disabled, the helper program using it will not be built.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>

---
 configure.ac            |   23 ++++++++++++++---------
 src/helpers/Makefile.am |    5 ++++-
 2 files changed, 18 insertions(+), 10 deletions(-)

Index: b/configure.ac
===================================================================
--- a/configure.ac
+++ b/configure.ac
@@ -120,15 +120,20 @@ if test "x$GCC" = "xyes"; then
   changequote([,])dnl
 fi
 
-have_sgutils="false"
-AC_CHECK_LIB([sgutils2], [sg_ll_inquiry], have_sgutils="true")
-if test x$have_sgutils != "xtrue"; then
-   AC_MSG_ERROR([libsgutils2 is needed])
-fi
-SGUTILS_CFLAGS=""
-SGUTILS_LIBS="-lsgutils2"
-AC_SUBST(SGUTILS_CFLAGS)
-AC_SUBST(SGUTILS_LIBS)
+AC_ARG_ENABLE(sgutils2,        [  --disable-sgutils2],enable_sgutils2=$enableval,enable_sgutils2=yes)
+
+if test "x$enable_sgutils2" = xyes; then
+  have_sgutils="false"
+  AC_CHECK_LIB([sgutils2], [sg_ll_inquiry], have_sgutils="true")
+  if test x$have_sgutils != "xtrue"; then
+     AC_MSG_ERROR([libsgutils2 is needed])
+  fi
+  SGUTILS_CFLAGS=""
+  SGUTILS_LIBS="-lsgutils2"
+  AC_SUBST(SGUTILS_CFLAGS)
+  AC_SUBST(SGUTILS_LIBS)
+fi
+AM_CONDITIONAL(SGUTILS2_ENABLED, test "x$enable_sgutils2" = xyes)
 
 
 PKG_CHECK_MODULES(GUDEV, [gudev-1.0 >= 147])
Index: b/src/helpers/Makefile.am
===================================================================
--- a/src/helpers/Makefile.am
+++ b/src/helpers/Makefile.am
@@ -28,12 +28,15 @@ libexec_PROGRAMS = 					\
 	udisks-helper-fstab-mounter			\
 	udisks-helper-ata-smart-collect			\
 	udisks-helper-ata-smart-selftest		\
-	udisks-helper-drive-detach			\
 	udisks-helper-drive-poll			\
 	udisks-helper-linux-md-check			\
 	udisks-helper-drive-benchmark			\
 	$(NULL)
 
+if SGUTILS2_ENABLED
+libexec_PROGRAMS += udisks-helper-drive-detach
+endif
+
 noinst_LTLIBRARIES = libpartutil.la
 libpartutil_la_SOURCES = partutil.h partutil.c
 libpartutil_la_CPPFLAGS = $(LIBPARTED_CFLAGS)