dect
/
asterisk
Archived
13
0
Fork 0

Merge in changes that allow Asterisk to be built against the Hoard

memory allocator.  See doc/hoard.txt for more details.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@135405 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
seanbright 2008-08-03 16:14:14 +00:00
parent 05e481bb17
commit d4ec4c4c3a
9 changed files with 375 additions and 18 deletions

View File

@ -197,6 +197,8 @@ Miscellaneous
the 'setvar' option to cause a given audio file to be played upon completion
of an attended transfer. Currently it works for DAHDI, IAX2, SIP, and
Skinny channels only.
* You can now compile Asterisk against the Hoard Memory Allocator, see doc/hoard.txt
for more information.
------------------------------------------------------------------------------
--- Functionality changes from Asterisk 1.4.X to Asterisk 1.6.0 -------------

View File

@ -10,6 +10,10 @@
</member>
<member name="LOW_MEMORY" displayname="Optimize for Low Memory Usage">
</member>
<member name="USE_HOARD_ALLOCATOR" displayname="Use the Hoard Memory Allocator instead of the default system one">
<defaultenabled>no</defaultenabled>
<depend>hoard</depend>
</member>
<member name="LOTS_OF_SPANS" displayname="More than 32 DAHDI spans">
</member>
<member name="RADIO_RELAX" displayname="Relax DTMF for Radio Applications">

View File

@ -9,6 +9,7 @@ GSM=@PBX_GSM@
GTK2=@PBX_GTK2@
GTK=@PBX_GTK@
H323=@PBX_H323@
HOARD=@PBX_HOARD@
ICONV=@PBX_ICONV@
IKSEMEL=@PBX_IKSEMEL@
IMAP_TK=@PBX_IMAP_TK@

