diff options
| author | Mark Pulford <mark@kyne.com.au> | 2011-08-11 19:46:36 +0930 |
|---|---|---|
| committer | Mark Pulford <mark@kyne.com.au> | 2011-08-11 19:46:36 +0930 |
| commit | 53baee1e33022fcba4d316b3952510c085173e02 (patch) | |
| tree | aed27e186b05a3bd8e5e2cec48095527fc29143c | |
| parent | 1fc923da45731b39e6aea9f50543cd7e8b0e4ad8 (diff) | |
| download | lua-cjson-53baee1e33022fcba4d316b3952510c085173e02.tar.gz lua-cjson-53baee1e33022fcba4d316b3952510c085173e02.tar.bz2 lua-cjson-53baee1e33022fcba4d316b3952510c085173e02.zip | |
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 <agentzh@gmail.com>
| -rw-r--r-- | Makefile | 3 | ||||
| -rw-r--r-- | README | 3 | ||||
| -rw-r--r-- | lua_cjson.c | 4 |
3 files changed, 10 insertions, 0 deletions
| @@ -15,6 +15,9 @@ LDFLAGS += -shared | |||
| 15 | LUA_INCLUDE_DIR ?= $(PREFIX)/include | 15 | LUA_INCLUDE_DIR ?= $(PREFIX)/include |
| 16 | LUA_LIB_DIR ?= $(PREFIX)/lib/lua/$(LUA_VERSION) | 16 | LUA_LIB_DIR ?= $(PREFIX)/lib/lua/$(LUA_VERSION) |
| 17 | 17 | ||
| 18 | # Some versions of Solaris are missing isinf(). Add -DMISSING_ISINF to | ||
| 19 | # CFLAGS to work around this bug. | ||
| 20 | |||
| 18 | #CFLAGS ?= -g -Wall -pedantic -fno-inline | 21 | #CFLAGS ?= -g -Wall -pedantic -fno-inline |
| 19 | CFLAGS ?= -g -O3 -Wall -pedantic | 22 | CFLAGS ?= -g -O3 -Wall -pedantic |
| 20 | override CFLAGS += -fpic -I$(LUA_INCLUDE_DIR) -DVERSION=\"$(CJSON_VERSION)\" | 23 | override CFLAGS += -fpic -I$(LUA_INCLUDE_DIR) -DVERSION=\"$(CJSON_VERSION)\" |
| @@ -51,6 +51,9 @@ Review and update the included Makefile to suit your platform. Then: | |||
| 51 | OR | 51 | OR |
| 52 | # cp cjson.so [your_module_directory] | 52 | # cp cjson.so [your_module_directory] |
| 53 | 53 | ||
| 54 | Note: Some Solaris platforms are missing isinf(). You can work around | ||
| 55 | this bug by adding -DMISSING_ISINF to CFLAGS in the Makefile. | ||
| 56 | |||
| 54 | 57 | ||
| 55 | RPM | 58 | RPM |
| 56 | --- | 59 | --- |
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 @@ | |||
| 44 | 44 | ||
| 45 | #include "strbuf.h" | 45 | #include "strbuf.h" |
| 46 | 46 | ||
| 47 | #ifdef MISSING_ISINF | ||
| 48 | #define isinf(x) (!isnan(x) && isnan((x) - (x))) | ||
| 49 | #endif | ||
| 50 | |||
| 47 | #define DEFAULT_SPARSE_CONVERT 0 | 51 | #define DEFAULT_SPARSE_CONVERT 0 |
| 48 | #define DEFAULT_SPARSE_RATIO 2 | 52 | #define DEFAULT_SPARSE_RATIO 2 |
| 49 | #define DEFAULT_SPARSE_SAFE 10 | 53 | #define DEFAULT_SPARSE_SAFE 10 |
