Re: friendly selinux configure patch ping

"Dan Nicholson" <[email protected]> Mon, 13 Mar 2006 16:40:37 -0800
Newsgroups gmane.linux.pld.shadow.general
Message-ID <[email protected]>
Hi,

Sorry about breaking threading.  I just subscribed to the list.

Mike, the patch you submitted has a small bug which wouldn't ever
allow -lselinux.  Just a small typo, but

+       elif test "x$have_selinux" = "yes" ; then

should probably be

    elif test "x$have_selinux" = "xyes" ; then

Just left the x out of the test.  Attached is an updated patch with
that fix.  I can confirm that it works as advertised on my non-SELinux
system.  I don't need to supply --without-selinux anymore.

--
Dan
shadow-friendly-selinux-2.diff (text/x-patch, 1.6 KB)
Index: configure.in
===================================================================
RCS file: /cvsroot/shadow/configure.in,v
retrieving revision 1.138
diff -u -p -r1.138 configure.in
--- configure.in	12 Mar 2006 18:58:22 -0000	1.138
+++ configure.in	14 Mar 2006 00:20:32 -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" = "xyes" ; 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)