From 53baee1e33022fcba4d316b3952510c085173e02 Mon Sep 17 00:00:00 2001 From: Mark Pulford Date: Thu, 11 Aug 2011 19:46:36 +0930 Subject: Add work around for missing isinf() on Solaris Some versions of Solaris (Eg, Solaris 11 / GCC 3.4.3) are missing isinf(). Provide a work around when MISSING_ISINF is defined. Reported by: Zhang "agentzh" Yichun --- Makefile | 3 +++ README | 3 +++ lua_cjson.c | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/Makefile b/Makefile index cfc7a74..d34ff6d 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,9 @@ LDFLAGS += -shared LUA_INCLUDE_DIR ?= $(PREFIX)/include LUA_LIB_DIR ?= $(PREFIX)/lib/lua/$(LUA_VERSION) +# Some versions of Solaris are missing isinf(). Add -DMISSING_ISINF to +# CFLAGS to work around this bug. + #CFLAGS ?= -g -Wall -pedantic -fno-inline CFLAGS ?= -g -O3 -Wall -pedantic override CFLAGS += -fpic -I$(LUA_INCLUDE_DIR) -DVERSION=\"$(CJSON_VERSION)\" diff --git a/README b/README index b849b92..d080ce3 100644 --- a/README +++ b/README @@ -51,6 +51,9 @@ Review and update the included Makefile to suit your platform. Then: OR # cp cjson.so [your_module_directory] +Note: Some Solaris platforms are missing isinf(). You can work around + this bug by adding -DMISSING_ISINF to CFLAGS in the Makefile. + RPM --- diff --git a/lua_cjson.c b/lua_cjson.c index b46e915..076c56f 100644 --- a/lua_cjson.c +++ b/lua_cjson.c @@ -44,6 +44,10 @@ #include "strbuf.h" +#ifdef MISSING_ISINF +#define isinf(x) (!isnan(x) && isnan((x) - (x))) +#endif + #define DEFAULT_SPARSE_CONVERT 0 #define DEFAULT_SPARSE_RATIO 2 #define DEFAULT_SPARSE_SAFE 10 -- cgit v1.2.3-55-g6feb