331
configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh
# From configure.ac Revision: 134538 .
# From configure.ac Revision: 134650 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for asterisk 1.6.
#
@ -768,6 +768,10 @@ GMIME_LIB
GMIME_INCLUDE
GMIME_DIR
PBX_GMIME
HOARD_LIB
HOARD_INCLUDE
HOARD_DIR
PBX_HOARD
ICONV_LIB
ICONV_INCLUDE
ICONV_DIR
@ -1597,6 +1601,7 @@ Optional Packages:
--with-gtk=PATH use gtk libraries files in PATH
--with-gtk2=PATH use gtk2 libraries files in PATH
--with-gmime=PATH use GMime library files in PATH
--with-hoard=PATH use Hoard Memory Allocator files in PATH
--with-iconv=PATH use Iconv Library files in PATH
--with-iksemel=PATH use Iksemel Jabber Library files in PATH
--with-imap=PATH use UW IMAP Toolkit files in PATH
@ -8237,6 +8242,34 @@ fi
HOARD_DESCRIP="Hoard Memory Allocator"
HOARD_OPTION="hoard"
# Check whether --with-hoard was given.
if test "${with_hoard+set}" = set; then
withval=$with_hoard;
case ${withval} in
n|no)
USE_HOARD=no
;;
y|ye|yes)
ac_mandatory_list="${ac_mandatory_list} HOARD"
;;
*)
HOARD_DIR="${withval}"
ac_mandatory_list="${ac_mandatory_list} HOARD"
;;
esac
fi
PBX_HOARD=0
ICONV_DESCRIP="Iconv Library"
ICONV_OPTION="iconv"
@ -12871,13 +12904,11 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/types.h> /* for off_t */
#include <stdio.h>
#include <stdio.h>
int
main ()
{
int (*fp) (FILE *, off_t, int) = fseeko;
return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0);
;
return 0;
}
@ -12917,13 +12948,11 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#define _LARGEFILE_SOURCE 1
#include <sys/types.h> /* for off_t */
#include <stdio.h>
#include <stdio.h>
int
main ()
{
int (*fp) (FILE *, off_t, int) = fseeko;
return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0);
;
return 0;
}
@ -45374,6 +45403,268 @@ _ACEOF
if test "x${PBX_HOARD}" != "x1" -a "${USE_HOARD}" != "no"; then
pbxlibdir=""
# if --with-HOARD=DIR has been specified, use it.
if test "x${HOARD_DIR}" != "x"; then
if test -d ${HOARD_DIR}/lib; then
pbxlibdir="-L${HOARD_DIR}/lib"
else
pbxlibdir="-L${HOARD_DIR}"
fi
fi
pbxfuncname="malloc"
if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers
AST_HOARD_FOUND=yes
else
as_ac_Lib=`echo "ac_cv_lib_hoard_${pbxfuncname}" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lhoard" >&5
echo $ECHO_N "checking for ${pbxfuncname} in -lhoard... $ECHO_C" >&6; }
if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lhoard ${pbxlibdir} $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char ${pbxfuncname} ();
int
main ()
{
return ${pbxfuncname} ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
eval "$as_ac_Lib=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_Lib=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
ac_res=`eval echo '${'$as_ac_Lib'}'`
{ echo "$as_me:$LINENO: result: $ac_res" >&5
echo "${ECHO_T}$ac_res" >&6; }
if test `eval echo '${'$as_ac_Lib'}'` = yes; then
AST_HOARD_FOUND=yes
else
AST_HOARD_FOUND=no
fi
fi
# now check for the header.
if test "${AST_HOARD_FOUND}" = "yes"; then
HOARD_LIB="${pbxlibdir} -lhoard "
# if --with-HOARD=DIR has been specified, use it.
if test "x${HOARD_DIR}" != "x"; then
HOARD_INCLUDE="-I${HOARD_DIR}/include"
fi
HOARD_INCLUDE="${HOARD_INCLUDE} "
if test "x" = "x" ; then # no header, assume found
HOARD_HEADER_FOUND="1"
else # check for the header
saved_cppflags="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${HOARD_INCLUDE}"
if test "${ac_cv_header_+set}" = set; then
{ echo "$as_me:$LINENO: checking for " >&5
echo $ECHO_N "checking for ... $ECHO_C" >&6; }
if test "${ac_cv_header_+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
echo "${ECHO_T}$ac_cv_header_" >&6; }
else
# Is the header compilable?
{ echo "$as_me:$LINENO: checking usability" >&5
echo $ECHO_N "checking usability... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <>
_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 "echo \"\$as_me:$LINENO: $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
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
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6; }
# Is the header present?
{ echo "$as_me:$LINENO: checking presence" >&5
echo $ECHO_N "checking presence... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <>
_ACEOF
if { (ac_try="$ac_cpp conftest.$ac_ext"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null && {
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err
}; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: : present but cannot be compiled" >&5
echo "$as_me: WARNING: : present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: : check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: : check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: : see the Autoconf documentation" >&5
echo "$as_me: WARNING: : see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: : section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: : section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: : proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: : proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: : in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: : in the future, the compiler will take precedence" >&2;}
( cat <<\_ASBOX
## ------------------------------- ##
## Report this to www.asterisk.org ##
## ------------------------------- ##
_ASBOX
) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
{ echo "$as_me:$LINENO: checking for " >&5
echo $ECHO_N "checking for ... $ECHO_C" >&6; }
if test "${ac_cv_header_+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_header_=$ac_header_preproc
fi
{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
echo "${ECHO_T}$ac_cv_header_" >&6; }
fi
if test $ac_cv_header_ = yes; then
HOARD_HEADER_FOUND=1
else
HOARD_HEADER_FOUND=0
fi
CPPFLAGS="${saved_cppflags}"
fi
if test "x${HOARD_HEADER_FOUND}" = "x0" ; then
HOARD_LIB=""
HOARD_INCLUDE=""
else
if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library
HOARD_LIB=""
fi
PBX_HOARD=1
# XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED
cat >>confdefs.h <<_ACEOF
#define HAVE_HOARD 1
_ACEOF
cat >>confdefs.h <<_ACEOF
#define HAVE_HOARD_VERSION
_ACEOF
fi
fi
fi
if test "x${PBX_FREETDS}" != "x1" -a "${USE_FREETDS}" != "no"; then
pbxlibdir=""
# if --with-FREETDS=DIR has been specified, use it.
@ -50362,6 +50653,10 @@ GMIME_LIB!$GMIME_LIB$ac_delim
GMIME_INCLUDE!$GMIME_INCLUDE$ac_delim
GMIME_DIR!$GMIME_DIR$ac_delim
PBX_GMIME!$PBX_GMIME$ac_delim
HOARD_LIB!$HOARD_LIB$ac_delim
HOARD_INCLUDE!$HOARD_INCLUDE$ac_delim
HOARD_DIR!$HOARD_DIR$ac_delim
PBX_HOARD!$PBX_HOARD$ac_delim
ICONV_LIB!$ICONV_LIB$ac_delim
ICONV_INCLUDE!$ICONV_INCLUDE$ac_delim
ICONV_DIR!$ICONV_DIR$ac_delim
@ -50403,10 +50698,6 @@ NBS_INCLUDE!$NBS_INCLUDE$ac_delim
NBS_DIR!$NBS_DIR$ac_delim
PBX_NBS!$PBX_NBS$ac_delim
NCURSES_LIB!$NCURSES_LIB$ac_delim
NCURSES_INCLUDE!$NCURSES_INCLUDE$ac_delim
NCURSES_DIR!$NCURSES_DIR$ac_delim
PBX_NCURSES!$PBX_NCURSES$ac_delim
NETSNMP_LIB!$NETSNMP_LIB$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@ -50448,6 +50739,10 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
NCURSES_INCLUDE!$NCURSES_INCLUDE$ac_delim
NCURSES_DIR!$NCURSES_DIR$ac_delim
PBX_NCURSES!$PBX_NCURSES$ac_delim
NETSNMP_LIB!$NETSNMP_LIB$ac_delim
NETSNMP_INCLUDE!$NETSNMP_INCLUDE$ac_delim
NETSNMP_DIR!$NETSNMP_DIR$ac_delim
PBX_NETSNMP!$PBX_NETSNMP$ac_delim
@ -50541,10 +50836,6 @@ SQLITE3_DIR!$SQLITE3_DIR$ac_delim
PBX_SQLITE3!$PBX_SQLITE3$ac_delim
SUPPSERV_LIB!$SUPPSERV_LIB$ac_delim
SUPPSERV_INCLUDE!$SUPPSERV_INCLUDE$ac_delim
SUPPSERV_DIR!$SUPPSERV_DIR$ac_delim
PBX_SUPPSERV!$PBX_SUPPSERV$ac_delim
OPENSSL_LIB!$OPENSSL_LIB$ac_delim
OPENSSL_INCLUDE!$OPENSSL_INCLUDE$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@ -50586,6 +50877,10 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
SUPPSERV_DIR!$SUPPSERV_DIR$ac_delim
PBX_SUPPSERV!$PBX_SUPPSERV$ac_delim
OPENSSL_LIB!$OPENSSL_LIB$ac_delim
OPENSSL_INCLUDE!$OPENSSL_INCLUDE$ac_delim
OPENSSL_DIR!$OPENSSL_DIR$ac_delim
PBX_OPENSSL!$PBX_OPENSSL$ac_delim
FREETDS_LIB!$FREETDS_LIB$ac_delim
@ -50666,7 +50961,7 @@ CURL_CONFIG!$CURL_CONFIG$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 78; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 82; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

View File

@ -215,6 +215,7 @@ AST_EXT_LIB_SETUP([GSM], [External GSM library], [gsm], [, use 'internal' GSM ot
AST_EXT_LIB_SETUP([GTK], [gtk libraries], [gtk])
AST_EXT_LIB_SETUP([GTK2], [gtk2 libraries], [gtk2])
AST_EXT_LIB_SETUP([GMIME], [GMime library], [gmime])
AST_EXT_LIB_SETUP([HOARD], [Hoard Memory Allocator], [hoard])
AST_EXT_LIB_SETUP([ICONV], [Iconv Library], [iconv])
AST_EXT_LIB_SETUP([IKSEMEL], [Iksemel Jabber Library], [iksemel])
AST_EXT_LIB_SETUP([IMAP_TK], [UW IMAP Toolkit], [imap])
@ -1426,6 +1427,8 @@ fi
AST_EXT_TOOL_CHECK([GMIME], [gmime])
AST_EXT_LIB_CHECK([HOARD], [hoard], [malloc], [])
AST_EXT_LIB_CHECK([FREETDS], [sybdb], [dbinit], [sybdb.h])
AST_EXT_LIB_CHECK([TERMCAP], [termcap], [tgetent], [])

38
doc/hoard.txt Normal file
View File

@ -0,0 +1,38 @@
Using the Hoard Memory Allocator with Asterisk
==============================================
1) Install the Hoard Memory Allocator
Download Hoard from http://www.hoard.org/ either via a package or the source
tarball.
If downloading the source, unpack the tarball and follow the instructions in
the README file to build libhoard for your platform.
2) Configure asterisk
Run ./configure in the root of the asterisk source directory, passing the
--with-hoard option specifying the location of the libhoard shared library.
For example:
./configure --with-hoard=/usr/src/hoard-371/src/
Note that we don't specify the full path to libhoard.so, just the directory
where it resides.
3) Enable Hoard in menuselect
Run 'make menuselect' in the root of the asterisk source distribution. Under
'Compiler Flags' select the 'USE_HOARD_ALLOCATOR' option. If the option is
not available (shows up with XXX next to it) this means that configure was
not able to find libhoard.so. Check that the path you passed to the
--with-hoard option is correct. Re-run ./configure with the correct option
and then repeat step 3.
4) Make and install asterisk
Run the standard build commands:
# make
# make install

View File

@ -343,6 +343,12 @@
/* Define if your system has the GTK2 libraries. */
#undef HAVE_GTK2
/* Define this to indicate the ${HOARD_DESCRIP} library */
#undef HAVE_HOARD
/* Define to indicate the ${HOARD_DESCRIP} library version */
#undef HAVE_HOARD_VERSION
/* Define this to indicate the ${ICONV_DESCRIP} library */
#undef HAVE_ICONV

View File

@ -104,6 +104,12 @@ ifeq ($(OSARCH),SunOS)
ASTLINK=
endif
ifneq ($(findstring USE_HOARD_ALLOCATOR,$(MENUSELECT_CFLAGS)),)
ifneq ($(HOARD_LIB),)
AST_LIBS+=$(HOARD_LIB)
endif
endif
CHECK_SUBDIR: # do nothing, just make sure that we recurse in the subdir/
editline/libedit.a: CHECK_SUBDIR

View File

@ -84,6 +84,8 @@ FREETDS_LIB=@FREETDS_LIB@
GMIME_INCLUDE=@GMIME_INCLUDE@
GMIME_LIB=@GMIME_LIB@
HOARD_LIB=@HOARD_LIB@
GSM_INTERNAL=@GSM_INTERNAL@
GSM_INCLUDE=@GSM_INCLUDE@
GSM_LIB=@GSM_LIB@