Debian Codegraph @

m4/keywords.m4

raw
1 dnl AC_C_BUILTIN_EXPECT
2 dnl Check whether compiler understands __builtin_expect.
3 AC_DEFUN([AC_C_BUILTIN_EXPECT],
4 [AC_CACHE_CHECK([for __builtin_expect],[ac_cv_builtin_expect],
5 [cat > conftest.c <<EOF
6 #line __oline__ "configure"
7 int foo (int a)
8 {
9 a = __builtin_expect (a, 10);
10 return a == 10 ? 0 : 1;
11 }
12 EOF
13 if AC_TRY_COMMAND([${CC-cc} $CFLAGS -nostdlib -nostartfiles
14 -o conftest conftest.c -lgcc >&AC_FD_CC]); then
15 ac_cv_builtin_expect=yes
16 else
17 ac_cv_builtin_expect=no
18 fi
19 rm -f conftest*])
20 if test x"$ac_cv_builtin_expect" = x"yes"; then
21 AC_DEFINE(HAVE_BUILTIN_EXPECT,,
22 [Define if you have the `__builtin_expect' function.])
23 fi])
24
25 dnl AC_C_ALWAYS_INLINE
26 dnl Define inline to something appropriate, including the new always_inline
27 dnl attribute from gcc 3.1
28 AC_DEFUN([AC_C_ALWAYS_INLINE],
29 [AC_C_INLINE
30 if test x"$GCC" = x"yes" -a x"$ac_cv_c_inline" = x"inline"; then
31 AC_MSG_CHECKING([for always_inline])
32 SAVE_CFLAGS="$CFLAGS"
33 CFLAGS="$CFLAGS -Wall -Werror"
34 AC_TRY_COMPILE([],
35 [__attribute__ ((__always_inline__)) void f (void);
36 #ifdef __cplusplus
37 42 = 42; // obviously illegal - we want c++ to fail here
38 #endif],
39 [ac_cv_always_inline=yes],[ac_cv_always_inline=no])
40 CFLAGS="$SAVE_CFLAGS"
41 AC_MSG_RESULT([$ac_cv_always_inline])
42 if test x"$ac_cv_always_inline" = x"yes"; then
43 AC_DEFINE_UNQUOTED([inline],[__attribute__ ((__always_inline__))])
44 fi
45 fi])
46
47 dnl AC_C_ATTRIBUTE_ALIGNED
48 dnl define ATTRIBUTE_ALIGNED_MAX to the maximum alignment if this is supported
49 AC_DEFUN([AC_C_ATTRIBUTE_ALIGNED],
50 [SAV_CFLAGS=$CFLAGS;
51 if test x"$GCC" = xyes; then CFLAGS="$CFLAGS -Werror"; fi
52 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
53 [ac_cv_c_attribute_aligned],
54 [ac_cv_c_attribute_aligned=0
55 for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
56 AC_TRY_COMPILE([],
57 [static struct s {
58 char a;
59 char b __attribute__ ((aligned($ac_cv_c_attr_align_try)));
60 } S = {0, 0};
61 switch (1) {
62 case 0:
63 case (long)(&((struct s *)0)->b) == $ac_cv_c_attr_align_try:
64 return 0;
65 }
66 return (long)&S;],
67 [ac_cv_c_attribute_aligned=$ac_cv_c_attr_align_try])
68 done])
69 if test x"$ac_cv_c_attribute_aligned" != x"0"; then
70 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
71 [$ac_cv_c_attribute_aligned],[maximum supported data alignment])
72 fi
73 CFLAGS=$SAV_CFLAGS])
74