ldb: Build lmdb backend also in non-AD case
[samba.git] / source3 / wscript
index b76ced59aa4733b969e799d1f9a78cd57669d0b2..f746a67b800833b7d2b5e298f04418173a5ca662 100644 (file)
@@ -62,7 +62,6 @@ def options(opt):
 
     opt.samba_add_onoff_option('winbind')
     opt.samba_add_onoff_option('ads')
 
     opt.samba_add_onoff_option('winbind')
     opt.samba_add_onoff_option('ads')
-    opt.samba_add_onoff_option('ldap')
     opt.samba_add_onoff_option('cups', with_name="enable", without_name="disable")
     opt.samba_add_onoff_option('iprint', with_name="enable", without_name="disable")
     opt.samba_add_onoff_option('pam')
     opt.samba_add_onoff_option('cups', with_name="enable", without_name="disable")
     opt.samba_add_onoff_option('iprint', with_name="enable", without_name="disable")
     opt.samba_add_onoff_option('pam')
@@ -87,12 +86,8 @@ def options(opt):
     opt.samba_add_onoff_option('fake-kaserver',
                           help=("Include AFS fake-kaserver support"), default=False)
 
     opt.samba_add_onoff_option('fake-kaserver',
                           help=("Include AFS fake-kaserver support"), default=False)
 
-    opt.add_option('--with-libcephfs',
-                   help=("Directory under which libcephfs is installed"),
-                   action="store", dest='libcephfs_dir', default=None)
-
     opt.samba_add_onoff_option('glusterfs', with_name="enable", without_name="disable", default=True)
     opt.samba_add_onoff_option('glusterfs', with_name="enable", without_name="disable", default=True)
