Introduce system MIT krb5 build with --with-system-mitkrb5 option.
[Samba.git] / source3 / wscript
blob0b36b22e61039ef4f05bcddf436daae4cc5a48cf
1 #! /usr/bin/env python
3 srcdir=".."
5 import sys, os
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
10 import build.charset
11 import samba_utils, samba_version
12 import samba3
14 Options.default_prefix = '/usr/local/samba'
16 def set_options(opt):
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('ldap')
32 opt.SAMBA3_ADD_OPTION('cups', with_name="enable", without_name="disable")
33 opt.SAMBA3_ADD_OPTION('iprint', with_name="enable", without_name="disable")
34 opt.SAMBA3_ADD_OPTION('pam')
35 opt.SAMBA3_ADD_OPTION('pam_smbpass')
36 opt.SAMBA3_ADD_OPTION('quotas')
37 opt.SAMBA3_ADD_OPTION('sys-quotas')
38 opt.SAMBA3_ADD_OPTION('sendfile-support')
39 opt.SAMBA3_ADD_OPTION('utmp')
40 opt.SAMBA3_ADD_OPTION('pthreadpool', with_name="enable", without_name="disable")
41 opt.SAMBA3_ADD_OPTION('avahi', with_name="enable", without_name="disable")
42 opt.SAMBA3_ADD_OPTION('iconv')
43 opt.SAMBA3_ADD_OPTION('acl-support')
44 opt.SAMBA3_ADD_OPTION('dnsupdate')
45 opt.SAMBA3_ADD_OPTION('syslog')
46 opt.SAMBA3_ADD_OPTION('automount')
47 opt.SAMBA3_ADD_OPTION('aio-support')
48 opt.SAMBA3_ADD_OPTION('profiling-data', default=False)
50 opt.SAMBA3_ADD_OPTION('cluster-support')
52 opt.add_option('--with-ctdb-dir',
53 help=("Directory under which ctdb is installed"),
54 action="store", dest='ctdb_dir', default=None)
55 opt.add_option('--enable-old-ctdb',
56 help=("enable building against (too) old version of ctdb (default=false)"),
57 action="store_true", dest='enable_old_ctdb', default=False)
61 def configure(conf):
62 from samba_utils import TO_LIST
64 if Options.options.developer:
65 conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
66 conf.env.developer = True
68 if Options.options.with_swat:
69 conf.env['build_swat'] = True
71 if sys.platform != 'openbsd5':
72 conf.ADD_LDFLAGS("-Wl,--export-dynamic", testflags=True)
74 conf.CHECK_HEADERS('execinfo.h libexc.h libunwind.h netdb.h')
75 conf.CHECK_HEADERS('linux/falloc.h')
77 conf.CHECK_FUNCS('getcwd fchown chmod fchmod mknod')
78 conf.CHECK_FUNCS('strtol strchr strupr chflags')
79 conf.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
80 conf.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
81 conf.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr')
82 conf.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
83 conf.CHECK_FUNCS('setpriv setgidx setuidx setgroups sysconf')
84 conf.CHECK_FUNCS('atexit grantpt fallocate posix_fallocate')
85 conf.CHECK_FUNCS('fseeko setluid')
86 conf.CHECK_FUNCS('getpwnam', headers='sys/types.h pwd.h')
87 conf.CHECK_FUNCS('fdopendir')
88 conf.CHECK_FUNCS('getpwent_r setenv strcasecmp fcvt fcvtl')
89 conf.CHECK_FUNCS('syslog vsyslog timegm setlocale')
90 conf.CHECK_FUNCS_IN('nanosleep', 'rt')
91 conf.CHECK_FUNCS('lutimes futimes utimensat futimens')
92 conf.CHECK_FUNCS('mlock munlock mlockall munlockall')
93 conf.CHECK_FUNCS('memalign posix_memalign hstrerror')
94 conf.CHECK_FUNCS('shmget')
95 conf.CHECK_FUNCS_IN('shm_open', 'rt', checklibc=True)
96 conf.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain bind_textdomain_codeset')
97 #FIXME: for some reason this one still fails
98 conf.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
99 conf.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
100 conf.CHECK_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)
108 #include <unistd.h>
109 #endif
110 long ret = splice(0,0,1,0,400,0);
111 ''',
112 'HAVE_LINUX_SPLICE',
113 headers='fcntl.h'):
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
122 conf.CHECK_CODE('''
123 #ifndef F_NOTIFY
124 #define F_NOTIFY 1026
125 #endif
126 main() {
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
133 conf.CHECK_CODE('''
134 #include <sys/types.h>
135 #include <fcntl.h>
136 #include <signal.h>
137 #ifndef F_NOTIFY
138 #define F_NOTIFY 1026
139 #endif
140 main() {
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
151 conf.CHECK_CODE('''
152 #include <sys/types.h>
153 #include <fcntl.h>
154 #include <signal.h>
155 #include <sys/file.h>
156 #ifndef LOCK_MAND
157 #define LOCK_MAND 32
158 #define LOCK_READ 64
159 #endif
160 main() {
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:
174 conf.CHECK_CODE('''
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:
181 conf.CHECK_CODE('''
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:
191 conf.CHECK_CODE('''
192 cap_t cap;
193 cap_value_t vals[1];
194 if (!(cap = cap_get_proc())) exit(1);
195 vals[0] = CAP_CHOWN;
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.
204 # -- JRA.
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
223 conf.CHECK_CODE('''
224 if (0) {
225 this_function_does_not_exist();
226 } else {
227 return 1;
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
232 # AIX needs this
233 conf.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL',
234 headers='stdio.h',
235 msg="Checking for LL suffix on long long integers")
237 conf.CHECK_FUNCS('''
238 _acl __acl add_proplist_entry atexit attr_getf attr_list attr_listf
239 attropen attr_remove attr_removef attr_set attr_setf
240 bindtextdomain _chdir __chdir chflags chmod _close __close _closedir
241 __closedir crypt16 delproplist devnm dgettext dirfd
242 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
243 extattr_delete_fd extattr_get_fd extattr_get_file
244 extattr_list_fd extattr_list_file
245 extattr_set_fd extattr_set_file _facl __facl _fchdir
246 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
247 fdelproplist fgetea fgetproplist fgetxattr flistea flistxattr
248 _fork __fork fremoveea fremovexattr fseeko fsetea
249 fsetproplist fsetxattr _fstat __fstat fsync
250 futimens futimes __fxstat getauthuid
251 getcwd _getcwd __getcwd getdents __getdents getdirentries
252 getgrent getgrnam getgrouplist getgrset getmntent getpagesize
253 getproplist get_proplist_entry getpwanam getpwent_r getrlimit gettext
254 glob grantpt hstrerror initgroups innetgr
255 listea listxattr
256 llseek _llseek __llseek _lseek __lseek
257 _lstat __lstat lutimes
258 __lxstat memalign mknod mlock mlockall munlock munlockall
259 _open __open _opendir __opendir
260 pathconf poll posix_fallocate
261 posix_memalign prctl pread _pread __pread
262 pwrite _pwrite __pwrite
263 rdchk _read __read _readdir __readdir
264 removeea removexattr _seekdir __seekdir
265 select setea setenv setgidx setgroups setlocale setluid
266 setmntent setpgid setpriv setproplist setsid setuidx
267 setxattr shmget shm_open sigaction sigblock sigprocmask sigset
268 sizeof_proplist_entry _stat __stat statvfs
269 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctl sysctlbyname
270 __sys_llseek syslog _telldir __telldir textdomain timegm
271 utimensat vsyslog _write __write __xstat
272 ''')
274 conf.CHECK_SAMBA3_CHARSET() # see build/charset.py
276 # FIXME: these should be tests for features, but the old build system just
277 # checks for OSes.
278 host_os = sys.platform
279 Logs.info("building on %s" % host_os)
281 # Python doesn't have case switches... :/
282 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
283 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
285 conf.SET_TARGET_TYPE('sunacl', 'EMPTY')
286 if (host_os.rfind('linux') > -1) or (host_os.rfind('gnu') > -1) or (host_os.rfind('qnx') > -1):
287 if host_os.rfind('linux') > -1:
288 conf.DEFINE('LINUX', '1')
289 elif host_os.rfind('qnx') > -1:
290 conf.DEFINE('QNX', '1')
291 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
292 elif (host_os.rfind('darwin') > -1):
293 conf.DEFINE('DARWINOS', 1)
294 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
295 conf.ADD_CFLAGS('-fno-common')
296 elif (host_os.rfind('freebsd') > -1):
297 if conf.CHECK_HEADERS('sunacl.h'):
298 conf.DEFINE('HAVE_FREEBSD_SUNACL_H', '1')
299 conf.CHECK_FUNCS_IN('acl', 'sunacl')
300 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
301 elif (host_os.rfind('netbsd') > -1):
302 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
303 elif (host_os.rfind('openbsd') > -1):
304 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
305 elif (host_os.rfind('sunos') > -1):
306 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
307 # FIXME: Add more checks here.
308 else:
309 Logs.warn("Unknown host_os '%s', please report this to samba-technical@samba.org" % host_os)
311 #FIXME: add more checks
312 if Options.options.with_acl_support:
313 if host_os.rfind('linux') > -1:
314 conf.CHECK_FUNCS_IN('acl_get_file', 'acl')
315 conf.CHECK_FUNCS_IN('getxattr', 'attr')
316 if conf.CHECK_CODE('''
317 acl_t acl;
318 int entry_id;
319 acl_entry_t *entry_p;
320 return acl_get_entry(acl, entry_id, entry_p);
321 ''',
322 'HAVE_POSIX_ACLS',
323 headers='sys/types.h sys/acl.h', link=False,
324 msg="Checking for POSIX ACL support") :
325 conf.CHECK_CODE('''
326 acl_permset_t permset_d;
327 acl_perm_t perm;
328 return acl_get_perm_np(permset_d, perm);
329 ''',
330 'HAVE_ACL_GET_PERM_NP',
331 headers='sys/types.h sys/acl.h', link=True,
332 msg="Checking whether acl_get_perm_np() is available")
333 else:
334 conf.DEFINE('HAVE_NO_ACLS', 1)
335 conf.SET_TARGET_TYPE('acl', 'EMPTY')
336 else:
337 conf.DEFINE('HAVE_NO_ACLS', 1)
338 conf.SET_TARGET_TYPE('acl', 'EMPTY')
340 if conf.CHECK_FUNCS('dirfd'):
341 conf.DEFINE('HAVE_DIRFD_DECL', 1)
343 conf.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
344 'HAVE_STATFS_F_FSID',
345 msg="vfs_fileid: checking for statfs() and struct statfs.f_fsid",
346 headers='sys/types.h sys/statfs.h',
347 execute=True)
349 if conf.CONFIG_SET('HAVE_FALLOCATE'):
350 conf.CHECK_CODE('''
351 int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
352 'HAVE_LINUX_FALLOCATE',
353 msg="Checking whether the Linux 'fallocate' function is available",
354 headers='unistd.h sys/types.h fcntl.h linux/falloc.h')
355 conf.CHECK_CODE('''
356 ssize_t err = readahead(0,0,0x80000);''',
357 'HAVE_LINUX_READAHEAD',
358 msg="Checking whether Linux readahead is available",
359 headers='unistd.h fcntl.h')
360 conf.CHECK_DECLS('readahead', headers='fcntl.h', always=True)
362 if Options.options.with_aio_support:
363 conf.CHECK_FUNCS_IN('aio_read', 'aio')
364 conf.CHECK_FUNCS_IN('aio_read', 'rt')
365 conf.CHECK_CODE('struct aiocb a; return aio_read(&a);',
366 'HAVE_AIO',
367 msg='Checking for asynchronous io support',
368 headers='sys/types.h aio.h',
369 lib='aio rt')
370 if conf.CONFIG_SET('HAVE_AIO'):
371 conf.DEFINE('WITH_AIO', '1')
372 if conf.CONFIG_SET('HAVE_AIO'):
373 conf.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg='Checking for aio_read', headers='aio.h', lib='aio rt')
374 conf.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg='Checking for aio_write', headers='aio.h', lib='aio rt')
375 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')
376 conf.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg='Checking for aio_return', headers='aio.h', lib='aio rt')
377 conf.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg='Checking for aio_error', headers='aio.h', lib='aio rt')
378 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')
379 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')
380 if host_os.rfind('linux') > -1:
381 conf.CHECK_FUNCS_IN('io_submit', 'aio')
382 conf.CHECK_CODE('''
383 struct io_event ioev;
384 struct iocb *ioc;
385 io_context_t ctx;
386 struct timespec ts;
387 int fd;
388 char *buf;
389 fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
390 io_queue_init(128,&ctx);
391 io_prep_pwrite(ioc, 1, buf, 1, 0);
392 io_prep_pread(ioc, 1, buf, 1, 0);
393 io_set_eventfd(ioc, fd);
394 io_set_callback(ioc, (io_callback_t)(0));
395 io_submit(ctx, 1, &ioc);
396 io_getevents(ctx, 1, 1, &ioev, &ts);
397 ''',
398 'HAVE_LINUX_KERNEL_AIO',
399 msg='Checking for linux kernel asynchronous io support',
400 headers='unistd.h stdlib.h sys/types.h fcntl.h sys/eventfd.h libaio.h',
401 lib='aio')
403 if not conf.CONFIG_SET('HAVE_AIO'):
404 conf.DEFINE('HAVE_NO_AIO', '1')
405 else:
406 conf.DEFINE('HAVE_NO_AIO', '1')
408 conf.CHECK_CODE('''
409 struct msghdr msg;
410 union {
411 struct cmsghdr cm;
412 char control[CMSG_SPACE(sizeof(int))];
413 } control_un;
414 msg.msg_control = control_un.control;
415 msg.msg_controllen = sizeof(control_un.control);
416 ''',
417 'HAVE_MSGHDR_MSG_CONTROL',
418 msg='Checking if we can use msg_control for passing file descriptors',
419 headers='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
420 conf.CHECK_CODE('''
421 struct msghdr msg;
422 int fd;
423 msg.msg_acctrights = (caddr_t) &fd;
424 msg.msg_acctrightslen = sizeof(fd);
425 ''',
426 'HAVE_MSGHDR_MSG_ACCTRIGHTS',
427 msg='Checking if we can use msg_acctrights for passing file descriptors',
428 headers='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
430 if Options.options.with_winbind:
431 conf.env.build_winbind = True
432 conf.DEFINE('WITH_WINBIND', '1')
434 conf.find_program('awk', var='AWK')
435 conf.find_program('perl', var='PERL')
437 # Darwin has extra options to xattr-family functions
438 conf.CHECK_CODE('getxattr(0, 0, 0, 0, 0, 0);',
439 'XATTR_ADD_OPT',
440 msg="Checking whether xattr interface takes additional options",
441 headers='sys/types.h attr/xattr.h sys/xattr.h')
443 conf.CHECK_HEADERS('asm/types.h')
445 conf.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
446 headers='unistd.h sys/types.h',
447 msg="Checking for major macro")
449 conf.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
450 headers='unistd.h sys/types.h',
451 msg="Checking for minor macro")
453 conf.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
454 headers='unistd.h sys/types.h dirent.h',
455 define='HAVE_DIRENT_D_OFF')
457 conf.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent')
458 if conf.CHECK_CFLAGS('-Werror-implicit-function-declaration'):
459 netgrent_cflags = '-Werror-implicit-function-declaration'
460 else:
461 netgrent_cflags = ''
462 conf.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE',
463 msg="Checking for setnetgrent prototype",
464 headers='netdb.h netgroup.h',
465 cflags=netgrent_cflags)
466 conf.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE',
467 msg="Checking for getnetgrent prototype",
468 headers='netdb.h netgroup.h',
469 cflags=netgrent_cflags)
470 conf.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE',
471 msg="Checking for endnetgrent prototype",
472 headers='netdb.h netgroup.h',
473 cflags=netgrent_cflags)
476 # Look for CUPS
477 if Options.options.with_cups:
478 conf.find_program('cups-config', var='CUPS_CONFIG')
479 if conf.env.CUPS_CONFIG:
480 # we would normally use --libs here, but cups-config incorrectly adds
481 # gssapi_krb5 and other libraries to its --libs output. That breaks the use
482 # of an in-tree heimdal kerberos
483 conf.check_cfg(path=conf.env.CUPS_CONFIG, args="--cflags --ldflags",
484 package="", uselib_store="CUPS")
485 conf.CHECK_HEADERS('cups/cups.h cups/language.h', lib='cups')
486 conf.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups')
487 if conf.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
488 conf.DEFINE('HAVE_CUPS', '1')
489 else:
490 conf.undefine('HAVE_CUPS')
491 conf.SET_TARGET_TYPE('cups', 'EMPTY')
492 else:
493 # define an empty subsystem for cups, to allow it to be used as an empty dependency
494 conf.SET_TARGET_TYPE('cups', 'EMPTY')
496 if Options.options.with_iprint:
497 if conf.CONFIG_SET('HAVE_CUPS'):
498 conf.DEFINE('HAVE_IPRINT', '1')
499 else:
500 Logs.warn("--enable-iprint=yes but cups support not sufficient")
501 if Options.options.with_syslog:
502 conf.DEFINE('WITH_SYSLOG', '1')
503 if Options.options.with_automount:
504 conf.DEFINE('WITH_AUTOMOUNT', '1')
506 # Check for LDAP
507 if Options.options.with_ldap:
508 conf.CHECK_HEADERS('ldap.h lber.h ldap_pvt.h')
509 conf.CHECK_TYPE('ber_tag_t', 'unsigned int', headers='ldap.h lber.h')
510 conf.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
511 conf.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers='ldap.h')
513 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
514 # for the samba logs
515 conf.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
516 define='HAVE_LBER_LOG_PRINT_FN', headers='lber.h')
518 conf.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', 'ldap')
519 conf.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
521 # Check if ldap_set_rebind_proc() takes three arguments
522 if conf.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
523 'LDAP_SET_REBIND_PROC_ARGS',
524 msg="Checking whether ldap_set_rebind_proc takes 3 arguments",
525 headers='ldap.h lber.h', link=False):
526 conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
527 else:
528 conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
530 # last but not least, if ldap_init() exists, we want to use ldap
531 if conf.CONFIG_SET('HAVE_LDAP_INIT'):
532 conf.DEFINE('HAVE_LDAP', '1')
533 conf.DEFINE('LDAP_DEPRECATED', '1')
534 conf.env['HAVE_LDAP'] = '1'
535 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
536 # SASL wrapping hooks
537 if conf.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
538 conf.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
539 conf.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
540 else:
541 conf.SET_TARGET_TYPE('ldap', 'EMPTY')
542 conf.SET_TARGET_TYPE('lber', 'EMPTY')
544 if Options.options.with_ads:
545 use_ads=True
546 if not conf.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and \
547 not conf.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC'):
548 Logs.warn("arcfour-hmac-md5 encryption type not found in -lkrb5")
549 use_ads=False
550 if not conf.CONFIG_SET('HAVE_KRB5_MK_REQ_EXTENDED'):
551 Logs.warn("krb5_mk_req_extended not found in -lkrb5")
552 use_ads=False
553 if not conf.CONFIG_SET('HAVE_KRB5_GET_HOST_REALM'):
554 Logs.warn("krb5_get_host_realm not found in -lkrb5")
555 use_ads=False
556 if not conf.CONFIG_SET('HAVE_KRB5_FREE_HOST_REALM'):
557 Logs.warn("krb5_free_host_realm not found in -lkrb5")
558 use_ads=False
559 if not conf.CONFIG_SET('HAVE_KRB5_FWD_TGT_CREDS'):
560 Logs.warn("krb5_fwd_tgt_creds found in -lkrb5")
561 use_ads=False
562 if not conf.CONFIG_SET('HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC'):
563 Logs.warn("krb5_get_init_creds_opt_alloc not found in -lkrb5")
564 use_ads=False
565 if not conf.CONFIG_SET('KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT'):
566 Logs.warn("krb5_get_init_creds_opt_free was not found or was too old in -lkrb5")
567 use_ads=False
568 if not conf.CONFIG_SET('HAVE_KRB5_GET_RENEWED_CREDS'):
569 Logs.warn("krb5_get_renewed_creds not found in -lkrb5")
570 use_ads=False
571 if not conf.CONFIG_SET('HAVE_KRB5_PRINCIPAL_COMPARE_ANY_REALM'):
572 Logs.warn("krb5_principal_compare_any_realm not found in -lkrb5")
573 use_ads=False
574 if not conf.CONFIG_SET('HAVE_KRB5_C_STRING_TO_KEY') and \
575 not conf.CONFIG_SET('HAVE_KRB5_STRING_TO_KEY_SALT'):
576 Logs.warn("krb5_c_string_to_key not found in -lkrb5")
577 use_ads=False
578 if not conf.CONFIG_SET('HAVE_KRB5_PRINCIPAL2SALT') and \
579 not conf.CONFIG_SET('HAVE_KRB5_GET_PW_SALT'):
580 Logs.warn("no CREATE_KEY_FUNCTIONS detected")
581 use_ads=False
582 if not conf.CONFIG_SET('HAVE_KRB5_GET_PERMITTED_ENCTYPES') and \
583 not conf.CONFIG_SET('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES'):
584 Logs.warn("no GET_ENCTYPES_FUNCTIONS detected")
585 use_ads=False
586 if not conf.CONFIG_SET('HAVE_KRB5_KT_FREE_ENTRY') and \
587 not conf.CONFIG_SET('HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS'):
588 Logs.warn("no KT_FREE_FUNCTION detected")
589 use_ads=False
590 if not conf.CONFIG_SET('HAVE_KRB5_C_VERIFY_CHECKSUM'):
591 Logs.warn("krb5_c_verify_checksum_compare not found in -lkrb5")
592 use_ads=False
594 # We don't actually use
595 # gsskrb5_extract_authz_data_from_sec_context, but it is a
596 # clue that this Heimdal, which does the PAC processing we
597 # need on the standard gss_inquire_sec_context_by_oid
598 if not conf.CONFIG_SET('HAVE_GSS_GET_NAME_ATTRIBUTE') and \
599 not (conf.CONFIG_SET('HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT') and \
600 conf.CONFIG_SET('HAVE_GSS_INQUIRE_SEC_CONTEXT_BY_OID')):
601 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")
602 use_ads=False
604 if not conf.CONFIG_SET('HAVE_GSS_KRB5_EXPORT_LUCID_SEC_CONTEXT'):
605 Logs.warn("need gss_krb5_export_lucid_sec_context for SPNEGO and gss_wrap support")
606 use_ads=False
608 if use_ads:
609 conf.DEFINE('WITH_ADS', '1')
610 conf.DEFINE('HAVE_KRB5', '1')
611 if conf.CONFIG_SET('HAVE_LDAP'):
612 conf.env['HAVE_ADS'] = '1'
613 else:
614 Logs.warn("krb5 libs don't have all features required for Active Directory support")
615 conf.undefine('HAVE_KRB5_H')
616 conf.undefine('HAVE_GSSAPI_H')
617 conf.undefine('HAVE_GSSAPI_GSSAPI_GENERIC_H')
618 conf.undefine('HAVE_GSSAPI_GSSAPI_H')
620 if Options.options.with_utmp:
621 conf.env.with_utmp = True
622 if not conf.CHECK_HEADERS('utmp.h'): conf.env.with_utmp = False
623 conf.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
624 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers='utmp.h',
625 define='HAVE_UT_UT_NAME')
626 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers='utmp.h',
627 define='HAVE_UT_UT_USER')
628 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers='utmp.h',
629 define='HAVE_UT_UT_ID')
630 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers='utmp.h',
631 define='HAVE_UT_UT_HOST')
632 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers='utmp.h',
633 define='HAVE_UT_UT_TIME')
634 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers='utmp.h',
635 define='HAVE_UT_UT_TV')
636 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers='utmp.h',
637 define='HAVE_UT_UT_TYPE')
638 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers='utmp.h',
639 define='HAVE_UT_UT_PID')
640 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers='utmp.h',
641 define='HAVE_UT_UT_EXIT')
642 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr_v6', headers='utmp.h',
643 define='HAVE_UT_UT_ADDR_V6')
644 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr', headers='utmp.h',
645 define='HAVE_UT_UT_ADDR')
646 conf.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers='utmpx.h',
647 define='HAVE_UX_UT_SYSLEN')
648 conf.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
649 'PUTUTLINE_RETURNS_UTMP', headers='utmp.h',
650 msg="Checking whether pututline returns pointer")
651 if conf.env.with_utmp:
652 conf.DEFINE('WITH_UTMP', 1)
654 if Options.options.with_avahi:
655 conf.env.with_avahi = True
656 if not conf.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf.env.with_avahi = False
657 if not conf.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf.env.with_avahi = False
658 if not conf.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf.env.with_avahi = False
659 if conf.env.with_avahi:
660 conf.DEFINE('WITH_AVAHI_SUPPORT', 1)
661 else:
662 conf.SET_TARGET_TYPE('avahi-common', 'EMPTY')
663 conf.SET_TARGET_TYPE('avahi-client', 'EMPTY')
665 if Options.options.with_iconv:
666 conf.env.with_iconv = True
667 if not conf.CHECK_FUNCS_IN('iconv_open', 'iconv', headers='iconv.h'):
668 conf.env.with_iconv = False
669 if conf.env.with_iconv:
670 conf.DEFINE('HAVE_ICONV', 1)
672 if Options.options.with_pam:
673 use_pam=True
674 conf.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
675 if not conf.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
676 Logs.warn("--with-pam=yes but pam_appl.h not found")
677 use_pam=False
678 conf.CHECK_FUNCS_IN('pam_get_data', 'pam')
679 conf.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h')
680 if not conf.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'):
681 Logs.warn("--with-pam=yes but pam_modules.h not found")
682 use_pam=False
683 conf.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h')
684 conf.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h')
685 conf.CHECK_FUNCS_IN('pam_vsyslog', 'pam')
686 conf.CHECK_CODE('''
687 #if defined(HAVE_SECURITY_PAM_APPL_H)
688 #include <security/pam_appl.h>
689 #elif defined(HAVE_PAM_PAM_APPL_H)
690 #include <pam/pam_appl.h>
691 #endif
692 pam_set_item(0, PAM_RHOST, 0);
693 ''',
694 'HAVE_PAM_RHOST',
695 lib='pam',
696 msg="Checking whether PAM_RHOST is available");
697 conf.CHECK_CODE('''
698 #if defined(HAVE_SECURITY_PAM_APPL_H)
699 #include <security/pam_appl.h>
700 #elif defined(HAVE_PAM_PAM_APPL_H)
701 #include <pam/pam_appl.h>
702 #endif
703 pam_set_item(0, PAM_TTY, 0);
704 ''',
705 'HAVE_PAM_TTY',
706 lib='pam',
707 msg="Checking whether PAM_TTY is available");
708 conf.CHECK_CODE('''
709 #if (!defined(LINUX))
711 #define PAM_EXTERN extern
712 #if defined(HAVE_SECURITY_PAM_APPL_H)
713 #include <security/pam_appl.h>
714 #elif defined(HAVE_PAM_PAM_APPL_H)
715 #include <pam/pam_appl.h>
716 #endif
718 #endif
720 #if defined(HAVE_SECURITY_PAM_MODULES_H)
721 #include <security/pam_modules.h>
722 #elif defined(HAVE_PAM_PAM_MODULES_H)
723 #include <pam/pam_modules.h>
724 #endif
726 #if defined(HAVE_SECURITY__PAM_MACROS_H)
727 #include <security/_pam_macros.h>
728 #elif defined(HAVE_PAM__PAM_MACROS_H)
729 #include <pam/_pam_macros.h>
730 #endif
732 #ifdef HAVE_SECURITY_PAM_EXT_H
733 #include <security/pam_ext.h>
734 #endif
736 int i; i = PAM_RADIO_TYPE;
737 ''',
738 'HAVE_PAM_RADIO_TYPE',
739 lib='pam',
740 msg="Checking whether PAM_RADIO_TYPE is available");
741 if use_pam:
742 conf.DEFINE('WITH_PAM', 1)
743 conf.DEFINE('WITH_PAM_MODULES', 1)
745 seteuid = False
746 if not seteuid:
747 seteuid = conf.CHECK_CODE('''
748 #define AUTOCONF_TEST 1
749 #define USE_SETREUID 1
750 #include "./lib/util_sec.c"
751 ''',
752 'USE_SETREUID',
753 addmain=False,
754 execute=True,
755 msg="Checking whether setreuid is available")
756 if not seteuid:
757 seteuid = conf.CHECK_CODE('''
758 #define AUTOCONF_TEST 1
759 #define USE_SETRESUID 1
760 #include "./lib/util_sec.c"
761 ''',
762 'USE_SETRESUID',
763 addmain=False,
764 execute=True,
765 msg="Checking whether setresuid is available")
766 if not seteuid:
767 seteuid = conf.CHECK_CODE('''
768 #define AUTOCONF_TEST 1
769 #define USE_SETEUID 1
770 #include "./lib/util_sec.c"
771 ''',
772 'USE_SETEUID',
773 addmain=False,
774 execute=True,
775 msg="Checking whether seteuid is available")
776 if not seteuid:
777 seteuid = conf.CHECK_CODE('''
778 #define AUTOCONF_TEST 1
779 #define USE_SETUIDX 1
780 #include "./lib/util_sec.c"
781 ''',
782 'USE_SETUIDX',
783 addmain=False,
784 execute=True,
785 mandatory=True,
786 msg="Checking whether setuidx is available")
787 if Options.options.with_dnsupdate:
788 conf.CHECK_HEADERS('uuid/uuid.h')
789 conf.CHECK_FUNCS_IN('uuid_generate', 'uuid')
790 if not conf.CONFIG_SET('HAVE_UUID_UUID_H') and not conf.CONFIG_SET('HAVE_UUID_GENERATE'):
791 Logs.warn("--with-dnsupdate=yes but uuid support not sufficient")
792 elif not conf.CONFIG_SET('HAVE_KRB5'):
793 Logs.warn("--with-dnsupdate=yes but gssapi support not sufficient")
794 else:
795 conf.DEFINE('WITH_DNS_UPDATES', 1)
796 else:
797 conf.SET_TARGET_TYPE('uuid', 'EMPTY')
798 conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
799 if Options.options.developer:
800 if conf.CONFIG_SET('HAVE_VALGRIND_H') or conf.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'):
801 conf.DEFINE('VALGRIND', '1')
803 if conf.CHECK_CODE('''
804 #include <bits/sockaddr.h>
805 #include <linux/netlink.h>
806 ''',
807 'HAVE_LINUX_NETLINK_H',
808 msg="Checking whether Linux netlink is available"):
809 conf.CHECK_CODE('''
810 #include <bits/sockaddr.h>
811 #include <linux/netlink.h>
812 #include <linux/rtnetlink.h>
813 ''',
814 'HAVE_LINUX_RTNETLINK_H',
815 msg='Checking whether Linux rtnetlink is available')
816 conf.CHECK_CODE('''
817 #include "../tests/fcntl_lock.c"
818 ''',
819 'HAVE_FCNTL_LOCK',
820 addmain=False,
821 execute=True,
822 msg='Checking whether fcntl locking is available')
824 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec',
825 define='HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') # Linux, Solaris
826 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimensec',
827 define='HAVE_STRUCT_STAT_ST_MTIMENSEC') # BSD, if defined _POSIX_SOURCE
828 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimespec.tv_nsec',
829 define='HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') # BSD, if not defined _POSIX_SOURCE
830 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtime_n',
831 define='HAVE_STRUCT_STAT_ST_MTIME_N') # AIX
832 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_umtime',
833 define='HAVE_STRUCT_STAT_ST_UMTIME') # Tru64
834 if conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') or \
835 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMENSEC') or \
836 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') or \
837 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIME_N') or \
838 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_UMTIME'):
839 conf.DEFINE('HAVE_STAT_HIRES_TIMESTAMPS', '1')
841 # recent FreeBSD, NetBSD have creation timestamps called birthtime:
842 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtime',
843 define='HAVE_STRUCT_STAT_ST_BIRTHTIME')
844 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimespec.tv_nsec',
845 define='HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC')
846 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimensec',
847 define='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC')
849 conf.CHECK_CODE('''
850 ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
851 ''',
852 'HAVE_POSIX_FADVISE',
853 msg='Checking whether posix_fadvise is available',
854 headers='unistd.h fcntl.h')
856 for v in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]:
857 conf.CHECK_CODE('''
858 #include <unistd.h>
859 return sysconf(%s) == -1 ? 1 : 0;
860 ''' % v,
861 'SYSCONF%s' % v,
862 msg='Checking whether sysconf(%s) is available' % v)
864 conf.CHECK_CODE('''
865 #include <sys/syscall.h>
866 #include <unistd.h>
867 syscall(SYS_initgroups, 16, NULL, NULL, 0);
868 ''',
869 'HAVE_DARWIN_INITGROUPS',
870 msg='Checking whether to use the Darwin-specific initgroups system call')
872 conf.CHECK_CODE('''struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''',
873 'HAVE_UTIMBUF',
874 headers='sys/types.h utime.h',
875 msg='Checking whether struct utimbuf is available')
877 if conf.CHECK_CODE('''struct sigevent s;''',
878 'HAVE_STRUCT_SIGEVENT',
879 headers='sys/types.h stdlib.h stddef.h signal.h',
880 msg='Checking whether we have the struct sigevent'):
881 conf.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sival_ptr',
882 define='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR',
883 headers='signal.h');
884 conf.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sigval_ptr',
885 define='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR',
886 headers='signal.h');
888 if os.path.exists('/proc/sys/kernel/core_pattern'):
889 conf.DEFINE('HAVE_SYS_KERNEL_PROC_CORE_PATTERN', '1')
891 if conf.CHECK_CODE('''
892 #include <time.h>
893 main() {
894 struct tm *tm;
895 if (sizeof(time_t) == 8) {
896 time_t max_time = 0x7fffffffffffffffll;
897 tm = gmtime(&max_time);
898 /* This should fail with 32-bit tm_year. */
899 if (tm == NULL) {
900 /* Max time_t that works with 32-bit int tm_year in struct tm. */
901 max_time = 67768036191676799ll;
902 tm = gmtime(&max_time);
903 if (tm) {
904 exit(0);
908 exit(1);
909 }''',
910 '__TIME_T_MAX',
911 addmain=False,
912 execute=True,
913 msg="Checking for the maximum value of the 'time_t' type"):
914 conf.DEFINE('TIME_T_MAX', '67768036191676799ll')
916 conf.CHECK_CODE('''
917 #if defined(HAVE_UNISTD_H)
918 #include <unistd.h>
919 #endif
920 #include <sys/types.h>
921 main() { dev_t dev = makedev(1,2); return 0; }
922 ''',
923 'HAVE_MAKEDEV',
924 addmain=False,
925 msg='Checking whether the macro for makedev is available')
927 conf.CHECK_CODE('''
928 #include <stdio.h>
929 #include <limits.h>
930 #include <signal.h>
932 void exit_on_core(int ignored) {
933 exit(1);
936 main() {
937 char *newpath;
938 signal(SIGSEGV, exit_on_core);
939 newpath = realpath("/tmp", NULL);
940 exit((newpath != NULL) ? 0 : 1);
942 ''',
943 'REALPATH_TAKES_NULL',
944 addmain=False,
945 execute=True,
946 msg='Checking whether the realpath function allows a NULL argument')
948 conf.CHECK_CODE('''#include "../tests/ftruncate.c"''',
949 'HAVE_FTRUNCATE_EXTEND',
950 msg='Checking for ftruncate extend',
951 addmain=False,
952 execute=True)
953 if os.getenv('RUN_FROM_BUILD_FARM'):
954 Logs.info("enabling buildfarm hacks")
955 conf.DEFINE('ENABLE_BUILD_FARM_HACKS', '1')
957 if Options.options.with_sendfile_support:
958 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):
959 conf.CHECK_CODE('''
960 int tofd, fromfd;
961 off_t offset;
962 size_t total;
963 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
964 ''',
965 '_HAVE_SENDFILE',
966 headers='sys/sendfile',
967 msg='Checking for linux sendfile support')
969 # Try and cope with broken Linux sendfile....
970 conf.CHECK_CODE('''#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
971 #undef _FILE_OFFSET_BITS
972 #endif
973 #include <sys/sendfile.h>
974 int tofd, fromfd;
975 off_t offset;
976 size_t total;
977 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
978 ''',
979 '_HAVE_BROKEN_LINUX_SENDFILE',
980 msg='Checking for broken linux sendfile support')
981 if conf.CONFIG_SET('_HAVE_SENDFILE'):
982 conf.DEFINE('HAVE_SENDFILE', '1')
983 conf.DEFINE('LINUX_SENDFILE_API', '1')
984 conf.DEFINE('WITH_SENDFILE', '1')
985 elif conf.CONFIG_SET('_HAVE_BROKEN_LINUX_SENDFILE'):
986 conf.DEFINE('LINUX_BROKEN_SENDFILE_API', '1')
987 conf.DEFINE('WITH_SENDFILE', '1')
988 elif (host_os.rfind('freebsd') > -1) or (host_os.rfind('dragonfly') > -1):
989 conf.CHECK_CODE('''
990 #include <sys/types.h>
991 #include <unistd.h>
992 #include <sys/socket.h>
993 #include <sys/uio.h>
994 int fromfd, tofd, ret, total=0;
995 off_t offset, nwritten;
996 struct sf_hdtr hdr;
997 struct iovec hdtrl;
998 hdr.headers = &hdtrl;
999 hdr.hdr_cnt = 1;
1000 hdr.trailers = NULL;
1001 hdr.trl_cnt = 0;
1002 hdtrl.iov_base = NULL;
1003 hdtrl.iov_len = 0;
1004 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0)
1005 ''',
1006 '_HAVE_SENDFILE',
1007 msg='Checking for freebsd sendfile support')
1008 if conf.CONFIG_SET('_HAVE_SENDFILE'):
1009 conf.DEFINE('HAVE_SENDFILE', '1')
1010 conf.DEFINE('FREEBSD_SENDFILE_API', '1')
1011 conf.DEFINE('WITH_SENDFILE', '1')
1012 elif (host_os.rfind('hpux') > -1):
1013 conf.CHECK_CODE('''
1014 #include <sys/socket.h>
1015 #include <sys/uio.h>
1016 int fromfd, tofd;
1017 size_t total=0;
1018 struct iovec hdtrl[2];
1019 ssize_t nwritten;
1020 off_t offset;
1021 hdtrl[0].iov_base = 0;
1022 hdtrl[0].iov_len = 0;
1023 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
1024 ''',
1025 '_HAVE_SENDFILE',
1026 msg='Checking for hpux sendfile support')
1027 if conf.CONFIG_SET('_HAVE_SENDFILE'):
1028 conf.DEFINE('HAVE_SENDFILE', '1')
1029 conf.DEFINE('HPUX_SENDFILE_API', '1')
1030 conf.DEFINE('WITH_SENDFILE', '1')
1031 elif (host_os.rfind('solaris') > -1):
1032 conf.CHECK_FUNCS_IN('sendfile', 'sendfilev')
1033 conf.CHECK_CODE('''
1034 #include <sys/sendfile.h>,
1035 int sfvcnt;
1036 size_t xferred;
1037 struct sendfilevec vec[2];
1038 ssize_t nwritten;
1039 int tofd;
1040 sfvcnt = 2;
1041 vec[0].sfv_fd = SFV_FD_SELF;
1042 vec[0].sfv_flag = 0;
1043 vec[0].sfv_off = 0;
1044 vec[0].sfv_len = 0;
1045 vec[1].sfv_fd = 0;
1046 vec[1].sfv_flag = 0;
1047 vec[1].sfv_off = 0;
1048 vec[1].sfv_len = 0;
1049 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
1050 ''',
1051 '_HAVE_SENDFILEV',
1052 msg='Checking for solaris sendfilev support')
1053 if conf.CONFIG_SET('_HAVE_SENDFILEV'):
1054 conf.DEFINE('HAVE_SENDFILEV', '1')
1055 conf.DEFINE('SOLARIS_SENDFILE_API', '1')
1056 conf.DEFINE('WITH_SENDFILE', '1')
1057 elif (host_os.rfind('aix') > -1):
1058 conf.CHECK_CODE('''
1059 #include <sys/socket.h>
1060 int fromfd, tofd;
1061 size_t total=0;
1062 struct sf_parms hdtrl;
1063 ssize_t nwritten;
1064 hdtrl.header_data = 0;
1065 hdtrl.header_length = 0;
1066 hdtrl.file_descriptor = fromfd;
1067 hdtrl.file_offset = 0;
1068 hdtrl.file_bytes = 0;
1069 hdtrl.trailer_data = 0;
1070 hdtrl.trailer_length = 0;
1071 nwritten = send_file(&tofd, &hdtrl, 0);
1072 ''',
1073 '_HAVE_SENDFILE',
1074 msg='Checking for AIX send_file support')
1075 if conf.CONFIG_SET('_HAVE_SENDFILE'):
1076 conf.DEFINE('HAVE_SENDFILE', '1')
1077 conf.DEFINE('AIX_SENDFILE_API', '1')
1078 conf.DEFINE('WITH_SENDFILE', '1')
1080 # Check for getcwd allowing a NULL arg.
1081 conf.CHECK_CODE('''
1082 #include <unistd.h>
1083 main() {
1084 char *s = getcwd(NULL,0);
1085 exit(s != NULL ? 0 : 1);
1086 }''', 'GETCWD_TAKES_NULL', addmain=False, execute=True,
1087 msg="getcwd takes a NULL argument")
1090 # UnixWare 7.x has its getspnam in -lgen
1091 conf.CHECK_FUNCS_IN('getspnam', 'gen')
1092 conf.CHECK_FUNCS_IN('getspnam', 'security')
1093 conf.CHECK_FUNCS_IN('getspnam', 'sec')
1095 if Options.options.with_quotas:
1096 # For quotas on Veritas VxFS filesystems
1097 conf.CHECK_HEADERS('sys/fs/vx_quota.h')
1098 # For quotas on Linux XFS filesystems
1099 conf.CHECK_HEADERS('linux/dqblk_xfs.h')
1100 # For sys/quota.h and linux/quota.h
1101 conf.CHECK_HEADERS('sys/quota.h')
1105 # checking for clustering extensions (CTDB)
1107 if not Options.options.with_cluster_support:
1108 have_cluster_support = False
1110 else:
1112 if Options.options.ctdb_dir:
1113 conf.ADD_EXTRA_INCLUDES(Options.options.ctdb_dir + '/include')
1115 srcdir = os.path.realpath(conf.srcdir)
1116 if 'EXTRA_INCLUDES' in conf.env:
1117 includes = ' '.join(conf.env['EXTRA_INCLUDES']).replace('#', srcdir + '/')
1118 else:
1119 includes = ''
1121 have_cluster_support = True
1122 ctdb_broken = ""
1124 conf.CHECK_CODE('''
1125 #define NO_CONFIG_H
1126 #include "replace.h"
1127 #include "system/wait.h"
1128 #include "system/network.h"
1129 #define private #error __USED_RESERVED_WORD_private__
1130 #include <talloc.h>
1131 #include <tdb.h>
1132 #include <ctdb.h>
1134 int main(void)
1136 return 0;
1138 ''',
1139 'HAVE_CTDB_H',
1140 addmain=False,
1141 includes=includes,
1142 msg='Checking for header ctdb.h')
1144 if not conf.CONFIG_SET('HAVE_CTDB_H'):
1145 have_cluster_support = False
1146 ctdb_broken = "ctdb.h is required for cluster support"
1148 if have_cluster_support:
1149 conf.CHECK_CODE('''
1150 #define NO_CONFIG_H
1151 #include "replace.h"
1152 #include "system/wait.h"
1153 #include "system/network.h"
1154 #define private #error __USED_RESERVED_WORD_private__
1155 #include <talloc.h>
1156 #include <tdb.h>
1157 #include <ctdb.h>
1158 #include <ctdb_private.h>
1160 int main(void)
1162 return 0;
1164 ''',
1165 'HAVE_CTDB_PRIVATE_H',
1166 addmain=False,
1167 includes=includes,
1168 msg='Checking for header ctdb_private.h')
1170 if not conf.CONFIG_SET('HAVE_CTDB_PRIVATE_H'):
1171 have_cluster_support = False
1172 ctdb_broken = "ctdb_private.h is required for cluster support"
1174 if have_cluster_support:
1175 conf.CHECK_CODE('''
1176 #define NO_CONFIG_H
1177 #include "replace.h"
1178 #include "system/wait.h"
1179 #include "system/network.h"
1180 #include <talloc.h>
1181 #include <tdb.h>
1182 #include <ctdb.h>
1183 #include <ctdb_private.h>
1185 int main(void)
1187 int i = (int)CTDB_CONTROL_TRANS3_COMMIT;
1188 return 0;
1190 ''',
1191 'HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL',
1192 addmain=False,
1193 includes=includes,
1194 msg='Checking for transaction support (TRANS3_COMMIT control)')
1196 if not conf.CONFIG_SET('HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL'):
1197 have_cluster_support = False
1198 ctdb_broken = "ctdb transaction support missing or too old"
1200 if have_cluster_support:
1201 conf.CHECK_CODE('''
1202 #define NO_CONFIG_H
1203 #include "replace.h"
1204 #include "system/wait.h"
1205 #include "system/network.h"
1206 #include <talloc.h>
1207 #include <tdb.h>
1208 #include <ctdb.h>
1209 #include <ctdb_private.h>
1211 int main(void)
1213 int i = (int)CTDB_CONTROL_SCHEDULE_FOR_DELETION;
1214 return 0;
1216 ''',
1217 'HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL',
1218 addmain=False,
1219 includes=includes,
1220 msg='Checking for SCHEDULE_FOR_DELETION control')
1222 if not conf.CONFIG_SET('HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL'):
1223 if not Options.options.enable_old_ctdb:
1224 have_cluster_support = False
1225 ctdb_broken = "SCHEDULE_FOR_DELETION control missing"
1226 else:
1227 Logs.warn("ignoring missing SCHEDULE_FOR_DELETION control (--enable-old-ctdb)")
1229 if have_cluster_support:
1230 conf.CHECK_CODE('''
1231 #define NO_CONFIG_H
1232 #include "replace.h"
1233 #include "system/wait.h"
1234 #include "system/network.h"
1235 #include <talloc.h>
1236 #include <tdb.h>
1237 #include <ctdb.h>
1238 #include <ctdb_private.h>
1240 int main(void)
1242 struct ctdb_control_tcp _x;
1243 return 0;
1245 ''',
1246 'HAVE_STRUCT_CTDB_CONTROL_TCP',
1247 addmain=False,
1248 includes=includes,
1249 msg='Checking for ctdb ipv4 support')
1251 if not conf.CONFIG_SET('HAVE_STRUCT_CTDB_CONTROL_TCP'):
1252 have_cluster_support = False
1253 ctdb_broken = "missing struct ctdb_control_tcp"
1255 if have_cluster_support:
1256 conf.CHECK_CODE('''
1257 #define NO_CONFIG_H
1258 #include "replace.h"
1259 #include "system/wait.h"
1260 #include "system/network.h"
1261 #include <talloc.h>
1262 #include <tdb.h>
1263 #include <ctdb.h>
1264 #include <ctdb_private.h>
1266 int main(void)
1268 struct ctdb_control_tcp_addr _x;
1269 return 0;
1271 ''',
1272 'HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR',
1273 addmain=False,
1274 includes=includes,
1275 msg='Checking for ctdb ipv6 support')
1277 if have_cluster_support:
1278 conf.CHECK_CODE('''
1279 #define NO_CONFIG_H
1280 #include "replace.h"
1281 #include "system/wait.h"
1282 #include "system/network.h"
1283 #include <talloc.h>
1284 #include <tdb.h>
1285 #include <ctdb.h>
1286 #include <ctdb_private.h>
1288 int main(void)
1290 int i = (int)CTDB_CONTROL_CHECK_SRVIDS;
1291 return 0;
1293 ''',
1294 'HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL',
1295 addmain=False,
1296 includes=includes,
1297 msg='Checking for CHECK_SRVIDS control')
1299 if not conf.CONFIG_SET('HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL'):
1300 if not Options.options.enable_old_ctdb:
1301 have_cluster_support = False
1302 ctdb_broken = "CHECK_SRVIDS control missing"
1303 else:
1304 Logs.warn("ignoring missing CHECK_SRVIDS control (--enable-old-ctdb)")
1306 if have_cluster_support:
1307 Logs.info("building with cluster support")
1308 conf.DEFINE('CLUSTER_SUPPORT', 1);
1309 else:
1310 if not Options.options.with_cluster_support:
1311 Logs.info("building without cluster support")
1312 else:
1313 Logs.warn("building without cluster support: " + ctdb_broken)
1314 conf.undefine('CLUSTER_SUPPORT')
1318 conf.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }',
1319 'HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR',
1320 addmain=False,
1321 link=False,
1322 msg='Checking whether we can compile with __attribute__((destructor))')
1324 conf.CHECK_CODE('void seekdir(DIR *d, long loc) { return; }',
1325 'SEEKDIR_RETURNS_VOID',
1326 headers='sys/types.h dirent.h',
1327 msg='Checking whether seekdir returns void')
1329 if Options.options.with_profiling_data:
1330 conf.DEFINE('WITH_PROFILE', 1);
1332 PTHREAD_CFLAGS='error'
1333 PTHREAD_LDFLAGS='error'
1335 if PTHREAD_LDFLAGS == 'error':
1336 if conf.CHECK_FUNCS_IN('pthread_attr_init', 'pthread'):
1337 PTHREAD_CFLAGS='-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS'
1338 PTHREAD_LDFLAGS='-lpthread'
1339 if PTHREAD_LDFLAGS == 'error':
1340 if conf.CHECK_FUNCS_IN('pthread_attr_init', 'pthreads'):
1341 PTHREAD_CFLAGS='-D_THREAD_SAFE'
1342 PTHREAD_LDFLAGS='-lpthreads'
1343 if PTHREAD_LDFLAGS == 'error':
1344 if conf.CHECK_FUNCS_IN('pthread_attr_init', 'c_r'):
1345 PTHREAD_CFLAGS='-D_THREAD_SAFE -pthread'
1346 PTHREAD_LDFLAGS='-pthread'
1347 if PTHREAD_LDFLAGS == 'error':
1348 if conf.CHECK_FUNC('pthread_attr_init'):
1349 PTHREAD_CFLAGS='-D_REENTRANT'
1350 PTHREAD_LDFLAGS='-lpthread'
1351 # especially for HP-UX, where the CHECK_FUNC macro fails to test for
1352 # pthread_attr_init. On pthread_mutex_lock it works there...
1353 if PTHREAD_LDFLAGS == 'error':
1354 if conf.CHECK_FUNCS_IN('pthread_mutex_lock', 'pthread'):
1355 PTHREAD_CFLAGS='-D_REENTRANT'
1356 PTHREAD_LDFLAGS='-lpthread'
1358 if PTHREAD_CFLAGS != 'error' and PTHREAD_LDFLAGS != 'error':
1359 conf.ADD_CFLAGS(PTHREAD_CFLAGS)
1360 conf.ADD_LDFLAGS(PTHREAD_LDFLAGS)
1361 conf.CHECK_HEADERS('pthread.h')
1362 conf.DEFINE('HAVE_PTHREAD', '1')
1364 if Options.options.with_pthreadpool:
1365 if conf.CONFIG_SET('HAVE_PTHREAD'):
1366 conf.DEFINE('WITH_PTHREADPOOL', '1')
1367 else:
1368 Logs.warn("pthreadpool support cannot be enabled when pthread support was not found")
1369 conf.undefine('WITH_PTHREADPOOL')
1371 if conf.CHECK_HEADERS('gpfs_gpl.h'):
1372 conf.DEFINE('HAVE_GPFS', '1')
1374 # Note that all charset 'modules' must actually be static, due to dependency loop issues
1375 # if we include the module loader in iconv
1377 default_static_modules=TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
1378 auth_sam auth_unix auth_winbind auth_wbc
1379 auth_domain auth_builtin vfs_default
1380 nss_info_template idmap_tdb idmap_passdb
1381 idmap_nss''')
1383 default_shared_modules=TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
1384 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
1385 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2
1386 auth_script vfs_readahead vfs_xattr_tdb vfs_posix_eadb
1387 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
1388 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
1389 vfs_crossrename vfs_linux_xfs_sgid
1390 vfs_time_audit idmap_autorid''')
1392 if Options.options.developer:
1393 default_static_modules.extend(TO_LIST('pdb_ads auth_netlogond charset_weird'))
1394 default_shared_modules.extend(TO_LIST('perfcount_test'))
1395 default_shared_modules.extend(TO_LIST('vfs_skel_opaque vfs_skel_transparent vfs_shadow_copy_test'))
1396 default_shared_modules.extend(TO_LIST('auth_skel pdb_test'))
1398 if conf.CONFIG_SET('AD_DC_BUILD_IS_ENABLED'):
1399 default_static_modules.extend(TO_LIST('pdb_samba4 auth_samba4 vfs_dfs_samba4'))
1401 if Options.options.with_acl_support and conf.CONFIG_SET('HAVE_POSIX_ACLS'):
1402 default_static_modules.extend(TO_LIST('vfs_posixacl'))
1404 if conf.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'):
1405 default_shared_modules.extend(TO_LIST('vfs_zfsacl'))
1407 if conf.CONFIG_SET('HAVE_DIRFD_DECL'):
1408 default_shared_modules.extend(TO_LIST('vfs_syncops vfs_dirsort'))
1410 if conf.CONFIG_SET('HAVE_STATFS_F_FSID'):
1411 default_shared_modules.extend(TO_LIST('vfs_fileid'))
1413 if conf.CONFIG_SET('HAVE_AIO') and (conf.CONFIG_SET('HAVE_MSGHDR_MSG_CONTROL') or conf.CONFIG_SET('HAVE_MSGHDR_MSG_ACCTRIGHTS')):
1414 default_shared_modules.extend(TO_LIST('vfs_aio_fork'))
1416 if conf.CONFIG_SET('HAVE_AIO') and Options.options.with_pthreadpool:
1417 default_shared_modules.extend(TO_LIST('vfs_aio_pthread'))
1419 if conf.CONFIG_SET('HAVE_AIO') and conf.CONFIG_SET('HAVE_LINUX_KERNEL_AIO'):
1420 default_shared_modules.extend(TO_LIST('vfs_aio_linux'))
1422 if conf.CONFIG_SET('HAVE_LDAP'):
1423 default_static_modules.extend(TO_LIST('pdb_ldap idmap_ldap'))
1425 if conf.CONFIG_SET('DARWINOS'):
1426 default_static_modules.extend(TO_LIST('charset_macosxfs'))
1428 if conf.CONFIG_SET('HAVE_GPFS'):
1429 default_shared_modules.extend(TO_LIST('vfs_gpfs vfs_gpfs_hsm_notify'))
1431 explicit_shared_modules = TO_LIST(Options.options.shared_modules, delimiter=',')
1432 explicit_static_modules = TO_LIST(Options.options.static_modules, delimiter=',')
1434 final_static_modules = default_static_modules
1435 final_shared_modules = default_shared_modules
1437 for m in explicit_static_modules:
1438 if m in final_shared_modules:
1439 final_shared_modules.remove(m)
1440 final_static_modules.append(m)
1441 for m in explicit_shared_modules:
1442 if m in final_static_modules:
1443 final_static_modules.remove(m)
1444 final_shared_modules.append(m)
1446 conf.env['static_modules'] = final_static_modules
1447 conf.env['shared_modules'] = final_shared_modules
1449 conf.DEFINE('STRING_STATIC_MODULES', ' '.join(final_static_modules), quote=True)
1451 static_list = {}
1452 shared_list = {}
1454 prefixes = ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
1455 conf.env['MODULE_PREFIXES'] = prefixes
1456 for p in prefixes:
1457 for m in final_static_modules:
1458 if m.find(p) == 0:
1459 if not p in static_list:
1460 static_list[p] = []
1461 static_list[p].append(m)
1462 for m in final_shared_modules:
1463 if m.find(p) == 0:
1464 if not p in shared_list:
1465 shared_list[p] = []
1466 shared_list[p].append(m)
1468 for p in prefixes:
1469 static_env = "%s_STATIC" % p.upper()
1470 shared_env = "%s_SHARED" % p.upper()
1471 conf.env[static_env] = []
1472 conf.env[shared_env] = []
1473 if p in static_list:
1474 decl_list=""
1475 for entry in static_list[p]:
1476 decl_list += "extern NTSTATUS %s_init(void); " % entry
1477 conf.env[static_env].append('%s' % entry)
1478 decl_list = decl_list.rstrip()
1479 conf.DEFINE('static_decl_%s' % p, decl_list)
1480 conf.DEFINE('static_init_%s' % p, '{ %s_init(); }' % '_init(); '.join(static_list[p]))
1481 else:
1482 conf.DEFINE('static_decl_%s' % p, '')
1483 conf.DEFINE('static_init_%s' % p, '{}')
1484 if p in shared_list:
1485 for entry in shared_list[p]:
1486 conf.DEFINE('%s_init' % entry, 'samba_init_module')
1487 conf.env[shared_env].append('%s' % entry)
1489 conf.SAMBA_CONFIG_H('include/config.h')
1491 def ctags(ctx):
1492 "build 'tags' file using ctags"
1493 import Utils
1494 source_root = os.path.dirname(Utils.g_module.root_path)
1495 cmd = 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
1496 print("Running: %s" % cmd)
1497 os.system(cmd)