6 from optparse
import SUPPRESS_HELP
7 sys
.path
.insert(0, srcdir
+"/buildtools/wafsamba")
8 sys
.path
.insert(0, "source3")
9 import wafsamba
, Options
, Logs
, Utils
, Scripting
11 import samba_utils
, samba_version
14 Options
.default_prefix
= '/usr/local/samba'
18 opt
.add_option('--with-static-modules',
19 help=("Comma-separated list of names of modules to statically link in"),
20 action
="store", dest
='static_modules', default
=None)
21 opt
.add_option('--with-shared-modules',
22 help=("Comma-separated list of names of modules to build shared"),
23 action
="store", dest
='shared_modules', default
=None)
24 opt
.add_option('--enable-selftest',
25 help=("enable options necessary for selftest"),
26 action
="store_true", dest
='enable_selftest', default
=False)
28 opt
.SAMBA3_ADD_OPTION('winbind')
29 opt
.SAMBA3_ADD_OPTION('swat')
30 opt
.SAMBA3_ADD_OPTION('ads')
31 opt
.SAMBA3_ADD_OPTION('mit-krb5-checks', default
=False)
32 opt
.SAMBA3_ADD_OPTION('ldap')
33 opt
.SAMBA3_ADD_OPTION('cups', with_name
="enable", without_name
="disable")
34 opt
.SAMBA3_ADD_OPTION('iprint', with_name
="enable", without_name
="disable")
35 opt
.SAMBA3_ADD_OPTION('pam')
36 opt
.SAMBA3_ADD_OPTION('pam_smbpass')
37 opt
.SAMBA3_ADD_OPTION('quotas')
38 opt
.SAMBA3_ADD_OPTION('sys-quotas')
39 opt
.SAMBA3_ADD_OPTION('sendfile-support')
40 opt
.SAMBA3_ADD_OPTION('utmp')
41 opt
.SAMBA3_ADD_OPTION('pthreadpool', with_name
="enable", without_name
="disable")
42 opt
.SAMBA3_ADD_OPTION('avahi', with_name
="enable", without_name
="disable")
43 opt
.SAMBA3_ADD_OPTION('iconv')
44 opt
.SAMBA3_ADD_OPTION('acl-support')
45 opt
.SAMBA3_ADD_OPTION('dnsupdate')
46 opt
.SAMBA3_ADD_OPTION('syslog')
47 opt
.SAMBA3_ADD_OPTION('automount')
48 opt
.SAMBA3_ADD_OPTION('aio-support')
49 opt
.SAMBA3_ADD_OPTION('profiling-data', default
=False)
51 opt
.SAMBA3_ADD_OPTION('cluster-support')
53 opt
.add_option('--with-ctdb-dir',
54 help=("Directory under which ctdb is installed"),
55 action
="store", dest
='ctdb_dir', default
=None)
56 opt
.add_option('--enable-old-ctdb',
57 help=("enable building against (too) old version of ctdb (default=false)"),
58 action
="store_true", dest
='enable_old_ctdb', default
=False)
63 from samba_utils
import TO_LIST
65 if Options
.options
.developer
:
66 conf
.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
67 conf
.env
.developer
= True
69 if Options
.options
.with_swat
:
70 conf
.env
['build_swat'] = True
72 if sys
.platform
!= 'openbsd5':
73 conf
.ADD_LDFLAGS("-Wl,--export-dynamic", testflags
=True)
75 conf
.CHECK_HEADERS('execinfo.h libexc.h libunwind.h netdb.h')
76 conf
.CHECK_HEADERS('linux/falloc.h')
78 conf
.CHECK_FUNCS('getcwd fchown chmod fchmod mknod')
79 conf
.CHECK_FUNCS('strtol strchr strupr chflags')
80 conf
.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
81 conf
.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
82 conf
.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr')
83 conf
.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
84 conf
.CHECK_FUNCS('setpriv setgidx setuidx setgroups sysconf')
85 conf
.CHECK_FUNCS('atexit grantpt fallocate posix_fallocate')
86 conf
.CHECK_FUNCS('fseeko setluid')
87 conf
.CHECK_FUNCS('getpwnam', headers
='sys/types.h pwd.h')
88 conf
.CHECK_FUNCS('fdopendir')
89 conf
.CHECK_FUNCS('getpwent_r setenv strcasecmp fcvt fcvtl')
90 conf
.CHECK_FUNCS('syslog vsyslog timegm setlocale')
91 conf
.CHECK_FUNCS_IN('nanosleep', 'rt')
92 conf
.CHECK_FUNCS('lutimes futimes utimensat futimens')
93 conf
.CHECK_FUNCS('mlock munlock mlockall munlockall')
94 conf
.CHECK_FUNCS('memalign posix_memalign hstrerror')
95 conf
.CHECK_FUNCS('shmget')
96 conf
.CHECK_FUNCS_IN('shm_open', 'rt', checklibc
=True)
97 conf
.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain bind_textdomain_codeset')
98 #FIXME: for some reason this one still fails
99 conf
.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
100 conf
.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
101 conf
.CHECK_DECLS('fdatasync', reverse
=True)
102 conf
.CHECK_DECLS('readahead', reverse
=True, headers
='fcntl.h')
104 if conf
.CONFIG_SET('HAVE_LONG_LONG'):
105 conf
.DEFINE('HAVE_LONGLONG', 1)
107 if conf
.CHECK_CODE('''
108 #if defined(HAVE_UNISTD_H)
111 long ret = splice(0,0,1,0,400,0);
115 conf
.CHECK_DECLS('splice', reverse
=True, headers
='fcntl.h')
117 # Check for inotify support
118 conf
.CHECK_HEADERS('sys/inotify.h')
119 if "HAVE_SYS_INOTIFY_H" in conf
.env
:
120 conf
.DEFINE('HAVE_INOTIFY', 1)
122 # Check for kernel change notify support
125 #define F_NOTIFY 1026
128 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
129 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain
=False, execute
=True,
130 headers
='fcntl.h signal.h',
131 msg
="Checking for kernel change notify support")
133 # Check for Linux kernel oplocks
135 #include <sys/types.h>
139 #define F_NOTIFY 1026
142 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
143 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain
=False, execute
=True,
144 msg
="Checking for Linux kernel oplocks")
146 # Check for IRIX kernel oplock types
147 conf
.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
148 'HAVE_KERNEL_OPLOCKS_IRIX', headers
='fcntl.h',
149 msg
="Checking for IRIX kernel oplock types")
151 # Check for kernel share modes
153 #include <sys/types.h>
156 #include <sys/file.h>
162 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
163 }''', 'HAVE_KERNEL_SHARE_MODES', addmain
=False, execute
=True,
164 msg
="Checking for krenel share modes")
166 # Check for various members of the stat structure
167 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define
='HAVE_STAT_ST_BLOCKS',
168 headers
='sys/stat.h')
169 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define
='HAVE_STAT_ST_BLKSIZE',
170 headers
='sys/stat.h')
171 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_flags', define
='HAVE_STAT_ST_FLAGS',
172 headers
='sys/types.h sys/stat.h unistd.h')
174 if "HAVE_BLKCNT_T" in conf
.env
:
176 return sizeof(blkcnt_t) == 4 ? 0 : 1''',
177 'SIZEOF_BLKCNT_T_4', execute
=True,
178 headers
='replace.h sys/types.h sys/stat.h unistd.h',
179 msg
="Checking whether blkcnt_t is 32 bit")
181 if "HAVE_BLKCNT_T" in conf
.env
:
183 return sizeof(blkcnt_t) == 8 ? 0 : 1''',
184 'SIZEOF_BLKCNT_T_8', execute
=True,
185 headers
='replace.h sys/types.h sys/stat.h unistd.h',
186 msg
="Checking whether blkcnt_t is 64 bit")
188 # Check for POSIX capability support
189 conf
.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers
='sys/capability.h')
191 if "HAVE_SYS_CAPABILITY_H" in conf
.env
:
195 if (!(cap = cap_get_proc())) exit(1);
197 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
198 cap_set_proc(cap);''',
199 'HAVE_POSIX_CAPABILITIES', execute
=True, lib
="cap",
200 headers
='sys/capability.h',
201 msg
="Checking whether POSIX capabilities are available")
203 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
204 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
206 if conf
.CONFIG_SET("HAVE_RPC_RPC_H"):
207 conf
.CHECK_TYPE('int16', headers
='rpc/rpc.h',
208 define
='HAVE_INT16_FROM_RPC_RPC_H',
209 msg
="Checking for int16 typedef included by rpc/rpc.h")
210 conf
.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
211 headers
='sys/types.h rpc/rpc.h',
212 msg
="Checking for uint16 typedef included by rpc/rpc.h")
213 conf
.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
214 headers
='sys/types.h rpc/rpc.h',
215 msg
="Checking for int32 typedef included by rpc/rpc.h")
216 conf
.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
217 headers
='sys/types.h rpc/rpc.h',
218 msg
="Checking for uint32 typedef included by rpc/rpc.h")
219 conf
.CHECK_CODE('int i;', 'BROKEN_NISPLUS_INCLUDE_FILES',
220 headers
='sys/types.h sys/acl.h rpcsvc/nis.h',
221 msg
="Checking for broken nisplus include files")
223 # Check if the compiler will optimize out functions
226 this_function_does_not_exist();
229 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
230 msg
="Checking if the compiler will optimize out functions")
232 # Check if the compiler supports the LL suffix on long long integers
234 conf
.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL',
236 msg
="Checking for LL suffix on long long integers")
239 _acl __acl add_proplist_entry atexit attr_getf attr_list attr_listf
240 attropen attr_remove attr_removef attr_set attr_setf
241 bindtextdomain _chdir __chdir chflags chmod _close __close _closedir
242 __closedir crypt16 delproplist devnm dgettext dirfd
243 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
244 extattr_delete_fd extattr_get_fd extattr_get_file
245 extattr_list_fd extattr_list_file
246 extattr_set_fd extattr_set_file _facl __facl _fchdir
247 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
248 fdelproplist fgetea fgetproplist fgetxattr flistea flistxattr
249 _fork __fork fremoveea fremovexattr fseeko fsetea
250 fsetproplist fsetxattr _fstat __fstat fsync
251 futimens futimes __fxstat getauthuid
252 getcwd _getcwd __getcwd getdents __getdents getdirentries
253 getgrent getgrnam getgrouplist getgrset getmntent getpagesize
254 getproplist get_proplist_entry getpwanam getpwent_r getrlimit gettext
255 glob grantpt hstrerror initgroups innetgr
257 llseek _llseek __llseek _lseek __lseek
258 _lstat __lstat lutimes
259 __lxstat memalign mknod mlock mlockall munlock munlockall
260 _open __open _opendir __opendir
261 pathconf poll posix_fallocate
262 posix_memalign prctl pread _pread __pread
263 pwrite _pwrite __pwrite
264 rdchk _read __read _readdir __readdir
265 removeea removexattr _seekdir __seekdir
266 select setea setenv setgidx setgroups setlocale setluid
267 setmntent setpgid setpriv setproplist setsid setuidx
268 setxattr shmget shm_open sigaction sigblock sigprocmask sigset
269 sizeof_proplist_entry _stat __stat statvfs
270 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctl sysctlbyname
271 __sys_llseek syslog _telldir __telldir textdomain timegm
272 utimensat vsyslog _write __write __xstat
275 conf
.CHECK_SAMBA3_CHARSET() # see build/charset.py
277 # FIXME: these should be tests for features, but the old build system just
279 host_os
= sys
.platform
280 Logs
.info("building on %s" % host_os
)
282 # Python doesn't have case switches... :/
283 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
284 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
286 conf
.SET_TARGET_TYPE('sunacl', 'EMPTY')
287 if (host_os
.rfind('linux') > -1) or (host_os
.rfind('gnu') > -1) or (host_os
.rfind('qnx') > -1):
288 if host_os
.rfind('linux') > -1:
289 conf
.DEFINE('LINUX', '1')
290 elif host_os
.rfind('qnx') > -1:
291 conf
.DEFINE('QNX', '1')
292 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
293 elif (host_os
.rfind('darwin') > -1):
294 conf
.DEFINE('DARWINOS', 1)
295 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
296 conf
.ADD_CFLAGS('-fno-common')
297 elif (host_os
.rfind('freebsd') > -1):
298 if conf
.CHECK_HEADERS('sunacl.h'):
299 conf
.DEFINE('HAVE_FREEBSD_SUNACL_H', '1')
300 conf
.CHECK_FUNCS_IN('acl', 'sunacl')
301 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
302 elif (host_os
.rfind('netbsd') > -1):
303 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
304 elif (host_os
.rfind('openbsd') > -1):
305 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
306 elif (host_os
.rfind('sunos') > -1):
307 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
308 # FIXME: Add more checks here.
310 Logs
.warn("Unknown host_os '%s', please report this to samba-technical@samba.org" % host_os
)
312 #FIXME: add more checks
313 if Options
.options
.with_acl_support
:
314 if host_os
.rfind('linux') > -1:
315 conf
.CHECK_FUNCS_IN('acl_get_file', 'acl')
316 conf
.CHECK_FUNCS_IN('getxattr', 'attr')
317 if conf
.CHECK_CODE('''
320 acl_entry_t *entry_p;
321 return acl_get_entry(acl, entry_id, entry_p);
324 headers
='sys/types.h sys/acl.h', link
=False,
325 msg
="Checking for POSIX ACL support") :
327 acl_permset_t permset_d;
329 return acl_get_perm_np(permset_d, perm);
331 'HAVE_ACL_GET_PERM_NP',
332 headers
='sys/types.h sys/acl.h', link
=True,
333 msg
="Checking whether acl_get_perm_np() is available")
335 conf
.DEFINE('HAVE_NO_ACLS', 1)
336 conf
.SET_TARGET_TYPE('acl', 'EMPTY')
338 conf
.DEFINE('HAVE_NO_ACLS', 1)
339 conf
.SET_TARGET_TYPE('acl', 'EMPTY')
341 if conf
.CHECK_FUNCS('dirfd'):
342 conf
.DEFINE('HAVE_DIRFD_DECL', 1)
344 conf
.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
345 'HAVE_STATFS_F_FSID',
346 msg
="vfs_fileid: checking for statfs() and struct statfs.f_fsid",
347 headers
='sys/types.h sys/statfs.h',
350 if conf
.CONFIG_SET('HAVE_FALLOCATE'):
352 int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
353 'HAVE_LINUX_FALLOCATE',
354 msg
="Checking whether the Linux 'fallocate' function is available",
355 headers
='unistd.h sys/types.h fcntl.h linux/falloc.h')
357 ssize_t err = readahead(0,0,0x80000);''',
358 'HAVE_LINUX_READAHEAD',
359 msg
="Checking whether Linux readahead is available",
360 headers
='unistd.h fcntl.h')
361 conf
.CHECK_DECLS('readahead', headers
='fcntl.h', always
=True)
363 if Options
.options
.with_aio_support
:
364 conf
.CHECK_FUNCS_IN('aio_read', 'aio')
365 conf
.CHECK_FUNCS_IN('aio_read', 'rt')
366 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);',
368 msg
='Checking for asynchronous io support',
369 headers
='sys/types.h aio.h',
371 if conf
.CONFIG_SET('HAVE_AIO'):
372 conf
.DEFINE('WITH_AIO', '1')
373 if conf
.CONFIG_SET('HAVE_AIO'):
374 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg
='Checking for aio_read', headers
='aio.h', lib
='aio rt')
375 conf
.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg
='Checking for aio_write', headers
='aio.h', lib
='aio rt')
376 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')
377 conf
.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg
='Checking for aio_return', headers
='aio.h', lib
='aio rt')
378 conf
.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg
='Checking for aio_error', headers
='aio.h', lib
='aio rt')
379 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')
380 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')
381 if host_os
.rfind('linux') > -1:
382 conf
.CHECK_FUNCS_IN('io_submit', 'aio')
384 struct io_event ioev;
390 fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
391 io_queue_init(128,&ctx);
392 io_prep_pwrite(ioc, 1, buf, 1, 0);
393 io_prep_pread(ioc, 1, buf, 1, 0);
394 io_set_eventfd(ioc, fd);
395 io_set_callback(ioc, (io_callback_t)(0));
396 io_submit(ctx, 1, &ioc);
397 io_getevents(ctx, 1, 1, &ioev, &ts);
399 'HAVE_LINUX_KERNEL_AIO',
400 msg
='Checking for linux kernel asynchronous io support',
401 headers
='unistd.h stdlib.h sys/types.h fcntl.h sys/eventfd.h libaio.h',
404 if not conf
.CONFIG_SET('HAVE_AIO'):
405 conf
.DEFINE('HAVE_NO_AIO', '1')
407 conf
.DEFINE('HAVE_NO_AIO', '1')
413 char control[CMSG_SPACE(sizeof(int))];
415 msg.msg_control = control_un.control;
416 msg.msg_controllen = sizeof(control_un.control);
418 'HAVE_MSGHDR_MSG_CONTROL',
419 msg
='Checking if we can use msg_control for passing file descriptors',
420 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
424 msg.msg_acctrights = (caddr_t) &fd;
425 msg.msg_acctrightslen = sizeof(fd);
427 'HAVE_MSGHDR_MSG_ACCTRIGHTS',
428 msg
='Checking if we can use msg_acctrights for passing file descriptors',
429 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
431 if Options
.options
.with_winbind
:
432 conf
.env
.build_winbind
= True
433 conf
.DEFINE('WITH_WINBIND', '1')
435 conf
.find_program('awk', var
='AWK')
436 conf
.find_program('perl', var
='PERL')
438 # Darwin has extra options to xattr-family functions
439 conf
.CHECK_CODE('getxattr(0, 0, 0, 0, 0, 0);',
441 msg
="Checking whether xattr interface takes additional options",
442 headers
='sys/types.h attr/xattr.h sys/xattr.h')
444 conf
.CHECK_HEADERS('asm/types.h')
446 conf
.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
447 headers
='unistd.h sys/types.h',
448 msg
="Checking for major macro")
450 conf
.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
451 headers
='unistd.h sys/types.h',
452 msg
="Checking for minor macro")
454 conf
.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
455 headers
='unistd.h sys/types.h dirent.h',
456 define
='HAVE_DIRENT_D_OFF')
458 conf
.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent')
459 if conf
.CHECK_CFLAGS('-Werror-implicit-function-declaration'):
460 netgrent_cflags
= '-Werror-implicit-function-declaration'
463 conf
.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE',
464 msg
="Checking for setnetgrent prototype",
465 headers
='netdb.h netgroup.h',
466 cflags
=netgrent_cflags
)
467 conf
.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE',
468 msg
="Checking for getnetgrent prototype",
469 headers
='netdb.h netgroup.h',
470 cflags
=netgrent_cflags
)
471 conf
.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE',
472 msg
="Checking for endnetgrent prototype",
473 headers
='netdb.h netgroup.h',
474 cflags
=netgrent_cflags
)
478 if Options
.options
.with_cups
:
479 conf
.find_program('cups-config', var
='CUPS_CONFIG')
480 if conf
.env
.CUPS_CONFIG
:
481 # we would normally use --libs here, but cups-config incorrectly adds
482 # gssapi_krb5 and other libraries to its --libs output. That breaks the use
483 # of an in-tree heimdal kerberos
484 conf
.check_cfg(path
=conf
.env
.CUPS_CONFIG
, args
="--cflags --ldflags",
485 package
="", uselib_store
="CUPS")
486 conf
.CHECK_HEADERS('cups/cups.h cups/language.h', lib
='cups')
487 conf
.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups')
488 if conf
.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf
.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
489 conf
.DEFINE('HAVE_CUPS', '1')
491 conf
.undefine('HAVE_CUPS')
492 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
494 # define an empty subsystem for cups, to allow it to be used as an empty dependency
495 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
497 if Options
.options
.with_iprint
:
498 if conf
.CONFIG_SET('HAVE_CUPS'):
499 conf
.DEFINE('HAVE_IPRINT', '1')
501 Logs
.warn("--enable-iprint=yes but cups support not sufficient")
502 if Options
.options
.with_syslog
:
503 conf
.DEFINE('WITH_SYSLOG', '1')
504 if Options
.options
.with_automount
:
505 conf
.DEFINE('WITH_AUTOMOUNT', '1')
508 if Options
.options
.with_ldap
:
509 conf
.CHECK_HEADERS('ldap.h lber.h ldap_pvt.h')
510 conf
.CHECK_TYPE('ber_tag_t', 'unsigned int', headers
='ldap.h lber.h')
511 conf
.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
512 conf
.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers
='ldap.h')
514 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
516 conf
.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
517 define
='HAVE_LBER_LOG_PRINT_FN', headers
='lber.h')
519 conf
.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', 'ldap')
520 conf
.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
522 # Check if ldap_set_rebind_proc() takes three arguments
523 if conf
.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
524 'LDAP_SET_REBIND_PROC_ARGS',
525 msg
="Checking whether ldap_set_rebind_proc takes 3 arguments",
526 headers
='ldap.h lber.h', link
=False):
527 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
529 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
531 # last but not least, if ldap_init() exists, we want to use ldap
532 if conf
.CONFIG_SET('HAVE_LDAP_INIT'):
533 conf
.DEFINE('HAVE_LDAP', '1')
534 conf
.DEFINE('LDAP_DEPRECATED', '1')
535 conf
.env
['HAVE_LDAP'] = '1'
536 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
537 # SASL wrapping hooks
538 if conf
.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
539 conf
.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
540 conf
.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
542 conf
.SET_TARGET_TYPE('ldap', 'EMPTY')
543 conf
.SET_TARGET_TYPE('lber', 'EMPTY')
547 if Options
.options
.with_mit_krb5_checks
:
548 Logs
.info("Looking for kerberos features")
549 conf
.find_program('krb5-config', var
='KRB5_CONFIG')
550 if conf
.env
.KRB5_CONFIG
:
551 conf
.check_cfg(path
="krb5-config", args
="--cflags --libs",
552 package
="gssapi", uselib_store
="KRB5")
553 conf
.CHECK_HEADERS('krb5.h krb5/locate_plugin.h', lib
='krb5')
554 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')
556 if conf
.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'):
557 conf
.env
['WINBIND_KRB5_LOCATOR'] = 'bin/winbind_krb5_locator.so'
559 conf
.CHECK_FUNCS_IN('_et_list', 'com_err')
560 conf
.CHECK_FUNCS_IN('krb5_encrypt_data', 'k5crypto')
561 conf
.CHECK_FUNCS_IN('des_set_key','crypto')
562 conf
.CHECK_FUNCS_IN('copy_Authenticator', 'asn1')
563 conf
.CHECK_FUNCS_IN('roken_getaddrinfo_hostspec', 'roken')
564 if conf
.CHECK_FUNCS_IN('gss_display_status', 'gssapi') or \
565 conf
.CHECK_FUNCS_IN('gss_display_status', 'gssapi_krb5'):
567 conf
.CHECK_FUNCS_IN('''
570 gss_get_name_attribute
573 gss_inquire_sec_context_by_oid
574 gsskrb5_extract_authz_data_from_sec_context
575 gss_krb5_export_lucid_sec_context
576 ''', 'gssapi gssapi_krb5 krb5')
577 conf
.CHECK_FUNCS_IN('krb5_mk_req_extended krb5_kt_compare', 'krb5')
579 krb5_set_default_in_tkt_etypes krb5_set_default_tgs_enctypes
580 krb5_set_default_tgs_ktypes krb5_principal2salt
581 krb5_c_string_to_key krb5_get_pw_salt krb5_string_to_key_salt krb5_auth_con_setkey
582 krb5_auth_con_setuseruserkey krb5_get_permitted_enctypes
583 krb5_get_default_in_tkt_etypes krb5_free_data_contents
584 krb5_principal_get_comp_string krb5_free_unparsed_name
585 krb5_free_keytab_entry_contents krb5_kt_free_entry krb5_krbhst_init
586 krb5_krbhst_get_addrinfo
587 krb5_crypto_init krb5_crypto_destroy
588 krb5_c_verify_checksum krb5_principal_compare_any_realm
589 krb5_parse_name_norealm krb5_princ_size krb5_get_init_creds_opt_set_pac_request
590 krb5_get_renewed_creds krb5_free_error_contents
591 initialize_krb5_error_table krb5_get_init_creds_opt_alloc
592 krb5_get_init_creds_opt_free krb5_get_init_creds_opt_get_error
593 krb5_enctype_to_string krb5_fwd_tgt_creds krb5_auth_con_set_req_cksumtype
594 krb5_get_creds_opt_alloc krb5_get_creds_opt_set_impersonate krb5_get_creds
595 krb5_get_credentials_for_user krb5_get_host_realm krb5_free_host_realm''',
597 conf
.CHECK_DECLS('''krb5_get_credentials_for_user
598 krb5_auth_con_set_req_cksumtype''',
599 headers
='krb5.h', always
=True)
600 conf
.CHECK_VARIABLE('AP_OPTS_USE_SUBKEY', headers
='krb5.h')
601 conf
.CHECK_VARIABLE('KV5M_KEYTAB', headers
='krb5.h')
602 conf
.CHECK_VARIABLE('KRB5_KU_OTHER_CKSUM', headers
='krb5.h')
603 conf
.CHECK_VARIABLE('KRB5_KEYUSAGE_APP_DATA_CKSUM', headers
='krb5.h')
604 conf
.CHECK_VARIABLE('ENCTYPE_AES128_CTS_HMAC_SHA1_96', headers
='krb5.h')
605 conf
.CHECK_VARIABLE('ENCTYPE_AES256_CTS_HMAC_SHA1_96', headers
='krb5.h')
606 conf
.CHECK_DECLS('KRB5_PDU_NONE', reverse
=True, headers
='krb5.h')
607 conf
.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'key', headers
='krb5.h',
608 define
='HAVE_KRB5_KEYTAB_ENTRY_KEY')
609 conf
.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'keyblock', headers
='krb5.h',
610 define
='HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK')
611 conf
.CHECK_STRUCTURE_MEMBER('krb5_address', 'magic', headers
='krb5.h',
612 define
='HAVE_MAGIC_IN_KRB5_ADDRESS')
613 conf
.CHECK_STRUCTURE_MEMBER('krb5_address', 'addrtype', headers
='krb5.h',
614 define
='HAVE_ADDRTYPE_IN_KRB5_ADDRESS')
615 conf
.CHECK_STRUCTURE_MEMBER('krb5_ap_req', 'ticket', headers
='krb5.h',
616 define
='HAVE_TICKET_POINTER_IN_KRB5_AP_REQ')
618 conf
.CHECK_TYPE('krb5_encrypt_block', headers
='krb5.h')
622 krb5_get_init_creds_opt *opt = NULL;
623 krb5_get_init_creds_opt_free(ctx, opt);
625 'KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT',
626 headers
='krb5.h', link
=False,
627 msg
="Checking whether krb5_get_init_creds_opt_free takes a context argument")
629 const krb5_data *pkdata;
630 krb5_context context;
631 krb5_principal principal;
632 pkdata = krb5_princ_component(context, principal, 0);
634 'HAVE_KRB5_PRINC_COMPONENT',
635 headers
='krb5.h', lib
='krb5',
636 msg
="Checking whether krb5_princ_component is available")
641 krb5_enctype_to_string(1, buf, 256);
644 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_SIZE_T_ARG',
645 headers
='krb5.h', lib
='krb5 k5crypto',
646 addmain
=False, cflags
='-Werror',
647 msg
="Checking whether krb5_enctype_to_string takes size_t argument")
651 krb5_context context = NULL;
653 krb5_enctype_to_string(context, 1, &str);
657 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_KRB5_CONTEXT_ARG',
658 headers
='krb5.h stdlib.h', lib
='krb5',
659 addmain
=False, cflags
='-Werror',
660 msg
="Checking whether krb5_enctype_to_string takes krb5_context argument")
663 krb5_context ctx = NULL;
664 krb5_principal princ = NULL;
665 const char *str = krb5_princ_realm(ctx, princ)->data;
668 'HAVE_KRB5_PRINC_REALM',
669 headers
='krb5.h', lib
='krb5',
671 msg
="Checking whether the macro krb5_princ_realm is defined")
674 krb5_context context;
675 krb5_principal principal;
676 const char *realm; realm = krb5_principal_get_realm(context, principal);
679 'HAVE_KRB5_PRINCIPAL_GET_REALM',
680 headers
='krb5.h', lib
='krb5',
682 msg
="Checking whether krb5_principal_get_realm is defined")
684 krb5_enctype enctype;
685 enctype = ENCTYPE_ARCFOUR_HMAC_MD5;
687 '_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5',
688 headers
='krb5.h', lib
='krb5',
689 msg
="Checking whether the ENCTYPE_ARCFOUR_HMAC_MD5 key type definition is available");
691 krb5_keytype keytype;
692 keytype = KEYTYPE_ARCFOUR_56;
694 '_HAVE_KEYTYPE_ARCFOUR_56',
695 headers
='krb5.h', lib
='krb5',
696 msg
="Checking whether the HAVE_KEYTYPE_ARCFOUR_56 key type definition is available");
697 if conf
.CONFIG_SET('_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and conf
.CONFIG_SET('_HAVE_KEYTYPE_ARCFOUR_56'):
698 conf
.DEFINE('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5', '1')
701 krb5_enctype enctype;
702 enctype = ENCTYPE_ARCFOUR_HMAC;
704 'HAVE_ENCTYPE_ARCFOUR_HMAC',
705 headers
='krb5.h', lib
='krb5',
706 msg
="Checking whether the ENCTYPE_ARCFOUR_HMAC key type definition is available");
709 krb5_context context;
711 krb5_init_context(&context);
712 return krb5_kt_resolve(context, "WRFILE:api", &keytab);
714 'HAVE_WRFILE_KEYTAB',
715 headers
='krb5.h', lib
='krb5', execute
=True,
716 msg
="Checking whether the WRFILE:-keytab is supported");
718 # Check for KRB5_DEPRECATED handling
719 conf
.CHECK_CODE('''#define KRB5_DEPRECATED 1
720 #include <krb5.h>''',
721 'HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER', addmain
=False,
723 msg
="Checking for KRB5_DEPRECATED define taking an identifier")
725 if Options
.options
.with_ads
:
727 if not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and \
728 not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC'):
729 Logs
.warn("arcfour-hmac-md5 encryption type not found in -lkrb5")
731 if not conf
.CONFIG_SET('HAVE_KRB5_MK_REQ_EXTENDED'):
732 Logs
.warn("krb5_mk_req_extended not found in -lkrb5")
734 if not conf
.CONFIG_SET('HAVE_KRB5_GET_HOST_REALM'):
735 Logs
.warn("krb5_get_host_realm not found in -lkrb5")
737 if not conf
.CONFIG_SET('HAVE_KRB5_FREE_HOST_REALM'):
738 Logs
.warn("krb5_free_host_realm not found in -lkrb5")
740 if not conf
.CONFIG_SET('HAVE_KRB5_FWD_TGT_CREDS'):
741 Logs
.warn("krb5_fwd_tgt_creds found in -lkrb5")
743 if not conf
.CONFIG_SET('HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC'):
744 Logs
.warn("krb5_get_init_creds_opt_alloc not found in -lkrb5")
746 if not conf
.CONFIG_SET('KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT'):
747 Logs
.warn("krb5_get_init_creds_opt_free was not found or was too old in -lkrb5")
749 if not conf
.CONFIG_SET('HAVE_KRB5_GET_RENEWED_CREDS'):
750 Logs
.warn("krb5_get_renewed_creds not found in -lkrb5")
752 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL_COMPARE_ANY_REALM'):
753 Logs
.warn("krb5_principal_compare_any_realm not found in -lkrb5")
755 if not conf
.CONFIG_SET('HAVE_KRB5_C_STRING_TO_KEY') and \
756 not conf
.CONFIG_SET('HAVE_KRB5_STRING_TO_KEY_SALT'):
757 Logs
.warn("krb5_c_string_to_key not found in -lkrb5")
759 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL2SALT') and \
760 not conf
.CONFIG_SET('HAVE_KRB5_GET_PW_SALT'):
761 Logs
.warn("no CREATE_KEY_FUNCTIONS detected")
763 if not conf
.CONFIG_SET('HAVE_KRB5_GET_PERMITTED_ENCTYPES') and \
764 not conf
.CONFIG_SET('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES'):
765 Logs
.warn("no GET_ENCTYPES_FUNCTIONS detected")
767 if not conf
.CONFIG_SET('HAVE_KRB5_KT_FREE_ENTRY') and \
768 not conf
.CONFIG_SET('HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS'):
769 Logs
.warn("no KT_FREE_FUNCTION detected")
771 if not conf
.CONFIG_SET('HAVE_KRB5_C_VERIFY_CHECKSUM'):
772 Logs
.warn("krb5_c_verify_checksum_compare not found in -lkrb5")
775 # We don't actually use
776 # gsskrb5_extract_authz_data_from_sec_context, but it is a
777 # clue that this Heimdal, which does the PAC processing we
778 # need on the standard gss_inquire_sec_context_by_oid
779 if not conf
.CONFIG_SET('HAVE_GSS_GET_NAME_ATTRIBUTE') and \
780 not (conf
.CONFIG_SET('HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT') and \
781 conf
.CONFIG_SET('HAVE_GSS_INQUIRE_SEC_CONTEXT_BY_OID')):
782 Logs
.warn("need eiterh gss_get_name_attribute or gsskrb5_extract_authz_data_from_sec_context and gss_inquire_sec_context_by_oid in -lgssapi for PAC support")
785 if not conf
.CONFIG_SET('HAVE_GSS_KRB5_EXPORT_LUCID_SEC_CONTEXT'):
786 Logs
.warn("need gss_krb5_export_lucid_sec_context for SPNEGO and gss_wrap support")
790 conf
.DEFINE('WITH_ADS', '1')
791 conf
.DEFINE('HAVE_KRB5', '1')
792 if conf
.CONFIG_SET('HAVE_LDAP'):
793 conf
.env
['HAVE_ADS'] = '1'
795 Logs
.warn("krb5 libs don't have all features required for Active Directory support")
796 conf
.undefine('HAVE_KRB5_H')
797 conf
.undefine('HAVE_GSSAPI_H')
798 conf
.undefine('HAVE_GSSAPI_GSSAPI_GENERIC_H')
799 conf
.undefine('HAVE_GSSAPI_GSSAPI_H')
801 if Options
.options
.with_utmp
:
802 conf
.env
.with_utmp
= True
803 if not conf
.CHECK_HEADERS('utmp.h'): conf
.env
.with_utmp
= False
804 conf
.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
805 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers
='utmp.h',
806 define
='HAVE_UT_UT_NAME')
807 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers
='utmp.h',
808 define
='HAVE_UT_UT_USER')
809 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers
='utmp.h',
810 define
='HAVE_UT_UT_ID')
811 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers
='utmp.h',
812 define
='HAVE_UT_UT_HOST')
813 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers
='utmp.h',
814 define
='HAVE_UT_UT_TIME')
815 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers
='utmp.h',
816 define
='HAVE_UT_UT_TV')
817 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers
='utmp.h',
818 define
='HAVE_UT_UT_TYPE')
819 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers
='utmp.h',
820 define
='HAVE_UT_UT_PID')
821 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers
='utmp.h',
822 define
='HAVE_UT_UT_EXIT')
823 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr_v6', headers
='utmp.h',
824 define
='HAVE_UT_UT_ADDR_V6')
825 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr', headers
='utmp.h',
826 define
='HAVE_UT_UT_ADDR')
827 conf
.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers
='utmpx.h',
828 define
='HAVE_UX_UT_SYSLEN')
829 conf
.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
830 'PUTUTLINE_RETURNS_UTMP', headers
='utmp.h',
831 msg
="Checking whether pututline returns pointer")
832 if conf
.env
.with_utmp
:
833 conf
.DEFINE('WITH_UTMP', 1)
835 if Options
.options
.with_avahi
:
836 conf
.env
.with_avahi
= True
837 if not conf
.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf
.env
.with_avahi
= False
838 if not conf
.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf
.env
.with_avahi
= False
839 if not conf
.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf
.env
.with_avahi
= False
840 if conf
.env
.with_avahi
:
841 conf
.DEFINE('WITH_AVAHI_SUPPORT', 1)
843 conf
.SET_TARGET_TYPE('avahi-common', 'EMPTY')
844 conf
.SET_TARGET_TYPE('avahi-client', 'EMPTY')
846 if Options
.options
.with_iconv
:
847 conf
.env
.with_iconv
= True
848 if not conf
.CHECK_FUNCS_IN('iconv_open', 'iconv', headers
='iconv.h'):
849 conf
.env
.with_iconv
= False
850 if conf
.env
.with_iconv
:
851 conf
.DEFINE('HAVE_ICONV', 1)
853 if Options
.options
.with_pam
:
855 conf
.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
856 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
857 Logs
.warn("--with-pam=yes but pam_appl.h not found")
859 conf
.CHECK_FUNCS_IN('pam_get_data', 'pam')
860 conf
.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h')
861 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'):
862 Logs
.warn("--with-pam=yes but pam_modules.h not found")
864 conf
.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h')
865 conf
.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h')
866 conf
.CHECK_FUNCS_IN('pam_vsyslog', 'pam')
868 #if defined(HAVE_SECURITY_PAM_APPL_H)
869 #include <security/pam_appl.h>
870 #elif defined(HAVE_PAM_PAM_APPL_H)
871 #include <pam/pam_appl.h>
873 pam_set_item(0, PAM_RHOST, 0);
877 msg
="Checking whether PAM_RHOST is available");
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_TTY, 0);
888 msg
="Checking whether PAM_TTY is available");
890 #if (!defined(LINUX))
892 #define PAM_EXTERN extern
893 #if defined(HAVE_SECURITY_PAM_APPL_H)
894 #include <security/pam_appl.h>
895 #elif defined(HAVE_PAM_PAM_APPL_H)
896 #include <pam/pam_appl.h>
901 #if defined(HAVE_SECURITY_PAM_MODULES_H)
902 #include <security/pam_modules.h>
903 #elif defined(HAVE_PAM_PAM_MODULES_H)
904 #include <pam/pam_modules.h>
907 #if defined(HAVE_SECURITY__PAM_MACROS_H)
908 #include <security/_pam_macros.h>
909 #elif defined(HAVE_PAM__PAM_MACROS_H)
910 #include <pam/_pam_macros.h>
913 #ifdef HAVE_SECURITY_PAM_EXT_H
914 #include <security/pam_ext.h>
917 int i; i = PAM_RADIO_TYPE;
919 'HAVE_PAM_RADIO_TYPE',
921 msg
="Checking whether PAM_RADIO_TYPE is available");
923 conf
.DEFINE('WITH_PAM', 1)
924 conf
.DEFINE('WITH_PAM_MODULES', 1)
928 seteuid
= conf
.CHECK_CODE('''
929 #define AUTOCONF_TEST 1
930 #define USE_SETREUID 1
931 #include "./lib/util_sec.c"
936 msg
="Checking whether setreuid is available")
938 seteuid
= conf
.CHECK_CODE('''
939 #define AUTOCONF_TEST 1
940 #define USE_SETRESUID 1
941 #include "./lib/util_sec.c"
946 msg
="Checking whether setresuid is available")
948 seteuid
= conf
.CHECK_CODE('''
949 #define AUTOCONF_TEST 1
950 #define USE_SETEUID 1
951 #include "./lib/util_sec.c"
956 msg
="Checking whether seteuid is available")
958 seteuid
= conf
.CHECK_CODE('''
959 #define AUTOCONF_TEST 1
960 #define USE_SETUIDX 1
961 #include "./lib/util_sec.c"
967 msg
="Checking whether setuidx is available")
968 if Options
.options
.with_dnsupdate
:
969 conf
.CHECK_HEADERS('uuid/uuid.h')
970 conf
.CHECK_FUNCS_IN('uuid_generate', 'uuid')
971 if not conf
.CONFIG_SET('HAVE_UUID_UUID_H') and not conf
.CONFIG_SET('HAVE_UUID_GENERATE'):
972 Logs
.warn("--with-dnsupdate=yes but uuid support not sufficient")
973 elif not conf
.CONFIG_SET('HAVE_KRB5'):
974 Logs
.warn("--with-dnsupdate=yes but gssapi support not sufficient")
976 conf
.DEFINE('WITH_DNS_UPDATES', 1)
978 conf
.SET_TARGET_TYPE('uuid', 'EMPTY')
979 conf
.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
980 if Options
.options
.developer
:
981 if conf
.CONFIG_SET('HAVE_VALGRIND_H') or conf
.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'):
982 conf
.DEFINE('VALGRIND', '1')
984 if conf
.CHECK_CODE('''
985 #include <bits/sockaddr.h>
986 #include <linux/netlink.h>
988 'HAVE_LINUX_NETLINK_H',
989 msg
="Checking whether Linux netlink is available"):
991 #include <bits/sockaddr.h>
992 #include <linux/netlink.h>
993 #include <linux/rtnetlink.h>
995 'HAVE_LINUX_RTNETLINK_H',
996 msg
='Checking whether Linux rtnetlink is available')
998 #include "../tests/fcntl_lock.c"
1003 msg
='Checking whether fcntl locking is available')
1005 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec',
1006 define
='HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') # Linux, Solaris
1007 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimensec',
1008 define
='HAVE_STRUCT_STAT_ST_MTIMENSEC') # BSD, if defined _POSIX_SOURCE
1009 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimespec.tv_nsec',
1010 define
='HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') # BSD, if not defined _POSIX_SOURCE
1011 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtime_n',
1012 define
='HAVE_STRUCT_STAT_ST_MTIME_N') # AIX
1013 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_umtime',
1014 define
='HAVE_STRUCT_STAT_ST_UMTIME') # Tru64
1015 if conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') or \
1016 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMENSEC') or \
1017 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') or \
1018 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIME_N') or \
1019 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_UMTIME'):
1020 conf
.DEFINE('HAVE_STAT_HIRES_TIMESTAMPS', '1')
1022 # recent FreeBSD, NetBSD have creation timestamps called birthtime:
1023 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtime',
1024 define
='HAVE_STRUCT_STAT_ST_BIRTHTIME')
1025 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimespec.tv_nsec',
1026 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC')
1027 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimensec',
1028 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC')
1031 ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
1033 'HAVE_POSIX_FADVISE',
1034 msg
='Checking whether posix_fadvise is available',
1035 headers
='unistd.h fcntl.h')
1037 for v
in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]:
1040 return sysconf(%s) == -1 ? 1 : 0;
1043 msg
='Checking whether sysconf(%s) is available' % v
)
1046 #include <sys/syscall.h>
1048 syscall(SYS_initgroups, 16, NULL, NULL, 0);
1050 'HAVE_DARWIN_INITGROUPS',
1051 msg
='Checking whether to use the Darwin-specific initgroups system call')
1053 conf
.CHECK_CODE('''struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''',
1055 headers
='sys/types.h utime.h',
1056 msg
='Checking whether struct utimbuf is available')
1058 if conf
.CHECK_CODE('''struct sigevent s;''',
1059 'HAVE_STRUCT_SIGEVENT',
1060 headers
='sys/types.h stdlib.h stddef.h signal.h',
1061 msg
='Checking whether we have the struct sigevent'):
1062 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sival_ptr',
1063 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR',
1064 headers
='signal.h');
1065 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sigval_ptr',
1066 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR',
1067 headers
='signal.h');
1069 if os
.path
.exists('/proc/sys/kernel/core_pattern'):
1070 conf
.DEFINE('HAVE_SYS_KERNEL_PROC_CORE_PATTERN', '1')
1072 if conf
.CHECK_CODE('''
1076 if (sizeof(time_t) == 8) {
1077 time_t max_time = 0x7fffffffffffffffll;
1078 tm = gmtime(&max_time);
1079 /* This should fail with 32-bit tm_year. */
1081 /* Max time_t that works with 32-bit int tm_year in struct tm. */
1082 max_time = 67768036191676799ll;
1083 tm = gmtime(&max_time);
1094 msg
="Checking for the maximum value of the 'time_t' type"):
1095 conf
.DEFINE('TIME_T_MAX', '67768036191676799ll')
1098 #if defined(HAVE_UNISTD_H)
1101 #include <sys/types.h>
1102 main() { dev_t dev = makedev(1,2); return 0; }
1106 msg
='Checking whether the macro for makedev is available')
1113 void exit_on_core(int ignored) {
1119 signal(SIGSEGV, exit_on_core);
1120 newpath = realpath("/tmp", NULL);
1121 exit((newpath != NULL) ? 0 : 1);
1124 'REALPATH_TAKES_NULL',
1127 msg
='Checking whether the realpath function allows a NULL argument')
1129 conf
.CHECK_CODE('''#include "../tests/ftruncate.c"''',
1130 'HAVE_FTRUNCATE_EXTEND',
1131 msg
='Checking for ftruncate extend',
1134 if os
.getenv('RUN_FROM_BUILD_FARM'):
1135 Logs
.info("enabling buildfarm hacks")
1136 conf
.DEFINE('ENABLE_BUILD_FARM_HACKS', '1')
1138 if Options
.options
.with_sendfile_support
:
1139 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):
1144 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1147 headers
='sys/sendfile',
1148 msg
='Checking for linux sendfile support')
1150 # Try and cope with broken Linux sendfile....
1151 conf
.CHECK_CODE('''#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
1152 #undef _FILE_OFFSET_BITS
1154 #include <sys/sendfile.h>
1158 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1160 '_HAVE_BROKEN_LINUX_SENDFILE',
1161 msg
='Checking for broken linux sendfile support')
1162 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1163 conf
.DEFINE('HAVE_SENDFILE', '1')
1164 conf
.DEFINE('LINUX_SENDFILE_API', '1')
1165 conf
.DEFINE('WITH_SENDFILE', '1')
1166 elif conf
.CONFIG_SET('_HAVE_BROKEN_LINUX_SENDFILE'):
1167 conf
.DEFINE('LINUX_BROKEN_SENDFILE_API', '1')
1168 conf
.DEFINE('WITH_SENDFILE', '1')
1169 elif (host_os
.rfind('freebsd') > -1) or (host_os
.rfind('dragonfly') > -1):
1171 #include <sys/types.h>
1173 #include <sys/socket.h>
1174 #include <sys/uio.h>
1175 int fromfd, tofd, ret, total=0;
1176 off_t offset, nwritten;
1179 hdr.headers = &hdtrl;
1181 hdr.trailers = NULL;
1183 hdtrl.iov_base = NULL;
1185 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0)
1188 msg
='Checking for freebsd sendfile support')
1189 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1190 conf
.DEFINE('HAVE_SENDFILE', '1')
1191 conf
.DEFINE('FREEBSD_SENDFILE_API', '1')
1192 conf
.DEFINE('WITH_SENDFILE', '1')
1193 elif (host_os
.rfind('hpux') > -1):
1195 #include <sys/socket.h>
1196 #include <sys/uio.h>
1199 struct iovec hdtrl[2];
1202 hdtrl[0].iov_base = 0;
1203 hdtrl[0].iov_len = 0;
1204 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
1207 msg
='Checking for hpux sendfile support')
1208 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1209 conf
.DEFINE('HAVE_SENDFILE', '1')
1210 conf
.DEFINE('HPUX_SENDFILE_API', '1')
1211 conf
.DEFINE('WITH_SENDFILE', '1')
1212 elif (host_os
.rfind('solaris') > -1):
1213 conf
.CHECK_FUNCS_IN('sendfile', 'sendfilev')
1215 #include <sys/sendfile.h>,
1218 struct sendfilevec vec[2];
1222 vec[0].sfv_fd = SFV_FD_SELF;
1223 vec[0].sfv_flag = 0;
1227 vec[1].sfv_flag = 0;
1230 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
1233 msg
='Checking for solaris sendfilev support')
1234 if conf
.CONFIG_SET('_HAVE_SENDFILEV'):
1235 conf
.DEFINE('HAVE_SENDFILEV', '1')
1236 conf
.DEFINE('SOLARIS_SENDFILE_API', '1')
1237 conf
.DEFINE('WITH_SENDFILE', '1')
1238 elif (host_os
.rfind('aix') > -1):
1240 #include <sys/socket.h>
1243 struct sf_parms hdtrl;
1245 hdtrl.header_data = 0;
1246 hdtrl.header_length = 0;
1247 hdtrl.file_descriptor = fromfd;
1248 hdtrl.file_offset = 0;
1249 hdtrl.file_bytes = 0;
1250 hdtrl.trailer_data = 0;
1251 hdtrl.trailer_length = 0;
1252 nwritten = send_file(&tofd, &hdtrl, 0);
1255 msg
='Checking for AIX send_file support')
1256 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1257 conf
.DEFINE('HAVE_SENDFILE', '1')
1258 conf
.DEFINE('AIX_SENDFILE_API', '1')
1259 conf
.DEFINE('WITH_SENDFILE', '1')
1261 # Check for getcwd allowing a NULL arg.
1265 char *s = getcwd(NULL,0);
1266 exit(s != NULL ? 0 : 1);
1267 }''', 'GETCWD_TAKES_NULL', addmain
=False, execute
=True,
1268 msg
="getcwd takes a NULL argument")
1271 # UnixWare 7.x has its getspnam in -lgen
1272 conf
.CHECK_FUNCS_IN('getspnam', 'gen')
1273 conf
.CHECK_FUNCS_IN('getspnam', 'security')
1274 conf
.CHECK_FUNCS_IN('getspnam', 'sec')
1276 if Options
.options
.with_quotas
:
1277 # For quotas on Veritas VxFS filesystems
1278 conf
.CHECK_HEADERS('sys/fs/vx_quota.h')
1279 # For quotas on Linux XFS filesystems
1280 conf
.CHECK_HEADERS('linux/dqblk_xfs.h')
1281 # For sys/quota.h and linux/quota.h
1282 conf
.CHECK_HEADERS('sys/quota.h')
1286 # checking for clustering extensions (CTDB)
1288 if not Options
.options
.with_cluster_support
:
1289 have_cluster_support
= False
1293 if Options
.options
.ctdb_dir
:
1294 conf
.ADD_EXTRA_INCLUDES(Options
.options
.ctdb_dir
+ '/include')
1296 srcdir
= os
.path
.realpath(conf
.srcdir
)
1297 if 'EXTRA_INCLUDES' in conf
.env
:
1298 includes
= ' '.join(conf
.env
['EXTRA_INCLUDES']).replace('#', srcdir
+ '/')
1302 have_cluster_support
= True
1307 #include "replace.h"
1308 #include "system/wait.h"
1309 #include "system/network.h"
1310 #define private #error __USED_RESERVED_WORD_private__
1323 msg
='Checking for header ctdb.h')
1325 if not conf
.CONFIG_SET('HAVE_CTDB_H'):
1326 have_cluster_support
= False
1327 ctdb_broken
= "ctdb.h is required for cluster support"
1329 if have_cluster_support
:
1332 #include "replace.h"
1333 #include "system/wait.h"
1334 #include "system/network.h"
1335 #define private #error __USED_RESERVED_WORD_private__
1339 #include <ctdb_private.h>
1346 'HAVE_CTDB_PRIVATE_H',
1349 msg
='Checking for header ctdb_private.h')
1351 if not conf
.CONFIG_SET('HAVE_CTDB_PRIVATE_H'):
1352 have_cluster_support
= False
1353 ctdb_broken
= "ctdb_private.h is required for cluster support"
1355 if have_cluster_support
:
1358 #include "replace.h"
1359 #include "system/wait.h"
1360 #include "system/network.h"
1364 #include <ctdb_private.h>
1368 int i = (int)CTDB_CONTROL_TRANS3_COMMIT;
1372 'HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL',
1375 msg
='Checking for transaction support (TRANS3_COMMIT control)')
1377 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL'):
1378 have_cluster_support
= False
1379 ctdb_broken
= "ctdb transaction support missing or too old"
1381 if have_cluster_support
:
1384 #include "replace.h"
1385 #include "system/wait.h"
1386 #include "system/network.h"
1390 #include <ctdb_private.h>
1394 int i = (int)CTDB_CONTROL_SCHEDULE_FOR_DELETION;
1398 'HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL',
1401 msg
='Checking for SCHEDULE_FOR_DELETION control')
1403 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL'):
1404 if not Options
.options
.enable_old_ctdb
:
1405 have_cluster_support
= False
1406 ctdb_broken
= "SCHEDULE_FOR_DELETION control missing"
1408 Logs
.warn("ignoring missing SCHEDULE_FOR_DELETION control (--enable-old-ctdb)")
1410 if have_cluster_support
:
1413 #include "replace.h"
1414 #include "system/wait.h"
1415 #include "system/network.h"
1419 #include <ctdb_private.h>
1423 struct ctdb_control_tcp _x;
1427 'HAVE_STRUCT_CTDB_CONTROL_TCP',
1430 msg
='Checking for ctdb ipv4 support')
1432 if not conf
.CONFIG_SET('HAVE_STRUCT_CTDB_CONTROL_TCP'):
1433 have_cluster_support
= False
1434 ctdb_broken
= "missing struct ctdb_control_tcp"
1436 if have_cluster_support
:
1439 #include "replace.h"
1440 #include "system/wait.h"
1441 #include "system/network.h"
1445 #include <ctdb_private.h>
1449 struct ctdb_control_tcp_addr _x;
1453 'HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR',
1456 msg
='Checking for ctdb ipv6 support')
1458 if have_cluster_support
:
1461 #include "replace.h"
1462 #include "system/wait.h"
1463 #include "system/network.h"
1467 #include <ctdb_private.h>
1471 int i = (int)CTDB_CONTROL_CHECK_SRVIDS;
1475 'HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL',
1478 msg
='Checking for CHECK_SRVIDS control')
1480 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL'):
1481 if not Options
.options
.enable_old_ctdb
:
1482 have_cluster_support
= False
1483 ctdb_broken
= "CHECK_SRVIDS control missing"
1485 Logs
.warn("ignoring missing CHECK_SRVIDS control (--enable-old-ctdb)")
1487 if have_cluster_support
:
1488 Logs
.info("building with cluster support")
1489 conf
.DEFINE('CLUSTER_SUPPORT', 1);
1491 if not Options
.options
.with_cluster_support
:
1492 Logs
.info("building without cluster support")
1494 Logs
.warn("building without cluster support: " + ctdb_broken
)
1495 conf
.undefine('CLUSTER_SUPPORT')
1499 conf
.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }',
1500 'HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR',
1503 msg
='Checking whether we can compile with __attribute__((destructor))')
1505 conf
.CHECK_CODE('void seekdir(DIR *d, long loc) { return; }',
1506 'SEEKDIR_RETURNS_VOID',
1507 headers
='sys/types.h dirent.h',
1508 msg
='Checking whether seekdir returns void')
1510 if Options
.options
.with_profiling_data
:
1511 conf
.DEFINE('WITH_PROFILE', 1);
1513 PTHREAD_CFLAGS
='error'
1514 PTHREAD_LDFLAGS
='error'
1516 if PTHREAD_LDFLAGS
== 'error':
1517 if conf
.CHECK_FUNCS_IN('pthread_attr_init', 'pthread'):
1518 PTHREAD_CFLAGS
='-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS'
1519 PTHREAD_LDFLAGS
='-lpthread'
1520 if PTHREAD_LDFLAGS
== 'error':
1521 if conf
.CHECK_FUNCS_IN('pthread_attr_init', 'pthreads'):
1522 PTHREAD_CFLAGS
='-D_THREAD_SAFE'
1523 PTHREAD_LDFLAGS
='-lpthreads'
1524 if PTHREAD_LDFLAGS
== 'error':
1525 if conf
.CHECK_FUNCS_IN('pthread_attr_init', 'c_r'):
1526 PTHREAD_CFLAGS
='-D_THREAD_SAFE -pthread'
1527 PTHREAD_LDFLAGS
='-pthread'
1528 if PTHREAD_LDFLAGS
== 'error':
1529 if conf
.CHECK_FUNC('pthread_attr_init'):
1530 PTHREAD_CFLAGS
='-D_REENTRANT'
1531 PTHREAD_LDFLAGS
='-lpthread'
1532 # especially for HP-UX, where the CHECK_FUNC macro fails to test for
1533 # pthread_attr_init. On pthread_mutex_lock it works there...
1534 if PTHREAD_LDFLAGS
== 'error':
1535 if conf
.CHECK_FUNCS_IN('pthread_mutex_lock', 'pthread'):
1536 PTHREAD_CFLAGS
='-D_REENTRANT'
1537 PTHREAD_LDFLAGS
='-lpthread'
1539 if PTHREAD_CFLAGS
!= 'error' and PTHREAD_LDFLAGS
!= 'error':
1540 conf
.ADD_CFLAGS(PTHREAD_CFLAGS
)
1541 conf
.ADD_LDFLAGS(PTHREAD_LDFLAGS
)
1542 conf
.CHECK_HEADERS('pthread.h')
1543 conf
.DEFINE('HAVE_PTHREAD', '1')
1545 if Options
.options
.with_pthreadpool
:
1546 if conf
.CONFIG_SET('HAVE_PTHREAD'):
1547 conf
.DEFINE('WITH_PTHREADPOOL', '1')
1549 Logs
.warn("pthreadpool support cannot be enabled when pthread support was not found")
1550 conf
.undefine('WITH_PTHREADPOOL')
1552 if conf
.CHECK_HEADERS('gpfs_gpl.h'):
1553 conf
.DEFINE('HAVE_GPFS', '1')
1555 # Note that all charset 'modules' must actually be static, due to dependency loop issues
1556 # if we include the module loader in iconv
1558 default_static_modules
=TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
1559 auth_sam auth_unix auth_winbind auth_wbc auth_server
1560 auth_domain auth_builtin vfs_default
1561 nss_info_template idmap_tdb idmap_passdb
1564 default_shared_modules
=TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
1565 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
1566 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2
1567 auth_script vfs_readahead vfs_xattr_tdb vfs_posix_eadb
1568 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
1569 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
1570 vfs_crossrename vfs_linux_xfs_sgid
1571 vfs_time_audit idmap_autorid''')
1573 if Options
.options
.developer
:
1574 default_static_modules
.extend(TO_LIST('pdb_ads auth_netlogond charset_weird'))
1575 default_shared_modules
.extend(TO_LIST('perfcount_test'))
1576 default_shared_modules
.extend(TO_LIST('vfs_skel_opaque vfs_skel_transparent vfs_shadow_copy_test'))
1577 default_shared_modules
.extend(TO_LIST('auth_skel pdb_test'))
1579 default_static_modules
.extend(TO_LIST('pdb_samba4 auth_samba4 vfs_dfs_samba4'))
1581 if Options
.options
.with_acl_support
and conf
.CONFIG_SET('HAVE_POSIX_ACLS'):
1582 default_static_modules
.extend(TO_LIST('vfs_posixacl'))
1584 if conf
.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'):
1585 default_shared_modules
.extend(TO_LIST('vfs_zfsacl'))
1587 if conf
.CONFIG_SET('HAVE_DIRFD_DECL'):
1588 default_shared_modules
.extend(TO_LIST('vfs_syncops vfs_dirsort'))
1590 if conf
.CONFIG_SET('HAVE_STATFS_F_FSID'):
1591 default_shared_modules
.extend(TO_LIST('vfs_fileid'))
1593 if conf
.CONFIG_SET('HAVE_AIO') and (conf
.CONFIG_SET('HAVE_MSGHDR_MSG_CONTROL') or conf
.CONFIG_SET('HAVE_MSGHDR_MSG_ACCTRIGHTS')):
1594 default_shared_modules
.extend(TO_LIST('vfs_aio_fork'))
1596 if conf
.CONFIG_SET('HAVE_AIO') and Options
.options
.with_pthreadpool
:
1597 default_shared_modules
.extend(TO_LIST('vfs_aio_pthread'))
1599 if conf
.CONFIG_SET('HAVE_AIO') and conf
.CONFIG_SET('HAVE_LINUX_KERNEL_AIO'):
1600 default_shared_modules
.extend(TO_LIST('vfs_aio_linux'))
1602 if conf
.CONFIG_SET('HAVE_LDAP'):
1603 default_static_modules
.extend(TO_LIST('pdb_ldap idmap_ldap'))
1605 if conf
.CONFIG_SET('DARWINOS'):
1606 default_static_modules
.extend(TO_LIST('charset_macosxfs'))
1608 if conf
.CONFIG_SET('HAVE_GPFS'):
1609 default_shared_modules
.extend(TO_LIST('vfs_gpfs vfs_gpfs_hsm_notify'))
1611 explicit_shared_modules
= TO_LIST(Options
.options
.shared_modules
, delimiter
=',')
1612 explicit_static_modules
= TO_LIST(Options
.options
.static_modules
, delimiter
=',')
1614 final_static_modules
= default_static_modules
1615 final_shared_modules
= default_shared_modules
1617 for m
in explicit_static_modules
:
1618 if m
in final_shared_modules
:
1619 final_shared_modules
.remove(m
)
1620 final_static_modules
.append(m
)
1621 for m
in explicit_shared_modules
:
1622 if m
in final_static_modules
:
1623 final_static_modules
.remove(m
)
1624 final_shared_modules
.append(m
)
1626 conf
.env
['static_modules'] = final_static_modules
1627 conf
.env
['shared_modules'] = final_shared_modules
1629 conf
.DEFINE('STRING_STATIC_MODULES', ' '.join(final_static_modules
), quote
=True)
1634 prefixes
= ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
1635 conf
.env
['MODULE_PREFIXES'] = prefixes
1637 for m
in final_static_modules
:
1639 if not p
in static_list
:
1641 static_list
[p
].append(m
)
1642 for m
in final_shared_modules
:
1644 if not p
in shared_list
:
1646 shared_list
[p
].append(m
)
1649 static_env
= "%s_STATIC" % p
.upper()
1650 shared_env
= "%s_SHARED" % p
.upper()
1651 conf
.env
[static_env
] = []
1652 conf
.env
[shared_env
] = []
1653 if p
in static_list
:
1655 for entry
in static_list
[p
]:
1656 decl_list
+= "extern NTSTATUS %s_init(void); " % entry
1657 conf
.env
[static_env
].append('%s' % entry
)
1658 decl_list
= decl_list
.rstrip()
1659 conf
.DEFINE('static_decl_%s' % p
, decl_list
)
1660 conf
.DEFINE('static_init_%s' % p
, '{ %s_init(); }' % '_init(); '.join(static_list
[p
]))
1662 conf
.DEFINE('static_decl_%s' % p
, '')
1663 conf
.DEFINE('static_init_%s' % p
, '{}')
1664 if p
in shared_list
:
1665 for entry
in shared_list
[p
]:
1666 conf
.DEFINE('%s_init' % entry
, 'samba_init_module')
1667 conf
.env
[shared_env
].append('%s' % entry
)
1669 conf
.SAMBA_CONFIG_H('include/config.h')
1672 "build 'tags' file using ctags"
1674 source_root
= os
.path
.dirname(Utils
.g_module
.root_path
)
1675 cmd
= 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
1676 print("Running: %s" % cmd
)