diff options
Diffstat (limited to 'libraries/evas/m4/efl_attribute.m4')
-rw-r--r-- | libraries/evas/m4/efl_attribute.m4 | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/libraries/evas/m4/efl_attribute.m4 b/libraries/evas/m4/efl_attribute.m4 new file mode 100644 index 0000000..aeb6a68 --- /dev/null +++ b/libraries/evas/m4/efl_attribute.m4 | |||
@@ -0,0 +1,107 @@ | |||
1 | dnl Copyright (C) 2011 Vincent Torri <vtorri at univ-evry dot fr> | ||
2 | dnl That code is public domain and can be freely used or copied. | ||
3 | |||
4 | dnl Macros for checking if the compiler supports some __attribute__ uses | ||
5 | |||
6 | dnl Usage: EFL_ATTRIBUTE_UNUSED | ||
7 | dnl call AC_DEFINE for __UNUSED__ if __attribute__((unused)) is available | ||
8 | |||
9 | AC_DEFUN([EFL_ATTRIBUTE_UNUSED], | ||
10 | [ | ||
11 | AC_MSG_CHECKING([for __attribute__ ((unused))]) | ||
12 | AC_COMPILE_IFELSE( | ||
13 | [AC_LANG_PROGRAM( | ||
14 | [[ | ||
15 | void foo(int x __attribute__ ((unused))) {} | ||
16 | ]], | ||
17 | [[ | ||
18 | ]])], | ||
19 | [have_attribute_unused="yes"], | ||
20 | [have_attribute_unused="no"]) | ||
21 | AC_MSG_RESULT([${have_attribute_unused}]) | ||
22 | |||
23 | if test "x${have_attribute_unused}" = "xyes" ; then | ||
24 | AC_DEFINE([__UNUSED__], [__attribute__ ((unused))], [Macro declaring a function argument to be unused.]) | ||
25 | else | ||
26 | AC_DEFINE([__UNUSED__], [], [__attribute__ ((unused)) is not supported.]) | ||
27 | fi | ||
28 | ]) | ||
29 | |||
30 | dnl Usage: EFL_ATTRIBUTE_VECTOR | ||
31 | dnl call AC_DEFINE for HAVE_GCC_ATTRIBUTE_VECTOR if __attribute__((vector)) is available | ||
32 | |||
33 | AC_DEFUN([EFL_ATTRIBUTE_VECTOR], | ||
34 | [ | ||
35 | AC_MSG_CHECKING([for __attribute__ ((vector))]) | ||
36 | AC_COMPILE_IFELSE( | ||
37 | [AC_LANG_PROGRAM( | ||
38 | [[ | ||
39 | typedef int v4si __attribute__ ((vector_size (16))); | ||
40 | ]], | ||
41 | [[ | ||
42 | if (sizeof(v4si) == 16) | ||
43 | return 0; | ||
44 | else | ||
45 | return -1; | ||
46 | ]])], | ||
47 | [have_attribute_vector="yes"], | ||
48 | [have_attribute_vector="no"]) | ||
49 | AC_MSG_RESULT([${have_attribute_vector}]) | ||
50 | |||
51 | if test "x${have_attribute_vector}" = "xyes" ; then | ||
52 | AC_DEFINE([HAVE_GCC_ATTRIBUTE_VECTOR], [1], [Define to 1 if your compiler supports __attribute__ ((vector)).]) | ||
53 | fi | ||
54 | ]) | ||
55 | |||
56 | dnl Usage: EFL_ATTRIBUTE_ALWAYS_INLINE | ||
57 | dnl call AC_DEFINE for alway_inline if __attribute__((always_inline)) is available | ||
58 | |||
59 | AC_DEFUN([EFL_ATTRIBUTE_ALWAYS_INLINE], | ||
60 | [ | ||
61 | |||
62 | have_attribute_forceinline="no" | ||
63 | |||
64 | AC_MSG_CHECKING([for __forceinline]) | ||
65 | |||
66 | AC_COMPILE_IFELSE( | ||
67 | [AC_LANG_PROGRAM( | ||
68 | [[ | ||
69 | #include <windows.h> | ||
70 | __forceinline void foo(void) {} | ||
71 | ]], | ||
72 | [[ | ||
73 | ]])], | ||
74 | [ | ||
75 | have_attribute_always_inline="yes" | ||
76 | have_attribute_forceinline="yes" | ||
77 | ], | ||
78 | [have_attribute_always_inline="no"]) | ||
79 | |||
80 | AC_MSG_RESULT([${have_attribute_always_inline}]) | ||
81 | |||
82 | if test "x${have_attribute_always_inline}" = "xno" ; then | ||
83 | AC_MSG_CHECKING([for __attribute__ ((__always_inline__))]) | ||
84 | AC_COMPILE_IFELSE( | ||
85 | [AC_LANG_PROGRAM( | ||
86 | [[ | ||
87 | __attribute__((__always_inline__)) inline void foo(void) {} | ||
88 | ]], | ||
89 | [[ | ||
90 | ]])], | ||
91 | [have_attribute_always_inline="yes"], | ||
92 | [have_attribute_always_inline="no"]) | ||
93 | AC_MSG_RESULT([${have_attribute_always_inline}]) | ||
94 | fi | ||
95 | |||
96 | if test "x${have_attribute_always_inline}" = "xyes" ; then | ||
97 | if test "x${have_attribute_forceinline}" = "xyes" ; then | ||
98 | AC_DEFINE([EFL_ALWAYS_INLINE], [__forceinline], [Macro declaring a function to always be inlined.]) | ||
99 | else | ||
100 | AC_DEFINE([EFL_ALWAYS_INLINE], [__attribute__ ((__always_inline__)) inline], [Macro declaring a function to always be inlined.]) | ||
101 | fi | ||
102 | else | ||
103 | AC_DEFINE([EFL_ALWAYS_INLINE], [static inline], [Macro declaring a function to always be inlined.]) | ||
104 | fi | ||
105 | ]) | ||
106 | |||
107 | dnl End of efl_attribute.m4 | ||