From 4af5dd813c040d30bcb0666a09300997a5d7f46d Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" <kpfleming@digium.com> Date: Tue, 16 Jun 2009 01:28:08 +0000 Subject: [PATCH] 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: https://origsvn.digium.com/svn/asterisk/trunk@200764 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- autoconf/ast_gcc_attribute.m4 | 6 ++-- configure | 62 +++++++++++++++++------------------ 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/autoconf/ast_gcc_attribute.m4 b/autoconf/ast_gcc_attribute.m4 index c4488454d9..806b390194 100644 --- a/autoconf/ast_gcc_attribute.m4 +++ b/autoconf/ast_gcc_attribute.m4 @@ -5,12 +5,12 @@ 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.]), @@ -18,7 +18,7 @@ AC_COMPILE_IFELSE( ) else AC_COMPILE_IFELSE( - AC_LANG_PROGRAM([void __attribute__(($2)) *test(void *muffin, ...) {}], + 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.]), diff --git a/configure b/configure index 926cf7f5a0..97015d342c 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 197738 . +# From configure.ac Revision: 200519 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.63 for asterisk 1.6. # @@ -18015,7 +18015,7 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ { $as_echo "$as_me:$LINENO: checking for compiler 'attribute pure' support" >&5 $as_echo_n "checking for compiler 'attribute pure' support... " >&6; } saved_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Werror" +CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" if test "x" = "x" then @@ -18025,7 +18025,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -void __attribute__((pure)) *test(void *muffin, ...) {} +static void __attribute__((pure)) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18076,7 +18076,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -void __attribute__(()) *test(void *muffin, ...) {} +static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18129,7 +18129,7 @@ CFLAGS="$saved_CFLAGS" { $as_echo "$as_me:$LINENO: checking for compiler 'attribute malloc' support" >&5 $as_echo_n "checking for compiler 'attribute malloc' support... " >&6; } saved_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Werror" +CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" if test "x" = "x" then @@ -18139,7 +18139,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -void __attribute__((malloc)) *test(void *muffin, ...) {} +static void __attribute__((malloc)) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18190,7 +18190,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -void __attribute__(()) *test(void *muffin, ...) {} +static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18243,7 +18243,7 @@ CFLAGS="$saved_CFLAGS" { $as_echo "$as_me:$LINENO: checking for compiler 'attribute const' support" >&5 $as_echo_n "checking for compiler 'attribute const' support... " >&6; } saved_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Werror" +CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" if test "x" = "x" then @@ -18253,7 +18253,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -void __attribute__((const)) *test(void *muffin, ...) {} +static void __attribute__((const)) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18304,7 +18304,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -void __attribute__(()) *test(void *muffin, ...) {} +static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18357,7 +18357,7 @@ CFLAGS="$saved_CFLAGS" { $as_echo "$as_me:$LINENO: checking for compiler 'attribute unused' support" >&5 $as_echo_n "checking for compiler 'attribute unused' support... " >&6; } saved_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Werror" +CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" if test "x" = "x" then @@ -18367,7 +18367,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -void __attribute__((unused)) *test(void *muffin, ...) {} +static void __attribute__((unused)) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18418,7 +18418,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -void __attribute__(()) *test(void *muffin, ...) {} +static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18471,7 +18471,7 @@ CFLAGS="$saved_CFLAGS" { $as_echo "$as_me:$LINENO: checking for compiler 'attribute always_inline' support" >&5 $as_echo_n "checking for compiler 'attribute always_inline' support... " >&6; } saved_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Werror" +CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" if test "x" = "x" then @@ -18481,7 +18481,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -void __attribute__((always_inline)) *test(void *muffin, ...) {} +static void __attribute__((always_inline)) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18532,7 +18532,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -void __attribute__(()) *test(void *muffin, ...) {} +static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18585,7 +18585,7 @@ CFLAGS="$saved_CFLAGS" { $as_echo "$as_me:$LINENO: checking for compiler 'attribute deprecated' support" >&5 $as_echo_n "checking for compiler 'attribute deprecated' support... " >&6; } saved_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Werror" +CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" if test "x" = "x" then @@ -18595,7 +18595,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -void __attribute__((deprecated)) *test(void *muffin, ...) {} +static void __attribute__((deprecated)) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18646,7 +18646,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -void __attribute__(()) *test(void *muffin, ...) {} +static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18699,7 +18699,7 @@ CFLAGS="$saved_CFLAGS" { $as_echo "$as_me:$LINENO: checking for compiler 'attribute sentinel' support" >&5 $as_echo_n "checking for compiler 'attribute sentinel' support... " >&6; } saved_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Werror" +CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" if test "x" = "x" then @@ -18709,7 +18709,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -void __attribute__((sentinel)) *test(void *muffin, ...) {} +static void __attribute__((sentinel)) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18760,7 +18760,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -void __attribute__(()) *test(void *muffin, ...) {} +static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18813,7 +18813,7 @@ CFLAGS="$saved_CFLAGS" { $as_echo "$as_me:$LINENO: checking for compiler 'attribute warn_unused_result' support" >&5 $as_echo_n "checking for compiler 'attribute warn_unused_result' support... " >&6; } saved_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Werror" +CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" if test "x" = "x" then @@ -18823,7 +18823,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -void __attribute__((warn_unused_result)) *test(void *muffin, ...) {} +static void __attribute__((warn_unused_result)) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18874,7 +18874,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -void __attribute__(()) *test(void *muffin, ...) {} +static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18927,7 +18927,7 @@ CFLAGS="$saved_CFLAGS" { $as_echo "$as_me:$LINENO: checking for compiler 'attribute weakref' support" >&5 $as_echo_n "checking for compiler 'attribute weakref' support... " >&6; } saved_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Werror" +CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" if test "xweakref("foo")" = "x" then @@ -18937,7 +18937,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -void __attribute__((weakref)) *test(void *muffin, ...) {} +static void __attribute__((weakref)) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18988,7 +18988,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -void __attribute__((weakref("foo"))) *test(void *muffin, ...) {} +static void __attribute__((weakref("foo"))) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -19041,7 +19041,7 @@ CFLAGS="$saved_CFLAGS" { $as_echo "$as_me:$LINENO: checking for compiler 'attribute weak_import' support" >&5 $as_echo_n "checking for compiler 'attribute weak_import' support... " >&6; } saved_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Werror" +CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" if test "x" = "x" then @@ -19051,7 +19051,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -void __attribute__((weak_import)) *test(void *muffin, ...) {} +static void __attribute__((weak_import)) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -19102,7 +19102,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -void __attribute__(()) *test(void *muffin, ...) {} +static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} int main () { -- GitLab