Skip to content

Commit e12ef89

Browse files
committed
make autoconf tool to use is_cross to determine whether it is cross-compile.
1 parent 21ae0fa commit e12ef89

File tree

2 files changed

+4
-26
lines changed

2 files changed

+4
-26
lines changed

xmake/modules/package/tools/autoconf.lua

+2-13
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,6 @@ function _get_msvc_runenvs(package)
7777
return os.joinenvs(_get_msvc(package):runenvs())
7878
end
7979

80-
-- is cross compilation?
81-
function _is_cross_compilation(package)
82-
if not package:is_plat(os.subhost()) then
83-
return true
84-
end
85-
if package:is_plat("macosx") and not package:is_arch(os.subarch()) then
86-
return true
87-
end
88-
return false
89-
end
90-
9180
-- get memcache
9281
function _memcache()
9382
return memcache.cache("package.tools.autoconf")
@@ -115,7 +104,7 @@ function _get_configs(package, configs)
115104
table.insert(configs, "--prefix=" .. _translate_paths(package:installdir()))
116105

117106
-- add host for cross-complation
118-
if not configs.host and _is_cross_compilation(package) then
107+
if not configs.host and package:is_cross() then
119108
if package:is_plat("iphoneos", "macosx") then
120109
local triples =
121110
{
@@ -240,7 +229,7 @@ function buildenvs(package, opt)
240229
local envs = {}
241230
local cross = false
242231
local cflags, cxxflags, cppflags, asflags, ldflags, shflags, arflags
243-
if not _is_cross_compilation(package) and not package:config("toolchains") then
232+
if not package:is_cross() and not package:config("toolchains") then
244233
cppflags = {}
245234
cflags = table.join(table.wrap(package:config("cxflags")), package:config("cflags"))
246235
cxxflags = table.join(table.wrap(package:config("cxflags")), package:config("cxxflags"))

xmake/modules/private/action/trybuild/autoconf.lua

+2-13
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ end
6868
function _get_buildenvs()
6969
local envs = {}
7070
local cross = false
71-
if not _is_cross_compilation() then
71+
if not is_cross() then
7272
local cflags = table.join(table.wrap(_get_buildenv("cxflags")), _get_buildenv("cflags"))
7373
local cxxflags = table.join(table.wrap(_get_buildenv("cxflags")), _get_buildenv("cxxflags"))
7474
local asflags = table.copy(table.wrap(_get_buildenv("asflags")))
@@ -174,17 +174,6 @@ function _get_buildenvs()
174174
return envs
175175
end
176176

177-
-- is cross compilation?
178-
function _is_cross_compilation()
179-
if not is_plat(os.subhost()) then
180-
return true
181-
end
182-
if is_plat("macosx") and not is_arch(os.subarch()) then
183-
return true
184-
end
185-
return false
186-
end
187-
188177
-- get configs
189178
function _get_configs(artifacts_dir)
190179

@@ -201,7 +190,7 @@ function _get_configs(artifacts_dir)
201190
end
202191

203192
-- add host for cross-complation
204-
if _is_cross_compilation() then
193+
if is_cross() then
205194
if is_plat("iphoneos", "macosx") then
206195
local triples =
207196
{

0 commit comments

Comments
 (0)