From bb1ca4961cc59a896ecd5304d1deba4261ddac85 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Mon, 29 Nov 2021 08:00:00 +0000 Subject: m4: fix st_SELINUX check * m4/st_selinux.m4: Make sure selinux support is enabled only if all expected functions are provided by libselinux. Fixes: v5.12~49 "Implement --secontext[=full] option to display SELinux contexts" --- m4/st_selinux.m4 | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) (limited to 'm4') diff --git a/m4/st_selinux.m4 b/m4/st_selinux.m4 index da72a485d..7b24ebaba 100644 --- a/m4/st_selinux.m4 +++ b/m4/st_selinux.m4 @@ -34,29 +34,25 @@ AS_IF([test "x$with_libselinux" != xno], AS_IF([test "x$found_selinux_h" = xyes], [saved_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $libselinux_LDFLAGS" - AC_CHECK_LIB([selinux],[getpidcon], - [libselinux_LIBS="-lselinux" - enable_secontext=yes - ], - [if test "x$with_libselinux" != xcheck; then - AC_MSG_FAILURE([failed to find getpidcon in libselinux]) - fi - ] - ) - AC_CHECK_LIB([selinux],[getfilecon], - [libselinux_LIBS="-lselinux" - enable_secontext=yes - ], - [if test "x$with_libselinux" != xcheck; then - AC_MSG_FAILURE([failed to find getfilecon in libselinux]) - fi - ] + missing= + for func in getpidcon getfilecon; do + AC_CHECK_LIB([selinux], [$func], [:], + [missing="$missing $func"]) + done + AS_IF([test "x$missing" = x], + [libselinux_LIBS="-lselinux" + enable_secontext=yes + ], + [AS_IF([test "x$with_libselinux" != xcheck], + [AC_MSG_FAILURE([failed to find in libselinux:$missing])] + ) + ] ) LDFLAGS="$saved_LDFLAGS" ], - [if test "x$with_libselinux" != xcheck; then - AC_MSG_FAILURE([failed to find selinux.h]) - fi + [AS_IF([test "x$with_libselinux" != xcheck], + [AC_MSG_FAILURE([failed to find selinux.h])] + ) ] ) ] -- cgit v1.2.1