Add check for C99 round function to configure, and define
a fallback function if round doesn't exist.
This commit is contained in:
parent
f498113f3f
commit
f253786a80
|
@ -22,6 +22,10 @@ functions and constants
|
||||||
extern double copysign(double, double);
|
extern double copysign(double, double);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_ROUND
|
||||||
|
extern double round(double);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_ACOSH
|
#ifndef HAVE_ACOSH
|
||||||
extern double acosh(double);
|
extern double acosh(double);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -69,6 +69,19 @@ copysign(double x, double y)
|
||||||
}
|
}
|
||||||
#endif /* HAVE_COPYSIGN */
|
#endif /* HAVE_COPYSIGN */
|
||||||
|
|
||||||
|
#ifndef HAVE_ROUND
|
||||||
|
double
|
||||||
|
round(double x)
|
||||||
|
{
|
||||||
|
double absx, y;
|
||||||
|
absx = fabs(x);
|
||||||
|
y = floor(absx);
|
||||||
|
if (absx - y >= 0.5)
|
||||||
|
y += 1.0;
|
||||||
|
return copysign(y, x);
|
||||||
|
}
|
||||||
|
#endif /* HAVE_ROUND */
|
||||||
|
|
||||||
#ifndef HAVE_LOG1P
|
#ifndef HAVE_LOG1P
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# From configure.in Revision: 71274 .
|
# From configure.in Revision: 71663 .
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.61 for python 3.1.
|
# Generated by GNU Autoconf 2.61 for python 3.1.
|
||||||
#
|
#
|
||||||
|
@ -22310,7 +22310,8 @@ fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for ac_func in acosh asinh atanh copysign expm1 finite hypot log1p
|
|
||||||
|
for ac_func in acosh asinh atanh copysign expm1 finite hypot log1p round
|
||||||
do
|
do
|
||||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
|
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||||
|
|
|
@ -3337,7 +3337,7 @@ then
|
||||||
[Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
|
[Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CHECK_FUNCS([acosh asinh atanh copysign expm1 finite hypot log1p])
|
AC_CHECK_FUNCS([acosh asinh atanh copysign expm1 finite hypot log1p round])
|
||||||
AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
|
AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
|
||||||
|
|
||||||
LIBS=$LIBS_SAVE
|
LIBS=$LIBS_SAVE
|
||||||
|
|
|
@ -521,6 +521,9 @@
|
||||||
/* Define if you have readline 4.0 */
|
/* Define if you have readline 4.0 */
|
||||||
#undef HAVE_RL_PRE_INPUT_HOOK
|
#undef HAVE_RL_PRE_INPUT_HOOK
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `round' function. */
|
||||||
|
#undef HAVE_ROUND
|
||||||
|
|
||||||
/* Define to 1 if you have the `select' function. */
|
/* Define to 1 if you have the `select' function. */
|
||||||
#undef HAVE_SELECT
|
#undef HAVE_SELECT
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue