summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac51
1 files changed, 51 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 6351dd708..7fbecbf8d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -524,6 +524,57 @@ CFLAGS=$ac_save_CFLAGS
LDFLAGS=$ac_save_LDFLAGS
ac_c_werror_flag=$cu_save_c_werror_flag
+AC_MSG_CHECKING([if __get_cpuid available])
+AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([[
+ #include <cpuid.h>
+
+ int main(void)
+ {
+ unsigned int eax, ebx, ecx, edx;
+ __get_cpuid(1, &eax, &ebx, &ecx, &edx);
+ return 1;
+ }
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_CPUID], [1], [__get_cpuid available])
+ cpuid_exists=yes
+ ],[
+ AC_MSG_RESULT([no])
+ ])
+
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-mavx -mpclmul $CFLAGS"
+AC_MSG_CHECKING([if pclmul intrinsic exists])
+AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([[
+ #include <x86intrin.h>
+
+ int main(void)
+ {
+ __m128i a, b;
+ a = _mm_clmulepi64_si128(a, b, 0x00);
+ return 1;
+ }
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_PCLMUL_INTRINSIC], [1], [pclmul intrinsic exists])
+ pclmul_intrinsic_exists=yes
+ ],[
+ AC_MSG_RESULT([no])
+ ])
+if test "x$cpuid_exists" = "xyes" &&
+ test "x$pclmul_intrinsic_exists" = "xyes"; then
+ AC_DEFINE([USE_PCLMUL_CRC32], [1],
+ [CRC32 calculation by pclmul hardware instruction enabled])
+fi
+AM_CONDITIONAL([USE_PCLMUL_CRC32],
+ [test "x$cpuid_exists" = "xyes" &&
+ test "x$pclmul_intrinsic_exists" = "xyes"])
+CFLAGS=$ac_save_CFLAGS
+
############################################################################
dnl Autogenerated by the 'gen-lists-of-programs.sh' auxiliary script.