Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit acbdabb

Browse files
bsnotebnoordhuis
authored andcommitted
configure: fix cross-compilation host_arch_cc()
In case of cross-compilation host_arch_cc() function could return target arch if CC was set to target arch compiler. Host arch compiler should always be used in this case. This was broken by commit 707863c.
1 parent 4bca631 commit acbdabb

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

configure

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,14 @@ def pkg_config(pkg):
296296
return (libs, cflags)
297297

298298

299-
def cc_macros():
300-
"""Checks predefined macros using the CC command."""
299+
def cc_macros(cc=None):
300+
"""Checks predefined macros using the C compiler command."""
301+
302+
if cc is None:
303+
cc = CC
301304

302305
try:
303-
p = subprocess.Popen(shlex.split(CC) + ['-dM', '-E', '-'],
306+
p = subprocess.Popen(shlex.split(cc) + ['-dM', '-E', '-'],
304307
stdin=subprocess.PIPE,
305308
stdout=subprocess.PIPE,
306309
stderr=subprocess.PIPE)
@@ -375,7 +378,9 @@ def arm_hard_float_abi():
375378
def host_arch_cc():
376379
"""Host architecture check using the CC command."""
377380

378-
k = cc_macros()
381+
# use 'cc', as CC may be set to a target arch compiler command
382+
# in case of cross-compilation
383+
k = cc_macros('cc')
379384

380385
matchup = {
381386
'__x86_64__' : 'x64',

0 commit comments

Comments
 (0)