aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-06-16 16:32:36 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-06-16 16:32:36 +0000
commitd2292f0eca49f9ec9297bab8aa9c551557213662 (patch)
tree0a9e072b735507f3f3e340e4c16046aa4140ea9e
parent39c737328cd621c6e3a502dbf24e810c6d38b77d (diff)
Fix problems with new compiler attribute checking in configure script.
The last changes to ast_gcc_attribute.m4 caused some problems checking for various attributes, because the scope of the symbol the attribute is applied to can be important; this patch allows the scope to be specified for the check. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@200985 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--autoconf/ast_gcc_attribute.m413
-rwxr-xr-xconfigure110
-rw-r--r--configure.ac2
3 files changed, 101 insertions, 24 deletions
diff --git a/autoconf/ast_gcc_attribute.m4 b/autoconf/ast_gcc_attribute.m4
index 806b39019..f08b2545b 100644
--- a/autoconf/ast_gcc_attribute.m4
+++ b/autoconf/ast_gcc_attribute.m4
@@ -1,5 +1,5 @@
# Helper function to check for gcc attributes.
-# AST_GCC_ATTRIBUTE([attribute name], [attribute syntax])
+# AST_GCC_ATTRIBUTE([attribute name], [attribute syntax], [attribute scope])
AC_DEFUN([AST_GCC_ATTRIBUTE],
[
@@ -7,10 +7,17 @@ AC_MSG_CHECKING(for compiler 'attribute $1' support)
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
+if test "x$3" = "x"
+then
+attribute_scope="static"
+else
+attribute_scope="$3"
+fi
+
if test "x$2" = "x"
then
AC_COMPILE_IFELSE(
- AC_LANG_PROGRAM([static void __attribute__(($1)) *test(void *muffin, ...) {return (void *) 0;}],
+ AC_LANG_PROGRAM([$attribute_scope 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.]),
@@ -18,7 +25,7 @@ AC_COMPILE_IFELSE(
)
else
AC_COMPILE_IFELSE(
- AC_LANG_PROGRAM([static void __attribute__(($2)) *test(void *muffin, ...) {return (void *) 0;}],
+ AC_LANG_PROGRAM([$attribute_scope 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.]),
diff --git a/configure b/configure
index 97015d342..1e2a6986e 100755
--- a/configure
+++ b/configure
@@ -18019,13 +18019,20 @@ CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
if test "x" = "x"
then
+attribute_scope="static"
+else
+attribute_scope=""
+fi
+
+if test "x" = "x"
+then
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-static void __attribute__((pure)) *test(void *muffin, ...) {return (void *) 0;}
+$attribute_scope void __attribute__((pure)) *test(void *muffin, ...) {return (void *) 0;}
int
main ()
{
@@ -18076,7 +18083,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
+$attribute_scope void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
int
main ()
{
@@ -18133,13 +18140,20 @@ CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
if test "x" = "x"
then
+attribute_scope="static"
+else
+attribute_scope=""
+fi
+
+if test "x" = "x"
+then
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-static void __attribute__((malloc)) *test(void *muffin, ...) {return (void *) 0;}
+$attribute_scope void __attribute__((malloc)) *test(void *muffin, ...) {return (void *) 0;}
int
main ()
{
@@ -18190,7 +18204,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
+$attribute_scope void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
int
main ()
{
@@ -18247,13 +18261,20 @@ CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
if test "x" = "x"
then
+attribute_scope="static"
+else
+attribute_scope=""
+fi
+
+if test "x" = "x"
+then
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-static void __attribute__((const)) *test(void *muffin, ...) {return (void *) 0;}
+$attribute_scope void __attribute__((const)) *test(void *muffin, ...) {return (void *) 0;}
int
main ()
{
@@ -18304,7 +18325,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
+$attribute_scope void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
int
main ()
{
@@ -18361,13 +18382,20 @@ CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
if test "x" = "x"
then
+attribute_scope="static"
+else
+attribute_scope=""
+fi
+
+if test "x" = "x"
+then
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-static void __attribute__((unused)) *test(void *muffin, ...) {return (void *) 0;}
+$attribute_scope void __attribute__((unused)) *test(void *muffin, ...) {return (void *) 0;}
int
main ()
{
@@ -18418,7 +18446,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
+$attribute_scope void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
int
main ()
{
@@ -18475,13 +18503,20 @@ CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
if test "x" = "x"
then
+attribute_scope="static"
+else
+attribute_scope=""
+fi
+
+if test "x" = "x"
+then
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-static void __attribute__((always_inline)) *test(void *muffin, ...) {return (void *) 0;}
+$attribute_scope void __attribute__((always_inline)) *test(void *muffin, ...) {return (void *) 0;}
int
main ()
{
@@ -18532,7 +18567,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
+$attribute_scope void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
int
main ()
{
@@ -18589,13 +18624,20 @@ CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
if test "x" = "x"
then
+attribute_scope="static"
+else
+attribute_scope=""
+fi
+
+if test "x" = "x"
+then
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-static void __attribute__((deprecated)) *test(void *muffin, ...) {return (void *) 0;}
+$attribute_scope void __attribute__((deprecated)) *test(void *muffin, ...) {return (void *) 0;}
int
main ()
{
@@ -18646,7 +18688,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
+$attribute_scope void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
int
main ()
{
@@ -18703,13 +18745,20 @@ CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
if test "x" = "x"
then
+attribute_scope="static"
+else
+attribute_scope=""
+fi
+
+if test "x" = "x"
+then
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-static void __attribute__((sentinel)) *test(void *muffin, ...) {return (void *) 0;}
+$attribute_scope void __attribute__((sentinel)) *test(void *muffin, ...) {return (void *) 0;}
int
main ()
{
@@ -18760,7 +18809,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
+$attribute_scope void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
int
main ()
{
@@ -18817,13 +18866,20 @@ CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
if test "x" = "x"
then
+attribute_scope="static"
+else
+attribute_scope=""
+fi
+
+if test "x" = "x"
+then
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-static void __attribute__((warn_unused_result)) *test(void *muffin, ...) {return (void *) 0;}
+$attribute_scope void __attribute__((warn_unused_result)) *test(void *muffin, ...) {return (void *) 0;}
int
main ()
{
@@ -18874,7 +18930,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
+$attribute_scope void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
int
main ()
{
@@ -18929,6 +18985,13 @@ $as_echo_n "checking for compiler 'attribute weakref' support... " >&6; }
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
+if test "x" = "x"
+then
+attribute_scope="static"
+else
+attribute_scope=""
+fi
+
if test "xweakref("foo")" = "x"
then
cat >conftest.$ac_ext <<_ACEOF
@@ -18937,7 +19000,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-static void __attribute__((weakref)) *test(void *muffin, ...) {return (void *) 0;}
+$attribute_scope void __attribute__((weakref)) *test(void *muffin, ...) {return (void *) 0;}
int
main ()
{
@@ -18988,7 +19051,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-static void __attribute__((weakref("foo"))) *test(void *muffin, ...) {return (void *) 0;}
+$attribute_scope void __attribute__((weakref("foo"))) *test(void *muffin, ...) {return (void *) 0;}
int
main ()
{
@@ -19043,6 +19106,13 @@ $as_echo_n "checking for compiler 'attribute weak_import' support... " >&6; }
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
+if test "x""" = "x"
+then
+attribute_scope="static"
+else
+attribute_scope=""""
+fi
+
if test "x" = "x"
then
cat >conftest.$ac_ext <<_ACEOF
@@ -19051,7 +19121,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-static void __attribute__((weak_import)) *test(void *muffin, ...) {return (void *) 0;}
+$attribute_scope void __attribute__((weak_import)) *test(void *muffin, ...) {return (void *) 0;}
int
main ()
{
@@ -19102,7 +19172,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
+$attribute_scope void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
int
main ()
{
diff --git a/configure.ac b/configure.ac
index cfb53fd7f..de7892fc1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -515,7 +515,7 @@ AST_GCC_ATTRIBUTE(deprecated)
AST_GCC_ATTRIBUTE(sentinel)
AST_GCC_ATTRIBUTE(warn_unused_result)
AST_GCC_ATTRIBUTE(weakref, [weakref("foo")])
-AST_GCC_ATTRIBUTE(weak_import)
+AST_GCC_ATTRIBUTE(weak_import, , "")
AC_MSG_CHECKING(for -ffunction-sections support)
saved_CFLAGS="${CFLAGS}"