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 <dsterba@suse.com>
This commit is contained in:
David Sterba 2023-12-04 19:12:46 +01:00
parent bc70e12877
commit a396f49cb8
1 changed files with 4 additions and 0 deletions

View File

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