Jacek Caban : libport: Added isnan.

Alexandre Julliard julliard at winehq.org
Wed Oct 15 10:08:25 CDT 2008


Module: wine
Branch: master
Commit: 1715dcbb19237d81b2acbe260f577582a5ed9fce
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1715dcbb19237d81b2acbe260f577582a5ed9fce

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Oct 14 16:06:49 2008 -0500

libport: Added isnan.

---

 configure             |   60 +++++++++++++++++++++++++++++++++++++++++++++++++
 configure.ac          |    8 ++++++
 include/config.h.in   |    3 ++
 include/wine/port.h   |    4 +++
 libs/port/Makefile.in |    1 +
 libs/port/isnan.c     |   38 +++++++++++++++++++++++++++++++
 6 files changed, 114 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index 4f1443b..951ba68 100755
--- a/configure
+++ b/configure
@@ -22216,6 +22216,66 @@ _ACEOF
 
 fi
 
+{ echo "$as_me:$LINENO: checking for isnan" >&5
+echo $ECHO_N "checking for isnan... $ECHO_C" >&6; }
+if test "${ac_cv_have_isnan+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <math.h>
+int
+main ()
+{
+float f = 0.0; int i=isnan(f)
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_have_isnan="yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_have_isnan="no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_have_isnan" >&5
+echo "${ECHO_T}$ac_cv_have_isnan" >&6; }
+if test "$ac_cv_have_isnan" = "yes"
+then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ISNAN 1
+_ACEOF
+
+fi
+
 
 case $host_cpu in
   *i[3456789]86*) { echo "$as_me:$LINENO: checking whether we need to define __i386__" >&5
diff --git a/configure.ac b/configure.ac
index 5a942ce..cf5ae31 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1663,6 +1663,14 @@ then
     AC_DEFINE(HAVE_ISINF, 1, [Define to 1 if you have the `isinf' function.])
 fi
 
+dnl Check for isnan
+AC_CACHE_CHECK([for isnan], ac_cv_have_isnan,
+               AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[float f = 0.0; int i=isnan(f)]])],[ac_cv_have_isnan="yes"],[ac_cv_have_isnan="no"]))
+if test "$ac_cv_have_isnan" = "yes"
+then
+    AC_DEFINE(HAVE_ISNAN, 1, [Define to 1 if you have the `isnan' function.])
+fi
+
 dnl *** check for the need to define platform-specific symbols
 
 case $host_cpu in
diff --git a/include/config.h.in b/include/config.h.in
index 3566a94..016ee8e 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -258,6 +258,9 @@
 /* Define to 1 if you have the `isinf' function. */
 #undef HAVE_ISINF
 
+/* Define to 1 if you have the `isnan' function. */
+#undef HAVE_ISNAN
+
 /* Define to 1 if you have the <jack/jack.h> header file. */
 #undef HAVE_JACK_JACK_H
 
diff --git a/include/wine/port.h b/include/wine/port.h
index 4f58de8..4f9f8ab 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -303,6 +303,10 @@ pid_t gettid(void);
 int isinf(double x);
 #endif
 
+#ifndef HAVE_ISNAN
+int isnan(double x);
+#endif
+
 #ifndef HAVE_LSTAT
 int lstat(const char *file_name, struct stat *buf);
 #endif /* HAVE_LSTAT */
diff --git a/libs/port/Makefile.in b/libs/port/Makefile.in
index 1d048d0..68dc8f1 100644
--- a/libs/port/Makefile.in
+++ b/libs/port/Makefile.in
@@ -16,6 +16,7 @@ C_SRCS = \
 	gettid.c \
 	interlocked.c \
 	isinf.c \
+	isnan.c \
 	lstat.c \
 	memcpy_unaligned.c \
 	memmove.c \
diff --git a/libs/port/isnan.c b/libs/port/isnan.c
new file mode 100644
index 0000000..b2a1be6
--- /dev/null
+++ b/libs/port/isnan.c
@@ -0,0 +1,38 @@
+/*
+ * isnan function
+ *
+ * Copyright 2008 Jacek Caban for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+#include "wine/port.h"
+
+#ifndef HAVE_ISNAN
+
+#ifdef HAVE_IEEEFP_H
+#include <ieeefp.h>
+
+int isnan(double x)
+{
+  return isnand(x);
+}
+
+#else
+#error No isnan() implementation available.
+#endif
+
+#endif /* HAVE_ISNAN */




More information about the wine-cvs mailing list