build: check AVX512 rather than binutils version
[dpdk.git] / config / x86 / meson.build
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2017-2019 Intel Corporation
3
4 # get binutils version for the workaround of Bug 97
5 if not is_windows
6         binutils_ok = run_command(binutils_avx512_check)
7         if binutils_ok.returncode() != 0 and cc.has_argument('-mno-avx512f')
8                 machine_args += '-mno-avx512f'
9                 warning('Binutils error with AVX512 assembly, disabling AVX512 support')
10         endif
11 endif
12
13 # we require SSE4.2 for DPDK
14 if cc.get_define('__SSE4_2__', args: machine_args) == ''
15         message('SSE 4.2 not enabled by default, explicitly enabling')
16         machine_args += '-msse4'
17 endif
18
19 base_flags = ['SSE', 'SSE2', 'SSE3','SSSE3', 'SSE4_1', 'SSE4_2']
20 foreach f:base_flags
21         dpdk_conf.set('RTE_MACHINE_CPUFLAG_' + f, 1)
22         compile_time_cpuflags += ['RTE_CPUFLAG_' + f]
23 endforeach
24
25 optional_flags = ['AES', 'PCLMUL',
26                 'AVX', 'AVX2', 'AVX512F',
27                 'RDRND', 'RDSEED']
28 foreach f:optional_flags
29         if cc.get_define('__@0@__'.format(f), args: machine_args) == '1'
30                 if f == 'PCLMUL' # special case flags with different defines
31                         f = 'PCLMULQDQ'
32                 elif f == 'RDRND'
33                         f = 'RDRAND'
34                 endif
35                 dpdk_conf.set('RTE_MACHINE_CPUFLAG_' + f, 1)
36                 compile_time_cpuflags += ['RTE_CPUFLAG_' + f]
37         endif
38 endforeach
39
40
41 dpdk_conf.set('RTE_ARCH_X86', 1)
42 if dpdk_conf.get('RTE_ARCH_64')
43         dpdk_conf.set('RTE_ARCH_X86_64', 1)
44         dpdk_conf.set('RTE_ARCH', 'x86_64')
45 else
46         dpdk_conf.set('RTE_ARCH_I686', 1)
47         dpdk_conf.set('RTE_ARCH', 'i686')
48 endif
49
50 dpdk_conf.set('RTE_CACHE_LINE_SIZE', 64)