From b64c0510b32bb6a03c1b43d8a4718067f08e70aa Mon Sep 17 00:00:00 2001 From: Maryam Tahhan Date: Tue, 7 Jun 2016 12:31:44 +0100 Subject: [PATCH] configure: check AVX support Check AVX support before adding -mavx flag. Change-Id: I2de2a12704126590ef991de89880ad5bd5c3805e Signed-off-by: Maryam Tahhan --- configure.ac | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 09882996..5b7a9505 100644 --- a/configure.ac +++ b/configure.ac @@ -2457,7 +2457,25 @@ then then AC_MSG_ERROR([cannot link with dpdk in $DPDK_LIB_DIR]) fi - BUILD_WITH_DPDK_CFLAGS="-mavx -fPIC -I$DPDK_INCLUDE" + BUILD_WITH_DPDK_CFLAGS="" + AC_MSG_NOTICE([Checking for avx instructions]) + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( +[[ +#include +]], +[[ +__m128i zero = _mm_setzero_si128(); +]] + )], + [HAVE_AVX=true], [HAVE_AVX=false]) + if test "x$HAVE_AVX" = "xtrue" + then + BUILD_WITH_DPDK_CFLAGS="-mavx " + AC_MSG_NOTICE([avx instructions supported]) + fi + + BUILD_WITH_DPDK_CFLAGS+="-fPIC -I$DPDK_INCLUDE" if test "x$LOCAL_DPDK_INSTALL" != "xtrue" then BUILD_WITH_DPDK_LDFLAGS="-Wl,--no-as-needed" -- 2.11.0