summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@strace.io>2021-11-29 08:00:00 +0000
committerDmitry V. Levin <ldv@strace.io>2021-11-29 12:05:18 +0000
commitbb1ca4961cc59a896ecd5304d1deba4261ddac85 (patch)
treedaa827892c16c407133a2d984ab762bd047745f5 /m4
parent1897e0894a282c0f72fd0f75df7f412a8e951dbb (diff)
downloadstrace-bb1ca4961cc59a896ecd5304d1deba4261ddac85.tar.gz
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"
Diffstat (limited to 'm4')
-rw-r--r--m4/st_selinux.m436
1 files changed, 16 insertions, 20 deletions
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])]
+ )
]
)
]