]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
Build: Check for -fsanitize= also in $CC
authorLasse Collin <lasse.collin@tukaani.org>
Sun, 2 Feb 2025 10:51:03 +0000 (12:51 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Sun, 2 Feb 2025 12:30:19 +0000 (14:30 +0200)
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

index e651371e6926efbea8ec3492344ab2cd86367749..80d6d3387f45376cfbec44783718386513fcd373 100644 (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],