10 from optparse import SUPPRESS_HELP
11 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
12 sys.path.insert(0, "source3")
13 import wafsamba, Options, Logs, Utils
15 import samba_utils, samba_version
19 if not os.getenv('TOPLEVEL_BUILD'):
20 opt.BUILTIN_DEFAULT('NONE')
21 opt.PRIVATE_EXTENSION_DEFAULT('s3')
22 opt.RECURSE('../lib/replace')
24 opt.RECURSE('selftest')
25 opt.RECURSE('../lib/nss_wrapper')
26 opt.RECURSE('../lib/socket_wrapper')
27 opt.RECURSE('../lib/tevent')
28 opt.RECURSE('../lib/tdb')
30 opt.add_option('--with-static-modules',
31 help=("Comma-separated list of names of modules to statically link in"),
32 action="store", dest='static_modules', default=None)
33 opt.add_option('--with-shared-modules',
34 help=("Comma-separated list of names of modules to build shared"),
35 action="store", dest='shared_modules', default=None)
36 opt.add_option('--enable-selftest',
37 help=("enable options necessary for selftest"),
38 action="store_true", dest='enable_selftest', default=False)
40 opt.SAMBA3_ADD_OPTION('winbind')
41 opt.SAMBA3_ADD_OPTION('swat')
42 opt.SAMBA3_ADD_OPTION('ads')
43 opt.SAMBA3_ADD_OPTION('krb5')
44 opt.SAMBA3_ADD_OPTION('ldap')
45 opt.SAMBA3_ADD_OPTION('cups', with_name="enable", without_name="disable")
46 opt.SAMBA3_ADD_OPTION('iprint', with_name="enable", without_name="disable")
47 opt.SAMBA3_ADD_OPTION('merged-build', with_name="enable", without_name="disable")
48 opt.SAMBA3_ADD_OPTION('pam')
49 opt.SAMBA3_ADD_OPTION('quotas')
50 opt.SAMBA3_ADD_OPTION('sys-quotas')
51 opt.SAMBA3_ADD_OPTION('sendfile-support')
52 opt.SAMBA3_ADD_OPTION('utmp')
53 opt.SAMBA3_ADD_OPTION('pthreadpool', with_name="enable", without_name="disable")
54 opt.SAMBA3_ADD_OPTION('avahi', with_name="enable", without_name="disable")
55 opt.SAMBA3_ADD_OPTION('iconv')
56 opt.SAMBA3_ADD_OPTION('acl-support')
57 opt.SAMBA3_ADD_OPTION('dnsupdate')
58 opt.SAMBA3_ADD_OPTION('syslog')
59 opt.SAMBA3_ADD_OPTION('automount')
60 opt.SAMBA3_ADD_OPTION('aio-support')
64 from samba_utils import TO_LIST
66 if not conf.env.toplevel_build:
67 version = samba_version.load_version(env=conf.env)
68 conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
69 conf.DEFINE('_SAMBA_BUILD_', version.MAJOR, add_to_cflags=True)
70 conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
72 if Options.options.developer:
73 conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
74 conf.env.developer = True
76 if Options.options.with_swat:
77 conf.env['build_swat'] = True
79 if not conf.env.toplevel_build:
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')
89 conf.RECURSE('../libcli/smbreadline')
90 conf.RECURSE('../lib/util')
92 conf.ADD_EXTRA_INCLUDES('''#source3 #source3/include #lib/replace''')
93 if not conf.env.USING_SYSTEM_TDB:
94 conf.ADD_EXTRA_INCLUDES('#lib/tdb/include')
95 if not conf.env.USING_SYSTEM_TEVENT:
96 conf.ADD_EXTRA_INCLUDES('#lib/tevent')
97 if not conf.env.USING_SYSTEM_TALLOC:
98 conf.ADD_EXTRA_INCLUDES('#lib/talloc')
99 if not conf.env.USING_SYSTEM_POPT:
100 conf.ADD_EXTRA_INCLUDES('#lib/popt')
102 conf.ADD_LDFLAGS("-Wl,--export-dynamic", testflags=True)
104 conf.CHECK_HEADERS('execinfo.h libexc.h libunwind.h netdb.h')
105 conf.CHECK_HEADERS('linux/falloc.h')
107 conf.CHECK_FUNCS('getcwd fchown chmod fchmod mknod mknod64')
108 conf.CHECK_FUNCS('strtol strchr strupr chflags')
109 conf.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
110 conf.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
111 conf.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr')
112 conf.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
113 conf.CHECK_FUNCS('setpriv setgidx setuidx setgroups sysconf stat64 fstat64')
114 conf.CHECK_FUNCS('lstat64 fopen64 atexit grantpt lseek64 ftruncate64 fallocate fallocate64 posix_fallocate posix_fallocate64')
115 conf.CHECK_FUNCS('fseek64 fseeko64 ftell64 ftello64 setluid')
116 conf.CHECK_FUNCS('getpwnam', headers='sys/types.h pwd.h')
117 conf.CHECK_FUNCS('opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64')
118 conf.CHECK_FUNCS('fdopendir fdopendir64')
119 conf.CHECK_FUNCS('getpwent_r getdents64 setenv strcasecmp fcvt fcvtl')
120 conf.CHECK_FUNCS('syslog vsyslog timegm setlocale nl_langinfo')
121 conf.CHECK_FUNCS_IN('nanosleep', 'rt')
122 conf.CHECK_FUNCS('lutimes futimes utimensat futimens')
123 conf.CHECK_FUNCS('mlock munlock mlockall munlockall')
124 conf.CHECK_FUNCS('memalign posix_memalign hstrerror')
125 conf.CHECK_FUNCS('shmget')
126 conf.CHECK_FUNCS_IN('shm_open', 'rt', checklibc=True)
127 conf.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain')
128 #FIXME: for some reason this one still fails
129 conf.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
130 conf.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
131 conf.CHECK_DECLS('fdatasync', reverse=True)
132 conf.CHECK_DECLS('readahead', reverse=True, headers='fcntl.h')
134 if conf.CONFIG_SET('HAVE_LONG_LONG'):
135 conf.DEFINE('HAVE_LONGLONG', 1)
137 if conf.CHECK_CODE('''
138 #if defined(HAVE_UNISTD_H)
141 long ret = splice(0,0,1,0,400,0);
145 conf.CHECK_DECLS('splice', reverse=True, headers='fcntl.h')
147 # Check for inotify support
148 conf.CHECK_HEADERS('linux/inotify.h asm/unistd.h sys/inotify.h')
149 conf.CHECK_FUNCS('inotify_init')
150 if "HAVE_LINUX_INOTIFY_H" in conf.env and "HAVE_INOTIFY_INIT" in conf.env:
151 conf.DEFINE('HAVE_INOTIFY', 1)
153 # Check for kernel change notify support
156 #define F_NOTIFY 1026
159 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
160 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain=False, execute=True,
161 headers='fcntl.h signal.h',
162 msg="Checking for kernel change notify support")
164 # Check for Linux kernel oplocks
166 #include <sys/types.h>
170 #define F_NOTIFY 1026
173 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
174 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain=False, execute=True,
175 msg="Checking for Linux kernel oplocks")
177 # Check for IRIX kernel oplock types
178 conf.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
179 'HAVE_KERNEL_OPLOCKS_IRIX', headers='fcntl.h',
180 msg="Checking for IRIX kernel oplock types")
182 # Check for krenel share modes
184 #include <sys/types.h>
187 #include <sys/file.h>
193 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
194 }''', 'HAVE_KERNEL_SHARE_MODES', addmain=False, execute=True,
195 msg="Checking for krenel share modes")
197 # Check for various members of the stat structure
198 conf.CHECK_TYPES('blksize_t blkcnt_t')
199 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define='HAVE_STAT_ST_BLOCKS',
200 headers='sys/stat.h')
201 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define='HAVE_STAT_ST_BLKSIZE',
202 headers='sys/stat.h')
203 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_flags', define='HAVE_STAT_ST_FLAGS',
204 headers='sys/types.h sys/stat.h unistd.h')
206 # Check for POSIX capability support
207 conf.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers='sys/capability.h')
209 if "HAVE_SYS_CAPABILITY_H" in conf.env:
213 if (!(cap = cap_get_proc())) exit(1);
215 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
216 cap_set_proc(cap);''',
217 'HAVE_POSIX_CAPABILITIES', execute=True, lib="cap",
218 headers='sys/capability.h',
219 msg="Checking whether POSIX capabilities are available")
221 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
222 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
224 if conf.CONFIG_SET("HAVE_RPC_RPC_H"):
225 conf.CHECK_TYPE('int16', headers='rpc/rpc.h',
226 define='HAVE_INT16_FROM_RPC_RPC_H',
227 msg="Checking for int16 typedef included by rpc/rpc.h")
228 conf.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
229 headers='sys/types.h rpc/rpc.h',
230 msg="Checking for uint16 typedef included by rpc/rpc.h")
231 conf.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
232 headers='sys/types.h rpc/rpc.h',
233 msg="Checking for int32 typedef included by rpc/rpc.h")
234 conf.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
235 headers='sys/types.h rpc/rpc.h',
236 msg="Checking for uint32 typedef included by rpc/rpc.h")
237 conf.CHECK_CODE('int i;', 'BROKEN_NISPLUS_INCLUDE_FILES',
238 headers='sys/types.h sys/acl.h rpcsvc/nis.h',
239 msg="Checking for broken nisplus include files")
241 # Check if the compiler will optimize out functions
244 this_function_does_not_exist();
247 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
248 msg="Checking if the compiler will optimize out functions")
250 # Check if the compiler supports the LL suffix on long long integers
252 conf.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL',
254 msg="Checking for LL suffix on long long integers")
257 _acl __acl add_proplist_entry atexit attr_getf attr_list attr_listf
258 attropen attr_remove attr_removef attr_set attr_setf backtrace_symbols
259 bindtextdomain _chdir __chdir chflags chmod _close __close _closedir
260 __closedir closedir64 creat64 crypt16 delproplist devnm dgettext dirfd
261 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
262 extattr_delete_fd extattr_delete_link extattr_get_fd extattr_get_file
263 extattr_get_link extattr_list_fd extattr_list_file extattr_list_link
264 extattr_set_fd extattr_set_file extattr_set_link _facl __facl _fchdir
265 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
266 fdelproplist fgetea fgetproplist fgetxattr flistea flistxattr fopen64
267 _fork __fork fremoveea fremovexattr fseek64 fseeko64 fsetea
268 fsetproplist fsetxattr _fstat __fstat fstat64 _fstat64 __fstat64 fsync
269 ftell64 ftello64 ftruncate64 futimens futimes __fxstat getauthuid
270 getcwd _getcwd __getcwd getdents __getdents getdents64 getdirentries
271 getgrent getgrnam getgrouplist getmntent getpagesize
272 getproplist get_proplist_entry getpwanam getpwent_r getrlimit gettext
273 glob grantpt hstrerror initgroups innetgr
274 inotify_init lgetea lgetxattr listea listxattr llistea llistxattr
275 llseek _llseek __llseek lremoveea lremovexattr _lseek __lseek lseek64
276 lsetea lsetxattr _lstat __lstat lstat64 _lstat64 __lstat64 lutimes
277 __lxstat memalign mknod mknod64 mlock mlockall munlock munlockall
278 nl_langinfo _open __open open64 _open64 __open64 _opendir __opendir
279 opendir64 pathconf poll posix_fallocate posix_fallocate64
280 posix_memalign prctl pread _pread __pread pread64 _pread64 __pread64
281 pwrite _pwrite __pwrite pwrite64 _pwrite64
282 __pwrite64 rdchk _read __read _readdir __readdir readdir64 _readdir64
283 __readdir64 removeea removexattr rewinddir64 _seekdir __seekdir
284 seekdir64 select setea setenv setgidx setgroups setlocale setluid
285 setmntent setpgid setpriv setproplist setsid setuidx
286 setxattr shmget shm_open sigaction sigblock sigprocmask sigset
287 sizeof_proplist_entry _stat __stat stat64 _stat64 __stat64 statvfs
288 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctlbyname
289 __sys_llseek syslog _telldir __telldir telldir64 textdomain timegm
290 utimensat vsyslog _write __write __xstat
293 conf.CHECK_TYPE('struct timespec', headers='sys/time.h time.h')
295 conf.CHECK_SAMBA3_CHARSET() # see build/charset.py
297 # FIXME: these should be tests for features, but the old build system just
300 host_os = sys.platform
301 Logs.info("building on %s" % host_os)
303 # Python doesn't have case switches... :/
304 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
305 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
307 conf.SET_TARGET_TYPE('sunacl', 'EMPTY')
308 if (host_os.rfind('linux') > -1) or (host_os.rfind('gnu') > -1) or (host_os.rfind('qnx') > -1):
309 if host_os.rfind('linux') > -1:
310 conf.DEFINE('LINUX', '1')
311 elif host_os.rfind('qnx') > -1:
312 conf.DEFINE('QNX', '1')
313 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
314 elif (host_os.rfind('darwin') > -1):
315 conf.DEFINE('DARWINOS', 1)
316 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
317 conf.ADD_CFLAGS('-fno-common')
318 elif (host_os.rfind('freebsd') > -1):
319 if conf.CHECK_HEADERS('sunacl.h'):
320 conf.define('HAVE_FREEBSD_SUNACL_H', '1')
321 conf.CHECK_FUNCS_IN('acl', 'sunacl')
322 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
323 elif (host_os.rfind('netbsd') > -1):
324 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
325 elif (host_os.rfind('openbsd') > -1):
326 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
327 # FIXME: Add more checks here.
329 Logs.warn("Unknown host_os '%s', please report this to samba-technical@samba.org" % host_os)
331 #FIXME: add more checks
332 if Options.options.with_acl_support:
333 if host_os.rfind('linux') > -1:
334 conf.CHECK_FUNCS_IN('acl_get_file', 'acl')
335 conf.CHECK_FUNCS_IN('getxattr', 'attr')
336 if conf.CHECK_CODE('''
339 acl_entry_t *entry_p;
340 return acl_get_entry(acl, entry_id, entry_p);
343 headers='sys/types.h sys/acl.h', link=False,
344 msg="Checking for POSIX ACL support") :
346 acl_permset_t permset_d;
348 return acl_get_perm_np(permset_d, perm);
350 'HAVE_ACL_GET_PERM_NP',
351 headers='sys/types.h sys/acl.h', link=True,
352 msg="Checking whether acl_get_perm_np() is available")
354 conf.DEFINE('HAVE_NO_ACLS', 1)
355 conf.SET_TARGET_TYPE('acl', 'EMPTY')
357 conf.DEFINE('HAVE_NO_ACLS', 1)
358 conf.SET_TARGET_TYPE('acl', 'EMPTY')
360 if conf.CHECK_FUNCS('dirfd'):
361 conf.DEFINE('HAVE_DIRFD_DECL', 1)
363 conf.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
364 'HAVE_STATFS_F_FSID',
365 msg="vfs_fileid: checking for statfs() and struct statfs.f_fsid",
366 headers='sys/types.h sys/statfs.h',
369 if conf.CONFIG_SET('HAVE_FALLOCATE'):
371 #if defined(HAVE_UNISTD_H)
374 #include <sys/types.h>
377 #if defined(HAVE_LINUX_FALLOC_H)
378 #include <linux/falloc.h>
380 int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
381 'HAVE_LINUX_FALLOCATE',
382 msg="Checking whether the Linux 'fallocate' function is available")
383 if conf.CONFIG_SET('HAVE_FALLOCATE64'):
385 #if defined(HAVE_UNISTD_H)
388 #include <sys/types.h>
391 #if defined(HAVE_LINUX_FALLOC_H)
392 #include <linux/falloc.h>
394 int ret = fallocate64(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
395 'HAVE_LINUX_FALLOCATE64',
396 msg="Checking whether the Linux 'fallocate64' function is available")
398 #if defined(HAVE_UNISTD_H)
402 ssize_t err = readahead(0,0,0x80000);''',
403 'HAVE_LINUX_READAHEAD',
404 msg="Checking whether Linux readahead is available")
405 conf.CHECK_DECLS('readahead', headers='fcntl.h', always=True)
408 #include <sys/types.h>
409 #include <sys/socket.h>],
412 int ret = getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len);''',
414 msg="Checking whether we can use SO_PEERCRED to get socket credentials")
417 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
418 #include <sys/types.h>
423 'HAVE_EXPLICIT_LARGEFILE_SUPPORT',
424 msg="Checking whether large file support can be enabled")
426 if Options.options.with_aio_support:
427 conf.CHECK_FUNCS_IN('aio_read', 'aio')
428 conf.CHECK_FUNCS_IN('aio_read', 'rt')
429 conf.CHECK_CODE('struct aiocb a; return aio_read(&a);',
431 msg='Checking for asynchronous io support',
432 headers='sys/types.h aio.h',
434 conf.CHECK_CODE('struct aiocb64 a; return aio_read64(&a);',
436 msg='Checking for 64-bit asynchronous io support',
437 headers='sys/types.h aio.h',
439 if conf.CONFIG_SET('HAVE_AIO64'):
440 conf.DEFINE('HAVE_AIOCB64', '1')
441 conf.DEFINE('WITH_AIO', '1')
442 elif conf.CONFIG_SET('HAVE_AIO'):
443 conf.DEFINE('WITH_AIO', '1')
444 if conf.CONFIG_SET('HAVE_AIO'):
445 conf.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg='Checking for aio_read', headers='aio.h', lib='aio rt')
446 conf.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg='Checking for aio_write', headers='aio.h', lib='aio rt')
447 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')
448 conf.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg='Checking for aio_return', headers='aio.h', lib='aio rt')
449 conf.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg='Checking for aio_error', headers='aio.h', lib='aio rt')
450 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')
451 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')
452 if conf.CONFIG_SET('HAVE_AIO64'):
453 conf.CHECK_CODE('struct aiocb a; return aio_read64(&a);', 'HAVE_AIO_READ64', msg='Checking for aio_read64', headers='aio.h', lib='aio rt')
454 conf.CHECK_CODE('struct aiocb a; return aio_write64(&a);', 'HAVE_AIO_WRITE64', msg='Checking for aio_write64', headers='aio.h', lib='aio rt')
455 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')
456 conf.CHECK_CODE('struct aiocb a; return aio_return64(&a);', 'HAVE_AIO_RETURN64', msg='Checking for aio_return64', headers='aio.h', lib='aio rt')
457 conf.CHECK_CODE('struct aiocb a; return aio_error64(&a);', 'HAVE_AIO_ERROR64', msg='Checking for aio_error64', headers='aio.h', lib='aio rt')
458 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')
459 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')
460 if not conf.CONFIG_SET('HAVE_AIO'):
461 conf.DEFINE('HAVE_NO_AIO', '1')
463 conf.DEFINE('HAVE_NO_AIO', '1')
469 char control[CMSG_SPACE(sizeof(int))];
471 msg.msg_control = control_un.control;
472 msg.msg_controllen = sizeof(control_un.control);
474 'HAVE_MSGHDR_MSG_CONTROL',
475 msg='Checking if we can use msg_control for passing file descriptors',
476 headers='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
480 msg.msg_acctrights = (caddr_t) &fd;
481 msg.msg_acctrightslen = sizeof(fd);
483 'HAVE_MSGHDR_MSG_ACCTRIGHTS',
484 msg='Checking if we can use msg_acctrights for passing file descriptors',
485 headers='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
487 if Options.options.with_winbind:
488 conf.env.build_winbind = True
489 conf.DEFINE('WITH_WINBIND', '1')
491 conf.find_program('awk', var='AWK')
492 conf.find_program('perl', var='PERL')
494 # Darwin has extra options to xattr-family functions
495 conf.CHECK_CODE('getxattr(0, 0, 0, 0, 0, 0);',
497 msg="Checking whether xattr interface takes additional options",
498 headers='sys/types.h attr/xattr.h sys/xattr.h')
500 conf.CHECK_HEADERS('asm/types.h')
502 conf.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
503 headers='unistd.h sys/types.h',
504 msg="Checking for major macro")
506 conf.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
507 headers='unistd.h sys/types.h',
508 msg="Checking for minor macro")
510 conf.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
511 headers='unistd.h sys/types.h dirent.h',
512 define='HAVE_DIRENT_D_OFF')
514 conf.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent')
515 conf.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE',
516 msg="Checking for setnetgrent prototype",
517 headers='netdb.h netgroup.h',
518 cflags="-Werror-implicit-function-declaration")
519 conf.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE',
520 msg="Checking for getnetgrent prototype",
521 headers='netdb.h netgroup.h',
522 cflags="-Werror-implicit-function-declaration")
523 conf.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE',
524 msg="Checking for endnetgrent prototype",
525 headers='netdb.h netgroup.h',
526 cflags="-Werror-implicit-function-declaration")
530 if Options.options.with_cups:
531 conf.find_program('cups-config', var='CUPS_CONFIG')
532 if conf.env.CUPS_CONFIG:
533 # we would normally use --libs here, but cups-config incorrectly adds
534 # gssapi_krb5 and other libraries to its --libs output. That breaks the use
535 # of an in-tree heimdal kerberos
536 conf.check_cfg(path=conf.env.CUPS_CONFIG, args="--cflags --ldflags",
537 package="", uselib_store="cups")
538 conf.CHECK_HEADERS('cups/cups.h cups/language.h', lib='cups')
539 conf.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups')
540 if conf.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
541 conf.DEFINE('HAVE_CUPS', '1')
543 conf.undefine('HAVE_CUPS')
544 conf.SET_TARGET_TYPE('cups', 'EMPTY')
546 # define an empty subsystem for cups, to allow it to be used as an empty dependency
547 conf.SET_TARGET_TYPE('cups', 'EMPTY')
549 if Options.options.with_iprint:
550 if conf.CONFIG_SET('HAVE_CUPS'):
551 conf.DEFINE('HAVE_IPRINT', '1')
553 Logs.warn("--enable-iprint=yes but cups support not sufficient")
554 if Options.options.with_syslog:
555 conf.DEFINE('WITH_SYSLOG', '1')
556 if Options.options.with_automount:
557 conf.DEFINE('WITH_AUTOMOUNT', '1')
560 if Options.options.with_ldap:
561 conf.CHECK_HEADERS('ldap.h lber.h')
562 conf.CHECK_TYPE('ber_tag_t', 'unsigned int', headers='ldap.h lber.h')
563 conf.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
564 conf.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers='ldap.h')
565 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
566 # SASL wrapping hooks
567 if conf.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
568 conf.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
569 conf.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
571 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
573 conf.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
574 define='HAVE_LBER_LOG_PRINT_FN', headers='lber.h')
576 conf.CHECK_FUNCS_IN('ldap_init ldap_initialize ldap_set_rebind_proc', 'ldap')
577 conf.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
579 # Check if ldap_set_rebind_proc() takes three arguments
580 if conf.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
581 'LDAP_SET_REBIND_PROC_ARGS',
582 msg="Checking whether ldap_set_rebind_proc takes 3 arguments",
583 headers='ldap.h lber.h', link=False):
584 conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
586 conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
588 # last but not least, if ldap_init() exists, we want to use ldap
589 if conf.CONFIG_SET('HAVE_LDAP_INIT'):
590 conf.DEFINE('HAVE_LDAP', '1')
591 conf.DEFINE('LDAP_DEPRECATED', '1')
592 conf.env['HAVE_LDAP'] = '1'
594 conf.SET_TARGET_TYPE('ldap', 'EMPTY')
595 conf.SET_TARGET_TYPE('lber', 'EMPTY')
599 if Options.options.with_krb5 and not conf.env.toplevel_build:
600 Logs.info("Looking for kerberos features")
601 conf.find_program('krb5-config', var='KRB5_CONFIG')
602 if conf.env.KRB5_CONFIG:
603 conf.check_cfg(path="krb5-config", args="--cflags --libs",
604 package="gssapi", uselib_store="krb5")
605 conf.CHECK_HEADERS('krb5.h krb5/locate_plugin.h', lib='krb5')
606 conf.CHECK_HEADERS('gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h gssapi/gssapi_ext.h com_err.h', lib='krb5')
608 if conf.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'):
609 conf.env['WINBIND_KRB5_LOCATOR'] = 'bin/winbind_krb5_locator.so'
611 conf.CHECK_FUNCS_IN('_et_list', 'com_err')
612 conf.CHECK_FUNCS_IN('krb5_encrypt_data', 'k5crypto')
613 conf.CHECK_FUNCS_IN('crypto', 'des_set_key')
614 conf.CHECK_FUNCS_IN('copy_Authenticator', 'asn1')
615 conf.CHECK_FUNCS_IN('roken_getaddrinfo_hostspec', 'roken')
616 if conf.CHECK_FUNCS_IN('gss_display_status', 'gssapi') or \
617 conf.CHECK_FUNCS_IN('gss_display_status', 'gssapi_krb5'):
619 conf.CHECK_FUNCS_IN('gss_wrap_iov', 'gssapi gssapi_krb5 krb5')
620 conf.CHECK_FUNCS_IN('krb5_mk_req_extended krb5_kt_compare', 'krb5')
622 krb5_set_real_time krb5_set_default_in_tkt_etypes krb5_set_default_tgs_enctypes
623 krb5_set_default_tgs_ktypes krb5_principal2salt krb5_use_enctype
624 krb5_string_to_key krb5_get_pw_salt krb5_string_to_key_salt krb5_auth_con_setkey
625 krb5_auth_con_setuseruserkey krb5_locate_kdc krb5_get_permitted_enctypes
626 krb5_get_default_in_tkt_etypes krb5_free_data_contents
627 krb5_principal_get_comp_string krb5_free_unparsed_name
628 krb5_free_keytab_entry_contents krb5_kt_free_entry krb5_krbhst_init
629 krb5_krbhst_get_addrinfo krb5_c_enctype_compare krb5_enctypes_compatible_keys
630 krb5_crypto_init krb5_crypto_destroy krb5_decode_ap_req free_AP_REQ
631 krb5_verify_checksum krb5_c_verify_checksum krb5_principal_compare_any_realm
632 krb5_parse_name_norealm krb5_princ_size krb5_get_init_creds_opt_set_pac_request
633 krb5_get_renewed_creds krb5_get_kdc_cred krb5_free_error_contents
634 initialize_krb5_error_table krb5_get_init_creds_opt_alloc
635 krb5_get_init_creds_opt_free krb5_get_init_creds_opt_get_error
636 krb5_enctype_to_string krb5_fwd_tgt_creds krb5_auth_con_set_req_cksumtype
637 krb5_get_creds_opt_alloc krb5_get_creds_opt_set_impersonate krb5_get_creds
638 krb5_get_credentials_for_user krb5_get_host_realm krb5_free_host_realm''',
640 conf.CHECK_DECLS('''krb5_get_credentials_for_user
641 krb5_auth_con_set_req_cksumtype''',
642 headers='krb5.h', always=True)
643 conf.CHECK_VARIABLE('AP_OPTS_USE_SUBKEY', headers='krb5.h')
644 conf.CHECK_VARIABLE('KV5M_KEYTAB', headers='krb5.h')
645 conf.CHECK_VARIABLE('KRB5_KU_OTHER_CKSUM', headers='krb5.h')
646 conf.CHECK_VARIABLE('KRB5_KEYUSAGE_APP_DATA_CKSUM', headers='krb5.h')
647 conf.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'key', headers='krb5.h',
648 define='HAVE_KRB5_KEYTAB_ENTRY_KEY')
649 conf.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'keyblock', headers='krb5.h',
650 define='HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK')
651 conf.CHECK_STRUCTURE_MEMBER('krb5_address', 'magic', headers='krb5.h',
652 define='HAVE_MAGIC_IN_KRB5_ADDRESS')
653 conf.CHECK_STRUCTURE_MEMBER('krb5_address', 'addrtype', headers='krb5.h',
654 define='HAVE_ADDRTYPE_IN_KRB5_ADDRESS')
655 conf.CHECK_STRUCTURE_MEMBER('krb5_ticket', 'enc_part2', headers='krb5.h',
656 define='HAVE_KRB5_TKT_ENC_PART2')
657 conf.CHECK_STRUCTURE_MEMBER('krb5_creds', 'keyblock', headers='krb5.h',
658 define='HAVE_KRB5_KEYBLOCK_IN_CREDS')
659 conf.CHECK_STRUCTURE_MEMBER('krb5_creds', 'session', headers='krb5.h',
660 define='HAVE_KRB5_SESSION_IN_CREDS')
661 conf.CHECK_STRUCTURE_MEMBER('krb5_ap_req', 'ticket', headers='krb5.h',
662 define='HAVE_TICKET_POINTER_IN_KRB5_AP_REQ')
664 conf.CHECK_TYPE('krb5_encrypt_block', headers='krb5.h')
669 krb5_enctype enctype;
670 enctype = ticket.enc_part.enctype;
671 kvno = ticket.enc_part.kvno;
673 'KRB5_TICKET_HAS_KEYINFO',
674 headers='krb5.h', link=False,
675 msg="Checking whether the krb5_ticket structure contains the kvno and enctype")
678 krb5_get_init_creds_opt *opt = NULL;
679 krb5_get_init_creds_opt_free(ctx, opt);
681 'KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT',
682 headers='krb5.h', link=False,
683 msg="Checking whether krb5_get_init_creds_opt_free takes a context argument")
684 conf.CHECK_CODE('krb5_mk_error(0,0,0)',
685 'HAVE_SHORT_KRB5_MK_ERROR_INTERFACE',
686 headers='krb5.h', link=False,
687 msg="Checking whether krb5_mk_error takes 3 arguments MIT or 9 Heimdal")
689 const krb5_data *pkdata;
690 krb5_context context;
691 krb5_principal principal;
692 pkdata = krb5_princ_component(context, principal, 0);
694 'HAVE_KRB5_PRINC_COMPONENT',
695 headers='krb5.h', lib='krb5',
696 msg="Checking whether krb5_princ_component is available")
701 krb5_enctype_to_string(1, buf, 256);
704 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_SIZE_T_ARG',
705 headers='krb5.h', lib='krb5 k5crypto',
706 addmain=False, cflags='-Werror',
707 msg="Checking whether krb5_enctype_to_string takes size_t argument")
711 krb5_context context = NULL;
713 krb5_enctype_to_string(context, 1, &str);
717 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_KRB5_CONTEXT_ARG',
718 headers='krb5.h stdlib.h', lib='krb5',
719 addmain=False, cflags='-Werror',
720 msg="Checking whether krb5_enctype_to_string takes krb5_context argument")
723 krb5_context ctx = NULL;
724 krb5_principal princ = NULL;
725 const char *str = krb5_princ_realm(ctx, princ)->data;
728 'HAVE_KRB5_PRINC_REALM',
729 headers='krb5.h', lib='krb5',
731 msg="Checking whether the macro krb5_princ_realm is defined")
734 krb5_context context;
735 krb5_principal principal;
736 const char *realm; realm = krb5_principal_get_realm(context, principal);
739 'HAVE_KRB5_PRINCIPAL_GET_REALM',
740 headers='krb5.h', lib='krb5',
742 msg="Checking whether krb5_principal_get_realm is defined")
743 if conf.CHECK_CODE('''krb5_verify_checksum(0, 0, 0, 0, 0, 0, 0);''',
744 'KRB5_VERIFY_CHECKSUM_ARGS',
745 headers='krb5.h', lib='krb5',
746 msg="Checking whether krb5_verify_checksum takes 7 arguments"):
747 conf.DEFINE('KRB5_VERIFY_CHECKSUM_ARGS', '7')
749 conf.DEFINE('KRB5_VERIFY_CHECKSUM_ARGS', '6')
752 krb5_enctype enctype;
753 enctype = ENCTYPE_ARCFOUR_HMAC_MD5;
755 '_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5',
756 headers='krb5.h', lib='krb5',
757 msg="Checking whether the ENCTYPE_ARCFOUR_HMAC_MD5 key type definition is available");
759 krb5_keytype keytype;
760 keytype = KEYTYPE_ARCFOUR_56;
762 '_HAVE_KEYTYPE_ARCFOUR_56',
763 headers='krb5.h', lib='krb5',
764 msg="Checking whether the HAVE_KEYTYPE_ARCFOUR_56 key type definition is available");
765 if conf.CONFIG_SET('_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and conf.CONFIG_SET('_HAVE_KEYTYPE_ARCFOUR_56'):
766 conf.DEFINE('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5', '1')
769 krb5_enctype enctype;
770 enctype = ENCTYPE_ARCFOUR_HMAC;
772 'HAVE_ENCTYPE_ARCFOUR_HMAC',
773 headers='krb5.h', lib='krb5',
774 msg="Checking whether the ENCTYPE_ARCFOUR_HMAC key type definition is available");
777 krb5_context context;
779 krb5_init_context(&context);
780 return krb5_kt_resolve(context, "WRFILE:api", &keytab);
782 'HAVE_WRFILE_KEYTAB',
783 headers='krb5.h', lib='krb5', execute=True,
784 msg="Checking whether the WRFILE:-keytab is supported");
786 # Check for KRB5_DEPRECATED handling
787 conf.CHECK_CODE('''#define KRB5_DEPRECATED 1
788 #include <krb5.h>''',
789 'HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER', addmain=False,
791 msg="Checking for KRB5_DEPRECATED define taking an identifier")
792 elif conf.env.toplevel_build:
793 # setup the right defines for a in-tree heimdal build
794 Logs.info("Using in-tree heimdal kerberos defines")
795 conf.define('HAVE_GSSAPI', 1)
796 conf.define('HAVE_GSSAPI_GSSAPI_H', 1)
797 conf.define('HAVE_AP_OPTS_USE_SUBKEY', 1)
798 conf.define('HAVE_KRB5_ADDRESSES', 1)
799 conf.define('HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK', 1)
800 conf.define('HAVE_KRB5_SET_REAL_TIME', 1)
801 conf.define('HAVE_COM_ERR_H', 1)
802 conf.define('HAVE_ADDR_TYPE_IN_KRB5_ADDRESS', 1)
803 conf.define('HAVE_GSS_DISPLAY_STATUS', 1)
804 conf.define('HAVE_LIBGSSAPI', 1)
805 conf.define('HAVE_ADDR_TYPE_IN_KRB5_ADDRESS', 1)
806 conf.define('HAVE_CHECKSUM_IN_KRB5_CHECKSUM', 1)
807 conf.define('HAVE_DECL_KRB5_AUTH_CON_SET_REQ_CKSUMTYPE', 0)
808 conf.define('HAVE_DECL_KRB5_GET_CREDENTIALS_FOR_USER', 0)
809 conf.define('HAVE_E_DATA_POINTER_IN_KRB5_ERROR', 1)
810 conf.define('HAVE_INITIALIZE_KRB5_ERROR_TABLE', 1)
811 conf.define('HAVE_KRB5_ADDRESSES', 1)
812 conf.define('HAVE_KRB5_AUTH_CON_SETKEY', 1)
813 conf.define('HAVE_KRB5_CRYPTO', 1)
814 conf.define('HAVE_KRB5_CRYPTO_DESTROY', 1)
815 conf.define('HAVE_KRB5_CRYPTO_INIT', 1)
816 conf.define('HAVE_KRB5_C_ENCTYPE_COMPARE', 1)
817 conf.define('HAVE_KRB5_C_VERIFY_CHECKSUM', 1)
818 conf.define('HAVE_FREE_AP_REQ', 1)
819 conf.define('HAVE_KRB5_DECODE_AP_REQ', 1)
820 conf.define('HAVE_KRB5_ENCTYPES_COMPATIBLE_KEYS', 1)
821 conf.define('HAVE_KRB5_ENCTYPE_TO_STRING', 1)
822 conf.define('HAVE_KRB5_ENCTYPE_TO_STRING_WITH_KRB5_CONTEXT_ARG', 1)
823 conf.define('HAVE_KRB5_FREE_ERROR_CONTENTS', 1)
824 conf.define('HAVE_KRB5_FREE_HOST_REALM', 1)
825 conf.define('HAVE_KRB5_FWD_TGT_CREDS', 1)
826 conf.define('HAVE_KRB5_GET_CREDS', 1)
827 conf.define('HAVE_KRB5_GET_CREDS_OPT_ALLOC', 1)
828 conf.define('HAVE_KRB5_GET_CREDS_OPT_SET_IMPERSONATE', 1)
829 conf.define('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES', 1)
830 conf.define('HAVE_KRB5_GET_HOST_REALM', 1)
831 conf.define('HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC', 1)
832 conf.define('HAVE_KRB5_GET_INIT_CREDS_OPT_FREE', 1)
833 conf.define('HAVE_KRB5_GET_INIT_CREDS_OPT_GET_ERROR', 1)
834 conf.define('HAVE_KRB5_GET_INIT_CREDS_OPT_SET_PAC_REQUEST', 1)
835 conf.define('HAVE_KRB5_GET_KDC_CRED', 1)
836 conf.define('HAVE_KRB5_GET_PW_SALT', 1)
837 conf.define('HAVE_KRB5_GET_RENEWED_CREDS', 1)
838 conf.define('HAVE_KRB5_KEYBLOCK_KEYVALUE', 1)
839 conf.define('HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK', 1)
840 conf.define('HAVE_KRB5_KRBHST_GET_ADDRINFO', 1)
841 conf.define('HAVE_KRB5_KRBHST_INIT', 1)
842 conf.define('HAVE_KRB5_KT_COMPARE', 1)
843 conf.define('HAVE_KRB5_KT_FREE_ENTRY', 1)
844 conf.define('HAVE_KRB5_KU_OTHER_CKSUM', 1)
845 conf.define('HAVE_KRB5_LOCATE_PLUGIN_H', 1)
846 conf.define('HAVE_KRB5_MK_REQ_EXTENDED', 1)
847 conf.define('HAVE_KRB5_PRINCIPAL_COMPARE_ANY_REALM', 1)
848 conf.define('HAVE_KRB5_PRINCIPAL_GET_COMP_STRING', 1)
849 conf.define('HAVE_KRB5_PRINCIPAL_GET_REALM', 1)
850 conf.define('HAVE_KRB5_REALM_TYPE', 1)
851 conf.define('HAVE_KRB5_SESSION_IN_CREDS', 1)
852 conf.define('HAVE_KRB5_SET_DEFAULT_IN_TKT_ETYPES', 1)
853 conf.define('HAVE_KRB5_SET_REAL_TIME', 1)
854 conf.define('HAVE_KRB5_STRING_TO_KEY', 1)
855 conf.define('HAVE_KRB5_STRING_TO_KEY_SALT', 1)
856 conf.define('HAVE_KRB5_VERIFY_CHECKSUM', 1)
857 conf.define('HAVE_LIBKRB5', 1)
858 conf.define('KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT', 1)
859 conf.define('KRB5_VERIFY_CHECKSUM_ARGS', 6)
860 conf.define('HAVE_ETYPE_IN_ENCRYPTEDDATA', 1)
861 conf.define('KRB5_PRINC_REALM_RETURNS_REALM', 1)
862 conf.define('HAVE_KRB5_PRINCIPAL_GET_REALM', 1)
863 conf.define('HAVE_KRB5_H', 1)
864 conf.define('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5', 1)
865 conf.define('HAVE_AP_OPTS_USE_SUBKEY', 1)
866 conf.define('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5', 1)
867 conf.define('HAVE_ENCTYPE_ARCFOUR_HMAC', 1)
869 conf.SET_TARGET_TYPE('krb5', 'EMPTY')
870 conf.SET_TARGET_TYPE('gssapi', 'EMPTY')
871 conf.SET_TARGET_TYPE('gssapi_krb5', 'EMPTY')
872 conf.SET_TARGET_TYPE('com_err', 'EMPTY')
873 conf.SET_TARGET_TYPE('k5crypto', 'EMPTY')
875 if Options.options.with_ads:
877 if not conf.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and \
878 not conf.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC'):
879 Logs.warn("arcfour-hmac-md5 encryption type not found in -lkrb5")
881 if not conf.CONFIG_SET('HAVE_KRB5_MK_REQ_EXTENDED'):
882 Logs.warn("krb5_mk_req_extended not found in -lkrb5")
884 if not conf.CONFIG_SET('HAVE_KRB5_PRINCIPAL2SALT') and \
885 not conf.CONFIG_SET('HAVE_KRB5_GET_PW_SALT'):
886 Logs.warn("no CREATE_KEY_FUNCTIONS detected")
888 if not conf.CONFIG_SET('HAVE_KRB5_GET_PERMITTED_ENCTYPES') and \
889 not conf.CONFIG_SET('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES'):
890 Logs.warn("no GET_ENCTYPES_FUNCTIONS detected")
892 if not conf.CONFIG_SET('HAVE_KRB5_KT_FREE_ENTRY') and \
893 not conf.CONFIG_SET('HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS'):
894 Logs.warn("no KT_FREE_FUNCTION detected")
896 if not conf.CONFIG_SET('HAVE_KRB5_C_VERIFY_CHECKSUM') and \
897 not conf.CONFIG_SET('HAVE_KRB5_VERIFY_CHECKSUM'):
898 Logs.warn("no KRB5_VERIFY_CHECKSUM_FUNCTION detected")
900 if not conf.CONFIG_SET('KRB5_TICKET_HAS_KEYINFO'):
901 # We only need the following functions if we can't get the enctype
902 # and kvno out of the ticket directly (ie. on Heimdal).
903 if not conf.CONFIG_SET('HAVE_FREE_AP_REQ'):
904 Logs.warn("no KRB5_AP_REQ_FREE_FUNCTION detected")
906 if not conf.CONFIG_SET('HAVE_KRB5_DECODE_AP_REQ'):
907 Logs.warn("no KRB5_AP_REQ_DECODING_FUNCTION detected")
910 conf.DEFINE('WITH_ADS', '1')
911 conf.DEFINE('HAVE_KRB5', '1')
913 conf.DEFINE('HAVE_GSSAPI', '1')
915 Logs.warn("krb5 libs don't have all features required for Active Directory support")
916 conf.undefine('HAVE_KRB5_H')
917 conf.undefine('HAVE_GSSAPI_H')
918 conf.undefine('HAVE_GSSAPI_GSSAPI_GENERIC_H')
919 conf.undefine('HAVE_GSSAPI_GSSAPI_H')
921 if Options.options.with_utmp:
922 conf.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
923 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers='utmp.h',
924 define='HAVE_UT_UT_NAME')
925 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers='utmp.h',
926 define='HAVE_UT_UT_USER')
927 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers='utmp.h',
928 define='HAVE_UT_UT_ID')
929 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers='utmp.h',
930 define='HAVE_UT_UT_HOST')
931 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers='utmp.h',
932 define='HAVE_UT_UT_TIME')
933 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers='utmp.h',
934 define='HAVE_UT_UT_TV')
935 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers='utmp.h',
936 define='HAVE_UT_UT_TYPE')
937 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers='utmp.h',
938 define='HAVE_UT_UT_PID')
939 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers='utmp.h',
940 define='HAVE_UT_UT_EXIT')
941 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr_v6', headers='utmp.h',
942 define='HAVE_UT_UT_ADDR_V6')
943 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr', headers='utmp.h',
944 define='HAVE_UT_UT_ADDR')
945 conf.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers='utmpx.h',
946 define='HAVE_UX_UT_SYSLEN')
947 conf.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
948 'PUTUTLINE_RETURNS_UTMP', headers='utmp.h',
949 msg="Checking whether pututline returns pointer")
950 conf.DEFINE('WITH_UTMP', 1)
952 if Options.options.with_avahi:
953 conf.env.with_avahi = True
954 if not conf.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf.env.with_avahi = False
955 if not conf.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf.env.with_avahi = False
956 if not conf.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf.env.with_avahi = False
957 if conf.env.with_avahi:
958 conf.DEFINE('WITH_AVAHI_SUPPORT', 1)
960 conf.SET_TARGET_TYPE('avahi-common', 'EMPTY')
961 conf.SET_TARGET_TYPE('avahi-client', 'EMPTY')
963 if Options.options.with_iconv:
964 conf.env.with_iconv = True
965 if not conf.CHECK_FUNCS_IN('iconv_open', 'iconv', headers='iconv.h'):
966 conf.env.with_iconv = False
967 if conf.env.with_iconv:
968 conf.DEFINE('HAVE_ICONV', 1)
970 if Options.options.with_pam:
972 conf.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
973 if not conf.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
974 Logs.warn("--with-pam=yes but pam_appl.h not found")
976 conf.CHECK_FUNCS_IN('pam_get_data', 'pam')
977 conf.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h')
978 if not conf.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'):
979 Logs.warn("--with-pam=yes but pam_modules.h not found")
981 conf.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h')
982 conf.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h')
983 conf.CHECK_FUNCS_IN('pam_vsyslog', 'pam')
985 #if defined(HAVE_SECURITY_PAM_APPL_H)
986 #include <security/pam_appl.h>
987 #elif defined(HAVE_PAM_PAM_APPL_H)
988 #include <pam/pam_appl.h>
990 pam_set_item(0, PAM_RHOST, 0);
994 msg="Checking whether PAM_RHOST is available");
996 #if defined(HAVE_SECURITY_PAM_APPL_H)
997 #include <security/pam_appl.h>
998 #elif defined(HAVE_PAM_PAM_APPL_H)
999 #include <pam/pam_appl.h>
1001 pam_set_item(0, PAM_TTY, 0);
1005 msg="Checking whether PAM_TTY is available");
1007 #if (!defined(LINUX))
1009 #define PAM_EXTERN extern
1010 #if defined(HAVE_SECURITY_PAM_APPL_H)
1011 #include <security/pam_appl.h>
1012 #elif defined(HAVE_PAM_PAM_APPL_H)
1013 #include <pam/pam_appl.h>
1018 #if defined(HAVE_SECURITY_PAM_MODULES_H)
1019 #include <security/pam_modules.h>
1020 #elif defined(HAVE_PAM_PAM_MODULES_H)
1021 #include <pam/pam_modules.h>
1024 #if defined(HAVE_SECURITY__PAM_MACROS_H)
1025 #include <security/_pam_macros.h>
1026 #elif defined(HAVE_PAM__PAM_MACROS_H)
1027 #include <pam/_pam_macros.h>
1030 #ifdef HAVE_SECURITY_PAM_EXT_H
1031 #include <security/pam_ext.h>
1034 int i; i = PAM_RADIO_TYPE;
1036 'HAVE_PAM_RADIO_TYPE',
1038 msg="Checking whether PAM_RADIO_TYPE is available");
1040 conf.DEFINE('WITH_PAM', 1)
1041 conf.DEFINE('WITH_PAM_MODULES', 1)
1045 seteuid = conf.CHECK_CODE('''
1046 #define AUTOCONF_TEST 1
1047 #define USE_SETREUID 1
1048 #include "./lib/util_sec.c"
1053 msg="Checking whether setreuid is available")
1055 seteuid = conf.CHECK_CODE('''
1056 #define AUTOCONF_TEST 1
1057 #define USE_SETRESUID 1
1058 #include "./lib/util_sec.c"
1063 msg="Checking whether setresuid is available")
1065 seteuid = conf.CHECK_CODE('''
1066 #define AUTOCONF_TEST 1
1067 #define USE_SETEUID 1
1068 #include "./lib/util_sec.c"
1073 msg="Checking whether seteuid is available")
1075 seteuid = conf.CHECK_CODE('''
1076 #define AUTOCONF_TEST 1
1077 #define USE_SETUIDX 1
1078 #include "./lib/util_sec.c"
1084 msg="Checking whether setuidx is available")
1085 if Options.options.with_dnsupdate:
1086 conf.CHECK_HEADERS('uuid/uuid.h')
1087 conf.CHECK_FUNCS_IN('uuid_generate', 'uuid')
1088 if not conf.CONFIG_SET('HAVE_UUID_UUID_H') and not conf.CONFIG_SET('HAVE_UUID_GENERATE'):
1089 Logs.warn("--with-dnsupdate=yes but uuid support not sufficient")
1090 elif not conf.CONFIG_SET('HAVE_GSSAPI'):
1091 Logs.warn("--with-dnsupdate=yes but gssapi support not sufficient")
1093 conf.DEFINE('WITH_DNS_UPDATES', 1)
1095 conf.SET_TARGET_TYPE('uuid', 'EMPTY')
1096 conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
1097 if Options.options.developer:
1098 if conf.CONFIG_SET('HAVE_VALGRIND_H') or conf.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'):
1099 conf.DEFINE('VALGRIND', '1')
1101 if conf.CHECK_CODE('''
1102 #include <bits/sockaddr.h>
1103 #include <linux/netlink.h>
1105 'HAVE_LINUX_NETLINK_H',
1106 msg="Checking whether Linux netlink is available"):
1108 #include <bits/sockaddr.h>
1109 #include <linux/netlink.h>
1110 #include <linux/rtnetlink.h>
1112 'HAVE_LINUX_RTNETLINK_H',
1113 msg='Checking whether Linux rtnetlink is available')
1114 if conf.CHECK_TYPE('struct dirent64', headers='sys/types.h dirent.h') and conf.CONFIG_SET('HAVE_READDIR64'):
1115 conf.DEFINE('HAVE_STRUCT_DIRENT64', '1')
1117 conf.undefine('HAVE_STRUCT_DIRENT64')
1120 #include "../tests/fcntl_lock.c"
1125 msg='Checking whether fcntl locking is available')
1128 #include "../tests/fcntl_lock64.c"
1130 'HAVE_BROKEN_FCNTL64_LOCKS',
1133 msg='Checking whether fcntl64 locks are broken')
1135 if not conf.CONFIG_SET('HAVE_BROKEN_FCNTL64_LOCKS'):
1137 #if defined(HAVE_UNISTD_H)
1147 #ifdef HAVE_SYS_FCNTL_H
1148 #include <sys/fcntl.h>
1150 main() { struct flock64 fl64;
1151 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
1158 'HAVE_STRUCT_FLOCK64',
1161 msg="Checking whether the flock64 struct is available")
1163 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec',
1164 define='HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') # Linux, Solaris
1165 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimensec',
1166 define='HAVE_STRUCT_STAT_ST_MTIMENSEC') # BSD, if defined _POSIX_SOURCE
1167 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimespec.tv_nsec',
1168 define='HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') # BSD, if not defined _POSIX_SOURCE
1169 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtime_n',
1170 define='HAVE_STRUCT_STAT_ST_MTIME_N') # AIX
1171 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_umtime',
1172 define='HAVE_STRUCT_STAT_ST_UMTIME') # Tru64
1173 if conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') or \
1174 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMENSEC') or \
1175 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') or \
1176 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIME_N') or \
1177 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_UMTIME'):
1178 conf.DEFINE('HAVE_STAT_HIRES_TIMESTAMPS', '1')
1180 # recent FreeBSD, NetBSD have creation timestamps called birthtime:
1181 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtime',
1182 define='HAVE_STRUCT_STAT_ST_BIRTHTIME')
1183 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimespec.tv_nsec',
1184 define='HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC')
1185 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimensec',
1186 define='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC')
1189 #if defined(HAVE_UNISTD_H)
1192 #include <fcntl.h>],
1193 ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
1195 'HAVE_POSIX_FADVISE',
1196 msg='Checking whether posix_fadvise is available')
1198 for v in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]:
1201 return sysconf(%s) == -1 ? 1 : 0;
1204 msg='Checking whether sysconf(%s) is available' % v)
1206 conf.CHECK_DECLS('__NR_inotify_init', reverse=True, headers='asm/unistd.h')
1209 #include <sys/syscall.h>
1211 syscall(SYS_initgroups, 16, NULL, NULL, 0);
1213 'HAVE_DARWIN_INITGROUPS',
1214 msg='Checking hether to use the Darwin-specific initgroups system call')
1216 conf.CHECK_CODE('''struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''',
1218 headers='sys/types.h utime.h',
1219 msg='Checking whether struct utimbuf is available')
1221 if conf.CHECK_CODE('''struct sigevent s;''',
1222 'HAVE_STRUCT_SIGEVENT',
1223 headers='sys/types.h stdlib.h stddef.h signal.h',
1224 msg='Checking whether we have the struct sigevent'):
1225 conf.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sival_ptr',
1226 define='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR',
1227 headers='signal.h');
1228 conf.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sigval_ptr',
1229 define='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR',
1230 headers='signal.h');
1232 if os.path.exists('/proc/sys/kernel/core_pattern'):
1233 conf.DEFINE('HAVE_SYS_KERNEL_PROC_CORE_PATTERN', '1')
1235 if conf.CHECK_CODE('''
1239 if (sizeof(time_t) == 8) {
1240 time_t max_time = 0x7fffffffffffffffll;
1241 tm = gmtime(&max_time);
1242 /* This should fail with 32-bit tm_year. */
1244 /* Max time_t that works with 32-bit int tm_year in struct tm. */
1245 max_time = 67768036191676799ll;
1246 tm = gmtime(&max_time);
1257 msg="Checking for the maximum value of the 'time_t' type"):
1258 conf.DEFINE('TIME_T_MAX', '67768036191676799ll')
1261 #if defined(HAVE_UNISTD_H)
1264 #include <sys/types.h>
1265 main() { dev_t dev = makedev(1,2); return 0; }
1269 msg='Checking whether the macro for makedev is available')
1276 void exit_on_core(int ignored) {
1282 signal(SIGSEGV, exit_on_core);
1283 newpath = realpath("/tmp", NULL);
1284 exit((newpath != NULL) ? 0 : 1);
1287 'REALPATH_TAKES_NULL',
1290 msg='Checking whether the realpath function allows a NULL argument')
1292 conf.CHECK_CODE('''#include "../tests/ftruncate.c"''',
1293 'HAVE_FTRUNCATE_EXTEND',
1294 msg='Checking for ftruncate extend',
1298 if os.environ.get('RUN_FROM_BUILD_FARM') is not None:
1299 conf.define('ENABLE_BUILD_FARM_HACKS', '1')
1301 if Options.options.with_sendfile_support:
1302 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):
1307 ssize_t nwritten = sendfile64(tofd, fromfd, &offset, total);
1310 headers='sys/sendfile',
1311 msg='Checking for linux sendfile64 support')
1316 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1319 headers='sys/sendfile',
1320 msg='Checking for linux sendfile support')
1322 # Try and cope with broken Linux sendfile....
1323 conf.CHECK_CODE('''#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
1324 #undef _FILE_OFFSET_BITS
1326 #include <sys/sendfile.h>
1330 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1332 '_HAVE_BROKEN_LINUX_SENDFILE',
1333 msg='Checking for broken linux sendfile support')
1334 if conf.CONFIG_SET('_HAVE_SENDFILE64'):
1335 conf.DEFINE('HAVE_SENDFILE64', '1')
1336 conf.DEFINE('LINUX_SENDFILE_API', '1')
1337 conf.DEFINE('WITH_SENDFILE', '1')
1338 elif conf.CONFIG_SET('_HAVE_SENDFILE'):
1339 conf.DEFINE('HAVE_SENDFILE', '1')
1340 conf.DEFINE('LINUX_SENDFILE_API', '1')
1341 conf.DEFINE('WITH_SENDFILE', '1')
1342 elif conf.CONFIG_SET('_HAVE_BROKEN_LINUX_SENDFILE'):
1343 conf.DEFINE('LINUX_BROKEN_SENDFILE_API', '1')
1344 conf.DEFINE('WITH_SENDFILE', '1')
1345 elif (host_os.rfind('freebsd') > -1) or (host_os.rfind('dragonfly') > -1):
1347 #include <sys/types.h>
1349 #include <sys/socket.h>
1350 #include <sys/uio.h>
1351 int fromfd, tofd, ret, total=0;
1352 off_t offset, nwritten;
1355 hdr.headers = &hdtrl;
1357 hdr.trailers = NULL;
1359 hdtrl.iov_base = NULL;
1361 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0)
1364 msg='Checking for freebsd sendfile support')
1365 if conf.CONFIG_SET('_HAVE_SENDFILE'):
1366 conf.DEFINE('HAVE_SENDFILE', '1')
1367 conf.DEFINE('FREEBSD_SENDFILE_API', '1')
1368 conf.DEFINE('WITH_SENDFILE', '1')
1369 elif (host_os.rfind('hpux') > -1):
1371 #include <sys/socket.h>
1372 #include <sys/uio.h>
1375 struct iovec hdtrl[2];
1378 hdtrl[0].iov_base = 0;
1379 hdtrl[0].iov_len = 0;
1380 nwritten = sendfile64(tofd, fromfd, offset, total, &hdtrl[0], 0);
1383 msg='Checking for hpux sendfile64 support')
1385 #include <sys/socket.h>
1386 #include <sys/uio.h>
1389 struct iovec hdtrl[2];
1392 hdtrl[0].iov_base = 0;
1393 hdtrl[0].iov_len = 0;
1394 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
1397 msg='Checking for hpux sendfile support')
1398 if conf.CONFIG_SET('_HAVE_SENDFILE64'):
1399 conf.DEFINE('HAVE_SENDFILE64', '1')
1400 conf.DEFINE('HPUX_SENDFILE_API', '1')
1401 conf.DEFINE('WITH_SENDFILE', '1')
1402 elif conf.CONFIG_SET('_HAVE_SENDFILE'):
1403 conf.DEFINE('HAVE_SENDFILE', '1')
1404 conf.DEFINE('HPUX_SENDFILE_API', '1')
1405 conf.DEFINE('WITH_SENDFILE', '1')
1406 elif (host_os.rfind('solaris') > -1):
1407 conf.CHECK_FUNCS_IN('sendfile', 'sendfilev')
1409 #include <sys/sendfile.h>
1412 struct sendfilevec vec[2];
1416 vec[0].sfv_fd = SFV_FD_SELF;
1417 vec[0].sfv_flag = 0;
1421 vec[1].sfv_flag = 0;
1424 nwritten = sendfilev64(tofd, vec, sfvcnt, &xferred);
1426 '_HAVE_SENDFILEV64',
1427 msg='Checking for solaris sendfilev64 support')
1429 #include <sys/sendfile.h>,
1432 struct sendfilevec vec[2];
1436 vec[0].sfv_fd = SFV_FD_SELF;
1437 vec[0].sfv_flag = 0;
1441 vec[1].sfv_flag = 0;
1444 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
1447 msg='Checking for solaris sendfilev support')
1448 if conf.CONFIG_SET('_HAVE_SENDFILEV64'):
1449 conf.DEFINE('HAVE_SENDFILEV64', '1')
1450 conf.DEFINE('SOLARIS_SENDFILE_API', '1')
1451 conf.DEFINE('WITH_SENDFILE', '1')
1452 elif conf.CONFIG_SET('_HAVE_SENDFILEV'):
1453 conf.DEFINE('HAVE_SENDFILEV', '1')
1454 conf.DEFINE('SOLARIS_SENDFILE_API', '1')
1455 conf.DEFINE('WITH_SENDFILE', '1')
1457 default_static_modules=TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
1458 auth_sam auth_unix auth_winbind auth_wbc auth_server
1459 auth_domain auth_builtin vfs_default
1460 nss_info_template idmap_tdb idmap_passdb
1463 default_shared_modules=TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
1464 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
1465 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850
1466 charset_CP437 auth_script vfs_readahead vfs_xattr_tdb
1467 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
1468 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
1469 vfs_crossrename vfs_linux_xfs_sgid
1470 vfs_time_audit idmap_autorid''')
1472 if Options.options.developer:
1473 default_static_modules.extend(TO_LIST('pdb_ads auth_netlogond'))
1474 default_shared_modules.extend(TO_LIST('charset_weird perfcount_test'))
1476 if Options.options.with_acl_support and conf.CONFIG_SET('HAVE_POSIX_ACLS'):
1477 default_static_modules.extend(TO_LIST('vfs_posixacl'))
1479 if conf.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'):
1480 default_shared_modules.extend(TO_LIST('vfs_zfsacl'))
1482 if conf.CONFIG_SET('HAVE_DIRFD_DECL'):
1483 default_shared_modules.extend(TO_LIST('vfs_syncops vfs_dirsort'))
1485 if conf.CONFIG_SET('HAVE_STATFS_F_FSID'):
1486 default_shared_modules.extend(TO_LIST('vfs_fileid'))
1488 if conf.CONFIG_SET('HAVE_AIO') and (conf.CONFIG_SET('HAVE_MSGHDR_MSG_CONTROL') or conf.CONFIG_SET('HAVE_MSGHDR_MSG_ACCTRIGHTS')):
1489 default_shared_modules.extend(TO_LIST('vfs_aio_fork'))
1491 if conf.CONFIG_SET('HAVE_LDAP'):
1492 default_static_modules.extend(TO_LIST('pdb_ldap idmap_ldap'))
1494 if conf.CONFIG_SET('DARWINOS'):
1495 default_shared_modules.extend(TO_LIST('charset_macosxfs'))
1497 explicit_shared_modules = TO_LIST(Options.options.shared_modules, delimiter=',')
1498 explicit_static_modules = TO_LIST(Options.options.static_modules, delimiter=',')
1500 final_static_modules = default_static_modules
1501 final_shared_modules = default_shared_modules
1503 for m in explicit_static_modules:
1504 if m in final_shared_modules:
1505 final_shared_modules.remove(m)
1506 final_static_modules.append(m)
1507 for m in explicit_shared_modules:
1508 if m in final_static_modules:
1509 final_static_modules.remove(m)
1510 final_shared_modules.append(m)
1512 conf.env['static_modules'] = final_static_modules
1513 conf.env['shared_modules'] = final_shared_modules
1515 conf.DEFINE('STRING_STATIC_MODULES', ' '.join(final_static_modules), quote=True)
1520 prefixes = ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
1521 conf.env['MODULE_PREFIXES'] = prefixes
1523 for m in final_static_modules:
1525 if not p in static_list:
1527 static_list[p].append(m)
1528 for m in final_shared_modules:
1530 if not p in shared_list:
1532 shared_list[p].append(m)
1535 static_env = "%s_STATIC" % p.upper()
1536 shared_env = "%s_SHARED" % p.upper()
1537 conf.env[static_env] = []
1538 conf.env[shared_env] = []
1539 if p in static_list:
1541 for entry in static_list[p]:
1542 decl_list += "extern NTSTATUS %s_init(void); " % entry
1543 conf.env[static_env].append('%s' % entry)
1544 decl_list = decl_list.rstrip()
1545 conf.DEFINE('static_decl_%s' % p, decl_list)
1546 conf.DEFINE('static_init_%s' % p, '{ %s_init(); }' % '_init(); '.join(static_list[p]))
1548 conf.DEFINE('static_decl_%s' % p, '')
1549 conf.DEFINE('static_init_%s' % p, '{}')
1550 if p in shared_list:
1551 for entry in shared_list[p]:
1552 conf.DEFINE('%s_init' % entry, 'init_samba_module')
1553 conf.env[shared_env].append('%s' % entry)
1555 conf.SAMBA_CONFIG_H('include/config.h')
1558 "build 'tags' file using ctags"
1560 source_root = os.path.dirname(Utils.g_module.root_path)
1561 cmd = 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
1562 print("Running: %s" % cmd)