configure.ac: add SIMD detection capabilities
This change adds a check whether compiler supports some SIMD
(Single Instruction, Multiple Data) instructions. It is enabled
by default, and can be disabled by configure option --disable-simd.
The check macro is based on the AX_EXT from autoconf-archive:
www.gnu.org/software/autoconf-archive/ax_ext.html
And depends on the ax_check_compile_flag macro:
www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
Currently only the following SIMD extensions are being checked:
AVX2, SSE3, SSE4.1, but adding others is also possible. All found
extensions are being defined in the 'config.h' header.
Change-Id: Idf8fff984bd936a75c7c307338df88ba4b005817
diff --git a/configure.ac b/configure.ac
index a18197d..672a6df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -226,6 +226,22 @@
CPPFLAGS+=" -fsanitize=address -fsanitize=undefined"
fi
+AC_ARG_ENABLE(simd,
+ [AS_HELP_STRING(
+ [--disable-simd],
+ [Disable SIMD support]
+ )],
+ [simd=$enableval], [simd="yes"])
+if test x"$simd" = x"yes"
+then
+ # Find and define supported SIMD extensions
+ AX_CHECK_SIMD
+else
+ AM_CONDITIONAL(HAVE_AVX2, false)
+ AM_CONDITIONAL(HAVE_SSE3, false)
+ AM_CONDITIONAL(HAVE_SSE4_1, false)
+fi
+
AC_OUTPUT(
libosmocore.pc
libosmocodec.pc