docs: Document new tdbdump -x option
[cs/samba-autobuild/.git] / wscript
diff --git a/wscript b/wscript
index 95ddd9ef5ba3f5fd4f6e181047eba5537ab452a5..57545c6a57195e15235d087b222a9cbf8f72c6b4 100644 (file)
--- a/wscript
+++ b/wscript
@@ -16,6 +16,8 @@ from waflib.Tools import bison
 samba_dist.DIST_DIRS('.')
 samba_dist.DIST_BLACKLIST('.gitignore .bzrignore source4/selftest/provisions')
 
+DEFAULT_PRIVATE_LIBS = ["ldb"]
+
 # install in /usr/local/samba by default
 default_prefix = Options.default_prefix = '/usr/local/samba'
 
@@ -35,7 +37,7 @@ def system_mitkrb5_callback(option, opt, value, parser):
 
 def options(opt):
     opt.BUILTIN_DEFAULT('NONE')
-    opt.PRIVATE_EXTENSION_DEFAULT('samba4')
+    opt.PRIVATE_EXTENSION_DEFAULT('private-samba')
     opt.RECURSE('lib/replace')
     opt.RECURSE('dynconfig')
     opt.RECURSE('packaging')
@@ -123,7 +125,9 @@ def options(opt):
                   help=('Disable kernely keyring support for credential storage'),
                   action='store_false', dest='enable_keyring')
 
-    gr = opt.option_group('developer options')
+    opt.samba_add_onoff_option('ldap')
+
+    opt.option_group('developer options')
 
     opt.load('python') # options for disabling pyc or pyo compilation
     # enable options related to building python extensions
@@ -177,7 +181,7 @@ def configure(conf):
     conf.RECURSE('examples/winexe')
 
     conf.SAMBA_CHECK_PERL(mandatory=True)
-    conf.find_program('xsltproc', var='XSLTPROC')
+    conf.CHECK_XSLTPROC_MANPAGES()
 
     if conf.env.disable_python:
         if not (Options.options.without_ad_dc):
@@ -207,9 +211,9 @@ def configure(conf):
                    mandatory=True)
     conf.CHECK_FUNCS_IN('inflateInit2', 'z')
 
-    if Options.options.enable_keyring != False:
+    if Options.options.enable_keyring is not False:
         conf.env['WITH_KERNEL_KEYRING'] = 'auto'
-        if Options.options.enable_keyring == True:
+        if Options.options.enable_keyring is True:
             conf.env['WITH_KERNEL_KEYRING'] = True
     else:
         conf.env['WITH_KERNEL_KEYRING'] = False
@@ -254,6 +258,56 @@ def configure(conf):
             else:
                 conf.define('USING_SYSTEM_PAM_WRAPPER', 1)
 
+    # Check for LDAP
+    if Options.options.with_ldap:
+        conf.CHECK_HEADERS('ldap.h lber.h ldap_pvt.h')
+        conf.CHECK_TYPE('ber_tag_t', 'unsigned int', headers='ldap.h lber.h')
+        conf.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
+        conf.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers='ldap.h')
+
+        # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
+        # for the samba logs
+        conf.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
+                            define='HAVE_LBER_LOG_PRINT_FN', headers='lber.h')
+
+        conf.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', 'ldap')
+        conf.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
+
+        # Check if ldap_set_rebind_proc() takes three arguments
+        if conf.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
+                           'LDAP_SET_REBIND_PROC_ARGS',
+                           msg="Checking whether ldap_set_rebind_proc takes 3 arguments",
+                           headers='ldap.h lber.h', link=False):
+            conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
+        else:
+            conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
+
+        # last but not least, if ldap_init() exists, we want to use ldap
+        if conf.CONFIG_SET('HAVE_LDAP_INIT') and conf.CONFIG_SET('HAVE_LDAP_H'):
+            conf.DEFINE('HAVE_LDAP', '1')
+            conf.DEFINE('LDAP_DEPRECATED', '1')
+            conf.env['HAVE_LDAP'] = '1'
+            # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
+            # SASL wrapping hooks
+            if conf.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
+                    conf.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
+                conf.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
+            conf.env.ENABLE_LDAP_BACKEND = True
+        else:
+            conf.fatal("LDAP support not found. "
+                       "Try installing libldap2-dev or openldap-devel. "
+                       "Otherwise, use --without-ldap to build without "
+                       "LDAP support. "
+                       "LDAP support is required for the LDAP passdb backend, "
+                       "LDAP idmap backends and ADS. "
+                       "ADS support improves communication with "
+                       "Active Directory domain controllers.")
+    else:
+        conf.SET_TARGET_TYPE('ldap', 'EMPTY')
+        conf.SET_TARGET_TYPE('lber', 'EMPTY')
+
+    conf.RECURSE('lib/tdb')
+    conf.RECURSE('lib/tevent')
     conf.RECURSE('lib/ldb')
 
     if conf.CHECK_LDFLAGS(['-Wl,--wrap=test']):
