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 e3a72bdc9ac27f164d6ecc3aaf64a0f384ee3c65..d839476827ca53e777bc162827ef69fff11b55fa 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 bf653a305431029b066e7a7712d4cfac56977a6c..e425baceacf8166710fd20e9a73713e93a5586fa 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 b4703be010dc6ca9ba8895223ca7d8399d7b1647..8d8b4dd783c74f7f0cbc2d90df10ee7cb232cabc 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 8952df01af3838553a3b976cfc804386df2e41c1..197f19f7d95656e5ce49d62e809f4021ea994498 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\"