> > +# LTP_CHECK_LIB(/LIBRARY/,/FUNCTIONS/,[/OTHER-LIBRARIES/])
> > +# --------------------------------------------------
> > +# LTP_CHECK_LIB works like AC_CHECK_LIB.
> > +# But it is customized for LTP.
> > +#
> > +# 1. LIBS is not updated even if /FUNCTION/ is found in /LIBRARY/.
> > +# 2. Instead of LIBS, /LIBRARY/_LIBS is set.
> > +# 3. LIBS_/LIBRARY/ is passed to AC_SUBST.
> > +#
> > +AC_DEFUN([LTP_CHECK_LIB],LIBRARY_LIBS
> > +[AH_TEMPLATE(AS_TR_CPP([HAVE_LIB$1]),
> > +[Define to 1 if you have the `$1' library (-l$1).])
> > +AC_CHECK_LIB($1,$2,[AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1)) 
> > AS_TR_CPP([$1_LIBS])="-l$1 $3"],,$3)
> > +AC_SUBST(AS_TR_CPP([$1_LIBS]))])
> > 
> 
> With or without libselinux-devel, the messages from ./configure script
> does not look good.

Sorry it was broken. LIBRARY_LIBS was not needed.
I've reflected all your comment to new patch.
It becomes simpler.


Signed-off-by: Masatake YAMATO <[email protected]>


--- old/m4/ltp-common.m4        1970-01-01 09:00:00.000000000 +0900
+++ new/m4/ltp-common.m4        2009-02-16 13:04:46.000000000 +0900
@@ -0,0 +1,35 @@
+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 Author: Masatake YAMATO <[email protected]>
+dnl
+
+# LTP_CHECK_LIB(/LIBRARY/,/FUNCTIONS/,[/OTHER-LIBRARIES/])
+# --------------------------------------------------
+# LTP_CHECK_LIB works like AC_CHECK_LIB.
+# But it is customized for LTP.
+#
+# 1. LIBS is not updated even if /FUNCTION/ is found in /LIBRARY/.
+# 2. Instead of LIBS, /LIBRARY/_LIBS is set.
+# 3. /LIBRARY/_LIBS is passed to AC_SUBST.
+#
+AC_DEFUN([LTP_CHECK_LIB],
+[AH_TEMPLATE(AS_TR_CPP([HAVE_LIB$1]),
+[Define to 1 if you have the `$1' library (-l$1).])
+AC_CHECK_LIB($1,$2,[AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1)) 
AS_TR_CPP([$1_LIBS])="-l$1 $3"],,$3)
+AC_SUBST(AS_TR_CPP([$1_LIBS]))])

Index: testcases/kernel/fs/proc/proc01.c
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/fs/proc/proc01.c,v
retrieving revision 1.13
diff -u -r1.13 proc01.c
--- testcases/kernel/fs/proc/proc01.c   5 Feb 2009 11:20:49 -0000       1.13
+++ testcases/kernel/fs/proc/proc01.c   16 Feb 2009 04:05:21 -0000
@@ -39,7 +39,11 @@
 #include <fcntl.h>
 #include <fnmatch.h>
 
-#ifdef HAVE_SELINUX_SELINUX_H
+#if defined(HAVE_SELINUX_SELINUX_H) && defined(HAVE_LIBSELINUX)
+#define HAVE_LIBSELINUX_DEVEL
+#endif
+
+#ifdef HAVE_LIBSELINUX_DEVEL
 #include <selinux/selinux.h>
 #endif
 
@@ -107,7 +111,7 @@
 
 /* If a particular LSM is enabled, it is expected that some entries can
    be read successfully. */
-#ifdef HAVE_SELINUX_SELINUX_H
+#ifdef HAVE_LIBSELINUX_DEVEL
 const char lsm_should_work[][PATH_MAX] =
   {
     "/proc/self/attr/*",
@@ -132,7 +136,7 @@
 /* Check if a particular LSM is enabled. */
 int is_lsm_enabled(void)
 {
-#ifdef HAVE_SELINUX_SELINUX_H
+#ifdef HAVE_LIBSELINUX_DEVEL
   return is_selinux_enabled();
 #else
   return 0;
Index: m4/ltp-selinux.m4
===================================================================
RCS file: /cvsroot/ltp/ltp/m4/ltp-selinux.m4,v
retrieving revision 1.1
diff -u -r1.1 ltp-selinux.m4
--- m4/ltp-selinux.m4   5 Feb 2009 11:18:58 -0000       1.1
+++ m4/ltp-selinux.m4   16 Feb 2009 04:05:21 -0000
@@ -22,8 +22,6 @@
 dnl
 AC_DEFUN([LTP_CHECK_SELINUX],
 [dnl
-AC_CHECK_HEADERS(selinux/selinux.h,[
-        SELINUX_LIBS="-lselinux"],[
-        SELINUX_LIBS=""])
-AC_SUBST(SELINUX_LIBS)
+AC_CHECK_HEADERS(selinux/selinux.h)
+LTP_CHECK_LIB(selinux,is_selinux_enabled)
 ])

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to