People may put -fsanitize in CC instead of CFLAGS so check both.
Landlock sandbox isn't compatible with sanitizers so it's nice
to catch the incompatible options at configure time.
Don't attempt to do the same in CMakeLists.txt; the check for
CMAKE_C_FLAGS / CFLAGS shall be enough there. The extra flags from
the CC environment variable go into the undocumented internal variable
CMAKE_C_COMPILER_ARG1 (all flags from CC go into that same variable).
Peeking the internal variable merely for improved diagnostics isn't
worth it.
Fixes: 88588b1246d8c26ffbc138b3e5c413c5f14c3179
]])], [
enable_sandbox=found
- AS_CASE([$CFLAGS], [*-fsanitize=*], [AC_MSG_ERROR([
- CFLAGS contains '-fsanitize=' which is incompatible with the Landlock
+ AS_CASE(["$CC $CFLAGS"], [*-fsanitize=*],
+ [AC_MSG_ERROR([
+ CC or CFLAGS contain '-fsanitize=' which is incompatible with the Landlock
sandboxing. Use --disable-sandbox when using '-fsanitize'.])])
AC_DEFINE([HAVE_LINUX_LANDLOCK], [1],