diff --git a/configure.ac b/configure.ac index 1209fb6..4ed7f83 100644 --- a/configure.ac +++ b/configure.ac @@ -43,6 +43,8 @@ LT_INIT AM_CPPFLAGS="$CPPFLAGS" AC_CHECK_HEADERS([stdint.h]) +AC_CHECK_FUNCS([popcount64]) + AC_CHECK_PROGS([DOXYGEN], [doxygen]) AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"]) diff --git a/libcpuid/libcpuid_util.c b/libcpuid/libcpuid_util.c index f7a0868..9bed613 100644 --- a/libcpuid/libcpuid_util.c +++ b/libcpuid/libcpuid_util.c @@ -29,6 +29,9 @@ #include #include #include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "libcpuid.h" #include "libcpuid_util.h" @@ -74,9 +77,10 @@ void debugf(int verboselevel, const char* format, ...) _warn_fun(buff); } -static int popcount64(uint64_t mask) +#ifndef HAVE_POPCOUNT64 +static unsigned int popcount64(uint64_t mask) { - int num_set_bits = 0; + unsigned int num_set_bits = 0; while (mask) { mask &= mask - 1; @@ -85,6 +89,7 @@ static int popcount64(uint64_t mask) return num_set_bits; } +#endif static int score(const struct match_entry_t* entry, const struct cpu_id_t* data, int brand_code, uint64_t bits, int model_code)