[Pixman] [PATCH] build: Ensure config.h does not undefine `sqrtf`
Peter TB Brett
peter at peter-b.co.uk
Mon Sep 26 09:46:50 UTC 2016
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
More information about the Pixman
mailing list