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)
25 opt
.SAMBA3_ADD_OPTION('winbind')
26 opt
.SAMBA3_ADD_OPTION('swat')
27 opt
.SAMBA3_ADD_OPTION('ads', default
=None) # None means autodetection
28 opt
.SAMBA3_ADD_OPTION('ldap')
29 opt
.SAMBA3_ADD_OPTION('cups', with_name
="enable", without_name
="disable")
30 opt
.SAMBA3_ADD_OPTION('iprint', with_name
="enable", without_name
="disable")
31 opt
.SAMBA3_ADD_OPTION('pam')
32 opt
.SAMBA3_ADD_OPTION('pam_smbpass')
33 opt
.SAMBA3_ADD_OPTION('quotas')
34 opt
.SAMBA3_ADD_OPTION('sendfile-support')
35 opt
.SAMBA3_ADD_OPTION('utmp')
36 opt
.SAMBA3_ADD_OPTION('pthreadpool', with_name
="enable", without_name
="disable", default
=True)
37 opt
.SAMBA3_ADD_OPTION('avahi', with_name
="enable", without_name
="disable")
38 opt
.SAMBA3_ADD_OPTION('iconv')
39 opt
.SAMBA3_ADD_OPTION('acl-support')
40 opt
.SAMBA3_ADD_OPTION('dnsupdate')
41 opt
.SAMBA3_ADD_OPTION('syslog')
42 opt
.SAMBA3_ADD_OPTION('automount')
43 opt
.SAMBA3_ADD_OPTION('aio-support')
44 opt
.SAMBA3_ADD_OPTION('dmapi', default
=None) # None means autodetection
45 opt
.SAMBA3_ADD_OPTION('fam', default
=None) # None means autodetection
46 opt
.SAMBA3_ADD_OPTION('profiling-data', default
=False)
48 opt
.SAMBA3_ADD_OPTION('cluster-support', default
=None)
50 opt
.add_option('--with-ctdb-dir',
51 help=("Directory under which ctdb is installed"),
52 action
="store", dest
='ctdb_dir', default
=None)
53 opt
.add_option('--enable-old-ctdb',
54 help=("enable building against (too) old version of ctdb (default=false)"),
55 action
="store_true", dest
='enable_old_ctdb', default
=False)
60 from samba_utils
import TO_LIST
62 default_static_modules
= []
63 default_shared_modules
= []
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 syscall sysconf')
85 conf
.CHECK_FUNCS('atexit grantpt posix_openpt 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_FUNCS_IN('dn_expand', 'inet')
102 conf
.CHECK_DECLS('fdatasync', reverse
=True)
103 conf
.CHECK_DECLS('readahead', reverse
=True, headers
='fcntl.h')
105 if conf
.CONFIG_SET('HAVE_LONG_LONG'):
106 conf
.DEFINE('HAVE_LONGLONG', 1)
108 if conf
.CHECK_CODE('''
109 #if defined(HAVE_UNISTD_H)
112 long ret = splice(0,0,1,0,400,SPLICE_F_MOVE);
116 conf
.CHECK_DECLS('splice', reverse
=True, headers
='fcntl.h')
118 # Check for inotify support
119 conf
.CHECK_HEADERS('sys/inotify.h')
120 if "HAVE_SYS_INOTIFY_H" in conf
.env
:
121 conf
.DEFINE('HAVE_INOTIFY', 1)
123 # Check for kernel change notify support
126 #define F_NOTIFY 1026
129 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
130 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain
=False, execute
=True,
131 headers
='fcntl.h signal.h',
132 msg
="Checking for kernel change notify support")
134 # Check for Linux kernel oplocks
136 #include <sys/types.h>
140 #define F_NOTIFY 1026
143 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
144 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain
=False, execute
=True,
145 msg
="Checking for Linux kernel oplocks")
147 # Check for IRIX kernel oplock types
148 conf
.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
149 'HAVE_KERNEL_OPLOCKS_IRIX', headers
='fcntl.h',
150 msg
="Checking for IRIX kernel oplock types")
152 # Check for kernel share modes
154 #include <sys/types.h>
157 #include <sys/file.h>
163 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
164 }''', 'HAVE_KERNEL_SHARE_MODES', addmain
=False, execute
=True,
165 msg
="Checking for kernel share modes")
170 if Options
.options
.with_fam
is None:
172 elif Options
.options
.with_fam
== True:
175 if check_for_fam
and conf
.CHECK_HEADERS('fam.h'):
176 if conf
.CHECK_FUNCS_IN('FAMOpen2', 'fam'):
178 elif conf
.CHECK_FUNCS_IN('FAMOpen2', 'fam C'):
179 samba_fam_libs
='fam C'
180 conf
.CHECK_TYPE('enum FAMCodes', headers
='fam.h',
181 define
='HAVE_FAM_H_FAMCODES_TYPEDEF',
182 msg
='Checking whether enum FAMCodes is available')
183 conf
.CHECK_FUNCS_IN('FAMNoExists', 'fam')
185 if samba_fam_libs
is not None:
186 conf
.DEFINE('SAMBA_FAM_LIBS', samba_fam_libs
)
188 if Options
.options
.with_fam
== True:
189 conf
.fatal('FAM support requested, but no suitable FAM library found')
191 Logs
.warn('no suitable FAM library found')
193 # check for DMAPI libs
194 Logs
.info("Checking for DMAPI library existence")
195 conf
.env
['dmapi_lib'] = ''
197 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'dm'):
198 samba_dmapi_lib
= 'dm'
200 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'jfsdm'):
201 samba_dmapi_lib
= 'jfsdm'
203 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'dmapi'):
204 samba_dmapi_lib
= 'dmapi'
206 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'xdsm'):
207 samba_dmapi_lib
= 'xdsm'
208 # only bother to test headers and compilation when a candidate
209 # library has been found
210 if Options
.options
.with_dmapi
== True and samba_dmapi_lib
== '':
211 conf
.fatal('DMAPI support requested, but no suitable DMAPI library found')
213 conf
.CHECK_HEADERS('sys/dmi.h xfs/dmapi.h sys/jfsdmapi.h sys/dmapi.h dmapi.h')
215 #include <time.h> /* needed by Tru64 */
216 #include <sys/types.h> /* needed by AIX */
217 #ifdef HAVE_XFS_DMAPI_H
218 #include <xfs/dmapi.h>
219 #elif defined(HAVE_SYS_DMI_H)
221 #elif defined(HAVE_SYS_JFSDMAPI_H)
222 #include <sys/jfsdmapi.h>
223 #elif defined(HAVE_SYS_DMAPI_H)
224 #include <sys/dmapi.h>
225 #elif defined(HAVE_DMAPI_H)
229 /* This link test is designed to fail on IRI 6.4, but should
230 * succeed on Linux, IRIX 6.5 and AIX.
232 int main(int argc, char **argv)
235 dm_eventset_t events;
236 /* This doesn't take an argument on IRIX 6.4. */
237 dm_init_service(&version);
238 /* IRIX 6.4 expects events to be a pointer. */
239 DMEV_ISSET(DM_EVENT_READ, events);
248 msg
='Checking whether DMAPI lib '+samba_dmapi_lib
+' can be used')
250 if conf
.CONFIG_SET('USE_DMAPI'):
251 conf
.env
['dmapi_lib'] = samba_dmapi_lib
253 if Options
.options
.with_dmapi
== True:
254 conf
.fatal('DMAPI support requested but not found');
256 # Check for various members of the stat structure
257 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define
='HAVE_STAT_ST_BLOCKS',
258 headers
='sys/stat.h')
259 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define
='HAVE_STAT_ST_BLKSIZE',
260 headers
='sys/stat.h')
261 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_flags', define
='HAVE_STAT_ST_FLAGS',
262 headers
='sys/types.h sys/stat.h unistd.h')
264 if "HAVE_BLKCNT_T" in conf
.env
:
266 return sizeof(blkcnt_t) == 4 ? 0 : 1''',
267 'SIZEOF_BLKCNT_T_4', execute
=True,
268 headers
='replace.h sys/types.h sys/stat.h unistd.h',
269 msg
="Checking whether blkcnt_t is 32 bit")
271 if "HAVE_BLKCNT_T" in conf
.env
:
273 return sizeof(blkcnt_t) == 8 ? 0 : 1''',
274 'SIZEOF_BLKCNT_T_8', execute
=True,
275 headers
='replace.h sys/types.h sys/stat.h unistd.h',
276 msg
="Checking whether blkcnt_t is 64 bit")
278 # Check for POSIX capability support
279 conf
.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers
='sys/capability.h')
281 if "HAVE_SYS_CAPABILITY_H" in conf
.env
:
285 if (!(cap = cap_get_proc())) exit(1);
287 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
288 cap_set_proc(cap);''',
289 'HAVE_POSIX_CAPABILITIES', execute
=True, lib
="cap",
290 headers
='sys/capability.h',
291 msg
="Checking whether POSIX capabilities are available")
293 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
294 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
296 if conf
.CONFIG_SET("HAVE_RPC_RPC_H"):
297 conf
.CHECK_TYPE('int16', headers
='rpc/rpc.h',
298 define
='HAVE_INT16_FROM_RPC_RPC_H',
299 msg
="Checking for int16 typedef included by rpc/rpc.h")
300 conf
.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
301 headers
='sys/types.h rpc/rpc.h',
302 msg
="Checking for uint16 typedef included by rpc/rpc.h")
303 conf
.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
304 headers
='sys/types.h rpc/rpc.h',
305 msg
="Checking for int32 typedef included by rpc/rpc.h")
306 conf
.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
307 headers
='sys/types.h rpc/rpc.h',
308 msg
="Checking for uint32 typedef included by rpc/rpc.h")
309 conf
.CHECK_CODE('int i;', 'BROKEN_NISPLUS_INCLUDE_FILES',
310 headers
='sys/types.h sys/acl.h rpcsvc/nis.h',
311 msg
="Checking for broken nisplus include files")
313 # Check if the compiler will optimize out functions
316 this_function_does_not_exist();
319 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
320 msg
="Checking if the compiler will optimize out functions")
322 # Check if the compiler supports the LL suffix on long long integers
324 conf
.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL',
326 msg
="Checking for LL suffix on long long integers")
330 bindtextdomain _chdir __chdir chflags chmod _close __close _closedir
331 __closedir crypt16 devnm dgettext dirfd
332 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
334 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
336 fsetxattr _fstat __fstat fsync
337 futimens futimes __fxstat getauthuid
338 getcwd _getcwd __getcwd getdents __getdents getdirentries
339 getgrent getgrnam getgrouplist getgrset getmntent getpagesize
340 getpwanam getpwent_r getrlimit gettext
341 glob grantpt hstrerror initgroups innetgr
342 llseek _llseek __llseek _lseek __lseek
343 _lstat __lstat lutimes
344 __lxstat memalign mknod mlock mlockall munlock munlockall
345 _open __open _opendir __opendir
346 pathconf poll posix_fallocate
347 posix_memalign prctl pread _pread __pread
348 pwrite _pwrite __pwrite
349 rdchk _read __read _readdir __readdir
351 select setenv setgidx setgroups setlocale setluid
352 setmntent setpgid setpriv setsid setuidx
353 shmget shm_open sigaction sigblock sigprocmask sigset
355 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctl sysctlbyname
356 __sys_llseek syslog _telldir __telldir textdomain timegm
357 utimensat vsyslog _write __write __xstat
361 #ifdef HAVE_SYS_PRCTL_H
362 #include <sys/prctl.h>
366 'HAVE_PRCTL', link
=False)
368 conf
.CHECK_SAMBA3_CHARSET() # see build/charset.py
370 # FIXME: these should be tests for features, but the old build system just
372 host_os
= sys
.platform
373 Logs
.info("building on %s" % host_os
)
375 # Python doesn't have case switches... :/
376 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
377 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
379 conf
.SET_TARGET_TYPE('sunacl', 'EMPTY')
380 if (host_os
.rfind('linux') > -1) or (host_os
.rfind('gnu') > -1) or (host_os
.rfind('qnx') > -1):
381 if host_os
.rfind('linux') > -1:
382 conf
.DEFINE('LINUX', '1')
383 elif host_os
.rfind('qnx') > -1:
384 conf
.DEFINE('QNX', '1')
385 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
386 elif (host_os
.rfind('darwin') > -1):
387 conf
.DEFINE('DARWINOS', 1)
388 conf
.ADD_CFLAGS('-fno-common')
389 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
390 elif (host_os
.rfind('freebsd') > -1):
391 conf
.DEFINE('FREEBSD', 1)
392 if conf
.CHECK_HEADERS('sunacl.h'):
393 conf
.DEFINE('HAVE_FREEBSD_SUNACL_H', '1')
394 conf
.CHECK_FUNCS_IN('acl', 'sunacl')
395 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
396 elif (host_os
.rfind('irix') > -1):
397 conf
.DEFINE('IRIX', 1)
398 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
399 elif (host_os
.rfind('aix') > -1):
400 conf
.DEFINE('AIX', 1)
401 conf
.DEFINE('STAT_ST_BLOCKSIZE', 'DEV_BSIZE')
402 elif (host_os
.rfind('hpux') > -1):
403 conf
.DEFINE('HPUX', 1)
404 conf
.DEFINE('STAT_ST_BLOCKSIZE', '8192')
405 elif (host_os
.rfind('osf') > -1):
406 conf
.DEFINE('OSF1', 1)
407 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
409 # FIXME: Add more checks here.
411 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
413 if Options
.options
.with_acl_support
:
414 if (host_os
.rfind('sysv5') > -1) and conf
.CHECK_FUNCS_IN('sec', 'facl', checklibc
=True):
415 Logs
.info('Using UnixWare ACLs')
416 conf
.DEFINE('HAVE_UNIXWARE_ACLS',1)
417 default_static_modules
.extend(TO_LIST('vfs_solarisacl'))
418 elif (host_os
.rfind('solaris') > -1) and conf
.CHECK_FUNCS_IN('sec', 'facl'):
419 Logs
.info('Using solaris ACLs')
420 conf
.DEFINE('HAVE_SOLARIS_ACLS',1)
421 default_static_modules
.extend(TO_LIST('vfs_solarisacl'))
422 elif (host_os
.rfind('hpux') > -1):
423 Logs
.info('Using HPUX ACLs')
424 conf
.DEFINE('HAVE_HPUX_ACLS',1)
425 conf
.DEFINE('POSIX_ACL_NEEDS_MASK',1)
426 default_static_modules
.extend(TO_LIST('vfs_hpuxacl'))
427 elif (host_os
.rfind('irix') > -1):
428 Logs
.info('Using IRIX ACLs')
429 conf
.DEFINE('HAVE_IRIX_ACLS',1)
430 default_static_modules
.extend(TO_LIST('vfs_irixacl'))
431 elif (host_os
.rfind('aix') > -1):
432 Logs
.info('Using AIX ACLs')
433 conf
.DEFINE('HAVE_AIX_ACLS',1)
434 default_static_modules
.extend(TO_LIST('vfs_aixacl'))
435 elif (host_os
.rfind('osf') > -1) and conf
.CHECK_FUNCS_IN('pacl', 'acl_get_fd'):
436 Logs
.info('Using Tru64 ACLs')
437 conf
.DEFINE('HAVE_TRU64_ACLS',1)
438 default_static_modules
.extend(TO_LIST('vfs_tru64acl'))
439 elif (host_os
.rfind('darwin') > -1):
440 Logs
.warn('ACLs on Dwarwin currently not supported')
442 conf
.CHECK_FUNCS_IN('acl_get_file', 'acl')
443 if conf
.CHECK_CODE('''
446 acl_entry_t *entry_p;
447 return acl_get_entry(acl, entry_id, entry_p);
450 headers
='sys/types.h sys/acl.h', link
=False,
451 msg
="Checking for POSIX ACL support") :
453 acl_permset_t permset_d;
455 return acl_get_perm_np(permset_d, perm);
457 'HAVE_ACL_GET_PERM_NP',
458 headers
='sys/types.h sys/acl.h', link
=True,
459 msg
="Checking whether acl_get_perm_np() is available")
460 default_static_modules
.extend(TO_LIST('vfs_posixacl'))
463 if conf
.CHECK_FUNCS('dirfd'):
464 conf
.DEFINE('HAVE_DIRFD_DECL', 1)
466 conf
.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
467 'HAVE_STATFS_F_FSID',
468 msg
="vfs_fileid: checking for statfs() and struct statfs.f_fsid",
469 headers
='sys/types.h sys/statfs.h',
472 if conf
.CONFIG_SET('HAVE_FALLOCATE'):
474 int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
475 'HAVE_LINUX_FALLOCATE',
476 msg
="Checking whether the Linux 'fallocate' function is available",
477 headers
='unistd.h sys/types.h fcntl.h linux/falloc.h')
479 ssize_t err = readahead(0,0,0x80000);''',
480 'HAVE_LINUX_READAHEAD',
481 msg
="Checking whether Linux readahead is available",
482 headers
='unistd.h fcntl.h')
483 conf
.CHECK_DECLS('readahead', headers
='fcntl.h', always
=True)
485 conf
.CHECK_CODE('int fd = openat(AT_FDCWD, ".", O_RDONLY);',
487 msg
='Checking for openat',
490 if Options
.options
.with_aio_support
:
491 conf
.CHECK_FUNCS_IN('aio_read', 'aio')
492 conf
.CHECK_FUNCS_IN('aio_read', 'rt')
493 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);',
495 msg
='Checking for asynchronous io support',
496 headers
='sys/types.h aio.h',
498 if conf
.CONFIG_SET('HAVE_AIO'):
499 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg
='Checking for aio_read', headers
='aio.h', lib
='aio rt')
500 conf
.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg
='Checking for aio_write', headers
='aio.h', lib
='aio rt')
501 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')
502 conf
.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg
='Checking for aio_return', headers
='aio.h', lib
='aio rt')
503 conf
.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg
='Checking for aio_error', headers
='aio.h', lib
='aio rt')
504 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')
505 conf
.CHECK_CODE('struct aiocb a; struct timespec t; return aio_suspend(&a, 1, &t);', 'HAVE_AIO_SUSPEND', msg
='Checking for aio_suspend', headers
='aio.h', lib
='aio rt')
506 if not conf
.CONFIG_SET('HAVE_AIO'):
507 conf
.DEFINE('HAVE_NO_AIO', '1')
509 conf
.DEFINE('HAVE_NO_AIO', '1')
511 if host_os
.rfind('linux') > -1:
512 conf
.CHECK_FUNCS_IN('io_submit', 'aio')
514 struct io_event ioev;
520 fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
521 io_queue_init(128,&ctx);
522 io_prep_pwrite(ioc, 1, buf, 1, 0);
523 io_prep_pread(ioc, 1, buf, 1, 0);
524 io_set_eventfd(ioc, fd);
525 io_set_callback(ioc, (io_callback_t)(0));
526 io_submit(ctx, 1, &ioc);
527 io_getevents(ctx, 1, 1, &ioev, &ts);
529 'HAVE_LINUX_KERNEL_AIO',
530 msg
='Checking for linux kernel asynchronous io support',
531 headers
='unistd.h stdlib.h sys/types.h fcntl.h sys/eventfd.h libaio.h',
538 char control[CMSG_SPACE(sizeof(int))];
540 msg.msg_control = control_un.control;
541 msg.msg_controllen = sizeof(control_un.control);
543 'HAVE_MSGHDR_MSG_CONTROL',
544 msg
='Checking if we can use msg_control for passing file descriptors',
545 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
549 msg.msg_acctrights = (caddr_t) &fd;
550 msg.msg_acctrightslen = sizeof(fd);
552 'HAVE_MSGHDR_MSG_ACCTRIGHTS',
553 msg
='Checking if we can use msg_acctrights for passing file descriptors',
554 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
556 if Options
.options
.with_winbind
:
557 conf
.env
.build_winbind
= True
558 conf
.DEFINE('WITH_WINBIND', '1')
560 conf
.find_program('awk', var
='AWK')
561 conf
.find_program('perl', var
='PERL')
563 conf
.CHECK_HEADERS('asm/types.h')
565 conf
.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
566 headers
='unistd.h sys/types.h',
567 msg
="Checking for major macro")
569 conf
.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
570 headers
='unistd.h sys/types.h',
571 msg
="Checking for minor macro")
573 conf
.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
574 headers
='unistd.h sys/types.h dirent.h',
575 define
='HAVE_DIRENT_D_OFF')
577 conf
.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent')
578 if conf
.CHECK_CFLAGS('-Werror-implicit-function-declaration'):
579 netgrent_cflags
= '-Werror-implicit-function-declaration'
582 conf
.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE',
583 msg
="Checking for setnetgrent prototype",
584 headers
='netdb.h netgroup.h',
585 cflags
=netgrent_cflags
)
586 conf
.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE',
587 msg
="Checking for getnetgrent prototype",
588 headers
='netdb.h netgroup.h',
589 cflags
=netgrent_cflags
)
590 conf
.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE',
591 msg
="Checking for endnetgrent prototype",
592 headers
='netdb.h netgroup.h',
593 cflags
=netgrent_cflags
)
597 if Options
.options
.with_cups
:
598 conf
.find_program('cups-config', var
='CUPS_CONFIG')
599 if conf
.env
.CUPS_CONFIG
:
600 # we would normally use --libs here, but cups-config incorrectly adds
601 # gssapi_krb5 and other libraries to its --libs output. That breaks the use
602 # of an in-tree heimdal kerberos
603 conf
.check_cfg(path
=conf
.env
.CUPS_CONFIG
, args
="--cflags --ldflags",
604 package
="", uselib_store
="CUPS")
605 conf
.CHECK_HEADERS('cups/cups.h cups/language.h', lib
='cups')
606 conf
.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups')
607 if conf
.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf
.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
608 conf
.DEFINE('HAVE_CUPS', '1')
610 conf
.undefine('HAVE_CUPS')
611 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
613 # define an empty subsystem for cups, to allow it to be used as an empty dependency
614 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
616 if Options
.options
.with_iprint
:
617 if conf
.CONFIG_SET('HAVE_CUPS'):
618 conf
.DEFINE('HAVE_IPRINT', '1')
620 Logs
.warn("--enable-iprint=yes but cups support not sufficient")
621 if Options
.options
.with_syslog
:
622 conf
.DEFINE('WITH_SYSLOG', '1')
623 if Options
.options
.with_automount
:
624 conf
.DEFINE('WITH_AUTOMOUNT', '1')
627 if Options
.options
.with_ldap
:
628 conf
.CHECK_HEADERS('ldap.h lber.h ldap_pvt.h')
629 conf
.CHECK_TYPE('ber_tag_t', 'unsigned int', headers
='ldap.h lber.h')
630 conf
.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
631 conf
.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers
='ldap.h')
633 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
635 conf
.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
636 define
='HAVE_LBER_LOG_PRINT_FN', headers
='lber.h')
638 conf
.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', 'ldap')
639 conf
.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
641 # Check if ldap_set_rebind_proc() takes three arguments
642 if conf
.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
643 'LDAP_SET_REBIND_PROC_ARGS',
644 msg
="Checking whether ldap_set_rebind_proc takes 3 arguments",
645 headers
='ldap.h lber.h', link
=False):
646 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
648 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
650 # last but not least, if ldap_init() exists, we want to use ldap
651 if conf
.CONFIG_SET('HAVE_LDAP_INIT') and conf
.CONFIG_SET('HAVE_LDAP_H'):
652 conf
.DEFINE('HAVE_LDAP', '1')
653 conf
.DEFINE('LDAP_DEPRECATED', '1')
654 conf
.env
['HAVE_LDAP'] = '1'
655 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
656 # SASL wrapping hooks
657 if conf
.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
658 conf
.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
659 conf
.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
661 conf
.SET_TARGET_TYPE('ldap', 'EMPTY')
662 conf
.SET_TARGET_TYPE('lber', 'EMPTY')
664 if Options
.options
.with_ads
== False:
672 if not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and \
673 not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC'):
674 Logs
.warn("arcfour-hmac-md5 encryption type not found in -lkrb5")
676 if not conf
.CONFIG_SET('HAVE_KRB5_MK_REQ_EXTENDED'):
677 Logs
.warn("krb5_mk_req_extended not found in -lkrb5")
679 if not conf
.CONFIG_SET('HAVE_KRB5_GET_HOST_REALM'):
680 Logs
.warn("krb5_get_host_realm not found in -lkrb5")
682 if not conf
.CONFIG_SET('HAVE_KRB5_FREE_HOST_REALM'):
683 Logs
.warn("krb5_free_host_realm not found in -lkrb5")
685 if not conf
.CONFIG_SET('HAVE_KRB5_FWD_TGT_CREDS'):
686 Logs
.warn("krb5_fwd_tgt_creds found in -lkrb5")
688 if not conf
.CONFIG_SET('HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC'):
689 Logs
.warn("krb5_get_init_creds_opt_alloc not found in -lkrb5")
691 if not conf
.CONFIG_SET('KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT'):
692 Logs
.warn("krb5_get_init_creds_opt_free was not found or was too old in -lkrb5")
694 if not conf
.CONFIG_SET('HAVE_KRB5_GET_RENEWED_CREDS'):
695 Logs
.warn("krb5_get_renewed_creds not found in -lkrb5")
697 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL_COMPARE_ANY_REALM'):
698 Logs
.warn("krb5_principal_compare_any_realm not found in -lkrb5")
700 if not conf
.CONFIG_SET('HAVE_KRB5_C_STRING_TO_KEY') and \
701 not conf
.CONFIG_SET('HAVE_KRB5_STRING_TO_KEY_SALT'):
702 Logs
.warn("krb5_c_string_to_key not found in -lkrb5")
704 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL2SALT') and \
705 not conf
.CONFIG_SET('HAVE_KRB5_GET_PW_SALT'):
706 Logs
.warn("no CREATE_KEY_FUNCTIONS detected")
708 if not conf
.CONFIG_SET('HAVE_KRB5_GET_PERMITTED_ENCTYPES') and \
709 not conf
.CONFIG_SET('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES'):
710 Logs
.warn("no GET_ENCTYPES_FUNCTIONS detected")
712 if not conf
.CONFIG_SET('HAVE_KRB5_KT_FREE_ENTRY') and \
713 not conf
.CONFIG_SET('HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS'):
714 Logs
.warn("no KT_FREE_FUNCTION detected")
716 if not conf
.CONFIG_SET('HAVE_KRB5_C_VERIFY_CHECKSUM'):
717 Logs
.warn("krb5_c_verify_checksum_compare not found in -lkrb5")
720 # We don't actually use
721 # gsskrb5_extract_authz_data_from_sec_context, but it is a
722 # clue that this Heimdal, which does the PAC processing we
723 # need on the standard gss_inquire_sec_context_by_oid
724 if not conf
.CONFIG_SET('HAVE_GSS_GET_NAME_ATTRIBUTE') and \
725 not (conf
.CONFIG_SET('HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT') and \
726 conf
.CONFIG_SET('HAVE_GSS_INQUIRE_SEC_CONTEXT_BY_OID')):
727 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")
730 if not conf
.CONFIG_SET('HAVE_GSS_KRB5_EXPORT_LUCID_SEC_CONTEXT'):
731 Logs
.warn("need gss_krb5_export_lucid_sec_context for SPNEGO and gss_wrap support")
735 conf
.DEFINE('HAVE_KRB5', '1')
736 conf
.env
['HAVE_KRB5'] = '1'
738 conf
.undefine('HAVE_KRB5_H')
739 conf
.undefine('HAVE_GSSAPI_H')
740 conf
.undefine('HAVE_GSSAPI_GSSAPI_GENERIC_H')
741 conf
.undefine('HAVE_GSSAPI_GSSAPI_H')
744 if not conf
.CONFIG_SET('HAVE_LDAP'):
749 conf
.DEFINE('WITH_ADS', '1')
750 conf
.env
['HAVE_ADS'] = '1'
751 Logs
.info("Building with Active Directory support.")
752 elif Options
.options
.with_ads
== False:
753 Logs
.info("Building without Active Directory support (--without-ads).")
756 Logs
.warn("Active Directory support not available: krb5 libs don't have all required features")
758 Logs
.warn("Active Directory support not available: LDAP support ist not available.")
759 if Options
.options
.with_ads
:
760 conf
.fatal("Active Directory support not found. Use --without-ads for building without Active Directory support.")
762 # this is the auto-mode case
763 Logs
.warn("Building without Active Directory support.")
766 if Options
.options
.with_utmp
:
767 conf
.env
.with_utmp
= True
768 if not conf
.CHECK_HEADERS('utmp.h'): conf
.env
.with_utmp
= False
769 conf
.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
770 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers
='utmp.h',
771 define
='HAVE_UT_UT_NAME')
772 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers
='utmp.h',
773 define
='HAVE_UT_UT_USER')
774 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers
='utmp.h',
775 define
='HAVE_UT_UT_ID')
776 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers
='utmp.h',
777 define
='HAVE_UT_UT_HOST')
778 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers
='utmp.h',
779 define
='HAVE_UT_UT_TIME')
780 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers
='utmp.h',
781 define
='HAVE_UT_UT_TV')
782 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers
='utmp.h',
783 define
='HAVE_UT_UT_TYPE')
784 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers
='utmp.h',
785 define
='HAVE_UT_UT_PID')
786 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers
='utmp.h',
787 define
='HAVE_UT_UT_EXIT')
788 conf
.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers
='utmpx.h',
789 define
='HAVE_UX_UT_SYSLEN')
790 conf
.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
791 'PUTUTLINE_RETURNS_UTMP', headers
='utmp.h',
792 msg
="Checking whether pututline returns pointer")
793 conf
.CHECK_SIZEOF(['((struct utmp *)NULL)->ut_line'], headers
='utmp.h',
794 define
='SIZEOF_UTMP_UT_LINE')
795 if not conf
.CONFIG_SET('SIZEOF_UTMP_UT_LINE'):
796 conf
.env
.with_utmp
= False
797 elif int(conf
.env
.SIZEOF_UTMP_UT_LINE
) < 15:
798 conf
.env
.with_utmp
= False
799 if conf
.env
.with_utmp
:
800 conf
.DEFINE('WITH_UTMP', 1)
802 Logs
.warn("--with-utmp but utmp support not sufficient")
804 if Options
.options
.with_avahi
:
805 conf
.env
.with_avahi
= True
806 if not conf
.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf
.env
.with_avahi
= False
807 if not conf
.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf
.env
.with_avahi
= False
808 if not conf
.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf
.env
.with_avahi
= False
809 if conf
.env
.with_avahi
:
810 conf
.DEFINE('WITH_AVAHI_SUPPORT', 1)
812 conf
.SET_TARGET_TYPE('avahi-common', 'EMPTY')
813 conf
.SET_TARGET_TYPE('avahi-client', 'EMPTY')
815 if Options
.options
.with_iconv
:
816 conf
.env
.with_iconv
= True
817 if not conf
.CHECK_FUNCS_IN('iconv_open', 'iconv', headers
='iconv.h'):
818 conf
.env
.with_iconv
= False
819 if conf
.env
.with_iconv
:
820 conf
.DEFINE('HAVE_ICONV', 1)
822 if Options
.options
.with_pam
:
824 conf
.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
825 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
826 Logs
.warn("--with-pam=yes but pam_appl.h not found")
828 conf
.CHECK_FUNCS_IN('pam_get_data', 'pam')
829 conf
.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h')
830 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'):
831 Logs
.warn("--with-pam=yes but pam_modules.h not found")
833 conf
.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h')
834 conf
.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h')
835 conf
.CHECK_FUNCS_IN('pam_vsyslog', 'pam')
837 #if defined(HAVE_SECURITY_PAM_APPL_H)
838 #include <security/pam_appl.h>
839 #elif defined(HAVE_PAM_PAM_APPL_H)
840 #include <pam/pam_appl.h>
842 pam_set_item(0, PAM_RHOST, 0);
846 msg
="Checking whether PAM_RHOST is available");
848 #if defined(HAVE_SECURITY_PAM_APPL_H)
849 #include <security/pam_appl.h>
850 #elif defined(HAVE_PAM_PAM_APPL_H)
851 #include <pam/pam_appl.h>
853 pam_set_item(0, PAM_TTY, 0);
857 msg
="Checking whether PAM_TTY is available");
859 #if (!defined(LINUX))
861 #define PAM_EXTERN extern
862 #if defined(HAVE_SECURITY_PAM_APPL_H)
863 #include <security/pam_appl.h>
864 #elif defined(HAVE_PAM_PAM_APPL_H)
865 #include <pam/pam_appl.h>
870 #if defined(HAVE_SECURITY_PAM_MODULES_H)
871 #include <security/pam_modules.h>
872 #elif defined(HAVE_PAM_PAM_MODULES_H)
873 #include <pam/pam_modules.h>
876 #if defined(HAVE_SECURITY__PAM_MACROS_H)
877 #include <security/_pam_macros.h>
878 #elif defined(HAVE_PAM__PAM_MACROS_H)
879 #include <pam/_pam_macros.h>
882 #ifdef HAVE_SECURITY_PAM_EXT_H
883 #include <security/pam_ext.h>
886 int i; i = PAM_RADIO_TYPE;
888 'HAVE_PAM_RADIO_TYPE',
890 msg
="Checking whether PAM_RADIO_TYPE is available");
892 conf
.DEFINE('WITH_PAM', 1)
893 conf
.DEFINE('WITH_PAM_MODULES', 1)
895 if Options
.options
.with_pam_smbpass
:
896 conf
.env
.with_pam_smbpass
= True
901 # Ensure we select the correct set of system calls on Linux.
903 if (host_os
.rfind('linux') > -1):
905 #if defined(HAVE_UNISTD_H)
910 #include <sys/types.h>
913 #ifdef HAVE_SYS_PRIV_H
914 #include <sys/priv.h>
920 #if defined(HAVE_SYSCALL_H)
924 #if defined(HAVE_SYS_SYSCALL_H)
925 #include <sys/syscall.h>
928 syscall(SYS_setresuid32, -1, -1, -1);
929 syscall(SYS_setresgid32, -1, -1, -1);
930 syscall(SYS_setreuid32, -1, -1);
931 syscall(SYS_setregid32, -1, -1);
932 syscall(SYS_setuid32, -1);
933 syscall(SYS_setgid32, -1);
934 syscall(SYS_setgroups32, 0, NULL);
936 'USE_LINUX_32BIT_SYSCALLS',
937 msg
="Checking whether Linux should use 32-bit credential calls");
939 if (conf
.CONFIG_SET('USE_LINUX_32BIT_SYSCALLS')):
940 seteuid
= conf
.CHECK_CODE('''
941 #define AUTOCONF_TEST 1
942 #define USE_LINUX_THREAD_CREDENTIALS 1
943 #define USE_LINUX_32BIT_SYSCALLS 1
944 #include "../lib/util/setid.c"
945 #include "./lib/util_sec.c"
947 'USE_LINUX_THREAD_CREDENTIALS',
950 msg
="Checking whether we can use Linux thread-specific credentials with 32-bit system calls")
952 seteuid
= conf
.CHECK_CODE('''
953 #define AUTOCONF_TEST 1
954 #define USE_LINUX_THREAD_CREDENTIALS 1
955 #include "../lib/util/setid.c"
956 #include "./lib/util_sec.c"
958 'USE_LINUX_THREAD_CREDENTIALS',
961 msg
="Checking whether we can use Linux thread-specific credentials")
963 seteuid
= conf
.CHECK_CODE('''
964 #define AUTOCONF_TEST 1
965 #define USE_SETREUID 1
966 #include "../lib/util/setid.c"
967 #include "./lib/util_sec.c"
972 msg
="Checking whether setreuid is available")
974 seteuid
= conf
.CHECK_CODE('''
975 #define AUTOCONF_TEST 1
976 #define USE_SETRESUID 1
977 #include "../lib/util/setid.c"
978 #include "./lib/util_sec.c"
983 msg
="Checking whether setresuid is available")
985 seteuid
= conf
.CHECK_CODE('''
986 #define AUTOCONF_TEST 1
987 #define USE_SETEUID 1
988 #include "../lib/util/setid.c"
989 #include "./lib/util_sec.c"
994 msg
="Checking whether seteuid is available")
996 seteuid
= conf
.CHECK_CODE('''
997 #define AUTOCONF_TEST 1
998 #define USE_SETUIDX 1
999 #include "../lib/util/setid.c"
1000 #include "./lib/util_sec.c"
1006 msg
="Checking whether setuidx is available")
1007 if Options
.options
.with_dnsupdate
:
1008 if not conf
.CONFIG_SET('HAVE_KRB5'):
1009 Logs
.warn("--with-dnsupdate=yes but gssapi support not sufficient")
1011 conf
.DEFINE('WITH_DNS_UPDATES', 1)
1012 conf
.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
1013 if Options
.options
.developer
:
1014 if conf
.CONFIG_SET('HAVE_VALGRIND_H') or conf
.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'):
1015 conf
.DEFINE('VALGRIND', '1')
1017 if conf
.CHECK_CODE('''
1018 #include <bits/sockaddr.h>
1019 #include <linux/netlink.h>
1021 'HAVE_LINUX_NETLINK_H',
1022 msg
="Checking whether Linux netlink is available"):
1025 #include <bits/sockaddr.h>
1026 #include <linux/netlink.h>
1027 #include <linux/rtnetlink.h>
1029 'HAVE_LINUX_RTNETLINK_H',
1030 msg
='Checking whether Linux rtnetlink is available')
1033 #include "../tests/fcntl_lock.c"
1038 msg
='Checking whether fcntl locking is available')
1040 # glibc up to 2.3.6 had dangerously broken posix_fallocate(). DON'T USE IT.
1041 if not conf
.CHECK_CODE('''
1042 #define _XOPEN_SOURCE 600
1044 #if defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4))
1045 #error probably broken posix_fallocate
1048 '_HAVE_UNBROKEN_POSIX_FALLOCATE',
1049 msg
='Checking for broken posix_fallocate'):
1050 conf
.DEFINE('HAVE_BROKEN_POSIX_FALLOCATE', '1')
1053 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec',
1054 define
='HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') # Linux, Solaris
1055 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimensec',
1056 define
='HAVE_STRUCT_STAT_ST_MTIMENSEC') # BSD, if defined _POSIX_SOURCE
1057 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimespec.tv_nsec',
1058 define
='HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') # BSD, if not defined _POSIX_SOURCE
1059 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtime_n',
1060 define
='HAVE_STRUCT_STAT_ST_MTIME_N') # AIX
1061 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_umtime',
1062 define
='HAVE_STRUCT_STAT_ST_UMTIME') # Tru64
1063 if conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') or \
1064 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMENSEC') or \
1065 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') or \
1066 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIME_N') or \
1067 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_UMTIME'):
1068 conf
.DEFINE('HAVE_STAT_HIRES_TIMESTAMPS', '1')
1070 # recent FreeBSD, NetBSD have creation timestamps called birthtime:
1071 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtime',
1072 define
='HAVE_STRUCT_STAT_ST_BIRTHTIME')
1073 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimespec.tv_nsec',
1074 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC')
1075 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimensec',
1076 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC')
1079 ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
1081 'HAVE_POSIX_FADVISE',
1082 msg
='Checking whether posix_fadvise is available',
1083 headers
='unistd.h fcntl.h')
1085 for v
in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]:
1088 return sysconf(%s) == -1 ? 1 : 0;
1091 msg
='Checking whether sysconf(%s) is available' % v
)
1094 #include <sys/syscall.h>
1096 syscall(SYS_initgroups, 16, NULL, NULL, 0);
1098 'HAVE_DARWIN_INITGROUPS',
1099 msg
='Checking whether to use the Darwin-specific initgroups system call')
1101 conf
.CHECK_CODE('''struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''',
1103 headers
='sys/types.h utime.h',
1104 msg
='Checking whether struct utimbuf is available')
1106 if conf
.CHECK_CODE('''struct sigevent s;''',
1107 'HAVE_STRUCT_SIGEVENT',
1108 headers
='sys/types.h stdlib.h stddef.h signal.h',
1109 msg
='Checking whether we have the struct sigevent'):
1110 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sival_ptr',
1111 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR',
1112 headers
='signal.h');
1113 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sigval_ptr',
1114 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR',
1115 headers
='signal.h');
1117 if os
.path
.exists('/proc/sys/kernel/core_pattern'):
1118 conf
.DEFINE('HAVE_SYS_KERNEL_PROC_CORE_PATTERN', '1')
1120 if conf
.CHECK_CODE('''
1124 if (sizeof(time_t) == 8) {
1125 time_t max_time = 0x7fffffffffffffffll;
1126 tm = gmtime(&max_time);
1127 /* This should fail with 32-bit tm_year. */
1129 /* Max time_t that works with 32-bit int tm_year in struct tm. */
1130 max_time = 67768036191676799ll;
1131 tm = gmtime(&max_time);
1142 msg
="Checking for the maximum value of the 'time_t' type"):
1143 conf
.DEFINE('TIME_T_MAX', '67768036191676799ll')
1146 #if defined(HAVE_UNISTD_H)
1149 #include <sys/types.h>
1150 main() { dev_t dev = makedev(1,2); return 0; }
1154 msg
='Checking whether the macro for makedev is available')
1161 void exit_on_core(int ignored) {
1167 signal(SIGSEGV, exit_on_core);
1168 newpath = realpath("/tmp", NULL);
1169 exit((newpath != NULL) ? 0 : 1);
1172 'REALPATH_TAKES_NULL',
1175 msg
='Checking whether the realpath function allows a NULL argument')
1177 conf
.CHECK_CODE('''#include "../tests/ftruncate.c"''',
1178 'HAVE_FTRUNCATE_EXTEND',
1179 msg
='Checking for ftruncate extend',
1183 if Options
.options
.with_sendfile_support
:
1184 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):
1189 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1192 headers
='sys/sendfile.h',
1193 msg
='Checking for linux sendfile support')
1195 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1196 conf
.DEFINE('HAVE_SENDFILE', '1')
1197 conf
.DEFINE('LINUX_SENDFILE_API', '1')
1198 conf
.DEFINE('WITH_SENDFILE', '1')
1199 elif (host_os
.rfind('freebsd') > -1) or (host_os
.rfind('dragonfly') > -1):
1201 #include <sys/types.h>
1203 #include <sys/socket.h>
1204 #include <sys/uio.h>
1205 int fromfd, tofd, ret, total=0;
1206 off_t offset, nwritten;
1209 hdr.headers = &hdtrl;
1211 hdr.trailers = NULL;
1213 hdtrl.iov_base = NULL;
1215 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0)
1218 msg
='Checking for freebsd sendfile support')
1219 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1220 conf
.DEFINE('HAVE_SENDFILE', '1')
1221 conf
.DEFINE('FREEBSD_SENDFILE_API', '1')
1222 conf
.DEFINE('WITH_SENDFILE', '1')
1223 elif (host_os
.rfind('darwin') > -1):
1225 #include <sys/types.h>
1226 #include <sys/socket.h>
1227 #include <sys/uio.h>
1228 int fromfd, tofd, ret;
1229 off_t offset, nwritten;
1232 hdr.headers = &hdtrl;
1234 hdr.trailers = (void *)0;
1236 hdtrl.iov_base = (void *)0;
1238 ret = sendfile(fromfd, tofd, offset, &nwritten, &hdr, 0);
1241 msg
='Checking for darwin sendfile support')
1242 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1243 conf
.DEFINE('HAVE_SENDFILE', '1')
1244 conf
.DEFINE('DARWIN_SENDFILE_API', '1')
1245 conf
.DEFINE('WITH_SENDFILE', '1')
1246 elif (host_os
.rfind('hpux') > -1) or (host_os
.rfind('osf') > -1):
1248 #include <sys/socket.h>
1249 #include <sys/uio.h>
1252 struct iovec hdtrl[2];
1255 hdtrl[0].iov_base = 0;
1256 hdtrl[0].iov_len = 0;
1257 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
1260 msg
='Checking for osf/hpux sendfile support')
1261 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1262 conf
.DEFINE('HAVE_SENDFILE', '1')
1263 conf
.DEFINE('HPUX_SENDFILE_API', '1')
1264 conf
.DEFINE('WITH_SENDFILE', '1')
1265 elif (host_os
.rfind('solaris') > -1):
1266 conf
.CHECK_FUNCS_IN('sendfile', 'sendfilev')
1268 #include <sys/sendfile.h>,
1271 struct sendfilevec vec[2];
1275 vec[0].sfv_fd = SFV_FD_SELF;
1276 vec[0].sfv_flag = 0;
1280 vec[1].sfv_flag = 0;
1283 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
1286 msg
='Checking for solaris sendfilev support')
1287 if conf
.CONFIG_SET('_HAVE_SENDFILEV'):
1288 conf
.DEFINE('HAVE_SENDFILEV', '1')
1289 conf
.DEFINE('SOLARIS_SENDFILE_API', '1')
1290 conf
.DEFINE('WITH_SENDFILE', '1')
1291 elif (host_os
.rfind('aix') > -1):
1293 #include <sys/socket.h>
1296 struct sf_parms hdtrl;
1298 hdtrl.header_data = 0;
1299 hdtrl.header_length = 0;
1300 hdtrl.file_descriptor = fromfd;
1301 hdtrl.file_offset = 0;
1302 hdtrl.file_bytes = 0;
1303 hdtrl.trailer_data = 0;
1304 hdtrl.trailer_length = 0;
1305 nwritten = send_file(&tofd, &hdtrl, 0);
1308 msg
='Checking for AIX send_file support')
1309 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1310 conf
.DEFINE('HAVE_SENDFILE', '1')
1311 conf
.DEFINE('AIX_SENDFILE_API', '1')
1312 conf
.DEFINE('WITH_SENDFILE', '1')
1314 # Check for getcwd allowing a NULL arg.
1318 char *s = getcwd(NULL,0);
1319 exit(s != NULL ? 0 : 1);
1320 }''', 'GETCWD_TAKES_NULL', addmain
=False, execute
=True,
1321 msg
="getcwd takes a NULL argument")
1324 # UnixWare 7.x has its getspnam in -lgen
1325 conf
.CHECK_FUNCS_IN('getspnam', 'gen')
1326 conf
.CHECK_FUNCS_IN('getspnam', 'security')
1327 conf
.CHECK_FUNCS_IN('getspnam', 'sec')
1329 if Options
.options
.with_quotas
:
1330 # For quotas on Veritas VxFS filesystems
1331 conf
.CHECK_HEADERS('sys/fs/vx_quota.h')
1332 # For sys/quota.h and linux/quota.h
1333 conf
.CHECK_HEADERS('sys/quota.h')
1334 # For quotas on BSD systems
1335 conf
.CHECK_HEADERS('ufs/ufs/quota.h')
1336 # For quotas on Linux XFS filesystems
1337 if conf
.CHECK_HEADERS('xfs/xqm.h'):
1338 conf
.DEFINE('HAVE_XFS_QUOTAS', '1')
1342 #include "confdefs.h"
1343 #ifdef HAVE_SYS_TYPES_H
1344 #include <sys/types.h>
1346 #ifdef HAVE_ASM_TYPES_H
1347 #include <asm/types.h>
1349 #include <sys/quota.h>
1350 int i = Q_XGETQUOTA;''',
1351 define
='HAVE_XFS_QUOTAS',
1352 msg
='for XFS QUOTA in <sys/quota.h>',
1354 local_include
=False)
1356 # For IRIX like dqb_isoftlimit instead of dqb_fsoftlimit in struc dqblk
1357 conf
.CHECK_STRUCTURE_MEMBER('struct dqblk', 'dqb_fsoftlimit', define
='HAVE_DQB_FSOFTLIMIT',
1358 headers
='sys/quota.h')
1359 #darwin style quota bytecount
1360 conf
.CHECK_STRUCTURE_MEMBER('struct dqblk', 'dqb_curbytes', define
='HAVE_STRUCT_DQBLK_DQB_CURBYTES',
1361 headers
='sys/quota.h')
1362 if conf
.CHECK_HEADERS('rpcsvc/rquota.h'):
1363 conf
.DEFINE('HAVE_NFS_QUOTAS', '1')
1364 conf
.CHECK_STRUCTURE_MEMBER('struct getquota_rslt', 'getquota_rslt_u',
1365 define
='HAVE_GETQUOTA_RSLT_GETQUOTA_RSLT_U',
1366 headers
='rpcsvc/rquota.h')
1368 if (host_os
.rfind('linux') > -1):
1369 conf
.DEFINE('HAVE_QUOTACTL_LINUX', '1')
1370 elif not conf
.CONFIG_SET("HAVE_XFS_QUOTAS"):
1371 if not conf
.CHECK_CODE('''
1372 #define HAVE_QUOTACTL_4A 1
1373 #define AUTOCONF_TEST 1
1374 #include "../tests/sysquotas.c"
1376 cflags
=conf
.env
['WERROR_CFLAGS'],
1377 define
='HAVE_QUOTACTL_4A',
1378 msg
='for QUOTACTL_4A: long quotactl(int cmd, char *special, qid_t id, caddr_t addr)',
1383 #define HAVE_QUOTACTL_4B 1
1384 #define AUTOCONF_TEST 1
1385 #include "../tests/sysquotas.c"
1387 cflags
=conf
.env
['WERROR_CFLAGS'],
1388 define
='HAVE_QUOTACTL_4B',
1389 msg
='for QUOTACTL_4B: int quotactl(const char *path, int cmd, int id, char *addr)',
1394 clnt_create("", RQUOTAPROG, RQUOTAVERS, "udp");
1396 headers
="rpc/rpc.h rpc/types.h rpcsvc/rquota.h rpc/nettype.h rpc/xdr.h",
1397 define
='HAVE_NFS_QUOTAS',
1398 msg
='for NFS QUOTAS',
1400 local_include
=False)
1402 if conf
.CONFIG_SET('HAVE_QUOTACTL_LINUX') or \
1403 conf
.CONFIG_SET('HAVE_QUOTACTL_4A') or \
1404 conf
.CONFIG_SET('HAVE_QUOTACTL_4B') or \
1405 conf
.CONFIG_SET('HAVE_XFS_QUOTAS'):
1406 conf
.DEFINE('HAVE_SYS_QUOTAS', '1')
1407 conf
.DEFINE('WITH_QUOTAS', '1')
1410 # checking for clustering extensions (CTDB)
1412 if Options
.options
.with_cluster_support
== False:
1413 # configure is called with --without-cluster-support,
1414 # so don't check for and build w/o ctdb support.
1415 have_cluster_support
= False
1419 if Options
.options
.ctdb_dir
:
1420 conf
.ADD_EXTRA_INCLUDES(Options
.options
.ctdb_dir
+ '/include')
1422 srcdir
= os
.path
.realpath(conf
.srcdir
)
1423 if 'EXTRA_INCLUDES' in conf
.env
:
1424 includes
= ' '.join(conf
.env
['EXTRA_INCLUDES']).replace('#', srcdir
+ '/')
1428 if not conf
.env
.USING_SYSTEM_TDB
:
1429 includes
= includes
+ ' ' + srcdir
+ '/lib/tdb/include'
1431 if not conf
.env
.USING_SYSTEM_TALLOC
:
1432 includes
= includes
+ ' ' + srcdir
+ '/lib/talloc'
1434 have_cluster_support
= True
1439 #include "replace.h"
1440 #include "system/wait.h"
1441 #include "system/network.h"
1442 #define private #error __USED_RESERVED_WORD_private__
1455 msg
='Checking for header ctdb.h')
1457 if not conf
.CONFIG_SET('HAVE_CTDB_H'):
1458 have_cluster_support
= False
1459 ctdb_broken
= "ctdb.h is required for cluster support"
1461 if have_cluster_support
:
1464 #include "replace.h"
1465 #include "system/wait.h"
1466 #include "system/network.h"
1467 #define private #error __USED_RESERVED_WORD_private__
1471 #include <ctdb_private.h>
1478 'HAVE_CTDB_PRIVATE_H',
1481 msg
='Checking for header ctdb_private.h')
1483 if not conf
.CONFIG_SET('HAVE_CTDB_PRIVATE_H'):
1484 have_cluster_support
= False
1485 ctdb_broken
= "ctdb_private.h is required for cluster support"
1487 if have_cluster_support
:
1490 #include "replace.h"
1491 #include "system/wait.h"
1492 #include "system/network.h"
1493 #define private #error __USED_RESERVED_WORD_private__
1497 #include <ctdb_protocol.h>
1504 'HAVE_CTDB_PROTOCOL_H',
1507 msg
='Checking for header ctdb_protocol.h')
1509 if have_cluster_support
:
1512 #include "replace.h"
1513 #include "system/wait.h"
1514 #include "system/network.h"
1518 #include <ctdb_private.h>
1522 int i = (int)CTDB_CONTROL_TRANS3_COMMIT;
1526 'HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL',
1529 msg
='Checking for transaction support (TRANS3_COMMIT control)')
1531 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL'):
1532 have_cluster_support
= False
1533 ctdb_broken
= "ctdb transaction support missing or too old"
1535 if have_cluster_support
:
1538 #include "replace.h"
1539 #include "system/wait.h"
1540 #include "system/network.h"
1544 #include <ctdb_private.h>
1548 int i = (int)CTDB_CONTROL_SCHEDULE_FOR_DELETION;
1552 'HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL',
1555 msg
='Checking for SCHEDULE_FOR_DELETION control')
1557 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL'):
1558 if not Options
.options
.enable_old_ctdb
:
1559 have_cluster_support
= False
1560 ctdb_broken
= "SCHEDULE_FOR_DELETION control missing"
1562 Logs
.warn("ignoring missing SCHEDULE_FOR_DELETION control (--enable-old-ctdb)")
1564 if have_cluster_support
:
1567 #include "replace.h"
1568 #include "system/wait.h"
1569 #include "system/network.h"
1573 #include <ctdb_private.h>
1577 struct ctdb_control_tcp _x;
1581 'HAVE_STRUCT_CTDB_CONTROL_TCP',
1584 msg
='Checking for ctdb ipv4 support')
1586 if not conf
.CONFIG_SET('HAVE_STRUCT_CTDB_CONTROL_TCP'):
1587 have_cluster_support
= False
1588 ctdb_broken
= "missing struct ctdb_control_tcp"
1590 if have_cluster_support
:
1593 #include "replace.h"
1594 #include "system/wait.h"
1595 #include "system/network.h"
1599 #include <ctdb_private.h>
1603 struct ctdb_control_tcp_addr _x;
1607 'HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR',
1610 msg
='Checking for ctdb ipv6 support')
1612 if have_cluster_support
:
1615 #include "replace.h"
1616 #include "system/wait.h"
1617 #include "system/network.h"
1621 #include <ctdb_private.h>
1625 int i = (int)CTDB_CONTROL_CHECK_SRVIDS;
1629 'HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL',
1632 msg
='Checking for CHECK_SRVIDS control')
1634 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL'):
1635 if not Options
.options
.enable_old_ctdb
:
1636 have_cluster_support
= False
1637 ctdb_broken
= "CHECK_SRVIDS control missing"
1639 Logs
.warn("ignoring missing CHECK_SRVIDS control (--enable-old-ctdb)")
1641 if have_cluster_support
:
1642 Logs
.info("building with cluster support")
1643 conf
.DEFINE('CLUSTER_SUPPORT', 1);
1645 if Options
.options
.with_cluster_support
== False:
1646 Logs
.info("building without cluster support (--without-cluster-support)")
1647 elif Options
.options
.with_cluster_support
== True:
1648 Logs
.error("Cluster support not available: " + ctdb_broken
)
1649 conf
.fatal("Cluster support not found, but --with-cluster-support was specified")
1651 Logs
.info("building without cluster support: " + ctdb_broken
)
1652 conf
.undefine('CLUSTER_SUPPORT')
1655 conf
.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }',
1656 'HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR',
1659 msg
='Checking whether we can compile with __attribute__((destructor))')
1661 conf
.CHECK_CODE('void seekdir(DIR *d, long loc) { return; }',
1662 'SEEKDIR_RETURNS_VOID',
1663 headers
='sys/types.h dirent.h',
1664 msg
='Checking whether seekdir returns void')
1666 if Options
.options
.with_profiling_data
:
1667 conf
.DEFINE('WITH_PROFILE', 1);
1669 PTHREAD_CFLAGS
='error'
1670 PTHREAD_LDFLAGS
='error'
1672 if PTHREAD_LDFLAGS
== 'error':
1673 if conf
.CHECK_FUNCS_IN('pthread_attr_init', 'pthread'):
1674 PTHREAD_CFLAGS
='-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS'
1675 PTHREAD_LDFLAGS
='-lpthread'
1676 if PTHREAD_LDFLAGS
== 'error':
1677 if conf
.CHECK_FUNCS_IN('pthread_attr_init', 'pthreads'):
1678 PTHREAD_CFLAGS
='-D_THREAD_SAFE'
1679 PTHREAD_LDFLAGS
='-lpthreads'
1680 if PTHREAD_LDFLAGS
== 'error':
1681 if conf
.CHECK_FUNCS_IN('pthread_attr_init', 'c_r'):
1682 PTHREAD_CFLAGS
='-D_THREAD_SAFE -pthread'
1683 PTHREAD_LDFLAGS
='-pthread'
1684 if PTHREAD_LDFLAGS
== 'error':
1685 if conf
.CHECK_FUNCS('pthread_attr_init'):
1686 PTHREAD_CFLAGS
='-D_REENTRANT'
1687 PTHREAD_LDFLAGS
='-lpthread'
1688 # especially for HP-UX, where the CHECK_FUNC macro fails to test for
1689 # pthread_attr_init. On pthread_mutex_lock it works there...
1690 if PTHREAD_LDFLAGS
== 'error':
1691 if conf
.CHECK_FUNCS_IN('pthread_mutex_lock', 'pthread'):
1692 PTHREAD_CFLAGS
='-D_REENTRANT'
1693 PTHREAD_LDFLAGS
='-lpthread'
1695 if PTHREAD_CFLAGS
!= 'error' and PTHREAD_LDFLAGS
!= 'error':
1696 conf
.ADD_CFLAGS(PTHREAD_CFLAGS
)
1697 conf
.ADD_LDFLAGS(PTHREAD_LDFLAGS
)
1698 conf
.CHECK_HEADERS('pthread.h')
1699 conf
.DEFINE('HAVE_PTHREAD', '1')
1701 if Options
.options
.with_pthreadpool
:
1702 if conf
.CONFIG_SET('HAVE_PTHREAD'):
1703 conf
.DEFINE('WITH_PTHREADPOOL', '1')
1705 Logs
.warn("pthreadpool support cannot be enabled when pthread support was not found")
1706 conf
.undefine('WITH_PTHREADPOOL')
1708 if conf
.CHECK_HEADERS('gpfs_gpl.h'):
1709 conf
.DEFINE('HAVE_GPFS', '1')
1711 default_static_modules
.extend(TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
1712 auth_sam auth_unix auth_winbind auth_wbc
1713 auth_domain auth_builtin vfs_default
1714 nss_info_template idmap_tdb idmap_passdb
1717 default_shared_modules
.extend(TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
1718 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
1719 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2
1720 auth_script vfs_readahead vfs_xattr_tdb vfs_posix_eadb
1721 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
1722 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
1725 vfs_crossrename vfs_linux_xfs_sgid
1726 vfs_time_audit idmap_autorid idmap_tdb2
1727 idmap_rid idmap_hash'''))
1729 if Options
.options
.developer
:
1730 default_static_modules
.extend(TO_LIST('charset_weird'))
1731 default_shared_modules
.extend(TO_LIST('perfcount_test'))
1732 default_shared_modules
.extend(TO_LIST('vfs_skel_opaque vfs_skel_transparent vfs_shadow_copy_test'))
1733 default_shared_modules
.extend(TO_LIST('auth_skel pdb_test'))
1735 if Options
.options
.enable_selftest
or Options
.options
.developer
:
1736 default_shared_modules
.extend(TO_LIST('vfs_fake_acls'))
1739 if conf
.CONFIG_SET('AD_DC_BUILD_IS_ENABLED'):
1740 default_static_modules
.extend(TO_LIST('pdb_samba_dsdb auth_samba4 vfs_dfs_samba4'))
1742 if conf
.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'):
1743 default_shared_modules
.extend(TO_LIST('vfs_zfsacl'))
1745 if conf
.CONFIG_SET('HAVE_DIRFD_DECL'):
1746 default_shared_modules
.extend(TO_LIST('vfs_syncops vfs_dirsort'))
1748 if conf
.CONFIG_SET('HAVE_STATFS_F_FSID'):
1749 default_shared_modules
.extend(TO_LIST('vfs_fileid'))
1751 if (conf
.CONFIG_SET('HAVE_MSGHDR_MSG_CONTROL') or conf
.CONFIG_SET('HAVE_MSGHDR_MSG_ACCTRIGHTS')):
1752 default_shared_modules
.extend(TO_LIST('vfs_aio_fork'))
1754 if Options
.options
.with_pthreadpool
:
1755 default_shared_modules
.extend(TO_LIST('vfs_aio_pthread'))
1757 if conf
.CONFIG_SET('HAVE_AIO'):
1758 default_shared_modules
.extend(TO_LIST('vfs_aio_posix'))
1760 if conf
.CONFIG_SET('HAVE_LINUX_KERNEL_AIO'):
1761 default_shared_modules
.extend(TO_LIST('vfs_aio_linux'))
1763 if conf
.CONFIG_SET('HAVE_LDAP'):
1764 default_static_modules
.extend(TO_LIST('pdb_ldapsam idmap_ldap'))
1766 if conf
.CONFIG_SET('DARWINOS'):
1767 default_static_modules
.extend(TO_LIST('charset_macosxfs'))
1769 if conf
.CONFIG_SET('HAVE_GPFS'):
1770 default_shared_modules
.extend(TO_LIST('vfs_gpfs'))
1772 if conf
.CONFIG_SET('SAMBA_FAM_LIBS'):
1773 default_shared_modules
.extend(TO_LIST('vfs_notify_fam'))
1775 explicit_shared_modules
= TO_LIST(Options
.options
.shared_modules
, delimiter
=',')
1776 explicit_static_modules
= TO_LIST(Options
.options
.static_modules
, delimiter
=',')
1778 def replace_list_item(lst
, item
, value
):
1780 idx
= lst
.index(item
)
1784 # PDB module file name should have the same name as module registers itself
1785 # In Autoconf build we export LDAP passdb module as ldapsam but WAF build
1786 # was always exporting pdb_ldap. In order to support existing packages
1787 # allow referring to pdb_ldapsam as pdb_ldap but use proper name internally.
1788 replace_list_item(explicit_shared_modules
, 'pdb_ldap', 'pdb_ldapsam')
1789 replace_list_item(explicit_static_modules
, 'pdb_ldap', 'pdb_ldapsam')
1791 final_static_modules
= default_static_modules
1792 final_shared_modules
= default_shared_modules
1794 for m
in explicit_static_modules
:
1795 if m
in final_shared_modules
:
1796 final_shared_modules
.remove(m
)
1797 final_static_modules
.append(m
)
1798 for m
in explicit_shared_modules
:
1799 if m
in final_static_modules
:
1800 final_static_modules
.remove(m
)
1801 final_shared_modules
.append(m
)
1803 if ("auth_domain" not in final_static_modules
) or \
1804 ("auth_builtin" not in final_static_modules
) or \
1805 ("auth_sam" not in final_static_modules
) or \
1806 ("auth_winbind" not in final_static_modules
):
1807 raise Utils
.WafError('These auth modules MUST be configured as static modules: auth_domain, auth_builtin, auth_sam, auth_winbind')
1809 conf
.env
['static_modules'] = final_static_modules
1810 conf
.env
['shared_modules'] = final_shared_modules
1812 conf
.DEFINE('STRING_STATIC_MODULES', ' '.join(final_static_modules
), quote
=True)
1817 prefixes
= ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
1818 conf
.env
['MODULE_PREFIXES'] = prefixes
1820 for m
in final_static_modules
:
1822 if not p
in static_list
:
1824 static_list
[p
].append(m
)
1825 for m
in final_shared_modules
:
1827 if not p
in shared_list
:
1829 shared_list
[p
].append(m
)
1832 static_env
= "%s_STATIC" % p
.upper()
1833 shared_env
= "%s_SHARED" % p
.upper()
1834 conf
.env
[static_env
] = []
1835 conf
.env
[shared_env
] = []
1836 if p
in static_list
:
1838 for entry
in static_list
[p
]:
1839 decl_list
+= "extern NTSTATUS %s_init(void); " % entry
1840 conf
.env
[static_env
].append('%s' % entry
)
1841 decl_list
= decl_list
.rstrip()
1842 conf
.DEFINE('static_decl_%s' % p
, decl_list
)
1843 conf
.DEFINE('static_init_%s' % p
, '{ %s_init(); }' % '_init(); '.join(static_list
[p
]))
1845 conf
.DEFINE('static_decl_%s' % p
, '')
1846 conf
.DEFINE('static_init_%s' % p
, '{}')
1847 if p
in shared_list
:
1848 for entry
in shared_list
[p
]:
1849 conf
.DEFINE('%s_init' % entry
, 'samba_init_module')
1850 conf
.env
[shared_env
].append('%s' % entry
)
1852 conf
.SAMBA_CONFIG_H('include/config.h')
1855 "build 'tags' file using ctags"
1857 source_root
= os
.path
.dirname(Utils
.g_module
.root_path
)
1858 cmd
= 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
1859 print("Running: %s" % cmd
)