[Pixman] [PATCH] build: Ensure config.h does not undefine `sqrtf`

Siarhei Siamashka siarhei.siamashka at gmail.com
Thu Oct 6 04:25:43 UTC 2016


On Mon, 26 Sep 2016 10:46:50 +0100
Peter TB Brett <peter at peter-b.co.uk> wrote:

> When compiling for Windows using MSVC, `sqrtf` is a macro.
> Previously, `configure` was detecting `sqrtf`'s availability, but then
> undefining it in `config.h`, resulting in link failures.
> 
> This patch modifies `configure` to use `HAVE_SQRTF` as a feature macro
> for the `sqrtf()` function, and adds an additional stanza to
> `config.h` which defines a suitable alternative when `HAVE_SQRTF` is
> not defined.
> 
> Signed-off-by: Peter TB Brett <peter.brett at livecode.com>
> 
> diff --git a/configure.ac b/configure.ac
> index e833e45..b70e32d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -932,9 +932,16 @@ fi
>    dnl =====================================
>    dnl Check for missing sqrtf() as, e.g., for Solaris 9
> 
> -AC_SEARCH_LIBS([sqrtf], [m], [],
> -               [AC_DEFINE([sqrtf], [sqrt],
> -                          [Define to sqrt if you do not have the 
> `sqrtf' function.])])
> +AC_SEARCH_LIBS([sqrtf], [m],
> +               [AC_DEFINE([HAVE_SQRTF], [1],
> +                          [Whether we have sqrtf()])],
> +               [])
> +
> +AH_VERBATIM([HAVE_SQRTF_MISSING],
> +            [/* If sqrtf() is missing, use sqrt(). */
> +#ifndef HAVE_SQRTF
> +#define sqrtf sqrt
> +#endif /* HAVE_SQRTF */])
> 
>    dnl =====================================
>    dnl Thread local storage

Thanks for posting the patch here.

As I asked in https://bugs.freedesktop.org/show_bug.cgi?id=97898
earlier, a bit more details would be very much welcome. Such as a
complete configure error report (then a relevant part of it may be
also included in the commit message).

There is just one thing that I don't quite understand. I'm not a
Windows person, but I believe that the MSVC compiler is not exactly
compatible with GCC command line options. And autotools generally
expect a GCC compatible compiler. So I'm quite curious about how
you managed to use autotools with the MSVC compiler for compiling
pixman.

Also if some other Windows user can confirm the bug and test your
fix, that would be perfect.

-- 
Best regards,
Siarhei Siamashka


More information about the Pixman mailing list