Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1 | From c02354af7f3d9426da31503abfae70952c699a9d Mon Sep 17 00:00:00 2001 |
| 2 | From: Wenzong Fan <wenzong.fan@windriver.com> |
| 3 | Date: Fri, 18 Mar 2016 03:23:11 -0400 |
| 4 | Subject: [PATCH] configure: fix with/without selinux |
| 5 | |
| 6 | Problem: |
| 7 | without-selinux doesn't work since WITH_SELINUX is always be defined no |
| 8 | matter which option is given: with-selinux, without-selinux. |
| 9 | |
| 10 | Fix: |
| 11 | Disable selinux support if without-selinux is given; otherwise check |
| 12 | libselinux to determine if selinux support should be enabled. |
| 13 | |
| 14 | Upstream-Status: Submitted [at@packages.debian.org] |
| 15 | |
| 16 | Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com> |
| 17 | --- |
| 18 | configure.ac | 19 +++++++++++++++---- |
| 19 | 1 file changed, 15 insertions(+), 4 deletions(-) |
| 20 | |
| 21 | diff --git a/configure.ac b/configure.ac |
| 22 | index 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 | -- |
| 52 | 1.9.1 |
| 53 | |