as-gcc-inline-assembly.m4 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. dnl as-gcc-inline-assembly.m4 0.1.0
  2. dnl autostars m4 macro for detection of gcc inline assembly
  3. dnl David Schleef <ds@schleef.org>
  4. dnl $Id$
  5. dnl AS_COMPILER_FLAG(ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
  6. dnl Tries to compile with the given CFLAGS.
  7. dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags,
  8. dnl and ACTION-IF-NOT-ACCEPTED otherwise.
  9. AC_DEFUN([AS_GCC_INLINE_ASSEMBLY],
  10. [
  11. AC_MSG_CHECKING([if compiler supports gcc-style inline assembly])
  12. AC_TRY_COMPILE([], [
  13. #ifdef __GNUC_MINOR__
  14. #if (__GNUC__ * 1000 + __GNUC_MINOR__) < 3004
  15. #error GCC before 3.4 has critical bugs compiling inline assembly
  16. #endif
  17. #endif
  18. __asm__ (""::) ], [flag_ok=yes], [flag_ok=no])
  19. if test "X$flag_ok" = Xyes ; then
  20. $1
  21. true
  22. else
  23. $2
  24. true
  25. fi
  26. AC_MSG_RESULT([$flag_ok])
  27. ])
  28. AC_DEFUN([AC_TRY_ASSEMBLE],
  29. [ac_c_ext=$ac_ext
  30. ac_ext=${ac_s_ext-s}
  31. cat > conftest.$ac_ext <<EOF
  32. .file "configure"
  33. [$1]
  34. EOF
  35. if AC_TRY_EVAL(ac_compile); then
  36. ac_ext=$ac_c_ext
  37. ifelse([$2], , :, [ $2
  38. rm -rf conftest*])
  39. else
  40. echo "configure: failed program was:" >&AC_FD_CC
  41. cat conftest.$ac_ext >&AC_FD_CC
  42. ac_ext=$ac_c_ext
  43. ifelse([$3], , , [ rm -rf conftest*
  44. $3
  45. ])dnl
  46. fi
  47. rm -rf conftest*])
  48. AC_DEFUN([AS_ASM_ARM_NEON],
  49. [
  50. AC_MSG_CHECKING([if assembler supports NEON instructions on ARM])
  51. AC_TRY_ASSEMBLE([vorr d0,d0,d0], [flag_ok=yes], [flag_ok=no])
  52. if test "X$flag_ok" = Xyes ; then
  53. $1
  54. true
  55. else
  56. $2
  57. true
  58. fi
  59. AC_MSG_RESULT([$flag_ok])
  60. ])
  61. AC_DEFUN([AS_ASM_ARM_MEDIA],
  62. [
  63. AC_MSG_CHECKING([if assembler supports ARMv6 media instructions on ARM])
  64. AC_TRY_ASSEMBLE([shadd8 r3,r3,r3], [flag_ok=yes], [flag_ok=no])
  65. if test "X$flag_ok" = Xyes ; then
  66. $1
  67. true
  68. else
  69. $2
  70. true
  71. fi
  72. AC_MSG_RESULT([$flag_ok])
  73. ])
  74. AC_DEFUN([AS_ASM_ARM_EDSP],
  75. [
  76. AC_MSG_CHECKING([if assembler supports EDSP instructions on ARM])
  77. AC_TRY_ASSEMBLE([qadd r3,r3,r3], [flag_ok=yes], [flag_ok=no])
  78. if test "X$flag_ok" = Xyes ; then
  79. $1
  80. true
  81. else
  82. $2
  83. true
  84. fi
  85. AC_MSG_RESULT([$flag_ok])
  86. ])