7 from optparse
import SUPPRESS_HELP
8 sys
.path
.insert(0, srcdir
+"/buildtools/wafsamba")
9 import wafsamba
, Options
14 version
= wafsamba
.samba_version_file("./VERSION")
16 VERSION
=version
.STRING
19 opt
.BUILTIN_DEFAULT('NONE')
20 opt
.BUNDLED_EXTENSION_DEFAULT('s3')
21 opt
.RECURSE('../lib/replace')
23 opt
.RECURSE('../lib/nss_wrapper')
24 opt
.RECURSE('../lib/socket_wrapper')
25 opt
.RECURSE('../lib/tevent')
26 opt
.RECURSE('../lib/tdb')
28 opt
.add_option('--with-static-modules',
29 help=("Comma-separated list of names of modules to statically link in"),
30 action
="store", dest
='static_modules', default
='')
31 opt
.add_option('--with-shared-modules',
32 help=("Comma-separated list of names of modules to build shared"),
33 action
="store", dest
='shared_modules', default
='')
34 opt
.add_option('--enable-selftest',
35 help=("enable options necessary for selftest"),
36 action
="store_true", dest
='enable_selftest', default
=False)
38 opt
.SAMBA3_ADD_OPTION('winbind')
39 opt
.SAMBA3_ADD_OPTION('swat')
40 opt
.SAMBA3_ADD_OPTION('ads')
41 opt
.SAMBA3_ADD_OPTION('krb5')
42 opt
.SAMBA3_ADD_OPTION('ldap')
43 opt
.SAMBA3_ADD_OPTION('cups', with_name
="enable", without_name
="disable")
44 opt
.SAMBA3_ADD_OPTION('merged-build', with_name
="enable", without_name
="disable")
45 opt
.SAMBA3_ADD_OPTION('pam')
46 opt
.SAMBA3_ADD_OPTION('quotas')
47 opt
.SAMBA3_ADD_OPTION('sys-quotas')
48 opt
.SAMBA3_ADD_OPTION('sendfile-support')
49 opt
.SAMBA3_ADD_OPTION('utmp')
50 opt
.SAMBA3_ADD_OPTION('pthreadpool', with_name
="enable", without_name
="disable")
54 from samba_utils
import TO_LIST
56 conf
.DEFINE('PACKAGE_NAME', 'Samba', quote
=True)
57 conf
.DEFINE('PACKAGE_STRING', 'Samba %s' % version
.MAJOR
, quote
=True)
58 conf
.DEFINE('PACKAGE_TARNAME', 'samba', quote
=True)
59 conf
.DEFINE('PACKAGE_URL', "", quote
=True)
60 conf
.DEFINE('PACKAGE_VERSION', "%s" % version
.MAJOR
, quote
=True)
61 conf
.DEFINE('PACKAGE_BUGREPORT', 'samba-technical@samba.org', quote
=True)
63 conf
.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
64 conf
.DEFINE('_SAMBA_BUILD_', version
.MAJOR
, add_to_cflags
=True)
65 conf
.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags
=True)
66 if Options
.options
.developer
:
67 conf
.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
68 conf
.env
['developer'] = True
70 if Options
.options
.with_swat
:
71 conf
.env
['build_swat'] = True
73 # set a limit on recursing in the waf preprocessor
74 conf
.env
.preprocessor_recursion_limit
= 10
76 conf
.ADD_EXTRA_INCLUDES('''#source3 #source3/include #lib/replace #lib/talloc
77 #lib/tevent #source3/libaddns #source3/librpc
78 #source3/lib #lib/tdb/include #lib/popt #source4''')
80 conf
.RECURSE('../lib/replace')
82 conf
.RECURSE('../lib/tdb')
83 conf
.RECURSE('../lib/talloc')
84 conf
.RECURSE('../lib/tevent')
85 conf
.RECURSE('../lib/popt')
86 conf
.RECURSE('../lib/nss_wrapper')
87 conf
.RECURSE('../lib/socket_wrapper')
88 conf
.RECURSE('../lib/zlib')
90 conf
.CHECK_HEADERS('execinfo.h libexc.h libunwind.h')
92 conf
.CHECK_FUNCS('getcwd fchown chmod fchmod mknod mknod64')
93 conf
.CHECK_FUNCS('strtol strchr strupr chflags')
94 conf
.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
95 conf
.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
96 conf
.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent')
97 conf
.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
98 conf
.CHECK_FUNCS('setpriv setgidx setuidx setgroups sysconf stat64 fstat64')
99 conf
.CHECK_FUNCS('lstat64 fopen64 atexit grantpt lseek64 ftruncate64 posix_fallocate posix_fallocate64')
100 conf
.CHECK_FUNCS('fseek64 fseeko64 ftell64 ftello64 setluid')
101 conf
.CHECK_FUNCS('getpwnam', headers
='sys/types.h pwd.h')
102 conf
.CHECK_FUNCS('opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64')
103 conf
.CHECK_FUNCS('getpwent_r getdents64 setenv strcasecmp fcvt fcvtl')
104 conf
.CHECK_FUNCS('syslog vsyslog timegm setlocale nl_langinfo')
105 conf
.CHECK_FUNCS_IN('nanosleep', 'rt')
106 conf
.CHECK_FUNCS('lutimes futimes utimensat futimens')
107 conf
.CHECK_FUNCS('mlock munlock mlockall munlockall')
108 conf
.CHECK_FUNCS('memalign posix_memalign hstrerror')
109 conf
.CHECK_FUNCS('shmget')
110 conf
.CHECK_FUNCS_IN('shm_open', 'rt', checklibc
=True)
111 conf
.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain')
112 #FIXME: for some reason this one still fails
113 conf
.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
114 conf
.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
116 # Check for inotify support
117 conf
.CHECK_HEADERS('linux/inotify.h asm/unistd.h sys/inotify.h')
118 conf
.CHECK_FUNCS('inotify_init')
119 if "HAVE_LINUX_INOTIFY_H" in conf
.env
and "HAVE_INOTIFY_INIT" in conf
.env
:
120 conf
.DEFINE('HAVE_INOTIFY', 1)
122 # Check for kernel change notify support
125 #define F_NOTIFY 1026
128 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
129 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain
=False, execute
=True,
130 headers
='fcntl.h signal.h',
131 msg
="Checking for kernel change notify support")
133 # Check for Linux kernel oplocks
135 #include <sys/types.h>
139 #define F_NOTIFY 1026
142 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
143 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain
=False, execute
=True,
144 msg
="Checking for Linux kernel oplocks")
146 # Check for IRIX kernel oplock types
147 conf
.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
148 'HAVE_KERNEL_OPLOCKS_IRIX', headers
='fcntl.h',
149 msg
="Checking for IRIX kernel oplock types")
151 # Check for krenel share modes
153 #include <sys/types.h>
156 #include <sys/file.h>
162 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
163 }''', 'HAVE_KERNEL_SHARE_MODES', addmain
=False, execute
=True,
164 msg
="Checking for krenel share modes")
166 # Check for various members of the stat structure
167 conf
.CHECK_TYPES('blksize_t blkcnt_t')
168 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define
='HAVE_STAT_ST_BLOCKS',
169 headers
='sys/stat.h')
170 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define
='HAVE_STAT_ST_BLKSIZE',
171 headers
='sys/stat.h')
173 # Check for POSIX capability support
174 conf
.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers
='sys/capability.h')
176 if "HAVE_SYS_CAPABILITY_H" in conf
.env
:
180 if (!(cap = cap_get_proc())) exit(1);
182 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
183 cap_set_proc(cap);''',
184 'HAVE_POSIX_CAPABILITIES', execute
=True, lib
="cap",
185 headers
='sys/capability.h',
186 msg
="Checking whether POSIX capabilities are available")
188 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
189 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
191 if conf
.CONFIG_SET("HAVE_RPC_RPC_H"):
192 conf
.CHECK_TYPE('int16', headers
='rpc/rpc.h',
193 define
='HAVE_INT16_FROM_RPC_RPC_H',
194 msg
="Checking for int16 typedef included by rpc/rpc.h")
195 conf
.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
196 headers
='sys/types.h rpc/rpc.h',
197 msg
="Checking for uint16 typedef included by rpc/rpc.h")
198 conf
.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
199 headers
='sys/types.h rpc/rpc.h',
200 msg
="Checking for int32 typedef included by rpc/rpc.h")
201 conf
.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
202 headers
='sys/types.h rpc/rpc.h',
203 msg
="Checking for uint32 typedef included by rpc/rpc.h")
205 # Check if the compiler will optimize out functions
208 this_function_does_not_exist();
211 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
212 msg
="Checking if the compiler will optimize out functions")
215 _acl __acl add_proplist_entry atexit attr_getf attr_list attr_listf
216 attropen attr_remove attr_removef attr_set attr_setf backtrace_symbols
217 bindtextdomain _chdir __chdir chflags chmod _close __close _closedir
218 __closedir closedir64 creat64 crypt16 delproplist devnm dgettext dirfd
219 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent endnetgrent execl
220 extattr_delete_fd extattr_delete_link extattr_get_fd extattr_get_file
221 extattr_get_link extattr_list_fd extattr_list_file extattr_list_link
222 extattr_set_fd extattr_set_file extattr_set_link _facl __facl _fchdir
223 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
224 fdelproplist fgetea fgetproplist fgetxattr flistea flistxattr fopen64
225 _fork __fork fremoveea fremovexattr fseek64 fseeko64 fsetea
226 fsetproplist fsetxattr _fstat __fstat fstat64 _fstat64 __fstat64 fsync
227 ftell64 ftello64 ftruncate64 futimens futimes __fxstat getauthuid
228 getcwd _getcwd __getcwd getdents __getdents getdents64 getdirentries
229 getgrent getgrnam getgrouplist getmntent getnetgrent getpagesize
230 getproplist get_proplist_entry getpwanam getpwent_r getrlimit gettext
231 glob grantpt hstrerror initgroups innetgr
232 inotify_init lgetea lgetxattr listea listxattr llistea llistxattr
233 llseek _llseek __llseek lremoveea lremovexattr _lseek __lseek lseek64
234 lsetea lsetxattr _lstat __lstat lstat64 _lstat64 __lstat64 lutimes
235 __lxstat memalign mknod mknod64 mlock mlockall munlock munlockall
236 nl_langinfo _open __open open64 _open64 __open64 _opendir __opendir
237 opendir64 pathconf poll posix_fallocate posix_fallocate64
238 posix_memalign prctl pread _pread __pread pread64 _pread64 __pread64
239 pwrite _pwrite __pwrite pwrite64 _pwrite64
240 __pwrite64 rdchk _read __read _readdir __readdir readdir64 _readdir64
241 __readdir64 removeea removexattr rewinddir64 _seekdir __seekdir
242 seekdir64 select setea setenv setgidx setgroups setlocale setluid
243 setmntent setnetgrent setpgid setpriv setproplist setsid setuidx
244 setxattr shmget shm_open sigaction sigblock sigprocmask sigset
245 sizeof_proplist_entry _stat __stat stat64 _stat64 __stat64 statvfs
246 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctlbyname
247 __sys_llseek syslog _telldir __telldir telldir64 textdomain timegm
248 utimensat vsyslog _write __write __xstat
251 conf
.CHECK_TYPE('struct timespec', headers
='sys/time.h time.h')
253 conf
.CHECK_SAMBA3_CHARSET() # see build/charset.py
256 default_static_modules
=TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam rpc_lsarpc rpc_samr
257 rpc_winreg rpc_initshutdown rpc_dssetup rpc_wkssvc rpc_svcctl
258 rpc_ntsvcs rpc_netlogon rpc_netdfs rpc_srvsvc rpc_spoolss
259 rpc_eventlog auth_sam auth_unix auth_winbind auth_wbc auth_server
260 auth_domain auth_builtin auth_netlogond vfs_default
261 nss_info_template''')
263 default_shared_modules
=TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
264 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
265 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850
266 charset_CP437 auth_script vfs_readahead vfs_xattr_tdb
267 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
268 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
271 if Options
.options
.developer
:
272 default_static_modules
.extend(TO_LIST('rpc_rpcecho pdb_ads'))
273 default_shared_modules
.extend(TO_LIST('charset_weird perfcount_test'))
275 move_to_shared
= TO_LIST(Options
.options
.shared_modules
)
276 move_to_static
= TO_LIST(Options
.options
.static_modules
)
278 for m
in move_to_static
:
279 if m
in default_shared_modules
:
280 default_shared_modules
.remove(m
)
281 default_static_modules
.append(m
)
282 for m
in move_to_shared
:
283 if m
in default_static_modules
:
284 default_static_modules
.remove(m
)
285 default_shared_modules
.append(m
)
287 conf
.DEFINE('STRING_STATIC_MODULES', ' '.join(default_static_modules
), quote
=True)
292 prefixes
= ['vfs', 'pdb', 'rpc', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
293 conf
.env
['MODULE_PREFIXES'] = prefixes
295 for m
in default_static_modules
:
297 if not p
in static_list
:
299 static_list
[p
].append(m
)
300 for m
in default_shared_modules
:
302 if not p
in shared_list
:
304 shared_list
[p
].append(m
)
307 static_env
= "%s_STATIC" % p
.upper()
308 shared_env
= "%s_SHARED" % p
.upper()
309 conf
.env
[static_env
] = []
310 conf
.env
[shared_env
] = []
313 for entry
in static_list
[p
]:
314 decl_list
+= "extern NTSTATUS %s_init(void); " % entry
315 conf
.env
[static_env
].append('%s' % entry
.upper())
316 decl_list
= decl_list
.rstrip()
317 conf
.DEFINE('static_decl_%s' % p
, decl_list
)
318 conf
.DEFINE('static_init_%s' % p
, '{ %s_init(); }' % '_init(); '.join(static_list
[p
]))
320 conf
.DEFINE('static_decl_%s' % p
, '')
321 conf
.DEFINE('static_init_%s' % p
, '{}')
323 for entry
in shared_list
[p
]:
324 conf
.DEFINE('%s_init' % entry
, 'init_samba_module')
325 conf
.env
[shared_env
].append('%s' % entry
.upper())
327 if Options
.options
.with_winbind
:
328 conf
.env
.build_winbind
= True
329 conf
.DEFINE('WITH_WINBIND', '1')
331 conf
.find_program('awk', var
='AWK')
333 # Darwin has extra options to xattr-family functions
334 conf
.CHECK_CODE('getxattr(0, 0, 0, 0, 0, 0);',
336 msg
="Checking whether xattr interface takes additional options",
337 headers
='sys/types.h attr/xattr.h sys/xattr.h')
339 #FIXME: Should just be set when krb5 and ldap requirements are fulfilled
340 if Options
.options
.with_ads
:
341 conf
.DEFINE('WITH_ADS', '1')
344 conf
.find_program('cups-config', var
='CUPS_CONFIG')
345 if conf
.env
.CUPS_CONFIG
and Options
.options
.with_cups
:
346 conf
.check_cfg(path
="cups-config", args
="--cflags --ldflags --libs",
347 package
="", uselib_store
="cups")
348 conf
.CHECK_HEADERS('cups/cups.h cups/language.h', lib
='cups')
349 conf
.CHECK_LIB('cups')
351 # define an empty subsystem for cups, to allow it to be used as an empty dependency
352 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
355 if Options
.options
.with_ldap
:
356 conf
.CHECK_HEADERS('ldap.h lber.h')
357 conf
.CHECK_TYPE('ber_tag_t', 'unsigned int', headers
='ldap.h lber.h')
358 conf
.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
359 conf
.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers
='ldap.h')
360 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
361 # SASL wrapping hooks
362 if conf
.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
363 conf
.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
364 conf
.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
366 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
368 conf
.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
369 define
='HAVE_LBER_LOG_PRINT_FN', headers
='lber.h')
371 conf
.CHECK_FUNCS_IN('ldap_init ldap_initialize ldap_set_rebind_proc', 'ldap')
372 conf
.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
374 # Check if ldap_set_rebind_proc() takes three arguments
375 if conf
.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
376 'LDAP_SET_REBIND_PROC_ARGS',
377 msg
="Checking whether ldap_set_rebind_proc takes 3 arguments",
378 headers
='ldap.h lber.h', link
=False):
379 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
381 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
383 # last but not least, if ldap_init() exists, we want to use ldap
384 if conf
.CONFIG_SET('HAVE_LDAP_INIT'):
385 conf
.DEFINE('HAVE_LDAP', '1')
386 conf
.DEFINE('LDAP_DEPRECATED', '1')
387 conf
.env
['SMBLDAP'] = 'lib/smbldap.c'
388 conf
.env
['SMBLDAPUTIL'] = 'lib/smbldap_util.c'
390 conf
.SET_TARGET_TYPE('ldap', 'EMPTY')
391 conf
.SET_TARGET_TYPE('lber', 'EMPTY')
394 conf
.find_program('krb5-config', var
='KRB5_CONFIG')
395 if conf
.env
.KRB5_CONFIG
and Options
.options
.with_krb5
:
396 conf
.check_cfg(path
="krb5-config", args
="--cflags --libs",
397 package
="gssapi", uselib_store
="krb5")
398 conf
.CHECK_HEADERS('krb5.h krb5/locate_plugin.h', lib
='krb5')
399 conf
.CHECK_HEADERS('gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h com_err.h', lib
='krb5')
401 if conf
.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'):
402 conf
.env
['WINBIND_KRB5_LOCATOR'] = 'bin/winbind_krb5_locator.so'
404 conf
.CHECK_FUNCS_IN('_et_list', 'com_err')
405 conf
.CHECK_FUNCS_IN('krb5_encrypt_data', 'k5crypto')
406 conf
.CHECK_FUNCS_IN('crypto', 'des_set_key')
407 conf
.CHECK_FUNCS_IN('copy_Authenticator', 'asn1')
408 conf
.CHECK_FUNCS_IN('roken_getaddrinfo_hostspec', 'roken')
409 conf
.CHECK_FUNCS_IN('gss_display_status', 'gssapi gssapi_krb5')
410 conf
.CHECK_FUNCS_IN('krb5_mk_req_extended krb5_kt_compare', 'krb5')
412 krb5_set_real_time krb5_set_default_in_tkt_etypes krb5_set_default_tgs_enctypes
413 krb5_set_default_tgs_ktypes krb5_principal2salt krb5_use_enctype
414 krb5_string_to_key krb5_get_pw_salt krb5_string_to_key_salt krb5_auth_con_setkey
415 krb5_auth_con_setuseruserkey krb5_locate_kdc krb5_get_permitted_enctypes
416 krb5_get_default_in_tkt_etypes krb5_free_data_contents
417 krb5_principal_get_comp_string krb5_free_unparsed_name
418 krb5_free_keytab_entry_contents krb5_kt_free_entry krb5_krbhst_init
419 krb5_krbhst_get_addrinfo krb5_c_enctype_compare krb5_enctypes_compatible_keys
420 krb5_crypto_init krb5_crypto_destroy krb5_decode_ap_req free_AP_REQ
421 krb5_verify_checksum krb5_c_verify_checksum krb5_principal_compare_any_realm
422 krb5_parse_name_norealm krb5_princ_size krb5_get_init_creds_opt_set_pac_request
423 krb5_get_renewed_creds krb5_get_kdc_cred krb5_free_error_contents
424 initialize_krb5_error_table krb5_get_init_creds_opt_alloc
425 krb5_get_init_creds_opt_free krb5_get_init_creds_opt_get_error
426 krb5_enctype_to_string krb5_fwd_tgt_creds krb5_auth_con_set_req_cksumtype
427 krb5_get_creds_opt_alloc krb5_get_creds_opt_set_impersonate krb5_get_creds
428 krb5_get_credentials_for_user krb5_get_host_realm krb5_free_host_realm''',
430 conf
.CHECK_DECLS('''krb5_get_credentials_for_user
431 krb5_auth_con_set_req_cksumtype''',
432 headers
='krb5.h', always
=True)
433 conf
.CHECK_VARIABLE('AP_OPTS_USE_SUBKEY', headers
='krb5.h')
434 conf
.CHECK_VARIABLE('KV5M_KEYTAB', headers
='krb5.h')
435 conf
.CHECK_VARIABLE('KRB5_KU_OTHER_CKSUM', headers
='krb5.h')
436 conf
.CHECK_VARIABLE('KRB5_KEYUSAGE_APP_DATA_CKSUM', headers
='krb5.h')
437 conf
.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'key', headers
='krb5.h',
438 define
='HAVE_KRB5_KEYTAB_ENTRY_KEY')
439 conf
.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'keyblock', headers
='krb5.h',
440 define
='HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK')
441 conf
.CHECK_STRUCTURE_MEMBER('krb5_address', 'magic', headers
='krb5.h',
442 define
='HAVE_MAGIC_IN_KRB5_ADDRESS')
443 conf
.CHECK_STRUCTURE_MEMBER('krb5_address', 'addrtype', headers
='krb5.h',
444 define
='HAVE_ADDRTYPE_IN_KRB5_ADDRESS')
445 conf
.CHECK_STRUCTURE_MEMBER('krb5_ticket', 'enc_part2', headers
='krb5.h',
446 define
='HAVE_KRB5_TKT_ENC_PART2')
447 conf
.CHECK_STRUCTURE_MEMBER('krb5_creds', 'keyblock', headers
='krb5.h',
448 define
='HAVE_KRB5_KEYBLOCK_IN_CREDS')
449 conf
.CHECK_STRUCTURE_MEMBER('krb5_creds', 'session', headers
='krb5.h',
450 define
='HAVE_KRB5_SESSION_IN_CREDS')
451 conf
.CHECK_TYPE('krb5_encrypt_block', headers
='krb5.h')
454 krb5_get_init_creds_opt *opt = NULL;
455 krb5_get_init_creds_opt_free(ctx, opt);
457 'KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT',
458 headers
='krb5.h', link
=False,
459 msg
="Checking whether krb5_get_init_creds_opt_free takes a context argument")
460 conf
.CHECK_CODE('krb5_mk_error(0,0,0)',
461 'HAVE_SHORT_KRB5_MK_ERROR_INTERFACE',
462 headers
='krb5.h', link
=False,
463 msg
="Checking whether krb5_mk_error takes 3 arguments MIT or 9 Heimdal")
465 const krb5_data *pkdata;
466 krb5_context context;
467 krb5_principal principal;
468 pkdata = krb5_princ_component(context, principal, 0);
470 'HAVE_KRB5_PRINC_COMPONENT',
471 headers
='krb5.h', lib
='krb5',
472 msg
="Checking whether krb5_princ_component is available")
477 krb5_enctype_to_string(1, buf, 256);
480 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_SIZE_T_ARG',
481 headers
='krb5.h', lib
='krb5',
482 addmain
=False, cflags
='-Werror',
483 msg
="Checking whether krb5_enctype_to_string takes size_t argument")
487 krb5_context context = NULL;
489 krb5_enctype_to_string(context, 1, &str);
493 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_KRB5_CONTEXT_ARG',
494 headers
='krb5.h stdlib.h', lib
='krb5',
495 addmain
=False, cflags
='-Werror',
496 msg
="Checking whether krb5_enctype_to_string takes krb5_context argument")
499 conf
.SET_TARGET_TYPE('krb5', 'EMPTY')
500 conf
.SET_TARGET_TYPE('gssapi', 'EMPTY')
501 conf
.SET_TARGET_TYPE('gssapi_krb5', 'EMPTY')
503 if Options
.options
.with_utmp
:
504 conf
.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
505 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers
='utmp.h',
506 define
='HAVE_UT_UT_NAME')
507 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers
='utmp.h',
508 define
='HAVE_UT_UT_USER')
509 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers
='utmp.h',
510 define
='HAVE_UT_UT_ID')
511 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers
='utmp.h',
512 define
='HAVE_UT_UT_HOST')
513 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers
='utmp.h',
514 define
='HAVE_UT_UT_TIME')
515 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers
='utmp.h',
516 define
='HAVE_UT_UT_TV')
517 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers
='utmp.h',
518 define
='HAVE_UT_UT_TYPE')
519 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers
='utmp.h',
520 define
='HAVE_UT_UT_PID')
521 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers
='utmp.h',
522 define
='HAVE_UT_UT_EXIT')
523 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr_v6', headers
='utmp.h',
524 define
='HAVE_UT_UT_ADDR_V6')
525 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr', headers
='utmp.h',
526 define
='HAVE_UT_UT_ADDR')
527 conf
.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers
='utmpx.h',
528 define
='HAVE_UX_UT_SYSLEN')
529 conf
.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
530 'PUTUTLINE_RETURNS_UTMP', headers
='utmp.h',
531 msg
="Checking whether pututline returns pointer")
532 conf
.DEFINE('WITH_UTMP', 1)
534 # FIXME: these should be tests for features, but the old build system just
537 host_os
= sys
.platform
539 # Python doesn't have case switches... :/
540 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
541 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
542 if (host_os
.rfind('linux') > -1) or (host_os
.rfind('gnu') > -1) or (host_os
.rfind('qnx') > -1):
543 if host_os
.rfind('linux') > -1:
544 conf
.DEFINE('LINUX', '1')
545 elif host_os
.rfind('qnx') > -1:
546 conf
.DEFINE('QNX', '1')
547 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
548 elif (host_os
.rfind('darwin') > -1):
549 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
550 # FIXME: Add more checks here.
552 print "Unknown host_os '%s', please report this to samba-technical@samba.org" % host_os
554 conf
.SAMBA_CONFIG_H('include/config.h')
557 "build 'tags' file using ctags"
559 source_root
= os
.path
.dirname(Utils
.g_module
.root_path
)
560 cmd
= 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
561 print("Running: %s" % cmd
)