Mesa (master): meson: Fix ppc64 little endian detection

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Dec 18 17:23:28 UTC 2018


Module: Mesa
Branch: master
Commit: e430a034b9d2be626557931cd29808a3161889f1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e430a034b9d2be626557931cd29808a3161889f1

Author: Dylan Baker <dylan at pnwbakers.com>
Date:   Tue Dec  4 09:28:10 2018 -0800

meson: Fix ppc64 little endian detection

Old versions of meson returned ppc64le as the cpu_family for little
endian power8 cpus, versions >=0.48 don't do this, so the check wouldn't
work in that case. This generalizes the check to work for both old and
new versions of meson.

Fixes: 34bbb24ce7702658cdc4e9d34a650e169716c39e
       ("meson: Add support for ppc assembly/optimizations")
Reviewed-by: Eric Engestrom <eric.engestrom at intel.com>

---

 meson.build | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index fe647f682c..92dedb4e34 100644
--- a/meson.build
+++ b/meson.build
@@ -627,7 +627,12 @@ if with_gallium_st_nine
 endif
 
 if get_option('power8') != 'false'
-  if host_machine.cpu_family() == 'ppc64le'
+  # on old versions of meson the cpu family would return as ppc64le on little
+  # endian power8, this was changed in 0.48 such that the family would always
+  # be ppc64 regardless of endianness, and the the machine.endian() value
+  # should be checked. Since we support versions < 0.48 we need to use
+  # startswith.
+  if host_machine.cpu_family().startswith('ppc64') and host_machine.endian() == 'little'
     if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.8')
       error('Altivec is not supported with gcc version < 4.8.')
     endif
@@ -968,7 +973,7 @@ if with_asm
       with_asm_arch = 'sparc'
       pre_args += ['-DUSE_SPARC_ASM']
     endif
-  elif host_machine.cpu_family() == 'ppc64le'
+  elif host_machine.cpu_family().startswith('ppc64') and host_machine.endian() == 'little'
     if system_has_kms_drm
       with_asm_arch = 'ppc64le'
       pre_args += ['-DUSE_PPC64LE_ASM']




More information about the mesa-commit mailing list