[PATCH 2/3] Proc01: Fix for PPC64 and Support SELinux-enabled Environment v2: The following patches add an entry from a PPC64 kernel to the list of known issue, which may return errno EINVAL depends on the content of the file and the read buffer it is testing. Also, they add support for SELinux-enabled testing environment by using the correct expected results if it is able to detect SELinux is enabled. It does not affect the testing for systems with no LSM, LSM other than SELinux, and SELinux-disabled. Version 2 is created base on the suggestion from Serge E. Hallyn. This patch is using configure script to automatically detect if the system has libselinux libraries and header installed, so we can use a macro later on to actually check if SELinux is enabled. Otherwise, or if you don't want to run configure script at all, the test and other tests should behave as normal. Also, it removes some unnecessary comments from the Makefile, and replaces LOADLIBES to LDLIBS according to the LTP INSTALL file, LDLIBS   - libraries listed after objects during link. Signed-off-by: CAI Qian <caiqian@cclom.cn>.
diff --git a/config.mk.in b/config.mk.in
index fa86da1..53e0a1f 100644
--- a/config.mk.in
+++ b/config.mk.in
@@ -7,3 +7,4 @@
 LDFLAGS = @LDFLAGS@
 
 AIO_LIBS = @AIO_LIBS@
+SELINUX_LIBS = @SELINUX_LIBS@
diff --git a/configure.ac b/configure.ac
index 2c84213..cfb5813 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,5 +18,6 @@
 LTP_CHECK_SYSCALL_EVENTFD
 LTP_CHECK_SYSCALL_MODIFY_LDT
 LTP_CHECK_SYSCALL_SIGNALFD
+LTP_CHECK_SELINUX
 
 AC_OUTPUT
diff --git a/m4/ltp-selinux.m4 b/m4/ltp-selinux.m4
new file mode 100644
index 0000000..3760f78
--- /dev/null
+++ b/m4/ltp-selinux.m4
@@ -0,0 +1,29 @@
+dnl
+dnl Copyright (c) Red Hat Inc., 2009
+dnl
+dnl This program is free software;  you can redistribute it and/or
+dnl modify it under the terms of the GNU General Public License as
+dnl published by the Free Software Foundation; either version 2 of
+dnl the License, or (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+dnl the GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program;  if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+dnl USA
+
+dnl
+dnl LTP_CHECK_SELINUX
+dnl ----------------------------
+dnl
+AC_DEFUN([LTP_CHECK_SELINUX],
+[dnl
+AC_CHECK_HEADERS(selinux/selinux.h,[
+        SELINUX_LIBS="-lselinux"],[
+        SELINUX_LIBS=""])
+AC_SUBST(SELINUX_LIBS)
+])
diff --git a/testcases/kernel/fs/proc/Makefile b/testcases/kernel/fs/proc/Makefile
index 8c18178..7a2b2cf 100644
--- a/testcases/kernel/fs/proc/Makefile
+++ b/testcases/kernel/fs/proc/Makefile
@@ -16,12 +16,10 @@
 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 #
 
-###########################################################################
-# name of file	: Makefile						  #
-# description	: make(1) description file for the send(2) tests.	  #
-###########################################################################
+include ../../../../config.mk
+
 CFLAGS+=	-I../../../../include
-LOADLIBES+=	-L../../../../lib -lltp
+LDLIBS+=	-L../../../../lib -lltp $(SELINUX_LIBS)
 
 SRCS=$(wildcard *.c)
 TARGETS=$(patsubst %.c,%,$(SRCS))
@@ -33,5 +31,3 @@
 
 clean:
 	rm -f $(TARGETS)
-
-