10 from optparse
import SUPPRESS_HELP
11 sys
.path
.insert(0, srcdir
+"/buildtools/wafsamba")
12 import wafsamba
, Options
17 def load_version(env
=None):
18 '''load samba versions either from ./VERSION or git
19 return a version object for detailed breakdown'''
20 import samba_utils
, Utils
22 env
= samba_utils
.LOAD_ENVIRONMENT()
24 version
= wafsamba
.samba_version_file("./VERSION", "..", env
=env
)
25 Utils
.g_module
.VERSION
= version
.STRING
29 opt
.BUILTIN_DEFAULT('NONE')
30 opt
.PRIVATE_EXTENSION_DEFAULT('s3')
31 opt
.RECURSE('../lib/replace')
33 opt
.RECURSE('selftest')
34 opt
.RECURSE('../lib/nss_wrapper')
35 opt
.RECURSE('../lib/socket_wrapper')
36 opt
.RECURSE('../lib/tevent')
37 opt
.RECURSE('../lib/tdb')
39 opt
.add_option('--with-static-modules',
40 help=("Comma-separated list of names of modules to statically link in"),
41 action
="store", dest
='static_modules', default
=None)
42 opt
.add_option('--with-shared-modules',
43 help=("Comma-separated list of names of modules to build shared"),
44 action
="store", dest
='shared_modules', default
=None)
45 opt
.add_option('--enable-selftest',
46 help=("enable options necessary for selftest"),
47 action
="store_true", dest
='enable_selftest', default
=False)
49 opt
.SAMBA3_ADD_OPTION('winbind')
50 opt
.SAMBA3_ADD_OPTION('swat')
51 opt
.SAMBA3_ADD_OPTION('ads')
52 opt
.SAMBA3_ADD_OPTION('krb5')
53 opt
.SAMBA3_ADD_OPTION('ldap')
54 opt
.SAMBA3_ADD_OPTION('cups', with_name
="enable", without_name
="disable")
55 opt
.SAMBA3_ADD_OPTION('merged-build', with_name
="enable", without_name
="disable")
56 opt
.SAMBA3_ADD_OPTION('pam')
57 opt
.SAMBA3_ADD_OPTION('quotas')
58 opt
.SAMBA3_ADD_OPTION('sys-quotas')
59 opt
.SAMBA3_ADD_OPTION('sendfile-support')
60 opt
.SAMBA3_ADD_OPTION('utmp')
61 opt
.SAMBA3_ADD_OPTION('pthreadpool', with_name
="enable", without_name
="disable")
62 opt
.SAMBA3_ADD_OPTION('avahi', with_name
="enable", without_name
="disable")
63 opt
.SAMBA3_ADD_OPTION('iconv')
64 opt
.SAMBA3_ADD_OPTION('acl-support')
65 opt
.SAMBA3_ADD_OPTION('dnsupdate')
69 from samba_utils
import TO_LIST
71 version
= load_version(env
=conf
.env
)
73 conf
.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
74 conf
.DEFINE('_SAMBA_BUILD_', version
.MAJOR
, add_to_cflags
=True)
75 conf
.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags
=True)
77 if Options
.options
.developer
:
78 conf
.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
79 conf
.env
['developer'] = True
81 if Options
.options
.with_swat
:
82 conf
.env
['build_swat'] = True
84 conf
.ADD_EXTRA_INCLUDES('''#source3 #source3/include #lib/replace #lib/talloc
85 #lib/tevent #source3/libaddns #source3/librpc
86 #source3/lib #lib/tdb/include #lib/popt #source4''')
88 conf
.RECURSE('../lib/replace')
90 conf
.RECURSE('../lib/tdb')
91 conf
.RECURSE('../lib/talloc')
92 conf
.RECURSE('../lib/tevent')
93 conf
.RECURSE('../lib/popt')
94 conf
.RECURSE('../lib/nss_wrapper')
95 conf
.RECURSE('../lib/socket_wrapper')
96 conf
.RECURSE('../lib/zlib')
97 conf
.RECURSE('../libcli/smbreadline')
99 conf
.ADD_LDFLAGS("-Wl,--export-dynamic", testflags
=True)
101 conf
.CHECK_HEADERS('execinfo.h libexc.h libunwind.h netdb.h')
103 conf
.CHECK_FUNCS('getcwd fchown chmod fchmod mknod mknod64')
104 conf
.CHECK_FUNCS('strtol strchr strupr chflags')
105 conf
.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
106 conf
.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
107 conf
.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr')
108 conf
.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
109 conf
.CHECK_FUNCS('setpriv setgidx setuidx setgroups sysconf stat64 fstat64')
110 conf
.CHECK_FUNCS('lstat64 fopen64 atexit grantpt lseek64 ftruncate64 posix_fallocate posix_fallocate64')
111 conf
.CHECK_FUNCS('fseek64 fseeko64 ftell64 ftello64 setluid')
112 conf
.CHECK_FUNCS('getpwnam', headers
='sys/types.h pwd.h')
113 conf
.CHECK_FUNCS('opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64')
114 conf
.CHECK_FUNCS('getpwent_r getdents64 setenv strcasecmp fcvt fcvtl')
115 conf
.CHECK_FUNCS('syslog vsyslog timegm setlocale nl_langinfo')
116 conf
.CHECK_FUNCS_IN('nanosleep', 'rt')
117 conf
.CHECK_FUNCS('lutimes futimes utimensat futimens')
118 conf
.CHECK_FUNCS('mlock munlock mlockall munlockall')
119 conf
.CHECK_FUNCS('memalign posix_memalign hstrerror')
120 conf
.CHECK_FUNCS('shmget')
121 conf
.CHECK_FUNCS_IN('shm_open', 'rt', checklibc
=True)
122 conf
.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain')
123 #FIXME: for some reason this one still fails
124 conf
.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
125 conf
.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
126 conf
.CHECK_DECLS('fdatasync', reverse
=True)
127 conf
.CHECK_DECLS('readahead', reverse
=True, headers
='fcntl.h')
129 if conf
.CHECK_CODE('''
130 #if defined(HAVE_UNISTD_H)
133 long ret = splice(0,0,1,0,400,0);
137 conf
.CHECK_DECLS('splice', reverse
=True, headers
='fcntl.h')
139 # Check for inotify support
140 conf
.CHECK_HEADERS('linux/inotify.h asm/unistd.h sys/inotify.h')
141 conf
.CHECK_FUNCS('inotify_init')
142 if "HAVE_LINUX_INOTIFY_H" in conf
.env
and "HAVE_INOTIFY_INIT" in conf
.env
:
143 conf
.DEFINE('HAVE_INOTIFY', 1)
145 # Check for kernel change notify support
148 #define F_NOTIFY 1026
151 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
152 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain
=False, execute
=True,
153 headers
='fcntl.h signal.h',
154 msg
="Checking for kernel change notify support")
156 # Check for Linux kernel oplocks
158 #include <sys/types.h>
162 #define F_NOTIFY 1026
165 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
166 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain
=False, execute
=True,
167 msg
="Checking for Linux kernel oplocks")
169 # Check for IRIX kernel oplock types
170 conf
.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
171 'HAVE_KERNEL_OPLOCKS_IRIX', headers
='fcntl.h',
172 msg
="Checking for IRIX kernel oplock types")
174 # Check for krenel share modes
176 #include <sys/types.h>
179 #include <sys/file.h>
185 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
186 }''', 'HAVE_KERNEL_SHARE_MODES', addmain
=False, execute
=True,
187 msg
="Checking for krenel share modes")
189 # Check for various members of the stat structure
190 conf
.CHECK_TYPES('blksize_t blkcnt_t')
191 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define
='HAVE_STAT_ST_BLOCKS',
192 headers
='sys/stat.h')
193 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define
='HAVE_STAT_ST_BLKSIZE',
194 headers
='sys/stat.h')
196 # Check for POSIX capability support
197 conf
.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers
='sys/capability.h')
199 if "HAVE_SYS_CAPABILITY_H" in conf
.env
:
203 if (!(cap = cap_get_proc())) exit(1);
205 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
206 cap_set_proc(cap);''',
207 'HAVE_POSIX_CAPABILITIES', execute
=True, lib
="cap",
208 headers
='sys/capability.h',
209 msg
="Checking whether POSIX capabilities are available")
211 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
212 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
214 if conf
.CONFIG_SET("HAVE_RPC_RPC_H"):
215 conf
.CHECK_TYPE('int16', headers
='rpc/rpc.h',
216 define
='HAVE_INT16_FROM_RPC_RPC_H',
217 msg
="Checking for int16 typedef included by rpc/rpc.h")
218 conf
.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
219 headers
='sys/types.h rpc/rpc.h',
220 msg
="Checking for uint16 typedef included by rpc/rpc.h")
221 conf
.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
222 headers
='sys/types.h rpc/rpc.h',
223 msg
="Checking for int32 typedef included by rpc/rpc.h")
224 conf
.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
225 headers
='sys/types.h rpc/rpc.h',
226 msg
="Checking for uint32 typedef included by rpc/rpc.h")
227 conf
.CHECK_CODE('int i;', 'BROKEN_NISPLUS_INCLUDE_FILES',
228 headers
='sys/types.h sys/acl.h rpcsvc/nis.h',
229 msg
="Checking for broken nisplus include files")
231 # Check if the compiler will optimize out functions
234 this_function_does_not_exist();
237 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
238 msg
="Checking if the compiler will optimize out functions")
240 # Check if the compiler supports the LL suffix on long long integers
242 conf
.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL',
244 msg
="Checking for LL suffix on long long integers")
247 _acl __acl add_proplist_entry atexit attr_getf attr_list attr_listf
248 attropen attr_remove attr_removef attr_set attr_setf backtrace_symbols
249 bindtextdomain _chdir __chdir chflags chmod _close __close _closedir
250 __closedir closedir64 creat64 crypt16 delproplist devnm dgettext dirfd
251 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
252 extattr_delete_fd extattr_delete_link extattr_get_fd extattr_get_file
253 extattr_get_link extattr_list_fd extattr_list_file extattr_list_link
254 extattr_set_fd extattr_set_file extattr_set_link _facl __facl _fchdir
255 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
256 fdelproplist fgetea fgetproplist fgetxattr flistea flistxattr fopen64
257 _fork __fork fremoveea fremovexattr fseek64 fseeko64 fsetea
258 fsetproplist fsetxattr _fstat __fstat fstat64 _fstat64 __fstat64 fsync
259 ftell64 ftello64 ftruncate64 futimens futimes __fxstat getauthuid
260 getcwd _getcwd __getcwd getdents __getdents getdents64 getdirentries
261 getgrent getgrnam getgrouplist getmntent getpagesize
262 getproplist get_proplist_entry getpwanam getpwent_r getrlimit gettext
263 glob grantpt hstrerror initgroups innetgr
264 inotify_init lgetea lgetxattr listea listxattr llistea llistxattr
265 llseek _llseek __llseek lremoveea lremovexattr _lseek __lseek lseek64
266 lsetea lsetxattr _lstat __lstat lstat64 _lstat64 __lstat64 lutimes
267 __lxstat memalign mknod mknod64 mlock mlockall munlock munlockall
268 nl_langinfo _open __open open64 _open64 __open64 _opendir __opendir
269 opendir64 pathconf poll posix_fallocate posix_fallocate64
270 posix_memalign prctl pread _pread __pread pread64 _pread64 __pread64
271 pwrite _pwrite __pwrite pwrite64 _pwrite64
272 __pwrite64 rdchk _read __read _readdir __readdir readdir64 _readdir64
273 __readdir64 removeea removexattr rewinddir64 _seekdir __seekdir
274 seekdir64 select setea setenv setgidx setgroups setlocale setluid
275 setmntent setpgid setpriv setproplist setsid setuidx
276 setxattr shmget shm_open sigaction sigblock sigprocmask sigset
277 sizeof_proplist_entry _stat __stat stat64 _stat64 __stat64 statvfs
278 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctlbyname
279 __sys_llseek syslog _telldir __telldir telldir64 textdomain timegm
280 utimensat vsyslog _write __write __xstat
283 conf
.CHECK_TYPE('struct timespec', headers
='sys/time.h time.h')
285 conf
.CHECK_SAMBA3_CHARSET() # see build/charset.py
287 # FIXME: these should be tests for features, but the old build system just
290 host_os
= sys
.platform
292 # Python doesn't have case switches... :/
293 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
294 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
295 if (host_os
.rfind('linux') > -1) or (host_os
.rfind('gnu') > -1) or (host_os
.rfind('qnx') > -1):
296 if host_os
.rfind('linux') > -1:
297 conf
.DEFINE('LINUX', '1')
298 elif host_os
.rfind('qnx') > -1:
299 conf
.DEFINE('QNX', '1')
300 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
301 elif (host_os
.rfind('darwin') > -1):
302 conf
.DEFINE('DARWINOS', 1)
303 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
304 conf
.ADD_CFLAGS('-fno-common')
305 # FIXME: Add more checks here.
307 print "Unknown host_os '%s', please report this to samba-technical@samba.org" % host_os
309 #FIXME: add more checks
310 if Options
.options
.with_acl_support
:
311 if host_os
.rfind('linux') > -1:
312 conf
.CHECK_FUNCS_IN('acl_get_file', 'acl')
313 conf
.CHECK_FUNCS_IN('getxattr', 'attr')
314 if conf
.CHECK_CODE('''
317 acl_entry_t *entry_p;
318 return acl_get_entry(acl, entry_id, entry_p);
321 headers
='sys/types.h sys/acl.h', link
=False,
322 msg
="Checking for POSIX ACL support") :
324 acl_permset_t permset_d;
326 return acl_get_perm_np(permset_d, perm);
328 'HAVE_ACL_GET_PERM_NP',
329 headers
='sys/types.h sys/acl.h', link
=True,
330 msg
="Checking whether acl_get_perm_np() is available")
332 conf
.DEFINE('HAVE_NO_ACLS', 1)
333 conf
.SET_TARGET_TYPE('acl', 'EMPTY')
334 conf
.SET_TARGET_TYPE('attr', 'EMPTY')
336 conf
.DEFINE('HAVE_NO_ACLS', 1)
337 conf
.SET_TARGET_TYPE('acl', 'EMPTY')
338 conf
.SET_TARGET_TYPE('attr', 'EMPTY')
340 if conf
.CHECK_FUNCS('dirfd'):
341 conf
.DEFINE('HAVE_DIRFD_DECL', 1)
343 conf
.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
344 'HAVE_STATFS_F_FSID',
345 msg
="vfs_fileid: checking for statfs() and struct statfs.f_fsid",
346 headers
='sys/types.h sys/statfs.h',
349 default_static_modules
=TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam pdb_ldap rpc_lsarpc rpc_samr
350 rpc_winreg rpc_initshutdown rpc_dssetup rpc_wkssvc rpc_svcctl
351 rpc_ntsvcs rpc_netlogon rpc_netdfs rpc_srvsvc rpc_spoolss
352 rpc_eventlog auth_sam auth_unix auth_winbind auth_wbc auth_server
353 auth_domain auth_builtin auth_netlogond vfs_default
354 nss_info_template idmap_ldap idmap_tdb idmap_passdb
357 default_shared_modules
=TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
358 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
359 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850
360 charset_CP437 auth_script vfs_readahead vfs_xattr_tdb
361 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
362 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
363 vfs_crossrename vfs_linux_xfs_sgid
364 vfs_time_audit idmap_autorid''')
366 if Options
.options
.developer
:
367 default_static_modules
.extend(TO_LIST('rpc_rpcecho pdb_ads'))
368 default_shared_modules
.extend(TO_LIST('charset_weird perfcount_test'))
370 if Options
.options
.with_acl_support
and conf
.CONFIG_SET('HAVE_POSIX_ACLS'):
371 default_static_modules
.extend(TO_LIST('vfs_posixacl'))
373 if conf
.CONFIG_SET('HAVE_DIRFD_DECL'):
374 default_shared_modules
.extend(TO_LIST('vfs_syncops vfs_dirsort'))
376 if conf
.CONFIG_SET('HAVE_STATFS_F_FSID'):
377 default_shared_modules
.extend(TO_LIST('vfs_fileid'))
379 explicit_shared_modules
= TO_LIST(Options
.options
.shared_modules
, delimiter
=',')
380 explicit_static_modules
= TO_LIST(Options
.options
.static_modules
, delimiter
=',')
382 final_static_modules
= default_static_modules
383 final_shared_modules
= default_shared_modules
385 for m
in explicit_static_modules
:
386 if m
in final_shared_modules
:
387 final_shared_modules
.remove(m
)
388 final_static_modules
.append(m
)
389 for m
in explicit_shared_modules
:
390 if m
in final_static_modules
:
391 final_static_modules
.remove(m
)
392 final_shared_modules
.append(m
)
394 conf
.env
['static_modules'] = final_static_modules
395 conf
.env
['shared_modules'] = final_shared_modules
397 conf
.DEFINE('STRING_STATIC_MODULES', ' '.join(final_static_modules
), quote
=True)
402 prefixes
= ['vfs', 'pdb', 'rpc', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
403 conf
.env
['MODULE_PREFIXES'] = prefixes
405 for m
in final_static_modules
:
407 if not p
in static_list
:
409 static_list
[p
].append(m
)
410 for m
in final_shared_modules
:
412 if not p
in shared_list
:
414 shared_list
[p
].append(m
)
417 static_env
= "%s_STATIC" % p
.upper()
418 shared_env
= "%s_SHARED" % p
.upper()
419 conf
.env
[static_env
] = []
420 conf
.env
[shared_env
] = []
424 for entry
in static_list
[p
]:
425 decl_list
+= "extern NTSTATUS %s_init(const struct rpc_srv_callbacks *rpc_srv_cb); " % entry
426 conf
.env
[static_env
].append('%s' % entry
)
427 decl_list
= decl_list
.rstrip()
428 conf
.DEFINE('static_decl_%s' % p
, decl_list
)
429 conf
.DEFINE('static_init_%s' % p
, '{ %s_init(NULL); }' % '_init(NULL); '.join(static_list
[p
]))
431 for entry
in static_list
[p
]:
432 decl_list
+= "extern NTSTATUS %s_init(void); " % entry
433 conf
.env
[static_env
].append('%s' % entry
)
434 decl_list
= decl_list
.rstrip()
435 conf
.DEFINE('static_decl_%s' % p
, decl_list
)
436 conf
.DEFINE('static_init_%s' % p
, '{ %s_init(); }' % '_init(); '.join(static_list
[p
]))
438 conf
.DEFINE('static_decl_%s' % p
, '')
439 conf
.DEFINE('static_init_%s' % p
, '{}')
441 for entry
in shared_list
[p
]:
442 conf
.DEFINE('%s_init' % entry
, 'init_samba_module')
443 conf
.env
[shared_env
].append('%s' % entry
)
445 if Options
.options
.with_winbind
:
446 conf
.env
.build_winbind
= True
447 conf
.DEFINE('WITH_WINBIND', '1')
449 conf
.find_program('awk', var
='AWK')
450 conf
.find_program('perl', var
='PERL')
452 # Darwin has extra options to xattr-family functions
453 conf
.CHECK_CODE('getxattr(0, 0, 0, 0, 0, 0);',
455 msg
="Checking whether xattr interface takes additional options",
456 headers
='sys/types.h attr/xattr.h sys/xattr.h')
458 conf
.CHECK_HEADERS('asm/types.h')
460 conf
.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
461 headers
='unistd.h sys/types.h',
462 msg
="Checking for major macro")
464 conf
.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
465 headers
='unistd.h sys/types.h',
466 msg
="Checking for minor macro")
468 conf
.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
469 headers
='unistd.h sys/types.h dirent.h',
470 define
='HAVE_DIRENT_D_OFF')
472 conf
.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent')
473 conf
.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE',
474 msg
="Checking for setnetgrent prototype",
475 headers
='netdb.h netgroup.h',
476 cflags
="-Werror-implicit-function-declaration")
477 conf
.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE',
478 msg
="Checking for getnetgrent prototype",
479 headers
='netdb.h netgroup.h',
480 cflags
="-Werror-implicit-function-declaration")
481 conf
.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE',
482 msg
="Checking for endnetgrent prototype",
483 headers
='netdb.h netgroup.h',
484 cflags
="-Werror-implicit-function-declaration")
486 #FIXME: Should just be set when krb5 and ldap requirements are fulfilled
487 if Options
.options
.with_ads
:
488 conf
.DEFINE('WITH_ADS', '1')
491 conf
.find_program('cups-config', var
='CUPS_CONFIG')
492 if conf
.env
.CUPS_CONFIG
and Options
.options
.with_cups
:
493 conf
.check_cfg(path
="cups-config", args
="--cflags --ldflags --libs",
494 package
="", uselib_store
="cups")
495 conf
.CHECK_HEADERS('cups/cups.h cups/language.h', lib
='cups')
496 conf
.CHECK_LIB('cups')
497 conf
.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups')
499 # define an empty subsystem for cups, to allow it to be used as an empty dependency
500 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
503 if Options
.options
.with_ldap
:
504 conf
.CHECK_HEADERS('ldap.h lber.h')
505 conf
.CHECK_TYPE('ber_tag_t', 'unsigned int', headers
='ldap.h lber.h')
506 conf
.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
507 conf
.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers
='ldap.h')
508 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
509 # SASL wrapping hooks
510 if conf
.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
511 conf
.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
512 conf
.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
514 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
516 conf
.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
517 define
='HAVE_LBER_LOG_PRINT_FN', headers
='lber.h')
519 conf
.CHECK_FUNCS_IN('ldap_init ldap_initialize ldap_set_rebind_proc', 'ldap')
520 conf
.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
522 # Check if ldap_set_rebind_proc() takes three arguments
523 if conf
.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
524 'LDAP_SET_REBIND_PROC_ARGS',
525 msg
="Checking whether ldap_set_rebind_proc takes 3 arguments",
526 headers
='ldap.h lber.h', link
=False):
527 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
529 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
531 # last but not least, if ldap_init() exists, we want to use ldap
532 if conf
.CONFIG_SET('HAVE_LDAP_INIT'):
533 conf
.DEFINE('HAVE_LDAP', '1')
534 conf
.DEFINE('LDAP_DEPRECATED', '1')
535 conf
.env
['SMBLDAP'] = 'lib/smbldap.c'
536 conf
.env
['SMBLDAPUTIL'] = 'lib/smbldap_util.c'
538 conf
.SET_TARGET_TYPE('ldap', 'EMPTY')
539 conf
.SET_TARGET_TYPE('lber', 'EMPTY')
542 conf
.find_program('krb5-config', var
='KRB5_CONFIG')
543 if conf
.env
.KRB5_CONFIG
and Options
.options
.with_krb5
:
544 conf
.check_cfg(path
="krb5-config", args
="--cflags --libs",
545 package
="gssapi", uselib_store
="krb5")
546 conf
.CHECK_HEADERS('krb5.h krb5/locate_plugin.h', lib
='krb5')
547 conf
.CHECK_HEADERS('gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h gssapi/gssapi_ext.h com_err.h', lib
='krb5')
549 if conf
.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'):
550 conf
.env
['WINBIND_KRB5_LOCATOR'] = 'bin/winbind_krb5_locator.so'
552 conf
.CHECK_FUNCS_IN('_et_list', 'com_err')
553 conf
.CHECK_FUNCS_IN('krb5_encrypt_data', 'k5crypto')
554 conf
.CHECK_FUNCS_IN('crypto', 'des_set_key')
555 conf
.CHECK_FUNCS_IN('copy_Authenticator', 'asn1')
556 conf
.CHECK_FUNCS_IN('roken_getaddrinfo_hostspec', 'roken')
557 if conf
.CHECK_FUNCS_IN('gss_display_status', 'gssapi gssapi_krb5'):
558 conf
.DEFINE('HAVE_GSSAPI', '1')
559 conf
.CHECK_FUNCS_IN('gss_wrap_iov', 'gssapi gssapi_krb5 krb5')
560 conf
.CHECK_FUNCS_IN('krb5_mk_req_extended krb5_kt_compare', 'krb5')
562 krb5_set_real_time krb5_set_default_in_tkt_etypes krb5_set_default_tgs_enctypes
563 krb5_set_default_tgs_ktypes krb5_principal2salt krb5_use_enctype
564 krb5_string_to_key krb5_get_pw_salt krb5_string_to_key_salt krb5_auth_con_setkey
565 krb5_auth_con_setuseruserkey krb5_locate_kdc krb5_get_permitted_enctypes
566 krb5_get_default_in_tkt_etypes krb5_free_data_contents
567 krb5_principal_get_comp_string krb5_free_unparsed_name
568 krb5_free_keytab_entry_contents krb5_kt_free_entry krb5_krbhst_init
569 krb5_krbhst_get_addrinfo krb5_c_enctype_compare krb5_enctypes_compatible_keys
570 krb5_crypto_init krb5_crypto_destroy krb5_decode_ap_req free_AP_REQ
571 krb5_verify_checksum krb5_c_verify_checksum krb5_principal_compare_any_realm
572 krb5_parse_name_norealm krb5_princ_size krb5_get_init_creds_opt_set_pac_request
573 krb5_get_renewed_creds krb5_get_kdc_cred krb5_free_error_contents
574 initialize_krb5_error_table krb5_get_init_creds_opt_alloc
575 krb5_get_init_creds_opt_free krb5_get_init_creds_opt_get_error
576 krb5_enctype_to_string krb5_fwd_tgt_creds krb5_auth_con_set_req_cksumtype
577 krb5_get_creds_opt_alloc krb5_get_creds_opt_set_impersonate krb5_get_creds
578 krb5_get_credentials_for_user krb5_get_host_realm krb5_free_host_realm''',
580 conf
.CHECK_DECLS('''krb5_get_credentials_for_user
581 krb5_auth_con_set_req_cksumtype''',
582 headers
='krb5.h', always
=True)
583 conf
.CHECK_VARIABLE('AP_OPTS_USE_SUBKEY', headers
='krb5.h')
584 conf
.CHECK_VARIABLE('KV5M_KEYTAB', headers
='krb5.h')
585 conf
.CHECK_VARIABLE('KRB5_KU_OTHER_CKSUM', headers
='krb5.h')
586 conf
.CHECK_VARIABLE('KRB5_KEYUSAGE_APP_DATA_CKSUM', headers
='krb5.h')
587 conf
.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'key', headers
='krb5.h',
588 define
='HAVE_KRB5_KEYTAB_ENTRY_KEY')
589 conf
.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'keyblock', headers
='krb5.h',
590 define
='HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK')
591 conf
.CHECK_STRUCTURE_MEMBER('krb5_address', 'magic', headers
='krb5.h',
592 define
='HAVE_MAGIC_IN_KRB5_ADDRESS')
593 conf
.CHECK_STRUCTURE_MEMBER('krb5_address', 'addrtype', headers
='krb5.h',
594 define
='HAVE_ADDRTYPE_IN_KRB5_ADDRESS')
595 conf
.CHECK_STRUCTURE_MEMBER('krb5_ticket', 'enc_part2', headers
='krb5.h',
596 define
='HAVE_KRB5_TKT_ENC_PART2')
597 conf
.CHECK_STRUCTURE_MEMBER('krb5_creds', 'keyblock', headers
='krb5.h',
598 define
='HAVE_KRB5_KEYBLOCK_IN_CREDS')
599 conf
.CHECK_STRUCTURE_MEMBER('krb5_creds', 'session', headers
='krb5.h',
600 define
='HAVE_KRB5_SESSION_IN_CREDS')
601 conf
.CHECK_STRUCTURE_MEMBER('krb5_ap_req', 'ticket', headers
='krb5.h',
602 define
='HAVE_TICKET_POINTER_IN_KRB5_AP_REQ')
604 conf
.CHECK_TYPE('krb5_encrypt_block', headers
='krb5.h')
609 krb5_enctype enctype;
610 enctype = ticket.enc_part.enctype;
611 kvno = ticket.enc_part.kvno;
613 'KRB5_TICKET_HAS_KEYINFO',
614 headers
='krb5.h', link
=False,
615 msg
="Checking whether the krb5_ticket structure contains the kvno and enctype")
618 krb5_get_init_creds_opt *opt = NULL;
619 krb5_get_init_creds_opt_free(ctx, opt);
621 'KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT',
622 headers
='krb5.h', link
=False,
623 msg
="Checking whether krb5_get_init_creds_opt_free takes a context argument")
624 conf
.CHECK_CODE('krb5_mk_error(0,0,0)',
625 'HAVE_SHORT_KRB5_MK_ERROR_INTERFACE',
626 headers
='krb5.h', link
=False,
627 msg
="Checking whether krb5_mk_error takes 3 arguments MIT or 9 Heimdal")
629 const krb5_data *pkdata;
630 krb5_context context;
631 krb5_principal principal;
632 pkdata = krb5_princ_component(context, principal, 0);
634 'HAVE_KRB5_PRINC_COMPONENT',
635 headers
='krb5.h', lib
='krb5',
636 msg
="Checking whether krb5_princ_component is available")
641 krb5_enctype_to_string(1, buf, 256);
644 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_SIZE_T_ARG',
645 headers
='krb5.h', lib
='krb5',
646 addmain
=False, cflags
='-Werror',
647 msg
="Checking whether krb5_enctype_to_string takes size_t argument")
651 krb5_context context = NULL;
653 krb5_enctype_to_string(context, 1, &str);
657 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_KRB5_CONTEXT_ARG',
658 headers
='krb5.h stdlib.h', lib
='krb5',
659 addmain
=False, cflags
='-Werror',
660 msg
="Checking whether krb5_enctype_to_string takes krb5_context argument")
663 krb5_context ctx = NULL;
664 krb5_principal princ = NULL;
665 const char *str = krb5_princ_realm(ctx, princ)->data;
668 'HAVE_KRB5_PRINC_REALM',
669 headers
='krb5.h', lib
='krb5',
671 msg
="Checking whether the macro krb5_princ_realm is defined")
672 if conf
.CHECK_CODE('''krb5_verify_checksum(0, 0, 0, 0, 0, 0, 0);''',
673 'KRB5_VERIFY_CHECKSUM_ARGS',
674 headers
='krb5.h', lib
='krb5',
675 msg
="Checking whether krb5_verify_checksum takes 7 arguments"):
676 conf
.DEFINE('KRB5_VERIFY_CHECKSUM_ARGS', '7')
678 conf
.DEFINE('KRB5_VERIFY_CHECKSUM_ARGS', '6')
681 krb5_enctype enctype;
682 enctype = ENCTYPE_ARCFOUR_HMAC_MD5;
684 '_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5',
685 headers
='krb5.h', lib
='krb5',
686 msg
="Checking whether the ENCTYPE_ARCFOUR_HMAC_MD5 key type definition is available");
688 krb5_keytype keytype;
689 keytype = KEYTYPE_ARCFOUR_56;
691 '_HAVE_KEYTYPE_ARCFOUR_56',
692 headers
='krb5.h', lib
='krb5',
693 msg
="Checking whether the HAVE_KEYTYPE_ARCFOUR_56 key type definition is available");
694 if conf
.CONFIG_SET('_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and conf
.CONFIG_SET('_HAVE_KEYTYPE_ARCFOUR_56'):
695 conf
.DEFINE('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5', '1')
698 krb5_enctype enctype;
699 enctype = ENCTYPE_ARCFOUR_HMAC;
701 'HAVE_ENCTYPE_ARCFOUR_HMAC',
702 headers
='krb5.h', lib
='krb5',
703 msg
="Checking whether the ENCTYPE_ARCFOUR_HMAC key type definition is available");
706 krb5_context context;
708 krb5_init_context(&context);
709 return krb5_kt_resolve(context, "WRFILE:api", &keytab);
711 'HAVE_WRFILE_KEYTAB',
712 headers
='krb5.h', lib
='krb5', execute
=True,
713 msg
="Checking whether the WRFILE:-keytab is supported");
715 conf
.DEFINE('HAVE_KRB5', '1')
718 conf
.SET_TARGET_TYPE('krb5', 'EMPTY')
719 conf
.SET_TARGET_TYPE('gssapi', 'EMPTY')
720 conf
.SET_TARGET_TYPE('gssapi_krb5', 'EMPTY')
721 conf
.SET_TARGET_TYPE('com_err', 'EMPTY')
722 conf
.SET_TARGET_TYPE('k5crypto', 'EMPTY')
724 if Options
.options
.with_utmp
:
725 conf
.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
726 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers
='utmp.h',
727 define
='HAVE_UT_UT_NAME')
728 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers
='utmp.h',
729 define
='HAVE_UT_UT_USER')
730 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers
='utmp.h',
731 define
='HAVE_UT_UT_ID')
732 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers
='utmp.h',
733 define
='HAVE_UT_UT_HOST')
734 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers
='utmp.h',
735 define
='HAVE_UT_UT_TIME')
736 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers
='utmp.h',
737 define
='HAVE_UT_UT_TV')
738 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers
='utmp.h',
739 define
='HAVE_UT_UT_TYPE')
740 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers
='utmp.h',
741 define
='HAVE_UT_UT_PID')
742 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers
='utmp.h',
743 define
='HAVE_UT_UT_EXIT')
744 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr_v6', headers
='utmp.h',
745 define
='HAVE_UT_UT_ADDR_V6')
746 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr', headers
='utmp.h',
747 define
='HAVE_UT_UT_ADDR')
748 conf
.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers
='utmpx.h',
749 define
='HAVE_UX_UT_SYSLEN')
750 conf
.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
751 'PUTUTLINE_RETURNS_UTMP', headers
='utmp.h',
752 msg
="Checking whether pututline returns pointer")
753 conf
.DEFINE('WITH_UTMP', 1)
755 if Options
.options
.with_avahi
:
756 conf
.env
.with_avahi
= True
757 if not conf
.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf
.env
.with_avahi
= False
758 if not conf
.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf
.env
.with_avahi
= False
759 if not conf
.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf
.env
.with_avahi
= False
760 if conf
.env
.with_avahi
:
761 conf
.DEFINE('WITH_AVAHI_SUPPORT', 1)
763 conf
.SET_TARGET_TYPE('avahi-common', 'EMPTY')
764 conf
.SET_TARGET_TYPE('avahi-client', 'EMPTY')
766 if Options
.options
.with_iconv
:
767 conf
.env
.with_iconv
= True
768 if not conf
.CHECK_FUNCS_IN('iconv_open', 'iconv', headers
='iconv.h'):
769 conf
.env
.with_iconv
= False
770 if conf
.env
.with_iconv
:
771 conf
.DEFINE('HAVE_ICONV', 1)
773 if Options
.options
.with_pam
:
774 conf
.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
775 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
776 print "--with-pam=yes but pam_appl.h not found"
778 conf
.CHECK_FUNCS_IN('pam_get_data', 'pam', mandatory
=True)
779 conf
.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h')
780 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'):
781 print "--with-pam=yes but pam_modules.h not found"
783 conf
.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h')
784 conf
.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h')
785 conf
.CHECK_FUNCS_IN('pam_vsyslog', 'pam')
787 #if defined(HAVE_SECURITY_PAM_APPL_H)
788 #include <security/pam_appl.h>
789 #elif defined(HAVE_PAM_PAM_APPL_H)
790 #include <pam/pam_appl.h>
792 pam_set_item(0, PAM_RHOST, 0);
796 msg
="Checking whether PAM_RHOST is available");
798 #if defined(HAVE_SECURITY_PAM_APPL_H)
799 #include <security/pam_appl.h>
800 #elif defined(HAVE_PAM_PAM_APPL_H)
801 #include <pam/pam_appl.h>
803 pam_set_item(0, PAM_TTY, 0);
807 msg
="Checking whether PAM_TTY is available");
809 #if (!defined(LINUX))
811 #define PAM_EXTERN extern
812 #if defined(HAVE_SECURITY_PAM_APPL_H)
813 #include <security/pam_appl.h>
814 #elif defined(HAVE_PAM_PAM_APPL_H)
815 #include <pam/pam_appl.h>
820 #if defined(HAVE_SECURITY_PAM_MODULES_H)
821 #include <security/pam_modules.h>
822 #elif defined(HAVE_PAM_PAM_MODULES_H)
823 #include <pam/pam_modules.h>
826 #if defined(HAVE_SECURITY__PAM_MACROS_H)
827 #include <security/_pam_macros.h>
828 #elif defined(HAVE_PAM__PAM_MACROS_H)
829 #include <pam/_pam_macros.h>
832 #ifdef HAVE_SECURITY_PAM_EXT_H
833 #include <security/pam_ext.h>
836 int i; i = PAM_RADIO_TYPE;
838 'HAVE_PAM_RADIO_TYPE',
840 msg
="Checking whether PAM_RADIO_TYPE is available");
841 conf
.DEFINE('WITH_PAM', 1)
842 conf
.DEFINE('WITH_PAM_MODULES', 1)
846 seteuid
= conf
.CHECK_CODE('''
847 #define AUTOCONF_TEST 1
848 #define USE_SETREUID 1
849 #include "./lib/util_sec.c"
854 msg
="Checking whether setreuid is available")
856 seteuid
= conf
.CHECK_CODE('''
857 #define AUTOCONF_TEST 1
858 #define USE_SETRESUID 1
859 #include "./lib/util_sec.c"
864 msg
="Checking whether setresuid is available")
866 seteuid
= conf
.CHECK_CODE('''
867 #define AUTOCONF_TEST 1
868 #define USE_SETEUID 1
869 #include "./lib/util_sec.c"
874 msg
="Checking whether seteuid is available")
876 seteuid
= conf
.CHECK_CODE('''
877 #define AUTOCONF_TEST 1
878 #define USE_SETUIDX 1
879 #include "./lib/util_sec.c"
885 msg
="Checking whether setuidx is available")
886 if Options
.options
.with_dnsupdate
:
887 conf
.CHECK_HEADERS('uuid/uuid.h')
888 conf
.CHECK_FUNCS_IN('uuid_generate', 'uuid')
889 if not conf
.CONFIG_SET('HAVE_UUID_UUID_H') and not conf
.CONFIG_SET('HAVE_UUID_GENERATE'):
890 print "--with-dnsupdate=yes but uuid support not sufficient"
892 conf
.DEFINE('WITH_DNS_UPDATES', 1)
894 conf
.SET_TARGET_TYPE('uuid', 'EMPTY')
895 conf
.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
896 if Options
.options
.developer
:
897 if conf
.CONFIG_SET('HAVE_VALGRIND_H') or conf
.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'):
898 conf
.DEFINE('VALGRIND', '1')
900 conf
.SAMBA_CONFIG_H('include/config.h')
903 "build 'tags' file using ctags"
905 source_root
= os
.path
.dirname(Utils
.g_module
.root_path
)
906 cmd
= 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
907 print("Running: %s" % cmd
)