aboutsummaryrefslogtreecommitdiffstats
path: root/autoconf
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-06-16 01:33:30 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-06-16 01:33:30 +0000
commit7b905ba00038bd8c5483e7c0d691dea71ebb76ed (patch)
tree8640b1f87f42a0edb076b92a46ce649c88b3c4c0 /autoconf
parent1c05391846dfea23af207f3a183fbbdb74f05f4b (diff)
Merged revisions 200764 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r200764 | kpfleming | 2009-06-15 20:28:08 -0500 (Mon, 15 Jun 2009) | 11 lines Ensure that configure-script testing for compiler attributes actually works. The configure script tests for compiler attributes didn't actually enable enough warnings or provide a proper test harness to determine whether the compiler supports the attribute in question or not; this caused gcc 4.1 to report that it supports 'weakref', but it doesn't actually support it in the way that is needed for our optional API mechanism. The new configure script test will properly distinguish between full support and partial support for this attribute, among others. ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@200767 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'autoconf')
-rw-r--r--autoconf/ast_gcc_attribute.m424
1 files changed, 19 insertions, 5 deletions
diff --git a/autoconf/ast_gcc_attribute.m4 b/autoconf/ast_gcc_attribute.m4
index 167bb4e79..806b39019 100644
--- a/autoconf/ast_gcc_attribute.m4
+++ b/autoconf/ast_gcc_attribute.m4
@@ -1,17 +1,31 @@
# Helper function to check for gcc attributes.
-# AST_GCC_ATTRIBUTE([attribute name])
+# AST_GCC_ATTRIBUTE([attribute name], [attribute syntax])
AC_DEFUN([AST_GCC_ATTRIBUTE],
[
AC_MSG_CHECKING(for compiler 'attribute $1' support)
saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Werror"
+CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
+
+if test "x$2" = "x"
+then
AC_COMPILE_IFELSE(
- AC_LANG_PROGRAM([void __attribute__(($1)) *test(void *muffin, ...) {}],
+ AC_LANG_PROGRAM([static 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))
-]
+ AC_MSG_RESULT(no)
+)
+else
+AC_COMPILE_IFELSE(
+ AC_LANG_PROGRAM([static 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"
+]
)