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 $Id$
8
9dnl AS_COMPILER_FLAG(ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
10dnl Tries to compile with the given CFLAGS.
11dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags,
12dnl and ACTION-IF-NOT-ACCEPTED otherwise.
13
14AC_DEFUN([AS_GCC_INLINE_ASSEMBLY],
15[
16  AC_MSG_CHECKING([if compiler supports gcc-style inline assembly])
17
18  AC_TRY_COMPILE([], [
19#ifdef __GNUC_MINOR__
20#if (__GNUC__ * 1000 + __GNUC_MINOR__) < 3004
21#error GCC before 3.4 has critical bugs compiling inline assembly
22#endif
23#endif
24__asm__ (""::) ], [flag_ok=yes], [flag_ok=no])
25
26  if test "X$flag_ok" = Xyes ; then
27    $1
28    true
29  else
30    $2
31    true
32  fi
33  AC_MSG_RESULT([$flag_ok])
34])
35
36
37AC_DEFUN([AS_GCC_ASM_POWERPC_FPU],
38[
39  AC_MSG_CHECKING([if compiler supports FPU instructions on PowerPC])
40
41  AC_TRY_COMPILE([], [__asm__ ("fadd 0,0,0"::) ], [flag_ok=yes], [flag_ok=no])
42
43  if test "X$flag_ok" = Xyes ; then
44    $1
45    true
46  else
47    $2
48    true
49  fi
50  AC_MSG_RESULT([$flag_ok])
51])
52
53