changeset 11657:f6b541f158c1

add warnings to selinux-h module's configure macros 2009-06-27 Paolo Bonzini <bonzini@gnu.org> * m4/selinux-context-h (gl_HEADERS_SELINUX_CONTEXT_H): Remove self-explaining comment. * m4/selinux-selinux-h: Update serial. (gl_LIBSELINUX): Warn if SELinux is found but libselinux is absent; extracted from... (gl_HEADERS_SELINUX_SELINUX_H): ... this one. Require gl_LIBSELINUX. Add warning for missing development packages here, too.
author Paolo Bonzini <bonzini@gnu.org>
date Sat, 27 Jun 2009 13:00:37 +0200
parents 840c1aaa2f6d
children 8b1dcb465dff
files ChangeLog m4/selinux-context-h.m4 m4/selinux-selinux-h.m4
diffstat 3 files changed, 32 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-06-27  Paolo Bonzini  <bonzini@gnu.org>
+
+	* m4/selinux-context-h (gl_HEADERS_SELINUX_CONTEXT_H): Remove
+	self-explaining comment.
+	* m4/selinux-selinux-h: Update serial.
+	(gl_LIBSELINUX): New macro, adding a warning for missing development
+	packages to code extracted from...
+	(gl_HEADERS_SELINUX_SELINUX_H): ... this one.  Require gl_LIBSELINUX.
+	Add warning for missing development packages here, too.
+
 2009-06-26  Paolo Bonzini  <bonzini@gnu.org>
 
 	* build-aux/bootstrap: Do not use GIT_CONFIG_LOCAL.
--- a/m4/selinux-context-h.m4
+++ b/m4/selinux-context-h.m4
@@ -9,7 +9,6 @@
 
 AC_DEFUN([gl_HEADERS_SELINUX_CONTEXT_H],
 [
-  # Check for <selinux/context.h>,
   AC_CHECK_HEADERS([selinux/context.h],
 		   [SELINUX_CONTEXT_H=],
 		   [SELINUX_CONTEXT_H=selinux/context.h])
--- a/m4/selinux-selinux-h.m4
+++ b/m4/selinux-selinux-h.m4
@@ -1,4 +1,4 @@
-# serial 2   -*- Autoconf -*-
+# serial 3   -*- Autoconf -*-
 # Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9,12 +9,25 @@
 
 AC_DEFUN([gl_HEADERS_SELINUX_SELINUX_H],
 [
-  # Check for <selinux/selinux.h>,
+  AC_REQUIRE([gl_LIBSELINUX])
   AC_CHECK_HEADERS([selinux/selinux.h],
 		   [SELINUX_SELINUX_H=],
 		   [SELINUX_SELINUX_H=selinux/selinux.h])
   AC_SUBST([SELINUX_SELINUX_H])
 
+  case "$ac_cv_search_setfilecon:$ac_cv_header_selinux_selinux_h" in
+    no:*) # already warned
+      ;;
+    *:no)
+      AC_MSG_WARN([libselinux was found but selinux/selinux.h is missing.])
+      AC_MSG_WARN([AC_PACKAGE_NAME will be compiled without SELinux support.])
+  esac
+])
+
+AC_DEFUN([gl_LIBSELINUX],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([AC_CANONICAL_BUILD])
   LIB_SELINUX=
   gl_save_LIBS=$LIBS
   AC_SEARCH_LIBS([setfilecon], [selinux],
@@ -22,4 +35,11 @@
                   LIB_SELINUX=$ac_cv_search_setfilecon])
   AC_SUBST([LIB_SELINUX])
   LIBS=$gl_save_LIBS
+
+  # Warn if SELinux is found but libselinux is absent;
+  if test "$ac_cv_search_setfilecon" = no &&
+     test "$host" = "$build" && test -d /selinux; then
+    AC_MSG_WARN([This system supports SELinux but libselinux is missing.])
+    AC_MSG_WARN([AC_PACKAGE_NAME will be compiled without SELinux support.])
+  fi
 ])