s3:wscript: don't add ctdb include dir globally
[samba.git] / source3 / wscript
index 2edf5e8ea711c15872855b811f05f3e998bde267..c1fadef79f75c6301e734b60b3cccac242b422c3 100644 (file)
@@ -23,7 +23,7 @@ def set_options(opt):
                    action="store", dest='shared_modules', default=None)
 
     opt.SAMBA3_ADD_OPTION('winbind')
-    opt.SAMBA3_ADD_OPTION('ads', default=None) # None means autodetection
+    opt.SAMBA3_ADD_OPTION('ads')
     opt.SAMBA3_ADD_OPTION('ldap')
     opt.SAMBA3_ADD_OPTION('cups', with_name="enable", without_name="disable")
     opt.SAMBA3_ADD_OPTION('iprint', with_name="enable", without_name="disable")
@@ -43,6 +43,7 @@ def set_options(opt):
     opt.SAMBA3_ADD_OPTION('dmapi', default=None) # None means autodetection
     opt.SAMBA3_ADD_OPTION('fam', default=None) # None means autodetection
     opt.SAMBA3_ADD_OPTION('profiling-data', default=False)
+    opt.SAMBA3_ADD_OPTION('libarchive', default=None)
 
     opt.SAMBA3_ADD_OPTION('cluster-support', default=None)
 
