2008-10-20 04:59:04 +00:00
|
|
|
# Helper function to check for gcc attributes.
|
2009-06-16 16:32:36 +00:00
|
|
|
# AST_GCC_ATTRIBUTE([attribute name], [attribute syntax], [attribute scope])
|
2008-10-20 04:59:04 +00:00
|
|
|
|
|
|
|
AC_DEFUN([AST_GCC_ATTRIBUTE],
|
|
|
|
[
|
|
|
|
AC_MSG_CHECKING(for compiler 'attribute $1' support)
|
|
|
|
saved_CFLAGS="$CFLAGS"
|
2009-06-16 01:28:08 +00:00
|
|
|
CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
|
2008-11-26 21:20:50 +00:00
|
|
|
|
2009-06-16 16:32:36 +00:00
|
|
|
if test "x$3" = "x"
|
|
|
|
then
|
|
|
|
attribute_scope="static"
|
|
|
|
else
|
|
|
|
attribute_scope="$3"
|
|
|
|
fi
|
|
|
|
|
2008-11-26 21:20:50 +00:00
|
|
|
if test "x$2" = "x"
|
|
|
|
then
|
2008-10-20 04:59:04 +00:00
|
|
|
AC_COMPILE_IFELSE(
|
2009-06-16 16:32:36 +00:00
|
|
|
AC_LANG_PROGRAM([$attribute_scope void __attribute__(($1)) *test(void *muffin, ...) {return (void *) 0;}],
|
2008-10-20 04:59:04 +00:00
|
|
|
[]),
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),
|
2008-11-26 21:20:50 +00:00
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
)
|
|
|
|
else
|
|
|
|
AC_COMPILE_IFELSE(
|
2009-06-16 16:32:36 +00:00
|
|
|
AC_LANG_PROGRAM([$attribute_scope void __attribute__(($2)) *test(void *muffin, ...) {return (void *) 0;}],
|
2008-11-26 21:20:50 +00:00
|
|
|
[]),
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
|
2008-10-20 04:59:04 +00:00
|
|
|
CFLAGS="$saved_CFLAGS"
|
2008-11-26 21:20:50 +00:00
|
|
|
]
|
2008-10-20 04:59:04 +00:00
|
|
|
)
|