From 5dde1b6d59fe11bbda684ed07d41834a0cb28039 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 23 Mar 2022 00:20:35 +0800 Subject: improve autoconf --- xmake/modules/package/tools/autoconf.lua | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua index cd5df4307..a960789ce 100644 --- a/xmake/modules/package/tools/autoconf.lua +++ b/xmake/modules/package/tools/autoconf.lua @@ -266,22 +266,29 @@ function buildenvs(package, opt) end end - -- fix autoconf cannot use clang/clang++ as linker + -- we should use ld as linker -- -- @see -- https://github.com/xmake-io/xmake-repo/pull/1043 -- https://github.com/libexpat/libexpat/issues/312 + -- https://github.com/xmake-io/xmake/issues/2195 local ld = envs.LD - local cxx = envs.CXX - if ld and package:has_tool("ld", "clangxx", "clang") then + if ld and package:has_tool("ld", "clang", "clangxx", "gcc", "gxx") then local dir = path.directory(ld) local name = path.filename(ld) - name = name:gsub("clang%+%+", "ld") - name = name:gsub("clang", "ld") + name = name:gsub("clang%+%+$", "ld") + name = name:gsub("clang%+%+%-%d+", "ld") + name = name:gsub("clang$", "ld") + name = name:gsub("clang%-%d+", "ld") + name = name:gsub("gcc$", "ld") + 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 end -- we need use clang++ as cxx, autoconf will use it as linker -- https://github.com/xmake-io/xmake/issues/2170 + local cxx = envs.CXX if cxx and package:has_tool("cxx", "clang", "gcc") then local dir = path.directory(cxx) local name = path.filename(cxx) -- cgit v1.3.1