summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-01-08 23:29:17 +0800
committerruki <[email protected]>2023-01-08 23:29:17 +0800
commitd3fc1bb511e858e7f18c8cb9fd72685751513720 (patch)
treef0ba54790a678db59302fb857a0d578f1d038284
parent476f1c3592aa55cd10a6986c045f1be834cf2a83 (diff)
improve option
-rwxr-xr-xconfigure7
-rwxr-xr-xcore/xmake.sh21
2 files changed, 25 insertions, 3 deletions
diff --git a/configure b/configure
index 1fa23c80e..d7ae869c8 100755
--- a/configure
+++ b/configure
@@ -3291,12 +3291,19 @@ _check_cxxsnippets() {
_check_option() {
local name="${1}"
_get_option_value "${name}"; local value="${_ret}"
+ _get_option_item "${name}" "default"; local default="${_ret}"
if test_nz "${value}"; then
if _is_enabled "${value}"; then
return 0
else
return 1
fi
+ elif test_nz "${default}"; then
+ if _is_enabled "${default}"; then
+ return 0
+ else
+ return 1
+ fi
else
_get_option_item "${name}" "before_check"; local before_check="${_ret}"
if test_nz "${before_check}"; then
diff --git a/core/xmake.sh b/core/xmake.sh
index 5de724427..f56216e4c 100755
--- a/core/xmake.sh
+++ b/core/xmake.sh
@@ -95,9 +95,14 @@ option "lua"
option_end
option_find_lua() {
+ local ldflags=""
option "lua"
add_cflags `pkg-config --cflags lua5.4 2>/dev/null`
- add_ldflags `pkg-config --libs lua5.4 2>/dev/null`
+ ldflags=`pkg-config --libs lua5.4 2>/dev/null`
+ if test_z "${ldflags}"; then
+ ldflags="-llua5.4"
+ fi
+ add_ldflags "${ldflags}"
option_end
}
@@ -110,9 +115,14 @@ option "luajit"
option_end
option_find_luajit() {
+ local ldflags=""
option "luajit"
add_cflags `pkg-config --cflags luajit 2>/dev/null`
- add_ldflags `pkg-config --libs luajit 2>/dev/null`
+ ldflags=`pkg-config --libs luajit 2>/dev/null`
+ if test_z "${ldflags}"; then
+ ldflags="-lluajit"
+ fi
+ add_ldflags "${ldflags}"
option_end
}
@@ -124,9 +134,14 @@ option "lz4"
option_end
option_find_lz4() {
+ local ldflags=""
option "lz4"
add_cflags `pkg-config --cflags liblz4 2>/dev/null`
- add_ldflags `pkg-config --libs liblz4 2>/dev/null`
+ ldflags=`pkg-config --libs liblz4 2>/dev/null`
+ if test_z "${ldflags}"; then
+ ldflags="-llz4"
+ fi
+ add_ldflags "${ldflags}"
option_end
}