Files
asterisk/autoconf/ast_gcc_attribute.m4
Kevin P. Fleming 21da1c5fde Merged revisions 201090 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
  r201090 | kpfleming | 2009-06-16 14:27:12 -0500 (Tue, 16 Jun 2009) | 5 lines
  
  Another minor fix to compiler attribute checking.
  
  Defaulting to 'static' for the function scope was bad... so remove it.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@201091 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-16 19:28:00 +00:00

32 lines
886 B
Plaintext

# Helper function to check for gcc attributes.
# AST_GCC_ATTRIBUTE([attribute name], [attribute syntax], [attribute scope])
AC_DEFUN([AST_GCC_ATTRIBUTE],
[
AC_MSG_CHECKING(for compiler 'attribute $1' support)
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
if test "x$2" = "x"
then
AC_COMPILE_IFELSE(
AC_LANG_PROGRAM([$3 void __attribute__(($1)) *test(void *muffin, ...) {return (void *) 0;}],
[]),
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)
)
else
AC_COMPILE_IFELSE(
AC_LANG_PROGRAM([$3 void __attribute__(($2)) *test(void *muffin, ...) {return (void *) 0;}],
[]),
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
CFLAGS="$saved_CFLAGS"
]
)