From 84c33c0384aa4604ff7956f2fae6f83ea60ba96b Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Sun, 2 Feb 2025 12:51:03 +0200 Subject: [PATCH] Build: Check for -fsanitize= also in $CC 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 --- configure.ac | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index e651371e..80d6d338 100644 --- a/configure.ac +++ b/configure.ac @@ -1235,8 +1235,9 @@ AS_CASE([$enable_sandbox], ]])], [ 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],