1 | #!/usr/bin/env python
|
---|
2 |
|
---|
3 | import Options
|
---|
4 | from optparse import SUPPRESS_HELP
|
---|
5 |
|
---|
6 | def set_options(opt):
|
---|
7 | # allow users to disable gnutls
|
---|
8 | opt.add_option('--enable-gnutls',
|
---|
9 | help=("Enable use of gnutls"),
|
---|
10 | action="store_true", dest='enable_gnutls', default=True)
|
---|
11 | opt.add_option('--disable-gnutls', help=SUPPRESS_HELP, action="store_false", dest='enable_gnutls')
|
---|
12 |
|
---|
13 |
|
---|
14 | def configure(conf):
|
---|
15 | conf.env.enable_gnutls = Options.options.enable_gnutls
|
---|
16 | if not conf.env.enable_gnutls:
|
---|
17 | conf.SET_TARGET_TYPE('gnutls', 'DISABLED')
|
---|
18 | conf.SET_TARGET_TYPE('gcrypt', 'DISABLED')
|
---|
19 | conf.SET_TARGET_TYPE('gpg-error', 'DISABLED')
|
---|
20 | return
|
---|
21 |
|
---|
22 | conf.check_cfg(package='gnutls',
|
---|
23 | args='"gnutls >= 1.4.0 gnutls != 2.2.4 gnutls != 2.8.0 gnutls != 2.8.1" --cflags --libs',
|
---|
24 | msg='Checking for gnutls >= 1.4.0 and broken versions', mandatory=False)
|
---|
25 |
|
---|
26 | if 'HAVE_GNUTLS' in conf.env:
|
---|
27 | conf.DEFINE('ENABLE_GNUTLS', 1)
|
---|
28 |
|
---|
29 | conf.CHECK_FUNCS_IN('gnutls_global_init', 'gnutls',
|
---|
30 | headers='gnutls/gnutls.h')
|
---|
31 |
|
---|
32 | conf.CHECK_VARIABLE('gnutls_x509_crt_set_version',
|
---|
33 | headers='gnutls/gnutls.h gnutls/x509.h',
|
---|
34 | define='HAVE_GNUTLS_X509_CRT_SET_VERSION',
|
---|
35 | lib='gnutls')
|
---|
36 | conf.CHECK_VARIABLE('gnutls_x509_crt_set_subject_key_id',
|
---|
37 | headers='gnutls/gnutls.h gnutls/x509.h',
|
---|
38 | define='HAVE_GNUTLS_X509_CRT_SET_SUBJECT_KEY_ID',
|
---|
39 | lib='gnutls')
|
---|
40 |
|
---|
41 | # check for gnutls_datum types
|
---|
42 | conf.CHECK_TYPES('gnutls_datum gnutls_datum_t',
|
---|
43 | headers='gnutls/gnutls.h', lib='gnutls')
|
---|
44 |
|
---|
45 | conf.CHECK_FUNCS_IN('gcry_control', 'gcrypt', headers='gcrypt.h')
|
---|
46 | conf.CHECK_FUNCS_IN('gpg_err_code_from_errno', 'gpg-error')
|
---|
47 |
|
---|
48 |
|
---|
49 | def build(bld):
|
---|
50 | bld.SAMBA_SUBSYSTEM('LIBTLS',
|
---|
51 | source='tls.c tlscert.c tls_tstream.c',
|
---|
52 | public_deps='talloc gnutls gcrypt samba-hostconfig samba_socket LIBTSOCKET tevent UTIL_TEVENT'
|
---|
53 | )
|
---|