s3:web/swat: use strtoll() instead of atoi/atol/atoll
[samba.git] / source3 / wscript
index ee4a98c85d584c3c942c46147f0ed1e8c12536b0..316427649934c0d9e070a8e0e6bbde9862b8aa21 100644 (file)
@@ -15,17 +15,19 @@ import build.charset
 import samba_utils, samba_version
 import samba3
 
+Options.default_prefix = '/usr/local/samba'
+
 def set_options(opt):
     if not os.getenv('TOPLEVEL_BUILD'):
         opt.BUILTIN_DEFAULT('NONE')
         opt.PRIVATE_EXTENSION_DEFAULT('s3')
         opt.RECURSE('../lib/replace')
-        opt.RECURSE('build')
+        opt.RECURSE('../dynconfig')
         opt.RECURSE('selftest')
         opt.RECURSE('../lib/nss_wrapper')
         opt.RECURSE('../lib/socket_wrapper')
         opt.RECURSE('../lib/tevent')
-        opt.RECURSE('../lib/tdb')
+        opt.RECURSE('../lib/tdb_compat')
 
     opt.add_option('--with-static-modules',
                    help=("Comma-separated list of names of modules to statically link in"),
@@ -90,9 +92,31 @@ def configure(conf):
         conf.env['build_swat'] = True
 
     if not conf.env.toplevel_build:
+
         conf.RECURSE('../lib/replace')
-        conf.RECURSE('build')
-        conf.RECURSE('../lib/tdb')
+
+        conf.find_program('python', var='PYTHON', mandatory=True)
+        conf.find_program('perl', var='PERL', mandatory=True)
+        conf.find_program('xsltproc', var='XSLTPROC')
+
+        # enable tool to build python extensions
+        conf.check_tool('python')
+        conf.check_python_version((2,4,2))
+        conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=True)
+
+        if sys.platform == 'darwin' and not conf.env['HAVE_ENVIRON_DECL']:
+            # Mac OSX needs to have this and it's also needed that the python is compiled with this
+            # otherwise you face errors about common symbols
+            if not conf.CHECK_SHLIB_W_PYTHON("Checking if -fno-common is needed"):
+                conf.ADD_CFLAGS('-fno-common')
+            if not conf.CHECK_SHLIB_W_PYTHON("Checking if -undefined dynamic_lookup is not need"):
+                conf.env.append_value('shlib_LINKFLAGS', ['-undefined', 'dynamic_lookup'])
+        if int(conf.env['PYTHON_VERSION'][0]) >= 3:
+           raise Utils.WafError('Python version 3.x is not supported by Samba yet')
+
+        conf.RECURSE('../dynconfig')
+        conf.RECURSE('../lib/ccan')
+        conf.RECURSE('../lib/tdb_compat')
         conf.RECURSE('../lib/talloc')
         conf.RECURSE('../lib/tevent')
         conf.RECURSE('../lib/popt')
@@ -102,9 +126,9 @@ def configure(conf):
         conf.RECURSE('../libcli/smbreadline')
         conf.RECURSE('../lib/util')
 
-        conf.ADD_EXTRA_INCLUDES('''#source3 #source3/include #lib/replace''')
+        conf.ADD_EXTRA_INCLUDES('''#source3 #source3/include #lib/replace #lib''')
         if not conf.env.USING_SYSTEM_TDB:
-            conf.ADD_EXTRA_INCLUDES('#lib/tdb/include')
+            conf.ADD_EXTRA_INCLUDES('#lib/tdb_compat')
         if not conf.env.USING_SYSTEM_TEVENT:
             conf.ADD_EXTRA_INCLUDES('#lib/tevent')
         if not conf.env.USING_SYSTEM_TALLOC:
@@ -130,14 +154,14 @@ def configure(conf):
     conf.CHECK_FUNCS('opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64')
     conf.CHECK_FUNCS('fdopendir fdopendir64')
     conf.CHECK_FUNCS('getpwent_r getdents64 setenv strcasecmp fcvt fcvtl')
