From 35d5a377ed19d5ff658a6d3bd36d76f2b5b05a21 Mon Sep 17 00:00:00 2001 From: file Date: Wed, 16 Jan 2008 01:17:25 +0000 Subject: [PATCH] Merged revisions 98951 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r98951 | file | 2008-01-15 21:13:27 -0400 (Tue, 15 Jan 2008) | 4 lines Add autoconf logic for speexdsp. Later versions use a separate library for some things so we need to use it if present in codec_speex. (closes issue #11693) Reported by: yzg ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@98952 f38db490-d61c-443f-a65b-d21fe96a405b --- build_tools/menuselect-deps.in | 1 + codecs/codec_speex.c | 1 + configure | 311 ++++++++++++++++++++++++++++++- configure.ac | 3 + include/asterisk/autoconfig.h.in | 6 + makeopts.in | 3 + 6 files changed, 319 insertions(+), 6 deletions(-) diff --git a/build_tools/menuselect-deps.in b/build_tools/menuselect-deps.in index 65d7f7207..f29ab8920 100644 --- a/build_tools/menuselect-deps.in +++ b/build_tools/menuselect-deps.in @@ -29,6 +29,7 @@ PORTAUDIO=@PBX_PORTAUDIO@ PRI=@PBX_PRI@ RADIUS=@PBX_RADIUS@ SPEEX=@PBX_SPEEX@ +SPEEXDSP=@PBX_SPEEXDSP@ SQLITE3=@PBX_SQLITE3@ SQLITE=@PBX_SQLITE@ SS7=@PBX_SS7@ diff --git a/codecs/codec_speex.c b/codecs/codec_speex.c index 21c98a5f5..035f9958b 100644 --- a/codecs/codec_speex.c +++ b/codecs/codec_speex.c @@ -32,6 +32,7 @@ /*** MODULEINFO speex + speexdsp ***/ #include "asterisk.h" diff --git a/configure b/configure index a7855ff9b..a0f26a63a 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 98604 . +# From configure.ac Revision: 98605 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for asterisk 1.4. # @@ -857,6 +857,10 @@ SPEEX_LIB SPEEX_INCLUDE SPEEX_DIR PBX_SPEEX +SPEEXDSP_LIB +SPEEXDSP_INCLUDE +SPEEXDSP_DIR +PBX_SPEEXDSP SQLITE_LIB SQLITE_INCLUDE SQLITE_DIR @@ -1603,6 +1607,7 @@ Optional Packages: --with-h323=PATH use OpenH323 files in PATH --with-radius=PATH use Radius Client files in PATH --with-speex=PATH use Speex files in PATH + --with-speexdsp=PATH use Speexdsp files in PATH --with-sqlite=PATH use SQLite files in PATH --with-sqlite3=PATH use SQLite files in PATH --with-suppserv=PATH use mISDN Supplemental Services files in PATH @@ -8884,6 +8889,34 @@ fi + SPEEXDSP_DESCRIP="Speexdsp" + SPEEXDSP_OPTION="speexdsp" + +# Check whether --with-speexdsp was given. +if test "${with_speexdsp+set}" = set; then + withval=$with_speexdsp; + case ${withval} in + n|no) + USE_SPEEXDSP=no + ;; + y|ye|yes) + ac_mandatory_list="${ac_mandatory_list} SPEEXDSP" + ;; + *) + SPEEXDSP_DIR="${withval}" + ac_mandatory_list="${ac_mandatory_list} SPEEXDSP" + ;; + esac + +fi + + PBX_SPEEXDSP=0 + + + + + + SQLITE_DESCRIP="SQLite" SQLITE_OPTION="sqlite" @@ -40919,6 +40952,268 @@ fi +if test "x${PBX_SPEEXDSP}" != "x1" -a "${USE_SPEEXDSP}" != "no"; then + pbxlibdir="" + # if --with-SPEEXDSP=DIR has been specified, use it. + if test "x${SPEEXDSP_DIR}" != "x"; then + if test -d ${SPEEXDSP_DIR}/lib; then + pbxlibdir="-L${SPEEXDSP_DIR}/lib" + else + pbxlibdir="-L${SPEEXDSP_DIR}" + fi + fi + pbxfuncname="speex_preprocess_ctl" + if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers + AST_SPEEXDSP_FOUND=yes + else + as_ac_Lib=`echo "ac_cv_lib_speexdsp_${pbxfuncname}" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lspeexdsp" >&5 +echo $ECHO_N "checking for ${pbxfuncname} in -lspeexdsp... $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="-lspeexdsp ${pbxlibdir} -lm $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_SPEEXDSP_FOUND=yes +else + AST_SPEEXDSP_FOUND=no +fi + + fi + + # now check for the header. + if test "${AST_SPEEXDSP_FOUND}" = "yes"; then + SPEEXDSP_LIB="${pbxlibdir} -lspeexdsp -lm" + # if --with-SPEEXDSP=DIR has been specified, use it. + if test "x${SPEEXDSP_DIR}" != "x"; then + SPEEXDSP_INCLUDE="-I${SPEEXDSP_DIR}/include" + fi + SPEEXDSP_INCLUDE="${SPEEXDSP_INCLUDE} " + if test "xspeex/speex.h" = "x" ; then # no header, assume found + SPEEXDSP_HEADER_FOUND="1" + else # check for the header + saved_cppflags="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} ${SPEEXDSP_INCLUDE} " + if test "${ac_cv_header_speex_speex_h+set}" = set; then + { echo "$as_me:$LINENO: checking for speex/speex.h" >&5 +echo $ECHO_N "checking for speex/speex.h... $ECHO_C" >&6; } +if test "${ac_cv_header_speex_speex_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_speex_speex_h" >&5 +echo "${ECHO_T}$ac_cv_header_speex_speex_h" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking speex/speex.h usability" >&5 +echo $ECHO_N "checking speex/speex.h 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 speex/speex.h presence" >&5 +echo $ECHO_N "checking speex/speex.h 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: speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: speex/speex.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: speex/speex.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: speex/speex.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: speex/speex.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: speex/speex.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: speex/speex.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: speex/speex.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: speex/speex.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: speex/speex.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: speex/speex.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: speex/speex.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: speex/speex.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: speex/speex.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: speex/speex.h: 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 speex/speex.h" >&5 +echo $ECHO_N "checking for speex/speex.h... $ECHO_C" >&6; } +if test "${ac_cv_header_speex_speex_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_speex_speex_h=$ac_header_preproc +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_speex_speex_h" >&5 +echo "${ECHO_T}$ac_cv_header_speex_speex_h" >&6; } + +fi +if test $ac_cv_header_speex_speex_h = yes; then + SPEEXDSP_HEADER_FOUND=1 +else + SPEEXDSP_HEADER_FOUND=0 +fi + + + CPPFLAGS="${saved_cppflags}" + fi + if test "x${SPEEXDSP_HEADER_FOUND}" = "x0" ; then + SPEEXDSP_LIB="" + SPEEXDSP_INCLUDE="" + else + if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library + SPEEXDSP_LIB="" + fi + PBX_SPEEXDSP=1 + # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED + +cat >>confdefs.h <<_ACEOF +#define HAVE_SPEEXDSP 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define HAVE_SPEEXDSP_VERSION +_ACEOF + + fi + fi +fi + + + if test "x${PBX_SQLITE}" != "x1" -a "${USE_SQLITE}" != "no"; then pbxlibdir="" # if --with-SQLITE=DIR has been specified, use it. @@ -49061,6 +49356,10 @@ SPEEX_LIB!$SPEEX_LIB$ac_delim SPEEX_INCLUDE!$SPEEX_INCLUDE$ac_delim SPEEX_DIR!$SPEEX_DIR$ac_delim PBX_SPEEX!$PBX_SPEEX$ac_delim +SPEEXDSP_LIB!$SPEEXDSP_LIB$ac_delim +SPEEXDSP_INCLUDE!$SPEEXDSP_INCLUDE$ac_delim +SPEEXDSP_DIR!$SPEEXDSP_DIR$ac_delim +PBX_SPEEXDSP!$PBX_SPEEXDSP$ac_delim SQLITE_LIB!$SQLITE_LIB$ac_delim SQLITE_INCLUDE!$SQLITE_INCLUDE$ac_delim SQLITE_DIR!$SQLITE_DIR$ac_delim @@ -49111,10 +49410,6 @@ X11_DIR!$X11_DIR$ac_delim PBX_X11!$PBX_X11$ac_delim ZLIB_LIB!$ZLIB_LIB$ac_delim ZLIB_INCLUDE!$ZLIB_INCLUDE$ac_delim -ZLIB_DIR!$ZLIB_DIR$ac_delim -PBX_ZLIB!$PBX_ZLIB$ac_delim -ZAPTEL_LIB!$ZAPTEL_LIB$ac_delim -ZAPTEL_INCLUDE!$ZAPTEL_INCLUDE$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -49156,6 +49451,10 @@ _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +ZLIB_DIR!$ZLIB_DIR$ac_delim +PBX_ZLIB!$PBX_ZLIB$ac_delim +ZAPTEL_LIB!$ZAPTEL_LIB$ac_delim +ZAPTEL_INCLUDE!$ZAPTEL_INCLUDE$ac_delim ZAPTEL_DIR!$ZAPTEL_DIR$ac_delim PBX_ZAPTEL!$PBX_ZAPTEL$ac_delim ZAPTEL_TRANSCODE_LIB!$ZAPTEL_TRANSCODE_LIB$ac_delim @@ -49220,7 +49519,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` = 62; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 66; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/configure.ac b/configure.ac index 299fcd6bf..4d656c0ad 100644 --- a/configure.ac +++ b/configure.ac @@ -236,6 +236,7 @@ AST_EXT_LIB_SETUP([PWLIB], [PWlib], [pwlib]) AST_EXT_LIB_SETUP([OPENH323], [OpenH323], [h323]) AST_EXT_LIB_SETUP([RADIUS], [Radius Client], [radius]) AST_EXT_LIB_SETUP([SPEEX], [Speex], [speex]) +AST_EXT_LIB_SETUP([SPEEXDSP], [Speexdsp], [speexdsp]) AST_EXT_LIB_SETUP([SQLITE], [SQLite], [sqlite]) AST_EXT_LIB_SETUP([SQLITE3], [SQLite], [sqlite3]) AST_EXT_LIB_SETUP([SUPPSERV], [mISDN Supplemental Services], [suppserv]) @@ -941,6 +942,8 @@ AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-n AST_EXT_LIB_CHECK([SPEEX], [speex], [speex_encode], [speex/speex.h], [-lm]) +AST_EXT_LIB_CHECK([SPEEXDSP], [speexdsp], [speex_preprocess_ctl], [speex/speex.h], [-lm]) + AST_EXT_LIB_CHECK([SQLITE], [sqlite], [sqlite_exec], [sqlite.h]) AST_EXT_LIB_CHECK([SQLITE3], [sqlite3], [sqlite3_open], [sqlite3.h]) diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in index 5202be17a..3e9217689 100644 --- a/include/asterisk/autoconfig.h.in +++ b/include/asterisk/autoconfig.h.in @@ -703,6 +703,12 @@ /* Define this to indicate the ${SPEEX_DESCRIP} library */ #undef HAVE_SPEEX +/* Define this to indicate the ${SPEEXDSP_DESCRIP} library */ +#undef HAVE_SPEEXDSP + +/* Define to indicate the ${SPEEXDSP_DESCRIP} library version */ +#undef HAVE_SPEEXDSP_VERSION + /* Define to indicate the ${SPEEX_DESCRIP} library version */ #undef HAVE_SPEEX_VERSION diff --git a/makeopts.in b/makeopts.in index 10dced8fc..aac5cf8b1 100644 --- a/makeopts.in +++ b/makeopts.in @@ -165,6 +165,9 @@ SDL_IMAGE_LIB=@SDL_IMAGE_LIB@ SPEEX_INCLUDE=@SPEEX_INCLUDE@ SPEEX_LIB=@SPEEX_LIB@ +SPEEXDSP_INCLUDE=@SPEEXDSP_INCLUDE@ +SPEEXDSP_LIB=@SPEEXDSP_LIB@ + SQLITE_INCLUDE=@SQLITE_INCLUDE@ SQLITE_LIB=@SQLITE_LIB@