New upstream version 18.11-rc4
[deb_dpdk.git] / config / meson.build
index 0b710b7..db32499 100644 (file)
@@ -7,10 +7,32 @@ if meson.is_cross_build()
 else
        machine = get_option('machine')
 endif
+
+# machine type 'default' is special, it defaults to the per arch agreed common
+# minimal baseline needed for DPDK.
+# That might not be the most optimized, but the most portable version while
+# still being able to support the CPU features required for DPDK.
+# This can be bumped up by the DPDK project, but it can never be an
+# invariant like 'native'
+if machine == 'default'
+       if host_machine.cpu_family().startswith('x86')
+               # matches the old pre-meson build systems default
+               machine = 'corei7'
+       elif host_machine.cpu_family().startswith('arm')
+               machine = 'armv7-a'
+       elif host_machine.cpu_family().startswith('aarch')
+               # arm64 manages defaults in config/arm/meson.build
+               machine = 'default'
+       elif host_machine.cpu_family().startswith('ppc')
+               machine = 'power8'
+       endif
+endif
+
 dpdk_conf.set('RTE_MACHINE', machine)
 machine_args = []
-# ppc64 does not support -march=native
-if host_machine.cpu_family().startswith('ppc') and machine == 'native'
+
+# ppc64 does not support -march= at all, use -mcpu and -mtune for that
+if host_machine.cpu_family().startswith('ppc')
        machine_args += '-mcpu=' + machine
        machine_args += '-mtune=' + machine
 else