aix: fix cpu family detection

Like the BSDs, AIX does not return anything useful in platform.machine().
pull/7581/head
Peter Harris 4 years ago
parent 435db35962
commit 45a12d28b9
  1. 8
      mesonbuild/environment.py
  2. 3
      mesonbuild/mesonlib.py

@ -337,7 +337,7 @@ def detect_cpu_family(compilers: CompilersDict) -> str:
"""
if mesonlib.is_windows():
trial = detect_windows_arch(compilers)
elif mesonlib.is_freebsd() or mesonlib.is_netbsd() or mesonlib.is_openbsd() or mesonlib.is_qnx():
elif mesonlib.is_freebsd() or mesonlib.is_netbsd() or mesonlib.is_openbsd() or mesonlib.is_qnx() or mesonlib.is_aix():
trial = platform.processor().lower()
else:
trial = platform.machine().lower()
@ -377,6 +377,10 @@ def detect_cpu_family(compilers: CompilersDict) -> str:
# ATM there is no 64 bit userland for PA-RISC. Thus always
# report it as 32 bit for simplicity.
trial = 'parisc'
elif trial == 'ppc':
# AIX always returns powerpc, check here for 64-bit
if any_compiler_has_define(compilers, '__64BIT__'):
trial = 'ppc64'
if trial not in known_cpu_families:
mlog.warning('Unknown CPU family {!r}, please report this at '
@ -388,7 +392,7 @@ def detect_cpu_family(compilers: CompilersDict) -> str:
def detect_cpu(compilers: CompilersDict):
if mesonlib.is_windows():
trial = detect_windows_arch(compilers)
elif mesonlib.is_freebsd() or mesonlib.is_netbsd() or mesonlib.is_openbsd():
elif mesonlib.is_freebsd() or mesonlib.is_netbsd() or mesonlib.is_openbsd() or mesonlib.is_aix():
trial = platform.processor().lower()
else:
trial = platform.machine().lower()

@ -530,6 +530,9 @@ def is_hurd() -> bool:
def is_qnx() -> bool:
return platform.system().lower() == 'qnx'
def is_aix() -> bool:
return platform.system().lower() == 'aix'
def exe_exists(arglist: T.List[str]) -> bool:
try:
if subprocess.run(arglist, timeout=10).returncode == 0:

Loading…
Cancel
Save