summaryrefslogtreecommitdiff
blob: 0f769fc339e3b298e07090ff855b7b0d4908bd6c (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
From bfdedc2f762027ec9a50fda659d66720718bb28d Mon Sep 17 00:00:00 2001
From: Gilles Dartiguelongue <eva@gentoo.org>
Date: Wed, 25 Nov 2015 09:23:51 +0100
Subject: [PATCH] Make libselinux dependency controllable by configure switch

---
 configure.ac | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/configure.ac b/configure.ac
index 777ff84..37a65ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -140,18 +140,19 @@ dnl ==========================================================================
 dnl ****************************
 dnl *** Check for libselinux ***
 dnl ****************************
-    
-SELINUX_LIBS=
+
 msg_selinux=no
-AC_CHECK_LIB(selinux, is_selinux_enabled,
-   [AC_CHECK_HEADERS(selinux/selinux.h,
-     [AC_SEARCH_LIBS(selinux_raw_to_trans_context, selinux, 
-       [AC_DEFINE(HAVE_SELINUX, 1, [Define to 1 if libselinux is available])
-        SELINUX_LIBS="-lselinux"
-        msg_selinux=yes])
-     ])
-   ])
-AC_SUBST(SELINUX_LIBS)
+
+AC_ARG_ENABLE([selinux],
+              [AS_HELP_STRING([--enable-selinux],
+                              [Enable selinux support])])
+AS_IF([test "$enable_selinux" != "no"],
+      [PKG_CHECK_MODULES([SELINUX], [libselinux >= 2.0],
+                         [
+                           AC_DEFINE([HAVE_SELINUX], [1], [Define to 1 if libselinux is available])
+                           msg_selinux=yes
+                         ])
+      ])
 
 
 AC_ARG_ENABLE(empty_view,
-- 
2.6.3