10 from optparse
import SUPPRESS_HELP
11 sys
.path
.insert(0, srcdir
+"/buildtools/wafsamba")
12 import wafsamba
, Options
14 import samba_utils
, samba_version
18 opt
.BUILTIN_DEFAULT('NONE')
19 opt
.PRIVATE_EXTENSION_DEFAULT('s3')
20 opt
.RECURSE('../lib/replace')
22 opt
.RECURSE('selftest')
23 opt
.RECURSE('../lib/nss_wrapper')
24 opt
.RECURSE('../lib/socket_wrapper')
25 opt
.RECURSE('../lib/tevent')
26 opt
.RECURSE('../lib/tdb')
28 opt
.add_option('--with-static-modules',
29 help=("Comma-separated list of names of modules to statically link in"),
30 action
="store", dest
='static_modules', default
=None)
31 opt
.add_option('--with-shared-modules',
32 help=("Comma-separated list of names of modules to build shared"),
33 action
="store", dest
='shared_modules', default
=None)
34 opt
.add_option('--enable-selftest',
35 help=("enable options necessary for selftest"),
36 action
="store_true", dest
='enable_selftest', default
=False)
38 opt
.SAMBA3_ADD_OPTION('winbind')
39 opt
.SAMBA3_ADD_OPTION('swat')
40 opt
.SAMBA3_ADD_OPTION('ads')
41 opt
.SAMBA3_ADD_OPTION('krb5')
42 opt
.SAMBA3_ADD_OPTION('ldap')
43 opt
.SAMBA3_ADD_OPTION('cups', with_name
="enable", without_name
="disable")
44 opt
.SAMBA3_ADD_OPTION('iprint', with_name
="enable", without_name
="disable")
45 opt
.SAMBA3_ADD_OPTION('merged-build', with_name
="enable", without_name
="disable")
46 opt
.SAMBA3_ADD_OPTION('pam')
47 opt
.SAMBA3_ADD_OPTION('quotas')
48 opt
.SAMBA3_ADD_OPTION('sys-quotas')
49 opt
.SAMBA3_ADD_OPTION('sendfile-support')
50 opt
.SAMBA3_ADD_OPTION('utmp')
51 opt
.SAMBA3_ADD_OPTION('pthreadpool', with_name
="enable", without_name
="disable")
52 opt
.SAMBA3_ADD_OPTION('avahi', with_name
="enable", without_name
="disable")
53 opt
.SAMBA3_ADD_OPTION('iconv')
54 opt
.SAMBA3_ADD_OPTION('acl-support')
55 opt
.SAMBA3_ADD_OPTION('dnsupdate')
56 opt
.SAMBA3_ADD_OPTION('syslog')
57 opt
.SAMBA3_ADD_OPTION('automount')
58 opt
.SAMBA3_ADD_OPTION('aio-support')
62 from samba_utils
import TO_LIST
64 version
= samba_version
.load_version(env
=conf
.env
)
66 conf
.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
67 conf
.DEFINE('_SAMBA_BUILD_', version
.MAJOR
, add_to_cflags
=True)
68 conf
.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags
=True)
70 if Options
.options
.developer
:
71 conf
.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
72 conf
.env
['developer'] = True
74 if Options
.options
.with_swat
:
75 conf
.env
['build_swat'] = True
77 conf
.RECURSE('../lib/replace')
79 conf
.RECURSE('../lib/tdb')
80 conf
.RECURSE('../lib/talloc')
81 conf
.RECURSE('../lib/tevent')
82 conf
.RECURSE('../lib/popt')
83 conf
.RECURSE('../lib/nss_wrapper')
84 conf
.RECURSE('../lib/socket_wrapper')
85 conf
.RECURSE('../lib/zlib')
86 conf
.RECURSE('../libcli/smbreadline')
87 conf
.RECURSE('../lib/util')
89 conf
.ADD_EXTRA_INCLUDES('''#source3 #source3/include''')
90 if not conf
.env
.USING_SYSTEM_TDB
:
91 conf
.ADD_EXTRA_INCLUDES('#lib/tdb/include')
92 if not conf
.env
.USING_SYSTEM_TEVENT
:
93 conf
.ADD_EXTRA_INCLUDES('#lib/tevent')
94 if not conf
.env
.USING_SYSTEM_TALLOC
:
95 conf
.ADD_EXTRA_INCLUDES('#lib/talloc')
97 conf
.ADD_LDFLAGS("-Wl,--export-dynamic", testflags
=True)
99 conf
.CHECK_HEADERS('execinfo.h libexc.h libunwind.h netdb.h')
100 conf
.CHECK_HEADERS('linux/falloc.h')
102 conf
.CHECK_FUNCS('getcwd fchown chmod fchmod mknod mknod64')
103 conf
.CHECK_FUNCS('strtol strchr strupr chflags')
104 conf
.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
105 conf
.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
106 conf
.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr')
107 conf
.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
108 conf
.CHECK_FUNCS('setpriv setgidx setuidx setgroups sysconf stat64 fstat64')
109 conf
.CHECK_FUNCS('lstat64 fopen64 atexit grantpt lseek64 ftruncate64 fallocate fallocate64 posix_fallocate posix_fallocate64')
110 conf
.CHECK_FUNCS('fseek64 fseeko64 ftell64 ftello64 setluid')
111 conf
.CHECK_FUNCS('getpwnam', headers
='sys/types.h pwd.h')
112 conf
.CHECK_FUNCS('opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64')
113 conf
.CHECK_FUNCS('fdopendir fdopendir64')
114 conf
.CHECK_FUNCS('getpwent_r getdents64 setenv strcasecmp fcvt fcvtl')
115 conf
.CHECK_FUNCS('syslog vsyslog timegm setlocale nl_langinfo')
116 conf
.CHECK_FUNCS_IN('nanosleep', 'rt')
117 conf
.CHECK_FUNCS('lutimes futimes utimensat futimens')
118 conf
.CHECK_FUNCS('mlock munlock mlockall munlockall')
119 conf
.CHECK_FUNCS('memalign posix_memalign hstrerror')
120 conf
.CHECK_FUNCS('shmget')
121 conf
.CHECK_FUNCS_IN('shm_open', 'rt', checklibc
=True)
122 conf
.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain')
123 #FIXME: for some reason this one still fails
124 conf
.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
125 conf
.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
126 conf
.CHECK_DECLS('fdatasync', reverse
=True)
127 conf
.CHECK_DECLS('readahead', reverse
=True, headers
='fcntl.h')
129 if conf
.CONFIG_SET('HAVE_LONG_LONG'):
130 conf
.DEFINE('HAVE_LONGLONG', 1)
132 if conf
.CHECK_CODE('''
133 #if defined(HAVE_UNISTD_H)
136 long ret = splice(0,0,1,0,400,0);
140 conf
.CHECK_DECLS('splice', reverse
=True, headers
='fcntl.h')
142 # Check for inotify support
143 conf
.CHECK_HEADERS('linux/inotify.h asm/unistd.h sys/inotify.h')
144 conf
.CHECK_FUNCS('inotify_init')
145 if "HAVE_LINUX_INOTIFY_H" in conf
.env
and "HAVE_INOTIFY_INIT" in conf
.env
:
146 conf
.DEFINE('HAVE_INOTIFY', 1)
148 # Check for kernel change notify support
151 #define F_NOTIFY 1026
154 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
155 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain
=False, execute
=True,
156 headers
='fcntl.h signal.h',
157 msg
="Checking for kernel change notify support")
159 # Check for Linux kernel oplocks
161 #include <sys/types.h>
165 #define F_NOTIFY 1026
168 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
169 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain
=False, execute
=True,
170 msg
="Checking for Linux kernel oplocks")
172 # Check for IRIX kernel oplock types
173 conf
.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
174 'HAVE_KERNEL_OPLOCKS_IRIX', headers
='fcntl.h',
175 msg
="Checking for IRIX kernel oplock types")
177 # Check for krenel share modes
179 #include <sys/types.h>
182 #include <sys/file.h>
188 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
189 }''', 'HAVE_KERNEL_SHARE_MODES', addmain
=False, execute
=True,
190 msg
="Checking for krenel share modes")
192 # Check for various members of the stat structure
193 conf
.CHECK_TYPES('blksize_t blkcnt_t')
194 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define
='HAVE_STAT_ST_BLOCKS',
195 headers
='sys/stat.h')
196 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define
='HAVE_STAT_ST_BLKSIZE',
197 headers
='sys/stat.h')
198 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_flags', define
='HAVE_STAT_ST_FLAGS',
199 headers
='sys/types.h sys/stat.h unistd.h')
201 # Check for POSIX capability support
202 conf
.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers
='sys/capability.h')
204 if "HAVE_SYS_CAPABILITY_H" in conf
.env
:
208 if (!(cap = cap_get_proc())) exit(1);
210 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
211 cap_set_proc(cap);''',
212 'HAVE_POSIX_CAPABILITIES', execute
=True, lib
="cap",
213 headers
='sys/capability.h',
214 msg
="Checking whether POSIX capabilities are available")
216 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
217 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
219 if conf
.CONFIG_SET("HAVE_RPC_RPC_H"):
220 conf
.CHECK_TYPE('int16', headers
='rpc/rpc.h',
221 define
='HAVE_INT16_FROM_RPC_RPC_H',
222 msg
="Checking for int16 typedef included by rpc/rpc.h")
223 conf
.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
224 headers
='sys/types.h rpc/rpc.h',
225 msg
="Checking for uint16 typedef included by rpc/rpc.h")
226 conf
.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
227 headers
='sys/types.h rpc/rpc.h',
228 msg
="Checking for int32 typedef included by rpc/rpc.h")
229 conf
.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
230 headers
='sys/types.h rpc/rpc.h',
231 msg
="Checking for uint32 typedef included by rpc/rpc.h")
232 conf
.CHECK_CODE('int i;', 'BROKEN_NISPLUS_INCLUDE_FILES',
233 headers
='sys/types.h sys/acl.h rpcsvc/nis.h',
234 msg
="Checking for broken nisplus include files")
236 # Check if the compiler will optimize out functions
239 this_function_does_not_exist();
242 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
243 msg
="Checking if the compiler will optimize out functions")
245 # Check if the compiler supports the LL suffix on long long integers
247 conf
.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL',
249 msg
="Checking for LL suffix on long long integers")
252 _acl __acl add_proplist_entry atexit attr_getf attr_list attr_listf
253 attropen attr_remove attr_removef attr_set attr_setf backtrace_symbols
254 bindtextdomain _chdir __chdir chflags chmod _close __close _closedir
255 __closedir closedir64 creat64 crypt16 delproplist devnm dgettext dirfd
256 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
257 extattr_delete_fd extattr_delete_link extattr_get_fd extattr_get_file
258 extattr_get_link extattr_list_fd extattr_list_file extattr_list_link
259 extattr_set_fd extattr_set_file extattr_set_link _facl __facl _fchdir
260 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
261 fdelproplist fgetea fgetproplist fgetxattr flistea flistxattr fopen64
262 _fork __fork fremoveea fremovexattr fseek64 fseeko64 fsetea
263 fsetproplist fsetxattr _fstat __fstat fstat64 _fstat64 __fstat64 fsync
264 ftell64 ftello64 ftruncate64 futimens futimes __fxstat getauthuid
265 getcwd _getcwd __getcwd getdents __getdents getdents64 getdirentries
266 getgrent getgrnam getgrouplist getmntent getpagesize
267 getproplist get_proplist_entry getpwanam getpwent_r getrlimit gettext
268 glob grantpt hstrerror initgroups innetgr
269 inotify_init lgetea lgetxattr listea listxattr llistea llistxattr
270 llseek _llseek __llseek lremoveea lremovexattr _lseek __lseek lseek64
271 lsetea lsetxattr _lstat __lstat lstat64 _lstat64 __lstat64 lutimes
272 __lxstat memalign mknod mknod64 mlock mlockall munlock munlockall
273 nl_langinfo _open __open open64 _open64 __open64 _opendir __opendir
274 opendir64 pathconf poll posix_fallocate posix_fallocate64
275 posix_memalign prctl pread _pread __pread pread64 _pread64 __pread64
276 pwrite _pwrite __pwrite pwrite64 _pwrite64
277 __pwrite64 rdchk _read __read _readdir __readdir readdir64 _readdir64
278 __readdir64 removeea removexattr rewinddir64 _seekdir __seekdir
279 seekdir64 select setea setenv setgidx setgroups setlocale setluid
280 setmntent setpgid setpriv setproplist setsid setuidx
281 setxattr shmget shm_open sigaction sigblock sigprocmask sigset
282 sizeof_proplist_entry _stat __stat stat64 _stat64 __stat64 statvfs
283 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctlbyname
284 __sys_llseek syslog _telldir __telldir telldir64 textdomain timegm
285 utimensat vsyslog _write __write __xstat
288 conf
.CHECK_TYPE('struct timespec', headers
='sys/time.h time.h')
290 conf
.CHECK_SAMBA3_CHARSET() # see build/charset.py
292 # FIXME: these should be tests for features, but the old build system just
295 host_os
= sys
.platform
296 print "building on %s" % host_os
298 # Python doesn't have case switches... :/
299 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
300 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
302 conf
.SET_TARGET_TYPE('sunacl', 'EMPTY')
303 if (host_os
.rfind('linux') > -1) or (host_os
.rfind('gnu') > -1) or (host_os
.rfind('qnx') > -1):
304 if host_os
.rfind('linux') > -1:
305 conf
.DEFINE('LINUX', '1')
306 elif host_os
.rfind('qnx') > -1:
307 conf
.DEFINE('QNX', '1')
308 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
309 elif (host_os
.rfind('darwin') > -1):
310 conf
.DEFINE('DARWINOS', 1)
311 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
312 conf
.ADD_CFLAGS('-fno-common')
313 elif (host_os
.rfind('freebsd') > -1):
314 if conf
.CHECK_HEADERS('sunacl.h'):
315 conf
.define('HAVE_FREEBSD_SUNACL_H', '1')
316 conf
.CHECK_FUNCS_IN('acl', 'sunacl')
317 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
318 elif (host_os
.rfind('netbsd') > -1):
319 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
320 elif (host_os
.rfind('openbsd') > -1):
321 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
322 # FIXME: Add more checks here.
324 print "Unknown host_os '%s', please report this to samba-technical@samba.org" % host_os
326 #FIXME: add more checks
327 if Options
.options
.with_acl_support
:
328 if host_os
.rfind('linux') > -1:
329 conf
.CHECK_FUNCS_IN('acl_get_file', 'acl')
330 conf
.CHECK_FUNCS_IN('getxattr', 'attr')
331 if conf
.CHECK_CODE('''
334 acl_entry_t *entry_p;
335 return acl_get_entry(acl, entry_id, entry_p);
338 headers
='sys/types.h sys/acl.h', link
=False,
339 msg
="Checking for POSIX ACL support") :
341 acl_permset_t permset_d;
343 return acl_get_perm_np(permset_d, perm);
345 'HAVE_ACL_GET_PERM_NP',
346 headers
='sys/types.h sys/acl.h', link
=True,
347 msg
="Checking whether acl_get_perm_np() is available")
349 conf
.DEFINE('HAVE_NO_ACLS', 1)
350 conf
.SET_TARGET_TYPE('acl', 'EMPTY')
352 conf
.DEFINE('HAVE_NO_ACLS', 1)
353 conf
.SET_TARGET_TYPE('acl', 'EMPTY')
355 if conf
.CHECK_FUNCS('dirfd'):
356 conf
.DEFINE('HAVE_DIRFD_DECL', 1)
358 conf
.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
359 'HAVE_STATFS_F_FSID',
360 msg
="vfs_fileid: checking for statfs() and struct statfs.f_fsid",
361 headers
='sys/types.h sys/statfs.h',
364 if conf
.CONFIG_SET('HAVE_FALLOCATE'):
366 #if defined(HAVE_UNISTD_H)
369 #include <sys/types.h>
372 #if defined(HAVE_LINUX_FALLOC_H)
373 #include <linux/falloc.h>
375 int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
376 'HAVE_LINUX_FALLOCATE',
377 msg
="Checking whether the Linux 'fallocate' function is available")
378 if conf
.CONFIG_SET('HAVE_FALLOCATE64'):
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 = fallocate64(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
390 'HAVE_LINUX_FALLOCATE64',
391 msg
="Checking whether the Linux 'fallocate64' function is available")
393 #if defined(HAVE_UNISTD_H)
397 ssize_t err = readahead(0,0,0x80000);''',
398 'HAVE_LINUX_READAHEAD',
399 msg
="Checking whether Linux readahead is available")
400 conf
.CHECK_DECLS('readahead', headers
='fcntl.h', always
=True)
403 #include <sys/types.h>
404 #include <sys/socket.h>],
407 int ret = getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len);''',
409 msg
="Checking whether we can use SO_PEERCRED to get socket credentials")
412 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
413 #include <sys/types.h>
418 'HAVE_EXPLICIT_LARGEFILE_SUPPORT',
419 msg
="Checking whether large file support can be enabled")
421 if Options
.options
.with_aio_support
:
422 conf
.CHECK_FUNCS_IN('aio_read', 'aio')
423 conf
.CHECK_FUNCS_IN('aio_read', 'rt')
424 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);',
426 msg
='Checking for asynchronous io support',
427 headers
='sys/types.h aio.h',
429 conf
.CHECK_CODE('struct aiocb64 a; return aio_read64(&a);',
431 msg
='Checking for 64-bit asynchronous io support',
432 headers
='sys/types.h aio.h',
434 if conf
.CONFIG_SET('HAVE_AIO64'):
435 conf
.DEFINE('HAVE_AIOCB64', '1')
436 conf
.DEFINE('WITH_AIO', '1')
437 elif conf
.CONFIG_SET('HAVE_AIO'):
438 conf
.DEFINE('WITH_AIO', '1')
439 if conf
.CONFIG_SET('HAVE_AIO'):
440 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg
='Checking for aio_read', headers
='aio.h', lib
='aio rt')
441 conf
.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg
='Checking for aio_write', headers
='aio.h', lib
='aio rt')
442 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')
443 conf
.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg
='Checking for aio_return', headers
='aio.h', lib
='aio rt')
444 conf
.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg
='Checking for aio_error', headers
='aio.h', lib
='aio rt')
445 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')
446 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')
447 if conf
.CONFIG_SET('HAVE_AIO64'):
448 conf
.CHECK_CODE('struct aiocb a; return aio_read64(&a);', 'HAVE_AIO_READ64', msg
='Checking for aio_read64', headers
='aio.h', lib
='aio rt')
449 conf
.CHECK_CODE('struct aiocb a; return aio_write64(&a);', 'HAVE_AIO_WRITE64', msg
='Checking for aio_write64', headers
='aio.h', lib
='aio rt')
450 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')
451 conf
.CHECK_CODE('struct aiocb a; return aio_return64(&a);', 'HAVE_AIO_RETURN64', msg
='Checking for aio_return64', headers
='aio.h', lib
='aio rt')
452 conf
.CHECK_CODE('struct aiocb a; return aio_error64(&a);', 'HAVE_AIO_ERROR64', msg
='Checking for aio_error64', headers
='aio.h', lib
='aio rt')
453 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')
454 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')
455 if not conf
.CONFIG_SET('HAVE_AIO'):
456 conf
.DEFINE('HAVE_NO_AIO', '1')
458 conf
.DEFINE('HAVE_NO_AIO', '1')
464 char control[CMSG_SPACE(sizeof(int))];
466 msg.msg_control = control_un.control;
467 msg.msg_controllen = sizeof(control_un.control);
469 'HAVE_MSGHDR_MSG_CONTROL',
470 msg
='Checking if we can use msg_control for passing file descriptors',
471 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
475 msg.msg_acctrights = (caddr_t) &fd;
476 msg.msg_acctrightslen = sizeof(fd);
478 'HAVE_MSGHDR_MSG_ACCTRIGHTS',
479 msg
='Checking if we can use msg_acctrights for passing file descriptors',
480 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
482 if Options
.options
.with_winbind
:
483 conf
.env
.build_winbind
= True
484 conf
.DEFINE('WITH_WINBIND', '1')
486 conf
.find_program('awk', var
='AWK')
487 conf
.find_program('perl', var
='PERL')
489 # Darwin has extra options to xattr-family functions
490 conf
.CHECK_CODE('getxattr(0, 0, 0, 0, 0, 0);',
492 msg
="Checking whether xattr interface takes additional options",
493 headers
='sys/types.h attr/xattr.h sys/xattr.h')
495 conf
.CHECK_HEADERS('asm/types.h')
497 conf
.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
498 headers
='unistd.h sys/types.h',
499 msg
="Checking for major macro")
501 conf
.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
502 headers
='unistd.h sys/types.h',
503 msg
="Checking for minor macro")
505 conf
.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
506 headers
='unistd.h sys/types.h dirent.h',
507 define
='HAVE_DIRENT_D_OFF')
509 conf
.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent')
510 conf
.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE',
511 msg
="Checking for setnetgrent prototype",
512 headers
='netdb.h netgroup.h',
513 cflags
="-Werror-implicit-function-declaration")
514 conf
.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE',
515 msg
="Checking for getnetgrent prototype",
516 headers
='netdb.h netgroup.h',
517 cflags
="-Werror-implicit-function-declaration")
518 conf
.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE',
519 msg
="Checking for endnetgrent prototype",
520 headers
='netdb.h netgroup.h',
521 cflags
="-Werror-implicit-function-declaration")
525 if Options
.options
.with_cups
:
526 conf
.find_program('cups-config', var
='CUPS_CONFIG')
527 if conf
.env
.CUPS_CONFIG
:
528 conf
.check_cfg(path
=conf
.env
.CUPS_CONFIG
, args
="--cflags --ldflags --libs",
529 package
="", uselib_store
="cups")
530 conf
.CHECK_HEADERS('cups/cups.h cups/language.h', lib
='cups')
531 conf
.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', conf
.env
.LIB_cups
)
532 if conf
.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf
.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
533 conf
.DEFINE('HAVE_CUPS', '1')
535 conf
.undefine('HAVE_CUPS')
536 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
538 # define an empty subsystem for cups, to allow it to be used as an empty dependency
539 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
541 if Options
.options
.with_iprint
:
542 if conf
.CONFIG_SET('HAVE_CUPS'):
543 conf
.DEFINE('HAVE_IPRINT', '1')
545 print "--enable-iprint=yes but cups support not sufficient"
546 if Options
.options
.with_syslog
:
547 conf
.DEFINE('WITH_SYSLOG', '1')
548 if Options
.options
.with_automount
:
549 conf
.DEFINE('WITH_AUTOMOUNT', '1')
552 if Options
.options
.with_ldap
:
553 conf
.CHECK_HEADERS('ldap.h lber.h')
554 conf
.CHECK_TYPE('ber_tag_t', 'unsigned int', headers
='ldap.h lber.h')
555 conf
.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
556 conf
.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers
='ldap.h')
557 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
558 # SASL wrapping hooks
559 if conf
.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
560 conf
.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
561 conf
.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
563 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
565 conf
.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
566 define
='HAVE_LBER_LOG_PRINT_FN', headers
='lber.h')
568 conf
.CHECK_FUNCS_IN('ldap_init ldap_initialize ldap_set_rebind_proc', 'ldap')
569 conf
.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
571 # Check if ldap_set_rebind_proc() takes three arguments
572 if conf
.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
573 'LDAP_SET_REBIND_PROC_ARGS',
574 msg
="Checking whether ldap_set_rebind_proc takes 3 arguments",
575 headers
='ldap.h lber.h', link
=False):
576 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
578 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
580 # last but not least, if ldap_init() exists, we want to use ldap
581 if conf
.CONFIG_SET('HAVE_LDAP_INIT'):
582 conf
.DEFINE('HAVE_LDAP', '1')
583 conf
.DEFINE('LDAP_DEPRECATED', '1')
584 conf
.env
['HAVE_LDAP'] = '1'
586 conf
.SET_TARGET_TYPE('ldap', 'EMPTY')
587 conf
.SET_TARGET_TYPE('lber', 'EMPTY')
591 if Options
.options
.with_krb5
:
592 conf
.find_program('krb5-config', var
='KRB5_CONFIG')
593 if conf
.env
.KRB5_CONFIG
:
594 conf
.check_cfg(path
="krb5-config", args
="--cflags --libs",
595 package
="gssapi", uselib_store
="krb5")
596 conf
.CHECK_HEADERS('krb5.h krb5/locate_plugin.h', lib
='krb5')
597 conf
.CHECK_HEADERS('gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h gssapi/gssapi_ext.h com_err.h', lib
='krb5')
599 if conf
.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'):
600 conf
.env
['WINBIND_KRB5_LOCATOR'] = 'bin/winbind_krb5_locator.so'
602 conf
.CHECK_FUNCS_IN('_et_list', 'com_err')
603 conf
.CHECK_FUNCS_IN('krb5_encrypt_data', 'k5crypto')
604 conf
.CHECK_FUNCS_IN('crypto', 'des_set_key')
605 conf
.CHECK_FUNCS_IN('copy_Authenticator', 'asn1')
606 conf
.CHECK_FUNCS_IN('roken_getaddrinfo_hostspec', 'roken')
607 if conf
.CHECK_FUNCS_IN('gss_display_status', 'gssapi') or \
608 conf
.CHECK_FUNCS_IN('gss_display_status', 'gssapi_krb5'):
610 conf
.CHECK_FUNCS_IN('gss_wrap_iov', 'gssapi gssapi_krb5 krb5')
611 conf
.CHECK_FUNCS_IN('krb5_mk_req_extended krb5_kt_compare', 'krb5')
613 krb5_set_real_time krb5_set_default_in_tkt_etypes krb5_set_default_tgs_enctypes
614 krb5_set_default_tgs_ktypes krb5_principal2salt krb5_use_enctype
615 krb5_string_to_key krb5_get_pw_salt krb5_string_to_key_salt krb5_auth_con_setkey
616 krb5_auth_con_setuseruserkey krb5_locate_kdc krb5_get_permitted_enctypes
617 krb5_get_default_in_tkt_etypes krb5_free_data_contents
618 krb5_principal_get_comp_string krb5_free_unparsed_name
619 krb5_free_keytab_entry_contents krb5_kt_free_entry krb5_krbhst_init
620 krb5_krbhst_get_addrinfo krb5_c_enctype_compare krb5_enctypes_compatible_keys
621 krb5_crypto_init krb5_crypto_destroy krb5_decode_ap_req free_AP_REQ
622 krb5_verify_checksum krb5_c_verify_checksum krb5_principal_compare_any_realm
623 krb5_parse_name_norealm krb5_princ_size krb5_get_init_creds_opt_set_pac_request
624 krb5_get_renewed_creds krb5_get_kdc_cred krb5_free_error_contents
625 initialize_krb5_error_table krb5_get_init_creds_opt_alloc
626 krb5_get_init_creds_opt_free krb5_get_init_creds_opt_get_error
627 krb5_enctype_to_string krb5_fwd_tgt_creds krb5_auth_con_set_req_cksumtype
628 krb5_get_creds_opt_alloc krb5_get_creds_opt_set_impersonate krb5_get_creds
629 krb5_get_credentials_for_user krb5_get_host_realm krb5_free_host_realm''',
631 conf
.CHECK_DECLS('''krb5_get_credentials_for_user
632 krb5_auth_con_set_req_cksumtype''',
633 headers
='krb5.h', always
=True)
634 conf
.CHECK_VARIABLE('AP_OPTS_USE_SUBKEY', headers
='krb5.h')
635 conf
.CHECK_VARIABLE('KV5M_KEYTAB', headers
='krb5.h')
636 conf
.CHECK_VARIABLE('KRB5_KU_OTHER_CKSUM', headers
='krb5.h')
637 conf
.CHECK_VARIABLE('KRB5_KEYUSAGE_APP_DATA_CKSUM', headers
='krb5.h')
638 conf
.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'key', headers
='krb5.h',
639 define
='HAVE_KRB5_KEYTAB_ENTRY_KEY')
640 conf
.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'keyblock', headers
='krb5.h',
641 define
='HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK')
642 conf
.CHECK_STRUCTURE_MEMBER('krb5_address', 'magic', headers
='krb5.h',
643 define
='HAVE_MAGIC_IN_KRB5_ADDRESS')
644 conf
.CHECK_STRUCTURE_MEMBER('krb5_address', 'addrtype', headers
='krb5.h',
645 define
='HAVE_ADDRTYPE_IN_KRB5_ADDRESS')
646 conf
.CHECK_STRUCTURE_MEMBER('krb5_ticket', 'enc_part2', headers
='krb5.h',
647 define
='HAVE_KRB5_TKT_ENC_PART2')
648 conf
.CHECK_STRUCTURE_MEMBER('krb5_creds', 'keyblock', headers
='krb5.h',
649 define
='HAVE_KRB5_KEYBLOCK_IN_CREDS')
650 conf
.CHECK_STRUCTURE_MEMBER('krb5_creds', 'session', headers
='krb5.h',
651 define
='HAVE_KRB5_SESSION_IN_CREDS')
652 conf
.CHECK_STRUCTURE_MEMBER('krb5_ap_req', 'ticket', headers
='krb5.h',
653 define
='HAVE_TICKET_POINTER_IN_KRB5_AP_REQ')
655 conf
.CHECK_TYPE('krb5_encrypt_block', headers
='krb5.h')
660 krb5_enctype enctype;
661 enctype = ticket.enc_part.enctype;
662 kvno = ticket.enc_part.kvno;
664 'KRB5_TICKET_HAS_KEYINFO',
665 headers
='krb5.h', link
=False,
666 msg
="Checking whether the krb5_ticket structure contains the kvno and enctype")
669 krb5_get_init_creds_opt *opt = NULL;
670 krb5_get_init_creds_opt_free(ctx, opt);
672 'KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT',
673 headers
='krb5.h', link
=False,
674 msg
="Checking whether krb5_get_init_creds_opt_free takes a context argument")
675 conf
.CHECK_CODE('krb5_mk_error(0,0,0)',
676 'HAVE_SHORT_KRB5_MK_ERROR_INTERFACE',
677 headers
='krb5.h', link
=False,
678 msg
="Checking whether krb5_mk_error takes 3 arguments MIT or 9 Heimdal")
680 const krb5_data *pkdata;
681 krb5_context context;
682 krb5_principal principal;
683 pkdata = krb5_princ_component(context, principal, 0);
685 'HAVE_KRB5_PRINC_COMPONENT',
686 headers
='krb5.h', lib
='krb5',
687 msg
="Checking whether krb5_princ_component is available")
692 krb5_enctype_to_string(1, buf, 256);
695 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_SIZE_T_ARG',
696 headers
='krb5.h', lib
='krb5 k5crypto',
697 addmain
=False, cflags
='-Werror',
698 msg
="Checking whether krb5_enctype_to_string takes size_t argument")
702 krb5_context context = NULL;
704 krb5_enctype_to_string(context, 1, &str);
708 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_KRB5_CONTEXT_ARG',
709 headers
='krb5.h stdlib.h', lib
='krb5',
710 addmain
=False, cflags
='-Werror',
711 msg
="Checking whether krb5_enctype_to_string takes krb5_context argument")
714 krb5_context ctx = NULL;
715 krb5_principal princ = NULL;
716 const char *str = krb5_princ_realm(ctx, princ)->data;
719 'HAVE_KRB5_PRINC_REALM',
720 headers
='krb5.h', lib
='krb5',
722 msg
="Checking whether the macro krb5_princ_realm is defined")
725 krb5_context context;
726 krb5_principal principal;
727 const char *realm; realm = krb5_principal_get_realm(context, principal);
730 'HAVE_KRB5_PRINCIPAL_GET_REALM',
731 headers
='krb5.h', lib
='krb5',
733 msg
="Checking whether krb5_principal_get_realm is defined")
734 if conf
.CHECK_CODE('''krb5_verify_checksum(0, 0, 0, 0, 0, 0, 0);''',
735 'KRB5_VERIFY_CHECKSUM_ARGS',
736 headers
='krb5.h', lib
='krb5',
737 msg
="Checking whether krb5_verify_checksum takes 7 arguments"):
738 conf
.DEFINE('KRB5_VERIFY_CHECKSUM_ARGS', '7')
740 conf
.DEFINE('KRB5_VERIFY_CHECKSUM_ARGS', '6')
743 krb5_enctype enctype;
744 enctype = ENCTYPE_ARCFOUR_HMAC_MD5;
746 '_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5',
747 headers
='krb5.h', lib
='krb5',
748 msg
="Checking whether the ENCTYPE_ARCFOUR_HMAC_MD5 key type definition is available");
750 krb5_keytype keytype;
751 keytype = KEYTYPE_ARCFOUR_56;
753 '_HAVE_KEYTYPE_ARCFOUR_56',
754 headers
='krb5.h', lib
='krb5',
755 msg
="Checking whether the HAVE_KEYTYPE_ARCFOUR_56 key type definition is available");
756 if conf
.CONFIG_SET('_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and conf
.CONFIG_SET('_HAVE_KEYTYPE_ARCFOUR_56'):
757 conf
.DEFINE('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5', '1')
760 krb5_enctype enctype;
761 enctype = ENCTYPE_ARCFOUR_HMAC;
763 'HAVE_ENCTYPE_ARCFOUR_HMAC',
764 headers
='krb5.h', lib
='krb5',
765 msg
="Checking whether the ENCTYPE_ARCFOUR_HMAC key type definition is available");
768 krb5_context context;
770 krb5_init_context(&context);
771 return krb5_kt_resolve(context, "WRFILE:api", &keytab);
773 'HAVE_WRFILE_KEYTAB',
774 headers
='krb5.h', lib
='krb5', execute
=True,
775 msg
="Checking whether the WRFILE:-keytab is supported");
777 # Check for KRB5_DEPRECATED handling
778 conf
.CHECK_CODE('''#define KRB5_DEPRECATED 1
779 #include <krb5.h>''',
780 'HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER', addmain
=False,
782 msg
="Checking for KRB5_DEPRECATED define taking an identifier")
784 conf
.SET_TARGET_TYPE('krb5', 'EMPTY')
785 conf
.SET_TARGET_TYPE('gssapi', 'EMPTY')
786 conf
.SET_TARGET_TYPE('gssapi_krb5', 'EMPTY')
787 conf
.SET_TARGET_TYPE('com_err', 'EMPTY')
788 conf
.SET_TARGET_TYPE('k5crypto', 'EMPTY')
790 if Options
.options
.with_ads
:
792 if not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and \
793 not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC'):
794 print "arcfour-hmac-md5 encryption type not found in -lkrb5"
796 if not conf
.CONFIG_SET('HAVE_KRB5_MK_REQ_EXTENDED'):
797 print "krb5_mk_req_extended not found in -lkrb5"
799 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL2SALT') and \
800 not conf
.CONFIG_SET('HAVE_KRB5_GET_PW_SALT'):
801 print "no CREATE_KEY_FUNCTIONS detected"
803 if not conf
.CONFIG_SET('HAVE_KRB5_GET_PERMITTED_ENCTYPES') and \
804 not conf
.CONFIG_SET('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES'):
805 print "no GET_ENCTYPES_FUNCTIONS detected"
807 if not conf
.CONFIG_SET('HAVE_KRB5_KT_FREE_ENTRY') and \
808 not conf
.CONFIG_SET('HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS'):
809 print "no KT_FREE_FUNCTION detected"
811 if not conf
.CONFIG_SET('HAVE_KRB5_C_VERIFY_CHECKSUM') and \
812 not conf
.CONFIG_SET('HAVE_KRB5_VERIFY_CHECKSUM'):
813 print "no KRB5_VERIFY_CHECKSUM_FUNCTION detected"
815 if not conf
.CONFIG_SET('KRB5_TICKET_HAS_KEYINFO'):
816 # We only need the following functions if we can't get the enctype
817 # and kvno out of the ticket directly (ie. on Heimdal).
818 if not conf
.CONFIG_SET('free_AP_REQ'):
819 print "no KRB5_AP_REQ_FREE_FUNCTION detected"
821 if not conf
.CONFIG_SET('HAVE_KRB5_DECODE_AP_REQ'):
822 print "no KRB5_AP_REQ_DECODING_FUNCTION detected"
825 conf
.DEFINE('WITH_ADS', '1')
826 conf
.DEFINE('HAVE_KRB5', '1')
828 conf
.DEFINE('HAVE_GSSAPI', '1')
830 print "krb5 libs don't have all features required for Active Directory support"
831 conf
.undefine('HAVE_KRB5_H')
832 conf
.undefine('HAVE_GSSAPI_H')
833 conf
.undefine('HAVE_GSSAPI_GSSAPI_GENERIC_H')
834 conf
.undefine('HAVE_GSSAPI_GSSAPI_H')
836 if Options
.options
.with_utmp
:
837 conf
.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
838 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers
='utmp.h',
839 define
='HAVE_UT_UT_NAME')
840 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers
='utmp.h',
841 define
='HAVE_UT_UT_USER')
842 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers
='utmp.h',
843 define
='HAVE_UT_UT_ID')
844 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers
='utmp.h',
845 define
='HAVE_UT_UT_HOST')
846 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers
='utmp.h',
847 define
='HAVE_UT_UT_TIME')
848 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers
='utmp.h',
849 define
='HAVE_UT_UT_TV')
850 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers
='utmp.h',
851 define
='HAVE_UT_UT_TYPE')
852 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers
='utmp.h',
853 define
='HAVE_UT_UT_PID')
854 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers
='utmp.h',
855 define
='HAVE_UT_UT_EXIT')
856 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr_v6', headers
='utmp.h',
857 define
='HAVE_UT_UT_ADDR_V6')
858 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr', headers
='utmp.h',
859 define
='HAVE_UT_UT_ADDR')
860 conf
.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers
='utmpx.h',
861 define
='HAVE_UX_UT_SYSLEN')
862 conf
.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
863 'PUTUTLINE_RETURNS_UTMP', headers
='utmp.h',
864 msg
="Checking whether pututline returns pointer")
865 conf
.DEFINE('WITH_UTMP', 1)
867 if Options
.options
.with_avahi
:
868 conf
.env
.with_avahi
= True
869 if not conf
.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf
.env
.with_avahi
= False
870 if not conf
.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf
.env
.with_avahi
= False
871 if not conf
.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf
.env
.with_avahi
= False
872 if conf
.env
.with_avahi
:
873 conf
.DEFINE('WITH_AVAHI_SUPPORT', 1)
875 conf
.SET_TARGET_TYPE('avahi-common', 'EMPTY')
876 conf
.SET_TARGET_TYPE('avahi-client', 'EMPTY')
878 if Options
.options
.with_iconv
:
879 conf
.env
.with_iconv
= True
880 if not conf
.CHECK_FUNCS_IN('iconv_open', 'iconv', headers
='iconv.h'):
881 conf
.env
.with_iconv
= False
882 if conf
.env
.with_iconv
:
883 conf
.DEFINE('HAVE_ICONV', 1)
885 if Options
.options
.with_pam
:
887 conf
.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
888 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
889 print "--with-pam=yes but pam_appl.h not found"
891 conf
.CHECK_FUNCS_IN('pam_get_data', 'pam')
892 conf
.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h')
893 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'):
894 print "--with-pam=yes but pam_modules.h not found"
896 conf
.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h')
897 conf
.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h')
898 conf
.CHECK_FUNCS_IN('pam_vsyslog', 'pam')
900 #if defined(HAVE_SECURITY_PAM_APPL_H)
901 #include <security/pam_appl.h>
902 #elif defined(HAVE_PAM_PAM_APPL_H)
903 #include <pam/pam_appl.h>
905 pam_set_item(0, PAM_RHOST, 0);
909 msg
="Checking whether PAM_RHOST is available");
911 #if defined(HAVE_SECURITY_PAM_APPL_H)
912 #include <security/pam_appl.h>
913 #elif defined(HAVE_PAM_PAM_APPL_H)
914 #include <pam/pam_appl.h>
916 pam_set_item(0, PAM_TTY, 0);
920 msg
="Checking whether PAM_TTY is available");
922 #if (!defined(LINUX))
924 #define PAM_EXTERN extern
925 #if defined(HAVE_SECURITY_PAM_APPL_H)
926 #include <security/pam_appl.h>
927 #elif defined(HAVE_PAM_PAM_APPL_H)
928 #include <pam/pam_appl.h>
933 #if defined(HAVE_SECURITY_PAM_MODULES_H)
934 #include <security/pam_modules.h>
935 #elif defined(HAVE_PAM_PAM_MODULES_H)
936 #include <pam/pam_modules.h>
939 #if defined(HAVE_SECURITY__PAM_MACROS_H)
940 #include <security/_pam_macros.h>
941 #elif defined(HAVE_PAM__PAM_MACROS_H)
942 #include <pam/_pam_macros.h>
945 #ifdef HAVE_SECURITY_PAM_EXT_H
946 #include <security/pam_ext.h>
949 int i; i = PAM_RADIO_TYPE;
951 'HAVE_PAM_RADIO_TYPE',
953 msg
="Checking whether PAM_RADIO_TYPE is available");
955 conf
.DEFINE('WITH_PAM', 1)
956 conf
.DEFINE('WITH_PAM_MODULES', 1)
960 seteuid
= conf
.CHECK_CODE('''
961 #define AUTOCONF_TEST 1
962 #define USE_SETREUID 1
963 #include "./lib/util_sec.c"
968 msg
="Checking whether setreuid is available")
970 seteuid
= conf
.CHECK_CODE('''
971 #define AUTOCONF_TEST 1
972 #define USE_SETRESUID 1
973 #include "./lib/util_sec.c"
978 msg
="Checking whether setresuid is available")
980 seteuid
= conf
.CHECK_CODE('''
981 #define AUTOCONF_TEST 1
982 #define USE_SETEUID 1
983 #include "./lib/util_sec.c"
988 msg
="Checking whether seteuid is available")
990 seteuid
= conf
.CHECK_CODE('''
991 #define AUTOCONF_TEST 1
992 #define USE_SETUIDX 1
993 #include "./lib/util_sec.c"
999 msg
="Checking whether setuidx is available")
1000 if Options
.options
.with_dnsupdate
:
1001 conf
.CHECK_HEADERS('uuid/uuid.h')
1002 conf
.CHECK_FUNCS_IN('uuid_generate', 'uuid')
1003 if not conf
.CONFIG_SET('HAVE_UUID_UUID_H') and not conf
.CONFIG_SET('HAVE_UUID_GENERATE'):
1004 print "--with-dnsupdate=yes but uuid support not sufficient"
1005 elif not conf
.CONFIG_SET('HAVE_GSSAPI'):
1006 print "--with-dnsupdate=yes but gssapi support not sufficient"
1008 conf
.DEFINE('WITH_DNS_UPDATES', 1)
1010 conf
.SET_TARGET_TYPE('uuid', 'EMPTY')
1011 conf
.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
1012 if Options
.options
.developer
:
1013 if conf
.CONFIG_SET('HAVE_VALGRIND_H') or conf
.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'):
1014 conf
.DEFINE('VALGRIND', '1')
1016 if conf
.CHECK_CODE('''
1017 #include <bits/sockaddr.h>
1018 #include <linux/netlink.h>
1020 'HAVE_LINUX_NETLINK_H',
1021 msg
="Checking whether Linux netlink is available"):
1023 #include <bits/sockaddr.h>
1024 #include <linux/netlink.h>
1025 #include <linux/rtnetlink.h>
1027 'HAVE_LINUX_RTNETLINK_H',
1028 msg
='Checking whether Linux rtnetlink is available')
1029 if conf
.CHECK_TYPE('struct dirent64', headers
='sys/types.h dirent.h') and conf
.CONFIG_SET('HAVE_READDIR64'):
1030 conf
.DEFINE('HAVE_STRUCT_DIRENT64', '1')
1032 conf
.undefine('HAVE_STRUCT_DIRENT64')
1035 #include "../tests/fcntl_lock.c"
1040 msg
='Checking whether fcntl locking is available')
1043 #include "../tests/fcntl_lock64.c"
1045 'HAVE_BROKEN_FCNTL64_LOCKS',
1048 msg
='Checking whether fcntl64 locks are broken')
1050 if not conf
.CONFIG_SET('HAVE_BROKEN_FCNTL64_LOCKS'):
1052 #if defined(HAVE_UNISTD_H)
1062 #ifdef HAVE_SYS_FCNTL_H
1063 #include <sys/fcntl.h>
1065 main() { struct flock64 fl64;
1066 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
1073 'HAVE_STRUCT_FLOCK64',
1076 msg
="Checking whether the flock64 struct is available")
1078 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec',
1079 define
='HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') # Linux, Solaris
1080 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimensec',
1081 define
='HAVE_STRUCT_STAT_ST_MTIMENSEC') # BSD, if defined _POSIX_SOURCE
1082 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimespec.tv_nsec',
1083 define
='HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') # BSD, if not defined _POSIX_SOURCE
1084 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtime_n',
1085 define
='HAVE_STRUCT_STAT_ST_MTIME_N') # AIX
1086 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_umtime',
1087 define
='HAVE_STRUCT_STAT_ST_UMTIME') # Tru64
1088 if conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') or \
1089 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMENSEC') or \
1090 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') or \
1091 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIME_N') or \
1092 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_UMTIME'):
1093 conf
.DEFINE('HAVE_STAT_HIRES_TIMESTAMPS', '1')
1095 # recent FreeBSD, NetBSD have creation timestamps called birthtime:
1096 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtime',
1097 define
='HAVE_STRUCT_STAT_ST_BIRTHTIME')
1098 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimespec.tv_nsec',
1099 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC')
1100 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimensec',
1101 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC')
1104 #if defined(HAVE_UNISTD_H)
1107 #include <fcntl.h>],
1108 ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
1110 'HAVE_POSIX_FADVISE',
1111 msg
='Checking whether posix_fadvise is available')
1113 for v
in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]:
1116 return sysconf(%s) == -1 ? 1 : 0;
1119 msg
='Checking whether sysconf(%s) is available' % v
)
1121 conf
.CHECK_DECLS('__NR_inotify_init', reverse
=True, headers
='asm/unistd.h')
1124 #include <sys/syscall.h>
1126 syscall(SYS_initgroups, 16, NULL, NULL, 0);
1128 'HAVE_DARWIN_INITGROUPS',
1129 msg
='Checking hether to use the Darwin-specific initgroups system call')
1131 conf
.CHECK_CODE('''struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''',
1133 headers
='sys/types.h utime.h',
1134 msg
='Checking whether struct utimbuf is available')
1136 if conf
.CHECK_CODE('''struct sigevent s;''',
1137 'HAVE_STRUCT_SIGEVENT',
1138 headers
='sys/types.h stdlib.h stddef.h signal.h',
1139 msg
='Checking whether we have the struct sigevent'):
1140 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sival_ptr',
1141 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR',
1142 headers
='signal.h');
1143 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sigval_ptr',
1144 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR',
1145 headers
='signal.h');
1147 default_static_modules
=TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
1148 auth_sam auth_unix auth_winbind auth_wbc auth_server
1149 auth_domain auth_builtin vfs_default
1150 nss_info_template idmap_tdb idmap_passdb
1153 default_shared_modules
=TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
1154 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
1155 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850
1156 charset_CP437 auth_script vfs_readahead vfs_xattr_tdb
1157 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
1158 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
1159 vfs_crossrename vfs_linux_xfs_sgid
1160 vfs_time_audit idmap_autorid''')
1162 if Options
.options
.developer
:
1163 default_static_modules
.extend(TO_LIST('pdb_ads auth_netlogond'))
1164 default_shared_modules
.extend(TO_LIST('charset_weird perfcount_test'))
1166 if Options
.options
.with_acl_support
and conf
.CONFIG_SET('HAVE_POSIX_ACLS'):
1167 default_static_modules
.extend(TO_LIST('vfs_posixacl'))
1169 if conf
.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'):
1170 default_shared_modules
.extend(TO_LIST('vfs_zfsacl'))
1172 if conf
.CONFIG_SET('HAVE_DIRFD_DECL'):
1173 default_shared_modules
.extend(TO_LIST('vfs_syncops vfs_dirsort'))
1175 if conf
.CONFIG_SET('HAVE_STATFS_F_FSID'):
1176 default_shared_modules
.extend(TO_LIST('vfs_fileid'))
1178 if conf
.CONFIG_SET('HAVE_AIO') and (conf
.CONFIG_SET('HAVE_MSGHDR_MSG_CONTROL') or conf
.CONFIG_SET('HAVE_MSGHDR_MSG_ACCTRIGHTS')):
1179 default_shared_modules
.extend(TO_LIST('vfs_aio_fork'))
1181 if conf
.CONFIG_SET('HAVE_LDAP'):
1182 default_static_modules
.extend(TO_LIST('pdb_ldap idmap_ldap'))
1184 if conf
.CONFIG_SET('DARWINOS'):
1185 default_shared_modules
.extend(TO_LIST('charset_macosxfs'))
1187 explicit_shared_modules
= TO_LIST(Options
.options
.shared_modules
, delimiter
=',')
1188 explicit_static_modules
= TO_LIST(Options
.options
.static_modules
, delimiter
=',')
1190 final_static_modules
= default_static_modules
1191 final_shared_modules
= default_shared_modules
1193 for m
in explicit_static_modules
:
1194 if m
in final_shared_modules
:
1195 final_shared_modules
.remove(m
)
1196 final_static_modules
.append(m
)
1197 for m
in explicit_shared_modules
:
1198 if m
in final_static_modules
:
1199 final_static_modules
.remove(m
)
1200 final_shared_modules
.append(m
)
1202 conf
.env
['static_modules'] = final_static_modules
1203 conf
.env
['shared_modules'] = final_shared_modules
1205 conf
.DEFINE('STRING_STATIC_MODULES', ' '.join(final_static_modules
), quote
=True)
1210 prefixes
= ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
1211 conf
.env
['MODULE_PREFIXES'] = prefixes
1213 for m
in final_static_modules
:
1215 if not p
in static_list
:
1217 static_list
[p
].append(m
)
1218 for m
in final_shared_modules
:
1220 if not p
in shared_list
:
1222 shared_list
[p
].append(m
)
1225 static_env
= "%s_STATIC" % p
.upper()
1226 shared_env
= "%s_SHARED" % p
.upper()
1227 conf
.env
[static_env
] = []
1228 conf
.env
[shared_env
] = []
1229 if p
in static_list
:
1231 for entry
in static_list
[p
]:
1232 decl_list
+= "extern NTSTATUS %s_init(void); " % entry
1233 conf
.env
[static_env
].append('%s' % entry
)
1234 decl_list
= decl_list
.rstrip()
1235 conf
.DEFINE('static_decl_%s' % p
, decl_list
)
1236 conf
.DEFINE('static_init_%s' % p
, '{ %s_init(); }' % '_init(); '.join(static_list
[p
]))
1238 conf
.DEFINE('static_decl_%s' % p
, '')
1239 conf
.DEFINE('static_init_%s' % p
, '{}')
1240 if p
in shared_list
:
1241 for entry
in shared_list
[p
]:
1242 conf
.DEFINE('%s_init' % entry
, 'init_samba_module')
1243 conf
.env
[shared_env
].append('%s' % entry
)
1245 conf
.SAMBA_CONFIG_H('include/config.h')
1248 "build 'tags' file using ctags"
1250 source_root
= os
.path
.dirname(Utils
.g_module
.root_path
)
1251 cmd
= 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
1252 print("Running: %s" % cmd
)