ac_cpu_optimisations.m4 772 B

123456789101112131415161718192021222324252627282930
  1. dnl AC_CPU_OPTIMISATIONS
  2. dnl Tries to find compiler optimisation flags for the target system
  3. AC_DEFUN([AC_CPU_OPTIMISATIONS],[
  4. AC_REQUIRE([AC_CANONICAL_TARGET])
  5. AC_ARG_ENABLE(cpu-opt,AC_HELP_STRING([--disable-cpu-opt],[turns off cpu specific optimisations]),[
  6. ],[
  7. AC_MSG_CHECKING(whether compiler supports -march=native)
  8. OLD_CFLAGS="$CFLAGS"
  9. CFLAGS="$OLD_CFLAGS -march=native"
  10. AC_TRY_COMPILE(,[
  11. void f() {};
  12. ],[
  13. AC_MSG_RESULT(yes)
  14. ],[
  15. AC_MSG_RESULT(no)
  16. CFLAGS="$OLD_CFLAGS"
  17. case "$target" in
  18. # marginal gains from aligning code
  19. i386-*) ;;
  20. i486-*) CPU_CFLAGS="-mtune=i486" ;;
  21. # nothing special for pentium
  22. # CMOV op on ppro/II/686 can help us
  23. i686-*) CPU_CFLAGS="-march=i686" ;;
  24. esac
  25. AC_C_COMPILE_FLAGS($CPU_CFLAGS)
  26. ])
  27. ])
  28. ])