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)
24 opt.add_option('--enable-selftest',
25 help=("enable options necessary for selftest"),
26 action="store_true", dest='enable_selftest', default=False)
28 opt.SAMBA3_ADD_OPTION('winbind')
29 opt.SAMBA3_ADD_OPTION('swat')
30 opt.SAMBA3_ADD_OPTION('ads')
31 opt.SAMBA3_ADD_OPTION('mit-krb5-checks', default=False)
32 opt.SAMBA3_ADD_OPTION('ldap')
33 opt.SAMBA3_ADD_OPTION('cups', with_name="enable", without_name="disable")
34 opt.SAMBA3_ADD_OPTION('iprint', with_name="enable", without_name="disable")
35 opt.SAMBA3_ADD_OPTION('pam')
36 opt.SAMBA3_ADD_OPTION('pam_smbpass')
37 opt.SAMBA3_ADD_OPTION('quotas')
38 opt.SAMBA3_ADD_OPTION('sys-quotas')
39 opt.SAMBA3_ADD_OPTION('sendfile-support')
40 opt.SAMBA3_ADD_OPTION('utmp')
41 opt.SAMBA3_ADD_OPTION('pthreadpool', with_name="enable", without_name="disable")
42 opt.SAMBA3_ADD_OPTION('avahi', with_name="enable", without_name="disable")
43 opt.SAMBA3_ADD_OPTION('iconv')
44 opt.SAMBA3_ADD_OPTION('acl-support')
45 opt.SAMBA3_ADD_OPTION('dnsupdate')
46 opt.SAMBA3_ADD_OPTION('syslog')
47 opt.SAMBA3_ADD_OPTION('automount')
48 opt.SAMBA3_ADD_OPTION('aio-support')
49 opt.SAMBA3_ADD_OPTION('profiling-data', default=False)
51 opt.SAMBA3_ADD_OPTION('cluster-support')
53 opt.add_option('--with-ctdb-dir',
54 help=("Directory under which ctdb is installed"),
55 action="store", dest='ctdb_dir', default=None)
56 opt.add_option('--enable-old-ctdb',
57 help=("enable building against (too) old version of ctdb (default=false)"),
58 action="store_true", dest='enable_old_ctdb', default=False)
63 from samba_utils import TO_LIST
65 if Options.options.developer:
66 conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
67 conf.env.developer = True
69 if Options.options.with_swat:
70 conf.env['build_swat'] = True
72 if sys.platform != 'openbsd5':
73 conf.ADD_LDFLAGS("-Wl,--export-dynamic", testflags=True)
75 conf.CHECK_HEADERS('execinfo.h libexc.h libunwind.h netdb.h')
76 conf.CHECK_HEADERS('linux/falloc.h')
78 conf.CHECK_FUNCS('getcwd fchown chmod fchmod mknod')
79 conf.CHECK_FUNCS('strtol strchr strupr chflags')
80 conf.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
81 conf.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
82 conf.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr')
83 conf.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
84 conf.CHECK_FUNCS('setpriv setgidx setuidx setgroups sysconf')
85 conf.CHECK_FUNCS('atexit grantpt fallocate posix_fallocate')
86 conf.CHECK_FUNCS('fseeko setluid')
87 conf.CHECK_FUNCS('getpwnam', headers='sys/types.h pwd.h')
88 conf.CHECK_FUNCS('fdopendir')
89 conf.CHECK_FUNCS('getpwent_r setenv strcasecmp fcvt fcvtl')
90 conf.CHECK_FUNCS('syslog vsyslog timegm setlocale')
91 conf.CHECK_FUNCS_IN('nanosleep', 'rt')
92 conf.CHECK_FUNCS('lutimes futimes utimensat futimens')
93 conf.CHECK_FUNCS('mlock munlock mlockall munlockall')
94 conf.CHECK_FUNCS('memalign posix_memalign hstrerror')
95 conf.CHECK_FUNCS('shmget')
96 conf.CHECK_FUNCS_IN('shm_open', 'rt', checklibc=True)
97 conf.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain bind_textdomain_codeset')
98 #FIXME: for some reason this one still fails
99 conf.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
100 conf.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
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,0);
115 conf.CHECK_DECLS('splice', reverse=True, headers='fcntl.h')
117 # Check for inotify support
118 conf.CHECK_HEADERS('linux/inotify.h asm/unistd.h sys/inotify.h')
119 conf.CHECK_FUNCS('inotify_init')
120 if "HAVE_INOTIFY_INIT" in conf.env:
121 if "HAVE_LINUX_INOTIFY_H" in conf.env or "HAVE_SYS_INOTIFY_H" in conf.env:
122 conf.DEFINE('HAVE_INOTIFY', 1)
124 # Check for kernel change notify support
127 #define F_NOTIFY 1026
130 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
131 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain=False, execute=True,
132 headers='fcntl.h signal.h',
133 msg="Checking for kernel change notify support")
135 # Check for Linux kernel oplocks
137 #include <sys/types.h>
141 #define F_NOTIFY 1026
144 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
145 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain=False, execute=True,
146 msg="Checking for Linux kernel oplocks")
148 # Check for IRIX kernel oplock types
149 conf.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
150 'HAVE_KERNEL_OPLOCKS_IRIX', headers='fcntl.h',
151 msg="Checking for IRIX kernel oplock types")
153 # Check for kernel share modes
155 #include <sys/types.h>
158 #include <sys/file.h>
164 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
165 }''', 'HAVE_KERNEL_SHARE_MODES', addmain=False, execute=True,
166 msg="Checking for krenel share modes")
168 # Check for various members of the stat structure
169 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define='HAVE_STAT_ST_BLOCKS',
170 headers='sys/stat.h')
171 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define='HAVE_STAT_ST_BLKSIZE',
172 headers='sys/stat.h')
173 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_flags', define='HAVE_STAT_ST_FLAGS',
174 headers='sys/types.h sys/stat.h unistd.h')
176 if "HAVE_BLKCNT_T" in conf.env:
178 return sizeof(blkcnt_t) == 4 ? 0 : 1''',
179 'SIZEOF_BLKCNT_T_4', execute=True,
180 headers='replace.h sys/types.h sys/stat.h unistd.h',
181 msg="Checking whether blkcnt_t is 32 bit")
183 if "HAVE_BLKCNT_T" in conf.env:
185 return sizeof(blkcnt_t) == 8 ? 0 : 1''',
186 'SIZEOF_BLKCNT_T_8', execute=True,
187 headers='replace.h sys/types.h sys/stat.h unistd.h',
188 msg="Checking whether blkcnt_t is 64 bit")
190 # Check for POSIX capability support
191 conf.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers='sys/capability.h')
193 if "HAVE_SYS_CAPABILITY_H" in conf.env:
197 if (!(cap = cap_get_proc())) exit(1);
199 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
200 cap_set_proc(cap);''',
201 'HAVE_POSIX_CAPABILITIES', execute=True, lib="cap",
202 headers='sys/capability.h',
203 msg="Checking whether POSIX capabilities are available")
205 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
206 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
208 if conf.CONFIG_SET("HAVE_RPC_RPC_H"):
209 conf.CHECK_TYPE('int16', headers='rpc/rpc.h',
210 define='HAVE_INT16_FROM_RPC_RPC_H',
211 msg="Checking for int16 typedef included by rpc/rpc.h")
212 conf.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
213 headers='sys/types.h rpc/rpc.h',
214 msg="Checking for uint16 typedef included by rpc/rpc.h")
215 conf.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
216 headers='sys/types.h rpc/rpc.h',
217 msg="Checking for int32 typedef included by rpc/rpc.h")
218 conf.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
219 headers='sys/types.h rpc/rpc.h',
220 msg="Checking for uint32 typedef included by rpc/rpc.h")
221 conf.CHECK_CODE('int i;', 'BROKEN_NISPLUS_INCLUDE_FILES',
222 headers='sys/types.h sys/acl.h rpcsvc/nis.h',
223 msg="Checking for broken nisplus include files")
225 # Check if the compiler will optimize out functions
228 this_function_does_not_exist();
231 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
232 msg="Checking if the compiler will optimize out functions")
234 # Check if the compiler supports the LL suffix on long long integers
236 conf.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL',
238 msg="Checking for LL suffix on long long integers")
241 _acl __acl add_proplist_entry atexit attr_getf attr_list attr_listf
242 attropen attr_remove attr_removef attr_set attr_setf
243 bindtextdomain _chdir __chdir chflags chmod _close __close _closedir
244 __closedir crypt16 delproplist devnm dgettext dirfd
245 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
246 extattr_delete_fd extattr_get_fd extattr_get_file
247 extattr_list_fd extattr_list_file
248 extattr_set_fd extattr_set_file _facl __facl _fchdir
249 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
250 fdelproplist fgetea fgetproplist fgetxattr flistea flistxattr
251 _fork __fork fremoveea fremovexattr fseeko fsetea
252 fsetproplist fsetxattr _fstat __fstat fsync
253 futimens futimes __fxstat getauthuid
254 getcwd _getcwd __getcwd getdents __getdents getdirentries
255 getgrent getgrnam getgrouplist getgrset getmntent getpagesize
256 getproplist get_proplist_entry getpwanam getpwent_r getrlimit gettext
257 glob grantpt hstrerror initgroups innetgr
258 inotify_init listea listxattr
259 llseek _llseek __llseek _lseek __lseek
260 _lstat __lstat lutimes
261 __lxstat memalign mknod mlock mlockall munlock munlockall
262 _open __open _opendir __opendir
263 pathconf poll posix_fallocate
264 posix_memalign prctl pread _pread __pread
265 pwrite _pwrite __pwrite
266 rdchk _read __read _readdir __readdir
267 removeea removexattr _seekdir __seekdir
268 select setea setenv setgidx setgroups setlocale setluid
269 setmntent setpgid setpriv setproplist setsid setuidx
270 setxattr shmget shm_open sigaction sigblock sigprocmask sigset
271 sizeof_proplist_entry _stat __stat statvfs
272 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctl sysctlbyname
273 __sys_llseek syslog _telldir __telldir textdomain timegm
274 utimensat vsyslog _write __write __xstat
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.DEFINE('STAT_ST_BLOCKSIZE', '512')
298 conf.ADD_CFLAGS('-fno-common')
299 elif (host_os.rfind('freebsd') > -1):
300 if conf.CHECK_HEADERS('sunacl.h'):
301 conf.DEFINE('HAVE_FREEBSD_SUNACL_H', '1')
302 conf.CHECK_FUNCS_IN('acl', 'sunacl')
303 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
304 elif (host_os.rfind('netbsd') > -1):
305 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
306 elif (host_os.rfind('openbsd') > -1):
307 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
308 elif (host_os.rfind('sunos') > -1):
309 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
310 # FIXME: Add more checks here.
312 Logs.warn("Unknown host_os '%s', please report this to samba-technical@samba.org" % host_os)
314 #FIXME: add more checks
315 if Options.options.with_acl_support:
316 if host_os.rfind('linux') > -1:
317 conf.CHECK_FUNCS_IN('acl_get_file', 'acl')
318 conf.CHECK_FUNCS_IN('getxattr', 'attr')
319 if conf.CHECK_CODE('''
322 acl_entry_t *entry_p;
323 return acl_get_entry(acl, entry_id, entry_p);
326 headers='sys/types.h sys/acl.h', link=False,
327 msg="Checking for POSIX ACL support") :
329 acl_permset_t permset_d;
331 return acl_get_perm_np(permset_d, perm);
333 'HAVE_ACL_GET_PERM_NP',
334 headers='sys/types.h sys/acl.h', link=True,
335 msg="Checking whether acl_get_perm_np() is available")
337 conf.DEFINE('HAVE_NO_ACLS', 1)
338 conf.SET_TARGET_TYPE('acl', 'EMPTY')
340 conf.DEFINE('HAVE_NO_ACLS', 1)
341 conf.SET_TARGET_TYPE('acl', 'EMPTY')
343 if conf.CHECK_FUNCS('dirfd'):
344 conf.DEFINE('HAVE_DIRFD_DECL', 1)
346 conf.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
347 'HAVE_STATFS_F_FSID',
348 msg="vfs_fileid: checking for statfs() and struct statfs.f_fsid",
349 headers='sys/types.h sys/statfs.h',
352 if conf.CONFIG_SET('HAVE_FALLOCATE'):
354 int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
355 'HAVE_LINUX_FALLOCATE',
356 msg="Checking whether the Linux 'fallocate' function is available",
357 headers='unistd.h sys/types.h fcntl.h linux/falloc.h')
359 ssize_t err = readahead(0,0,0x80000);''',
360 'HAVE_LINUX_READAHEAD',
361 msg="Checking whether Linux readahead is available",
362 headers='unistd.h fcntl.h')
363 conf.CHECK_DECLS('readahead', headers='fcntl.h', always=True)
365 if Options.options.with_aio_support:
366 conf.CHECK_FUNCS_IN('aio_read', 'aio')
367 conf.CHECK_FUNCS_IN('aio_read', 'rt')
368 conf.CHECK_CODE('struct aiocb a; return aio_read(&a);',
370 msg='Checking for asynchronous io support',
371 headers='sys/types.h aio.h',
373 if conf.CONFIG_SET('HAVE_AIO'):
374 conf.DEFINE('WITH_AIO', '1')
375 if conf.CONFIG_SET('HAVE_AIO'):
376 conf.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg='Checking for aio_read', headers='aio.h', lib='aio rt')
377 conf.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg='Checking for aio_write', headers='aio.h', lib='aio rt')
378 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')
379 conf.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg='Checking for aio_return', headers='aio.h', lib='aio rt')
380 conf.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg='Checking for aio_error', headers='aio.h', lib='aio rt')
381 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')
382 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')
383 if not conf.CONFIG_SET('HAVE_AIO'):
384 conf.DEFINE('HAVE_NO_AIO', '1')
386 conf.DEFINE('HAVE_NO_AIO', '1')
392 char control[CMSG_SPACE(sizeof(int))];
394 msg.msg_control = control_un.control;
395 msg.msg_controllen = sizeof(control_un.control);
397 'HAVE_MSGHDR_MSG_CONTROL',
398 msg='Checking if we can use msg_control for passing file descriptors',
399 headers='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
403 msg.msg_acctrights = (caddr_t) &fd;
404 msg.msg_acctrightslen = sizeof(fd);
406 'HAVE_MSGHDR_MSG_ACCTRIGHTS',
407 msg='Checking if we can use msg_acctrights for passing file descriptors',
408 headers='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
410 if Options.options.with_winbind:
411 conf.env.build_winbind = True
412 conf.DEFINE('WITH_WINBIND', '1')
414 conf.find_program('awk', var='AWK')
415 conf.find_program('perl', var='PERL')
417 # Darwin has extra options to xattr-family functions
418 conf.CHECK_CODE('getxattr(0, 0, 0, 0, 0, 0);',
420 msg="Checking whether xattr interface takes additional options",
421 headers='sys/types.h attr/xattr.h sys/xattr.h')
423 conf.CHECK_HEADERS('asm/types.h')
425 conf.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
426 headers='unistd.h sys/types.h',
427 msg="Checking for major macro")
429 conf.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
430 headers='unistd.h sys/types.h',
431 msg="Checking for minor macro")
433 conf.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
434 headers='unistd.h sys/types.h dirent.h',
435 define='HAVE_DIRENT_D_OFF')
437 conf.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent')
438 if conf.CHECK_CFLAGS('-Werror-implicit-function-declaration'):
439 netgrent_cflags = '-Werror-implicit-function-declaration'
442 conf.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE',
443 msg="Checking for setnetgrent prototype",
444 headers='netdb.h netgroup.h',
445 cflags=netgrent_cflags)
446 conf.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE',
447 msg="Checking for getnetgrent prototype",
448 headers='netdb.h netgroup.h',
449 cflags=netgrent_cflags)
450 conf.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE',
451 msg="Checking for endnetgrent prototype",
452 headers='netdb.h netgroup.h',
453 cflags=netgrent_cflags)
457 if Options.options.with_cups:
458 conf.find_program('cups-config', var='CUPS_CONFIG')
459 if conf.env.CUPS_CONFIG:
460 # we would normally use --libs here, but cups-config incorrectly adds
461 # gssapi_krb5 and other libraries to its --libs output. That breaks the use
462 # of an in-tree heimdal kerberos
463 conf.check_cfg(path=conf.env.CUPS_CONFIG, args="--cflags --ldflags",
464 package="", uselib_store="CUPS")
465 conf.CHECK_HEADERS('cups/cups.h cups/language.h', lib='cups')
466 conf.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups')
467 if conf.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
468 conf.DEFINE('HAVE_CUPS', '1')
470 conf.undefine('HAVE_CUPS')
471 conf.SET_TARGET_TYPE('cups', 'EMPTY')
473 # define an empty subsystem for cups, to allow it to be used as an empty dependency
474 conf.SET_TARGET_TYPE('cups', 'EMPTY')
476 if Options.options.with_iprint:
477 if conf.CONFIG_SET('HAVE_CUPS'):
478 conf.DEFINE('HAVE_IPRINT', '1')
480 Logs.warn("--enable-iprint=yes but cups support not sufficient")
481 if Options.options.with_syslog:
482 conf.DEFINE('WITH_SYSLOG', '1')
483 if Options.options.with_automount:
484 conf.DEFINE('WITH_AUTOMOUNT', '1')
487 if Options.options.with_ldap:
488 conf.CHECK_HEADERS('ldap.h lber.h ldap_pvt.h')
489 conf.CHECK_TYPE('ber_tag_t', 'unsigned int', headers='ldap.h lber.h')
490 conf.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
491 conf.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers='ldap.h')
493 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
495 conf.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
496 define='HAVE_LBER_LOG_PRINT_FN', headers='lber.h')
498 conf.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', 'ldap')
499 conf.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
501 # Check if ldap_set_rebind_proc() takes three arguments
502 if conf.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
503 'LDAP_SET_REBIND_PROC_ARGS',
504 msg="Checking whether ldap_set_rebind_proc takes 3 arguments",
505 headers='ldap.h lber.h', link=False):
506 conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
508 conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
510 # last but not least, if ldap_init() exists, we want to use ldap
511 if conf.CONFIG_SET('HAVE_LDAP_INIT'):
512 conf.DEFINE('HAVE_LDAP', '1')
513 conf.DEFINE('LDAP_DEPRECATED', '1')
514 conf.env['HAVE_LDAP'] = '1'
515 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
516 # SASL wrapping hooks
517 if conf.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
518 conf.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
519 conf.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
521 conf.SET_TARGET_TYPE('ldap', 'EMPTY')
522 conf.SET_TARGET_TYPE('lber', 'EMPTY')
526 if Options.options.with_mit_krb5_checks and conf.env.developer:
527 Logs.info("Looking for kerberos features")
528 conf.find_program('krb5-config', var='KRB5_CONFIG')
529 if conf.env.KRB5_CONFIG:
530 conf.check_cfg(path="krb5-config", args="--cflags --libs",
531 package="gssapi", uselib_store="KRB5")
532 conf.CHECK_HEADERS('krb5.h krb5/locate_plugin.h', lib='krb5')
533 conf.CHECK_HEADERS('gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h gssapi/gssapi_ext.h gssapi/gssapi_krb5.h com_err.h', lib='krb5')
535 if conf.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'):
536 conf.env['WINBIND_KRB5_LOCATOR'] = 'bin/winbind_krb5_locator.so'
538 conf.CHECK_FUNCS_IN('_et_list', 'com_err')
539 conf.CHECK_FUNCS_IN('krb5_encrypt_data', 'k5crypto')
540 conf.CHECK_FUNCS_IN('des_set_key','crypto')
541 conf.CHECK_FUNCS_IN('copy_Authenticator', 'asn1')
542 conf.CHECK_FUNCS_IN('roken_getaddrinfo_hostspec', 'roken')
543 if conf.CHECK_FUNCS_IN('gss_display_status', 'gssapi') or \
544 conf.CHECK_FUNCS_IN('gss_display_status', 'gssapi_krb5'):
546 conf.CHECK_FUNCS_IN('''
549 gss_get_name_attribute
552 gss_inquire_sec_context_by_oid
553 gsskrb5_extract_authz_data_from_sec_context
554 gss_krb5_export_lucid_sec_context
555 ''', 'gssapi gssapi_krb5 krb5')
556 conf.CHECK_FUNCS_IN('krb5_mk_req_extended krb5_kt_compare', 'krb5')
558 krb5_set_default_in_tkt_etypes krb5_set_default_tgs_enctypes
559 krb5_set_default_tgs_ktypes krb5_principal2salt krb5_use_enctype
560 krb5_string_to_key krb5_get_pw_salt krb5_string_to_key_salt krb5_auth_con_setkey
561 krb5_auth_con_setuseruserkey krb5_get_permitted_enctypes
562 krb5_get_default_in_tkt_etypes krb5_free_data_contents
563 krb5_principal_get_comp_string krb5_free_unparsed_name
564 krb5_free_keytab_entry_contents krb5_kt_free_entry krb5_krbhst_init
565 krb5_krbhst_get_addrinfo
566 krb5_crypto_init krb5_crypto_destroy
567 krb5_c_verify_checksum krb5_principal_compare_any_realm
568 krb5_parse_name_norealm krb5_princ_size krb5_get_init_creds_opt_set_pac_request
569 krb5_get_renewed_creds krb5_free_error_contents
570 initialize_krb5_error_table krb5_get_init_creds_opt_alloc
571 krb5_get_init_creds_opt_free krb5_get_init_creds_opt_get_error
572 krb5_enctype_to_string krb5_fwd_tgt_creds krb5_auth_con_set_req_cksumtype
573 krb5_get_creds_opt_alloc krb5_get_creds_opt_set_impersonate krb5_get_creds
574 krb5_get_credentials_for_user krb5_get_host_realm krb5_free_host_realm''',
576 conf.CHECK_DECLS('''krb5_get_credentials_for_user
577 krb5_auth_con_set_req_cksumtype''',
578 headers='krb5.h', always=True)
579 conf.CHECK_VARIABLE('AP_OPTS_USE_SUBKEY', headers='krb5.h')
580 conf.CHECK_VARIABLE('KV5M_KEYTAB', headers='krb5.h')
581 conf.CHECK_VARIABLE('KRB5_KU_OTHER_CKSUM', headers='krb5.h')
582 conf.CHECK_VARIABLE('KRB5_KEYUSAGE_APP_DATA_CKSUM', headers='krb5.h')
583 conf.CHECK_VARIABLE('ENCTYPE_AES128_CTS_HMAC_SHA1_96', headers='krb5.h')
584 conf.CHECK_VARIABLE('ENCTYPE_AES256_CTS_HMAC_SHA1_96', headers='krb5.h')
585 conf.CHECK_DECLS('KRB5_PDU_NONE', reverse=True, headers='krb5.h')
586 conf.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'key', headers='krb5.h',
587 define='HAVE_KRB5_KEYTAB_ENTRY_KEY')
588 conf.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'keyblock', headers='krb5.h',
589 define='HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK')
590 conf.CHECK_STRUCTURE_MEMBER('krb5_address', 'magic', headers='krb5.h',
591 define='HAVE_MAGIC_IN_KRB5_ADDRESS')
592 conf.CHECK_STRUCTURE_MEMBER('krb5_address', 'addrtype', headers='krb5.h',
593 define='HAVE_ADDRTYPE_IN_KRB5_ADDRESS')
594 conf.CHECK_STRUCTURE_MEMBER('krb5_ap_req', 'ticket', headers='krb5.h',
595 define='HAVE_TICKET_POINTER_IN_KRB5_AP_REQ')
597 conf.CHECK_TYPE('krb5_encrypt_block', headers='krb5.h')
601 krb5_get_init_creds_opt *opt = NULL;
602 krb5_get_init_creds_opt_free(ctx, opt);
604 'KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT',
605 headers='krb5.h', link=False,
606 msg="Checking whether krb5_get_init_creds_opt_free takes a context argument")
608 const krb5_data *pkdata;
609 krb5_context context;
610 krb5_principal principal;
611 pkdata = krb5_princ_component(context, principal, 0);
613 'HAVE_KRB5_PRINC_COMPONENT',
614 headers='krb5.h', lib='krb5',
615 msg="Checking whether krb5_princ_component is available")
620 krb5_enctype_to_string(1, buf, 256);
623 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_SIZE_T_ARG',
624 headers='krb5.h', lib='krb5 k5crypto',
625 addmain=False, cflags='-Werror',
626 msg="Checking whether krb5_enctype_to_string takes size_t argument")
630 krb5_context context = NULL;
632 krb5_enctype_to_string(context, 1, &str);
636 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_KRB5_CONTEXT_ARG',
637 headers='krb5.h stdlib.h', lib='krb5',
638 addmain=False, cflags='-Werror',
639 msg="Checking whether krb5_enctype_to_string takes krb5_context argument")
642 krb5_context ctx = NULL;
643 krb5_principal princ = NULL;
644 const char *str = krb5_princ_realm(ctx, princ)->data;
647 'HAVE_KRB5_PRINC_REALM',
648 headers='krb5.h', lib='krb5',
650 msg="Checking whether the macro krb5_princ_realm is defined")
653 krb5_context context;
654 krb5_principal principal;
655 const char *realm; realm = krb5_principal_get_realm(context, principal);
658 'HAVE_KRB5_PRINCIPAL_GET_REALM',
659 headers='krb5.h', lib='krb5',
661 msg="Checking whether krb5_principal_get_realm is defined")
663 krb5_enctype enctype;
664 enctype = ENCTYPE_ARCFOUR_HMAC_MD5;
666 '_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5',
667 headers='krb5.h', lib='krb5',
668 msg="Checking whether the ENCTYPE_ARCFOUR_HMAC_MD5 key type definition is available");
670 krb5_keytype keytype;
671 keytype = KEYTYPE_ARCFOUR_56;
673 '_HAVE_KEYTYPE_ARCFOUR_56',
674 headers='krb5.h', lib='krb5',
675 msg="Checking whether the HAVE_KEYTYPE_ARCFOUR_56 key type definition is available");
676 if conf.CONFIG_SET('_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and conf.CONFIG_SET('_HAVE_KEYTYPE_ARCFOUR_56'):
677 conf.DEFINE('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5', '1')
680 krb5_enctype enctype;
681 enctype = ENCTYPE_ARCFOUR_HMAC;
683 'HAVE_ENCTYPE_ARCFOUR_HMAC',
684 headers='krb5.h', lib='krb5',
685 msg="Checking whether the ENCTYPE_ARCFOUR_HMAC key type definition is available");
688 krb5_context context;
690 krb5_init_context(&context);
691 return krb5_kt_resolve(context, "WRFILE:api", &keytab);
693 'HAVE_WRFILE_KEYTAB',
694 headers='krb5.h', lib='krb5', execute=True,
695 msg="Checking whether the WRFILE:-keytab is supported");
697 # Check for KRB5_DEPRECATED handling
698 conf.CHECK_CODE('''#define KRB5_DEPRECATED 1
699 #include <krb5.h>''',
700 'HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER', addmain=False,
702 msg="Checking for KRB5_DEPRECATED define taking an identifier")
704 if Options.options.with_ads:
706 if not conf.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and \
707 not conf.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC'):
708 Logs.warn("arcfour-hmac-md5 encryption type not found in -lkrb5")
710 if not conf.CONFIG_SET('HAVE_KRB5_MK_REQ_EXTENDED'):
711 Logs.warn("krb5_mk_req_extended not found in -lkrb5")
713 if not conf.CONFIG_SET('HAVE_KRB5_GET_HOST_REALM'):
714 Logs.warn("krb5_get_host_realm not found in -lkrb5")
716 if not conf.CONFIG_SET('HAVE_KRB5_FREE_HOST_REALM'):
717 Logs.warn("krb5_free_host_realm not found in -lkrb5")
719 if not conf.CONFIG_SET('HAVE_KRB5_FWD_TGT_CREDS'):
720 Logs.warn("krb5_fwd_tgt_creds found in -lkrb5")
722 if not conf.CONFIG_SET('HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC'):
723 Logs.warn("krb5_get_init_creds_opt_alloc not found in -lkrb5")
725 if not conf.CONFIG_SET('KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT'):
726 Logs.warn("krb5_get_init_creds_opt_free was not found or was too old in -lkrb5")
728 if not conf.CONFIG_SET('HAVE_KRB5_GET_RENEWED_CREDS'):
729 Logs.warn("krb5_get_renewed_creds not found in -lkrb5")
731 if not conf.CONFIG_SET('HAVE_KRB5_PRINCIPAL_COMPARE_ANY_REALM'):
732 Logs.warn("krb5_principal_compare_any_realm not found in -lkrb5")
734 if not conf.CONFIG_SET('HAVE_KRB5_STRING_TO_KEY'):
735 Logs.warn("krb5_string_to_key not found in -lkrb5")
737 if not conf.CONFIG_SET('HAVE_KRB5_PRINCIPAL2SALT') and \
738 not conf.CONFIG_SET('HAVE_KRB5_GET_PW_SALT'):
739 Logs.warn("no CREATE_KEY_FUNCTIONS detected")
741 if not conf.CONFIG_SET('HAVE_KRB5_GET_PERMITTED_ENCTYPES') and \
742 not conf.CONFIG_SET('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES'):
743 Logs.warn("no GET_ENCTYPES_FUNCTIONS detected")
745 if not conf.CONFIG_SET('HAVE_KRB5_KT_FREE_ENTRY') and \
746 not conf.CONFIG_SET('HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS'):
747 Logs.warn("no KT_FREE_FUNCTION detected")
749 if not conf.CONFIG_SET('HAVE_KRB5_C_VERIFY_CHECKSUM'):
750 Logs.warn("krb5_c_verify_checksum_compare not found in -lkrb5")
753 # We don't actually use
754 # gsskrb5_extract_authz_data_from_sec_context, but it is a
755 # clue that this Heimdal, which does the PAC processing we
756 # need on the standard gss_inquire_sec_context_by_oid
757 if not conf.CONFIG_SET('HAVE_GSS_GET_NAME_ATTRIBUTE') and \
758 not (conf.CONFIG_SET('HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT') and \
759 conf.CONFIG_SET('HAVE_GSS_INQUIRE_SEC_CONTEXT_BY_OID')):
760 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")
763 if not conf.CONFIG_SET('HAVE_GSS_KRB5_EXPORT_LUCID_SEC_CONTEXT'):
764 Logs.warn("need gss_krb5_export_lucid_sec_context for SPNEGO and gss_wrap support")
768 conf.DEFINE('WITH_ADS', '1')
769 conf.DEFINE('HAVE_KRB5', '1')
770 if conf.CONFIG_SET('HAVE_LDAP'):
771 conf.env['HAVE_ADS'] = '1'
773 Logs.warn("krb5 libs don't have all features required for Active Directory support")
774 conf.undefine('HAVE_KRB5_H')
775 conf.undefine('HAVE_GSSAPI_H')
776 conf.undefine('HAVE_GSSAPI_GSSAPI_GENERIC_H')
777 conf.undefine('HAVE_GSSAPI_GSSAPI_H')
779 if Options.options.with_utmp:
780 conf.env.with_utmp = True
781 if not conf.CHECK_HEADERS('utmp.h'): conf.env.with_utmp = False
782 conf.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
783 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers='utmp.h',
784 define='HAVE_UT_UT_NAME')
785 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers='utmp.h',
786 define='HAVE_UT_UT_USER')
787 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers='utmp.h',
788 define='HAVE_UT_UT_ID')
789 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers='utmp.h',
790 define='HAVE_UT_UT_HOST')
791 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers='utmp.h',
792 define='HAVE_UT_UT_TIME')
793 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers='utmp.h',
794 define='HAVE_UT_UT_TV')
795 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers='utmp.h',
796 define='HAVE_UT_UT_TYPE')
797 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers='utmp.h',
798 define='HAVE_UT_UT_PID')
799 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers='utmp.h',
800 define='HAVE_UT_UT_EXIT')
801 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr_v6', headers='utmp.h',
802 define='HAVE_UT_UT_ADDR_V6')
803 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr', headers='utmp.h',
804 define='HAVE_UT_UT_ADDR')
805 conf.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers='utmpx.h',
806 define='HAVE_UX_UT_SYSLEN')
807 conf.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
808 'PUTUTLINE_RETURNS_UTMP', headers='utmp.h',
809 msg="Checking whether pututline returns pointer")
810 if conf.env.with_utmp:
811 conf.DEFINE('WITH_UTMP', 1)
813 if Options.options.with_avahi:
814 conf.env.with_avahi = True
815 if not conf.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf.env.with_avahi = False
816 if not conf.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf.env.with_avahi = False
817 if not conf.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf.env.with_avahi = False
818 if conf.env.with_avahi:
819 conf.DEFINE('WITH_AVAHI_SUPPORT', 1)
821 conf.SET_TARGET_TYPE('avahi-common', 'EMPTY')
822 conf.SET_TARGET_TYPE('avahi-client', 'EMPTY')
824 if Options.options.with_iconv:
825 conf.env.with_iconv = True
826 if not conf.CHECK_FUNCS_IN('iconv_open', 'iconv', headers='iconv.h'):
827 conf.env.with_iconv = False
828 if conf.env.with_iconv:
829 conf.DEFINE('HAVE_ICONV', 1)
831 if Options.options.with_pam:
833 conf.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
834 if not conf.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
835 Logs.warn("--with-pam=yes but pam_appl.h not found")
837 conf.CHECK_FUNCS_IN('pam_get_data', 'pam')
838 conf.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h')
839 if not conf.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'):
840 Logs.warn("--with-pam=yes but pam_modules.h not found")
842 conf.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h')
843 conf.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h')
844 conf.CHECK_FUNCS_IN('pam_vsyslog', 'pam')
846 #if defined(HAVE_SECURITY_PAM_APPL_H)
847 #include <security/pam_appl.h>
848 #elif defined(HAVE_PAM_PAM_APPL_H)
849 #include <pam/pam_appl.h>
851 pam_set_item(0, PAM_RHOST, 0);
855 msg="Checking whether PAM_RHOST is available");
857 #if defined(HAVE_SECURITY_PAM_APPL_H)
858 #include <security/pam_appl.h>
859 #elif defined(HAVE_PAM_PAM_APPL_H)
860 #include <pam/pam_appl.h>
862 pam_set_item(0, PAM_TTY, 0);
866 msg="Checking whether PAM_TTY is available");
868 #if (!defined(LINUX))
870 #define PAM_EXTERN extern
871 #if defined(HAVE_SECURITY_PAM_APPL_H)
872 #include <security/pam_appl.h>
873 #elif defined(HAVE_PAM_PAM_APPL_H)
874 #include <pam/pam_appl.h>
879 #if defined(HAVE_SECURITY_PAM_MODULES_H)
880 #include <security/pam_modules.h>
881 #elif defined(HAVE_PAM_PAM_MODULES_H)
882 #include <pam/pam_modules.h>
885 #if defined(HAVE_SECURITY__PAM_MACROS_H)
886 #include <security/_pam_macros.h>
887 #elif defined(HAVE_PAM__PAM_MACROS_H)
888 #include <pam/_pam_macros.h>
891 #ifdef HAVE_SECURITY_PAM_EXT_H
892 #include <security/pam_ext.h>
895 int i; i = PAM_RADIO_TYPE;
897 'HAVE_PAM_RADIO_TYPE',
899 msg="Checking whether PAM_RADIO_TYPE is available");
901 conf.DEFINE('WITH_PAM', 1)
902 conf.DEFINE('WITH_PAM_MODULES', 1)
906 seteuid = conf.CHECK_CODE('''
907 #define AUTOCONF_TEST 1
908 #define USE_SETREUID 1
909 #include "./lib/util_sec.c"
914 msg="Checking whether setreuid is available")
916 seteuid = conf.CHECK_CODE('''
917 #define AUTOCONF_TEST 1
918 #define USE_SETRESUID 1
919 #include "./lib/util_sec.c"
924 msg="Checking whether setresuid is available")
926 seteuid = conf.CHECK_CODE('''
927 #define AUTOCONF_TEST 1
928 #define USE_SETEUID 1
929 #include "./lib/util_sec.c"
934 msg="Checking whether seteuid is available")
936 seteuid = conf.CHECK_CODE('''
937 #define AUTOCONF_TEST 1
938 #define USE_SETUIDX 1
939 #include "./lib/util_sec.c"
945 msg="Checking whether setuidx is available")
946 if Options.options.with_dnsupdate:
947 conf.CHECK_HEADERS('uuid/uuid.h')
948 conf.CHECK_FUNCS_IN('uuid_generate', 'uuid')
949 if not conf.CONFIG_SET('HAVE_UUID_UUID_H') and not conf.CONFIG_SET('HAVE_UUID_GENERATE'):
950 Logs.warn("--with-dnsupdate=yes but uuid support not sufficient")
951 elif not conf.CONFIG_SET('HAVE_KRB5'):
952 Logs.warn("--with-dnsupdate=yes but gssapi support not sufficient")
954 conf.DEFINE('WITH_DNS_UPDATES', 1)
956 conf.SET_TARGET_TYPE('uuid', 'EMPTY')
957 conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
958 if Options.options.developer:
959 if conf.CONFIG_SET('HAVE_VALGRIND_H') or conf.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'):
960 conf.DEFINE('VALGRIND', '1')
962 if conf.CHECK_CODE('''
963 #include <bits/sockaddr.h>
964 #include <linux/netlink.h>
966 'HAVE_LINUX_NETLINK_H',
967 msg="Checking whether Linux netlink is available"):
969 #include <bits/sockaddr.h>
970 #include <linux/netlink.h>
971 #include <linux/rtnetlink.h>
973 'HAVE_LINUX_RTNETLINK_H',
974 msg='Checking whether Linux rtnetlink is available')
976 #include "../tests/fcntl_lock.c"
981 msg='Checking whether fcntl locking is available')
983 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec',
984 define='HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') # Linux, Solaris
985 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimensec',
986 define='HAVE_STRUCT_STAT_ST_MTIMENSEC') # BSD, if defined _POSIX_SOURCE
987 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimespec.tv_nsec',
988 define='HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') # BSD, if not defined _POSIX_SOURCE
989 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtime_n',
990 define='HAVE_STRUCT_STAT_ST_MTIME_N') # AIX
991 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_umtime',
992 define='HAVE_STRUCT_STAT_ST_UMTIME') # Tru64
993 if conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') or \
994 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMENSEC') or \
995 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') or \
996 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIME_N') or \
997 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_UMTIME'):
998 conf.DEFINE('HAVE_STAT_HIRES_TIMESTAMPS', '1')
1000 # recent FreeBSD, NetBSD have creation timestamps called birthtime:
1001 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtime',
1002 define='HAVE_STRUCT_STAT_ST_BIRTHTIME')
1003 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimespec.tv_nsec',
1004 define='HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC')
1005 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimensec',
1006 define='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC')
1009 ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
1011 'HAVE_POSIX_FADVISE',
1012 msg='Checking whether posix_fadvise is available',
1013 headers='unistd.h fcntl.h')
1015 for v in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]:
1018 return sysconf(%s) == -1 ? 1 : 0;
1021 msg='Checking whether sysconf(%s) is available' % v)
1023 conf.CHECK_DECLS('__NR_inotify_init', reverse=True, headers='asm/unistd.h')
1026 #include <sys/syscall.h>
1028 syscall(SYS_initgroups, 16, NULL, NULL, 0);
1030 'HAVE_DARWIN_INITGROUPS',
1031 msg='Checking whether to use the Darwin-specific initgroups system call')
1033 conf.CHECK_CODE('''struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''',
1035 headers='sys/types.h utime.h',
1036 msg='Checking whether struct utimbuf is available')
1038 if conf.CHECK_CODE('''struct sigevent s;''',
1039 'HAVE_STRUCT_SIGEVENT',
1040 headers='sys/types.h stdlib.h stddef.h signal.h',
1041 msg='Checking whether we have the struct sigevent'):
1042 conf.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sival_ptr',
1043 define='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR',
1044 headers='signal.h');
1045 conf.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sigval_ptr',
1046 define='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR',
1047 headers='signal.h');
1049 if os.path.exists('/proc/sys/kernel/core_pattern'):
1050 conf.DEFINE('HAVE_SYS_KERNEL_PROC_CORE_PATTERN', '1')
1052 if conf.CHECK_CODE('''
1056 if (sizeof(time_t) == 8) {
1057 time_t max_time = 0x7fffffffffffffffll;
1058 tm = gmtime(&max_time);
1059 /* This should fail with 32-bit tm_year. */
1061 /* Max time_t that works with 32-bit int tm_year in struct tm. */
1062 max_time = 67768036191676799ll;
1063 tm = gmtime(&max_time);
1074 msg="Checking for the maximum value of the 'time_t' type"):
1075 conf.DEFINE('TIME_T_MAX', '67768036191676799ll')
1078 #if defined(HAVE_UNISTD_H)
1081 #include <sys/types.h>
1082 main() { dev_t dev = makedev(1,2); return 0; }
1086 msg='Checking whether the macro for makedev is available')
1093 void exit_on_core(int ignored) {
1099 signal(SIGSEGV, exit_on_core);
1100 newpath = realpath("/tmp", NULL);
1101 exit((newpath != NULL) ? 0 : 1);
1104 'REALPATH_TAKES_NULL',
1107 msg='Checking whether the realpath function allows a NULL argument')
1109 conf.CHECK_CODE('''#include "../tests/ftruncate.c"''',
1110 'HAVE_FTRUNCATE_EXTEND',
1111 msg='Checking for ftruncate extend',
1114 if os.getenv('RUN_FROM_BUILD_FARM'):
1115 Logs.info("enabling buildfarm hacks")
1116 conf.DEFINE('ENABLE_BUILD_FARM_HACKS', '1')
1118 if Options.options.with_sendfile_support:
1119 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):
1124 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1127 headers='sys/sendfile',
1128 msg='Checking for linux sendfile support')
1130 # Try and cope with broken Linux sendfile....
1131 conf.CHECK_CODE('''#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
1132 #undef _FILE_OFFSET_BITS
1134 #include <sys/sendfile.h>
1138 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1140 '_HAVE_BROKEN_LINUX_SENDFILE',
1141 msg='Checking for broken linux sendfile support')
1142 if conf.CONFIG_SET('_HAVE_SENDFILE'):
1143 conf.DEFINE('HAVE_SENDFILE', '1')
1144 conf.DEFINE('LINUX_SENDFILE_API', '1')
1145 conf.DEFINE('WITH_SENDFILE', '1')
1146 elif conf.CONFIG_SET('_HAVE_BROKEN_LINUX_SENDFILE'):
1147 conf.DEFINE('LINUX_BROKEN_SENDFILE_API', '1')
1148 conf.DEFINE('WITH_SENDFILE', '1')
1149 elif (host_os.rfind('freebsd') > -1) or (host_os.rfind('dragonfly') > -1):
1151 #include <sys/types.h>
1153 #include <sys/socket.h>
1154 #include <sys/uio.h>
1155 int fromfd, tofd, ret, total=0;
1156 off_t offset, nwritten;
1159 hdr.headers = &hdtrl;
1161 hdr.trailers = NULL;
1163 hdtrl.iov_base = NULL;
1165 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0)
1168 msg='Checking for freebsd sendfile support')
1169 if conf.CONFIG_SET('_HAVE_SENDFILE'):
1170 conf.DEFINE('HAVE_SENDFILE', '1')
1171 conf.DEFINE('FREEBSD_SENDFILE_API', '1')
1172 conf.DEFINE('WITH_SENDFILE', '1')
1173 elif (host_os.rfind('hpux') > -1):
1175 #include <sys/socket.h>
1176 #include <sys/uio.h>
1179 struct iovec hdtrl[2];
1182 hdtrl[0].iov_base = 0;
1183 hdtrl[0].iov_len = 0;
1184 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
1187 msg='Checking for hpux sendfile support')
1188 if conf.CONFIG_SET('_HAVE_SENDFILE'):
1189 conf.DEFINE('HAVE_SENDFILE', '1')
1190 conf.DEFINE('HPUX_SENDFILE_API', '1')
1191 conf.DEFINE('WITH_SENDFILE', '1')
1192 elif (host_os.rfind('solaris') > -1):
1193 conf.CHECK_FUNCS_IN('sendfile', 'sendfilev')
1195 #include <sys/sendfile.h>,
1198 struct sendfilevec vec[2];
1202 vec[0].sfv_fd = SFV_FD_SELF;
1203 vec[0].sfv_flag = 0;
1207 vec[1].sfv_flag = 0;
1210 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
1213 msg='Checking for solaris sendfilev support')
1214 if conf.CONFIG_SET('_HAVE_SENDFILEV'):
1215 conf.DEFINE('HAVE_SENDFILEV', '1')
1216 conf.DEFINE('SOLARIS_SENDFILE_API', '1')
1217 conf.DEFINE('WITH_SENDFILE', '1')
1218 elif (host_os.rfind('aix') > -1):
1220 #include <sys/socket.h>
1223 struct sf_parms hdtrl;
1225 hdtrl.header_data = 0;
1226 hdtrl.header_length = 0;
1227 hdtrl.file_descriptor = fromfd;
1228 hdtrl.file_offset = 0;
1229 hdtrl.file_bytes = 0;
1230 hdtrl.trailer_data = 0;
1231 hdtrl.trailer_length = 0;
1232 nwritten = send_file(&tofd, &hdtrl, 0);
1235 msg='Checking for AIX send_file support')
1236 if conf.CONFIG_SET('_HAVE_SENDFILE'):
1237 conf.DEFINE('HAVE_SENDFILE', '1')
1238 conf.DEFINE('AIX_SENDFILE_API', '1')
1239 conf.DEFINE('WITH_SENDFILE', '1')
1241 # Check for getcwd allowing a NULL arg.
1245 char *s = getcwd(NULL,0);
1246 exit(s != NULL ? 0 : 1);
1247 }''', 'GETCWD_TAKES_NULL', addmain=False, execute=True,
1248 msg="getcwd takes a NULL argument")
1251 # UnixWare 7.x has its getspnam in -lgen
1252 conf.CHECK_FUNCS_IN('getspnam', 'gen')
1253 conf.CHECK_FUNCS_IN('getspnam', 'security')
1254 conf.CHECK_FUNCS_IN('getspnam', 'sec')
1256 if Options.options.with_quotas:
1257 # For quotas on Veritas VxFS filesystems
1258 conf.CHECK_HEADERS('sys/fs/vx_quota.h')
1259 # For quotas on Linux XFS filesystems
1260 conf.CHECK_HEADERS('linux/dqblk_xfs.h')
1261 # For sys/quota.h and linux/quota.h
1262 conf.CHECK_HEADERS('sys/quota.h')
1266 # checking for clustering extensions (CTDB)
1268 if not Options.options.with_cluster_support:
1269 have_cluster_support = False
1273 if Options.options.ctdb_dir:
1274 conf.ADD_EXTRA_INCLUDES(Options.options.ctdb_dir + '/include')
1276 srcdir = os.path.realpath(conf.srcdir)
1277 if 'EXTRA_INCLUDES' in conf.env:
1278 includes = ' '.join(conf.env['EXTRA_INCLUDES']).replace('#', srcdir + '/')
1282 have_cluster_support = True
1287 #include "replace.h"
1288 #include "system/wait.h"
1289 #include "system/network.h"
1290 #define private #error __USED_RESERVED_WORD_private__
1303 msg='Checking for header ctdb.h')
1305 if not conf.CONFIG_SET('HAVE_CTDB_H'):
1306 have_cluster_support = False
1307 ctdb_broken = "ctdb.h is required for cluster support"
1309 if have_cluster_support:
1312 #include "replace.h"
1313 #include "system/wait.h"
1314 #include "system/network.h"
1315 #define private #error __USED_RESERVED_WORD_private__
1319 #include <ctdb_private.h>
1326 'HAVE_CTDB_PRIVATE_H',
1329 msg='Checking for header ctdb_private.h')
1331 if not conf.CONFIG_SET('HAVE_CTDB_PRIVATE_H'):
1332 have_cluster_support = False
1333 ctdb_broken = "ctdb_private.h is required for cluster support"
1335 if have_cluster_support:
1338 #include "replace.h"
1339 #include "system/wait.h"
1340 #include "system/network.h"
1344 #include <ctdb_private.h>
1348 int i = (int)CTDB_CONTROL_TRANS3_COMMIT;
1352 'HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL',
1355 msg='Checking for transaction support (TRANS3_COMMIT control)')
1357 if not conf.CONFIG_SET('HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL'):
1358 have_cluster_support = False
1359 ctdb_broken = "ctdb transaction support missing or too old"
1361 if have_cluster_support:
1364 #include "replace.h"
1365 #include "system/wait.h"
1366 #include "system/network.h"
1370 #include <ctdb_private.h>
1374 int i = (int)CTDB_CONTROL_SCHEDULE_FOR_DELETION;
1378 'HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL',
1381 msg='Checking for SCHEDULE_FOR_DELETION control')
1383 if not conf.CONFIG_SET('HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL'):
1384 if not Options.options.enable_old_ctdb:
1385 have_cluster_support = False
1386 ctdb_broken = "SCHEDULE_FOR_DELETION control missing"
1388 Logs.warn("ignoring missing SCHEDULE_FOR_DELETION control (--enable-old-ctdb)")
1390 if have_cluster_support:
1393 #include "replace.h"
1394 #include "system/wait.h"
1395 #include "system/network.h"
1399 #include <ctdb_private.h>
1403 struct ctdb_control_tcp _x;
1407 'HAVE_STRUCT_CTDB_CONTROL_TCP',
1410 msg='Checking for ctdb ipv4 support')
1412 if not conf.CONFIG_SET('HAVE_STRUCT_CTDB_CONTROL_TCP'):
1413 have_cluster_support = False
1414 ctdb_broken = "missing struct ctdb_control_tcp"
1416 if have_cluster_support:
1419 #include "replace.h"
1420 #include "system/wait.h"
1421 #include "system/network.h"
1425 #include <ctdb_private.h>
1429 struct ctdb_control_tcp_addr _x;
1433 'HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR',
1436 msg='Checking for ctdb ipv6 support')
1438 if have_cluster_support:
1441 #include "replace.h"
1442 #include "system/wait.h"
1443 #include "system/network.h"
1447 #include <ctdb_private.h>
1451 int i = (int)CTDB_CONTROL_CHECK_SRVIDS;
1455 'HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL',
1458 msg='Checking for CHECK_SRVIDS control')
1460 if not conf.CONFIG_SET('HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL'):
1461 if not Options.options.enable_old_ctdb:
1462 have_cluster_support = False
1463 ctdb_broken = "CHECK_SRVIDS control missing"
1465 Logs.warn("ignoring missing CHECK_SRVIDS control (--enable-old-ctdb)")
1467 if have_cluster_support:
1468 Logs.info("building with cluster support")
1469 conf.DEFINE('CLUSTER_SUPPORT', 1);
1471 if not Options.options.with_cluster_support:
1472 Logs.info("building without cluster support")
1474 Logs.warn("building without cluster support: " + ctdb_broken)
1475 conf.undefine('CLUSTER_SUPPORT')
1479 conf.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }',
1480 'HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR',
1483 msg='Checking whether we can compile with __attribute__((destructor))')
1485 conf.CHECK_CODE('void seekdir(DIR *d, long loc) { return; }',
1486 'SEEKDIR_RETURNS_VOID',
1487 headers='sys/types.h dirent.h',
1488 msg='Checking whether seekdir returns void')
1490 if Options.options.with_profiling_data:
1491 conf.DEFINE('WITH_PROFILE', 1);
1493 PTHREAD_CFLAGS='error'
1494 PTHREAD_LDFLAGS='error'
1496 if PTHREAD_LDFLAGS == 'error':
1497 if conf.CHECK_FUNCS_IN('pthread_attr_init', 'pthread'):
1498 PTHREAD_CFLAGS='-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS'
1499 PTHREAD_LDFLAGS='-lpthread'
1500 if PTHREAD_LDFLAGS == 'error':
1501 if conf.CHECK_FUNCS_IN('pthread_attr_init', 'pthreads'):
1502 PTHREAD_CFLAGS='-D_THREAD_SAFE'
1503 PTHREAD_LDFLAGS='-lpthreads'
1504 if PTHREAD_LDFLAGS == 'error':
1505 if conf.CHECK_FUNCS_IN('pthread_attr_init', 'c_r'):
1506 PTHREAD_CFLAGS='-D_THREAD_SAFE -pthread'
1507 PTHREAD_LDFLAGS='-pthread'
1508 if PTHREAD_LDFLAGS == 'error':
1509 if conf.CHECK_FUNC('pthread_attr_init'):
1510 PTHREAD_CFLAGS='-D_REENTRANT'
1511 PTHREAD_LDFLAGS='-lpthread'
1512 # especially for HP-UX, where the CHECK_FUNC macro fails to test for
1513 # pthread_attr_init. On pthread_mutex_lock it works there...
1514 if PTHREAD_LDFLAGS == 'error':
1515 if conf.CHECK_FUNCS_IN('pthread_mutex_lock', 'pthread'):
1516 PTHREAD_CFLAGS='-D_REENTRANT'
1517 PTHREAD_LDFLAGS='-lpthread'
1519 if PTHREAD_CFLAGS != 'error' and PTHREAD_LDFLAGS != 'error':
1520 conf.ADD_CFLAGS(PTHREAD_CFLAGS)
1521 conf.ADD_LDFLAGS(PTHREAD_LDFLAGS)
1522 conf.CHECK_HEADERS('pthread.h')
1523 conf.DEFINE('HAVE_PTHREAD', '1')
1525 if Options.options.with_pthreadpool:
1526 if conf.CONFIG_SET('HAVE_PTHREAD'):
1527 conf.DEFINE('WITH_PTHREADPOOL', '1')
1529 Logs.warn("pthreadpool support cannot be enabled when pthread support was not found")
1530 conf.undefine('WITH_PTHREADPOOL')
1532 if conf.CHECK_HEADERS('gpfs_gpl.h'):
1533 conf.DEFINE('HAVE_GPFS', '1')
1535 # Note that all charset 'modules' must actually be static, due to dependency loop issues
1536 # if we include the module loader in iconv
1538 default_static_modules=TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
1539 auth_sam auth_unix auth_winbind auth_wbc auth_server
1540 auth_domain auth_builtin vfs_default
1541 nss_info_template idmap_tdb idmap_passdb
1544 default_shared_modules=TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
1545 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
1546 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2
1547 auth_script vfs_readahead vfs_xattr_tdb vfs_posix_eadb
1548 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
1549 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
1550 vfs_crossrename vfs_linux_xfs_sgid
1551 vfs_time_audit idmap_autorid''')
1553 if Options.options.developer:
1554 default_static_modules.extend(TO_LIST('pdb_ads auth_netlogond charset_weird'))
1555 default_shared_modules.extend(TO_LIST('perfcount_test'))
1556 default_shared_modules.extend(TO_LIST('vfs_skel_opaque vfs_skel_transparent vfs_shadow_copy_test'))
1557 default_shared_modules.extend(TO_LIST('auth_skel pdb_test'))
1559 default_static_modules.extend(TO_LIST('pdb_samba4 auth_samba4 vfs_dfs_samba4'))
1561 if Options.options.with_acl_support and conf.CONFIG_SET('HAVE_POSIX_ACLS'):
1562 default_static_modules.extend(TO_LIST('vfs_posixacl'))
1564 if conf.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'):
1565 default_shared_modules.extend(TO_LIST('vfs_zfsacl'))
1567 if conf.CONFIG_SET('HAVE_DIRFD_DECL'):
1568 default_shared_modules.extend(TO_LIST('vfs_syncops vfs_dirsort'))
1570 if conf.CONFIG_SET('HAVE_STATFS_F_FSID'):
1571 default_shared_modules.extend(TO_LIST('vfs_fileid'))
1573 if conf.CONFIG_SET('HAVE_AIO') and (conf.CONFIG_SET('HAVE_MSGHDR_MSG_CONTROL') or conf.CONFIG_SET('HAVE_MSGHDR_MSG_ACCTRIGHTS')):
1574 default_shared_modules.extend(TO_LIST('vfs_aio_fork'))
1576 if conf.CONFIG_SET('HAVE_AIO') and Options.options.with_pthreadpool:
1577 default_shared_modules.extend(TO_LIST('vfs_aio_pthread'))
1579 if conf.CONFIG_SET('HAVE_LDAP'):
1580 default_static_modules.extend(TO_LIST('pdb_ldap idmap_ldap'))
1582 if conf.CONFIG_SET('DARWINOS'):
1583 default_static_modules.extend(TO_LIST('charset_macosxfs'))
1585 if conf.CONFIG_SET('HAVE_GPFS'):
1586 default_shared_modules.extend(TO_LIST('vfs_gpfs vfs_gpfs_hsm_notify'))
1588 explicit_shared_modules = TO_LIST(Options.options.shared_modules, delimiter=',')
1589 explicit_static_modules = TO_LIST(Options.options.static_modules, delimiter=',')
1591 final_static_modules = default_static_modules
1592 final_shared_modules = default_shared_modules
1594 for m in explicit_static_modules:
1595 if m in final_shared_modules:
1596 final_shared_modules.remove(m)
1597 final_static_modules.append(m)
1598 for m in explicit_shared_modules:
1599 if m in final_static_modules:
1600 final_static_modules.remove(m)
1601 final_shared_modules.append(m)
1603 conf.env['static_modules'] = final_static_modules
1604 conf.env['shared_modules'] = final_shared_modules
1606 conf.DEFINE('STRING_STATIC_MODULES', ' '.join(final_static_modules), quote=True)
1611 prefixes = ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
1612 conf.env['MODULE_PREFIXES'] = prefixes
1614 for m in final_static_modules:
1616 if not p in static_list:
1618 static_list[p].append(m)
1619 for m in final_shared_modules:
1621 if not p in shared_list:
1623 shared_list[p].append(m)
1626 static_env = "%s_STATIC" % p.upper()
1627 shared_env = "%s_SHARED" % p.upper()
1628 conf.env[static_env] = []
1629 conf.env[shared_env] = []
1630 if p in static_list:
1632 for entry in static_list[p]:
1633 decl_list += "extern NTSTATUS %s_init(void); " % entry
1634 conf.env[static_env].append('%s' % entry)
1635 decl_list = decl_list.rstrip()
1636 conf.DEFINE('static_decl_%s' % p, decl_list)
1637 conf.DEFINE('static_init_%s' % p, '{ %s_init(); }' % '_init(); '.join(static_list[p]))
1639 conf.DEFINE('static_decl_%s' % p, '')
1640 conf.DEFINE('static_init_%s' % p, '{}')
1641 if p in shared_list:
1642 for entry in shared_list[p]:
1643 conf.DEFINE('%s_init' % entry, 'samba_init_module')
1644 conf.env[shared_env].append('%s' % entry)
1646 conf.SAMBA_CONFIG_H('include/config.h')
1649 "build 'tags' file using ctags"
1651 source_root = os.path.dirname(Utils.g_module.root_path)
1652 cmd = 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
1653 print("Running: %s" % cmd)