diff --git a/configure.ac b/configure.ac index e6fd591b..24f9735a 100644 --- a/configure.ac +++ b/configure.ac @@ -237,11 +237,10 @@ AM_CONDITIONAL(HAVE_GENERIC_SIMD256, test "$have_generic_simd256" = "yes") AC_ARG_ENABLE(sve, [AC_HELP_STRING([--enable-sve],[enable ARM SVE optimizations])], have_sve=$enableval, have_sve=no) if test "$have_sve" = "yes"; then - AC_DEFINE(HAVE_SVE,1,[Define to enable ARM SVE optimizations.]) + AC_DEFINE(HAVE_SVE,1,[Define to enable ARM SVE optimizations]) fi AM_CONDITIONAL(HAVE_SVE, test "$have_sve" = "yes") - dnl FIXME: dnl AC_ARG_ENABLE(mips-ps, [AS_HELP_STRING([--enable-mips-ps],[enable MIPS pair-single optimizations])], have_mips_ps=$enableval, have_mips_ps=no) dnl if test "$have_mips_ps" = "yes"; then @@ -683,6 +682,13 @@ if test "$enable_openmp" = "yes"; then AX_OPENMP([], [AC_MSG_ERROR([don't know how to enable OpenMP])]) fi +if test "$have_sve" = "yes"; then + ACX_SVE([sve_ok=yes], [sve_ok=no]) + if test "$sve_ok" != "yes"; then + AC_MSG_ERROR([Cannot build a SVE program, aborting]) + fi +fi + AC_ARG_ENABLE(threads, [AS_HELP_STRING([--enable-threads],[compile FFTW SMP threads library])], enable_threads=$enableval, enable_threads=no) if test "$enable_threads" = "yes"; then diff --git a/m4/acx_sve.m4 b/m4/acx_sve.m4 new file mode 100644 index 00000000..6a981fe8 --- /dev/null +++ b/m4/acx_sve.m4 @@ -0,0 +1,26 @@ +dnl @synopsis ACX_SVE([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +dnl @summary figure out whether a simple SVE program can be compiled +dnl @category InstalledPackages +dnl +dnl This macro tries to compile a simple SVE program that uses +dnl the ACLE SVE extensions. +dnl +dnl ACTION-IF-FOUND is a list of shell commands to run if a SVE +dnl program can be compiled, and ACTION-IF-NOT-FOUND is a list of commands +dnl to run it cannot. +dnl +dnl @version 2024-04-15 +dnl @license GPLWithACException +dnl @author Gilles Gouaillardet + +AC_DEFUN([ACX_SVE], [ + + AC_MSG_CHECKING([whether a SVE program can be compiled]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[#if defined(__GNUC__) && !defined(__ARM_FEATURE_SVE) +#error compiling without SVE support +#endif]])],[AC_MSG_RESULT([yes]) + $1], + [AC_MSG_RESULT([no]) + $2]) +])dnl ACX_SVE