@@ -339,13 +393,13 @@ def configure(conf):
 
     conf.SET_TARGET_TYPE('jansson', 'EMPTY')
 
-    if Options.options.with_json != False:
+    if Options.options.with_json is not 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 != False:
+        if Options.options.with_json is not False:
             conf.fatal("Jansson JSON support not found. "
                        "Try installing libjansson-dev or jansson-devel. "
                        "Otherwise, use --without-json to build without "
@@ -390,8 +444,8 @@ def configure(conf):
                            msg='Checking configure summary'):
         raise Errors.WafError('configure summary failed')
 
-    if Options.options.enable_pie != False:
-        if Options.options.enable_pie == True:
+    if Options.options.enable_pie is not False:
+        if Options.options.enable_pie is True:
                 need_pie = True
         else:
                 # not specified, only build PIEs if supported by compiler
@@ -400,8 +454,8 @@ def configure(conf):
                          msg="Checking compiler for PIE support"):
             conf.env['ENABLE_PIE'] = True
 
-    if Options.options.enable_relro != False:
-        if Options.options.enable_relro == True:
+    if Options.options.enable_relro is not False:
+        if Options.options.enable_relro is True:
             need_relro = True
         else:
             # not specified, only build RELROs if supported by compiler
@@ -411,13 +465,13 @@ def configure(conf):
             conf.env['ENABLE_RELRO'] = True
 
     if conf.CONFIG_GET('ENABLE_SELFTEST') and \
-       Options.options.with_smb1server == False and \
-       Options.options.without_ad_dc != True:
+       Options.options.with_smb1server is False and \
+       Options.options.without_ad_dc is not True:
         conf.fatal('--without-smb1-server cannot be specified with '
                    '--enable-selftest/--enable-developer if '
                    '--without-ad-dc is NOT set!')
 
-    if Options.options.with_smb1server != False:
+    if Options.options.with_smb1server is not False:
         conf.DEFINE('WITH_SMB1SERVER', '1')
 
     #
@@ -452,7 +506,6 @@ def configure(conf):
 
 def etags(ctx):
     '''build TAGS file using etags'''
-    from waflib import Utils
     source_root = os.path.dirname(Context.g_module.root_path)
     cmd = r'rm -f %s/TAGS && (find %s -name "*.[ch]" | egrep -v \.inst\. | xargs -n 100 etags -a)' % (source_root, source_root)
     print("Running: %s" % cmd)
@@ -462,7 +515,6 @@ def etags(ctx):
 
 def ctags(ctx):
     "build 'tags' file using ctags"
-    from waflib import Utils
     source_root = os.path.dirname(Context.g_module.root_path)
     cmd = r'ctags --python-kinds=-i $(find %s -name "*.[ch]" | grep -v "*_proto\.h" | egrep -v \.inst\.) $(find %s -name "*.py")' % (source_root, source_root)
     print("Running: %s" % cmd)
@@ -518,6 +570,11 @@ def distcheck():
     '''test that distribution tarball builds and installs'''
     samba_version.load_version(env=None)
 
+def printversion(ctx):
+    '''print version'''
+    ver = samba_version.load_version(env=None)
+    print('Samba Version: ' + ver.STRING_WITH_NICKNAME)
+
 def wildcard_cmd(cmd):
     '''called on a unknown command'''
     from samba_wildcard import run_named_build_task
@@ -531,7 +588,6 @@ Scripting.main = main
 
 def reconfigure(ctx):
     '''reconfigure if config scripts have changed'''
-    import samba_utils
     samba_utils.reconfigure(ctx)