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-libcephfs',
56 help=("Directory under which libcephfs is installed"),
57 action
="store", dest
='libcephfs_dir', default
=None)
59 opt
.SAMBA3_ADD_OPTION('glusterfs', with_name
="enable", without_name
="disable", default
=True)
61 opt
.add_option('--enable-vxfs',
62 help=("enable support for VxFS (default=no)"),
63 action
="store_true", dest
='enable_vxfs', default
=False)
65 opt
.SAMBA3_ADD_OPTION('spotlight', with_name
="enable", without_name
="disable", default
=False)
68 from samba_utils
import TO_LIST
70 default_static_modules
= []
71 default_shared_modules
= []
73 if Options
.options
.developer
:
74 conf
.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
75 conf
.env
.developer
= True
77 if sys
.platform
!= 'openbsd5':
78 conf
.ADD_LDFLAGS("-Wl,--export-dynamic", testflags
=True)
80 conf
.CHECK_HEADERS('execinfo.h libexc.h libunwind.h netdb.h')
81 conf
.CHECK_HEADERS('linux/falloc.h linux/ioctl.h')
83 conf
.CHECK_FUNCS('getcwd fchown chmod fchmod mknod')
84 conf
.CHECK_FUNCS('strtol strchr strupr chflags')
85 conf
.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
86 conf
.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
87 conf
.CHECK_FUNCS('innetgr')
88 conf
.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
89 conf
.CHECK_FUNCS('setpriv setgidx setuidx setgroups syscall sysconf')
90 conf
.CHECK_FUNCS('atexit grantpt posix_openpt fallocate posix_fallocate')
91 conf
.CHECK_FUNCS('fseeko setluid')
92 conf
.CHECK_FUNCS('getpwnam', headers
='sys/types.h pwd.h')
93 conf
.CHECK_FUNCS('fdopendir')
94 conf
.CHECK_FUNCS('fstatat')
95 conf
.CHECK_FUNCS('getpwent_r setenv strcasecmp fcvt fcvtl')
96 conf
.CHECK_FUNCS('syslog vsyslog timegm setlocale')
97 conf
.CHECK_FUNCS_IN('nanosleep', 'rt')
98 conf
.CHECK_FUNCS('lutimes futimes utimensat futimens')
99 conf
.CHECK_FUNCS('mlock munlock mlockall munlockall')
100 conf
.CHECK_FUNCS('memalign posix_memalign hstrerror')
101 conf
.CHECK_FUNCS('shmget')
102 conf
.CHECK_FUNCS_IN('shm_open', 'rt', checklibc
=True)
103 #FIXME: for some reason this one still fails
104 conf
.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
105 conf
.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
106 conf
.CHECK_FUNCS_IN('dn_expand', 'inet')
107 conf
.CHECK_DECLS('fdatasync', reverse
=True)
108 conf
.CHECK_DECLS('readahead', reverse
=True, headers
='fcntl.h')
110 if conf
.CHECK_CODE('''
111 #if defined(HAVE_UNISTD_H)
114 long ret = splice(0,0,1,0,400,SPLICE_F_MOVE);
118 conf
.CHECK_DECLS('splice', reverse
=True, headers
='fcntl.h')
120 # Check for inotify support
121 conf
.CHECK_HEADERS('sys/inotify.h')
122 if "HAVE_SYS_INOTIFY_H" in conf
.env
:
123 conf
.DEFINE('HAVE_INOTIFY', 1)
125 # Check for kernel change notify support
128 #define F_NOTIFY 1026
131 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
132 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain
=False, execute
=True,
133 headers
='fcntl.h signal.h',
134 msg
="Checking for kernel change notify support")
136 # Check for Linux kernel oplocks
138 #include <sys/types.h>
142 #define F_NOTIFY 1026
145 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
146 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain
=False, execute
=True,
147 msg
="Checking for Linux kernel oplocks")
149 # Check for IRIX kernel oplock types
150 conf
.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
151 'HAVE_KERNEL_OPLOCKS_IRIX', headers
='fcntl.h',
152 msg
="Checking for IRIX kernel oplock types")
154 # Check for kernel share modes
156 #include <sys/types.h>
159 #include <sys/file.h>
165 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
166 }''', 'HAVE_KERNEL_SHARE_MODES', addmain
=False, execute
=True,
167 msg
="Checking for kernel share modes")
172 if Options
.options
.with_fam
is None:
174 elif Options
.options
.with_fam
== True:
177 if check_for_fam
and conf
.CHECK_HEADERS('fam.h'):
178 if conf
.CHECK_FUNCS_IN('FAMOpen2', 'fam'):
180 elif conf
.CHECK_FUNCS_IN('FAMOpen2', 'fam C'):
181 samba_fam_libs
='fam C'
182 conf
.CHECK_TYPE('enum FAMCodes', headers
='fam.h',
183 define
='HAVE_FAM_H_FAMCODES_TYPEDEF',
184 msg
='Checking whether enum FAMCodes is available')
185 conf
.CHECK_FUNCS_IN('FAMNoExists', 'fam')
187 if samba_fam_libs
is not None:
188 conf
.DEFINE('SAMBA_FAM_LIBS', samba_fam_libs
)
190 if Options
.options
.with_fam
== True:
191 conf
.fatal('FAM support requested, but no suitable FAM library found')
193 Logs
.warn('no suitable FAM library found')
195 # check for libarchive (tar command in smbclient)
196 # None means autodetect, True/False means enable/disable
197 conf
.env
['archive_lib'] = ''
198 if Options
.options
.with_libarchive
is not False:
199 libarchive_mandatory
= Options
.options
.with_libarchive
== True
200 Logs
.info("Checking for libarchive existence")
201 if conf
.CHECK_BUNDLED_SYSTEM('libarchive', minversion
='3.1.2'):
202 conf
.env
['archive_lib'] = 'libarchive'
203 elif libarchive_mandatory
:
204 conf
.fatal('libarchive support requested, but no suitable pkgconfig found')
206 # check for DMAPI libs
207 if Options
.options
.with_dmapi
== False:
211 Logs
.info("Checking for DMAPI library existence")
213 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'dm'):
214 samba_dmapi_lib
= 'dm'
216 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'jfsdm'):
217 samba_dmapi_lib
= 'jfsdm'
219 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'dmapi'):
220 samba_dmapi_lib
= 'dmapi'
222 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'xdsm'):
223 samba_dmapi_lib
= 'xdsm'
224 # only bother to test headers and compilation when a candidate
225 # library has been found
226 if samba_dmapi_lib
== '':
228 broken_dmapi
= "no suitable DMAPI library found"
231 conf
.CHECK_HEADERS('sys/dmi.h xfs/dmapi.h sys/jfsdmapi.h sys/dmapi.h dmapi.h')
233 #include <time.h> /* needed by Tru64 */
234 #include <sys/types.h> /* needed by AIX */
235 #ifdef HAVE_XFS_DMAPI_H
236 #include <xfs/dmapi.h>
237 #elif defined(HAVE_SYS_DMI_H)
239 #elif defined(HAVE_SYS_JFSDMAPI_H)
240 #include <sys/jfsdmapi.h>
241 #elif defined(HAVE_SYS_DMAPI_H)
242 #include <sys/dmapi.h>
243 #elif defined(HAVE_DMAPI_H)
247 /* This link test is designed to fail on IRI 6.4, but should
248 * succeed on Linux, IRIX 6.5 and AIX.
250 int main(int argc, char **argv)
253 dm_eventset_t events;
254 /* This doesn't take an argument on IRIX 6.4. */
255 dm_init_service(&version);
256 /* IRIX 6.4 expects events to be a pointer. */
257 DMEV_ISSET(DM_EVENT_READ, events);
262 'USEABLE_DMAPI_LIBRARY',
266 msg
='Checking whether DMAPI lib '+samba_dmapi_lib
+' can be used')
267 if not conf
.CONFIG_SET('USEABLE_DMAPI_LIBRARY'):
269 broken_dmapi
= "no usable DMAPI library found"
272 Logs
.info("Building with DMAPI support.")
273 conf
.env
['dmapi_lib'] = samba_dmapi_lib
274 conf
.DEFINE('USE_DMAPI', 1)
276 if Options
.options
.with_dmapi
== False:
277 Logs
.info("Building without DMAPI support (--without-dmapi).")
278 elif Options
.options
.with_dmapi
== True:
279 Logs
.error("DMAPI support not available: " + broken_dmapi
)
280 conf
.fatal('DMAPI support requested but not found.');
282 Logs
.warn("Building without DMAPI support: " + broken_dmapi
)
283 conf
.env
['dmapi_lib'] = ''
285 # Check for various members of the stat structure
286 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define
='HAVE_STAT_ST_BLOCKS',
287 headers
='sys/stat.h')
288 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define
='HAVE_STAT_ST_BLKSIZE',
289 headers
='sys/stat.h')
290 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_flags', define
='HAVE_STAT_ST_FLAGS',
291 headers
='sys/types.h sys/stat.h unistd.h')
293 if "HAVE_BLKCNT_T" in conf
.env
:
295 static int test_array[1 - 2 * !(((long int)(sizeof(blkcnt_t))) <= 4)];''',
297 headers
='replace.h sys/types.h sys/stat.h unistd.h',
298 msg
="Checking whether blkcnt_t is 32 bit")
300 # If sizeof is 4 it can't be 8
301 if "HAVE_BLKCNT_T" in conf
.env
:
302 if not conf
.CONFIG_SET('SIZEOF_BLKCNT_T_4'):
304 static int test_array[1 - 2 * !(((long int)(sizeof(blkcnt_t))) <= 8)];''',
306 headers
='replace.h sys/types.h sys/stat.h unistd.h',
307 msg
="Checking whether blkcnt_t is 64 bit")
309 # Check for POSIX capability support
310 conf
.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers
='sys/capability.h')
312 if "HAVE_SYS_CAPABILITY_H" in conf
.env
:
316 if (!(cap = cap_get_proc())) exit(1);
318 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
319 cap_set_proc(cap);''',
320 'HAVE_POSIX_CAPABILITIES', execute
=True, lib
="cap",
321 headers
='sys/capability.h',
322 msg
="Checking whether POSIX capabilities are available")
324 conf
.CHECK_CODE('int i;', 'BROKEN_NISPLUS_INCLUDE_FILES',
325 headers
='sys/types.h sys/acl.h rpcsvc/nis.h',
326 msg
="Checking for broken nisplus include files")
328 # Check if the compiler will optimize out functions
330 #include <sys/types.h>
331 size_t __unsafe_string_function_usage_here_size_t__(void);
332 #define CHECK_STRING_SIZE(d, len) (sizeof(d) != (len) && sizeof(d) != sizeof(char *))
333 static size_t push_string_check_fn(void *dest, const char *src, size_t dest_len) {
337 #define push_string_check(dest, src, dest_len) \
338 (CHECK_STRING_SIZE(dest, dest_len) \
339 ? __unsafe_string_function_usage_here_size_t__() \
340 : push_string_check_fn(dest, src, dest_len))
342 int main(int argc, char **argv) {
345 const char *foo = "bar";
346 p += 31 + push_string_check(p + 31, foo, sizeof(outbuf) - (p + 31 - outbuf));
348 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
351 msg
="Checking if the compiler will optimize out functions")
353 # Check if the compiler supports the LL suffix on long long integers
355 conf
.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL',
357 msg
="Checking for LL suffix on long long integers")
361 _chdir __chdir chflags chmod _close __close _closedir
362 __closedir crypt16 devnm dirfd
363 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
365 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
367 fsetxattr _fstat __fstat fsync
368 futimens futimes __fxstat getauthuid
369 getcwd _getcwd __getcwd getdents __getdents getdirentries
370 getgrent getgrnam getgrouplist getgrset getmntent getpagesize
371 getpwanam getpwent_r getrlimit
372 glob grantpt hstrerror initgroups innetgr
373 llseek _llseek __llseek _lseek __lseek
374 _lstat __lstat lutimes
375 __lxstat memalign mknod mlock mlockall munlock munlockall
376 _open __open _opendir __opendir
377 pathconf poll posix_fallocate
378 posix_memalign pread _pread __pread
379 pwrite _pwrite __pwrite
380 rdchk _read __read _readdir __readdir
382 select setenv setgidx setgroups setlocale setluid
383 setmntent setpgid setpriv setsid setuidx
386 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctl sysctlbyname
387 __sys_llseek syslog _telldir __telldir timegm
388 utimensat vsyslog _write __write __xstat
391 conf
.CHECK_SAMBA3_CHARSET() # see build/charset.py
393 # FIXME: these should be tests for features, but the old build system just
395 host_os
= sys
.platform
396 Logs
.info("building on %s" % host_os
)
398 # Python doesn't have case switches... :/
399 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
400 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
402 conf
.SET_TARGET_TYPE('sunacl', 'EMPTY')
403 if (host_os
.rfind('linux') > -1) or (host_os
.rfind('gnu') > -1) or (host_os
.rfind('qnx') > -1):
404 if host_os
.rfind('linux') > -1:
405 conf
.DEFINE('LINUX', '1')
406 elif host_os
.rfind('qnx') > -1:
407 conf
.DEFINE('QNX', '1')
408 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
409 elif (host_os
.rfind('darwin') > -1):
410 conf
.DEFINE('DARWINOS', 1)
411 conf
.ADD_CFLAGS('-fno-common')
412 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
413 elif (host_os
.rfind('freebsd') > -1):
414 conf
.DEFINE('FREEBSD', 1)
415 if conf
.CHECK_HEADERS('sunacl.h'):
416 conf
.DEFINE('HAVE_FREEBSD_SUNACL_H', '1')
417 conf
.CHECK_FUNCS_IN(['acl'], 'sunacl')
418 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
419 elif (host_os
.rfind('irix') > -1):
420 conf
.DEFINE('IRIX', 1)
421 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
422 elif (host_os
.rfind('aix') > -1):
423 conf
.DEFINE('AIX', 1)
424 conf
.DEFINE('STAT_ST_BLOCKSIZE', 'DEV_BSIZE')
425 elif (host_os
.rfind('hpux') > -1):
426 conf
.DEFINE('HPUX', 1)
427 conf
.DEFINE('STAT_ST_BLOCKSIZE', '8192')
428 elif (host_os
.rfind('osf') > -1):
429 conf
.DEFINE('OSF1', 1)
430 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
432 # FIXME: Add more checks here.
434 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
436 if Options
.options
.with_acl_support
:
437 if (host_os
.rfind('hpux') > -1):
438 Logs
.info('Using HPUX ACLs')
439 conf
.DEFINE('HAVE_HPUX_ACLS',1)
440 conf
.DEFINE('POSIX_ACL_NEEDS_MASK',1)
441 default_static_modules
.extend(TO_LIST('vfs_hpuxacl'))
442 elif (host_os
.rfind('aix') > -1):
443 Logs
.info('Using AIX ACLs')
444 conf
.DEFINE('HAVE_AIX_ACLS',1)
445 default_static_modules
.extend(TO_LIST('vfs_aixacl vfs_aixacl2'))
446 elif (host_os
.rfind('darwin') > -1):
447 Logs
.warn('ACLs on Darwin currently not supported')
448 conf
.fatal("ACL support not available on Darwin/MacOS. "
449 "Use --without-acl-support for building without "
451 "ACL support is required to change permissions "
452 "from Windows clients.")
454 conf
.CHECK_FUNCS_IN(['acl_get_file'], 'acl')
455 if conf
.CHECK_CODE('''
458 acl_entry_t *entry_p;
459 return acl_get_entry(acl, entry_id, entry_p);
462 headers
='sys/types.h sys/acl.h', link
=False,
463 msg
="Checking for POSIX ACL support") :
465 acl_permset_t permset_d;
467 return acl_get_perm_np(permset_d, perm);
469 'HAVE_ACL_GET_PERM_NP',
470 headers
='sys/types.h sys/acl.h', link
=True,
471 msg
="Checking whether acl_get_perm_np() is available")
472 default_static_modules
.extend(TO_LIST('vfs_posixacl'))
473 conf
.CHECK_VARIABLE('ACL_EVERYONE', headers
='sys/acl.h')
474 elif conf
.CHECK_FUNCS_IN(['facl'], 'sec'):
475 Logs
.info('Using solaris or UnixWare ACLs')
476 conf
.DEFINE('HAVE_SOLARIS_UNIXWARE_ACLS',1)
477 default_static_modules
.extend(TO_LIST('vfs_solarisacl'))
478 elif conf
.CHECK_FUNCS_IN(['acl_get_fd'], 'pacl'):
479 Logs
.info('Using Tru64 ACLs')
480 conf
.DEFINE('HAVE_TRU64_ACLS',1)
481 default_static_modules
.extend(TO_LIST('vfs_tru64acl'))
483 conf
.fatal("ACL support not found. Try installing libacl1-dev "
485 "Otherwise, use --without-acl-support to build "
486 "without ACL support. "
487 "ACL support is required to change permissions from "
490 if conf
.CHECK_FUNCS('dirfd'):
491 conf
.DEFINE('HAVE_DIRFD_DECL', 1)
493 conf
.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
494 'HAVE_STATFS_F_FSID',
495 msg
="vfs_fileid checking for statfs() and struct statfs.f_fsid",
496 headers
='sys/types.h sys/statfs.h',
499 if conf
.CONFIG_SET('HAVE_FALLOCATE'):
501 int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
502 'HAVE_LINUX_FALLOCATE',
503 msg
="Checking whether the Linux 'fallocate' function is available",
504 headers
='unistd.h sys/types.h fcntl.h linux/falloc.h')
506 int ret = fallocate(0, FALLOC_FL_PUNCH_HOLE, 0, 10);''',
507 'HAVE_FALLOC_FL_PUNCH_HOLE',
508 msg
="Checking whether Linux 'fallocate' supports hole-punching",
509 headers
='unistd.h sys/types.h fcntl.h linux/falloc.h')
512 int ret = lseek(0, 0, SEEK_HOLE);
513 ret = lseek(0, 0, SEEK_DATA);''',
514 'HAVE_LSEEK_HOLE_DATA',
515 msg
="Checking whether lseek supports hole/data seeking",
516 headers
='unistd.h sys/types.h')
519 ssize_t err = readahead(0,0,0x80000);''',
520 'HAVE_LINUX_READAHEAD',
521 msg
="Checking whether Linux readahead is available",
522 headers
='unistd.h fcntl.h')
523 conf
.CHECK_DECLS('readahead', headers
='fcntl.h', always
=True)
525 conf
.CHECK_CODE('int fd = openat(AT_FDCWD, ".", O_RDONLY);',
527 msg
='Checking for openat',
530 if Options
.options
.with_aio_support
:
531 conf
.CHECK_FUNCS_IN('aio_read', 'aio')
532 conf
.CHECK_FUNCS_IN('aio_read', 'rt')
533 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);',
535 msg
='Checking for asynchronous io support',
536 headers
='sys/types.h aio.h',
538 if conf
.CONFIG_SET('HAVE_AIO'):
539 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg
='Checking for aio_read', headers
='aio.h', lib
='aio rt')
540 conf
.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg
='Checking for aio_write', headers
='aio.h', lib
='aio rt')
541 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')
542 conf
.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg
='Checking for aio_return', headers
='aio.h', lib
='aio rt')
543 conf
.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg
='Checking for aio_error', headers
='aio.h', lib
='aio rt')
544 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')
545 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')
546 if not conf
.CONFIG_SET('HAVE_AIO'):
547 conf
.DEFINE('HAVE_NO_AIO', '1')
549 conf
.DEFINE('HAVE_NO_AIO', '1')
551 if host_os
.rfind('linux') > -1:
552 conf
.CHECK_FUNCS_IN('io_submit', 'aio')
554 struct io_event ioev;
560 fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
561 io_queue_init(128,&ctx);
562 io_prep_pwrite(ioc, 1, buf, 1, 0);
563 io_prep_pread(ioc, 1, buf, 1, 0);
564 io_set_eventfd(ioc, fd);
565 io_set_callback(ioc, (io_callback_t)(0));
566 io_submit(ctx, 1, &ioc);
567 io_getevents(ctx, 1, 1, &ioev, &ts);
569 'HAVE_LINUX_KERNEL_AIO',
570 msg
='Checking for linux kernel asynchronous io support',
571 headers
='unistd.h stdlib.h sys/types.h fcntl.h sys/eventfd.h libaio.h',
578 char control[CMSG_SPACE(sizeof(int))];
580 msg.msg_control = control_un.control;
581 msg.msg_controllen = sizeof(control_un.control);
583 'HAVE_STRUCT_MSGHDR_MSG_CONTROL',
584 msg
='Checking if we can use msg_control for passing file descriptors',
585 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
589 msg.msg_accrights = (caddr_t) &fd;
590 msg.msg_accrightslen = sizeof(fd);
592 'HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS',
593 msg
='Checking if we can use msg_accrights for passing file descriptors',
594 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
596 if Options
.options
.with_winbind
:
597 conf
.env
.build_winbind
= True
598 conf
.DEFINE('WITH_WINBIND', '1')
600 conf
.find_program('awk', var
='AWK')
602 conf
.CHECK_HEADERS('asm/types.h')
604 conf
.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
605 headers
='unistd.h sys/types.h',
606 msg
="Checking for major macro")
608 conf
.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
609 headers
='unistd.h sys/types.h',
610 msg
="Checking for minor macro")
612 conf
.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
613 headers
='unistd.h sys/types.h dirent.h',
614 define
='HAVE_DIRENT_D_OFF')
616 conf
.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent')
617 if conf
.CHECK_CFLAGS('-Werror-implicit-function-declaration'):
618 netgrent_cflags
= '-Werror-implicit-function-declaration'
621 conf
.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE',
622 msg
="Checking for setnetgrent prototype",
623 headers
='netdb.h netgroup.h',
624 cflags
=netgrent_cflags
)
625 conf
.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE',
626 msg
="Checking for getnetgrent prototype",
627 headers
='netdb.h netgroup.h',
628 cflags
=netgrent_cflags
)
629 conf
.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE',
630 msg
="Checking for endnetgrent prototype",
631 headers
='netdb.h netgroup.h',
632 cflags
=netgrent_cflags
)
636 if Options
.options
.with_cups
:
637 conf
.find_program('cups-config', var
='CUPS_CONFIG')
638 if conf
.env
.CUPS_CONFIG
:
639 # we would normally use --libs here, but cups-config incorrectly adds
640 # gssapi_krb5 and other libraries to its --libs output. That breaks the use
641 # of an in-tree heimdal kerberos
642 conf
.CHECK_CFG(path
=conf
.env
.CUPS_CONFIG
, args
="--cflags --ldflags",
643 package
="", uselib_store
="CUPS")
644 conf
.CHECK_HEADERS('cups/cups.h cups/language.h', lib
='cups')
645 conf
.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups')
646 if conf
.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf
.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
647 conf
.DEFINE('HAVE_CUPS', '1')
649 conf
.undefine('HAVE_CUPS')
650 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
652 # define an empty subsystem for cups, to allow it to be used as an empty dependency
653 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
655 if Options
.options
.with_iprint
:
656 if conf
.CONFIG_SET('HAVE_CUPS'):
657 conf
.DEFINE('HAVE_IPRINT', '1')
659 Logs
.warn("--enable-iprint=yes but cups support not sufficient")
660 if Options
.options
.with_syslog
:
661 conf
.DEFINE('WITH_SYSLOG', '1')
662 if Options
.options
.with_automount
:
663 conf
.DEFINE('WITH_AUTOMOUNT', '1')
666 if Options
.options
.with_ldap
:
667 conf
.CHECK_HEADERS('ldap.h lber.h ldap_pvt.h')
668 conf
.CHECK_TYPE('ber_tag_t', 'unsigned int', headers
='ldap.h lber.h')
669 conf
.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
670 conf
.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers
='ldap.h')
672 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
674 conf
.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
675 define
='HAVE_LBER_LOG_PRINT_FN', headers
='lber.h')
677 conf
.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', 'ldap')
678 conf
.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
680 # Check if ldap_set_rebind_proc() takes three arguments
681 if conf
.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
682 'LDAP_SET_REBIND_PROC_ARGS',
683 msg
="Checking whether ldap_set_rebind_proc takes 3 arguments",
684 headers
='ldap.h lber.h', link
=False):
685 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
687 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
689 # last but not least, if ldap_init() exists, we want to use ldap
690 if conf
.CONFIG_SET('HAVE_LDAP_INIT') and conf
.CONFIG_SET('HAVE_LDAP_H'):
691 conf
.DEFINE('HAVE_LDAP', '1')
692 conf
.DEFINE('LDAP_DEPRECATED', '1')
693 conf
.env
['HAVE_LDAP'] = '1'
694 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
695 # SASL wrapping hooks
696 if conf
.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
697 conf
.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
698 conf
.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
700 conf
.fatal("LDAP support not found. "
701 "Try installing libldap2-dev or openldap-devel. "
702 "Otherwise, use --without-ldap to build without "
704 "LDAP support is required for the LDAP passdb backend, "
705 "LDAP idmap backends and ADS. "
706 "ADS support improves communication with "
707 "Active Directory domain controllers.")
709 conf
.SET_TARGET_TYPE('ldap', 'EMPTY')
710 conf
.SET_TARGET_TYPE('lber', 'EMPTY')
712 if Options
.options
.with_ads
== False:
720 if not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and \
721 not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC'):
722 Logs
.warn("arcfour-hmac-md5 encryption type not found in -lkrb5")
724 if not conf
.CONFIG_SET('HAVE_KRB5_MK_REQ_EXTENDED'):
725 Logs
.warn("krb5_mk_req_extended not found in -lkrb5")
727 if not conf
.CONFIG_SET('HAVE_KRB5_GET_HOST_REALM'):
728 Logs
.warn("krb5_get_host_realm not found in -lkrb5")
730 if not conf
.CONFIG_SET('HAVE_KRB5_FREE_HOST_REALM'):
731 Logs
.warn("krb5_free_host_realm not found in -lkrb5")
733 if not conf
.CONFIG_SET('HAVE_KRB5_FWD_TGT_CREDS'):
734 Logs
.warn("krb5_fwd_tgt_creds found in -lkrb5")
736 if not conf
.CONFIG_SET('HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC'):
737 Logs
.warn("krb5_get_init_creds_opt_alloc not found in -lkrb5")
739 if not conf
.CONFIG_SET('KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT'):
740 Logs
.warn("krb5_get_init_creds_opt_free was not found or was too old in -lkrb5")
742 if not conf
.CONFIG_SET('HAVE_KRB5_GET_RENEWED_CREDS'):
743 Logs
.warn("krb5_get_renewed_creds not found in -lkrb5")
745 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL_COMPARE_ANY_REALM'):
746 Logs
.warn("krb5_principal_compare_any_realm not found in -lkrb5")
748 if not conf
.CONFIG_SET('HAVE_KRB5_C_STRING_TO_KEY') and \
749 not conf
.CONFIG_SET('HAVE_KRB5_STRING_TO_KEY_SALT'):
750 Logs
.warn("krb5_c_string_to_key not found in -lkrb5")
752 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL2SALT') and \
753 not conf
.CONFIG_SET('HAVE_KRB5_GET_PW_SALT'):
754 Logs
.warn("no CREATE_KEY_FUNCTIONS detected")
756 if not conf
.CONFIG_SET('HAVE_KRB5_GET_PERMITTED_ENCTYPES') and \
757 not conf
.CONFIG_SET('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES'):
758 Logs
.warn("no GET_ENCTYPES_FUNCTIONS detected")
760 if not conf
.CONFIG_SET('HAVE_KRB5_KT_FREE_ENTRY') and \
761 not conf
.CONFIG_SET('HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS'):
762 Logs
.warn("no KT_FREE_FUNCTION detected")
764 if not conf
.CONFIG_SET('HAVE_KRB5_C_VERIFY_CHECKSUM'):
765 Logs
.warn("krb5_c_verify_checksum_compare not found in -lkrb5")
768 # We don't actually use
769 # gsskrb5_extract_authz_data_from_sec_context, but it is a
770 # clue that this Heimdal, which does the PAC processing we
771 # need on the standard gss_inquire_sec_context_by_oid
772 if not conf
.CONFIG_SET('HAVE_GSS_GET_NAME_ATTRIBUTE') and \
773 not (conf
.CONFIG_SET('HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT') and \
774 conf
.CONFIG_SET('HAVE_GSS_INQUIRE_SEC_CONTEXT_BY_OID')):
775 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")
778 if not conf
.CONFIG_SET('HAVE_GSS_KRB5_EXPORT_LUCID_SEC_CONTEXT'):
779 Logs
.warn("need gss_krb5_export_lucid_sec_context for SPNEGO and gss_wrap support")
783 conf
.DEFINE('HAVE_KRB5', '1')
784 conf
.env
['HAVE_KRB5'] = '1'
786 conf
.undefine('HAVE_KRB5_H')
787 conf
.undefine('HAVE_GSSAPI_H')
788 conf
.undefine('HAVE_GSSAPI_GSSAPI_GENERIC_H')
789 conf
.undefine('HAVE_GSSAPI_GSSAPI_H')
792 if not conf
.CONFIG_SET('HAVE_LDAP'):
797 conf
.DEFINE('WITH_ADS', '1')
798 conf
.env
['HAVE_ADS'] = '1'
799 Logs
.info("Building with Active Directory support.")
800 elif Options
.options
.with_ads
== False:
801 Logs
.info("Building without Active Directory support (--without-ads).")
804 Logs
.warn("Active Directory support not available: krb5 libs don't have all required features")
806 Logs
.warn("Active Directory support not available: LDAP support is not available.")
807 if Options
.options
.with_ads
:
808 conf
.fatal("Active Directory support not found. Use --without-ads "
809 "for building without Active Directory support. "
810 "ADS support improves communication with "
811 "Active Directory domain controllers.")
813 # this is the auto-mode case
814 Logs
.warn("Building without Active Directory support.")
817 if Options
.options
.with_utmp
:
818 conf
.env
.with_utmp
= True
819 if not conf
.CHECK_HEADERS('utmp.h'): conf
.env
.with_utmp
= False
820 conf
.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
821 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers
='utmp.h',
822 define
='HAVE_UT_UT_NAME')
823 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers
='utmp.h',
824 define
='HAVE_UT_UT_USER')
825 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers
='utmp.h',
826 define
='HAVE_UT_UT_ID')
827 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers
='utmp.h',
828 define
='HAVE_UT_UT_HOST')
829 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers
='utmp.h',
830 define
='HAVE_UT_UT_TIME')
831 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers
='utmp.h',
832 define
='HAVE_UT_UT_TV')
833 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers
='utmp.h',
834 define
='HAVE_UT_UT_TYPE')
835 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers
='utmp.h',
836 define
='HAVE_UT_UT_PID')
837 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers
='utmp.h',
838 define
='HAVE_UT_UT_EXIT')
839 conf
.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers
='utmpx.h',
840 define
='HAVE_UX_UT_SYSLEN')
841 conf
.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
842 'PUTUTLINE_RETURNS_UTMP', headers
='utmp.h',
843 msg
="Checking whether pututline returns pointer")
844 conf
.CHECK_SIZEOF(['((struct utmp *)NULL)->ut_line'], headers
='utmp.h',
845 define
='SIZEOF_UTMP_UT_LINE', critical
=False)
846 if not conf
.CONFIG_SET('SIZEOF_UTMP_UT_LINE'):
847 conf
.env
.with_utmp
= False
848 elif int(conf
.env
.SIZEOF_UTMP_UT_LINE
) < 15:
849 conf
.env
.with_utmp
= False
850 if conf
.env
.with_utmp
:
851 conf
.DEFINE('WITH_UTMP', 1)
853 Logs
.warn("--with-utmp but utmp support not sufficient")
855 if Options
.options
.with_avahi
:
856 conf
.env
.with_avahi
= True
857 if not conf
.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf
.env
.with_avahi
= False
858 if not conf
.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf
.env
.with_avahi
= False
859 if not conf
.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf
.env
.with_avahi
= False
860 if conf
.env
.with_avahi
:
861 conf
.DEFINE('WITH_AVAHI_SUPPORT', 1)
863 conf
.SET_TARGET_TYPE('avahi-common', 'EMPTY')
864 conf
.SET_TARGET_TYPE('avahi-client', 'EMPTY')
866 if Options
.options
.with_iconv
:
867 conf
.env
.with_iconv
= True
868 if not conf
.CHECK_FUNCS_IN('iconv_open', 'iconv', headers
='iconv.h'):
869 conf
.env
.with_iconv
= False
870 if conf
.env
.with_iconv
:
871 conf
.DEFINE('HAVE_ICONV', 1)
873 if Options
.options
.with_pam
:
875 conf
.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
876 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
877 Logs
.warn("--with-pam=yes but pam_appl.h not found")
879 conf
.CHECK_FUNCS_IN('pam_get_data', 'pam')
880 conf
.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h')
881 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'):
882 Logs
.warn("--with-pam=yes but pam_modules.h not found")
884 conf
.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h')
885 conf
.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h')
886 conf
.CHECK_FUNCS_IN('pam_vsyslog', 'pam')
888 #if defined(HAVE_SECURITY_PAM_APPL_H)
889 #include <security/pam_appl.h>
890 #elif defined(HAVE_PAM_PAM_APPL_H)
891 #include <pam/pam_appl.h>
893 pam_set_item(0, PAM_RHOST, 0);
897 msg
="Checking whether PAM_RHOST is available");
899 #if defined(HAVE_SECURITY_PAM_APPL_H)
900 #include <security/pam_appl.h>
901 #elif defined(HAVE_PAM_PAM_APPL_H)
902 #include <pam/pam_appl.h>
904 pam_set_item(0, PAM_TTY, 0);
908 msg
="Checking whether PAM_TTY is available");
910 #if (!defined(LINUX))
912 #define PAM_EXTERN extern
913 #if defined(HAVE_SECURITY_PAM_APPL_H)
914 #include <security/pam_appl.h>
915 #elif defined(HAVE_PAM_PAM_APPL_H)
916 #include <pam/pam_appl.h>
921 #if defined(HAVE_SECURITY_PAM_MODULES_H)
922 #include <security/pam_modules.h>
923 #elif defined(HAVE_PAM_PAM_MODULES_H)
924 #include <pam/pam_modules.h>
927 #if defined(HAVE_SECURITY__PAM_MACROS_H)
928 #include <security/_pam_macros.h>
929 #elif defined(HAVE_PAM__PAM_MACROS_H)
930 #include <pam/_pam_macros.h>
933 #ifdef HAVE_SECURITY_PAM_EXT_H
934 #include <security/pam_ext.h>
937 int i; i = PAM_RADIO_TYPE;
939 'HAVE_PAM_RADIO_TYPE',
941 msg
="Checking whether PAM_RADIO_TYPE is available");
943 conf
.DEFINE('WITH_PAM', 1)
944 conf
.DEFINE('WITH_PAM_MODULES', 1)
946 if Options
.options
.with_pam_smbpass
:
947 conf
.env
.with_pam_smbpass
= True
952 # Ensure we select the correct set of system calls on Linux.
954 if (host_os
.rfind('linux') > -1):
956 #if defined(HAVE_UNISTD_H)
961 #include <sys/types.h>
964 #ifdef HAVE_SYS_PRIV_H
965 #include <sys/priv.h>
971 #if defined(HAVE_SYSCALL_H)
975 #if defined(HAVE_SYS_SYSCALL_H)
976 #include <sys/syscall.h>
979 syscall(SYS_setresuid32, -1, -1, -1);
980 syscall(SYS_setresgid32, -1, -1, -1);
981 syscall(SYS_setreuid32, -1, -1);
982 syscall(SYS_setregid32, -1, -1);
983 syscall(SYS_setuid32, -1);
984 syscall(SYS_setgid32, -1);
985 syscall(SYS_setgroups32, 0, NULL);
987 'USE_LINUX_32BIT_SYSCALLS',
988 msg
="Checking whether Linux should use 32-bit credential calls");
990 if (conf
.CONFIG_SET('USE_LINUX_32BIT_SYSCALLS')):
991 seteuid
= conf
.CHECK_CODE('''
992 #define AUTOCONF_TEST 1
993 #define USE_LINUX_THREAD_CREDENTIALS 1
994 #define USE_LINUX_32BIT_SYSCALLS 1
995 #include "../lib/util/setid.c"
996 #include "./lib/util_sec.c"
998 'USE_LINUX_THREAD_CREDENTIALS',
1001 msg
="Checking whether we can use Linux thread-specific credentials with 32-bit system calls")
1003 seteuid
= conf
.CHECK_CODE('''
1004 #define AUTOCONF_TEST 1
1005 #define USE_LINUX_THREAD_CREDENTIALS 1
1006 #include "../lib/util/setid.c"
1007 #include "./lib/util_sec.c"
1009 'USE_LINUX_THREAD_CREDENTIALS',
1012 msg
="Checking whether we can use Linux thread-specific credentials")
1014 seteuid
= conf
.CHECK_CODE('''
1015 #define AUTOCONF_TEST 1
1016 #define USE_SETREUID 1
1017 #include "../lib/util/setid.c"
1018 #include "./lib/util_sec.c"
1023 msg
="Checking whether setreuid is available")
1025 seteuid
= conf
.CHECK_CODE('''
1026 #define AUTOCONF_TEST 1
1027 #define USE_SETRESUID 1
1028 #include "../lib/util/setid.c"
1029 #include "./lib/util_sec.c"
1034 msg
="Checking whether setresuid is available")
1036 seteuid
= conf
.CHECK_CODE('''
1037 #define AUTOCONF_TEST 1
1038 #define USE_SETEUID 1
1039 #include "../lib/util/setid.c"
1040 #include "./lib/util_sec.c"
1045 msg
="Checking whether seteuid is available")
1047 seteuid
= conf
.CHECK_CODE('''
1048 #define AUTOCONF_TEST 1
1049 #define USE_SETUIDX 1
1050 #include "../lib/util/setid.c"
1051 #include "./lib/util_sec.c"
1057 msg
="Checking whether setuidx is available")
1058 if Options
.options
.with_dnsupdate
:
1059 if not conf
.CONFIG_SET('HAVE_KRB5'):
1060 Logs
.warn("--with-dnsupdate=yes but gssapi support not sufficient")
1062 conf
.DEFINE('WITH_DNS_UPDATES', 1)
1063 conf
.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
1064 if Options
.options
.developer
:
1065 if conf
.CONFIG_SET('HAVE_VALGRIND_H') or conf
.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'):
1066 conf
.DEFINE('VALGRIND', '1')
1068 if conf
.CHECK_CODE('''
1069 #include <bits/sockaddr.h>
1070 #include <linux/netlink.h>
1072 'HAVE_LINUX_NETLINK_H',
1073 msg
="Checking whether Linux netlink is available"):
1076 #include <bits/sockaddr.h>
1077 #include <linux/netlink.h>
1078 #include <linux/rtnetlink.h>
1080 'HAVE_LINUX_RTNETLINK_H',
1081 msg
='Checking whether Linux rtnetlink is available')
1084 #include "../tests/fcntl_lock.c"
1089 msg
='Checking whether fcntl locking is available')
1091 # glibc up to 2.3.6 had dangerously broken posix_fallocate(). DON'T USE IT.
1092 if not conf
.CHECK_CODE('''
1093 #define _XOPEN_SOURCE 600
1095 #if defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4))
1096 #error probably broken posix_fallocate
1099 '_HAVE_UNBROKEN_POSIX_FALLOCATE',
1100 msg
='Checking for broken posix_fallocate'):
1101 conf
.DEFINE('HAVE_BROKEN_POSIX_FALLOCATE', '1')
1104 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec',
1105 define
='HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') # Linux, Solaris
1106 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimensec',
1107 define
='HAVE_STRUCT_STAT_ST_MTIMENSEC') # BSD, if defined _POSIX_SOURCE
1108 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimespec.tv_nsec',
1109 define
='HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') # BSD, if not defined _POSIX_SOURCE
1110 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtime_n',
1111 define
='HAVE_STRUCT_STAT_ST_MTIME_N') # AIX
1112 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_umtime',
1113 define
='HAVE_STRUCT_STAT_ST_UMTIME') # Tru64
1114 if conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') or \
1115 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMENSEC') or \
1116 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') or \
1117 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIME_N') or \
1118 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_UMTIME'):
1119 conf
.DEFINE('HAVE_STAT_HIRES_TIMESTAMPS', '1')
1121 # recent FreeBSD, NetBSD have creation timestamps called birthtime:
1122 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtime',
1123 define
='HAVE_STRUCT_STAT_ST_BIRTHTIME')
1124 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimespec.tv_nsec',
1125 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC')
1126 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimensec',
1127 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC')
1130 ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
1132 'HAVE_POSIX_FADVISE',
1133 msg
='Checking whether posix_fadvise is available',
1134 headers
='unistd.h fcntl.h')
1136 for v
in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]:
1139 return sysconf(%s) == -1 ? 1 : 0;
1142 msg
='Checking whether sysconf(%s) is available' % v
)
1145 #include <sys/syscall.h>
1147 syscall(SYS_initgroups, 16, NULL, NULL, 0);
1149 'HAVE_DARWIN_INITGROUPS',
1150 msg
='Checking whether to use the Darwin-specific initgroups system call')
1152 conf
.CHECK_CODE('''struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''',
1154 headers
='sys/types.h utime.h',
1155 msg
='Checking whether struct utimbuf is available')
1157 if conf
.CHECK_CODE('''struct sigevent s;''',
1158 'HAVE_STRUCT_SIGEVENT',
1159 headers
='sys/types.h stdlib.h stddef.h signal.h',
1160 msg
='Checking whether we have the struct sigevent'):
1161 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sival_ptr',
1162 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR',
1163 headers
='signal.h');
1164 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sigval_ptr',
1165 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR',
1166 headers
='signal.h');
1168 if os
.path
.exists('/proc/sys/kernel/core_pattern'):
1169 conf
.DEFINE('HAVE_SYS_KERNEL_PROC_CORE_PATTERN', '1')
1171 if conf
.CHECK_CODE('''
1175 if (sizeof(time_t) == 8) {
1176 time_t max_time = 0x7fffffffffffffffll;
1177 tm = gmtime(&max_time);
1178 /* This should fail with 32-bit tm_year. */
1180 /* Max time_t that works with 32-bit int tm_year in struct tm. */
1181 max_time = 67768036191676799ll;
1182 tm = gmtime(&max_time);
1193 msg
="Checking for the maximum value of the 'time_t' type"):
1194 conf
.DEFINE('TIME_T_MAX', '67768036191676799ll')
1197 #if defined(HAVE_UNISTD_H)
1200 #include <sys/types.h>
1201 main() { dev_t dev = makedev(1,2); return 0; }
1205 msg
='Checking whether the macro for makedev is available')
1212 void exit_on_core(int ignored) {
1218 signal(SIGSEGV, exit_on_core);
1219 newpath = realpath("/tmp", NULL);
1220 exit((newpath != NULL) ? 0 : 1);
1223 'REALPATH_TAKES_NULL',
1226 msg
='Checking whether the realpath function allows a NULL argument')
1228 conf
.CHECK_CODE('''#include "../tests/ftruncate.c"''',
1229 'HAVE_FTRUNCATE_EXTEND',
1230 msg
='Checking for ftruncate extend',
1234 if Options
.options
.with_sendfile_support
:
1235 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):
1240 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1243 headers
='sys/sendfile.h',
1244 msg
='Checking for linux sendfile support')
1246 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1247 conf
.DEFINE('HAVE_SENDFILE', '1')
1248 conf
.DEFINE('LINUX_SENDFILE_API', '1')
1249 conf
.DEFINE('WITH_SENDFILE', '1')
1250 elif (host_os
.rfind('freebsd') > -1) or (host_os
.rfind('dragonfly') > -1):
1252 #include <sys/types.h>
1254 #include <sys/socket.h>
1255 #include <sys/uio.h>
1256 int fromfd, tofd, ret, total=0;
1257 off_t offset, nwritten;
1260 hdr.headers = &hdtrl;
1262 hdr.trailers = NULL;
1264 hdtrl.iov_base = NULL;
1266 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0)
1269 msg
='Checking for freebsd sendfile support')
1270 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1271 conf
.DEFINE('HAVE_SENDFILE', '1')
1272 conf
.DEFINE('FREEBSD_SENDFILE_API', '1')
1273 conf
.DEFINE('WITH_SENDFILE', '1')
1274 elif (host_os
.rfind('darwin') > -1):
1276 #include <sys/types.h>
1277 #include <sys/socket.h>
1278 #include <sys/uio.h>
1279 int fromfd, tofd, ret;
1280 off_t offset, nwritten;
1283 hdr.headers = &hdtrl;
1285 hdr.trailers = (void *)0;
1287 hdtrl.iov_base = (void *)0;
1289 ret = sendfile(fromfd, tofd, offset, &nwritten, &hdr, 0);
1292 msg
='Checking for darwin sendfile support')
1293 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1294 conf
.DEFINE('HAVE_SENDFILE', '1')
1295 conf
.DEFINE('DARWIN_SENDFILE_API', '1')
1296 conf
.DEFINE('WITH_SENDFILE', '1')
1297 elif (host_os
.rfind('hpux') > -1) or (host_os
.rfind('osf') > -1):
1299 #include <sys/socket.h>
1300 #include <sys/uio.h>
1303 struct iovec hdtrl[2];
1306 hdtrl[0].iov_base = 0;
1307 hdtrl[0].iov_len = 0;
1308 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
1311 msg
='Checking for osf/hpux sendfile support')
1312 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1313 conf
.DEFINE('HAVE_SENDFILE', '1')
1314 conf
.DEFINE('HPUX_SENDFILE_API', '1')
1315 conf
.DEFINE('WITH_SENDFILE', '1')
1316 elif (host_os
.rfind('solaris') > -1):
1317 conf
.CHECK_FUNCS_IN('sendfile', 'sendfilev')
1319 #include <sys/sendfile.h>,
1322 struct sendfilevec vec[2];
1326 vec[0].sfv_fd = SFV_FD_SELF;
1327 vec[0].sfv_flag = 0;
1331 vec[1].sfv_flag = 0;
1334 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
1337 msg
='Checking for solaris sendfilev support')
1338 if conf
.CONFIG_SET('_HAVE_SENDFILEV'):
1339 conf
.DEFINE('HAVE_SENDFILEV', '1')
1340 conf
.DEFINE('SOLARIS_SENDFILE_API', '1')
1341 conf
.DEFINE('WITH_SENDFILE', '1')
1342 elif (host_os
.rfind('aix') > -1):
1344 #include <sys/socket.h>
1347 struct sf_parms hdtrl;
1349 hdtrl.header_data = 0;
1350 hdtrl.header_length = 0;
1351 hdtrl.file_descriptor = fromfd;
1352 hdtrl.file_offset = 0;
1353 hdtrl.file_bytes = 0;
1354 hdtrl.trailer_data = 0;
1355 hdtrl.trailer_length = 0;
1356 nwritten = send_file(&tofd, &hdtrl, 0);
1359 msg
='Checking for AIX send_file support')
1360 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1361 conf
.DEFINE('HAVE_SENDFILE', '1')
1362 conf
.DEFINE('AIX_SENDFILE_API', '1')
1363 conf
.DEFINE('WITH_SENDFILE', '1')
1365 # Check for getcwd allowing a NULL arg.
1369 char *s = getcwd(NULL,0);
1370 exit(s != NULL ? 0 : 1);
1371 }''', 'GETCWD_TAKES_NULL', addmain
=False, execute
=True,
1372 msg
="getcwd takes a NULL argument")
1375 # UnixWare 7.x has its getspnam in -lgen
1376 conf
.CHECK_FUNCS_IN('getspnam', 'gen')
1377 conf
.CHECK_FUNCS_IN('getspnam', 'security')
1378 conf
.CHECK_FUNCS_IN('getspnam', 'sec')
1380 if Options
.options
.with_quotas
:
1381 # For quotas on Veritas VxFS filesystems
1382 conf
.CHECK_HEADERS('sys/fs/vx_quota.h')
1383 # For sys/quota.h and linux/quota.h
1384 conf
.CHECK_HEADERS('sys/quota.h')
1385 # For quotas on BSD systems
1386 conf
.CHECK_HEADERS('ufs/ufs/quota.h')
1387 # For quotas on Linux XFS filesystems
1388 if conf
.CHECK_HEADERS('xfs/xqm.h'):
1389 conf
.DEFINE('HAVE_XFS_QUOTAS', '1')
1393 #include "confdefs.h"
1394 #ifdef HAVE_SYS_TYPES_H
1395 #include <sys/types.h>
1397 #ifdef HAVE_ASM_TYPES_H
1398 #include <asm/types.h>
1400 #include <sys/quota.h>
1401 int i = Q_XGETQUOTA;''',
1402 define
='HAVE_XFS_QUOTAS',
1403 msg
='for XFS QUOTA in <sys/quota.h>',
1405 local_include
=False)
1407 # For IRIX like dqb_isoftlimit instead of dqb_fsoftlimit in struc dqblk
1408 conf
.CHECK_STRUCTURE_MEMBER('struct dqblk', 'dqb_fsoftlimit', define
='HAVE_DQB_FSOFTLIMIT',
1409 headers
='sys/quota.h')
1410 #darwin style quota bytecount
1411 conf
.CHECK_STRUCTURE_MEMBER('struct dqblk', 'dqb_curbytes', define
='HAVE_STRUCT_DQBLK_DQB_CURBYTES',
1412 headers
='sys/quota.h')
1413 if conf
.CHECK_HEADERS('rpcsvc/rquota.h'):
1414 conf
.DEFINE('HAVE_NFS_QUOTAS', '1')
1415 conf
.CHECK_STRUCTURE_MEMBER('struct getquota_rslt', 'getquota_rslt_u',
1416 define
='HAVE_GETQUOTA_RSLT_GETQUOTA_RSLT_U',
1417 headers
='rpcsvc/rquota.h')
1419 if (host_os
.rfind('linux') > -1):
1420 conf
.DEFINE('HAVE_QUOTACTL_LINUX', '1')
1421 elif not conf
.CONFIG_SET("HAVE_XFS_QUOTAS"):
1422 if not conf
.CHECK_CODE('''
1423 #define HAVE_QUOTACTL_4A 1
1424 #define AUTOCONF_TEST 1
1425 #include "../tests/sysquotas.c"
1427 cflags
=conf
.env
['WERROR_CFLAGS'],
1428 define
='HAVE_QUOTACTL_4A',
1429 msg
='for QUOTACTL_4A: long quotactl(int cmd, char *special, qid_t id, caddr_t addr)',
1434 #define HAVE_QUOTACTL_4B 1
1435 #define AUTOCONF_TEST 1
1436 #include "../tests/sysquotas.c"
1438 cflags
=conf
.env
['WERROR_CFLAGS'],
1439 define
='HAVE_QUOTACTL_4B',
1440 msg
='for QUOTACTL_4B: int quotactl(const char *path, int cmd, int id, char *addr)',
1445 clnt_create("", RQUOTAPROG, RQUOTAVERS, "udp");
1447 headers
="rpc/rpc.h rpc/types.h rpcsvc/rquota.h rpc/nettype.h rpc/xdr.h",
1448 define
='HAVE_NFS_QUOTAS',
1449 msg
='for NFS QUOTAS',
1451 local_include
=False)
1453 if conf
.CONFIG_SET('HAVE_QUOTACTL_LINUX') or \
1454 conf
.CONFIG_SET('HAVE_QUOTACTL_4A') or \
1455 conf
.CONFIG_SET('HAVE_QUOTACTL_4B') or \
1456 conf
.CONFIG_SET('HAVE_XFS_QUOTAS'):
1457 conf
.DEFINE('HAVE_SYS_QUOTAS', '1')
1458 conf
.DEFINE('WITH_QUOTAS', '1')
1461 # cluster support (CTDB)
1463 if not Options
.options
.with_cluster_support
:
1464 Logs
.info("building without cluster support (--without-cluster-support)")
1465 conf
.env
.with_ctdb
= False
1467 Logs
.info("building with cluster support")
1468 conf
.env
['CTDB_CFLAGS'] = '-DCLUSTER_SUPPORT=1'
1469 conf
.env
['CTDB_INCLUDE'] = conf
.srcdir
+ '/ctdb/include'
1470 conf
.env
.with_ctdb
= True
1472 conf
.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }',
1473 'HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR',
1476 msg
='Checking whether we can compile with __attribute__((destructor))')
1478 conf
.CHECK_CODE('void seekdir(DIR *d, long loc) { return; }',
1479 'SEEKDIR_RETURNS_VOID',
1480 headers
='sys/types.h dirent.h',
1481 msg
='Checking whether seekdir returns void')
1483 if Options
.options
.with_profiling_data
:
1484 conf
.DEFINE('WITH_PROFILE', 1);
1485 conf
.CHECK_FUNCS('getrusage', headers
="sys/time.h sys/resource.h")
1487 if Options
.options
.with_pthreadpool
:
1488 if conf
.CONFIG_SET('HAVE_PTHREAD'):
1489 conf
.DEFINE('WITH_PTHREADPOOL', '1')
1491 Logs
.warn("pthreadpool support cannot be enabled when pthread support was not found")
1492 conf
.undefine('WITH_PTHREADPOOL')
1494 if (conf
.CHECK_HEADERS('linux/ioctl.h sys/ioctl.h linux/fs.h') and
1495 conf
.CHECK_DECLS('FS_IOC_GETFLAGS FS_COMPR_FL', headers
='linux/fs.h')):
1496 conf
.DEFINE('HAVE_LINUX_IOCTL', '1')
1498 conf
.env
['CCFLAGS_CEPHFS'] = "-D_FILE_OFFSET_BITS=64"
1499 if Options
.options
.libcephfs_dir
:
1500 conf
.env
['CPPPATH_CEPHFS'] = Options
.options
.libcephfs_dir
+ '/include'
1501 conf
.env
['LIBPATH_CEPHFS'] = Options
.options
.libcephfs_dir
+ '/lib'
1503 if conf
.CHECK_HEADERS('cephfs/libcephfs.h', False, False, 'cephfs') and conf
.CHECK_LIB('cephfs'):
1504 conf
.DEFINE('HAVE_CEPH', '1')
1506 if Options
.options
.with_glusterfs
:
1507 conf
.CHECK_CFG(package
='glusterfs-api', args
='"glusterfs-api >= 4" --cflags --libs',
1508 msg
='Checking for glusterfs-api >= 4', uselib_store
="GFAPI")
1509 conf
.CHECK_HEADERS('api/glfs.h', lib
='gfapi')
1510 conf
.CHECK_LIB('gfapi', shlib
=True)
1512 if conf
.CONFIG_SET('HAVE_API_GLFS_H'):
1513 conf
.DEFINE('HAVE_GLUSTERFS', '1')
1515 conf
.SET_TARGET_TYPE('gfapi', 'EMPTY')
1516 conf
.undefine('HAVE_GLUSTERFS')
1518 conf
.SET_TARGET_TYPE('gfapi', 'EMPTY')
1519 conf
.undefine('HAVE_GLUSTERFS')
1521 if Options
.options
.enable_vxfs
:
1522 conf
.DEFINE('HAVE_VXFS', '1')
1524 if conf
.CHECK_CFG(package
='dbus-1', args
='--cflags --libs',
1525 msg
='Checking for dbus', uselib_store
="DBUS-1"):
1526 if (conf
.CHECK_HEADERS('dbus/dbus.h', lib
='dbus-1')
1527 and conf
.CHECK_LIB('dbus-1', shlib
=True)):
1528 conf
.DEFINE('HAVE_DBUS', '1')
1530 conf
.env
.build_regedit
= False
1531 if not Options
.options
.with_regedit
== False:
1532 conf
.PROCESS_SEPARATE_RULE('system_ncurses')
1533 if conf
.CONFIG_SET('HAVE_NCURSES'):
1534 conf
.env
.build_regedit
= True
1536 if conf
.env
.build_regedit
:
1537 Logs
.info("building regedit")
1539 if Options
.options
.with_regedit
== False:
1540 Logs
.info("not building regedit (--without-regedit)")
1541 elif Options
.options
.with_regedit
== True:
1542 Logs
.error("ncurses not available, cannot build regedit")
1543 conf
.fatal("ncurses not available, but --with-regedit was specified")
1545 Logs
.info("ncurses not available, not building regedit")
1547 conf
.CHECK_FUNCS_IN('DES_pcbc_encrypt', 'crypto')
1548 if Options
.options
.with_fake_kaserver
== True:
1549 conf
.CHECK_HEADERS('afs/param.h afs/stds.h', together
=True)
1550 conf
.CHECK_HEADERS('afs/param.h afs/stds.h', together
=True)
1551 if (conf
.CONFIG_SET('HAVE_AFS_PARAM_H') and conf
.CONFIG_SET('HAVE_AFS_STDS_H') and conf
.CONFIG_SET('HAVE_DES_PCBC_ENCRYPT')):
1552 conf
.DEFINE('WITH_FAKE_KASERVER', '1')
1554 conf
.fatal('AFS headers not available, but --with-fake-kaserver was specified')
1556 conf
.env
['libtracker']=''
1557 conf
.env
.with_spotlight
= False
1558 if Options
.options
.with_spotlight
:
1559 versions
= ['1.0', '0.16', '0.14']
1560 for version
in versions
:
1561 testlib
= 'tracker-sparql-' + version
1562 if conf
.check_cfg(package
=testlib
,
1563 args
='--cflags --libs',
1565 conf
.SET_TARGET_TYPE(testlib
, 'SYSLIB')
1566 conf
.env
['libtracker'] = testlib
1567 conf
.env
.with_spotlight
= True
1568 conf
.DEFINE('WITH_SPOTLIGHT', '1')
1571 if not conf
.env
.with_spotlight
:
1572 conf
.fatal("Spotlight support requested but tracker-sparql library missing")
1573 Logs
.info("building with Spotlight support")
1575 default_static_modules
.extend(TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
1576 auth_sam auth_unix auth_winbind auth_wbc
1577 auth_domain auth_builtin vfs_default
1578 nss_info_template idmap_tdb idmap_passdb
1581 default_shared_modules
.extend(TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
1582 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
1583 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2
1584 auth_script vfs_readahead vfs_xattr_tdb vfs_posix_eadb
1585 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
1586 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
1587 vfs_media_harmony vfs_unityed_media vfs_fruit vfs_shell_snap
1590 vfs_crossrename vfs_linux_xfs_sgid
1591 vfs_time_audit idmap_autorid idmap_tdb2
1594 idmap_rid idmap_hash idmap_rfc2307'''))
1596 if Options
.options
.developer
:
1597 default_static_modules
.extend(TO_LIST('charset_weird'))
1598 default_shared_modules
.extend(TO_LIST('perfcount_test'))
1599 default_shared_modules
.extend(TO_LIST('vfs_skel_opaque vfs_skel_transparent vfs_shadow_copy_test'))
1600 default_shared_modules
.extend(TO_LIST('auth_skel pdb_test'))
1602 if Options
.options
.enable_selftest
or Options
.options
.developer
:
1603 default_shared_modules
.extend(TO_LIST('vfs_fake_acls vfs_nfs4acl_xattr'))
1606 if conf
.CONFIG_SET('AD_DC_BUILD_IS_ENABLED'):
1607 default_static_modules
.extend(TO_LIST('pdb_samba_dsdb auth_samba4 vfs_dfs_samba4'))
1609 if conf
.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'):
1610 default_shared_modules
.extend(TO_LIST('vfs_zfsacl'))
1612 if conf
.CONFIG_SET('HAVE_DIRFD_DECL'):
1613 default_shared_modules
.extend(TO_LIST('vfs_syncops vfs_dirsort'))
1615 if conf
.CONFIG_SET('HAVE_STATFS_F_FSID'):
1616 default_shared_modules
.extend(TO_LIST('vfs_fileid'))
1618 if (conf
.CONFIG_SET('HAVE_STRUCT_MSGHDR_MSG_CONTROL') or conf
.CONFIG_SET('HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS')):
1619 default_shared_modules
.extend(TO_LIST('vfs_aio_fork'))
1621 if Options
.options
.with_pthreadpool
:
1622 default_shared_modules
.extend(TO_LIST('vfs_aio_pthread'))
1624 if conf
.CONFIG_SET('HAVE_AIO'):
1625 default_shared_modules
.extend(TO_LIST('vfs_aio_posix'))
1627 if conf
.CONFIG_SET('HAVE_LINUX_KERNEL_AIO'):
1628 default_shared_modules
.extend(TO_LIST('vfs_aio_linux'))
1630 if conf
.CONFIG_SET('HAVE_LDAP'):
1631 default_static_modules
.extend(TO_LIST('pdb_ldapsam idmap_ldap'))
1633 if conf
.CONFIG_SET('DARWINOS'):
1634 default_static_modules
.extend(TO_LIST('charset_macosxfs'))
1636 if conf
.CONFIG_SET('HAVE_GPFS'):
1637 default_shared_modules
.extend(TO_LIST('vfs_gpfs'))
1639 if (conf
.CONFIG_SET('HAVE_LINUX_IOCTL')
1640 and conf
.CONFIG_SET('HAVE_BASENAME') and conf
.CONFIG_SET('HAVE_DIRNAME')):
1641 default_shared_modules
.extend(TO_LIST('vfs_btrfs'))
1643 if conf
.CONFIG_SET('SAMBA_FAM_LIBS'):
1644 default_shared_modules
.extend(TO_LIST('vfs_notify_fam'))
1646 if conf
.CONFIG_SET("HAVE_CEPH"):
1647 default_shared_modules
.extend(TO_LIST('vfs_ceph'))
1649 if conf
.CONFIG_SET('HAVE_GLUSTERFS'):
1650 default_shared_modules
.extend(TO_LIST('vfs_glusterfs'))
1652 if conf
.CONFIG_SET('HAVE_VXFS'):
1653 default_shared_modules
.extend(TO_LIST('vfs_vxfs'))
1655 if conf
.CONFIG_SET('HAVE_DBUS'):
1656 default_shared_modules
.extend(TO_LIST('vfs_snapper'))
1658 explicit_shared_modules
= TO_LIST(Options
.options
.shared_modules
, delimiter
=',')
1659 explicit_static_modules
= TO_LIST(Options
.options
.static_modules
, delimiter
=',')
1661 def replace_list_item(lst
, item
, value
):
1663 idx
= lst
.index(item
)
1667 # PDB module file name should have the same name as module registers itself
1668 # In Autoconf build we export LDAP passdb module as ldapsam but WAF build
1669 # was always exporting pdb_ldap. In order to support existing packages
1670 # allow referring to pdb_ldapsam as pdb_ldap but use proper name internally.
1671 replace_list_item(explicit_shared_modules
, 'pdb_ldap', 'pdb_ldapsam')
1672 replace_list_item(explicit_static_modules
, 'pdb_ldap', 'pdb_ldapsam')
1674 final_static_modules
= default_static_modules
1675 final_shared_modules
= default_shared_modules
1677 for m
in explicit_static_modules
:
1678 if m
in final_shared_modules
:
1679 final_shared_modules
.remove(m
)
1680 final_static_modules
.append(m
)
1681 for m
in explicit_shared_modules
:
1682 if m
in final_static_modules
:
1683 final_static_modules
.remove(m
)
1684 final_shared_modules
.append(m
)
1686 if ("auth_domain" not in final_static_modules
) or \
1687 ("auth_builtin" not in final_static_modules
) or \
1688 ("auth_sam" not in final_static_modules
) or \
1689 ("auth_winbind" not in final_static_modules
):
1690 raise Utils
.WafError('These auth modules MUST be configured as static modules: auth_domain, auth_builtin, auth_sam, auth_winbind')
1692 conf
.env
['static_modules'] = final_static_modules
1693 conf
.env
['shared_modules'] = final_shared_modules
1695 conf
.DEFINE('STRING_STATIC_MODULES', ' '.join(final_static_modules
), quote
=True)
1700 prefixes
= ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
1701 conf
.env
['MODULE_PREFIXES'] = prefixes
1703 for m
in final_static_modules
:
1705 if not p
in static_list
:
1707 static_list
[p
].append(m
)
1708 for m
in final_shared_modules
:
1710 if not p
in shared_list
:
1712 shared_list
[p
].append(m
)
1715 static_env
= "%s_STATIC" % p
.upper()
1716 shared_env
= "%s_SHARED" % p
.upper()
1717 conf
.env
[static_env
] = []
1718 conf
.env
[shared_env
] = []
1719 if p
in static_list
:
1721 for entry
in static_list
[p
]:
1722 decl_list
+= "extern NTSTATUS %s_init(void); " % entry
1723 conf
.env
[static_env
].append('%s' % entry
)
1724 decl_list
= decl_list
.rstrip()
1725 conf
.DEFINE('static_decl_%s' % p
, decl_list
)
1726 conf
.DEFINE('static_init_%s' % p
, '{ %s_init(); }' % '_init(); '.join(static_list
[p
]))
1728 conf
.DEFINE('static_decl_%s' % p
, '')
1729 conf
.DEFINE('static_init_%s' % p
, '{}')
1730 if p
in shared_list
:
1731 for entry
in shared_list
[p
]:
1732 conf
.DEFINE('%s_init' % entry
, 'samba_init_module')
1733 conf
.env
[shared_env
].append('%s' % entry
)
1735 conf
.SAMBA_CONFIG_H('include/config.h')
1738 "build 'tags' file using ctags"
1740 source_root
= os
.path
.dirname(Utils
.g_module
.root_path
)
1741 cmd
= 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
1742 print("Running: %s" % cmd
)