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.
This commit is contained in:
@ -209,6 +209,11 @@
|
|||||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||||
#define HAVE_SYS_TYPES_H 1
|
#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. */
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
#define HAVE_UNISTD_H 1
|
#define HAVE_UNISTD_H 1
|
||||||
|
|||||||
@ -876,9 +876,10 @@ AC_CHECK_FUNCS(mallinfo)
|
|||||||
AC_CHECK_FUNCS(getresuid)
|
AC_CHECK_FUNCS(getresuid)
|
||||||
AC_TYPE_UID_T
|
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_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>]])
|
AC_CHECK_DECLS([isnan, isinf], [], [], [[#include <math.h>]])
|
||||||
|
|
||||||
# Checks for gdkspawn
|
# Checks for gdkspawn
|
||||||
|
|||||||
@ -106,3 +106,11 @@ exp2 (double x)
|
|||||||
return pow (2.0, x);
|
return pow (2.0, x);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_TRUNC
|
||||||
|
static inline double
|
||||||
|
trunc (double x)
|
||||||
|
{
|
||||||
|
return (x > 0 ? floor (x) : ceil (x));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user