Fix bug #7996 - sgid bit lost on folder rename.
[ira/wip.git] / source3 / wscript
index 90a541ba95bf9eacfee9503a4f1d482aacba6037..e8bd62598b14e72dcb4b84854e0def0f11f86af4 100644 (file)
@@ -10,7 +10,7 @@ import sys, os
 from optparse import SUPPRESS_HELP
 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
 sys.path.insert(0, "source3")
-import wafsamba, Options, Logs, Utils
+import wafsamba, Options, Logs, Utils, Scripting
 import build.charset
 import samba_utils, samba_version
 import samba3
@@ -46,6 +46,7 @@ def set_options(opt):
     opt.SAMBA3_ADD_OPTION('iprint', with_name="enable", without_name="disable")
     opt.SAMBA3_ADD_OPTION('merged-build', with_name="enable", without_name="disable")
     opt.SAMBA3_ADD_OPTION('pam')
+    opt.SAMBA3_ADD_OPTION('pam_smbpass')
     opt.SAMBA3_ADD_OPTION('quotas')
     opt.SAMBA3_ADD_OPTION('sys-quotas')
     opt.SAMBA3_ADD_OPTION('sendfile-support')
@@ -268,7 +269,7 @@ _fork __fork fremoveea fremovexattr fseek64 fseeko64 fsetea
 fsetproplist fsetxattr _fstat __fstat fstat64 _fstat64 __fstat64 fsync
 ftell64 ftello64 ftruncate64 futimens futimes __fxstat getauthuid
 getcwd _getcwd __getcwd getdents __getdents getdents64 getdirentries
-getgrent getgrnam getgrouplist getmntent getpagesize
+getgrent getgrnam getgrouplist getgrset getmntent getpagesize
 getproplist get_proplist_entry getpwanam getpwent_r getrlimit gettext
 glob grantpt hstrerror initgroups innetgr
 inotify_init lgetea lgetxattr listea listxattr llistea llistxattr
@@ -290,8 +291,6 @@ __sys_llseek syslog _telldir __telldir telldir64 textdomain timegm
 utimensat vsyslog _write __write __xstat
 ''')
 
-    conf.CHECK_TYPE('struct timespec', headers='sys/time.h time.h')
-
     conf.CHECK_SAMBA3_CHARSET() # see build/charset.py
 
     # FIXME: these should be tests for features, but the old build system just
@@ -562,11 +561,6 @@ msg.msg_acctrightslen = sizeof(fd);
         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 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')
 
         # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
         # for the samba logs
@@ -590,6 +584,11 @@ msg.msg_acctrightslen = sizeof(fd);
             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.SET_TARGET_TYPE('ldap', 'EMPTY')
         conf.SET_TARGET_TYPE('lber', 'EMPTY')
@@ -911,6 +910,8 @@ return krb5_kt_resolve(context, "WRFILE:api", &keytab);
             conf.DEFINE('HAVE_KRB5', '1')
             if have_gssapi:
                 conf.DEFINE('HAVE_GSSAPI', '1')
+            if conf.CONFIG_SET('HAVE_LDAP'):
+                conf.env['HAVE_ADS'] = '1'
         else:
             Logs.warn("krb5 libs don't have all features required for Active Directory support")
             conf.undefine('HAVE_KRB5_H')
@@ -1211,7 +1212,7 @@ ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
 syscall(SYS_initgroups, 16, NULL, NULL, 0);
                    ''',
                    'HAVE_DARWIN_INITGROUPS',
-                   msg='Checking hether to use the Darwin-specific initgroups system call')
+                   msg='Checking whether to use the Darwin-specific initgroups system call')
 
     conf.CHECK_CODE('''struct utimbuf tbuf;  tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''',
                    'HAVE_UTIMBUF',
@@ -1294,9 +1295,9 @@ main() {
                    msg='Checking for ftruncate extend',
                    addmain=False,
                    execute=True)
-
-    if os.environ.get('RUN_FROM_BUILD_FARM') is not None:
-        conf.define('ENABLE_BUILD_FARM_HACKS', '1')
+    if os.getenv('RUN_FROM_BUILD_FARM'):
+        Logs.info("enabling buildfarm hacks")
+        conf.DEFINE('ENABLE_BUILD_FARM_HACKS', '1')
 
     if Options.options.with_sendfile_support:
         if (host_os.rfind('linux') > -1) or (host_os.rfind('gnu') > -1) or (host_os.rfind('k*bsd*-gnu') > -1) or (host_os.rfind('kopensolaris*-gnu') > -1):
@@ -1495,6 +1496,17 @@ main() {
         # For sys/quota.h and linux/quota.h
         conf.CHECK_HEADERS('sys/quota.h')
 
+    conf.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }',
+                   'HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR',
+                   addmain=False,
+                   link=False,
+                   msg='Checking whether we can compile with __attribute__((destructor))')
+
+    conf.CHECK_CODE('void seekdir(DIR *d, long loc) { return; }',
+                   'SEEKDIR_RETURNS_VOID',
+                   headers='sys/types.h dirent.h',
+                   msg='Checking whether seekdir returns void')
+
     default_static_modules=TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
                                       auth_sam auth_unix auth_winbind auth_wbc auth_server
                                       auth_domain auth_builtin vfs_default
@@ -1602,3 +1614,13 @@ def ctags(ctx):
     cmd = 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
     print("Running: %s" % cmd)
     os.system(cmd)
+
+if not os.getenv('TOPLEVEL_BUILD'):
+    def wildcard_cmd(cmd):
+        '''called on a unknown command'''
+        from samba_wildcard import run_named_build_task
+        run_named_build_task(cmd)
+    def main():
+        from samba_wildcard import wildcard_main
+        wildcard_main(wildcard_cmd)
+    Scripting.main = main