#! /usr/bin/env python
-srcdir = '..'
-blddir = 'bin'
-
-APPNAME='samba'
-VERSION=None
+srcdir=".."
import sys, os
from optparse import SUPPRESS_HELP
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('../dynconfig')
- opt.RECURSE('selftest')
- opt.RECURSE('../lib/nss_wrapper')
- opt.RECURSE('../lib/socket_wrapper')
- opt.RECURSE('../lib/tevent')
- opt.RECURSE('../lib/tdb_compat')
opt.add_option('--with-static-modules',
help=("Comma-separated list of names of modules to statically link in"),
opt.SAMBA3_ADD_OPTION('winbind')
opt.SAMBA3_ADD_OPTION('swat')
opt.SAMBA3_ADD_OPTION('ads')
- opt.SAMBA3_ADD_OPTION('krb5')
+ opt.SAMBA3_ADD_OPTION('mit-krb5-checks', default=False)
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")
- 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')
def configure(conf):
from samba_utils import TO_LIST
- if not conf.env.toplevel_build:
- version = samba_version.load_version(env=conf.env)
- conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
- conf.DEFINE('_SAMBA_WAF_BUILD_', version.MAJOR)
- conf.DEFINE('_SAMBA_BUILD_', version.MAJOR, add_to_cflags=True)
- conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
-
if Options.options.developer:
conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
conf.env.developer = True
if Options.options.with_swat:
conf.env['build_swat'] = True
- if not conf.env.toplevel_build:
-
- conf.RECURSE('../lib/replace')
-
- 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')
- conf.RECURSE('../lib/nss_wrapper')
- conf.RECURSE('../lib/socket_wrapper')
- conf.RECURSE('../lib/zlib')
- conf.RECURSE('../libcli/smbreadline')
- conf.RECURSE('../lib/util')
- conf.RECURSE('../lib/util/charset')
-
- conf.ADD_EXTRA_INCLUDES('''#source3 #source3/include #lib/replace #lib''')
- if not conf.env.USING_SYSTEM_TDB:
- 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:
- conf.ADD_EXTRA_INCLUDES('#lib/talloc')
- if not conf.env.USING_SYSTEM_POPT:
- conf.ADD_EXTRA_INCLUDES('#lib/popt')
-
conf.ADD_LDFLAGS("-Wl,--export-dynamic", testflags=True)
conf.CHECK_HEADERS('execinfo.h libexc.h libunwind.h netdb.h')
conf.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
conf.CHECK_FUNCS('setpriv setgidx setuidx setgroups sysconf stat64 fstat64')
conf.CHECK_FUNCS('lstat64 fopen64 atexit grantpt lseek64 ftruncate64 fallocate fallocate64 posix_fallocate posix_fallocate64')
- conf.CHECK_FUNCS('fseek64 fseeko64 ftell64 ftello64 setluid')
+ conf.CHECK_FUNCS('fseeko fseek64 fseeko64 ftell64 ftello64 setluid')
conf.CHECK_FUNCS('getpwnam', headers='sys/types.h pwd.h')
conf.CHECK_FUNCS('opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64')
conf.CHECK_FUNCS('fdopendir fdopendir64')
extattr_set_fd extattr_set_file extattr_set_link _facl __facl _fchdir
__fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
fdelproplist fgetea fgetproplist fgetxattr flistea flistxattr fopen64
-_fork __fork fremoveea fremovexattr fseek64 fseeko64 fsetea
+_fork __fork fremoveea fremovexattr fseeko 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
if conf.CONFIG_SET('HAVE_FALLOCATE'):
conf.CHECK_CODE('''
- #if defined(HAVE_UNISTD_H)
- #include <unistd.h>
- #endif
- #include <sys/types.h>
- #define _GNU_SOURCE
- #include <fcntl.h>
- #if defined(HAVE_LINUX_FALLOC_H)
- #include <linux/falloc.h>
- #endif
int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
'HAVE_LINUX_FALLOCATE',
- msg="Checking whether the Linux 'fallocate' function is available")
+ msg="Checking whether the Linux 'fallocate' function is available",
+ headers='unistd.h sys/types.h fcntl.h linux/falloc.h')
if conf.CONFIG_SET('HAVE_FALLOCATE64'):
conf.CHECK_CODE('''
- #if defined(HAVE_UNISTD_H)
- #include <unistd.h>
- #endif
- #include <sys/types.h>
- #define _GNU_SOURCE
- #include <fcntl.h>
- #if defined(HAVE_LINUX_FALLOC_H)
- #include <linux/falloc.h>
- #endif
int ret = fallocate64(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
'HAVE_LINUX_FALLOCATE64',
- msg="Checking whether the Linux 'fallocate64' function is available")
+ msg="Checking whether the Linux 'fallocate64' function is available",
+ headers='unistd.h sys/types.h fcntl.h linux/falloc.h')
conf.CHECK_CODE('''
- #if defined(HAVE_UNISTD_H)
- #include <unistd.h>
- #endif
- #include <fcntl.h>
ssize_t err = readahead(0,0,0x80000);''',
'HAVE_LINUX_READAHEAD',
- msg="Checking whether Linux readahead is available")
+ msg="Checking whether Linux readahead is available",
+ headers='unistd.h fcntl.h')
conf.CHECK_DECLS('readahead', headers='fcntl.h', always=True)
conf.CHECK_CODE('''
- #include <sys/types.h>
- #include <sys/socket.h>],
struct ucred cred;
socklen_t cred_len;
int ret = getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len);''',
'HAVE_PEERCRED',
- msg="Checking whether we can use SO_PEERCRED to get socket credentials")
+ msg="Checking whether we can use SO_PEERCRED to get socket credentials",
+ headers='sys/types.h sys/socket.h')
conf.CHECK_CODE('''
#if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
# gssapi_krb5 and other libraries to its --libs output. That breaks the use
# of an in-tree heimdal kerberos
conf.check_cfg(path=conf.env.CUPS_CONFIG, args="--cflags --ldflags",
- package="", uselib_store="cups")
+ package="", uselib_store="CUPS")
conf.CHECK_HEADERS('cups/cups.h cups/language.h', lib='cups')
conf.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups')
if conf.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
# Check for kerberos
have_gssapi=False
- if Options.options.with_krb5 and not conf.env.toplevel_build:
+ if Options.options.with_mit_krb5_checks and conf.env.developer:
Logs.info("Looking for kerberos features")
conf.find_program('krb5-config', var='KRB5_CONFIG')
if conf.env.KRB5_CONFIG:
conf.check_cfg(path="krb5-config", args="--cflags --libs",
- package="gssapi", uselib_store="krb5")
+ package="gssapi", uselib_store="KRB5")
conf.CHECK_HEADERS('krb5.h krb5/locate_plugin.h', lib='krb5')
conf.CHECK_HEADERS('gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h gssapi/gssapi_ext.h gssapi/gssapi_krb5.h com_err.h', lib='krb5')
'HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER', addmain=False,
link=False,
msg="Checking for KRB5_DEPRECATED define taking an identifier")
- elif not conf.env.toplevel_build:
- conf.SET_TARGET_TYPE('krb5', 'EMPTY')
- conf.SET_TARGET_TYPE('gssapi', 'EMPTY')
- conf.SET_TARGET_TYPE('gssapi_krb5', 'EMPTY')
- conf.SET_TARGET_TYPE('com_err', 'EMPTY')
- conf.SET_TARGET_TYPE('k5crypto', 'EMPTY')
if Options.options.with_ads:
use_ads=True
define='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC')
conf.CHECK_CODE('''
-#if defined(HAVE_UNISTD_H)
-#include <unistd.h>
-#endif
-#include <fcntl.h>],
ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
''',
'HAVE_POSIX_FADVISE',
- msg='Checking whether posix_fadvise is available')
+ msg='Checking whether posix_fadvise is available',
+ headers='unistd.h fcntl.h')
for v in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]:
conf.CHECK_CODE('''
if Options.options.developer:
default_static_modules.extend(TO_LIST('pdb_ads auth_netlogond charset_weird'))
default_shared_modules.extend(TO_LIST('perfcount_test'))
+ default_shared_modules.extend(TO_LIST('vfs_skel_opaque vfs_skel_transparent vfs_shadow_copy_test'))
+ default_shared_modules.extend(TO_LIST('auth_skel pdb_test'))
- if Options.options.developer or not conf.CONFIG_SET('HAVE_NATIVE_ICONV'):
- default_static_modules.extend(TO_LIST('charset_CP850 charset_CP437'))
-
- if conf.env.toplevel_build:
- default_static_modules.extend(TO_LIST('pdb_samba4 auth_samba4'))
+ default_static_modules.extend(TO_LIST('pdb_samba4 auth_samba4 vfs_dfs_samba4'))
if Options.options.with_acl_support and conf.CONFIG_SET('HAVE_POSIX_ACLS'):
default_static_modules.extend(TO_LIST('vfs_posixacl'))
conf.DEFINE('static_init_%s' % p, '{}')
if p in shared_list:
for entry in shared_list[p]:
- conf.DEFINE('%s_init' % entry, 'init_samba_module')
+ conf.DEFINE('%s_init' % entry, 'samba_module_init')
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):
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