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
15 import samba_utils
, samba_version
19 if not os
.getenv('TOPLEVEL_BUILD'):
20 opt
.BUILTIN_DEFAULT('NONE')
21 opt
.PRIVATE_EXTENSION_DEFAULT('s3')
22 opt
.RECURSE('../lib/replace')
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')
63 opt
.SAMBA3_ADD_OPTION('cluster-support')
65 opt
.add_option('--with-ctdb-dir',
66 help=("Directory under which ctdb is installed"),
67 action
="store", dest
='ctdb_dir', default
=None)
68 opt
.add_option('--enable-old-ctdb',
69 help=("enable building against (too) old version of ctdb (default=false)"),
70 action
="store_true", dest
='enable_old_ctdb', default
=False)
75 from samba_utils
import TO_LIST
77 if not conf
.env
.toplevel_build
:
78 version
= samba_version
.load_version(env
=conf
.env
)
79 conf
.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
80 conf
.DEFINE('_SAMBA_BUILD_', version
.MAJOR
, add_to_cflags
=True)
81 conf
.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags
=True)
83 if Options
.options
.developer
:
84 conf
.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
85 conf
.env
.developer
= True
87 if Options
.options
.with_swat
:
88 conf
.env
['build_swat'] = True
90 if not conf
.env
.toplevel_build
:
91 conf
.RECURSE('../lib/replace')
93 conf
.RECURSE('../lib/tdb')
94 conf
.RECURSE('../lib/talloc')
95 conf
.RECURSE('../lib/tevent')
96 conf
.RECURSE('../lib/popt')
97 conf
.RECURSE('../lib/nss_wrapper')
98 conf
.RECURSE('../lib/socket_wrapper')
99 conf
.RECURSE('../lib/zlib')
100 conf
.RECURSE('../libcli/smbreadline')
101 conf
.RECURSE('../lib/util')
103 conf
.ADD_EXTRA_INCLUDES('''#source3 #source3/include #lib/replace''')
104 if not conf
.env
.USING_SYSTEM_TDB
:
105 conf
.ADD_EXTRA_INCLUDES('#lib/tdb/include')
106 if not conf
.env
.USING_SYSTEM_TEVENT
:
107 conf
.ADD_EXTRA_INCLUDES('#lib/tevent')
108 if not conf
.env
.USING_SYSTEM_TALLOC
:
109 conf
.ADD_EXTRA_INCLUDES('#lib/talloc')
110 if not conf
.env
.USING_SYSTEM_POPT
:
111 conf
.ADD_EXTRA_INCLUDES('#lib/popt')
113 conf
.ADD_LDFLAGS("-Wl,--export-dynamic", testflags
=True)
115 conf
.CHECK_HEADERS('execinfo.h libexc.h libunwind.h netdb.h')
116 conf
.CHECK_HEADERS('linux/falloc.h')
118 conf
.CHECK_FUNCS('getcwd fchown chmod fchmod mknod mknod64')
119 conf
.CHECK_FUNCS('strtol strchr strupr chflags')
120 conf
.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
121 conf
.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
122 conf
.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr')
123 conf
.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
124 conf
.CHECK_FUNCS('setpriv setgidx setuidx setgroups sysconf stat64 fstat64')
125 conf
.CHECK_FUNCS('lstat64 fopen64 atexit grantpt lseek64 ftruncate64 fallocate fallocate64 posix_fallocate posix_fallocate64')
126 conf
.CHECK_FUNCS('fseek64 fseeko64 ftell64 ftello64 setluid')
127 conf
.CHECK_FUNCS('getpwnam', headers
='sys/types.h pwd.h')
128 conf
.CHECK_FUNCS('opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64')
129 conf
.CHECK_FUNCS('fdopendir fdopendir64')
130 conf
.CHECK_FUNCS('getpwent_r getdents64 setenv strcasecmp fcvt fcvtl')
131 conf
.CHECK_FUNCS('syslog vsyslog timegm setlocale nl_langinfo')
132 conf
.CHECK_FUNCS_IN('nanosleep', 'rt')
133 conf
.CHECK_FUNCS('lutimes futimes utimensat futimens')
134 conf
.CHECK_FUNCS('mlock munlock mlockall munlockall')
135 conf
.CHECK_FUNCS('memalign posix_memalign hstrerror')
136 conf
.CHECK_FUNCS('shmget')
137 conf
.CHECK_FUNCS_IN('shm_open', 'rt', checklibc
=True)
138 conf
.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain')
139 #FIXME: for some reason this one still fails
140 conf
.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
141 conf
.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
142 conf
.CHECK_DECLS('fdatasync', reverse
=True)
143 conf
.CHECK_DECLS('readahead', reverse
=True, headers
='fcntl.h')
145 if conf
.CONFIG_SET('HAVE_LONG_LONG'):
146 conf
.DEFINE('HAVE_LONGLONG', 1)
148 if conf
.CHECK_CODE('''
149 #if defined(HAVE_UNISTD_H)
152 long ret = splice(0,0,1,0,400,0);
156 conf
.CHECK_DECLS('splice', reverse
=True, headers
='fcntl.h')
158 # Check for inotify support
159 conf
.CHECK_HEADERS('linux/inotify.h asm/unistd.h sys/inotify.h')
160 conf
.CHECK_FUNCS('inotify_init')
161 if "HAVE_LINUX_INOTIFY_H" in conf
.env
and "HAVE_INOTIFY_INIT" in conf
.env
:
162 conf
.DEFINE('HAVE_INOTIFY', 1)
164 # Check for kernel change notify support
167 #define F_NOTIFY 1026
170 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
171 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain
=False, execute
=True,
172 headers
='fcntl.h signal.h',
173 msg
="Checking for kernel change notify support")
175 # Check for Linux kernel oplocks
177 #include <sys/types.h>
181 #define F_NOTIFY 1026
184 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
185 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain
=False, execute
=True,
186 msg
="Checking for Linux kernel oplocks")
188 # Check for IRIX kernel oplock types
189 conf
.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
190 'HAVE_KERNEL_OPLOCKS_IRIX', headers
='fcntl.h',
191 msg
="Checking for IRIX kernel oplock types")
193 # Check for krenel share modes
195 #include <sys/types.h>
198 #include <sys/file.h>
204 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
205 }''', 'HAVE_KERNEL_SHARE_MODES', addmain
=False, execute
=True,
206 msg
="Checking for krenel share modes")
208 # Check for various members of the stat structure
209 conf
.CHECK_TYPES('blksize_t blkcnt_t')
210 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define
='HAVE_STAT_ST_BLOCKS',
211 headers
='sys/stat.h')
212 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define
='HAVE_STAT_ST_BLKSIZE',
213 headers
='sys/stat.h')
214 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_flags', define
='HAVE_STAT_ST_FLAGS',
215 headers
='sys/types.h sys/stat.h unistd.h')
217 # Check for POSIX capability support
218 conf
.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers
='sys/capability.h')
220 if "HAVE_SYS_CAPABILITY_H" in conf
.env
:
224 if (!(cap = cap_get_proc())) exit(1);
226 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
227 cap_set_proc(cap);''',
228 'HAVE_POSIX_CAPABILITIES', execute
=True, lib
="cap",
229 headers
='sys/capability.h',
230 msg
="Checking whether POSIX capabilities are available")
232 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
233 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
235 if conf
.CONFIG_SET("HAVE_RPC_RPC_H"):
236 conf
.CHECK_TYPE('int16', headers
='rpc/rpc.h',
237 define
='HAVE_INT16_FROM_RPC_RPC_H',
238 msg
="Checking for int16 typedef included by rpc/rpc.h")
239 conf
.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
240 headers
='sys/types.h rpc/rpc.h',
241 msg
="Checking for uint16 typedef included by rpc/rpc.h")
242 conf
.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
243 headers
='sys/types.h rpc/rpc.h',
244 msg
="Checking for int32 typedef included by rpc/rpc.h")
245 conf
.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
246 headers
='sys/types.h rpc/rpc.h',
247 msg
="Checking for uint32 typedef included by rpc/rpc.h")
248 conf
.CHECK_CODE('int i;', 'BROKEN_NISPLUS_INCLUDE_FILES',
249 headers
='sys/types.h sys/acl.h rpcsvc/nis.h',
250 msg
="Checking for broken nisplus include files")
252 # Check if the compiler will optimize out functions
255 this_function_does_not_exist();
258 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
259 msg
="Checking if the compiler will optimize out functions")
261 # Check if the compiler supports the LL suffix on long long integers
263 conf
.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL',
265 msg
="Checking for LL suffix on long long integers")
268 _acl __acl add_proplist_entry atexit attr_getf attr_list attr_listf
269 attropen attr_remove attr_removef attr_set attr_setf backtrace_symbols
270 bindtextdomain _chdir __chdir chflags chmod _close __close _closedir
271 __closedir closedir64 creat64 crypt16 delproplist devnm dgettext dirfd
272 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
273 extattr_delete_fd extattr_delete_link extattr_get_fd extattr_get_file
274 extattr_get_link extattr_list_fd extattr_list_file extattr_list_link
275 extattr_set_fd extattr_set_file extattr_set_link _facl __facl _fchdir
276 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
277 fdelproplist fgetea fgetproplist fgetxattr flistea flistxattr fopen64
278 _fork __fork fremoveea fremovexattr fseek64 fseeko64 fsetea
279 fsetproplist fsetxattr _fstat __fstat fstat64 _fstat64 __fstat64 fsync
280 ftell64 ftello64 ftruncate64 futimens futimes __fxstat getauthuid
281 getcwd _getcwd __getcwd getdents __getdents getdents64 getdirentries
282 getgrent getgrnam getgrouplist getgrset getmntent getpagesize
283 getproplist get_proplist_entry getpwanam getpwent_r getrlimit gettext
284 glob grantpt hstrerror initgroups innetgr
285 inotify_init lgetea lgetxattr listea listxattr llistea llistxattr
286 llseek _llseek __llseek lremoveea lremovexattr _lseek __lseek lseek64
287 lsetea lsetxattr _lstat __lstat lstat64 _lstat64 __lstat64 lutimes
288 __lxstat memalign mknod mknod64 mlock mlockall munlock munlockall
289 nl_langinfo _open __open open64 _open64 __open64 _opendir __opendir
290 opendir64 pathconf poll posix_fallocate posix_fallocate64
291 posix_memalign prctl pread _pread __pread pread64 _pread64 __pread64
292 pwrite _pwrite __pwrite pwrite64 _pwrite64
293 __pwrite64 rdchk _read __read _readdir __readdir readdir64 _readdir64
294 __readdir64 removeea removexattr rewinddir64 _seekdir __seekdir
295 seekdir64 select setea setenv setgidx setgroups setlocale setluid
296 setmntent setpgid setpriv setproplist setsid setuidx
297 setxattr shmget shm_open sigaction sigblock sigprocmask sigset
298 sizeof_proplist_entry _stat __stat stat64 _stat64 __stat64 statvfs
299 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctlbyname
300 __sys_llseek syslog _telldir __telldir telldir64 textdomain timegm
301 utimensat vsyslog _write __write __xstat
304 conf
.CHECK_SAMBA3_CHARSET() # see build/charset.py
306 # FIXME: these should be tests for features, but the old build system just
309 host_os
= sys
.platform
310 Logs
.info("building on %s" % host_os
)
312 # Python doesn't have case switches... :/
313 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
314 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
316 conf
.SET_TARGET_TYPE('sunacl', 'EMPTY')
317 if (host_os
.rfind('linux') > -1) or (host_os
.rfind('gnu') > -1) or (host_os
.rfind('qnx') > -1):
318 if host_os
.rfind('linux') > -1:
319 conf
.DEFINE('LINUX', '1')
320 elif host_os
.rfind('qnx') > -1:
321 conf
.DEFINE('QNX', '1')
322 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
323 elif (host_os
.rfind('darwin') > -1):
324 conf
.DEFINE('DARWINOS', 1)
325 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
326 conf
.ADD_CFLAGS('-fno-common')
327 elif (host_os
.rfind('freebsd') > -1):
328 if conf
.CHECK_HEADERS('sunacl.h'):
329 conf
.define('HAVE_FREEBSD_SUNACL_H', '1')
330 conf
.CHECK_FUNCS_IN('acl', 'sunacl')
331 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
332 elif (host_os
.rfind('netbsd') > -1):
333 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
334 elif (host_os
.rfind('openbsd') > -1):
335 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
336 # FIXME: Add more checks here.
338 Logs
.warn("Unknown host_os '%s', please report this to samba-technical@samba.org" % host_os
)
340 #FIXME: add more checks
341 if Options
.options
.with_acl_support
:
342 if host_os
.rfind('linux') > -1:
343 conf
.CHECK_FUNCS_IN('acl_get_file', 'acl')
344 conf
.CHECK_FUNCS_IN('getxattr', 'attr')
345 if conf
.CHECK_CODE('''
348 acl_entry_t *entry_p;
349 return acl_get_entry(acl, entry_id, entry_p);
352 headers
='sys/types.h sys/acl.h', link
=False,
353 msg
="Checking for POSIX ACL support") :
355 acl_permset_t permset_d;
357 return acl_get_perm_np(permset_d, perm);
359 'HAVE_ACL_GET_PERM_NP',
360 headers
='sys/types.h sys/acl.h', link
=True,
361 msg
="Checking whether acl_get_perm_np() is available")
363 conf
.DEFINE('HAVE_NO_ACLS', 1)
364 conf
.SET_TARGET_TYPE('acl', 'EMPTY')
366 conf
.DEFINE('HAVE_NO_ACLS', 1)
367 conf
.SET_TARGET_TYPE('acl', 'EMPTY')
369 if conf
.CHECK_FUNCS('dirfd'):
370 conf
.DEFINE('HAVE_DIRFD_DECL', 1)
372 conf
.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
373 'HAVE_STATFS_F_FSID',
374 msg
="vfs_fileid: checking for statfs() and struct statfs.f_fsid",
375 headers
='sys/types.h sys/statfs.h',
378 if conf
.CONFIG_SET('HAVE_FALLOCATE'):
380 #if defined(HAVE_UNISTD_H)
383 #include <sys/types.h>
386 #if defined(HAVE_LINUX_FALLOC_H)
387 #include <linux/falloc.h>
389 int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
390 'HAVE_LINUX_FALLOCATE',
391 msg
="Checking whether the Linux 'fallocate' function is available")
392 if conf
.CONFIG_SET('HAVE_FALLOCATE64'):
394 #if defined(HAVE_UNISTD_H)
397 #include <sys/types.h>
400 #if defined(HAVE_LINUX_FALLOC_H)
401 #include <linux/falloc.h>
403 int ret = fallocate64(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
404 'HAVE_LINUX_FALLOCATE64',
405 msg
="Checking whether the Linux 'fallocate64' function is available")
407 #if defined(HAVE_UNISTD_H)
411 ssize_t err = readahead(0,0,0x80000);''',
412 'HAVE_LINUX_READAHEAD',
413 msg
="Checking whether Linux readahead is available")
414 conf
.CHECK_DECLS('readahead', headers
='fcntl.h', always
=True)
417 #include <sys/types.h>
418 #include <sys/socket.h>],
421 int ret = getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len);''',
423 msg
="Checking whether we can use SO_PEERCRED to get socket credentials")
426 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
427 #include <sys/types.h>
432 'HAVE_EXPLICIT_LARGEFILE_SUPPORT',
433 msg
="Checking whether large file support can be enabled")
435 if Options
.options
.with_aio_support
:
436 conf
.CHECK_FUNCS_IN('aio_read', 'aio')
437 conf
.CHECK_FUNCS_IN('aio_read', 'rt')
438 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);',
440 msg
='Checking for asynchronous io support',
441 headers
='sys/types.h aio.h',
443 conf
.CHECK_CODE('struct aiocb64 a; return aio_read64(&a);',
445 msg
='Checking for 64-bit asynchronous io support',
446 headers
='sys/types.h aio.h',
448 if conf
.CONFIG_SET('HAVE_AIO64'):
449 conf
.DEFINE('HAVE_AIOCB64', '1')
450 conf
.DEFINE('WITH_AIO', '1')
451 elif conf
.CONFIG_SET('HAVE_AIO'):
452 conf
.DEFINE('WITH_AIO', '1')
453 if conf
.CONFIG_SET('HAVE_AIO'):
454 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg
='Checking for aio_read', headers
='aio.h', lib
='aio rt')
455 conf
.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg
='Checking for aio_write', headers
='aio.h', lib
='aio rt')
456 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')
457 conf
.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg
='Checking for aio_return', headers
='aio.h', lib
='aio rt')
458 conf
.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg
='Checking for aio_error', headers
='aio.h', lib
='aio rt')
459 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')
460 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')
461 if conf
.CONFIG_SET('HAVE_AIO64'):
462 conf
.CHECK_CODE('struct aiocb a; return aio_read64(&a);', 'HAVE_AIO_READ64', msg
='Checking for aio_read64', headers
='aio.h', lib
='aio rt')
463 conf
.CHECK_CODE('struct aiocb a; return aio_write64(&a);', 'HAVE_AIO_WRITE64', msg
='Checking for aio_write64', headers
='aio.h', lib
='aio rt')
464 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')
465 conf
.CHECK_CODE('struct aiocb a; return aio_return64(&a);', 'HAVE_AIO_RETURN64', msg
='Checking for aio_return64', headers
='aio.h', lib
='aio rt')
466 conf
.CHECK_CODE('struct aiocb a; return aio_error64(&a);', 'HAVE_AIO_ERROR64', msg
='Checking for aio_error64', headers
='aio.h', lib
='aio rt')
467 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')
468 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')
469 if not conf
.CONFIG_SET('HAVE_AIO'):
470 conf
.DEFINE('HAVE_NO_AIO', '1')
472 conf
.DEFINE('HAVE_NO_AIO', '1')
478 char control[CMSG_SPACE(sizeof(int))];
480 msg.msg_control = control_un.control;
481 msg.msg_controllen = sizeof(control_un.control);
483 'HAVE_MSGHDR_MSG_CONTROL',
484 msg
='Checking if we can use msg_control for passing file descriptors',
485 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
489 msg.msg_acctrights = (caddr_t) &fd;
490 msg.msg_acctrightslen = sizeof(fd);
492 'HAVE_MSGHDR_MSG_ACCTRIGHTS',
493 msg
='Checking if we can use msg_acctrights for passing file descriptors',
494 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
496 if Options
.options
.with_winbind
:
497 conf
.env
.build_winbind
= True
498 conf
.DEFINE('WITH_WINBIND', '1')
500 conf
.find_program('awk', var
='AWK')
501 conf
.find_program('perl', var
='PERL')
503 # Darwin has extra options to xattr-family functions
504 conf
.CHECK_CODE('getxattr(0, 0, 0, 0, 0, 0);',
506 msg
="Checking whether xattr interface takes additional options",
507 headers
='sys/types.h attr/xattr.h sys/xattr.h')
509 conf
.CHECK_HEADERS('asm/types.h')
511 conf
.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
512 headers
='unistd.h sys/types.h',
513 msg
="Checking for major macro")
515 conf
.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
516 headers
='unistd.h sys/types.h',
517 msg
="Checking for minor macro")
519 conf
.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
520 headers
='unistd.h sys/types.h dirent.h',
521 define
='HAVE_DIRENT_D_OFF')
523 conf
.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent')
524 conf
.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE',
525 msg
="Checking for setnetgrent prototype",
526 headers
='netdb.h netgroup.h',
527 cflags
="-Werror-implicit-function-declaration")
528 conf
.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE',
529 msg
="Checking for getnetgrent prototype",
530 headers
='netdb.h netgroup.h',
531 cflags
="-Werror-implicit-function-declaration")
532 conf
.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE',
533 msg
="Checking for endnetgrent prototype",
534 headers
='netdb.h netgroup.h',
535 cflags
="-Werror-implicit-function-declaration")
539 if Options
.options
.with_cups
:
540 conf
.find_program('cups-config', var
='CUPS_CONFIG')
541 if conf
.env
.CUPS_CONFIG
:
542 # we would normally use --libs here, but cups-config incorrectly adds
543 # gssapi_krb5 and other libraries to its --libs output. That breaks the use
544 # of an in-tree heimdal kerberos
545 conf
.check_cfg(path
=conf
.env
.CUPS_CONFIG
, args
="--cflags --ldflags",
546 package
="", uselib_store
="cups")
547 conf
.CHECK_HEADERS('cups/cups.h cups/language.h', lib
='cups')
548 conf
.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups')
549 if conf
.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf
.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
550 conf
.DEFINE('HAVE_CUPS', '1')
552 conf
.undefine('HAVE_CUPS')
553 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
555 # define an empty subsystem for cups, to allow it to be used as an empty dependency
556 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
558 if Options
.options
.with_iprint
:
559 if conf
.CONFIG_SET('HAVE_CUPS'):
560 conf
.DEFINE('HAVE_IPRINT', '1')
562 Logs
.warn("--enable-iprint=yes but cups support not sufficient")
563 if Options
.options
.with_syslog
:
564 conf
.DEFINE('WITH_SYSLOG', '1')
565 if Options
.options
.with_automount
:
566 conf
.DEFINE('WITH_AUTOMOUNT', '1')
569 if Options
.options
.with_ldap
:
570 conf
.CHECK_HEADERS('ldap.h lber.h')
571 conf
.CHECK_TYPE('ber_tag_t', 'unsigned int', headers
='ldap.h lber.h')
572 conf
.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
573 conf
.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers
='ldap.h')
575 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
577 conf
.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
578 define
='HAVE_LBER_LOG_PRINT_FN', headers
='lber.h')
580 conf
.CHECK_FUNCS_IN('ldap_init ldap_initialize ldap_set_rebind_proc', 'ldap')
581 conf
.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
583 # Check if ldap_set_rebind_proc() takes three arguments
584 if conf
.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
585 'LDAP_SET_REBIND_PROC_ARGS',
586 msg
="Checking whether ldap_set_rebind_proc takes 3 arguments",
587 headers
='ldap.h lber.h', link
=False):
588 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
590 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
592 # last but not least, if ldap_init() exists, we want to use ldap
593 if conf
.CONFIG_SET('HAVE_LDAP_INIT'):
594 conf
.DEFINE('HAVE_LDAP', '1')
595 conf
.DEFINE('LDAP_DEPRECATED', '1')
596 conf
.env
['HAVE_LDAP'] = '1'
597 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
598 # SASL wrapping hooks
599 if conf
.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
600 conf
.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
601 conf
.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
603 conf
.SET_TARGET_TYPE('ldap', 'EMPTY')
604 conf
.SET_TARGET_TYPE('lber', 'EMPTY')
608 if Options
.options
.with_krb5
and not conf
.env
.toplevel_build
:
609 Logs
.info("Looking for kerberos features")
610 conf
.find_program('krb5-config', var
='KRB5_CONFIG')
611 if conf
.env
.KRB5_CONFIG
:
612 conf
.check_cfg(path
="krb5-config", args
="--cflags --libs",
613 package
="gssapi", uselib_store
="krb5")
614 conf
.CHECK_HEADERS('krb5.h krb5/locate_plugin.h', lib
='krb5')
615 conf
.CHECK_HEADERS('gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h gssapi/gssapi_ext.h com_err.h', lib
='krb5')
617 if conf
.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'):
618 conf
.env
['WINBIND_KRB5_LOCATOR'] = 'bin/winbind_krb5_locator.so'
620 conf
.CHECK_FUNCS_IN('_et_list', 'com_err')
621 conf
.CHECK_FUNCS_IN('krb5_encrypt_data', 'k5crypto')
622 conf
.CHECK_FUNCS_IN('crypto', 'des_set_key')
623 conf
.CHECK_FUNCS_IN('copy_Authenticator', 'asn1')
624 conf
.CHECK_FUNCS_IN('roken_getaddrinfo_hostspec', 'roken')
625 if conf
.CHECK_FUNCS_IN('gss_display_status', 'gssapi') or \
626 conf
.CHECK_FUNCS_IN('gss_display_status', 'gssapi_krb5'):
628 conf
.CHECK_FUNCS_IN('gss_wrap_iov', 'gssapi gssapi_krb5 krb5')
629 conf
.CHECK_FUNCS_IN('krb5_mk_req_extended krb5_kt_compare', 'krb5')
631 krb5_set_real_time krb5_set_default_in_tkt_etypes krb5_set_default_tgs_enctypes
632 krb5_set_default_tgs_ktypes krb5_principal2salt krb5_use_enctype
633 krb5_string_to_key krb5_get_pw_salt krb5_string_to_key_salt krb5_auth_con_setkey
634 krb5_auth_con_setuseruserkey krb5_locate_kdc krb5_get_permitted_enctypes
635 krb5_get_default_in_tkt_etypes krb5_free_data_contents
636 krb5_principal_get_comp_string krb5_free_unparsed_name
637 krb5_free_keytab_entry_contents krb5_kt_free_entry krb5_krbhst_init
638 krb5_krbhst_get_addrinfo krb5_c_enctype_compare krb5_enctypes_compatible_keys
639 krb5_crypto_init krb5_crypto_destroy krb5_decode_ap_req free_AP_REQ
640 krb5_verify_checksum krb5_c_verify_checksum krb5_principal_compare_any_realm
641 krb5_parse_name_norealm krb5_princ_size krb5_get_init_creds_opt_set_pac_request
642 krb5_get_renewed_creds krb5_get_kdc_cred krb5_free_error_contents
643 initialize_krb5_error_table krb5_get_init_creds_opt_alloc
644 krb5_get_init_creds_opt_free krb5_get_init_creds_opt_get_error
645 krb5_enctype_to_string krb5_fwd_tgt_creds krb5_auth_con_set_req_cksumtype
646 krb5_get_creds_opt_alloc krb5_get_creds_opt_set_impersonate krb5_get_creds
647 krb5_get_credentials_for_user krb5_get_host_realm krb5_free_host_realm''',
649 conf
.CHECK_DECLS('''krb5_get_credentials_for_user
650 krb5_auth_con_set_req_cksumtype''',
651 headers
='krb5.h', always
=True)
652 conf
.CHECK_VARIABLE('AP_OPTS_USE_SUBKEY', headers
='krb5.h')
653 conf
.CHECK_VARIABLE('KV5M_KEYTAB', headers
='krb5.h')
654 conf
.CHECK_VARIABLE('KRB5_KU_OTHER_CKSUM', headers
='krb5.h')
655 conf
.CHECK_VARIABLE('KRB5_KEYUSAGE_APP_DATA_CKSUM', headers
='krb5.h')
656 conf
.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'key', headers
='krb5.h',
657 define
='HAVE_KRB5_KEYTAB_ENTRY_KEY')
658 conf
.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'keyblock', headers
='krb5.h',
659 define
='HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK')
660 conf
.CHECK_STRUCTURE_MEMBER('krb5_address', 'magic', headers
='krb5.h',
661 define
='HAVE_MAGIC_IN_KRB5_ADDRESS')
662 conf
.CHECK_STRUCTURE_MEMBER('krb5_address', 'addrtype', headers
='krb5.h',
663 define
='HAVE_ADDRTYPE_IN_KRB5_ADDRESS')
664 conf
.CHECK_STRUCTURE_MEMBER('krb5_ticket', 'enc_part2', headers
='krb5.h',
665 define
='HAVE_KRB5_TKT_ENC_PART2')
666 conf
.CHECK_STRUCTURE_MEMBER('krb5_creds', 'keyblock', headers
='krb5.h',
667 define
='HAVE_KRB5_KEYBLOCK_IN_CREDS')
668 conf
.CHECK_STRUCTURE_MEMBER('krb5_creds', 'session', headers
='krb5.h',
669 define
='HAVE_KRB5_SESSION_IN_CREDS')
670 conf
.CHECK_STRUCTURE_MEMBER('krb5_ap_req', 'ticket', headers
='krb5.h',
671 define
='HAVE_TICKET_POINTER_IN_KRB5_AP_REQ')
673 conf
.CHECK_TYPE('krb5_encrypt_block', headers
='krb5.h')
678 krb5_enctype enctype;
679 enctype = ticket.enc_part.enctype;
680 kvno = ticket.enc_part.kvno;
682 'KRB5_TICKET_HAS_KEYINFO',
683 headers
='krb5.h', link
=False,
684 msg
="Checking whether the krb5_ticket structure contains the kvno and enctype")
687 krb5_get_init_creds_opt *opt = NULL;
688 krb5_get_init_creds_opt_free(ctx, opt);
690 'KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT',
691 headers
='krb5.h', link
=False,
692 msg
="Checking whether krb5_get_init_creds_opt_free takes a context argument")
693 conf
.CHECK_CODE('krb5_mk_error(0,0,0)',
694 'HAVE_SHORT_KRB5_MK_ERROR_INTERFACE',
695 headers
='krb5.h', link
=False,
696 msg
="Checking whether krb5_mk_error takes 3 arguments MIT or 9 Heimdal")
698 const krb5_data *pkdata;
699 krb5_context context;
700 krb5_principal principal;
701 pkdata = krb5_princ_component(context, principal, 0);
703 'HAVE_KRB5_PRINC_COMPONENT',
704 headers
='krb5.h', lib
='krb5',
705 msg
="Checking whether krb5_princ_component is available")
710 krb5_enctype_to_string(1, buf, 256);
713 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_SIZE_T_ARG',
714 headers
='krb5.h', lib
='krb5 k5crypto',
715 addmain
=False, cflags
='-Werror',
716 msg
="Checking whether krb5_enctype_to_string takes size_t argument")
720 krb5_context context = NULL;
722 krb5_enctype_to_string(context, 1, &str);
726 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_KRB5_CONTEXT_ARG',
727 headers
='krb5.h stdlib.h', lib
='krb5',
728 addmain
=False, cflags
='-Werror',
729 msg
="Checking whether krb5_enctype_to_string takes krb5_context argument")
732 krb5_context ctx = NULL;
733 krb5_principal princ = NULL;
734 const char *str = krb5_princ_realm(ctx, princ)->data;
737 'HAVE_KRB5_PRINC_REALM',
738 headers
='krb5.h', lib
='krb5',
740 msg
="Checking whether the macro krb5_princ_realm is defined")
743 krb5_context context;
744 krb5_principal principal;
745 const char *realm; realm = krb5_principal_get_realm(context, principal);
748 'HAVE_KRB5_PRINCIPAL_GET_REALM',
749 headers
='krb5.h', lib
='krb5',
751 msg
="Checking whether krb5_principal_get_realm is defined")
752 if conf
.CHECK_CODE('''krb5_verify_checksum(0, 0, 0, 0, 0, 0, 0);''',
753 'KRB5_VERIFY_CHECKSUM_ARGS',
754 headers
='krb5.h', lib
='krb5',
755 msg
="Checking whether krb5_verify_checksum takes 7 arguments"):
756 conf
.DEFINE('KRB5_VERIFY_CHECKSUM_ARGS', '7')
758 conf
.DEFINE('KRB5_VERIFY_CHECKSUM_ARGS', '6')
761 krb5_enctype enctype;
762 enctype = ENCTYPE_ARCFOUR_HMAC_MD5;
764 '_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5',
765 headers
='krb5.h', lib
='krb5',
766 msg
="Checking whether the ENCTYPE_ARCFOUR_HMAC_MD5 key type definition is available");
768 krb5_keytype keytype;
769 keytype = KEYTYPE_ARCFOUR_56;
771 '_HAVE_KEYTYPE_ARCFOUR_56',
772 headers
='krb5.h', lib
='krb5',
773 msg
="Checking whether the HAVE_KEYTYPE_ARCFOUR_56 key type definition is available");
774 if conf
.CONFIG_SET('_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and conf
.CONFIG_SET('_HAVE_KEYTYPE_ARCFOUR_56'):
775 conf
.DEFINE('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5', '1')
778 krb5_enctype enctype;
779 enctype = ENCTYPE_ARCFOUR_HMAC;
781 'HAVE_ENCTYPE_ARCFOUR_HMAC',
782 headers
='krb5.h', lib
='krb5',
783 msg
="Checking whether the ENCTYPE_ARCFOUR_HMAC key type definition is available");
786 krb5_context context;
788 krb5_init_context(&context);
789 return krb5_kt_resolve(context, "WRFILE:api", &keytab);
791 'HAVE_WRFILE_KEYTAB',
792 headers
='krb5.h', lib
='krb5', execute
=True,
793 msg
="Checking whether the WRFILE:-keytab is supported");
795 # Check for KRB5_DEPRECATED handling
796 conf
.CHECK_CODE('''#define KRB5_DEPRECATED 1
797 #include <krb5.h>''',
798 'HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER', addmain
=False,
800 msg
="Checking for KRB5_DEPRECATED define taking an identifier")
801 elif conf
.env
.toplevel_build
:
802 # setup the right defines for a in-tree heimdal build
803 Logs
.info("Using in-tree heimdal kerberos defines")
804 conf
.define('HAVE_GSSAPI', 1)
805 conf
.define('HAVE_GSSAPI_GSSAPI_H', 1)
806 conf
.define('HAVE_AP_OPTS_USE_SUBKEY', 1)
807 conf
.define('HAVE_KRB5_ADDRESSES', 1)
808 conf
.define('HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK', 1)
809 conf
.define('HAVE_KRB5_SET_REAL_TIME', 1)
810 conf
.define('HAVE_COM_ERR_H', 1)
811 conf
.define('HAVE_ADDR_TYPE_IN_KRB5_ADDRESS', 1)
812 conf
.define('HAVE_GSS_DISPLAY_STATUS', 1)
813 conf
.define('HAVE_LIBGSSAPI', 1)
814 conf
.define('HAVE_ADDR_TYPE_IN_KRB5_ADDRESS', 1)
815 conf
.define('HAVE_CHECKSUM_IN_KRB5_CHECKSUM', 1)
816 conf
.define('HAVE_DECL_KRB5_AUTH_CON_SET_REQ_CKSUMTYPE', 0)
817 conf
.define('HAVE_DECL_KRB5_GET_CREDENTIALS_FOR_USER', 0)
818 conf
.define('HAVE_E_DATA_POINTER_IN_KRB5_ERROR', 1)
819 conf
.define('HAVE_INITIALIZE_KRB5_ERROR_TABLE', 1)
820 conf
.define('HAVE_KRB5_ADDRESSES', 1)
821 conf
.define('HAVE_KRB5_AUTH_CON_SETKEY', 1)
822 conf
.define('HAVE_KRB5_CRYPTO', 1)
823 conf
.define('HAVE_KRB5_CRYPTO_DESTROY', 1)
824 conf
.define('HAVE_KRB5_CRYPTO_INIT', 1)
825 conf
.define('HAVE_KRB5_C_ENCTYPE_COMPARE', 1)
826 conf
.define('HAVE_KRB5_C_VERIFY_CHECKSUM', 1)
827 conf
.define('HAVE_FREE_AP_REQ', 1)
828 conf
.define('HAVE_KRB5_DECODE_AP_REQ', 1)
829 conf
.define('HAVE_KRB5_ENCTYPES_COMPATIBLE_KEYS', 1)
830 conf
.define('HAVE_KRB5_ENCTYPE_TO_STRING', 1)
831 conf
.define('HAVE_KRB5_ENCTYPE_TO_STRING_WITH_KRB5_CONTEXT_ARG', 1)
832 conf
.define('HAVE_KRB5_FREE_ERROR_CONTENTS', 1)
833 conf
.define('HAVE_KRB5_FREE_HOST_REALM', 1)
834 conf
.define('HAVE_KRB5_FWD_TGT_CREDS', 1)
835 conf
.define('HAVE_KRB5_GET_CREDS', 1)
836 conf
.define('HAVE_KRB5_GET_CREDS_OPT_ALLOC', 1)
837 conf
.define('HAVE_KRB5_GET_CREDS_OPT_SET_IMPERSONATE', 1)
838 conf
.define('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES', 1)
839 conf
.define('HAVE_KRB5_GET_HOST_REALM', 1)
840 conf
.define('HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC', 1)
841 conf
.define('HAVE_KRB5_GET_INIT_CREDS_OPT_FREE', 1)
842 conf
.define('HAVE_KRB5_GET_INIT_CREDS_OPT_GET_ERROR', 1)
843 conf
.define('HAVE_KRB5_GET_INIT_CREDS_OPT_SET_PAC_REQUEST', 1)
844 conf
.define('HAVE_KRB5_GET_KDC_CRED', 1)
845 conf
.define('HAVE_KRB5_GET_PW_SALT', 1)
846 conf
.define('HAVE_KRB5_GET_RENEWED_CREDS', 1)
847 conf
.define('HAVE_KRB5_KEYBLOCK_KEYVALUE', 1)
848 conf
.define('HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK', 1)
849 conf
.define('HAVE_KRB5_KRBHST_GET_ADDRINFO', 1)
850 conf
.define('HAVE_KRB5_KRBHST_INIT', 1)
851 conf
.define('HAVE_KRB5_KT_COMPARE', 1)
852 conf
.define('HAVE_KRB5_KT_FREE_ENTRY', 1)
853 conf
.define('HAVE_KRB5_KU_OTHER_CKSUM', 1)
854 conf
.define('HAVE_KRB5_LOCATE_PLUGIN_H', 1)
855 conf
.define('HAVE_KRB5_MK_REQ_EXTENDED', 1)
856 conf
.define('HAVE_KRB5_PRINCIPAL_COMPARE_ANY_REALM', 1)
857 conf
.define('HAVE_KRB5_PRINCIPAL_GET_COMP_STRING', 1)
858 conf
.define('HAVE_KRB5_PRINCIPAL_GET_REALM', 1)
859 conf
.define('HAVE_KRB5_REALM_TYPE', 1)
860 conf
.define('HAVE_KRB5_SESSION_IN_CREDS', 1)
861 conf
.define('HAVE_KRB5_SET_DEFAULT_IN_TKT_ETYPES', 1)
862 conf
.define('HAVE_KRB5_SET_REAL_TIME', 1)
863 conf
.define('HAVE_KRB5_STRING_TO_KEY', 1)
864 conf
.define('HAVE_KRB5_STRING_TO_KEY_SALT', 1)
865 conf
.define('HAVE_KRB5_VERIFY_CHECKSUM', 1)
866 conf
.define('HAVE_LIBKRB5', 1)
867 conf
.define('KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT', 1)
868 conf
.define('KRB5_VERIFY_CHECKSUM_ARGS', 6)
869 conf
.define('HAVE_ETYPE_IN_ENCRYPTEDDATA', 1)
870 conf
.define('KRB5_PRINC_REALM_RETURNS_REALM', 1)
871 conf
.define('HAVE_KRB5_PRINCIPAL_GET_REALM', 1)
872 conf
.define('HAVE_KRB5_H', 1)
873 conf
.define('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5', 1)
874 conf
.define('HAVE_AP_OPTS_USE_SUBKEY', 1)
875 conf
.define('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5', 1)
876 conf
.define('HAVE_ENCTYPE_ARCFOUR_HMAC', 1)
878 conf
.SET_TARGET_TYPE('krb5', 'EMPTY')
879 conf
.SET_TARGET_TYPE('gssapi', 'EMPTY')
880 conf
.SET_TARGET_TYPE('gssapi_krb5', 'EMPTY')
881 conf
.SET_TARGET_TYPE('com_err', 'EMPTY')
882 conf
.SET_TARGET_TYPE('k5crypto', 'EMPTY')
884 if Options
.options
.with_ads
:
886 if not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and \
887 not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC'):
888 Logs
.warn("arcfour-hmac-md5 encryption type not found in -lkrb5")
890 if not conf
.CONFIG_SET('HAVE_KRB5_MK_REQ_EXTENDED'):
891 Logs
.warn("krb5_mk_req_extended not found in -lkrb5")
893 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL2SALT') and \
894 not conf
.CONFIG_SET('HAVE_KRB5_GET_PW_SALT'):
895 Logs
.warn("no CREATE_KEY_FUNCTIONS detected")
897 if not conf
.CONFIG_SET('HAVE_KRB5_GET_PERMITTED_ENCTYPES') and \
898 not conf
.CONFIG_SET('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES'):
899 Logs
.warn("no GET_ENCTYPES_FUNCTIONS detected")
901 if not conf
.CONFIG_SET('HAVE_KRB5_KT_FREE_ENTRY') and \
902 not conf
.CONFIG_SET('HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS'):
903 Logs
.warn("no KT_FREE_FUNCTION detected")
905 if not conf
.CONFIG_SET('HAVE_KRB5_C_VERIFY_CHECKSUM') and \
906 not conf
.CONFIG_SET('HAVE_KRB5_VERIFY_CHECKSUM'):
907 Logs
.warn("no KRB5_VERIFY_CHECKSUM_FUNCTION detected")
909 if not conf
.CONFIG_SET('KRB5_TICKET_HAS_KEYINFO'):
910 # We only need the following functions if we can't get the enctype
911 # and kvno out of the ticket directly (ie. on Heimdal).
912 if not conf
.CONFIG_SET('HAVE_FREE_AP_REQ'):
913 Logs
.warn("no KRB5_AP_REQ_FREE_FUNCTION detected")
915 if not conf
.CONFIG_SET('HAVE_KRB5_DECODE_AP_REQ'):
916 Logs
.warn("no KRB5_AP_REQ_DECODING_FUNCTION detected")
919 conf
.DEFINE('WITH_ADS', '1')
920 conf
.DEFINE('HAVE_KRB5', '1')
922 conf
.DEFINE('HAVE_GSSAPI', '1')
923 if conf
.CONFIG_SET('HAVE_LDAP'):
924 conf
.env
['HAVE_ADS'] = '1'
926 Logs
.warn("krb5 libs don't have all features required for Active Directory support")
927 conf
.undefine('HAVE_KRB5_H')
928 conf
.undefine('HAVE_GSSAPI_H')
929 conf
.undefine('HAVE_GSSAPI_GSSAPI_GENERIC_H')
930 conf
.undefine('HAVE_GSSAPI_GSSAPI_H')
932 if Options
.options
.with_utmp
:
933 conf
.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
934 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers
='utmp.h',
935 define
='HAVE_UT_UT_NAME')
936 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers
='utmp.h',
937 define
='HAVE_UT_UT_USER')
938 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers
='utmp.h',
939 define
='HAVE_UT_UT_ID')
940 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers
='utmp.h',
941 define
='HAVE_UT_UT_HOST')
942 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers
='utmp.h',
943 define
='HAVE_UT_UT_TIME')
944 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers
='utmp.h',
945 define
='HAVE_UT_UT_TV')
946 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers
='utmp.h',
947 define
='HAVE_UT_UT_TYPE')
948 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers
='utmp.h',
949 define
='HAVE_UT_UT_PID')
950 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers
='utmp.h',
951 define
='HAVE_UT_UT_EXIT')
952 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr_v6', headers
='utmp.h',
953 define
='HAVE_UT_UT_ADDR_V6')
954 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr', headers
='utmp.h',
955 define
='HAVE_UT_UT_ADDR')
956 conf
.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers
='utmpx.h',
957 define
='HAVE_UX_UT_SYSLEN')
958 conf
.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
959 'PUTUTLINE_RETURNS_UTMP', headers
='utmp.h',
960 msg
="Checking whether pututline returns pointer")
961 conf
.DEFINE('WITH_UTMP', 1)
963 if Options
.options
.with_avahi
:
964 conf
.env
.with_avahi
= True
965 if not conf
.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf
.env
.with_avahi
= False
966 if not conf
.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf
.env
.with_avahi
= False
967 if not conf
.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf
.env
.with_avahi
= False
968 if conf
.env
.with_avahi
:
969 conf
.DEFINE('WITH_AVAHI_SUPPORT', 1)
971 conf
.SET_TARGET_TYPE('avahi-common', 'EMPTY')
972 conf
.SET_TARGET_TYPE('avahi-client', 'EMPTY')
974 if Options
.options
.with_iconv
:
975 conf
.env
.with_iconv
= True
976 if not conf
.CHECK_FUNCS_IN('iconv_open', 'iconv', headers
='iconv.h'):
977 conf
.env
.with_iconv
= False
978 if conf
.env
.with_iconv
:
979 conf
.DEFINE('HAVE_ICONV', 1)
981 if Options
.options
.with_pam
:
983 conf
.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
984 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
985 Logs
.warn("--with-pam=yes but pam_appl.h not found")
987 conf
.CHECK_FUNCS_IN('pam_get_data', 'pam')
988 conf
.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h')
989 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'):
990 Logs
.warn("--with-pam=yes but pam_modules.h not found")
992 conf
.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h')
993 conf
.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h')
994 conf
.CHECK_FUNCS_IN('pam_vsyslog', 'pam')
996 #if defined(HAVE_SECURITY_PAM_APPL_H)
997 #include <security/pam_appl.h>
998 #elif defined(HAVE_PAM_PAM_APPL_H)
999 #include <pam/pam_appl.h>
1001 pam_set_item(0, PAM_RHOST, 0);
1005 msg
="Checking whether PAM_RHOST is available");
1007 #if defined(HAVE_SECURITY_PAM_APPL_H)
1008 #include <security/pam_appl.h>
1009 #elif defined(HAVE_PAM_PAM_APPL_H)
1010 #include <pam/pam_appl.h>
1012 pam_set_item(0, PAM_TTY, 0);
1016 msg
="Checking whether PAM_TTY is available");
1018 #if (!defined(LINUX))
1020 #define PAM_EXTERN extern
1021 #if defined(HAVE_SECURITY_PAM_APPL_H)
1022 #include <security/pam_appl.h>
1023 #elif defined(HAVE_PAM_PAM_APPL_H)
1024 #include <pam/pam_appl.h>
1029 #if defined(HAVE_SECURITY_PAM_MODULES_H)
1030 #include <security/pam_modules.h>
1031 #elif defined(HAVE_PAM_PAM_MODULES_H)
1032 #include <pam/pam_modules.h>
1035 #if defined(HAVE_SECURITY__PAM_MACROS_H)
1036 #include <security/_pam_macros.h>
1037 #elif defined(HAVE_PAM__PAM_MACROS_H)
1038 #include <pam/_pam_macros.h>
1041 #ifdef HAVE_SECURITY_PAM_EXT_H
1042 #include <security/pam_ext.h>
1045 int i; i = PAM_RADIO_TYPE;
1047 'HAVE_PAM_RADIO_TYPE',
1049 msg
="Checking whether PAM_RADIO_TYPE is available");
1051 conf
.DEFINE('WITH_PAM', 1)
1052 conf
.DEFINE('WITH_PAM_MODULES', 1)
1056 seteuid
= conf
.CHECK_CODE('''
1057 #define AUTOCONF_TEST 1
1058 #define USE_SETREUID 1
1059 #include "./lib/util_sec.c"
1064 msg
="Checking whether setreuid is available")
1066 seteuid
= conf
.CHECK_CODE('''
1067 #define AUTOCONF_TEST 1
1068 #define USE_SETRESUID 1
1069 #include "./lib/util_sec.c"
1074 msg
="Checking whether setresuid is available")
1076 seteuid
= conf
.CHECK_CODE('''
1077 #define AUTOCONF_TEST 1
1078 #define USE_SETEUID 1
1079 #include "./lib/util_sec.c"
1084 msg
="Checking whether seteuid is available")
1086 seteuid
= conf
.CHECK_CODE('''
1087 #define AUTOCONF_TEST 1
1088 #define USE_SETUIDX 1
1089 #include "./lib/util_sec.c"
1095 msg
="Checking whether setuidx is available")
1096 if Options
.options
.with_dnsupdate
:
1097 conf
.CHECK_HEADERS('uuid/uuid.h')
1098 conf
.CHECK_FUNCS_IN('uuid_generate', 'uuid')
1099 if not conf
.CONFIG_SET('HAVE_UUID_UUID_H') and not conf
.CONFIG_SET('HAVE_UUID_GENERATE'):
1100 Logs
.warn("--with-dnsupdate=yes but uuid support not sufficient")
1101 elif not conf
.CONFIG_SET('HAVE_GSSAPI'):
1102 Logs
.warn("--with-dnsupdate=yes but gssapi support not sufficient")
1104 conf
.DEFINE('WITH_DNS_UPDATES', 1)
1106 conf
.SET_TARGET_TYPE('uuid', 'EMPTY')
1107 conf
.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
1108 if Options
.options
.developer
:
1109 if conf
.CONFIG_SET('HAVE_VALGRIND_H') or conf
.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'):
1110 conf
.DEFINE('VALGRIND', '1')
1112 if conf
.CHECK_CODE('''
1113 #include <bits/sockaddr.h>
1114 #include <linux/netlink.h>
1116 'HAVE_LINUX_NETLINK_H',
1117 msg
="Checking whether Linux netlink is available"):
1119 #include <bits/sockaddr.h>
1120 #include <linux/netlink.h>
1121 #include <linux/rtnetlink.h>
1123 'HAVE_LINUX_RTNETLINK_H',
1124 msg
='Checking whether Linux rtnetlink is available')
1125 if conf
.CHECK_TYPE('struct dirent64', headers
='sys/types.h dirent.h') and conf
.CONFIG_SET('HAVE_READDIR64'):
1126 conf
.DEFINE('HAVE_STRUCT_DIRENT64', '1')
1128 conf
.undefine('HAVE_STRUCT_DIRENT64')
1131 #include "../tests/fcntl_lock.c"
1136 msg
='Checking whether fcntl locking is available')
1139 #include "../tests/fcntl_lock64.c"
1141 'HAVE_BROKEN_FCNTL64_LOCKS',
1144 msg
='Checking whether fcntl64 locks are broken')
1146 if not conf
.CONFIG_SET('HAVE_BROKEN_FCNTL64_LOCKS'):
1148 #if defined(HAVE_UNISTD_H)
1158 #ifdef HAVE_SYS_FCNTL_H
1159 #include <sys/fcntl.h>
1161 main() { struct flock64 fl64;
1162 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
1169 'HAVE_STRUCT_FLOCK64',
1172 msg
="Checking whether the flock64 struct is available")
1174 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec',
1175 define
='HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') # Linux, Solaris
1176 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimensec',
1177 define
='HAVE_STRUCT_STAT_ST_MTIMENSEC') # BSD, if defined _POSIX_SOURCE
1178 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimespec.tv_nsec',
1179 define
='HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') # BSD, if not defined _POSIX_SOURCE
1180 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtime_n',
1181 define
='HAVE_STRUCT_STAT_ST_MTIME_N') # AIX
1182 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_umtime',
1183 define
='HAVE_STRUCT_STAT_ST_UMTIME') # Tru64
1184 if conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') or \
1185 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMENSEC') or \
1186 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') or \
1187 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIME_N') or \
1188 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_UMTIME'):
1189 conf
.DEFINE('HAVE_STAT_HIRES_TIMESTAMPS', '1')
1191 # recent FreeBSD, NetBSD have creation timestamps called birthtime:
1192 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtime',
1193 define
='HAVE_STRUCT_STAT_ST_BIRTHTIME')
1194 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimespec.tv_nsec',
1195 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC')
1196 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimensec',
1197 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC')
1200 #if defined(HAVE_UNISTD_H)
1203 #include <fcntl.h>],
1204 ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
1206 'HAVE_POSIX_FADVISE',
1207 msg
='Checking whether posix_fadvise is available')
1209 for v
in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]:
1212 return sysconf(%s) == -1 ? 1 : 0;
1215 msg
='Checking whether sysconf(%s) is available' % v
)
1217 conf
.CHECK_DECLS('__NR_inotify_init', reverse
=True, headers
='asm/unistd.h')
1220 #include <sys/syscall.h>
1222 syscall(SYS_initgroups, 16, NULL, NULL, 0);
1224 'HAVE_DARWIN_INITGROUPS',
1225 msg
='Checking whether to use the Darwin-specific initgroups system call')
1227 conf
.CHECK_CODE('''struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''',
1229 headers
='sys/types.h utime.h',
1230 msg
='Checking whether struct utimbuf is available')
1232 if conf
.CHECK_CODE('''struct sigevent s;''',
1233 'HAVE_STRUCT_SIGEVENT',
1234 headers
='sys/types.h stdlib.h stddef.h signal.h',
1235 msg
='Checking whether we have the struct sigevent'):
1236 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sival_ptr',
1237 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR',
1238 headers
='signal.h');
1239 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sigval_ptr',
1240 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR',
1241 headers
='signal.h');
1243 if os
.path
.exists('/proc/sys/kernel/core_pattern'):
1244 conf
.DEFINE('HAVE_SYS_KERNEL_PROC_CORE_PATTERN', '1')
1246 if conf
.CHECK_CODE('''
1250 if (sizeof(time_t) == 8) {
1251 time_t max_time = 0x7fffffffffffffffll;
1252 tm = gmtime(&max_time);
1253 /* This should fail with 32-bit tm_year. */
1255 /* Max time_t that works with 32-bit int tm_year in struct tm. */
1256 max_time = 67768036191676799ll;
1257 tm = gmtime(&max_time);
1268 msg
="Checking for the maximum value of the 'time_t' type"):
1269 conf
.DEFINE('TIME_T_MAX', '67768036191676799ll')
1272 #if defined(HAVE_UNISTD_H)
1275 #include <sys/types.h>
1276 main() { dev_t dev = makedev(1,2); return 0; }
1280 msg
='Checking whether the macro for makedev is available')
1287 void exit_on_core(int ignored) {
1293 signal(SIGSEGV, exit_on_core);
1294 newpath = realpath("/tmp", NULL);
1295 exit((newpath != NULL) ? 0 : 1);
1298 'REALPATH_TAKES_NULL',
1301 msg
='Checking whether the realpath function allows a NULL argument')
1303 conf
.CHECK_CODE('''#include "../tests/ftruncate.c"''',
1304 'HAVE_FTRUNCATE_EXTEND',
1305 msg
='Checking for ftruncate extend',
1308 if os
.getenv('RUN_FROM_BUILD_FARM'):
1309 Logs
.info("enabling buildfarm hacks")
1310 conf
.DEFINE('ENABLE_BUILD_FARM_HACKS', '1')
1312 if Options
.options
.with_sendfile_support
:
1313 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):
1318 ssize_t nwritten = sendfile64(tofd, fromfd, &offset, total);
1321 headers
='sys/sendfile',
1322 msg
='Checking for linux sendfile64 support')
1327 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1330 headers
='sys/sendfile',
1331 msg
='Checking for linux sendfile support')
1333 # Try and cope with broken Linux sendfile....
1334 conf
.CHECK_CODE('''#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
1335 #undef _FILE_OFFSET_BITS
1337 #include <sys/sendfile.h>
1341 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1343 '_HAVE_BROKEN_LINUX_SENDFILE',
1344 msg
='Checking for broken linux sendfile support')
1345 if conf
.CONFIG_SET('_HAVE_SENDFILE64'):
1346 conf
.DEFINE('HAVE_SENDFILE64', '1')
1347 conf
.DEFINE('LINUX_SENDFILE_API', '1')
1348 conf
.DEFINE('WITH_SENDFILE', '1')
1349 elif conf
.CONFIG_SET('_HAVE_SENDFILE'):
1350 conf
.DEFINE('HAVE_SENDFILE', '1')
1351 conf
.DEFINE('LINUX_SENDFILE_API', '1')
1352 conf
.DEFINE('WITH_SENDFILE', '1')
1353 elif conf
.CONFIG_SET('_HAVE_BROKEN_LINUX_SENDFILE'):
1354 conf
.DEFINE('LINUX_BROKEN_SENDFILE_API', '1')
1355 conf
.DEFINE('WITH_SENDFILE', '1')
1356 elif (host_os
.rfind('freebsd') > -1) or (host_os
.rfind('dragonfly') > -1):
1358 #include <sys/types.h>
1360 #include <sys/socket.h>
1361 #include <sys/uio.h>
1362 int fromfd, tofd, ret, total=0;
1363 off_t offset, nwritten;
1366 hdr.headers = &hdtrl;
1368 hdr.trailers = NULL;
1370 hdtrl.iov_base = NULL;
1372 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0)
1375 msg
='Checking for freebsd sendfile support')
1376 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1377 conf
.DEFINE('HAVE_SENDFILE', '1')
1378 conf
.DEFINE('FREEBSD_SENDFILE_API', '1')
1379 conf
.DEFINE('WITH_SENDFILE', '1')
1380 elif (host_os
.rfind('hpux') > -1):
1382 #include <sys/socket.h>
1383 #include <sys/uio.h>
1386 struct iovec hdtrl[2];
1389 hdtrl[0].iov_base = 0;
1390 hdtrl[0].iov_len = 0;
1391 nwritten = sendfile64(tofd, fromfd, offset, total, &hdtrl[0], 0);
1394 msg
='Checking for hpux sendfile64 support')
1396 #include <sys/socket.h>
1397 #include <sys/uio.h>
1400 struct iovec hdtrl[2];
1403 hdtrl[0].iov_base = 0;
1404 hdtrl[0].iov_len = 0;
1405 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
1408 msg
='Checking for hpux sendfile support')
1409 if conf
.CONFIG_SET('_HAVE_SENDFILE64'):
1410 conf
.DEFINE('HAVE_SENDFILE64', '1')
1411 conf
.DEFINE('HPUX_SENDFILE_API', '1')
1412 conf
.DEFINE('WITH_SENDFILE', '1')
1413 elif conf
.CONFIG_SET('_HAVE_SENDFILE'):
1414 conf
.DEFINE('HAVE_SENDFILE', '1')
1415 conf
.DEFINE('HPUX_SENDFILE_API', '1')
1416 conf
.DEFINE('WITH_SENDFILE', '1')
1417 elif (host_os
.rfind('solaris') > -1):
1418 conf
.CHECK_FUNCS_IN('sendfile', 'sendfilev')
1420 #include <sys/sendfile.h>
1423 struct sendfilevec vec[2];
1427 vec[0].sfv_fd = SFV_FD_SELF;
1428 vec[0].sfv_flag = 0;
1432 vec[1].sfv_flag = 0;
1435 nwritten = sendfilev64(tofd, vec, sfvcnt, &xferred);
1437 '_HAVE_SENDFILEV64',
1438 msg
='Checking for solaris sendfilev64 support')
1440 #include <sys/sendfile.h>,
1443 struct sendfilevec vec[2];
1447 vec[0].sfv_fd = SFV_FD_SELF;
1448 vec[0].sfv_flag = 0;
1452 vec[1].sfv_flag = 0;
1455 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
1458 msg
='Checking for solaris sendfilev support')
1459 if conf
.CONFIG_SET('_HAVE_SENDFILEV64'):
1460 conf
.DEFINE('HAVE_SENDFILEV64', '1')
1461 conf
.DEFINE('SOLARIS_SENDFILE_API', '1')
1462 conf
.DEFINE('WITH_SENDFILE', '1')
1463 elif conf
.CONFIG_SET('_HAVE_SENDFILEV'):
1464 conf
.DEFINE('HAVE_SENDFILEV', '1')
1465 conf
.DEFINE('SOLARIS_SENDFILE_API', '1')
1466 conf
.DEFINE('WITH_SENDFILE', '1')
1467 elif (host_os
.rfind('aix') > -1):
1469 #include <sys/socket.h>
1472 struct sf_parms hdtrl;
1475 hdtrl.header_data = 0;
1476 hdtrl.header_length = 0;
1477 hdtrl.file_descriptor = fromfd;
1478 hdtrl.file_offset = 0;
1479 hdtrl.file_bytes = 0;
1480 hdtrl.trailer_data = 0;
1481 hdtrl.trailer_length = 0;
1482 nwritten = send_file(&tofd, &hdtrl, 0);
1485 msg
='Checking for AIX send_file support')
1486 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1487 conf
.DEFINE('HAVE_SENDFILE', '1')
1488 conf
.DEFINE('AIX_SENDFILE_API', '1')
1489 conf
.DEFINE('WITH_SENDFILE', '1')
1491 conf
.CHECK_CODE('''enum TDB_ERROR err = TDB_ERR_NESTING''',
1492 'HAVE_TDB_ERR_NESTING',
1494 msg
='Checking whether we have TDB_ERR_NESTING')
1496 # UnixWare 7.x has its getspnam in -lgen
1497 conf
.CHECK_FUNCS_IN('getspnam', 'gen')
1498 conf
.CHECK_FUNCS_IN('getspnam', 'security')
1499 conf
.CHECK_FUNCS_IN('getspnam', 'sec')
1501 if Options
.options
.with_quotas
:
1502 # For quotas on Veritas VxFS filesystems
1503 conf
.CHECK_HEADERS('sys/fs/vx_quota.h')
1504 # For quotas on Linux XFS filesystems
1505 conf
.CHECK_HEADERS('linux/dqblk_xfs.h')
1506 # For sys/quota.h and linux/quota.h
1507 conf
.CHECK_HEADERS('sys/quota.h')
1511 # checking for clustering extensions (CTDB)
1513 if not Options
.options
.with_cluster_support
:
1514 have_cluster_support
= False
1518 if Options
.options
.ctdb_dir
:
1519 conf
.ADD_EXTRA_INCLUDES(Options
.options
.ctdb_dir
+ '/include')
1521 srcdir
= os
.path
.realpath(conf
.srcdir
)
1522 if 'EXTRA_INCLUDES' in conf
.env
:
1523 includes
= ' '.join(conf
.env
['EXTRA_INCLUDES']).replace('#', srcdir
+ '/')
1527 have_cluster_support
= True
1532 #include "replace.h"
1533 #include "system/wait.h"
1534 #include "system/network.h"
1535 #define private #error __USED_RESERVED_WORD_private__
1548 msg
='Checking for header ctdb.h')
1550 if not conf
.CONFIG_SET('HAVE_CTDB_H'):
1551 have_cluster_support
= False
1552 ctdb_broken
= "ctdb.h is required for cluster support"
1554 if have_cluster_support
:
1557 #include "replace.h"
1558 #include "system/wait.h"
1559 #include "system/network.h"
1560 #define private #error __USED_RESERVED_WORD_private__
1564 #include <ctdb_private.h>
1571 'HAVE_CTDB_PRIVATE_H',
1574 msg
='Checking for header ctdb_private.h')
1576 if not conf
.CONFIG_SET('HAVE_CTDB_PRIVATE_H'):
1577 have_cluster_support
= False
1578 ctdb_broken
= "ctdb_private.h is required for cluster support"
1580 if have_cluster_support
:
1583 #include "replace.h"
1584 #include "system/wait.h"
1585 #include "system/network.h"
1589 #include <ctdb_private.h>
1593 int i = (int)CTDB_CONTROL_TRANS3_COMMIT;
1597 'HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL',
1600 msg
='Checking for transaction support (TRANS3_COMMIT control)')
1602 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL'):
1603 have_cluster_support
= False
1604 ctdb_broken
= "ctdb transaction support missing or too old"
1606 if have_cluster_support
:
1609 #include "replace.h"
1610 #include "system/wait.h"
1611 #include "system/network.h"
1615 #include <ctdb_private.h>
1619 int i = (int)CTDB_CONTROL_SCHEDULE_FOR_DELETION;
1623 'HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL',
1626 msg
='Checking for SCHEDULE_FOR_DELETION control')
1628 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL'):
1629 if not Options
.optinons
.enable_old_ctdb
:
1630 have_cluster_support
= False
1631 ctdb_broken
= "SCHEDULE_FOR_DELETION control missing"
1633 Logs
.warn("ignoring missing SCHEDULE_FOR_DELETION control (--enable-old-ctdb)")
1635 if have_cluster_support
:
1638 #include "replace.h"
1639 #include "system/wait.h"
1640 #include "system/network.h"
1644 #include <ctdb_private.h>
1648 struct ctdb_control_tcp _x;
1652 'HAVE_STRUCT_CTDB_CONTROL_TCP',
1655 msg
='Checking for ctdb ipv4 support')
1657 if not conf
.CONFIG_SET('HAVE_STRUCT_CTDB_CONTROL_TCP'):
1658 have_cluster_support
= False
1659 ctdb_broken
= "missing struct ctdb_control_tcp"
1661 if have_cluster_support
:
1664 #include "replace.h"
1665 #include "system/wait.h"
1666 #include "system/network.h"
1670 #include <ctdb_private.h>
1674 struct ctdb_control_tcp_addr _x;
1678 'HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR',
1681 msg
='Checking for ctdb ipv6 support')
1683 if have_cluster_support
:
1684 Logs
.info("building with cluster support")
1685 conf
.DEFINE('CLUSTER_SUPPORT', 1);
1687 if not Options
.options
.with_cluster_support
:
1688 Logs
.info("building without cluster support")
1690 Logs
.warn("building without cluster support: " + ctdb_broken
)
1691 conf
.undefine('CLUSTER_SUPPORT')
1695 conf
.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }',
1696 'HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR',
1699 msg
='Checking whether we can compile with __attribute__((destructor))')
1701 conf
.CHECK_CODE('void seekdir(DIR *d, long loc) { return; }',
1702 'SEEKDIR_RETURNS_VOID',
1703 headers
='sys/types.h dirent.h',
1704 msg
='Checking whether seekdir returns void')
1706 default_static_modules
=TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
1707 auth_sam auth_unix auth_winbind auth_wbc auth_server
1708 auth_domain auth_builtin vfs_default
1709 nss_info_template idmap_tdb idmap_passdb
1712 default_shared_modules
=TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
1713 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
1714 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850
1715 charset_CP437 auth_script vfs_readahead vfs_xattr_tdb
1716 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
1717 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
1718 vfs_crossrename vfs_linux_xfs_sgid
1719 vfs_time_audit idmap_autorid''')
1721 if Options
.options
.developer
:
1722 default_static_modules
.extend(TO_LIST('pdb_ads auth_netlogond'))
1723 default_shared_modules
.extend(TO_LIST('charset_weird perfcount_test'))
1725 if Options
.options
.with_acl_support
and conf
.CONFIG_SET('HAVE_POSIX_ACLS'):
1726 default_static_modules
.extend(TO_LIST('vfs_posixacl'))
1728 if conf
.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'):
1729 default_shared_modules
.extend(TO_LIST('vfs_zfsacl'))
1731 if conf
.CONFIG_SET('HAVE_DIRFD_DECL'):
1732 default_shared_modules
.extend(TO_LIST('vfs_syncops vfs_dirsort'))
1734 if conf
.CONFIG_SET('HAVE_STATFS_F_FSID'):
1735 default_shared_modules
.extend(TO_LIST('vfs_fileid'))
1737 if conf
.CONFIG_SET('HAVE_AIO') and (conf
.CONFIG_SET('HAVE_MSGHDR_MSG_CONTROL') or conf
.CONFIG_SET('HAVE_MSGHDR_MSG_ACCTRIGHTS')):
1738 default_shared_modules
.extend(TO_LIST('vfs_aio_fork'))
1740 if conf
.CONFIG_SET('HAVE_LDAP'):
1741 default_static_modules
.extend(TO_LIST('pdb_ldap idmap_ldap'))
1743 if conf
.CONFIG_SET('DARWINOS'):
1744 default_shared_modules
.extend(TO_LIST('charset_macosxfs'))
1746 explicit_shared_modules
= TO_LIST(Options
.options
.shared_modules
, delimiter
=',')
1747 explicit_static_modules
= TO_LIST(Options
.options
.static_modules
, delimiter
=',')
1749 final_static_modules
= default_static_modules
1750 final_shared_modules
= default_shared_modules
1752 for m
in explicit_static_modules
:
1753 if m
in final_shared_modules
:
1754 final_shared_modules
.remove(m
)
1755 final_static_modules
.append(m
)
1756 for m
in explicit_shared_modules
:
1757 if m
in final_static_modules
:
1758 final_static_modules
.remove(m
)
1759 final_shared_modules
.append(m
)
1761 conf
.env
['static_modules'] = final_static_modules
1762 conf
.env
['shared_modules'] = final_shared_modules
1764 conf
.DEFINE('STRING_STATIC_MODULES', ' '.join(final_static_modules
), quote
=True)
1769 prefixes
= ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
1770 conf
.env
['MODULE_PREFIXES'] = prefixes
1772 for m
in final_static_modules
:
1774 if not p
in static_list
:
1776 static_list
[p
].append(m
)
1777 for m
in final_shared_modules
:
1779 if not p
in shared_list
:
1781 shared_list
[p
].append(m
)
1784 static_env
= "%s_STATIC" % p
.upper()
1785 shared_env
= "%s_SHARED" % p
.upper()
1786 conf
.env
[static_env
] = []
1787 conf
.env
[shared_env
] = []
1788 if p
in static_list
:
1790 for entry
in static_list
[p
]:
1791 decl_list
+= "extern NTSTATUS %s_init(void); " % entry
1792 conf
.env
[static_env
].append('%s' % entry
)
1793 decl_list
= decl_list
.rstrip()
1794 conf
.DEFINE('static_decl_%s' % p
, decl_list
)
1795 conf
.DEFINE('static_init_%s' % p
, '{ %s_init(); }' % '_init(); '.join(static_list
[p
]))
1797 conf
.DEFINE('static_decl_%s' % p
, '')
1798 conf
.DEFINE('static_init_%s' % p
, '{}')
1799 if p
in shared_list
:
1800 for entry
in shared_list
[p
]:
1801 conf
.DEFINE('%s_init' % entry
, 'init_samba_module')
1802 conf
.env
[shared_env
].append('%s' % entry
)
1804 conf
.SAMBA_CONFIG_H('include/config.h')
1807 "build 'tags' file using ctags"
1809 source_root
= os
.path
.dirname(Utils
.g_module
.root_path
)
1810 cmd
= 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
1811 print("Running: %s" % cmd
)
1814 if not os
.getenv('TOPLEVEL_BUILD'):
1815 def wildcard_cmd(cmd
):
1816 '''called on a unknown command'''
1817 from samba_wildcard
import run_named_build_task
1818 run_named_build_task(cmd
)
1820 from samba_wildcard
import wildcard_main
1821 wildcard_main(wildcard_cmd
)
1822 Scripting
.main
= main