1diff --git a/Zend/configure.ac b/Zend/configure.ac
2index b95c1360b8..fe16c86007 100644
3--- a/Zend/configure.ac
4+++ b/Zend/configure.ac
5@@ -60,7 +60,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
6 #include <math.h>
7
8 #ifndef zend_isnan
9-#if HAVE_DECL_ISNAN && (!defined(__cplusplus) || __cplusplus < 201103L)
10+#if HAVE_DECL_ISNAN && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L)
11 #define zend_isnan(a) isnan(a)
12 #elif defined(HAVE_FPCLASS)
13 #define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
14@@ -69,7 +69,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
15 #endif
16 #endif
17
18-#if HAVE_DECL_ISINF && (!defined(__cplusplus) || __cplusplus < 201103L)
19+#if HAVE_DECL_ISINF && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L)
20 #define zend_isinf(a) isinf(a)
21 #elif defined(INFINITY)
22 /* Might not work, but is required by ISO C99 */
23@@ -80,7 +80,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
24 #define zend_isinf(a) 0
25 #endif
26
27-#if HAVE_DECL_ISFINITE && (!defined(__cplusplus) || __cplusplus < 201103L)
28+#if HAVE_DECL_ISFINITE && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L)
29 #define zend_finite(a) isfinite(a)
30 #elif defined(HAVE_FINITE)
31 #define zend_finite(a) finite(a)
32diff --git a/configure.ac b/configure.ac
33index d3f3cacd07..ddbf712ba2 100644
34--- a/configure.ac
35+++ b/configure.ac
36@@ -68,7 +68,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
37 #include <math.h>
38
39 #ifndef zend_isnan
40-#if HAVE_DECL_ISNAN && (!defined(__cplusplus) || __cplusplus < 201103L)
41+#if HAVE_DECL_ISNAN && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L)
42 #define zend_isnan(a) isnan(a)
43 #elif defined(HAVE_FPCLASS)
44 #define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
45@@ -77,7 +77,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
46 #endif
47 #endif
48
49-#if HAVE_DECL_ISINF && (!defined(__cplusplus) || __cplusplus < 201103L)
50+#if HAVE_DECL_ISINF && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L)
51 #define zend_isinf(a) isinf(a)
52 #elif defined(INFINITY)
53 /* Might not work, but is required by ISO C99 */
54@@ -88,7 +88,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
55 #define zend_isinf(a) 0
56 #endif
57
58-#if HAVE_DECL_ISFINITE && (!defined(__cplusplus) || __cplusplus < 201103L)
59+#if HAVE_DECL_ISFINITE && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L)
60 #define zend_finite(a) isfinite(a)
61 #elif defined(HAVE_FINITE)
62 #define zend_finite(a) finite(a)