diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-09-21 14:25:51 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-09-21 14:25:51 +0000 |
commit | e935ee6eac3ecb38b704ea2e9c2e86309150ab84 (patch) | |
tree | 20df30ed47e98f695d6234fe53f28b1a92674fe4 | |
parent | 31890082ef16e6087c77b44c04b894ebe0007650 (diff) |
Check for the presence of trunc and round, and make the ISOC99 detection a little more sane (closes issue #10776)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@83431 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | configure | 1562 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | include/asterisk/autoconfig.h.in | 24 | ||||
-rw-r--r-- | main/ast_expr2.c | 245 | ||||
-rw-r--r-- | main/ast_expr2.h | 2 | ||||
-rw-r--r-- | main/ast_expr2.y | 89 |
6 files changed, 1806 insertions, 120 deletions
@@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 81873 . +# From configure.ac Revision: 82386 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61. # @@ -19785,6 +19785,786 @@ _ACEOF fi +if test "x${PBX_ROUNDL}" != "x1" -a "${USE_ROUNDL}" != "no"; then + pbxlibdir="" + if test "x${ROUNDL_DIR}" != "x"; then + if test -d ${ROUNDL_DIR}/lib; then + pbxlibdir="-L${ROUNDL_DIR}/lib" + else + pbxlibdir="-L${ROUNDL_DIR}" + fi + fi + pbxfuncname="roundl" + if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers + AST_ROUNDL_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_ROUNDL_FOUND=yes +else + AST_ROUNDL_FOUND=no +fi + + fi + + if test "${AST_ROUNDL_FOUND}" = "yes"; then + ROUNDL_LIB="-lm " + ROUNDL_HEADER_FOUND="1" + if test "x${ROUNDL_DIR}" != "x"; then + ROUNDL_LIB="${pbxlibdir} ${ROUNDL_LIB}" + ROUNDL_INCLUDE="-I${ROUNDL_DIR}/include" + saved_cppflags="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} -I${ROUNDL_DIR}/include" + if test "x" != "x" ; then + as_ac_Header=`echo "ac_cv_header_${ROUNDL_DIR}/include/" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for ${ROUNDL_DIR}/include/" >&5 +echo $ECHO_N "checking for ${ROUNDL_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 ${ROUNDL_DIR}/include/ usability" >&5 +echo $ECHO_N "checking ${ROUNDL_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 <${ROUNDL_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 ${ROUNDL_DIR}/include/ presence" >&5 +echo $ECHO_N "checking ${ROUNDL_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 <${ROUNDL_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: ${ROUNDL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: ${ROUNDL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: ${ROUNDL_DIR}/include/: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: ${ROUNDL_DIR}/include/: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: ${ROUNDL_DIR}/include/: present but cannot be compiled" >&5 +echo "$as_me: WARNING: ${ROUNDL_DIR}/include/: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: ${ROUNDL_DIR}/include/: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: ${ROUNDL_DIR}/include/: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: ${ROUNDL_DIR}/include/: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: ${ROUNDL_DIR}/include/: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: ${ROUNDL_DIR}/include/: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: ${ROUNDL_DIR}/include/: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: ${ROUNDL_DIR}/include/: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: ${ROUNDL_DIR}/include/: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: ${ROUNDL_DIR}/include/: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: ${ROUNDL_DIR}/include/: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ echo "$as_me:$LINENO: checking for ${ROUNDL_DIR}/include/" >&5 +echo $ECHO_N "checking for ${ROUNDL_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 + ROUNDL_HEADER_FOUND=1 +else + ROUNDL_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 + ROUNDL_HEADER_FOUND=1 +else + ROUNDL_HEADER_FOUND=0 +fi + + + fi + fi + if test "x${ROUNDL_HEADER_FOUND}" = "x0" ; then + ROUNDL_LIB="" + ROUNDL_INCLUDE="" + else + if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library + ROUNDL_LIB="" + fi + PBX_ROUNDL=1 + # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED + +cat >>confdefs.h <<_ACEOF +#define HAVE_ROUNDL 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define HAVE_ROUNDL_VERSION +_ACEOF + + fi + fi +fi + + +if test "x${PBX_TRUNCL}" != "x1" -a "${USE_TRUNCL}" != "no"; then + pbxlibdir="" + if test "x${TRUNCL_DIR}" != "x"; then + if test -d ${TRUNCL_DIR}/lib; then + pbxlibdir="-L${TRUNCL_DIR}/lib" + else + pbxlibdir="-L${TRUNCL_DIR}" + fi + fi + pbxfuncname="truncl" + if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers + AST_TRUNCL_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_TRUNCL_FOUND=yes +else + AST_TRUNCL_FOUND=no +fi + + fi + + if test "${AST_TRUNCL_FOUND}" = "yes"; then + TRUNCL_LIB="-lm " + TRUNCL_HEADER_FOUND="1" + if test "x${TRUNCL_DIR}" != "x"; then + TRUNCL_LIB="${pbxlibdir} ${TRUNCL_LIB}" + TRUNCL_INCLUDE="-I${TRUNCL_DIR}/include" + saved_cppflags="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} -I${TRUNCL_DIR}/include" + if test "x" != "x" ; then + as_ac_Header=`echo "ac_cv_header_${TRUNCL_DIR}/include/" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for ${TRUNCL_DIR}/include/" >&5 +echo $ECHO_N "checking for ${TRUNCL_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 ${TRUNCL_DIR}/include/ usability" >&5 +echo $ECHO_N "checking ${TRUNCL_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 <${TRUNCL_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 ${TRUNCL_DIR}/include/ presence" >&5 +echo $ECHO_N "checking ${TRUNCL_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 <${TRUNCL_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: ${TRUNCL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: ${TRUNCL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: ${TRUNCL_DIR}/include/: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: ${TRUNCL_DIR}/include/: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: ${TRUNCL_DIR}/include/: present but cannot be compiled" >&5 +echo "$as_me: WARNING: ${TRUNCL_DIR}/include/: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: ${TRUNCL_DIR}/include/: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: ${TRUNCL_DIR}/include/: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: ${TRUNCL_DIR}/include/: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: ${TRUNCL_DIR}/include/: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: ${TRUNCL_DIR}/include/: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: ${TRUNCL_DIR}/include/: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: ${TRUNCL_DIR}/include/: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: ${TRUNCL_DIR}/include/: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: ${TRUNCL_DIR}/include/: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: ${TRUNCL_DIR}/include/: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ echo "$as_me:$LINENO: checking for ${TRUNCL_DIR}/include/" >&5 +echo $ECHO_N "checking for ${TRUNCL_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 + TRUNCL_HEADER_FOUND=1 +else + TRUNCL_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 + TRUNCL_HEADER_FOUND=1 +else + TRUNCL_HEADER_FOUND=0 +fi + + + fi + fi + if test "x${TRUNCL_HEADER_FOUND}" = "x0" ; then + TRUNCL_LIB="" + TRUNCL_INCLUDE="" + else + if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library + TRUNCL_LIB="" + fi + PBX_TRUNCL=1 + # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED + +cat >>confdefs.h <<_ACEOF +#define HAVE_TRUNCL 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define HAVE_TRUNCL_VERSION +_ACEOF + + fi + fi +fi + + if test "x${PBX_EXP2}" != "x1" -a "${USE_EXP2}" != "no"; then pbxlibdir="" if test "x${EXP2_DIR}" != "x"; then @@ -21345,6 +22125,786 @@ _ACEOF fi +if test "x${PBX_ROUND}" != "x1" -a "${USE_ROUND}" != "no"; then + pbxlibdir="" + if test "x${ROUND_DIR}" != "x"; then + if test -d ${ROUND_DIR}/lib; then + pbxlibdir="-L${ROUND_DIR}/lib" + else + pbxlibdir="-L${ROUND_DIR}" + fi + fi + pbxfuncname="round" + if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers + AST_ROUND_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_ROUND_FOUND=yes +else + AST_ROUND_FOUND=no +fi + + fi + + if test "${AST_ROUND_FOUND}" = "yes"; then + ROUND_LIB="-lm " + ROUND_HEADER_FOUND="1" + if test "x${ROUND_DIR}" != "x"; then + ROUND_LIB="${pbxlibdir} ${ROUND_LIB}" + ROUND_INCLUDE="-I${ROUND_DIR}/include" + saved_cppflags="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} -I${ROUND_DIR}/include" + if test "x" != "x" ; then + as_ac_Header=`echo "ac_cv_header_${ROUND_DIR}/include/" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for ${ROUND_DIR}/include/" >&5 +echo $ECHO_N "checking for ${ROUND_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 ${ROUND_DIR}/include/ usability" >&5 +echo $ECHO_N "checking ${ROUND_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 <${ROUND_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 ${ROUND_DIR}/include/ presence" >&5 +echo $ECHO_N "checking ${ROUND_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 <${ROUND_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: ${ROUND_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: ${ROUND_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: ${ROUND_DIR}/include/: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: ${ROUND_DIR}/include/: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: ${ROUND_DIR}/include/: present but cannot be compiled" >&5 +echo "$as_me: WARNING: ${ROUND_DIR}/include/: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: ${ROUND_DIR}/include/: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: ${ROUND_DIR}/include/: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: ${ROUND_DIR}/include/: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: ${ROUND_DIR}/include/: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: ${ROUND_DIR}/include/: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: ${ROUND_DIR}/include/: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: ${ROUND_DIR}/include/: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: ${ROUND_DIR}/include/: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: ${ROUND_DIR}/include/: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: ${ROUND_DIR}/include/: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ echo "$as_me:$LINENO: checking for ${ROUND_DIR}/include/" >&5 +echo $ECHO_N "checking for ${ROUND_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 + ROUND_HEADER_FOUND=1 +else + ROUND_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 + ROUND_HEADER_FOUND=1 +else + ROUND_HEADER_FOUND=0 +fi + + + fi + fi + if test "x${ROUND_HEADER_FOUND}" = "x0" ; then + ROUND_LIB="" + ROUND_INCLUDE="" + else + if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library + ROUND_LIB="" + fi + PBX_ROUND=1 + # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED + +cat >>confdefs.h <<_ACEOF +#define HAVE_ROUND 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define HAVE_ROUND_VERSION +_ACEOF + + fi + fi +fi + + +if test "x${PBX_TRUNC}" != "x1" -a "${USE_TRUNC}" != "no"; then + pbxlibdir="" + if test "x${TRUNC_DIR}" != "x"; then + if test -d ${TRUNC_DIR}/lib; then + pbxlibdir="-L${TRUNC_DIR}/lib" + else + pbxlibdir="-L${TRUNC_DIR}" + fi + fi + pbxfuncname="trunc" + if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers + AST_TRUNC_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_TRUNC_FOUND=yes +else + AST_TRUNC_FOUND=no +fi + + fi + + if test "${AST_TRUNC_FOUND}" = "yes"; then + TRUNC_LIB="-lm " + TRUNC_HEADER_FOUND="1" + if test "x${TRUNC_DIR}" != "x"; then + TRUNC_LIB="${pbxlibdir} ${TRUNC_LIB}" + TRUNC_INCLUDE="-I${TRUNC_DIR}/include" + saved_cppflags="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} -I${TRUNC_DIR}/include" + if test "x" != "x" ; then + as_ac_Header=`echo "ac_cv_header_${TRUNC_DIR}/include/" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for ${TRUNC_DIR}/include/" >&5 +echo $ECHO_N "checking for ${TRUNC_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 ${TRUNC_DIR}/include/ usability" >&5 +echo $ECHO_N "checking ${TRUNC_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 <${TRUNC_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 ${TRUNC_DIR}/include/ presence" >&5 +echo $ECHO_N "checking ${TRUNC_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 <${TRUNC_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: ${TRUNC_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: ${TRUNC_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: ${TRUNC_DIR}/include/: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: ${TRUNC_DIR}/include/: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: ${TRUNC_DIR}/include/: present but cannot be compiled" >&5 +echo "$as_me: WARNING: ${TRUNC_DIR}/include/: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: ${TRUNC_DIR}/include/: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: ${TRUNC_DIR}/include/: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: ${TRUNC_DIR}/include/: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: ${TRUNC_DIR}/include/: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: ${TRUNC_DIR}/include/: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: ${TRUNC_DIR}/include/: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: ${TRUNC_DIR}/include/: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: ${TRUNC_DIR}/include/: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: ${TRUNC_DIR}/include/: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: ${TRUNC_DIR}/include/: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ echo "$as_me:$LINENO: checking for ${TRUNC_DIR}/include/" >&5 +echo $ECHO_N "checking for ${TRUNC_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 + TRUNC_HEADER_FOUND=1 +else + TRUNC_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 + TRUNC_HEADER_FOUND=1 +else + TRUNC_HEADER_FOUND=0 +fi + + + fi + fi + if test "x${TRUNC_HEADER_FOUND}" = "x0" ; then + TRUNC_LIB="" + TRUNC_INCLUDE="" + else + if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library + TRUNC_LIB="" + fi + PBX_TRUNC=1 + # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED + +cat >>confdefs.h <<_ACEOF +#define HAVE_TRUNC 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define HAVE_TRUNC_VERSION +_ACEOF + + fi + fi +fi + + GSM_INTERNAL="yes" GSM_SYSTEM="yes" diff --git a/configure.ac b/configure.ac index 34173a64b..02aa6d1a8 100644 --- a/configure.ac +++ b/configure.ac @@ -447,10 +447,14 @@ AST_EXT_LIB_CHECK([EXP2L], [m], [exp2l]) AST_EXT_LIB_CHECK([LOG2L], [m], [log2l]) AST_EXT_LIB_CHECK([EXP10L], [m], [exp10l]) AST_EXT_LIB_CHECK([LOG10L], [m], [log10l]) +AST_EXT_LIB_CHECK([ROUNDL], [m], [roundl]) +AST_EXT_LIB_CHECK([TRUNCL], [m], [truncl]) AST_EXT_LIB_CHECK([EXP2], [m], [exp2]) AST_EXT_LIB_CHECK([LOG2], [m], [log2]) AST_EXT_LIB_CHECK([EXP10], [m], [exp10]) AST_EXT_LIB_CHECK([LOG10], [m], [log10]) +AST_EXT_LIB_CHECK([ROUND], [m], [round]) +AST_EXT_LIB_CHECK([TRUNC], [m], [trunc]) GSM_INTERNAL="yes" AC_SUBST(GSM_INTERNAL) diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in index b94d295a2..881556fd2 100644 --- a/include/asterisk/autoconfig.h.in +++ b/include/asterisk/autoconfig.h.in @@ -454,6 +454,18 @@ /* Define to 1 if you have the `rint' function. */ #undef HAVE_RINT +/* Define this to indicate the ${ROUND_DESCRIP} library */ +#undef HAVE_ROUND + +/* Define this to indicate the ${ROUNDL_DESCRIP} library */ +#undef HAVE_ROUNDL + +/* Define to indicate the ${ROUNDL_DESCRIP} library version */ +#undef HAVE_ROUNDL_VERSION + +/* Define to indicate the ${ROUND_DESCRIP} library version */ +#undef HAVE_ROUND_VERSION + /* Define if your system has the RTLD_NOLOAD headers. */ #undef HAVE_RTLD_NOLOAD @@ -654,6 +666,18 @@ /* Define to indicate the ${TONEZONE_DESCRIP} library version */ #undef HAVE_TONEZONE_VERSION +/* Define this to indicate the ${TRUNC_DESCRIP} library */ +#undef HAVE_TRUNC + +/* Define this to indicate the ${TRUNCL_DESCRIP} library */ +#undef HAVE_TRUNCL + +/* Define to indicate the ${TRUNCL_DESCRIP} library version */ +#undef HAVE_TRUNCL_VERSION + +/* Define to indicate the ${TRUNC_DESCRIP} library version */ +#undef HAVE_TRUNC_VERSION + /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H diff --git a/main/ast_expr2.c b/main/ast_expr2.c index a1b1e652b..77f0eb336 100644 --- a/main/ast_expr2.c +++ b/main/ast_expr2.c @@ -144,9 +144,10 @@ #include <sys/types.h> #include <stdio.h> -#ifdef STANDALONE /* I guess somewhere, the feature is set in the asterisk includes */ +/* Instead of looking for an arbitrary keyword, just test for various C99 function presence */ +#if (defined(HAVE_ROUNDL) || defined(HAVE_TRUNCL) || defined(HAVE_LOG10L) || defined(HAVE_LOG2L)) #ifndef __USE_ISOC99 -#define __USE_ISOC99 1 +#define __USE_ISOC99 #endif #endif @@ -166,33 +167,61 @@ #define FUNC_SQRT sqrtl #define FUNC_FLOOR floorl #define FUNC_CEIL ceill -#define FUNC_ROUND roundl #define FUNC_RINT rintl -#define FUNC_TRUNC truncl #define FUNC_EXP expl +#define FUNC_LOG logl +#define FUNC_REMAINDER remainderl + +#ifdef HAVE_ROUNDL +#define FUNC_ROUND roundl +#else /* HAVE_ROUNDL */ +#ifdef HAVE_ROUND +#define FUNC_ROUND round +#else /* HAVE_ROUND */ +#undef FUNC_ROUND +#endif /* HAVE_ROUND */ +#endif /* HAVE_ROUNDL */ + +#ifdef HAVE_TRUNCL +#define FUNC_TRUNC truncl +#else /* HAVE_TRUNCL */ +#ifdef HAVE_TRUNC +#define FUNC_TRUNC trunc +#else /* HAVE_TRUNC */ +#undef FUNC_TRUNC +#endif /* HAVE_TRUNC */ +#endif /* HAVE_TRUNCL */ + +/*! \note + * Oddly enough, some platforms have some ISO C99 functions, but not others, so + * we define the missing functions in terms of their mathematical identities. + */ #ifdef HAVE_EXP2L #define FUNC_EXP2 exp2l #else -#define FUNC_EXP2(x) expl((x) * logl(2)) +#define FUNC_EXP2(x) expl((x) * logl(2.0)) #endif + #ifdef HAVE_EXP10L #define FUNC_EXP10 exp10l #else -#define FUNC_EXP10(x) expl((x) * logl(10)) +#define FUNC_EXP10(x) expl((x) * logl(10.0)) #endif -#define FUNC_LOG logl + #ifdef HAVE_LOG2L #define FUNC_LOG2 log2l #else -#define FUNC_LOG2(x) (logl(x) / logl(2)) +#define FUNC_LOG2(x) (logl(x) / logl(2.0)) #endif + #ifdef HAVE_LOG10L #define FUNC_LOG10 log10l #else -#define FUNC_LOG10(x) (logl(x) / logl(10)) +#define FUNC_LOG10(x) (logl(x) / logl(10.0)) #endif -#define FUNC_REMAINDER remainderl -#else + +#else /* defined(__USE_ISOC99) */ + #define FP___PRINTF "%.16g" #define FP___FMOD fmod #define FP___STRTOD strtod @@ -208,34 +237,50 @@ #define FUNC_SQRT sqrt #define FUNC_FLOOR floor #define FUNC_CEIL ceil -#define FUNC_ROUND round #define FUNC_RINT rint -#define FUNC_TRUNC trunc #define FUNC_EXP exp +#define FUNC_LOG log +#define FUNC_REMAINDER remainder + +#ifdef HAVE_ROUND +#define FUNC_ROUND round +#else +#undef FUNC_ROUND +#endif + +#ifdef HAVE_TRUNC +#define FUNC_TRUNC round +#else +#undef FUNC_TRUNC +#endif + #ifdef HAVE_EXP2 #define FUNC_EXP2 exp2 #else -#define FUNC_EXP2(x) exp((x) * log(2)) +#define FUNC_EXP2(x) exp((x) * log(2.0)) #endif + #ifdef HAVE_EXP10 #define FUNC_EXP10 exp10 #else -#define FUNC_EXP10(x) exp((x) * log(10)) +#define FUNC_EXP10(x) exp((x) * log(10.0)) #endif -#define FUNC_LOG log + #ifdef HAVE_LOG2 #define FUNC_LOG2 log2 #else -#define FUNC_LOG2(x) (log(x) / log(2)) +#define FUNC_LOG2(x) (log(x) / log(2.0)) #endif + #ifdef HAVE_LOG10 #define FUNC_LOG10 log10 #else -#define FUNC_LOG10(x) (log(x) / log(10)) -#endif -#define FUNC_REMAINDER remainder +#define FUNC_LOG10(x) (log(x) / log(10.0)) #endif +#endif /* defined(__USE_ISOC99) */ + + #include <stdlib.h> #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -399,13 +444,13 @@ int ast_yyerror(const char *,YYLTYPE *, struct parse_io *); #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 260 "../main/ast_expr2.y" +#line 305 "../main/ast_expr2.y" { struct val *val; struct expr_node *arglist; } /* Line 187 of yacc.c. */ -#line 409 "../main/ast_expr2.c" +#line 454 "../main/ast_expr2.c" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -427,13 +472,13 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ -#line 265 "../main/ast_expr2.y" +#line 310 "../main/ast_expr2.y" extern int ast_yylex __P((YYSTYPE *, YYLTYPE *, yyscan_t)); /* Line 216 of yacc.c. */ -#line 437 "../main/ast_expr2.c" +#line 482 "../main/ast_expr2.c" #ifdef short # undef short @@ -729,9 +774,9 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 291, 291, 299, 306, 307, 316, 322, 323, 327, - 331, 335, 339, 343, 347, 351, 355, 359, 363, 367, - 371, 375, 379, 383, 387, 391, 395 + 0, 336, 336, 344, 351, 352, 361, 367, 368, 372, + 376, 380, 384, 388, 392, 396, 400, 404, 408, 412, + 416, 420, 424, 428, 432, 436, 440 }; #endif @@ -1384,114 +1429,114 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp) switch (yytype) { case 4: /* "TOK_COLONCOLON" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1390 "../main/ast_expr2.c" +#line 1435 "../main/ast_expr2.c" break; case 5: /* "TOK_COND" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1395 "../main/ast_expr2.c" +#line 1440 "../main/ast_expr2.c" break; case 6: /* "TOK_OR" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1400 "../main/ast_expr2.c" +#line 1445 "../main/ast_expr2.c" break; case 7: /* "TOK_AND" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1405 "../main/ast_expr2.c" +#line 1450 "../main/ast_expr2.c" break; case 8: /* "TOK_NE" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1410 "../main/ast_expr2.c" +#line 1455 "../main/ast_expr2.c" break; case 9: /* "TOK_LE" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1415 "../main/ast_expr2.c" +#line 1460 "../main/ast_expr2.c" break; case 10: /* "TOK_GE" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1420 "../main/ast_expr2.c" +#line 1465 "../main/ast_expr2.c" break; case 11: /* "TOK_LT" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1425 "../main/ast_expr2.c" +#line 1470 "../main/ast_expr2.c" break; case 12: /* "TOK_GT" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1430 "../main/ast_expr2.c" +#line 1475 "../main/ast_expr2.c" break; case 13: /* "TOK_EQ" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1435 "../main/ast_expr2.c" +#line 1480 "../main/ast_expr2.c" break; case 14: /* "TOK_MINUS" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1440 "../main/ast_expr2.c" +#line 1485 "../main/ast_expr2.c" break; case 15: /* "TOK_PLUS" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1445 "../main/ast_expr2.c" +#line 1490 "../main/ast_expr2.c" break; case 16: /* "TOK_MOD" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1450 "../main/ast_expr2.c" +#line 1495 "../main/ast_expr2.c" break; case 17: /* "TOK_DIV" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1455 "../main/ast_expr2.c" +#line 1500 "../main/ast_expr2.c" break; case 18: /* "TOK_MULT" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1460 "../main/ast_expr2.c" +#line 1505 "../main/ast_expr2.c" break; case 19: /* "TOK_COMPL" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1465 "../main/ast_expr2.c" +#line 1510 "../main/ast_expr2.c" break; case 20: /* "TOK_EQTILDE" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1470 "../main/ast_expr2.c" +#line 1515 "../main/ast_expr2.c" break; case 21: /* "TOK_COLON" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1475 "../main/ast_expr2.c" +#line 1520 "../main/ast_expr2.c" break; case 22: /* "TOK_LP" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1480 "../main/ast_expr2.c" +#line 1525 "../main/ast_expr2.c" break; case 23: /* "TOK_RP" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1485 "../main/ast_expr2.c" +#line 1530 "../main/ast_expr2.c" break; case 24: /* "TOKEN" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1490 "../main/ast_expr2.c" +#line 1535 "../main/ast_expr2.c" break; case 28: /* "expr" */ -#line 285 "../main/ast_expr2.y" +#line 330 "../main/ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1495 "../main/ast_expr2.c" +#line 1540 "../main/ast_expr2.c" break; default: @@ -1814,7 +1859,7 @@ yyreduce: switch (yyn) { case 2: -#line 291 "../main/ast_expr2.y" +#line 336 "../main/ast_expr2.y" { ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1); ((struct parse_io *)parseio)->val->type = (yyvsp[(1) - (1)].val)->type; if( (yyvsp[(1) - (1)].val)->type == AST_EXPR_number ) @@ -1826,7 +1871,7 @@ yyreduce: break; case 3: -#line 299 "../main/ast_expr2.y" +#line 344 "../main/ast_expr2.y" {/* nothing */ ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1); ((struct parse_io *)parseio)->val->type = AST_EXPR_string; ((struct parse_io *)parseio)->val->u.s = strdup(""); @@ -1834,12 +1879,12 @@ yyreduce: break; case 4: -#line 306 "../main/ast_expr2.y" +#line 351 "../main/ast_expr2.y" { (yyval.arglist) = alloc_expr_node(AST_EXPR_NODE_VAL); (yyval.arglist)->val = (yyvsp[(1) - (1)].val);;} break; case 5: -#line 307 "../main/ast_expr2.y" +#line 352 "../main/ast_expr2.y" {struct expr_node *x = alloc_expr_node(AST_EXPR_NODE_VAL); struct expr_node *t; DESTROY((yyvsp[(2) - (3)].val)); @@ -1849,7 +1894,7 @@ yyreduce: break; case 6: -#line 316 "../main/ast_expr2.y" +#line 361 "../main/ast_expr2.y" { (yyval.val) = op_func((yyvsp[(1) - (4)].val),(yyvsp[(3) - (4)].arglist), ((struct parse_io *)parseio)->chan); DESTROY((yyvsp[(2) - (4)].val)); DESTROY((yyvsp[(4) - (4)].val)); @@ -1859,12 +1904,12 @@ yyreduce: break; case 7: -#line 322 "../main/ast_expr2.y" +#line 367 "../main/ast_expr2.y" {(yyval.val) = (yyvsp[(1) - (1)].val);;} break; case 8: -#line 323 "../main/ast_expr2.y" +#line 368 "../main/ast_expr2.y" { (yyval.val) = (yyvsp[(2) - (3)].val); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; (yyloc).first_line=0; (yyloc).last_line=0; @@ -1872,7 +1917,7 @@ yyreduce: break; case 9: -#line 327 "../main/ast_expr2.y" +#line 372 "../main/ast_expr2.y" { (yyval.val) = op_or ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -1880,7 +1925,7 @@ yyreduce: break; case 10: -#line 331 "../main/ast_expr2.y" +#line 376 "../main/ast_expr2.y" { (yyval.val) = op_and ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -1888,7 +1933,7 @@ yyreduce: break; case 11: -#line 335 "../main/ast_expr2.y" +#line 380 "../main/ast_expr2.y" { (yyval.val) = op_eq ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -1896,7 +1941,7 @@ yyreduce: break; case 12: -#line 339 "../main/ast_expr2.y" +#line 384 "../main/ast_expr2.y" { (yyval.val) = op_gt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -1904,7 +1949,7 @@ yyreduce: break; case 13: -#line 343 "../main/ast_expr2.y" +#line 388 "../main/ast_expr2.y" { (yyval.val) = op_lt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -1912,7 +1957,7 @@ yyreduce: break; case 14: -#line 347 "../main/ast_expr2.y" +#line 392 "../main/ast_expr2.y" { (yyval.val) = op_ge ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -1920,7 +1965,7 @@ yyreduce: break; case 15: -#line 351 "../main/ast_expr2.y" +#line 396 "../main/ast_expr2.y" { (yyval.val) = op_le ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -1928,7 +1973,7 @@ yyreduce: break; case 16: -#line 355 "../main/ast_expr2.y" +#line 400 "../main/ast_expr2.y" { (yyval.val) = op_ne ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -1936,7 +1981,7 @@ yyreduce: break; case 17: -#line 359 "../main/ast_expr2.y" +#line 404 "../main/ast_expr2.y" { (yyval.val) = op_plus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -1944,7 +1989,7 @@ yyreduce: break; case 18: -#line 363 "../main/ast_expr2.y" +#line 408 "../main/ast_expr2.y" { (yyval.val) = op_minus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -1952,7 +1997,7 @@ yyreduce: break; case 19: -#line 367 "../main/ast_expr2.y" +#line 412 "../main/ast_expr2.y" { (yyval.val) = op_negate ((yyvsp[(2) - (2)].val)); DESTROY((yyvsp[(1) - (2)].val)); (yyloc).first_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column; @@ -1960,7 +2005,7 @@ yyreduce: break; case 20: -#line 371 "../main/ast_expr2.y" +#line 416 "../main/ast_expr2.y" { (yyval.val) = op_compl ((yyvsp[(2) - (2)].val)); DESTROY((yyvsp[(1) - (2)].val)); (yyloc).first_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column; @@ -1968,7 +2013,7 @@ yyreduce: break; case 21: -#line 375 "../main/ast_expr2.y" +#line 420 "../main/ast_expr2.y" { (yyval.val) = op_times ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -1976,7 +2021,7 @@ yyreduce: break; case 22: -#line 379 "../main/ast_expr2.y" +#line 424 "../main/ast_expr2.y" { (yyval.val) = op_div ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -1984,7 +2029,7 @@ yyreduce: break; case 23: -#line 383 "../main/ast_expr2.y" +#line 428 "../main/ast_expr2.y" { (yyval.val) = op_rem ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -1992,7 +2037,7 @@ yyreduce: break; case 24: -#line 387 "../main/ast_expr2.y" +#line 432 "../main/ast_expr2.y" { (yyval.val) = op_colon ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -2000,7 +2045,7 @@ yyreduce: break; case 25: -#line 391 "../main/ast_expr2.y" +#line 436 "../main/ast_expr2.y" { (yyval.val) = op_eqtilde ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -2008,7 +2053,7 @@ yyreduce: break; case 26: -#line 395 "../main/ast_expr2.y" +#line 440 "../main/ast_expr2.y" { (yyval.val) = op_cond ((yyvsp[(1) - (5)].val), (yyvsp[(3) - (5)].val), (yyvsp[(5) - (5)].val)); DESTROY((yyvsp[(2) - (5)].val)); DESTROY((yyvsp[(4) - (5)].val)); @@ -2018,7 +2063,7 @@ yyreduce: /* Line 1267 of yacc.c. */ -#line 2022 "../main/ast_expr2.c" +#line 2067 "../main/ast_expr2.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2238,7 +2283,7 @@ yyreturn: } -#line 402 "../main/ast_expr2.y" +#line 447 "../main/ast_expr2.y" static struct expr_node *alloc_expr_node(enum node_type nt) @@ -2641,6 +2686,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 FUNC_ROUND } else if (strcmp(funcname->u.s,"ROUND") == 0) { if (arglist && !arglist->right && arglist->val){ to_number(arglist->val); @@ -2650,6 +2696,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 /* defined(FUNC_ROUND) */ } else if (strcmp(funcname->u.s,"RINT") == 0) { if (arglist && !arglist->right && arglist->val){ to_number(arglist->val); @@ -2659,6 +2706,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 FUNC_TRUNC } else if (strcmp(funcname->u.s,"TRUNC") == 0) { if (arglist && !arglist->right && arglist->val){ to_number(arglist->val); @@ -2668,6 +2716,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 /* defined(FUNC_TRUNC) */ } else if (strcmp(funcname->u.s,"EXP") == 0) { if (arglist && !arglist->right && arglist->val){ to_number(arglist->val); diff --git a/main/ast_expr2.h b/main/ast_expr2.h index c5d84d2ac..e7aca623c 100644 --- a/main/ast_expr2.h +++ b/main/ast_expr2.h @@ -92,7 +92,7 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 260 "../main/ast_expr2.y" +#line 305 "../main/ast_expr2.y" { struct val *val; struct expr_node *arglist; diff --git a/main/ast_expr2.y b/main/ast_expr2.y index 5ba348867..3b698c477 100644 --- a/main/ast_expr2.y +++ b/main/ast_expr2.y @@ -15,9 +15,10 @@ #include <sys/types.h> #include <stdio.h> -#ifdef STANDALONE /* I guess somewhere, the feature is set in the asterisk includes */ +/* Instead of looking for an arbitrary keyword, just test for various C99 function presence */ +#if (defined(HAVE_ROUNDL) || defined(HAVE_TRUNCL) || defined(HAVE_LOG10L) || defined(HAVE_LOG2L)) #ifndef __USE_ISOC99 -#define __USE_ISOC99 1 +#define __USE_ISOC99 #endif #endif @@ -37,33 +38,61 @@ #define FUNC_SQRT sqrtl #define FUNC_FLOOR floorl #define FUNC_CEIL ceill -#define FUNC_ROUND roundl #define FUNC_RINT rintl -#define FUNC_TRUNC truncl #define FUNC_EXP expl +#define FUNC_LOG logl +#define FUNC_REMAINDER remainderl + +#ifdef HAVE_ROUNDL +#define FUNC_ROUND roundl +#else /* HAVE_ROUNDL */ +#ifdef HAVE_ROUND +#define FUNC_ROUND round +#else /* HAVE_ROUND */ +#undef FUNC_ROUND +#endif /* HAVE_ROUND */ +#endif /* HAVE_ROUNDL */ + +#ifdef HAVE_TRUNCL +#define FUNC_TRUNC truncl +#else /* HAVE_TRUNCL */ +#ifdef HAVE_TRUNC +#define FUNC_TRUNC trunc +#else /* HAVE_TRUNC */ +#undef FUNC_TRUNC +#endif /* HAVE_TRUNC */ +#endif /* HAVE_TRUNCL */ + +/*! \note + * Oddly enough, some platforms have some ISO C99 functions, but not others, so + * we define the missing functions in terms of their mathematical identities. + */ #ifdef HAVE_EXP2L #define FUNC_EXP2 exp2l #else -#define FUNC_EXP2(x) expl((x) * logl(2)) +#define FUNC_EXP2(x) expl((x) * logl(2.0)) #endif + #ifdef HAVE_EXP10L #define FUNC_EXP10 exp10l #else -#define FUNC_EXP10(x) expl((x) * logl(10)) +#define FUNC_EXP10(x) expl((x) * logl(10.0)) #endif -#define FUNC_LOG logl + #ifdef HAVE_LOG2L #define FUNC_LOG2 log2l #else -#define FUNC_LOG2(x) (logl(x) / logl(2)) +#define FUNC_LOG2(x) (logl(x) / logl(2.0)) #endif + #ifdef HAVE_LOG10L #define FUNC_LOG10 log10l #else -#define FUNC_LOG10(x) (logl(x) / logl(10)) +#define FUNC_LOG10(x) (logl(x) / logl(10.0)) #endif -#define FUNC_REMAINDER remainderl -#else + +#else /* defined(__USE_ISOC99) */ + #define FP___PRINTF "%.16g" #define FP___FMOD fmod #define FP___STRTOD strtod @@ -79,34 +108,50 @@ #define FUNC_SQRT sqrt #define FUNC_FLOOR floor #define FUNC_CEIL ceil -#define FUNC_ROUND round #define FUNC_RINT rint -#define FUNC_TRUNC trunc #define FUNC_EXP exp +#define FUNC_LOG log +#define FUNC_REMAINDER remainder + +#ifdef HAVE_ROUND +#define FUNC_ROUND round +#else +#undef FUNC_ROUND +#endif + +#ifdef HAVE_TRUNC +#define FUNC_TRUNC round +#else +#undef FUNC_TRUNC +#endif + #ifdef HAVE_EXP2 #define FUNC_EXP2 exp2 #else -#define FUNC_EXP2(x) exp((x) * log(2)) +#define FUNC_EXP2(x) exp((x) * log(2.0)) #endif + #ifdef HAVE_EXP10 #define FUNC_EXP10 exp10 #else -#define FUNC_EXP10(x) exp((x) * log(10)) +#define FUNC_EXP10(x) exp((x) * log(10.0)) #endif -#define FUNC_LOG log + #ifdef HAVE_LOG2 #define FUNC_LOG2 log2 #else -#define FUNC_LOG2(x) (log(x) / log(2)) +#define FUNC_LOG2(x) (log(x) / log(2.0)) #endif + #ifdef HAVE_LOG10 #define FUNC_LOG10 log10 #else -#define FUNC_LOG10(x) (log(x) / log(10)) -#endif -#define FUNC_REMAINDER remainder +#define FUNC_LOG10(x) (log(x) / log(10.0)) #endif +#endif /* defined(__USE_ISOC99) */ + + #include <stdlib.h> #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -801,6 +846,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 FUNC_ROUND } else if (strcmp(funcname->u.s,"ROUND") == 0) { if (arglist && !arglist->right && arglist->val){ to_number(arglist->val); @@ -810,6 +856,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 /* defined(FUNC_ROUND) */ } else if (strcmp(funcname->u.s,"RINT") == 0) { if (arglist && !arglist->right && arglist->val){ to_number(arglist->val); @@ -819,6 +866,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 FUNC_TRUNC } else if (strcmp(funcname->u.s,"TRUNC") == 0) { if (arglist && !arglist->right && arglist->val){ to_number(arglist->val); @@ -828,6 +876,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 /* defined(FUNC_TRUNC) */ } else if (strcmp(funcname->u.s,"EXP") == 0) { if (arglist && !arglist->right && arglist->val){ to_number(arglist->val); |