build: add option to choose to build with or without JSON audit support
authorBjörn Baumbach <bb@sernet.de>
Tue, 17 Apr 2018 13:47:58 +0000 (15:47 +0200)
committerBjörn Baumbach <bbaumbach@samba.org>
Wed, 18 Apr 2018 13:25:42 +0000 (15:25 +0200)
Add a new configure option:

  --with-json-audit
            Build with JSON auth audit support (default=auto). This requires
    the jansson devel package.

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master):  <bbaumbach@samba.org>
Autobuild-Date(master): Wed Apr 18 15:25:42 CEST 2018 on sn-devel-144

auth/wscript [new file with mode: 0644]
auth/wscript_configure [deleted file]
wscript

diff --git a/auth/wscript b/auth/wscript
new file mode 100644 (file)
index 0000000..6b769c5
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+
+import Logs, Options, Utils
+import samba3
+
+def set_options(opt):
+    help = ("Build with JSON auth audit support (default=auto). "
+            "This requires the jansson devel package.")
+
+    opt.SAMBA3_ADD_OPTION('json-audit', default=None, help=(help))
+
+    return
+
+def configure(conf):
+    conf.SET_TARGET_TYPE('json-audit', 'EMPTY')
+
+    if Options.options.with_json_audit != False:
+        if conf.CHECK_CFG(package='jansson', args='--cflags --libs',
+                          msg='Checking for jansson'):
+            conf.CHECK_FUNCS_IN('json_object', 'jansson')
+
+    if not conf.CONFIG_GET('HAVE_JSON_OBJECT'):
+        if Options.options.with_json_audit == True:
+            conf.fatal('JSON support requested, but no suitable jansson '
+                       'library found')
+        if conf.CONFIG_GET('ENABLE_SELFTEST') and \
+          (not Options.options.without_ad_dc):
+            raise Utils.WafError('jansson JSON library required for '
+                                 '--enable-selftest when building the AD DC')
+        Logs.info("Building without jansson json log support")
+
diff --git a/auth/wscript_configure b/auth/wscript_configure
deleted file mode 100644 (file)
index 9d930ba..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env python
-
-import Options, Utils
-
-conf.SET_TARGET_TYPE('jansson', 'EMPTY')
-
-if conf.CHECK_CFG(package='jansson', args='--cflags --libs',
-                 msg='Checking for jansson'):
-    conf.CHECK_FUNCS_IN('json_object', 'jansson')
-
-if not conf.CONFIG_GET('HAVE_JSON_OBJECT') and \
-   conf.CONFIG_GET('ENABLE_SELFTEST') and \
-   (not Options.options.without_ad_dc):
-    raise Utils.WafError('jansson JSON library required for '
-                         '--enable-selftest '
-                         'when building the AD DC')
diff --git a/wscript b/wscript
index 0985aa948676e1bfcf515cc0fbdd8275cd3f9bac..b45146c31b2dfbb61d4b1fc5a84e73b309d0c1aa 100644 (file)
--- a/wscript
+++ b/wscript
@@ -35,6 +35,7 @@ def system_mitkrb5_callback(option, opt, value, parser):
 def set_options(opt):
     opt.BUILTIN_DEFAULT('NONE')
     opt.PRIVATE_EXTENSION_DEFAULT('samba4')
+    opt.RECURSE('auth')
     opt.RECURSE('lib/replace')
     opt.RECURSE('dynconfig')
     opt.RECURSE('packaging')
@@ -205,6 +206,7 @@ def configure(conf):
     # system-provided or embedded Heimdal build
     if conf.CONFIG_GET('KRB5_VENDOR') in (None, 'heimdal'):
         conf.RECURSE('source4/heimdal_build')
+    conf.RECURSE('auth')
     conf.RECURSE('source4/lib/tls')
     conf.RECURSE('source4/dsdb/samdb/ldb_modules')
     conf.RECURSE('source4/ntvfs/sysdep')