-    opt.samba_add_onoff_option('cephfs', with_name="enable", without_name="disable", default=True)
+    opt.samba_add_onoff_option('cephfs', with_name="enable", without_name="disable", default=None)
 
     opt.add_option('--enable-vxfs',
                   help=("enable support for VxFS (default=no)"),
 
     opt.add_option('--enable-vxfs',
                   help=("enable support for VxFS (default=no)"),
@@ -119,6 +114,7 @@ def configure(conf):
 
     conf.CHECK_HEADERS('netdb.h')
     conf.CHECK_HEADERS('linux/falloc.h linux/ioctl.h')
 
     conf.CHECK_HEADERS('netdb.h')
     conf.CHECK_HEADERS('linux/falloc.h linux/ioctl.h')
+    conf.CHECK_HEADERS('linux/magic.h')
 
     conf.CHECK_FUNCS('getcwd fchown chmod fchmod mknod mknodat')
     conf.CHECK_FUNCS('strtol strchr strupr chflags fchflags')
 
     conf.CHECK_FUNCS('getcwd fchown chmod fchmod mknod mknodat')
     conf.CHECK_FUNCS('strtol strchr strupr chflags fchflags')
@@ -532,6 +528,10 @@ return acl_get_perm_np(permset_d, perm);
     if conf.CHECK_FUNCS('dirfd'):
         conf.DEFINE('HAVE_DIRFD_DECL', 1)
 
     if conf.CHECK_FUNCS('dirfd'):
         conf.DEFINE('HAVE_DIRFD_DECL', 1)
 
+    conf.CHECK_CODE('struct statfs fsd; int r = fstatfs(AT_FDCWD, &fsd);',
+                    'HAVE_FSTATFS',
+                    msg='Checking for fstatfs',
+                    headers='sys/statfs.h fcntl.h')
     conf.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
                     'HAVE_STATFS_F_FSID',
                     msg="vfs_fileid checking for statfs() and struct statfs.f_fsid",
     conf.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
                     'HAVE_STATFS_F_FSID',
                     msg="vfs_fileid checking for statfs() and struct statfs.f_fsid",
@@ -644,53 +644,6 @@ msg.msg_accrightslen = sizeof(fd);
     if Options.options.with_automount:
         conf.DEFINE('WITH_AUTOMOUNT', '1')
 
     if Options.options.with_automount:
         conf.DEFINE('WITH_AUTOMOUNT', '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')
-        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')
-
     if Options.options.with_ads == False:
         use_ads = False
         use_ads_krb5 = False
     if Options.options.with_ads == False:
         use_ads = False
         use_ads_krb5 = False
@@ -771,13 +724,13 @@ msg.msg_accrightslen = sizeof(fd);
             conf.undefine('HAVE_GSSAPI_GSSAPI_H')
             use_ads = False
 
             conf.undefine('HAVE_GSSAPI_GSSAPI_H')
             use_ads = False
 
-        if not conf.CONFIG_SET('HAVE_LDAP'):
+        if not conf.CONFIG_SET('HAVE_LDAP_TRANSPORT_WRAPPING'):
+            Logs.warn("need ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF for SASL and TLS support")
             use_ads = False
             use_ads_ldap = False
 
     if use_ads:
             use_ads = False
             use_ads_ldap = False
 
     if use_ads:
-        conf.DEFINE('WITH_ADS', '1')
-        conf.env['HAVE_ADS'] = '1'
+        conf.DEFINE('HAVE_ADS', '1')
         Logs.info("Building with Active Directory support.")
         # these have broken dependencies
         forced_shared_modules.extend(['idmap_ad', 'idmap_rfc2307'])
         Logs.info("Building with Active Directory support.")
         # these have broken dependencies
         forced_shared_modules.extend(['idmap_ad', 'idmap_rfc2307'])
@@ -1665,37 +1618,28 @@ int main(void) {
             conf.DEFINE('HAVE_LINUX_IOCTL', '1')
 
     conf.env['CFLAGS_CEPHFS'] = "-D_FILE_OFFSET_BITS=64"
             conf.DEFINE('HAVE_LINUX_IOCTL', '1')
 
     conf.env['CFLAGS_CEPHFS'] = "-D_FILE_OFFSET_BITS=64"
-    if Options.options.libcephfs_dir:
-        Logs.error('''--with-libcephfs no longer supported, please use compiler
-                   flags instead, e.g. GCC LIBRARY_PATH and C_INCLUDE_PATH''')
-        sys.exit(1)
 
 
-    if (Options.options.with_cephfs and
+    if (Options.options.with_cephfs is not False and
         conf.CHECK_HEADERS('cephfs/libcephfs.h', False, False, 'cephfs') and
         conf.CHECK_LIB('cephfs', shlib=True)):
         if (Options.options.with_acl_support and
         conf.CHECK_HEADERS('cephfs/libcephfs.h', False, False, 'cephfs') and
         conf.CHECK_LIB('cephfs', shlib=True)):
         if (Options.options.with_acl_support and
-            conf.CHECK_FUNCS_IN('ceph_statx', 'cephfs',
+            conf.CHECK_FUNCS_IN('ceph_statx ceph_openat', 'cephfs',
                                 headers='cephfs/libcephfs.h')):
             conf.DEFINE('HAVE_CEPH', '1')
                                 headers='cephfs/libcephfs.h')):
             conf.DEFINE('HAVE_CEPH', '1')
-            conf.CHECK_FUNCS_IN('ceph_select_filesystem', 'cephfs',
-                                headers='cephfs/libcephfs.h')
-            conf.DEFINE('HAVE_MANDATORY_CEPH_API', '1')
-            for api in ['ceph_mkdirat', 'ceph_openat', 'ceph_unlinkat',
-                        'ceph_symlinkat', 'ceph_readlinkat', 'ceph_statxat']:
-                if not conf.CHECK_FUNCS_IN(api, 'cephfs',
-                                           headers='cephfs/libcephfs.h'):
-                    conf.undefine('HAVE_MANDATORY_CEPH_API')
-            if not conf.env.HAVE_MANDATORY_CEPH_API:
-                Logs.warn("Installed Ceph version support is at the verge of "
-                          "deprecation due to the absence of some mandatory "
-                          "libcephfs APIs. This warning there shall result in "
-                          "disabling the Ceph VFS module altogether with the "
-                          "next major Samba version. It is highly recommended "
-                          "to update to a more recent/active version of Ceph.")
+
+    if conf.CONFIG_SET('HAVE_CEPH'):
+        Logs.info("building ceph vfs modules")
+    else:
+        if Options.options.with_cephfs == False:
+            Logs.info("not building ceph vfs modules(--disable-cephfs)")
+        elif Options.options.with_cephfs == True:
+            Logs.error("acl support disabled or ceph_statx/ceph_openat not "
+                       "available, cannot build ceph vfs modules")
+            conf.fatal("acl support disabled or ceph_statx/ceph_openat not "
+                       "available, but --enable-cephfs was specified")
         else:
         else:
-            Logs.warn('''Ceph support disabled due to --without-acl-support
-                      or lack of ceph_statx support''')
-            conf.undefine('HAVE_CEPH')
+            Logs.warn("acl support disabled or ceph_statx/ceph_openat not "
+                       "available, not building ceph vfs modules")
 
     if Options.options.with_glusterfs:
         conf.CHECK_CFG(package='glusterfs-api', args='"glusterfs-api >= 4" --cflags --libs',
 
     if Options.options.with_glusterfs:
         conf.CHECK_CFG(package='glusterfs-api', args='"glusterfs-api >= 4" --cflags --libs',
@@ -1965,6 +1909,7 @@ int main(void) {
         # addition to vfs_ceph. Still, only enable vfs_ceph_snapshots builds
         # if we're building with libcephfs for now.
         default_shared_modules.extend(['vfs_ceph_snapshots'])
         # addition to vfs_ceph. Still, only enable vfs_ceph_snapshots builds
         # if we're building with libcephfs for now.
         default_shared_modules.extend(['vfs_ceph_snapshots'])
+        default_shared_modules.extend(['vfs_ceph_new'])
 
     if conf.CONFIG_SET('HAVE_GLUSTERFS'):
         default_shared_modules.extend(['vfs_glusterfs'])
 
     if conf.CONFIG_SET('HAVE_GLUSTERFS'):
         default_shared_modules.extend(['vfs_glusterfs'])