1 From b1e48789d61d995740762f66f505385db42410a5 Mon Sep 17 00:00:00 2001
2 From: Jan Palus <jpalus@fastmail.com>
3 Date: Mon, 30 Oct 2023 01:36:57 +0100
4 Subject: [PATCH] Check if NEON extension are actually available
6 User may pass own compiler flags to configure which override those
7 provided by project through automake. Therefore it is possible for user
8 on ARM platform to pass CXXFLAGS=-mfpu=vfp which will effectively
9 disable NEON even though used compiler supports -mfpu=neon (since user
10 supplied flags take precedence compiler invocation will use flags:
11 -mfpu=neon -mfpu=vfp). Instead of checking whether compiler supports
12 -mfpu=neon flag, check if NEON extensions are available by checking if
13 __ARM_NEON is defined when compiling with -mfpu=neon and user supplied
16 Signed-off-by: Jan Palus <jpalus@fastmail.com>
18 configure.ac | 18 ++++++++++++++----
19 1 file changed, 14 insertions(+), 4 deletions(-)
21 diff --git a/configure.ac b/configure.ac
22 index 0b38537229..0514b619c5 100644
25 @@ -178,10 +178,20 @@ case "${host_cpu}" in
30 - AX_CHECK_COMPILE_FLAG([-mfpu=neon], [neon=true], [neon=false], [$WERROR])
31 - AM_CONDITIONAL([HAVE_NEON], $neon)
33 + SAVE_CXXFLAGS="$CXXFLAGS"
34 + CXXFLAGS="-mfpu=neon $CXXFLAGS"
35 + AC_MSG_CHECKING([for NEON support])
37 + [AC_LANG_PROGRAM([], [[
42 + [neon=yes], [neon=no])
43 + AC_MSG_RESULT([$neon])
44 + CXXFLAGS="$SAVE_CXXFLAGS"
45 + AM_CONDITIONAL([HAVE_NEON], test "xyes" = "x$neon")
46 + if test "xyes" = "$neon"; then
47 AC_DEFINE([HAVE_NEON], [1], [Enable NEON instructions])
48 NEON_CXXFLAGS="-mfpu=neon"
49 AC_SUBST([NEON_CXXFLAGS])