[Pixman] [PATCH v2] build: Ensure config.h does not undefine `sqrtf`
Peter TB Brett
peter at peter-b.co.uk
Mon Oct 10 13:26:30 UTC 2016
On Windows, `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
`pixman-compiler.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..5f57ea5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -932,9 +932,10 @@ 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()])],
+ [])
dnl =====================================
dnl Thread local storage
diff --git a/pixman/pixman-compiler.h b/pixman/pixman-compiler.h
index 2489adc..3b52101 100644
--- a/pixman/pixman-compiler.h
+++ b/pixman/pixman-compiler.h
@@ -71,6 +71,11 @@
# define M_PI 3.14159265358979323846
#endif
+#ifndef HAVE_SQRTF
+# define sqrtf sqrt
+#endif
+
+
#ifdef _MSC_VER
/* 'inline' is available only in C++ in MSVC */
# define inline __inline
More information about the Pixman
mailing list