Commit 91343251 authored by Chun-wei Fan's avatar Chun-wei Fan

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

fmin() is a function that is introduced with C99/C++11, so check for the
presence of it and provide a simple implementation for it if it does not
exist.

Also update the config.h.win32.in template accordingly, since this
function is provided on Visual Studio 2013 or later.
parent ecd6b0b9
Pipeline #240998 passed with stages
in 38 minutes and 31 seconds
......@@ -44,6 +44,9 @@
/* Define to 1 if you have the `flockfile' function. */
#mesondefine HAVE_FLOCKFILE
/* Define to 1 if you have the `fmin' function. */
#mesondefine HAVE_FMIN
/* Define to 1 if you have the <ftw.h> header file. */
#mesondefine HAVE_FTW_H
......
......@@ -52,6 +52,11 @@
/* Define to 1 if you have the `flockfile' function. */
#undef HAVE_FLOCKFILE
/* Define to 1 if you have the `fmin' function. */
#if !defined (_MSC_VER) || (_MSC_VER >= 1800)
# define HAVE_FMIN 1
#endif
/* Define to 1 if you have the <ftw.h> header file. */
/* #undef HAVE_FTW_H */
......
......@@ -843,7 +843,7 @@ AC_TYPE_UID_T
# 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 trunc)
AC_CHECK_FUNCS(round rint nearbyint sincos exp2 log2 trunc fmin)
AC_CHECK_DECLS([isnan, isinf], [], [], [[#include <math.h>]])
AC_MSG_CHECKING(whether to build dynamic modules)
......
......@@ -126,3 +126,11 @@ isnan (double x)
return _isnan (x);
}
#endif
#ifndef HAVE_FMIN
static inline double
fmin (double x, double y)
{
return x < y ? x : y;
}
#endif
......@@ -48,7 +48,7 @@
#include "gtkprogresstrackerprivate.h"
#include "gtksettingsprivate.h"
#include <math.h>
#include "fallback-c89.c"
/**
* SECTION:gtkscrolledwindow
......
......@@ -252,6 +252,7 @@ check_functions = [
'sincos',
'trunc',
'localtime_r',
'fmin',
]
foreach func : check_functions
......
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