diff options
| author | ruki <[email protected]> | 2021-06-30 22:40:57 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-06-30 22:40:57 +0800 |
| commit | 88ab7bebc40bc91bbfd91b565be2236ebd8c5e72 (patch) | |
| tree | a7fb4c94856f5381a8fb1fb4142e48162879c28d | |
| parent | 46fd1844fc7a5456c4cd56bc2c251ed635d037ca (diff) | |
use system lua-cjson
| -rw-r--r-- | core/detect/lua-cjson.c | 7 | ||||
| -rw-r--r-- | core/makefile | 1 | ||||
| -rw-r--r-- | core/src/demo/makefile | 11 | ||||
| -rw-r--r-- | core/src/lua-cjson/makefile | 8 |
4 files changed, 14 insertions, 13 deletions
diff --git a/core/detect/lua-cjson.c b/core/detect/lua-cjson.c new file mode 100644 index 000000000..8e9d36ccd --- /dev/null +++ b/core/detect/lua-cjson.c @@ -0,0 +1,7 @@ +int luaopen_cjson(void *l); + +int main() +{ + luaopen_cjson(0); + return 0; +} diff --git a/core/makefile b/core/makefile index a6b9a82e4..fb41dfc82 100644 --- a/core/makefile +++ b/core/makefile @@ -278,6 +278,7 @@ base_LIBNAMES := base_LIBNAMES += $(shell if { cat detect/curses.c | $(CC) -xc - -lcurses -ltinfo -o /dev/null 2>/dev/null; }; then echo curses tinfo; fi ) base_LIBNAMES += $(shell if { cat detect/readline.c | $(CC) -xc - -lreadline -o /dev/null 2>/dev/null; }; then echo readline; fi ) base_LIBNAMES += $(shell if { cat detect/tbox.c | $(CC) -xc - -ltbox -o /dev/null 2>/dev/null; }; then echo tbox; fi ) +base_LIBNAMES += $(shell if { cat detect/lua-cjson.c | $(CC) -xc - -llua5.1-cjson -lluajit-5.1 -o /dev/null 2>/dev/null; }; then echo lua5.1-cjson; fi ) ifeq ($(LUAJIT_SYSTEM),y) base_LIBNAMES += $(shell if { cat detect/luajit.c | $(CC) -xc - $(shell pkg-config --libs --cflags luajit) -o /dev/null 2>/dev/null; }; then echo luajit-5.1; fi ) endif diff --git a/core/src/demo/makefile b/core/src/demo/makefile index 63c6abcef..37b06ad98 100644 --- a/core/src/demo/makefile +++ b/core/src/demo/makefile @@ -40,14 +40,9 @@ demo_INC_DIRS += $(SV_INC_DIRS) demo_LIB_DIRS += $(SV_LIB_DIRS) # lua-cjson -ifndef LUA_CJSON_LIBS -LUA_CJSON_LIBS := lua-cjson$(DTYPE) -endif -ifndef LUA_CJSON_LIB_DIRS -LUA_CJSON_LIB_DIRS := ../lua-cjson -endif -demo_LIBS += $(LUA_CJSON_LIBS) -demo_LIB_DIRS += $(LUA_CJSON_LIB_DIRS) +lua-cjson_LIBS := $(if $(findstring cjson,$(base_LIBNAMES)),,lua-cjson$(DTYPE)) +demo_LIBS += $(lua-cjson_LIBS) +demo_LIB_DIRS += ../lua-cjson demo_LIBS += $(BASE_LIBS) diff --git a/core/src/lua-cjson/makefile b/core/src/lua-cjson/makefile index 8a95507ba..9e96851ae 100644 --- a/core/src/lua-cjson/makefile +++ b/core/src/lua-cjson/makefile @@ -25,11 +25,9 @@ lua-cjson_CFLAGS += -DNDEBUG -DUSE_INTERNAL_FPCONV lua-cjson_INC_DIRS += \ ../luajit/luajit/src -# use given lua-cjson library? -ifdef LUA_CJSON_LIBS -lua-cjson_C_FILES := -lua-cjson_INC_DIRS := -endif +# use given system library? +lua-cjson_C_FILES := $(if $(findstring cjson,$(base_LIBNAMES)),,$(lua-cjson_C_FILES)) +lua-cjson_INC_FILES := $(if $(findstring cjson,$(base_LIBNAMES)),,$(lua-cjson_INC_FILES)) # suffix include $(PRO_DIR)/suffix.mak |
