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
.ADD_EXTRA_INCLUDES('''#source3 #source3/include #lib/replace #lib/talloc
78 #lib/tevent #lib/addns #source3/librpc
79 #source3/lib #lib/tdb/include #lib/popt''')
81 conf
.RECURSE('../lib/replace')
83 conf
.RECURSE('../lib/tdb')
84 conf
.RECURSE('../lib/talloc')
85 conf
.RECURSE('../lib/tevent')
86 conf
.RECURSE('../lib/popt')
87 conf
.RECURSE('../lib/nss_wrapper')
88 conf
.RECURSE('../lib/socket_wrapper')
89 conf
.RECURSE('../lib/zlib')
90 conf
.RECURSE('../libcli/smbreadline')
91 conf
.RECURSE('../lib/util')
93 conf
.ADD_LDFLAGS("-Wl,--export-dynamic", testflags
=True)
95 conf
.CHECK_HEADERS('execinfo.h libexc.h libunwind.h netdb.h')
96 conf
.CHECK_HEADERS('linux/falloc.h')
98 conf
.CHECK_FUNCS('getcwd fchown chmod fchmod mknod mknod64')
99 conf
.CHECK_FUNCS('strtol strchr strupr chflags')
100 conf
.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
101 conf
.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
102 conf
.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr')
103 conf
.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
104 conf
.CHECK_FUNCS('setpriv setgidx setuidx setgroups sysconf stat64 fstat64')
105 conf
.CHECK_FUNCS('lstat64 fopen64 atexit grantpt lseek64 ftruncate64 fallocate fallocate64 posix_fallocate posix_fallocate64')
106 conf
.CHECK_FUNCS('fseek64 fseeko64 ftell64 ftello64 setluid')
107 conf
.CHECK_FUNCS('getpwnam', headers
='sys/types.h pwd.h')
108 conf
.CHECK_FUNCS('opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64')
109 conf
.CHECK_FUNCS('fdopendir fdopendir64')
110 conf
.CHECK_FUNCS('getpwent_r getdents64 setenv strcasecmp fcvt fcvtl')
111 conf
.CHECK_FUNCS('syslog vsyslog timegm setlocale nl_langinfo')
112 conf
.CHECK_FUNCS_IN('nanosleep', 'rt')
113 conf
.CHECK_FUNCS('lutimes futimes utimensat futimens')
114 conf
.CHECK_FUNCS('mlock munlock mlockall munlockall')
115 conf
.CHECK_FUNCS('memalign posix_memalign hstrerror')
116 conf
.CHECK_FUNCS('shmget')
117 conf
.CHECK_FUNCS_IN('shm_open', 'rt', checklibc
=True)
118 conf
.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain')
119 #FIXME: for some reason this one still fails
120 conf
.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
121 conf
.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
122 conf
.CHECK_DECLS('fdatasync', reverse
=True)
123 conf
.CHECK_DECLS('readahead', reverse
=True, headers
='fcntl.h')
125 if conf
.CONFIG_SET('HAVE_LONG_LONG'):
126 conf
.DEFINE('HAVE_LONGLONG', 1)
128 if conf
.CHECK_CODE('''
129 #if defined(HAVE_UNISTD_H)
132 long ret = splice(0,0,1,0,400,0);
136 conf
.CHECK_DECLS('splice', reverse
=True, headers
='fcntl.h')
138 # Check for inotify support
139 conf
.CHECK_HEADERS('linux/inotify.h asm/unistd.h sys/inotify.h')
140 conf
.CHECK_FUNCS('inotify_init')
141 if "HAVE_LINUX_INOTIFY_H" in conf
.env
and "HAVE_INOTIFY_INIT" in conf
.env
:
142 conf
.DEFINE('HAVE_INOTIFY', 1)
144 # Check for kernel change notify support
147 #define F_NOTIFY 1026
150 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
151 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain
=False, execute
=True,
152 headers
='fcntl.h signal.h',
153 msg
="Checking for kernel change notify support")
155 # Check for Linux kernel oplocks
157 #include <sys/types.h>
161 #define F_NOTIFY 1026
164 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
165 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain
=False, execute
=True,
166 msg
="Checking for Linux kernel oplocks")
168 # Check for IRIX kernel oplock types
169 conf
.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
170 'HAVE_KERNEL_OPLOCKS_IRIX', headers
='fcntl.h',
171 msg
="Checking for IRIX kernel oplock types")
173 # Check for krenel share modes
175 #include <sys/types.h>
178 #include <sys/file.h>
184 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
185 }''', 'HAVE_KERNEL_SHARE_MODES', addmain
=False, execute
=True,
186 msg
="Checking for krenel share modes")
188 # Check for various members of the stat structure
189 conf
.CHECK_TYPES('blksize_t blkcnt_t')
190 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define
='HAVE_STAT_ST_BLOCKS',
191 headers
='sys/stat.h')
192 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define
='HAVE_STAT_ST_BLKSIZE',
193 headers
='sys/stat.h')
194 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_flags', define
='HAVE_STAT_ST_FLAGS',
195 headers
='sys/types.h sys/stat.h unistd.h')
197 # Check for POSIX capability support
198 conf
.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers
='sys/capability.h')
200 if "HAVE_SYS_CAPABILITY_H" in conf
.env
:
204 if (!(cap = cap_get_proc())) exit(1);
206 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
207 cap_set_proc(cap);''',
208 'HAVE_POSIX_CAPABILITIES', execute
=True, lib
="cap",
209 headers
='sys/capability.h',
210 msg
="Checking whether POSIX capabilities are available")
212 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
213 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
215 if conf
.CONFIG_SET("HAVE_RPC_RPC_H"):
216 conf
.CHECK_TYPE('int16', headers
='rpc/rpc.h',
217 define
='HAVE_INT16_FROM_RPC_RPC_H',
218 msg
="Checking for int16 typedef included by rpc/rpc.h")
219 conf
.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
220 headers
='sys/types.h rpc/rpc.h',
221 msg
="Checking for uint16 typedef included by rpc/rpc.h")
222 conf
.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
223 headers
='sys/types.h rpc/rpc.h',
224 msg
="Checking for int32 typedef included by rpc/rpc.h")
225 conf
.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
226 headers
='sys/types.h rpc/rpc.h',
227 msg
="Checking for uint32 typedef included by rpc/rpc.h")
228 conf
.CHECK_CODE('int i;', 'BROKEN_NISPLUS_INCLUDE_FILES',
229 headers
='sys/types.h sys/acl.h rpcsvc/nis.h',
230 msg
="Checking for broken nisplus include files")
232 # Check if the compiler will optimize out functions
235 this_function_does_not_exist();
238 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
239 msg
="Checking if the compiler will optimize out functions")
241 # Check if the compiler supports the LL suffix on long long integers
243 conf
.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL',
245 msg
="Checking for LL suffix on long long integers")
248 _acl __acl add_proplist_entry atexit attr_getf attr_list attr_listf
249 attropen attr_remove attr_removef attr_set attr_setf backtrace_symbols
250 bindtextdomain _chdir __chdir chflags chmod _close __close _closedir
251 __closedir closedir64 creat64 crypt16 delproplist devnm dgettext dirfd
252 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
253 extattr_delete_fd extattr_delete_link extattr_get_fd extattr_get_file
254 extattr_get_link extattr_list_fd extattr_list_file extattr_list_link
255 extattr_set_fd extattr_set_file extattr_set_link _facl __facl _fchdir
256 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
257 fdelproplist fgetea fgetproplist fgetxattr flistea flistxattr fopen64
258 _fork __fork fremoveea fremovexattr fseek64 fseeko64 fsetea
259 fsetproplist fsetxattr _fstat __fstat fstat64 _fstat64 __fstat64 fsync
260 ftell64 ftello64 ftruncate64 futimens futimes __fxstat getauthuid
261 getcwd _getcwd __getcwd getdents __getdents getdents64 getdirentries
262 getgrent getgrnam getgrouplist getmntent getpagesize
263 getproplist get_proplist_entry getpwanam getpwent_r getrlimit gettext
264 glob grantpt hstrerror initgroups innetgr
265 inotify_init lgetea lgetxattr listea listxattr llistea llistxattr
266 llseek _llseek __llseek lremoveea lremovexattr _lseek __lseek lseek64
267 lsetea lsetxattr _lstat __lstat lstat64 _lstat64 __lstat64 lutimes
268 __lxstat memalign mknod mknod64 mlock mlockall munlock munlockall
269 nl_langinfo _open __open open64 _open64 __open64 _opendir __opendir
270 opendir64 pathconf poll posix_fallocate posix_fallocate64
271 posix_memalign prctl pread _pread __pread pread64 _pread64 __pread64
272 pwrite _pwrite __pwrite pwrite64 _pwrite64
273 __pwrite64 rdchk _read __read _readdir __readdir readdir64 _readdir64
274 __readdir64 removeea removexattr rewinddir64 _seekdir __seekdir
275 seekdir64 select setea setenv setgidx setgroups setlocale setluid
276 setmntent setpgid setpriv setproplist setsid setuidx
277 setxattr shmget shm_open sigaction sigblock sigprocmask sigset
278 sizeof_proplist_entry _stat __stat stat64 _stat64 __stat64 statvfs
279 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctlbyname
280 __sys_llseek syslog _telldir __telldir telldir64 textdomain timegm
281 utimensat vsyslog _write __write __xstat
284 conf
.CHECK_TYPE('struct timespec', headers
='sys/time.h time.h')
286 conf
.CHECK_SAMBA3_CHARSET() # see build/charset.py
288 # FIXME: these should be tests for features, but the old build system just
291 host_os
= sys
.platform
292 print "building on %s" % host_os
294 # Python doesn't have case switches... :/
295 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
296 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
298 conf
.SET_TARGET_TYPE('sunacl', 'EMPTY')
299 if (host_os
.rfind('linux') > -1) or (host_os
.rfind('gnu') > -1) or (host_os
.rfind('qnx') > -1):
300 if host_os
.rfind('linux') > -1:
301 conf
.DEFINE('LINUX', '1')
302 elif host_os
.rfind('qnx') > -1:
303 conf
.DEFINE('QNX', '1')
304 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
305 elif (host_os
.rfind('darwin') > -1):
306 conf
.DEFINE('DARWINOS', 1)
307 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
308 conf
.ADD_CFLAGS('-fno-common')
309 elif (host_os
.rfind('freebsd') > -1):
310 if conf
.CHECK_HEADERS('sunacl.h'):
311 conf
.define('HAVE_FREEBSD_SUNACL_H', '1')
312 conf
.CHECK_FUNCS_IN('acl', 'sunacl')
313 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
314 elif (host_os
.rfind('netbsd') > -1):
315 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
316 elif (host_os
.rfind('openbsd') > -1):
317 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
318 # FIXME: Add more checks here.
320 print "Unknown host_os '%s', please report this to samba-technical@samba.org" % host_os
322 #FIXME: add more checks
323 if Options
.options
.with_acl_support
:
324 if host_os
.rfind('linux') > -1:
325 conf
.CHECK_FUNCS_IN('acl_get_file', 'acl')
326 conf
.CHECK_FUNCS_IN('getxattr', 'attr')
327 if conf
.CHECK_CODE('''
330 acl_entry_t *entry_p;
331 return acl_get_entry(acl, entry_id, entry_p);
334 headers
='sys/types.h sys/acl.h', link
=False,
335 msg
="Checking for POSIX ACL support") :
337 acl_permset_t permset_d;
339 return acl_get_perm_np(permset_d, perm);
341 'HAVE_ACL_GET_PERM_NP',
342 headers
='sys/types.h sys/acl.h', link
=True,
343 msg
="Checking whether acl_get_perm_np() is available")
345 conf
.DEFINE('HAVE_NO_ACLS', 1)
346 conf
.SET_TARGET_TYPE('acl', 'EMPTY')
348 conf
.DEFINE('HAVE_NO_ACLS', 1)
349 conf
.SET_TARGET_TYPE('acl', 'EMPTY')
351 if conf
.CHECK_FUNCS('dirfd'):
352 conf
.DEFINE('HAVE_DIRFD_DECL', 1)
354 conf
.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
355 'HAVE_STATFS_F_FSID',
356 msg
="vfs_fileid: checking for statfs() and struct statfs.f_fsid",
357 headers
='sys/types.h sys/statfs.h',
360 if conf
.CONFIG_SET('HAVE_FALLOCATE'):
362 #if defined(HAVE_UNISTD_H)
365 #include <sys/types.h>
368 #if defined(HAVE_LINUX_FALLOC_H)
369 #include <linux/falloc.h>
371 int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
372 'HAVE_LINUX_FALLOCATE',
373 msg
="Checking whether the Linux 'fallocate' function is available")
374 if conf
.CONFIG_SET('HAVE_FALLOCATE64'):
376 #if defined(HAVE_UNISTD_H)
379 #include <sys/types.h>
382 #if defined(HAVE_LINUX_FALLOC_H)
383 #include <linux/falloc.h>
385 int ret = fallocate64(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
386 'HAVE_LINUX_FALLOCATE64',
387 msg
="Checking whether the Linux 'fallocate64' function is available")
389 #if defined(HAVE_UNISTD_H)
393 ssize_t err = readahead(0,0,0x80000);''',
394 'HAVE_LINUX_READAHEAD',
395 msg
="Checking whether Linux readahead is available")
396 conf
.CHECK_DECLS('readahead', headers
='fcntl.h', always
=True)
399 #include <sys/types.h>
400 #include <sys/socket.h>],
403 int ret = getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len);''',
405 msg
="Checking whether we can use SO_PEERCRED to get socket credentials")
408 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
409 #include <sys/types.h>
414 'HAVE_EXPLICIT_LARGEFILE_SUPPORT',
415 msg
="Checking whether large file support can be enabled")
417 if Options
.options
.with_aio_support
:
418 conf
.CHECK_FUNCS_IN('aio_read', 'aio')
419 conf
.CHECK_FUNCS_IN('aio_read', 'rt')
420 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);',
422 msg
='Checking for asynchronous io support',
423 headers
='sys/types.h aio.h',
425 conf
.CHECK_CODE('struct aiocb64 a; return aio_read64(&a);',
427 msg
='Checking for 64-bit asynchronous io support',
428 headers
='sys/types.h aio.h',
430 if conf
.CONFIG_SET('HAVE_AIO64'):
431 conf
.DEFINE('HAVE_AIOCB64', '1')
432 conf
.DEFINE('WITH_AIO', '1')
433 elif conf
.CONFIG_SET('HAVE_AIO'):
434 conf
.DEFINE('WITH_AIO', '1')
435 if conf
.CONFIG_SET('HAVE_AIO'):
436 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg
='Checking for aio_read', headers
='aio.h', lib
='aio rt')
437 conf
.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg
='Checking for aio_write', headers
='aio.h', lib
='aio rt')
438 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')
439 conf
.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg
='Checking for aio_return', headers
='aio.h', lib
='aio rt')
440 conf
.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg
='Checking for aio_error', headers
='aio.h', lib
='aio rt')
441 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')
442 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')
443 if conf
.CONFIG_SET('HAVE_AIO64'):
444 conf
.CHECK_CODE('struct aiocb a; return aio_read64(&a);', 'HAVE_AIO_READ64', msg
='Checking for aio_read64', headers
='aio.h', lib
='aio rt')
445 conf
.CHECK_CODE('struct aiocb a; return aio_write64(&a);', 'HAVE_AIO_WRITE64', msg
='Checking for aio_write64', headers
='aio.h', lib
='aio rt')
446 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')
447 conf
.CHECK_CODE('struct aiocb a; return aio_return64(&a);', 'HAVE_AIO_RETURN64', msg
='Checking for aio_return64', headers
='aio.h', lib
='aio rt')
448 conf
.CHECK_CODE('struct aiocb a; return aio_error64(&a);', 'HAVE_AIO_ERROR64', msg
='Checking for aio_error64', headers
='aio.h', lib
='aio rt')
449 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')
450 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')
451 if not conf
.CONFIG_SET('HAVE_AIO'):
452 conf
.DEFINE('HAVE_NO_AIO', '1')
454 conf
.DEFINE('HAVE_NO_AIO', '1')
460 char control[CMSG_SPACE(sizeof(int))];
462 msg.msg_control = control_un.control;
463 msg.msg_controllen = sizeof(control_un.control);
465 'HAVE_MSGHDR_MSG_CONTROL',
466 msg
='Checking if we can use msg_control for passing file descriptors',
467 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
471 msg.msg_acctrights = (caddr_t) &fd;
472 msg.msg_acctrightslen = sizeof(fd);
474 'HAVE_MSGHDR_MSG_ACCTRIGHTS',
475 msg
='Checking if we can use msg_acctrights for passing file descriptors',
476 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
478 if Options
.options
.with_winbind
:
479 conf
.env
.build_winbind
= True
480 conf
.DEFINE('WITH_WINBIND', '1')
482 conf
.find_program('awk', var
='AWK')
483 conf
.find_program('perl', var
='PERL')
485 # Darwin has extra options to xattr-family functions
486 conf
.CHECK_CODE('getxattr(0, 0, 0, 0, 0, 0);',
488 msg
="Checking whether xattr interface takes additional options",
489 headers
='sys/types.h attr/xattr.h sys/xattr.h')
491 conf
.CHECK_HEADERS('asm/types.h')
493 conf
.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
494 headers
='unistd.h sys/types.h',
495 msg
="Checking for major macro")
497 conf
.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
498 headers
='unistd.h sys/types.h',
499 msg
="Checking for minor macro")
501 conf
.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
502 headers
='unistd.h sys/types.h dirent.h',
503 define
='HAVE_DIRENT_D_OFF')
505 conf
.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent')
506 conf
.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE',
507 msg
="Checking for setnetgrent prototype",
508 headers
='netdb.h netgroup.h',
509 cflags
="-Werror-implicit-function-declaration")
510 conf
.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE',
511 msg
="Checking for getnetgrent prototype",
512 headers
='netdb.h netgroup.h',
513 cflags
="-Werror-implicit-function-declaration")
514 conf
.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE',
515 msg
="Checking for endnetgrent prototype",
516 headers
='netdb.h netgroup.h',
517 cflags
="-Werror-implicit-function-declaration")
521 if Options
.options
.with_cups
:
522 conf
.find_program('cups-config', var
='CUPS_CONFIG')
523 if conf
.env
.CUPS_CONFIG
:
524 conf
.check_cfg(path
=conf
.env
.CUPS_CONFIG
, args
="--cflags --ldflags --libs",
525 package
="", uselib_store
="cups")
526 conf
.CHECK_HEADERS('cups/cups.h cups/language.h', lib
='cups')
527 conf
.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', conf
.env
.LIB_cups
)
528 if conf
.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf
.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
529 conf
.DEFINE('HAVE_CUPS', '1')
531 conf
.undefine('HAVE_CUPS')
532 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
534 # define an empty subsystem for cups, to allow it to be used as an empty dependency
535 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
537 if Options
.options
.with_iprint
:
538 if conf
.CONFIG_SET('HAVE_CUPS'):
539 conf
.DEFINE('HAVE_IPRINT', '1')
541 print "--enable-iprint=yes but cups support not sufficient"
542 if Options
.options
.with_syslog
:
543 conf
.DEFINE('WITH_SYSLOG', '1')
544 if Options
.options
.with_automount
:
545 conf
.DEFINE('WITH_AUTOMOUNT', '1')
548 if Options
.options
.with_ldap
:
549 conf
.CHECK_HEADERS('ldap.h lber.h')
550 conf
.CHECK_TYPE('ber_tag_t', 'unsigned int', headers
='ldap.h lber.h')
551 conf
.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
552 conf
.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers
='ldap.h')
553 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
554 # SASL wrapping hooks
555 if conf
.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
556 conf
.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
557 conf
.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
559 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
561 conf
.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
562 define
='HAVE_LBER_LOG_PRINT_FN', headers
='lber.h')
564 conf
.CHECK_FUNCS_IN('ldap_init ldap_initialize ldap_set_rebind_proc', 'ldap')
565 conf
.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
567 # Check if ldap_set_rebind_proc() takes three arguments
568 if conf
.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
569 'LDAP_SET_REBIND_PROC_ARGS',
570 msg
="Checking whether ldap_set_rebind_proc takes 3 arguments",
571 headers
='ldap.h lber.h', link
=False):
572 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
574 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
576 # last but not least, if ldap_init() exists, we want to use ldap
577 if conf
.CONFIG_SET('HAVE_LDAP_INIT'):
578 conf
.DEFINE('HAVE_LDAP', '1')
579 conf
.DEFINE('LDAP_DEPRECATED', '1')
580 conf
.env
['HAVE_LDAP'] = '1'
582 conf
.SET_TARGET_TYPE('ldap', 'EMPTY')
583 conf
.SET_TARGET_TYPE('lber', 'EMPTY')
587 if Options
.options
.with_krb5
:
588 conf
.find_program('krb5-config', var
='KRB5_CONFIG')
589 if conf
.env
.KRB5_CONFIG
:
590 conf
.check_cfg(path
="krb5-config", args
="--cflags --libs",
591 package
="gssapi", uselib_store
="krb5")
592 conf
.CHECK_HEADERS('krb5.h krb5/locate_plugin.h', lib
='krb5')
593 conf
.CHECK_HEADERS('gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h gssapi/gssapi_ext.h com_err.h', lib
='krb5')
595 if conf
.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'):
596 conf
.env
['WINBIND_KRB5_LOCATOR'] = 'bin/winbind_krb5_locator.so'
598 conf
.CHECK_FUNCS_IN('_et_list', 'com_err')
599 conf
.CHECK_FUNCS_IN('krb5_encrypt_data', 'k5crypto')
600 conf
.CHECK_FUNCS_IN('crypto', 'des_set_key')
601 conf
.CHECK_FUNCS_IN('copy_Authenticator', 'asn1')
602 conf
.CHECK_FUNCS_IN('roken_getaddrinfo_hostspec', 'roken')
603 if conf
.CHECK_FUNCS_IN('gss_display_status', 'gssapi') or \
604 conf
.CHECK_FUNCS_IN('gss_display_status', 'gssapi_krb5'):
606 conf
.CHECK_FUNCS_IN('gss_wrap_iov', 'gssapi gssapi_krb5 krb5')
607 conf
.CHECK_FUNCS_IN('krb5_mk_req_extended krb5_kt_compare', 'krb5')
609 krb5_set_real_time krb5_set_default_in_tkt_etypes krb5_set_default_tgs_enctypes
610 krb5_set_default_tgs_ktypes krb5_principal2salt krb5_use_enctype
611 krb5_string_to_key krb5_get_pw_salt krb5_string_to_key_salt krb5_auth_con_setkey
612 krb5_auth_con_setuseruserkey krb5_locate_kdc krb5_get_permitted_enctypes
613 krb5_get_default_in_tkt_etypes krb5_free_data_contents
614 krb5_principal_get_comp_string krb5_free_unparsed_name
615 krb5_free_keytab_entry_contents krb5_kt_free_entry krb5_krbhst_init
616 krb5_krbhst_get_addrinfo krb5_c_enctype_compare krb5_enctypes_compatible_keys
617 krb5_crypto_init krb5_crypto_destroy krb5_decode_ap_req free_AP_REQ
618 krb5_verify_checksum krb5_c_verify_checksum krb5_principal_compare_any_realm
619 krb5_parse_name_norealm krb5_princ_size krb5_get_init_creds_opt_set_pac_request
620 krb5_get_renewed_creds krb5_get_kdc_cred krb5_free_error_contents
621 initialize_krb5_error_table krb5_get_init_creds_opt_alloc
622 krb5_get_init_creds_opt_free krb5_get_init_creds_opt_get_error
623 krb5_enctype_to_string krb5_fwd_tgt_creds krb5_auth_con_set_req_cksumtype
624 krb5_get_creds_opt_alloc krb5_get_creds_opt_set_impersonate krb5_get_creds
625 krb5_get_credentials_for_user krb5_get_host_realm krb5_free_host_realm''',
627 conf
.CHECK_DECLS('''krb5_get_credentials_for_user
628 krb5_auth_con_set_req_cksumtype''',
629 headers
='krb5.h', always
=True)
630 conf
.CHECK_VARIABLE('AP_OPTS_USE_SUBKEY', headers
='krb5.h')
631 conf
.CHECK_VARIABLE('KV5M_KEYTAB', headers
='krb5.h')
632 conf
.CHECK_VARIABLE('KRB5_KU_OTHER_CKSUM', headers
='krb5.h')
633 conf
.CHECK_VARIABLE('KRB5_KEYUSAGE_APP_DATA_CKSUM', headers
='krb5.h')
634 conf
.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'key', headers
='krb5.h',
635 define
='HAVE_KRB5_KEYTAB_ENTRY_KEY')
636 conf
.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'keyblock', headers
='krb5.h',
637 define
='HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK')
638 conf
.CHECK_STRUCTURE_MEMBER('krb5_address', 'magic', headers
='krb5.h',
639 define
='HAVE_MAGIC_IN_KRB5_ADDRESS')
640 conf
.CHECK_STRUCTURE_MEMBER('krb5_address', 'addrtype', headers
='krb5.h',
641 define
='HAVE_ADDRTYPE_IN_KRB5_ADDRESS')
642 conf
.CHECK_STRUCTURE_MEMBER('krb5_ticket', 'enc_part2', headers
='krb5.h',
643 define
='HAVE_KRB5_TKT_ENC_PART2')
644 conf
.CHECK_STRUCTURE_MEMBER('krb5_creds', 'keyblock', headers
='krb5.h',
645 define
='HAVE_KRB5_KEYBLOCK_IN_CREDS')
646 conf
.CHECK_STRUCTURE_MEMBER('krb5_creds', 'session', headers
='krb5.h',
647 define
='HAVE_KRB5_SESSION_IN_CREDS')
648 conf
.CHECK_STRUCTURE_MEMBER('krb5_ap_req', 'ticket', headers
='krb5.h',
649 define
='HAVE_TICKET_POINTER_IN_KRB5_AP_REQ')
651 conf
.CHECK_TYPE('krb5_encrypt_block', headers
='krb5.h')
656 krb5_enctype enctype;
657 enctype = ticket.enc_part.enctype;
658 kvno = ticket.enc_part.kvno;
660 'KRB5_TICKET_HAS_KEYINFO',
661 headers
='krb5.h', link
=False,
662 msg
="Checking whether the krb5_ticket structure contains the kvno and enctype")
665 krb5_get_init_creds_opt *opt = NULL;
666 krb5_get_init_creds_opt_free(ctx, opt);
668 'KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT',
669 headers
='krb5.h', link
=False,
670 msg
="Checking whether krb5_get_init_creds_opt_free takes a context argument")
671 conf
.CHECK_CODE('krb5_mk_error(0,0,0)',
672 'HAVE_SHORT_KRB5_MK_ERROR_INTERFACE',
673 headers
='krb5.h', link
=False,
674 msg
="Checking whether krb5_mk_error takes 3 arguments MIT or 9 Heimdal")
676 const krb5_data *pkdata;
677 krb5_context context;
678 krb5_principal principal;
679 pkdata = krb5_princ_component(context, principal, 0);
681 'HAVE_KRB5_PRINC_COMPONENT',
682 headers
='krb5.h', lib
='krb5',
683 msg
="Checking whether krb5_princ_component is available")
688 krb5_enctype_to_string(1, buf, 256);
691 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_SIZE_T_ARG',
692 headers
='krb5.h', lib
='krb5 k5crypto',
693 addmain
=False, cflags
='-Werror',
694 msg
="Checking whether krb5_enctype_to_string takes size_t argument")
698 krb5_context context = NULL;
700 krb5_enctype_to_string(context, 1, &str);
704 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_KRB5_CONTEXT_ARG',
705 headers
='krb5.h stdlib.h', lib
='krb5',
706 addmain
=False, cflags
='-Werror',
707 msg
="Checking whether krb5_enctype_to_string takes krb5_context argument")
710 krb5_context ctx = NULL;
711 krb5_principal princ = NULL;
712 const char *str = krb5_princ_realm(ctx, princ)->data;
715 'HAVE_KRB5_PRINC_REALM',
716 headers
='krb5.h', lib
='krb5',
718 msg
="Checking whether the macro krb5_princ_realm is defined")
719 if conf
.CHECK_CODE('''krb5_verify_checksum(0, 0, 0, 0, 0, 0, 0);''',
720 'KRB5_VERIFY_CHECKSUM_ARGS',
721 headers
='krb5.h', lib
='krb5',
722 msg
="Checking whether krb5_verify_checksum takes 7 arguments"):
723 conf
.DEFINE('KRB5_VERIFY_CHECKSUM_ARGS', '7')
725 conf
.DEFINE('KRB5_VERIFY_CHECKSUM_ARGS', '6')
728 krb5_enctype enctype;
729 enctype = ENCTYPE_ARCFOUR_HMAC_MD5;
731 '_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5',
732 headers
='krb5.h', lib
='krb5',
733 msg
="Checking whether the ENCTYPE_ARCFOUR_HMAC_MD5 key type definition is available");
735 krb5_keytype keytype;
736 keytype = KEYTYPE_ARCFOUR_56;
738 '_HAVE_KEYTYPE_ARCFOUR_56',
739 headers
='krb5.h', lib
='krb5',
740 msg
="Checking whether the HAVE_KEYTYPE_ARCFOUR_56 key type definition is available");
741 if conf
.CONFIG_SET('_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and conf
.CONFIG_SET('_HAVE_KEYTYPE_ARCFOUR_56'):
742 conf
.DEFINE('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5', '1')
745 krb5_enctype enctype;
746 enctype = ENCTYPE_ARCFOUR_HMAC;
748 'HAVE_ENCTYPE_ARCFOUR_HMAC',
749 headers
='krb5.h', lib
='krb5',
750 msg
="Checking whether the ENCTYPE_ARCFOUR_HMAC key type definition is available");
753 krb5_context context;
755 krb5_init_context(&context);
756 return krb5_kt_resolve(context, "WRFILE:api", &keytab);
758 'HAVE_WRFILE_KEYTAB',
759 headers
='krb5.h', lib
='krb5', execute
=True,
760 msg
="Checking whether the WRFILE:-keytab is supported");
763 conf
.SET_TARGET_TYPE('krb5', 'EMPTY')
764 conf
.SET_TARGET_TYPE('gssapi', 'EMPTY')
765 conf
.SET_TARGET_TYPE('gssapi_krb5', 'EMPTY')
766 conf
.SET_TARGET_TYPE('com_err', 'EMPTY')
767 conf
.SET_TARGET_TYPE('k5crypto', 'EMPTY')
769 if Options
.options
.with_ads
:
771 if not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and \
772 not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC'):
773 print "arcfour-hmac-md5 encryption type not found in -lkrb5"
775 if not conf
.CONFIG_SET('HAVE_KRB5_MK_REQ_EXTENDED'):
776 print "krb5_mk_req_extended not found in -lkrb5"
778 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL2SALT') and \
779 not conf
.CONFIG_SET('HAVE_KRB5_GET_PW_SALT'):
780 print "no CREATE_KEY_FUNCTIONS detected"
782 if not conf
.CONFIG_SET('HAVE_KRB5_GET_PERMITTED_ENCTYPES') and \
783 not conf
.CONFIG_SET('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES'):
784 print "no GET_ENCTYPES_FUNCTIONS detected"
786 if not conf
.CONFIG_SET('HAVE_KRB5_KT_FREE_ENTRY') and \
787 not conf
.CONFIG_SET('HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS'):
788 print "no KT_FREE_FUNCTION detected"
790 if not conf
.CONFIG_SET('HAVE_KRB5_C_VERIFY_CHECKSUM') and \
791 not conf
.CONFIG_SET('HAVE_KRB5_VERIFY_CHECKSUM'):
792 print "no KRB5_VERIFY_CHECKSUM_FUNCTION detected"
794 if not conf
.CONFIG_SET('KRB5_TICKET_HAS_KEYINFO'):
795 # We only need the following functions if we can't get the enctype
796 # and kvno out of the ticket directly (ie. on Heimdal).
797 if not conf
.CONFIG_SET('free_AP_REQ'):
798 print "no KRB5_AP_REQ_FREE_FUNCTION detected"
800 if not conf
.CONFIG_SET('HAVE_KRB5_DECODE_AP_REQ'):
801 print "no KRB5_AP_REQ_DECODING_FUNCTION detected"
804 conf
.DEFINE('WITH_ADS', '1')
805 conf
.DEFINE('HAVE_KRB5', '1')
807 conf
.DEFINE('HAVE_GSSAPI', '1')
809 print "krb5 libs don't have all features required for Active Directory support"
810 conf
.undefine('HAVE_KRB5_H')
811 conf
.undefine('HAVE_GSSAPI_H')
812 conf
.undefine('HAVE_GSSAPI_GSSAPI_GENERIC_H')
813 conf
.undefine('HAVE_GSSAPI_GSSAPI_H')
815 if Options
.options
.with_utmp
:
816 conf
.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
817 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers
='utmp.h',
818 define
='HAVE_UT_UT_NAME')
819 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers
='utmp.h',
820 define
='HAVE_UT_UT_USER')
821 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers
='utmp.h',
822 define
='HAVE_UT_UT_ID')
823 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers
='utmp.h',
824 define
='HAVE_UT_UT_HOST')
825 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers
='utmp.h',
826 define
='HAVE_UT_UT_TIME')
827 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers
='utmp.h',
828 define
='HAVE_UT_UT_TV')
829 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers
='utmp.h',
830 define
='HAVE_UT_UT_TYPE')
831 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers
='utmp.h',
832 define
='HAVE_UT_UT_PID')
833 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers
='utmp.h',
834 define
='HAVE_UT_UT_EXIT')
835 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr_v6', headers
='utmp.h',
836 define
='HAVE_UT_UT_ADDR_V6')
837 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr', headers
='utmp.h',
838 define
='HAVE_UT_UT_ADDR')
839 conf
.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers
='utmpx.h',
840 define
='HAVE_UX_UT_SYSLEN')
841 conf
.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
842 'PUTUTLINE_RETURNS_UTMP', headers
='utmp.h',
843 msg
="Checking whether pututline returns pointer")
844 conf
.DEFINE('WITH_UTMP', 1)
846 if Options
.options
.with_avahi
:
847 conf
.env
.with_avahi
= True
848 if not conf
.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf
.env
.with_avahi
= False
849 if not conf
.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf
.env
.with_avahi
= False
850 if not conf
.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf
.env
.with_avahi
= False
851 if conf
.env
.with_avahi
:
852 conf
.DEFINE('WITH_AVAHI_SUPPORT', 1)
854 conf
.SET_TARGET_TYPE('avahi-common', 'EMPTY')
855 conf
.SET_TARGET_TYPE('avahi-client', 'EMPTY')
857 if Options
.options
.with_iconv
:
858 conf
.env
.with_iconv
= True
859 if not conf
.CHECK_FUNCS_IN('iconv_open', 'iconv', headers
='iconv.h'):
860 conf
.env
.with_iconv
= False
861 if conf
.env
.with_iconv
:
862 conf
.DEFINE('HAVE_ICONV', 1)
864 if Options
.options
.with_pam
:
866 conf
.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
867 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
868 print "--with-pam=yes but pam_appl.h not found"
870 conf
.CHECK_FUNCS_IN('pam_get_data', 'pam')
871 conf
.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h')
872 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'):
873 print "--with-pam=yes but pam_modules.h not found"
875 conf
.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h')
876 conf
.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h')
877 conf
.CHECK_FUNCS_IN('pam_vsyslog', 'pam')
879 #if defined(HAVE_SECURITY_PAM_APPL_H)
880 #include <security/pam_appl.h>
881 #elif defined(HAVE_PAM_PAM_APPL_H)
882 #include <pam/pam_appl.h>
884 pam_set_item(0, PAM_RHOST, 0);
888 msg
="Checking whether PAM_RHOST is available");
890 #if defined(HAVE_SECURITY_PAM_APPL_H)
891 #include <security/pam_appl.h>
892 #elif defined(HAVE_PAM_PAM_APPL_H)
893 #include <pam/pam_appl.h>
895 pam_set_item(0, PAM_TTY, 0);
899 msg
="Checking whether PAM_TTY is available");
901 #if (!defined(LINUX))
903 #define PAM_EXTERN extern
904 #if defined(HAVE_SECURITY_PAM_APPL_H)
905 #include <security/pam_appl.h>
906 #elif defined(HAVE_PAM_PAM_APPL_H)
907 #include <pam/pam_appl.h>
912 #if defined(HAVE_SECURITY_PAM_MODULES_H)
913 #include <security/pam_modules.h>
914 #elif defined(HAVE_PAM_PAM_MODULES_H)
915 #include <pam/pam_modules.h>
918 #if defined(HAVE_SECURITY__PAM_MACROS_H)
919 #include <security/_pam_macros.h>
920 #elif defined(HAVE_PAM__PAM_MACROS_H)
921 #include <pam/_pam_macros.h>
924 #ifdef HAVE_SECURITY_PAM_EXT_H
925 #include <security/pam_ext.h>
928 int i; i = PAM_RADIO_TYPE;
930 'HAVE_PAM_RADIO_TYPE',
932 msg
="Checking whether PAM_RADIO_TYPE is available");
934 conf
.DEFINE('WITH_PAM', 1)
935 conf
.DEFINE('WITH_PAM_MODULES', 1)
939 seteuid
= conf
.CHECK_CODE('''
940 #define AUTOCONF_TEST 1
941 #define USE_SETREUID 1
942 #include "./lib/util_sec.c"
947 msg
="Checking whether setreuid is available")
949 seteuid
= conf
.CHECK_CODE('''
950 #define AUTOCONF_TEST 1
951 #define USE_SETRESUID 1
952 #include "./lib/util_sec.c"
957 msg
="Checking whether setresuid is available")
959 seteuid
= conf
.CHECK_CODE('''
960 #define AUTOCONF_TEST 1
961 #define USE_SETEUID 1
962 #include "./lib/util_sec.c"
967 msg
="Checking whether seteuid is available")
969 seteuid
= conf
.CHECK_CODE('''
970 #define AUTOCONF_TEST 1
971 #define USE_SETUIDX 1
972 #include "./lib/util_sec.c"
978 msg
="Checking whether setuidx is available")
979 if Options
.options
.with_dnsupdate
:
980 conf
.CHECK_HEADERS('uuid/uuid.h')
981 conf
.CHECK_FUNCS_IN('uuid_generate', 'uuid')
982 if not conf
.CONFIG_SET('HAVE_UUID_UUID_H') and not conf
.CONFIG_SET('HAVE_UUID_GENERATE'):
983 print "--with-dnsupdate=yes but uuid support not sufficient"
984 elif not conf
.CONFIG_SET('HAVE_GSSAPI'):
985 print "--with-dnsupdate=yes but gssapi support not sufficient"
987 conf
.DEFINE('WITH_DNS_UPDATES', 1)
989 conf
.SET_TARGET_TYPE('uuid', 'EMPTY')
990 conf
.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
991 if Options
.options
.developer
:
992 if conf
.CONFIG_SET('HAVE_VALGRIND_H') or conf
.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'):
993 conf
.DEFINE('VALGRIND', '1')
995 if conf
.CHECK_CODE('''
996 #include <bits/sockaddr.h>
997 #include <linux/netlink.h>
999 'HAVE_LINUX_NETLINK_H',
1000 msg
="Checking whether Linux netlink is available"):
1002 #include <bits/sockaddr.h>
1003 #include <linux/netlink.h>
1004 #include <linux/rtnetlink.h>
1006 'HAVE_LINUX_RTNETLINK_H',
1007 msg
='Checking whether Linux rtnetlink is available')
1008 if conf
.CHECK_TYPE('struct dirent64', headers
='sys/types.h dirent.h') and conf
.CONFIG_SET('HAVE_READDIR64'):
1009 conf
.DEFINE('HAVE_STRUCT_DIRENT64', '1')
1011 conf
.undefine('HAVE_STRUCT_DIRENT64')
1014 #include "../tests/fcntl_lock.c"
1019 msg
='Checking whether fcntl locking is available')
1022 #include "../tests/fcntl_lock64.c"
1024 'HAVE_BROKEN_FCNTL64_LOCKS',
1027 msg
='Checking whether fcntl64 locks are broken')
1029 if not conf
.CONFIG_SET('HAVE_BROKEN_FCNTL64_LOCKS'):
1031 #if defined(HAVE_UNISTD_H)
1041 #ifdef HAVE_SYS_FCNTL_H
1042 #include <sys/fcntl.h>
1044 main() { struct flock64 fl64;
1045 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
1052 'HAVE_STRUCT_FLOCK64',
1055 msg
="Checking whether the flock64 struct is available")
1057 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec',
1058 define
='HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') # Linux, Solaris
1059 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimensec',
1060 define
='HAVE_STRUCT_STAT_ST_MTIMENSEC') # BSD, if defined _POSIX_SOURCE
1061 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimespec.tv_nsec',
1062 define
='HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') # BSD, if not defined _POSIX_SOURCE
1063 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtime_n',
1064 define
='HAVE_STRUCT_STAT_ST_MTIME_N') # AIX
1065 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_umtime',
1066 define
='HAVE_STRUCT_STAT_ST_UMTIME') # Tru64
1067 if conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') or \
1068 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMENSEC') or \
1069 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') or \
1070 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIME_N') or \
1071 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_UMTIME'):
1072 conf
.DEFINE('HAVE_STAT_HIRES_TIMESTAMPS', '1')
1074 # recent FreeBSD, NetBSD have creation timestamps called birthtime:
1075 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtime',
1076 define
='HAVE_STRUCT_STAT_ST_BIRTHTIME')
1077 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimespec.tv_nsec',
1078 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC')
1079 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimensec',
1080 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC')
1083 #if defined(HAVE_UNISTD_H)
1086 #include <fcntl.h>],
1087 ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
1089 'HAVE_POSIX_FADVISE',
1090 msg
='Checking whether posix_fadvise is available')
1092 for v
in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]:
1095 return sysconf(%s) == -1 ? 1 : 0;
1098 msg
='Checking whether sysconf(%s) is available' % v
)
1100 conf
.CHECK_DECLS('__NR_inotify_init', reverse
=True, headers
='asm/unistd.h')
1103 #include <sys/syscall.h>
1105 syscall(SYS_initgroups, 16, NULL, NULL, 0);
1107 'HAVE_DARWIN_INITGROUPS',
1108 msg
='Checking hether to use the Darwin-specific initgroups system call')
1110 conf
.CHECK_CODE('''struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''',
1112 headers
='sys/types.h utime.h',
1113 msg
='Checking whether struct utimbuf is available')
1115 if conf
.CHECK_CODE('''struct sigevent s;''',
1116 'HAVE_STRUCT_SIGEVENT',
1117 headers
='sys/types.h stdlib.h stddef.h signal.h',
1118 msg
='Checking whether we have the struct sigevent'):
1119 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sival_ptr',
1120 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR',
1121 headers
='signal.h');
1122 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sigval_ptr',
1123 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR',
1124 headers
='signal.h');
1126 if os
.path
.exists('/proc/sys/kernel/core_pattern'):
1127 conf
.DEFINE('HAVE_SYS_KERNEL_PROC_CORE_PATTERN', '1')
1129 if conf
.CHECK_CODE('''
1133 if (sizeof(time_t) == 8) {
1134 time_t max_time = 0x7fffffffffffffffll;
1135 tm = gmtime(&max_time);
1136 /* This should fail with 32-bit tm_year. */
1138 /* Max time_t that works with 32-bit int tm_year in struct tm. */
1139 max_time = 67768036191676799ll;
1140 tm = gmtime(&max_time);
1151 msg
="Checking for the maximum value of the 'time_t' type"):
1152 conf
.DEFINE('TIME_T_MAX', '67768036191676799ll')
1155 #if defined(HAVE_UNISTD_H)
1158 #include <sys/types.h>
1159 main() { dev_t dev = makedev(1,2); return 0; }
1163 msg
='Checking whether the macro for makedev is available')
1170 void exit_on_core(int ignored) {
1176 signal(SIGSEGV, exit_on_core);
1177 newpath = realpath("/tmp", NULL);
1178 exit((newpath != NULL) ? 0 : 1);
1181 'REALPATH_TAKES_NULL',
1184 msg
='Checking whether the realpath function allows a NULL argument')
1186 conf
.CHECK_CODE('''#include "../tests/ftruncate.c"''',
1187 'HAVE_FTRUNCATE_EXTEND',
1188 msg
='Checking for ftruncate extend',
1192 if os
.environ
.get('RUN_FROM_BUILD_FARM') is not None:
1193 conf
.define('ENABLE_BUILD_FARM_HACKS', '1')
1195 if Options
.options
.with_sendfile_support
:
1196 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):
1201 ssize_t nwritten = sendfile64(tofd, fromfd, &offset, total);
1204 headers
='sys/sendfile',
1205 msg
='Checking for linux sendfile64 support')
1210 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1213 headers
='sys/sendfile',
1214 msg
='Checking for linux sendfile support')
1216 # Try and cope with broken Linux sendfile....
1217 conf
.CHECK_CODE('''#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
1218 #undef _FILE_OFFSET_BITS
1220 #include <sys/sendfile.h>
1224 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1226 '_HAVE_BROKEN_LINUX_SENDFILE',
1227 msg
='Checking for broken linux sendfile support')
1228 if conf
.CONFIG_SET('_HAVE_SENDFILE64'):
1229 conf
.DEFINE('HAVE_SENDFILE64', '1')
1230 conf
.DEFINE('LINUX_SENDFILE_API', '1')
1231 conf
.DEFINE('WITH_SENDFILE', '1')
1232 elif conf
.CONFIG_SET('_HAVE_SENDFILE'):
1233 conf
.DEFINE('HAVE_SENDFILE', '1')
1234 conf
.DEFINE('LINUX_SENDFILE_API', '1')
1235 conf
.DEFINE('WITH_SENDFILE', '1')
1236 elif conf
.CONFIG_SET('_HAVE_BROKEN_LINUX_SENDFILE'):
1237 conf
.DEFINE('LINUX_BROKEN_SENDFILE_API', '1')
1238 conf
.DEFINE('WITH_SENDFILE', '1')
1239 elif (host_os
.rfind('freebsd') > -1) or (host_os
.rfind('dragonfly') > -1):
1241 #include <sys/types.h>
1243 #include <sys/socket.h>
1244 #include <sys/uio.h>
1245 int fromfd, tofd, ret, total=0;
1246 off_t offset, nwritten;
1249 hdr.headers = &hdtrl;
1251 hdr.trailers = NULL;
1253 hdtrl.iov_base = NULL;
1255 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0)
1258 msg
='Checking for freebsd sendfile support')
1259 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1260 conf
.DEFINE('HAVE_SENDFILE', '1')
1261 conf
.DEFINE('FREEBSD_SENDFILE_API', '1')
1262 conf
.DEFINE('WITH_SENDFILE', '1')
1263 elif (host_os
.rfind('hpux') > -1):
1265 #include <sys/socket.h>
1266 #include <sys/uio.h>
1269 struct iovec hdtrl[2];
1272 hdtrl[0].iov_base = 0;
1273 hdtrl[0].iov_len = 0;
1274 nwritten = sendfile64(tofd, fromfd, offset, total, &hdtrl[0], 0);
1277 msg
='Checking for hpux sendfile64 support')
1279 #include <sys/socket.h>
1280 #include <sys/uio.h>
1283 struct iovec hdtrl[2];
1286 hdtrl[0].iov_base = 0;
1287 hdtrl[0].iov_len = 0;
1288 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
1291 msg
='Checking for hpux sendfile support')
1292 if conf
.CONFIG_SET('_HAVE_SENDFILE64'):
1293 conf
.DEFINE('HAVE_SENDFILE64', '1')
1294 conf
.DEFINE('HPUX_SENDFILE_API', '1')
1295 conf
.DEFINE('WITH_SENDFILE', '1')
1296 elif conf
.CONFIG_SET('_HAVE_SENDFILE'):
1297 conf
.DEFINE('HAVE_SENDFILE', '1')
1298 conf
.DEFINE('HPUX_SENDFILE_API', '1')
1299 conf
.DEFINE('WITH_SENDFILE', '1')
1300 elif (host_os
.rfind('solaris') > -1):
1301 conf
.CHECK_FUNCS_IN('sendfile', 'sendfilev')
1303 #include <sys/sendfile.h>
1306 struct sendfilevec vec[2];
1310 vec[0].sfv_fd = SFV_FD_SELF;
1311 vec[0].sfv_flag = 0;
1315 vec[1].sfv_flag = 0;
1318 nwritten = sendfilev64(tofd, vec, sfvcnt, &xferred);
1320 '_HAVE_SENDFILEV64',
1321 msg
='Checking for solaris sendfilev64 support')
1323 #include <sys/sendfile.h>,
1326 struct sendfilevec vec[2];
1330 vec[0].sfv_fd = SFV_FD_SELF;
1331 vec[0].sfv_flag = 0;
1335 vec[1].sfv_flag = 0;
1338 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
1341 msg
='Checking for solaris sendfilev support')
1342 if conf
.CONFIG_SET('_HAVE_SENDFILEV64'):
1343 conf
.DEFINE('HAVE_SENDFILEV64', '1')
1344 conf
.DEFINE('SOLARIS_SENDFILE_API', '1')
1345 conf
.DEFINE('WITH_SENDFILE', '1')
1346 elif conf
.CONFIG_SET('_HAVE_SENDFILEV'):
1347 conf
.DEFINE('HAVE_SENDFILEV', '1')
1348 conf
.DEFINE('SOLARIS_SENDFILE_API', '1')
1349 conf
.DEFINE('WITH_SENDFILE', '1')
1350 elif (host_os
.rfind('aix') > -1):
1352 #include <sys/socket.h>
1355 struct sf_parms hdtrl;
1358 hdtrl.header_data = 0;
1359 hdtrl.header_length = 0;
1360 hdtrl.file_descriptor = fromfd;
1361 hdtrl.file_offset = 0;
1362 hdtrl.file_bytes = 0;
1363 hdtrl.trailer_data = 0;
1364 hdtrl.trailer_length = 0;
1365 nwritten = send_file(&tofd, &hdtrl, 0);
1368 msg
='Checking for AIX send_file support')
1369 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1370 conf
.DEFINE('HAVE_SENDFILE', '1')
1371 conf
.DEFINE('AIX_SENDFILE_API', '1')
1372 conf
.DEFINE('WITH_SENDFILE', '1')
1374 conf
.CHECK_CODE('''enum TDB_ERROR err = TDB_ERR_NESTING''',
1375 'HAVE_TDB_ERR_NESTING',
1377 msg
='Checking whether we have TDB_ERR_NESTING')
1379 # UnixWare 7.x has its getspnam in -lgen
1380 conf
.CHECK_FUNCS_IN('getspnam', 'gen')
1381 conf
.CHECK_FUNCS_IN('getspnam', 'security')
1382 conf
.CHECK_FUNCS_IN('getspnam', 'sec')
1384 default_static_modules
=TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
1385 auth_sam auth_unix auth_winbind auth_wbc auth_server
1386 auth_domain auth_builtin vfs_default
1387 nss_info_template idmap_tdb idmap_passdb
1390 default_shared_modules
=TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
1391 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
1392 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850
1393 charset_CP437 auth_script vfs_readahead vfs_xattr_tdb
1394 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
1395 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
1396 vfs_crossrename vfs_linux_xfs_sgid
1397 vfs_time_audit idmap_autorid''')
1399 if Options
.options
.developer
:
1400 default_static_modules
.extend(TO_LIST('pdb_ads auth_netlogond'))
1401 default_shared_modules
.extend(TO_LIST('charset_weird perfcount_test'))
1403 if Options
.options
.with_acl_support
and conf
.CONFIG_SET('HAVE_POSIX_ACLS'):
1404 default_static_modules
.extend(TO_LIST('vfs_posixacl'))
1406 if conf
.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'):
1407 default_shared_modules
.extend(TO_LIST('vfs_zfsacl'))
1409 if conf
.CONFIG_SET('HAVE_DIRFD_DECL'):
1410 default_shared_modules
.extend(TO_LIST('vfs_syncops vfs_dirsort'))
1412 if conf
.CONFIG_SET('HAVE_STATFS_F_FSID'):
1413 default_shared_modules
.extend(TO_LIST('vfs_fileid'))
1415 if conf
.CONFIG_SET('HAVE_AIO') and (conf
.CONFIG_SET('HAVE_MSGHDR_MSG_CONTROL') or conf
.CONFIG_SET('HAVE_MSGHDR_MSG_ACCTRIGHTS')):
1416 default_shared_modules
.extend(TO_LIST('vfs_aio_fork'))
1418 if conf
.CONFIG_SET('HAVE_LDAP'):
1419 default_static_modules
.extend(TO_LIST('pdb_ldap idmap_ldap'))
1421 if conf
.CONFIG_SET('DARWINOS'):
1422 default_shared_modules
.extend(TO_LIST('charset_macosxfs'))
1424 explicit_shared_modules
= TO_LIST(Options
.options
.shared_modules
, delimiter
=',')
1425 explicit_static_modules
= TO_LIST(Options
.options
.static_modules
, delimiter
=',')
1427 final_static_modules
= default_static_modules
1428 final_shared_modules
= default_shared_modules
1430 for m
in explicit_static_modules
:
1431 if m
in final_shared_modules
:
1432 final_shared_modules
.remove(m
)
1433 final_static_modules
.append(m
)
1434 for m
in explicit_shared_modules
:
1435 if m
in final_static_modules
:
1436 final_static_modules
.remove(m
)
1437 final_shared_modules
.append(m
)
1439 conf
.env
['static_modules'] = final_static_modules
1440 conf
.env
['shared_modules'] = final_shared_modules
1442 conf
.DEFINE('STRING_STATIC_MODULES', ' '.join(final_static_modules
), quote
=True)
1447 prefixes
= ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
1448 conf
.env
['MODULE_PREFIXES'] = prefixes
1450 for m
in final_static_modules
:
1452 if not p
in static_list
:
1454 static_list
[p
].append(m
)
1455 for m
in final_shared_modules
:
1457 if not p
in shared_list
:
1459 shared_list
[p
].append(m
)
1462 static_env
= "%s_STATIC" % p
.upper()
1463 shared_env
= "%s_SHARED" % p
.upper()
1464 conf
.env
[static_env
] = []
1465 conf
.env
[shared_env
] = []
1466 if p
in static_list
:
1468 for entry
in static_list
[p
]:
1469 decl_list
+= "extern NTSTATUS %s_init(void); " % entry
1470 conf
.env
[static_env
].append('%s' % entry
)
1471 decl_list
= decl_list
.rstrip()
1472 conf
.DEFINE('static_decl_%s' % p
, decl_list
)
1473 conf
.DEFINE('static_init_%s' % p
, '{ %s_init(); }' % '_init(); '.join(static_list
[p
]))
1475 conf
.DEFINE('static_decl_%s' % p
, '')
1476 conf
.DEFINE('static_init_%s' % p
, '{}')
1477 if p
in shared_list
:
1478 for entry
in shared_list
[p
]:
1479 conf
.DEFINE('%s_init' % entry
, 'init_samba_module')
1480 conf
.env
[shared_env
].append('%s' % entry
)
1482 conf
.SAMBA_CONFIG_H('include/config.h')
1485 "build 'tags' file using ctags"
1487 source_root
= os
.path
.dirname(Utils
.g_module
.root_path
)
1488 cmd
= 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
1489 print("Running: %s" % cmd
)