Redesigned 'optional API' support.

This patch provides a new implementation of the optional API support defined
in asterisk/optional_api.h; this new version provides solves compatibility
issues with the use of linker version scripts for suppressing global symbols.
In addition, there is now a functional (and tested!) implementation for Mac OS/X,
so module writers no longer need to use special tests before calling optional
API functions. All future implementations must provide these same semantics,
so that module writers can rely on them.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@200519 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2009-06-15 16:07:23 +00:00
parent d224f78dd5
commit 6c5987811c
19 changed files with 289 additions and 297 deletions

130
configure vendored
View File

@@ -1,5 +1,5 @@
#! /bin/sh
# From configure.ac Revision: 196981 .
# From configure.ac Revision: 197738 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.63 for asterisk 1.6.
#
@@ -18924,12 +18924,12 @@ CFLAGS="$saved_CFLAGS"
{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute weak' support" >&5
$as_echo_n "checking for compiler 'attribute weak' support... " >&6; }
{ $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"
if test "x" = "x"
if test "xweakref("foo")" = "x"
then
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
@@ -18937,7 +18937,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
void __attribute__((weak)) *test(void *muffin, ...) {}
void __attribute__((weakref)) *test(void *muffin, ...) {}
int
main ()
{
@@ -18968,7 +18968,7 @@ $as_echo "$ac_try_echo") >&5
$as_echo "yes" >&6; }
cat >>confdefs.h <<_ACEOF
#define HAVE_ATTRIBUTE_weak 1
#define HAVE_ATTRIBUTE_weakref 1
_ACEOF
else
@@ -18988,7 +18988,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
void __attribute__(()) *test(void *muffin, ...) {}
void __attribute__((weakref("foo"))) *test(void *muffin, ...) {}
int
main ()
{
@@ -19019,7 +19019,7 @@ $as_echo "$ac_try_echo") >&5
$as_echo "yes" >&6; }
cat >>confdefs.h <<_ACEOF
#define HAVE_ATTRIBUTE_weak 1
#define HAVE_ATTRIBUTE_weakref 1
_ACEOF
else
@@ -19152,120 +19152,6 @@ CFLAGS="$saved_CFLAGS"
{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute alias' support" >&5
$as_echo_n "checking for compiler 'attribute alias' support... " >&6; }
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
if test "xalias("foo")" = "x"
then
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
void __attribute__((alias)) *test(void *muffin, ...) {}
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
cat >>confdefs.h <<_ACEOF
#define HAVE_ATTRIBUTE_alias 1
_ACEOF
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
void __attribute__((alias("foo"))) *test(void *muffin, ...) {}
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
cat >>confdefs.h <<_ACEOF
#define HAVE_ATTRIBUTE_alias 1
_ACEOF
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
CFLAGS="$saved_CFLAGS"
{ $as_echo "$as_me:$LINENO: checking for -ffunction-sections support" >&5
$as_echo_n "checking for -ffunction-sections support... " >&6; }
saved_CFLAGS="${CFLAGS}"