7 sys
.path
.insert(0, srcdir
+"/buildtools/wafsamba")
8 import wafsamba
, Options
10 from samba_utils
import *
13 opt
.BUILTIN_DEFAULT('NONE')
14 opt
.BUNDLED_EXTENSION_DEFAULT('s3')
15 opt
.RECURSE('../lib/replace')
17 opt
.RECURSE('../lib/nss_wrapper')
18 opt
.RECURSE('../lib/socket_wrapper')
19 opt
.RECURSE('../lib/tevent')
21 opt
.add_option('--with-static-modules',
22 help=("Comma-separated list of names of modules to statically link in"),
23 action
="store", dest
='static_modules', default
='')
24 opt
.add_option('--with-shared-modules',
25 help=("Comma-separated list of names of modules to build shared"),
26 action
="store", dest
='shared_modules', default
='')
30 conf
.define('PACKAGE_NAME', 'Samba')
31 conf
.define('PACKAGE_STRING', 'Samba 3')
32 conf
.define('PACKAGE_TARNAME', 'samba')
33 conf
.define('PACKAGE_URL', '')
34 conf
.define('PACKAGE_VERSION', '3')
35 conf
.define('PACKAGE_BUGREPORT', 'samba-technical@samba.org')
37 conf
.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
38 conf
.DEFINE('_SAMBA_BUILD_', 3, add_to_cflags
=True)
39 conf
.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags
=True)
40 if Options
.options
.developer
:
41 conf
.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
43 # set a limit on recursing in the waf preprocessor
44 conf
.env
.preprocessor_recursion_limit
= 10
46 conf
.ADD_EXTRA_INCLUDES('#source3 #source3/include #lib/replace #lib/talloc #lib/tevent #source3/libaddns #source3/librpc')
48 conf
.RECURSE('../lib/replace')
50 conf
.RECURSE('../lib/tdb')
51 conf
.RECURSE('../lib/talloc')
52 conf
.RECURSE('../lib/tevent')
53 conf
.RECURSE('../lib/popt')
54 conf
.RECURSE('../lib/nss_wrapper')
55 conf
.RECURSE('../lib/socket_wrapper')
57 conf
.CHECK_HEADERS('execinfo.h libexc.h libunwind.h')
59 conf
.CHECK_FUNCS('getcwd fchown chmod fchmod mknod mknod64')
60 conf
.CHECK_FUNCS('strtol strchr strupr chflags')
61 conf
.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
62 conf
.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
63 conf
.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent')
64 conf
.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
65 conf
.CHECK_FUNCS('setpriv setgidx setuidx setgroups sysconf stat64 fstat64')
66 conf
.CHECK_FUNCS('lstat64 fopen64 atexit grantpt lseek64 ftruncate64 posix_fallocate posix_fallocate64')
67 conf
.CHECK_FUNCS('fseek64 fseeko64 ftell64 ftello64 setluid')
68 conf
.CHECK_FUNCS('getpwnam', headers
='sys/types.h pwd.h')
69 conf
.CHECK_FUNCS('opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64')
70 conf
.CHECK_FUNCS('getpwent_r getdents64 setenv strcasecmp fcvt fcvtl')
71 conf
.CHECK_FUNCS('syslog vsyslog timegm setlocale nl_langinfo')
72 conf
.CHECK_FUNCS_IN('nanosleep', 'rt')
73 conf
.CHECK_FUNCS('lutimes futimes utimensat futimens')
74 conf
.CHECK_FUNCS('mlock munlock mlockall munlockall')
75 conf
.CHECK_FUNCS('memalign posix_memalign hstrerror')
76 conf
.CHECK_FUNCS('shmget')
77 conf
.CHECK_FUNCS_IN('shm_open', 'rt', checklibc
=True)
78 conf
.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain')
79 conf
.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
81 # Check for inotify support
82 conf
.CHECK_HEADERS('linux/inotify.h asm/unistd.h sys/inotify.h')
83 conf
.CHECK_FUNCS('inotify_init')
84 if "HAVE_LINUX_INOTIFY_H" in conf
.env
and "HAVE_INOTIFY_INIT" in conf
.env
:
85 conf
.DEFINE('HAVE_INOTIFY', 1)
87 # Check for kernel change notify support
93 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
94 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain
=False, execute
=True,
95 headers
='fcntl.h signal.h',
96 msg
="Checking for kernel change notify support")
98 # Check for Linux kernel oplocks
100 #include <sys/types.h>
104 #define F_NOTIFY 1026
107 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
108 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain
=False, execute
=True,
109 msg
="Checking for Linux kernel oplocks")
111 # Check for IRIX kernel oplock types
112 conf
.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
113 'HAVE_KERNEL_OPLOCKS_IRIX', headers
='fcntl.h',
114 msg
="Checking for IRIX kernel oplock types")
116 # Check for krenel share modes
118 #include <sys/types.h>
121 #include <sys/file.h>
127 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
128 }''', 'HAVE_KERNEL_SHARE_MODES', addmain
=False, execute
=True,
129 msg
="Checking for krenel share modes")
131 # Check for various members of the stat structure
132 conf
.CHECK_TYPES('blksize_t blkcnt_t')
133 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define
='HAVE_STAT_ST_BLOCKS',
134 headers
='sys/stat.h')
135 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define
='HAVE_STAT_ST_BLKSIZE',
136 headers
='sys/stat.h')
138 # Check for POSIX capability support
139 if "HAVE_SYS_CAPABILITY_H" in conf
.env
:
140 conf
.CHECK_FUNCS_IN('cap_get_proc', 'cap')
144 if (!(cap = cap_get_proc())) exit(1);
146 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
147 cap_set_proc(cap);''',
148 'HAVE_POSIX_CAPABILITIES', execute
=True, lib
="cap",
149 headers
='sys/capability.h',
150 msg
="Checking whether POSIX capabilities are available")
152 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
153 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
155 if conf
.CONFIG_SET("HAVE_RPC_RPC_H"):
156 conf
.CHECK_TYPE('int16', headers
='rpc/rpc.h',
157 define
='HAVE_INT16_FROM_RPC_RPC_H',
158 msg
="Checking for int16 typedef included by rpc/rpc.h")
159 conf
.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
160 headers
='sys/types.h rpc/rpc.h',
161 msg
="Checking for uint16 typedef included by rpc/rpc.h")
162 conf
.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
163 headers
='sys/types.h rpc/rpc.h',
164 msg
="Checking for int32 typedef included by rpc/rpc.h")
165 conf
.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
166 headers
='sys/types.h rpc/rpc.h',
167 msg
="Checking for uint32 typedef included by rpc/rpc.h")
169 # Check if the compiler will optimize out functions
172 this_function_does_not_exist();
175 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
176 msg
="Checking if the compiler will optimize out functions")
179 _acl __acl add_proplist_entry atexit attr_getf attr_list attr_listf
180 attropen attr_remove attr_removef attr_set attr_setf backtrace_symbols
181 bindtextdomain _chdir __chdir chflags chmod _close __close _closedir
182 __closedir closedir64 creat64 crypt16 delproplist devnm dgettext dirfd
183 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent endnetgrent execl
184 extattr_delete_fd extattr_delete_link extattr_get_fd extattr_get_file
185 extattr_get_link extattr_list_fd extattr_list_file extattr_list_link
186 extattr_set_fd extattr_set_file extattr_set_link _facl __facl _fchdir
187 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
188 fdelproplist fgetea fgetproplist fgetxattr flistea flistxattr fopen64
189 _fork __fork fremoveea fremovexattr fseek64 fseeko64 fsetea
190 fsetproplist fsetxattr _fstat __fstat fstat64 _fstat64 __fstat64 fsync
191 ftell64 ftello64 ftruncate64 futimens futimes __fxstat getauthuid
192 getcwd _getcwd __getcwd getdents __getdents getdents64 getdirentries
193 getgrent getgrnam getgrouplist getmntent getnetgrent getpagesize
194 getproplist get_proplist_entry getpwanam getpwent_r getrlimit gettext
195 getutmpx getutxent glob grantpt hstrerror initgroups innetgr
196 inotify_init lgetea lgetxattr listea listxattr llistea llistxattr
197 llseek _llseek __llseek lremoveea lremovexattr _lseek __lseek lseek64
198 lsetea lsetxattr _lstat __lstat lstat64 _lstat64 __lstat64 lutimes
199 __lxstat memalign mknod mknod64 mlock mlockall munlock munlockall
200 nl_langinfo _open __open open64 _open64 __open64 _opendir __opendir
201 opendir64 pathconf poll posix_fallocate posix_fallocate64
202 posix_memalign prctl pread _pread __pread pread64 _pread64 __pread64
203 pututline pututxline pwrite _pwrite __pwrite pwrite64 _pwrite64
204 __pwrite64 rdchk _read __read _readdir __readdir readdir64 _readdir64
205 __readdir64 removeea removexattr rewinddir64 _seekdir __seekdir
206 seekdir64 select setea setenv setgidx setgroups setlocale setluid
207 setmntent setnetgrent setpgid setpriv setproplist setsid setuidx
208 setxattr shmget shm_open sigaction sigblock sigprocmask sigset
209 sizeof_proplist_entry _stat __stat stat64 _stat64 __stat64 statvfs
210 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctlbyname
211 __sys_llseek syslog _telldir __telldir telldir64 textdomain timegm
212 updwtmp updwtmpx utimensat vsyslog _write __write __xstat
213 yp_get_default_domain
216 conf
.CHECK_TYPE('struct timespec', headers
='sys/time.h time.h')
218 conf
.CHECK_SAMBA3_CHARSET() # see build/charset.py
221 default_static_modules
=TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam rpc_lsarpc rpc_samr
222 rpc_winreg rpc_initshutdown rpc_dssetup rpc_wkssvc rpc_svcctl
223 rpc_ntsvcs rpc_netlogon rpc_netdfs rpc_srvsvc rpc_spoolss
224 rpc_eventlog auth_sam auth_unix auth_winbind auth_wbc auth_server
225 auth_domain auth_builtin auth_netlogond vfs_default
226 nss_info_template''')
228 default_shared_modules
=TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
229 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
230 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850
231 charset_CP437 auth_script vfs_readahead vfs_xattr_tdb
232 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
233 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
236 if Options
.options
.developer
:
237 default_static_modules
.extend(TO_LIST('rpc_rpcecho pdb_ads'))
238 default_shared_modules
.extend(TO_LIST('charset_weird perfcount_test'))
240 move_to_shared
= TO_LIST(Options
.options
.shared_modules
)
241 move_to_static
= TO_LIST(Options
.options
.static_modules
)
243 for m
in move_to_static
:
244 if m
in default_shared_modules
:
245 default_shared_modules
.remove(m
)
246 default_static_modules
.append(m
)
247 for m
in move_to_shared
:
248 if m
in default_static_modules
:
249 default_static_modules
.remove(m
)
250 default_shared_modules
.append(m
)
252 conf
.DEFINE('STRING_STATIC_MODULES', ' '.join(default_static_modules
), quote
=True)
256 prefixes
= ['vfs', 'pdb', 'rpc', 'auth', 'nss_info', 'charset', 'idmap']
258 for m
in default_static_modules
:
260 if not p
in static_list
:
262 static_list
[p
].append(m
)
265 conf
.env
['%s_STATIC' % p
.upper()] = ''
266 conf
.env
['%s_SHARED' % p
.upper()] = ''
268 conf
.DEFINE('static_init_%s' % p
, '{ %s_init(); }' % '_init(); '.join(static_list
[p
]))
270 conf
.DEFINE('static_init_%s' % p
, '{}')
272 #TODO: Actually check for these
273 conf
.DEFINE('WITH_WINBIND', '1')
274 conf
.DEFINE('WITH_ADS', '1')
277 conf
.find_program('cups-config', var
='CUPS_CONFIG')
278 if conf
.env
.CUPS_CONFIG
:
279 conf
.check_cfg(path
="cups-config", args
="--cflags --ldflags --libs", package
="", uselib_store
="CUPS")
280 conf
.CHECK_HEADERS('cups/cups.h cups/language.h', lib
='CUPS')
283 conf
.CHECK_HEADERS('ldap.h lber.h')
284 conf
.CHECK_TYPE('ber_tag_t', 'unsigned int', headers
='ldap.h lber.h')
285 conf
.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
286 conf
.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers
='ldap.h')
287 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
288 # SASL wrapping hooks
289 if conf
.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
290 conf
.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
291 conf
.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
293 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
295 conf
.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
296 define
='HAVE_LBER_LOG_PRINT_FN', headers
='lber.h')
298 conf
.CHECK_FUNCS_IN('ldap_init ldap_initialize ldap_set_rebind_proc', 'ldap')
299 conf
.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
301 # Check if ldap_set_rebind_proc() takes three arguments
302 if conf
.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
303 'LDAP_SET_REBIND_PROC_ARGS',
304 msg
="Checking whether ldap_set_rebind_proc takes 3 arguments",
305 headers
='ldap.h lber.h', link
=False):
306 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
308 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
310 # last but not least, if ldap_init() exists, we want to use ldap
311 if conf
.CONFIG_SET('HAVE_LDAP_INIT'):
312 conf
.DEFINE('HAVE_LDAP', '1')
313 conf
.DEFINE('LDAP_DEPRECATED', '1')
314 conf
.env
['SMBLDAP'] = 'lib/smbldap.c'
315 conf
.env
['SMBLDAPUTIL'] = 'lib/smbldap_util.c'
318 conf
.find_program('krb5-config', var
='KRB5_CONFIG')
319 if conf
.env
.KRB5_CONFIG
:
320 conf
.check_cfg(path
="krb5-config", args
="--cflags --libs",
321 package
="gssapi", uselib_store
="krb5")
322 conf
.CHECK_HEADERS('krb5.h krb5/locate_plugin.h', lib
='krb5')
323 conf
.CHECK_HEADERS('gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h com_err.h', lib
='krb5')
325 if conf
.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'):
326 conf
.env
['WINBIND_KRB5_LOCATOR'] = 'bin/winbind_krb5_locator.so'
328 # Check for KRB5_DEPRECATED handling
329 conf
.CHECK_CODE('''#define KRB5_DEPRECATED 1
330 #include <krb5.h>''',
331 'HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER', addmain
=False,
333 msg
="Checking for KRB5_DEPRECATED define taking an identifier")
335 conf
.CHECK_FUNCS_IN('_et_list', 'com_err')
336 conf
.CHECK_FUNCS_IN('krb5_encrypt_data', 'k5crypto')
337 conf
.CHECK_FUNCS_IN('crypto', 'des_set_key')
338 conf
.CHECK_FUNCS_IN('copy_Authenticator', 'asn1')
339 conf
.CHECK_FUNCS_IN('roken_getaddrinfo_hostspec', 'roken')
340 conf
.CHECK_FUNCS_IN('gss_display_status', 'gssapi gssapi_krb5')
341 conf
.CHECK_FUNCS_IN('krb5_mk_req_extended krb5_kt_compare', 'krb5')
343 krb5_set_real_time krb5_set_default_in_tkt_etypes krb5_set_default_tgs_enctypes
344 krb5_set_default_tgs_ktypes krb5_principal2salt krb5_use_enctype
345 krb5_string_to_key krb5_get_pw_salt krb5_string_to_key_salt krb5_auth_con_setkey
346 krb5_auth_con_setuseruserkey krb5_locate_kdc krb5_get_permitted_enctypes
347 krb5_get_default_in_tkt_etypes krb5_free_data_contents
348 krb5_principal_get_comp_string krb5_free_unparsed_name
349 krb5_free_keytab_entry_contents krb5_kt_free_entry krb5_krbhst_init
350 krb5_krbhst_get_addrinfo krb5_c_enctype_compare krb5_enctypes_compatible_keys
351 krb5_crypto_init krb5_crypto_destroy krb5_decode_ap_req free_AP_REQ
352 krb5_verify_checksum krb5_c_verify_checksum krb5_principal_compare_any_realm
353 krb5_parse_name_norealm krb5_princ_size krb5_get_init_creds_opt_set_pac_request
354 krb5_get_renewed_creds krb5_get_kdc_cred krb5_free_error_contents
355 initialize_krb5_error_table krb5_get_init_creds_opt_alloc
356 krb5_get_init_creds_opt_free krb5_get_init_creds_opt_get_error
357 krb5_enctype_to_string krb5_fwd_tgt_creds krb5_auth_con_set_req_cksumtype
358 krb5_get_creds_opt_alloc krb5_get_creds_opt_set_impersonate krb5_get_creds
359 krb5_get_credentials_for_user krb5_get_host_realm krb5_free_host_realm''',
361 conf
.CHECK_DECLS('''krb5_get_credentials_for_user
362 krb5_auth_con_set_req_cksumtype''',
363 headers
='krb5.h', always
=True)
365 conf
.SAMBA_CONFIG_H('include/config.h')