-    conf.CHECK_FUNCS('syslog vsyslog timegm setlocale nl_langinfo')
+    conf.CHECK_FUNCS('syslog vsyslog timegm setlocale')
     conf.CHECK_FUNCS_IN('nanosleep', 'rt')
     conf.CHECK_FUNCS('lutimes futimes utimensat futimens')
     conf.CHECK_FUNCS('mlock munlock mlockall munlockall')
     conf.CHECK_FUNCS('memalign posix_memalign hstrerror')
     conf.CHECK_FUNCS('shmget')
     conf.CHECK_FUNCS_IN('shm_open', 'rt', checklibc=True)
-    conf.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain')
+    conf.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain bind_textdomain_codeset')
     #FIXME: for some reason this one still fails
     conf.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
     conf.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
@@ -288,7 +312,7 @@ inotify_init lgetea lgetxattr listea listxattr llistea llistxattr
 llseek _llseek __llseek lremoveea lremovexattr _lseek __lseek lseek64
 lsetea lsetxattr _lstat __lstat lstat64 _lstat64 __lstat64 lutimes
 __lxstat memalign mknod mknod64 mlock mlockall munlock munlockall
-nl_langinfo _open __open open64 _open64 __open64 _opendir __opendir
+_open __open open64 _open64 __open64 _opendir __opendir
 opendir64 pathconf poll posix_fallocate posix_fallocate64
 posix_memalign prctl pread _pread __pread pread64 _pread64 __pread64
 pwrite _pwrite __pwrite pwrite64 _pwrite64
@@ -307,7 +331,6 @@ utimensat vsyslog _write __write __xstat
 
     # FIXME: these should be tests for features, but the old build system just
     # checks for OSes.
-    import sys
     host_os = sys.platform
     Logs.info("building on %s" % host_os)
 
@@ -627,7 +650,7 @@ msg.msg_acctrightslen = sizeof(fd);
 
         conf.CHECK_FUNCS_IN('_et_list', 'com_err')
         conf.CHECK_FUNCS_IN('krb5_encrypt_data', 'k5crypto')
-        conf.CHECK_FUNCS_IN('crypto', 'des_set_key')
+       conf.CHECK_FUNCS_IN('des_set_key','crypto')
         conf.CHECK_FUNCS_IN('copy_Authenticator', 'asn1')
         conf.CHECK_FUNCS_IN('roken_getaddrinfo_hostspec', 'roken')
         if conf.CHECK_FUNCS_IN('gss_display_status', 'gssapi') or \
@@ -1420,6 +1443,16 @@ main() {
                 conf.DEFINE('AIX_SENDFILE_API', '1')
                 conf.DEFINE('WITH_SENDFILE', '1')
 
+    # Check for getcwd allowing a NULL arg.
+    conf.CHECK_CODE('''
+#include <unistd.h>
+main() {
+       char *s = getcwd(NULL,0);
+        exit(s != NULL ?  0 : 1);
+}''', 'GETCWD_TAKES_NULL', addmain=False, execute=True,
+        msg="getcwd takes a NULL argument")
+
+
     conf.CHECK_CODE('''enum TDB_ERROR err = TDB_ERR_NESTING''',
                    'HAVE_TDB_ERR_NESTING',
                    headers='tdb.h',
@@ -1784,6 +1817,12 @@ main() {
                 conf.DEFINE('%s_init' % entry, 'init_samba_module')
                 conf.env[shared_env].append('%s' % entry)
 
+    if not os.getenv('TOPLEVEL_BUILD'):
+        # we don't want PYTHONDIR in config.h, as otherwise changing
+        # --prefix causes a complete rebuild
+        del(conf.env.defines['PYTHONDIR'])
+        del(conf.env.defines['PYTHONARCHDIR'])
+
     conf.SAMBA_CONFIG_H('include/config.h')
 
 def ctags(ctx):