Update tizen 2.0 beta source
[profile/ivi/liboil.git] / m4 / as-gcc-inline-assembly.m4
1 dnl as-gcc-inline-assembly.m4 0.1.0
2
3 dnl autostars m4 macro for detection of gcc inline assembly
4
5 dnl David Schleef <ds@schleef.org>
6
7 dnl $Id: as-gcc-inline-assembly.m4,v 1.5 2007-11-14 06:48:57 ds Exp $
8
9 dnl AS_COMPILER_FLAG(ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
10 dnl Tries to compile with the given CFLAGS.
11 dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags,
12 dnl and ACTION-IF-NOT-ACCEPTED otherwise.
13
14 AC_DEFUN([AS_GCC_INLINE_ASSEMBLY],
15 [
16   AC_MSG_CHECKING([if compiler supports gcc-style inline assembly])
17
18   AC_TRY_COMPILE([], [
19 #ifndef __GNUC__
20 #error Not GCC
21 #endif
22 #ifdef __GNUC_MINOR__
23 #if (__GNUC__ * 1000 + __GNUC_MINOR__) < 3004
24 #error GCC before 3.4 has critical bugs compiling inline assembly
25 #endif
26 #endif
27 __asm__ (""::) ], [flag_ok=yes], [flag_ok=no])
28
29   if test "X$flag_ok" = Xyes ; then
30     $1
31     true
32   else
33     $2
34     true
35   fi
36   AC_MSG_RESULT([$flag_ok])
37 ])
38
39
40 AC_DEFUN([AS_GCC_ASM_POWERPC_FPU],
41 [
42   AC_MSG_CHECKING([if compiler supports FPU instructions on PowerPC])
43
44   AC_TRY_COMPILE([], [double x = 0; __asm__ ("fadd 0,0,0"::"f" (x):"32") ], [flag_ok=yes], [flag_ok=no])
45
46   if test "X$flag_ok" = Xyes ; then
47     $1
48     true
49   else
50     $2
51     true
52   fi
53   AC_MSG_RESULT([$flag_ok])
54 ])
55
56 AC_DEFUN([AS_GCC_INLINE_ASM_INSTRUCTION],
57 [
58   AC_MSG_CHECKING([if compiler supports '$1' asm instruction])
59
60   AC_TRY_COMPILE([], [
61 #ifndef __GNUC__
62 #error Not GCC
63 #endif
64 #ifdef __GNUC_MINOR__
65 #if (__GNUC__ * 1000 + __GNUC_MINOR__) < 3004
66 #error GCC before 3.4 has critical bugs compiling inline assembly
67 #endif
68 #endif
69 __asm__ ("$1"::) ], [flag_ok=yes], [flag_ok=no])
70
71   if test "X$flag_ok" = Xyes ; then
72     $2
73     true
74   else
75     $3
76     true
77   fi
78   AC_MSG_RESULT([$flag_ok])
79 ])
80