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
This commit is contained in:
Pádraig Brady 2025-10-26 12:33:42 +00:00
parent 2b3eb795c8
commit 8ba47d09a3
3 changed files with 18 additions and 2 deletions

6
NEWS
View File

@ -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]

View File

@ -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

View File

@ -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],[