@@ -193,6 +194,17 @@ main() {
         elif check_for_fam:
             Logs.warn('no suitable FAM library found')
 
+    # check for libarchive (tar command in smbclient)
+    # None means autodetect, True/False means enable/disable
+    conf.env['archive_lib'] = ''
+    if Options.options.with_libarchive is not False:
+        libarchive_mandatory = Options.options.with_libarchive == True
+        Logs.info("Checking for libarchive existence")
+        if conf.CHECK_BUNDLED_SYSTEM('libarchive', minversion='3.1.2'):
+            conf.env['archive_lib'] = 'libarchive'
+        elif libarchive_mandatory:
+            conf.fatal('libarchive support requested, but no suitable pkgconfig found')
+
     # check for DMAPI libs
     Logs.info("Checking for DMAPI library existence")
     conf.env['dmapi_lib'] = ''
@@ -386,7 +398,7 @@ utimensat vsyslog _write __write __xstat
         conf.DEFINE('FREEBSD', 1)
         if conf.CHECK_HEADERS('sunacl.h'):
             conf.DEFINE('HAVE_FREEBSD_SUNACL_H', '1')
-            conf.CHECK_FUNCS_IN('acl', 'sunacl')
+            conf.CHECK_FUNCS_IN(['acl'], 'sunacl')
         conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
     elif (host_os.rfind('irix') > -1):
         conf.DEFINE('IRIX', 1)
@@ -406,15 +418,7 @@ utimensat vsyslog _write __write __xstat
         conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
 
     if Options.options.with_acl_support:
-       if (host_os.rfind('sysv5') > -1) and conf.CHECK_FUNCS_IN('sec', 'facl', checklibc=True):
-               Logs.info('Using UnixWare ACLs')
-                conf.DEFINE('HAVE_UNIXWARE_ACLS',1)
-                default_static_modules.extend(TO_LIST('vfs_solarisacl'))
-       elif (host_os.rfind('solaris') > -1) and conf.CHECK_FUNCS_IN('sec', 'facl'):
-               Logs.info('Using solaris ACLs')
-                conf.DEFINE('HAVE_SOLARIS_ACLS',1)
-                default_static_modules.extend(TO_LIST('vfs_solarisacl'))
-       elif (host_os.rfind('hpux') > -1):
+        if (host_os.rfind('hpux') > -1):
                Logs.info('Using HPUX ACLs')
                 conf.DEFINE('HAVE_HPUX_ACLS',1)
                 conf.DEFINE('POSIX_ACL_NEEDS_MASK',1)
@@ -423,14 +427,15 @@ utimensat vsyslog _write __write __xstat
                Logs.info('Using AIX ACLs')
                 conf.DEFINE('HAVE_AIX_ACLS',1)
                 default_static_modules.extend(TO_LIST('vfs_aixacl vfs_aixacl2'))
-       elif (host_os.rfind('osf') > -1) and conf.CHECK_FUNCS_IN('pacl', 'acl_get_fd'):
-               Logs.info('Using Tru64 ACLs')
-                conf.DEFINE('HAVE_TRU64_ACLS',1)
-                default_static_modules.extend(TO_LIST('vfs_tru64acl'))
         elif (host_os.rfind('darwin') > -1):
-            Logs.warn('ACLs on Dwarwin currently not supported')
+            Logs.warn('ACLs on Darwin currently not supported')
+            conf.fatal("ACL support not available on Darwin/MacOS. "
+                       "Use --without-acl-support for building without "
+                       "ACL support. "
+                       "ACL support is required to change permissions "
+                       "from Windows clients.")
         else:
-            conf.CHECK_FUNCS_IN('acl_get_file', 'acl')
+            conf.CHECK_FUNCS_IN(['acl_get_file'], 'acl')
             if conf.CHECK_CODE('''
 acl_t acl;
 int entry_id;
@@ -449,7 +454,21 @@ return acl_get_perm_np(permset_d, perm);
                         headers='sys/types.h sys/acl.h', link=True,
                         msg="Checking whether acl_get_perm_np() is available")
                 default_static_modules.extend(TO_LIST('vfs_posixacl'))
-
+            elif conf.CHECK_FUNCS_IN(['facl'], 'sec'):
+                Logs.info('Using solaris or UnixWare ACLs')
+                conf.DEFINE('HAVE_SOLARIS_UNIXWARE_ACLS',1)
+                default_static_modules.extend(TO_LIST('vfs_solarisacl'))
+            elif conf.CHECK_FUNCS_IN(['acl_get_fd'], 'pacl'):
+                Logs.info('Using Tru64 ACLs')
+                conf.DEFINE('HAVE_TRU64_ACLS',1)
+                default_static_modules.extend(TO_LIST('vfs_tru64acl'))
+            else:
+                conf.fatal("ACL support not found. Try installing libacl1-dev "
+                           "or libacl-devel.  "
+                           "Otherwise, use --without-acl-support to build "
+                           "without ACL support. "
+                           "ACL support is required to change permissions from "
+                           "Windows clients.")
 
     if conf.CHECK_FUNCS('dirfd'):
         conf.DEFINE('HAVE_DIRFD_DECL', 1)
@@ -648,6 +667,15 @@ msg.msg_acctrightslen = sizeof(fd);
             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')
@@ -746,9 +774,12 @@ msg.msg_acctrightslen = sizeof(fd);
         if not use_ads_krb5:
             Logs.warn("Active Directory support not available: krb5 libs don't have all required features")
         if not use_ads_ldap:
-            Logs.warn("Active Directory support not available: LDAP support ist not available.")
+            Logs.warn("Active Directory support not available: LDAP support is not available.")
         if Options.options.with_ads:
-            conf.fatal("Active Directory support not found. Use --without-ads for building without Active Directory support.")
+            conf.fatal("Active Directory support not found. Use --without-ads "
+                       "for building without Active Directory support. "
+                       "ADS support improves communication with "
+                       "Active Directory domain controllers.")
         else:
             # this is the auto-mode case
             Logs.warn("Building without Active Directory support.")
@@ -1407,8 +1438,9 @@ main() {
 
     else:
 
-        if Options.options.ctdb_dir:
-            conf.ADD_EXTRA_INCLUDES(Options.options.ctdb_dir + '/include')
+        have_cluster_support = True
+        ctdb_broken = ""
+        CTDB_CFLAGS = ""
 
         srcdir = os.path.realpath(conf.srcdir)
         if 'EXTRA_INCLUDES' in conf.env:
@@ -1416,15 +1448,16 @@ main() {
         else:
             includes = ''
 
+        if Options.options.ctdb_dir:
+            CTDB_CFLAGS = '-I' + Options.options.ctdb_dir + '/include'
+            includes = includes + ' ' + Options.options.ctdb_dir + '/include'
+
         if not conf.env.USING_SYSTEM_TDB:
             includes = includes + ' ' + srcdir + '/lib/tdb/include'
 
         if not conf.env.USING_SYSTEM_TALLOC:
             includes = includes + ' ' + srcdir + '/lib/talloc'
 
-        have_cluster_support = True
-        ctdb_broken = ""
-
         conf.CHECK_CODE('''
             #define NO_CONFIG_H
             #include "replace.h"
@@ -1660,6 +1693,7 @@ main() {
     if have_cluster_support:
         Logs.info("building with cluster support")
         conf.DEFINE('CLUSTER_SUPPORT', 1);
+        conf.env['CTDB_CFLAGS'] = CTDB_CFLAGS
     else:
         if Options.options.with_cluster_support == False:
             Logs.info("building without cluster support (--without-cluster-support)")
@@ -1668,6 +1702,7 @@ main() {
             conf.fatal("Cluster support not found, but --with-cluster-support was specified")
         else:
             Logs.info("building without cluster support: " + ctdb_broken)
+        conf.env['CTDB_CFLAGS'] = ''
         conf.undefine('CLUSTER_SUPPORT')
 
 
@@ -1727,7 +1762,8 @@ main() {
     if conf.CHECK_HEADERS('gpfs_gpl.h'):
         conf.DEFINE('HAVE_GPFS', '1')
 
-    if conf.CHECK_HEADERS('linux/ioctl.h sys/ioctl.h linux/fs.h'):
+    if (conf.CHECK_HEADERS('linux/ioctl.h sys/ioctl.h linux/fs.h') and
+       conf.CHECK_DECLS('FS_IOC_GETFLAGS FS_COMPR_FL', headers='linux/fs.h')):
            conf.DEFINE('HAVE_LINUX_IOCTL', '1')
 
     conf.env['CCFLAGS_CEPHFS'] = "-D_FILE_OFFSET_BITS=64"
@@ -1785,8 +1821,10 @@ main() {
                                       vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
                                      vfs_media_harmony
                                      vfs_commit
+                                     vfs_worm
                                       vfs_crossrename vfs_linux_xfs_sgid
                                       vfs_time_audit idmap_autorid idmap_tdb2
+                                      idmap_ad
                                       idmap_rid idmap_hash idmap_rfc2307'''))
 
     if Options.options.developer: