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)
25 opt.SAMBA3_ADD_OPTION('winbind')
26 opt.SAMBA3_ADD_OPTION('ads')
27 opt.SAMBA3_ADD_OPTION('ldap')
28 opt.SAMBA3_ADD_OPTION('cups', with_name="enable", without_name="disable")
29 opt.SAMBA3_ADD_OPTION('iprint', with_name="enable", without_name="disable")
30 opt.SAMBA3_ADD_OPTION('pam')
31 opt.SAMBA3_ADD_OPTION('pam_smbpass')
32 opt.SAMBA3_ADD_OPTION('quotas')
33 opt.SAMBA3_ADD_OPTION('sendfile-support')
34 opt.SAMBA3_ADD_OPTION('utmp')
35 opt.SAMBA3_ADD_OPTION('pthreadpool', with_name="enable", without_name="disable", default=True)
36 opt.SAMBA3_ADD_OPTION('avahi', with_name="enable", without_name="disable")
37 opt.SAMBA3_ADD_OPTION('iconv')
38 opt.SAMBA3_ADD_OPTION('acl-support')
39 opt.SAMBA3_ADD_OPTION('dnsupdate')
40 opt.SAMBA3_ADD_OPTION('syslog')
41 opt.SAMBA3_ADD_OPTION('automount')
42 opt.SAMBA3_ADD_OPTION('aio-support')
43 opt.SAMBA3_ADD_OPTION('dmapi', default=None) # None means autodetection
44 opt.SAMBA3_ADD_OPTION('fam', default=None) # None means autodetection
45 opt.SAMBA3_ADD_OPTION('profiling-data', default=False)
46 opt.SAMBA3_ADD_OPTION('libarchive', default=None)
48 opt.SAMBA3_ADD_OPTION('cluster-support', default=None)
50 opt.SAMBA3_ADD_OPTION('regedit', default=None)
52 opt.SAMBA3_ADD_OPTION('fake-kaserver',
53 help=("Include AFS fake-kaserver support"), default=False)
55 opt.add_option('--with-ctdb-dir',
56 help=("Directory under which ctdb is installed"),
57 action="store", dest='ctdb_dir', default=None)
59 opt.add_option('--with-libcephfs',
60 help=("Directory under which libcephfs is installed"),
61 action="store", dest='libcephfs_dir', default=None)
63 opt.SAMBA3_ADD_OPTION('glusterfs', with_name="enable", without_name="disable", default=True)
65 opt.add_option('--enable-vxfs',
66 help=("enable support for VxFS (default=no)"),
67 action="store_true", dest='enable_vxfs', default=False)
71 from samba_utils import TO_LIST
73 default_static_modules = []
74 default_shared_modules = []
76 if Options.options.developer:
77 conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
78 conf.env.developer = True
80 if sys.platform != 'openbsd5':
81 conf.ADD_LDFLAGS("-Wl,--export-dynamic", testflags=True)
83 conf.CHECK_HEADERS('execinfo.h libexc.h libunwind.h netdb.h')
84 conf.CHECK_HEADERS('linux/falloc.h')
86 conf.CHECK_FUNCS('getcwd fchown chmod fchmod mknod')
87 conf.CHECK_FUNCS('strtol strchr strupr chflags')
88 conf.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
89 conf.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
90 conf.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr')
91 conf.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
92 conf.CHECK_FUNCS('setpriv setgidx setuidx setgroups syscall sysconf')
93 conf.CHECK_FUNCS('atexit grantpt posix_openpt fallocate posix_fallocate')
94 conf.CHECK_FUNCS('fseeko setluid')
95 conf.CHECK_FUNCS('getpwnam', headers='sys/types.h pwd.h')
96 conf.CHECK_FUNCS('fdopendir')
97 conf.CHECK_FUNCS('fstatat')
98 conf.CHECK_FUNCS('getpwent_r setenv strcasecmp fcvt fcvtl')
99 conf.CHECK_FUNCS('syslog vsyslog timegm setlocale')
100 conf.CHECK_FUNCS_IN('nanosleep', 'rt')
101 conf.CHECK_FUNCS('lutimes futimes utimensat futimens')
102 conf.CHECK_FUNCS('mlock munlock mlockall munlockall')
103 conf.CHECK_FUNCS('memalign posix_memalign hstrerror')
104 conf.CHECK_FUNCS('shmget')
105 conf.CHECK_FUNCS_IN('shm_open', 'rt', checklibc=True)
106 #FIXME: for some reason this one still fails
107 conf.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
108 conf.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
109 conf.CHECK_FUNCS_IN('dn_expand', 'inet')
110 conf.CHECK_DECLS('fdatasync', reverse=True)
111 conf.CHECK_DECLS('readahead', reverse=True, headers='fcntl.h')
113 if conf.CHECK_CODE('''
114 #if defined(HAVE_UNISTD_H)
117 long ret = splice(0,0,1,0,400,SPLICE_F_MOVE);
121 conf.CHECK_DECLS('splice', reverse=True, headers='fcntl.h')
123 # Check for inotify support
124 conf.CHECK_HEADERS('sys/inotify.h')
125 if "HAVE_SYS_INOTIFY_H" in conf.env:
126 conf.DEFINE('HAVE_INOTIFY', 1)
128 # Check for kernel change notify support
131 #define F_NOTIFY 1026
134 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
135 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain=False, execute=True,
136 headers='fcntl.h signal.h',
137 msg="Checking for kernel change notify support")
139 # Check for Linux kernel oplocks
141 #include <sys/types.h>
145 #define F_NOTIFY 1026
148 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
149 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain=False, execute=True,
150 msg="Checking for Linux kernel oplocks")
152 # Check for IRIX kernel oplock types
153 conf.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
154 'HAVE_KERNEL_OPLOCKS_IRIX', headers='fcntl.h',
155 msg="Checking for IRIX kernel oplock types")
157 # Check for kernel share modes
159 #include <sys/types.h>
162 #include <sys/file.h>
168 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
169 }''', 'HAVE_KERNEL_SHARE_MODES', addmain=False, execute=True,
170 msg="Checking for kernel share modes")
175 if Options.options.with_fam is None:
177 elif Options.options.with_fam == True:
180 if check_for_fam and conf.CHECK_HEADERS('fam.h'):
181 if conf.CHECK_FUNCS_IN('FAMOpen2', 'fam'):
183 elif conf.CHECK_FUNCS_IN('FAMOpen2', 'fam C'):
184 samba_fam_libs='fam C'
185 conf.CHECK_TYPE('enum FAMCodes', headers='fam.h',
186 define='HAVE_FAM_H_FAMCODES_TYPEDEF',
187 msg='Checking whether enum FAMCodes is available')
188 conf.CHECK_FUNCS_IN('FAMNoExists', 'fam')
190 if samba_fam_libs is not None:
191 conf.DEFINE('SAMBA_FAM_LIBS', samba_fam_libs)
193 if Options.options.with_fam == True:
194 conf.fatal('FAM support requested, but no suitable FAM library found')
196 Logs.warn('no suitable FAM library found')
198 # check for libarchive (tar command in smbclient)
199 # None means autodetect, True/False means enable/disable
200 conf.env['archive_lib'] = ''
201 if Options.options.with_libarchive is not False:
202 libarchive_mandatory = Options.options.with_libarchive == True
203 Logs.info("Checking for libarchive existence")
204 if conf.CHECK_BUNDLED_SYSTEM('libarchive', minversion='3.1.2'):
205 conf.env['archive_lib'] = 'libarchive'
206 elif libarchive_mandatory:
207 conf.fatal('libarchive support requested, but no suitable pkgconfig found')
209 # check for DMAPI libs
210 if Options.options.with_dmapi == False:
214 Logs.info("Checking for DMAPI library existence")
216 if conf.CHECK_FUNCS_IN('dm_get_eventlist', 'dm'):
217 samba_dmapi_lib = 'dm'
219 if conf.CHECK_FUNCS_IN('dm_get_eventlist', 'jfsdm'):
220 samba_dmapi_lib = 'jfsdm'
222 if conf.CHECK_FUNCS_IN('dm_get_eventlist', 'dmapi'):
223 samba_dmapi_lib = 'dmapi'
225 if conf.CHECK_FUNCS_IN('dm_get_eventlist', 'xdsm'):
226 samba_dmapi_lib = 'xdsm'
227 # only bother to test headers and compilation when a candidate
228 # library has been found
229 if samba_dmapi_lib == '':
231 broken_dmapi = "no suitable DMAPI library found"
234 conf.CHECK_HEADERS('sys/dmi.h xfs/dmapi.h sys/jfsdmapi.h sys/dmapi.h dmapi.h')
236 #include <time.h> /* needed by Tru64 */
237 #include <sys/types.h> /* needed by AIX */
238 #ifdef HAVE_XFS_DMAPI_H
239 #include <xfs/dmapi.h>
240 #elif defined(HAVE_SYS_DMI_H)
242 #elif defined(HAVE_SYS_JFSDMAPI_H)
243 #include <sys/jfsdmapi.h>
244 #elif defined(HAVE_SYS_DMAPI_H)
245 #include <sys/dmapi.h>
246 #elif defined(HAVE_DMAPI_H)
250 /* This link test is designed to fail on IRI 6.4, but should
251 * succeed on Linux, IRIX 6.5 and AIX.
253 int main(int argc, char **argv)
256 dm_eventset_t events;
257 /* This doesn't take an argument on IRIX 6.4. */
258 dm_init_service(&version);
259 /* IRIX 6.4 expects events to be a pointer. */
260 DMEV_ISSET(DM_EVENT_READ, events);
265 'USEABLE_DMAPI_LIBRARY',
269 msg='Checking whether DMAPI lib '+samba_dmapi_lib+' can be used')
270 if not conf.CONFIG_SET('USEABLE_DMAPI_LIBRARY'):
272 broken_dmapi = "no usable DMAPI library found"
275 Logs.info("Building with DMAPI support.")
276 conf.env['dmapi_lib'] = samba_dmapi_lib
277 conf.DEFINE('USE_DMAPI', 1)
279 if Options.options.with_dmapi == False:
280 Logs.info("Building without DMAPI support (--without-dmapi).")
281 elif Options.options.with_dmapi == True:
282 Logs.error("DMAPI support not available: " + broken_dmapi)
283 conf.fatal('DMAPI support requested but not found.');
285 Logs.warn("Building without DMAPI support: " + broken_dmapi)
286 conf.env['dmapi_lib'] = ''
288 # Check for various members of the stat structure
289 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define='HAVE_STAT_ST_BLOCKS',
290 headers='sys/stat.h')
291 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define='HAVE_STAT_ST_BLKSIZE',
292 headers='sys/stat.h')
293 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_flags', define='HAVE_STAT_ST_FLAGS',
294 headers='sys/types.h sys/stat.h unistd.h')
296 if "HAVE_BLKCNT_T" in conf.env:
298 static int test_array[1 - 2 * !(((long int)(sizeof(blkcnt_t))) <= 4)];''',
300 headers='replace.h sys/types.h sys/stat.h unistd.h',
301 msg="Checking whether blkcnt_t is 32 bit")
303 # If sizeof is 4 it can't be 8
304 if "HAVE_BLKCNT_T" in conf.env:
305 if not conf.CONFIG_SET('SIZEOF_BLKCNT_T_4'):
307 static int test_array[1 - 2 * !(((long int)(sizeof(blkcnt_t))) <= 8)];''',
309 headers='replace.h sys/types.h sys/stat.h unistd.h',
310 msg="Checking whether blkcnt_t is 64 bit")
312 # Check for POSIX capability support
313 conf.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers='sys/capability.h')
315 if "HAVE_SYS_CAPABILITY_H" in conf.env:
319 if (!(cap = cap_get_proc())) exit(1);
321 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
322 cap_set_proc(cap);''',
323 'HAVE_POSIX_CAPABILITIES', execute=True, lib="cap",
324 headers='sys/capability.h',
325 msg="Checking whether POSIX capabilities are available")
327 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
328 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
330 if conf.CONFIG_SET("HAVE_RPC_RPC_H"):
331 conf.CHECK_TYPE('int16', headers='rpc/rpc.h',
332 define='HAVE_INT16_FROM_RPC_RPC_H',
333 msg="Checking for int16 typedef included by rpc/rpc.h")
334 conf.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
335 headers='sys/types.h rpc/rpc.h',
336 msg="Checking for uint16 typedef included by rpc/rpc.h")
337 conf.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
338 headers='sys/types.h rpc/rpc.h',
339 msg="Checking for int32 typedef included by rpc/rpc.h")
340 conf.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
341 headers='sys/types.h rpc/rpc.h',
342 msg="Checking for uint32 typedef included by rpc/rpc.h")
343 conf.CHECK_CODE('int i;', 'BROKEN_NISPLUS_INCLUDE_FILES',
344 headers='sys/types.h sys/acl.h rpcsvc/nis.h',
345 msg="Checking for broken nisplus include files")
347 # Check if the compiler will optimize out functions
349 #include <sys/types.h>
350 size_t __unsafe_string_function_usage_here_size_t__(void);
351 #define CHECK_STRING_SIZE(d, len) (sizeof(d) != (len) && sizeof(d) != sizeof(char *))
352 static size_t push_string_check_fn(void *dest, const char *src, size_t dest_len) {
356 #define push_string_check(dest, src, dest_len) \
357 (CHECK_STRING_SIZE(dest, dest_len) \
358 ? __unsafe_string_function_usage_here_size_t__() \
359 : push_string_check_fn(dest, src, dest_len))
361 int main(int argc, char **argv) {
364 const char *foo = "bar";
365 p += 31 + push_string_check(p + 31, foo, sizeof(outbuf) - (p + 31 - outbuf));
367 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
370 msg="Checking if the compiler will optimize out functions")
372 # Check if the compiler supports the LL suffix on long long integers
374 conf.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL',
376 msg="Checking for LL suffix on long long integers")
380 _chdir __chdir chflags chmod _close __close _closedir
381 __closedir crypt16 devnm dirfd
382 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
384 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
386 fsetxattr _fstat __fstat fsync
387 futimens futimes __fxstat getauthuid
388 getcwd _getcwd __getcwd getdents __getdents getdirentries
389 getgrent getgrnam getgrouplist getgrset getmntent getpagesize
390 getpwanam getpwent_r getrlimit
391 glob grantpt hstrerror initgroups innetgr
392 llseek _llseek __llseek _lseek __lseek
393 _lstat __lstat lutimes
394 __lxstat memalign mknod mlock mlockall munlock munlockall
395 _open __open _opendir __opendir
396 pathconf poll posix_fallocate
397 posix_memalign pread _pread __pread
398 pwrite _pwrite __pwrite
399 rdchk _read __read _readdir __readdir
401 select setenv setgidx setgroups setlocale setluid
402 setmntent setpgid setpriv setsid setuidx
403 shmget shm_open sigaction sigblock sigprocmask sigset
405 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctl sysctlbyname
406 __sys_llseek syslog _telldir __telldir timegm
407 utimensat vsyslog _write __write __xstat
410 conf.CHECK_SAMBA3_CHARSET() # see build/charset.py
412 # FIXME: these should be tests for features, but the old build system just
414 host_os = sys.platform
415 Logs.info("building on %s" % host_os)
417 # Python doesn't have case switches... :/
418 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
419 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
421 conf.SET_TARGET_TYPE('sunacl', 'EMPTY')
422 if (host_os.rfind('linux') > -1) or (host_os.rfind('gnu') > -1) or (host_os.rfind('qnx') > -1):
423 if host_os.rfind('linux') > -1:
424 conf.DEFINE('LINUX', '1')
425 elif host_os.rfind('qnx') > -1:
426 conf.DEFINE('QNX', '1')
427 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
428 elif (host_os.rfind('darwin') > -1):
429 conf.DEFINE('DARWINOS', 1)
430 conf.ADD_CFLAGS('-fno-common')
431 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
432 elif (host_os.rfind('freebsd') > -1):
433 conf.DEFINE('FREEBSD', 1)
434 if conf.CHECK_HEADERS('sunacl.h'):
435 conf.DEFINE('HAVE_FREEBSD_SUNACL_H', '1')
436 conf.CHECK_FUNCS_IN(['acl'], 'sunacl')
437 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
438 elif (host_os.rfind('irix') > -1):
439 conf.DEFINE('IRIX', 1)
440 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
441 elif (host_os.rfind('aix') > -1):
442 conf.DEFINE('AIX', 1)
443 conf.DEFINE('STAT_ST_BLOCKSIZE', 'DEV_BSIZE')
444 elif (host_os.rfind('hpux') > -1):
445 conf.DEFINE('HPUX', 1)
446 conf.DEFINE('STAT_ST_BLOCKSIZE', '8192')
447 elif (host_os.rfind('osf') > -1):
448 conf.DEFINE('OSF1', 1)
449 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
451 # FIXME: Add more checks here.
453 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
455 if Options.options.with_acl_support:
456 if (host_os.rfind('hpux') > -1):
457 Logs.info('Using HPUX ACLs')
458 conf.DEFINE('HAVE_HPUX_ACLS',1)
459 conf.DEFINE('POSIX_ACL_NEEDS_MASK',1)
460 default_static_modules.extend(TO_LIST('vfs_hpuxacl'))
461 elif (host_os.rfind('aix') > -1):
462 Logs.info('Using AIX ACLs')
463 conf.DEFINE('HAVE_AIX_ACLS',1)
464 default_static_modules.extend(TO_LIST('vfs_aixacl vfs_aixacl2'))
465 elif (host_os.rfind('darwin') > -1):
466 Logs.warn('ACLs on Darwin currently not supported')
467 conf.fatal("ACL support not available on Darwin/MacOS. "
468 "Use --without-acl-support for building without "
470 "ACL support is required to change permissions "
471 "from Windows clients.")
473 conf.CHECK_FUNCS_IN(['acl_get_file'], 'acl')
474 if conf.CHECK_CODE('''
477 acl_entry_t *entry_p;
478 return acl_get_entry(acl, entry_id, entry_p);
481 headers='sys/types.h sys/acl.h', link=False,
482 msg="Checking for POSIX ACL support") :
484 acl_permset_t permset_d;
486 return acl_get_perm_np(permset_d, perm);
488 'HAVE_ACL_GET_PERM_NP',
489 headers='sys/types.h sys/acl.h', link=True,
490 msg="Checking whether acl_get_perm_np() is available")
491 default_static_modules.extend(TO_LIST('vfs_posixacl'))
492 conf.CHECK_VARIABLE('ACL_EVERYONE', headers='sys/acl.h')
493 elif conf.CHECK_FUNCS_IN(['facl'], 'sec'):
494 Logs.info('Using solaris or UnixWare ACLs')
495 conf.DEFINE('HAVE_SOLARIS_UNIXWARE_ACLS',1)
496 default_static_modules.extend(TO_LIST('vfs_solarisacl'))
497 elif conf.CHECK_FUNCS_IN(['acl_get_fd'], 'pacl'):
498 Logs.info('Using Tru64 ACLs')
499 conf.DEFINE('HAVE_TRU64_ACLS',1)
500 default_static_modules.extend(TO_LIST('vfs_tru64acl'))
502 conf.fatal("ACL support not found. Try installing libacl1-dev "
504 "Otherwise, use --without-acl-support to build "
505 "without ACL support. "
506 "ACL support is required to change permissions from "
509 if conf.CHECK_FUNCS('dirfd'):
510 conf.DEFINE('HAVE_DIRFD_DECL', 1)
512 conf.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
513 'HAVE_STATFS_F_FSID',
514 msg="vfs_fileid checking for statfs() and struct statfs.f_fsid",
515 headers='sys/types.h sys/statfs.h',
518 if conf.CONFIG_SET('HAVE_FALLOCATE'):
520 int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
521 'HAVE_LINUX_FALLOCATE',
522 msg="Checking whether the Linux 'fallocate' function is available",
523 headers='unistd.h sys/types.h fcntl.h linux/falloc.h')
525 ssize_t err = readahead(0,0,0x80000);''',
526 'HAVE_LINUX_READAHEAD',
527 msg="Checking whether Linux readahead is available",
528 headers='unistd.h fcntl.h')
529 conf.CHECK_DECLS('readahead', headers='fcntl.h', always=True)
531 conf.CHECK_CODE('int fd = openat(AT_FDCWD, ".", O_RDONLY);',
533 msg='Checking for openat',
536 if Options.options.with_aio_support:
537 conf.CHECK_FUNCS_IN('aio_read', 'aio')
538 conf.CHECK_FUNCS_IN('aio_read', 'rt')
539 conf.CHECK_CODE('struct aiocb a; return aio_read(&a);',
541 msg='Checking for asynchronous io support',
542 headers='sys/types.h aio.h',
544 if conf.CONFIG_SET('HAVE_AIO'):
545 conf.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg='Checking for aio_read', headers='aio.h', lib='aio rt')
546 conf.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg='Checking for aio_write', headers='aio.h', lib='aio rt')
547 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')
548 conf.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg='Checking for aio_return', headers='aio.h', lib='aio rt')
549 conf.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg='Checking for aio_error', headers='aio.h', lib='aio rt')
550 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')
551 conf.CHECK_CODE('const struct aiocb * const a[1]; struct timespec t; return aio_suspend(&a, 1, &t);', 'HAVE_AIO_SUSPEND', msg='Checking for aio_suspend', headers='aio.h', lib='aio rt')
552 if not conf.CONFIG_SET('HAVE_AIO'):
553 conf.DEFINE('HAVE_NO_AIO', '1')
555 conf.DEFINE('HAVE_NO_AIO', '1')
557 if host_os.rfind('linux') > -1:
558 conf.CHECK_FUNCS_IN('io_submit', 'aio')
560 struct io_event ioev;
566 fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
567 io_queue_init(128,&ctx);
568 io_prep_pwrite(ioc, 1, buf, 1, 0);
569 io_prep_pread(ioc, 1, buf, 1, 0);
570 io_set_eventfd(ioc, fd);
571 io_set_callback(ioc, (io_callback_t)(0));
572 io_submit(ctx, 1, &ioc);
573 io_getevents(ctx, 1, 1, &ioev, &ts);
575 'HAVE_LINUX_KERNEL_AIO',
576 msg='Checking for linux kernel asynchronous io support',
577 headers='unistd.h stdlib.h sys/types.h fcntl.h sys/eventfd.h libaio.h',
584 char control[CMSG_SPACE(sizeof(int))];
586 msg.msg_control = control_un.control;
587 msg.msg_controllen = sizeof(control_un.control);
589 'HAVE_STRUCT_MSGHDR_MSG_CONTROL',
590 msg='Checking if we can use msg_control for passing file descriptors',
591 headers='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
595 msg.msg_accrights = (caddr_t) &fd;
596 msg.msg_accrightslen = sizeof(fd);
598 'HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS',
599 msg='Checking if we can use msg_accrights for passing file descriptors',
600 headers='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
602 if Options.options.with_winbind:
603 conf.env.build_winbind = True
604 conf.DEFINE('WITH_WINBIND', '1')
606 conf.find_program('awk', var='AWK')
608 conf.CHECK_HEADERS('asm/types.h')
610 conf.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
611 headers='unistd.h sys/types.h',
612 msg="Checking for major macro")
614 conf.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
615 headers='unistd.h sys/types.h',
616 msg="Checking for minor macro")
618 conf.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
619 headers='unistd.h sys/types.h dirent.h',
620 define='HAVE_DIRENT_D_OFF')
622 conf.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent')
623 if conf.CHECK_CFLAGS('-Werror-implicit-function-declaration'):
624 netgrent_cflags = '-Werror-implicit-function-declaration'
627 conf.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE',
628 msg="Checking for setnetgrent prototype",
629 headers='netdb.h netgroup.h',
630 cflags=netgrent_cflags)
631 conf.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE',
632 msg="Checking for getnetgrent prototype",
633 headers='netdb.h netgroup.h',
634 cflags=netgrent_cflags)
635 conf.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE',
636 msg="Checking for endnetgrent prototype",
637 headers='netdb.h netgroup.h',
638 cflags=netgrent_cflags)
642 if Options.options.with_cups:
643 conf.find_program('cups-config', var='CUPS_CONFIG')
644 if conf.env.CUPS_CONFIG:
645 # we would normally use --libs here, but cups-config incorrectly adds
646 # gssapi_krb5 and other libraries to its --libs output. That breaks the use
647 # of an in-tree heimdal kerberos
648 conf.check_cfg(path=conf.env.CUPS_CONFIG, args="--cflags --ldflags",
649 package="", uselib_store="CUPS")
650 conf.CHECK_HEADERS('cups/cups.h cups/language.h', lib='cups')
651 conf.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups')
652 if conf.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
653 conf.DEFINE('HAVE_CUPS', '1')
655 conf.undefine('HAVE_CUPS')
656 conf.SET_TARGET_TYPE('cups', 'EMPTY')
658 # define an empty subsystem for cups, to allow it to be used as an empty dependency
659 conf.SET_TARGET_TYPE('cups', 'EMPTY')
661 if Options.options.with_iprint:
662 if conf.CONFIG_SET('HAVE_CUPS'):
663 conf.DEFINE('HAVE_IPRINT', '1')
665 Logs.warn("--enable-iprint=yes but cups support not sufficient")
666 if Options.options.with_syslog:
667 conf.DEFINE('WITH_SYSLOG', '1')
668 if Options.options.with_automount:
669 conf.DEFINE('WITH_AUTOMOUNT', '1')
672 if Options.options.with_ldap:
673 conf.CHECK_HEADERS('ldap.h lber.h ldap_pvt.h')
674 conf.CHECK_TYPE('ber_tag_t', 'unsigned int', headers='ldap.h lber.h')
675 conf.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
676 conf.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers='ldap.h')
678 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
680 conf.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
681 define='HAVE_LBER_LOG_PRINT_FN', headers='lber.h')
683 conf.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', 'ldap')
684 conf.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
686 # Check if ldap_set_rebind_proc() takes three arguments
687 if conf.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
688 'LDAP_SET_REBIND_PROC_ARGS',
689 msg="Checking whether ldap_set_rebind_proc takes 3 arguments",
690 headers='ldap.h lber.h', link=False):
691 conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
693 conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
695 # last but not least, if ldap_init() exists, we want to use ldap
696 if conf.CONFIG_SET('HAVE_LDAP_INIT') and conf.CONFIG_SET('HAVE_LDAP_H'):
697 conf.DEFINE('HAVE_LDAP', '1')
698 conf.DEFINE('LDAP_DEPRECATED', '1')
699 conf.env['HAVE_LDAP'] = '1'
700 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
701 # SASL wrapping hooks
702 if conf.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
703 conf.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
704 conf.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
706 conf.fatal("LDAP support not found. "
707 "Try installing libldap2-dev or openldap-devel. "
708 "Otherwise, use --without-ldap to build without "
710 "LDAP support is required for the LDAP passdb backend, "
711 "LDAP idmap backends and ADS. "
712 "ADS support improves communication with "
713 "Active Directory domain controllers.")
715 conf.SET_TARGET_TYPE('ldap', 'EMPTY')
716 conf.SET_TARGET_TYPE('lber', 'EMPTY')
718 if Options.options.with_ads == False:
726 if not conf.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and \
727 not conf.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC'):
728 Logs.warn("arcfour-hmac-md5 encryption type not found in -lkrb5")
730 if not conf.CONFIG_SET('HAVE_KRB5_MK_REQ_EXTENDED'):
731 Logs.warn("krb5_mk_req_extended not found in -lkrb5")
733 if not conf.CONFIG_SET('HAVE_KRB5_GET_HOST_REALM'):
734 Logs.warn("krb5_get_host_realm not found in -lkrb5")
736 if not conf.CONFIG_SET('HAVE_KRB5_FREE_HOST_REALM'):
737 Logs.warn("krb5_free_host_realm not found in -lkrb5")
739 if not conf.CONFIG_SET('HAVE_KRB5_FWD_TGT_CREDS'):
740 Logs.warn("krb5_fwd_tgt_creds found in -lkrb5")
742 if not conf.CONFIG_SET('HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC'):
743 Logs.warn("krb5_get_init_creds_opt_alloc not found in -lkrb5")
745 if not conf.CONFIG_SET('KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT'):
746 Logs.warn("krb5_get_init_creds_opt_free was not found or was too old in -lkrb5")
748 if not conf.CONFIG_SET('HAVE_KRB5_GET_RENEWED_CREDS'):
749 Logs.warn("krb5_get_renewed_creds not found in -lkrb5")
751 if not conf.CONFIG_SET('HAVE_KRB5_PRINCIPAL_COMPARE_ANY_REALM'):
752 Logs.warn("krb5_principal_compare_any_realm not found in -lkrb5")
754 if not conf.CONFIG_SET('HAVE_KRB5_C_STRING_TO_KEY') and \
755 not conf.CONFIG_SET('HAVE_KRB5_STRING_TO_KEY_SALT'):
756 Logs.warn("krb5_c_string_to_key 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'):
771 Logs.warn("krb5_c_verify_checksum_compare not found in -lkrb5")
774 # We don't actually use
775 # gsskrb5_extract_authz_data_from_sec_context, but it is a
776 # clue that this Heimdal, which does the PAC processing we
777 # need on the standard gss_inquire_sec_context_by_oid
778 if not conf.CONFIG_SET('HAVE_GSS_GET_NAME_ATTRIBUTE') and \
779 not (conf.CONFIG_SET('HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT') and \
780 conf.CONFIG_SET('HAVE_GSS_INQUIRE_SEC_CONTEXT_BY_OID')):
781 Logs.warn("need either gss_get_name_attribute or gsskrb5_extract_authz_data_from_sec_context and gss_inquire_sec_context_by_oid in -lgssapi for PAC support")
784 if not conf.CONFIG_SET('HAVE_GSS_KRB5_EXPORT_LUCID_SEC_CONTEXT'):
785 Logs.warn("need gss_krb5_export_lucid_sec_context for SPNEGO and gss_wrap support")
789 conf.DEFINE('HAVE_KRB5', '1')
790 conf.env['HAVE_KRB5'] = '1'
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')
798 if not conf.CONFIG_SET('HAVE_LDAP'):
803 conf.DEFINE('WITH_ADS', '1')
804 conf.env['HAVE_ADS'] = '1'
805 Logs.info("Building with Active Directory support.")
806 elif Options.options.with_ads == False:
807 Logs.info("Building without Active Directory support (--without-ads).")
810 Logs.warn("Active Directory support not available: krb5 libs don't have all required features")
812 Logs.warn("Active Directory support not available: LDAP support is not available.")
813 if Options.options.with_ads:
814 conf.fatal("Active Directory support not found. Use --without-ads "
815 "for building without Active Directory support. "
816 "ADS support improves communication with "
817 "Active Directory domain controllers.")
819 # this is the auto-mode case
820 Logs.warn("Building without Active Directory support.")
823 if Options.options.with_utmp:
824 conf.env.with_utmp = True
825 if not conf.CHECK_HEADERS('utmp.h'): conf.env.with_utmp = False
826 conf.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
827 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers='utmp.h',
828 define='HAVE_UT_UT_NAME')
829 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers='utmp.h',
830 define='HAVE_UT_UT_USER')
831 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers='utmp.h',
832 define='HAVE_UT_UT_ID')
833 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers='utmp.h',
834 define='HAVE_UT_UT_HOST')
835 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers='utmp.h',
836 define='HAVE_UT_UT_TIME')
837 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers='utmp.h',
838 define='HAVE_UT_UT_TV')
839 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers='utmp.h',
840 define='HAVE_UT_UT_TYPE')
841 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers='utmp.h',
842 define='HAVE_UT_UT_PID')
843 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers='utmp.h',
844 define='HAVE_UT_UT_EXIT')
845 conf.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers='utmpx.h',
846 define='HAVE_UX_UT_SYSLEN')
847 conf.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
848 'PUTUTLINE_RETURNS_UTMP', headers='utmp.h',
849 msg="Checking whether pututline returns pointer")
850 conf.CHECK_SIZEOF(['((struct utmp *)NULL)->ut_line'], headers='utmp.h',
851 define='SIZEOF_UTMP_UT_LINE', critical=False)
852 if not conf.CONFIG_SET('SIZEOF_UTMP_UT_LINE'):
853 conf.env.with_utmp = False
854 elif int(conf.env.SIZEOF_UTMP_UT_LINE) < 15:
855 conf.env.with_utmp = False
856 if conf.env.with_utmp:
857 conf.DEFINE('WITH_UTMP', 1)
859 Logs.warn("--with-utmp but utmp support not sufficient")
861 if Options.options.with_avahi:
862 conf.env.with_avahi = True
863 if not conf.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf.env.with_avahi = False
864 if not conf.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf.env.with_avahi = False
865 if not conf.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf.env.with_avahi = False
866 if conf.env.with_avahi:
867 conf.DEFINE('WITH_AVAHI_SUPPORT', 1)
869 conf.SET_TARGET_TYPE('avahi-common', 'EMPTY')
870 conf.SET_TARGET_TYPE('avahi-client', 'EMPTY')
872 if Options.options.with_iconv:
873 conf.env.with_iconv = True
874 if not conf.CHECK_FUNCS_IN('iconv_open', 'iconv', headers='iconv.h'):
875 conf.env.with_iconv = False
876 if conf.env.with_iconv:
877 conf.DEFINE('HAVE_ICONV', 1)
879 if Options.options.with_pam:
881 conf.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
882 if not conf.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
883 Logs.warn("--with-pam=yes but pam_appl.h not found")
885 conf.CHECK_FUNCS_IN('pam_get_data', 'pam')
886 conf.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h')
887 if not conf.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'):
888 Logs.warn("--with-pam=yes but pam_modules.h not found")
890 conf.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h')
891 conf.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h')
892 conf.CHECK_FUNCS_IN('pam_vsyslog', 'pam')
894 #if defined(HAVE_SECURITY_PAM_APPL_H)
895 #include <security/pam_appl.h>
896 #elif defined(HAVE_PAM_PAM_APPL_H)
897 #include <pam/pam_appl.h>
899 pam_set_item(0, PAM_RHOST, 0);
903 msg="Checking whether PAM_RHOST is available");
905 #if defined(HAVE_SECURITY_PAM_APPL_H)
906 #include <security/pam_appl.h>
907 #elif defined(HAVE_PAM_PAM_APPL_H)
908 #include <pam/pam_appl.h>
910 pam_set_item(0, PAM_TTY, 0);
914 msg="Checking whether PAM_TTY is available");
916 #if (!defined(LINUX))
918 #define PAM_EXTERN extern
919 #if defined(HAVE_SECURITY_PAM_APPL_H)
920 #include <security/pam_appl.h>
921 #elif defined(HAVE_PAM_PAM_APPL_H)
922 #include <pam/pam_appl.h>
927 #if defined(HAVE_SECURITY_PAM_MODULES_H)
928 #include <security/pam_modules.h>
929 #elif defined(HAVE_PAM_PAM_MODULES_H)
930 #include <pam/pam_modules.h>
933 #if defined(HAVE_SECURITY__PAM_MACROS_H)
934 #include <security/_pam_macros.h>
935 #elif defined(HAVE_PAM__PAM_MACROS_H)
936 #include <pam/_pam_macros.h>
939 #ifdef HAVE_SECURITY_PAM_EXT_H
940 #include <security/pam_ext.h>
943 int i; i = PAM_RADIO_TYPE;
945 'HAVE_PAM_RADIO_TYPE',
947 msg="Checking whether PAM_RADIO_TYPE is available");
949 conf.DEFINE('WITH_PAM', 1)
950 conf.DEFINE('WITH_PAM_MODULES', 1)
952 if Options.options.with_pam_smbpass:
953 conf.env.with_pam_smbpass = True
958 # Ensure we select the correct set of system calls on Linux.
960 if (host_os.rfind('linux') > -1):
962 #if defined(HAVE_UNISTD_H)
967 #include <sys/types.h>
970 #ifdef HAVE_SYS_PRIV_H
971 #include <sys/priv.h>
977 #if defined(HAVE_SYSCALL_H)
981 #if defined(HAVE_SYS_SYSCALL_H)
982 #include <sys/syscall.h>
985 syscall(SYS_setresuid32, -1, -1, -1);
986 syscall(SYS_setresgid32, -1, -1, -1);
987 syscall(SYS_setreuid32, -1, -1);
988 syscall(SYS_setregid32, -1, -1);
989 syscall(SYS_setuid32, -1);
990 syscall(SYS_setgid32, -1);
991 syscall(SYS_setgroups32, 0, NULL);
993 'USE_LINUX_32BIT_SYSCALLS',
994 msg="Checking whether Linux should use 32-bit credential calls");
996 if (conf.CONFIG_SET('USE_LINUX_32BIT_SYSCALLS')):
997 seteuid = conf.CHECK_CODE('''
998 #define AUTOCONF_TEST 1
999 #define USE_LINUX_THREAD_CREDENTIALS 1
1000 #define USE_LINUX_32BIT_SYSCALLS 1
1001 #include "../lib/util/setid.c"
1002 #include "./lib/util_sec.c"
1004 'USE_LINUX_THREAD_CREDENTIALS',
1007 msg="Checking whether we can use Linux thread-specific credentials with 32-bit system calls")
1009 seteuid = conf.CHECK_CODE('''
1010 #define AUTOCONF_TEST 1
1011 #define USE_LINUX_THREAD_CREDENTIALS 1
1012 #include "../lib/util/setid.c"
1013 #include "./lib/util_sec.c"
1015 'USE_LINUX_THREAD_CREDENTIALS',
1018 msg="Checking whether we can use Linux thread-specific credentials")
1020 seteuid = conf.CHECK_CODE('''
1021 #define AUTOCONF_TEST 1
1022 #define USE_SETREUID 1
1023 #include "../lib/util/setid.c"
1024 #include "./lib/util_sec.c"
1029 msg="Checking whether setreuid is available")
1031 seteuid = conf.CHECK_CODE('''
1032 #define AUTOCONF_TEST 1
1033 #define USE_SETRESUID 1
1034 #include "../lib/util/setid.c"
1035 #include "./lib/util_sec.c"
1040 msg="Checking whether setresuid is available")
1042 seteuid = conf.CHECK_CODE('''
1043 #define AUTOCONF_TEST 1
1044 #define USE_SETEUID 1
1045 #include "../lib/util/setid.c"
1046 #include "./lib/util_sec.c"
1051 msg="Checking whether seteuid is available")
1053 seteuid = conf.CHECK_CODE('''
1054 #define AUTOCONF_TEST 1
1055 #define USE_SETUIDX 1
1056 #include "../lib/util/setid.c"
1057 #include "./lib/util_sec.c"
1063 msg="Checking whether setuidx is available")
1064 if Options.options.with_dnsupdate:
1065 if not conf.CONFIG_SET('HAVE_KRB5'):
1066 Logs.warn("--with-dnsupdate=yes but gssapi support not sufficient")
1068 conf.DEFINE('WITH_DNS_UPDATES', 1)
1069 conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
1070 if Options.options.developer:
1071 if conf.CONFIG_SET('HAVE_VALGRIND_H') or conf.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'):
1072 conf.DEFINE('VALGRIND', '1')
1074 if conf.CHECK_CODE('''
1075 #include <bits/sockaddr.h>
1076 #include <linux/netlink.h>
1078 'HAVE_LINUX_NETLINK_H',
1079 msg="Checking whether Linux netlink is available"):
1082 #include <bits/sockaddr.h>
1083 #include <linux/netlink.h>
1084 #include <linux/rtnetlink.h>
1086 'HAVE_LINUX_RTNETLINK_H',
1087 msg='Checking whether Linux rtnetlink is available')
1090 #include "../tests/fcntl_lock.c"
1095 msg='Checking whether fcntl locking is available')
1097 # glibc up to 2.3.6 had dangerously broken posix_fallocate(). DON'T USE IT.
1098 if not conf.CHECK_CODE('''
1099 #define _XOPEN_SOURCE 600
1101 #if defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4))
1102 #error probably broken posix_fallocate
1105 '_HAVE_UNBROKEN_POSIX_FALLOCATE',
1106 msg='Checking for broken posix_fallocate'):
1107 conf.DEFINE('HAVE_BROKEN_POSIX_FALLOCATE', '1')
1110 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec',
1111 define='HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') # Linux, Solaris
1112 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimensec',
1113 define='HAVE_STRUCT_STAT_ST_MTIMENSEC') # BSD, if defined _POSIX_SOURCE
1114 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimespec.tv_nsec',
1115 define='HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') # BSD, if not defined _POSIX_SOURCE
1116 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtime_n',
1117 define='HAVE_STRUCT_STAT_ST_MTIME_N') # AIX
1118 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_umtime',
1119 define='HAVE_STRUCT_STAT_ST_UMTIME') # Tru64
1120 if conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') or \
1121 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMENSEC') or \
1122 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') or \
1123 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIME_N') or \
1124 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_UMTIME'):
1125 conf.DEFINE('HAVE_STAT_HIRES_TIMESTAMPS', '1')
1127 # recent FreeBSD, NetBSD have creation timestamps called birthtime:
1128 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtime',
1129 define='HAVE_STRUCT_STAT_ST_BIRTHTIME')
1130 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimespec.tv_nsec',
1131 define='HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC')
1132 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimensec',
1133 define='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC')
1136 ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
1138 'HAVE_POSIX_FADVISE',
1139 msg='Checking whether posix_fadvise is available',
1140 headers='unistd.h fcntl.h')
1142 for v in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]:
1145 return sysconf(%s) == -1 ? 1 : 0;
1148 msg='Checking whether sysconf(%s) is available' % v)
1151 #include <sys/syscall.h>
1153 syscall(SYS_initgroups, 16, NULL, NULL, 0);
1155 'HAVE_DARWIN_INITGROUPS',
1156 msg='Checking whether to use the Darwin-specific initgroups system call')
1158 conf.CHECK_CODE('''struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''',
1160 headers='sys/types.h utime.h',
1161 msg='Checking whether struct utimbuf is available')
1163 if conf.CHECK_CODE('''struct sigevent s;''',
1164 'HAVE_STRUCT_SIGEVENT',
1165 headers='sys/types.h stdlib.h stddef.h signal.h',
1166 msg='Checking whether we have the struct sigevent'):
1167 conf.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sival_ptr',
1168 define='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR',
1169 headers='signal.h');
1170 conf.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sigval_ptr',
1171 define='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR',
1172 headers='signal.h');
1174 if os.path.exists('/proc/sys/kernel/core_pattern'):
1175 conf.DEFINE('HAVE_SYS_KERNEL_PROC_CORE_PATTERN', '1')
1177 if conf.CHECK_CODE('''
1181 if (sizeof(time_t) == 8) {
1182 time_t max_time = 0x7fffffffffffffffll;
1183 tm = gmtime(&max_time);
1184 /* This should fail with 32-bit tm_year. */
1186 /* Max time_t that works with 32-bit int tm_year in struct tm. */
1187 max_time = 67768036191676799ll;
1188 tm = gmtime(&max_time);
1199 msg="Checking for the maximum value of the 'time_t' type"):
1200 conf.DEFINE('TIME_T_MAX', '67768036191676799ll')
1203 #if defined(HAVE_UNISTD_H)
1206 #include <sys/types.h>
1207 main() { dev_t dev = makedev(1,2); return 0; }
1211 msg='Checking whether the macro for makedev is available')
1218 void exit_on_core(int ignored) {
1224 signal(SIGSEGV, exit_on_core);
1225 newpath = realpath("/tmp", NULL);
1226 exit((newpath != NULL) ? 0 : 1);
1229 'REALPATH_TAKES_NULL',
1232 msg='Checking whether the realpath function allows a NULL argument')
1234 conf.CHECK_CODE('''#include "../tests/ftruncate.c"''',
1235 'HAVE_FTRUNCATE_EXTEND',
1236 msg='Checking for ftruncate extend',
1240 if Options.options.with_sendfile_support:
1241 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):
1246 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1249 headers='sys/sendfile.h',
1250 msg='Checking for linux sendfile support')
1252 if conf.CONFIG_SET('_HAVE_SENDFILE'):
1253 conf.DEFINE('HAVE_SENDFILE', '1')
1254 conf.DEFINE('LINUX_SENDFILE_API', '1')
1255 conf.DEFINE('WITH_SENDFILE', '1')
1256 elif (host_os.rfind('freebsd') > -1) or (host_os.rfind('dragonfly') > -1):
1258 #include <sys/types.h>
1260 #include <sys/socket.h>
1261 #include <sys/uio.h>
1262 int fromfd, tofd, ret, total=0;
1263 off_t offset, nwritten;
1266 hdr.headers = &hdtrl;
1268 hdr.trailers = NULL;
1270 hdtrl.iov_base = NULL;
1272 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0)
1275 msg='Checking for freebsd sendfile support')
1276 if conf.CONFIG_SET('_HAVE_SENDFILE'):
1277 conf.DEFINE('HAVE_SENDFILE', '1')
1278 conf.DEFINE('FREEBSD_SENDFILE_API', '1')
1279 conf.DEFINE('WITH_SENDFILE', '1')
1280 elif (host_os.rfind('darwin') > -1):
1282 #include <sys/types.h>
1283 #include <sys/socket.h>
1284 #include <sys/uio.h>
1285 int fromfd, tofd, ret;
1286 off_t offset, nwritten;
1289 hdr.headers = &hdtrl;
1291 hdr.trailers = (void *)0;
1293 hdtrl.iov_base = (void *)0;
1295 ret = sendfile(fromfd, tofd, offset, &nwritten, &hdr, 0);
1298 msg='Checking for darwin sendfile support')
1299 if conf.CONFIG_SET('_HAVE_SENDFILE'):
1300 conf.DEFINE('HAVE_SENDFILE', '1')
1301 conf.DEFINE('DARWIN_SENDFILE_API', '1')
1302 conf.DEFINE('WITH_SENDFILE', '1')
1303 elif (host_os.rfind('hpux') > -1) or (host_os.rfind('osf') > -1):
1305 #include <sys/socket.h>
1306 #include <sys/uio.h>
1309 struct iovec hdtrl[2];
1312 hdtrl[0].iov_base = 0;
1313 hdtrl[0].iov_len = 0;
1314 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
1317 msg='Checking for osf/hpux sendfile support')
1318 if conf.CONFIG_SET('_HAVE_SENDFILE'):
1319 conf.DEFINE('HAVE_SENDFILE', '1')
1320 conf.DEFINE('HPUX_SENDFILE_API', '1')
1321 conf.DEFINE('WITH_SENDFILE', '1')
1322 elif (host_os.rfind('solaris') > -1):
1323 conf.CHECK_FUNCS_IN('sendfile', 'sendfilev')
1325 #include <sys/sendfile.h>,
1328 struct sendfilevec vec[2];
1332 vec[0].sfv_fd = SFV_FD_SELF;
1333 vec[0].sfv_flag = 0;
1337 vec[1].sfv_flag = 0;
1340 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
1343 msg='Checking for solaris sendfilev support')
1344 if conf.CONFIG_SET('_HAVE_SENDFILEV'):
1345 conf.DEFINE('HAVE_SENDFILEV', '1')
1346 conf.DEFINE('SOLARIS_SENDFILE_API', '1')
1347 conf.DEFINE('WITH_SENDFILE', '1')
1348 elif (host_os.rfind('aix') > -1):
1350 #include <sys/socket.h>
1353 struct sf_parms hdtrl;
1355 hdtrl.header_data = 0;
1356 hdtrl.header_length = 0;
1357 hdtrl.file_descriptor = fromfd;
1358 hdtrl.file_offset = 0;
1359 hdtrl.file_bytes = 0;
1360 hdtrl.trailer_data = 0;
1361 hdtrl.trailer_length = 0;
1362 nwritten = send_file(&tofd, &hdtrl, 0);
1365 msg='Checking for AIX send_file support')
1366 if conf.CONFIG_SET('_HAVE_SENDFILE'):
1367 conf.DEFINE('HAVE_SENDFILE', '1')
1368 conf.DEFINE('AIX_SENDFILE_API', '1')
1369 conf.DEFINE('WITH_SENDFILE', '1')
1371 # Check for getcwd allowing a NULL arg.
1375 char *s = getcwd(NULL,0);
1376 exit(s != NULL ? 0 : 1);
1377 }''', 'GETCWD_TAKES_NULL', addmain=False, execute=True,
1378 msg="getcwd takes a NULL argument")
1381 # UnixWare 7.x has its getspnam in -lgen
1382 conf.CHECK_FUNCS_IN('getspnam', 'gen')
1383 conf.CHECK_FUNCS_IN('getspnam', 'security')
1384 conf.CHECK_FUNCS_IN('getspnam', 'sec')
1386 if Options.options.with_quotas:
1387 # For quotas on Veritas VxFS filesystems
1388 conf.CHECK_HEADERS('sys/fs/vx_quota.h')
1389 # For sys/quota.h and linux/quota.h
1390 conf.CHECK_HEADERS('sys/quota.h')
1391 # For quotas on BSD systems
1392 conf.CHECK_HEADERS('ufs/ufs/quota.h')
1393 # For quotas on Linux XFS filesystems
1394 if conf.CHECK_HEADERS('xfs/xqm.h'):
1395 conf.DEFINE('HAVE_XFS_QUOTAS', '1')
1399 #include "confdefs.h"
1400 #ifdef HAVE_SYS_TYPES_H
1401 #include <sys/types.h>
1403 #ifdef HAVE_ASM_TYPES_H
1404 #include <asm/types.h>
1406 #include <sys/quota.h>
1407 int i = Q_XGETQUOTA;''',
1408 define='HAVE_XFS_QUOTAS',
1409 msg='for XFS QUOTA in <sys/quota.h>',
1411 local_include=False)
1413 # For IRIX like dqb_isoftlimit instead of dqb_fsoftlimit in struc dqblk
1414 conf.CHECK_STRUCTURE_MEMBER('struct dqblk', 'dqb_fsoftlimit', define='HAVE_DQB_FSOFTLIMIT',
1415 headers='sys/quota.h')
1416 #darwin style quota bytecount
1417 conf.CHECK_STRUCTURE_MEMBER('struct dqblk', 'dqb_curbytes', define='HAVE_STRUCT_DQBLK_DQB_CURBYTES',
1418 headers='sys/quota.h')
1419 if conf.CHECK_HEADERS('rpcsvc/rquota.h'):
1420 conf.DEFINE('HAVE_NFS_QUOTAS', '1')
1421 conf.CHECK_STRUCTURE_MEMBER('struct getquota_rslt', 'getquota_rslt_u',
1422 define='HAVE_GETQUOTA_RSLT_GETQUOTA_RSLT_U',
1423 headers='rpcsvc/rquota.h')
1425 if (host_os.rfind('linux') > -1):
1426 conf.DEFINE('HAVE_QUOTACTL_LINUX', '1')
1427 elif not conf.CONFIG_SET("HAVE_XFS_QUOTAS"):
1428 if not conf.CHECK_CODE('''
1429 #define HAVE_QUOTACTL_4A 1
1430 #define AUTOCONF_TEST 1
1431 #include "../tests/sysquotas.c"
1433 cflags=conf.env['WERROR_CFLAGS'],
1434 define='HAVE_QUOTACTL_4A',
1435 msg='for QUOTACTL_4A: long quotactl(int cmd, char *special, qid_t id, caddr_t addr)',
1440 #define HAVE_QUOTACTL_4B 1
1441 #define AUTOCONF_TEST 1
1442 #include "../tests/sysquotas.c"
1444 cflags=conf.env['WERROR_CFLAGS'],
1445 define='HAVE_QUOTACTL_4B',
1446 msg='for QUOTACTL_4B: int quotactl(const char *path, int cmd, int id, char *addr)',
1451 clnt_create("", RQUOTAPROG, RQUOTAVERS, "udp");
1453 headers="rpc/rpc.h rpc/types.h rpcsvc/rquota.h rpc/nettype.h rpc/xdr.h",
1454 define='HAVE_NFS_QUOTAS',
1455 msg='for NFS QUOTAS',
1457 local_include=False)
1459 if conf.CONFIG_SET('HAVE_QUOTACTL_LINUX') or \
1460 conf.CONFIG_SET('HAVE_QUOTACTL_4A') or \
1461 conf.CONFIG_SET('HAVE_QUOTACTL_4B') or \
1462 conf.CONFIG_SET('HAVE_XFS_QUOTAS'):
1463 conf.DEFINE('HAVE_SYS_QUOTAS', '1')
1464 conf.DEFINE('WITH_QUOTAS', '1')
1467 # checking for clustering extensions (CTDB)
1469 if Options.options.with_cluster_support == False:
1470 # configure is called with --without-cluster-support,
1471 # so don't check for and build w/o ctdb support.
1472 have_cluster_support = False
1476 have_cluster_support = True
1480 srcdir = os.path.realpath(conf.srcdir)
1481 if 'EXTRA_INCLUDES' in conf.env:
1482 includes = ' '.join(conf.env['EXTRA_INCLUDES']).replace('#', srcdir + '/')
1486 if Options.options.ctdb_dir:
1487 CTDB_INCLUDE = Options.options.ctdb_dir + '/include'
1489 CTDB_INCLUDE = conf.srcdir + '/ctdb/include'
1490 includes = includes + ' ' + CTDB_INCLUDE
1492 if not conf.env.USING_SYSTEM_TDB:
1493 includes = includes + ' ' + srcdir + '/lib/tdb/include'
1495 if not conf.env.USING_SYSTEM_TALLOC:
1496 includes = includes + ' ' + srcdir + '/lib/talloc'
1498 ok = conf.CHECK_CODE('''
1500 #include "replace.h"
1501 #include "system/wait.h"
1502 #include "system/network.h"
1503 #define private #error __USED_RESERVED_WORD_private__
1513 'HAVE_CTDB_CHECK_CODE',
1516 msg='Checking for header ctdb.h')
1518 CTDB_CFLAGS += ' -DHAVE_CTDB_H=1'
1520 have_cluster_support = False
1521 ctdb_broken = "ctdb.h is required for cluster support"
1523 conf.CONFIG_RESET('HAVE_CTDB_CHECK_CODE')
1524 if have_cluster_support:
1525 ok = conf.CHECK_CODE('''
1527 #include "replace.h"
1528 #include "system/wait.h"
1529 #include "system/network.h"
1530 #define private #error __USED_RESERVED_WORD_private__
1534 #include <ctdb_private.h>
1541 'HAVE_CTDB_CHECK_CODE',
1544 msg='Checking for header ctdb_private.h')
1546 CTDB_CFLAGS += ' -DHAVE_CTDB_PRIVATE_H=1'
1548 have_cluster_support = False
1549 ctdb_broken = "ctdb_private.h is required for cluster support"
1551 conf.CONFIG_RESET('HAVE_CTDB_CHECK_CODE')
1552 if have_cluster_support:
1553 ok = conf.CHECK_CODE('''
1555 #include "replace.h"
1556 #include "system/wait.h"
1557 #include "system/network.h"
1558 #define private #error __USED_RESERVED_WORD_private__
1562 #include <ctdb_protocol.h>
1569 'HAVE_CTDB_CHECK_CODE',
1572 msg='Checking for header ctdb_protocol.h')
1574 CTDB_CFLAGS += ' -DHAVE_CTDB_PROTOCOL_H=1'
1576 conf.CONFIG_RESET('HAVE_CTDB_CHECK_CODE')
1577 conf.undefine('HAVE_CTDB_CHECK_CODE')
1578 if have_cluster_support:
1579 Logs.info("building with cluster support")
1580 conf.env['CTDB_CFLAGS'] = CTDB_CFLAGS
1581 conf.env['CTDB_INCLUDE'] = CTDB_INCLUDE
1583 if Options.options.with_cluster_support == False:
1584 Logs.info("building without cluster support (--without-cluster-support)")
1585 elif Options.options.with_cluster_support == True:
1586 Logs.error("Cluster support not available: " + ctdb_broken)
1587 conf.fatal("Cluster support not found, but --with-cluster-support was specified")
1589 Logs.info("building without cluster support: " + ctdb_broken)
1590 conf.env['CTDB_CFLAGS'] = ''
1593 conf.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }',
1594 'HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR',
1597 msg='Checking whether we can compile with __attribute__((destructor))')
1599 conf.CHECK_CODE('void seekdir(DIR *d, long loc) { return; }',
1600 'SEEKDIR_RETURNS_VOID',
1601 headers='sys/types.h dirent.h',
1602 msg='Checking whether seekdir returns void')
1604 if Options.options.with_profiling_data:
1605 conf.DEFINE('WITH_PROFILE', 1);
1607 if Options.options.with_pthreadpool:
1608 if conf.CONFIG_SET('HAVE_PTHREAD'):
1609 conf.DEFINE('WITH_PTHREADPOOL', '1')
1611 Logs.warn("pthreadpool support cannot be enabled when pthread support was not found")
1612 conf.undefine('WITH_PTHREADPOOL')
1614 if conf.CHECK_HEADERS('gpfs_gpl.h'):
1615 conf.DEFINE('HAVE_GPFS', '1')
1617 if (conf.CHECK_HEADERS('linux/ioctl.h sys/ioctl.h linux/fs.h') and
1618 conf.CHECK_DECLS('FS_IOC_GETFLAGS FS_COMPR_FL', headers='linux/fs.h')):
1619 conf.DEFINE('HAVE_LINUX_IOCTL', '1')
1621 conf.env['CCFLAGS_CEPHFS'] = "-D_FILE_OFFSET_BITS=64"
1622 if Options.options.libcephfs_dir:
1623 conf.env['CPPPATH_CEPHFS'] = Options.options.libcephfs_dir + '/include'
1624 conf.env['LIBPATH_CEPHFS'] = Options.options.libcephfs_dir + '/lib'
1626 if conf.CHECK_HEADERS('cephfs/libcephfs.h', False, False, 'cephfs') and conf.CHECK_LIB('cephfs'):
1627 conf.DEFINE('HAVE_CEPH', '1')
1629 if Options.options.with_glusterfs:
1630 conf.check_cfg(package='glusterfs-api', args='"glusterfs-api >= 4" --cflags --libs',
1631 msg='Checking for glusterfs-api >= 4', uselib_store="GFAPI")
1632 conf.CHECK_HEADERS('api/glfs.h', lib='gfapi')
1633 conf.CHECK_LIB('gfapi', shlib=True)
1635 if conf.CONFIG_SET('HAVE_API_GLFS_H'):
1636 conf.DEFINE('HAVE_GLUSTERFS', '1')
1638 conf.SET_TARGET_TYPE('gfapi', 'EMPTY')
1639 conf.undefine('HAVE_GLUSTERFS')
1641 conf.SET_TARGET_TYPE('gfapi', 'EMPTY')
1642 conf.undefine('HAVE_GLUSTERFS')
1644 if Options.options.enable_vxfs:
1645 conf.DEFINE('HAVE_VXFS', '1')
1647 if conf.check_cfg(package='dbus-1', args='--cflags --libs',
1648 msg='Checking for dbus', uselib_store="DBUS-1"):
1649 if (conf.CHECK_HEADERS('dbus/dbus.h', lib='dbus-1')
1650 and conf.CHECK_LIB('dbus-1', shlib=True)):
1651 conf.DEFINE('HAVE_DBUS', '1')
1653 conf.env.build_regedit = False
1654 if not Options.options.with_regedit == False:
1655 conf.PROCESS_SEPARATE_RULE('system_ncurses')
1656 if conf.CONFIG_SET('HAVE_NCURSES'):
1657 conf.env.build_regedit = True
1659 if conf.env.build_regedit:
1660 Logs.info("building regedit")
1662 if Options.options.with_regedit == False:
1663 Logs.info("not building regedit (--without-regedit)")
1664 elif Options.options.with_regedit == True:
1665 Logs.error("ncurses not available, cannot build regedit")
1666 conf.fatal("ncurses not available, but --with-regedit was specified")
1668 Logs.info("ncurses not available, not building regedit")
1670 conf.CHECK_FUNCS_IN('DES_pcbc_encrypt', 'crypto')
1671 if Options.options.with_fake_kaserver == True:
1672 conf.CHECK_HEADERS('afs/param.h afs/stds.h', together=True)
1673 conf.CHECK_HEADERS('afs/param.h afs/stds.h', together=True)
1674 if (conf.CONFIG_SET('HAVE_AFS_PARAM_H') and conf.CONFIG_SET('HAVE_AFS_STDS_H') and conf.CONFIG_SET('HAVE_DES_PCBC_ENCRYPT')):
1675 conf.DEFINE('WITH_FAKE_KASERVER', '1')
1677 conf.fatal('AFS headers not available, but --with-fake-kaserver was specified')
1681 default_static_modules.extend(TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
1682 auth_sam auth_unix auth_winbind auth_wbc
1683 auth_domain auth_builtin vfs_default
1684 nss_info_template idmap_tdb idmap_passdb
1687 default_shared_modules.extend(TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
1688 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
1689 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2
1690 auth_script vfs_readahead vfs_xattr_tdb vfs_posix_eadb
1691 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
1692 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
1693 vfs_media_harmony vfs_fruit
1696 vfs_crossrename vfs_linux_xfs_sgid
1697 vfs_time_audit idmap_autorid idmap_tdb2
1699 idmap_rid idmap_hash idmap_rfc2307'''))
1701 if Options.options.developer:
1702 default_static_modules.extend(TO_LIST('charset_weird'))
1703 default_shared_modules.extend(TO_LIST('perfcount_test'))
1704 default_shared_modules.extend(TO_LIST('vfs_skel_opaque vfs_skel_transparent vfs_shadow_copy_test'))
1705 default_shared_modules.extend(TO_LIST('auth_skel pdb_test'))
1707 if Options.options.enable_selftest or Options.options.developer:
1708 default_shared_modules.extend(TO_LIST('vfs_fake_acls vfs_nfs4acl_xattr'))
1711 if conf.CONFIG_SET('AD_DC_BUILD_IS_ENABLED'):
1712 default_static_modules.extend(TO_LIST('pdb_samba_dsdb auth_samba4 vfs_dfs_samba4'))
1714 if conf.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'):
1715 default_shared_modules.extend(TO_LIST('vfs_zfsacl'))
1717 if conf.CONFIG_SET('HAVE_DIRFD_DECL'):
1718 default_shared_modules.extend(TO_LIST('vfs_syncops vfs_dirsort'))
1720 if conf.CONFIG_SET('HAVE_STATFS_F_FSID'):
1721 default_shared_modules.extend(TO_LIST('vfs_fileid'))
1723 if (conf.CONFIG_SET('HAVE_STRUCT_MSGHDR_MSG_CONTROL') or conf.CONFIG_SET('HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS')):
1724 default_shared_modules.extend(TO_LIST('vfs_aio_fork'))
1726 if Options.options.with_pthreadpool:
1727 default_shared_modules.extend(TO_LIST('vfs_aio_pthread'))
1729 if conf.CONFIG_SET('HAVE_AIO'):
1730 default_shared_modules.extend(TO_LIST('vfs_aio_posix'))
1732 if conf.CONFIG_SET('HAVE_LINUX_KERNEL_AIO'):
1733 default_shared_modules.extend(TO_LIST('vfs_aio_linux'))
1735 if conf.CONFIG_SET('HAVE_LDAP'):
1736 default_static_modules.extend(TO_LIST('pdb_ldapsam idmap_ldap'))
1738 if conf.CONFIG_SET('DARWINOS'):
1739 default_static_modules.extend(TO_LIST('charset_macosxfs'))
1741 if conf.CONFIG_SET('HAVE_GPFS'):
1742 default_shared_modules.extend(TO_LIST('vfs_gpfs'))
1744 if conf.CONFIG_SET('HAVE_LINUX_IOCTL'):
1745 default_shared_modules.extend(TO_LIST('vfs_btrfs'))
1747 if conf.CONFIG_SET('SAMBA_FAM_LIBS'):
1748 default_shared_modules.extend(TO_LIST('vfs_notify_fam'))
1750 if conf.CONFIG_SET("HAVE_CEPH"):
1751 default_shared_modules.extend(TO_LIST('vfs_ceph'))
1753 if conf.CONFIG_SET('HAVE_GLUSTERFS'):
1754 default_shared_modules.extend(TO_LIST('vfs_glusterfs'))
1756 if conf.CONFIG_SET('HAVE_VXFS'):
1757 default_shared_modules.extend(TO_LIST('vfs_vxfs'))
1759 if conf.CONFIG_SET('HAVE_DBUS'):
1760 default_shared_modules.extend(TO_LIST('vfs_snapper'))
1762 explicit_shared_modules = TO_LIST(Options.options.shared_modules, delimiter=',')
1763 explicit_static_modules = TO_LIST(Options.options.static_modules, delimiter=',')
1765 def replace_list_item(lst, item, value):
1767 idx = lst.index(item)
1771 # PDB module file name should have the same name as module registers itself
1772 # In Autoconf build we export LDAP passdb module as ldapsam but WAF build
1773 # was always exporting pdb_ldap. In order to support existing packages
1774 # allow referring to pdb_ldapsam as pdb_ldap but use proper name internally.
1775 replace_list_item(explicit_shared_modules, 'pdb_ldap', 'pdb_ldapsam')
1776 replace_list_item(explicit_static_modules, 'pdb_ldap', 'pdb_ldapsam')
1778 final_static_modules = default_static_modules
1779 final_shared_modules = default_shared_modules
1781 for m in explicit_static_modules:
1782 if m in final_shared_modules:
1783 final_shared_modules.remove(m)
1784 final_static_modules.append(m)
1785 for m in explicit_shared_modules:
1786 if m in final_static_modules:
1787 final_static_modules.remove(m)
1788 final_shared_modules.append(m)
1790 if ("auth_domain" not in final_static_modules) or \
1791 ("auth_builtin" not in final_static_modules) or \
1792 ("auth_sam" not in final_static_modules) or \
1793 ("auth_winbind" not in final_static_modules):
1794 raise Utils.WafError('These auth modules MUST be configured as static modules: auth_domain, auth_builtin, auth_sam, auth_winbind')
1796 conf.env['static_modules'] = final_static_modules
1797 conf.env['shared_modules'] = final_shared_modules
1799 conf.DEFINE('STRING_STATIC_MODULES', ' '.join(final_static_modules), quote=True)
1804 prefixes = ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
1805 conf.env['MODULE_PREFIXES'] = prefixes
1807 for m in final_static_modules:
1809 if not p in static_list:
1811 static_list[p].append(m)
1812 for m in final_shared_modules:
1814 if not p in shared_list:
1816 shared_list[p].append(m)
1819 static_env = "%s_STATIC" % p.upper()
1820 shared_env = "%s_SHARED" % p.upper()
1821 conf.env[static_env] = []
1822 conf.env[shared_env] = []
1823 if p in static_list:
1825 for entry in static_list[p]:
1826 decl_list += "extern NTSTATUS %s_init(void); " % entry
1827 conf.env[static_env].append('%s' % entry)
1828 decl_list = decl_list.rstrip()
1829 conf.DEFINE('static_decl_%s' % p, decl_list)
1830 conf.DEFINE('static_init_%s' % p, '{ %s_init(); }' % '_init(); '.join(static_list[p]))
1832 conf.DEFINE('static_decl_%s' % p, '')
1833 conf.DEFINE('static_init_%s' % p, '{}')
1834 if p in shared_list:
1835 for entry in shared_list[p]:
1836 conf.DEFINE('%s_init' % entry, 'samba_init_module')
1837 conf.env[shared_env].append('%s' % entry)
1839 conf.SAMBA_CONFIG_H('include/config.h')
1842 "build 'tags' file using ctags"
1844 source_root = os.path.dirname(Utils.g_module.root_path)
1845 cmd = 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
1846 print("Running: %s" % cmd)