Fix the poll() backend to correctly respond to POLLHUP|POLLERR returns on a fd select...
[Samba.git] / source3 / wscript
bloba1043c811a31fabbd0ad25a44f1716e583130c3c
1 #! /usr/bin/env python
3 srcdir = '..'
4 blddir = 'bin'
6 APPNAME='samba'
7 VERSION=None
9 import sys, os
10 from optparse import SUPPRESS_HELP
11 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
12 sys.path.insert(0, "source3")
13 import wafsamba, Options, Logs, Utils, Scripting
14 import build.charset
15 import samba_utils, samba_version
16 import samba3
18 def set_options(opt):
19 if not os.getenv('TOPLEVEL_BUILD'):
20 opt.BUILTIN_DEFAULT('NONE')
21 opt.PRIVATE_EXTENSION_DEFAULT('s3')
22 opt.RECURSE('../lib/replace')
23 opt.RECURSE('build')
24 opt.RECURSE('selftest')
25 opt.RECURSE('../lib/nss_wrapper')
26 opt.RECURSE('../lib/socket_wrapper')
27 opt.RECURSE('../lib/tevent')
28 opt.RECURSE('../lib/tdb')
30 opt.add_option('--with-static-modules',
31 help=("Comma-separated list of names of modules to statically link in"),
32 action="store", dest='static_modules', default=None)
33 opt.add_option('--with-shared-modules',
34 help=("Comma-separated list of names of modules to build shared"),
35 action="store", dest='shared_modules', default=None)
36 opt.add_option('--enable-selftest',
37 help=("enable options necessary for selftest"),
38 action="store_true", dest='enable_selftest', default=False)
40 opt.SAMBA3_ADD_OPTION('winbind')
41 opt.SAMBA3_ADD_OPTION('swat')
42 opt.SAMBA3_ADD_OPTION('ads')
43 opt.SAMBA3_ADD_OPTION('krb5')
44 opt.SAMBA3_ADD_OPTION('ldap')
45 opt.SAMBA3_ADD_OPTION('cups', with_name="enable", without_name="disable")
46 opt.SAMBA3_ADD_OPTION('iprint', with_name="enable", without_name="disable")
47 opt.SAMBA3_ADD_OPTION('merged-build', with_name="enable", without_name="disable")
48 opt.SAMBA3_ADD_OPTION('pam')
49 opt.SAMBA3_ADD_OPTION('pam_smbpass')
50 opt.SAMBA3_ADD_OPTION('quotas')
51 opt.SAMBA3_ADD_OPTION('sys-quotas')
52 opt.SAMBA3_ADD_OPTION('sendfile-support')
53 opt.SAMBA3_ADD_OPTION('utmp')
54 opt.SAMBA3_ADD_OPTION('pthreadpool', with_name="enable", without_name="disable")
55 opt.SAMBA3_ADD_OPTION('avahi', with_name="enable", without_name="disable")
56 opt.SAMBA3_ADD_OPTION('iconv')
57 opt.SAMBA3_ADD_OPTION('acl-support')
58 opt.SAMBA3_ADD_OPTION('dnsupdate')
59 opt.SAMBA3_ADD_OPTION('syslog')
60 opt.SAMBA3_ADD_OPTION('automount')
61 opt.SAMBA3_ADD_OPTION('aio-support')
62 opt.SAMBA3_ADD_OPTION('profiling-data')
64 opt.SAMBA3_ADD_OPTION('cluster-support')
66 opt.add_option('--with-ctdb-dir',
67 help=("Directory under which ctdb is installed"),
68 action="store", dest='ctdb_dir', default=None)
69 opt.add_option('--enable-old-ctdb',
70 help=("enable building against (too) old version of ctdb (default=false)"),
71 action="store_true", dest='enable_old_ctdb', default=False)
75 def configure(conf):
76 from samba_utils import TO_LIST
78 if not conf.env.toplevel_build:
79 version = samba_version.load_version(env=conf.env)
80 conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
81 conf.DEFINE('_SAMBA_BUILD_', version.MAJOR, add_to_cflags=True)
82 conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
84 if Options.options.developer:
85 conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
86 conf.env.developer = True
88 if Options.options.with_swat:
89 conf.env['build_swat'] = True
91 if not conf.env.toplevel_build:
92 conf.RECURSE('../lib/replace')
93 conf.RECURSE('build')
94 conf.RECURSE('../lib/tdb')
95 conf.RECURSE('../lib/talloc')
96 conf.RECURSE('../lib/tevent')
97 conf.RECURSE('../lib/popt')
98 conf.RECURSE('../lib/nss_wrapper')
99 conf.RECURSE('../lib/socket_wrapper')
100 conf.RECURSE('../lib/zlib')
101 conf.RECURSE('../libcli/smbreadline')
102 conf.RECURSE('../lib/util')
104 conf.ADD_EXTRA_INCLUDES('''#source3 #source3/include #lib/replace''')
105 if not conf.env.USING_SYSTEM_TDB:
106 conf.ADD_EXTRA_INCLUDES('#lib/tdb/include')
107 if not conf.env.USING_SYSTEM_TEVENT:
108 conf.ADD_EXTRA_INCLUDES('#lib/tevent')
109 if not conf.env.USING_SYSTEM_TALLOC:
110 conf.ADD_EXTRA_INCLUDES('#lib/talloc')
111 if not conf.env.USING_SYSTEM_POPT:
112 conf.ADD_EXTRA_INCLUDES('#lib/popt')
114 conf.ADD_LDFLAGS("-Wl,--export-dynamic", testflags=True)
116 conf.CHECK_HEADERS('execinfo.h libexc.h libunwind.h netdb.h')
117 conf.CHECK_HEADERS('linux/falloc.h')
119 conf.CHECK_FUNCS('getcwd fchown chmod fchmod mknod mknod64')
120 conf.CHECK_FUNCS('strtol strchr strupr chflags')
121 conf.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
122 conf.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
123 conf.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr')
124 conf.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
125 conf.CHECK_FUNCS('setpriv setgidx setuidx setgroups sysconf stat64 fstat64')
126 conf.CHECK_FUNCS('lstat64 fopen64 atexit grantpt lseek64 ftruncate64 fallocate fallocate64 posix_fallocate posix_fallocate64')
127 conf.CHECK_FUNCS('fseek64 fseeko64 ftell64 ftello64 setluid')
128 conf.CHECK_FUNCS('getpwnam', headers='sys/types.h pwd.h')
129 conf.CHECK_FUNCS('opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64')
130 conf.CHECK_FUNCS('fdopendir fdopendir64')
131 conf.CHECK_FUNCS('getpwent_r getdents64 setenv strcasecmp fcvt fcvtl')
132 conf.CHECK_FUNCS('syslog vsyslog timegm setlocale nl_langinfo')
133 conf.CHECK_FUNCS_IN('nanosleep', 'rt')
134 conf.CHECK_FUNCS('lutimes futimes utimensat futimens')
135 conf.CHECK_FUNCS('mlock munlock mlockall munlockall')
136 conf.CHECK_FUNCS('memalign posix_memalign hstrerror')
137 conf.CHECK_FUNCS('shmget')
138 conf.CHECK_FUNCS_IN('shm_open', 'rt', checklibc=True)
139 conf.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain')
140 #FIXME: for some reason this one still fails
141 conf.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
142 conf.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
143 conf.CHECK_DECLS('fdatasync', reverse=True)
144 conf.CHECK_DECLS('readahead', reverse=True, headers='fcntl.h')
146 if conf.CONFIG_SET('HAVE_LONG_LONG'):
147 conf.DEFINE('HAVE_LONGLONG', 1)
149 if conf.CHECK_CODE('''
150 #if defined(HAVE_UNISTD_H)
151 #include <unistd.h>
152 #endif
153 long ret = splice(0,0,1,0,400,0);
154 ''',
155 'HAVE_LINUX_SPLICE',
156 headers='fcntl.h'):
157 conf.CHECK_DECLS('splice', reverse=True, headers='fcntl.h')
159 # Check for inotify support
160 conf.CHECK_HEADERS('linux/inotify.h asm/unistd.h sys/inotify.h')
161 conf.CHECK_FUNCS('inotify_init')
162 if "HAVE_LINUX_INOTIFY_H" in conf.env and "HAVE_INOTIFY_INIT" in conf.env:
163 conf.DEFINE('HAVE_INOTIFY', 1)
165 # Check for kernel change notify support
166 conf.CHECK_CODE('''
167 #ifndef F_NOTIFY
168 #define F_NOTIFY 1026
169 #endif
170 main() {
171 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
172 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain=False, execute=True,
173 headers='fcntl.h signal.h',
174 msg="Checking for kernel change notify support")
176 # Check for Linux kernel oplocks
177 conf.CHECK_CODE('''
178 #include <sys/types.h>
179 #include <fcntl.h>
180 #include <signal.h>
181 #ifndef F_NOTIFY
182 #define F_NOTIFY 1026
183 #endif
184 main() {
185 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
186 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain=False, execute=True,
187 msg="Checking for Linux kernel oplocks")
189 # Check for IRIX kernel oplock types
190 conf.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
191 'HAVE_KERNEL_OPLOCKS_IRIX', headers='fcntl.h',
192 msg="Checking for IRIX kernel oplock types")
194 # Check for kernel share modes
195 conf.CHECK_CODE('''
196 #include <sys/types.h>
197 #include <fcntl.h>
198 #include <signal.h>
199 #include <sys/file.h>
200 #ifndef LOCK_MAND
201 #define LOCK_MAND 32
202 #define LOCK_READ 64
203 #endif
204 main() {
205 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
206 }''', 'HAVE_KERNEL_SHARE_MODES', addmain=False, execute=True,
207 msg="Checking for krenel share modes")
209 # Check for various members of the stat structure
210 conf.CHECK_TYPES('blksize_t blkcnt_t')
211 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define='HAVE_STAT_ST_BLOCKS',
212 headers='sys/stat.h')
213 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define='HAVE_STAT_ST_BLKSIZE',
214 headers='sys/stat.h')
215 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_flags', define='HAVE_STAT_ST_FLAGS',
216 headers='sys/types.h sys/stat.h unistd.h')
218 # Check for POSIX capability support
219 conf.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers='sys/capability.h')
221 if "HAVE_SYS_CAPABILITY_H" in conf.env:
222 conf.CHECK_CODE('''
223 cap_t cap;
224 cap_value_t vals[1];
225 if (!(cap = cap_get_proc())) exit(1);
226 vals[0] = CAP_CHOWN;
227 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
228 cap_set_proc(cap);''',
229 'HAVE_POSIX_CAPABILITIES', execute=True, lib="cap",
230 headers='sys/capability.h',
231 msg="Checking whether POSIX capabilities are available")
233 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
234 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
235 # -- JRA.
236 if conf.CONFIG_SET("HAVE_RPC_RPC_H"):
237 conf.CHECK_TYPE('int16', headers='rpc/rpc.h',
238 define='HAVE_INT16_FROM_RPC_RPC_H',
239 msg="Checking for int16 typedef included by rpc/rpc.h")
240 conf.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
241 headers='sys/types.h rpc/rpc.h',
242 msg="Checking for uint16 typedef included by rpc/rpc.h")
243 conf.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
244 headers='sys/types.h rpc/rpc.h',
245 msg="Checking for int32 typedef included by rpc/rpc.h")
246 conf.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
247 headers='sys/types.h rpc/rpc.h',
248 msg="Checking for uint32 typedef included by rpc/rpc.h")
249 conf.CHECK_CODE('int i;', 'BROKEN_NISPLUS_INCLUDE_FILES',
250 headers='sys/types.h sys/acl.h rpcsvc/nis.h',
251 msg="Checking for broken nisplus include files")
253 # Check if the compiler will optimize out functions
254 conf.CHECK_CODE('''
255 if (0) {
256 this_function_does_not_exist();
257 } else {
258 return 1;
259 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
260 msg="Checking if the compiler will optimize out functions")
262 # Check if the compiler supports the LL suffix on long long integers
263 # AIX needs this
264 conf.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL',
265 headers='stdio.h',
266 msg="Checking for LL suffix on long long integers")
268 conf.CHECK_FUNCS('''
269 _acl __acl add_proplist_entry atexit attr_getf attr_list attr_listf
270 attropen attr_remove attr_removef attr_set attr_setf backtrace_symbols
271 bindtextdomain _chdir __chdir chflags chmod _close __close _closedir
272 __closedir closedir64 creat64 crypt16 delproplist devnm dgettext dirfd
273 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
274 extattr_delete_fd extattr_delete_link extattr_get_fd extattr_get_file
275 extattr_get_link extattr_list_fd extattr_list_file extattr_list_link
276 extattr_set_fd extattr_set_file extattr_set_link _facl __facl _fchdir
277 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
278 fdelproplist fgetea fgetproplist fgetxattr flistea flistxattr fopen64
279 _fork __fork fremoveea fremovexattr fseek64 fseeko64 fsetea
280 fsetproplist fsetxattr _fstat __fstat fstat64 _fstat64 __fstat64 fsync
281 ftell64 ftello64 ftruncate64 futimens futimes __fxstat getauthuid
282 getcwd _getcwd __getcwd getdents __getdents getdents64 getdirentries
283 getgrent getgrnam getgrouplist getgrset getmntent getpagesize
284 getproplist get_proplist_entry getpwanam getpwent_r getrlimit gettext
285 glob grantpt hstrerror initgroups innetgr
286 inotify_init lgetea lgetxattr listea listxattr llistea llistxattr
287 llseek _llseek __llseek lremoveea lremovexattr _lseek __lseek lseek64
288 lsetea lsetxattr _lstat __lstat lstat64 _lstat64 __lstat64 lutimes
289 __lxstat memalign mknod mknod64 mlock mlockall munlock munlockall
290 nl_langinfo _open __open open64 _open64 __open64 _opendir __opendir
291 opendir64 pathconf poll posix_fallocate posix_fallocate64
292 posix_memalign prctl pread _pread __pread pread64 _pread64 __pread64
293 pwrite _pwrite __pwrite pwrite64 _pwrite64
294 __pwrite64 rdchk _read __read _readdir __readdir readdir64 _readdir64
295 __readdir64 removeea removexattr rewinddir64 _seekdir __seekdir
296 seekdir64 select setea setenv setgidx setgroups setlocale setluid
297 setmntent setpgid setpriv setproplist setsid setuidx
298 setxattr shmget shm_open sigaction sigblock sigprocmask sigset
299 sizeof_proplist_entry _stat __stat stat64 _stat64 __stat64 statvfs
300 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctlbyname
301 __sys_llseek syslog _telldir __telldir telldir64 textdomain timegm
302 utimensat vsyslog _write __write __xstat
303 ''')
305 conf.CHECK_SAMBA3_CHARSET() # see build/charset.py
307 # FIXME: these should be tests for features, but the old build system just
308 # checks for OSes.
309 import sys
310 host_os = sys.platform
311 Logs.info("building on %s" % host_os)
313 # Python doesn't have case switches... :/
314 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
315 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
317 conf.SET_TARGET_TYPE('sunacl', 'EMPTY')
318 if (host_os.rfind('linux') > -1) or (host_os.rfind('gnu') > -1) or (host_os.rfind('qnx') > -1):
319 if host_os.rfind('linux') > -1:
320 conf.DEFINE('LINUX', '1')
321 elif host_os.rfind('qnx') > -1:
322 conf.DEFINE('QNX', '1')
323 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
324 elif (host_os.rfind('darwin') > -1):
325 conf.DEFINE('DARWINOS', 1)
326 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
327 conf.ADD_CFLAGS('-fno-common')
328 elif (host_os.rfind('freebsd') > -1):
329 if conf.CHECK_HEADERS('sunacl.h'):
330 conf.define('HAVE_FREEBSD_SUNACL_H', '1')
331 conf.CHECK_FUNCS_IN('acl', 'sunacl')
332 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
333 elif (host_os.rfind('netbsd') > -1):
334 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
335 elif (host_os.rfind('openbsd') > -1):
336 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
337 elif (host_os.rfind('sunos') > -1):
338 conf.DEFINE('STAT_ST_BLOCKSIZE', '512')
339 # FIXME: Add more checks here.
340 else:
341 Logs.warn("Unknown host_os '%s', please report this to samba-technical@samba.org" % host_os)
343 #FIXME: add more checks
344 if Options.options.with_acl_support:
345 if host_os.rfind('linux') > -1:
346 conf.CHECK_FUNCS_IN('acl_get_file', 'acl')
347 conf.CHECK_FUNCS_IN('getxattr', 'attr')
348 if conf.CHECK_CODE('''
349 acl_t acl;
350 int entry_id;
351 acl_entry_t *entry_p;
352 return acl_get_entry(acl, entry_id, entry_p);
353 ''',
354 'HAVE_POSIX_ACLS',
355 headers='sys/types.h sys/acl.h', link=False,
356 msg="Checking for POSIX ACL support") :
357 conf.CHECK_CODE('''
358 acl_permset_t permset_d;
359 acl_perm_t perm;
360 return acl_get_perm_np(permset_d, perm);
361 ''',
362 'HAVE_ACL_GET_PERM_NP',
363 headers='sys/types.h sys/acl.h', link=True,
364 msg="Checking whether acl_get_perm_np() is available")
365 else:
366 conf.DEFINE('HAVE_NO_ACLS', 1)
367 conf.SET_TARGET_TYPE('acl', 'EMPTY')
368 else:
369 conf.DEFINE('HAVE_NO_ACLS', 1)
370 conf.SET_TARGET_TYPE('acl', 'EMPTY')
372 if conf.CHECK_FUNCS('dirfd'):
373 conf.DEFINE('HAVE_DIRFD_DECL', 1)
375 conf.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
376 'HAVE_STATFS_F_FSID',
377 msg="vfs_fileid: checking for statfs() and struct statfs.f_fsid",
378 headers='sys/types.h sys/statfs.h',
379 execute=True)
381 if conf.CONFIG_SET('HAVE_FALLOCATE'):
382 conf.CHECK_CODE('''
383 #if defined(HAVE_UNISTD_H)
384 #include <unistd.h>
385 #endif
386 #include <sys/types.h>
387 #define _GNU_SOURCE
388 #include <fcntl.h>
389 #if defined(HAVE_LINUX_FALLOC_H)
390 #include <linux/falloc.h>
391 #endif
392 int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
393 'HAVE_LINUX_FALLOCATE',
394 msg="Checking whether the Linux 'fallocate' function is available")
395 if conf.CONFIG_SET('HAVE_FALLOCATE64'):
396 conf.CHECK_CODE('''
397 #if defined(HAVE_UNISTD_H)
398 #include <unistd.h>
399 #endif
400 #include <sys/types.h>
401 #define _GNU_SOURCE
402 #include <fcntl.h>
403 #if defined(HAVE_LINUX_FALLOC_H)
404 #include <linux/falloc.h>
405 #endif
406 int ret = fallocate64(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
407 'HAVE_LINUX_FALLOCATE64',
408 msg="Checking whether the Linux 'fallocate64' function is available")
409 conf.CHECK_CODE('''
410 #if defined(HAVE_UNISTD_H)
411 #include <unistd.h>
412 #endif
413 #include <fcntl.h>
414 ssize_t err = readahead(0,0,0x80000);''',
415 'HAVE_LINUX_READAHEAD',
416 msg="Checking whether Linux readahead is available")
417 conf.CHECK_DECLS('readahead', headers='fcntl.h', always=True)
419 conf.CHECK_CODE('''
420 #include <sys/types.h>
421 #include <sys/socket.h>],
422 struct ucred cred;
423 socklen_t cred_len;
424 int ret = getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len);''',
425 'HAVE_PEERCRED',
426 msg="Checking whether we can use SO_PEERCRED to get socket credentials")
428 conf.CHECK_CODE('''
429 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
430 #include <sys/types.h>
431 #else
432 __COMPILE_ERROR_
433 #endif
434 int i;''',
435 'HAVE_EXPLICIT_LARGEFILE_SUPPORT',
436 msg="Checking whether large file support can be enabled")
438 if Options.options.with_aio_support:
439 conf.CHECK_FUNCS_IN('aio_read', 'aio')
440 conf.CHECK_FUNCS_IN('aio_read', 'rt')
441 conf.CHECK_CODE('struct aiocb a; return aio_read(&a);',
442 'HAVE_AIO',
443 msg='Checking for asynchronous io support',
444 headers='sys/types.h aio.h',
445 lib='aio rt')
446 conf.CHECK_CODE('struct aiocb64 a; return aio_read64(&a);',
447 'HAVE_AIO64',
448 msg='Checking for 64-bit asynchronous io support',
449 headers='sys/types.h aio.h',
450 lib='aio rt')
451 if conf.CONFIG_SET('HAVE_AIO64'):
452 conf.DEFINE('HAVE_AIOCB64', '1')
453 conf.DEFINE('WITH_AIO', '1')
454 elif conf.CONFIG_SET('HAVE_AIO'):
455 conf.DEFINE('WITH_AIO', '1')
456 if conf.CONFIG_SET('HAVE_AIO'):
457 conf.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg='Checking for aio_read', headers='aio.h', lib='aio rt')
458 conf.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg='Checking for aio_write', headers='aio.h', lib='aio rt')
459 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')
460 conf.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg='Checking for aio_return', headers='aio.h', lib='aio rt')
461 conf.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg='Checking for aio_error', headers='aio.h', lib='aio rt')
462 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')
463 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')
464 if conf.CONFIG_SET('HAVE_AIO64'):
465 conf.CHECK_CODE('struct aiocb a; return aio_read64(&a);', 'HAVE_AIO_READ64', msg='Checking for aio_read64', headers='aio.h', lib='aio rt')
466 conf.CHECK_CODE('struct aiocb a; return aio_write64(&a);', 'HAVE_AIO_WRITE64', msg='Checking for aio_write64', headers='aio.h', lib='aio rt')
467 conf.CHECK_CODE('struct aiocb a; return aio_fsync64(1, &a);', 'HAVE_AIO_FSYNC64', msg='Checking for aio_fsync64', headers='aio.h', lib='aio rt')
468 conf.CHECK_CODE('struct aiocb a; return aio_return64(&a);', 'HAVE_AIO_RETURN64', msg='Checking for aio_return64', headers='aio.h', lib='aio rt')
469 conf.CHECK_CODE('struct aiocb a; return aio_error64(&a);', 'HAVE_AIO_ERROR64', msg='Checking for aio_error64', headers='aio.h', lib='aio rt')
470 conf.CHECK_CODE('struct aiocb a; return aio_cancel64(1, &a);', 'HAVE_AIO_CANCEL64', msg='Checking for aio_cancel64', headers='aio.h', lib='aio rt')
471 conf.CHECK_CODE('struct aiocb a; return aio_suspend64(&a, 1, NULL);', 'HAVE_AIO_SUSPEND64', msg='Checking for aio_suspend64', headers='aio.h', lib='aio rt')
472 if not conf.CONFIG_SET('HAVE_AIO'):
473 conf.DEFINE('HAVE_NO_AIO', '1')
474 else:
475 conf.DEFINE('HAVE_NO_AIO', '1')
477 conf.CHECK_CODE('''
478 struct msghdr msg;
479 union {
480 struct cmsghdr cm;
481 char control[CMSG_SPACE(sizeof(int))];
482 } control_un;
483 msg.msg_control = control_un.control;
484 msg.msg_controllen = sizeof(control_un.control);
485 ''',
486 'HAVE_MSGHDR_MSG_CONTROL',
487 msg='Checking if we can use msg_control for passing file descriptors',
488 headers='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
489 conf.CHECK_CODE('''
490 struct msghdr msg;
491 int fd;
492 msg.msg_acctrights = (caddr_t) &fd;
493 msg.msg_acctrightslen = sizeof(fd);
494 ''',
495 'HAVE_MSGHDR_MSG_ACCTRIGHTS',
496 msg='Checking if we can use msg_acctrights for passing file descriptors',
497 headers='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
499 if Options.options.with_winbind:
500 conf.env.build_winbind = True
501 conf.DEFINE('WITH_WINBIND', '1')
503 conf.find_program('awk', var='AWK')
504 conf.find_program('perl', var='PERL')
506 # Darwin has extra options to xattr-family functions
507 conf.CHECK_CODE('getxattr(0, 0, 0, 0, 0, 0);',
508 'XATTR_ADD_OPT',
509 msg="Checking whether xattr interface takes additional options",
510 headers='sys/types.h attr/xattr.h sys/xattr.h')
512 conf.CHECK_HEADERS('asm/types.h')
514 conf.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
515 headers='unistd.h sys/types.h',
516 msg="Checking for major macro")
518 conf.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
519 headers='unistd.h sys/types.h',
520 msg="Checking for minor macro")
522 conf.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
523 headers='unistd.h sys/types.h dirent.h',
524 define='HAVE_DIRENT_D_OFF')
526 conf.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent')
527 if conf.CHECK_CFLAGS('-Werror-implicit-function-declaration'):
528 netgrent_cflags = '-Werror-implicit-function-declaration'
529 else:
530 netgrent_cflags = ''
531 conf.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE',
532 msg="Checking for setnetgrent prototype",
533 headers='netdb.h netgroup.h',
534 cflags=netgrent_cflags)
535 conf.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE',
536 msg="Checking for getnetgrent prototype",
537 headers='netdb.h netgroup.h',
538 cflags=netgrent_cflags)
539 conf.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE',
540 msg="Checking for endnetgrent prototype",
541 headers='netdb.h netgroup.h',
542 cflags=netgrent_cflags)
545 # Look for CUPS
546 if Options.options.with_cups:
547 conf.find_program('cups-config', var='CUPS_CONFIG')
548 if conf.env.CUPS_CONFIG:
549 # we would normally use --libs here, but cups-config incorrectly adds
550 # gssapi_krb5 and other libraries to its --libs output. That breaks the use
551 # of an in-tree heimdal kerberos
552 conf.check_cfg(path=conf.env.CUPS_CONFIG, args="--cflags --ldflags",
553 package="", uselib_store="cups")
554 conf.CHECK_HEADERS('cups/cups.h cups/language.h', lib='cups')
555 conf.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups')
556 if conf.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
557 conf.DEFINE('HAVE_CUPS', '1')
558 else:
559 conf.undefine('HAVE_CUPS')
560 conf.SET_TARGET_TYPE('cups', 'EMPTY')
561 else:
562 # define an empty subsystem for cups, to allow it to be used as an empty dependency
563 conf.SET_TARGET_TYPE('cups', 'EMPTY')
565 if Options.options.with_iprint:
566 if conf.CONFIG_SET('HAVE_CUPS'):
567 conf.DEFINE('HAVE_IPRINT', '1')
568 else:
569 Logs.warn("--enable-iprint=yes but cups support not sufficient")
570 if Options.options.with_syslog:
571 conf.DEFINE('WITH_SYSLOG', '1')
572 if Options.options.with_automount:
573 conf.DEFINE('WITH_AUTOMOUNT', '1')
575 # Check for LDAP
576 if Options.options.with_ldap:
577 conf.CHECK_HEADERS('ldap.h lber.h')
578 conf.CHECK_TYPE('ber_tag_t', 'unsigned int', headers='ldap.h lber.h')
579 conf.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
580 conf.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers='ldap.h')
582 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
583 # for the samba logs
584 conf.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
585 define='HAVE_LBER_LOG_PRINT_FN', headers='lber.h')
587 conf.CHECK_FUNCS_IN('ldap_init ldap_initialize ldap_set_rebind_proc', 'ldap')
588 conf.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
590 # Check if ldap_set_rebind_proc() takes three arguments
591 if conf.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
592 'LDAP_SET_REBIND_PROC_ARGS',
593 msg="Checking whether ldap_set_rebind_proc takes 3 arguments",
594 headers='ldap.h lber.h', link=False):
595 conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
596 else:
597 conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
599 # last but not least, if ldap_init() exists, we want to use ldap
600 if conf.CONFIG_SET('HAVE_LDAP_INIT'):
601 conf.DEFINE('HAVE_LDAP', '1')
602 conf.DEFINE('LDAP_DEPRECATED', '1')
603 conf.env['HAVE_LDAP'] = '1'
604 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
605 # SASL wrapping hooks
606 if conf.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
607 conf.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
608 conf.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
609 else:
610 conf.SET_TARGET_TYPE('ldap', 'EMPTY')
611 conf.SET_TARGET_TYPE('lber', 'EMPTY')
613 # Check for kerberos
614 have_gssapi=False
615 if Options.options.with_krb5 and not conf.env.toplevel_build:
616 Logs.info("Looking for kerberos features")
617 conf.find_program('krb5-config', var='KRB5_CONFIG')
618 if conf.env.KRB5_CONFIG:
619 conf.check_cfg(path="krb5-config", args="--cflags --libs",
620 package="gssapi", uselib_store="krb5")
621 conf.CHECK_HEADERS('krb5.h krb5/locate_plugin.h', lib='krb5')
622 conf.CHECK_HEADERS('gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h gssapi/gssapi_ext.h com_err.h', lib='krb5')
624 if conf.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'):
625 conf.env['WINBIND_KRB5_LOCATOR'] = 'bin/winbind_krb5_locator.so'
627 conf.CHECK_FUNCS_IN('_et_list', 'com_err')
628 conf.CHECK_FUNCS_IN('krb5_encrypt_data', 'k5crypto')
629 conf.CHECK_FUNCS_IN('crypto', 'des_set_key')
630 conf.CHECK_FUNCS_IN('copy_Authenticator', 'asn1')
631 conf.CHECK_FUNCS_IN('roken_getaddrinfo_hostspec', 'roken')
632 if conf.CHECK_FUNCS_IN('gss_display_status', 'gssapi') or \
633 conf.CHECK_FUNCS_IN('gss_display_status', 'gssapi_krb5'):
634 have_gssapi=True
635 conf.CHECK_FUNCS_IN('gss_wrap_iov', 'gssapi gssapi_krb5 krb5')
636 conf.CHECK_FUNCS_IN('krb5_mk_req_extended krb5_kt_compare', 'krb5')
637 conf.CHECK_FUNCS('''
638 krb5_set_real_time krb5_set_default_in_tkt_etypes krb5_set_default_tgs_enctypes
639 krb5_set_default_tgs_ktypes krb5_principal2salt krb5_use_enctype
640 krb5_string_to_key krb5_get_pw_salt krb5_string_to_key_salt krb5_auth_con_setkey
641 krb5_auth_con_setuseruserkey krb5_locate_kdc krb5_get_permitted_enctypes
642 krb5_get_default_in_tkt_etypes krb5_free_data_contents
643 krb5_principal_get_comp_string krb5_free_unparsed_name
644 krb5_free_keytab_entry_contents krb5_kt_free_entry krb5_krbhst_init
645 krb5_krbhst_get_addrinfo krb5_c_enctype_compare krb5_enctypes_compatible_keys
646 krb5_crypto_init krb5_crypto_destroy krb5_decode_ap_req free_AP_REQ
647 krb5_verify_checksum krb5_c_verify_checksum krb5_principal_compare_any_realm
648 krb5_parse_name_norealm krb5_princ_size krb5_get_init_creds_opt_set_pac_request
649 krb5_get_renewed_creds krb5_get_kdc_cred krb5_free_error_contents
650 initialize_krb5_error_table krb5_get_init_creds_opt_alloc
651 krb5_get_init_creds_opt_free krb5_get_init_creds_opt_get_error
652 krb5_enctype_to_string krb5_fwd_tgt_creds krb5_auth_con_set_req_cksumtype
653 krb5_get_creds_opt_alloc krb5_get_creds_opt_set_impersonate krb5_get_creds
654 krb5_get_credentials_for_user krb5_get_host_realm krb5_free_host_realm''',
655 lib='krb5 k5crypto')
656 conf.CHECK_DECLS('''krb5_get_credentials_for_user
657 krb5_auth_con_set_req_cksumtype''',
658 headers='krb5.h', always=True)
659 conf.CHECK_VARIABLE('AP_OPTS_USE_SUBKEY', headers='krb5.h')
660 conf.CHECK_VARIABLE('KV5M_KEYTAB', headers='krb5.h')
661 conf.CHECK_VARIABLE('KRB5_KU_OTHER_CKSUM', headers='krb5.h')
662 conf.CHECK_VARIABLE('KRB5_KEYUSAGE_APP_DATA_CKSUM', headers='krb5.h')
663 conf.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'key', headers='krb5.h',
664 define='HAVE_KRB5_KEYTAB_ENTRY_KEY')
665 conf.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'keyblock', headers='krb5.h',
666 define='HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK')
667 conf.CHECK_STRUCTURE_MEMBER('krb5_address', 'magic', headers='krb5.h',
668 define='HAVE_MAGIC_IN_KRB5_ADDRESS')
669 conf.CHECK_STRUCTURE_MEMBER('krb5_address', 'addrtype', headers='krb5.h',
670 define='HAVE_ADDRTYPE_IN_KRB5_ADDRESS')
671 conf.CHECK_STRUCTURE_MEMBER('krb5_ticket', 'enc_part2', headers='krb5.h',
672 define='HAVE_KRB5_TKT_ENC_PART2')
673 conf.CHECK_STRUCTURE_MEMBER('krb5_creds', 'keyblock', headers='krb5.h',
674 define='HAVE_KRB5_KEYBLOCK_IN_CREDS')
675 conf.CHECK_STRUCTURE_MEMBER('krb5_creds', 'session', headers='krb5.h',
676 define='HAVE_KRB5_SESSION_IN_CREDS')
677 conf.CHECK_STRUCTURE_MEMBER('krb5_ap_req', 'ticket', headers='krb5.h',
678 define='HAVE_TICKET_POINTER_IN_KRB5_AP_REQ')
680 conf.CHECK_TYPE('krb5_encrypt_block', headers='krb5.h')
682 conf.CHECK_CODE('''
683 krb5_ticket ticket;
684 krb5_kvno kvno;
685 krb5_enctype enctype;
686 enctype = ticket.enc_part.enctype;
687 kvno = ticket.enc_part.kvno;
688 ''',
689 'KRB5_TICKET_HAS_KEYINFO',
690 headers='krb5.h', link=False,
691 msg="Checking whether the krb5_ticket structure contains the kvno and enctype")
692 conf.CHECK_CODE('''
693 krb5_context ctx;
694 krb5_get_init_creds_opt *opt = NULL;
695 krb5_get_init_creds_opt_free(ctx, opt);
696 ''',
697 'KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT',
698 headers='krb5.h', link=False,
699 msg="Checking whether krb5_get_init_creds_opt_free takes a context argument")
700 conf.CHECK_CODE('krb5_mk_error(0,0,0)',
701 'HAVE_SHORT_KRB5_MK_ERROR_INTERFACE',
702 headers='krb5.h', link=False,
703 msg="Checking whether krb5_mk_error takes 3 arguments MIT or 9 Heimdal")
704 conf.CHECK_CODE('''
705 const krb5_data *pkdata;
706 krb5_context context;
707 krb5_principal principal;
708 pkdata = krb5_princ_component(context, principal, 0);
709 ''',
710 'HAVE_KRB5_PRINC_COMPONENT',
711 headers='krb5.h', lib='krb5',
712 msg="Checking whether krb5_princ_component is available")
714 conf.CHECK_CODE('''
715 int main(void) {
716 char buf[256];
717 krb5_enctype_to_string(1, buf, 256);
718 return 0;
719 }''',
720 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_SIZE_T_ARG',
721 headers='krb5.h', lib='krb5 k5crypto',
722 addmain=False, cflags='-Werror',
723 msg="Checking whether krb5_enctype_to_string takes size_t argument")
725 conf.CHECK_CODE('''
726 int main(void) {
727 krb5_context context = NULL;
728 char *str = NULL;
729 krb5_enctype_to_string(context, 1, &str);
730 if (str) free (str);
731 return 0;
732 }''',
733 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_KRB5_CONTEXT_ARG',
734 headers='krb5.h stdlib.h', lib='krb5',
735 addmain=False, cflags='-Werror',
736 msg="Checking whether krb5_enctype_to_string takes krb5_context argument")
737 conf.CHECK_CODE('''
738 int main(void) {
739 krb5_context ctx = NULL;
740 krb5_principal princ = NULL;
741 const char *str = krb5_princ_realm(ctx, princ)->data;
742 return 0;
743 }''',
744 'HAVE_KRB5_PRINC_REALM',
745 headers='krb5.h', lib='krb5',
746 addmain=False,
747 msg="Checking whether the macro krb5_princ_realm is defined")
748 conf.CHECK_CODE('''
749 int main(void) {
750 krb5_context context;
751 krb5_principal principal;
752 const char *realm; realm = krb5_principal_get_realm(context, principal);
753 return 0;
754 }''',
755 'HAVE_KRB5_PRINCIPAL_GET_REALM',
756 headers='krb5.h', lib='krb5',
757 addmain=False,
758 msg="Checking whether krb5_principal_get_realm is defined")
759 if conf.CHECK_CODE('''krb5_verify_checksum(0, 0, 0, 0, 0, 0, 0);''',
760 'KRB5_VERIFY_CHECKSUM_ARGS',
761 headers='krb5.h', lib='krb5',
762 msg="Checking whether krb5_verify_checksum takes 7 arguments"):
763 conf.DEFINE('KRB5_VERIFY_CHECKSUM_ARGS', '7')
764 else:
765 conf.DEFINE('KRB5_VERIFY_CHECKSUM_ARGS', '6')
767 conf.CHECK_CODE('''
768 krb5_enctype enctype;
769 enctype = ENCTYPE_ARCFOUR_HMAC_MD5;
770 ''',
771 '_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5',
772 headers='krb5.h', lib='krb5',
773 msg="Checking whether the ENCTYPE_ARCFOUR_HMAC_MD5 key type definition is available");
774 conf.CHECK_CODE('''
775 krb5_keytype keytype;
776 keytype = KEYTYPE_ARCFOUR_56;
777 ''',
778 '_HAVE_KEYTYPE_ARCFOUR_56',
779 headers='krb5.h', lib='krb5',
780 msg="Checking whether the HAVE_KEYTYPE_ARCFOUR_56 key type definition is available");
781 if conf.CONFIG_SET('_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and conf.CONFIG_SET('_HAVE_KEYTYPE_ARCFOUR_56'):
782 conf.DEFINE('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5', '1')
784 conf.CHECK_CODE('''
785 krb5_enctype enctype;
786 enctype = ENCTYPE_ARCFOUR_HMAC;
787 ''',
788 'HAVE_ENCTYPE_ARCFOUR_HMAC',
789 headers='krb5.h', lib='krb5',
790 msg="Checking whether the ENCTYPE_ARCFOUR_HMAC key type definition is available");
792 conf.CHECK_CODE('''
793 krb5_context context;
794 krb5_keytab keytab;
795 krb5_init_context(&context);
796 return krb5_kt_resolve(context, "WRFILE:api", &keytab);
797 ''',
798 'HAVE_WRFILE_KEYTAB',
799 headers='krb5.h', lib='krb5', execute=True,
800 msg="Checking whether the WRFILE:-keytab is supported");
802 # Check for KRB5_DEPRECATED handling
803 conf.CHECK_CODE('''#define KRB5_DEPRECATED 1
804 #include <krb5.h>''',
805 'HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER', addmain=False,
806 link=False,
807 msg="Checking for KRB5_DEPRECATED define taking an identifier")
808 elif conf.env.toplevel_build:
809 # setup the right defines for a in-tree heimdal build
810 Logs.info("Using in-tree heimdal kerberos defines")
811 conf.define('HAVE_GSSAPI', 1)
812 conf.define('HAVE_GSSAPI_GSSAPI_H', 1)
813 conf.define('HAVE_AP_OPTS_USE_SUBKEY', 1)
814 conf.define('HAVE_KRB5_ADDRESSES', 1)
815 conf.define('HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK', 1)
816 conf.define('HAVE_KRB5_SET_REAL_TIME', 1)
817 conf.define('HAVE_COM_ERR_H', 1)
818 conf.define('HAVE_ADDR_TYPE_IN_KRB5_ADDRESS', 1)
819 conf.define('HAVE_GSS_DISPLAY_STATUS', 1)
820 conf.define('HAVE_LIBGSSAPI', 1)
821 conf.define('HAVE_ADDR_TYPE_IN_KRB5_ADDRESS', 1)
822 conf.define('HAVE_CHECKSUM_IN_KRB5_CHECKSUM', 1)
823 conf.define('HAVE_DECL_KRB5_AUTH_CON_SET_REQ_CKSUMTYPE', 0)
824 conf.define('HAVE_DECL_KRB5_GET_CREDENTIALS_FOR_USER', 0)
825 conf.define('HAVE_E_DATA_POINTER_IN_KRB5_ERROR', 1)
826 conf.define('HAVE_INITIALIZE_KRB5_ERROR_TABLE', 1)
827 conf.define('HAVE_KRB5_ADDRESSES', 1)
828 conf.define('HAVE_KRB5_AUTH_CON_SETKEY', 1)
829 conf.define('HAVE_KRB5_CRYPTO', 1)
830 conf.define('HAVE_KRB5_CRYPTO_DESTROY', 1)
831 conf.define('HAVE_KRB5_CRYPTO_INIT', 1)
832 conf.define('HAVE_KRB5_C_ENCTYPE_COMPARE', 1)
833 conf.define('HAVE_KRB5_C_VERIFY_CHECKSUM', 1)
834 conf.define('HAVE_FREE_AP_REQ', 1)
835 conf.define('HAVE_KRB5_DECODE_AP_REQ', 1)
836 conf.define('HAVE_KRB5_ENCTYPES_COMPATIBLE_KEYS', 1)
837 conf.define('HAVE_KRB5_ENCTYPE_TO_STRING', 1)
838 conf.define('HAVE_KRB5_ENCTYPE_TO_STRING_WITH_KRB5_CONTEXT_ARG', 1)
839 conf.define('HAVE_KRB5_FREE_ERROR_CONTENTS', 1)
840 conf.define('HAVE_KRB5_FREE_HOST_REALM', 1)
841 conf.define('HAVE_KRB5_FWD_TGT_CREDS', 1)
842 conf.define('HAVE_KRB5_GET_CREDS', 1)
843 conf.define('HAVE_KRB5_GET_CREDS_OPT_ALLOC', 1)
844 conf.define('HAVE_KRB5_GET_CREDS_OPT_SET_IMPERSONATE', 1)
845 conf.define('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES', 1)
846 conf.define('HAVE_KRB5_GET_HOST_REALM', 1)
847 conf.define('HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC', 1)
848 conf.define('HAVE_KRB5_GET_INIT_CREDS_OPT_FREE', 1)
849 conf.define('HAVE_KRB5_GET_INIT_CREDS_OPT_GET_ERROR', 1)
850 conf.define('HAVE_KRB5_GET_INIT_CREDS_OPT_SET_PAC_REQUEST', 1)
851 conf.define('HAVE_KRB5_GET_KDC_CRED', 1)
852 conf.define('HAVE_KRB5_GET_PW_SALT', 1)
853 conf.define('HAVE_KRB5_GET_RENEWED_CREDS', 1)
854 conf.define('HAVE_KRB5_KEYBLOCK_KEYVALUE', 1)
855 conf.define('HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK', 1)
856 conf.define('HAVE_KRB5_KRBHST_GET_ADDRINFO', 1)
857 conf.define('HAVE_KRB5_KRBHST_INIT', 1)
858 conf.define('HAVE_KRB5_KT_COMPARE', 1)
859 conf.define('HAVE_KRB5_KT_FREE_ENTRY', 1)
860 conf.define('HAVE_KRB5_KU_OTHER_CKSUM', 1)
861 conf.define('HAVE_KRB5_LOCATE_PLUGIN_H', 1)
862 conf.define('HAVE_KRB5_MK_REQ_EXTENDED', 1)
863 conf.define('HAVE_KRB5_PRINCIPAL_COMPARE_ANY_REALM', 1)
864 conf.define('HAVE_KRB5_PRINCIPAL_GET_COMP_STRING', 1)
865 conf.define('HAVE_KRB5_PRINCIPAL_GET_REALM', 1)
866 conf.define('HAVE_KRB5_REALM_TYPE', 1)
867 conf.define('HAVE_KRB5_SESSION_IN_CREDS', 1)
868 conf.define('HAVE_KRB5_SET_DEFAULT_IN_TKT_ETYPES', 1)
869 conf.define('HAVE_KRB5_SET_REAL_TIME', 1)
870 conf.define('HAVE_KRB5_STRING_TO_KEY', 1)
871 conf.define('HAVE_KRB5_STRING_TO_KEY_SALT', 1)
872 conf.define('HAVE_KRB5_VERIFY_CHECKSUM', 1)
873 conf.define('HAVE_LIBKRB5', 1)
874 conf.define('KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT', 1)
875 conf.define('KRB5_VERIFY_CHECKSUM_ARGS', 6)
876 conf.define('HAVE_ETYPE_IN_ENCRYPTEDDATA', 1)
877 conf.define('KRB5_PRINC_REALM_RETURNS_REALM', 1)
878 conf.define('HAVE_KRB5_PRINCIPAL_GET_REALM', 1)
879 conf.define('HAVE_KRB5_H', 1)
880 conf.define('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5', 1)
881 conf.define('HAVE_AP_OPTS_USE_SUBKEY', 1)
882 conf.define('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5', 1)
883 conf.define('HAVE_ENCTYPE_ARCFOUR_HMAC', 1)
884 else:
885 conf.SET_TARGET_TYPE('krb5', 'EMPTY')
886 conf.SET_TARGET_TYPE('gssapi', 'EMPTY')
887 conf.SET_TARGET_TYPE('gssapi_krb5', 'EMPTY')
888 conf.SET_TARGET_TYPE('com_err', 'EMPTY')
889 conf.SET_TARGET_TYPE('k5crypto', 'EMPTY')
891 if Options.options.with_ads:
892 use_ads=True
893 if not conf.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and \
894 not conf.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC'):
895 Logs.warn("arcfour-hmac-md5 encryption type not found in -lkrb5")
896 use_ads=False
897 if not conf.CONFIG_SET('HAVE_KRB5_MK_REQ_EXTENDED'):
898 Logs.warn("krb5_mk_req_extended not found in -lkrb5")
899 use_ads=False
900 if not conf.CONFIG_SET('HAVE_KRB5_PRINCIPAL2SALT') and \
901 not conf.CONFIG_SET('HAVE_KRB5_GET_PW_SALT'):
902 Logs.warn("no CREATE_KEY_FUNCTIONS detected")
903 use_ads=False
904 if not conf.CONFIG_SET('HAVE_KRB5_GET_PERMITTED_ENCTYPES') and \
905 not conf.CONFIG_SET('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES'):
906 Logs.warn("no GET_ENCTYPES_FUNCTIONS detected")
907 use_ads=False
908 if not conf.CONFIG_SET('HAVE_KRB5_KT_FREE_ENTRY') and \
909 not conf.CONFIG_SET('HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS'):
910 Logs.warn("no KT_FREE_FUNCTION detected")
911 use_ads=False
912 if not conf.CONFIG_SET('HAVE_KRB5_C_VERIFY_CHECKSUM') and \
913 not conf.CONFIG_SET('HAVE_KRB5_VERIFY_CHECKSUM'):
914 Logs.warn("no KRB5_VERIFY_CHECKSUM_FUNCTION detected")
915 use_ads=False
916 if not conf.CONFIG_SET('KRB5_TICKET_HAS_KEYINFO'):
917 # We only need the following functions if we can't get the enctype
918 # and kvno out of the ticket directly (ie. on Heimdal).
919 if not conf.CONFIG_SET('HAVE_FREE_AP_REQ'):
920 Logs.warn("no KRB5_AP_REQ_FREE_FUNCTION detected")
921 use_ads=False
922 if not conf.CONFIG_SET('HAVE_KRB5_DECODE_AP_REQ'):
923 Logs.warn("no KRB5_AP_REQ_DECODING_FUNCTION detected")
924 use_ads=False
925 if use_ads:
926 conf.DEFINE('WITH_ADS', '1')
927 conf.DEFINE('HAVE_KRB5', '1')
928 if have_gssapi:
929 conf.DEFINE('HAVE_GSSAPI', '1')
930 if conf.CONFIG_SET('HAVE_LDAP'):
931 conf.env['HAVE_ADS'] = '1'
932 else:
933 Logs.warn("krb5 libs don't have all features required for Active Directory support")
934 conf.undefine('HAVE_KRB5_H')
935 conf.undefine('HAVE_GSSAPI_H')
936 conf.undefine('HAVE_GSSAPI_GSSAPI_GENERIC_H')
937 conf.undefine('HAVE_GSSAPI_GSSAPI_H')
939 if Options.options.with_utmp:
940 conf.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
941 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers='utmp.h',
942 define='HAVE_UT_UT_NAME')
943 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers='utmp.h',
944 define='HAVE_UT_UT_USER')
945 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers='utmp.h',
946 define='HAVE_UT_UT_ID')
947 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers='utmp.h',
948 define='HAVE_UT_UT_HOST')
949 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers='utmp.h',
950 define='HAVE_UT_UT_TIME')
951 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers='utmp.h',
952 define='HAVE_UT_UT_TV')
953 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers='utmp.h',
954 define='HAVE_UT_UT_TYPE')
955 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers='utmp.h',
956 define='HAVE_UT_UT_PID')
957 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers='utmp.h',
958 define='HAVE_UT_UT_EXIT')
959 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr_v6', headers='utmp.h',
960 define='HAVE_UT_UT_ADDR_V6')
961 conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr', headers='utmp.h',
962 define='HAVE_UT_UT_ADDR')
963 conf.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers='utmpx.h',
964 define='HAVE_UX_UT_SYSLEN')
965 conf.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
966 'PUTUTLINE_RETURNS_UTMP', headers='utmp.h',
967 msg="Checking whether pututline returns pointer")
968 conf.DEFINE('WITH_UTMP', 1)
970 if Options.options.with_avahi:
971 conf.env.with_avahi = True
972 if not conf.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf.env.with_avahi = False
973 if not conf.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf.env.with_avahi = False
974 if not conf.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf.env.with_avahi = False
975 if conf.env.with_avahi:
976 conf.DEFINE('WITH_AVAHI_SUPPORT', 1)
977 else:
978 conf.SET_TARGET_TYPE('avahi-common', 'EMPTY')
979 conf.SET_TARGET_TYPE('avahi-client', 'EMPTY')
981 if Options.options.with_iconv:
982 conf.env.with_iconv = True
983 if not conf.CHECK_FUNCS_IN('iconv_open', 'iconv', headers='iconv.h'):
984 conf.env.with_iconv = False
985 if conf.env.with_iconv:
986 conf.DEFINE('HAVE_ICONV', 1)
988 if Options.options.with_pam:
989 use_pam=True
990 conf.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
991 if not conf.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
992 Logs.warn("--with-pam=yes but pam_appl.h not found")
993 use_pam=False
994 conf.CHECK_FUNCS_IN('pam_get_data', 'pam')
995 conf.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h')
996 if not conf.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'):
997 Logs.warn("--with-pam=yes but pam_modules.h not found")
998 use_pam=False
999 conf.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h')
1000 conf.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h')
1001 conf.CHECK_FUNCS_IN('pam_vsyslog', 'pam')
1002 conf.CHECK_CODE('''
1003 #if defined(HAVE_SECURITY_PAM_APPL_H)
1004 #include <security/pam_appl.h>
1005 #elif defined(HAVE_PAM_PAM_APPL_H)
1006 #include <pam/pam_appl.h>
1007 #endif
1008 pam_set_item(0, PAM_RHOST, 0);
1009 ''',
1010 'HAVE_PAM_RHOST',
1011 lib='pam',
1012 msg="Checking whether PAM_RHOST is available");
1013 conf.CHECK_CODE('''
1014 #if defined(HAVE_SECURITY_PAM_APPL_H)
1015 #include <security/pam_appl.h>
1016 #elif defined(HAVE_PAM_PAM_APPL_H)
1017 #include <pam/pam_appl.h>
1018 #endif
1019 pam_set_item(0, PAM_TTY, 0);
1020 ''',
1021 'HAVE_PAM_TTY',
1022 lib='pam',
1023 msg="Checking whether PAM_TTY is available");
1024 conf.CHECK_CODE('''
1025 #if (!defined(LINUX))
1027 #define PAM_EXTERN extern
1028 #if defined(HAVE_SECURITY_PAM_APPL_H)
1029 #include <security/pam_appl.h>
1030 #elif defined(HAVE_PAM_PAM_APPL_H)
1031 #include <pam/pam_appl.h>
1032 #endif
1034 #endif
1036 #if defined(HAVE_SECURITY_PAM_MODULES_H)
1037 #include <security/pam_modules.h>
1038 #elif defined(HAVE_PAM_PAM_MODULES_H)
1039 #include <pam/pam_modules.h>
1040 #endif
1042 #if defined(HAVE_SECURITY__PAM_MACROS_H)
1043 #include <security/_pam_macros.h>
1044 #elif defined(HAVE_PAM__PAM_MACROS_H)
1045 #include <pam/_pam_macros.h>
1046 #endif
1048 #ifdef HAVE_SECURITY_PAM_EXT_H
1049 #include <security/pam_ext.h>
1050 #endif
1052 int i; i = PAM_RADIO_TYPE;
1053 ''',
1054 'HAVE_PAM_RADIO_TYPE',
1055 lib='pam',
1056 msg="Checking whether PAM_RADIO_TYPE is available");
1057 if use_pam:
1058 conf.DEFINE('WITH_PAM', 1)
1059 conf.DEFINE('WITH_PAM_MODULES', 1)
1061 seteuid = False
1062 if not seteuid:
1063 seteuid = conf.CHECK_CODE('''
1064 #define AUTOCONF_TEST 1
1065 #define USE_SETREUID 1
1066 #include "./lib/util_sec.c"
1067 ''',
1068 'USE_SETREUID',
1069 addmain=False,
1070 execute=True,
1071 msg="Checking whether setreuid is available")
1072 if not seteuid:
1073 seteuid = conf.CHECK_CODE('''
1074 #define AUTOCONF_TEST 1
1075 #define USE_SETRESUID 1
1076 #include "./lib/util_sec.c"
1077 ''',
1078 'USE_SETRESUID',
1079 addmain=False,
1080 execute=True,
1081 msg="Checking whether setresuid is available")
1082 if not seteuid:
1083 seteuid = conf.CHECK_CODE('''
1084 #define AUTOCONF_TEST 1
1085 #define USE_SETEUID 1
1086 #include "./lib/util_sec.c"
1087 ''',
1088 'USE_SETEUID',
1089 addmain=False,
1090 execute=True,
1091 msg="Checking whether seteuid is available")
1092 if not seteuid:
1093 seteuid = conf.CHECK_CODE('''
1094 #define AUTOCONF_TEST 1
1095 #define USE_SETUIDX 1
1096 #include "./lib/util_sec.c"
1097 ''',
1098 'USE_SETUIDX',
1099 addmain=False,
1100 execute=True,
1101 mandatory=True,
1102 msg="Checking whether setuidx is available")
1103 if Options.options.with_dnsupdate:
1104 conf.CHECK_HEADERS('uuid/uuid.h')
1105 conf.CHECK_FUNCS_IN('uuid_generate', 'uuid')
1106 if not conf.CONFIG_SET('HAVE_UUID_UUID_H') and not conf.CONFIG_SET('HAVE_UUID_GENERATE'):
1107 Logs.warn("--with-dnsupdate=yes but uuid support not sufficient")
1108 elif not conf.CONFIG_SET('HAVE_GSSAPI'):
1109 Logs.warn("--with-dnsupdate=yes but gssapi support not sufficient")
1110 else:
1111 conf.DEFINE('WITH_DNS_UPDATES', 1)
1112 else:
1113 conf.SET_TARGET_TYPE('uuid', 'EMPTY')
1114 conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
1115 if Options.options.developer:
1116 if conf.CONFIG_SET('HAVE_VALGRIND_H') or conf.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'):
1117 conf.DEFINE('VALGRIND', '1')
1119 if conf.CHECK_CODE('''
1120 #include <bits/sockaddr.h>
1121 #include <linux/netlink.h>
1122 ''',
1123 'HAVE_LINUX_NETLINK_H',
1124 msg="Checking whether Linux netlink is available"):
1125 conf.CHECK_CODE('''
1126 #include <bits/sockaddr.h>
1127 #include <linux/netlink.h>
1128 #include <linux/rtnetlink.h>
1129 ''',
1130 'HAVE_LINUX_RTNETLINK_H',
1131 msg='Checking whether Linux rtnetlink is available')
1132 if conf.CHECK_TYPE('struct dirent64', headers='sys/types.h dirent.h') and conf.CONFIG_SET('HAVE_READDIR64'):
1133 conf.DEFINE('HAVE_STRUCT_DIRENT64', '1')
1134 else:
1135 conf.undefine('HAVE_STRUCT_DIRENT64')
1137 conf.CHECK_CODE('''
1138 #include "../tests/fcntl_lock.c"
1139 ''',
1140 'HAVE_FCNTL_LOCK',
1141 addmain=False,
1142 execute=True,
1143 msg='Checking whether fcntl locking is available')
1145 conf.CHECK_CODE('''
1146 #include "../tests/fcntl_lock64.c"
1147 ''',
1148 'HAVE_BROKEN_FCNTL64_LOCKS',
1149 addmain=False,
1150 execute=True,
1151 msg='Checking whether fcntl64 locks are broken')
1153 if not conf.CONFIG_SET('HAVE_BROKEN_FCNTL64_LOCKS'):
1154 conf.CHECK_CODE('''
1155 #if defined(HAVE_UNISTD_H)
1156 #include <unistd.h>
1157 #endif
1158 #include <stdio.h>
1159 #include <stdlib.h>
1161 #ifdef HAVE_FCNTL_H
1162 #include <fcntl.h>
1163 #endif
1165 #ifdef HAVE_SYS_FCNTL_H
1166 #include <sys/fcntl.h>
1167 #endif
1168 main() { struct flock64 fl64;
1169 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
1170 exit(0);
1171 #else
1172 exit(1);
1173 #endif
1175 ''',
1176 'HAVE_STRUCT_FLOCK64',
1177 addmain=False,
1178 execute=True,
1179 msg="Checking whether the flock64 struct is available")
1181 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec',
1182 define='HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') # Linux, Solaris
1183 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimensec',
1184 define='HAVE_STRUCT_STAT_ST_MTIMENSEC') # BSD, if defined _POSIX_SOURCE
1185 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimespec.tv_nsec',
1186 define='HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') # BSD, if not defined _POSIX_SOURCE
1187 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtime_n',
1188 define='HAVE_STRUCT_STAT_ST_MTIME_N') # AIX
1189 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_umtime',
1190 define='HAVE_STRUCT_STAT_ST_UMTIME') # Tru64
1191 if conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') or \
1192 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMENSEC') or \
1193 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') or \
1194 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIME_N') or \
1195 conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_UMTIME'):
1196 conf.DEFINE('HAVE_STAT_HIRES_TIMESTAMPS', '1')
1198 # recent FreeBSD, NetBSD have creation timestamps called birthtime:
1199 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtime',
1200 define='HAVE_STRUCT_STAT_ST_BIRTHTIME')
1201 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimespec.tv_nsec',
1202 define='HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC')
1203 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimensec',
1204 define='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC')
1206 conf.CHECK_CODE('''
1207 #if defined(HAVE_UNISTD_H)
1208 #include <unistd.h>
1209 #endif
1210 #include <fcntl.h>],
1211 ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
1212 ''',
1213 'HAVE_POSIX_FADVISE',
1214 msg='Checking whether posix_fadvise is available')
1216 for v in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]:
1217 conf.CHECK_CODE('''
1218 #include <unistd.h>
1219 return sysconf(%s) == -1 ? 1 : 0;
1220 ''' % v,
1221 'SYSCONF%s' % v,
1222 msg='Checking whether sysconf(%s) is available' % v)
1224 conf.CHECK_DECLS('__NR_inotify_init', reverse=True, headers='asm/unistd.h')
1226 conf.CHECK_CODE('''
1227 #include <sys/syscall.h>
1228 #include <unistd.h>
1229 syscall(SYS_initgroups, 16, NULL, NULL, 0);
1230 ''',
1231 'HAVE_DARWIN_INITGROUPS',
1232 msg='Checking whether to use the Darwin-specific initgroups system call')
1234 conf.CHECK_CODE('''struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''',
1235 'HAVE_UTIMBUF',
1236 headers='sys/types.h utime.h',
1237 msg='Checking whether struct utimbuf is available')
1239 if conf.CHECK_CODE('''struct sigevent s;''',
1240 'HAVE_STRUCT_SIGEVENT',
1241 headers='sys/types.h stdlib.h stddef.h signal.h',
1242 msg='Checking whether we have the struct sigevent'):
1243 conf.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sival_ptr',
1244 define='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR',
1245 headers='signal.h');
1246 conf.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sigval_ptr',
1247 define='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR',
1248 headers='signal.h');
1250 if os.path.exists('/proc/sys/kernel/core_pattern'):
1251 conf.DEFINE('HAVE_SYS_KERNEL_PROC_CORE_PATTERN', '1')
1253 if conf.CHECK_CODE('''
1254 #include <time.h>
1255 main() {
1256 struct tm *tm;
1257 if (sizeof(time_t) == 8) {
1258 time_t max_time = 0x7fffffffffffffffll;
1259 tm = gmtime(&max_time);
1260 /* This should fail with 32-bit tm_year. */
1261 if (tm == NULL) {
1262 /* Max time_t that works with 32-bit int tm_year in struct tm. */
1263 max_time = 67768036191676799ll;
1264 tm = gmtime(&max_time);
1265 if (tm) {
1266 exit(0);
1270 exit(1);
1271 }''',
1272 '__TIME_T_MAX',
1273 addmain=False,
1274 execute=True,
1275 msg="Checking for the maximum value of the 'time_t' type"):
1276 conf.DEFINE('TIME_T_MAX', '67768036191676799ll')
1278 conf.CHECK_CODE('''
1279 #if defined(HAVE_UNISTD_H)
1280 #include <unistd.h>
1281 #endif
1282 #include <sys/types.h>
1283 main() { dev_t dev = makedev(1,2); return 0; }
1284 ''',
1285 'HAVE_MAKEDEV',
1286 addmain=False,
1287 msg='Checking whether the macro for makedev is available')
1289 conf.CHECK_CODE('''
1290 #include <stdio.h>
1291 #include <limits.h>
1292 #include <signal.h>
1294 void exit_on_core(int ignored) {
1295 exit(1);
1298 main() {
1299 char *newpath;
1300 signal(SIGSEGV, exit_on_core);
1301 newpath = realpath("/tmp", NULL);
1302 exit((newpath != NULL) ? 0 : 1);
1304 ''',
1305 'REALPATH_TAKES_NULL',
1306 addmain=False,
1307 execute=True,
1308 msg='Checking whether the realpath function allows a NULL argument')
1310 conf.CHECK_CODE('''#include "../tests/ftruncate.c"''',
1311 'HAVE_FTRUNCATE_EXTEND',
1312 msg='Checking for ftruncate extend',
1313 addmain=False,
1314 execute=True)
1315 if os.getenv('RUN_FROM_BUILD_FARM'):
1316 Logs.info("enabling buildfarm hacks")
1317 conf.DEFINE('ENABLE_BUILD_FARM_HACKS', '1')
1319 if Options.options.with_sendfile_support:
1320 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):
1321 conf.CHECK_CODE('''
1322 int tofd, fromfd;
1323 off64_t offset;
1324 size_t total;
1325 ssize_t nwritten = sendfile64(tofd, fromfd, &offset, total);
1326 ''',
1327 '_HAVE_SENDFILE64',
1328 headers='sys/sendfile',
1329 msg='Checking for linux sendfile64 support')
1330 conf.CHECK_CODE('''
1331 int tofd, fromfd;
1332 off_t offset;
1333 size_t total;
1334 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1335 ''',
1336 '_HAVE_SENDFILE',
1337 headers='sys/sendfile',
1338 msg='Checking for linux sendfile support')
1340 # Try and cope with broken Linux sendfile....
1341 conf.CHECK_CODE('''#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
1342 #undef _FILE_OFFSET_BITS
1343 #endif
1344 #include <sys/sendfile.h>
1345 int tofd, fromfd;
1346 off_t offset;
1347 size_t total;
1348 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1349 ''',
1350 '_HAVE_BROKEN_LINUX_SENDFILE',
1351 msg='Checking for broken linux sendfile support')
1352 if conf.CONFIG_SET('_HAVE_SENDFILE64'):
1353 conf.DEFINE('HAVE_SENDFILE64', '1')
1354 conf.DEFINE('LINUX_SENDFILE_API', '1')
1355 conf.DEFINE('WITH_SENDFILE', '1')
1356 elif conf.CONFIG_SET('_HAVE_SENDFILE'):
1357 conf.DEFINE('HAVE_SENDFILE', '1')
1358 conf.DEFINE('LINUX_SENDFILE_API', '1')
1359 conf.DEFINE('WITH_SENDFILE', '1')
1360 elif conf.CONFIG_SET('_HAVE_BROKEN_LINUX_SENDFILE'):
1361 conf.DEFINE('LINUX_BROKEN_SENDFILE_API', '1')
1362 conf.DEFINE('WITH_SENDFILE', '1')
1363 elif (host_os.rfind('freebsd') > -1) or (host_os.rfind('dragonfly') > -1):
1364 conf.CHECK_CODE('''
1365 #include <sys/types.h>
1366 #include <unistd.h>
1367 #include <sys/socket.h>
1368 #include <sys/uio.h>
1369 int fromfd, tofd, ret, total=0;
1370 off_t offset, nwritten;
1371 struct sf_hdtr hdr;
1372 struct iovec hdtrl;
1373 hdr.headers = &hdtrl;
1374 hdr.hdr_cnt = 1;
1375 hdr.trailers = NULL;
1376 hdr.trl_cnt = 0;
1377 hdtrl.iov_base = NULL;
1378 hdtrl.iov_len = 0;
1379 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0)
1380 ''',
1381 '_HAVE_SENDFILE',
1382 msg='Checking for freebsd sendfile support')
1383 if conf.CONFIG_SET('_HAVE_SENDFILE'):
1384 conf.DEFINE('HAVE_SENDFILE', '1')
1385 conf.DEFINE('FREEBSD_SENDFILE_API', '1')
1386 conf.DEFINE('WITH_SENDFILE', '1')
1387 elif (host_os.rfind('hpux') > -1):
1388 conf.CHECK_CODE('''
1389 #include <sys/socket.h>
1390 #include <sys/uio.h>
1391 int fromfd, tofd;
1392 size_t total=0;
1393 struct iovec hdtrl[2];
1394 ssize_t nwritten;
1395 off64_t offset;
1396 hdtrl[0].iov_base = 0;
1397 hdtrl[0].iov_len = 0;
1398 nwritten = sendfile64(tofd, fromfd, offset, total, &hdtrl[0], 0);
1399 ''',
1400 '_HAVE_SENDFILE64',
1401 msg='Checking for hpux sendfile64 support')
1402 conf.CHECK_CODE('''
1403 #include <sys/socket.h>
1404 #include <sys/uio.h>
1405 int fromfd, tofd;
1406 size_t total=0;
1407 struct iovec hdtrl[2];
1408 ssize_t nwritten;
1409 off_t offset;
1410 hdtrl[0].iov_base = 0;
1411 hdtrl[0].iov_len = 0;
1412 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
1413 ''',
1414 '_HAVE_SENDFILE',
1415 msg='Checking for hpux sendfile support')
1416 if conf.CONFIG_SET('_HAVE_SENDFILE64'):
1417 conf.DEFINE('HAVE_SENDFILE64', '1')
1418 conf.DEFINE('HPUX_SENDFILE_API', '1')
1419 conf.DEFINE('WITH_SENDFILE', '1')
1420 elif conf.CONFIG_SET('_HAVE_SENDFILE'):
1421 conf.DEFINE('HAVE_SENDFILE', '1')
1422 conf.DEFINE('HPUX_SENDFILE_API', '1')
1423 conf.DEFINE('WITH_SENDFILE', '1')
1424 elif (host_os.rfind('solaris') > -1):
1425 conf.CHECK_FUNCS_IN('sendfile', 'sendfilev')
1426 conf.CHECK_CODE('''
1427 #include <sys/sendfile.h>
1428 int sfvcnt;
1429 size_t xferred;
1430 struct sendfilevec vec[2];
1431 ssize_t nwritten;
1432 int tofd;
1433 sfvcnt = 2;
1434 vec[0].sfv_fd = SFV_FD_SELF;
1435 vec[0].sfv_flag = 0;
1436 vec[0].sfv_off = 0;
1437 vec[0].sfv_len = 0;
1438 vec[1].sfv_fd = 0;
1439 vec[1].sfv_flag = 0;
1440 vec[1].sfv_off = 0;
1441 vec[1].sfv_len = 0;
1442 nwritten = sendfilev64(tofd, vec, sfvcnt, &xferred);
1443 ''',
1444 '_HAVE_SENDFILEV64',
1445 msg='Checking for solaris sendfilev64 support')
1446 conf.CHECK_CODE('''
1447 #include <sys/sendfile.h>,
1448 int sfvcnt;
1449 size_t xferred;
1450 struct sendfilevec vec[2];
1451 ssize_t nwritten;
1452 int tofd;
1453 sfvcnt = 2;
1454 vec[0].sfv_fd = SFV_FD_SELF;
1455 vec[0].sfv_flag = 0;
1456 vec[0].sfv_off = 0;
1457 vec[0].sfv_len = 0;
1458 vec[1].sfv_fd = 0;
1459 vec[1].sfv_flag = 0;
1460 vec[1].sfv_off = 0;
1461 vec[1].sfv_len = 0;
1462 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
1463 ''',
1464 '_HAVE_SENDFILEV',
1465 msg='Checking for solaris sendfilev support')
1466 if conf.CONFIG_SET('_HAVE_SENDFILEV64'):
1467 conf.DEFINE('HAVE_SENDFILEV64', '1')
1468 conf.DEFINE('SOLARIS_SENDFILE_API', '1')
1469 conf.DEFINE('WITH_SENDFILE', '1')
1470 elif conf.CONFIG_SET('_HAVE_SENDFILEV'):
1471 conf.DEFINE('HAVE_SENDFILEV', '1')
1472 conf.DEFINE('SOLARIS_SENDFILE_API', '1')
1473 conf.DEFINE('WITH_SENDFILE', '1')
1474 elif (host_os.rfind('aix') > -1):
1475 conf.CHECK_CODE('''
1476 #include <sys/socket.h>
1477 int fromfd, tofd;
1478 size_t total=0;
1479 struct sf_parms hdtrl;
1480 ssize_t nwritten;
1481 off64_t offset;
1482 hdtrl.header_data = 0;
1483 hdtrl.header_length = 0;
1484 hdtrl.file_descriptor = fromfd;
1485 hdtrl.file_offset = 0;
1486 hdtrl.file_bytes = 0;
1487 hdtrl.trailer_data = 0;
1488 hdtrl.trailer_length = 0;
1489 nwritten = send_file(&tofd, &hdtrl, 0);
1490 ''',
1491 '_HAVE_SENDFILE',
1492 msg='Checking for AIX send_file support')
1493 if conf.CONFIG_SET('_HAVE_SENDFILE'):
1494 conf.DEFINE('HAVE_SENDFILE', '1')
1495 conf.DEFINE('AIX_SENDFILE_API', '1')
1496 conf.DEFINE('WITH_SENDFILE', '1')
1498 conf.CHECK_CODE('''enum TDB_ERROR err = TDB_ERR_NESTING''',
1499 'HAVE_TDB_ERR_NESTING',
1500 headers='tdb.h',
1501 msg='Checking whether we have TDB_ERR_NESTING')
1503 # UnixWare 7.x has its getspnam in -lgen
1504 conf.CHECK_FUNCS_IN('getspnam', 'gen')
1505 conf.CHECK_FUNCS_IN('getspnam', 'security')
1506 conf.CHECK_FUNCS_IN('getspnam', 'sec')
1508 if Options.options.with_quotas:
1509 # For quotas on Veritas VxFS filesystems
1510 conf.CHECK_HEADERS('sys/fs/vx_quota.h')
1511 # For quotas on Linux XFS filesystems
1512 conf.CHECK_HEADERS('linux/dqblk_xfs.h')
1513 # For sys/quota.h and linux/quota.h
1514 conf.CHECK_HEADERS('sys/quota.h')
1518 # checking for clustering extensions (CTDB)
1520 if not Options.options.with_cluster_support:
1521 have_cluster_support = False
1523 else:
1525 if Options.options.ctdb_dir:
1526 conf.ADD_EXTRA_INCLUDES(Options.options.ctdb_dir + '/include')
1528 srcdir = os.path.realpath(conf.srcdir)
1529 if 'EXTRA_INCLUDES' in conf.env:
1530 includes = ' '.join(conf.env['EXTRA_INCLUDES']).replace('#', srcdir + '/')
1531 else:
1532 includes = ''
1534 have_cluster_support = True
1535 ctdb_broken = ""
1537 conf.CHECK_CODE('''
1538 #define NO_CONFIG_H
1539 #include "replace.h"
1540 #include "system/wait.h"
1541 #include "system/network.h"
1542 #define private #error __USED_RESERVED_WORD_private__
1543 #include <talloc.h>
1544 #include <tdb.h>
1545 #include <ctdb.h>
1547 int main(void)
1549 return 0;
1551 ''',
1552 'HAVE_CTDB_H',
1553 addmain=False,
1554 includes=includes,
1555 msg='Checking for header ctdb.h')
1557 if not conf.CONFIG_SET('HAVE_CTDB_H'):
1558 have_cluster_support = False
1559 ctdb_broken = "ctdb.h is required for cluster support"
1561 if have_cluster_support:
1562 conf.CHECK_CODE('''
1563 #define NO_CONFIG_H
1564 #include "replace.h"
1565 #include "system/wait.h"
1566 #include "system/network.h"
1567 #define private #error __USED_RESERVED_WORD_private__
1568 #include <talloc.h>
1569 #include <tdb.h>
1570 #include <ctdb.h>
1571 #include <ctdb_private.h>
1573 int main(void)
1575 return 0;
1577 ''',
1578 'HAVE_CTDB_PRIVATE_H',
1579 addmain=False,
1580 includes=includes,
1581 msg='Checking for header ctdb_private.h')
1583 if not conf.CONFIG_SET('HAVE_CTDB_PRIVATE_H'):
1584 have_cluster_support = False
1585 ctdb_broken = "ctdb_private.h is required for cluster support"
1587 if have_cluster_support:
1588 conf.CHECK_CODE('''
1589 #define NO_CONFIG_H
1590 #include "replace.h"
1591 #include "system/wait.h"
1592 #include "system/network.h"
1593 #include <talloc.h>
1594 #include <tdb.h>
1595 #include <ctdb.h>
1596 #include <ctdb_private.h>
1598 int main(void)
1600 int i = (int)CTDB_CONTROL_TRANS3_COMMIT;
1601 return 0;
1603 ''',
1604 'HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL',
1605 addmain=False,
1606 includes=includes,
1607 msg='Checking for transaction support (TRANS3_COMMIT control)')
1609 if not conf.CONFIG_SET('HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL'):
1610 have_cluster_support = False
1611 ctdb_broken = "ctdb transaction support missing or too old"
1613 if have_cluster_support:
1614 conf.CHECK_CODE('''
1615 #define NO_CONFIG_H
1616 #include "replace.h"
1617 #include "system/wait.h"
1618 #include "system/network.h"
1619 #include <talloc.h>
1620 #include <tdb.h>
1621 #include <ctdb.h>
1622 #include <ctdb_private.h>
1624 int main(void)
1626 int i = (int)CTDB_CONTROL_SCHEDULE_FOR_DELETION;
1627 return 0;
1629 ''',
1630 'HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL',
1631 addmain=False,
1632 includes=includes,
1633 msg='Checking for SCHEDULE_FOR_DELETION control')
1635 if not conf.CONFIG_SET('HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL'):
1636 if not Options.options.enable_old_ctdb:
1637 have_cluster_support = False
1638 ctdb_broken = "SCHEDULE_FOR_DELETION control missing"
1639 else:
1640 Logs.warn("ignoring missing SCHEDULE_FOR_DELETION control (--enable-old-ctdb)")
1642 if have_cluster_support:
1643 conf.CHECK_CODE('''
1644 #define NO_CONFIG_H
1645 #include "replace.h"
1646 #include "system/wait.h"
1647 #include "system/network.h"
1648 #include <talloc.h>
1649 #include <tdb.h>
1650 #include <ctdb.h>
1651 #include <ctdb_private.h>
1653 int main(void)
1655 struct ctdb_control_tcp _x;
1656 return 0;
1658 ''',
1659 'HAVE_STRUCT_CTDB_CONTROL_TCP',
1660 addmain=False,
1661 includes=includes,
1662 msg='Checking for ctdb ipv4 support')
1664 if not conf.CONFIG_SET('HAVE_STRUCT_CTDB_CONTROL_TCP'):
1665 have_cluster_support = False
1666 ctdb_broken = "missing struct ctdb_control_tcp"
1668 if have_cluster_support:
1669 conf.CHECK_CODE('''
1670 #define NO_CONFIG_H
1671 #include "replace.h"
1672 #include "system/wait.h"
1673 #include "system/network.h"
1674 #include <talloc.h>
1675 #include <tdb.h>
1676 #include <ctdb.h>
1677 #include <ctdb_private.h>
1679 int main(void)
1681 struct ctdb_control_tcp_addr _x;
1682 return 0;
1684 ''',
1685 'HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR',
1686 addmain=False,
1687 includes=includes,
1688 msg='Checking for ctdb ipv6 support')
1690 if have_cluster_support:
1691 Logs.info("building with cluster support")
1692 conf.DEFINE('CLUSTER_SUPPORT', 1);
1693 else:
1694 if not Options.options.with_cluster_support:
1695 Logs.info("building without cluster support")
1696 else:
1697 Logs.warn("building without cluster support: " + ctdb_broken)
1698 conf.undefine('CLUSTER_SUPPORT')
1702 conf.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }',
1703 'HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR',
1704 addmain=False,
1705 link=False,
1706 msg='Checking whether we can compile with __attribute__((destructor))')
1708 conf.CHECK_CODE('void seekdir(DIR *d, long loc) { return; }',
1709 'SEEKDIR_RETURNS_VOID',
1710 headers='sys/types.h dirent.h',
1711 msg='Checking whether seekdir returns void')
1713 if Options.options.with_profiling_data:
1714 conf.DEFINE('WITH_PROFILE', 1);
1716 PTHREAD_CFLAGS='error'
1717 PTHREAD_LDFLAGS='error'
1719 if PTHREAD_LDFLAGS == 'error':
1720 if conf.CHECK_FUNCS_IN('pthread_attr_init', 'pthread'):
1721 PTHREAD_CFLAGS='-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS'
1722 PTHREAD_LDFLAGS='-lpthread'
1723 if PTHREAD_LDFLAGS == 'error':
1724 if conf.CHECK_FUNCS_IN('pthread_attr_init', 'pthreads'):
1725 PTHREAD_CFLAGS='-D_THREAD_SAFE'
1726 PTHREAD_LDFLAGS='-lpthreads'
1727 if PTHREAD_LDFLAGS == 'error':
1728 if conf.CHECK_FUNCS_IN('pthread_attr_init', 'c_r'):
1729 PTHREAD_CFLAGS='-D_THREAD_SAFE -pthread'
1730 PTHREAD_LDFLAGS='-pthread'
1731 if PTHREAD_LDFLAGS == 'error':
1732 if conf.CHECK_FUNC('pthread_attr_init'):
1733 PTHREAD_CFLAGS='-D_REENTRANT'
1734 PTHREAD_LDFLAGS='-lpthread'
1735 # especially for HP-UX, where the CHECK_FUNC macro fails to test for
1736 # pthread_attr_init. On pthread_mutex_lock it works there...
1737 if PTHREAD_LDFLAGS == 'error':
1738 if conf.CHECK_FUNCS_IN('pthread_mutex_lock', 'pthread'):
1739 PTHREAD_CFLAGS='-D_REENTRANT'
1740 PTHREAD_LDFLAGS='-lpthread'
1742 if PTHREAD_CFLAGS != 'error' and PTHREAD_LDFLAGS != 'error':
1743 conf.ADD_CFLAGS(PTHREAD_CFLAGS)
1744 conf.ADD_LDFLAGS(PTHREAD_LDFLAGS)
1745 conf.CHECK_HEADERS('pthread.h')
1746 conf.DEFINE('HAVE_PTHREAD', '1')
1748 if conf.CHECK_HEADERS('gpfs_gpl.h'):
1749 conf.DEFINE('HAVE_GPFS', '1')
1751 default_static_modules=TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
1752 auth_sam auth_unix auth_winbind auth_wbc auth_server
1753 auth_domain auth_builtin vfs_default
1754 nss_info_template idmap_tdb idmap_passdb
1755 idmap_nss''')
1757 default_shared_modules=TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
1758 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
1759 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850
1760 charset_CP437 auth_script vfs_readahead vfs_xattr_tdb
1761 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
1762 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
1763 vfs_crossrename vfs_linux_xfs_sgid
1764 vfs_time_audit idmap_autorid''')
1766 if Options.options.developer:
1767 default_static_modules.extend(TO_LIST('pdb_ads auth_netlogond'))
1768 default_shared_modules.extend(TO_LIST('charset_weird perfcount_test'))
1770 if Options.options.with_acl_support and conf.CONFIG_SET('HAVE_POSIX_ACLS'):
1771 default_static_modules.extend(TO_LIST('vfs_posixacl'))
1773 if conf.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'):
1774 default_shared_modules.extend(TO_LIST('vfs_zfsacl'))
1776 if conf.CONFIG_SET('HAVE_DIRFD_DECL'):
1777 default_shared_modules.extend(TO_LIST('vfs_syncops vfs_dirsort'))
1779 if conf.CONFIG_SET('HAVE_STATFS_F_FSID'):
1780 default_shared_modules.extend(TO_LIST('vfs_fileid'))
1782 if conf.CONFIG_SET('HAVE_AIO') and (conf.CONFIG_SET('HAVE_MSGHDR_MSG_CONTROL') or conf.CONFIG_SET('HAVE_MSGHDR_MSG_ACCTRIGHTS')):
1783 default_shared_modules.extend(TO_LIST('vfs_aio_fork'))
1785 if conf.CONFIG_SET('HAVE_LDAP'):
1786 default_static_modules.extend(TO_LIST('pdb_ldap idmap_ldap'))
1788 if conf.CONFIG_SET('DARWINOS'):
1789 default_shared_modules.extend(TO_LIST('charset_macosxfs'))
1791 if conf.CONFIG_SET('HAVE_GPFS'):
1792 default_shared_modules.extend(TO_LIST('vfs_gpfs vfs_gpfs_hsm_notify'))
1794 explicit_shared_modules = TO_LIST(Options.options.shared_modules, delimiter=',')
1795 explicit_static_modules = TO_LIST(Options.options.static_modules, delimiter=',')
1797 final_static_modules = default_static_modules
1798 final_shared_modules = default_shared_modules
1800 for m in explicit_static_modules:
1801 if m in final_shared_modules:
1802 final_shared_modules.remove(m)
1803 final_static_modules.append(m)
1804 for m in explicit_shared_modules:
1805 if m in final_static_modules:
1806 final_static_modules.remove(m)
1807 final_shared_modules.append(m)
1809 conf.env['static_modules'] = final_static_modules
1810 conf.env['shared_modules'] = final_shared_modules
1812 conf.DEFINE('STRING_STATIC_MODULES', ' '.join(final_static_modules), quote=True)
1814 static_list = {}
1815 shared_list = {}
1817 prefixes = ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
1818 conf.env['MODULE_PREFIXES'] = prefixes
1819 for p in prefixes:
1820 for m in final_static_modules:
1821 if m.find(p) == 0:
1822 if not p in static_list:
1823 static_list[p] = []
1824 static_list[p].append(m)
1825 for m in final_shared_modules:
1826 if m.find(p) == 0:
1827 if not p in shared_list:
1828 shared_list[p] = []
1829 shared_list[p].append(m)
1831 for p in prefixes:
1832 static_env = "%s_STATIC" % p.upper()
1833 shared_env = "%s_SHARED" % p.upper()
1834 conf.env[static_env] = []
1835 conf.env[shared_env] = []
1836 if p in static_list:
1837 decl_list=""
1838 for entry in static_list[p]:
1839 decl_list += "extern NTSTATUS %s_init(void); " % entry
1840 conf.env[static_env].append('%s' % entry)
1841 decl_list = decl_list.rstrip()
1842 conf.DEFINE('static_decl_%s' % p, decl_list)
1843 conf.DEFINE('static_init_%s' % p, '{ %s_init(); }' % '_init(); '.join(static_list[p]))
1844 else:
1845 conf.DEFINE('static_decl_%s' % p, '')
1846 conf.DEFINE('static_init_%s' % p, '{}')
1847 if p in shared_list:
1848 for entry in shared_list[p]:
1849 conf.DEFINE('%s_init' % entry, 'init_samba_module')
1850 conf.env[shared_env].append('%s' % entry)
1852 conf.SAMBA_CONFIG_H('include/config.h')
1854 def ctags(ctx):
1855 "build 'tags' file using ctags"
1856 import Utils
1857 source_root = os.path.dirname(Utils.g_module.root_path)
1858 cmd = 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
1859 print("Running: %s" % cmd)
1860 os.system(cmd)
1862 if not os.getenv('TOPLEVEL_BUILD'):
1863 def wildcard_cmd(cmd):
1864 '''called on a unknown command'''
1865 from samba_wildcard import run_named_build_task
1866 run_named_build_task(cmd)
1867 def main():
1868 from samba_wildcard import wildcard_main
1869 wildcard_main(wildcard_cmd)
1870 Scripting.main = main