diff options
| author | Arthur LAURENT <[email protected]> | 2025-05-13 20:31:58 +0200 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2025-05-13 20:31:58 +0200 |
| commit | e7eab7231c9838569fd33d8fd53b9cf30b04327f (patch) | |
| tree | 97bde269cff484a039ce040e1ec5566dc2bd7e63 | |
| parent | 5a580f088db2e75271f133e68d549102fa334486 (diff) | |
(autotools) fix ld override when ld binary is not in the same directory as compiler
| -rw-r--r-- | xmake/modules/package/tools/autoconf.lua | 9 |
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..9559a2ad7 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 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 |
