Skip to contentSkip to conversation

Add a configure option for SELinux support

PATCH In review Sergey Kvachonok 2 participants 2 messages Jan 13, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add a configure option for SELinux support

./configure --without-selinux :: unconditionally disable SELinux support

./configure --with-selinux :: enable SELinux support and abort if libselinux is not found

When no configure option is specified the current libselinux autodetection behaviour is preserved.

---
 configure.ac | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
configure.ac +18 -2
index 8781af1..b855afe 100644
@@ -45,6 +45,12 @@ AC_CHECK_HEADERS_ONCE([
 	sys/mount.h
 ])
 
+# Test configure options.
+AC_ARG_WITH([selinux],
+	AS_HELP_STRING([--without-selinux],
+	  [Ignore presence of libselinux and disable selinux support])
+)
+
 # Checks for programs.
 AC_PROG_CC
 AC_PROG_LIBTOOL
@@ -54,9 +60,19 @@ AC_PATH_PROG([LDCONFIG], [ldconfig],
 
 # Checks for libraries.
 PKG_CHECK_MODULES([libuuid], [uuid])
-PKG_CHECK_MODULES([libselinux], [libselinux],
+
+AS_IF([test "x$with_selinux" != "xno"],
+	[PKG_CHECK_MODULES([libselinux], [libselinux],
+	                   [have_selinux=yes], [have_selinux=no])],
+	[have_selinux=no]
+)
+
+AS_IF([test "x$have_selinux" = "xyes"],
 	[AC_DEFINE([HAVE_LIBSELINUX], [1], [Use libselinux])],
-	[AC_MSG_NOTICE([libselinux not found])])
+	[AS_IF([test "x$with_selinux" = "xyes"],
+		[AC_MSG_ERROR([selinux support requested but libselinux not found])]
+	)]
+)
 
 # Checks for header files.
 AC_CHECK_HEADERS([linux/fs.h linux/blkzoned.h fcntl.h mntent.h stdlib.h string.h \
Signature · 9 lines
2.11.0


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
#1 lore raw

Merged, thank you for the patch.

Quoted 66 lines · Sergey Kvachonok

./configure --without-selinux :: unconditionally disable SELinux support

./configure --with-selinux :: enable SELinux support and abort if libselinux is not found

When no configure option is specified the current libselinux autodetection behaviour is preserved.

---
 configure.ac | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
configure.ac +18 -2
index 8781af1..b855afe 100644
@@ -45,6 +45,12 @@ AC_CHECK_HEADERS_ONCE([
 	sys/mount.h
 ])
 
+# Test configure options.
+AC_ARG_WITH([selinux],
+	AS_HELP_STRING([--without-selinux],
+	  [Ignore presence of libselinux and disable selinux support])
+)
+
 # Checks for programs.
 AC_PROG_CC
 AC_PROG_LIBTOOL
@@ -54,9 +60,19 @@ AC_PATH_PROG([LDCONFIG], [ldconfig],
 
 # Checks for libraries.
 PKG_CHECK_MODULES([libuuid], [uuid])
-PKG_CHECK_MODULES([libselinux], [libselinux],
+
+AS_IF([test "x$with_selinux" != "xno"],
+	[PKG_CHECK_MODULES([libselinux], [libselinux],
+	                   [have_selinux=yes], [have_selinux=no])],
+	[have_selinux=no]
+)
+
+AS_IF([test "x$have_selinux" = "xyes"],
 	[AC_DEFINE([HAVE_LIBSELINUX], [1], [Use libselinux])],
-	[AC_MSG_NOTICE([libselinux not found])])
+	[AS_IF([test "x$with_selinux" = "xyes"],
+		[AC_MSG_ERROR([selinux support requested but libselinux not found])]
+	)]
+)
 
 # Checks for header files.
 AC_CHECK_HEADERS([linux/fs.h linux/blkzoned.h fcntl.h mntent.h stdlib.h string.h \
Signature · 13 lines
2.11.0


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi