1 # serial 3 -*- Autoconf -*-
2 # Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
3 # This file is free software; the Free Software Foundation
4 # gives unlimited permission to copy and/or distribute it,
5 # with or without modifications, as long as this notice is preserved.
8 # Provide <selinux/selinux.h>, if necessary.
10 AC_DEFUN([gl_HEADERS_SELINUX_SELINUX_H],
12 AC_REQUIRE([gl_LIBSELINUX])
13 AC_CHECK_HEADERS([selinux/selinux.h],
15 [SELINUX_SELINUX_H=selinux/selinux.h])
16 AC_SUBST([SELINUX_SELINUX_H])
18 case "$ac_cv_search_setfilecon:$ac_cv_header_selinux_selinux_h" in
19 no:*) # already warned
22 AC_MSG_WARN([libselinux was found but selinux/selinux.h is missing.])
23 AC_MSG_WARN([AC_PACKAGE_NAME will be compiled without SELinux support.])
27 AC_DEFUN([gl_LIBSELINUX],
29 AC_REQUIRE([AC_CANONICAL_HOST])
30 AC_REQUIRE([AC_CANONICAL_BUILD])
33 AC_SEARCH_LIBS([setfilecon], [selinux],
34 [test "$ac_cv_search_setfilecon" = "none required" ||
35 LIB_SELINUX=$ac_cv_search_setfilecon])
36 AC_SUBST([LIB_SELINUX])
39 # Warn if SELinux is found but libselinux is absent;
40 if test "$ac_cv_search_setfilecon" = no &&
41 test "$host" = "$build" && test -d /selinux; then
42 AC_MSG_WARN([This system supports SELinux but libselinux is missing.])
43 AC_MSG_WARN([AC_PACKAGE_NAME will be compiled without SELinux support.])