From 1827bcba77c54a2c7b9879f959be73a5c9a9a5a1 Mon Sep 17 00:00:00 2001 From: Steve Murphy Date: Sat, 7 Jul 2007 16:44:57 +0000 Subject: These changes fix 10145 and 10150, a prob with BSD and exp2/log2 not existing, as well as the bootstrap needing a small upgrade for openbsd. Many thanks to mvanbaak git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@73821 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- bootstrap.sh | 18 +- configure | 802 ++++++++++++++++++++++++++++++++++++++- configure.ac | 4 + include/asterisk/autoconfig.h.in | 48 +-- main/ast_expr2.c | 12 + main/ast_expr2.y | 12 + 6 files changed, 847 insertions(+), 49 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index d3d51ee76..8fd87efd0 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -9,13 +9,21 @@ check_for_app() { fi } -# On FreeBSD, multiple autoconf/automake versions have different names. +# On FreeBSD and OpenBSD, multiple autoconf/automake versions have different names. # On linux, envitonment variables tell which one to use. -uname -s | grep -q FreeBSD -if [ $? = 0 ] ; then # FreeBSD case - MY_AC_VER=259 - MY_AM_VER=19 +uname -s | grep -q BSD +if [ $? = 0 ] ; then # BSD case + uname -s | grep -q FreeBSD + if [ $? = 0 ] ; then # FreeBSD case + MY_AC_VER=259 + MY_AM_VER=19 + fi + uname -s | grep -q OpenBSD + if [ $? = 0 ] ; then # OpenBSD case + MY_AC_VER=-2.61 + MY_AM_VER=-1.9 + fi else # linux case MY_AC_VER= MY_AM_VER= diff --git a/configure b/configure index 6afbbb1f2..7dd0ed2c8 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 72738 . +# From configure.ac Revision: 72767 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61. # @@ -203,7 +203,7 @@ if as_func_ret_failure; then echo as_func_ret_failure succeeded. fi -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then +if (set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 @@ -407,7 +407,7 @@ if as_func_ret_failure; then echo as_func_ret_failure succeeded. fi -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then +if (set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 @@ -6469,7 +6469,7 @@ else GNU_MAKE_VERSION_MINOR=0 ; for a in make gmake gnumake ; do if test -z "$a" ; then continue ; fi ; - if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then + if (sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then GNU_MAKE=$a ; GNU_MAKE_VERSION_MAJOR=`$GNU_MAKE --version | grep "GNU Make" | cut -f3 -d' ' | cut -f1 -d'.'` GNU_MAKE_VERSION_MINOR=`$GNU_MAKE --version | grep "GNU Make" | cut -f2 -d'.' | cut -c1-2` @@ -12127,13 +12127,11 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include /* for off_t */ - #include +#include 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; } @@ -12173,13 +12171,11 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _LARGEFILE_SOURCE 1 -#include /* for off_t */ - #include +#include 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; } @@ -17653,6 +17649,788 @@ fi fi +# BSD might not have exp2, and/or log2 + +if test "x${PBX_EXP2}" != "x1" -a "${USE_EXP2}" != "no"; then + pbxlibdir="" + if test "x${EXP2_DIR}" != "x"; then + if test -d ${EXP2_DIR}/lib; then + pbxlibdir="-L${EXP2_DIR}/lib" + else + pbxlibdir="-L${EXP2_DIR}" + fi + fi + pbxfuncname="exp2" + if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers + AST_EXP2_FOUND=yes + else + as_ac_Lib=`echo "ac_cv_lib_m_${pbxfuncname}" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lm" >&5 +echo $ECHO_N "checking for ${pbxfuncname} in -lm... $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="-lm ${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_EXP2_FOUND=yes +else + AST_EXP2_FOUND=no +fi + + fi + + if test "${AST_EXP2_FOUND}" = "yes"; then + EXP2_LIB="-lm " + EXP2_HEADER_FOUND="1" + if test "x${EXP2_DIR}" != "x"; then + EXP2_LIB="${pbxlibdir} ${EXP2_LIB}" + EXP2_INCLUDE="-I${EXP2_DIR}/include" + saved_cppflags="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} -I${EXP2_DIR}/include" + if test "x" != "x" ; then + as_ac_Header=`echo "ac_cv_header_${EXP2_DIR}/include/" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for ${EXP2_DIR}/include/" >&5 +echo $ECHO_N "checking for ${EXP2_DIR}/include/... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking ${EXP2_DIR}/include/ usability" >&5 +echo $ECHO_N "checking ${EXP2_DIR}/include/ 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 <${EXP2_DIR}/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 ${EXP2_DIR}/include/ presence" >&5 +echo $ECHO_N "checking ${EXP2_DIR}/include/ 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 <${EXP2_DIR}/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: ${EXP2_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: ${EXP2_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: ${EXP2_DIR}/include/: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: ${EXP2_DIR}/include/: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: ${EXP2_DIR}/include/: present but cannot be compiled" >&5 +echo "$as_me: WARNING: ${EXP2_DIR}/include/: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: ${EXP2_DIR}/include/: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: ${EXP2_DIR}/include/: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: ${EXP2_DIR}/include/: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: ${EXP2_DIR}/include/: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: ${EXP2_DIR}/include/: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: ${EXP2_DIR}/include/: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: ${EXP2_DIR}/include/: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: ${EXP2_DIR}/include/: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: ${EXP2_DIR}/include/: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: ${EXP2_DIR}/include/: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ echo "$as_me:$LINENO: checking for ${EXP2_DIR}/include/" >&5 +echo $ECHO_N "checking for ${EXP2_DIR}/include/... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + EXP2_HEADER_FOUND=1 +else + EXP2_HEADER_FOUND=0 +fi + + + fi + CPPFLAGS="${saved_cppflags}" + else + if test "x" != "x" ; then + 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;} + + ;; +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 + EXP2_HEADER_FOUND=1 +else + EXP2_HEADER_FOUND=0 +fi + + + fi + fi + if test "x${EXP2_HEADER_FOUND}" = "x0" ; then + EXP2_LIB="" + EXP2_INCLUDE="" + else + if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library + EXP2_LIB="" + fi + PBX_EXP2=1 + # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED + +cat >>confdefs.h <<_ACEOF +#define HAVE_EXP2 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define HAVE_EXP2_VERSION +_ACEOF + + fi + fi +fi + + +if test "x${PBX_LOG2}" != "x1" -a "${USE_LOG2}" != "no"; then + pbxlibdir="" + if test "x${LOG2_DIR}" != "x"; then + if test -d ${LOG2_DIR}/lib; then + pbxlibdir="-L${LOG2_DIR}/lib" + else + pbxlibdir="-L${LOG2_DIR}" + fi + fi + pbxfuncname="log2" + if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers + AST_LOG2_FOUND=yes + else + as_ac_Lib=`echo "ac_cv_lib_m_${pbxfuncname}" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lm" >&5 +echo $ECHO_N "checking for ${pbxfuncname} in -lm... $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="-lm ${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_LOG2_FOUND=yes +else + AST_LOG2_FOUND=no +fi + + fi + + if test "${AST_LOG2_FOUND}" = "yes"; then + LOG2_LIB="-lm " + LOG2_HEADER_FOUND="1" + if test "x${LOG2_DIR}" != "x"; then + LOG2_LIB="${pbxlibdir} ${LOG2_LIB}" + LOG2_INCLUDE="-I${LOG2_DIR}/include" + saved_cppflags="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} -I${LOG2_DIR}/include" + if test "x" != "x" ; then + as_ac_Header=`echo "ac_cv_header_${LOG2_DIR}/include/" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for ${LOG2_DIR}/include/" >&5 +echo $ECHO_N "checking for ${LOG2_DIR}/include/... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking ${LOG2_DIR}/include/ usability" >&5 +echo $ECHO_N "checking ${LOG2_DIR}/include/ 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 <${LOG2_DIR}/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 ${LOG2_DIR}/include/ presence" >&5 +echo $ECHO_N "checking ${LOG2_DIR}/include/ 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 <${LOG2_DIR}/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: ${LOG2_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: ${LOG2_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: ${LOG2_DIR}/include/: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: ${LOG2_DIR}/include/: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: ${LOG2_DIR}/include/: present but cannot be compiled" >&5 +echo "$as_me: WARNING: ${LOG2_DIR}/include/: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: ${LOG2_DIR}/include/: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: ${LOG2_DIR}/include/: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: ${LOG2_DIR}/include/: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: ${LOG2_DIR}/include/: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: ${LOG2_DIR}/include/: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: ${LOG2_DIR}/include/: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: ${LOG2_DIR}/include/: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: ${LOG2_DIR}/include/: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: ${LOG2_DIR}/include/: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: ${LOG2_DIR}/include/: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ echo "$as_me:$LINENO: checking for ${LOG2_DIR}/include/" >&5 +echo $ECHO_N "checking for ${LOG2_DIR}/include/... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + LOG2_HEADER_FOUND=1 +else + LOG2_HEADER_FOUND=0 +fi + + + fi + CPPFLAGS="${saved_cppflags}" + else + if test "x" != "x" ; then + 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;} + + ;; +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 + LOG2_HEADER_FOUND=1 +else + LOG2_HEADER_FOUND=0 +fi + + + fi + fi + if test "x${LOG2_HEADER_FOUND}" = "x0" ; then + LOG2_LIB="" + LOG2_INCLUDE="" + else + if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library + LOG2_LIB="" + fi + PBX_LOG2=1 + # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED + +cat >>confdefs.h <<_ACEOF +#define HAVE_LOG2 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define HAVE_LOG2_VERSION +_ACEOF + + fi + fi +fi + + GSM_INTERNAL="yes" GSM_SYSTEM="yes" diff --git a/configure.ac b/configure.ac index 4000f022d..d223ca179 100644 --- a/configure.ac +++ b/configure.ac @@ -374,6 +374,10 @@ if test "x${host_os}" = "xlinux-gnu" ; then AST_EXT_LIB_CHECK([CAP], [cap], [cap_from_text], [sys/capability.h]) fi +# BSD might not have exp2, and/or log2 +AST_EXT_LIB_CHECK([EXP2], [m], [exp2]) +AST_EXT_LIB_CHECK([LOG2], [m], [log2]) + GSM_INTERNAL="yes" AC_SUBST(GSM_INTERNAL) GSM_SYSTEM="yes" diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in index 85618b9e3..fccb01f48 100644 --- a/include/asterisk/autoconfig.h.in +++ b/include/asterisk/autoconfig.h.in @@ -105,6 +105,12 @@ /* Define to 1 if you have the `endpwent' function. */ #undef HAVE_ENDPWENT +/* Define this to indicate the ${EXP2_DESCRIP} library */ +#undef HAVE_EXP2 + +/* Define to indicate the ${EXP2_DESCRIP} library version */ +#undef HAVE_EXP2_VERSION + /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H @@ -226,6 +232,12 @@ /* Define to 1 if you have the `localtime_r' function. */ #undef HAVE_LOCALTIME_R +/* Define this to indicate the ${LOG2_DESCRIP} library */ +#undef HAVE_LOG2 + +/* Define to indicate the ${LOG2_DESCRIP} library version */ +#undef HAVE_LOG2_VERSION + /* Define this to indicate the ${LTDL_DESCRIP} library */ #undef HAVE_LTDL @@ -699,12 +711,12 @@ release 3. */ #undef SETVBUF_REVERSED -/* The size of `int', as computed by sizeof. */ +/* The size of a `int', as computed by sizeof. */ #undef SIZEOF_INT /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be - automatically deduced at runtime. + automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ @@ -719,13 +731,6 @@ /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME -/* Define to 1 if on AIX 3. - System headers sometimes define this. - We just want to avoid a redefinition error message. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif - /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS @@ -740,27 +745,6 @@ /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES -/* Define to 1 if on MINIX. */ -#undef _MINIX - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -#undef _POSIX_1_SOURCE - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -#undef _POSIX_SOURCE - -/* Enable extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif - /* Define like PROTOTYPES; this can be used by system headers. */ #undef __PROTOTYPES @@ -779,13 +763,13 @@ /* Define to `int' if does not define. */ #undef mode_t -/* Define to `long int' if does not define. */ +/* Define to `long' if does not define. */ #undef off_t /* Define to `int' if does not define. */ #undef pid_t -/* Define to `unsigned int' if does not define. */ +/* Define to `unsigned' if does not define. */ #undef size_t /* Define to `int' if doesn't define. */ diff --git a/main/ast_expr2.c b/main/ast_expr2.c index 7a55bc16f..2e25e0766 100644 --- a/main/ast_expr2.c +++ b/main/ast_expr2.c @@ -160,9 +160,13 @@ #define FUNC_RINT rintl #define FUNC_TRUNC truncl #define FUNC_EXP expl +#ifdef HAVE_EXP2 #define FUNC_EXP2 exp2l +#endif #define FUNC_LOG logl +#ifdef HAVE_LOG2 #define FUNC_LOG2 log2l +#endif #define FUNC_LOG10 log10l #define FUNC_REMAINDER remainderl #else @@ -185,9 +189,13 @@ #define FUNC_RINT rint #define FUNC_TRUNC trunc #define FUNC_EXP exp +#ifdef HAVE_EXP2 #define FUNC_EXP2 exp2 +#endif #define FUNC_LOG log +#ifdef HAVE_LOG2 #define FUNC_LOG2 log2 +#endif #define FUNC_LOG10 log10 #define FUNC_REMAINDER remainder #endif @@ -2631,6 +2639,7 @@ static struct val *op_func(struct val *funcname, struct expr_node *arglist, stru ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s); return make_number(0.0); } +#ifdef HAVE_EXP2 } else if (strcmp(funcname->u.s,"EXP2") == 0) { if (arglist && !arglist->right && arglist->val){ to_number(arglist->val); @@ -2640,6 +2649,7 @@ static struct val *op_func(struct val *funcname, struct expr_node *arglist, stru ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s); return make_number(0.0); } +#endif } else if (strcmp(funcname->u.s,"LOG") == 0) { if (arglist && !arglist->right && arglist->val){ to_number(arglist->val); @@ -2649,6 +2659,7 @@ static struct val *op_func(struct val *funcname, struct expr_node *arglist, stru ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s); return make_number(0.0); } +#ifdef HAVE_LOG2 } else if (strcmp(funcname->u.s,"LOG2") == 0) { if (arglist && !arglist->right && arglist->val){ to_number(arglist->val); @@ -2658,6 +2669,7 @@ static struct val *op_func(struct val *funcname, struct expr_node *arglist, stru ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s); return make_number(0.0); } +#endif } else if (strcmp(funcname->u.s,"LOG10") == 0) { if (arglist && !arglist->right && arglist->val){ to_number(arglist->val); diff --git a/main/ast_expr2.y b/main/ast_expr2.y index 89baf91bd..126a02856 100644 --- a/main/ast_expr2.y +++ b/main/ast_expr2.y @@ -41,9 +41,13 @@ #define FUNC_RINT rintl #define FUNC_TRUNC truncl #define FUNC_EXP expl +#ifdef HAVE_EXP2 #define FUNC_EXP2 exp2l +#endif #define FUNC_LOG logl +#ifdef HAVE_LOG2 #define FUNC_LOG2 log2l +#endif #define FUNC_LOG10 log10l #define FUNC_REMAINDER remainderl #else @@ -66,9 +70,13 @@ #define FUNC_RINT rint #define FUNC_TRUNC trunc #define FUNC_EXP exp +#ifdef HAVE_EXP2 #define FUNC_EXP2 exp2 +#endif #define FUNC_LOG log +#ifdef HAVE_LOG2 #define FUNC_LOG2 log2 +#endif #define FUNC_LOG10 log10 #define FUNC_REMAINDER remainder #endif @@ -803,6 +811,7 @@ static struct val *op_func(struct val *funcname, struct expr_node *arglist, stru ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s); return make_number(0.0); } +#ifdef HAVE_EXP2 } else if (strcmp(funcname->u.s,"EXP2") == 0) { if (arglist && !arglist->right && arglist->val){ to_number(arglist->val); @@ -812,6 +821,7 @@ static struct val *op_func(struct val *funcname, struct expr_node *arglist, stru ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s); return make_number(0.0); } +#endif } else if (strcmp(funcname->u.s,"LOG") == 0) { if (arglist && !arglist->right && arglist->val){ to_number(arglist->val); @@ -821,6 +831,7 @@ static struct val *op_func(struct val *funcname, struct expr_node *arglist, stru ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s); return make_number(0.0); } +#ifdef HAVE_LOG2 } else if (strcmp(funcname->u.s,"LOG2") == 0) { if (arglist && !arglist->right && arglist->val){ to_number(arglist->val); @@ -830,6 +841,7 @@ static struct val *op_func(struct val *funcname, struct expr_node *arglist, stru ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s); return make_number(0.0); } +#endif } else if (strcmp(funcname->u.s,"LOG10") == 0) { if (arglist && !arglist->right && arglist->val){ to_number(arglist->val); -- cgit v1.2.3