blob: 389af1e072280b4ab2282274a727db64a1e3faca [file] [log] [blame]
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001From c02354af7f3d9426da31503abfae70952c699a9d Mon Sep 17 00:00:00 2001
2From: Wenzong Fan <wenzong.fan@windriver.com>
3Date: Fri, 18 Mar 2016 03:23:11 -0400
4Subject: [PATCH] configure: fix with/without selinux
5
6Problem:
7without-selinux doesn't work since WITH_SELINUX is always be defined no
8matter which option is given: with-selinux, without-selinux.
9
10Fix:
11Disable selinux support if without-selinux is given; otherwise check
12libselinux to determine if selinux support should be enabled.
13
14Upstream-Status: Submitted [at@packages.debian.org]
15
16Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
17---
18 configure.ac | 19 +++++++++++++++----
19 1 file changed, 15 insertions(+), 4 deletions(-)
20
21diff --git a/configure.ac b/configure.ac
22index 5a43419..8c9de62 100644
23--- a/configure.ac
24+++ b/configure.ac
25@@ -240,10 +240,21 @@ AC_ARG_WITH(daemon_username,
26 AC_SUBST(DAEMON_USERNAME)
27
28 AC_ARG_WITH(selinux,
29-[ --with-selinux Define to run with selinux],
30-AC_DEFINE(WITH_SELINUX, 1, [Define if you are building with_selinux]),
31-)
32-AC_CHECK_LIB(selinux, is_selinux_enabled, SELINUXLIB=-lselinux)
33+[ --with-selinux Define to run with selinux (default=check)],
34+[],
35+[with_selinux=check])
36+
37+if test "x$with_selinux" != xno; then
38+ AC_CHECK_LIB([selinux], [is_selinux_enabled],
39+ [SELINUXLIB=-lselinux
40+ AC_DEFINE(WITH_SELINUX, 1, [Define if you are building with_selinux])
41+ ],
42+ [if test "x$with_selinux" != xcheck; then
43+ AC_MSG_FAILURE([--with-selinux is given, but test for selinux failed])
44+ fi
45+ ]
46+ )
47+fi
48 AC_SUBST(SELINUXLIB)
49 AC_SUBST(WITH_SELINUX)
50
51--
521.9.1
53