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')
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('profiling-data', default
=False)
46 opt
.SAMBA3_ADD_OPTION('cluster-support')
48 opt
.add_option('--with-ctdb-dir',
49 help=("Directory under which ctdb is installed"),
50 action
="store", dest
='ctdb_dir', default
=None)
51 opt
.add_option('--enable-old-ctdb',
52 help=("enable building against (too) old version of ctdb (default=false)"),
53 action
="store_true", dest
='enable_old_ctdb', default
=False)
58 from samba_utils
import TO_LIST
60 default_static_modules
= []
61 default_shared_modules
= []
63 if Options
.options
.developer
:
64 conf
.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
65 conf
.env
.developer
= True
67 if Options
.options
.with_swat
:
68 conf
.env
['build_swat'] = True
70 if sys
.platform
!= 'openbsd5':
71 conf
.ADD_LDFLAGS("-Wl,--export-dynamic", testflags
=True)
73 conf
.CHECK_HEADERS('execinfo.h libexc.h libunwind.h netdb.h')
74 conf
.CHECK_HEADERS('linux/falloc.h')
76 conf
.CHECK_FUNCS('getcwd fchown chmod fchmod mknod')
77 conf
.CHECK_FUNCS('strtol strchr strupr chflags')
78 conf
.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
79 conf
.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
80 conf
.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr')
81 conf
.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
82 conf
.CHECK_FUNCS('setpriv setgidx setuidx setgroups syscall sysconf')
83 conf
.CHECK_FUNCS('atexit grantpt fallocate posix_fallocate')
84 conf
.CHECK_FUNCS('fseeko setluid')
85 conf
.CHECK_FUNCS('getpwnam', headers
='sys/types.h pwd.h')
86 conf
.CHECK_FUNCS('fdopendir')
87 conf
.CHECK_FUNCS('getpwent_r setenv strcasecmp fcvt fcvtl')
88 conf
.CHECK_FUNCS('syslog vsyslog timegm setlocale')
89 conf
.CHECK_FUNCS_IN('nanosleep', 'rt')
90 conf
.CHECK_FUNCS('lutimes futimes utimensat futimens')
91 conf
.CHECK_FUNCS('mlock munlock mlockall munlockall')
92 conf
.CHECK_FUNCS('memalign posix_memalign hstrerror')
93 conf
.CHECK_FUNCS('shmget')
94 conf
.CHECK_FUNCS_IN('shm_open', 'rt', checklibc
=True)
95 conf
.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain bind_textdomain_codeset')
96 #FIXME: for some reason this one still fails
97 conf
.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
98 conf
.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
99 conf
.CHECK_FUNCS_IN('dn_expand', 'inet')
100 conf
.CHECK_DECLS('fdatasync', reverse
=True)
101 conf
.CHECK_DECLS('readahead', reverse
=True, headers
='fcntl.h')
103 if conf
.CONFIG_SET('HAVE_LONG_LONG'):
104 conf
.DEFINE('HAVE_LONGLONG', 1)
106 if conf
.CHECK_CODE('''
107 #if defined(HAVE_UNISTD_H)
110 long ret = splice(0,0,1,0,400,SPLICE_F_MOVE);
114 conf
.CHECK_DECLS('splice', reverse
=True, headers
='fcntl.h')
116 # Check for inotify support
117 conf
.CHECK_HEADERS('sys/inotify.h')
118 if "HAVE_SYS_INOTIFY_H" in conf
.env
:
119 conf
.DEFINE('HAVE_INOTIFY', 1)
121 # Check for kernel change notify support
124 #define F_NOTIFY 1026
127 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
128 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain
=False, execute
=True,
129 headers
='fcntl.h signal.h',
130 msg
="Checking for kernel change notify support")
132 # Check for Linux kernel oplocks
134 #include <sys/types.h>
138 #define F_NOTIFY 1026
141 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
142 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain
=False, execute
=True,
143 msg
="Checking for Linux kernel oplocks")
145 # Check for IRIX kernel oplock types
146 conf
.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
147 'HAVE_KERNEL_OPLOCKS_IRIX', headers
='fcntl.h',
148 msg
="Checking for IRIX kernel oplock types")
150 # Check for kernel share modes
152 #include <sys/types.h>
155 #include <sys/file.h>
161 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
162 }''', 'HAVE_KERNEL_SHARE_MODES', addmain
=False, execute
=True,
163 msg
="Checking for krenel share modes")
165 # Check for various members of the stat structure
166 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define
='HAVE_STAT_ST_BLOCKS',
167 headers
='sys/stat.h')
168 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define
='HAVE_STAT_ST_BLKSIZE',
169 headers
='sys/stat.h')
170 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_flags', define
='HAVE_STAT_ST_FLAGS',
171 headers
='sys/types.h sys/stat.h unistd.h')
173 if "HAVE_BLKCNT_T" in conf
.env
:
175 return sizeof(blkcnt_t) == 4 ? 0 : 1''',
176 'SIZEOF_BLKCNT_T_4', execute
=True,
177 headers
='replace.h sys/types.h sys/stat.h unistd.h',
178 msg
="Checking whether blkcnt_t is 32 bit")
180 if "HAVE_BLKCNT_T" in conf
.env
:
182 return sizeof(blkcnt_t) == 8 ? 0 : 1''',
183 'SIZEOF_BLKCNT_T_8', execute
=True,
184 headers
='replace.h sys/types.h sys/stat.h unistd.h',
185 msg
="Checking whether blkcnt_t is 64 bit")
187 # Check for POSIX capability support
188 conf
.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers
='sys/capability.h')
190 if "HAVE_SYS_CAPABILITY_H" in conf
.env
:
194 if (!(cap = cap_get_proc())) exit(1);
196 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
197 cap_set_proc(cap);''',
198 'HAVE_POSIX_CAPABILITIES', execute
=True, lib
="cap",
199 headers
='sys/capability.h',
200 msg
="Checking whether POSIX capabilities are available")
202 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
203 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
205 if conf
.CONFIG_SET("HAVE_RPC_RPC_H"):
206 conf
.CHECK_TYPE('int16', headers
='rpc/rpc.h',
207 define
='HAVE_INT16_FROM_RPC_RPC_H',
208 msg
="Checking for int16 typedef included by rpc/rpc.h")
209 conf
.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
210 headers
='sys/types.h rpc/rpc.h',
211 msg
="Checking for uint16 typedef included by rpc/rpc.h")
212 conf
.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
213 headers
='sys/types.h rpc/rpc.h',
214 msg
="Checking for int32 typedef included by rpc/rpc.h")
215 conf
.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
216 headers
='sys/types.h rpc/rpc.h',
217 msg
="Checking for uint32 typedef included by rpc/rpc.h")
218 conf
.CHECK_CODE('int i;', 'BROKEN_NISPLUS_INCLUDE_FILES',
219 headers
='sys/types.h sys/acl.h rpcsvc/nis.h',
220 msg
="Checking for broken nisplus include files")
222 # Check if the compiler will optimize out functions
225 this_function_does_not_exist();
228 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
229 msg
="Checking if the compiler will optimize out functions")
231 # Check if the compiler supports the LL suffix on long long integers
233 conf
.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL',
235 msg
="Checking for LL suffix on long long integers")
239 bindtextdomain _chdir __chdir chflags chmod _close __close _closedir
240 __closedir crypt16 devnm dgettext dirfd
241 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
243 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
245 fsetxattr _fstat __fstat fsync
246 futimens futimes __fxstat getauthuid
247 getcwd _getcwd __getcwd getdents __getdents getdirentries
248 getgrent getgrnam getgrouplist getgrset getmntent getpagesize
249 getpwanam getpwent_r getrlimit gettext
250 glob grantpt hstrerror initgroups innetgr
251 llseek _llseek __llseek _lseek __lseek
252 _lstat __lstat lutimes
253 __lxstat memalign mknod mlock mlockall munlock munlockall
254 _open __open _opendir __opendir
255 pathconf poll posix_fallocate
256 posix_memalign prctl pread _pread __pread
257 pwrite _pwrite __pwrite
258 rdchk _read __read _readdir __readdir
260 select setenv setgidx setgroups setlocale setluid
261 setmntent setpgid setpriv setsid setuidx
262 shmget shm_open sigaction sigblock sigprocmask sigset
264 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctl sysctlbyname
265 __sys_llseek syslog _telldir __telldir textdomain timegm
266 utimensat vsyslog _write __write __xstat
270 #ifdef HAVE_SYS_PRCTL_H
271 #include <sys/prctl.h>
275 'HAVE_PRCTL', link
=False)
277 conf
.CHECK_SAMBA3_CHARSET() # see build/charset.py
279 # FIXME: these should be tests for features, but the old build system just
281 host_os
= sys
.platform
282 Logs
.info("building on %s" % host_os
)
284 # Python doesn't have case switches... :/
285 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
286 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
288 conf
.SET_TARGET_TYPE('sunacl', 'EMPTY')
289 if (host_os
.rfind('linux') > -1) or (host_os
.rfind('gnu') > -1) or (host_os
.rfind('qnx') > -1):
290 if host_os
.rfind('linux') > -1:
291 conf
.DEFINE('LINUX', '1')
292 elif host_os
.rfind('qnx') > -1:
293 conf
.DEFINE('QNX', '1')
294 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
295 elif (host_os
.rfind('darwin') > -1):
296 conf
.DEFINE('DARWINOS', 1)
297 conf
.ADD_CFLAGS('-fno-common')
298 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
299 elif (host_os
.rfind('freebsd') > -1):
300 conf
.DEFINE('FREEBSD', 1)
301 if conf
.CHECK_HEADERS('sunacl.h'):
302 conf
.DEFINE('HAVE_FREEBSD_SUNACL_H', '1')
303 conf
.CHECK_FUNCS_IN('acl', 'sunacl')
304 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
305 elif (host_os
.rfind('irix') > -1):
306 conf
.DEFINE('IRIX', 1)
307 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
308 elif (host_os
.rfind('aix') > -1):
309 conf
.DEFINE('AIX', 1)
310 conf
.DEFINE('STAT_ST_BLOCKSIZE', 'DEV_BSIZE')
311 elif (host_os
.rfind('hpux') > -1):
312 conf
.DEFINE('HPUX', 1)
313 conf
.DEFINE('STAT_ST_BLOCKSIZE', '8192')
314 elif (host_os
.rfind('osf') > -1):
315 conf
.DEFINE('OSF1', 1)
316 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
318 # FIXME: Add more checks here.
320 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
322 if Options
.options
.with_acl_support
:
323 if (host_os
.rfind('sysv5') > -1) and conf
.CHECK_FUNCS_IN('sec', 'facl', checklibc
=True):
324 Logs
.info('Using UnixWare ACLs')
325 conf
.DEFINE('HAVE_UNIXWARE_ACLS',1)
326 default_static_modules
.extend(TO_LIST('vfs_solarisacl'))
327 elif (host_os
.rfind('solaris') > -1) and conf
.CHECK_FUNCS_IN('sec', 'facl'):
328 Logs
.info('Using solaris ACLs')
329 conf
.DEFINE('HAVE_SOLARIS_ACLS',1)
330 default_static_modules
.extend(TO_LIST('vfs_solarisacl'))
331 elif (host_os
.rfind('hpux') > -1):
332 Logs
.info('Using HPUX ACLs')
333 conf
.DEFINE('HAVE_HPUX_ACLS',1)
334 conf
.DEFINE('POSIX_ACL_NEEDS_MASK',1)
335 default_static_modules
.extend(TO_LIST('vfs_hpuxacl'))
336 elif (host_os
.rfind('irix') > -1):
337 Logs
.info('Using IRIX ACLs')
338 conf
.DEFINE('HAVE_IRIX_ACLS',1)
339 default_static_modules
.extend(TO_LIST('vfs_irixacl'))
340 elif (host_os
.rfind('aix') > -1):
341 Logs
.info('Using AIX ACLs')
342 conf
.DEFINE('HAVE_AIX_ACLS',1)
343 default_static_modules
.extend(TO_LIST('vfs_aixacl'))
344 elif (host_os
.rfind('osf') > -1) and conf
.CHECK_FUNCS_IN('pacl', 'acl_get_fd'):
345 Logs
.info('Using Tru64 ACLs')
346 conf
.DEFINE('HAVE_TRU64_ACLS',1)
347 default_static_modules
.extend(TO_LIST('vfs_tru64acl'))
348 elif (host_os
.rfind('darwin') > -1):
349 Logs
.warn('ACLs on Dwarwin currently not supported')
351 conf
.CHECK_FUNCS_IN('acl_get_file', 'acl')
352 if conf
.CHECK_CODE('''
355 acl_entry_t *entry_p;
356 return acl_get_entry(acl, entry_id, entry_p);
359 headers
='sys/types.h sys/acl.h', link
=False,
360 msg
="Checking for POSIX ACL support") :
362 acl_permset_t permset_d;
364 return acl_get_perm_np(permset_d, perm);
366 'HAVE_ACL_GET_PERM_NP',
367 headers
='sys/types.h sys/acl.h', link
=True,
368 msg
="Checking whether acl_get_perm_np() is available")
369 default_static_modules
.extend(TO_LIST('vfs_posixacl'))
372 if conf
.CHECK_FUNCS('dirfd'):
373 conf
.DEFINE('HAVE_DIRFD_DECL', 1)
375 conf
.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
376 'HAVE_STATFS_F_FSID',
377 msg
="vfs_fileid: checking for statfs() and struct statfs.f_fsid",
378 headers
='sys/types.h sys/statfs.h',
381 if conf
.CONFIG_SET('HAVE_FALLOCATE'):
383 int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
384 'HAVE_LINUX_FALLOCATE',
385 msg
="Checking whether the Linux 'fallocate' function is available",
386 headers
='unistd.h sys/types.h fcntl.h linux/falloc.h')
388 ssize_t err = readahead(0,0,0x80000);''',
389 'HAVE_LINUX_READAHEAD',
390 msg
="Checking whether Linux readahead is available",
391 headers
='unistd.h fcntl.h')
392 conf
.CHECK_DECLS('readahead', headers
='fcntl.h', always
=True)
394 conf
.CHECK_CODE('int fd = openat(AT_FDCWD, ".", O_RDONLY);',
396 msg
='Checking for openat',
399 if Options
.options
.with_aio_support
:
400 conf
.CHECK_FUNCS_IN('aio_read', 'aio')
401 conf
.CHECK_FUNCS_IN('aio_read', 'rt')
402 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);',
404 msg
='Checking for asynchronous io support',
405 headers
='sys/types.h aio.h',
407 if conf
.CONFIG_SET('HAVE_AIO'):
408 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg
='Checking for aio_read', headers
='aio.h', lib
='aio rt')
409 conf
.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg
='Checking for aio_write', headers
='aio.h', lib
='aio rt')
410 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')
411 conf
.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg
='Checking for aio_return', headers
='aio.h', lib
='aio rt')
412 conf
.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg
='Checking for aio_error', headers
='aio.h', lib
='aio rt')
413 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')
414 conf
.CHECK_CODE('struct aiocb a; return aio_suspend(&a, 1, NULL);', 'HAVE_AIO_SUSPEND', msg
='Checking for aio_suspend', headers
='aio.h', lib
='aio rt')
415 if not conf
.CONFIG_SET('HAVE_AIO'):
416 conf
.DEFINE('HAVE_NO_AIO', '1')
418 conf
.DEFINE('HAVE_NO_AIO', '1')
420 if host_os
.rfind('linux') > -1:
421 conf
.CHECK_FUNCS_IN('io_submit', 'aio')
423 struct io_event ioev;
429 fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
430 io_queue_init(128,&ctx);
431 io_prep_pwrite(ioc, 1, buf, 1, 0);
432 io_prep_pread(ioc, 1, buf, 1, 0);
433 io_set_eventfd(ioc, fd);
434 io_set_callback(ioc, (io_callback_t)(0));
435 io_submit(ctx, 1, &ioc);
436 io_getevents(ctx, 1, 1, &ioev, &ts);
438 'HAVE_LINUX_KERNEL_AIO',
439 msg
='Checking for linux kernel asynchronous io support',
440 headers
='unistd.h stdlib.h sys/types.h fcntl.h sys/eventfd.h libaio.h',
447 char control[CMSG_SPACE(sizeof(int))];
449 msg.msg_control = control_un.control;
450 msg.msg_controllen = sizeof(control_un.control);
452 'HAVE_MSGHDR_MSG_CONTROL',
453 msg
='Checking if we can use msg_control for passing file descriptors',
454 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
458 msg.msg_acctrights = (caddr_t) &fd;
459 msg.msg_acctrightslen = sizeof(fd);
461 'HAVE_MSGHDR_MSG_ACCTRIGHTS',
462 msg
='Checking if we can use msg_acctrights for passing file descriptors',
463 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
465 if Options
.options
.with_winbind
:
466 conf
.env
.build_winbind
= True
467 conf
.DEFINE('WITH_WINBIND', '1')
469 conf
.find_program('awk', var
='AWK')
470 conf
.find_program('perl', var
='PERL')
472 conf
.CHECK_HEADERS('asm/types.h')
474 conf
.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
475 headers
='unistd.h sys/types.h',
476 msg
="Checking for major macro")
478 conf
.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
479 headers
='unistd.h sys/types.h',
480 msg
="Checking for minor macro")
482 conf
.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
483 headers
='unistd.h sys/types.h dirent.h',
484 define
='HAVE_DIRENT_D_OFF')
486 conf
.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent')
487 if conf
.CHECK_CFLAGS('-Werror-implicit-function-declaration'):
488 netgrent_cflags
= '-Werror-implicit-function-declaration'
491 conf
.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE',
492 msg
="Checking for setnetgrent prototype",
493 headers
='netdb.h netgroup.h',
494 cflags
=netgrent_cflags
)
495 conf
.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE',
496 msg
="Checking for getnetgrent prototype",
497 headers
='netdb.h netgroup.h',
498 cflags
=netgrent_cflags
)
499 conf
.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE',
500 msg
="Checking for endnetgrent prototype",
501 headers
='netdb.h netgroup.h',
502 cflags
=netgrent_cflags
)
506 if Options
.options
.with_cups
:
507 conf
.find_program('cups-config', var
='CUPS_CONFIG')
508 if conf
.env
.CUPS_CONFIG
:
509 # we would normally use --libs here, but cups-config incorrectly adds
510 # gssapi_krb5 and other libraries to its --libs output. That breaks the use
511 # of an in-tree heimdal kerberos
512 conf
.check_cfg(path
=conf
.env
.CUPS_CONFIG
, args
="--cflags --ldflags",
513 package
="", uselib_store
="CUPS")
514 conf
.CHECK_HEADERS('cups/cups.h cups/language.h', lib
='cups')
515 conf
.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups')
516 if conf
.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf
.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
517 conf
.DEFINE('HAVE_CUPS', '1')
519 conf
.undefine('HAVE_CUPS')
520 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
522 # define an empty subsystem for cups, to allow it to be used as an empty dependency
523 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
525 if Options
.options
.with_iprint
:
526 if conf
.CONFIG_SET('HAVE_CUPS'):
527 conf
.DEFINE('HAVE_IPRINT', '1')
529 Logs
.warn("--enable-iprint=yes but cups support not sufficient")
530 if Options
.options
.with_syslog
:
531 conf
.DEFINE('WITH_SYSLOG', '1')
532 if Options
.options
.with_automount
:
533 conf
.DEFINE('WITH_AUTOMOUNT', '1')
536 if Options
.options
.with_ldap
:
537 conf
.CHECK_HEADERS('ldap.h lber.h ldap_pvt.h')
538 conf
.CHECK_TYPE('ber_tag_t', 'unsigned int', headers
='ldap.h lber.h')
539 conf
.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
540 conf
.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers
='ldap.h')
542 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
544 conf
.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
545 define
='HAVE_LBER_LOG_PRINT_FN', headers
='lber.h')
547 conf
.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', 'ldap')
548 conf
.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
550 # Check if ldap_set_rebind_proc() takes three arguments
551 if conf
.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
552 'LDAP_SET_REBIND_PROC_ARGS',
553 msg
="Checking whether ldap_set_rebind_proc takes 3 arguments",
554 headers
='ldap.h lber.h', link
=False):
555 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
557 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
559 # last but not least, if ldap_init() exists, we want to use ldap
560 if conf
.CONFIG_SET('HAVE_LDAP_INIT') and conf
.CONFIG_SET('HAVE_LDAP_H'):
561 conf
.DEFINE('HAVE_LDAP', '1')
562 conf
.DEFINE('LDAP_DEPRECATED', '1')
563 conf
.env
['HAVE_LDAP'] = '1'
564 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
565 # SASL wrapping hooks
566 if conf
.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
567 conf
.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
568 conf
.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
570 conf
.SET_TARGET_TYPE('ldap', 'EMPTY')
571 conf
.SET_TARGET_TYPE('lber', 'EMPTY')
573 if Options
.options
.with_ads
:
575 if not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and \
576 not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC'):
577 Logs
.warn("arcfour-hmac-md5 encryption type not found in -lkrb5")
579 if not conf
.CONFIG_SET('HAVE_KRB5_MK_REQ_EXTENDED'):
580 Logs
.warn("krb5_mk_req_extended not found in -lkrb5")
582 if not conf
.CONFIG_SET('HAVE_KRB5_GET_HOST_REALM'):
583 Logs
.warn("krb5_get_host_realm not found in -lkrb5")
585 if not conf
.CONFIG_SET('HAVE_KRB5_FREE_HOST_REALM'):
586 Logs
.warn("krb5_free_host_realm not found in -lkrb5")
588 if not conf
.CONFIG_SET('HAVE_KRB5_FWD_TGT_CREDS'):
589 Logs
.warn("krb5_fwd_tgt_creds found in -lkrb5")
591 if not conf
.CONFIG_SET('HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC'):
592 Logs
.warn("krb5_get_init_creds_opt_alloc not found in -lkrb5")
594 if not conf
.CONFIG_SET('KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT'):
595 Logs
.warn("krb5_get_init_creds_opt_free was not found or was too old in -lkrb5")
597 if not conf
.CONFIG_SET('HAVE_KRB5_GET_RENEWED_CREDS'):
598 Logs
.warn("krb5_get_renewed_creds not found in -lkrb5")
600 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL_COMPARE_ANY_REALM'):
601 Logs
.warn("krb5_principal_compare_any_realm not found in -lkrb5")
603 if not conf
.CONFIG_SET('HAVE_KRB5_C_STRING_TO_KEY') and \
604 not conf
.CONFIG_SET('HAVE_KRB5_STRING_TO_KEY_SALT'):
605 Logs
.warn("krb5_c_string_to_key not found in -lkrb5")
607 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL2SALT') and \
608 not conf
.CONFIG_SET('HAVE_KRB5_GET_PW_SALT'):
609 Logs
.warn("no CREATE_KEY_FUNCTIONS detected")
611 if not conf
.CONFIG_SET('HAVE_KRB5_GET_PERMITTED_ENCTYPES') and \
612 not conf
.CONFIG_SET('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES'):
613 Logs
.warn("no GET_ENCTYPES_FUNCTIONS detected")
615 if not conf
.CONFIG_SET('HAVE_KRB5_KT_FREE_ENTRY') and \
616 not conf
.CONFIG_SET('HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS'):
617 Logs
.warn("no KT_FREE_FUNCTION detected")
619 if not conf
.CONFIG_SET('HAVE_KRB5_C_VERIFY_CHECKSUM'):
620 Logs
.warn("krb5_c_verify_checksum_compare not found in -lkrb5")
623 # We don't actually use
624 # gsskrb5_extract_authz_data_from_sec_context, but it is a
625 # clue that this Heimdal, which does the PAC processing we
626 # need on the standard gss_inquire_sec_context_by_oid
627 if not conf
.CONFIG_SET('HAVE_GSS_GET_NAME_ATTRIBUTE') and \
628 not (conf
.CONFIG_SET('HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT') and \
629 conf
.CONFIG_SET('HAVE_GSS_INQUIRE_SEC_CONTEXT_BY_OID')):
630 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")
633 if not conf
.CONFIG_SET('HAVE_GSS_KRB5_EXPORT_LUCID_SEC_CONTEXT'):
634 Logs
.warn("need gss_krb5_export_lucid_sec_context for SPNEGO and gss_wrap support")
638 conf
.DEFINE('WITH_ADS', '1')
639 conf
.DEFINE('HAVE_KRB5', '1')
640 if conf
.CONFIG_SET('HAVE_LDAP'):
641 conf
.env
['HAVE_ADS'] = '1'
643 Logs
.warn("krb5 libs don't have all features required for Active Directory support")
644 conf
.undefine('HAVE_KRB5_H')
645 conf
.undefine('HAVE_GSSAPI_H')
646 conf
.undefine('HAVE_GSSAPI_GSSAPI_GENERIC_H')
647 conf
.undefine('HAVE_GSSAPI_GSSAPI_H')
649 if Options
.options
.with_utmp
:
650 conf
.env
.with_utmp
= True
651 if not conf
.CHECK_HEADERS('utmp.h'): conf
.env
.with_utmp
= False
652 conf
.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
653 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers
='utmp.h',
654 define
='HAVE_UT_UT_NAME')
655 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers
='utmp.h',
656 define
='HAVE_UT_UT_USER')
657 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers
='utmp.h',
658 define
='HAVE_UT_UT_ID')
659 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers
='utmp.h',
660 define
='HAVE_UT_UT_HOST')
661 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers
='utmp.h',
662 define
='HAVE_UT_UT_TIME')
663 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers
='utmp.h',
664 define
='HAVE_UT_UT_TV')
665 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers
='utmp.h',
666 define
='HAVE_UT_UT_TYPE')
667 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers
='utmp.h',
668 define
='HAVE_UT_UT_PID')
669 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers
='utmp.h',
670 define
='HAVE_UT_UT_EXIT')
671 conf
.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers
='utmpx.h',
672 define
='HAVE_UX_UT_SYSLEN')
673 conf
.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
674 'PUTUTLINE_RETURNS_UTMP', headers
='utmp.h',
675 msg
="Checking whether pututline returns pointer")
676 conf
.CHECK_SIZEOF(['((struct utmp *)NULL)->ut_line'], headers
='utmp.h',
677 define
='SIZEOF_UTMP_UT_LINE')
678 if not conf
.CONFIG_SET('SIZEOF_UTMP_UT_LINE'):
679 conf
.env
.with_utmp
= False
680 elif int(conf
.env
.SIZEOF_UTMP_UT_LINE
) < 15:
681 conf
.env
.with_utmp
= False
682 if conf
.env
.with_utmp
:
683 conf
.DEFINE('WITH_UTMP', 1)
685 Logs
.warn("--with-utmp but utmp support not sufficient")
687 if Options
.options
.with_avahi
:
688 conf
.env
.with_avahi
= True
689 if not conf
.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf
.env
.with_avahi
= False
690 if not conf
.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf
.env
.with_avahi
= False
691 if not conf
.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf
.env
.with_avahi
= False
692 if conf
.env
.with_avahi
:
693 conf
.DEFINE('WITH_AVAHI_SUPPORT', 1)
695 conf
.SET_TARGET_TYPE('avahi-common', 'EMPTY')
696 conf
.SET_TARGET_TYPE('avahi-client', 'EMPTY')
698 if Options
.options
.with_iconv
:
699 conf
.env
.with_iconv
= True
700 if not conf
.CHECK_FUNCS_IN('iconv_open', 'iconv', headers
='iconv.h'):
701 conf
.env
.with_iconv
= False
702 if conf
.env
.with_iconv
:
703 conf
.DEFINE('HAVE_ICONV', 1)
705 if Options
.options
.with_pam
:
707 conf
.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
708 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
709 Logs
.warn("--with-pam=yes but pam_appl.h not found")
711 conf
.CHECK_FUNCS_IN('pam_get_data', 'pam')
712 conf
.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h')
713 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'):
714 Logs
.warn("--with-pam=yes but pam_modules.h not found")
716 conf
.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h')
717 conf
.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h')
718 conf
.CHECK_FUNCS_IN('pam_vsyslog', 'pam')
720 #if defined(HAVE_SECURITY_PAM_APPL_H)
721 #include <security/pam_appl.h>
722 #elif defined(HAVE_PAM_PAM_APPL_H)
723 #include <pam/pam_appl.h>
725 pam_set_item(0, PAM_RHOST, 0);
729 msg
="Checking whether PAM_RHOST is available");
731 #if defined(HAVE_SECURITY_PAM_APPL_H)
732 #include <security/pam_appl.h>
733 #elif defined(HAVE_PAM_PAM_APPL_H)
734 #include <pam/pam_appl.h>
736 pam_set_item(0, PAM_TTY, 0);
740 msg
="Checking whether PAM_TTY is available");
742 #if (!defined(LINUX))
744 #define PAM_EXTERN extern
745 #if defined(HAVE_SECURITY_PAM_APPL_H)
746 #include <security/pam_appl.h>
747 #elif defined(HAVE_PAM_PAM_APPL_H)
748 #include <pam/pam_appl.h>
753 #if defined(HAVE_SECURITY_PAM_MODULES_H)
754 #include <security/pam_modules.h>
755 #elif defined(HAVE_PAM_PAM_MODULES_H)
756 #include <pam/pam_modules.h>
759 #if defined(HAVE_SECURITY__PAM_MACROS_H)
760 #include <security/_pam_macros.h>
761 #elif defined(HAVE_PAM__PAM_MACROS_H)
762 #include <pam/_pam_macros.h>
765 #ifdef HAVE_SECURITY_PAM_EXT_H
766 #include <security/pam_ext.h>
769 int i; i = PAM_RADIO_TYPE;
771 'HAVE_PAM_RADIO_TYPE',
773 msg
="Checking whether PAM_RADIO_TYPE is available");
775 conf
.DEFINE('WITH_PAM', 1)
776 conf
.DEFINE('WITH_PAM_MODULES', 1)
778 if Options
.options
.with_pam_smbpass
:
779 conf
.env
.with_pam_smbpass
= True
784 # Ensure we select the correct set of system calls on Linux.
786 if (host_os
.rfind('linux') > -1):
788 #if defined(HAVE_UNISTD_H)
793 #include <sys/types.h>
796 #ifdef HAVE_SYS_PRIV_H
797 #include <sys/priv.h>
803 #if defined(HAVE_SYSCALL_H)
807 #if defined(HAVE_SYS_SYSCALL_H)
808 #include <sys/syscall.h>
811 syscall(SYS_setresuid32, -1, -1, -1);
812 syscall(SYS_setresgid32, -1, -1, -1);
813 syscall(SYS_setreuid32, -1, -1);
814 syscall(SYS_setregid32, -1, -1);
815 syscall(SYS_setuid32, -1);
816 syscall(SYS_setgid32, -1);
817 syscall(SYS_setgroups32, 0, NULL);
819 'USE_LINUX_32BIT_SYSCALLS',
820 msg
="Checking whether Linux should use 32-bit credential calls");
822 if (conf
.CONFIG_SET('USE_LINUX_32BIT_SYSCALLS')):
823 seteuid
= conf
.CHECK_CODE('''
824 #define AUTOCONF_TEST 1
825 #define USE_LINUX_THREAD_CREDENTIALS 1
826 #define USE_LINUX_32BIT_SYSCALLS 1
827 #include "../lib/util/setid.c"
828 #include "./lib/util_sec.c"
830 'USE_LINUX_THREAD_CREDENTIALS',
833 msg
="Checking whether we can use Linux thread-specific credentials with 32-bit system calls")
835 seteuid
= conf
.CHECK_CODE('''
836 #define AUTOCONF_TEST 1
837 #define USE_LINUX_THREAD_CREDENTIALS 1
838 #include "../lib/util/setid.c"
839 #include "./lib/util_sec.c"
841 'USE_LINUX_THREAD_CREDENTIALS',
844 msg
="Checking whether we can use Linux thread-specific credentials")
846 seteuid
= conf
.CHECK_CODE('''
847 #define AUTOCONF_TEST 1
848 #define USE_SETREUID 1
849 #include "../lib/util/setid.c"
850 #include "./lib/util_sec.c"
855 msg
="Checking whether setreuid is available")
857 seteuid
= conf
.CHECK_CODE('''
858 #define AUTOCONF_TEST 1
859 #define USE_SETRESUID 1
860 #include "../lib/util/setid.c"
861 #include "./lib/util_sec.c"
866 msg
="Checking whether setresuid is available")
868 seteuid
= conf
.CHECK_CODE('''
869 #define AUTOCONF_TEST 1
870 #define USE_SETEUID 1
871 #include "../lib/util/setid.c"
872 #include "./lib/util_sec.c"
877 msg
="Checking whether seteuid is available")
879 seteuid
= conf
.CHECK_CODE('''
880 #define AUTOCONF_TEST 1
881 #define USE_SETUIDX 1
882 #include "../lib/util/setid.c"
883 #include "./lib/util_sec.c"
889 msg
="Checking whether setuidx is available")
890 if Options
.options
.with_dnsupdate
:
891 if not conf
.CONFIG_SET('HAVE_KRB5'):
892 Logs
.warn("--with-dnsupdate=yes but gssapi support not sufficient")
894 conf
.DEFINE('WITH_DNS_UPDATES', 1)
895 conf
.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
896 if Options
.options
.developer
:
897 if conf
.CONFIG_SET('HAVE_VALGRIND_H') or conf
.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'):
898 conf
.DEFINE('VALGRIND', '1')
900 if conf
.CHECK_CODE('''
901 #include <bits/sockaddr.h>
902 #include <linux/netlink.h>
904 'HAVE_LINUX_NETLINK_H',
905 msg
="Checking whether Linux netlink is available"):
908 #include <bits/sockaddr.h>
909 #include <linux/netlink.h>
910 #include <linux/rtnetlink.h>
912 'HAVE_LINUX_RTNETLINK_H',
913 msg
='Checking whether Linux rtnetlink is available')
916 #include "../tests/fcntl_lock.c"
921 msg
='Checking whether fcntl locking is available')
923 # glibc up to 2.3.6 had dangerously broken posix_fallocate(). DON'T USE IT.
924 if not conf
.CHECK_CODE('''
925 #define _XOPEN_SOURCE 600
927 #if defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4))
928 #error probably broken posix_fallocate
931 '_HAVE_UNBROKEN_POSIX_FALLOCATE',
932 msg
='Checking for broken posix_fallocate'):
933 conf
.DEFINE('HAVE_BROKEN_POSIX_FALLOCATE', '1')
936 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec',
937 define
='HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') # Linux, Solaris
938 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimensec',
939 define
='HAVE_STRUCT_STAT_ST_MTIMENSEC') # BSD, if defined _POSIX_SOURCE
940 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimespec.tv_nsec',
941 define
='HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') # BSD, if not defined _POSIX_SOURCE
942 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtime_n',
943 define
='HAVE_STRUCT_STAT_ST_MTIME_N') # AIX
944 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_umtime',
945 define
='HAVE_STRUCT_STAT_ST_UMTIME') # Tru64
946 if conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') or \
947 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMENSEC') or \
948 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') or \
949 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIME_N') or \
950 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_UMTIME'):
951 conf
.DEFINE('HAVE_STAT_HIRES_TIMESTAMPS', '1')
953 # recent FreeBSD, NetBSD have creation timestamps called birthtime:
954 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtime',
955 define
='HAVE_STRUCT_STAT_ST_BIRTHTIME')
956 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimespec.tv_nsec',
957 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC')
958 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimensec',
959 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC')
962 ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
964 'HAVE_POSIX_FADVISE',
965 msg
='Checking whether posix_fadvise is available',
966 headers
='unistd.h fcntl.h')
968 for v
in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]:
971 return sysconf(%s) == -1 ? 1 : 0;
974 msg
='Checking whether sysconf(%s) is available' % v
)
977 #include <sys/syscall.h>
979 syscall(SYS_initgroups, 16, NULL, NULL, 0);
981 'HAVE_DARWIN_INITGROUPS',
982 msg
='Checking whether to use the Darwin-specific initgroups system call')
984 conf
.CHECK_CODE('''struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''',
986 headers
='sys/types.h utime.h',
987 msg
='Checking whether struct utimbuf is available')
989 if conf
.CHECK_CODE('''struct sigevent s;''',
990 'HAVE_STRUCT_SIGEVENT',
991 headers
='sys/types.h stdlib.h stddef.h signal.h',
992 msg
='Checking whether we have the struct sigevent'):
993 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sival_ptr',
994 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR',
996 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sigval_ptr',
997 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR',
1000 if os
.path
.exists('/proc/sys/kernel/core_pattern'):
1001 conf
.DEFINE('HAVE_SYS_KERNEL_PROC_CORE_PATTERN', '1')
1003 if conf
.CHECK_CODE('''
1007 if (sizeof(time_t) == 8) {
1008 time_t max_time = 0x7fffffffffffffffll;
1009 tm = gmtime(&max_time);
1010 /* This should fail with 32-bit tm_year. */
1012 /* Max time_t that works with 32-bit int tm_year in struct tm. */
1013 max_time = 67768036191676799ll;
1014 tm = gmtime(&max_time);
1025 msg
="Checking for the maximum value of the 'time_t' type"):
1026 conf
.DEFINE('TIME_T_MAX', '67768036191676799ll')
1029 #if defined(HAVE_UNISTD_H)
1032 #include <sys/types.h>
1033 main() { dev_t dev = makedev(1,2); return 0; }
1037 msg
='Checking whether the macro for makedev is available')
1044 void exit_on_core(int ignored) {
1050 signal(SIGSEGV, exit_on_core);
1051 newpath = realpath("/tmp", NULL);
1052 exit((newpath != NULL) ? 0 : 1);
1055 'REALPATH_TAKES_NULL',
1058 msg
='Checking whether the realpath function allows a NULL argument')
1060 conf
.CHECK_CODE('''#include "../tests/ftruncate.c"''',
1061 'HAVE_FTRUNCATE_EXTEND',
1062 msg
='Checking for ftruncate extend',
1066 if Options
.options
.with_sendfile_support
:
1067 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):
1072 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1075 headers
='sys/sendfile.h',
1076 msg
='Checking for linux sendfile support')
1078 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1079 conf
.DEFINE('HAVE_SENDFILE', '1')
1080 conf
.DEFINE('LINUX_SENDFILE_API', '1')
1081 conf
.DEFINE('WITH_SENDFILE', '1')
1082 elif (host_os
.rfind('freebsd') > -1) or (host_os
.rfind('dragonfly') > -1):
1084 #include <sys/types.h>
1086 #include <sys/socket.h>
1087 #include <sys/uio.h>
1088 int fromfd, tofd, ret, total=0;
1089 off_t offset, nwritten;
1092 hdr.headers = &hdtrl;
1094 hdr.trailers = NULL;
1096 hdtrl.iov_base = NULL;
1098 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0)
1101 msg
='Checking for freebsd sendfile support')
1102 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1103 conf
.DEFINE('HAVE_SENDFILE', '1')
1104 conf
.DEFINE('FREEBSD_SENDFILE_API', '1')
1105 conf
.DEFINE('WITH_SENDFILE', '1')
1106 elif (host_os
.rfind('darwin') > -1):
1108 #include <sys/types.h>
1109 #include <sys/socket.h>
1110 #include <sys/uio.h>
1111 int fromfd, tofd, ret;
1112 off_t offset, nwritten;
1115 hdr.headers = &hdtrl;
1117 hdr.trailers = (void *)0;
1119 hdtrl.iov_base = (void *)0;
1121 ret = sendfile(fromfd, tofd, offset, &nwritten, &hdr, 0);
1124 msg
='Checking for darwin sendfile support')
1125 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1126 conf
.DEFINE('HAVE_SENDFILE', '1')
1127 conf
.DEFINE('DARWIN_SENDFILE_API', '1')
1128 conf
.DEFINE('WITH_SENDFILE', '1')
1129 elif (host_os
.rfind('hpux') > -1) or (host_os
.rfind('osf') > -1):
1131 #include <sys/socket.h>
1132 #include <sys/uio.h>
1135 struct iovec hdtrl[2];
1138 hdtrl[0].iov_base = 0;
1139 hdtrl[0].iov_len = 0;
1140 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
1143 msg
='Checking for osf/hpux sendfile support')
1144 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1145 conf
.DEFINE('HAVE_SENDFILE', '1')
1146 conf
.DEFINE('HPUX_SENDFILE_API', '1')
1147 conf
.DEFINE('WITH_SENDFILE', '1')
1148 elif (host_os
.rfind('solaris') > -1):
1149 conf
.CHECK_FUNCS_IN('sendfile', 'sendfilev')
1151 #include <sys/sendfile.h>,
1154 struct sendfilevec vec[2];
1158 vec[0].sfv_fd = SFV_FD_SELF;
1159 vec[0].sfv_flag = 0;
1163 vec[1].sfv_flag = 0;
1166 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
1169 msg
='Checking for solaris sendfilev support')
1170 if conf
.CONFIG_SET('_HAVE_SENDFILEV'):
1171 conf
.DEFINE('HAVE_SENDFILEV', '1')
1172 conf
.DEFINE('SOLARIS_SENDFILE_API', '1')
1173 conf
.DEFINE('WITH_SENDFILE', '1')
1174 elif (host_os
.rfind('aix') > -1):
1176 #include <sys/socket.h>
1179 struct sf_parms hdtrl;
1181 hdtrl.header_data = 0;
1182 hdtrl.header_length = 0;
1183 hdtrl.file_descriptor = fromfd;
1184 hdtrl.file_offset = 0;
1185 hdtrl.file_bytes = 0;
1186 hdtrl.trailer_data = 0;
1187 hdtrl.trailer_length = 0;
1188 nwritten = send_file(&tofd, &hdtrl, 0);
1191 msg
='Checking for AIX send_file support')
1192 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1193 conf
.DEFINE('HAVE_SENDFILE', '1')
1194 conf
.DEFINE('AIX_SENDFILE_API', '1')
1195 conf
.DEFINE('WITH_SENDFILE', '1')
1197 # Check for getcwd allowing a NULL arg.
1201 char *s = getcwd(NULL,0);
1202 exit(s != NULL ? 0 : 1);
1203 }''', 'GETCWD_TAKES_NULL', addmain
=False, execute
=True,
1204 msg
="getcwd takes a NULL argument")
1207 # UnixWare 7.x has its getspnam in -lgen
1208 conf
.CHECK_FUNCS_IN('getspnam', 'gen')
1209 conf
.CHECK_FUNCS_IN('getspnam', 'security')
1210 conf
.CHECK_FUNCS_IN('getspnam', 'sec')
1212 if Options
.options
.with_quotas
:
1213 # For quotas on Veritas VxFS filesystems
1214 conf
.CHECK_HEADERS('sys/fs/vx_quota.h')
1215 # For sys/quota.h and linux/quota.h
1216 conf
.CHECK_HEADERS('sys/quota.h')
1217 # For quotas on BSD systems
1218 conf
.CHECK_HEADERS('ufs/ufs/quota.h')
1219 # For quotas on Linux XFS filesystems
1220 if conf
.CHECK_HEADERS('xfs/xqm.h'):
1221 conf
.DEFINE('HAVE_XFS_QUOTAS', '1')
1225 #include "confdefs.h"
1226 #ifdef HAVE_SYS_TYPES_H
1227 #include <sys/types.h>
1229 #ifdef HAVE_ASM_TYPES_H
1230 #include <asm/types.h>
1232 #include <sys/quota.h>
1233 int i = Q_XGETQUOTA;''',
1234 define
='HAVE_XFS_QUOTAS',
1235 msg
='for XFS QUOTA in <sys/quota.h>',
1237 local_include
=False)
1239 # For IRIX like dqb_isoftlimit instead of dqb_fsoftlimit in struc dqblk
1240 conf
.CHECK_STRUCTURE_MEMBER('struct dqblk', 'dqb_fsoftlimit', define
='HAVE_DQB_FSOFTLIMIT',
1241 headers
='sys/quota.h')
1242 #darwin style quota bytecount
1243 conf
.CHECK_STRUCTURE_MEMBER('struct dqblk', 'dqb_curbytes', define
='HAVE_STRUCT_DQBLK_DQB_CURBYTES',
1244 headers
='sys/quota.h')
1245 if conf
.CHECK_HEADERS('rpcsvc/rquota.h'):
1246 conf
.DEFINE('HAVE_NFS_QUOTAS', '1')
1247 conf
.CHECK_STRUCTURE_MEMBER('struct getquota_rslt', 'getquota_rslt_u',
1248 define
='HAVE_GETQUOTA_RSLT_GETQUOTA_RSLT_U',
1249 headers
='rpcsvc/rquota.h')
1251 if (host_os
.rfind('linux') > -1):
1252 conf
.DEFINE('HAVE_QUOTACTL_LINUX', '1')
1253 elif not conf
.CONFIG_SET("HAVE_XFS_QUOTAS"):
1254 if not conf
.CHECK_CODE('''
1255 #define HAVE_QUOTACTL_4A 1
1256 #define AUTOCONF_TEST 1
1257 #include "../tests/sysquotas.c"
1259 cflags
=conf
.env
['WERROR_CFLAGS'],
1260 define
='HAVE_QUOTACTL_4A',
1261 msg
='for QUOTACTL_4A: long quotactl(int cmd, char *special, qid_t id, caddr_t addr)',
1266 #define HAVE_QUOTACTL_4B 1
1267 #define AUTOCONF_TEST 1
1268 #include "../tests/sysquotas.c"
1270 cflags
=conf
.env
['WERROR_CFLAGS'],
1271 define
='HAVE_QUOTACTL_4B',
1272 msg
='for QUOTACTL_4B: int quotactl(const char *path, int cmd, int id, char *addr)',
1277 clnt_create("", RQUOTAPROG, RQUOTAVERS, "udp");
1279 headers
="rpc/rpc.h rpc/types.h rpcsvc/rquota.h rpc/nettype.h rpc/xdr.h",
1280 define
='HAVE_NFS_QUOTAS',
1281 msg
='for NFS QUOTAS',
1283 local_include
=False)
1285 if conf
.CONFIG_SET('HAVE_QUOTACTL_LINUX') or \
1286 conf
.CONFIG_SET('HAVE_QUOTACTL_4A') or \
1287 conf
.CONFIG_SET('HAVE_QUOTACTL_4B') or \
1288 conf
.CONFIG_SET('HAVE_XFS_QUOTAS'):
1289 conf
.DEFINE('HAVE_SYS_QUOTAS', '1')
1290 conf
.DEFINE('WITH_QUOTAS', '1')
1293 # checking for clustering extensions (CTDB)
1295 if not Options
.options
.with_cluster_support
:
1296 have_cluster_support
= False
1300 if Options
.options
.ctdb_dir
:
1301 conf
.ADD_EXTRA_INCLUDES(Options
.options
.ctdb_dir
+ '/include')
1303 srcdir
= os
.path
.realpath(conf
.srcdir
)
1304 if 'EXTRA_INCLUDES' in conf
.env
:
1305 includes
= ' '.join(conf
.env
['EXTRA_INCLUDES']).replace('#', srcdir
+ '/')
1309 if not conf
.env
.USING_SYSTEM_TDB
:
1310 includes
= includes
+ ' ' + srcdir
+ '/lib/tdb/include'
1312 have_cluster_support
= True
1317 #include "replace.h"
1318 #include "system/wait.h"
1319 #include "system/network.h"
1320 #define private #error __USED_RESERVED_WORD_private__
1333 msg
='Checking for header ctdb.h')
1335 if not conf
.CONFIG_SET('HAVE_CTDB_H'):
1336 have_cluster_support
= False
1337 ctdb_broken
= "ctdb.h is required for cluster support"
1339 if have_cluster_support
:
1342 #include "replace.h"
1343 #include "system/wait.h"
1344 #include "system/network.h"
1345 #define private #error __USED_RESERVED_WORD_private__
1349 #include <ctdb_private.h>
1356 'HAVE_CTDB_PRIVATE_H',
1359 msg
='Checking for header ctdb_private.h')
1361 if not conf
.CONFIG_SET('HAVE_CTDB_PRIVATE_H'):
1362 have_cluster_support
= False
1363 ctdb_broken
= "ctdb_private.h is required for cluster support"
1365 if have_cluster_support
:
1368 #include "replace.h"
1369 #include "system/wait.h"
1370 #include "system/network.h"
1371 #define private #error __USED_RESERVED_WORD_private__
1375 #include <ctdb_protocol.h>
1382 'HAVE_CTDB_PROTOCOL_H',
1385 msg
='Checking for header ctdb_protocol.h')
1387 if have_cluster_support
:
1390 #include "replace.h"
1391 #include "system/wait.h"
1392 #include "system/network.h"
1396 #include <ctdb_private.h>
1400 int i = (int)CTDB_CONTROL_TRANS3_COMMIT;
1404 'HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL',
1407 msg
='Checking for transaction support (TRANS3_COMMIT control)')
1409 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL'):
1410 have_cluster_support
= False
1411 ctdb_broken
= "ctdb transaction support missing or too old"
1413 if have_cluster_support
:
1416 #include "replace.h"
1417 #include "system/wait.h"
1418 #include "system/network.h"
1422 #include <ctdb_private.h>
1426 int i = (int)CTDB_CONTROL_SCHEDULE_FOR_DELETION;
1430 'HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL',
1433 msg
='Checking for SCHEDULE_FOR_DELETION control')
1435 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL'):
1436 if not Options
.options
.enable_old_ctdb
:
1437 have_cluster_support
= False
1438 ctdb_broken
= "SCHEDULE_FOR_DELETION control missing"
1440 Logs
.warn("ignoring missing SCHEDULE_FOR_DELETION control (--enable-old-ctdb)")
1442 if have_cluster_support
:
1445 #include "replace.h"
1446 #include "system/wait.h"
1447 #include "system/network.h"
1451 #include <ctdb_private.h>
1455 struct ctdb_control_tcp _x;
1459 'HAVE_STRUCT_CTDB_CONTROL_TCP',
1462 msg
='Checking for ctdb ipv4 support')
1464 if not conf
.CONFIG_SET('HAVE_STRUCT_CTDB_CONTROL_TCP'):
1465 have_cluster_support
= False
1466 ctdb_broken
= "missing struct ctdb_control_tcp"
1468 if have_cluster_support
:
1471 #include "replace.h"
1472 #include "system/wait.h"
1473 #include "system/network.h"
1477 #include <ctdb_private.h>
1481 struct ctdb_control_tcp_addr _x;
1485 'HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR',
1488 msg
='Checking for ctdb ipv6 support')
1490 if have_cluster_support
:
1493 #include "replace.h"
1494 #include "system/wait.h"
1495 #include "system/network.h"
1499 #include <ctdb_private.h>
1503 int i = (int)CTDB_CONTROL_CHECK_SRVIDS;
1507 'HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL',
1510 msg
='Checking for CHECK_SRVIDS control')
1512 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL'):
1513 if not Options
.options
.enable_old_ctdb
:
1514 have_cluster_support
= False
1515 ctdb_broken
= "CHECK_SRVIDS control missing"
1517 Logs
.warn("ignoring missing CHECK_SRVIDS control (--enable-old-ctdb)")
1519 if have_cluster_support
:
1520 Logs
.info("building with cluster support")
1521 conf
.DEFINE('CLUSTER_SUPPORT', 1);
1523 if not Options
.options
.with_cluster_support
:
1524 Logs
.info("building without cluster support")
1526 Logs
.warn("building without cluster support: " + ctdb_broken
)
1527 conf
.undefine('CLUSTER_SUPPORT')
1531 conf
.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }',
1532 'HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR',
1535 msg
='Checking whether we can compile with __attribute__((destructor))')
1537 conf
.CHECK_CODE('void seekdir(DIR *d, long loc) { return; }',
1538 'SEEKDIR_RETURNS_VOID',
1539 headers
='sys/types.h dirent.h',
1540 msg
='Checking whether seekdir returns void')
1542 if Options
.options
.with_profiling_data
:
1543 conf
.DEFINE('WITH_PROFILE', 1);
1545 PTHREAD_CFLAGS
='error'
1546 PTHREAD_LDFLAGS
='error'
1548 if PTHREAD_LDFLAGS
== 'error':
1549 if conf
.CHECK_FUNCS_IN('pthread_attr_init', 'pthread'):
1550 PTHREAD_CFLAGS
='-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS'
1551 PTHREAD_LDFLAGS
='-lpthread'
1552 if PTHREAD_LDFLAGS
== 'error':
1553 if conf
.CHECK_FUNCS_IN('pthread_attr_init', 'pthreads'):
1554 PTHREAD_CFLAGS
='-D_THREAD_SAFE'
1555 PTHREAD_LDFLAGS
='-lpthreads'
1556 if PTHREAD_LDFLAGS
== 'error':
1557 if conf
.CHECK_FUNCS_IN('pthread_attr_init', 'c_r'):
1558 PTHREAD_CFLAGS
='-D_THREAD_SAFE -pthread'
1559 PTHREAD_LDFLAGS
='-pthread'
1560 if PTHREAD_LDFLAGS
== 'error':
1561 if conf
.CHECK_FUNCS('pthread_attr_init'):
1562 PTHREAD_CFLAGS
='-D_REENTRANT'
1563 PTHREAD_LDFLAGS
='-lpthread'
1564 # especially for HP-UX, where the CHECK_FUNC macro fails to test for
1565 # pthread_attr_init. On pthread_mutex_lock it works there...
1566 if PTHREAD_LDFLAGS
== 'error':
1567 if conf
.CHECK_FUNCS_IN('pthread_mutex_lock', 'pthread'):
1568 PTHREAD_CFLAGS
='-D_REENTRANT'
1569 PTHREAD_LDFLAGS
='-lpthread'
1571 if PTHREAD_CFLAGS
!= 'error' and PTHREAD_LDFLAGS
!= 'error':
1572 conf
.ADD_CFLAGS(PTHREAD_CFLAGS
)
1573 conf
.ADD_LDFLAGS(PTHREAD_LDFLAGS
)
1574 conf
.CHECK_HEADERS('pthread.h')
1575 conf
.DEFINE('HAVE_PTHREAD', '1')
1577 if Options
.options
.with_pthreadpool
:
1578 if conf
.CONFIG_SET('HAVE_PTHREAD'):
1579 conf
.DEFINE('WITH_PTHREADPOOL', '1')
1581 Logs
.warn("pthreadpool support cannot be enabled when pthread support was not found")
1582 conf
.undefine('WITH_PTHREADPOOL')
1584 if conf
.CHECK_HEADERS('gpfs_gpl.h'):
1585 conf
.DEFINE('HAVE_GPFS', '1')
1587 default_static_modules
.extend(TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
1588 auth_sam auth_unix auth_winbind auth_wbc
1589 auth_domain auth_builtin vfs_default
1590 nss_info_template idmap_tdb idmap_passdb
1593 default_shared_modules
.extend(TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
1594 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
1595 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2
1596 auth_script vfs_readahead vfs_xattr_tdb vfs_posix_eadb
1597 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
1598 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
1600 vfs_crossrename vfs_linux_xfs_sgid
1601 vfs_time_audit idmap_autorid idmap_tdb2
1602 idmap_rid idmap_hash'''))
1604 if Options
.options
.developer
:
1605 default_static_modules
.extend(TO_LIST('charset_weird'))
1606 default_shared_modules
.extend(TO_LIST('perfcount_test'))
1607 default_shared_modules
.extend(TO_LIST('vfs_skel_opaque vfs_skel_transparent vfs_shadow_copy_test'))
1608 default_shared_modules
.extend(TO_LIST('auth_skel pdb_test'))
1610 if Options
.options
.enable_selftest
or Options
.options
.developer
:
1611 default_shared_modules
.extend(TO_LIST('vfs_fake_acls'))
1614 if conf
.CONFIG_SET('AD_DC_BUILD_IS_ENABLED'):
1615 default_static_modules
.extend(TO_LIST('pdb_samba_dsdb auth_samba4 vfs_dfs_samba4'))
1617 if conf
.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'):
1618 default_shared_modules
.extend(TO_LIST('vfs_zfsacl'))
1620 if conf
.CONFIG_SET('HAVE_DIRFD_DECL'):
1621 default_shared_modules
.extend(TO_LIST('vfs_syncops vfs_dirsort'))
1623 if conf
.CONFIG_SET('HAVE_STATFS_F_FSID'):
1624 default_shared_modules
.extend(TO_LIST('vfs_fileid'))
1626 if (conf
.CONFIG_SET('HAVE_MSGHDR_MSG_CONTROL') or conf
.CONFIG_SET('HAVE_MSGHDR_MSG_ACCTRIGHTS')):
1627 default_shared_modules
.extend(TO_LIST('vfs_aio_fork'))
1629 if Options
.options
.with_pthreadpool
:
1630 default_shared_modules
.extend(TO_LIST('vfs_aio_pthread'))
1632 if conf
.CONFIG_SET('HAVE_AIO'):
1633 default_shared_modules
.extend(TO_LIST('vfs_aio_posix'))
1635 if conf
.CONFIG_SET('HAVE_LINUX_KERNEL_AIO'):
1636 default_shared_modules
.extend(TO_LIST('vfs_aio_linux'))
1638 if conf
.CONFIG_SET('HAVE_LDAP'):
1639 default_static_modules
.extend(TO_LIST('pdb_ldap idmap_ldap'))
1641 if conf
.CONFIG_SET('DARWINOS'):
1642 default_static_modules
.extend(TO_LIST('charset_macosxfs'))
1644 if conf
.CONFIG_SET('HAVE_GPFS'):
1645 default_shared_modules
.extend(TO_LIST('vfs_gpfs'))
1647 explicit_shared_modules
= TO_LIST(Options
.options
.shared_modules
, delimiter
=',')
1648 explicit_static_modules
= TO_LIST(Options
.options
.static_modules
, delimiter
=',')
1650 final_static_modules
= default_static_modules
1651 final_shared_modules
= default_shared_modules
1653 for m
in explicit_static_modules
:
1654 if m
in final_shared_modules
:
1655 final_shared_modules
.remove(m
)
1656 final_static_modules
.append(m
)
1657 for m
in explicit_shared_modules
:
1658 if m
in final_static_modules
:
1659 final_static_modules
.remove(m
)
1660 final_shared_modules
.append(m
)
1662 if ("auth_domain" not in final_static_modules
) or \
1663 ("auth_builtin" not in final_static_modules
) or \
1664 ("auth_sam" not in final_static_modules
) or \
1665 ("auth_winbind" not in final_static_modules
):
1666 raise Utils
.WafError('These auth modules MUST be configured as static modules: auth_domain, auth_builtin, auth_sam, auth_winbind')
1668 conf
.env
['static_modules'] = final_static_modules
1669 conf
.env
['shared_modules'] = final_shared_modules
1671 conf
.DEFINE('STRING_STATIC_MODULES', ' '.join(final_static_modules
), quote
=True)
1676 prefixes
= ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
1677 conf
.env
['MODULE_PREFIXES'] = prefixes
1679 for m
in final_static_modules
:
1681 if not p
in static_list
:
1683 static_list
[p
].append(m
)
1684 for m
in final_shared_modules
:
1686 if not p
in shared_list
:
1688 shared_list
[p
].append(m
)
1691 static_env
= "%s_STATIC" % p
.upper()
1692 shared_env
= "%s_SHARED" % p
.upper()
1693 conf
.env
[static_env
] = []
1694 conf
.env
[shared_env
] = []
1695 if p
in static_list
:
1697 for entry
in static_list
[p
]:
1698 decl_list
+= "extern NTSTATUS %s_init(void); " % entry
1699 conf
.env
[static_env
].append('%s' % entry
)
1700 decl_list
= decl_list
.rstrip()
1701 conf
.DEFINE('static_decl_%s' % p
, decl_list
)
1702 conf
.DEFINE('static_init_%s' % p
, '{ %s_init(); }' % '_init(); '.join(static_list
[p
]))
1704 conf
.DEFINE('static_decl_%s' % p
, '')
1705 conf
.DEFINE('static_init_%s' % p
, '{}')
1706 if p
in shared_list
:
1707 for entry
in shared_list
[p
]:
1708 conf
.DEFINE('%s_init' % entry
, 'samba_init_module')
1709 conf
.env
[shared_env
].append('%s' % entry
)
1711 conf
.SAMBA_CONFIG_H('include/config.h')
1714 "build 'tags' file using ctags"
1716 source_root
= os
.path
.dirname(Utils
.g_module
.root_path
)
1717 cmd
= 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
1718 print("Running: %s" % cmd
)