[Pixman] [PATCH v2] test: add a check for FE_DIVBYZERO

Søren Sandmann soren.sandmann at gmail.com
Sun Feb 23 11:09:14 PST 2014


Hi,

This still doesn't correctly detect that my system has FE_DIVBYZERO,
probably because the macro you check for in utils.c is called
HAVE_FE_DIVBYZERO, but the one you set in autoconf.c is called
HAVE_FEDIVBYZERO (missing an underscore).

Since we'll need another revision of this anyway, I think I'd prefer if
we could be consistent with the other checks in autoconf.c and use the
action-if-yes and action-if-no arguments of AC_CHECK_DECL to set an
have_fe_divbyzero variable instead of relying on the ac_cv_ one.


Thanks,
Søren


Thomas Petazzoni <thomas.petazzoni at free-electrons.com> writes:

> Some architectures, such as Microblaze, currently do not implement
> FE_DIVBYZERO, even though they have <fenv.h> and
> feenableexcept(). This commit adds a configure.ac check to verify
> whether FE_DIVBYZERO is defined or not, and if not, disables the
> problematic code in test/utils.c.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
>
> ---
> Changes v1 -> v2:
>
>  * Use the ac_cv_have_decl_FE_DIVBYZERO variable, which is
>    automatically set by AC_CHECK_DECL, to decide whether or not
>    HAVE_FEDIVBYZERO should be defined.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
> ---
>  configure.ac | 5 +++++
>  test/utils.c | 2 ++
>  2 files changed, 7 insertions(+)
>
> diff --git a/configure.ac b/configure.ac
> index 6327972..7564b29 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -891,6 +891,11 @@ if test x$have_feenableexcept = xyes; then
>     AC_DEFINE(HAVE_FEENABLEEXCEPT, 1, [Whether we have feenableexcept()])
>  fi
>  
> +AC_CHECK_DECL([FE_DIVBYZERO], [], [], [[#include <fenv.h>]])
> +if test x$ac_cv_have_decl_FE_DIVBYZERO = xyes; then
> +   AC_DEFINE(HAVE_FEDIVBYZERO, 1, [Whether we have FE_DIVBYZERO])
> +fi
> +
>  AC_CHECK_FUNC(gettimeofday, have_gettimeofday=yes, have_gettimeofday=no)
>  AC_CHECK_HEADER(sys/time.h, have_sys_time_h=yes, have_sys_time_h=no)
>  if test x$have_gettimeofday = xyes && test x$have_sys_time_h = xyes; then
> diff --git a/test/utils.c b/test/utils.c
> index 1888417..c973939 100644
> --- a/test/utils.c
> +++ b/test/utils.c
> @@ -844,9 +844,11 @@ enable_divbyzero_exceptions (void)
>  {
>  #ifdef HAVE_FENV_H
>  #ifdef HAVE_FEENABLEEXCEPT
> +#ifdef HAVE_FE_DIVBYZERO
>      feenableexcept (FE_DIVBYZERO);
>  #endif
>  #endif
> +#endif
>  }
>  
>  void *


More information about the Pixman mailing list