summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-05-14 14:42:55 +0800
committerGitHub <[email protected]>2025-05-14 14:42:55 +0800
commit29ee4b47144829d80fbb7c3fe429696fba94394c (patch)
treefddd07b0acc972f0f6dd9d8f5fa245d039480388
parent173069f43f8efee4f99ac217582df24891c1e6db (diff)
parentc29575128eaac627315143d81cedd9b0c9cd72fc (diff)
Merge pull request #6425 from Arthapz/fix-ld-autotools
(autotools) fix ld override when ld binary is not in the same directo…
-rw-r--r--xmake/modules/package/tools/autoconf.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua
index b9339fcb7..b69506fc5 100644
--- a/xmake/modules/package/tools/autoconf.lua
+++ b/xmake/modules/package/tools/autoconf.lua
@@ -449,7 +449,14 @@ function buildenvs(package, opt)
name = name:gsub("gcc-%d+", "ld")
name = name:gsub("g%+%+$", "ld")
name = name:gsub("g%+%+%-%d+", "ld")
- envs.LD = dir and path.join(dir, name) or name
+ if dir and os.isfile(path.join(dir, name)) then
+ envs.LD = path.join(dir, name)
+ else
+ local ld = find_tool("ld")
+ if ld and path.filename(ld.program) == name then
+ envs.LD = ld.program
+ end
+ end
end
-- we need use clang++ as cxx, autoconf will use it as linker
-- https://github.com/xmake-io/xmake/issues/2170