1
0
mirror of https://git.tukaani.org/xz.git synced 2025-02-21 07:58:27 +00:00

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
This commit is contained in:
Lasse Collin 2025-02-02 12:51:03 +02:00
parent a7304ea4a7
commit 84c33c0384
No known key found for this signature in database
GPG Key ID: 38EE757D69184620

View File

@ -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],