Add builtin roundf() for systems lacking it.

(closes issue ASTERISK-16854)
Review: https://reviewboard.asterisk.org/r/2276
Reported-by: Ovidiu Sas
........

Merged revisions 379547 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 379548 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@379549 65c4cc65-6c06-0410-ace0-fbb531ad65f3
changes/78/78/1
Walter Doekes 13 years ago
parent 01763fd41b
commit e6a3674150

510
configure vendored

File diff suppressed because it is too large Load Diff

@ -597,7 +597,7 @@ AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll
# so that AC_CHECK_FUNCS can detect functions in that library. # so that AC_CHECK_FUNCS can detect functions in that library.
AC_CHECK_LIB([m], [sqrt]) AC_CHECK_LIB([m], [sqrt])
# BSD might not have exp2, and/or log2 # BSD might not have exp2, and/or log2
AC_CHECK_FUNCS([exp2 log2 exp10 log10 sin cos tan asin acos atan atan2 pow rint exp log remainder fmod round trunc floor ceil]) AC_CHECK_FUNCS([exp2 log2 exp10 log10 sin cos tan asin acos atan atan2 pow rint exp log remainder fmod round roundf trunc floor ceil])
# Certain architectures don't really have long double, even though # Certain architectures don't really have long double, even though
# AC_CHECK_FUNCS would otherwise find the following functions. # AC_CHECK_FUNCS would otherwise find the following functions.

@ -702,6 +702,9 @@
/* Define to 1 if you have the `round' function. */ /* Define to 1 if you have the `round' function. */
#undef HAVE_ROUND #undef HAVE_ROUND
/* Define to 1 if you have the `roundf' function. */
#undef HAVE_ROUNDF
/* Define to 1 if you have the `roundl' function. */ /* Define to 1 if you have the `roundl' function. */
#undef HAVE_ROUNDL #undef HAVE_ROUNDL

@ -216,4 +216,12 @@ typedef unsigned long long uint64_t;
#define MY_GLOB_FLAGS (GLOB_NOMAGIC | GLOB_BRACE) #define MY_GLOB_FLAGS (GLOB_NOMAGIC | GLOB_BRACE)
#endif #endif
#ifndef HAVE_ROUNDF
#ifdef HAVE_ROUND
#define roundf(x) ((float)round(x))
#else
float roundf(float x);
#endif
#endif
#endif #endif

@ -17,6 +17,8 @@
/*! \file /*! \file
* *
* \brief Compatibility functions for strsep and strtoq missing on Solaris * \brief Compatibility functions for strsep and strtoq missing on Solaris
*
* .. and lots of other functions too.
*/ */
/*** MODULEINFO /*** MODULEINFO
@ -568,3 +570,15 @@ char *mkdtemp(char *path)
return mktemp_internal(path, 0, MKTEMP_DIR) ? NULL : path; return mktemp_internal(path, 0, MKTEMP_DIR) ? NULL : path;
} }
#endif #endif
#ifndef HAVE_ROUNDF
#ifndef HAVE_ROUND
float roundf(float x) {
if (x < 0.0) {
return (float)(int)((x) - 0.5);
} else {
return (float)(int)((x) + 0.5);
}
}
#endif
#endif

Loading…
Cancel
Save