01c6c96de694798bce3d804404ed2dfdb665dda9
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / pixman / 0001-check-fe-divbyzero.patch
1 Add a check for FE_DIVBYZERO
2
3 Some architectures (namely Microblaze) do have fenv.h and
4 feenableexcept, but they don't have the FE_DIVBYZERO definition. This
5 patch adds a configure check for FE_DIVBYZERO, and only uses it if
6 it's available.
7
8 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
9
10 Index: b/configure.ac
11 ===================================================================
12 --- a/configure.ac
13 +++ b/configure.ac
14 @@ -838,6 +838,11 @@
15     AC_DEFINE(HAVE_FEENABLEEXCEPT, 1, [Whether we have feenableexcept()])
16  fi
17  
18 +AC_CHECK_DECL([FE_DIVBYZERO], [], [], [[#include <fenv.h>]])
19 +if test x$ac_cv_have_decl_FE_DIVBYZERO = xyes; then
20 +   AC_DEFINE(HAVE_FEDIVBYZERO, 1, [Whether we have FE_DIVBYZERO])
21 +fi
22 +
23  AC_CHECK_FUNC(gettimeofday, have_gettimeofday=yes, have_gettimeofday=no)
24  AC_CHECK_HEADER(sys/time.h, have_sys_time_h=yes, have_sys_time_h=no)
25  if test x$have_gettimeofday = xyes && test x$have_sys_time_h = xyes; then
26 Index: b/test/utils.c
27 ===================================================================
28 --- a/test/utils.c
29 +++ b/test/utils.c
30 @@ -776,9 +776,11 @@
31  {
32  #ifdef HAVE_FENV_H
33  #ifdef HAVE_FEENABLEEXCEPT
34 +#ifdef HAVE_FE_DIVBYZERO
35      feenableexcept (FE_DIVBYZERO);
36  #endif
37  #endif
38 +#endif
39  }
40  
41  void *