From: Nikos Mavrogiannopoulos Date: Sun, 29 May 2011 10:01:16 +0000 (+0200) Subject: Use cpuid.h if it exists, to use the x86 CPUID instruction. X-Git-Tag: gnutls_2_99_3~85 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=23df2cf3d4e719b51d6be784b0249b68139d1668;p=thirdparty%2Fgnutls.git Use cpuid.h if it exists, to use the x86 CPUID instruction. --- diff --git a/configure.ac b/configure.ac index 95eb972d0a..00f4a7ed57 100644 --- a/configure.ac +++ b/configure.ac @@ -81,6 +81,7 @@ case $host_cpu in i?86 | x86_64 | amd64) dnl GCC_FLAG_ADD([-maes -mpclmul],[X86]) dnl if test "x$X86" = "xyes";then + AC_CHECK_HEADERS(cpuid.h) if test "$host_cpu" = "x86_64" -o "$host_cpu" = "amd64";then hw_accel="x86-64" else diff --git a/lib/accelerated/x86.h b/lib/accelerated/x86.h index c344283e36..8886516f4e 100644 --- a/lib/accelerated/x86.h +++ b/lib/accelerated/x86.h @@ -1,3 +1,12 @@ +#include + +#ifdef HAVE_CPUID_H +# include +# define cpuid __cpuid + +#else #define cpuid(func,ax,bx,cx,dx)\ __asm__ __volatile__ ("cpuid":\ "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (func)); + +#endif