friendly selinux configure patch ping

[email protected] Tue, 7 Mar 2006 20:15:50 -0500
Newsgroups gmane.linux.pld.shadow.general
Organization wh0rd.org
Message-ID <[email protected]>
updated to current cvs ... this patch addresses the bug that running 
`./configure` on a non-selinux system will fail
-mike
shadow-friendly-selinux.patch (text/x-diff, 1.6 KB)
Index: configure.in
===================================================================
RCS file: /cvsroot/shadow/configure.in,v
retrieving revision 1.136
diff -u -p -r1.136 configure.in
--- configure.in	6 Mar 2006 18:57:10 -0000	1.136
+++ configure.in	8 Mar 2006 01:14:17 -0000
@@ -226,7 +226,7 @@ AC_ARG_WITH(libpam,
 	[with_libpam=$withval], [with_libpam=yes])
 AC_ARG_WITH(selinux,
 	[AC_HELP_STRING([--with-selinux], [use SELinux support @<:@default=autodetect@:>@])],
-	[with_selinux=$withval], [with_selinux=yes])
+	[with_selinux=$withval], [with_selinux=maybe])
 AC_ARG_WITH(skey,
 	[AC_HELP_STRING([--with-skey], [use S/Key support @<:@default=no@:>@])],
 	[with_skey=$withval], [with_skey=no])
@@ -288,13 +288,21 @@ if test "$with_libcrack" = "yes"; then
 		AC_DEFINE(HAVE_LIBCRACK_PW, 1, [Defined if it includes *Pw functions.]))
 fi
 
-if test "$with_selinux" = "yes"; then
+if test "$with_selinux" != "no"; then
+	have_selinux="yes"
 	AC_CHECK_LIB(selinux, is_selinux_enabled,
 		[LIBSELINUX="-lselinux"],
-		[AC_MSG_ERROR([libselinux not found])])
+		[have_selinux="no"])
 	AC_SUBST(LIBSELINUX)
-	AC_CHECK_HEADERS(selinux/selinux.h, [], [selinux/selinux.h is missing])
-	AC_DEFINE(WITH_SELINUX, 1, [Build shadow with SELinux support])
+	if test "x$have_selinux$with_selinux" = "xnoyes" ; then
+		AC_MSG_ERROR([libselinux not found])
+	elif test "x$have_selinux" = "yes" ; then
+		with_selinux="yes"
+		AC_CHECK_HEADERS(selinux/selinux.h, [], [selinux/selinux.h is missing])
+		AC_DEFINE(WITH_SELINUX, 1, [Build shadow with SELinux support])
+	else
+		with_selinux="no"
+	fi
 fi
 
 AC_SUBST(LIBPAM)