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 <[email protected]>

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

_______________________________________________
Pixman mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/pixman

Reply via email to