10 from optparse
import SUPPRESS_HELP
11 sys
.path
.insert(0, srcdir
+"/buildtools/wafsamba")
12 sys
.path
.insert(0, "source3")
13 import wafsamba
, Options
, Logs
, Utils
, Scripting
15 import samba_utils
, samba_version
19 if not os
.getenv('TOPLEVEL_BUILD'):
20 opt
.BUILTIN_DEFAULT('NONE')
21 opt
.PRIVATE_EXTENSION_DEFAULT('s3')
22 opt
.RECURSE('../lib/replace')
24 opt
.RECURSE('selftest')
25 opt
.RECURSE('../lib/nss_wrapper')
26 opt
.RECURSE('../lib/socket_wrapper')
27 opt
.RECURSE('../lib/tevent')
28 opt
.RECURSE('../lib/tdb_compat')
30 opt
.add_option('--with-static-modules',
31 help=("Comma-separated list of names of modules to statically link in"),
32 action
="store", dest
='static_modules', default
=None)
33 opt
.add_option('--with-shared-modules',
34 help=("Comma-separated list of names of modules to build shared"),
35 action
="store", dest
='shared_modules', default
=None)
36 opt
.add_option('--enable-selftest',
37 help=("enable options necessary for selftest"),
38 action
="store_true", dest
='enable_selftest', default
=False)
40 opt
.SAMBA3_ADD_OPTION('winbind')
41 opt
.SAMBA3_ADD_OPTION('swat')
42 opt
.SAMBA3_ADD_OPTION('ads')
43 opt
.SAMBA3_ADD_OPTION('krb5')
44 opt
.SAMBA3_ADD_OPTION('ldap')
45 opt
.SAMBA3_ADD_OPTION('cups', with_name
="enable", without_name
="disable")
46 opt
.SAMBA3_ADD_OPTION('iprint', with_name
="enable", without_name
="disable")
47 opt
.SAMBA3_ADD_OPTION('merged-build', with_name
="enable", without_name
="disable")
48 opt
.SAMBA3_ADD_OPTION('pam')
49 opt
.SAMBA3_ADD_OPTION('pam_smbpass')
50 opt
.SAMBA3_ADD_OPTION('quotas')
51 opt
.SAMBA3_ADD_OPTION('sys-quotas')
52 opt
.SAMBA3_ADD_OPTION('sendfile-support')
53 opt
.SAMBA3_ADD_OPTION('utmp')
54 opt
.SAMBA3_ADD_OPTION('pthreadpool', with_name
="enable", without_name
="disable")
55 opt
.SAMBA3_ADD_OPTION('avahi', with_name
="enable", without_name
="disable")
56 opt
.SAMBA3_ADD_OPTION('iconv')
57 opt
.SAMBA3_ADD_OPTION('acl-support')
58 opt
.SAMBA3_ADD_OPTION('dnsupdate')
59 opt
.SAMBA3_ADD_OPTION('syslog')
60 opt
.SAMBA3_ADD_OPTION('automount')
61 opt
.SAMBA3_ADD_OPTION('aio-support')
62 opt
.SAMBA3_ADD_OPTION('profiling-data', default
=False)
64 opt
.SAMBA3_ADD_OPTION('cluster-support')
66 opt
.add_option('--with-ctdb-dir',
67 help=("Directory under which ctdb is installed"),
68 action
="store", dest
='ctdb_dir', default
=None)
69 opt
.add_option('--enable-old-ctdb',
70 help=("enable building against (too) old version of ctdb (default=false)"),
71 action
="store_true", dest
='enable_old_ctdb', default
=False)
76 from samba_utils
import TO_LIST
78 if not conf
.env
.toplevel_build
:
79 version
= samba_version
.load_version(env
=conf
.env
)
80 conf
.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
81 conf
.DEFINE('_SAMBA_WAF_BUILD_', version
.MAJOR
)
82 conf
.DEFINE('_SAMBA_BUILD_', version
.MAJOR
, add_to_cflags
=True)
83 conf
.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags
=True)
85 if Options
.options
.developer
:
86 conf
.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
87 conf
.env
.developer
= True
89 if Options
.options
.with_swat
:
90 conf
.env
['build_swat'] = True
92 if not conf
.env
.toplevel_build
:
93 conf
.RECURSE('../lib/replace')
95 conf
.RECURSE('../lib/ccan')
96 conf
.RECURSE('../lib/tdb_compat')
97 conf
.RECURSE('../lib/talloc')
98 conf
.RECURSE('../lib/tevent')
99 conf
.RECURSE('../lib/popt')
100 conf
.RECURSE('../lib/nss_wrapper')
101 conf
.RECURSE('../lib/socket_wrapper')
102 conf
.RECURSE('../lib/zlib')
103 conf
.RECURSE('../libcli/smbreadline')
104 conf
.RECURSE('../lib/util')
106 conf
.ADD_EXTRA_INCLUDES('''#source3 #source3/include #lib/replace #lib''')
107 if not conf
.env
.USING_SYSTEM_TDB
:
108 conf
.ADD_EXTRA_INCLUDES('#lib/tdb_compat')
109 if not conf
.env
.USING_SYSTEM_TEVENT
:
110 conf
.ADD_EXTRA_INCLUDES('#lib/tevent')
111 if not conf
.env
.USING_SYSTEM_TALLOC
:
112 conf
.ADD_EXTRA_INCLUDES('#lib/talloc')
113 if not conf
.env
.USING_SYSTEM_POPT
:
114 conf
.ADD_EXTRA_INCLUDES('#lib/popt')
116 conf
.ADD_LDFLAGS("-Wl,--export-dynamic", testflags
=True)
118 conf
.CHECK_HEADERS('execinfo.h libexc.h libunwind.h netdb.h')
119 conf
.CHECK_HEADERS('linux/falloc.h')
121 conf
.CHECK_FUNCS('getcwd fchown chmod fchmod mknod mknod64')
122 conf
.CHECK_FUNCS('strtol strchr strupr chflags')
123 conf
.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
124 conf
.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
125 conf
.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr')
126 conf
.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
127 conf
.CHECK_FUNCS('setpriv setgidx setuidx setgroups sysconf stat64 fstat64')
128 conf
.CHECK_FUNCS('lstat64 fopen64 atexit grantpt lseek64 ftruncate64 fallocate fallocate64 posix_fallocate posix_fallocate64')
129 conf
.CHECK_FUNCS('fseek64 fseeko64 ftell64 ftello64 setluid')
130 conf
.CHECK_FUNCS('getpwnam', headers
='sys/types.h pwd.h')
131 conf
.CHECK_FUNCS('opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64')
132 conf
.CHECK_FUNCS('fdopendir fdopendir64')
133 conf
.CHECK_FUNCS('getpwent_r getdents64 setenv strcasecmp fcvt fcvtl')
134 conf
.CHECK_FUNCS('syslog vsyslog timegm setlocale nl_langinfo')
135 conf
.CHECK_FUNCS_IN('nanosleep', 'rt')
136 conf
.CHECK_FUNCS('lutimes futimes utimensat futimens')
137 conf
.CHECK_FUNCS('mlock munlock mlockall munlockall')
138 conf
.CHECK_FUNCS('memalign posix_memalign hstrerror')
139 conf
.CHECK_FUNCS('shmget')
140 conf
.CHECK_FUNCS_IN('shm_open', 'rt', checklibc
=True)
141 conf
.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain')
142 #FIXME: for some reason this one still fails
143 conf
.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
144 conf
.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
145 conf
.CHECK_DECLS('fdatasync', reverse
=True)
146 conf
.CHECK_DECLS('readahead', reverse
=True, headers
='fcntl.h')
148 if conf
.CONFIG_SET('HAVE_LONG_LONG'):
149 conf
.DEFINE('HAVE_LONGLONG', 1)
151 if conf
.CHECK_CODE('''
152 #if defined(HAVE_UNISTD_H)
155 long ret = splice(0,0,1,0,400,0);
159 conf
.CHECK_DECLS('splice', reverse
=True, headers
='fcntl.h')
161 # Check for inotify support
162 conf
.CHECK_HEADERS('linux/inotify.h asm/unistd.h sys/inotify.h')
163 conf
.CHECK_FUNCS('inotify_init')
164 if "HAVE_LINUX_INOTIFY_H" in conf
.env
and "HAVE_INOTIFY_INIT" in conf
.env
:
165 conf
.DEFINE('HAVE_INOTIFY', 1)
167 # Check for kernel change notify support
170 #define F_NOTIFY 1026
173 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
174 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain
=False, execute
=True,
175 headers
='fcntl.h signal.h',
176 msg
="Checking for kernel change notify support")
178 # Check for Linux kernel oplocks
180 #include <sys/types.h>
184 #define F_NOTIFY 1026
187 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
188 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain
=False, execute
=True,
189 msg
="Checking for Linux kernel oplocks")
191 # Check for IRIX kernel oplock types
192 conf
.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
193 'HAVE_KERNEL_OPLOCKS_IRIX', headers
='fcntl.h',
194 msg
="Checking for IRIX kernel oplock types")
196 # Check for kernel share modes
198 #include <sys/types.h>
201 #include <sys/file.h>
207 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
208 }''', 'HAVE_KERNEL_SHARE_MODES', addmain
=False, execute
=True,
209 msg
="Checking for krenel share modes")
211 # Check for various members of the stat structure
212 conf
.CHECK_TYPES('blksize_t blkcnt_t')
213 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define
='HAVE_STAT_ST_BLOCKS',
214 headers
='sys/stat.h')
215 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define
='HAVE_STAT_ST_BLKSIZE',
216 headers
='sys/stat.h')
217 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_flags', define
='HAVE_STAT_ST_FLAGS',
218 headers
='sys/types.h sys/stat.h unistd.h')
220 # Check for POSIX capability support
221 conf
.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers
='sys/capability.h')
223 if "HAVE_SYS_CAPABILITY_H" in conf
.env
:
227 if (!(cap = cap_get_proc())) exit(1);
229 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
230 cap_set_proc(cap);''',
231 'HAVE_POSIX_CAPABILITIES', execute
=True, lib
="cap",
232 headers
='sys/capability.h',
233 msg
="Checking whether POSIX capabilities are available")
235 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
236 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
238 if conf
.CONFIG_SET("HAVE_RPC_RPC_H"):
239 conf
.CHECK_TYPE('int16', headers
='rpc/rpc.h',
240 define
='HAVE_INT16_FROM_RPC_RPC_H',
241 msg
="Checking for int16 typedef included by rpc/rpc.h")
242 conf
.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
243 headers
='sys/types.h rpc/rpc.h',
244 msg
="Checking for uint16 typedef included by rpc/rpc.h")
245 conf
.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
246 headers
='sys/types.h rpc/rpc.h',
247 msg
="Checking for int32 typedef included by rpc/rpc.h")
248 conf
.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
249 headers
='sys/types.h rpc/rpc.h',
250 msg
="Checking for uint32 typedef included by rpc/rpc.h")
251 conf
.CHECK_CODE('int i;', 'BROKEN_NISPLUS_INCLUDE_FILES',
252 headers
='sys/types.h sys/acl.h rpcsvc/nis.h',
253 msg
="Checking for broken nisplus include files")
255 # Check if the compiler will optimize out functions
258 this_function_does_not_exist();
261 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
262 msg
="Checking if the compiler will optimize out functions")
264 # Check if the compiler supports the LL suffix on long long integers
266 conf
.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL',
268 msg
="Checking for LL suffix on long long integers")
271 _acl __acl add_proplist_entry atexit attr_getf attr_list attr_listf
272 attropen attr_remove attr_removef attr_set attr_setf backtrace_symbols
273 bindtextdomain _chdir __chdir chflags chmod _close __close _closedir
274 __closedir closedir64 creat64 crypt16 delproplist devnm dgettext dirfd
275 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
276 extattr_delete_fd extattr_delete_link extattr_get_fd extattr_get_file
277 extattr_get_link extattr_list_fd extattr_list_file extattr_list_link
278 extattr_set_fd extattr_set_file extattr_set_link _facl __facl _fchdir
279 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
280 fdelproplist fgetea fgetproplist fgetxattr flistea flistxattr fopen64
281 _fork __fork fremoveea fremovexattr fseek64 fseeko64 fsetea
282 fsetproplist fsetxattr _fstat __fstat fstat64 _fstat64 __fstat64 fsync
283 ftell64 ftello64 ftruncate64 futimens futimes __fxstat getauthuid
284 getcwd _getcwd __getcwd getdents __getdents getdents64 getdirentries
285 getgrent getgrnam getgrouplist getgrset getmntent getpagesize
286 getproplist get_proplist_entry getpwanam getpwent_r getrlimit gettext
287 glob grantpt hstrerror initgroups innetgr
288 inotify_init lgetea lgetxattr listea listxattr llistea llistxattr
289 llseek _llseek __llseek lremoveea lremovexattr _lseek __lseek lseek64
290 lsetea lsetxattr _lstat __lstat lstat64 _lstat64 __lstat64 lutimes
291 __lxstat memalign mknod mknod64 mlock mlockall munlock munlockall
292 nl_langinfo _open __open open64 _open64 __open64 _opendir __opendir
293 opendir64 pathconf poll posix_fallocate posix_fallocate64
294 posix_memalign prctl pread _pread __pread pread64 _pread64 __pread64
295 pwrite _pwrite __pwrite pwrite64 _pwrite64
296 __pwrite64 rdchk _read __read _readdir __readdir readdir64 _readdir64
297 __readdir64 removeea removexattr rewinddir64 _seekdir __seekdir
298 seekdir64 select setea setenv setgidx setgroups setlocale setluid
299 setmntent setpgid setpriv setproplist setsid setuidx
300 setxattr shmget shm_open sigaction sigblock sigprocmask sigset
301 sizeof_proplist_entry _stat __stat stat64 _stat64 __stat64 statvfs
302 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctlbyname
303 __sys_llseek syslog _telldir __telldir telldir64 textdomain timegm
304 utimensat vsyslog _write __write __xstat
307 conf
.CHECK_SAMBA3_CHARSET() # see build/charset.py
309 # FIXME: these should be tests for features, but the old build system just
312 host_os
= sys
.platform
313 Logs
.info("building on %s" % host_os
)
315 # Python doesn't have case switches... :/
316 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
317 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
319 conf
.SET_TARGET_TYPE('sunacl', 'EMPTY')
320 if (host_os
.rfind('linux') > -1) or (host_os
.rfind('gnu') > -1) or (host_os
.rfind('qnx') > -1):
321 if host_os
.rfind('linux') > -1:
322 conf
.DEFINE('LINUX', '1')
323 elif host_os
.rfind('qnx') > -1:
324 conf
.DEFINE('QNX', '1')
325 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
326 elif (host_os
.rfind('darwin') > -1):
327 conf
.DEFINE('DARWINOS', 1)
328 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
329 conf
.ADD_CFLAGS('-fno-common')
330 elif (host_os
.rfind('freebsd') > -1):
331 if conf
.CHECK_HEADERS('sunacl.h'):
332 conf
.define('HAVE_FREEBSD_SUNACL_H', '1')
333 conf
.CHECK_FUNCS_IN('acl', 'sunacl')
334 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
335 elif (host_os
.rfind('netbsd') > -1):
336 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
337 elif (host_os
.rfind('openbsd') > -1):
338 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
339 elif (host_os
.rfind('sunos') > -1):
340 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
341 # FIXME: Add more checks here.
343 Logs
.warn("Unknown host_os '%s', please report this to samba-technical@samba.org" % host_os
)
345 #FIXME: add more checks
346 if Options
.options
.with_acl_support
:
347 if host_os
.rfind('linux') > -1:
348 conf
.CHECK_FUNCS_IN('acl_get_file', 'acl')
349 conf
.CHECK_FUNCS_IN('getxattr', 'attr')
350 if conf
.CHECK_CODE('''
353 acl_entry_t *entry_p;
354 return acl_get_entry(acl, entry_id, entry_p);
357 headers
='sys/types.h sys/acl.h', link
=False,
358 msg
="Checking for POSIX ACL support") :
360 acl_permset_t permset_d;
362 return acl_get_perm_np(permset_d, perm);
364 'HAVE_ACL_GET_PERM_NP',
365 headers
='sys/types.h sys/acl.h', link
=True,
366 msg
="Checking whether acl_get_perm_np() is available")
368 conf
.DEFINE('HAVE_NO_ACLS', 1)
369 conf
.SET_TARGET_TYPE('acl', 'EMPTY')
371 conf
.DEFINE('HAVE_NO_ACLS', 1)
372 conf
.SET_TARGET_TYPE('acl', 'EMPTY')
374 if conf
.CHECK_FUNCS('dirfd'):
375 conf
.DEFINE('HAVE_DIRFD_DECL', 1)
377 conf
.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
378 'HAVE_STATFS_F_FSID',
379 msg
="vfs_fileid: checking for statfs() and struct statfs.f_fsid",
380 headers
='sys/types.h sys/statfs.h',
383 if conf
.CONFIG_SET('HAVE_FALLOCATE'):
385 #if defined(HAVE_UNISTD_H)
388 #include <sys/types.h>
391 #if defined(HAVE_LINUX_FALLOC_H)
392 #include <linux/falloc.h>
394 int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
395 'HAVE_LINUX_FALLOCATE',
396 msg
="Checking whether the Linux 'fallocate' function is available")
397 if conf
.CONFIG_SET('HAVE_FALLOCATE64'):
399 #if defined(HAVE_UNISTD_H)
402 #include <sys/types.h>
405 #if defined(HAVE_LINUX_FALLOC_H)
406 #include <linux/falloc.h>
408 int ret = fallocate64(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
409 'HAVE_LINUX_FALLOCATE64',
410 msg
="Checking whether the Linux 'fallocate64' function is available")
412 #if defined(HAVE_UNISTD_H)
416 ssize_t err = readahead(0,0,0x80000);''',
417 'HAVE_LINUX_READAHEAD',
418 msg
="Checking whether Linux readahead is available")
419 conf
.CHECK_DECLS('readahead', headers
='fcntl.h', always
=True)
422 #include <sys/types.h>
423 #include <sys/socket.h>],
426 int ret = getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len);''',
428 msg
="Checking whether we can use SO_PEERCRED to get socket credentials")
431 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
432 #include <sys/types.h>
437 'HAVE_EXPLICIT_LARGEFILE_SUPPORT',
438 msg
="Checking whether large file support can be enabled")
440 if Options
.options
.with_aio_support
:
441 conf
.CHECK_FUNCS_IN('aio_read', 'aio')
442 conf
.CHECK_FUNCS_IN('aio_read', 'rt')
443 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);',
445 msg
='Checking for asynchronous io support',
446 headers
='sys/types.h aio.h',
448 conf
.CHECK_CODE('struct aiocb64 a; return aio_read64(&a);',
450 msg
='Checking for 64-bit asynchronous io support',
451 headers
='sys/types.h aio.h',
453 if conf
.CONFIG_SET('HAVE_AIO64'):
454 conf
.DEFINE('HAVE_AIOCB64', '1')
455 conf
.DEFINE('WITH_AIO', '1')
456 elif conf
.CONFIG_SET('HAVE_AIO'):
457 conf
.DEFINE('WITH_AIO', '1')
458 if conf
.CONFIG_SET('HAVE_AIO'):
459 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg
='Checking for aio_read', headers
='aio.h', lib
='aio rt')
460 conf
.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg
='Checking for aio_write', headers
='aio.h', lib
='aio rt')
461 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')
462 conf
.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg
='Checking for aio_return', headers
='aio.h', lib
='aio rt')
463 conf
.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg
='Checking for aio_error', headers
='aio.h', lib
='aio rt')
464 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')
465 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')
466 if conf
.CONFIG_SET('HAVE_AIO64'):
467 conf
.CHECK_CODE('struct aiocb a; return aio_read64(&a);', 'HAVE_AIO_READ64', msg
='Checking for aio_read64', headers
='aio.h', lib
='aio rt')
468 conf
.CHECK_CODE('struct aiocb a; return aio_write64(&a);', 'HAVE_AIO_WRITE64', msg
='Checking for aio_write64', headers
='aio.h', lib
='aio rt')
469 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')
470 conf
.CHECK_CODE('struct aiocb a; return aio_return64(&a);', 'HAVE_AIO_RETURN64', msg
='Checking for aio_return64', headers
='aio.h', lib
='aio rt')
471 conf
.CHECK_CODE('struct aiocb a; return aio_error64(&a);', 'HAVE_AIO_ERROR64', msg
='Checking for aio_error64', headers
='aio.h', lib
='aio rt')
472 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')
473 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')
474 if not conf
.CONFIG_SET('HAVE_AIO'):
475 conf
.DEFINE('HAVE_NO_AIO', '1')
477 conf
.DEFINE('HAVE_NO_AIO', '1')
483 char control[CMSG_SPACE(sizeof(int))];
485 msg.msg_control = control_un.control;
486 msg.msg_controllen = sizeof(control_un.control);
488 'HAVE_MSGHDR_MSG_CONTROL',
489 msg
='Checking if we can use msg_control for passing file descriptors',
490 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
494 msg.msg_acctrights = (caddr_t) &fd;
495 msg.msg_acctrightslen = sizeof(fd);
497 'HAVE_MSGHDR_MSG_ACCTRIGHTS',
498 msg
='Checking if we can use msg_acctrights for passing file descriptors',
499 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
501 if Options
.options
.with_winbind
:
502 conf
.env
.build_winbind
= True
503 conf
.DEFINE('WITH_WINBIND', '1')
505 conf
.find_program('awk', var
='AWK')
506 conf
.find_program('perl', var
='PERL')
508 # Darwin has extra options to xattr-family functions
509 conf
.CHECK_CODE('getxattr(0, 0, 0, 0, 0, 0);',
511 msg
="Checking whether xattr interface takes additional options",
512 headers
='sys/types.h attr/xattr.h sys/xattr.h')
514 conf
.CHECK_HEADERS('asm/types.h')
516 conf
.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
517 headers
='unistd.h sys/types.h',
518 msg
="Checking for major macro")
520 conf
.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
521 headers
='unistd.h sys/types.h',
522 msg
="Checking for minor macro")
524 conf
.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
525 headers
='unistd.h sys/types.h dirent.h',
526 define
='HAVE_DIRENT_D_OFF')
528 conf
.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent')
529 if conf
.CHECK_CFLAGS('-Werror-implicit-function-declaration'):
530 netgrent_cflags
= '-Werror-implicit-function-declaration'
533 conf
.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE',
534 msg
="Checking for setnetgrent prototype",
535 headers
='netdb.h netgroup.h',
536 cflags
=netgrent_cflags
)
537 conf
.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE',
538 msg
="Checking for getnetgrent prototype",
539 headers
='netdb.h netgroup.h',
540 cflags
=netgrent_cflags
)
541 conf
.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE',
542 msg
="Checking for endnetgrent prototype",
543 headers
='netdb.h netgroup.h',
544 cflags
=netgrent_cflags
)
548 if Options
.options
.with_cups
:
549 conf
.find_program('cups-config', var
='CUPS_CONFIG')
550 if conf
.env
.CUPS_CONFIG
:
551 # we would normally use --libs here, but cups-config incorrectly adds
552 # gssapi_krb5 and other libraries to its --libs output. That breaks the use
553 # of an in-tree heimdal kerberos
554 conf
.check_cfg(path
=conf
.env
.CUPS_CONFIG
, args
="--cflags --ldflags",
555 package
="", uselib_store
="cups")
556 conf
.CHECK_HEADERS('cups/cups.h cups/language.h', lib
='cups')
557 conf
.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups')
558 if conf
.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf
.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
559 conf
.DEFINE('HAVE_CUPS', '1')
561 conf
.undefine('HAVE_CUPS')
562 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
564 # define an empty subsystem for cups, to allow it to be used as an empty dependency
565 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
567 if Options
.options
.with_iprint
:
568 if conf
.CONFIG_SET('HAVE_CUPS'):
569 conf
.DEFINE('HAVE_IPRINT', '1')
571 Logs
.warn("--enable-iprint=yes but cups support not sufficient")
572 if Options
.options
.with_syslog
:
573 conf
.DEFINE('WITH_SYSLOG', '1')
574 if Options
.options
.with_automount
:
575 conf
.DEFINE('WITH_AUTOMOUNT', '1')
578 if Options
.options
.with_ldap
:
579 conf
.CHECK_HEADERS('ldap.h lber.h ldap_pvt.h')
580 conf
.CHECK_TYPE('ber_tag_t', 'unsigned int', headers
='ldap.h lber.h')
581 conf
.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
582 conf
.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers
='ldap.h')
584 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
586 conf
.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
587 define
='HAVE_LBER_LOG_PRINT_FN', headers
='lber.h')
589 conf
.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', 'ldap')
590 conf
.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
592 # Check if ldap_set_rebind_proc() takes three arguments
593 if conf
.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
594 'LDAP_SET_REBIND_PROC_ARGS',
595 msg
="Checking whether ldap_set_rebind_proc takes 3 arguments",
596 headers
='ldap.h lber.h', link
=False):
597 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
599 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
601 # last but not least, if ldap_init() exists, we want to use ldap
602 if conf
.CONFIG_SET('HAVE_LDAP_INIT'):
603 conf
.DEFINE('HAVE_LDAP', '1')
604 conf
.DEFINE('LDAP_DEPRECATED', '1')
605 conf
.env
['HAVE_LDAP'] = '1'
606 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
607 # SASL wrapping hooks
608 if conf
.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
609 conf
.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
610 conf
.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
612 conf
.SET_TARGET_TYPE('ldap', 'EMPTY')
613 conf
.SET_TARGET_TYPE('lber', 'EMPTY')
617 if Options
.options
.with_krb5
and not conf
.env
.toplevel_build
:
618 Logs
.info("Looking for kerberos features")
619 conf
.find_program('krb5-config', var
='KRB5_CONFIG')
620 if conf
.env
.KRB5_CONFIG
:
621 conf
.check_cfg(path
="krb5-config", args
="--cflags --libs",
622 package
="gssapi", uselib_store
="krb5")
623 conf
.CHECK_HEADERS('krb5.h krb5/locate_plugin.h', lib
='krb5')
624 conf
.CHECK_HEADERS('gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h gssapi/gssapi_ext.h gssapi/gssapi_krb5.h com_err.h', lib
='krb5')
626 if conf
.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'):
627 conf
.env
['WINBIND_KRB5_LOCATOR'] = 'bin/winbind_krb5_locator.so'
629 conf
.CHECK_FUNCS_IN('_et_list', 'com_err')
630 conf
.CHECK_FUNCS_IN('krb5_encrypt_data', 'k5crypto')
631 conf
.CHECK_FUNCS_IN('crypto', 'des_set_key')
632 conf
.CHECK_FUNCS_IN('copy_Authenticator', 'asn1')
633 conf
.CHECK_FUNCS_IN('roken_getaddrinfo_hostspec', 'roken')
634 if conf
.CHECK_FUNCS_IN('gss_display_status', 'gssapi') or \
635 conf
.CHECK_FUNCS_IN('gss_display_status', 'gssapi_krb5'):
637 conf
.CHECK_FUNCS_IN('gss_wrap_iov gss_krb5_import_cred gss_get_name_attribute gss_mech_krb5 gss_oid_equal gss_inquire_sec_context_by_oid', 'gssapi gssapi_krb5 krb5')
638 conf
.CHECK_FUNCS_IN('krb5_mk_req_extended krb5_kt_compare', 'krb5')
640 krb5_set_real_time krb5_set_default_in_tkt_etypes krb5_set_default_tgs_enctypes
641 krb5_set_default_tgs_ktypes krb5_principal2salt krb5_use_enctype
642 krb5_string_to_key krb5_get_pw_salt krb5_string_to_key_salt krb5_auth_con_setkey
643 krb5_auth_con_setuseruserkey krb5_locate_kdc krb5_get_permitted_enctypes
644 krb5_get_default_in_tkt_etypes krb5_free_data_contents
645 krb5_principal_get_comp_string krb5_free_unparsed_name
646 krb5_free_keytab_entry_contents krb5_kt_free_entry krb5_krbhst_init
647 krb5_krbhst_get_addrinfo krb5_c_enctype_compare krb5_enctypes_compatible_keys
648 krb5_crypto_init krb5_crypto_destroy krb5_decode_ap_req free_AP_REQ
649 krb5_verify_checksum krb5_c_verify_checksum krb5_principal_compare_any_realm
650 krb5_parse_name_norealm krb5_princ_size krb5_get_init_creds_opt_set_pac_request
651 krb5_get_renewed_creds krb5_get_kdc_cred krb5_free_error_contents
652 initialize_krb5_error_table krb5_get_init_creds_opt_alloc
653 krb5_get_init_creds_opt_free krb5_get_init_creds_opt_get_error
654 krb5_enctype_to_string krb5_fwd_tgt_creds krb5_auth_con_set_req_cksumtype
655 krb5_get_creds_opt_alloc krb5_get_creds_opt_set_impersonate krb5_get_creds
656 krb5_get_credentials_for_user krb5_get_host_realm krb5_free_host_realm''',
658 conf
.CHECK_DECLS('''krb5_get_credentials_for_user
659 krb5_auth_con_set_req_cksumtype''',
660 headers
='krb5.h', always
=True)
661 conf
.CHECK_VARIABLE('AP_OPTS_USE_SUBKEY', headers
='krb5.h')
662 conf
.CHECK_VARIABLE('KV5M_KEYTAB', headers
='krb5.h')
663 conf
.CHECK_VARIABLE('KRB5_KU_OTHER_CKSUM', headers
='krb5.h')
664 conf
.CHECK_VARIABLE('KRB5_KEYUSAGE_APP_DATA_CKSUM', headers
='krb5.h')
665 conf
.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'key', headers
='krb5.h',
666 define
='HAVE_KRB5_KEYTAB_ENTRY_KEY')
667 conf
.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'keyblock', headers
='krb5.h',
668 define
='HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK')
669 conf
.CHECK_STRUCTURE_MEMBER('krb5_address', 'magic', headers
='krb5.h',
670 define
='HAVE_MAGIC_IN_KRB5_ADDRESS')
671 conf
.CHECK_STRUCTURE_MEMBER('krb5_address', 'addrtype', headers
='krb5.h',
672 define
='HAVE_ADDRTYPE_IN_KRB5_ADDRESS')
673 conf
.CHECK_STRUCTURE_MEMBER('krb5_ticket', 'enc_part2', headers
='krb5.h',
674 define
='HAVE_KRB5_TKT_ENC_PART2')
675 conf
.CHECK_STRUCTURE_MEMBER('krb5_creds', 'keyblock', headers
='krb5.h',
676 define
='HAVE_KRB5_KEYBLOCK_IN_CREDS')
677 conf
.CHECK_STRUCTURE_MEMBER('krb5_creds', 'session', headers
='krb5.h',
678 define
='HAVE_KRB5_SESSION_IN_CREDS')
679 conf
.CHECK_STRUCTURE_MEMBER('krb5_ap_req', 'ticket', headers
='krb5.h',
680 define
='HAVE_TICKET_POINTER_IN_KRB5_AP_REQ')
682 conf
.CHECK_TYPE('krb5_encrypt_block', headers
='krb5.h')
687 krb5_enctype enctype;
688 enctype = ticket.enc_part.enctype;
689 kvno = ticket.enc_part.kvno;
691 'KRB5_TICKET_HAS_KEYINFO',
692 headers
='krb5.h', link
=False,
693 msg
="Checking whether the krb5_ticket structure contains the kvno and enctype")
696 krb5_get_init_creds_opt *opt = NULL;
697 krb5_get_init_creds_opt_free(ctx, opt);
699 'KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT',
700 headers
='krb5.h', link
=False,
701 msg
="Checking whether krb5_get_init_creds_opt_free takes a context argument")
702 conf
.CHECK_CODE('krb5_mk_error(0,0,0)',
703 'HAVE_SHORT_KRB5_MK_ERROR_INTERFACE',
704 headers
='krb5.h', link
=False,
705 msg
="Checking whether krb5_mk_error takes 3 arguments MIT or 9 Heimdal")
707 const krb5_data *pkdata;
708 krb5_context context;
709 krb5_principal principal;
710 pkdata = krb5_princ_component(context, principal, 0);
712 'HAVE_KRB5_PRINC_COMPONENT',
713 headers
='krb5.h', lib
='krb5',
714 msg
="Checking whether krb5_princ_component is available")
719 krb5_enctype_to_string(1, buf, 256);
722 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_SIZE_T_ARG',
723 headers
='krb5.h', lib
='krb5 k5crypto',
724 addmain
=False, cflags
='-Werror',
725 msg
="Checking whether krb5_enctype_to_string takes size_t argument")
729 krb5_context context = NULL;
731 krb5_enctype_to_string(context, 1, &str);
735 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_KRB5_CONTEXT_ARG',
736 headers
='krb5.h stdlib.h', lib
='krb5',
737 addmain
=False, cflags
='-Werror',
738 msg
="Checking whether krb5_enctype_to_string takes krb5_context argument")
741 krb5_context ctx = NULL;
742 krb5_principal princ = NULL;
743 const char *str = krb5_princ_realm(ctx, princ)->data;
746 'HAVE_KRB5_PRINC_REALM',
747 headers
='krb5.h', lib
='krb5',
749 msg
="Checking whether the macro krb5_princ_realm is defined")
752 krb5_context context;
753 krb5_principal principal;
754 const char *realm; realm = krb5_principal_get_realm(context, principal);
757 'HAVE_KRB5_PRINCIPAL_GET_REALM',
758 headers
='krb5.h', lib
='krb5',
760 msg
="Checking whether krb5_principal_get_realm is defined")
761 if conf
.CHECK_CODE('''krb5_verify_checksum(0, 0, 0, 0, 0, 0, 0);''',
762 'KRB5_VERIFY_CHECKSUM_ARGS',
763 headers
='krb5.h', lib
='krb5',
764 msg
="Checking whether krb5_verify_checksum takes 7 arguments"):
765 conf
.DEFINE('KRB5_VERIFY_CHECKSUM_ARGS', '7')
767 conf
.DEFINE('KRB5_VERIFY_CHECKSUM_ARGS', '6')
770 krb5_enctype enctype;
771 enctype = ENCTYPE_ARCFOUR_HMAC_MD5;
773 '_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5',
774 headers
='krb5.h', lib
='krb5',
775 msg
="Checking whether the ENCTYPE_ARCFOUR_HMAC_MD5 key type definition is available");
777 krb5_keytype keytype;
778 keytype = KEYTYPE_ARCFOUR_56;
780 '_HAVE_KEYTYPE_ARCFOUR_56',
781 headers
='krb5.h', lib
='krb5',
782 msg
="Checking whether the HAVE_KEYTYPE_ARCFOUR_56 key type definition is available");
783 if conf
.CONFIG_SET('_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and conf
.CONFIG_SET('_HAVE_KEYTYPE_ARCFOUR_56'):
784 conf
.DEFINE('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5', '1')
787 krb5_enctype enctype;
788 enctype = ENCTYPE_ARCFOUR_HMAC;
790 'HAVE_ENCTYPE_ARCFOUR_HMAC',
791 headers
='krb5.h', lib
='krb5',
792 msg
="Checking whether the ENCTYPE_ARCFOUR_HMAC key type definition is available");
795 krb5_context context;
797 krb5_init_context(&context);
798 return krb5_kt_resolve(context, "WRFILE:api", &keytab);
800 'HAVE_WRFILE_KEYTAB',
801 headers
='krb5.h', lib
='krb5', execute
=True,
802 msg
="Checking whether the WRFILE:-keytab is supported");
804 # Check for KRB5_DEPRECATED handling
805 conf
.CHECK_CODE('''#define KRB5_DEPRECATED 1
806 #include <krb5.h>''',
807 'HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER', addmain
=False,
809 msg
="Checking for KRB5_DEPRECATED define taking an identifier")
810 elif not conf
.env
.toplevel_build
:
811 conf
.SET_TARGET_TYPE('krb5', 'EMPTY')
812 conf
.SET_TARGET_TYPE('gssapi', 'EMPTY')
813 conf
.SET_TARGET_TYPE('gssapi_krb5', 'EMPTY')
814 conf
.SET_TARGET_TYPE('com_err', 'EMPTY')
815 conf
.SET_TARGET_TYPE('k5crypto', 'EMPTY')
817 if Options
.options
.with_ads
:
819 if not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and \
820 not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC'):
821 Logs
.warn("arcfour-hmac-md5 encryption type not found in -lkrb5")
823 if not conf
.CONFIG_SET('HAVE_KRB5_MK_REQ_EXTENDED'):
824 Logs
.warn("krb5_mk_req_extended not found in -lkrb5")
826 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL2SALT') and \
827 not conf
.CONFIG_SET('HAVE_KRB5_GET_PW_SALT'):
828 Logs
.warn("no CREATE_KEY_FUNCTIONS detected")
830 if not conf
.CONFIG_SET('HAVE_KRB5_GET_PERMITTED_ENCTYPES') and \
831 not conf
.CONFIG_SET('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES'):
832 Logs
.warn("no GET_ENCTYPES_FUNCTIONS detected")
834 if not conf
.CONFIG_SET('HAVE_KRB5_KT_FREE_ENTRY') and \
835 not conf
.CONFIG_SET('HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS'):
836 Logs
.warn("no KT_FREE_FUNCTION detected")
838 if not conf
.CONFIG_SET('HAVE_KRB5_C_VERIFY_CHECKSUM') and \
839 not conf
.CONFIG_SET('HAVE_KRB5_VERIFY_CHECKSUM'):
840 Logs
.warn("no KRB5_VERIFY_CHECKSUM_FUNCTION detected")
842 if not conf
.CONFIG_SET('KRB5_TICKET_HAS_KEYINFO'):
843 # We only need the following functions if we can't get the enctype
844 # and kvno out of the ticket directly (ie. on Heimdal).
845 if not conf
.CONFIG_SET('HAVE_FREE_AP_REQ'):
846 Logs
.warn("no KRB5_AP_REQ_FREE_FUNCTION detected")
848 if not conf
.CONFIG_SET('HAVE_KRB5_DECODE_AP_REQ'):
849 Logs
.warn("no KRB5_AP_REQ_DECODING_FUNCTION detected")
852 conf
.DEFINE('WITH_ADS', '1')
853 conf
.DEFINE('HAVE_KRB5', '1')
855 conf
.DEFINE('HAVE_GSSAPI', '1')
856 if conf
.CONFIG_SET('HAVE_LDAP'):
857 conf
.env
['HAVE_ADS'] = '1'
859 Logs
.warn("krb5 libs don't have all features required for Active Directory support")
860 conf
.undefine('HAVE_KRB5_H')
861 conf
.undefine('HAVE_GSSAPI_H')
862 conf
.undefine('HAVE_GSSAPI_GSSAPI_GENERIC_H')
863 conf
.undefine('HAVE_GSSAPI_GSSAPI_H')
865 if Options
.options
.with_utmp
:
866 conf
.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
867 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers
='utmp.h',
868 define
='HAVE_UT_UT_NAME')
869 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers
='utmp.h',
870 define
='HAVE_UT_UT_USER')
871 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers
='utmp.h',
872 define
='HAVE_UT_UT_ID')
873 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers
='utmp.h',
874 define
='HAVE_UT_UT_HOST')
875 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers
='utmp.h',
876 define
='HAVE_UT_UT_TIME')
877 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers
='utmp.h',
878 define
='HAVE_UT_UT_TV')
879 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers
='utmp.h',
880 define
='HAVE_UT_UT_TYPE')
881 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers
='utmp.h',
882 define
='HAVE_UT_UT_PID')
883 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers
='utmp.h',
884 define
='HAVE_UT_UT_EXIT')
885 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr_v6', headers
='utmp.h',
886 define
='HAVE_UT_UT_ADDR_V6')
887 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr', headers
='utmp.h',
888 define
='HAVE_UT_UT_ADDR')
889 conf
.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers
='utmpx.h',
890 define
='HAVE_UX_UT_SYSLEN')
891 conf
.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
892 'PUTUTLINE_RETURNS_UTMP', headers
='utmp.h',
893 msg
="Checking whether pututline returns pointer")
894 conf
.DEFINE('WITH_UTMP', 1)
896 if Options
.options
.with_avahi
:
897 conf
.env
.with_avahi
= True
898 if not conf
.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf
.env
.with_avahi
= False
899 if not conf
.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf
.env
.with_avahi
= False
900 if not conf
.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf
.env
.with_avahi
= False
901 if conf
.env
.with_avahi
:
902 conf
.DEFINE('WITH_AVAHI_SUPPORT', 1)
904 conf
.SET_TARGET_TYPE('avahi-common', 'EMPTY')
905 conf
.SET_TARGET_TYPE('avahi-client', 'EMPTY')
907 if Options
.options
.with_iconv
:
908 conf
.env
.with_iconv
= True
909 if not conf
.CHECK_FUNCS_IN('iconv_open', 'iconv', headers
='iconv.h'):
910 conf
.env
.with_iconv
= False
911 if conf
.env
.with_iconv
:
912 conf
.DEFINE('HAVE_ICONV', 1)
914 if Options
.options
.with_pam
:
916 conf
.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
917 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
918 Logs
.warn("--with-pam=yes but pam_appl.h not found")
920 conf
.CHECK_FUNCS_IN('pam_get_data', 'pam')
921 conf
.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h')
922 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'):
923 Logs
.warn("--with-pam=yes but pam_modules.h not found")
925 conf
.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h')
926 conf
.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h')
927 conf
.CHECK_FUNCS_IN('pam_vsyslog', 'pam')
929 #if defined(HAVE_SECURITY_PAM_APPL_H)
930 #include <security/pam_appl.h>
931 #elif defined(HAVE_PAM_PAM_APPL_H)
932 #include <pam/pam_appl.h>
934 pam_set_item(0, PAM_RHOST, 0);
938 msg
="Checking whether PAM_RHOST is available");
940 #if defined(HAVE_SECURITY_PAM_APPL_H)
941 #include <security/pam_appl.h>
942 #elif defined(HAVE_PAM_PAM_APPL_H)
943 #include <pam/pam_appl.h>
945 pam_set_item(0, PAM_TTY, 0);
949 msg
="Checking whether PAM_TTY is available");
951 #if (!defined(LINUX))
953 #define PAM_EXTERN extern
954 #if defined(HAVE_SECURITY_PAM_APPL_H)
955 #include <security/pam_appl.h>
956 #elif defined(HAVE_PAM_PAM_APPL_H)
957 #include <pam/pam_appl.h>
962 #if defined(HAVE_SECURITY_PAM_MODULES_H)
963 #include <security/pam_modules.h>
964 #elif defined(HAVE_PAM_PAM_MODULES_H)
965 #include <pam/pam_modules.h>
968 #if defined(HAVE_SECURITY__PAM_MACROS_H)
969 #include <security/_pam_macros.h>
970 #elif defined(HAVE_PAM__PAM_MACROS_H)
971 #include <pam/_pam_macros.h>
974 #ifdef HAVE_SECURITY_PAM_EXT_H
975 #include <security/pam_ext.h>
978 int i; i = PAM_RADIO_TYPE;
980 'HAVE_PAM_RADIO_TYPE',
982 msg
="Checking whether PAM_RADIO_TYPE is available");
984 conf
.DEFINE('WITH_PAM', 1)
985 conf
.DEFINE('WITH_PAM_MODULES', 1)
989 seteuid
= conf
.CHECK_CODE('''
990 #define AUTOCONF_TEST 1
991 #define USE_SETREUID 1
992 #include "./lib/util_sec.c"
997 msg
="Checking whether setreuid is available")
999 seteuid
= conf
.CHECK_CODE('''
1000 #define AUTOCONF_TEST 1
1001 #define USE_SETRESUID 1
1002 #include "./lib/util_sec.c"
1007 msg
="Checking whether setresuid is available")
1009 seteuid
= conf
.CHECK_CODE('''
1010 #define AUTOCONF_TEST 1
1011 #define USE_SETEUID 1
1012 #include "./lib/util_sec.c"
1017 msg
="Checking whether seteuid is available")
1019 seteuid
= conf
.CHECK_CODE('''
1020 #define AUTOCONF_TEST 1
1021 #define USE_SETUIDX 1
1022 #include "./lib/util_sec.c"
1028 msg
="Checking whether setuidx is available")
1029 if Options
.options
.with_dnsupdate
:
1030 conf
.CHECK_HEADERS('uuid/uuid.h')
1031 conf
.CHECK_FUNCS_IN('uuid_generate', 'uuid')
1032 if not conf
.CONFIG_SET('HAVE_UUID_UUID_H') and not conf
.CONFIG_SET('HAVE_UUID_GENERATE'):
1033 Logs
.warn("--with-dnsupdate=yes but uuid support not sufficient")
1034 elif not conf
.CONFIG_SET('HAVE_GSSAPI'):
1035 Logs
.warn("--with-dnsupdate=yes but gssapi support not sufficient")
1037 conf
.DEFINE('WITH_DNS_UPDATES', 1)
1039 conf
.SET_TARGET_TYPE('uuid', 'EMPTY')
1040 conf
.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
1041 if Options
.options
.developer
:
1042 if conf
.CONFIG_SET('HAVE_VALGRIND_H') or conf
.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'):
1043 conf
.DEFINE('VALGRIND', '1')
1045 if conf
.CHECK_CODE('''
1046 #include <bits/sockaddr.h>
1047 #include <linux/netlink.h>
1049 'HAVE_LINUX_NETLINK_H',
1050 msg
="Checking whether Linux netlink is available"):
1052 #include <bits/sockaddr.h>
1053 #include <linux/netlink.h>
1054 #include <linux/rtnetlink.h>
1056 'HAVE_LINUX_RTNETLINK_H',
1057 msg
='Checking whether Linux rtnetlink is available')
1058 if conf
.CHECK_TYPE('struct dirent64', headers
='sys/types.h dirent.h') and conf
.CONFIG_SET('HAVE_READDIR64'):
1059 conf
.DEFINE('HAVE_STRUCT_DIRENT64', '1')
1061 conf
.undefine('HAVE_STRUCT_DIRENT64')
1064 #include "../tests/fcntl_lock.c"
1069 msg
='Checking whether fcntl locking is available')
1072 #include "../tests/fcntl_lock64.c"
1074 'HAVE_BROKEN_FCNTL64_LOCKS',
1077 msg
='Checking whether fcntl64 locks are broken')
1079 if not conf
.CONFIG_SET('HAVE_BROKEN_FCNTL64_LOCKS'):
1081 #if defined(HAVE_UNISTD_H)
1091 #ifdef HAVE_SYS_FCNTL_H
1092 #include <sys/fcntl.h>
1094 main() { struct flock64 fl64;
1095 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
1102 'HAVE_STRUCT_FLOCK64',
1105 msg
="Checking whether the flock64 struct is available")
1107 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec',
1108 define
='HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') # Linux, Solaris
1109 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimensec',
1110 define
='HAVE_STRUCT_STAT_ST_MTIMENSEC') # BSD, if defined _POSIX_SOURCE
1111 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimespec.tv_nsec',
1112 define
='HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') # BSD, if not defined _POSIX_SOURCE
1113 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtime_n',
1114 define
='HAVE_STRUCT_STAT_ST_MTIME_N') # AIX
1115 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_umtime',
1116 define
='HAVE_STRUCT_STAT_ST_UMTIME') # Tru64
1117 if conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') or \
1118 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMENSEC') or \
1119 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') or \
1120 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIME_N') or \
1121 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_UMTIME'):
1122 conf
.DEFINE('HAVE_STAT_HIRES_TIMESTAMPS', '1')
1124 # recent FreeBSD, NetBSD have creation timestamps called birthtime:
1125 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtime',
1126 define
='HAVE_STRUCT_STAT_ST_BIRTHTIME')
1127 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimespec.tv_nsec',
1128 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC')
1129 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimensec',
1130 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC')
1133 #if defined(HAVE_UNISTD_H)
1136 #include <fcntl.h>],
1137 ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
1139 'HAVE_POSIX_FADVISE',
1140 msg
='Checking whether posix_fadvise is available')
1142 for v
in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]:
1145 return sysconf(%s) == -1 ? 1 : 0;
1148 msg
='Checking whether sysconf(%s) is available' % v
)
1150 conf
.CHECK_DECLS('__NR_inotify_init', reverse
=True, headers
='asm/unistd.h')
1153 #include <sys/syscall.h>
1155 syscall(SYS_initgroups, 16, NULL, NULL, 0);
1157 'HAVE_DARWIN_INITGROUPS',
1158 msg
='Checking whether to use the Darwin-specific initgroups system call')
1160 conf
.CHECK_CODE('''struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''',
1162 headers
='sys/types.h utime.h',
1163 msg
='Checking whether struct utimbuf is available')
1165 if conf
.CHECK_CODE('''struct sigevent s;''',
1166 'HAVE_STRUCT_SIGEVENT',
1167 headers
='sys/types.h stdlib.h stddef.h signal.h',
1168 msg
='Checking whether we have the struct sigevent'):
1169 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sival_ptr',
1170 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR',
1171 headers
='signal.h');
1172 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sigval_ptr',
1173 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR',
1174 headers
='signal.h');
1176 if os
.path
.exists('/proc/sys/kernel/core_pattern'):
1177 conf
.DEFINE('HAVE_SYS_KERNEL_PROC_CORE_PATTERN', '1')
1179 if conf
.CHECK_CODE('''
1183 if (sizeof(time_t) == 8) {
1184 time_t max_time = 0x7fffffffffffffffll;
1185 tm = gmtime(&max_time);
1186 /* This should fail with 32-bit tm_year. */
1188 /* Max time_t that works with 32-bit int tm_year in struct tm. */
1189 max_time = 67768036191676799ll;
1190 tm = gmtime(&max_time);
1201 msg
="Checking for the maximum value of the 'time_t' type"):
1202 conf
.DEFINE('TIME_T_MAX', '67768036191676799ll')
1205 #if defined(HAVE_UNISTD_H)
1208 #include <sys/types.h>
1209 main() { dev_t dev = makedev(1,2); return 0; }
1213 msg
='Checking whether the macro for makedev is available')
1220 void exit_on_core(int ignored) {
1226 signal(SIGSEGV, exit_on_core);
1227 newpath = realpath("/tmp", NULL);
1228 exit((newpath != NULL) ? 0 : 1);
1231 'REALPATH_TAKES_NULL',
1234 msg
='Checking whether the realpath function allows a NULL argument')
1236 conf
.CHECK_CODE('''#include "../tests/ftruncate.c"''',
1237 'HAVE_FTRUNCATE_EXTEND',
1238 msg
='Checking for ftruncate extend',
1241 if os
.getenv('RUN_FROM_BUILD_FARM'):
1242 Logs
.info("enabling buildfarm hacks")
1243 conf
.DEFINE('ENABLE_BUILD_FARM_HACKS', '1')
1245 if Options
.options
.with_sendfile_support
:
1246 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):
1251 ssize_t nwritten = sendfile64(tofd, fromfd, &offset, total);
1254 headers
='sys/sendfile',
1255 msg
='Checking for linux sendfile64 support')
1260 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1263 headers
='sys/sendfile',
1264 msg
='Checking for linux sendfile support')
1266 # Try and cope with broken Linux sendfile....
1267 conf
.CHECK_CODE('''#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
1268 #undef _FILE_OFFSET_BITS
1270 #include <sys/sendfile.h>
1274 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1276 '_HAVE_BROKEN_LINUX_SENDFILE',
1277 msg
='Checking for broken linux sendfile support')
1278 if conf
.CONFIG_SET('_HAVE_SENDFILE64'):
1279 conf
.DEFINE('HAVE_SENDFILE64', '1')
1280 conf
.DEFINE('LINUX_SENDFILE_API', '1')
1281 conf
.DEFINE('WITH_SENDFILE', '1')
1282 elif conf
.CONFIG_SET('_HAVE_SENDFILE'):
1283 conf
.DEFINE('HAVE_SENDFILE', '1')
1284 conf
.DEFINE('LINUX_SENDFILE_API', '1')
1285 conf
.DEFINE('WITH_SENDFILE', '1')
1286 elif conf
.CONFIG_SET('_HAVE_BROKEN_LINUX_SENDFILE'):
1287 conf
.DEFINE('LINUX_BROKEN_SENDFILE_API', '1')
1288 conf
.DEFINE('WITH_SENDFILE', '1')
1289 elif (host_os
.rfind('freebsd') > -1) or (host_os
.rfind('dragonfly') > -1):
1291 #include <sys/types.h>
1293 #include <sys/socket.h>
1294 #include <sys/uio.h>
1295 int fromfd, tofd, ret, total=0;
1296 off_t offset, nwritten;
1299 hdr.headers = &hdtrl;
1301 hdr.trailers = NULL;
1303 hdtrl.iov_base = NULL;
1305 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0)
1308 msg
='Checking for freebsd sendfile support')
1309 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1310 conf
.DEFINE('HAVE_SENDFILE', '1')
1311 conf
.DEFINE('FREEBSD_SENDFILE_API', '1')
1312 conf
.DEFINE('WITH_SENDFILE', '1')
1313 elif (host_os
.rfind('hpux') > -1):
1315 #include <sys/socket.h>
1316 #include <sys/uio.h>
1319 struct iovec hdtrl[2];
1322 hdtrl[0].iov_base = 0;
1323 hdtrl[0].iov_len = 0;
1324 nwritten = sendfile64(tofd, fromfd, offset, total, &hdtrl[0], 0);
1327 msg
='Checking for hpux sendfile64 support')
1329 #include <sys/socket.h>
1330 #include <sys/uio.h>
1333 struct iovec hdtrl[2];
1336 hdtrl[0].iov_base = 0;
1337 hdtrl[0].iov_len = 0;
1338 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
1341 msg
='Checking for hpux sendfile support')
1342 if conf
.CONFIG_SET('_HAVE_SENDFILE64'):
1343 conf
.DEFINE('HAVE_SENDFILE64', '1')
1344 conf
.DEFINE('HPUX_SENDFILE_API', '1')
1345 conf
.DEFINE('WITH_SENDFILE', '1')
1346 elif conf
.CONFIG_SET('_HAVE_SENDFILE'):
1347 conf
.DEFINE('HAVE_SENDFILE', '1')
1348 conf
.DEFINE('HPUX_SENDFILE_API', '1')
1349 conf
.DEFINE('WITH_SENDFILE', '1')
1350 elif (host_os
.rfind('solaris') > -1):
1351 conf
.CHECK_FUNCS_IN('sendfile', 'sendfilev')
1353 #include <sys/sendfile.h>
1356 struct sendfilevec vec[2];
1360 vec[0].sfv_fd = SFV_FD_SELF;
1361 vec[0].sfv_flag = 0;
1365 vec[1].sfv_flag = 0;
1368 nwritten = sendfilev64(tofd, vec, sfvcnt, &xferred);
1370 '_HAVE_SENDFILEV64',
1371 msg
='Checking for solaris sendfilev64 support')
1373 #include <sys/sendfile.h>,
1376 struct sendfilevec vec[2];
1380 vec[0].sfv_fd = SFV_FD_SELF;
1381 vec[0].sfv_flag = 0;
1385 vec[1].sfv_flag = 0;
1388 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
1391 msg
='Checking for solaris sendfilev support')
1392 if conf
.CONFIG_SET('_HAVE_SENDFILEV64'):
1393 conf
.DEFINE('HAVE_SENDFILEV64', '1')
1394 conf
.DEFINE('SOLARIS_SENDFILE_API', '1')
1395 conf
.DEFINE('WITH_SENDFILE', '1')
1396 elif conf
.CONFIG_SET('_HAVE_SENDFILEV'):
1397 conf
.DEFINE('HAVE_SENDFILEV', '1')
1398 conf
.DEFINE('SOLARIS_SENDFILE_API', '1')
1399 conf
.DEFINE('WITH_SENDFILE', '1')
1400 elif (host_os
.rfind('aix') > -1):
1402 #include <sys/socket.h>
1405 struct sf_parms hdtrl;
1408 hdtrl.header_data = 0;
1409 hdtrl.header_length = 0;
1410 hdtrl.file_descriptor = fromfd;
1411 hdtrl.file_offset = 0;
1412 hdtrl.file_bytes = 0;
1413 hdtrl.trailer_data = 0;
1414 hdtrl.trailer_length = 0;
1415 nwritten = send_file(&tofd, &hdtrl, 0);
1418 msg
='Checking for AIX send_file support')
1419 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1420 conf
.DEFINE('HAVE_SENDFILE', '1')
1421 conf
.DEFINE('AIX_SENDFILE_API', '1')
1422 conf
.DEFINE('WITH_SENDFILE', '1')
1424 # Check for getcwd allowing a NULL arg.
1428 char *s = getcwd(NULL,0);
1429 exit(s != NULL ? 0 : 1);
1430 }''', 'GETCWD_TAKES_NULL', addmain
=False, execute
=True,
1431 msg
="getcwd takes a NULL argument")
1434 conf
.CHECK_CODE('''enum TDB_ERROR err = TDB_ERR_NESTING''',
1435 'HAVE_TDB_ERR_NESTING',
1437 msg
='Checking whether we have TDB_ERR_NESTING')
1439 # UnixWare 7.x has its getspnam in -lgen
1440 conf
.CHECK_FUNCS_IN('getspnam', 'gen')
1441 conf
.CHECK_FUNCS_IN('getspnam', 'security')
1442 conf
.CHECK_FUNCS_IN('getspnam', 'sec')
1444 if Options
.options
.with_quotas
:
1445 # For quotas on Veritas VxFS filesystems
1446 conf
.CHECK_HEADERS('sys/fs/vx_quota.h')
1447 # For quotas on Linux XFS filesystems
1448 conf
.CHECK_HEADERS('linux/dqblk_xfs.h')
1449 # For sys/quota.h and linux/quota.h
1450 conf
.CHECK_HEADERS('sys/quota.h')
1454 # checking for clustering extensions (CTDB)
1456 if not Options
.options
.with_cluster_support
:
1457 have_cluster_support
= False
1461 if Options
.options
.ctdb_dir
:
1462 conf
.ADD_EXTRA_INCLUDES(Options
.options
.ctdb_dir
+ '/include')
1464 srcdir
= os
.path
.realpath(conf
.srcdir
)
1465 if 'EXTRA_INCLUDES' in conf
.env
:
1466 includes
= ' '.join(conf
.env
['EXTRA_INCLUDES']).replace('#', srcdir
+ '/')
1470 have_cluster_support
= True
1475 #include "replace.h"
1476 #include "system/wait.h"
1477 #include "system/network.h"
1478 #define private #error __USED_RESERVED_WORD_private__
1491 msg
='Checking for header ctdb.h')
1493 if not conf
.CONFIG_SET('HAVE_CTDB_H'):
1494 have_cluster_support
= False
1495 ctdb_broken
= "ctdb.h is required for cluster support"
1497 if have_cluster_support
:
1500 #include "replace.h"
1501 #include "system/wait.h"
1502 #include "system/network.h"
1503 #define private #error __USED_RESERVED_WORD_private__
1507 #include <ctdb_private.h>
1514 'HAVE_CTDB_PRIVATE_H',
1517 msg
='Checking for header ctdb_private.h')
1519 if not conf
.CONFIG_SET('HAVE_CTDB_PRIVATE_H'):
1520 have_cluster_support
= False
1521 ctdb_broken
= "ctdb_private.h is required for cluster support"
1523 if have_cluster_support
:
1526 #include "replace.h"
1527 #include "system/wait.h"
1528 #include "system/network.h"
1532 #include <ctdb_private.h>
1536 int i = (int)CTDB_CONTROL_TRANS3_COMMIT;
1540 'HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL',
1543 msg
='Checking for transaction support (TRANS3_COMMIT control)')
1545 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL'):
1546 have_cluster_support
= False
1547 ctdb_broken
= "ctdb transaction support missing or too old"
1549 if have_cluster_support
:
1552 #include "replace.h"
1553 #include "system/wait.h"
1554 #include "system/network.h"
1558 #include <ctdb_private.h>
1562 int i = (int)CTDB_CONTROL_SCHEDULE_FOR_DELETION;
1566 'HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL',
1569 msg
='Checking for SCHEDULE_FOR_DELETION control')
1571 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL'):
1572 if not Options
.options
.enable_old_ctdb
:
1573 have_cluster_support
= False
1574 ctdb_broken
= "SCHEDULE_FOR_DELETION control missing"
1576 Logs
.warn("ignoring missing SCHEDULE_FOR_DELETION control (--enable-old-ctdb)")
1578 if have_cluster_support
:
1581 #include "replace.h"
1582 #include "system/wait.h"
1583 #include "system/network.h"
1587 #include <ctdb_private.h>
1591 struct ctdb_control_tcp _x;
1595 'HAVE_STRUCT_CTDB_CONTROL_TCP',
1598 msg
='Checking for ctdb ipv4 support')
1600 if not conf
.CONFIG_SET('HAVE_STRUCT_CTDB_CONTROL_TCP'):
1601 have_cluster_support
= False
1602 ctdb_broken
= "missing struct ctdb_control_tcp"
1604 if have_cluster_support
:
1607 #include "replace.h"
1608 #include "system/wait.h"
1609 #include "system/network.h"
1613 #include <ctdb_private.h>
1617 struct ctdb_control_tcp_addr _x;
1621 'HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR',
1624 msg
='Checking for ctdb ipv6 support')
1626 if have_cluster_support
:
1627 Logs
.info("building with cluster support")
1628 conf
.DEFINE('CLUSTER_SUPPORT', 1);
1630 if not Options
.options
.with_cluster_support
:
1631 Logs
.info("building without cluster support")
1633 Logs
.warn("building without cluster support: " + ctdb_broken
)
1634 conf
.undefine('CLUSTER_SUPPORT')
1638 conf
.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }',
1639 'HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR',
1642 msg
='Checking whether we can compile with __attribute__((destructor))')
1644 conf
.CHECK_CODE('void seekdir(DIR *d, long loc) { return; }',
1645 'SEEKDIR_RETURNS_VOID',
1646 headers
='sys/types.h dirent.h',
1647 msg
='Checking whether seekdir returns void')
1649 if Options
.options
.with_profiling_data
:
1650 conf
.DEFINE('WITH_PROFILE', 1);
1652 PTHREAD_CFLAGS
='error'
1653 PTHREAD_LDFLAGS
='error'
1655 if PTHREAD_LDFLAGS
== 'error':
1656 if conf
.CHECK_FUNCS_IN('pthread_attr_init', 'pthread'):
1657 PTHREAD_CFLAGS
='-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS'
1658 PTHREAD_LDFLAGS
='-lpthread'
1659 if PTHREAD_LDFLAGS
== 'error':
1660 if conf
.CHECK_FUNCS_IN('pthread_attr_init', 'pthreads'):
1661 PTHREAD_CFLAGS
='-D_THREAD_SAFE'
1662 PTHREAD_LDFLAGS
='-lpthreads'
1663 if PTHREAD_LDFLAGS
== 'error':
1664 if conf
.CHECK_FUNCS_IN('pthread_attr_init', 'c_r'):
1665 PTHREAD_CFLAGS
='-D_THREAD_SAFE -pthread'
1666 PTHREAD_LDFLAGS
='-pthread'
1667 if PTHREAD_LDFLAGS
== 'error':
1668 if conf
.CHECK_FUNC('pthread_attr_init'):
1669 PTHREAD_CFLAGS
='-D_REENTRANT'
1670 PTHREAD_LDFLAGS
='-lpthread'
1671 # especially for HP-UX, where the CHECK_FUNC macro fails to test for
1672 # pthread_attr_init. On pthread_mutex_lock it works there...
1673 if PTHREAD_LDFLAGS
== 'error':
1674 if conf
.CHECK_FUNCS_IN('pthread_mutex_lock', 'pthread'):
1675 PTHREAD_CFLAGS
='-D_REENTRANT'
1676 PTHREAD_LDFLAGS
='-lpthread'
1678 if PTHREAD_CFLAGS
!= 'error' and PTHREAD_LDFLAGS
!= 'error':
1679 conf
.ADD_CFLAGS(PTHREAD_CFLAGS
)
1680 conf
.ADD_LDFLAGS(PTHREAD_LDFLAGS
)
1681 conf
.CHECK_HEADERS('pthread.h')
1682 conf
.DEFINE('HAVE_PTHREAD', '1')
1684 if Options
.options
.with_pthreadpool
:
1685 if conf
.CONFIG_SET('HAVE_PTHREAD'):
1686 conf
.DEFINE('WITH_PTHREADPOOL', '1')
1688 Logs
.warn("pthreadpool support cannot be enabled when pthread support was not found")
1689 conf
.undefine('WITH_PTHREADPOOL')
1691 if conf
.CHECK_HEADERS('gpfs_gpl.h'):
1692 conf
.DEFINE('HAVE_GPFS', '1')
1694 default_static_modules
=TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
1695 auth_sam auth_unix auth_winbind auth_wbc auth_server
1696 auth_domain auth_builtin vfs_default
1697 nss_info_template idmap_tdb idmap_passdb
1700 default_shared_modules
=TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
1701 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
1702 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850
1703 charset_CP437 auth_script vfs_readahead vfs_xattr_tdb
1704 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
1705 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
1706 vfs_crossrename vfs_linux_xfs_sgid
1707 vfs_time_audit idmap_autorid''')
1709 if Options
.options
.developer
:
1710 default_static_modules
.extend(TO_LIST('pdb_ads auth_netlogond'))
1711 default_shared_modules
.extend(TO_LIST('charset_weird perfcount_test'))
1713 if conf
.env
.toplevel_build
:
1714 default_static_modules
.extend(TO_LIST('pdb_samba4 auth_samba4'))
1716 if Options
.options
.with_acl_support
and conf
.CONFIG_SET('HAVE_POSIX_ACLS'):
1717 default_static_modules
.extend(TO_LIST('vfs_posixacl'))
1719 if conf
.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'):
1720 default_shared_modules
.extend(TO_LIST('vfs_zfsacl'))
1722 if conf
.CONFIG_SET('HAVE_DIRFD_DECL'):
1723 default_shared_modules
.extend(TO_LIST('vfs_syncops vfs_dirsort'))
1725 if conf
.CONFIG_SET('HAVE_STATFS_F_FSID'):
1726 default_shared_modules
.extend(TO_LIST('vfs_fileid'))
1728 if conf
.CONFIG_SET('HAVE_AIO') and (conf
.CONFIG_SET('HAVE_MSGHDR_MSG_CONTROL') or conf
.CONFIG_SET('HAVE_MSGHDR_MSG_ACCTRIGHTS')):
1729 default_shared_modules
.extend(TO_LIST('vfs_aio_fork'))
1731 if conf
.CONFIG_SET('HAVE_LDAP'):
1732 default_static_modules
.extend(TO_LIST('pdb_ldap idmap_ldap'))
1734 if conf
.CONFIG_SET('DARWINOS'):
1735 default_shared_modules
.extend(TO_LIST('charset_macosxfs'))
1737 if conf
.CONFIG_SET('HAVE_GPFS'):
1738 default_shared_modules
.extend(TO_LIST('vfs_gpfs vfs_gpfs_hsm_notify'))
1740 explicit_shared_modules
= TO_LIST(Options
.options
.shared_modules
, delimiter
=',')
1741 explicit_static_modules
= TO_LIST(Options
.options
.static_modules
, delimiter
=',')
1743 final_static_modules
= default_static_modules
1744 final_shared_modules
= default_shared_modules
1746 for m
in explicit_static_modules
:
1747 if m
in final_shared_modules
:
1748 final_shared_modules
.remove(m
)
1749 final_static_modules
.append(m
)
1750 for m
in explicit_shared_modules
:
1751 if m
in final_static_modules
:
1752 final_static_modules
.remove(m
)
1753 final_shared_modules
.append(m
)
1755 conf
.env
['static_modules'] = final_static_modules
1756 conf
.env
['shared_modules'] = final_shared_modules
1758 conf
.DEFINE('STRING_STATIC_MODULES', ' '.join(final_static_modules
), quote
=True)
1763 prefixes
= ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
1764 conf
.env
['MODULE_PREFIXES'] = prefixes
1766 for m
in final_static_modules
:
1768 if not p
in static_list
:
1770 static_list
[p
].append(m
)
1771 for m
in final_shared_modules
:
1773 if not p
in shared_list
:
1775 shared_list
[p
].append(m
)
1778 static_env
= "%s_STATIC" % p
.upper()
1779 shared_env
= "%s_SHARED" % p
.upper()
1780 conf
.env
[static_env
] = []
1781 conf
.env
[shared_env
] = []
1782 if p
in static_list
:
1784 for entry
in static_list
[p
]:
1785 decl_list
+= "extern NTSTATUS %s_init(void); " % entry
1786 conf
.env
[static_env
].append('%s' % entry
)
1787 decl_list
= decl_list
.rstrip()
1788 conf
.DEFINE('static_decl_%s' % p
, decl_list
)
1789 conf
.DEFINE('static_init_%s' % p
, '{ %s_init(); }' % '_init(); '.join(static_list
[p
]))
1791 conf
.DEFINE('static_decl_%s' % p
, '')
1792 conf
.DEFINE('static_init_%s' % p
, '{}')
1793 if p
in shared_list
:
1794 for entry
in shared_list
[p
]:
1795 conf
.DEFINE('%s_init' % entry
, 'init_samba_module')
1796 conf
.env
[shared_env
].append('%s' % entry
)
1798 conf
.SAMBA_CONFIG_H('include/config.h')
1801 "build 'tags' file using ctags"
1803 source_root
= os
.path
.dirname(Utils
.g_module
.root_path
)
1804 cmd
= 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
1805 print("Running: %s" % cmd
)
1808 if not os
.getenv('TOPLEVEL_BUILD'):
1809 def wildcard_cmd(cmd
):
1810 '''called on a unknown command'''
1811 from samba_wildcard
import run_named_build_task
1812 run_named_build_task(cmd
)
1814 from samba_wildcard
import wildcard_main
1815 wildcard_main(wildcard_cmd
)
1816 Scripting
.main
= main