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
certified/1.8.6
Kevin P. Fleming 16 years ago
parent dcc651d99b
commit 4af5dd813c

@ -5,12 +5,12 @@ AC_DEFUN([AST_GCC_ATTRIBUTE],
[ [
AC_MSG_CHECKING(for compiler 'attribute $1' support) AC_MSG_CHECKING(for compiler 'attribute $1' support)
saved_CFLAGS="$CFLAGS" saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror" CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
if test "x$2" = "x" if test "x$2" = "x"
then then
AC_COMPILE_IFELSE( 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_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]), 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 else
AC_COMPILE_IFELSE( 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_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]), AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),

62
configure vendored

@ -1,5 +1,5 @@
#! /bin/sh #! /bin/sh
# From configure.ac Revision: 197738 . # From configure.ac Revision: 200519 .
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.63 for asterisk 1.6. # 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 "$as_me:$LINENO: checking for compiler 'attribute pure' support" >&5
$as_echo_n "checking for compiler 'attribute pure' support... " >&6; } $as_echo_n "checking for compiler 'attribute pure' support... " >&6; }
saved_CFLAGS="$CFLAGS" saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror" CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
if test "x" = "x" if test "x" = "x"
then then
@ -18025,7 +18025,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
void __attribute__((pure)) *test(void *muffin, ...) {} static void __attribute__((pure)) *test(void *muffin, ...) {return (void *) 0;}
int int
main () main ()
{ {
@ -18076,7 +18076,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
void __attribute__(()) *test(void *muffin, ...) {} static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
int int
main () main ()
{ {
@ -18129,7 +18129,7 @@ CFLAGS="$saved_CFLAGS"
{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute malloc' support" >&5 { $as_echo "$as_me:$LINENO: checking for compiler 'attribute malloc' support" >&5
$as_echo_n "checking for compiler 'attribute malloc' support... " >&6; } $as_echo_n "checking for compiler 'attribute malloc' support... " >&6; }
saved_CFLAGS="$CFLAGS" saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror" CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
if test "x" = "x" if test "x" = "x"
then then
@ -18139,7 +18139,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
void __attribute__((malloc)) *test(void *muffin, ...) {} static void __attribute__((malloc)) *test(void *muffin, ...) {return (void *) 0;}
int int
main () main ()
{ {
@ -18190,7 +18190,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
void __attribute__(()) *test(void *muffin, ...) {} static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
int int
main () main ()
{ {
@ -18243,7 +18243,7 @@ CFLAGS="$saved_CFLAGS"
{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute const' support" >&5 { $as_echo "$as_me:$LINENO: checking for compiler 'attribute const' support" >&5
$as_echo_n "checking for compiler 'attribute const' support... " >&6; } $as_echo_n "checking for compiler 'attribute const' support... " >&6; }
saved_CFLAGS="$CFLAGS" saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror" CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
if test "x" = "x" if test "x" = "x"
then then
@ -18253,7 +18253,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
void __attribute__((const)) *test(void *muffin, ...) {} static void __attribute__((const)) *test(void *muffin, ...) {return (void *) 0;}
int int
main () main ()
{ {
@ -18304,7 +18304,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
void __attribute__(()) *test(void *muffin, ...) {} static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
int int
main () main ()
{ {
@ -18357,7 +18357,7 @@ CFLAGS="$saved_CFLAGS"
{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute unused' support" >&5 { $as_echo "$as_me:$LINENO: checking for compiler 'attribute unused' support" >&5
$as_echo_n "checking for compiler 'attribute unused' support... " >&6; } $as_echo_n "checking for compiler 'attribute unused' support... " >&6; }
saved_CFLAGS="$CFLAGS" saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror" CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
if test "x" = "x" if test "x" = "x"
then then
@ -18367,7 +18367,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
void __attribute__((unused)) *test(void *muffin, ...) {} static void __attribute__((unused)) *test(void *muffin, ...) {return (void *) 0;}
int int
main () main ()
{ {
@ -18418,7 +18418,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
void __attribute__(()) *test(void *muffin, ...) {} static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
int int
main () main ()
{ {
@ -18471,7 +18471,7 @@ CFLAGS="$saved_CFLAGS"
{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute always_inline' support" >&5 { $as_echo "$as_me:$LINENO: checking for compiler 'attribute always_inline' support" >&5
$as_echo_n "checking for compiler 'attribute always_inline' support... " >&6; } $as_echo_n "checking for compiler 'attribute always_inline' support... " >&6; }
saved_CFLAGS="$CFLAGS" saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror" CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
if test "x" = "x" if test "x" = "x"
then then
@ -18481,7 +18481,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
void __attribute__((always_inline)) *test(void *muffin, ...) {} static void __attribute__((always_inline)) *test(void *muffin, ...) {return (void *) 0;}
int int
main () main ()
{ {
@ -18532,7 +18532,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
void __attribute__(()) *test(void *muffin, ...) {} static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
int int
main () main ()
{ {
@ -18585,7 +18585,7 @@ CFLAGS="$saved_CFLAGS"
{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute deprecated' support" >&5 { $as_echo "$as_me:$LINENO: checking for compiler 'attribute deprecated' support" >&5
$as_echo_n "checking for compiler 'attribute deprecated' support... " >&6; } $as_echo_n "checking for compiler 'attribute deprecated' support... " >&6; }
saved_CFLAGS="$CFLAGS" saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror" CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
if test "x" = "x" if test "x" = "x"
then then
@ -18595,7 +18595,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
void __attribute__((deprecated)) *test(void *muffin, ...) {} static void __attribute__((deprecated)) *test(void *muffin, ...) {return (void *) 0;}
int int
main () main ()
{ {
@ -18646,7 +18646,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
void __attribute__(()) *test(void *muffin, ...) {} static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
int int
main () main ()
{ {
@ -18699,7 +18699,7 @@ CFLAGS="$saved_CFLAGS"
{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute sentinel' support" >&5 { $as_echo "$as_me:$LINENO: checking for compiler 'attribute sentinel' support" >&5
$as_echo_n "checking for compiler 'attribute sentinel' support... " >&6; } $as_echo_n "checking for compiler 'attribute sentinel' support... " >&6; }
saved_CFLAGS="$CFLAGS" saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror" CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
if test "x" = "x" if test "x" = "x"
then then
@ -18709,7 +18709,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
void __attribute__((sentinel)) *test(void *muffin, ...) {} static void __attribute__((sentinel)) *test(void *muffin, ...) {return (void *) 0;}
int int
main () main ()
{ {
@ -18760,7 +18760,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
void __attribute__(()) *test(void *muffin, ...) {} static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
int int
main () main ()
{ {
@ -18813,7 +18813,7 @@ CFLAGS="$saved_CFLAGS"
{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute warn_unused_result' support" >&5 { $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; } $as_echo_n "checking for compiler 'attribute warn_unused_result' support... " >&6; }
saved_CFLAGS="$CFLAGS" saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror" CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
if test "x" = "x" if test "x" = "x"
then then
@ -18823,7 +18823,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
void __attribute__((warn_unused_result)) *test(void *muffin, ...) {} static void __attribute__((warn_unused_result)) *test(void *muffin, ...) {return (void *) 0;}
int int
main () main ()
{ {
@ -18874,7 +18874,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
void __attribute__(()) *test(void *muffin, ...) {} static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
int int
main () main ()
{ {
@ -18927,7 +18927,7 @@ CFLAGS="$saved_CFLAGS"
{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute weakref' support" >&5 { $as_echo "$as_me:$LINENO: checking for compiler 'attribute weakref' support" >&5
$as_echo_n "checking for compiler 'attribute weakref' support... " >&6; } $as_echo_n "checking for compiler 'attribute weakref' support... " >&6; }
saved_CFLAGS="$CFLAGS" saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror" CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
if test "xweakref("foo")" = "x" if test "xweakref("foo")" = "x"
then then
@ -18937,7 +18937,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
void __attribute__((weakref)) *test(void *muffin, ...) {} static void __attribute__((weakref)) *test(void *muffin, ...) {return (void *) 0;}
int int
main () main ()
{ {
@ -18988,7 +18988,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
void __attribute__((weakref("foo"))) *test(void *muffin, ...) {} static void __attribute__((weakref("foo"))) *test(void *muffin, ...) {return (void *) 0;}
int int
main () main ()
{ {
@ -19041,7 +19041,7 @@ CFLAGS="$saved_CFLAGS"
{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute weak_import' support" >&5 { $as_echo "$as_me:$LINENO: checking for compiler 'attribute weak_import' support" >&5
$as_echo_n "checking for compiler 'attribute weak_import' support... " >&6; } $as_echo_n "checking for compiler 'attribute weak_import' support... " >&6; }
saved_CFLAGS="$CFLAGS" saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror" CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
if test "x" = "x" if test "x" = "x"
then then
@ -19051,7 +19051,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
void __attribute__((weak_import)) *test(void *muffin, ...) {} static void __attribute__((weak_import)) *test(void *muffin, ...) {return (void *) 0;}
int int
main () main ()
{ {
@ -19102,7 +19102,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
void __attribute__(()) *test(void *muffin, ...) {} static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
int int
main () main ()
{ {

Loading…
Cancel
Save