CHECK_INCLUDE_FILES(aio.h HAVE_AIO_H)
CHECK_INCLUDE_FILES(libaio.h HAVE_LIBAIO_H)
CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
+CHECK_INCLUDE_FILES(cpuid.h HAVE_CPUID_H)
# Some dependencies
IF(HAVE_SYS_WAIT_H)
CHECK_SYMBOL_EXISTS(setbit sys/param.h PARAM_H_HAS_BITSET)
CHECK_SYMBOL_EXISTS(getaddrinfo "sys/types.h;sys/socket.h;netdb.h" HAVE_GETADDRINFO)
CHECK_SYMBOL_EXISTS(sched_yield "sched.h" HAVE_SCHED_YIELD)
+CHECK_SYMBOL_EXISTS(__get_cpuid "cpuid.h" HAVE_GET_CPUID)
CHECK_SYMBOL_EXISTS(PCRE_CONFIG_JIT "pcre.h" HAVE_PCRE_JIT)
FILE(WRITE ${CMAKE_BINARY_DIR}/pthread_setpshared.c "
#cmakedefine HAVE_EXPLICIT_BZERO 1
#cmakedefine HAVE_WEAK_SYMBOLS 1
#cmakedefine HAVE_PCRE_JIT 1
+#cmakedefine HAVE_GET_CPUID 1
+#cmakedefine HAVE_CPUID_H 1
/* Configure allocator */
#define uthash_malloc(sz) g_slice_alloc(sz)
#include "poly1305/poly1305.h"
#include "curve25519/curve25519.h"
#include "ottery.h"
+#ifdef HAVE_CPUID_H
+#include <cpuid.h>
+#endif
unsigned long cpu_config = 0;
rspamd_cryptobox_cpuid (gint cpu[4], gint info)
{
#if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
+# if defined(HAVE_GET_CPUID)
+ __get_cpuid (info, &cpu[0], &cpu[1], &cpu[2], &cpu[3]);
+# else
__asm__ __volatile__ (
"cpuid":
"=a" (cpu[0]),
"=d" (cpu[3]) :
"a" (info), "c" (0)
);
+# endif
#else
memset (cpu, 0, sizeof (cpu));
#endif