Commit 723e5099 authored by Chun-wei Fan's avatar Chun-wei Fan

gtk/fallback-c89.c: Add C89 fallback for trunc()

Check for trunc() during configure and provide a fallback implementation
for it if it is not found.
parent ab352767
......@@ -209,6 +209,11 @@
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if trunc() is available */
#if !defined (_MSC_VER) || (_MSC_VER >= 1800)
# define HAVE_TRUNC 1
#endif
/* Define to 1 if you have the <unistd.h> header file. */
#ifndef _MSC_VER
#define HAVE_UNISTD_H 1
......
......@@ -876,9 +876,10 @@ AC_CHECK_FUNCS(mallinfo)
AC_CHECK_FUNCS(getresuid)
AC_TYPE_UID_T
# Check for round(), rint(), isnan(), isinf() and nearbyint()
# Check for round(), rint(), isnan() and isinf()
# Check for log2(), exp2(), nearbyint() and trunc()
AC_CHECK_LIB(m,round,,)
AC_CHECK_FUNCS(round rint nearbyint sincos exp2 log2)
AC_CHECK_FUNCS(round rint nearbyint sincos exp2 log2 trunc)
AC_CHECK_DECLS([isnan, isinf], [], [], [[#include <math.h>]])
# Checks for gdkspawn
......
......@@ -106,3 +106,11 @@ exp2 (double x)
return pow (2.0, x);
}
#endif
#ifndef HAVE_TRUNC
static inline double
trunc (double x)
{
return (x > 0 ? floor (x) : ceil (x));
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment