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('swat')
27 opt
.SAMBA3_ADD_OPTION('ads', default
=None) # None means autodetection
28 opt
.SAMBA3_ADD_OPTION('ldap')
29 opt
.SAMBA3_ADD_OPTION('cups', with_name
="enable", without_name
="disable")
30 opt
.SAMBA3_ADD_OPTION('iprint', with_name
="enable", without_name
="disable")
31 opt
.SAMBA3_ADD_OPTION('pam')
32 opt
.SAMBA3_ADD_OPTION('pam_smbpass')
33 opt
.SAMBA3_ADD_OPTION('quotas')
34 opt
.SAMBA3_ADD_OPTION('sendfile-support')
35 opt
.SAMBA3_ADD_OPTION('utmp')
36 opt
.SAMBA3_ADD_OPTION('pthreadpool', with_name
="enable", without_name
="disable", default
=True)
37 opt
.SAMBA3_ADD_OPTION('avahi', with_name
="enable", without_name
="disable")
38 opt
.SAMBA3_ADD_OPTION('iconv')
39 opt
.SAMBA3_ADD_OPTION('acl-support')
40 opt
.SAMBA3_ADD_OPTION('dnsupdate')
41 opt
.SAMBA3_ADD_OPTION('syslog')
42 opt
.SAMBA3_ADD_OPTION('automount')
43 opt
.SAMBA3_ADD_OPTION('aio-support')
44 opt
.SAMBA3_ADD_OPTION('dmapi', default
=False, help="build with DMAPI support")
45 opt
.SAMBA3_ADD_OPTION('profiling-data', default
=False)
47 opt
.SAMBA3_ADD_OPTION('cluster-support', default
=None)
49 opt
.add_option('--with-ctdb-dir',
50 help=("Directory under which ctdb is installed"),
51 action
="store", dest
='ctdb_dir', default
=None)
52 opt
.add_option('--enable-old-ctdb',
53 help=("enable building against (too) old version of ctdb (default=false)"),
54 action
="store_true", dest
='enable_old_ctdb', default
=False)
59 from samba_utils
import TO_LIST
61 default_static_modules
= []
62 default_shared_modules
= []
64 if Options
.options
.developer
:
65 conf
.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
66 conf
.env
.developer
= True
68 if Options
.options
.with_swat
:
69 conf
.env
['build_swat'] = True
71 if sys
.platform
!= 'openbsd5':
72 conf
.ADD_LDFLAGS("-Wl,--export-dynamic", testflags
=True)
74 conf
.CHECK_HEADERS('execinfo.h libexc.h libunwind.h netdb.h')
75 conf
.CHECK_HEADERS('linux/falloc.h')
77 conf
.CHECK_FUNCS('getcwd fchown chmod fchmod mknod')
78 conf
.CHECK_FUNCS('strtol strchr strupr chflags')
79 conf
.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
80 conf
.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
81 conf
.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr')
82 conf
.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
83 conf
.CHECK_FUNCS('setpriv setgidx setuidx setgroups syscall sysconf')
84 conf
.CHECK_FUNCS('atexit grantpt posix_openpt fallocate posix_fallocate')
85 conf
.CHECK_FUNCS('fseeko setluid')
86 conf
.CHECK_FUNCS('getpwnam', headers
='sys/types.h pwd.h')
87 conf
.CHECK_FUNCS('fdopendir')
88 conf
.CHECK_FUNCS('getpwent_r setenv strcasecmp fcvt fcvtl')
89 conf
.CHECK_FUNCS('syslog vsyslog timegm setlocale')
90 conf
.CHECK_FUNCS_IN('nanosleep', 'rt')
91 conf
.CHECK_FUNCS('lutimes futimes utimensat futimens')
92 conf
.CHECK_FUNCS('mlock munlock mlockall munlockall')
93 conf
.CHECK_FUNCS('memalign posix_memalign hstrerror')
94 conf
.CHECK_FUNCS('shmget')
95 conf
.CHECK_FUNCS_IN('shm_open', 'rt', checklibc
=True)
96 conf
.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain bind_textdomain_codeset')
97 #FIXME: for some reason this one still fails
98 conf
.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
99 conf
.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
100 conf
.CHECK_FUNCS_IN('dn_expand', 'inet')
101 conf
.CHECK_DECLS('fdatasync', reverse
=True)
102 conf
.CHECK_DECLS('readahead', reverse
=True, headers
='fcntl.h')
104 if conf
.CONFIG_SET('HAVE_LONG_LONG'):
105 conf
.DEFINE('HAVE_LONGLONG', 1)
107 if conf
.CHECK_CODE('''
108 #if defined(HAVE_UNISTD_H)
111 long ret = splice(0,0,1,0,400,SPLICE_F_MOVE);
115 conf
.CHECK_DECLS('splice', reverse
=True, headers
='fcntl.h')
117 # Check for inotify support
118 conf
.CHECK_HEADERS('sys/inotify.h')
119 if "HAVE_SYS_INOTIFY_H" in conf
.env
:
120 conf
.DEFINE('HAVE_INOTIFY', 1)
122 # Check for kernel change notify support
125 #define F_NOTIFY 1026
128 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
129 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain
=False, execute
=True,
130 headers
='fcntl.h signal.h',
131 msg
="Checking for kernel change notify support")
133 # Check for Linux kernel oplocks
135 #include <sys/types.h>
139 #define F_NOTIFY 1026
142 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
143 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain
=False, execute
=True,
144 msg
="Checking for Linux kernel oplocks")
146 # Check for IRIX kernel oplock types
147 conf
.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
148 'HAVE_KERNEL_OPLOCKS_IRIX', headers
='fcntl.h',
149 msg
="Checking for IRIX kernel oplock types")
151 # Check for kernel share modes
153 #include <sys/types.h>
156 #include <sys/file.h>
162 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
163 }''', 'HAVE_KERNEL_SHARE_MODES', addmain
=False, execute
=True,
164 msg
="Checking for kernel share modes")
166 # check for DMAPI libs
167 Logs
.info("Checking for DMAPI library existence")
168 conf
.env
['dmapi_lib'] = ''
170 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'dm'):
171 samba_dmapi_lib
= 'dm'
173 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'jfsdm'):
174 samba_dmapi_lib
= 'jfsdm'
176 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'dmapi'):
177 samba_dmapi_lib
= 'dmapi'
179 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'xdsm'):
180 samba_dmapi_lib
= 'xdsm'
181 # only bother to test headers and compilation when a candidate
182 # library has been found
183 if Options
.options
.with_dmapi
== True and samba_dmapi_lib
== '':
184 conf
.fatal('DMAPI support requested, but no suitable DMAPI library found')
186 conf
.CHECK_HEADERS('sys/dmi.h xfs/dmapi.h sys/jfsdmapi.h sys/dmapi.h dmapi.h')
188 #include <time.h> /* needed by Tru64 */
189 #include <sys/types.h> /* needed by AIX */
190 #ifdef HAVE_XFS_DMAPI_H
191 #include <xfs/dmapi.h>
192 #elif defined(HAVE_SYS_DMI_H)
194 #elif defined(HAVE_SYS_JFSDMAPI_H)
195 #include <sys/jfsdmapi.h>
196 #elif defined(HAVE_SYS_DMAPI_H)
197 #include <sys/dmapi.h>
198 #elif defined(HAVE_DMAPI_H)
202 /* This link test is designed to fail on IRI 6.4, but should
203 * succeed on Linux, IRIX 6.5 and AIX.
205 int main(int argc, char **argv)
208 dm_eventset_t events;
209 /* This doesn't take an argument on IRIX 6.4. */
210 dm_init_service(&version);
211 /* IRIX 6.4 expects events to be a pointer. */
212 DMEV_ISSET(DM_EVENT_READ, events);
221 msg
='Checking whether DMAPI lib '+samba_dmapi_lib
+' can be used')
223 if conf
.CONFIG_SET('USE_DMAPI'):
224 conf
.env
['dmapi_lib'] = samba_dmapi_lib
226 if Options
.options
.with_dmapi
== True:
227 conf
.fatal('DMAPI support requested but not found');
229 # Check for various members of the stat structure
230 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define
='HAVE_STAT_ST_BLOCKS',
231 headers
='sys/stat.h')
232 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define
='HAVE_STAT_ST_BLKSIZE',
233 headers
='sys/stat.h')
234 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_flags', define
='HAVE_STAT_ST_FLAGS',
235 headers
='sys/types.h sys/stat.h unistd.h')
237 if "HAVE_BLKCNT_T" in conf
.env
:
239 return sizeof(blkcnt_t) == 4 ? 0 : 1''',
240 'SIZEOF_BLKCNT_T_4', execute
=True,
241 headers
='replace.h sys/types.h sys/stat.h unistd.h',
242 msg
="Checking whether blkcnt_t is 32 bit")
244 if "HAVE_BLKCNT_T" in conf
.env
:
246 return sizeof(blkcnt_t) == 8 ? 0 : 1''',
247 'SIZEOF_BLKCNT_T_8', execute
=True,
248 headers
='replace.h sys/types.h sys/stat.h unistd.h',
249 msg
="Checking whether blkcnt_t is 64 bit")
251 # Check for POSIX capability support
252 conf
.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers
='sys/capability.h')
254 if "HAVE_SYS_CAPABILITY_H" in conf
.env
:
258 if (!(cap = cap_get_proc())) exit(1);
260 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
261 cap_set_proc(cap);''',
262 'HAVE_POSIX_CAPABILITIES', execute
=True, lib
="cap",
263 headers
='sys/capability.h',
264 msg
="Checking whether POSIX capabilities are available")
266 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
267 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
269 if conf
.CONFIG_SET("HAVE_RPC_RPC_H"):
270 conf
.CHECK_TYPE('int16', headers
='rpc/rpc.h',
271 define
='HAVE_INT16_FROM_RPC_RPC_H',
272 msg
="Checking for int16 typedef included by rpc/rpc.h")
273 conf
.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
274 headers
='sys/types.h rpc/rpc.h',
275 msg
="Checking for uint16 typedef included by rpc/rpc.h")
276 conf
.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
277 headers
='sys/types.h rpc/rpc.h',
278 msg
="Checking for int32 typedef included by rpc/rpc.h")
279 conf
.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
280 headers
='sys/types.h rpc/rpc.h',
281 msg
="Checking for uint32 typedef included by rpc/rpc.h")
282 conf
.CHECK_CODE('int i;', 'BROKEN_NISPLUS_INCLUDE_FILES',
283 headers
='sys/types.h sys/acl.h rpcsvc/nis.h',
284 msg
="Checking for broken nisplus include files")
286 # Check if the compiler will optimize out functions
289 this_function_does_not_exist();
292 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
293 msg
="Checking if the compiler will optimize out functions")
295 # Check if the compiler supports the LL suffix on long long integers
297 conf
.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL',
299 msg
="Checking for LL suffix on long long integers")
303 bindtextdomain _chdir __chdir chflags chmod _close __close _closedir
304 __closedir crypt16 devnm dgettext dirfd
305 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
307 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
309 fsetxattr _fstat __fstat fsync
310 futimens futimes __fxstat getauthuid
311 getcwd _getcwd __getcwd getdents __getdents getdirentries
312 getgrent getgrnam getgrouplist getgrset getmntent getpagesize
313 getpwanam getpwent_r getrlimit gettext
314 glob grantpt hstrerror initgroups innetgr
315 llseek _llseek __llseek _lseek __lseek
316 _lstat __lstat lutimes
317 __lxstat memalign mknod mlock mlockall munlock munlockall
318 _open __open _opendir __opendir
319 pathconf poll posix_fallocate
320 posix_memalign prctl pread _pread __pread
321 pwrite _pwrite __pwrite
322 rdchk _read __read _readdir __readdir
324 select setenv setgidx setgroups setlocale setluid
325 setmntent setpgid setpriv setsid setuidx
326 shmget shm_open sigaction sigblock sigprocmask sigset
328 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctl sysctlbyname
329 __sys_llseek syslog _telldir __telldir textdomain timegm
330 utimensat vsyslog _write __write __xstat
334 #ifdef HAVE_SYS_PRCTL_H
335 #include <sys/prctl.h>
339 'HAVE_PRCTL', link
=False)
341 conf
.CHECK_SAMBA3_CHARSET() # see build/charset.py
343 # FIXME: these should be tests for features, but the old build system just
345 host_os
= sys
.platform
346 Logs
.info("building on %s" % host_os
)
348 # Python doesn't have case switches... :/
349 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
350 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
352 conf
.SET_TARGET_TYPE('sunacl', 'EMPTY')
353 if (host_os
.rfind('linux') > -1) or (host_os
.rfind('gnu') > -1) or (host_os
.rfind('qnx') > -1):
354 if host_os
.rfind('linux') > -1:
355 conf
.DEFINE('LINUX', '1')
356 elif host_os
.rfind('qnx') > -1:
357 conf
.DEFINE('QNX', '1')
358 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
359 elif (host_os
.rfind('darwin') > -1):
360 conf
.DEFINE('DARWINOS', 1)
361 conf
.ADD_CFLAGS('-fno-common')
362 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
363 elif (host_os
.rfind('freebsd') > -1):
364 conf
.DEFINE('FREEBSD', 1)
365 if conf
.CHECK_HEADERS('sunacl.h'):
366 conf
.DEFINE('HAVE_FREEBSD_SUNACL_H', '1')
367 conf
.CHECK_FUNCS_IN('acl', 'sunacl')
368 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
369 elif (host_os
.rfind('irix') > -1):
370 conf
.DEFINE('IRIX', 1)
371 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
372 elif (host_os
.rfind('aix') > -1):
373 conf
.DEFINE('AIX', 1)
374 conf
.DEFINE('STAT_ST_BLOCKSIZE', 'DEV_BSIZE')
375 elif (host_os
.rfind('hpux') > -1):
376 conf
.DEFINE('HPUX', 1)
377 conf
.DEFINE('STAT_ST_BLOCKSIZE', '8192')
378 elif (host_os
.rfind('osf') > -1):
379 conf
.DEFINE('OSF1', 1)
380 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
382 # FIXME: Add more checks here.
384 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
386 if Options
.options
.with_acl_support
:
387 if (host_os
.rfind('sysv5') > -1) and conf
.CHECK_FUNCS_IN('sec', 'facl', checklibc
=True):
388 Logs
.info('Using UnixWare ACLs')
389 conf
.DEFINE('HAVE_UNIXWARE_ACLS',1)
390 default_static_modules
.extend(TO_LIST('vfs_solarisacl'))
391 elif (host_os
.rfind('solaris') > -1) and conf
.CHECK_FUNCS_IN('sec', 'facl'):
392 Logs
.info('Using solaris ACLs')
393 conf
.DEFINE('HAVE_SOLARIS_ACLS',1)
394 default_static_modules
.extend(TO_LIST('vfs_solarisacl'))
395 elif (host_os
.rfind('hpux') > -1):
396 Logs
.info('Using HPUX ACLs')
397 conf
.DEFINE('HAVE_HPUX_ACLS',1)
398 conf
.DEFINE('POSIX_ACL_NEEDS_MASK',1)
399 default_static_modules
.extend(TO_LIST('vfs_hpuxacl'))
400 elif (host_os
.rfind('irix') > -1):
401 Logs
.info('Using IRIX ACLs')
402 conf
.DEFINE('HAVE_IRIX_ACLS',1)
403 default_static_modules
.extend(TO_LIST('vfs_irixacl'))
404 elif (host_os
.rfind('aix') > -1):
405 Logs
.info('Using AIX ACLs')
406 conf
.DEFINE('HAVE_AIX_ACLS',1)
407 default_static_modules
.extend(TO_LIST('vfs_aixacl'))
408 elif (host_os
.rfind('osf') > -1) and conf
.CHECK_FUNCS_IN('pacl', 'acl_get_fd'):
409 Logs
.info('Using Tru64 ACLs')
410 conf
.DEFINE('HAVE_TRU64_ACLS',1)
411 default_static_modules
.extend(TO_LIST('vfs_tru64acl'))
412 elif (host_os
.rfind('darwin') > -1):
413 Logs
.warn('ACLs on Dwarwin currently not supported')
415 conf
.CHECK_FUNCS_IN('acl_get_file', 'acl')
416 if conf
.CHECK_CODE('''
419 acl_entry_t *entry_p;
420 return acl_get_entry(acl, entry_id, entry_p);
423 headers
='sys/types.h sys/acl.h', link
=False,
424 msg
="Checking for POSIX ACL support") :
426 acl_permset_t permset_d;
428 return acl_get_perm_np(permset_d, perm);
430 'HAVE_ACL_GET_PERM_NP',
431 headers
='sys/types.h sys/acl.h', link
=True,
432 msg
="Checking whether acl_get_perm_np() is available")
433 default_static_modules
.extend(TO_LIST('vfs_posixacl'))
436 if conf
.CHECK_FUNCS('dirfd'):
437 conf
.DEFINE('HAVE_DIRFD_DECL', 1)
439 conf
.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
440 'HAVE_STATFS_F_FSID',
441 msg
="vfs_fileid: checking for statfs() and struct statfs.f_fsid",
442 headers
='sys/types.h sys/statfs.h',
445 if conf
.CONFIG_SET('HAVE_FALLOCATE'):
447 int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
448 'HAVE_LINUX_FALLOCATE',
449 msg
="Checking whether the Linux 'fallocate' function is available",
450 headers
='unistd.h sys/types.h fcntl.h linux/falloc.h')
452 ssize_t err = readahead(0,0,0x80000);''',
453 'HAVE_LINUX_READAHEAD',
454 msg
="Checking whether Linux readahead is available",
455 headers
='unistd.h fcntl.h')
456 conf
.CHECK_DECLS('readahead', headers
='fcntl.h', always
=True)
458 conf
.CHECK_CODE('int fd = openat(AT_FDCWD, ".", O_RDONLY);',
460 msg
='Checking for openat',
463 if Options
.options
.with_aio_support
:
464 conf
.CHECK_FUNCS_IN('aio_read', 'aio')
465 conf
.CHECK_FUNCS_IN('aio_read', 'rt')
466 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);',
468 msg
='Checking for asynchronous io support',
469 headers
='sys/types.h aio.h',
471 if conf
.CONFIG_SET('HAVE_AIO'):
472 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg
='Checking for aio_read', headers
='aio.h', lib
='aio rt')
473 conf
.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg
='Checking for aio_write', headers
='aio.h', lib
='aio rt')
474 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')
475 conf
.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg
='Checking for aio_return', headers
='aio.h', lib
='aio rt')
476 conf
.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg
='Checking for aio_error', headers
='aio.h', lib
='aio rt')
477 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')
478 conf
.CHECK_CODE('struct aiocb a; struct timespec t; return aio_suspend(&a, 1, &t);', 'HAVE_AIO_SUSPEND', msg
='Checking for aio_suspend', headers
='aio.h', lib
='aio rt')
479 if not conf
.CONFIG_SET('HAVE_AIO'):
480 conf
.DEFINE('HAVE_NO_AIO', '1')
482 conf
.DEFINE('HAVE_NO_AIO', '1')
484 if host_os
.rfind('linux') > -1:
485 conf
.CHECK_FUNCS_IN('io_submit', 'aio')
487 struct io_event ioev;
493 fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
494 io_queue_init(128,&ctx);
495 io_prep_pwrite(ioc, 1, buf, 1, 0);
496 io_prep_pread(ioc, 1, buf, 1, 0);
497 io_set_eventfd(ioc, fd);
498 io_set_callback(ioc, (io_callback_t)(0));
499 io_submit(ctx, 1, &ioc);
500 io_getevents(ctx, 1, 1, &ioev, &ts);
502 'HAVE_LINUX_KERNEL_AIO',
503 msg
='Checking for linux kernel asynchronous io support',
504 headers
='unistd.h stdlib.h sys/types.h fcntl.h sys/eventfd.h libaio.h',
511 char control[CMSG_SPACE(sizeof(int))];
513 msg.msg_control = control_un.control;
514 msg.msg_controllen = sizeof(control_un.control);
516 'HAVE_MSGHDR_MSG_CONTROL',
517 msg
='Checking if we can use msg_control for passing file descriptors',
518 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
522 msg.msg_acctrights = (caddr_t) &fd;
523 msg.msg_acctrightslen = sizeof(fd);
525 'HAVE_MSGHDR_MSG_ACCTRIGHTS',
526 msg
='Checking if we can use msg_acctrights for passing file descriptors',
527 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
529 if Options
.options
.with_winbind
:
530 conf
.env
.build_winbind
= True
531 conf
.DEFINE('WITH_WINBIND', '1')
533 conf
.find_program('awk', var
='AWK')
534 conf
.find_program('perl', var
='PERL')
536 conf
.CHECK_HEADERS('asm/types.h')
538 conf
.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
539 headers
='unistd.h sys/types.h',
540 msg
="Checking for major macro")
542 conf
.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
543 headers
='unistd.h sys/types.h',
544 msg
="Checking for minor macro")
546 conf
.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
547 headers
='unistd.h sys/types.h dirent.h',
548 define
='HAVE_DIRENT_D_OFF')
550 conf
.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent')
551 if conf
.CHECK_CFLAGS('-Werror-implicit-function-declaration'):
552 netgrent_cflags
= '-Werror-implicit-function-declaration'
555 conf
.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE',
556 msg
="Checking for setnetgrent prototype",
557 headers
='netdb.h netgroup.h',
558 cflags
=netgrent_cflags
)
559 conf
.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE',
560 msg
="Checking for getnetgrent prototype",
561 headers
='netdb.h netgroup.h',
562 cflags
=netgrent_cflags
)
563 conf
.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE',
564 msg
="Checking for endnetgrent prototype",
565 headers
='netdb.h netgroup.h',
566 cflags
=netgrent_cflags
)
570 if Options
.options
.with_cups
:
571 conf
.find_program('cups-config', var
='CUPS_CONFIG')
572 if conf
.env
.CUPS_CONFIG
:
573 # we would normally use --libs here, but cups-config incorrectly adds
574 # gssapi_krb5 and other libraries to its --libs output. That breaks the use
575 # of an in-tree heimdal kerberos
576 conf
.check_cfg(path
=conf
.env
.CUPS_CONFIG
, args
="--cflags --ldflags",
577 package
="", uselib_store
="CUPS")
578 conf
.CHECK_HEADERS('cups/cups.h cups/language.h', lib
='cups')
579 conf
.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups')
580 if conf
.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf
.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
581 conf
.DEFINE('HAVE_CUPS', '1')
583 conf
.undefine('HAVE_CUPS')
584 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
586 # define an empty subsystem for cups, to allow it to be used as an empty dependency
587 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
589 if Options
.options
.with_iprint
:
590 if conf
.CONFIG_SET('HAVE_CUPS'):
591 conf
.DEFINE('HAVE_IPRINT', '1')
593 Logs
.warn("--enable-iprint=yes but cups support not sufficient")
594 if Options
.options
.with_syslog
:
595 conf
.DEFINE('WITH_SYSLOG', '1')
596 if Options
.options
.with_automount
:
597 conf
.DEFINE('WITH_AUTOMOUNT', '1')
600 if Options
.options
.with_ldap
:
601 conf
.CHECK_HEADERS('ldap.h lber.h ldap_pvt.h')
602 conf
.CHECK_TYPE('ber_tag_t', 'unsigned int', headers
='ldap.h lber.h')
603 conf
.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
604 conf
.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers
='ldap.h')
606 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
608 conf
.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
609 define
='HAVE_LBER_LOG_PRINT_FN', headers
='lber.h')
611 conf
.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', 'ldap')
612 conf
.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
614 # Check if ldap_set_rebind_proc() takes three arguments
615 if conf
.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
616 'LDAP_SET_REBIND_PROC_ARGS',
617 msg
="Checking whether ldap_set_rebind_proc takes 3 arguments",
618 headers
='ldap.h lber.h', link
=False):
619 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
621 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
623 # last but not least, if ldap_init() exists, we want to use ldap
624 if conf
.CONFIG_SET('HAVE_LDAP_INIT') and conf
.CONFIG_SET('HAVE_LDAP_H'):
625 conf
.DEFINE('HAVE_LDAP', '1')
626 conf
.DEFINE('LDAP_DEPRECATED', '1')
627 conf
.env
['HAVE_LDAP'] = '1'
628 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
629 # SASL wrapping hooks
630 if conf
.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
631 conf
.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
632 conf
.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
634 conf
.SET_TARGET_TYPE('ldap', 'EMPTY')
635 conf
.SET_TARGET_TYPE('lber', 'EMPTY')
637 if Options
.options
.with_ads
== False:
645 if not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and \
646 not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC'):
647 Logs
.warn("arcfour-hmac-md5 encryption type not found in -lkrb5")
649 if not conf
.CONFIG_SET('HAVE_KRB5_MK_REQ_EXTENDED'):
650 Logs
.warn("krb5_mk_req_extended not found in -lkrb5")
652 if not conf
.CONFIG_SET('HAVE_KRB5_GET_HOST_REALM'):
653 Logs
.warn("krb5_get_host_realm not found in -lkrb5")
655 if not conf
.CONFIG_SET('HAVE_KRB5_FREE_HOST_REALM'):
656 Logs
.warn("krb5_free_host_realm not found in -lkrb5")
658 if not conf
.CONFIG_SET('HAVE_KRB5_FWD_TGT_CREDS'):
659 Logs
.warn("krb5_fwd_tgt_creds found in -lkrb5")
661 if not conf
.CONFIG_SET('HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC'):
662 Logs
.warn("krb5_get_init_creds_opt_alloc not found in -lkrb5")
664 if not conf
.CONFIG_SET('KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT'):
665 Logs
.warn("krb5_get_init_creds_opt_free was not found or was too old in -lkrb5")
667 if not conf
.CONFIG_SET('HAVE_KRB5_GET_RENEWED_CREDS'):
668 Logs
.warn("krb5_get_renewed_creds not found in -lkrb5")
670 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL_COMPARE_ANY_REALM'):
671 Logs
.warn("krb5_principal_compare_any_realm not found in -lkrb5")
673 if not conf
.CONFIG_SET('HAVE_KRB5_C_STRING_TO_KEY') and \
674 not conf
.CONFIG_SET('HAVE_KRB5_STRING_TO_KEY_SALT'):
675 Logs
.warn("krb5_c_string_to_key not found in -lkrb5")
677 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL2SALT') and \
678 not conf
.CONFIG_SET('HAVE_KRB5_GET_PW_SALT'):
679 Logs
.warn("no CREATE_KEY_FUNCTIONS detected")
681 if not conf
.CONFIG_SET('HAVE_KRB5_GET_PERMITTED_ENCTYPES') and \
682 not conf
.CONFIG_SET('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES'):
683 Logs
.warn("no GET_ENCTYPES_FUNCTIONS detected")
685 if not conf
.CONFIG_SET('HAVE_KRB5_KT_FREE_ENTRY') and \
686 not conf
.CONFIG_SET('HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS'):
687 Logs
.warn("no KT_FREE_FUNCTION detected")
689 if not conf
.CONFIG_SET('HAVE_KRB5_C_VERIFY_CHECKSUM'):
690 Logs
.warn("krb5_c_verify_checksum_compare not found in -lkrb5")
693 # We don't actually use
694 # gsskrb5_extract_authz_data_from_sec_context, but it is a
695 # clue that this Heimdal, which does the PAC processing we
696 # need on the standard gss_inquire_sec_context_by_oid
697 if not conf
.CONFIG_SET('HAVE_GSS_GET_NAME_ATTRIBUTE') and \
698 not (conf
.CONFIG_SET('HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT') and \
699 conf
.CONFIG_SET('HAVE_GSS_INQUIRE_SEC_CONTEXT_BY_OID')):
700 Logs
.warn("need eiterh gss_get_name_attribute or gsskrb5_extract_authz_data_from_sec_context and gss_inquire_sec_context_by_oid in -lgssapi for PAC support")
703 if not conf
.CONFIG_SET('HAVE_GSS_KRB5_EXPORT_LUCID_SEC_CONTEXT'):
704 Logs
.warn("need gss_krb5_export_lucid_sec_context for SPNEGO and gss_wrap support")
708 conf
.DEFINE('HAVE_KRB5', '1')
709 conf
.env
['HAVE_KRB5'] = '1'
711 conf
.undefine('HAVE_KRB5_H')
712 conf
.undefine('HAVE_GSSAPI_H')
713 conf
.undefine('HAVE_GSSAPI_GSSAPI_GENERIC_H')
714 conf
.undefine('HAVE_GSSAPI_GSSAPI_H')
717 if not conf
.CONFIG_SET('HAVE_LDAP'):
722 conf
.DEFINE('WITH_ADS', '1')
723 conf
.env
['HAVE_ADS'] = '1'
724 Logs
.info("Building with Active Directory support.")
725 elif Options
.options
.with_ads
== False:
726 Logs
.info("Building without Active Directory support (--without-ads).")
729 Logs
.warn("Active Directory support not available: krb5 libs don't have all required features")
731 Logs
.warn("Active Directory support not available: LDAP support ist not available.")
732 if Options
.options
.with_ads
:
733 conf
.fatal("Active Directory support not found. Use --without-ads for building without Active Directory support.")
735 # this is the auto-mode case
736 Logs
.warn("Building without Active Directory support.")
739 if Options
.options
.with_utmp
:
740 conf
.env
.with_utmp
= True
741 if not conf
.CHECK_HEADERS('utmp.h'): conf
.env
.with_utmp
= False
742 conf
.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
743 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers
='utmp.h',
744 define
='HAVE_UT_UT_NAME')
745 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers
='utmp.h',
746 define
='HAVE_UT_UT_USER')
747 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers
='utmp.h',
748 define
='HAVE_UT_UT_ID')
749 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers
='utmp.h',
750 define
='HAVE_UT_UT_HOST')
751 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers
='utmp.h',
752 define
='HAVE_UT_UT_TIME')
753 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers
='utmp.h',
754 define
='HAVE_UT_UT_TV')
755 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers
='utmp.h',
756 define
='HAVE_UT_UT_TYPE')
757 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers
='utmp.h',
758 define
='HAVE_UT_UT_PID')
759 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers
='utmp.h',
760 define
='HAVE_UT_UT_EXIT')
761 conf
.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers
='utmpx.h',
762 define
='HAVE_UX_UT_SYSLEN')
763 conf
.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
764 'PUTUTLINE_RETURNS_UTMP', headers
='utmp.h',
765 msg
="Checking whether pututline returns pointer")
766 conf
.CHECK_SIZEOF(['((struct utmp *)NULL)->ut_line'], headers
='utmp.h',
767 define
='SIZEOF_UTMP_UT_LINE')
768 if not conf
.CONFIG_SET('SIZEOF_UTMP_UT_LINE'):
769 conf
.env
.with_utmp
= False
770 elif int(conf
.env
.SIZEOF_UTMP_UT_LINE
) < 15:
771 conf
.env
.with_utmp
= False
772 if conf
.env
.with_utmp
:
773 conf
.DEFINE('WITH_UTMP', 1)
775 Logs
.warn("--with-utmp but utmp support not sufficient")
777 if Options
.options
.with_avahi
:
778 conf
.env
.with_avahi
= True
779 if not conf
.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf
.env
.with_avahi
= False
780 if not conf
.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf
.env
.with_avahi
= False
781 if not conf
.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf
.env
.with_avahi
= False
782 if conf
.env
.with_avahi
:
783 conf
.DEFINE('WITH_AVAHI_SUPPORT', 1)
785 conf
.SET_TARGET_TYPE('avahi-common', 'EMPTY')
786 conf
.SET_TARGET_TYPE('avahi-client', 'EMPTY')
788 if Options
.options
.with_iconv
:
789 conf
.env
.with_iconv
= True
790 if not conf
.CHECK_FUNCS_IN('iconv_open', 'iconv', headers
='iconv.h'):
791 conf
.env
.with_iconv
= False
792 if conf
.env
.with_iconv
:
793 conf
.DEFINE('HAVE_ICONV', 1)
795 if Options
.options
.with_pam
:
797 conf
.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
798 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
799 Logs
.warn("--with-pam=yes but pam_appl.h not found")
801 conf
.CHECK_FUNCS_IN('pam_get_data', 'pam')
802 conf
.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h')
803 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'):
804 Logs
.warn("--with-pam=yes but pam_modules.h not found")
806 conf
.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h')
807 conf
.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h')
808 conf
.CHECK_FUNCS_IN('pam_vsyslog', 'pam')
810 #if defined(HAVE_SECURITY_PAM_APPL_H)
811 #include <security/pam_appl.h>
812 #elif defined(HAVE_PAM_PAM_APPL_H)
813 #include <pam/pam_appl.h>
815 pam_set_item(0, PAM_RHOST, 0);
819 msg
="Checking whether PAM_RHOST is available");
821 #if defined(HAVE_SECURITY_PAM_APPL_H)
822 #include <security/pam_appl.h>
823 #elif defined(HAVE_PAM_PAM_APPL_H)
824 #include <pam/pam_appl.h>
826 pam_set_item(0, PAM_TTY, 0);
830 msg
="Checking whether PAM_TTY is available");
832 #if (!defined(LINUX))
834 #define PAM_EXTERN extern
835 #if defined(HAVE_SECURITY_PAM_APPL_H)
836 #include <security/pam_appl.h>
837 #elif defined(HAVE_PAM_PAM_APPL_H)
838 #include <pam/pam_appl.h>
843 #if defined(HAVE_SECURITY_PAM_MODULES_H)
844 #include <security/pam_modules.h>
845 #elif defined(HAVE_PAM_PAM_MODULES_H)
846 #include <pam/pam_modules.h>
849 #if defined(HAVE_SECURITY__PAM_MACROS_H)
850 #include <security/_pam_macros.h>
851 #elif defined(HAVE_PAM__PAM_MACROS_H)
852 #include <pam/_pam_macros.h>
855 #ifdef HAVE_SECURITY_PAM_EXT_H
856 #include <security/pam_ext.h>
859 int i; i = PAM_RADIO_TYPE;
861 'HAVE_PAM_RADIO_TYPE',
863 msg
="Checking whether PAM_RADIO_TYPE is available");
865 conf
.DEFINE('WITH_PAM', 1)
866 conf
.DEFINE('WITH_PAM_MODULES', 1)
868 if Options
.options
.with_pam_smbpass
:
869 conf
.env
.with_pam_smbpass
= True
874 # Ensure we select the correct set of system calls on Linux.
876 if (host_os
.rfind('linux') > -1):
878 #if defined(HAVE_UNISTD_H)
883 #include <sys/types.h>
886 #ifdef HAVE_SYS_PRIV_H
887 #include <sys/priv.h>
893 #if defined(HAVE_SYSCALL_H)
897 #if defined(HAVE_SYS_SYSCALL_H)
898 #include <sys/syscall.h>
901 syscall(SYS_setresuid32, -1, -1, -1);
902 syscall(SYS_setresgid32, -1, -1, -1);
903 syscall(SYS_setreuid32, -1, -1);
904 syscall(SYS_setregid32, -1, -1);
905 syscall(SYS_setuid32, -1);
906 syscall(SYS_setgid32, -1);
907 syscall(SYS_setgroups32, 0, NULL);
909 'USE_LINUX_32BIT_SYSCALLS',
910 msg
="Checking whether Linux should use 32-bit credential calls");
912 if (conf
.CONFIG_SET('USE_LINUX_32BIT_SYSCALLS')):
913 seteuid
= conf
.CHECK_CODE('''
914 #define AUTOCONF_TEST 1
915 #define USE_LINUX_THREAD_CREDENTIALS 1
916 #define USE_LINUX_32BIT_SYSCALLS 1
917 #include "../lib/util/setid.c"
918 #include "./lib/util_sec.c"
920 'USE_LINUX_THREAD_CREDENTIALS',
923 msg
="Checking whether we can use Linux thread-specific credentials with 32-bit system calls")
925 seteuid
= conf
.CHECK_CODE('''
926 #define AUTOCONF_TEST 1
927 #define USE_LINUX_THREAD_CREDENTIALS 1
928 #include "../lib/util/setid.c"
929 #include "./lib/util_sec.c"
931 'USE_LINUX_THREAD_CREDENTIALS',
934 msg
="Checking whether we can use Linux thread-specific credentials")
936 seteuid
= conf
.CHECK_CODE('''
937 #define AUTOCONF_TEST 1
938 #define USE_SETREUID 1
939 #include "../lib/util/setid.c"
940 #include "./lib/util_sec.c"
945 msg
="Checking whether setreuid is available")
947 seteuid
= conf
.CHECK_CODE('''
948 #define AUTOCONF_TEST 1
949 #define USE_SETRESUID 1
950 #include "../lib/util/setid.c"
951 #include "./lib/util_sec.c"
956 msg
="Checking whether setresuid is available")
958 seteuid
= conf
.CHECK_CODE('''
959 #define AUTOCONF_TEST 1
960 #define USE_SETEUID 1
961 #include "../lib/util/setid.c"
962 #include "./lib/util_sec.c"
967 msg
="Checking whether seteuid is available")
969 seteuid
= conf
.CHECK_CODE('''
970 #define AUTOCONF_TEST 1
971 #define USE_SETUIDX 1
972 #include "../lib/util/setid.c"
973 #include "./lib/util_sec.c"
979 msg
="Checking whether setuidx is available")
980 if Options
.options
.with_dnsupdate
:
981 if not conf
.CONFIG_SET('HAVE_KRB5'):
982 Logs
.warn("--with-dnsupdate=yes but gssapi support not sufficient")
984 conf
.DEFINE('WITH_DNS_UPDATES', 1)
985 conf
.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
986 if Options
.options
.developer
:
987 if conf
.CONFIG_SET('HAVE_VALGRIND_H') or conf
.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'):
988 conf
.DEFINE('VALGRIND', '1')
990 if conf
.CHECK_CODE('''
991 #include <bits/sockaddr.h>
992 #include <linux/netlink.h>
994 'HAVE_LINUX_NETLINK_H',
995 msg
="Checking whether Linux netlink is available"):
998 #include <bits/sockaddr.h>
999 #include <linux/netlink.h>
1000 #include <linux/rtnetlink.h>
1002 'HAVE_LINUX_RTNETLINK_H',
1003 msg
='Checking whether Linux rtnetlink is available')
1006 #include "../tests/fcntl_lock.c"
1011 msg
='Checking whether fcntl locking is available')
1013 # glibc up to 2.3.6 had dangerously broken posix_fallocate(). DON'T USE IT.
1014 if not conf
.CHECK_CODE('''
1015 #define _XOPEN_SOURCE 600
1017 #if defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4))
1018 #error probably broken posix_fallocate
1021 '_HAVE_UNBROKEN_POSIX_FALLOCATE',
1022 msg
='Checking for broken posix_fallocate'):
1023 conf
.DEFINE('HAVE_BROKEN_POSIX_FALLOCATE', '1')
1026 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec',
1027 define
='HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') # Linux, Solaris
1028 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimensec',
1029 define
='HAVE_STRUCT_STAT_ST_MTIMENSEC') # BSD, if defined _POSIX_SOURCE
1030 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimespec.tv_nsec',
1031 define
='HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') # BSD, if not defined _POSIX_SOURCE
1032 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtime_n',
1033 define
='HAVE_STRUCT_STAT_ST_MTIME_N') # AIX
1034 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_umtime',
1035 define
='HAVE_STRUCT_STAT_ST_UMTIME') # Tru64
1036 if conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') or \
1037 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMENSEC') or \
1038 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') or \
1039 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIME_N') or \
1040 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_UMTIME'):
1041 conf
.DEFINE('HAVE_STAT_HIRES_TIMESTAMPS', '1')
1043 # recent FreeBSD, NetBSD have creation timestamps called birthtime:
1044 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtime',
1045 define
='HAVE_STRUCT_STAT_ST_BIRTHTIME')
1046 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimespec.tv_nsec',
1047 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC')
1048 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimensec',
1049 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC')
1052 ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
1054 'HAVE_POSIX_FADVISE',
1055 msg
='Checking whether posix_fadvise is available',
1056 headers
='unistd.h fcntl.h')
1058 for v
in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]:
1061 return sysconf(%s) == -1 ? 1 : 0;
1064 msg
='Checking whether sysconf(%s) is available' % v
)
1067 #include <sys/syscall.h>
1069 syscall(SYS_initgroups, 16, NULL, NULL, 0);
1071 'HAVE_DARWIN_INITGROUPS',
1072 msg
='Checking whether to use the Darwin-specific initgroups system call')
1074 conf
.CHECK_CODE('''struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''',
1076 headers
='sys/types.h utime.h',
1077 msg
='Checking whether struct utimbuf is available')
1079 if conf
.CHECK_CODE('''struct sigevent s;''',
1080 'HAVE_STRUCT_SIGEVENT',
1081 headers
='sys/types.h stdlib.h stddef.h signal.h',
1082 msg
='Checking whether we have the struct sigevent'):
1083 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sival_ptr',
1084 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR',
1085 headers
='signal.h');
1086 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sigval_ptr',
1087 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR',
1088 headers
='signal.h');
1090 if os
.path
.exists('/proc/sys/kernel/core_pattern'):
1091 conf
.DEFINE('HAVE_SYS_KERNEL_PROC_CORE_PATTERN', '1')
1093 if conf
.CHECK_CODE('''
1097 if (sizeof(time_t) == 8) {
1098 time_t max_time = 0x7fffffffffffffffll;
1099 tm = gmtime(&max_time);
1100 /* This should fail with 32-bit tm_year. */
1102 /* Max time_t that works with 32-bit int tm_year in struct tm. */
1103 max_time = 67768036191676799ll;
1104 tm = gmtime(&max_time);
1115 msg
="Checking for the maximum value of the 'time_t' type"):
1116 conf
.DEFINE('TIME_T_MAX', '67768036191676799ll')
1119 #if defined(HAVE_UNISTD_H)
1122 #include <sys/types.h>
1123 main() { dev_t dev = makedev(1,2); return 0; }
1127 msg
='Checking whether the macro for makedev is available')
1134 void exit_on_core(int ignored) {
1140 signal(SIGSEGV, exit_on_core);
1141 newpath = realpath("/tmp", NULL);
1142 exit((newpath != NULL) ? 0 : 1);
1145 'REALPATH_TAKES_NULL',
1148 msg
='Checking whether the realpath function allows a NULL argument')
1150 conf
.CHECK_CODE('''#include "../tests/ftruncate.c"''',
1151 'HAVE_FTRUNCATE_EXTEND',
1152 msg
='Checking for ftruncate extend',
1156 if Options
.options
.with_sendfile_support
:
1157 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):
1162 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1165 headers
='sys/sendfile.h',
1166 msg
='Checking for linux sendfile support')
1168 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1169 conf
.DEFINE('HAVE_SENDFILE', '1')
1170 conf
.DEFINE('LINUX_SENDFILE_API', '1')
1171 conf
.DEFINE('WITH_SENDFILE', '1')
1172 elif (host_os
.rfind('freebsd') > -1) or (host_os
.rfind('dragonfly') > -1):
1174 #include <sys/types.h>
1176 #include <sys/socket.h>
1177 #include <sys/uio.h>
1178 int fromfd, tofd, ret, total=0;
1179 off_t offset, nwritten;
1182 hdr.headers = &hdtrl;
1184 hdr.trailers = NULL;
1186 hdtrl.iov_base = NULL;
1188 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0)
1191 msg
='Checking for freebsd sendfile support')
1192 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1193 conf
.DEFINE('HAVE_SENDFILE', '1')
1194 conf
.DEFINE('FREEBSD_SENDFILE_API', '1')
1195 conf
.DEFINE('WITH_SENDFILE', '1')
1196 elif (host_os
.rfind('darwin') > -1):
1198 #include <sys/types.h>
1199 #include <sys/socket.h>
1200 #include <sys/uio.h>
1201 int fromfd, tofd, ret;
1202 off_t offset, nwritten;
1205 hdr.headers = &hdtrl;
1207 hdr.trailers = (void *)0;
1209 hdtrl.iov_base = (void *)0;
1211 ret = sendfile(fromfd, tofd, offset, &nwritten, &hdr, 0);
1214 msg
='Checking for darwin sendfile support')
1215 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1216 conf
.DEFINE('HAVE_SENDFILE', '1')
1217 conf
.DEFINE('DARWIN_SENDFILE_API', '1')
1218 conf
.DEFINE('WITH_SENDFILE', '1')
1219 elif (host_os
.rfind('hpux') > -1) or (host_os
.rfind('osf') > -1):
1221 #include <sys/socket.h>
1222 #include <sys/uio.h>
1225 struct iovec hdtrl[2];
1228 hdtrl[0].iov_base = 0;
1229 hdtrl[0].iov_len = 0;
1230 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
1233 msg
='Checking for osf/hpux sendfile support')
1234 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1235 conf
.DEFINE('HAVE_SENDFILE', '1')
1236 conf
.DEFINE('HPUX_SENDFILE_API', '1')
1237 conf
.DEFINE('WITH_SENDFILE', '1')
1238 elif (host_os
.rfind('solaris') > -1):
1239 conf
.CHECK_FUNCS_IN('sendfile', 'sendfilev')
1241 #include <sys/sendfile.h>,
1244 struct sendfilevec vec[2];
1248 vec[0].sfv_fd = SFV_FD_SELF;
1249 vec[0].sfv_flag = 0;
1253 vec[1].sfv_flag = 0;
1256 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
1259 msg
='Checking for solaris sendfilev support')
1260 if conf
.CONFIG_SET('_HAVE_SENDFILEV'):
1261 conf
.DEFINE('HAVE_SENDFILEV', '1')
1262 conf
.DEFINE('SOLARIS_SENDFILE_API', '1')
1263 conf
.DEFINE('WITH_SENDFILE', '1')
1264 elif (host_os
.rfind('aix') > -1):
1266 #include <sys/socket.h>
1269 struct sf_parms hdtrl;
1271 hdtrl.header_data = 0;
1272 hdtrl.header_length = 0;
1273 hdtrl.file_descriptor = fromfd;
1274 hdtrl.file_offset = 0;
1275 hdtrl.file_bytes = 0;
1276 hdtrl.trailer_data = 0;
1277 hdtrl.trailer_length = 0;
1278 nwritten = send_file(&tofd, &hdtrl, 0);
1281 msg
='Checking for AIX send_file support')
1282 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1283 conf
.DEFINE('HAVE_SENDFILE', '1')
1284 conf
.DEFINE('AIX_SENDFILE_API', '1')
1285 conf
.DEFINE('WITH_SENDFILE', '1')
1287 # Check for getcwd allowing a NULL arg.
1291 char *s = getcwd(NULL,0);
1292 exit(s != NULL ? 0 : 1);
1293 }''', 'GETCWD_TAKES_NULL', addmain
=False, execute
=True,
1294 msg
="getcwd takes a NULL argument")
1297 # UnixWare 7.x has its getspnam in -lgen
1298 conf
.CHECK_FUNCS_IN('getspnam', 'gen')
1299 conf
.CHECK_FUNCS_IN('getspnam', 'security')
1300 conf
.CHECK_FUNCS_IN('getspnam', 'sec')
1302 if Options
.options
.with_quotas
:
1303 # For quotas on Veritas VxFS filesystems
1304 conf
.CHECK_HEADERS('sys/fs/vx_quota.h')
1305 # For sys/quota.h and linux/quota.h
1306 conf
.CHECK_HEADERS('sys/quota.h')
1307 # For quotas on BSD systems
1308 conf
.CHECK_HEADERS('ufs/ufs/quota.h')
1309 # For quotas on Linux XFS filesystems
1310 if conf
.CHECK_HEADERS('xfs/xqm.h'):
1311 conf
.DEFINE('HAVE_XFS_QUOTAS', '1')
1315 #include "confdefs.h"
1316 #ifdef HAVE_SYS_TYPES_H
1317 #include <sys/types.h>
1319 #ifdef HAVE_ASM_TYPES_H
1320 #include <asm/types.h>
1322 #include <sys/quota.h>
1323 int i = Q_XGETQUOTA;''',
1324 define
='HAVE_XFS_QUOTAS',
1325 msg
='for XFS QUOTA in <sys/quota.h>',
1327 local_include
=False)
1329 # For IRIX like dqb_isoftlimit instead of dqb_fsoftlimit in struc dqblk
1330 conf
.CHECK_STRUCTURE_MEMBER('struct dqblk', 'dqb_fsoftlimit', define
='HAVE_DQB_FSOFTLIMIT',
1331 headers
='sys/quota.h')
1332 #darwin style quota bytecount
1333 conf
.CHECK_STRUCTURE_MEMBER('struct dqblk', 'dqb_curbytes', define
='HAVE_STRUCT_DQBLK_DQB_CURBYTES',
1334 headers
='sys/quota.h')
1335 if conf
.CHECK_HEADERS('rpcsvc/rquota.h'):
1336 conf
.DEFINE('HAVE_NFS_QUOTAS', '1')
1337 conf
.CHECK_STRUCTURE_MEMBER('struct getquota_rslt', 'getquota_rslt_u',
1338 define
='HAVE_GETQUOTA_RSLT_GETQUOTA_RSLT_U',
1339 headers
='rpcsvc/rquota.h')
1341 if (host_os
.rfind('linux') > -1):
1342 conf
.DEFINE('HAVE_QUOTACTL_LINUX', '1')
1343 elif not conf
.CONFIG_SET("HAVE_XFS_QUOTAS"):
1344 if not conf
.CHECK_CODE('''
1345 #define HAVE_QUOTACTL_4A 1
1346 #define AUTOCONF_TEST 1
1347 #include "../tests/sysquotas.c"
1349 cflags
=conf
.env
['WERROR_CFLAGS'],
1350 define
='HAVE_QUOTACTL_4A',
1351 msg
='for QUOTACTL_4A: long quotactl(int cmd, char *special, qid_t id, caddr_t addr)',
1356 #define HAVE_QUOTACTL_4B 1
1357 #define AUTOCONF_TEST 1
1358 #include "../tests/sysquotas.c"
1360 cflags
=conf
.env
['WERROR_CFLAGS'],
1361 define
='HAVE_QUOTACTL_4B',
1362 msg
='for QUOTACTL_4B: int quotactl(const char *path, int cmd, int id, char *addr)',
1367 clnt_create("", RQUOTAPROG, RQUOTAVERS, "udp");
1369 headers
="rpc/rpc.h rpc/types.h rpcsvc/rquota.h rpc/nettype.h rpc/xdr.h",
1370 define
='HAVE_NFS_QUOTAS',
1371 msg
='for NFS QUOTAS',
1373 local_include
=False)
1375 if conf
.CONFIG_SET('HAVE_QUOTACTL_LINUX') or \
1376 conf
.CONFIG_SET('HAVE_QUOTACTL_4A') or \
1377 conf
.CONFIG_SET('HAVE_QUOTACTL_4B') or \
1378 conf
.CONFIG_SET('HAVE_XFS_QUOTAS'):
1379 conf
.DEFINE('HAVE_SYS_QUOTAS', '1')
1380 conf
.DEFINE('WITH_QUOTAS', '1')
1383 # checking for clustering extensions (CTDB)
1385 if Options
.options
.with_cluster_support
== False:
1386 # configure is called with --without-cluster-support,
1387 # so don't check for and build w/o ctdb support.
1388 have_cluster_support
= False
1392 if Options
.options
.ctdb_dir
:
1393 conf
.ADD_EXTRA_INCLUDES(Options
.options
.ctdb_dir
+ '/include')
1395 srcdir
= os
.path
.realpath(conf
.srcdir
)
1396 if 'EXTRA_INCLUDES' in conf
.env
:
1397 includes
= ' '.join(conf
.env
['EXTRA_INCLUDES']).replace('#', srcdir
+ '/')
1401 if not conf
.env
.USING_SYSTEM_TDB
:
1402 includes
= includes
+ ' ' + srcdir
+ '/lib/tdb/include'
1404 if not conf
.env
.USING_SYSTEM_TALLOC
:
1405 includes
= includes
+ ' ' + srcdir
+ '/lib/talloc'
1407 have_cluster_support
= True
1412 #include "replace.h"
1413 #include "system/wait.h"
1414 #include "system/network.h"
1415 #define private #error __USED_RESERVED_WORD_private__
1428 msg
='Checking for header ctdb.h')
1430 if not conf
.CONFIG_SET('HAVE_CTDB_H'):
1431 have_cluster_support
= False
1432 ctdb_broken
= "ctdb.h is required for cluster support"
1434 if have_cluster_support
:
1437 #include "replace.h"
1438 #include "system/wait.h"
1439 #include "system/network.h"
1440 #define private #error __USED_RESERVED_WORD_private__
1444 #include <ctdb_private.h>
1451 'HAVE_CTDB_PRIVATE_H',
1454 msg
='Checking for header ctdb_private.h')
1456 if not conf
.CONFIG_SET('HAVE_CTDB_PRIVATE_H'):
1457 have_cluster_support
= False
1458 ctdb_broken
= "ctdb_private.h is required for cluster support"
1460 if have_cluster_support
:
1463 #include "replace.h"
1464 #include "system/wait.h"
1465 #include "system/network.h"
1466 #define private #error __USED_RESERVED_WORD_private__
1470 #include <ctdb_protocol.h>
1477 'HAVE_CTDB_PROTOCOL_H',
1480 msg
='Checking for header ctdb_protocol.h')
1482 if have_cluster_support
:
1485 #include "replace.h"
1486 #include "system/wait.h"
1487 #include "system/network.h"
1491 #include <ctdb_private.h>
1495 int i = (int)CTDB_CONTROL_TRANS3_COMMIT;
1499 'HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL',
1502 msg
='Checking for transaction support (TRANS3_COMMIT control)')
1504 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL'):
1505 have_cluster_support
= False
1506 ctdb_broken
= "ctdb transaction support missing or too old"
1508 if have_cluster_support
:
1511 #include "replace.h"
1512 #include "system/wait.h"
1513 #include "system/network.h"
1517 #include <ctdb_private.h>
1521 int i = (int)CTDB_CONTROL_SCHEDULE_FOR_DELETION;
1525 'HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL',
1528 msg
='Checking for SCHEDULE_FOR_DELETION control')
1530 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL'):
1531 if not Options
.options
.enable_old_ctdb
:
1532 have_cluster_support
= False
1533 ctdb_broken
= "SCHEDULE_FOR_DELETION control missing"
1535 Logs
.warn("ignoring missing SCHEDULE_FOR_DELETION control (--enable-old-ctdb)")
1537 if have_cluster_support
:
1540 #include "replace.h"
1541 #include "system/wait.h"
1542 #include "system/network.h"
1546 #include <ctdb_private.h>
1550 struct ctdb_control_tcp _x;
1554 'HAVE_STRUCT_CTDB_CONTROL_TCP',
1557 msg
='Checking for ctdb ipv4 support')
1559 if not conf
.CONFIG_SET('HAVE_STRUCT_CTDB_CONTROL_TCP'):
1560 have_cluster_support
= False
1561 ctdb_broken
= "missing struct ctdb_control_tcp"
1563 if have_cluster_support
:
1566 #include "replace.h"
1567 #include "system/wait.h"
1568 #include "system/network.h"
1572 #include <ctdb_private.h>
1576 struct ctdb_control_tcp_addr _x;
1580 'HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR',
1583 msg
='Checking for ctdb ipv6 support')
1585 if have_cluster_support
:
1588 #include "replace.h"
1589 #include "system/wait.h"
1590 #include "system/network.h"
1594 #include <ctdb_private.h>
1598 int i = (int)CTDB_CONTROL_CHECK_SRVIDS;
1602 'HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL',
1605 msg
='Checking for CHECK_SRVIDS control')
1607 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL'):
1608 if not Options
.options
.enable_old_ctdb
:
1609 have_cluster_support
= False
1610 ctdb_broken
= "CHECK_SRVIDS control missing"
1612 Logs
.warn("ignoring missing CHECK_SRVIDS control (--enable-old-ctdb)")
1614 if have_cluster_support
:
1615 Logs
.info("building with cluster support")
1616 conf
.DEFINE('CLUSTER_SUPPORT', 1);
1618 if Options
.options
.with_cluster_support
== False:
1619 Logs
.info("building without cluster support (--without-cluster-support)")
1620 elif Options
.options
.with_cluster_support
== True:
1621 Logs
.error("Cluster support not available: " + ctdb_broken
)
1622 conf
.fatal("Cluster support not found, but --with-cluster-support was specified")
1624 Logs
.info("building without cluster support: " + ctdb_broken
)
1625 conf
.undefine('CLUSTER_SUPPORT')
1628 conf
.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }',
1629 'HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR',
1632 msg
='Checking whether we can compile with __attribute__((destructor))')
1634 conf
.CHECK_CODE('void seekdir(DIR *d, long loc) { return; }',
1635 'SEEKDIR_RETURNS_VOID',
1636 headers
='sys/types.h dirent.h',
1637 msg
='Checking whether seekdir returns void')
1639 if Options
.options
.with_profiling_data
:
1640 conf
.DEFINE('WITH_PROFILE', 1);
1642 PTHREAD_CFLAGS
='error'
1643 PTHREAD_LDFLAGS
='error'
1645 if PTHREAD_LDFLAGS
== 'error':
1646 if conf
.CHECK_FUNCS_IN('pthread_attr_init', 'pthread'):
1647 PTHREAD_CFLAGS
='-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS'
1648 PTHREAD_LDFLAGS
='-lpthread'
1649 if PTHREAD_LDFLAGS
== 'error':
1650 if conf
.CHECK_FUNCS_IN('pthread_attr_init', 'pthreads'):
1651 PTHREAD_CFLAGS
='-D_THREAD_SAFE'
1652 PTHREAD_LDFLAGS
='-lpthreads'
1653 if PTHREAD_LDFLAGS
== 'error':
1654 if conf
.CHECK_FUNCS_IN('pthread_attr_init', 'c_r'):
1655 PTHREAD_CFLAGS
='-D_THREAD_SAFE -pthread'
1656 PTHREAD_LDFLAGS
='-pthread'
1657 if PTHREAD_LDFLAGS
== 'error':
1658 if conf
.CHECK_FUNCS('pthread_attr_init'):
1659 PTHREAD_CFLAGS
='-D_REENTRANT'
1660 PTHREAD_LDFLAGS
='-lpthread'
1661 # especially for HP-UX, where the CHECK_FUNC macro fails to test for
1662 # pthread_attr_init. On pthread_mutex_lock it works there...
1663 if PTHREAD_LDFLAGS
== 'error':
1664 if conf
.CHECK_FUNCS_IN('pthread_mutex_lock', 'pthread'):
1665 PTHREAD_CFLAGS
='-D_REENTRANT'
1666 PTHREAD_LDFLAGS
='-lpthread'
1668 if PTHREAD_CFLAGS
!= 'error' and PTHREAD_LDFLAGS
!= 'error':
1669 conf
.ADD_CFLAGS(PTHREAD_CFLAGS
)
1670 conf
.ADD_LDFLAGS(PTHREAD_LDFLAGS
)
1671 conf
.CHECK_HEADERS('pthread.h')
1672 conf
.DEFINE('HAVE_PTHREAD', '1')
1674 if Options
.options
.with_pthreadpool
:
1675 if conf
.CONFIG_SET('HAVE_PTHREAD'):
1676 conf
.DEFINE('WITH_PTHREADPOOL', '1')
1678 Logs
.warn("pthreadpool support cannot be enabled when pthread support was not found")
1679 conf
.undefine('WITH_PTHREADPOOL')
1681 if conf
.CHECK_HEADERS('gpfs_gpl.h'):
1682 conf
.DEFINE('HAVE_GPFS', '1')
1684 default_static_modules
.extend(TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
1685 auth_sam auth_unix auth_winbind auth_wbc
1686 auth_domain auth_builtin vfs_default
1687 nss_info_template idmap_tdb idmap_passdb
1690 default_shared_modules
.extend(TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
1691 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
1692 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2
1693 auth_script vfs_readahead vfs_xattr_tdb vfs_posix_eadb
1694 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
1695 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
1698 vfs_crossrename vfs_linux_xfs_sgid
1699 vfs_time_audit idmap_autorid idmap_tdb2
1700 idmap_rid idmap_hash'''))
1702 if Options
.options
.developer
:
1703 default_static_modules
.extend(TO_LIST('charset_weird'))
1704 default_shared_modules
.extend(TO_LIST('perfcount_test'))
1705 default_shared_modules
.extend(TO_LIST('vfs_skel_opaque vfs_skel_transparent vfs_shadow_copy_test'))
1706 default_shared_modules
.extend(TO_LIST('auth_skel pdb_test'))
1708 if Options
.options
.enable_selftest
or Options
.options
.developer
:
1709 default_shared_modules
.extend(TO_LIST('vfs_fake_acls'))
1712 if conf
.CONFIG_SET('AD_DC_BUILD_IS_ENABLED'):
1713 default_static_modules
.extend(TO_LIST('pdb_samba_dsdb auth_samba4 vfs_dfs_samba4'))
1715 if conf
.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'):
1716 default_shared_modules
.extend(TO_LIST('vfs_zfsacl'))
1718 if conf
.CONFIG_SET('HAVE_DIRFD_DECL'):
1719 default_shared_modules
.extend(TO_LIST('vfs_syncops vfs_dirsort'))
1721 if conf
.CONFIG_SET('HAVE_STATFS_F_FSID'):
1722 default_shared_modules
.extend(TO_LIST('vfs_fileid'))
1724 if (conf
.CONFIG_SET('HAVE_MSGHDR_MSG_CONTROL') or conf
.CONFIG_SET('HAVE_MSGHDR_MSG_ACCTRIGHTS')):
1725 default_shared_modules
.extend(TO_LIST('vfs_aio_fork'))
1727 if Options
.options
.with_pthreadpool
:
1728 default_shared_modules
.extend(TO_LIST('vfs_aio_pthread'))
1730 if conf
.CONFIG_SET('HAVE_AIO'):
1731 default_shared_modules
.extend(TO_LIST('vfs_aio_posix'))
1733 if conf
.CONFIG_SET('HAVE_LINUX_KERNEL_AIO'):
1734 default_shared_modules
.extend(TO_LIST('vfs_aio_linux'))
1736 if conf
.CONFIG_SET('HAVE_LDAP'):
1737 default_static_modules
.extend(TO_LIST('pdb_ldapsam idmap_ldap'))
1739 if conf
.CONFIG_SET('DARWINOS'):
1740 default_static_modules
.extend(TO_LIST('charset_macosxfs'))
1742 if conf
.CONFIG_SET('HAVE_GPFS'):
1743 default_shared_modules
.extend(TO_LIST('vfs_gpfs'))
1745 explicit_shared_modules
= TO_LIST(Options
.options
.shared_modules
, delimiter
=',')
1746 explicit_static_modules
= TO_LIST(Options
.options
.static_modules
, delimiter
=',')
1748 def replace_list_item(lst
, item
, value
):
1750 idx
= lst
.index(item
)
1754 # PDB module file name should have the same name as module registers itself
1755 # In Autoconf build we export LDAP passdb module as ldapsam but WAF build
1756 # was always exporting pdb_ldap. In order to support existing packages
1757 # allow referring to pdb_ldapsam as pdb_ldap but use proper name internally.
1758 replace_list_item(explicit_shared_modules
, 'pdb_ldap', 'pdb_ldapsam')
1759 replace_list_item(explicit_static_modules
, 'pdb_ldap', 'pdb_ldapsam')
1761 final_static_modules
= default_static_modules
1762 final_shared_modules
= default_shared_modules
1764 for m
in explicit_static_modules
:
1765 if m
in final_shared_modules
:
1766 final_shared_modules
.remove(m
)
1767 final_static_modules
.append(m
)
1768 for m
in explicit_shared_modules
:
1769 if m
in final_static_modules
:
1770 final_static_modules
.remove(m
)
1771 final_shared_modules
.append(m
)
1773 if ("auth_domain" not in final_static_modules
) or \
1774 ("auth_builtin" not in final_static_modules
) or \
1775 ("auth_sam" not in final_static_modules
) or \
1776 ("auth_winbind" not in final_static_modules
):
1777 raise Utils
.WafError('These auth modules MUST be configured as static modules: auth_domain, auth_builtin, auth_sam, auth_winbind')
1779 conf
.env
['static_modules'] = final_static_modules
1780 conf
.env
['shared_modules'] = final_shared_modules
1782 conf
.DEFINE('STRING_STATIC_MODULES', ' '.join(final_static_modules
), quote
=True)
1787 prefixes
= ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
1788 conf
.env
['MODULE_PREFIXES'] = prefixes
1790 for m
in final_static_modules
:
1792 if not p
in static_list
:
1794 static_list
[p
].append(m
)
1795 for m
in final_shared_modules
:
1797 if not p
in shared_list
:
1799 shared_list
[p
].append(m
)
1802 static_env
= "%s_STATIC" % p
.upper()
1803 shared_env
= "%s_SHARED" % p
.upper()
1804 conf
.env
[static_env
] = []
1805 conf
.env
[shared_env
] = []
1806 if p
in static_list
:
1808 for entry
in static_list
[p
]:
1809 decl_list
+= "extern NTSTATUS %s_init(void); " % entry
1810 conf
.env
[static_env
].append('%s' % entry
)
1811 decl_list
= decl_list
.rstrip()
1812 conf
.DEFINE('static_decl_%s' % p
, decl_list
)
1813 conf
.DEFINE('static_init_%s' % p
, '{ %s_init(); }' % '_init(); '.join(static_list
[p
]))
1815 conf
.DEFINE('static_decl_%s' % p
, '')
1816 conf
.DEFINE('static_init_%s' % p
, '{}')
1817 if p
in shared_list
:
1818 for entry
in shared_list
[p
]:
1819 conf
.DEFINE('%s_init' % entry
, 'samba_init_module')
1820 conf
.env
[shared_env
].append('%s' % entry
)
1822 conf
.SAMBA_CONFIG_H('include/config.h')
1825 "build 'tags' file using ctags"
1827 source_root
= os
.path
.dirname(Utils
.g_module
.root_path
)
1828 cmd
= 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
1829 print("Running: %s" % cmd
)