1 # AC_CHECK_FASTCALL([if-ok],[if-notok])
2 # Test if the compiler recognizes __attribute__((regparm(3))) - we don't
3 # currently check if it actually works correctly, but probably should...
4 # -----------------------
5 AC_DEFUN([AC_CHECK_FASTCALL], [
6 AC_MSG_CHECKING([support for fastcall calling conventions]);
9 int __attribute__((regparm(3))) foo(int a, int b) { return a+b; }
11 int main(int argc, char *argv[])
13 return foo( 1, 2 ) == 3 ? 0 : 1;
23 # AC_CHECK_FORCEINLINE([if-ok],[if-notok])
24 # Test if the compiler recognizes __attribute__((always_inline))
25 # -----------------------
26 AC_DEFUN([AC_CHECK_FORCEINLINE], [
27 AC_MSG_CHECKING([support for force inlining]);
30 static int __attribute__((always_inline)) foo(int a, int b) { return a+b; }
32 int main(int argc, char *argv[])
34 return foo( 1, 2 ) == 3 ? 0 : 1;
36 FORCEINLINE="__attribute__((always_inline))"
37 AC_MSG_RESULT([$FORCEINLINE])
44 # AC_CHECK_FRAME_ADDRESS([if-ok],[if-notok])
45 # Test if the compiler will let us modify the return address on the stack
46 # via __builtin_frame_address()
47 # -----------------------
48 AC_DEFUN([AC_CHECK_FRAME_ADDRESS], [
49 AC_MSG_CHECKING([if we have a working __builtin_frame_address()]);
52 void * __attribute__((noinline)) first_arg( void *x, void *y ) { return x; }
53 int __attribute__((noinline)) foo( int arg, void *exc )
56 *(((void * volatile *)__builtin_frame_address(0))+1) = exc;
61 int main(int argc, char *argv[])
63 goto *first_arg(&&start, &&except);
66 return foo( argc, &&except ) + 1;
79 # AC_CC_VERSION([if-gcc], [if-icc],[if-other])
80 # Check which C compiler we're using and branch accordingly, eg to set
81 # different optimization flags. Currently recognizes gcc and icc
83 AC_DEFUN([AC_CC_VERSION], [
84 _GCC_VERSION=`$CC --version | $SED -ne '/gcc/p'`
85 _ICC_VERSION=`$CC --version | $SED -ne '/(ICC)/p'`
86 AC_MSG_CHECKING([CC version])
87 if test -n "$_ICC_VERSION"; then
90 elif test -n "$_GCC_VERSION"; then
94 AC_MSG_RESULT([Unknown])
99 # AC_OBJC_VERSION([if-gcc],[if-other], [if-none])
100 # Check which objective C compiler we're using and branch accordingly.
101 AC_DEFUN([AC_OBJC_VERSION], [
102 AC_MSG_CHECKING([OBJC version])
103 if test -n "$OBJC"; then
104 _GOBJC_VERSION=`$OBJC --version | $SED -ne '/(GCC)/p'`
105 if test -n "$_GOBJC_VERSION"; then
109 AC_MSG_RESULT([Unknown])
113 AC_MSG_RESULT([None])
118 # Check if the given C compiler flag is supported, and if so add it to CFLAGS
119 AC_DEFUN([AC_CHECK_CFLAG], [
121 AC_MSG_CHECKING([if $CC supports $1])
122 save_CFLAGS="$CFLAGS"
125 AC_LANG_SOURCE([int main() { return 0; }])], [
128 CFLAGS="$save_CFLAGS"
134 # Check if the given OBJC compiler flag is supported, and if so add it to OBJCFLAGS
135 AC_DEFUN([AC_CHECK_OBJCFLAG], [
136 AC_LANG_PUSH([Objective C])
137 AC_MSG_CHECKING([if $OBJC supports $1])
138 save_OBJCFLAGS="$OBJCFLAGS"
139 OBJCFLAGS="$1 $OBJCFLAGS"
141 AC_LANG_SOURCE([int main() { return 0; }])], [
144 OBJCFLAGS="$save_OBJCFLAGS"
147 AC_LANG_POP([Objective C])
152 # AC_HAVE_OBJC([if-present],[if-not-present])
153 # Check if we have a working Objective-C compiler
154 AC_DEFUN([AC_HAVE_OBJC], [
156 AC_MSG_CHECKING([for a working Objective-C compiler])
157 AC_LANG_PUSH([Objective C])dnl
158 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@interface Foo @end]], [])],
159 [AC_MSG_RESULT([yes])
163 AC_LANG_POP([Objective C])
.