summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 467724e)
raw | patch | inline | side by side (parent: 467724e)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 30 Dec 2010 11:28:13 +0000 (12:28 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 30 Dec 2010 11:28:13 +0000 (12:28 +0100) |
Solaris and FreeBSD have problems with it for different reasons. The
huge NAN-block from "collectd.h" has been imported again, instead.
huge NAN-block from "collectd.h" has been imported again, instead.
configure.in | patch | blob | history | |
src/collectd-nagios.c | patch | blob | history | |
src/collectdctl.c | patch | blob | history |
diff --git a/configure.in b/configure.in
index 985e8482d39c8b7b000fac16e779ea9c921e32fd..63402f2afb97a11d51cd2b9195f46e42503e32ad 100644 (file)
--- a/configure.in
+++ b/configure.in
[[
#include <stdlib.h>
#include <math.h>
-static float foo = NAN;
+static double foo = NAN;
]],
[[
if (isnan (foo))
#include <stdlib.h>
#define __USE_ISOC99 1
#include <math.h>
-static float foo = NAN;
+static double foo = NAN;
]],
[[
if (isnan (foo))
#ifndef isnan
# define isnan(f) ((f) != (f))
#endif
-static float foo = NAN;
+static double foo = NAN;
]],
[[
if (isnan (foo))
diff --git a/src/collectd-nagios.c b/src/collectd-nagios.c
index b3c1855aba2be7d98a3c112b62b5ddbebe33f609..af8744de6da58353d0c47d69381fc6acec664b7b 100644 (file)
--- a/src/collectd-nagios.c
+++ b/src/collectd-nagios.c
# include "config.h"
#endif
-#ifndef _ISOC99_SOURCE
-# define _ISOC99_SOURCE
-#endif
-
-#ifndef _POSIX_C_SOURCE
-# define _POSIX_C_SOURCE 200112L
-#endif
-
-#ifndef _XOPEN_SOURCE
-# define _XOPEN_SOURCE 600
-#endif
-
#if !defined(__GNUC__) || !__GNUC__
# define __attribute__(x) /**/
#endif
#include <string.h>
#include <strings.h>
#include <assert.h>
-#include <math.h>
+
+#if NAN_STATIC_DEFAULT
+# include <math.h>
+/* #endif NAN_STATIC_DEFAULT*/
+#elif NAN_STATIC_ISOC
+# ifndef __USE_ISOC99
+# define DISABLE_ISOC99 1
+# define __USE_ISOC99 1
+# endif /* !defined(__USE_ISOC99) */
+# include <math.h>
+# if DISABLE_ISOC99
+# undef DISABLE_ISOC99
+# undef __USE_ISOC99
+# endif /* DISABLE_ISOC99 */
+/* #endif NAN_STATIC_ISOC */
+#elif NAN_ZERO_ZERO
+# include <math.h>
+# ifdef NAN
+# undef NAN
+# endif
+# define NAN (0.0 / 0.0)
+# ifndef isnan
+# define isnan(f) ((f) != (f))
+# endif /* !defined(isnan) */
+# ifndef isfinite
+# define isfinite(f) (((f) - (f)) == 0.0)
+# endif
+# ifndef isinf
+# define isinf(f) (!isfinite(f) && !isnan(f))
+# endif
+#endif /* NAN_ZERO_ZERO */
#include "libcollectdclient/client.h"
diff --git a/src/collectdctl.c b/src/collectdctl.c
index e1091cc6467a5669d4e9aee2e2d5dfa30d9ff730..3bd8f0410f846ddf21130bf93ac8059555a7c269 100644 (file)
--- a/src/collectdctl.c
+++ b/src/collectdctl.c
# include "config.h"
#endif
-#ifndef _ISOC99_SOURCE
-# define _ISOC99_SOURCE
-#endif
-
-#ifndef _POSIX_C_SOURCE
-# define _POSIX_C_SOURCE 200112L
-#endif
-
-#ifndef _XOPEN_SOURCE
-# define _XOPEN_SOURCE 600
-#endif
-
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <assert.h>
#include <errno.h>
-#include <math.h>
-#include "libcollectdclient/client.h"
+#if NAN_STATIC_DEFAULT
+# include <math.h>
+/* #endif NAN_STATIC_DEFAULT*/
+#elif NAN_STATIC_ISOC
+# ifndef __USE_ISOC99
+# define DISABLE_ISOC99 1
+# define __USE_ISOC99 1
+# endif /* !defined(__USE_ISOC99) */
+# include <math.h>
+# if DISABLE_ISOC99
+# undef DISABLE_ISOC99
+# undef __USE_ISOC99
+# endif /* DISABLE_ISOC99 */
+/* #endif NAN_STATIC_ISOC */
+#elif NAN_ZERO_ZERO
+# include <math.h>
+# ifdef NAN
+# undef NAN
+# endif
+# define NAN (0.0 / 0.0)
+# ifndef isnan
+# define isnan(f) ((f) != (f))
+# endif /* !defined(isnan) */
+# ifndef isfinite
+# define isfinite(f) (((f) - (f)) == 0.0)
+# endif
+# ifndef isinf
+# define isinf(f) (!isfinite(f) && !isnan(f))
+# endif
+#endif /* NAN_ZERO_ZERO */
+#include "libcollectdclient/client.h"
#define DEFAULT_SOCK LOCALSTATEDIR"/run/"PACKAGE_NAME"-unixsock"