From: Pádraig Brady
Date: Sun, 26 Oct 2025 12:33:42 +0000 (+0000) Subject: build: don't build chcon or runcon unless selinux is available X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8ba47d09a33f0740e071a8394f3504e0fb57948e;p=thirdparty%2Fcoreutils.git build: don't build chcon or runcon unless selinux is available The build can be force enabled with --with-selinux and vice versa. * build-aux/gen-lists-of-programs.sh: Move chcon and runcon to the list of optional programs. * configure.ac: Only enable chcon and runcon if selinux.h is available. * NEWS: Mention the Build-related change. Fixes https://github.com/coreutils/coreutils/issues/121 --- diff --git a/NEWS b/NEWS index 402585be32..21106f6910 100644 --- a/NEWS +++ b/NEWS @@ -67,6 +67,12 @@ GNU coreutils NEWS -*- outline -*- wc -l now operates 10% faster on hosts that support AVX512 instructions. +** Build-related + + chcon and runcon are not built by default if selinux headers are not present, + or if the --without-selinux configure option is specified. + This can be overridden with the --with-selinux configure option. + * Noteworthy changes in release 9.8 (2025-09-22) [stable] diff --git a/build-aux/gen-lists-of-programs.sh b/build-aux/gen-lists-of-programs.sh index 4b6af8a4f2..454eba0aa4 100755 --- a/build-aux/gen-lists-of-programs.sh +++ b/build-aux/gen-lists-of-programs.sh @@ -24,12 +24,14 @@ disabled_by_default_progs=' # Programs that can be built only when certain requisite system # features are detected at configure time. build_if_possible_progs=' + chcon chroot df hostid libstdbuf.so nice pinky + runcon stdbuf stty timeout @@ -47,7 +49,6 @@ normal_progs=' basenc basename cat - chcon chgrp chmod chown @@ -102,7 +103,6 @@ normal_progs=' realpath rm rmdir - runcon seq sha1sum sha224sum diff --git a/configure.ac b/configure.ac index 1e51aba0e2..fd0b11a69a 100644 --- a/configure.ac +++ b/configure.ac @@ -529,6 +529,16 @@ CFLAGS=$ac_save_CFLAGS LDFLAGS=$ac_save_LDFLAGS ac_c_werror_flag=$cu_save_c_werror_flag +# Don't build chcon and runcon if only have gnulib stubs +# Honor --without-selinux to force disable +# and --with-selinux to force enable. +if test "$with_selinux" != no && + { test "$with_selinux" = yes || + test "$ac_cv_header_selinux_selinux_h" = yes; }; then + gl_ADD_PROG([optional_bin_progs], [chcon]) + gl_ADD_PROG([optional_bin_progs], [runcon]) +fi + # Test compiler support for half precision floating point types (for od) AC_MSG_CHECKING([IEEE 16 bit floating point]) AC_CACHE_VAL([utils_cv_ieee_16_bit_supported],[