1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00
samba-mirror/third_party/aesni-intel/wscript
Timur I. Bakeyev 1da4ff2e64 third_party:build: Test for the flags, recognized by Clang.
Make amd64 SYSTEM_UNAME_MACHINE an alias for x86_64.

Signed-off-by: Timur I. Bakeyev <timur@iXsystems.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-15 07:08:25 +02:00

32 lines
1.2 KiB
Python

#!/usr/bin/env python
import Options
import Utils
def configure(conf):
if Options.options.accel_aes.lower() == "intelaesni":
asm_flags = ('-Wp,-E,-lang-asm', '-xassembler-with-cpp')
for f in asm_flags:
if conf.CHECK_CFLAGS(f, ''):
conf.DEFINE('AESNI_INTEL_CFLAGS', f)
break
if conf.CONFIG_SET('AESNI_INTEL_CFLAGS'):
if conf.env['SYSTEM_UNAME_MACHINE'] in ('x86_64', 'amd64'):
print("Compiling with Intel AES instructions")
conf.DEFINE('HAVE_AESNI_INTEL', 1)
else:
raise Utils.WafError('--accel-aes=intelaesni selected and non x86_64 CPU')
else:
raise Utils.WafError('--aes-accel=intelaesni selected and compiler rejects ' + str(asm_flags))
if not conf.CHECK_LDFLAGS('-Wl,-z,noexecstack'):
raise Utils.WafError('--accel-aes=intelaesni selected and linker rejects -z noexecstack')
def build(bld):
if not bld.CONFIG_SET('HAVE_AESNI_INTEL'):
return
bld.SAMBA_LIBRARY('aesni-intel',
source='aesni-intel_asm.c',
cflags=bld.CONFIG_GET('AESNI_INTEL_CFLAGS'),
ldflags='-Wl,-z,noexecstack',
private_library=True)