ac_gcc_x86_cpuid.m4 691 B

123456789101112131415161718192021
  1. AC_DEFUN([AX_GCC_X86_CPUID],
  2. [AC_REQUIRE([AC_PROG_CC])
  3. AC_LANG_PUSH([C])
  4. AC_CACHE_CHECK(for x86 cpuid $1 output, ax_cv_gcc_x86_cpuid_$1,
  5. [AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>], [
  6. int op = $1, eax, ebx, ecx, edx;
  7. FILE *f;
  8. __asm__("cpuid"
  9. : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
  10. : "a" (op));
  11. f = fopen("conftest_cpuid", "w"); if (!f) return 1;
  12. fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx);
  13. fclose(f);
  14. return 0;
  15. ])],
  16. [ax_cv_gcc_x86_cpuid_$1=`cat conftest_cpuid`; rm -f conftest_cpuid],
  17. [ax_cv_gcc_x86_cpuid_$1=unknown; rm -f conftest_cpuid],
  18. [ax_cv_gcc_x86_cpuid_$1=unknown])])
  19. AC_LANG_POP([C])
  20. ])