X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=m4%2Fselinux-selinux-h.m4;h=eb005fcd0acac6bb155b0665f1a9185d2cb2186e;hb=25fb29a19d9993a32075b7c3fefa959e3345ab64;hp=35d2dbed45ad38167d51cbf5057fe32f02e7801a;hpb=b2e2010c7c902235b5efb5bd3c6529f61b093aa4;p=gnulib.git diff --git a/m4/selinux-selinux-h.m4 b/m4/selinux-selinux-h.m4 index 35d2dbed4..eb005fcd0 100644 --- a/m4/selinux-selinux-h.m4 +++ b/m4/selinux-selinux-h.m4 @@ -1,5 +1,5 @@ -# serial 3 -*- Autoconf -*- -# Copyright (C) 2006-2007, 2009-2010 Free Software Foundation, Inc. +# serial 5 -*- Autoconf -*- +# Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -12,46 +12,60 @@ AC_DEFUN([gl_HEADERS_SELINUX_SELINUX_H], [ AC_REQUIRE([gl_LIBSELINUX]) - AC_CHECK_HEADERS([selinux/selinux.h]) - - if test "$ac_cv_header_selinux_selinux_h" = yes; then - # We do have , so do compile getfilecon.c - # and arrange to use its wrappers. - AC_LIBOBJ([getfilecon]) - gl_CHECK_NEXT_HEADERS([selinux/selinux.h]) - AC_DEFINE([getfilecon], [rpl_getfilecon], - [Always use our getfilecon wrapper.]) - AC_DEFINE([lgetfilecon], [rpl_lgetfilecon], - [Always use our lgetfilecon wrapper.]) - AC_DEFINE([fgetfilecon], [rpl_fgetfilecon], - [Always use our fgetfilecon wrapper.]) - fi + if test "$with_selinux" != no; then + AC_CHECK_HEADERS([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 + if test "$ac_cv_header_selinux_selinux_h" = yes; then + # We do have , so do compile getfilecon.c + # and arrange to use its wrappers. + gl_CHECK_NEXT_HEADERS([selinux/selinux.h]) + AC_DEFINE([getfilecon], [rpl_getfilecon], + [Always use our getfilecon wrapper.]) + AC_DEFINE([lgetfilecon], [rpl_lgetfilecon], + [Always use our lgetfilecon wrapper.]) + AC_DEFINE([fgetfilecon], [rpl_fgetfilecon], + [Always use our fgetfilecon wrapper.]) + fi + + 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 + else + # Do as if does not exist, even if + # AC_CHECK_HEADERS_ONCE has already determined that it exists. + AC_DEFINE([HAVE_SELINUX_SELINUX_H], [0]) + fi ]) AC_DEFUN([gl_LIBSELINUX], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_CANONICAL_BUILD]) + + AC_ARG_WITH([selinux], + AS_HELP_STRING([--without-selinux], [do not use SELinux, even on systems with SELinux]), + [], [with_selinux=maybe]) + LIB_SELINUX= - gl_save_LIBS=$LIBS - AC_SEARCH_LIBS([setfilecon], [selinux], - [test "$ac_cv_search_setfilecon" = "none required" || - LIB_SELINUX=$ac_cv_search_setfilecon]) + if test "$with_selinux" != no; then + gl_save_LIBS=$LIBS + AC_SEARCH_LIBS([setfilecon], [selinux], + [test "$ac_cv_search_setfilecon" = "none required" || + LIB_SELINUX=$ac_cv_search_setfilecon]) + LIBS=$gl_save_LIBS + fi 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.]) + if test "$ac_cv_search_setfilecon" = no; then + if 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 + with_selinux=no fi ])