config: compiler support check for machine arch flags
Checks
Commit Message
Added additional checks for compiler support of specific cpu arch
flags to fix incorrect error reporting.
Without this patch, meson build reports '__SSE4_2__' not defined
error for x86 builds when the compiler does not support the specified
cpu_instruction_set (or) machine argument.
Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
---
config/meson.build | 5 +++++
1 file changed, 5 insertions(+)
Comments
On Wed, Oct 25, 2023 at 07:17:09AM -0700, Sivaprasad Tummala wrote:
> Added additional checks for compiler support of specific cpu arch
> flags to fix incorrect error reporting.
>
> Without this patch, meson build reports '__SSE4_2__' not defined
> error for x86 builds when the compiler does not support the specified
> cpu_instruction_set (or) machine argument.
>
> Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
> ---
> config/meson.build | 5 +++++
> 1 file changed, 5 insertions(+)
>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
@@ -159,8 +159,13 @@ if not is_ms_compiler
if host_machine.cpu_family().startswith('ppc')
machine_args += '-mcpu=' + cpu_instruction_set
machine_args += '-mtune=' + cpu_instruction_set
+ compiler_arch_support = cc.has_argument('-mcpu=' + cpu_instruction_set)
else
machine_args += '-march=' + cpu_instruction_set
+ compiler_arch_support = cc.has_argument('-march=' + cpu_instruction_set)
+ endif
+ if not compiler_arch_support
+ error('Compiler does not support "@0@" arch flag.'.format(cpu_instruction_set))
endif
endif