From a396f49cb8ce019b0a7c534b4e029bc1bb8b3fb1 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Mon, 4 Dec 2023 19:12:46 +0100 Subject: [PATCH] btrfs-progs: build: conditionally detect x86_64 compiler flags Compiling with clang on aarch64 leads to an error when detecting the SIMD instruction support. Gcc ignores the arch/feature mismatch. Conditionally detect the -m flags only on x86_64. Issue: #712 Signed-off-by: David Sterba --- configure.ac | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configure.ac b/configure.ac index bed3c8dd..a049be08 100644 --- a/configure.ac +++ b/configure.ac @@ -45,6 +45,8 @@ AC_C_CONST AC_C_VOLATILE AC_C_BIGENDIAN +if test "x$target_cpu" == 'xx86_64'; then + AX_CHECK_COMPILE_FLAG([-msse2], [HAVE_CFLAG_msse2=1], [HAVE_CFLAG_msse2=0]) AC_SUBST([HAVE_CFLAG_msse2]) AC_DEFINE_UNQUOTED([HAVE_CFLAG_msse2], [$HAVE_CFLAG_msse2], [Compiler supports -msse2]) @@ -61,6 +63,8 @@ AX_CHECK_COMPILE_FLAG([-msha], [HAVE_CFLAG_msha=1], [HAVE_CFLAG_msha=0]) AC_SUBST([HAVE_CFLAG_msha]) AC_DEFINE_UNQUOTED([HAVE_CFLAG_msha], [$HAVE_CFLAG_msha], [Compiler supports -msha]) +fi + AX_CHECK_COMPILE_FLAG([-std=gnu11], [], [AC_MSG_ERROR([std=gnu11 compiler required])])