configure: Try pkg-config first for libselinux
authorKusanagi Kouichi <slash@ac.auone-net.jp>
Sat, 15 Feb 2014 02:53:00 +0000 (11:53 +0900)
committerEmil Velikov <emil.l.velikov@gmail.com>
Mon, 17 Feb 2014 21:14:16 +0000 (21:14 +0000)
v2 (Emil) Add SELINUX_CFLAGS in the respective locations

Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com> (v1)
configure.ac
src/mapi/glapi/Makefile.am
src/mapi/shared-glapi/Makefile.am
src/mapi/vgapi/Makefile.am

index e3a72bd..d839476 100644 (file)
@@ -506,13 +506,15 @@ AC_ARG_ENABLE([selinux],
     [MESA_SELINUX="$enableval"],
     [MESA_SELINUX=no])
 if test "x$enable_selinux" = "xyes"; then
-    AC_CHECK_HEADER([selinux/selinux.h],[],
-                    [AC_MSG_ERROR([SELinux headers not found])])
-    AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
-                 [AC_MSG_ERROR([SELinux library not found])])
-    SELINUX_LIBS="-lselinux"
+    PKG_CHECK_MODULES([SELINUX], [libselinux], [],
+        [AC_CHECK_HEADER([selinux/selinux.h],[],
+                         [AC_MSG_ERROR([SELinux headers not found])])
+         AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
+                      [AC_MSG_ERROR([SELinux library not found])])
+         SELINUX_LIBS="-lselinux"])
     DEFINES="$DEFINES -DMESA_SELINUX"
 fi
+AC_SUBST([SELINUX_CFLAGS])
 AC_SUBST([SELINUX_LIBS])
 
 dnl Options for APIs
index bf653a3..e425bac 100644 (file)
@@ -27,6 +27,7 @@ include ../Makefile.sources
 
 AM_CPPFLAGS = \
         $(DEFINES) \
+        $(SELINUX_CFLAGS) \
        -I$(top_srcdir)/include \
        -I$(top_srcdir)/src/mapi \
         -I$(top_builddir)/src/mapi \
index b4703be..8d8b4dd 100644 (file)
@@ -21,6 +21,7 @@ CLEANFILES = $(BUILT_SOURCES)
 AM_CFLAGS = $(PTHREAD_CFLAGS)
 AM_CPPFLAGS =                                                  \
        $(DEFINES)                                              \
+       $(SELINUX_CFLAGS)                                       \
        -I$(top_srcdir)/include                                 \
        -I$(top_srcdir)/src/mapi                                \
        -I$(top_builddir)/src/mapi                              \
index 8952df0..197f19f 100644 (file)
@@ -21,6 +21,7 @@
 
 AM_CPPFLAGS = \
        $(DEFINES) \
+       $(SELINUX_CFLAGS) \
        -I$(top_srcdir)/include \
        -I$(top_srcdir)/src/mapi \
        -DMAPI_ABI_HEADER=\"vgapi_tmp.h\"