diff --git a/configure.ac b/configure.ac
index 65720e0f64..35f8981a7b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -758,6 +758,13 @@ Please report at ])
;;
esac
+ if test "$cflags_set" = "yes";
+ then
+ # We cannot be sure that AVX2 and AVX512 are enabled.
+ have_avx2="no"
+ have_avx512="no"
+ fi
+
if test "$have_avx512" = "yes";
then
have_avx2="yes"
@@ -803,6 +810,13 @@ Please report at ])
;;
esac
+ if test "$cflags_set" = "yes";
+ then
+ # We cannot be sure that AVX2 and AVX512 are enabled.
+ have_avx2="no"
+ have_avx512="no"
+ fi
+
if test "$have_avx512" = "yes";
then
have_avx2="yes"