build: Move --without-json-audit and json lib detection to lib/audit_logging
[samba.git] / lib / audit_logging / wscript
1 #!/usr/bin/env python
2
3 import Logs, Options, Utils
4 import samba3
5
6 def set_options(opt):
7     help = ("Build with JSON auth audit support (default=True). "
8             "This requires the jansson devel package.")
9
10     opt.SAMBA3_ADD_OPTION('json-audit', default=None, help=(help))
11
12     return
13
14 def configure(conf):
15     conf.SET_TARGET_TYPE('jansson', 'EMPTY')
16
17     if Options.options.with_json_audit != False:
18         if conf.CHECK_CFG(package='jansson', args='--cflags --libs',
19                           msg='Checking for jansson'):
20             conf.CHECK_FUNCS_IN('json_object', 'jansson')
21
22     if not conf.CONFIG_GET('HAVE_JSON_OBJECT'):
23         if Options.options.with_json_audit != False:
24             conf.fatal("JSON support not found. "
25                        "Try installing libjansson-dev or jansson-devel. "
26                        "Otherwise, use --without-json-audit to build without "
27                        "JSON support. "
28                        "JSON support is required for the JSON "
29                        "formatted audit log feature")
30         if conf.CONFIG_GET('ENABLE_SELFTEST') and \
31           (not Options.options.without_ad_dc):
32             raise Utils.WafError('jansson JSON library required for '
33                                  '--enable-selftest when building the AD DC')
34         Logs.info("Building without jansson json log support")