libport: Fix the detection of isfinite().

Francois Gouget fgouget at free.fr
Thu Dec 5 04:31:20 CST 2013


---

It's necessary to define _GNU_SOURCE to get the isfinite() macro with 
gcc 2.95. The problem is that autoconf was not defining that macro but 
port.h is, thus leading to macro redefinition errors.

 configure           | 3 +++
 configure.ac        | 5 ++++-
 include/wine/port.h | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 6615428..a2f43b5 100755
--- a/configure
+++ b/configure
@@ -15785,6 +15785,9 @@ if ${ac_cv_have_isfinite+:} false; then :
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
 #include <math.h>
 int
 main ()
diff --git a/configure.ac b/configure.ac
index 9f982f1..1bd72b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2548,7 +2548,10 @@ dnl Check for isfinite
 ac_save_LIBS="$LIBS"
 LIBS="$LIBS -lm"
 AC_CACHE_CHECK([for isfinite], ac_cv_have_isfinite,
-               AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[float f = 0.0; return isfinite(f)]])],[ac_cv_have_isfinite="yes"],[ac_cv_have_isfinite="no"]))
+               AC_LINK_IFELSE([AC_LANG_PROGRAM([[#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+#include <math.h>]], [[float f = 0.0; return isfinite(f)]])],[ac_cv_have_isfinite="yes"],[ac_cv_have_isfinite="no"]))
 if test "$ac_cv_have_isfinite" = "yes"
 then
     AC_DEFINE(HAVE_ISFINITE, 1, [Define to 1 if you have the `isfinite' function.])
diff --git a/include/wine/port.h b/include/wine/port.h
index 406f190..3548a44 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -30,7 +30,7 @@
 #endif
 
 #ifndef _GNU_SOURCE
-# define _GNU_SOURCE  /* for pread/pwrite */
+# define _GNU_SOURCE  /* for pread/pwrite, isfinite */
 #endif
 #include <fcntl.h>
 #include <math.h>
-- 
1.8.4.3




More information about the wine-patches mailing list