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)
67 from samba_utils
import TO_LIST
69 default_static_modules
= []
70 default_shared_modules
= []
72 if Options
.options
.developer
:
73 conf
.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
74 conf
.env
.developer
= True
76 if sys
.platform
!= 'openbsd5':
77 conf
.ADD_LDFLAGS("-Wl,--export-dynamic", testflags
=True)
79 conf
.CHECK_HEADERS('execinfo.h libexc.h libunwind.h netdb.h')
80 conf
.CHECK_HEADERS('linux/falloc.h linux/ioctl.h')
82 conf
.CHECK_FUNCS('getcwd fchown chmod fchmod mknod')
83 conf
.CHECK_FUNCS('strtol strchr strupr chflags')
84 conf
.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
85 conf
.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
86 conf
.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr')
87 conf
.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
88 conf
.CHECK_FUNCS('setpriv setgidx setuidx setgroups syscall sysconf')
89 conf
.CHECK_FUNCS('atexit grantpt posix_openpt fallocate posix_fallocate')
90 conf
.CHECK_FUNCS('fseeko setluid')
91 conf
.CHECK_FUNCS('getpwnam', headers
='sys/types.h pwd.h')
92 conf
.CHECK_FUNCS('fdopendir')
93 conf
.CHECK_FUNCS('fstatat')
94 conf
.CHECK_FUNCS('getpwent_r setenv strcasecmp fcvt fcvtl')
95 conf
.CHECK_FUNCS('syslog vsyslog timegm setlocale')
96 conf
.CHECK_FUNCS_IN('nanosleep', 'rt')
97 conf
.CHECK_FUNCS('lutimes futimes utimensat futimens')
98 conf
.CHECK_FUNCS('mlock munlock mlockall munlockall')
99 conf
.CHECK_FUNCS('memalign posix_memalign hstrerror')
100 conf
.CHECK_FUNCS('shmget')
101 conf
.CHECK_FUNCS_IN('shm_open', 'rt', checklibc
=True)
102 #FIXME: for some reason this one still fails
103 conf
.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
104 conf
.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
105 conf
.CHECK_FUNCS_IN('dn_expand', 'inet')
106 conf
.CHECK_DECLS('fdatasync', reverse
=True)
107 conf
.CHECK_DECLS('readahead', reverse
=True, headers
='fcntl.h')
109 if conf
.CHECK_CODE('''
110 #if defined(HAVE_UNISTD_H)
113 long ret = splice(0,0,1,0,400,SPLICE_F_MOVE);
117 conf
.CHECK_DECLS('splice', reverse
=True, headers
='fcntl.h')
119 # Check for inotify support
120 conf
.CHECK_HEADERS('sys/inotify.h')
121 if "HAVE_SYS_INOTIFY_H" in conf
.env
:
122 conf
.DEFINE('HAVE_INOTIFY', 1)
124 # Check for kernel change notify support
127 #define F_NOTIFY 1026
130 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
131 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain
=False, execute
=True,
132 headers
='fcntl.h signal.h',
133 msg
="Checking for kernel change notify support")
135 # Check for Linux kernel oplocks
137 #include <sys/types.h>
141 #define F_NOTIFY 1026
144 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
145 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain
=False, execute
=True,
146 msg
="Checking for Linux kernel oplocks")
148 # Check for IRIX kernel oplock types
149 conf
.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
150 'HAVE_KERNEL_OPLOCKS_IRIX', headers
='fcntl.h',
151 msg
="Checking for IRIX kernel oplock types")
153 # Check for kernel share modes
155 #include <sys/types.h>
158 #include <sys/file.h>
164 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
165 }''', 'HAVE_KERNEL_SHARE_MODES', addmain
=False, execute
=True,
166 msg
="Checking for kernel share modes")
171 if Options
.options
.with_fam
is None:
173 elif Options
.options
.with_fam
== True:
176 if check_for_fam
and conf
.CHECK_HEADERS('fam.h'):
177 if conf
.CHECK_FUNCS_IN('FAMOpen2', 'fam'):
179 elif conf
.CHECK_FUNCS_IN('FAMOpen2', 'fam C'):
180 samba_fam_libs
='fam C'
181 conf
.CHECK_TYPE('enum FAMCodes', headers
='fam.h',
182 define
='HAVE_FAM_H_FAMCODES_TYPEDEF',
183 msg
='Checking whether enum FAMCodes is available')
184 conf
.CHECK_FUNCS_IN('FAMNoExists', 'fam')
186 if samba_fam_libs
is not None:
187 conf
.DEFINE('SAMBA_FAM_LIBS', samba_fam_libs
)
189 if Options
.options
.with_fam
== True:
190 conf
.fatal('FAM support requested, but no suitable FAM library found')
192 Logs
.warn('no suitable FAM library found')
194 # check for libarchive (tar command in smbclient)
195 # None means autodetect, True/False means enable/disable
196 conf
.env
['archive_lib'] = ''
197 if Options
.options
.with_libarchive
is not False:
198 libarchive_mandatory
= Options
.options
.with_libarchive
== True
199 Logs
.info("Checking for libarchive existence")
200 if conf
.CHECK_BUNDLED_SYSTEM('libarchive', minversion
='3.1.2'):
201 conf
.env
['archive_lib'] = 'libarchive'
202 elif libarchive_mandatory
:
203 conf
.fatal('libarchive support requested, but no suitable pkgconfig found')
205 # check for DMAPI libs
206 if Options
.options
.with_dmapi
== False:
210 Logs
.info("Checking for DMAPI library existence")
212 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'dm'):
213 samba_dmapi_lib
= 'dm'
215 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'jfsdm'):
216 samba_dmapi_lib
= 'jfsdm'
218 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'dmapi'):
219 samba_dmapi_lib
= 'dmapi'
221 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'xdsm'):
222 samba_dmapi_lib
= 'xdsm'
223 # only bother to test headers and compilation when a candidate
224 # library has been found
225 if samba_dmapi_lib
== '':
227 broken_dmapi
= "no suitable DMAPI library found"
230 conf
.CHECK_HEADERS('sys/dmi.h xfs/dmapi.h sys/jfsdmapi.h sys/dmapi.h dmapi.h')
232 #include <time.h> /* needed by Tru64 */
233 #include <sys/types.h> /* needed by AIX */
234 #ifdef HAVE_XFS_DMAPI_H
235 #include <xfs/dmapi.h>
236 #elif defined(HAVE_SYS_DMI_H)
238 #elif defined(HAVE_SYS_JFSDMAPI_H)
239 #include <sys/jfsdmapi.h>
240 #elif defined(HAVE_SYS_DMAPI_H)
241 #include <sys/dmapi.h>
242 #elif defined(HAVE_DMAPI_H)
246 /* This link test is designed to fail on IRI 6.4, but should
247 * succeed on Linux, IRIX 6.5 and AIX.
249 int main(int argc, char **argv)
252 dm_eventset_t events;
253 /* This doesn't take an argument on IRIX 6.4. */
254 dm_init_service(&version);
255 /* IRIX 6.4 expects events to be a pointer. */
256 DMEV_ISSET(DM_EVENT_READ, events);
261 'USEABLE_DMAPI_LIBRARY',
265 msg
='Checking whether DMAPI lib '+samba_dmapi_lib
+' can be used')
266 if not conf
.CONFIG_SET('USEABLE_DMAPI_LIBRARY'):
268 broken_dmapi
= "no usable DMAPI library found"
271 Logs
.info("Building with DMAPI support.")
272 conf
.env
['dmapi_lib'] = samba_dmapi_lib
273 conf
.DEFINE('USE_DMAPI', 1)
275 if Options
.options
.with_dmapi
== False:
276 Logs
.info("Building without DMAPI support (--without-dmapi).")
277 elif Options
.options
.with_dmapi
== True:
278 Logs
.error("DMAPI support not available: " + broken_dmapi
)
279 conf
.fatal('DMAPI support requested but not found.');
281 Logs
.warn("Building without DMAPI support: " + broken_dmapi
)
282 conf
.env
['dmapi_lib'] = ''
284 # Check for various members of the stat structure
285 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define
='HAVE_STAT_ST_BLOCKS',
286 headers
='sys/stat.h')
287 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define
='HAVE_STAT_ST_BLKSIZE',
288 headers
='sys/stat.h')
289 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_flags', define
='HAVE_STAT_ST_FLAGS',
290 headers
='sys/types.h sys/stat.h unistd.h')
292 if "HAVE_BLKCNT_T" in conf
.env
:
294 static int test_array[1 - 2 * !(((long int)(sizeof(blkcnt_t))) <= 4)];''',
296 headers
='replace.h sys/types.h sys/stat.h unistd.h',
297 msg
="Checking whether blkcnt_t is 32 bit")
299 # If sizeof is 4 it can't be 8
300 if "HAVE_BLKCNT_T" in conf
.env
:
301 if not conf
.CONFIG_SET('SIZEOF_BLKCNT_T_4'):
303 static int test_array[1 - 2 * !(((long int)(sizeof(blkcnt_t))) <= 8)];''',
305 headers
='replace.h sys/types.h sys/stat.h unistd.h',
306 msg
="Checking whether blkcnt_t is 64 bit")
308 # Check for POSIX capability support
309 conf
.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers
='sys/capability.h')
311 if "HAVE_SYS_CAPABILITY_H" in conf
.env
:
315 if (!(cap = cap_get_proc())) exit(1);
317 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
318 cap_set_proc(cap);''',
319 'HAVE_POSIX_CAPABILITIES', execute
=True, lib
="cap",
320 headers
='sys/capability.h',
321 msg
="Checking whether POSIX capabilities are available")
323 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
324 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
326 if conf
.CONFIG_SET("HAVE_RPC_RPC_H"):
327 conf
.CHECK_TYPE('int16', headers
='rpc/rpc.h',
328 define
='HAVE_INT16_FROM_RPC_RPC_H',
329 msg
="Checking for int16 typedef included by rpc/rpc.h")
330 conf
.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
331 headers
='sys/types.h rpc/rpc.h',
332 msg
="Checking for uint16 typedef included by rpc/rpc.h")
333 conf
.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
334 headers
='sys/types.h rpc/rpc.h',
335 msg
="Checking for int32 typedef included by rpc/rpc.h")
336 conf
.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
337 headers
='sys/types.h rpc/rpc.h',
338 msg
="Checking for uint32 typedef included by rpc/rpc.h")
339 conf
.CHECK_CODE('int i;', 'BROKEN_NISPLUS_INCLUDE_FILES',
340 headers
='sys/types.h sys/acl.h rpcsvc/nis.h',
341 msg
="Checking for broken nisplus include files")
343 # Check if the compiler will optimize out functions
345 #include <sys/types.h>
346 size_t __unsafe_string_function_usage_here_size_t__(void);
347 #define CHECK_STRING_SIZE(d, len) (sizeof(d) != (len) && sizeof(d) != sizeof(char *))
348 static size_t push_string_check_fn(void *dest, const char *src, size_t dest_len) {
352 #define push_string_check(dest, src, dest_len) \
353 (CHECK_STRING_SIZE(dest, dest_len) \
354 ? __unsafe_string_function_usage_here_size_t__() \
355 : push_string_check_fn(dest, src, dest_len))
357 int main(int argc, char **argv) {
360 const char *foo = "bar";
361 p += 31 + push_string_check(p + 31, foo, sizeof(outbuf) - (p + 31 - outbuf));
363 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
366 msg
="Checking if the compiler will optimize out functions")
368 # Check if the compiler supports the LL suffix on long long integers
370 conf
.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL',
372 msg
="Checking for LL suffix on long long integers")
376 _chdir __chdir chflags chmod _close __close _closedir
377 __closedir crypt16 devnm dirfd
378 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
380 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
382 fsetxattr _fstat __fstat fsync
383 futimens futimes __fxstat getauthuid
384 getcwd _getcwd __getcwd getdents __getdents getdirentries
385 getgrent getgrnam getgrouplist getgrset getmntent getpagesize
386 getpwanam getpwent_r getrlimit
387 glob grantpt hstrerror initgroups innetgr
388 llseek _llseek __llseek _lseek __lseek
389 _lstat __lstat lutimes
390 __lxstat memalign mknod mlock mlockall munlock munlockall
391 _open __open _opendir __opendir
392 pathconf poll posix_fallocate
393 posix_memalign pread _pread __pread
394 pwrite _pwrite __pwrite
395 rdchk _read __read _readdir __readdir
397 select setenv setgidx setgroups setlocale setluid
398 setmntent setpgid setpriv setsid setuidx
399 shmget shm_open sigaction sigblock sigprocmask sigset
401 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctl sysctlbyname
402 __sys_llseek syslog _telldir __telldir timegm
403 utimensat vsyslog _write __write __xstat
406 conf
.CHECK_SAMBA3_CHARSET() # see build/charset.py
408 # FIXME: these should be tests for features, but the old build system just
410 host_os
= sys
.platform
411 Logs
.info("building on %s" % host_os
)
413 # Python doesn't have case switches... :/
414 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
415 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
417 conf
.SET_TARGET_TYPE('sunacl', 'EMPTY')
418 if (host_os
.rfind('linux') > -1) or (host_os
.rfind('gnu') > -1) or (host_os
.rfind('qnx') > -1):
419 if host_os
.rfind('linux') > -1:
420 conf
.DEFINE('LINUX', '1')
421 elif host_os
.rfind('qnx') > -1:
422 conf
.DEFINE('QNX', '1')
423 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
424 elif (host_os
.rfind('darwin') > -1):
425 conf
.DEFINE('DARWINOS', 1)
426 conf
.ADD_CFLAGS('-fno-common')
427 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
428 elif (host_os
.rfind('freebsd') > -1):
429 conf
.DEFINE('FREEBSD', 1)
430 if conf
.CHECK_HEADERS('sunacl.h'):
431 conf
.DEFINE('HAVE_FREEBSD_SUNACL_H', '1')
432 conf
.CHECK_FUNCS_IN(['acl'], 'sunacl')
433 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
434 elif (host_os
.rfind('irix') > -1):
435 conf
.DEFINE('IRIX', 1)
436 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
437 elif (host_os
.rfind('aix') > -1):
438 conf
.DEFINE('AIX', 1)
439 conf
.DEFINE('STAT_ST_BLOCKSIZE', 'DEV_BSIZE')
440 elif (host_os
.rfind('hpux') > -1):
441 conf
.DEFINE('HPUX', 1)
442 conf
.DEFINE('STAT_ST_BLOCKSIZE', '8192')
443 elif (host_os
.rfind('osf') > -1):
444 conf
.DEFINE('OSF1', 1)
445 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
447 # FIXME: Add more checks here.
449 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
451 if Options
.options
.with_acl_support
:
452 if (host_os
.rfind('hpux') > -1):
453 Logs
.info('Using HPUX ACLs')
454 conf
.DEFINE('HAVE_HPUX_ACLS',1)
455 conf
.DEFINE('POSIX_ACL_NEEDS_MASK',1)
456 default_static_modules
.extend(TO_LIST('vfs_hpuxacl'))
457 elif (host_os
.rfind('aix') > -1):
458 Logs
.info('Using AIX ACLs')
459 conf
.DEFINE('HAVE_AIX_ACLS',1)
460 default_static_modules
.extend(TO_LIST('vfs_aixacl vfs_aixacl2'))
461 elif (host_os
.rfind('darwin') > -1):
462 Logs
.warn('ACLs on Darwin currently not supported')
463 conf
.fatal("ACL support not available on Darwin/MacOS. "
464 "Use --without-acl-support for building without "
466 "ACL support is required to change permissions "
467 "from Windows clients.")
469 conf
.CHECK_FUNCS_IN(['acl_get_file'], 'acl')
470 if conf
.CHECK_CODE('''
473 acl_entry_t *entry_p;
474 return acl_get_entry(acl, entry_id, entry_p);
477 headers
='sys/types.h sys/acl.h', link
=False,
478 msg
="Checking for POSIX ACL support") :
480 acl_permset_t permset_d;
482 return acl_get_perm_np(permset_d, perm);
484 'HAVE_ACL_GET_PERM_NP',
485 headers
='sys/types.h sys/acl.h', link
=True,
486 msg
="Checking whether acl_get_perm_np() is available")
487 default_static_modules
.extend(TO_LIST('vfs_posixacl'))
488 conf
.CHECK_VARIABLE('ACL_EVERYONE', headers
='sys/acl.h')
489 elif conf
.CHECK_FUNCS_IN(['facl'], 'sec'):
490 Logs
.info('Using solaris or UnixWare ACLs')
491 conf
.DEFINE('HAVE_SOLARIS_UNIXWARE_ACLS',1)
492 default_static_modules
.extend(TO_LIST('vfs_solarisacl'))
493 elif conf
.CHECK_FUNCS_IN(['acl_get_fd'], 'pacl'):
494 Logs
.info('Using Tru64 ACLs')
495 conf
.DEFINE('HAVE_TRU64_ACLS',1)
496 default_static_modules
.extend(TO_LIST('vfs_tru64acl'))
498 conf
.fatal("ACL support not found. Try installing libacl1-dev "
500 "Otherwise, use --without-acl-support to build "
501 "without ACL support. "
502 "ACL support is required to change permissions from "
505 if conf
.CHECK_FUNCS('dirfd'):
506 conf
.DEFINE('HAVE_DIRFD_DECL', 1)
508 conf
.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
509 'HAVE_STATFS_F_FSID',
510 msg
="vfs_fileid checking for statfs() and struct statfs.f_fsid",
511 headers
='sys/types.h sys/statfs.h',
514 if conf
.CONFIG_SET('HAVE_FALLOCATE'):
516 int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
517 'HAVE_LINUX_FALLOCATE',
518 msg
="Checking whether the Linux 'fallocate' function is available",
519 headers
='unistd.h sys/types.h fcntl.h linux/falloc.h')
521 int ret = fallocate(0, FALLOC_FL_PUNCH_HOLE, 0, 10);''',
522 'HAVE_FALLOC_FL_PUNCH_HOLE',
523 msg
="Checking whether Linux 'fallocate' supports hole-punching",
524 headers
='unistd.h sys/types.h fcntl.h linux/falloc.h')
527 int ret = lseek(0, 0, SEEK_HOLE);
528 ret = lseek(0, 0, SEEK_DATA);''',
529 'HAVE_LSEEK_HOLE_DATA',
530 msg
="Checking whether lseek supports hole/data seeking",
531 headers
='unistd.h sys/types.h')
534 ssize_t err = readahead(0,0,0x80000);''',
535 'HAVE_LINUX_READAHEAD',
536 msg
="Checking whether Linux readahead is available",
537 headers
='unistd.h fcntl.h')
538 conf
.CHECK_DECLS('readahead', headers
='fcntl.h', always
=True)
540 conf
.CHECK_CODE('int fd = openat(AT_FDCWD, ".", O_RDONLY);',
542 msg
='Checking for openat',
545 if Options
.options
.with_aio_support
:
546 conf
.CHECK_FUNCS_IN('aio_read', 'aio')
547 conf
.CHECK_FUNCS_IN('aio_read', 'rt')
548 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);',
550 msg
='Checking for asynchronous io support',
551 headers
='sys/types.h aio.h',
553 if conf
.CONFIG_SET('HAVE_AIO'):
554 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg
='Checking for aio_read', headers
='aio.h', lib
='aio rt')
555 conf
.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg
='Checking for aio_write', headers
='aio.h', lib
='aio rt')
556 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')
557 conf
.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg
='Checking for aio_return', headers
='aio.h', lib
='aio rt')
558 conf
.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg
='Checking for aio_error', headers
='aio.h', lib
='aio rt')
559 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')
560 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')
561 if not conf
.CONFIG_SET('HAVE_AIO'):
562 conf
.DEFINE('HAVE_NO_AIO', '1')
564 conf
.DEFINE('HAVE_NO_AIO', '1')
566 if host_os
.rfind('linux') > -1:
567 conf
.CHECK_FUNCS_IN('io_submit', 'aio')
569 struct io_event ioev;
575 fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
576 io_queue_init(128,&ctx);
577 io_prep_pwrite(ioc, 1, buf, 1, 0);
578 io_prep_pread(ioc, 1, buf, 1, 0);
579 io_set_eventfd(ioc, fd);
580 io_set_callback(ioc, (io_callback_t)(0));
581 io_submit(ctx, 1, &ioc);
582 io_getevents(ctx, 1, 1, &ioev, &ts);
584 'HAVE_LINUX_KERNEL_AIO',
585 msg
='Checking for linux kernel asynchronous io support',
586 headers
='unistd.h stdlib.h sys/types.h fcntl.h sys/eventfd.h libaio.h',
593 char control[CMSG_SPACE(sizeof(int))];
595 msg.msg_control = control_un.control;
596 msg.msg_controllen = sizeof(control_un.control);
598 'HAVE_STRUCT_MSGHDR_MSG_CONTROL',
599 msg
='Checking if we can use msg_control for passing file descriptors',
600 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
604 msg.msg_accrights = (caddr_t) &fd;
605 msg.msg_accrightslen = sizeof(fd);
607 'HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS',
608 msg
='Checking if we can use msg_accrights for passing file descriptors',
609 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
611 if Options
.options
.with_winbind
:
612 conf
.env
.build_winbind
= True
613 conf
.DEFINE('WITH_WINBIND', '1')
615 conf
.find_program('awk', var
='AWK')
617 conf
.CHECK_HEADERS('asm/types.h')
619 conf
.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
620 headers
='unistd.h sys/types.h',
621 msg
="Checking for major macro")
623 conf
.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
624 headers
='unistd.h sys/types.h',
625 msg
="Checking for minor macro")
627 conf
.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
628 headers
='unistd.h sys/types.h dirent.h',
629 define
='HAVE_DIRENT_D_OFF')
631 conf
.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent')
632 if conf
.CHECK_CFLAGS('-Werror-implicit-function-declaration'):
633 netgrent_cflags
= '-Werror-implicit-function-declaration'
636 conf
.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE',
637 msg
="Checking for setnetgrent prototype",
638 headers
='netdb.h netgroup.h',
639 cflags
=netgrent_cflags
)
640 conf
.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE',
641 msg
="Checking for getnetgrent prototype",
642 headers
='netdb.h netgroup.h',
643 cflags
=netgrent_cflags
)
644 conf
.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE',
645 msg
="Checking for endnetgrent prototype",
646 headers
='netdb.h netgroup.h',
647 cflags
=netgrent_cflags
)
651 if Options
.options
.with_cups
:
652 conf
.find_program('cups-config', var
='CUPS_CONFIG')
653 if conf
.env
.CUPS_CONFIG
:
654 # we would normally use --libs here, but cups-config incorrectly adds
655 # gssapi_krb5 and other libraries to its --libs output. That breaks the use
656 # of an in-tree heimdal kerberos
657 conf
.CHECK_CFG(path
=conf
.env
.CUPS_CONFIG
, args
="--cflags --ldflags",
658 package
="", uselib_store
="CUPS")
659 conf
.CHECK_HEADERS('cups/cups.h cups/language.h', lib
='cups')
660 conf
.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups')
661 if conf
.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf
.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
662 conf
.DEFINE('HAVE_CUPS', '1')
664 conf
.undefine('HAVE_CUPS')
665 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
667 # define an empty subsystem for cups, to allow it to be used as an empty dependency
668 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
670 if Options
.options
.with_iprint
:
671 if conf
.CONFIG_SET('HAVE_CUPS'):
672 conf
.DEFINE('HAVE_IPRINT', '1')
674 Logs
.warn("--enable-iprint=yes but cups support not sufficient")
675 if Options
.options
.with_syslog
:
676 conf
.DEFINE('WITH_SYSLOG', '1')
677 if Options
.options
.with_automount
:
678 conf
.DEFINE('WITH_AUTOMOUNT', '1')
681 if Options
.options
.with_ldap
:
682 conf
.CHECK_HEADERS('ldap.h lber.h ldap_pvt.h')
683 conf
.CHECK_TYPE('ber_tag_t', 'unsigned int', headers
='ldap.h lber.h')
684 conf
.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
685 conf
.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers
='ldap.h')
687 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
689 conf
.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
690 define
='HAVE_LBER_LOG_PRINT_FN', headers
='lber.h')
692 conf
.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', 'ldap')
693 conf
.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
695 # Check if ldap_set_rebind_proc() takes three arguments
696 if conf
.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
697 'LDAP_SET_REBIND_PROC_ARGS',
698 msg
="Checking whether ldap_set_rebind_proc takes 3 arguments",
699 headers
='ldap.h lber.h', link
=False):
700 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
702 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
704 # last but not least, if ldap_init() exists, we want to use ldap
705 if conf
.CONFIG_SET('HAVE_LDAP_INIT') and conf
.CONFIG_SET('HAVE_LDAP_H'):
706 conf
.DEFINE('HAVE_LDAP', '1')
707 conf
.DEFINE('LDAP_DEPRECATED', '1')
708 conf
.env
['HAVE_LDAP'] = '1'
709 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
710 # SASL wrapping hooks
711 if conf
.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
712 conf
.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
713 conf
.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
715 conf
.fatal("LDAP support not found. "
716 "Try installing libldap2-dev or openldap-devel. "
717 "Otherwise, use --without-ldap to build without "
719 "LDAP support is required for the LDAP passdb backend, "
720 "LDAP idmap backends and ADS. "
721 "ADS support improves communication with "
722 "Active Directory domain controllers.")
724 conf
.SET_TARGET_TYPE('ldap', 'EMPTY')
725 conf
.SET_TARGET_TYPE('lber', 'EMPTY')
727 if Options
.options
.with_ads
== False:
735 if not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and \
736 not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC'):
737 Logs
.warn("arcfour-hmac-md5 encryption type not found in -lkrb5")
739 if not conf
.CONFIG_SET('HAVE_KRB5_MK_REQ_EXTENDED'):
740 Logs
.warn("krb5_mk_req_extended not found in -lkrb5")
742 if not conf
.CONFIG_SET('HAVE_KRB5_GET_HOST_REALM'):
743 Logs
.warn("krb5_get_host_realm not found in -lkrb5")
745 if not conf
.CONFIG_SET('HAVE_KRB5_FREE_HOST_REALM'):
746 Logs
.warn("krb5_free_host_realm not found in -lkrb5")
748 if not conf
.CONFIG_SET('HAVE_KRB5_FWD_TGT_CREDS'):
749 Logs
.warn("krb5_fwd_tgt_creds found in -lkrb5")
751 if not conf
.CONFIG_SET('HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC'):
752 Logs
.warn("krb5_get_init_creds_opt_alloc not found in -lkrb5")
754 if not conf
.CONFIG_SET('KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT'):
755 Logs
.warn("krb5_get_init_creds_opt_free was not found or was too old in -lkrb5")
757 if not conf
.CONFIG_SET('HAVE_KRB5_GET_RENEWED_CREDS'):
758 Logs
.warn("krb5_get_renewed_creds not found in -lkrb5")
760 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL_COMPARE_ANY_REALM'):
761 Logs
.warn("krb5_principal_compare_any_realm not found in -lkrb5")
763 if not conf
.CONFIG_SET('HAVE_KRB5_C_STRING_TO_KEY') and \
764 not conf
.CONFIG_SET('HAVE_KRB5_STRING_TO_KEY_SALT'):
765 Logs
.warn("krb5_c_string_to_key not found in -lkrb5")
767 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL2SALT') and \
768 not conf
.CONFIG_SET('HAVE_KRB5_GET_PW_SALT'):
769 Logs
.warn("no CREATE_KEY_FUNCTIONS detected")
771 if not conf
.CONFIG_SET('HAVE_KRB5_GET_PERMITTED_ENCTYPES') and \
772 not conf
.CONFIG_SET('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES'):
773 Logs
.warn("no GET_ENCTYPES_FUNCTIONS detected")
775 if not conf
.CONFIG_SET('HAVE_KRB5_KT_FREE_ENTRY') and \
776 not conf
.CONFIG_SET('HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS'):
777 Logs
.warn("no KT_FREE_FUNCTION detected")
779 if not conf
.CONFIG_SET('HAVE_KRB5_C_VERIFY_CHECKSUM'):
780 Logs
.warn("krb5_c_verify_checksum_compare not found in -lkrb5")
783 # We don't actually use
784 # gsskrb5_extract_authz_data_from_sec_context, but it is a
785 # clue that this Heimdal, which does the PAC processing we
786 # need on the standard gss_inquire_sec_context_by_oid
787 if not conf
.CONFIG_SET('HAVE_GSS_GET_NAME_ATTRIBUTE') and \
788 not (conf
.CONFIG_SET('HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT') and \
789 conf
.CONFIG_SET('HAVE_GSS_INQUIRE_SEC_CONTEXT_BY_OID')):
790 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")
793 if not conf
.CONFIG_SET('HAVE_GSS_KRB5_EXPORT_LUCID_SEC_CONTEXT'):
794 Logs
.warn("need gss_krb5_export_lucid_sec_context for SPNEGO and gss_wrap support")
798 conf
.DEFINE('HAVE_KRB5', '1')
799 conf
.env
['HAVE_KRB5'] = '1'
801 conf
.undefine('HAVE_KRB5_H')
802 conf
.undefine('HAVE_GSSAPI_H')
803 conf
.undefine('HAVE_GSSAPI_GSSAPI_GENERIC_H')
804 conf
.undefine('HAVE_GSSAPI_GSSAPI_H')
807 if not conf
.CONFIG_SET('HAVE_LDAP'):
812 conf
.DEFINE('WITH_ADS', '1')
813 conf
.env
['HAVE_ADS'] = '1'
814 Logs
.info("Building with Active Directory support.")
815 elif Options
.options
.with_ads
== False:
816 Logs
.info("Building without Active Directory support (--without-ads).")
819 Logs
.warn("Active Directory support not available: krb5 libs don't have all required features")
821 Logs
.warn("Active Directory support not available: LDAP support is not available.")
822 if Options
.options
.with_ads
:
823 conf
.fatal("Active Directory support not found. Use --without-ads "
824 "for building without Active Directory support. "
825 "ADS support improves communication with "
826 "Active Directory domain controllers.")
828 # this is the auto-mode case
829 Logs
.warn("Building without Active Directory support.")
832 if Options
.options
.with_utmp
:
833 conf
.env
.with_utmp
= True
834 if not conf
.CHECK_HEADERS('utmp.h'): conf
.env
.with_utmp
= False
835 conf
.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
836 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers
='utmp.h',
837 define
='HAVE_UT_UT_NAME')
838 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers
='utmp.h',
839 define
='HAVE_UT_UT_USER')
840 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers
='utmp.h',
841 define
='HAVE_UT_UT_ID')
842 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers
='utmp.h',
843 define
='HAVE_UT_UT_HOST')
844 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers
='utmp.h',
845 define
='HAVE_UT_UT_TIME')
846 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers
='utmp.h',
847 define
='HAVE_UT_UT_TV')
848 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers
='utmp.h',
849 define
='HAVE_UT_UT_TYPE')
850 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers
='utmp.h',
851 define
='HAVE_UT_UT_PID')
852 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers
='utmp.h',
853 define
='HAVE_UT_UT_EXIT')
854 conf
.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers
='utmpx.h',
855 define
='HAVE_UX_UT_SYSLEN')
856 conf
.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
857 'PUTUTLINE_RETURNS_UTMP', headers
='utmp.h',
858 msg
="Checking whether pututline returns pointer")
859 conf
.CHECK_SIZEOF(['((struct utmp *)NULL)->ut_line'], headers
='utmp.h',
860 define
='SIZEOF_UTMP_UT_LINE', critical
=False)
861 if not conf
.CONFIG_SET('SIZEOF_UTMP_UT_LINE'):
862 conf
.env
.with_utmp
= False
863 elif int(conf
.env
.SIZEOF_UTMP_UT_LINE
) < 15:
864 conf
.env
.with_utmp
= False
865 if conf
.env
.with_utmp
:
866 conf
.DEFINE('WITH_UTMP', 1)
868 Logs
.warn("--with-utmp but utmp support not sufficient")
870 if Options
.options
.with_avahi
:
871 conf
.env
.with_avahi
= True
872 if not conf
.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf
.env
.with_avahi
= False
873 if not conf
.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf
.env
.with_avahi
= False
874 if not conf
.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf
.env
.with_avahi
= False
875 if conf
.env
.with_avahi
:
876 conf
.DEFINE('WITH_AVAHI_SUPPORT', 1)
878 conf
.SET_TARGET_TYPE('avahi-common', 'EMPTY')
879 conf
.SET_TARGET_TYPE('avahi-client', 'EMPTY')
881 if Options
.options
.with_iconv
:
882 conf
.env
.with_iconv
= True
883 if not conf
.CHECK_FUNCS_IN('iconv_open', 'iconv', headers
='iconv.h'):
884 conf
.env
.with_iconv
= False
885 if conf
.env
.with_iconv
:
886 conf
.DEFINE('HAVE_ICONV', 1)
888 if Options
.options
.with_pam
:
890 conf
.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
891 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
892 Logs
.warn("--with-pam=yes but pam_appl.h not found")
894 conf
.CHECK_FUNCS_IN('pam_get_data', 'pam')
895 conf
.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h')
896 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'):
897 Logs
.warn("--with-pam=yes but pam_modules.h not found")
899 conf
.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h')
900 conf
.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h')
901 conf
.CHECK_FUNCS_IN('pam_vsyslog', 'pam')
903 #if defined(HAVE_SECURITY_PAM_APPL_H)
904 #include <security/pam_appl.h>
905 #elif defined(HAVE_PAM_PAM_APPL_H)
906 #include <pam/pam_appl.h>
908 pam_set_item(0, PAM_RHOST, 0);
912 msg
="Checking whether PAM_RHOST is available");
914 #if defined(HAVE_SECURITY_PAM_APPL_H)
915 #include <security/pam_appl.h>
916 #elif defined(HAVE_PAM_PAM_APPL_H)
917 #include <pam/pam_appl.h>
919 pam_set_item(0, PAM_TTY, 0);
923 msg
="Checking whether PAM_TTY is available");
925 #if (!defined(LINUX))
927 #define PAM_EXTERN extern
928 #if defined(HAVE_SECURITY_PAM_APPL_H)
929 #include <security/pam_appl.h>
930 #elif defined(HAVE_PAM_PAM_APPL_H)
931 #include <pam/pam_appl.h>
936 #if defined(HAVE_SECURITY_PAM_MODULES_H)
937 #include <security/pam_modules.h>
938 #elif defined(HAVE_PAM_PAM_MODULES_H)
939 #include <pam/pam_modules.h>
942 #if defined(HAVE_SECURITY__PAM_MACROS_H)
943 #include <security/_pam_macros.h>
944 #elif defined(HAVE_PAM__PAM_MACROS_H)
945 #include <pam/_pam_macros.h>
948 #ifdef HAVE_SECURITY_PAM_EXT_H
949 #include <security/pam_ext.h>
952 int i; i = PAM_RADIO_TYPE;
954 'HAVE_PAM_RADIO_TYPE',
956 msg
="Checking whether PAM_RADIO_TYPE is available");
958 conf
.DEFINE('WITH_PAM', 1)
959 conf
.DEFINE('WITH_PAM_MODULES', 1)
961 if Options
.options
.with_pam_smbpass
:
962 conf
.env
.with_pam_smbpass
= True
967 # Ensure we select the correct set of system calls on Linux.
969 if (host_os
.rfind('linux') > -1):
971 #if defined(HAVE_UNISTD_H)
976 #include <sys/types.h>
979 #ifdef HAVE_SYS_PRIV_H
980 #include <sys/priv.h>
986 #if defined(HAVE_SYSCALL_H)
990 #if defined(HAVE_SYS_SYSCALL_H)
991 #include <sys/syscall.h>
994 syscall(SYS_setresuid32, -1, -1, -1);
995 syscall(SYS_setresgid32, -1, -1, -1);
996 syscall(SYS_setreuid32, -1, -1);
997 syscall(SYS_setregid32, -1, -1);
998 syscall(SYS_setuid32, -1);
999 syscall(SYS_setgid32, -1);
1000 syscall(SYS_setgroups32, 0, NULL);
1002 'USE_LINUX_32BIT_SYSCALLS',
1003 msg
="Checking whether Linux should use 32-bit credential calls");
1005 if (conf
.CONFIG_SET('USE_LINUX_32BIT_SYSCALLS')):
1006 seteuid
= conf
.CHECK_CODE('''
1007 #define AUTOCONF_TEST 1
1008 #define USE_LINUX_THREAD_CREDENTIALS 1
1009 #define USE_LINUX_32BIT_SYSCALLS 1
1010 #include "../lib/util/setid.c"
1011 #include "./lib/util_sec.c"
1013 'USE_LINUX_THREAD_CREDENTIALS',
1016 msg
="Checking whether we can use Linux thread-specific credentials with 32-bit system calls")
1018 seteuid
= conf
.CHECK_CODE('''
1019 #define AUTOCONF_TEST 1
1020 #define USE_LINUX_THREAD_CREDENTIALS 1
1021 #include "../lib/util/setid.c"
1022 #include "./lib/util_sec.c"
1024 'USE_LINUX_THREAD_CREDENTIALS',
1027 msg
="Checking whether we can use Linux thread-specific credentials")
1029 seteuid
= conf
.CHECK_CODE('''
1030 #define AUTOCONF_TEST 1
1031 #define USE_SETREUID 1
1032 #include "../lib/util/setid.c"
1033 #include "./lib/util_sec.c"
1038 msg
="Checking whether setreuid is available")
1040 seteuid
= conf
.CHECK_CODE('''
1041 #define AUTOCONF_TEST 1
1042 #define USE_SETRESUID 1
1043 #include "../lib/util/setid.c"
1044 #include "./lib/util_sec.c"
1049 msg
="Checking whether setresuid is available")
1051 seteuid
= conf
.CHECK_CODE('''
1052 #define AUTOCONF_TEST 1
1053 #define USE_SETEUID 1
1054 #include "../lib/util/setid.c"
1055 #include "./lib/util_sec.c"
1060 msg
="Checking whether seteuid is available")
1062 seteuid
= conf
.CHECK_CODE('''
1063 #define AUTOCONF_TEST 1
1064 #define USE_SETUIDX 1
1065 #include "../lib/util/setid.c"
1066 #include "./lib/util_sec.c"
1072 msg
="Checking whether setuidx is available")
1073 if Options
.options
.with_dnsupdate
:
1074 if not conf
.CONFIG_SET('HAVE_KRB5'):
1075 Logs
.warn("--with-dnsupdate=yes but gssapi support not sufficient")
1077 conf
.DEFINE('WITH_DNS_UPDATES', 1)
1078 conf
.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
1079 if Options
.options
.developer
:
1080 if conf
.CONFIG_SET('HAVE_VALGRIND_H') or conf
.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'):
1081 conf
.DEFINE('VALGRIND', '1')
1083 if conf
.CHECK_CODE('''
1084 #include <bits/sockaddr.h>
1085 #include <linux/netlink.h>
1087 'HAVE_LINUX_NETLINK_H',
1088 msg
="Checking whether Linux netlink is available"):
1091 #include <bits/sockaddr.h>
1092 #include <linux/netlink.h>
1093 #include <linux/rtnetlink.h>
1095 'HAVE_LINUX_RTNETLINK_H',
1096 msg
='Checking whether Linux rtnetlink is available')
1099 #include "../tests/fcntl_lock.c"
1104 msg
='Checking whether fcntl locking is available')
1106 # glibc up to 2.3.6 had dangerously broken posix_fallocate(). DON'T USE IT.
1107 if not conf
.CHECK_CODE('''
1108 #define _XOPEN_SOURCE 600
1110 #if defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4))
1111 #error probably broken posix_fallocate
1114 '_HAVE_UNBROKEN_POSIX_FALLOCATE',
1115 msg
='Checking for broken posix_fallocate'):
1116 conf
.DEFINE('HAVE_BROKEN_POSIX_FALLOCATE', '1')
1119 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec',
1120 define
='HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') # Linux, Solaris
1121 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimensec',
1122 define
='HAVE_STRUCT_STAT_ST_MTIMENSEC') # BSD, if defined _POSIX_SOURCE
1123 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimespec.tv_nsec',
1124 define
='HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') # BSD, if not defined _POSIX_SOURCE
1125 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtime_n',
1126 define
='HAVE_STRUCT_STAT_ST_MTIME_N') # AIX
1127 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_umtime',
1128 define
='HAVE_STRUCT_STAT_ST_UMTIME') # Tru64
1129 if conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') or \
1130 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMENSEC') or \
1131 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') or \
1132 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIME_N') or \
1133 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_UMTIME'):
1134 conf
.DEFINE('HAVE_STAT_HIRES_TIMESTAMPS', '1')
1136 # recent FreeBSD, NetBSD have creation timestamps called birthtime:
1137 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtime',
1138 define
='HAVE_STRUCT_STAT_ST_BIRTHTIME')
1139 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimespec.tv_nsec',
1140 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC')
1141 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimensec',
1142 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC')
1145 ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
1147 'HAVE_POSIX_FADVISE',
1148 msg
='Checking whether posix_fadvise is available',
1149 headers
='unistd.h fcntl.h')
1151 for v
in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]:
1154 return sysconf(%s) == -1 ? 1 : 0;
1157 msg
='Checking whether sysconf(%s) is available' % v
)
1160 #include <sys/syscall.h>
1162 syscall(SYS_initgroups, 16, NULL, NULL, 0);
1164 'HAVE_DARWIN_INITGROUPS',
1165 msg
='Checking whether to use the Darwin-specific initgroups system call')
1167 conf
.CHECK_CODE('''struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''',
1169 headers
='sys/types.h utime.h',
1170 msg
='Checking whether struct utimbuf is available')
1172 if conf
.CHECK_CODE('''struct sigevent s;''',
1173 'HAVE_STRUCT_SIGEVENT',
1174 headers
='sys/types.h stdlib.h stddef.h signal.h',
1175 msg
='Checking whether we have the struct sigevent'):
1176 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sival_ptr',
1177 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR',
1178 headers
='signal.h');
1179 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sigval_ptr',
1180 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR',
1181 headers
='signal.h');
1183 if os
.path
.exists('/proc/sys/kernel/core_pattern'):
1184 conf
.DEFINE('HAVE_SYS_KERNEL_PROC_CORE_PATTERN', '1')
1186 if conf
.CHECK_CODE('''
1190 if (sizeof(time_t) == 8) {
1191 time_t max_time = 0x7fffffffffffffffll;
1192 tm = gmtime(&max_time);
1193 /* This should fail with 32-bit tm_year. */
1195 /* Max time_t that works with 32-bit int tm_year in struct tm. */
1196 max_time = 67768036191676799ll;
1197 tm = gmtime(&max_time);
1208 msg
="Checking for the maximum value of the 'time_t' type"):
1209 conf
.DEFINE('TIME_T_MAX', '67768036191676799ll')
1212 #if defined(HAVE_UNISTD_H)
1215 #include <sys/types.h>
1216 main() { dev_t dev = makedev(1,2); return 0; }
1220 msg
='Checking whether the macro for makedev is available')
1227 void exit_on_core(int ignored) {
1233 signal(SIGSEGV, exit_on_core);
1234 newpath = realpath("/tmp", NULL);
1235 exit((newpath != NULL) ? 0 : 1);
1238 'REALPATH_TAKES_NULL',
1241 msg
='Checking whether the realpath function allows a NULL argument')
1243 conf
.CHECK_CODE('''#include "../tests/ftruncate.c"''',
1244 'HAVE_FTRUNCATE_EXTEND',
1245 msg
='Checking for ftruncate extend',
1249 if Options
.options
.with_sendfile_support
:
1250 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):
1255 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1258 headers
='sys/sendfile.h',
1259 msg
='Checking for linux sendfile support')
1261 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1262 conf
.DEFINE('HAVE_SENDFILE', '1')
1263 conf
.DEFINE('LINUX_SENDFILE_API', '1')
1264 conf
.DEFINE('WITH_SENDFILE', '1')
1265 elif (host_os
.rfind('freebsd') > -1) or (host_os
.rfind('dragonfly') > -1):
1267 #include <sys/types.h>
1269 #include <sys/socket.h>
1270 #include <sys/uio.h>
1271 int fromfd, tofd, ret, total=0;
1272 off_t offset, nwritten;
1275 hdr.headers = &hdtrl;
1277 hdr.trailers = NULL;
1279 hdtrl.iov_base = NULL;
1281 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0)
1284 msg
='Checking for freebsd sendfile support')
1285 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1286 conf
.DEFINE('HAVE_SENDFILE', '1')
1287 conf
.DEFINE('FREEBSD_SENDFILE_API', '1')
1288 conf
.DEFINE('WITH_SENDFILE', '1')
1289 elif (host_os
.rfind('darwin') > -1):
1291 #include <sys/types.h>
1292 #include <sys/socket.h>
1293 #include <sys/uio.h>
1294 int fromfd, tofd, ret;
1295 off_t offset, nwritten;
1298 hdr.headers = &hdtrl;
1300 hdr.trailers = (void *)0;
1302 hdtrl.iov_base = (void *)0;
1304 ret = sendfile(fromfd, tofd, offset, &nwritten, &hdr, 0);
1307 msg
='Checking for darwin sendfile support')
1308 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1309 conf
.DEFINE('HAVE_SENDFILE', '1')
1310 conf
.DEFINE('DARWIN_SENDFILE_API', '1')
1311 conf
.DEFINE('WITH_SENDFILE', '1')
1312 elif (host_os
.rfind('hpux') > -1) or (host_os
.rfind('osf') > -1):
1314 #include <sys/socket.h>
1315 #include <sys/uio.h>
1318 struct iovec hdtrl[2];
1321 hdtrl[0].iov_base = 0;
1322 hdtrl[0].iov_len = 0;
1323 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
1326 msg
='Checking for osf/hpux sendfile support')
1327 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1328 conf
.DEFINE('HAVE_SENDFILE', '1')
1329 conf
.DEFINE('HPUX_SENDFILE_API', '1')
1330 conf
.DEFINE('WITH_SENDFILE', '1')
1331 elif (host_os
.rfind('solaris') > -1):
1332 conf
.CHECK_FUNCS_IN('sendfile', 'sendfilev')
1334 #include <sys/sendfile.h>,
1337 struct sendfilevec vec[2];
1341 vec[0].sfv_fd = SFV_FD_SELF;
1342 vec[0].sfv_flag = 0;
1346 vec[1].sfv_flag = 0;
1349 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
1352 msg
='Checking for solaris sendfilev support')
1353 if conf
.CONFIG_SET('_HAVE_SENDFILEV'):
1354 conf
.DEFINE('HAVE_SENDFILEV', '1')
1355 conf
.DEFINE('SOLARIS_SENDFILE_API', '1')
1356 conf
.DEFINE('WITH_SENDFILE', '1')
1357 elif (host_os
.rfind('aix') > -1):
1359 #include <sys/socket.h>
1362 struct sf_parms hdtrl;
1364 hdtrl.header_data = 0;
1365 hdtrl.header_length = 0;
1366 hdtrl.file_descriptor = fromfd;
1367 hdtrl.file_offset = 0;
1368 hdtrl.file_bytes = 0;
1369 hdtrl.trailer_data = 0;
1370 hdtrl.trailer_length = 0;
1371 nwritten = send_file(&tofd, &hdtrl, 0);
1374 msg
='Checking for AIX send_file support')
1375 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1376 conf
.DEFINE('HAVE_SENDFILE', '1')
1377 conf
.DEFINE('AIX_SENDFILE_API', '1')
1378 conf
.DEFINE('WITH_SENDFILE', '1')
1380 # Check for getcwd allowing a NULL arg.
1384 char *s = getcwd(NULL,0);
1385 exit(s != NULL ? 0 : 1);
1386 }''', 'GETCWD_TAKES_NULL', addmain
=False, execute
=True,
1387 msg
="getcwd takes a NULL argument")
1390 # UnixWare 7.x has its getspnam in -lgen
1391 conf
.CHECK_FUNCS_IN('getspnam', 'gen')
1392 conf
.CHECK_FUNCS_IN('getspnam', 'security')
1393 conf
.CHECK_FUNCS_IN('getspnam', 'sec')
1395 if Options
.options
.with_quotas
:
1396 # For quotas on Veritas VxFS filesystems
1397 conf
.CHECK_HEADERS('sys/fs/vx_quota.h')
1398 # For sys/quota.h and linux/quota.h
1399 conf
.CHECK_HEADERS('sys/quota.h')
1400 # For quotas on BSD systems
1401 conf
.CHECK_HEADERS('ufs/ufs/quota.h')
1402 # For quotas on Linux XFS filesystems
1403 if conf
.CHECK_HEADERS('xfs/xqm.h'):
1404 conf
.DEFINE('HAVE_XFS_QUOTAS', '1')
1408 #include "confdefs.h"
1409 #ifdef HAVE_SYS_TYPES_H
1410 #include <sys/types.h>
1412 #ifdef HAVE_ASM_TYPES_H
1413 #include <asm/types.h>
1415 #include <sys/quota.h>
1416 int i = Q_XGETQUOTA;''',
1417 define
='HAVE_XFS_QUOTAS',
1418 msg
='for XFS QUOTA in <sys/quota.h>',
1420 local_include
=False)
1422 # For IRIX like dqb_isoftlimit instead of dqb_fsoftlimit in struc dqblk
1423 conf
.CHECK_STRUCTURE_MEMBER('struct dqblk', 'dqb_fsoftlimit', define
='HAVE_DQB_FSOFTLIMIT',
1424 headers
='sys/quota.h')
1425 #darwin style quota bytecount
1426 conf
.CHECK_STRUCTURE_MEMBER('struct dqblk', 'dqb_curbytes', define
='HAVE_STRUCT_DQBLK_DQB_CURBYTES',
1427 headers
='sys/quota.h')
1428 if conf
.CHECK_HEADERS('rpcsvc/rquota.h'):
1429 conf
.DEFINE('HAVE_NFS_QUOTAS', '1')
1430 conf
.CHECK_STRUCTURE_MEMBER('struct getquota_rslt', 'getquota_rslt_u',
1431 define
='HAVE_GETQUOTA_RSLT_GETQUOTA_RSLT_U',
1432 headers
='rpcsvc/rquota.h')
1434 if (host_os
.rfind('linux') > -1):
1435 conf
.DEFINE('HAVE_QUOTACTL_LINUX', '1')
1436 elif not conf
.CONFIG_SET("HAVE_XFS_QUOTAS"):
1437 if not conf
.CHECK_CODE('''
1438 #define HAVE_QUOTACTL_4A 1
1439 #define AUTOCONF_TEST 1
1440 #include "../tests/sysquotas.c"
1442 cflags
=conf
.env
['WERROR_CFLAGS'],
1443 define
='HAVE_QUOTACTL_4A',
1444 msg
='for QUOTACTL_4A: long quotactl(int cmd, char *special, qid_t id, caddr_t addr)',
1449 #define HAVE_QUOTACTL_4B 1
1450 #define AUTOCONF_TEST 1
1451 #include "../tests/sysquotas.c"
1453 cflags
=conf
.env
['WERROR_CFLAGS'],
1454 define
='HAVE_QUOTACTL_4B',
1455 msg
='for QUOTACTL_4B: int quotactl(const char *path, int cmd, int id, char *addr)',
1460 clnt_create("", RQUOTAPROG, RQUOTAVERS, "udp");
1462 headers
="rpc/rpc.h rpc/types.h rpcsvc/rquota.h rpc/nettype.h rpc/xdr.h",
1463 define
='HAVE_NFS_QUOTAS',
1464 msg
='for NFS QUOTAS',
1466 local_include
=False)
1468 if conf
.CONFIG_SET('HAVE_QUOTACTL_LINUX') or \
1469 conf
.CONFIG_SET('HAVE_QUOTACTL_4A') or \
1470 conf
.CONFIG_SET('HAVE_QUOTACTL_4B') or \
1471 conf
.CONFIG_SET('HAVE_XFS_QUOTAS'):
1472 conf
.DEFINE('HAVE_SYS_QUOTAS', '1')
1473 conf
.DEFINE('WITH_QUOTAS', '1')
1476 # cluster support (CTDB)
1478 if not Options
.options
.with_cluster_support
:
1479 Logs
.info("building without cluster support (--without-cluster-support)")
1480 conf
.env
.with_ctdb
= False
1482 Logs
.info("building with cluster support")
1483 conf
.env
['CTDB_CFLAGS'] = '-DCLUSTER_SUPPORT=1'
1484 conf
.env
['CTDB_INCLUDE'] = conf
.srcdir
+ '/ctdb/include'
1485 conf
.env
.with_ctdb
= True
1487 conf
.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }',
1488 'HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR',
1491 msg
='Checking whether we can compile with __attribute__((destructor))')
1493 conf
.CHECK_CODE('void seekdir(DIR *d, long loc) { return; }',
1494 'SEEKDIR_RETURNS_VOID',
1495 headers
='sys/types.h dirent.h',
1496 msg
='Checking whether seekdir returns void')
1498 if Options
.options
.with_profiling_data
:
1499 conf
.DEFINE('WITH_PROFILE', 1);
1500 conf
.CHECK_FUNCS('getrusage', headers
="sys/time.h sys/resource.h")
1502 if Options
.options
.with_pthreadpool
:
1503 if conf
.CONFIG_SET('HAVE_PTHREAD'):
1504 conf
.DEFINE('WITH_PTHREADPOOL', '1')
1506 Logs
.warn("pthreadpool support cannot be enabled when pthread support was not found")
1507 conf
.undefine('WITH_PTHREADPOOL')
1509 conf
.env
['CPPPATH_GPFS'] = '/usr/lpp/mmfs/include/'
1510 if conf
.CHECK_HEADERS('gpfs_fcntl.h', False, False, "gpfs"):
1511 conf
.DEFINE('HAVE_GPFS', '1')
1513 if (conf
.CHECK_HEADERS('linux/ioctl.h sys/ioctl.h linux/fs.h') and
1514 conf
.CHECK_DECLS('FS_IOC_GETFLAGS FS_COMPR_FL', headers
='linux/fs.h')):
1515 conf
.DEFINE('HAVE_LINUX_IOCTL', '1')
1517 conf
.env
['CCFLAGS_CEPHFS'] = "-D_FILE_OFFSET_BITS=64"
1518 if Options
.options
.libcephfs_dir
:
1519 conf
.env
['CPPPATH_CEPHFS'] = Options
.options
.libcephfs_dir
+ '/include'
1520 conf
.env
['LIBPATH_CEPHFS'] = Options
.options
.libcephfs_dir
+ '/lib'
1522 if conf
.CHECK_HEADERS('cephfs/libcephfs.h', False, False, 'cephfs') and conf
.CHECK_LIB('cephfs'):
1523 conf
.DEFINE('HAVE_CEPH', '1')
1525 if Options
.options
.with_glusterfs
:
1526 conf
.CHECK_CFG(package
='glusterfs-api', args
='"glusterfs-api >= 4" --cflags --libs',
1527 msg
='Checking for glusterfs-api >= 4', uselib_store
="GFAPI")
1528 conf
.CHECK_HEADERS('api/glfs.h', lib
='gfapi')
1529 conf
.CHECK_LIB('gfapi', shlib
=True)
1531 if conf
.CONFIG_SET('HAVE_API_GLFS_H'):
1532 conf
.DEFINE('HAVE_GLUSTERFS', '1')
1534 conf
.SET_TARGET_TYPE('gfapi', 'EMPTY')
1535 conf
.undefine('HAVE_GLUSTERFS')
1537 conf
.SET_TARGET_TYPE('gfapi', 'EMPTY')
1538 conf
.undefine('HAVE_GLUSTERFS')
1540 if Options
.options
.enable_vxfs
:
1541 conf
.DEFINE('HAVE_VXFS', '1')
1543 if conf
.CHECK_CFG(package
='dbus-1', args
='--cflags --libs',
1544 msg
='Checking for dbus', uselib_store
="DBUS-1"):
1545 if (conf
.CHECK_HEADERS('dbus/dbus.h', lib
='dbus-1')
1546 and conf
.CHECK_LIB('dbus-1', shlib
=True)):
1547 conf
.DEFINE('HAVE_DBUS', '1')
1549 conf
.env
.build_regedit
= False
1550 if not Options
.options
.with_regedit
== False:
1551 conf
.PROCESS_SEPARATE_RULE('system_ncurses')
1552 if conf
.CONFIG_SET('HAVE_NCURSES'):
1553 conf
.env
.build_regedit
= True
1555 if conf
.env
.build_regedit
:
1556 Logs
.info("building regedit")
1558 if Options
.options
.with_regedit
== False:
1559 Logs
.info("not building regedit (--without-regedit)")
1560 elif Options
.options
.with_regedit
== True:
1561 Logs
.error("ncurses not available, cannot build regedit")
1562 conf
.fatal("ncurses not available, but --with-regedit was specified")
1564 Logs
.info("ncurses not available, not building regedit")
1566 conf
.CHECK_FUNCS_IN('DES_pcbc_encrypt', 'crypto')
1567 if Options
.options
.with_fake_kaserver
== True:
1568 conf
.CHECK_HEADERS('afs/param.h afs/stds.h', together
=True)
1569 conf
.CHECK_HEADERS('afs/param.h afs/stds.h', together
=True)
1570 if (conf
.CONFIG_SET('HAVE_AFS_PARAM_H') and conf
.CONFIG_SET('HAVE_AFS_STDS_H') and conf
.CONFIG_SET('HAVE_DES_PCBC_ENCRYPT')):
1571 conf
.DEFINE('WITH_FAKE_KASERVER', '1')
1573 conf
.fatal('AFS headers not available, but --with-fake-kaserver was specified')
1577 default_static_modules
.extend(TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
1578 auth_sam auth_unix auth_winbind auth_wbc
1579 auth_domain auth_builtin vfs_default
1580 nss_info_template idmap_tdb idmap_passdb
1583 default_shared_modules
.extend(TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
1584 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
1585 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2
1586 auth_script vfs_readahead vfs_xattr_tdb vfs_posix_eadb
1587 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
1588 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
1589 vfs_media_harmony vfs_unityed_media vfs_fruit
1592 vfs_crossrename vfs_linux_xfs_sgid
1593 vfs_time_audit idmap_autorid idmap_tdb2
1596 idmap_rid idmap_hash idmap_rfc2307'''))
1598 if Options
.options
.developer
:
1599 default_static_modules
.extend(TO_LIST('charset_weird'))
1600 default_shared_modules
.extend(TO_LIST('perfcount_test'))
1601 default_shared_modules
.extend(TO_LIST('vfs_skel_opaque vfs_skel_transparent vfs_shadow_copy_test'))
1602 default_shared_modules
.extend(TO_LIST('auth_skel pdb_test'))
1604 if Options
.options
.enable_selftest
or Options
.options
.developer
:
1605 default_shared_modules
.extend(TO_LIST('vfs_fake_acls vfs_nfs4acl_xattr'))
1608 if conf
.CONFIG_SET('AD_DC_BUILD_IS_ENABLED'):
1609 default_static_modules
.extend(TO_LIST('pdb_samba_dsdb auth_samba4 vfs_dfs_samba4'))
1611 if conf
.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'):
1612 default_shared_modules
.extend(TO_LIST('vfs_zfsacl'))
1614 if conf
.CONFIG_SET('HAVE_DIRFD_DECL'):
1615 default_shared_modules
.extend(TO_LIST('vfs_syncops vfs_dirsort'))
1617 if conf
.CONFIG_SET('HAVE_STATFS_F_FSID'):
1618 default_shared_modules
.extend(TO_LIST('vfs_fileid'))
1620 if (conf
.CONFIG_SET('HAVE_STRUCT_MSGHDR_MSG_CONTROL') or conf
.CONFIG_SET('HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS')):
1621 default_shared_modules
.extend(TO_LIST('vfs_aio_fork'))
1623 if Options
.options
.with_pthreadpool
:
1624 default_shared_modules
.extend(TO_LIST('vfs_aio_pthread'))
1626 if conf
.CONFIG_SET('HAVE_AIO'):
1627 default_shared_modules
.extend(TO_LIST('vfs_aio_posix'))
1629 if conf
.CONFIG_SET('HAVE_LINUX_KERNEL_AIO'):
1630 default_shared_modules
.extend(TO_LIST('vfs_aio_linux'))
1632 if conf
.CONFIG_SET('HAVE_LDAP'):
1633 default_static_modules
.extend(TO_LIST('pdb_ldapsam idmap_ldap'))
1635 if conf
.CONFIG_SET('DARWINOS'):
1636 default_static_modules
.extend(TO_LIST('charset_macosxfs'))
1638 if conf
.CONFIG_SET('HAVE_GPFS'):
1639 default_shared_modules
.extend(TO_LIST('vfs_gpfs'))
1641 if conf
.CONFIG_SET('HAVE_LINUX_IOCTL'):
1642 default_shared_modules
.extend(TO_LIST('vfs_btrfs'))
1644 if conf
.CONFIG_SET('SAMBA_FAM_LIBS'):
1645 default_shared_modules
.extend(TO_LIST('vfs_notify_fam'))
1647 if conf
.CONFIG_SET("HAVE_CEPH"):
1648 default_shared_modules
.extend(TO_LIST('vfs_ceph'))
1650 if conf
.CONFIG_SET('HAVE_GLUSTERFS'):
1651 default_shared_modules
.extend(TO_LIST('vfs_glusterfs'))
1653 if conf
.CONFIG_SET('HAVE_VXFS'):
1654 default_shared_modules
.extend(TO_LIST('vfs_vxfs'))
1656 if conf
.CONFIG_SET('HAVE_DBUS'):
1657 default_shared_modules
.extend(TO_LIST('vfs_snapper'))
1659 explicit_shared_modules
= TO_LIST(Options
.options
.shared_modules
, delimiter
=',')
1660 explicit_static_modules
= TO_LIST(Options
.options
.static_modules
, delimiter
=',')
1662 def replace_list_item(lst
, item
, value
):
1664 idx
= lst
.index(item
)
1668 # PDB module file name should have the same name as module registers itself
1669 # In Autoconf build we export LDAP passdb module as ldapsam but WAF build
1670 # was always exporting pdb_ldap. In order to support existing packages
1671 # allow referring to pdb_ldapsam as pdb_ldap but use proper name internally.
1672 replace_list_item(explicit_shared_modules
, 'pdb_ldap', 'pdb_ldapsam')
1673 replace_list_item(explicit_static_modules
, 'pdb_ldap', 'pdb_ldapsam')
1675 final_static_modules
= default_static_modules
1676 final_shared_modules
= default_shared_modules
1678 for m
in explicit_static_modules
:
1679 if m
in final_shared_modules
:
1680 final_shared_modules
.remove(m
)
1681 final_static_modules
.append(m
)
1682 for m
in explicit_shared_modules
:
1683 if m
in final_static_modules
:
1684 final_static_modules
.remove(m
)
1685 final_shared_modules
.append(m
)
1687 if ("auth_domain" not in final_static_modules
) or \
1688 ("auth_builtin" not in final_static_modules
) or \
1689 ("auth_sam" not in final_static_modules
) or \
1690 ("auth_winbind" not in final_static_modules
):
1691 raise Utils
.WafError('These auth modules MUST be configured as static modules: auth_domain, auth_builtin, auth_sam, auth_winbind')
1693 conf
.env
['static_modules'] = final_static_modules
1694 conf
.env
['shared_modules'] = final_shared_modules
1696 conf
.DEFINE('STRING_STATIC_MODULES', ' '.join(final_static_modules
), quote
=True)
1701 prefixes
= ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
1702 conf
.env
['MODULE_PREFIXES'] = prefixes
1704 for m
in final_static_modules
:
1706 if not p
in static_list
:
1708 static_list
[p
].append(m
)
1709 for m
in final_shared_modules
:
1711 if not p
in shared_list
:
1713 shared_list
[p
].append(m
)
1716 static_env
= "%s_STATIC" % p
.upper()
1717 shared_env
= "%s_SHARED" % p
.upper()
1718 conf
.env
[static_env
] = []
1719 conf
.env
[shared_env
] = []
1720 if p
in static_list
:
1722 for entry
in static_list
[p
]:
1723 decl_list
+= "extern NTSTATUS %s_init(void); " % entry
1724 conf
.env
[static_env
].append('%s' % entry
)
1725 decl_list
= decl_list
.rstrip()
1726 conf
.DEFINE('static_decl_%s' % p
, decl_list
)
1727 conf
.DEFINE('static_init_%s' % p
, '{ %s_init(); }' % '_init(); '.join(static_list
[p
]))
1729 conf
.DEFINE('static_decl_%s' % p
, '')
1730 conf
.DEFINE('static_init_%s' % p
, '{}')
1731 if p
in shared_list
:
1732 for entry
in shared_list
[p
]:
1733 conf
.DEFINE('%s_init' % entry
, 'samba_init_module')
1734 conf
.env
[shared_env
].append('%s' % entry
)
1736 conf
.SAMBA_CONFIG_H('include/config.h')
1739 "build 'tags' file using ctags"
1741 source_root
= os
.path
.dirname(Utils
.g_module
.root_path
)
1742 cmd
= 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
1743 print("Running: %s" % cmd
)