Fix pam_winbind build against newer iniparser library
[Samba.git] / source3 / wscript
blob46aa5827480b2b01e3fbe11dff51b7719011e59f
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('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)
62 def configure(conf):
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)
109 #include <unistd.h>
110 #endif
111 long ret = splice(0,0,1,0,400,0);
112 ''',
113 'HAVE_LINUX_SPLICE',
114 headers='fcntl.h'):
115 conf.CHECK_DECLS('splice', reverse=True, headers='fcntl.h')
117 # Check for inotify support
118 conf.CHECK_HEADERS('sys/inotify.h')
119 if "HAVE_SYS_INOTIFY_H" in conf.env:
120 conf.DEFINE('HAVE_INOTIFY', 1)
122 # Check for kernel change notify support
123 conf.CHECK_CODE('''
124 #ifndef F_NOTIFY
125 #define F_NOTIFY 1026
126 #endif
127 main() {
128 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
129 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain=False, execute=True,
130 headers='fcntl.h signal.h',
131 msg="Checking for kernel change notify support")
133 # Check for Linux kernel oplocks
134 conf.CHECK_CODE('''
135 #include <sys/types.h>
136 #include <fcntl.h>
137 #include <signal.h>
138 #ifndef F_NOTIFY
139 #define F_NOTIFY 1026
140 #endif
141 main() {
142 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
143 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain=False, execute=True,
144 msg="Checking for Linux kernel oplocks")
146 # Check for IRIX kernel oplock types
147 conf.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
148 'HAVE_KERNEL_OPLOCKS_IRIX', headers='fcntl.h',
149 msg="Checking for IRIX kernel oplock types")
151 # Check for kernel share modes
152 conf.CHECK_CODE('''
153 #include <sys/types.h>
154 #include <fcntl.h>
155 #include <signal.h>
156 #include <sys/file.h>
157 #ifndef LOCK_MAND
158 #define LOCK_MAND 32
159 #define LOCK_READ 64
160 #endif
161 main() {
162 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
163 }''', 'HAVE_KERNEL_SHARE_MODES', addmain=False, execute=True,
164 msg="Checking for krenel share modes")
166 # Check for various members of the stat structure
167 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define='HAVE_STAT_ST_BLOCKS',
168 headers='sys/stat.h')
169 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define='HAVE_STAT_ST_BLKSIZE',
170 headers='sys/stat.h')
171 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_flags', define='HAVE_STAT_ST_FLAGS',
172 headers='sys/types.h sys/stat.h unistd.h')
174 if "HAVE_BLKCNT_T" in conf.env:
175 conf.CHECK_CODE('''
176 return sizeof(blkcnt_t) == 4 ? 0 : 1''',
177 'SIZEOF_BLKCNT_T_4', execute=True,
178 headers='replace.h sys/types.h sys/stat.h unistd.h',
179 msg="Checking whether blkcnt_t is 32 bit")
181 if "HAVE_BLKCNT_T" in conf.env:
182 conf.CHECK_CODE('''
183 return sizeof(blkcnt_t) == 8 ? 0 : 1''',
184 'SIZEOF_BLKCNT_T_8', execute=True,
185 headers='replace.h sys/types.h sys/stat.h unistd.h',
186 msg="Checking whether blkcnt_t is 64 bit")
188 # Check for POSIX capability support
189 conf.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers='sys/capability.h')
191 if "HAVE_SYS_CAPABILITY_H" in conf.env:
192 conf.CHECK_CODE('''
193 cap_t cap;
194 cap_value_t vals[1];
195 if (!(cap = cap_get_proc())) exit(1);
196 vals[0] = CAP_CHOWN;
197 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
198 cap_set_proc(cap);''',
199 'HAVE_POSIX_CAPABILITIES', execute=True, lib="cap",
200 headers='sys/capability.h',
201 msg="Checking whether POSIX capabilities are available")
203 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
204 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
205 # -- JRA.
206 if conf.CONFIG_SET("HAVE_RPC_RPC_H"):
207 conf.CHECK_TYPE('int16', headers='rpc/rpc.h',
208 define='HAVE_INT16_FROM_RPC_RPC_H',
209 msg="Checking for int16 typedef included by rpc/rpc.h")
210 conf.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
211 headers='sys/types.h rpc/rpc.h',
212 msg="Checking for uint16 typedef included by rpc/rpc.h")
213 conf.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
214 headers='sys/types.h rpc/rpc.h',
215 msg="Checking for int32 typedef included by rpc/rpc.h")
216 conf.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
217 headers='sys/types.h rpc/rpc.h',
218 msg="Checking for uint32 typedef included by rpc/rpc.h")
219 conf.CHECK_CODE('int i;', 'BROKEN_NISPLUS_INCLUDE_FILES',
220 headers='sys/types.h sys/acl.h rpcsvc/nis.h',
221 msg="Checking for broken nisplus include files")
223 # Check if the compiler will optimize out functions
224 conf.CHECK_CODE('''
225 if (0) {
226 this_function_does_not_exist();
227 } else {
228 return 1;
229 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
230 msg="Checking if the compiler will optimize out functions")
232 # Check if the compiler supports the LL suffix on long long integers
233 # AIX needs this
234 conf.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL',
235 headers='stdio.h',
236 msg="Checking for LL suffix on long long integers")
238 conf.CHECK_FUNCS('''
239 _acl __acl add_proplist_entry atexit attr_getf attr_list attr_listf
240 attropen attr_remove attr_removef attr_set attr_setf
241 bindtextdomain _chdir __chdir chflags chmod _close __close _closedir
242 __closedir crypt16 delproplist devnm dgettext dirfd
243 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
244 extattr_delete_fd extattr_get_fd extattr_get_file
245 extattr_list_fd extattr_list_file
246 extattr_set_fd extattr_set_file _facl __facl _fchdir
247 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
248 fdelproplist fgetea fgetproplist fgetxattr flistea flistxattr
249 _fork __fork fremoveea fremovexattr fseeko fsetea
250 fsetproplist fsetxattr _fstat __fstat fsync
251 futimens futimes __fxstat getauthuid
252 getcwd _getcwd __getcwd getdents __getdents getdirentries
253 getgrent getgrnam getgrouplist getgrset getmntent getpagesize
254 getproplist get_proplist_entry getpwanam getpwent_r getrlimit gettext
255 glob grantpt hstrerror initgroups innetgr
256 listea listxattr
257 llseek _llseek __llseek _lseek __lseek
258 _lstat __lstat lutimes
259 __lxstat memalign mknod mlock mlockall munlock munlockall
260 _open __open _opendir __opendir
261 pathconf poll posix_fallocate
262 posix_memalign prctl pread _pread __pread
263 pwrite _pwrite __pwrite
264 rdchk _read __read _readdir __readdir
265 removeea removexattr _seekdir __seekdir
266 select setea setenv setgidx setgroups setlocale setluid
267 setmntent setpgid setpriv setproplist setsid setuidx
268 setxattr shmget shm_open sigaction sigblock sigprocmask sigset
269 sizeof_proplist_entry _stat __stat statvfs
270 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctl sysctlbyname
271 __sys_llseek syslog _telldir __telldir textdomain timegm
272 utimensat vsyslog _write __write __xstat
273 ''')
275 conf.CHECK_SAMBA3_CHARSET() # see build/charset.py
277 # FIXME: these should be tests for features, but the old build system just
278 # checks for OSes.
279 host_os = sys.platform
280 Logs.info("building on %s" % host_os)
282 # Python doesn't have case switches... :/
283 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
284 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
286 conf.SET_TARGET_TYPE('sunacl', 'EMPTY')
287 if (host_os.rfind('linux') > -1) or (host_os.rfind('gnu') > -1) or (host_os.rfind('qnx') > -1):
288 if host_os.rfind('linux') > -1:
289 conf.DEFINE('LINUX', '1')
290 elif host_os.rfind('qnx') > -1:
291 conf.DEFINE('QNX', '1')
292 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
293 elif (host_os.rfind('darwin') > -1):
294 conf.DEFINE('DARWINOS', 1)
295 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
296 conf.ADD_CFLAGS('-fno-common')
297 elif (host_os.rfind('freebsd') > -1):
298 if conf.CHECK_HEADERS('sunacl.h'):
299 conf.DEFINE('HAVE_FREEBSD_SUNACL_H', '1')
300 conf.CHECK_FUNCS_IN('acl', 'sunacl')
301 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
302 elif (host_os.rfind('netbsd') > -1):
303 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
304 elif (host_os.rfind('openbsd') > -1):
305 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
306 elif (host_os.rfind('sunos') > -1):
307 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
308 # FIXME: Add more checks here.
309 else:
310 Logs.warn("Unknown host_os '%s', please report this to samba-technical@samba.org" % host_os)
312 #FIXME: add more checks
313 if Options.options.with_acl_support:
314 if host_os.rfind('linux') > -1:
315 conf.CHECK_FUNCS_IN('acl_get_file', 'acl')
316 conf.CHECK_FUNCS_IN('getxattr', 'attr')
317 if conf.CHECK_CODE('''
318 acl_t acl;
319 int entry_id;
320 acl_entry_t *entry_p;
321 return acl_get_entry(acl, entry_id, entry_p);
322 ''',
323 'HAVE_POSIX_ACLS',
324 headers='sys/types.h sys/acl.h', link=False,
325 msg="Checking for POSIX ACL support") :
326 conf.CHECK_CODE('''
327 acl_permset_t permset_d;
328 acl_perm_t perm;
329 return acl_get_perm_np(permset_d, perm);
330 ''',
331 'HAVE_ACL_GET_PERM_NP',
332 headers='sys/types.h sys/acl.h', link=True,
333 msg="Checking whether acl_get_perm_np() is available")
334 else:
335 conf.DEFINE('HAVE_NO_ACLS', 1)
336 conf.SET_TARGET_TYPE('acl', 'EMPTY')
337 else:
338 conf.DEFINE('HAVE_NO_ACLS', 1)
339 conf.SET_TARGET_TYPE('acl', 'EMPTY')
341 if conf.CHECK_FUNCS('dirfd'):
342 conf.DEFINE('HAVE_DIRFD_DECL', 1)
344 conf.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
345 'HAVE_STATFS_F_FSID',
346 msg="vfs_fileid: checking for statfs() and struct statfs.f_fsid",
347 headers='sys/types.h sys/statfs.h',
348 execute=True)
350 if conf.CONFIG_SET('HAVE_FALLOCATE'):
351 conf.CHECK_CODE('''
352 int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
353 'HAVE_LINUX_FALLOCATE',
354 msg="Checking whether the Linux 'fallocate' function is available",
355 headers='unistd.h sys/types.h fcntl.h linux/falloc.h')
356 conf.CHECK_CODE('''
357 ssize_t err = readahead(0,0,0x80000);''',
358 'HAVE_LINUX_READAHEAD',
359 msg="Checking whether Linux readahead is available",
360 headers='unistd.h fcntl.h')
361 conf.CHECK_DECLS('readahead', headers='fcntl.h', always=True)
363 if Options.options.with_aio_support:
364 conf.CHECK_FUNCS_IN('aio_read', 'aio')
365 conf.CHECK_FUNCS_IN('aio_read', 'rt')
366 conf.CHECK_CODE('struct aiocb a; return aio_read(&a);',
367 'HAVE_AIO',
368 msg='Checking for asynchronous io support',
369 headers='sys/types.h aio.h',
370 lib='aio rt')
371 if conf.CONFIG_SET('HAVE_AIO'):
372 conf.DEFINE('WITH_AIO', '1')
373 if conf.CONFIG_SET('HAVE_AIO'):
374 conf.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg='Checking for aio_read', headers='aio.h', lib='aio rt')
375 conf.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg='Checking for aio_write', headers='aio.h', lib='aio rt')
376 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')
377 conf.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg='Checking for aio_return', headers='aio.h', lib='aio rt')
378 conf.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg='Checking for aio_error', headers='aio.h', lib='aio rt')
379 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')
380 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')
381 if host_os.rfind('linux') > -1:
382 conf.CHECK_FUNCS_IN('io_submit', 'aio')
383 conf.CHECK_CODE('''
384 struct io_event ioev;
385 struct iocb *ioc;
386 io_context_t ctx;
387 struct timespec ts;
388 int fd;
389 char *buf;
390 fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
391 io_queue_init(128,&ctx);
392 io_prep_pwrite(ioc, 1, buf, 1, 0);
393 io_prep_pread(ioc, 1, buf, 1, 0);
394 io_set_eventfd(ioc, fd);
395 io_set_callback(ioc, (io_callback_t)(0));
396 io_submit(ctx, 1, &ioc);
397 io_getevents(ctx, 1, 1, &ioev, &ts);
398 ''',
399 'HAVE_LINUX_KERNEL_AIO',
400 msg='Checking for linux kernel asynchronous io support',
401 headers='unistd.h stdlib.h sys/types.h fcntl.h sys/eventfd.h libaio.h',
402 lib='aio')
404 if not conf.CONFIG_SET('HAVE_AIO'):
405 conf.DEFINE('HAVE_NO_AIO', '1')
406 else:
407 conf.DEFINE('HAVE_NO_AIO', '1')
409 conf.CHECK_CODE('''
410 struct msghdr msg;
411 union {
412 struct cmsghdr cm;
413 char control[CMSG_SPACE(sizeof(int))];
414 } control_un;
415 msg.msg_control = control_un.control;
416 msg.msg_controllen = sizeof(control_un.control);
417 ''',
418 'HAVE_MSGHDR_MSG_CONTROL',
419 msg='Checking if we can use msg_control for passing file descriptors',
420 headers='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
421 conf.CHECK_CODE('''
422 struct msghdr msg;
423 int fd;
424 msg.msg_acctrights = (caddr_t) &fd;
425 msg.msg_acctrightslen = sizeof(fd);
426 ''',
427 'HAVE_MSGHDR_MSG_ACCTRIGHTS',
428 msg='Checking if we can use msg_acctrights for passing file descriptors',
429 headers='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
431 if Options.options.with_winbind:
432 conf.env.build_winbind = True
433 conf.DEFINE('WITH_WINBIND', '1')
435 conf.find_program('awk', var='AWK')
436 conf.find_program('perl', var='PERL')
438 # Darwin has extra options to xattr-family functions
439 conf.CHECK_CODE('getxattr(0, 0, 0, 0, 0, 0);',
440 'XATTR_ADD_OPT',
441 msg="Checking whether xattr interface takes additional options",
442 headers='sys/types.h attr/xattr.h sys/xattr.h')
444 conf.CHECK_HEADERS('asm/types.h')
446 conf.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
447 headers='unistd.h sys/types.h',
448 msg="Checking for major macro")
450 conf.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
451 headers='unistd.h sys/types.h',
452 msg="Checking for minor macro")
454 conf.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
455 headers='unistd.h sys/types.h dirent.h',
456 define='HAVE_DIRENT_D_OFF')
458 conf.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent')
459 if conf.CHECK_CFLAGS('-Werror-implicit-function-declaration'):
460 netgrent_cflags = '-Werror-implicit-function-declaration'
461 else:
462 netgrent_cflags = ''
463 conf.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE',
464 msg="Checking for setnetgrent prototype",
465 headers='netdb.h netgroup.h',
466 cflags=netgrent_cflags)
467 conf.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE',
468 msg="Checking for getnetgrent prototype",
469 headers='netdb.h netgroup.h',
470 cflags=netgrent_cflags)
471 conf.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE',
472 msg="Checking for endnetgrent prototype",
473 headers='netdb.h netgroup.h',
474 cflags=netgrent_cflags)
477 # Look for CUPS
478 if Options.options.with_cups:
479 conf.find_program('cups-config', var='CUPS_CONFIG')
480 if conf.env.CUPS_CONFIG:
481 # we would normally use --libs here, but cups-config incorrectly adds
482 # gssapi_krb5 and other libraries to its --libs output. That breaks the use
483 # of an in-tree heimdal kerberos
484 conf.check_cfg(path=conf.env.CUPS_CONFIG, args="--cflags --ldflags",
485 package="", uselib_store="CUPS")
486 conf.CHECK_HEADERS('cups/cups.h cups/language.h', lib='cups')
487 conf.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups')
488 if conf.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
489 conf.DEFINE('HAVE_CUPS', '1')
490 else:
491 conf.undefine('HAVE_CUPS')
492 conf.SET_TARGET_TYPE('cups', 'EMPTY')
493 else:
494 # define an empty subsystem for cups, to allow it to be used as an empty dependency
495 conf.SET_TARGET_TYPE('cups', 'EMPTY')
497 if Options.options.with_iprint:
498 if conf.CONFIG_SET('HAVE_CUPS'):
499 conf.DEFINE('HAVE_IPRINT', '1')
500 else:
501 Logs.warn("--enable-iprint=yes but cups support not sufficient")
502 if Options.options.with_syslog:
503 conf.DEFINE('WITH_SYSLOG', '1')
504 if Options.options.with_automount:
505 conf.DEFINE('WITH_AUTOMOUNT', '1')
507 # Check for LDAP
508 if Options.options.with_ldap:
509 conf.CHECK_HEADERS('ldap.h lber.h ldap_pvt.h')
510 conf.CHECK_TYPE('ber_tag_t', 'unsigned int', headers='ldap.h lber.h')
511 conf.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
512 conf.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers='ldap.h')
514 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
515 # for the samba logs
516 conf.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
517 define='HAVE_LBER_LOG_PRINT_FN', headers='lber.h')
519 conf.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', 'ldap')
520 conf.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
522 # Check if ldap_set_rebind_proc() takes three arguments
523 if conf.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
524 'LDAP_SET_REBIND_PROC_ARGS',
525 msg="Checking whether ldap_set_rebind_proc takes 3 arguments",
526 headers='ldap.h lber.h', link=False):
527 conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
528 else:
529 conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
531 # last but not least, if ldap_init() exists, we want to use ldap
532 if conf.CONFIG_SET('HAVE_LDAP_INIT'):
533 conf.DEFINE('HAVE_LDAP', '1')
534 conf.DEFINE('LDAP_DEPRECATED', '1')
535 conf.env['HAVE_LDAP'] = '1'
536 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
537 # SASL wrapping hooks
538 if conf.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
539 conf.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
540 conf.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
541 else:
542 conf.SET_TARGET_TYPE('ldap', 'EMPTY')
543 conf.SET_TARGET_TYPE('lber', 'EMPTY')
545 if Options.options.with_ads:
546 use_ads=True
547 if not conf.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and \
548 not conf.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC'):
549 Logs.warn("arcfour-hmac-md5 encryption type not found in -lkrb5")
550 use_ads=False
551 if not conf.CONFIG_SET('HAVE_KRB5_MK_REQ_EXTENDED'):
552 Logs.warn("krb5_mk_req_extended not found in -lkrb5")
553 use_ads=False
554 if not conf.CONFIG_SET('HAVE_KRB5_GET_HOST_REALM'):
555 Logs.warn("krb5_get_host_realm not found in -lkrb5")
556 use_ads=False
557 if not conf.CONFIG_SET('HAVE_KRB5_FREE_HOST_REALM'):
558 Logs.warn("krb5_free_host_realm not found in -lkrb5")
559 use_ads=False
560 if not conf.CONFIG_SET('HAVE_KRB5_FWD_TGT_CREDS'):
561 Logs.warn("krb5_fwd_tgt_creds found in -lkrb5")
562 use_ads=False
563 if not conf.CONFIG_SET('HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC'):
564 Logs.warn("krb5_get_init_creds_opt_alloc not found in -lkrb5")
565 use_ads=False
566 if not conf.CONFIG_SET('KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT'):
567 Logs.warn("krb5_get_init_creds_opt_free was not found or was too old in -lkrb5")
568 use_ads=False
569 if not conf.CONFIG_SET('HAVE_KRB5_GET_RENEWED_CREDS'):
570 Logs.warn("krb5_get_renewed_creds not found in -lkrb5")
571 use_ads=False
572 if not conf.CONFIG_SET('HAVE_KRB5_PRINCIPAL_COMPARE_ANY_REALM'):
573 Logs.warn("krb5_principal_compare_any_realm not found in -lkrb5")
574 use_ads=False
575 if not conf.CONFIG_SET('HAVE_KRB5_C_STRING_TO_KEY') and \
576 not conf.CONFIG_SET('HAVE_KRB5_STRING_TO_KEY_SALT'):
577 Logs.warn("krb5_c_string_to_key not found in -lkrb5")
578 use_ads=False
579 if not conf.CONFIG_SET('HAVE_KRB5_PRINCIPAL2SALT') and \
580 not conf.CONFIG_SET('HAVE_KRB5_GET_PW_SALT'):
581 Logs.warn("no CREATE_KEY_FUNCTIONS detected")
582 use_ads=False
583 if not conf.CONFIG_SET('HAVE_KRB5_GET_PERMITTED_ENCTYPES') and \
584 not conf.CONFIG_SET('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES'):
585 Logs.warn("no GET_ENCTYPES_FUNCTIONS detected")
586 use_ads=False
587 if not conf.CONFIG_SET('HAVE_KRB5_KT_FREE_ENTRY') and \
588 not conf.CONFIG_SET('HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS'):
589 Logs.warn("no KT_FREE_FUNCTION detected")
590 use_ads=False
591 if not conf.CONFIG_SET('HAVE_KRB5_C_VERIFY_CHECKSUM'):
592 Logs.warn("krb5_c_verify_checksum_compare not found in -lkrb5")
593 use_ads=False
595 # We don't actually use
596 # gsskrb5_extract_authz_data_from_sec_context, but it is a
597 # clue that this Heimdal, which does the PAC processing we
598 # need on the standard gss_inquire_sec_context_by_oid
599 if not conf.CONFIG_SET('HAVE_GSS_GET_NAME_ATTRIBUTE') and \
600 not (conf.CONFIG_SET('HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT') and \
601 conf.CONFIG_SET('HAVE_GSS_INQUIRE_SEC_CONTEXT_BY_OID')):
602 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")
603 use_ads=False
605 if not conf.CONFIG_SET('HAVE_GSS_KRB5_EXPORT_LUCID_SEC_CONTEXT'):
606 Logs.warn("need gss_krb5_export_lucid_sec_context for SPNEGO and gss_wrap support")
607 use_ads=False
609 if use_ads:
610 conf.DEFINE('WITH_ADS', '1')
611 conf.DEFINE('HAVE_KRB5', '1')
612 if conf.CONFIG_SET('HAVE_LDAP'):
613 conf.env['HAVE_ADS'] = '1'
614 else:
615 Logs.warn("krb5 libs don't have all features required for Active Directory support")
616 conf.undefine('HAVE_KRB5_H')
617 conf.undefine('HAVE_GSSAPI_H')
618 conf.undefine('HAVE_GSSAPI_GSSAPI_GENERIC_H')
619 conf.undefine('HAVE_GSSAPI_GSSAPI_H')
621 if Options.options.with_utmp:
622 conf.env.with_utmp = True
623 if not conf.CHECK_HEADERS('utmp.h'): conf.env.with_utmp = False
624 conf.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
625 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers='utmp.h',
626 define='HAVE_UT_UT_NAME')
627 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers='utmp.h',
628 define='HAVE_UT_UT_USER')
629 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers='utmp.h',
630 define='HAVE_UT_UT_ID')
631 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers='utmp.h',
632 define='HAVE_UT_UT_HOST')
633 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers='utmp.h',
634 define='HAVE_UT_UT_TIME')
635 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers='utmp.h',
636 define='HAVE_UT_UT_TV')
637 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers='utmp.h',
638 define='HAVE_UT_UT_TYPE')
639 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers='utmp.h',
640 define='HAVE_UT_UT_PID')
641 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers='utmp.h',
642 define='HAVE_UT_UT_EXIT')
643 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr_v6', headers='utmp.h',
644 define='HAVE_UT_UT_ADDR_V6')
645 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr', headers='utmp.h',
646 define='HAVE_UT_UT_ADDR')
647 conf.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers='utmpx.h',
648 define='HAVE_UX_UT_SYSLEN')
649 conf.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
650 'PUTUTLINE_RETURNS_UTMP', headers='utmp.h',
651 msg="Checking whether pututline returns pointer")
652 if conf.env.with_utmp:
653 conf.DEFINE('WITH_UTMP', 1)
655 if Options.options.with_avahi:
656 conf.env.with_avahi = True
657 if not conf.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf.env.with_avahi = False
658 if not conf.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf.env.with_avahi = False
659 if not conf.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf.env.with_avahi = False
660 if conf.env.with_avahi:
661 conf.DEFINE('WITH_AVAHI_SUPPORT', 1)
662 else:
663 conf.SET_TARGET_TYPE('avahi-common', 'EMPTY')
664 conf.SET_TARGET_TYPE('avahi-client', 'EMPTY')
666 if Options.options.with_iconv:
667 conf.env.with_iconv = True
668 if not conf.CHECK_FUNCS_IN('iconv_open', 'iconv', headers='iconv.h'):
669 conf.env.with_iconv = False
670 if conf.env.with_iconv:
671 conf.DEFINE('HAVE_ICONV', 1)
673 if Options.options.with_pam:
674 use_pam=True
675 conf.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
676 if not conf.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
677 Logs.warn("--with-pam=yes but pam_appl.h not found")
678 use_pam=False
679 conf.CHECK_FUNCS_IN('pam_get_data', 'pam')
680 conf.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h')
681 if not conf.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'):
682 Logs.warn("--with-pam=yes but pam_modules.h not found")
683 use_pam=False
684 conf.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h')
685 conf.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h')
686 conf.CHECK_FUNCS_IN('pam_vsyslog', 'pam')
687 conf.CHECK_CODE('''
688 #if defined(HAVE_SECURITY_PAM_APPL_H)
689 #include <security/pam_appl.h>
690 #elif defined(HAVE_PAM_PAM_APPL_H)
691 #include <pam/pam_appl.h>
692 #endif
693 pam_set_item(0, PAM_RHOST, 0);
694 ''',
695 'HAVE_PAM_RHOST',
696 lib='pam',
697 msg="Checking whether PAM_RHOST is available");
698 conf.CHECK_CODE('''
699 #if defined(HAVE_SECURITY_PAM_APPL_H)
700 #include <security/pam_appl.h>
701 #elif defined(HAVE_PAM_PAM_APPL_H)
702 #include <pam/pam_appl.h>
703 #endif
704 pam_set_item(0, PAM_TTY, 0);
705 ''',
706 'HAVE_PAM_TTY',
707 lib='pam',
708 msg="Checking whether PAM_TTY is available");
709 conf.CHECK_CODE('''
710 #if (!defined(LINUX))
712 #define PAM_EXTERN extern
713 #if defined(HAVE_SECURITY_PAM_APPL_H)
714 #include <security/pam_appl.h>
715 #elif defined(HAVE_PAM_PAM_APPL_H)
716 #include <pam/pam_appl.h>
717 #endif
719 #endif
721 #if defined(HAVE_SECURITY_PAM_MODULES_H)
722 #include <security/pam_modules.h>
723 #elif defined(HAVE_PAM_PAM_MODULES_H)
724 #include <pam/pam_modules.h>
725 #endif
727 #if defined(HAVE_SECURITY__PAM_MACROS_H)
728 #include <security/_pam_macros.h>
729 #elif defined(HAVE_PAM__PAM_MACROS_H)
730 #include <pam/_pam_macros.h>
731 #endif
733 #ifdef HAVE_SECURITY_PAM_EXT_H
734 #include <security/pam_ext.h>
735 #endif
737 int i; i = PAM_RADIO_TYPE;
738 ''',
739 'HAVE_PAM_RADIO_TYPE',
740 lib='pam',
741 msg="Checking whether PAM_RADIO_TYPE is available");
742 if use_pam:
743 conf.DEFINE('WITH_PAM', 1)
744 conf.DEFINE('WITH_PAM_MODULES', 1)
746 seteuid = False
747 if not seteuid:
748 seteuid = conf.CHECK_CODE('''
749 #define AUTOCONF_TEST 1
750 #define USE_SETREUID 1
751 #include "./lib/util_sec.c"
752 ''',
753 'USE_SETREUID',
754 addmain=False,
755 execute=True,
756 msg="Checking whether setreuid is available")
757 if not seteuid:
758 seteuid = conf.CHECK_CODE('''
759 #define AUTOCONF_TEST 1
760 #define USE_SETRESUID 1
761 #include "./lib/util_sec.c"
762 ''',
763 'USE_SETRESUID',
764 addmain=False,
765 execute=True,
766 msg="Checking whether setresuid is available")
767 if not seteuid:
768 seteuid = conf.CHECK_CODE('''
769 #define AUTOCONF_TEST 1
770 #define USE_SETEUID 1
771 #include "./lib/util_sec.c"
772 ''',
773 'USE_SETEUID',
774 addmain=False,
775 execute=True,
776 msg="Checking whether seteuid is available")
777 if not seteuid:
778 seteuid = conf.CHECK_CODE('''
779 #define AUTOCONF_TEST 1
780 #define USE_SETUIDX 1
781 #include "./lib/util_sec.c"
782 ''',
783 'USE_SETUIDX',
784 addmain=False,
785 execute=True,
786 mandatory=True,
787 msg="Checking whether setuidx is available")
788 if Options.options.with_dnsupdate:
789 conf.CHECK_HEADERS('uuid/uuid.h')
790 conf.CHECK_FUNCS_IN('uuid_generate', 'uuid')
791 if not conf.CONFIG_SET('HAVE_UUID_UUID_H') and not conf.CONFIG_SET('HAVE_UUID_GENERATE'):
792 Logs.warn("--with-dnsupdate=yes but uuid support not sufficient")
793 elif not conf.CONFIG_SET('HAVE_KRB5'):
794 Logs.warn("--with-dnsupdate=yes but gssapi support not sufficient")
795 else:
796 conf.DEFINE('WITH_DNS_UPDATES', 1)
797 else:
798 conf.SET_TARGET_TYPE('uuid', 'EMPTY')
799 conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
800 if Options.options.developer:
801 if conf.CONFIG_SET('HAVE_VALGRIND_H') or conf.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'):
802 conf.DEFINE('VALGRIND', '1')
804 if conf.CHECK_CODE('''
805 #include <bits/sockaddr.h>
806 #include <linux/netlink.h>
807 ''',
808 'HAVE_LINUX_NETLINK_H',
809 msg="Checking whether Linux netlink is available"):
810 conf.CHECK_CODE('''
811 #include <bits/sockaddr.h>
812 #include <linux/netlink.h>
813 #include <linux/rtnetlink.h>
814 ''',
815 'HAVE_LINUX_RTNETLINK_H',
816 msg='Checking whether Linux rtnetlink is available')
817 conf.CHECK_CODE('''
818 #include "../tests/fcntl_lock.c"
819 ''',
820 'HAVE_FCNTL_LOCK',
821 addmain=False,
822 execute=True,
823 msg='Checking whether fcntl locking is available')
825 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec',
826 define='HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') # Linux, Solaris
827 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimensec',
828 define='HAVE_STRUCT_STAT_ST_MTIMENSEC') # BSD, if defined _POSIX_SOURCE
829 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimespec.tv_nsec',
830 define='HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') # BSD, if not defined _POSIX_SOURCE
831 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtime_n',
832 define='HAVE_STRUCT_STAT_ST_MTIME_N') # AIX
833 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_umtime',
834 define='HAVE_STRUCT_STAT_ST_UMTIME') # Tru64
835 if conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') or \
836 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMENSEC') or \
837 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') or \
838 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIME_N') or \
839 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_UMTIME'):
840 conf.DEFINE('HAVE_STAT_HIRES_TIMESTAMPS', '1')
842 # recent FreeBSD, NetBSD have creation timestamps called birthtime:
843 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtime',
844 define='HAVE_STRUCT_STAT_ST_BIRTHTIME')
845 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimespec.tv_nsec',
846 define='HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC')
847 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimensec',
848 define='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC')
850 conf.CHECK_CODE('''
851 ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
852 ''',
853 'HAVE_POSIX_FADVISE',
854 msg='Checking whether posix_fadvise is available',
855 headers='unistd.h fcntl.h')
857 for v in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]:
858 conf.CHECK_CODE('''
859 #include <unistd.h>
860 return sysconf(%s) == -1 ? 1 : 0;
861 ''' % v,
862 'SYSCONF%s' % v,
863 msg='Checking whether sysconf(%s) is available' % v)
865 conf.CHECK_CODE('''
866 #include <sys/syscall.h>
867 #include <unistd.h>
868 syscall(SYS_initgroups, 16, NULL, NULL, 0);
869 ''',
870 'HAVE_DARWIN_INITGROUPS',
871 msg='Checking whether to use the Darwin-specific initgroups system call')
873 conf.CHECK_CODE('''struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''',
874 'HAVE_UTIMBUF',
875 headers='sys/types.h utime.h',
876 msg='Checking whether struct utimbuf is available')
878 if conf.CHECK_CODE('''struct sigevent s;''',
879 'HAVE_STRUCT_SIGEVENT',
880 headers='sys/types.h stdlib.h stddef.h signal.h',
881 msg='Checking whether we have the struct sigevent'):
882 conf.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sival_ptr',
883 define='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR',
884 headers='signal.h');
885 conf.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sigval_ptr',
886 define='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR',
887 headers='signal.h');
889 if os.path.exists('/proc/sys/kernel/core_pattern'):
890 conf.DEFINE('HAVE_SYS_KERNEL_PROC_CORE_PATTERN', '1')
892 if conf.CHECK_CODE('''
893 #include <time.h>
894 main() {
895 struct tm *tm;
896 if (sizeof(time_t) == 8) {
897 time_t max_time = 0x7fffffffffffffffll;
898 tm = gmtime(&max_time);
899 /* This should fail with 32-bit tm_year. */
900 if (tm == NULL) {
901 /* Max time_t that works with 32-bit int tm_year in struct tm. */
902 max_time = 67768036191676799ll;
903 tm = gmtime(&max_time);
904 if (tm) {
905 exit(0);
909 exit(1);
910 }''',
911 '__TIME_T_MAX',
912 addmain=False,
913 execute=True,
914 msg="Checking for the maximum value of the 'time_t' type"):
915 conf.DEFINE('TIME_T_MAX', '67768036191676799ll')
917 conf.CHECK_CODE('''
918 #if defined(HAVE_UNISTD_H)
919 #include <unistd.h>
920 #endif
921 #include <sys/types.h>
922 main() { dev_t dev = makedev(1,2); return 0; }
923 ''',
924 'HAVE_MAKEDEV',
925 addmain=False,
926 msg='Checking whether the macro for makedev is available')
928 conf.CHECK_CODE('''
929 #include <stdio.h>
930 #include <limits.h>
931 #include <signal.h>
933 void exit_on_core(int ignored) {
934 exit(1);
937 main() {
938 char *newpath;
939 signal(SIGSEGV, exit_on_core);
940 newpath = realpath("/tmp", NULL);
941 exit((newpath != NULL) ? 0 : 1);
943 ''',
944 'REALPATH_TAKES_NULL',
945 addmain=False,
946 execute=True,
947 msg='Checking whether the realpath function allows a NULL argument')
949 conf.CHECK_CODE('''#include "../tests/ftruncate.c"''',
950 'HAVE_FTRUNCATE_EXTEND',
951 msg='Checking for ftruncate extend',
952 addmain=False,
953 execute=True)
954 if os.getenv('RUN_FROM_BUILD_FARM'):
955 Logs.info("enabling buildfarm hacks")
956 conf.DEFINE('ENABLE_BUILD_FARM_HACKS', '1')
958 if Options.options.with_sendfile_support:
959 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):
960 conf.CHECK_CODE('''
961 int tofd, fromfd;
962 off_t offset;
963 size_t total;
964 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
965 ''',
966 '_HAVE_SENDFILE',
967 headers='sys/sendfile',
968 msg='Checking for linux sendfile support')
970 # Try and cope with broken Linux sendfile....
971 conf.CHECK_CODE('''#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
972 #undef _FILE_OFFSET_BITS
973 #endif
974 #include <sys/sendfile.h>
975 int tofd, fromfd;
976 off_t offset;
977 size_t total;
978 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
979 ''',
980 '_HAVE_BROKEN_LINUX_SENDFILE',
981 msg='Checking for broken linux sendfile support')
982 if conf.CONFIG_SET('_HAVE_SENDFILE'):
983 conf.DEFINE('HAVE_SENDFILE', '1')
984 conf.DEFINE('LINUX_SENDFILE_API', '1')
985 conf.DEFINE('WITH_SENDFILE', '1')
986 elif conf.CONFIG_SET('_HAVE_BROKEN_LINUX_SENDFILE'):
987 conf.DEFINE('LINUX_BROKEN_SENDFILE_API', '1')
988 conf.DEFINE('WITH_SENDFILE', '1')
989 elif (host_os.rfind('freebsd') > -1) or (host_os.rfind('dragonfly') > -1):
990 conf.CHECK_CODE('''
991 #include <sys/types.h>
992 #include <unistd.h>
993 #include <sys/socket.h>
994 #include <sys/uio.h>
995 int fromfd, tofd, ret, total=0;
996 off_t offset, nwritten;
997 struct sf_hdtr hdr;
998 struct iovec hdtrl;
999 hdr.headers = &hdtrl;
1000 hdr.hdr_cnt = 1;
1001 hdr.trailers = NULL;
1002 hdr.trl_cnt = 0;
1003 hdtrl.iov_base = NULL;
1004 hdtrl.iov_len = 0;
1005 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0)
1006 ''',
1007 '_HAVE_SENDFILE',
1008 msg='Checking for freebsd sendfile support')
1009 if conf.CONFIG_SET('_HAVE_SENDFILE'):
1010 conf.DEFINE('HAVE_SENDFILE', '1')
1011 conf.DEFINE('FREEBSD_SENDFILE_API', '1')
1012 conf.DEFINE('WITH_SENDFILE', '1')
1013 elif (host_os.rfind('hpux') > -1):
1014 conf.CHECK_CODE('''
1015 #include <sys/socket.h>
1016 #include <sys/uio.h>
1017 int fromfd, tofd;
1018 size_t total=0;
1019 struct iovec hdtrl[2];
1020 ssize_t nwritten;
1021 off_t offset;
1022 hdtrl[0].iov_base = 0;
1023 hdtrl[0].iov_len = 0;
1024 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
1025 ''',
1026 '_HAVE_SENDFILE',
1027 msg='Checking for hpux sendfile support')
1028 if conf.CONFIG_SET('_HAVE_SENDFILE'):
1029 conf.DEFINE('HAVE_SENDFILE', '1')
1030 conf.DEFINE('HPUX_SENDFILE_API', '1')
1031 conf.DEFINE('WITH_SENDFILE', '1')
1032 elif (host_os.rfind('solaris') > -1):
1033 conf.CHECK_FUNCS_IN('sendfile', 'sendfilev')
1034 conf.CHECK_CODE('''
1035 #include <sys/sendfile.h>,
1036 int sfvcnt;
1037 size_t xferred;
1038 struct sendfilevec vec[2];
1039 ssize_t nwritten;
1040 int tofd;
1041 sfvcnt = 2;
1042 vec[0].sfv_fd = SFV_FD_SELF;
1043 vec[0].sfv_flag = 0;
1044 vec[0].sfv_off = 0;
1045 vec[0].sfv_len = 0;
1046 vec[1].sfv_fd = 0;
1047 vec[1].sfv_flag = 0;
1048 vec[1].sfv_off = 0;
1049 vec[1].sfv_len = 0;
1050 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
1051 ''',
1052 '_HAVE_SENDFILEV',
1053 msg='Checking for solaris sendfilev support')
1054 if conf.CONFIG_SET('_HAVE_SENDFILEV'):
1055 conf.DEFINE('HAVE_SENDFILEV', '1')
1056 conf.DEFINE('SOLARIS_SENDFILE_API', '1')
1057 conf.DEFINE('WITH_SENDFILE', '1')
1058 elif (host_os.rfind('aix') > -1):
1059 conf.CHECK_CODE('''
1060 #include <sys/socket.h>
1061 int fromfd, tofd;
1062 size_t total=0;
1063 struct sf_parms hdtrl;
1064 ssize_t nwritten;
1065 hdtrl.header_data = 0;
1066 hdtrl.header_length = 0;
1067 hdtrl.file_descriptor = fromfd;
1068 hdtrl.file_offset = 0;
1069 hdtrl.file_bytes = 0;
1070 hdtrl.trailer_data = 0;
1071 hdtrl.trailer_length = 0;
1072 nwritten = send_file(&tofd, &hdtrl, 0);
1073 ''',
1074 '_HAVE_SENDFILE',
1075 msg='Checking for AIX send_file support')
1076 if conf.CONFIG_SET('_HAVE_SENDFILE'):
1077 conf.DEFINE('HAVE_SENDFILE', '1')
1078 conf.DEFINE('AIX_SENDFILE_API', '1')
1079 conf.DEFINE('WITH_SENDFILE', '1')
1081 # Check for getcwd allowing a NULL arg.
1082 conf.CHECK_CODE('''
1083 #include <unistd.h>
1084 main() {
1085 char *s = getcwd(NULL,0);
1086 exit(s != NULL ? 0 : 1);
1087 }''', 'GETCWD_TAKES_NULL', addmain=False, execute=True,
1088 msg="getcwd takes a NULL argument")
1091 # UnixWare 7.x has its getspnam in -lgen
1092 conf.CHECK_FUNCS_IN('getspnam', 'gen')
1093 conf.CHECK_FUNCS_IN('getspnam', 'security')
1094 conf.CHECK_FUNCS_IN('getspnam', 'sec')
1096 if Options.options.with_quotas:
1097 # For quotas on Veritas VxFS filesystems
1098 conf.CHECK_HEADERS('sys/fs/vx_quota.h')
1099 # For quotas on Linux XFS filesystems
1100 conf.CHECK_HEADERS('linux/dqblk_xfs.h')
1101 # For sys/quota.h and linux/quota.h
1102 conf.CHECK_HEADERS('sys/quota.h')
1106 # checking for clustering extensions (CTDB)
1108 if not Options.options.with_cluster_support:
1109 have_cluster_support = False
1111 else:
1113 if Options.options.ctdb_dir:
1114 conf.ADD_EXTRA_INCLUDES(Options.options.ctdb_dir + '/include')
1116 srcdir = os.path.realpath(conf.srcdir)
1117 if 'EXTRA_INCLUDES' in conf.env:
1118 includes = ' '.join(conf.env['EXTRA_INCLUDES']).replace('#', srcdir + '/')
1119 else:
1120 includes = ''
1122 have_cluster_support = True
1123 ctdb_broken = ""
1125 conf.CHECK_CODE('''
1126 #define NO_CONFIG_H
1127 #include "replace.h"
1128 #include "system/wait.h"
1129 #include "system/network.h"
1130 #define private #error __USED_RESERVED_WORD_private__
1131 #include <talloc.h>
1132 #include <tdb.h>
1133 #include <ctdb.h>
1135 int main(void)
1137 return 0;
1139 ''',
1140 'HAVE_CTDB_H',
1141 addmain=False,
1142 includes=includes,
1143 msg='Checking for header ctdb.h')
1145 if not conf.CONFIG_SET('HAVE_CTDB_H'):
1146 have_cluster_support = False
1147 ctdb_broken = "ctdb.h is required for cluster support"
1149 if have_cluster_support:
1150 conf.CHECK_CODE('''
1151 #define NO_CONFIG_H
1152 #include "replace.h"
1153 #include "system/wait.h"
1154 #include "system/network.h"
1155 #define private #error __USED_RESERVED_WORD_private__
1156 #include <talloc.h>
1157 #include <tdb.h>
1158 #include <ctdb.h>
1159 #include <ctdb_private.h>
1161 int main(void)
1163 return 0;
1165 ''',
1166 'HAVE_CTDB_PRIVATE_H',
1167 addmain=False,
1168 includes=includes,
1169 msg='Checking for header ctdb_private.h')
1171 if not conf.CONFIG_SET('HAVE_CTDB_PRIVATE_H'):
1172 have_cluster_support = False
1173 ctdb_broken = "ctdb_private.h is required for cluster support"
1175 if have_cluster_support:
1176 conf.CHECK_CODE('''
1177 #define NO_CONFIG_H
1178 #include "replace.h"
1179 #include "system/wait.h"
1180 #include "system/network.h"
1181 #include <talloc.h>
1182 #include <tdb.h>
1183 #include <ctdb.h>
1184 #include <ctdb_private.h>
1186 int main(void)
1188 int i = (int)CTDB_CONTROL_TRANS3_COMMIT;
1189 return 0;
1191 ''',
1192 'HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL',
1193 addmain=False,
1194 includes=includes,
1195 msg='Checking for transaction support (TRANS3_COMMIT control)')
1197 if not conf.CONFIG_SET('HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL'):
1198 have_cluster_support = False
1199 ctdb_broken = "ctdb transaction support missing or too old"
1201 if have_cluster_support:
1202 conf.CHECK_CODE('''
1203 #define NO_CONFIG_H
1204 #include "replace.h"
1205 #include "system/wait.h"
1206 #include "system/network.h"
1207 #include <talloc.h>
1208 #include <tdb.h>
1209 #include <ctdb.h>
1210 #include <ctdb_private.h>
1212 int main(void)
1214 int i = (int)CTDB_CONTROL_SCHEDULE_FOR_DELETION;
1215 return 0;
1217 ''',
1218 'HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL',
1219 addmain=False,
1220 includes=includes,
1221 msg='Checking for SCHEDULE_FOR_DELETION control')
1223 if not conf.CONFIG_SET('HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL'):
1224 if not Options.options.enable_old_ctdb:
1225 have_cluster_support = False
1226 ctdb_broken = "SCHEDULE_FOR_DELETION control missing"
1227 else:
1228 Logs.warn("ignoring missing SCHEDULE_FOR_DELETION control (--enable-old-ctdb)")
1230 if have_cluster_support:
1231 conf.CHECK_CODE('''
1232 #define NO_CONFIG_H
1233 #include "replace.h"
1234 #include "system/wait.h"
1235 #include "system/network.h"
1236 #include <talloc.h>
1237 #include <tdb.h>
1238 #include <ctdb.h>
1239 #include <ctdb_private.h>
1241 int main(void)
1243 struct ctdb_control_tcp _x;
1244 return 0;
1246 ''',
1247 'HAVE_STRUCT_CTDB_CONTROL_TCP',
1248 addmain=False,
1249 includes=includes,
1250 msg='Checking for ctdb ipv4 support')
1252 if not conf.CONFIG_SET('HAVE_STRUCT_CTDB_CONTROL_TCP'):
1253 have_cluster_support = False
1254 ctdb_broken = "missing struct ctdb_control_tcp"
1256 if have_cluster_support:
1257 conf.CHECK_CODE('''
1258 #define NO_CONFIG_H
1259 #include "replace.h"
1260 #include "system/wait.h"
1261 #include "system/network.h"
1262 #include <talloc.h>
1263 #include <tdb.h>
1264 #include <ctdb.h>
1265 #include <ctdb_private.h>
1267 int main(void)
1269 struct ctdb_control_tcp_addr _x;
1270 return 0;
1272 ''',
1273 'HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR',
1274 addmain=False,
1275 includes=includes,
1276 msg='Checking for ctdb ipv6 support')
1278 if have_cluster_support:
1279 conf.CHECK_CODE('''
1280 #define NO_CONFIG_H
1281 #include "replace.h"
1282 #include "system/wait.h"
1283 #include "system/network.h"
1284 #include <talloc.h>
1285 #include <tdb.h>
1286 #include <ctdb.h>
1287 #include <ctdb_private.h>
1289 int main(void)
1291 int i = (int)CTDB_CONTROL_CHECK_SRVIDS;
1292 return 0;
1294 ''',
1295 'HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL',
1296 addmain=False,
1297 includes=includes,
1298 msg='Checking for CHECK_SRVIDS control')
1300 if not conf.CONFIG_SET('HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL'):
1301 if not Options.options.enable_old_ctdb:
1302 have_cluster_support = False
1303 ctdb_broken = "CHECK_SRVIDS control missing"
1304 else:
1305 Logs.warn("ignoring missing CHECK_SRVIDS control (--enable-old-ctdb)")
1307 if have_cluster_support:
1308 Logs.info("building with cluster support")
1309 conf.DEFINE('CLUSTER_SUPPORT', 1);
1310 else:
1311 if not Options.options.with_cluster_support:
1312 Logs.info("building without cluster support")
1313 else:
1314 Logs.warn("building without cluster support: " + ctdb_broken)
1315 conf.undefine('CLUSTER_SUPPORT')
1319 conf.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }',
1320 'HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR',
1321 addmain=False,
1322 link=False,
1323 msg='Checking whether we can compile with __attribute__((destructor))')
1325 conf.CHECK_CODE('void seekdir(DIR *d, long loc) { return; }',
1326 'SEEKDIR_RETURNS_VOID',
1327 headers='sys/types.h dirent.h',
1328 msg='Checking whether seekdir returns void')
1330 if Options.options.with_profiling_data:
1331 conf.DEFINE('WITH_PROFILE', 1);
1333 PTHREAD_CFLAGS='error'
1334 PTHREAD_LDFLAGS='error'
1336 if PTHREAD_LDFLAGS == 'error':
1337 if conf.CHECK_FUNCS_IN('pthread_attr_init', 'pthread'):
1338 PTHREAD_CFLAGS='-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS'
1339 PTHREAD_LDFLAGS='-lpthread'
1340 if PTHREAD_LDFLAGS == 'error':
1341 if conf.CHECK_FUNCS_IN('pthread_attr_init', 'pthreads'):
1342 PTHREAD_CFLAGS='-D_THREAD_SAFE'
1343 PTHREAD_LDFLAGS='-lpthreads'
1344 if PTHREAD_LDFLAGS == 'error':
1345 if conf.CHECK_FUNCS_IN('pthread_attr_init', 'c_r'):
1346 PTHREAD_CFLAGS='-D_THREAD_SAFE -pthread'
1347 PTHREAD_LDFLAGS='-pthread'
1348 if PTHREAD_LDFLAGS == 'error':
1349 if conf.CHECK_FUNC('pthread_attr_init'):
1350 PTHREAD_CFLAGS='-D_REENTRANT'
1351 PTHREAD_LDFLAGS='-lpthread'
1352 # especially for HP-UX, where the CHECK_FUNC macro fails to test for
1353 # pthread_attr_init. On pthread_mutex_lock it works there...
1354 if PTHREAD_LDFLAGS == 'error':
1355 if conf.CHECK_FUNCS_IN('pthread_mutex_lock', 'pthread'):
1356 PTHREAD_CFLAGS='-D_REENTRANT'
1357 PTHREAD_LDFLAGS='-lpthread'
1359 if PTHREAD_CFLAGS != 'error' and PTHREAD_LDFLAGS != 'error':
1360 conf.ADD_CFLAGS(PTHREAD_CFLAGS)
1361 conf.ADD_LDFLAGS(PTHREAD_LDFLAGS)
1362 conf.CHECK_HEADERS('pthread.h')
1363 conf.DEFINE('HAVE_PTHREAD', '1')
1365 if Options.options.with_pthreadpool:
1366 if conf.CONFIG_SET('HAVE_PTHREAD'):
1367 conf.DEFINE('WITH_PTHREADPOOL', '1')
1368 else:
1369 Logs.warn("pthreadpool support cannot be enabled when pthread support was not found")
1370 conf.undefine('WITH_PTHREADPOOL')
1372 if conf.CHECK_HEADERS('gpfs_gpl.h'):
1373 conf.DEFINE('HAVE_GPFS', '1')
1375 # Note that all charset 'modules' must actually be static, due to dependency loop issues
1376 # if we include the module loader in iconv
1378 default_static_modules=TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
1379 auth_sam auth_unix auth_winbind auth_wbc auth_server
1380 auth_domain auth_builtin vfs_default
1381 nss_info_template idmap_tdb idmap_passdb
1382 idmap_nss''')
1384 default_shared_modules=TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
1385 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
1386 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2
1387 auth_script vfs_readahead vfs_xattr_tdb vfs_posix_eadb
1388 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
1389 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
1390 vfs_crossrename vfs_linux_xfs_sgid
1391 vfs_time_audit idmap_autorid''')
1393 if Options.options.developer:
1394 default_static_modules.extend(TO_LIST('pdb_ads auth_netlogond charset_weird'))
1395 default_shared_modules.extend(TO_LIST('perfcount_test'))
1396 default_shared_modules.extend(TO_LIST('vfs_skel_opaque vfs_skel_transparent vfs_shadow_copy_test'))
1397 default_shared_modules.extend(TO_LIST('auth_skel pdb_test'))
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)