1dnl as-gcc-inline-assembly.m4 0.1.0 2 3dnl autostars m4 macro for detection of gcc inline assembly 4 5dnl David Schleef <ds@schleef.org> 6 7dnl AS_COMPILER_FLAG(ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) 8dnl Tries to compile with the given CFLAGS. 9dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags, 10dnl and ACTION-IF-NOT-ACCEPTED otherwise. 11 12AC_DEFUN([AS_GCC_INLINE_ASSEMBLY], 13[ 14 AC_MSG_CHECKING([if compiler supports gcc-style inline assembly]) 15 16 AC_TRY_COMPILE([], [ 17#ifdef __GNUC_MINOR__ 18#if (__GNUC__ * 1000 + __GNUC_MINOR__) < 3004 19#error GCC before 3.4 has critical bugs compiling inline assembly 20#endif 21#endif 22__asm__ (""::) ], [flag_ok=yes], [flag_ok=no]) 23 24 if test "X$flag_ok" = Xyes ; then 25 $1 26 true 27 else 28 $2 29 true 30 fi 31 AC_MSG_RESULT([$flag_ok]) 32]) 33 34AC_DEFUN([AS_ASM_ARM_NEON], 35[ 36 AC_MSG_CHECKING([if assembler supports NEON instructions on ARM]) 37 38 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[__asm__("vorr d0,d0,d0")])], 39 [AC_MSG_RESULT([yes]) 40 $1], 41 [AC_MSG_RESULT([no]) 42 $2]) 43]) 44 45 46AC_DEFUN([AS_ASM_ARM_MEDIA], 47[ 48 AC_MSG_CHECKING([if assembler supports ARMv6 media instructions on ARM]) 49 50 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[__asm__("shadd8 r3,r3,r3")])], 51 [AC_MSG_RESULT([yes]) 52 $1], 53 [AC_MSG_RESULT([no]) 54 $2]) 55]) 56 57 58AC_DEFUN([AS_ASM_ARM_EDSP], 59[ 60 AC_MSG_CHECKING([if assembler supports EDSP instructions on ARM]) 61 62 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[__asm__("qadd r3,r3,r3")])], 63 [AC_MSG_RESULT([yes]) 64 $1], 65 [AC_MSG_RESULT([no]) 66 $2]) 67]) 68