Skip to content

Commit

Permalink
Build: Check for -fsanitize= also in $CC
Browse files Browse the repository at this point in the history
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: 88588b1
  • Loading branch information
Larhzu committed Feb 2, 2025
1 parent a7304ea commit 84c33c0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down

0 comments on commit 84c33c0

Please sign in to comment.