summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-06-30 22:45:42 +0800
committerruki <[email protected]>2021-06-30 22:45:42 +0800
commitd1ff269e0ed663f4def9dcc762aee23ddbf85064 (patch)
tree22c19928d742b613af6155315bd40ef4e2f2e793
parent445ac813e8ee62935bae9c7efb2ad25ed26cc5c6 (diff)
use system sv
-rw-r--r--core/detect/sv.c7
-rw-r--r--core/makefile1
-rw-r--r--core/src/demo/makefile16
-rw-r--r--core/src/sv/makefile8
4 files changed, 15 insertions, 17 deletions
diff --git a/core/detect/sv.c b/core/detect/sv.c
new file mode 100644
index 000000000..20a071557
--- /dev/null
+++ b/core/detect/sv.c
@@ -0,0 +1,7 @@
+#include <semver.h>
+
+int main()
+{
+ semvern(0, 0, 0);
+ return 0;
+}
diff --git a/core/makefile b/core/makefile
index fb41dfc82..0bba754cd 100644
--- a/core/makefile
+++ b/core/makefile
@@ -279,6 +279,7 @@ base_LIBNAMES += $(shell if { cat detect/curses.c | $(CC) -xc - -lcurses -ltinf
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 )
+base_LIBNAMES += $(shell if { cat detect/sv.c | $(CC) -xc - -lsv -o /dev/null 2>/dev/null; }; then echo sv; 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 37b06ad98..1a2142db5 100644
--- a/core/src/demo/makefile
+++ b/core/src/demo/makefile
@@ -26,18 +26,10 @@ demo_INC_DIRS += ../luajit/luajit/src
demo_LIB_DIRS += ../luajit
# sv
-ifndef SV_LIBS
-SV_LIBS := sv$(DTYPE)
-endif
-ifndef SV_INC_DIRS
-SV_INC_DIRS := ../sv/sv/include
-endif
-ifndef SV_LIB_DIRS
-SV_LIB_DIRS := ../sv
-endif
-demo_LIBS += $(SV_LIBS)
-demo_INC_DIRS += $(SV_INC_DIRS)
-demo_LIB_DIRS += $(SV_LIB_DIRS)
+sv_DTYPE := $(if $(findstring sv,$(base_LIBNAMES)),,$(DTYPE))
+demo_LIBS += sv$(sv_DTYPE)
+demo_INC_DIRS += ../sv/sv/include
+demo_LIB_DIRS += ../sv
# lua-cjson
lua-cjson_LIBS := $(if $(findstring cjson,$(base_LIBNAMES)),,lua-cjson$(DTYPE))
diff --git a/core/src/sv/makefile b/core/src/sv/makefile
index 2666676a2..33b1e1041 100644
--- a/core/src/sv/makefile
+++ b/core/src/sv/makefile
@@ -23,11 +23,9 @@ sv_C_FILES += \
# includes
sv_INC_DIRS += sv/include
-# use given sv library?
-ifdef SV_LIBS
-sv_C_FILES :=
-sv_INC_DIRS :=
-endif
+# use system tbox library?
+sv_C_FILES := $(if $(findstring tbox,$(base_LIBNAMES)),,$(sv_C_FILES))
+sv_INC_DIRS := $(if $(findstring tbox,$(base_LIBNAMES)),,$(sv_INC_DIRS))
# suffix
include $(PRO_DIR)/suffix.mak