btrfs-progs: build: use AS_IF for target_cpu condition

The autoconf manual recommends AS_IF [1] nowadays rather than bare shell
if tests as they can interfere with quoting and macro expansion.

[1] https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.html#index-AS_005fIF-1

Pull-request: #721
Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Sam James 2023-12-15 04:17:44 +00:00 committed by David Sterba
parent a79560163c
commit 46101b0137
1 changed files with 14 additions and 16 deletions

View File

@ -45,25 +45,23 @@ AC_C_CONST
AC_C_VOLATILE
AC_C_BIGENDIAN
if test "x$target_cpu" = 'xx86_64'; then
AS_IF([test "x$target_cpu" = 'xx86_64'], [
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])
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])
AX_CHECK_COMPILE_FLAG([-msse4.1], [HAVE_CFLAG_msse41=1], [HAVE_CFLAG_msse41=0])
AC_SUBST([HAVE_CFLAG_msse41])
AC_DEFINE_UNQUOTED([HAVE_CFLAG_msse41], [$HAVE_CFLAG_msse41], [Compiler supports -msse4.1])
AX_CHECK_COMPILE_FLAG([-msse4.1], [HAVE_CFLAG_msse41=1], [HAVE_CFLAG_msse41=0])
AC_SUBST([HAVE_CFLAG_msse41])
AC_DEFINE_UNQUOTED([HAVE_CFLAG_msse41], [$HAVE_CFLAG_msse41], [Compiler supports -msse4.1])
AX_CHECK_COMPILE_FLAG([-mavx2], [HAVE_CFLAG_mavx2=1], [HAVE_CFLAG_mavx2=0])
AC_SUBST([HAVE_CFLAG_mavx2])
AC_DEFINE_UNQUOTED([HAVE_CFLAG_mavx2], [$HAVE_CFLAG_mavx2], [Compiler supports -mavx2])
AX_CHECK_COMPILE_FLAG([-mavx2], [HAVE_CFLAG_mavx2=1], [HAVE_CFLAG_mavx2=0])
AC_SUBST([HAVE_CFLAG_mavx2])
AC_DEFINE_UNQUOTED([HAVE_CFLAG_mavx2], [$HAVE_CFLAG_mavx2], [Compiler supports -mavx2])
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([-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])
], [])
AX_CHECK_COMPILE_FLAG([-std=gnu11], [],
[AC_MSG_ERROR([std=gnu11 compiler required])])