6 from optparse import SUPPRESS_HELP
7 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
8 sys.path.insert(0, "source3")
9 import wafsamba, Options, Logs, Utils, Scripting
11 import samba_utils, samba_version
14 Options.default_prefix = '/usr/local/samba'
18 opt.add_option('--with-static-modules',
19 help=("Comma-separated list of names of modules to statically link in"),
20 action="store", dest='static_modules', default=None)
21 opt.add_option('--with-shared-modules',
22 help=("Comma-separated list of names of modules to build shared"),
23 action="store", dest='shared_modules', default=None)
24 opt.add_option('--enable-selftest',
25 help=("enable options necessary for selftest"),
26 action="store_true", dest='enable_selftest', default=False)
28 opt.SAMBA3_ADD_OPTION('winbind')
29 opt.SAMBA3_ADD_OPTION('swat')
30 opt.SAMBA3_ADD_OPTION('ads')
31 opt.SAMBA3_ADD_OPTION('mit-krb5-checks', default=False)
32 opt.SAMBA3_ADD_OPTION('ldap')
33 opt.SAMBA3_ADD_OPTION('cups', with_name="enable", without_name="disable")
34 opt.SAMBA3_ADD_OPTION('iprint', with_name="enable", without_name="disable")
35 opt.SAMBA3_ADD_OPTION('pam')
36 opt.SAMBA3_ADD_OPTION('pam_smbpass')
37 opt.SAMBA3_ADD_OPTION('quotas')
38 opt.SAMBA3_ADD_OPTION('sys-quotas')
39 opt.SAMBA3_ADD_OPTION('sendfile-support')
40 opt.SAMBA3_ADD_OPTION('utmp')
41 opt.SAMBA3_ADD_OPTION('pthreadpool', with_name="enable", without_name="disable")
42 opt.SAMBA3_ADD_OPTION('avahi', with_name="enable", without_name="disable")
43 opt.SAMBA3_ADD_OPTION('iconv')
44 opt.SAMBA3_ADD_OPTION('acl-support')
45 opt.SAMBA3_ADD_OPTION('dnsupdate')
46 opt.SAMBA3_ADD_OPTION('syslog')
47 opt.SAMBA3_ADD_OPTION('automount')
48 opt.SAMBA3_ADD_OPTION('aio-support')
49 opt.SAMBA3_ADD_OPTION('profiling-data', default=False)
51 opt.SAMBA3_ADD_OPTION('cluster-support')
53 opt.add_option('--with-ctdb-dir',
54 help=("Directory under which ctdb is installed"),
55 action="store", dest='ctdb_dir', default=None)
56 opt.add_option('--enable-old-ctdb',
57 help=("enable building against (too) old version of ctdb (default=false)"),
58 action="store_true", dest='enable_old_ctdb', default=False)
63 from samba_utils import TO_LIST
65 if Options.options.developer:
66 conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
67 conf.env.developer = True
69 if Options.options.with_swat:
70 conf.env['build_swat'] = True
72 conf.ADD_LDFLAGS("-Wl,--export-dynamic", testflags=True)
74 conf.CHECK_HEADERS('execinfo.h libexc.h libunwind.h netdb.h')
75 conf.CHECK_HEADERS('linux/falloc.h')
77 conf.CHECK_FUNCS('getcwd fchown chmod fchmod mknod mknod64')
78 conf.CHECK_FUNCS('strtol strchr strupr chflags')
79 conf.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
80 conf.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
81 conf.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr')
82 conf.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
83 conf.CHECK_FUNCS('setpriv setgidx setuidx setgroups sysconf stat64 fstat64')
84 conf.CHECK_FUNCS('lstat64 fopen64 atexit grantpt lseek64 ftruncate64 fallocate fallocate64 posix_fallocate posix_fallocate64')
85 conf.CHECK_FUNCS('fseek64 fseeko64 ftell64 ftello64 setluid')
86 conf.CHECK_FUNCS('getpwnam', headers='sys/types.h pwd.h')
87 conf.CHECK_FUNCS('opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64')
88 conf.CHECK_FUNCS('fdopendir fdopendir64')
89 conf.CHECK_FUNCS('getpwent_r getdents64 setenv strcasecmp fcvt fcvtl')
90 conf.CHECK_FUNCS('syslog vsyslog timegm setlocale')
91 conf.CHECK_FUNCS_IN('nanosleep', 'rt')
92 conf.CHECK_FUNCS('lutimes futimes utimensat futimens')
93 conf.CHECK_FUNCS('mlock munlock mlockall munlockall')
94 conf.CHECK_FUNCS('memalign posix_memalign hstrerror')
95 conf.CHECK_FUNCS('shmget')
96 conf.CHECK_FUNCS_IN('shm_open', 'rt', checklibc=True)
97 conf.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain bind_textdomain_codeset')
98 #FIXME: for some reason this one still fails
99 conf.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
100 conf.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
101 conf.CHECK_DECLS('fdatasync', reverse=True)
102 conf.CHECK_DECLS('readahead', reverse=True, headers='fcntl.h')
104 if conf.CONFIG_SET('HAVE_LONG_LONG'):
105 conf.DEFINE('HAVE_LONGLONG', 1)
107 if conf.CHECK_CODE('''
108 #if defined(HAVE_UNISTD_H)
111 long ret = splice(0,0,1,0,400,0);
115 conf.CHECK_DECLS('splice', reverse=True, headers='fcntl.h')
117 # Check for inotify support
118 conf.CHECK_HEADERS('linux/inotify.h asm/unistd.h sys/inotify.h')
119 conf.CHECK_FUNCS('inotify_init')
120 if "HAVE_LINUX_INOTIFY_H" in conf.env and "HAVE_INOTIFY_INIT" in conf.env:
121 conf.DEFINE('HAVE_INOTIFY', 1)
123 # Check for kernel change notify support
126 #define F_NOTIFY 1026
129 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
130 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain=False, execute=True,
131 headers='fcntl.h signal.h',
132 msg="Checking for kernel change notify support")
134 # Check for Linux kernel oplocks
136 #include <sys/types.h>
140 #define F_NOTIFY 1026
143 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
144 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain=False, execute=True,
145 msg="Checking for Linux kernel oplocks")
147 # Check for IRIX kernel oplock types
148 conf.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
149 'HAVE_KERNEL_OPLOCKS_IRIX', headers='fcntl.h',
150 msg="Checking for IRIX kernel oplock types")
152 # Check for kernel share modes
154 #include <sys/types.h>
157 #include <sys/file.h>
163 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
164 }''', 'HAVE_KERNEL_SHARE_MODES', addmain=False, execute=True,
165 msg="Checking for krenel share modes")
167 # Check for various members of the stat structure
168 conf.CHECK_TYPES('blksize_t blkcnt_t')
169 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define='HAVE_STAT_ST_BLOCKS',
170 headers='sys/stat.h')
171 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define='HAVE_STAT_ST_BLKSIZE',
172 headers='sys/stat.h')
173 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_flags', define='HAVE_STAT_ST_FLAGS',
174 headers='sys/types.h sys/stat.h unistd.h')
176 # Check for POSIX capability support
177 conf.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers='sys/capability.h')
179 if "HAVE_SYS_CAPABILITY_H" in conf.env:
183 if (!(cap = cap_get_proc())) exit(1);
185 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
186 cap_set_proc(cap);''',
187 'HAVE_POSIX_CAPABILITIES', execute=True, lib="cap",
188 headers='sys/capability.h',
189 msg="Checking whether POSIX capabilities are available")
191 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
192 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
194 if conf.CONFIG_SET("HAVE_RPC_RPC_H"):
195 conf.CHECK_TYPE('int16', headers='rpc/rpc.h',
196 define='HAVE_INT16_FROM_RPC_RPC_H',
197 msg="Checking for int16 typedef included by rpc/rpc.h")
198 conf.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
199 headers='sys/types.h rpc/rpc.h',
200 msg="Checking for uint16 typedef included by rpc/rpc.h")
201 conf.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
202 headers='sys/types.h rpc/rpc.h',
203 msg="Checking for int32 typedef included by rpc/rpc.h")
204 conf.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
205 headers='sys/types.h rpc/rpc.h',
206 msg="Checking for uint32 typedef included by rpc/rpc.h")
207 conf.CHECK_CODE('int i;', 'BROKEN_NISPLUS_INCLUDE_FILES',
208 headers='sys/types.h sys/acl.h rpcsvc/nis.h',
209 msg="Checking for broken nisplus include files")
211 # Check if the compiler will optimize out functions
214 this_function_does_not_exist();
217 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
218 msg="Checking if the compiler will optimize out functions")
220 # Check if the compiler supports the LL suffix on long long integers
222 conf.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL',
224 msg="Checking for LL suffix on long long integers")
227 _acl __acl add_proplist_entry atexit attr_getf attr_list attr_listf
228 attropen attr_remove attr_removef attr_set attr_setf backtrace_symbols
229 bindtextdomain _chdir __chdir chflags chmod _close __close _closedir
230 __closedir closedir64 creat64 crypt16 delproplist devnm dgettext dirfd
231 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
232 extattr_delete_fd extattr_delete_link extattr_get_fd extattr_get_file
233 extattr_get_link extattr_list_fd extattr_list_file extattr_list_link
234 extattr_set_fd extattr_set_file extattr_set_link _facl __facl _fchdir
235 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
236 fdelproplist fgetea fgetproplist fgetxattr flistea flistxattr fopen64
237 _fork __fork fremoveea fremovexattr fseek64 fseeko64 fsetea
238 fsetproplist fsetxattr _fstat __fstat fstat64 _fstat64 __fstat64 fsync
239 ftell64 ftello64 ftruncate64 futimens futimes __fxstat getauthuid
240 getcwd _getcwd __getcwd getdents __getdents getdents64 getdirentries
241 getgrent getgrnam getgrouplist getgrset getmntent getpagesize
242 getproplist get_proplist_entry getpwanam getpwent_r getrlimit gettext
243 glob grantpt hstrerror initgroups innetgr
244 inotify_init lgetea lgetxattr listea listxattr llistea llistxattr
245 llseek _llseek __llseek lremoveea lremovexattr _lseek __lseek lseek64
246 lsetea lsetxattr _lstat __lstat lstat64 _lstat64 __lstat64 lutimes
247 __lxstat memalign mknod mknod64 mlock mlockall munlock munlockall
248 _open __open open64 _open64 __open64 _opendir __opendir
249 opendir64 pathconf poll posix_fallocate posix_fallocate64
250 posix_memalign prctl pread _pread __pread pread64 _pread64 __pread64
251 pwrite _pwrite __pwrite pwrite64 _pwrite64
252 __pwrite64 rdchk _read __read _readdir __readdir readdir64 _readdir64
253 __readdir64 removeea removexattr rewinddir64 _seekdir __seekdir
254 seekdir64 select setea setenv setgidx setgroups setlocale setluid
255 setmntent setpgid setpriv setproplist setsid setuidx
256 setxattr shmget shm_open sigaction sigblock sigprocmask sigset
257 sizeof_proplist_entry _stat __stat stat64 _stat64 __stat64 statvfs
258 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctlbyname
259 __sys_llseek syslog _telldir __telldir telldir64 textdomain timegm
260 utimensat vsyslog _write __write __xstat
263 conf.CHECK_SAMBA3_CHARSET() # see build/charset.py
265 # FIXME: these should be tests for features, but the old build system just
267 host_os = sys.platform
268 Logs.info("building on %s" % host_os)
270 # Python doesn't have case switches... :/
271 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
272 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
274 conf.SET_TARGET_TYPE('sunacl', 'EMPTY')
275 if (host_os.rfind('linux') > -1) or (host_os.rfind('gnu') > -1) or (host_os.rfind('qnx') > -1):
276 if host_os.rfind('linux') > -1:
277 conf.DEFINE('LINUX', '1')
278 elif host_os.rfind('qnx') > -1:
279 conf.DEFINE('QNX', '1')
280 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
281 elif (host_os.rfind('darwin') > -1):
282 conf.DEFINE('DARWINOS', 1)
283 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
284 conf.ADD_CFLAGS('-fno-common')
285 elif (host_os.rfind('freebsd') > -1):
286 if conf.CHECK_HEADERS('sunacl.h'):
287 conf.DEFINE('HAVE_FREEBSD_SUNACL_H', '1')
288 conf.CHECK_FUNCS_IN('acl', 'sunacl')
289 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
290 elif (host_os.rfind('netbsd') > -1):
291 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
292 elif (host_os.rfind('openbsd') > -1):
293 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
294 elif (host_os.rfind('sunos') > -1):
295 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
296 # FIXME: Add more checks here.
298 Logs.warn("Unknown host_os '%s', please report this to samba-technical@samba.org" % host_os)
300 #FIXME: add more checks
301 if Options.options.with_acl_support:
302 if host_os.rfind('linux') > -1:
303 conf.CHECK_FUNCS_IN('acl_get_file', 'acl')
304 conf.CHECK_FUNCS_IN('getxattr', 'attr')
305 if conf.CHECK_CODE('''
308 acl_entry_t *entry_p;
309 return acl_get_entry(acl, entry_id, entry_p);
312 headers='sys/types.h sys/acl.h', link=False,
313 msg="Checking for POSIX ACL support") :
315 acl_permset_t permset_d;
317 return acl_get_perm_np(permset_d, perm);
319 'HAVE_ACL_GET_PERM_NP',
320 headers='sys/types.h sys/acl.h', link=True,
321 msg="Checking whether acl_get_perm_np() is available")
323 conf.DEFINE('HAVE_NO_ACLS', 1)
324 conf.SET_TARGET_TYPE('acl', 'EMPTY')
326 conf.DEFINE('HAVE_NO_ACLS', 1)
327 conf.SET_TARGET_TYPE('acl', 'EMPTY')
329 if conf.CHECK_FUNCS('dirfd'):
330 conf.DEFINE('HAVE_DIRFD_DECL', 1)
332 conf.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
333 'HAVE_STATFS_F_FSID',
334 msg="vfs_fileid: checking for statfs() and struct statfs.f_fsid",
335 headers='sys/types.h sys/statfs.h',
338 if conf.CONFIG_SET('HAVE_FALLOCATE'):
340 int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
341 'HAVE_LINUX_FALLOCATE',
342 msg="Checking whether the Linux 'fallocate' function is available",
343 headers='unistd.h sys/types.h fcntl.h linux/falloc.h')
344 if conf.CONFIG_SET('HAVE_FALLOCATE64'):
346 int ret = fallocate64(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
347 'HAVE_LINUX_FALLOCATE64',
348 msg="Checking whether the Linux 'fallocate64' function is available",
349 headers='unistd.h sys/types.h fcntl.h linux/falloc.h')
351 #if defined(HAVE_UNISTD_H)
355 ssize_t err = readahead(0,0,0x80000);''',
356 'HAVE_LINUX_READAHEAD',
357 msg="Checking whether Linux readahead is available")
358 conf.CHECK_DECLS('readahead', headers='fcntl.h', always=True)
363 int ret = getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len);''',
365 msg="Checking whether we can use SO_PEERCRED to get socket credentials",
366 headers='sys/types.h sys/socket.h')
369 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
370 #include <sys/types.h>
375 'HAVE_EXPLICIT_LARGEFILE_SUPPORT',
376 msg="Checking whether large file support can be enabled")
378 if Options.options.with_aio_support:
379 conf.CHECK_FUNCS_IN('aio_read', 'aio')
380 conf.CHECK_FUNCS_IN('aio_read', 'rt')
381 conf.CHECK_CODE('struct aiocb a; return aio_read(&a);',
383 msg='Checking for asynchronous io support',
384 headers='sys/types.h aio.h',
386 conf.CHECK_CODE('struct aiocb64 a; return aio_read64(&a);',
388 msg='Checking for 64-bit asynchronous io support',
389 headers='sys/types.h aio.h',
391 if conf.CONFIG_SET('HAVE_AIO64'):
392 conf.DEFINE('HAVE_AIOCB64', '1')
393 conf.DEFINE('WITH_AIO', '1')
394 elif conf.CONFIG_SET('HAVE_AIO'):
395 conf.DEFINE('WITH_AIO', '1')
396 if conf.CONFIG_SET('HAVE_AIO'):
397 conf.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg='Checking for aio_read', headers='aio.h', lib='aio rt')
398 conf.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg='Checking for aio_write', headers='aio.h', lib='aio rt')
399 conf.CHECK_CODE('struct aiocb a; return aio_fsync(1, &a);', 'HAVE_AIO_FSYNC', msg='Checking for aio_fsync', headers='aio.h', lib='aio rt')
400 conf.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg='Checking for aio_return', headers='aio.h', lib='aio rt')
401 conf.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg='Checking for aio_error', headers='aio.h', lib='aio rt')
402 conf.CHECK_CODE('struct aiocb a; return aio_cancel(1, &a);', 'HAVE_AIO_CANCEL', msg='Checking for aio_cancel', headers='aio.h', lib='aio rt')
403 conf.CHECK_CODE('struct aiocb a; return aio_suspend(&a, 1, NULL);', 'HAVE_AIO_SUSPEND', msg='Checking for aio_suspend', headers='aio.h', lib='aio rt')
404 if conf.CONFIG_SET('HAVE_AIO64'):
405 conf.CHECK_CODE('struct aiocb a; return aio_read64(&a);', 'HAVE_AIO_READ64', msg='Checking for aio_read64', headers='aio.h', lib='aio rt')
406 conf.CHECK_CODE('struct aiocb a; return aio_write64(&a);', 'HAVE_AIO_WRITE64', msg='Checking for aio_write64', headers='aio.h', lib='aio rt')
407 conf.CHECK_CODE('struct aiocb a; return aio_fsync64(1, &a);', 'HAVE_AIO_FSYNC64', msg='Checking for aio_fsync64', headers='aio.h', lib='aio rt')
408 conf.CHECK_CODE('struct aiocb a; return aio_return64(&a);', 'HAVE_AIO_RETURN64', msg='Checking for aio_return64', headers='aio.h', lib='aio rt')
409 conf.CHECK_CODE('struct aiocb a; return aio_error64(&a);', 'HAVE_AIO_ERROR64', msg='Checking for aio_error64', headers='aio.h', lib='aio rt')
410 conf.CHECK_CODE('struct aiocb a; return aio_cancel64(1, &a);', 'HAVE_AIO_CANCEL64', msg='Checking for aio_cancel64', headers='aio.h', lib='aio rt')
411 conf.CHECK_CODE('struct aiocb a; return aio_suspend64(&a, 1, NULL);', 'HAVE_AIO_SUSPEND64', msg='Checking for aio_suspend64', headers='aio.h', lib='aio rt')
412 if not conf.CONFIG_SET('HAVE_AIO'):
413 conf.DEFINE('HAVE_NO_AIO', '1')
415 conf.DEFINE('HAVE_NO_AIO', '1')
421 char control[CMSG_SPACE(sizeof(int))];
423 msg.msg_control = control_un.control;
424 msg.msg_controllen = sizeof(control_un.control);
426 'HAVE_MSGHDR_MSG_CONTROL',
427 msg='Checking if we can use msg_control for passing file descriptors',
428 headers='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
432 msg.msg_acctrights = (caddr_t) &fd;
433 msg.msg_acctrightslen = sizeof(fd);
435 'HAVE_MSGHDR_MSG_ACCTRIGHTS',
436 msg='Checking if we can use msg_acctrights for passing file descriptors',
437 headers='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
439 if Options.options.with_winbind:
440 conf.env.build_winbind = True
441 conf.DEFINE('WITH_WINBIND', '1')
443 conf.find_program('awk', var='AWK')
444 conf.find_program('perl', var='PERL')
446 # Darwin has extra options to xattr-family functions
447 conf.CHECK_CODE('getxattr(0, 0, 0, 0, 0, 0);',
449 msg="Checking whether xattr interface takes additional options",
450 headers='sys/types.h attr/xattr.h sys/xattr.h')
452 conf.CHECK_HEADERS('asm/types.h')
454 conf.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
455 headers='unistd.h sys/types.h',
456 msg="Checking for major macro")
458 conf.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
459 headers='unistd.h sys/types.h',
460 msg="Checking for minor macro")
462 conf.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
463 headers='unistd.h sys/types.h dirent.h',
464 define='HAVE_DIRENT_D_OFF')
466 conf.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent')
467 if conf.CHECK_CFLAGS('-Werror-implicit-function-declaration'):
468 netgrent_cflags = '-Werror-implicit-function-declaration'
471 conf.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE',
472 msg="Checking for setnetgrent prototype",
473 headers='netdb.h netgroup.h',
474 cflags=netgrent_cflags)
475 conf.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE',
476 msg="Checking for getnetgrent prototype",
477 headers='netdb.h netgroup.h',
478 cflags=netgrent_cflags)
479 conf.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE',
480 msg="Checking for endnetgrent prototype",
481 headers='netdb.h netgroup.h',
482 cflags=netgrent_cflags)
486 if Options.options.with_cups:
487 conf.find_program('cups-config', var='CUPS_CONFIG')
488 if conf.env.CUPS_CONFIG:
489 # we would normally use --libs here, but cups-config incorrectly adds
490 # gssapi_krb5 and other libraries to its --libs output. That breaks the use
491 # of an in-tree heimdal kerberos
492 conf.check_cfg(path=conf.env.CUPS_CONFIG, args="--cflags --ldflags",
493 package="", uselib_store="cups")
494 conf.CHECK_HEADERS('cups/cups.h cups/language.h', lib='cups')
495 conf.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups')
496 if conf.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
497 conf.DEFINE('HAVE_CUPS', '1')
499 conf.undefine('HAVE_CUPS')
500 conf.SET_TARGET_TYPE('cups', 'EMPTY')
502 # define an empty subsystem for cups, to allow it to be used as an empty dependency
503 conf.SET_TARGET_TYPE('cups', 'EMPTY')
505 if Options.options.with_iprint:
506 if conf.CONFIG_SET('HAVE_CUPS'):
507 conf.DEFINE('HAVE_IPRINT', '1')
509 Logs.warn("--enable-iprint=yes but cups support not sufficient")
510 if Options.options.with_syslog:
511 conf.DEFINE('WITH_SYSLOG', '1')
512 if Options.options.with_automount:
513 conf.DEFINE('WITH_AUTOMOUNT', '1')
516 if Options.options.with_ldap:
517 conf.CHECK_HEADERS('ldap.h lber.h ldap_pvt.h')
518 conf.CHECK_TYPE('ber_tag_t', 'unsigned int', headers='ldap.h lber.h')
519 conf.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
520 conf.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers='ldap.h')
522 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
524 conf.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
525 define='HAVE_LBER_LOG_PRINT_FN', headers='lber.h')
527 conf.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', 'ldap')
528 conf.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
530 # Check if ldap_set_rebind_proc() takes three arguments
531 if conf.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
532 'LDAP_SET_REBIND_PROC_ARGS',
533 msg="Checking whether ldap_set_rebind_proc takes 3 arguments",
534 headers='ldap.h lber.h', link=False):
535 conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
537 conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
539 # last but not least, if ldap_init() exists, we want to use ldap
540 if conf.CONFIG_SET('HAVE_LDAP_INIT'):
541 conf.DEFINE('HAVE_LDAP', '1')
542 conf.DEFINE('LDAP_DEPRECATED', '1')
543 conf.env['HAVE_LDAP'] = '1'
544 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
545 # SASL wrapping hooks
546 if conf.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
547 conf.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
548 conf.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
550 conf.SET_TARGET_TYPE('ldap', 'EMPTY')
551 conf.SET_TARGET_TYPE('lber', 'EMPTY')
555 if Options.options.with_mit_krb5_checks and conf.env.developer:
556 Logs.info("Looking for kerberos features")
557 conf.find_program('krb5-config', var='KRB5_CONFIG')
558 if conf.env.KRB5_CONFIG:
559 conf.check_cfg(path="krb5-config", args="--cflags --libs",
560 package="gssapi", uselib_store="krb5")
561 conf.CHECK_HEADERS('krb5.h krb5/locate_plugin.h', lib='krb5')
562 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')
564 if conf.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'):
565 conf.env['WINBIND_KRB5_LOCATOR'] = 'bin/winbind_krb5_locator.so'
567 conf.CHECK_FUNCS_IN('_et_list', 'com_err')
568 conf.CHECK_FUNCS_IN('krb5_encrypt_data', 'k5crypto')
569 conf.CHECK_FUNCS_IN('des_set_key','crypto')
570 conf.CHECK_FUNCS_IN('copy_Authenticator', 'asn1')
571 conf.CHECK_FUNCS_IN('roken_getaddrinfo_hostspec', 'roken')
572 if conf.CHECK_FUNCS_IN('gss_display_status', 'gssapi') or \
573 conf.CHECK_FUNCS_IN('gss_display_status', 'gssapi_krb5'):
575 conf.CHECK_FUNCS_IN('gss_wrap_iov gss_krb5_import_cred gss_get_name_attribute gss_mech_krb5 gss_oid_equal gss_inquire_sec_context_by_oid', 'gssapi gssapi_krb5 krb5')
576 conf.CHECK_FUNCS_IN('krb5_mk_req_extended krb5_kt_compare', 'krb5')
578 krb5_set_real_time krb5_set_default_in_tkt_etypes krb5_set_default_tgs_enctypes
579 krb5_set_default_tgs_ktypes krb5_principal2salt krb5_use_enctype
580 krb5_string_to_key krb5_get_pw_salt krb5_string_to_key_salt krb5_auth_con_setkey
581 krb5_auth_con_setuseruserkey krb5_locate_kdc krb5_get_permitted_enctypes
582 krb5_get_default_in_tkt_etypes krb5_free_data_contents
583 krb5_principal_get_comp_string krb5_free_unparsed_name
584 krb5_free_keytab_entry_contents krb5_kt_free_entry krb5_krbhst_init
585 krb5_krbhst_get_addrinfo krb5_c_enctype_compare krb5_enctypes_compatible_keys
586 krb5_crypto_init krb5_crypto_destroy krb5_decode_ap_req free_AP_REQ
587 krb5_verify_checksum krb5_c_verify_checksum krb5_principal_compare_any_realm
588 krb5_parse_name_norealm krb5_princ_size krb5_get_init_creds_opt_set_pac_request
589 krb5_get_renewed_creds krb5_get_kdc_cred krb5_free_error_contents
590 initialize_krb5_error_table krb5_get_init_creds_opt_alloc
591 krb5_get_init_creds_opt_free krb5_get_init_creds_opt_get_error
592 krb5_enctype_to_string krb5_fwd_tgt_creds krb5_auth_con_set_req_cksumtype
593 krb5_get_creds_opt_alloc krb5_get_creds_opt_set_impersonate krb5_get_creds
594 krb5_get_credentials_for_user krb5_get_host_realm krb5_free_host_realm''',
596 conf.CHECK_DECLS('''krb5_get_credentials_for_user
597 krb5_auth_con_set_req_cksumtype''',
598 headers='krb5.h', always=True)
599 conf.CHECK_VARIABLE('AP_OPTS_USE_SUBKEY', headers='krb5.h')
600 conf.CHECK_VARIABLE('KV5M_KEYTAB', headers='krb5.h')
601 conf.CHECK_VARIABLE('KRB5_KU_OTHER_CKSUM', headers='krb5.h')
602 conf.CHECK_VARIABLE('KRB5_KEYUSAGE_APP_DATA_CKSUM', headers='krb5.h')
603 conf.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'key', headers='krb5.h',
604 define='HAVE_KRB5_KEYTAB_ENTRY_KEY')
605 conf.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'keyblock', headers='krb5.h',
606 define='HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK')
607 conf.CHECK_STRUCTURE_MEMBER('krb5_address', 'magic', headers='krb5.h',
608 define='HAVE_MAGIC_IN_KRB5_ADDRESS')
609 conf.CHECK_STRUCTURE_MEMBER('krb5_address', 'addrtype', headers='krb5.h',
610 define='HAVE_ADDRTYPE_IN_KRB5_ADDRESS')
611 conf.CHECK_STRUCTURE_MEMBER('krb5_ticket', 'enc_part2', headers='krb5.h',
612 define='HAVE_KRB5_TKT_ENC_PART2')
613 conf.CHECK_STRUCTURE_MEMBER('krb5_creds', 'keyblock', headers='krb5.h',
614 define='HAVE_KRB5_KEYBLOCK_IN_CREDS')
615 conf.CHECK_STRUCTURE_MEMBER('krb5_creds', 'session', headers='krb5.h',
616 define='HAVE_KRB5_SESSION_IN_CREDS')
617 conf.CHECK_STRUCTURE_MEMBER('krb5_ap_req', 'ticket', headers='krb5.h',
618 define='HAVE_TICKET_POINTER_IN_KRB5_AP_REQ')
620 conf.CHECK_TYPE('krb5_encrypt_block', headers='krb5.h')
625 krb5_enctype enctype;
626 enctype = ticket.enc_part.enctype;
627 kvno = ticket.enc_part.kvno;
629 'KRB5_TICKET_HAS_KEYINFO',
630 headers='krb5.h', link=False,
631 msg="Checking whether the krb5_ticket structure contains the kvno and enctype")
634 krb5_get_init_creds_opt *opt = NULL;
635 krb5_get_init_creds_opt_free(ctx, opt);
637 'KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT',
638 headers='krb5.h', link=False,
639 msg="Checking whether krb5_get_init_creds_opt_free takes a context argument")
640 conf.CHECK_CODE('krb5_mk_error(0,0,0)',
641 'HAVE_SHORT_KRB5_MK_ERROR_INTERFACE',
642 headers='krb5.h', link=False,
643 msg="Checking whether krb5_mk_error takes 3 arguments MIT or 9 Heimdal")
645 const krb5_data *pkdata;
646 krb5_context context;
647 krb5_principal principal;
648 pkdata = krb5_princ_component(context, principal, 0);
650 'HAVE_KRB5_PRINC_COMPONENT',
651 headers='krb5.h', lib='krb5',
652 msg="Checking whether krb5_princ_component is available")
657 krb5_enctype_to_string(1, buf, 256);
660 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_SIZE_T_ARG',
661 headers='krb5.h', lib='krb5 k5crypto',
662 addmain=False, cflags='-Werror',
663 msg="Checking whether krb5_enctype_to_string takes size_t argument")
667 krb5_context context = NULL;
669 krb5_enctype_to_string(context, 1, &str);
673 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_KRB5_CONTEXT_ARG',
674 headers='krb5.h stdlib.h', lib='krb5',
675 addmain=False, cflags='-Werror',
676 msg="Checking whether krb5_enctype_to_string takes krb5_context argument")
679 krb5_context ctx = NULL;
680 krb5_principal princ = NULL;
681 const char *str = krb5_princ_realm(ctx, princ)->data;
684 'HAVE_KRB5_PRINC_REALM',
685 headers='krb5.h', lib='krb5',
687 msg="Checking whether the macro krb5_princ_realm is defined")
690 krb5_context context;
691 krb5_principal principal;
692 const char *realm; realm = krb5_principal_get_realm(context, principal);
695 'HAVE_KRB5_PRINCIPAL_GET_REALM',
696 headers='krb5.h', lib='krb5',
698 msg="Checking whether krb5_principal_get_realm is defined")
699 if conf.CHECK_CODE('''krb5_verify_checksum(0, 0, 0, 0, 0, 0, 0);''',
700 'KRB5_VERIFY_CHECKSUM_ARGS',
701 headers='krb5.h', lib='krb5',
702 msg="Checking whether krb5_verify_checksum takes 7 arguments"):
703 conf.DEFINE('KRB5_VERIFY_CHECKSUM_ARGS', '7')
705 conf.DEFINE('KRB5_VERIFY_CHECKSUM_ARGS', '6')
708 krb5_enctype enctype;
709 enctype = ENCTYPE_ARCFOUR_HMAC_MD5;
711 '_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5',
712 headers='krb5.h', lib='krb5',
713 msg="Checking whether the ENCTYPE_ARCFOUR_HMAC_MD5 key type definition is available");
715 krb5_keytype keytype;
716 keytype = KEYTYPE_ARCFOUR_56;
718 '_HAVE_KEYTYPE_ARCFOUR_56',
719 headers='krb5.h', lib='krb5',
720 msg="Checking whether the HAVE_KEYTYPE_ARCFOUR_56 key type definition is available");
721 if conf.CONFIG_SET('_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and conf.CONFIG_SET('_HAVE_KEYTYPE_ARCFOUR_56'):
722 conf.DEFINE('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5', '1')
725 krb5_enctype enctype;
726 enctype = ENCTYPE_ARCFOUR_HMAC;
728 'HAVE_ENCTYPE_ARCFOUR_HMAC',
729 headers='krb5.h', lib='krb5',
730 msg="Checking whether the ENCTYPE_ARCFOUR_HMAC key type definition is available");
733 krb5_context context;
735 krb5_init_context(&context);
736 return krb5_kt_resolve(context, "WRFILE:api", &keytab);
738 'HAVE_WRFILE_KEYTAB',
739 headers='krb5.h', lib='krb5', execute=True,
740 msg="Checking whether the WRFILE:-keytab is supported");
742 # Check for KRB5_DEPRECATED handling
743 conf.CHECK_CODE('''#define KRB5_DEPRECATED 1
744 #include <krb5.h>''',
745 'HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER', addmain=False,
747 msg="Checking for KRB5_DEPRECATED define taking an identifier")
749 if Options.options.with_ads:
751 if not conf.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and \
752 not conf.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC'):
753 Logs.warn("arcfour-hmac-md5 encryption type not found in -lkrb5")
755 if not conf.CONFIG_SET('HAVE_KRB5_MK_REQ_EXTENDED'):
756 Logs.warn("krb5_mk_req_extended not found in -lkrb5")
758 if not conf.CONFIG_SET('HAVE_KRB5_PRINCIPAL2SALT') and \
759 not conf.CONFIG_SET('HAVE_KRB5_GET_PW_SALT'):
760 Logs.warn("no CREATE_KEY_FUNCTIONS detected")
762 if not conf.CONFIG_SET('HAVE_KRB5_GET_PERMITTED_ENCTYPES') and \
763 not conf.CONFIG_SET('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES'):
764 Logs.warn("no GET_ENCTYPES_FUNCTIONS detected")
766 if not conf.CONFIG_SET('HAVE_KRB5_KT_FREE_ENTRY') and \
767 not conf.CONFIG_SET('HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS'):
768 Logs.warn("no KT_FREE_FUNCTION detected")
770 if not conf.CONFIG_SET('HAVE_KRB5_C_VERIFY_CHECKSUM') and \
771 not conf.CONFIG_SET('HAVE_KRB5_VERIFY_CHECKSUM'):
772 Logs.warn("no KRB5_VERIFY_CHECKSUM_FUNCTION detected")
774 if not conf.CONFIG_SET('KRB5_TICKET_HAS_KEYINFO'):
775 # We only need the following functions if we can't get the enctype
776 # and kvno out of the ticket directly (ie. on Heimdal).
777 if not conf.CONFIG_SET('HAVE_FREE_AP_REQ'):
778 Logs.warn("no KRB5_AP_REQ_FREE_FUNCTION detected")
780 if not conf.CONFIG_SET('HAVE_KRB5_DECODE_AP_REQ'):
781 Logs.warn("no KRB5_AP_REQ_DECODING_FUNCTION detected")
784 conf.DEFINE('WITH_ADS', '1')
785 conf.DEFINE('HAVE_KRB5', '1')
787 conf.DEFINE('HAVE_GSSAPI', '1')
788 if conf.CONFIG_SET('HAVE_LDAP'):
789 conf.env['HAVE_ADS'] = '1'
791 Logs.warn("krb5 libs don't have all features required for Active Directory support")
792 conf.undefine('HAVE_KRB5_H')
793 conf.undefine('HAVE_GSSAPI_H')
794 conf.undefine('HAVE_GSSAPI_GSSAPI_GENERIC_H')
795 conf.undefine('HAVE_GSSAPI_GSSAPI_H')
797 if Options.options.with_utmp:
798 conf.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
799 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers='utmp.h',
800 define='HAVE_UT_UT_NAME')
801 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers='utmp.h',
802 define='HAVE_UT_UT_USER')
803 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers='utmp.h',
804 define='HAVE_UT_UT_ID')
805 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers='utmp.h',
806 define='HAVE_UT_UT_HOST')
807 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers='utmp.h',
808 define='HAVE_UT_UT_TIME')
809 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers='utmp.h',
810 define='HAVE_UT_UT_TV')
811 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers='utmp.h',
812 define='HAVE_UT_UT_TYPE')
813 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers='utmp.h',
814 define='HAVE_UT_UT_PID')
815 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers='utmp.h',
816 define='HAVE_UT_UT_EXIT')
817 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr_v6', headers='utmp.h',
818 define='HAVE_UT_UT_ADDR_V6')
819 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr', headers='utmp.h',
820 define='HAVE_UT_UT_ADDR')
821 conf.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers='utmpx.h',
822 define='HAVE_UX_UT_SYSLEN')
823 conf.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
824 'PUTUTLINE_RETURNS_UTMP', headers='utmp.h',
825 msg="Checking whether pututline returns pointer")
826 conf.DEFINE('WITH_UTMP', 1)
828 if Options.options.with_avahi:
829 conf.env.with_avahi = True
830 if not conf.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf.env.with_avahi = False
831 if not conf.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf.env.with_avahi = False
832 if not conf.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf.env.with_avahi = False
833 if conf.env.with_avahi:
834 conf.DEFINE('WITH_AVAHI_SUPPORT', 1)
836 conf.SET_TARGET_TYPE('avahi-common', 'EMPTY')
837 conf.SET_TARGET_TYPE('avahi-client', 'EMPTY')
839 if Options.options.with_iconv:
840 conf.env.with_iconv = True
841 if not conf.CHECK_FUNCS_IN('iconv_open', 'iconv', headers='iconv.h'):
842 conf.env.with_iconv = False
843 if conf.env.with_iconv:
844 conf.DEFINE('HAVE_ICONV', 1)
846 if Options.options.with_pam:
848 conf.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
849 if not conf.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
850 Logs.warn("--with-pam=yes but pam_appl.h not found")
852 conf.CHECK_FUNCS_IN('pam_get_data', 'pam')
853 conf.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h')
854 if not conf.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'):
855 Logs.warn("--with-pam=yes but pam_modules.h not found")
857 conf.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h')
858 conf.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h')
859 conf.CHECK_FUNCS_IN('pam_vsyslog', 'pam')
861 #if defined(HAVE_SECURITY_PAM_APPL_H)
862 #include <security/pam_appl.h>
863 #elif defined(HAVE_PAM_PAM_APPL_H)
864 #include <pam/pam_appl.h>
866 pam_set_item(0, PAM_RHOST, 0);
870 msg="Checking whether PAM_RHOST is available");
872 #if defined(HAVE_SECURITY_PAM_APPL_H)
873 #include <security/pam_appl.h>
874 #elif defined(HAVE_PAM_PAM_APPL_H)
875 #include <pam/pam_appl.h>
877 pam_set_item(0, PAM_TTY, 0);
881 msg="Checking whether PAM_TTY is available");
883 #if (!defined(LINUX))
885 #define PAM_EXTERN extern
886 #if defined(HAVE_SECURITY_PAM_APPL_H)
887 #include <security/pam_appl.h>
888 #elif defined(HAVE_PAM_PAM_APPL_H)
889 #include <pam/pam_appl.h>
894 #if defined(HAVE_SECURITY_PAM_MODULES_H)
895 #include <security/pam_modules.h>
896 #elif defined(HAVE_PAM_PAM_MODULES_H)
897 #include <pam/pam_modules.h>
900 #if defined(HAVE_SECURITY__PAM_MACROS_H)
901 #include <security/_pam_macros.h>
902 #elif defined(HAVE_PAM__PAM_MACROS_H)
903 #include <pam/_pam_macros.h>
906 #ifdef HAVE_SECURITY_PAM_EXT_H
907 #include <security/pam_ext.h>
910 int i; i = PAM_RADIO_TYPE;
912 'HAVE_PAM_RADIO_TYPE',
914 msg="Checking whether PAM_RADIO_TYPE is available");
916 conf.DEFINE('WITH_PAM', 1)
917 conf.DEFINE('WITH_PAM_MODULES', 1)
921 seteuid = conf.CHECK_CODE('''
922 #define AUTOCONF_TEST 1
923 #define USE_SETREUID 1
924 #include "./lib/util_sec.c"
929 msg="Checking whether setreuid is available")
931 seteuid = conf.CHECK_CODE('''
932 #define AUTOCONF_TEST 1
933 #define USE_SETRESUID 1
934 #include "./lib/util_sec.c"
939 msg="Checking whether setresuid is available")
941 seteuid = conf.CHECK_CODE('''
942 #define AUTOCONF_TEST 1
943 #define USE_SETEUID 1
944 #include "./lib/util_sec.c"
949 msg="Checking whether seteuid is available")
951 seteuid = conf.CHECK_CODE('''
952 #define AUTOCONF_TEST 1
953 #define USE_SETUIDX 1
954 #include "./lib/util_sec.c"
960 msg="Checking whether setuidx is available")
961 if Options.options.with_dnsupdate:
962 conf.CHECK_HEADERS('uuid/uuid.h')
963 conf.CHECK_FUNCS_IN('uuid_generate', 'uuid')
964 if not conf.CONFIG_SET('HAVE_UUID_UUID_H') and not conf.CONFIG_SET('HAVE_UUID_GENERATE'):
965 Logs.warn("--with-dnsupdate=yes but uuid support not sufficient")
966 elif not conf.CONFIG_SET('HAVE_GSSAPI'):
967 Logs.warn("--with-dnsupdate=yes but gssapi support not sufficient")
969 conf.DEFINE('WITH_DNS_UPDATES', 1)
971 conf.SET_TARGET_TYPE('uuid', 'EMPTY')
972 conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
973 if Options.options.developer:
974 if conf.CONFIG_SET('HAVE_VALGRIND_H') or conf.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'):
975 conf.DEFINE('VALGRIND', '1')
977 if conf.CHECK_CODE('''
978 #include <bits/sockaddr.h>
979 #include <linux/netlink.h>
981 'HAVE_LINUX_NETLINK_H',
982 msg="Checking whether Linux netlink is available"):
984 #include <bits/sockaddr.h>
985 #include <linux/netlink.h>
986 #include <linux/rtnetlink.h>
988 'HAVE_LINUX_RTNETLINK_H',
989 msg='Checking whether Linux rtnetlink is available')
990 if conf.CHECK_TYPE('struct dirent64', headers='sys/types.h dirent.h') and conf.CONFIG_SET('HAVE_READDIR64'):
991 conf.DEFINE('HAVE_STRUCT_DIRENT64', '1')
993 conf.undefine('HAVE_STRUCT_DIRENT64')
996 #include "../tests/fcntl_lock.c"
1001 msg='Checking whether fcntl locking is available')
1004 #include "../tests/fcntl_lock64.c"
1006 'HAVE_BROKEN_FCNTL64_LOCKS',
1009 msg='Checking whether fcntl64 locks are broken')
1011 if not conf.CONFIG_SET('HAVE_BROKEN_FCNTL64_LOCKS'):
1013 #if defined(HAVE_UNISTD_H)
1023 #ifdef HAVE_SYS_FCNTL_H
1024 #include <sys/fcntl.h>
1026 main() { struct flock64 fl64;
1027 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
1034 'HAVE_STRUCT_FLOCK64',
1037 msg="Checking whether the flock64 struct is available")
1039 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec',
1040 define='HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') # Linux, Solaris
1041 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimensec',
1042 define='HAVE_STRUCT_STAT_ST_MTIMENSEC') # BSD, if defined _POSIX_SOURCE
1043 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimespec.tv_nsec',
1044 define='HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') # BSD, if not defined _POSIX_SOURCE
1045 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtime_n',
1046 define='HAVE_STRUCT_STAT_ST_MTIME_N') # AIX
1047 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_umtime',
1048 define='HAVE_STRUCT_STAT_ST_UMTIME') # Tru64
1049 if conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') or \
1050 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMENSEC') or \
1051 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') or \
1052 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIME_N') or \
1053 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_UMTIME'):
1054 conf.DEFINE('HAVE_STAT_HIRES_TIMESTAMPS', '1')
1056 # recent FreeBSD, NetBSD have creation timestamps called birthtime:
1057 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtime',
1058 define='HAVE_STRUCT_STAT_ST_BIRTHTIME')
1059 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimespec.tv_nsec',
1060 define='HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC')
1061 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimensec',
1062 define='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC')
1065 ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
1067 'HAVE_POSIX_FADVISE',
1068 msg='Checking whether posix_fadvise is available',
1069 headers='unistd.h fcntl.h')
1071 for v in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]:
1074 return sysconf(%s) == -1 ? 1 : 0;
1077 msg='Checking whether sysconf(%s) is available' % v)
1079 conf.CHECK_DECLS('__NR_inotify_init', reverse=True, headers='asm/unistd.h')
1082 #include <sys/syscall.h>
1084 syscall(SYS_initgroups, 16, NULL, NULL, 0);
1086 'HAVE_DARWIN_INITGROUPS',
1087 msg='Checking whether to use the Darwin-specific initgroups system call')
1089 conf.CHECK_CODE('''struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''',
1091 headers='sys/types.h utime.h',
1092 msg='Checking whether struct utimbuf is available')
1094 if conf.CHECK_CODE('''struct sigevent s;''',
1095 'HAVE_STRUCT_SIGEVENT',
1096 headers='sys/types.h stdlib.h stddef.h signal.h',
1097 msg='Checking whether we have the struct sigevent'):
1098 conf.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sival_ptr',
1099 define='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR',
1100 headers='signal.h');
1101 conf.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sigval_ptr',
1102 define='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR',
1103 headers='signal.h');
1105 if os.path.exists('/proc/sys/kernel/core_pattern'):
1106 conf.DEFINE('HAVE_SYS_KERNEL_PROC_CORE_PATTERN', '1')
1108 if conf.CHECK_CODE('''
1112 if (sizeof(time_t) == 8) {
1113 time_t max_time = 0x7fffffffffffffffll;
1114 tm = gmtime(&max_time);
1115 /* This should fail with 32-bit tm_year. */
1117 /* Max time_t that works with 32-bit int tm_year in struct tm. */
1118 max_time = 67768036191676799ll;
1119 tm = gmtime(&max_time);
1130 msg="Checking for the maximum value of the 'time_t' type"):
1131 conf.DEFINE('TIME_T_MAX', '67768036191676799ll')
1134 #if defined(HAVE_UNISTD_H)
1137 #include <sys/types.h>
1138 main() { dev_t dev = makedev(1,2); return 0; }
1142 msg='Checking whether the macro for makedev is available')
1149 void exit_on_core(int ignored) {
1155 signal(SIGSEGV, exit_on_core);
1156 newpath = realpath("/tmp", NULL);
1157 exit((newpath != NULL) ? 0 : 1);
1160 'REALPATH_TAKES_NULL',
1163 msg='Checking whether the realpath function allows a NULL argument')
1165 conf.CHECK_CODE('''#include "../tests/ftruncate.c"''',
1166 'HAVE_FTRUNCATE_EXTEND',
1167 msg='Checking for ftruncate extend',
1170 if os.getenv('RUN_FROM_BUILD_FARM'):
1171 Logs.info("enabling buildfarm hacks")
1172 conf.DEFINE('ENABLE_BUILD_FARM_HACKS', '1')
1174 if Options.options.with_sendfile_support:
1175 if (host_os.rfind('linux') > -1) or (host_os.rfind('gnu') > -1) or (host_os.rfind('k*bsd*-gnu') > -1) or (host_os.rfind('kopensolaris*-gnu') > -1):
1180 ssize_t nwritten = sendfile64(tofd, fromfd, &offset, total);
1183 headers='sys/sendfile',
1184 msg='Checking for linux sendfile64 support')
1189 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1192 headers='sys/sendfile',
1193 msg='Checking for linux sendfile support')
1195 # Try and cope with broken Linux sendfile....
1196 conf.CHECK_CODE('''#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
1197 #undef _FILE_OFFSET_BITS
1199 #include <sys/sendfile.h>
1203 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1205 '_HAVE_BROKEN_LINUX_SENDFILE',
1206 msg='Checking for broken linux sendfile support')
1207 if conf.CONFIG_SET('_HAVE_SENDFILE64'):
1208 conf.DEFINE('HAVE_SENDFILE64', '1')
1209 conf.DEFINE('LINUX_SENDFILE_API', '1')
1210 conf.DEFINE('WITH_SENDFILE', '1')
1211 elif conf.CONFIG_SET('_HAVE_SENDFILE'):
1212 conf.DEFINE('HAVE_SENDFILE', '1')
1213 conf.DEFINE('LINUX_SENDFILE_API', '1')
1214 conf.DEFINE('WITH_SENDFILE', '1')
1215 elif conf.CONFIG_SET('_HAVE_BROKEN_LINUX_SENDFILE'):
1216 conf.DEFINE('LINUX_BROKEN_SENDFILE_API', '1')
1217 conf.DEFINE('WITH_SENDFILE', '1')
1218 elif (host_os.rfind('freebsd') > -1) or (host_os.rfind('dragonfly') > -1):
1220 #include <sys/types.h>
1222 #include <sys/socket.h>
1223 #include <sys/uio.h>
1224 int fromfd, tofd, ret, total=0;
1225 off_t offset, nwritten;
1228 hdr.headers = &hdtrl;
1230 hdr.trailers = NULL;
1232 hdtrl.iov_base = NULL;
1234 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0)
1237 msg='Checking for freebsd sendfile support')
1238 if conf.CONFIG_SET('_HAVE_SENDFILE'):
1239 conf.DEFINE('HAVE_SENDFILE', '1')
1240 conf.DEFINE('FREEBSD_SENDFILE_API', '1')
1241 conf.DEFINE('WITH_SENDFILE', '1')
1242 elif (host_os.rfind('hpux') > -1):
1244 #include <sys/socket.h>
1245 #include <sys/uio.h>
1248 struct iovec hdtrl[2];
1251 hdtrl[0].iov_base = 0;
1252 hdtrl[0].iov_len = 0;
1253 nwritten = sendfile64(tofd, fromfd, offset, total, &hdtrl[0], 0);
1256 msg='Checking for hpux sendfile64 support')
1258 #include <sys/socket.h>
1259 #include <sys/uio.h>
1262 struct iovec hdtrl[2];
1265 hdtrl[0].iov_base = 0;
1266 hdtrl[0].iov_len = 0;
1267 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
1270 msg='Checking for hpux sendfile support')
1271 if conf.CONFIG_SET('_HAVE_SENDFILE64'):
1272 conf.DEFINE('HAVE_SENDFILE64', '1')
1273 conf.DEFINE('HPUX_SENDFILE_API', '1')
1274 conf.DEFINE('WITH_SENDFILE', '1')
1275 elif conf.CONFIG_SET('_HAVE_SENDFILE'):
1276 conf.DEFINE('HAVE_SENDFILE', '1')
1277 conf.DEFINE('HPUX_SENDFILE_API', '1')
1278 conf.DEFINE('WITH_SENDFILE', '1')
1279 elif (host_os.rfind('solaris') > -1):
1280 conf.CHECK_FUNCS_IN('sendfile', 'sendfilev')
1282 #include <sys/sendfile.h>
1285 struct sendfilevec vec[2];
1289 vec[0].sfv_fd = SFV_FD_SELF;
1290 vec[0].sfv_flag = 0;
1294 vec[1].sfv_flag = 0;
1297 nwritten = sendfilev64(tofd, vec, sfvcnt, &xferred);
1299 '_HAVE_SENDFILEV64',
1300 msg='Checking for solaris sendfilev64 support')
1302 #include <sys/sendfile.h>,
1305 struct sendfilevec vec[2];
1309 vec[0].sfv_fd = SFV_FD_SELF;
1310 vec[0].sfv_flag = 0;
1314 vec[1].sfv_flag = 0;
1317 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
1320 msg='Checking for solaris sendfilev support')
1321 if conf.CONFIG_SET('_HAVE_SENDFILEV64'):
1322 conf.DEFINE('HAVE_SENDFILEV64', '1')
1323 conf.DEFINE('SOLARIS_SENDFILE_API', '1')
1324 conf.DEFINE('WITH_SENDFILE', '1')
1325 elif conf.CONFIG_SET('_HAVE_SENDFILEV'):
1326 conf.DEFINE('HAVE_SENDFILEV', '1')
1327 conf.DEFINE('SOLARIS_SENDFILE_API', '1')
1328 conf.DEFINE('WITH_SENDFILE', '1')
1329 elif (host_os.rfind('aix') > -1):
1331 #include <sys/socket.h>
1334 struct sf_parms hdtrl;
1337 hdtrl.header_data = 0;
1338 hdtrl.header_length = 0;
1339 hdtrl.file_descriptor = fromfd;
1340 hdtrl.file_offset = 0;
1341 hdtrl.file_bytes = 0;
1342 hdtrl.trailer_data = 0;
1343 hdtrl.trailer_length = 0;
1344 nwritten = send_file(&tofd, &hdtrl, 0);
1347 msg='Checking for AIX send_file support')
1348 if conf.CONFIG_SET('_HAVE_SENDFILE'):
1349 conf.DEFINE('HAVE_SENDFILE', '1')
1350 conf.DEFINE('AIX_SENDFILE_API', '1')
1351 conf.DEFINE('WITH_SENDFILE', '1')
1353 # Check for getcwd allowing a NULL arg.
1357 char *s = getcwd(NULL,0);
1358 exit(s != NULL ? 0 : 1);
1359 }''', 'GETCWD_TAKES_NULL', addmain=False, execute=True,
1360 msg="getcwd takes a NULL argument")
1363 conf.CHECK_CODE('''enum TDB_ERROR err = TDB_ERR_NESTING''',
1364 'HAVE_TDB_ERR_NESTING',
1366 msg='Checking whether we have TDB_ERR_NESTING')
1368 # UnixWare 7.x has its getspnam in -lgen
1369 conf.CHECK_FUNCS_IN('getspnam', 'gen')
1370 conf.CHECK_FUNCS_IN('getspnam', 'security')
1371 conf.CHECK_FUNCS_IN('getspnam', 'sec')
1373 if Options.options.with_quotas:
1374 # For quotas on Veritas VxFS filesystems
1375 conf.CHECK_HEADERS('sys/fs/vx_quota.h')
1376 # For quotas on Linux XFS filesystems
1377 conf.CHECK_HEADERS('linux/dqblk_xfs.h')
1378 # For sys/quota.h and linux/quota.h
1379 conf.CHECK_HEADERS('sys/quota.h')
1383 # checking for clustering extensions (CTDB)
1385 if not Options.options.with_cluster_support:
1386 have_cluster_support = False
1390 if Options.options.ctdb_dir:
1391 conf.ADD_EXTRA_INCLUDES(Options.options.ctdb_dir + '/include')
1393 srcdir = os.path.realpath(conf.srcdir)
1394 if 'EXTRA_INCLUDES' in conf.env:
1395 includes = ' '.join(conf.env['EXTRA_INCLUDES']).replace('#', srcdir + '/')
1399 have_cluster_support = True
1404 #include "replace.h"
1405 #include "system/wait.h"
1406 #include "system/network.h"
1407 #define private #error __USED_RESERVED_WORD_private__
1420 msg='Checking for header ctdb.h')
1422 if not conf.CONFIG_SET('HAVE_CTDB_H'):
1423 have_cluster_support = False
1424 ctdb_broken = "ctdb.h is required for cluster support"
1426 if have_cluster_support:
1429 #include "replace.h"
1430 #include "system/wait.h"
1431 #include "system/network.h"
1432 #define private #error __USED_RESERVED_WORD_private__
1436 #include <ctdb_private.h>
1443 'HAVE_CTDB_PRIVATE_H',
1446 msg='Checking for header ctdb_private.h')
1448 if not conf.CONFIG_SET('HAVE_CTDB_PRIVATE_H'):
1449 have_cluster_support = False
1450 ctdb_broken = "ctdb_private.h is required for cluster support"
1452 if have_cluster_support:
1455 #include "replace.h"
1456 #include "system/wait.h"
1457 #include "system/network.h"
1461 #include <ctdb_private.h>
1465 int i = (int)CTDB_CONTROL_TRANS3_COMMIT;
1469 'HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL',
1472 msg='Checking for transaction support (TRANS3_COMMIT control)')
1474 if not conf.CONFIG_SET('HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL'):
1475 have_cluster_support = False
1476 ctdb_broken = "ctdb transaction support missing or too old"
1478 if have_cluster_support:
1481 #include "replace.h"
1482 #include "system/wait.h"
1483 #include "system/network.h"
1487 #include <ctdb_private.h>
1491 int i = (int)CTDB_CONTROL_SCHEDULE_FOR_DELETION;
1495 'HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL',
1498 msg='Checking for SCHEDULE_FOR_DELETION control')
1500 if not conf.CONFIG_SET('HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL'):
1501 if not Options.options.enable_old_ctdb:
1502 have_cluster_support = False
1503 ctdb_broken = "SCHEDULE_FOR_DELETION control missing"
1505 Logs.warn("ignoring missing SCHEDULE_FOR_DELETION control (--enable-old-ctdb)")
1507 if have_cluster_support:
1510 #include "replace.h"
1511 #include "system/wait.h"
1512 #include "system/network.h"
1516 #include <ctdb_private.h>
1520 struct ctdb_control_tcp _x;
1524 'HAVE_STRUCT_CTDB_CONTROL_TCP',
1527 msg='Checking for ctdb ipv4 support')
1529 if not conf.CONFIG_SET('HAVE_STRUCT_CTDB_CONTROL_TCP'):
1530 have_cluster_support = False
1531 ctdb_broken = "missing struct ctdb_control_tcp"
1533 if have_cluster_support:
1536 #include "replace.h"
1537 #include "system/wait.h"
1538 #include "system/network.h"
1542 #include <ctdb_private.h>
1546 struct ctdb_control_tcp_addr _x;
1550 'HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR',
1553 msg='Checking for ctdb ipv6 support')
1555 if have_cluster_support:
1556 Logs.info("building with cluster support")
1557 conf.DEFINE('CLUSTER_SUPPORT', 1);
1559 if not Options.options.with_cluster_support:
1560 Logs.info("building without cluster support")
1562 Logs.warn("building without cluster support: " + ctdb_broken)
1563 conf.undefine('CLUSTER_SUPPORT')
1567 conf.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }',
1568 'HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR',
1571 msg='Checking whether we can compile with __attribute__((destructor))')
1573 conf.CHECK_CODE('void seekdir(DIR *d, long loc) { return; }',
1574 'SEEKDIR_RETURNS_VOID',
1575 headers='sys/types.h dirent.h',
1576 msg='Checking whether seekdir returns void')
1578 if Options.options.with_profiling_data:
1579 conf.DEFINE('WITH_PROFILE', 1);
1581 PTHREAD_CFLAGS='error'
1582 PTHREAD_LDFLAGS='error'
1584 if PTHREAD_LDFLAGS == 'error':
1585 if conf.CHECK_FUNCS_IN('pthread_attr_init', 'pthread'):
1586 PTHREAD_CFLAGS='-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS'
1587 PTHREAD_LDFLAGS='-lpthread'
1588 if PTHREAD_LDFLAGS == 'error':
1589 if conf.CHECK_FUNCS_IN('pthread_attr_init', 'pthreads'):
1590 PTHREAD_CFLAGS='-D_THREAD_SAFE'
1591 PTHREAD_LDFLAGS='-lpthreads'
1592 if PTHREAD_LDFLAGS == 'error':
1593 if conf.CHECK_FUNCS_IN('pthread_attr_init', 'c_r'):
1594 PTHREAD_CFLAGS='-D_THREAD_SAFE -pthread'
1595 PTHREAD_LDFLAGS='-pthread'
1596 if PTHREAD_LDFLAGS == 'error':
1597 if conf.CHECK_FUNC('pthread_attr_init'):
1598 PTHREAD_CFLAGS='-D_REENTRANT'
1599 PTHREAD_LDFLAGS='-lpthread'
1600 # especially for HP-UX, where the CHECK_FUNC macro fails to test for
1601 # pthread_attr_init. On pthread_mutex_lock it works there...
1602 if PTHREAD_LDFLAGS == 'error':
1603 if conf.CHECK_FUNCS_IN('pthread_mutex_lock', 'pthread'):
1604 PTHREAD_CFLAGS='-D_REENTRANT'
1605 PTHREAD_LDFLAGS='-lpthread'
1607 if PTHREAD_CFLAGS != 'error' and PTHREAD_LDFLAGS != 'error':
1608 conf.ADD_CFLAGS(PTHREAD_CFLAGS)
1609 conf.ADD_LDFLAGS(PTHREAD_LDFLAGS)
1610 conf.CHECK_HEADERS('pthread.h')
1611 conf.DEFINE('HAVE_PTHREAD', '1')
1613 if Options.options.with_pthreadpool:
1614 if conf.CONFIG_SET('HAVE_PTHREAD'):
1615 conf.DEFINE('WITH_PTHREADPOOL', '1')
1617 Logs.warn("pthreadpool support cannot be enabled when pthread support was not found")
1618 conf.undefine('WITH_PTHREADPOOL')
1620 if conf.CHECK_HEADERS('gpfs_gpl.h'):
1621 conf.DEFINE('HAVE_GPFS', '1')
1623 # Note that all charset 'modules' must actually be static, due to dependency loop issues
1624 # if we include the module loader in iconv
1626 default_static_modules=TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
1627 auth_sam auth_unix auth_winbind auth_wbc auth_server
1628 auth_domain auth_builtin vfs_default
1629 nss_info_template idmap_tdb idmap_passdb
1632 default_shared_modules=TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
1633 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
1634 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2
1635 auth_script vfs_readahead vfs_xattr_tdb
1636 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
1637 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
1638 vfs_crossrename vfs_linux_xfs_sgid
1639 vfs_time_audit idmap_autorid''')
1641 if Options.options.developer:
1642 default_static_modules.extend(TO_LIST('pdb_ads auth_netlogond charset_weird'))
1643 default_shared_modules.extend(TO_LIST('perfcount_test'))
1645 default_static_modules.extend(TO_LIST('pdb_samba4 auth_samba4 vfs_dfs_samba4'))
1647 if Options.options.with_acl_support and conf.CONFIG_SET('HAVE_POSIX_ACLS'):
1648 default_static_modules.extend(TO_LIST('vfs_posixacl'))
1650 if conf.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'):
1651 default_shared_modules.extend(TO_LIST('vfs_zfsacl'))
1653 if conf.CONFIG_SET('HAVE_DIRFD_DECL'):
1654 default_shared_modules.extend(TO_LIST('vfs_syncops vfs_dirsort'))
1656 if conf.CONFIG_SET('HAVE_STATFS_F_FSID'):
1657 default_shared_modules.extend(TO_LIST('vfs_fileid'))
1659 if conf.CONFIG_SET('HAVE_AIO') and (conf.CONFIG_SET('HAVE_MSGHDR_MSG_CONTROL') or conf.CONFIG_SET('HAVE_MSGHDR_MSG_ACCTRIGHTS')):
1660 default_shared_modules.extend(TO_LIST('vfs_aio_fork'))
1662 if conf.CONFIG_SET('HAVE_LDAP'):
1663 default_static_modules.extend(TO_LIST('pdb_ldap idmap_ldap'))
1665 if conf.CONFIG_SET('DARWINOS'):
1666 default_static_modules.extend(TO_LIST('charset_macosxfs'))
1668 if conf.CONFIG_SET('HAVE_GPFS'):
1669 default_shared_modules.extend(TO_LIST('vfs_gpfs vfs_gpfs_hsm_notify'))
1671 explicit_shared_modules = TO_LIST(Options.options.shared_modules, delimiter=',')
1672 explicit_static_modules = TO_LIST(Options.options.static_modules, delimiter=',')
1674 final_static_modules = default_static_modules
1675 final_shared_modules = default_shared_modules
1677 for m in explicit_static_modules:
1678 if m in final_shared_modules:
1679 final_shared_modules.remove(m)
1680 final_static_modules.append(m)
1681 for m in explicit_shared_modules:
1682 if m in final_static_modules:
1683 final_static_modules.remove(m)
1684 final_shared_modules.append(m)
1686 conf.env['static_modules'] = final_static_modules
1687 conf.env['shared_modules'] = final_shared_modules
1689 conf.DEFINE('STRING_STATIC_MODULES', ' '.join(final_static_modules), quote=True)
1694 prefixes = ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
1695 conf.env['MODULE_PREFIXES'] = prefixes
1697 for m in final_static_modules:
1699 if not p in static_list:
1701 static_list[p].append(m)
1702 for m in final_shared_modules:
1704 if not p in shared_list:
1706 shared_list[p].append(m)
1709 static_env = "%s_STATIC" % p.upper()
1710 shared_env = "%s_SHARED" % p.upper()
1711 conf.env[static_env] = []
1712 conf.env[shared_env] = []
1713 if p in static_list:
1715 for entry in static_list[p]:
1716 decl_list += "extern NTSTATUS %s_init(void); " % entry
1717 conf.env[static_env].append('%s' % entry)
1718 decl_list = decl_list.rstrip()
1719 conf.DEFINE('static_decl_%s' % p, decl_list)
1720 conf.DEFINE('static_init_%s' % p, '{ %s_init(); }' % '_init(); '.join(static_list[p]))
1722 conf.DEFINE('static_decl_%s' % p, '')
1723 conf.DEFINE('static_init_%s' % p, '{}')
1724 if p in shared_list:
1725 for entry in shared_list[p]:
1726 conf.DEFINE('%s_init' % entry, 'samba_init_module')
1727 conf.env[shared_env].append('%s' % entry)
1729 conf.SAMBA_CONFIG_H('include/config.h')
1732 "build 'tags' file using ctags"
1734 source_root = os.path.dirname(Utils.g_module.root_path)
1735 cmd = 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
1736 print("Running: %s" % cmd)