2017-09-06 19:58:06 +03:00
#!/usr/bin/env python
2018-02-02 17:34:32 +03:00
from waflib import Options
2018-11-26 22:14:21 +03:00
from waflib import Errors
2017-09-06 19:58:06 +03:00
def configure(conf):
2017-09-06 21:59:44 +03:00
if Options.options.accel_aes.lower() == "intelaesni":
2018-07-08 19:45:59 +03:00
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'):
2017-09-06 21:59:44 +03:00
print("Compiling with Intel AES instructions")
conf.DEFINE('HAVE_AESNI_INTEL', 1)
else:
2018-11-26 22:14:21 +03:00
raise Errors.WafError('--accel-aes=intelaesni selected and non x86_64 CPU')
2017-09-06 21:59:44 +03:00
else:
2018-11-26 22:14:21 +03:00
raise Errors.WafError('--aes-accel=intelaesni selected and compiler rejects ' + str(asm_flags))
2017-12-04 12:49:19 +03:00
if not conf.CHECK_LDFLAGS('-Wl,-z,noexecstack'):
2018-11-26 22:14:21 +03:00
raise Errors.WafError('--accel-aes=intelaesni selected and linker rejects -z noexecstack')
2017-09-06 19:58:06 +03:00
def build(bld):
2019-12-10 20:06:29 +03:00
if (not bld.CONFIG_SET('HAVE_AESNI_INTEL') or
bld.CONFIG_SET('HAVE_GNUTLS_AES_CMAC')):
2017-09-06 19:58:06 +03:00
return
bld.SAMBA_LIBRARY('aesni-intel',
source='aesni-intel_asm.c',
2018-07-08 19:45:59 +03:00
cflags=bld.CONFIG_GET('AESNI_INTEL_CFLAGS'),
2017-12-04 12:49:19 +03:00
ldflags='-Wl,-z,noexecstack',
2017-09-06 19:58:06 +03:00
private_library=True)