d3dx9_36: Provide a replacement for signbit() if it is missing.

Francois Gouget fgouget at codeweavers.com
Mon Jul 11 11:31:20 CDT 2011


This fixes compilation on Solaris 10u9 with gcc 3.4.3.
---
 configure           |   34 ++++++++++++++++++++++++++++++++++
 configure.ac        |   10 ++++++++++
 include/config.h.in |    3 +++
 include/wine/port.h |    4 ++++
 4 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index eb3c1bf..3073ff2 100755
--- a/configure
+++ b/configure
@@ -13167,6 +13167,40 @@ if test "$ac_res" != no; then :
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for signbit" >&5
+$as_echo_n "checking for signbit... " >&6; }
+if ${wine_cv_have_signbit+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <math.h>
+int
+main ()
+{
+signbit(0.0f);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  wine_cv_have_signbit=yes
+else
+  wine_cv_have_signbit=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wine_cv_have_signbit" >&5
+$as_echo "$wine_cv_have_signbit" >&6; }
+if test "$wine_cv_have_signbit" = "yes"
+then
+
+$as_echo "#define HAVE_SIGNBIT 1" >>confdefs.h
+
+fi
+
+
 for ac_func in \
 	getaddrinfo \
 	getnameinfo \
diff --git a/configure.ac b/configure.ac
index b50d5ed..eb9766e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2037,6 +2037,16 @@ AC_SEARCH_LIBS(connect, socket)
 dnl Check for -lresolv for Solaris
 AC_SEARCH_LIBS(inet_aton, resolv)
 
+dnl **** Check for signbit() which may be missing on Solaris.
+AC_CACHE_CHECK([for signbit],wine_cv_have_signbit,
+                AC_LINK_IFELSE([AC_LANG_PROGRAM(
+[[#include <math.h>]], [[signbit(0.0f);]])],[wine_cv_have_signbit=yes],[wine_cv_have_signbit=no]))
+if test "$wine_cv_have_signbit" = "yes"
+then
+  AC_DEFINE(HAVE_SIGNBIT, 1, [Define to 1 if you have the `signbit' function.])
+fi
+
+
 dnl **** Check for functions which may rely on -lsocket on Solaris.
 AC_CHECK_FUNCS(\
 	getaddrinfo \
diff --git a/include/config.h.in b/include/config.h.in
index 04507e0..ba10b62 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -737,6 +737,9 @@
 /* Define to 1 if `si_fd' is a member of `siginfo_t'. */
 #undef HAVE_SIGINFO_T_SI_FD
 
+/* Define to 1 if you have the `signbit' function. */
+#undef HAVE_SIGNBIT
+
 /* Define to 1 if you have the `sigprocmask' function. */
 #undef HAVE_SIGPROCMASK
 
diff --git a/include/wine/port.h b/include/wine/port.h
index 8281653..bfa4e41 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -292,6 +292,10 @@ ssize_t pwrite( int fd, const void *buf, size_t count, off_t offset );
 int readlink( const char *path, char *buf, size_t size );
 #endif /* HAVE_READLINK */
 
+#ifndef HAVE_SIGNBIT
+#define signbit(x) (copysign(1, (x)) < 0)
+#endif /* !defined(HAVE_SIGNBIT) */
+
 #ifndef HAVE_STATVFS
 int statvfs( const char *path, struct statvfs *buf );
 #endif
-- 
1.7.5.4



More information about the wine-patches mailing list