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 #FIXME: for some reason this one still fails
98 conf
.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
99 conf
.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
100 conf
.CHECK_FUNCS_IN('dn_expand', 'inet')
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,SPLICE_F_MOVE);
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 kernel share modes")
169 if Options
.options
.with_fam
is None:
171 elif Options
.options
.with_fam
== True:
174 if check_for_fam
and conf
.CHECK_HEADERS('fam.h'):
175 if conf
.CHECK_FUNCS_IN('FAMOpen2', 'fam'):
177 elif conf
.CHECK_FUNCS_IN('FAMOpen2', 'fam C'):
178 samba_fam_libs
='fam C'
179 conf
.CHECK_TYPE('enum FAMCodes', headers
='fam.h',
180 define
='HAVE_FAM_H_FAMCODES_TYPEDEF',
181 msg
='Checking whether enum FAMCodes is available')
182 conf
.CHECK_FUNCS_IN('FAMNoExists', 'fam')
184 if samba_fam_libs
is not None:
185 conf
.DEFINE('SAMBA_FAM_LIBS', samba_fam_libs
)
187 if Options
.options
.with_fam
== True:
188 conf
.fatal('FAM support requested, but no suitable FAM library found')
190 Logs
.warn('no suitable FAM library found')
192 # check for DMAPI libs
193 if Options
.options
.with_dmapi
== False:
197 Logs
.info("Checking for DMAPI library existence")
199 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'dm'):
200 samba_dmapi_lib
= 'dm'
202 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'jfsdm'):
203 samba_dmapi_lib
= 'jfsdm'
205 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'dmapi'):
206 samba_dmapi_lib
= 'dmapi'
208 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'xdsm'):
209 samba_dmapi_lib
= 'xdsm'
210 # only bother to test headers and compilation when a candidate
211 # library has been found
212 if samba_dmapi_lib
== '':
214 broken_dmapi
= "no suitable DMAPI library found"
217 conf
.CHECK_HEADERS('sys/dmi.h xfs/dmapi.h sys/jfsdmapi.h sys/dmapi.h dmapi.h')
219 #include <time.h> /* needed by Tru64 */
220 #include <sys/types.h> /* needed by AIX */
221 #ifdef HAVE_XFS_DMAPI_H
222 #include <xfs/dmapi.h>
223 #elif defined(HAVE_SYS_DMI_H)
225 #elif defined(HAVE_SYS_JFSDMAPI_H)
226 #include <sys/jfsdmapi.h>
227 #elif defined(HAVE_SYS_DMAPI_H)
228 #include <sys/dmapi.h>
229 #elif defined(HAVE_DMAPI_H)
233 /* This link test is designed to fail on IRI 6.4, but should
234 * succeed on Linux, IRIX 6.5 and AIX.
236 int main(int argc, char **argv)
239 dm_eventset_t events;
240 /* This doesn't take an argument on IRIX 6.4. */
241 dm_init_service(&version);
242 /* IRIX 6.4 expects events to be a pointer. */
243 DMEV_ISSET(DM_EVENT_READ, events);
248 'USEABLE_DMAPI_LIBRARY',
252 msg
='Checking whether DMAPI lib '+samba_dmapi_lib
+' can be used')
253 if not conf
.CONFIG_SET('USEABLE_DMAPI_LIBRARY'):
255 broken_dmapi
= "no usable DMAPI library found"
258 Logs
.info("Building with DMAPI support.")
259 conf
.env
['dmapi_lib'] = samba_dmapi_lib
260 conf
.DEFINE('USE_DMAPI', 1)
262 if Options
.options
.with_dmapi
== False:
263 Logs
.info("Building without DMAPI support (--without-dmapi).")
264 elif Options
.options
.with_dmapi
== True:
265 Logs
.error("DMAPI support not available: " + broken_dmapi
)
266 conf
.fatal('DMAPI support requested but not found.');
268 Logs
.warn("Building without DMAPI support: " + broken_dmapi
)
269 conf
.env
['dmapi_lib'] = ''
271 # Check for various members of the stat structure
272 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define
='HAVE_STAT_ST_BLOCKS',
273 headers
='sys/stat.h')
274 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define
='HAVE_STAT_ST_BLKSIZE',
275 headers
='sys/stat.h')
276 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_flags', define
='HAVE_STAT_ST_FLAGS',
277 headers
='sys/types.h sys/stat.h unistd.h')
279 if "HAVE_BLKCNT_T" in conf
.env
:
281 return sizeof(blkcnt_t) == 4 ? 0 : 1''',
282 'SIZEOF_BLKCNT_T_4', execute
=True,
283 headers
='replace.h sys/types.h sys/stat.h unistd.h',
284 msg
="Checking whether blkcnt_t is 32 bit")
286 if "HAVE_BLKCNT_T" in conf
.env
:
288 return sizeof(blkcnt_t) == 8 ? 0 : 1''',
289 'SIZEOF_BLKCNT_T_8', execute
=True,
290 headers
='replace.h sys/types.h sys/stat.h unistd.h',
291 msg
="Checking whether blkcnt_t is 64 bit")
293 # Check for POSIX capability support
294 conf
.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers
='sys/capability.h')
296 if "HAVE_SYS_CAPABILITY_H" in conf
.env
:
300 if (!(cap = cap_get_proc())) exit(1);
302 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
303 cap_set_proc(cap);''',
304 'HAVE_POSIX_CAPABILITIES', execute
=True, lib
="cap",
305 headers
='sys/capability.h',
306 msg
="Checking whether POSIX capabilities are available")
308 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
309 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
311 if conf
.CONFIG_SET("HAVE_RPC_RPC_H"):
312 conf
.CHECK_TYPE('int16', headers
='rpc/rpc.h',
313 define
='HAVE_INT16_FROM_RPC_RPC_H',
314 msg
="Checking for int16 typedef included by rpc/rpc.h")
315 conf
.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
316 headers
='sys/types.h rpc/rpc.h',
317 msg
="Checking for uint16 typedef included by rpc/rpc.h")
318 conf
.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
319 headers
='sys/types.h rpc/rpc.h',
320 msg
="Checking for int32 typedef included by rpc/rpc.h")
321 conf
.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
322 headers
='sys/types.h rpc/rpc.h',
323 msg
="Checking for uint32 typedef included by rpc/rpc.h")
324 conf
.CHECK_CODE('int i;', 'BROKEN_NISPLUS_INCLUDE_FILES',
325 headers
='sys/types.h sys/acl.h rpcsvc/nis.h',
326 msg
="Checking for broken nisplus include files")
328 # Check if the compiler will optimize out functions
331 this_function_does_not_exist();
334 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
335 msg
="Checking if the compiler will optimize out functions")
337 # Check if the compiler supports the LL suffix on long long integers
339 conf
.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL',
341 msg
="Checking for LL suffix on long long integers")
345 _chdir __chdir chflags chmod _close __close _closedir
346 __closedir crypt16 devnm dirfd
347 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
349 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
351 fsetxattr _fstat __fstat fsync
352 futimens futimes __fxstat getauthuid
353 getcwd _getcwd __getcwd getdents __getdents getdirentries
354 getgrent getgrnam getgrouplist getgrset getmntent getpagesize
355 getpwanam getpwent_r getrlimit
356 glob grantpt hstrerror initgroups innetgr
357 llseek _llseek __llseek _lseek __lseek
358 _lstat __lstat lutimes
359 __lxstat memalign mknod mlock mlockall munlock munlockall
360 _open __open _opendir __opendir
361 pathconf poll posix_fallocate
362 posix_memalign prctl pread _pread __pread
363 pwrite _pwrite __pwrite
364 rdchk _read __read _readdir __readdir
366 select setenv setgidx setgroups setlocale setluid
367 setmntent setpgid setpriv setsid setuidx
368 shmget shm_open sigaction sigblock sigprocmask sigset
370 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctl sysctlbyname
371 __sys_llseek syslog _telldir __telldir timegm
372 utimensat vsyslog _write __write __xstat
376 #ifdef HAVE_SYS_PRCTL_H
377 #include <sys/prctl.h>
381 'HAVE_PRCTL', link
=False)
383 conf
.CHECK_SAMBA3_CHARSET() # see build/charset.py
385 # FIXME: these should be tests for features, but the old build system just
387 host_os
= sys
.platform
388 Logs
.info("building on %s" % host_os
)
390 # Python doesn't have case switches... :/
391 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
392 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
394 conf
.SET_TARGET_TYPE('sunacl', 'EMPTY')
395 if (host_os
.rfind('linux') > -1) or (host_os
.rfind('gnu') > -1) or (host_os
.rfind('qnx') > -1):
396 if host_os
.rfind('linux') > -1:
397 conf
.DEFINE('LINUX', '1')
398 elif host_os
.rfind('qnx') > -1:
399 conf
.DEFINE('QNX', '1')
400 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
401 elif (host_os
.rfind('darwin') > -1):
402 conf
.DEFINE('DARWINOS', 1)
403 conf
.ADD_CFLAGS('-fno-common')
404 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
405 elif (host_os
.rfind('freebsd') > -1):
406 conf
.DEFINE('FREEBSD', 1)
407 if conf
.CHECK_HEADERS('sunacl.h'):
408 conf
.DEFINE('HAVE_FREEBSD_SUNACL_H', '1')
409 conf
.CHECK_FUNCS_IN('acl', 'sunacl')
410 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
411 elif (host_os
.rfind('irix') > -1):
412 conf
.DEFINE('IRIX', 1)
413 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
414 elif (host_os
.rfind('aix') > -1):
415 conf
.DEFINE('AIX', 1)
416 conf
.DEFINE('STAT_ST_BLOCKSIZE', 'DEV_BSIZE')
417 elif (host_os
.rfind('hpux') > -1):
418 conf
.DEFINE('HPUX', 1)
419 conf
.DEFINE('STAT_ST_BLOCKSIZE', '8192')
420 elif (host_os
.rfind('osf') > -1):
421 conf
.DEFINE('OSF1', 1)
422 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
424 # FIXME: Add more checks here.
426 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
428 if Options
.options
.with_acl_support
:
429 if (host_os
.rfind('sysv5') > -1) and conf
.CHECK_FUNCS_IN('sec', 'facl', checklibc
=True):
430 Logs
.info('Using UnixWare ACLs')
431 conf
.DEFINE('HAVE_UNIXWARE_ACLS',1)
432 default_static_modules
.extend(TO_LIST('vfs_solarisacl'))
433 elif (host_os
.rfind('solaris') > -1) and conf
.CHECK_FUNCS_IN('sec', 'facl'):
434 Logs
.info('Using solaris ACLs')
435 conf
.DEFINE('HAVE_SOLARIS_ACLS',1)
436 default_static_modules
.extend(TO_LIST('vfs_solarisacl'))
437 elif (host_os
.rfind('hpux') > -1):
438 Logs
.info('Using HPUX ACLs')
439 conf
.DEFINE('HAVE_HPUX_ACLS',1)
440 conf
.DEFINE('POSIX_ACL_NEEDS_MASK',1)
441 default_static_modules
.extend(TO_LIST('vfs_hpuxacl'))
442 elif (host_os
.rfind('irix') > -1):
443 Logs
.info('Using IRIX ACLs')
444 conf
.DEFINE('HAVE_IRIX_ACLS',1)
445 default_static_modules
.extend(TO_LIST('vfs_irixacl'))
446 elif (host_os
.rfind('aix') > -1):
447 Logs
.info('Using AIX ACLs')
448 conf
.DEFINE('HAVE_AIX_ACLS',1)
449 default_static_modules
.extend(TO_LIST('vfs_aixacl'))
450 elif (host_os
.rfind('osf') > -1) and conf
.CHECK_FUNCS_IN('pacl', 'acl_get_fd'):
451 Logs
.info('Using Tru64 ACLs')
452 conf
.DEFINE('HAVE_TRU64_ACLS',1)
453 default_static_modules
.extend(TO_LIST('vfs_tru64acl'))
454 elif (host_os
.rfind('darwin') > -1):
455 Logs
.warn('ACLs on Dwarwin currently not supported')
457 conf
.CHECK_FUNCS_IN('acl_get_file', 'acl')
458 if conf
.CHECK_CODE('''
461 acl_entry_t *entry_p;
462 return acl_get_entry(acl, entry_id, entry_p);
465 headers
='sys/types.h sys/acl.h', link
=False,
466 msg
="Checking for POSIX ACL support") :
468 acl_permset_t permset_d;
470 return acl_get_perm_np(permset_d, perm);
472 'HAVE_ACL_GET_PERM_NP',
473 headers
='sys/types.h sys/acl.h', link
=True,
474 msg
="Checking whether acl_get_perm_np() is available")
475 default_static_modules
.extend(TO_LIST('vfs_posixacl'))
478 if conf
.CHECK_FUNCS('dirfd'):
479 conf
.DEFINE('HAVE_DIRFD_DECL', 1)
481 conf
.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
482 'HAVE_STATFS_F_FSID',
483 msg
="vfs_fileid checking for statfs() and struct statfs.f_fsid",
484 headers
='sys/types.h sys/statfs.h',
487 if conf
.CONFIG_SET('HAVE_FALLOCATE'):
489 int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
490 'HAVE_LINUX_FALLOCATE',
491 msg
="Checking whether the Linux 'fallocate' function is available",
492 headers
='unistd.h sys/types.h fcntl.h linux/falloc.h')
494 ssize_t err = readahead(0,0,0x80000);''',
495 'HAVE_LINUX_READAHEAD',
496 msg
="Checking whether Linux readahead is available",
497 headers
='unistd.h fcntl.h')
498 conf
.CHECK_DECLS('readahead', headers
='fcntl.h', always
=True)
500 conf
.CHECK_CODE('int fd = openat(AT_FDCWD, ".", O_RDONLY);',
502 msg
='Checking for openat',
505 if Options
.options
.with_aio_support
:
506 conf
.CHECK_FUNCS_IN('aio_read', 'aio')
507 conf
.CHECK_FUNCS_IN('aio_read', 'rt')
508 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);',
510 msg
='Checking for asynchronous io support',
511 headers
='sys/types.h aio.h',
513 if conf
.CONFIG_SET('HAVE_AIO'):
514 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg
='Checking for aio_read', headers
='aio.h', lib
='aio rt')
515 conf
.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg
='Checking for aio_write', headers
='aio.h', lib
='aio rt')
516 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')
517 conf
.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg
='Checking for aio_return', headers
='aio.h', lib
='aio rt')
518 conf
.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg
='Checking for aio_error', headers
='aio.h', lib
='aio rt')
519 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')
520 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')
521 if not conf
.CONFIG_SET('HAVE_AIO'):
522 conf
.DEFINE('HAVE_NO_AIO', '1')
524 conf
.DEFINE('HAVE_NO_AIO', '1')
526 if host_os
.rfind('linux') > -1:
527 conf
.CHECK_FUNCS_IN('io_submit', 'aio')
529 struct io_event ioev;
535 fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
536 io_queue_init(128,&ctx);
537 io_prep_pwrite(ioc, 1, buf, 1, 0);
538 io_prep_pread(ioc, 1, buf, 1, 0);
539 io_set_eventfd(ioc, fd);
540 io_set_callback(ioc, (io_callback_t)(0));
541 io_submit(ctx, 1, &ioc);
542 io_getevents(ctx, 1, 1, &ioev, &ts);
544 'HAVE_LINUX_KERNEL_AIO',
545 msg
='Checking for linux kernel asynchronous io support',
546 headers
='unistd.h stdlib.h sys/types.h fcntl.h sys/eventfd.h libaio.h',
553 char control[CMSG_SPACE(sizeof(int))];
555 msg.msg_control = control_un.control;
556 msg.msg_controllen = sizeof(control_un.control);
558 'HAVE_MSGHDR_MSG_CONTROL',
559 msg
='Checking if we can use msg_control for passing file descriptors',
560 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
564 msg.msg_acctrights = (caddr_t) &fd;
565 msg.msg_acctrightslen = sizeof(fd);
567 'HAVE_MSGHDR_MSG_ACCTRIGHTS',
568 msg
='Checking if we can use msg_acctrights for passing file descriptors',
569 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
571 if Options
.options
.with_winbind
:
572 conf
.env
.build_winbind
= True
573 conf
.DEFINE('WITH_WINBIND', '1')
575 conf
.find_program('awk', var
='AWK')
576 conf
.find_program('perl', var
='PERL')
578 conf
.CHECK_HEADERS('asm/types.h')
580 conf
.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
581 headers
='unistd.h sys/types.h',
582 msg
="Checking for major macro")
584 conf
.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
585 headers
='unistd.h sys/types.h',
586 msg
="Checking for minor macro")
588 conf
.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
589 headers
='unistd.h sys/types.h dirent.h',
590 define
='HAVE_DIRENT_D_OFF')
592 conf
.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent')
593 if conf
.CHECK_CFLAGS('-Werror-implicit-function-declaration'):
594 netgrent_cflags
= '-Werror-implicit-function-declaration'
597 conf
.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE',
598 msg
="Checking for setnetgrent prototype",
599 headers
='netdb.h netgroup.h',
600 cflags
=netgrent_cflags
)
601 conf
.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE',
602 msg
="Checking for getnetgrent prototype",
603 headers
='netdb.h netgroup.h',
604 cflags
=netgrent_cflags
)
605 conf
.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE',
606 msg
="Checking for endnetgrent prototype",
607 headers
='netdb.h netgroup.h',
608 cflags
=netgrent_cflags
)
612 if Options
.options
.with_cups
:
613 conf
.find_program('cups-config', var
='CUPS_CONFIG')
614 if conf
.env
.CUPS_CONFIG
:
615 # we would normally use --libs here, but cups-config incorrectly adds
616 # gssapi_krb5 and other libraries to its --libs output. That breaks the use
617 # of an in-tree heimdal kerberos
618 conf
.check_cfg(path
=conf
.env
.CUPS_CONFIG
, args
="--cflags --ldflags",
619 package
="", uselib_store
="CUPS")
620 conf
.CHECK_HEADERS('cups/cups.h cups/language.h', lib
='cups')
621 conf
.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups')
622 if conf
.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf
.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
623 conf
.DEFINE('HAVE_CUPS', '1')
625 conf
.undefine('HAVE_CUPS')
626 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
628 # define an empty subsystem for cups, to allow it to be used as an empty dependency
629 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
631 if Options
.options
.with_iprint
:
632 if conf
.CONFIG_SET('HAVE_CUPS'):
633 conf
.DEFINE('HAVE_IPRINT', '1')
635 Logs
.warn("--enable-iprint=yes but cups support not sufficient")
636 if Options
.options
.with_syslog
:
637 conf
.DEFINE('WITH_SYSLOG', '1')
638 if Options
.options
.with_automount
:
639 conf
.DEFINE('WITH_AUTOMOUNT', '1')
642 if Options
.options
.with_ldap
:
643 conf
.CHECK_HEADERS('ldap.h lber.h ldap_pvt.h')
644 conf
.CHECK_TYPE('ber_tag_t', 'unsigned int', headers
='ldap.h lber.h')
645 conf
.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
646 conf
.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers
='ldap.h')
648 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
650 conf
.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
651 define
='HAVE_LBER_LOG_PRINT_FN', headers
='lber.h')
653 conf
.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', 'ldap')
654 conf
.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
656 # Check if ldap_set_rebind_proc() takes three arguments
657 if conf
.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
658 'LDAP_SET_REBIND_PROC_ARGS',
659 msg
="Checking whether ldap_set_rebind_proc takes 3 arguments",
660 headers
='ldap.h lber.h', link
=False):
661 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
663 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
665 # last but not least, if ldap_init() exists, we want to use ldap
666 if conf
.CONFIG_SET('HAVE_LDAP_INIT') and conf
.CONFIG_SET('HAVE_LDAP_H'):
667 conf
.DEFINE('HAVE_LDAP', '1')
668 conf
.DEFINE('LDAP_DEPRECATED', '1')
669 conf
.env
['HAVE_LDAP'] = '1'
670 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
671 # SASL wrapping hooks
672 if conf
.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
673 conf
.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
674 conf
.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
676 conf
.SET_TARGET_TYPE('ldap', 'EMPTY')
677 conf
.SET_TARGET_TYPE('lber', 'EMPTY')
679 if Options
.options
.with_ads
== False:
687 if not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and \
688 not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC'):
689 Logs
.warn("arcfour-hmac-md5 encryption type not found in -lkrb5")
691 if not conf
.CONFIG_SET('HAVE_KRB5_MK_REQ_EXTENDED'):
692 Logs
.warn("krb5_mk_req_extended not found in -lkrb5")
694 if not conf
.CONFIG_SET('HAVE_KRB5_GET_HOST_REALM'):
695 Logs
.warn("krb5_get_host_realm not found in -lkrb5")
697 if not conf
.CONFIG_SET('HAVE_KRB5_FREE_HOST_REALM'):
698 Logs
.warn("krb5_free_host_realm not found in -lkrb5")
700 if not conf
.CONFIG_SET('HAVE_KRB5_FWD_TGT_CREDS'):
701 Logs
.warn("krb5_fwd_tgt_creds found in -lkrb5")
703 if not conf
.CONFIG_SET('HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC'):
704 Logs
.warn("krb5_get_init_creds_opt_alloc not found in -lkrb5")
706 if not conf
.CONFIG_SET('KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT'):
707 Logs
.warn("krb5_get_init_creds_opt_free was not found or was too old in -lkrb5")
709 if not conf
.CONFIG_SET('HAVE_KRB5_GET_RENEWED_CREDS'):
710 Logs
.warn("krb5_get_renewed_creds not found in -lkrb5")
712 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL_COMPARE_ANY_REALM'):
713 Logs
.warn("krb5_principal_compare_any_realm not found in -lkrb5")
715 if not conf
.CONFIG_SET('HAVE_KRB5_C_STRING_TO_KEY') and \
716 not conf
.CONFIG_SET('HAVE_KRB5_STRING_TO_KEY_SALT'):
717 Logs
.warn("krb5_c_string_to_key not found in -lkrb5")
719 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL2SALT') and \
720 not conf
.CONFIG_SET('HAVE_KRB5_GET_PW_SALT'):
721 Logs
.warn("no CREATE_KEY_FUNCTIONS detected")
723 if not conf
.CONFIG_SET('HAVE_KRB5_GET_PERMITTED_ENCTYPES') and \
724 not conf
.CONFIG_SET('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES'):
725 Logs
.warn("no GET_ENCTYPES_FUNCTIONS detected")
727 if not conf
.CONFIG_SET('HAVE_KRB5_KT_FREE_ENTRY') and \
728 not conf
.CONFIG_SET('HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS'):
729 Logs
.warn("no KT_FREE_FUNCTION detected")
731 if not conf
.CONFIG_SET('HAVE_KRB5_C_VERIFY_CHECKSUM'):
732 Logs
.warn("krb5_c_verify_checksum_compare not found in -lkrb5")
735 # We don't actually use
736 # gsskrb5_extract_authz_data_from_sec_context, but it is a
737 # clue that this Heimdal, which does the PAC processing we
738 # need on the standard gss_inquire_sec_context_by_oid
739 if not conf
.CONFIG_SET('HAVE_GSS_GET_NAME_ATTRIBUTE') and \
740 not (conf
.CONFIG_SET('HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT') and \
741 conf
.CONFIG_SET('HAVE_GSS_INQUIRE_SEC_CONTEXT_BY_OID')):
742 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")
745 if not conf
.CONFIG_SET('HAVE_GSS_KRB5_EXPORT_LUCID_SEC_CONTEXT'):
746 Logs
.warn("need gss_krb5_export_lucid_sec_context for SPNEGO and gss_wrap support")
750 conf
.DEFINE('HAVE_KRB5', '1')
751 conf
.env
['HAVE_KRB5'] = '1'
753 conf
.undefine('HAVE_KRB5_H')
754 conf
.undefine('HAVE_GSSAPI_H')
755 conf
.undefine('HAVE_GSSAPI_GSSAPI_GENERIC_H')
756 conf
.undefine('HAVE_GSSAPI_GSSAPI_H')
759 if not conf
.CONFIG_SET('HAVE_LDAP'):
764 conf
.DEFINE('WITH_ADS', '1')
765 conf
.env
['HAVE_ADS'] = '1'
766 Logs
.info("Building with Active Directory support.")
767 elif Options
.options
.with_ads
== False:
768 Logs
.info("Building without Active Directory support (--without-ads).")
771 Logs
.warn("Active Directory support not available: krb5 libs don't have all required features")
773 Logs
.warn("Active Directory support not available: LDAP support ist not available.")
774 if Options
.options
.with_ads
:
775 conf
.fatal("Active Directory support not found. Use --without-ads for building without Active Directory support.")
777 # this is the auto-mode case
778 Logs
.warn("Building without Active Directory support.")
781 if Options
.options
.with_utmp
:
782 conf
.env
.with_utmp
= True
783 if not conf
.CHECK_HEADERS('utmp.h'): conf
.env
.with_utmp
= False
784 conf
.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
785 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers
='utmp.h',
786 define
='HAVE_UT_UT_NAME')
787 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers
='utmp.h',
788 define
='HAVE_UT_UT_USER')
789 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers
='utmp.h',
790 define
='HAVE_UT_UT_ID')
791 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers
='utmp.h',
792 define
='HAVE_UT_UT_HOST')
793 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers
='utmp.h',
794 define
='HAVE_UT_UT_TIME')
795 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers
='utmp.h',
796 define
='HAVE_UT_UT_TV')
797 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers
='utmp.h',
798 define
='HAVE_UT_UT_TYPE')
799 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers
='utmp.h',
800 define
='HAVE_UT_UT_PID')
801 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers
='utmp.h',
802 define
='HAVE_UT_UT_EXIT')
803 conf
.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers
='utmpx.h',
804 define
='HAVE_UX_UT_SYSLEN')
805 conf
.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
806 'PUTUTLINE_RETURNS_UTMP', headers
='utmp.h',
807 msg
="Checking whether pututline returns pointer")
808 conf
.CHECK_SIZEOF(['((struct utmp *)NULL)->ut_line'], headers
='utmp.h',
809 define
='SIZEOF_UTMP_UT_LINE')
810 if not conf
.CONFIG_SET('SIZEOF_UTMP_UT_LINE'):
811 conf
.env
.with_utmp
= False
812 elif int(conf
.env
.SIZEOF_UTMP_UT_LINE
) < 15:
813 conf
.env
.with_utmp
= False
814 if conf
.env
.with_utmp
:
815 conf
.DEFINE('WITH_UTMP', 1)
817 Logs
.warn("--with-utmp but utmp support not sufficient")
819 if Options
.options
.with_avahi
:
820 conf
.env
.with_avahi
= True
821 if not conf
.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf
.env
.with_avahi
= False
822 if not conf
.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf
.env
.with_avahi
= False
823 if not conf
.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf
.env
.with_avahi
= False
824 if conf
.env
.with_avahi
:
825 conf
.DEFINE('WITH_AVAHI_SUPPORT', 1)
827 conf
.SET_TARGET_TYPE('avahi-common', 'EMPTY')
828 conf
.SET_TARGET_TYPE('avahi-client', 'EMPTY')
830 if Options
.options
.with_iconv
:
831 conf
.env
.with_iconv
= True
832 if not conf
.CHECK_FUNCS_IN('iconv_open', 'iconv', headers
='iconv.h'):
833 conf
.env
.with_iconv
= False
834 if conf
.env
.with_iconv
:
835 conf
.DEFINE('HAVE_ICONV', 1)
837 if Options
.options
.with_pam
:
839 conf
.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
840 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
841 Logs
.warn("--with-pam=yes but pam_appl.h not found")
843 conf
.CHECK_FUNCS_IN('pam_get_data', 'pam')
844 conf
.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h')
845 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'):
846 Logs
.warn("--with-pam=yes but pam_modules.h not found")
848 conf
.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h')
849 conf
.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h')
850 conf
.CHECK_FUNCS_IN('pam_vsyslog', 'pam')
852 #if defined(HAVE_SECURITY_PAM_APPL_H)
853 #include <security/pam_appl.h>
854 #elif defined(HAVE_PAM_PAM_APPL_H)
855 #include <pam/pam_appl.h>
857 pam_set_item(0, PAM_RHOST, 0);
861 msg
="Checking whether PAM_RHOST is available");
863 #if defined(HAVE_SECURITY_PAM_APPL_H)
864 #include <security/pam_appl.h>
865 #elif defined(HAVE_PAM_PAM_APPL_H)
866 #include <pam/pam_appl.h>
868 pam_set_item(0, PAM_TTY, 0);
872 msg
="Checking whether PAM_TTY is available");
874 #if (!defined(LINUX))
876 #define PAM_EXTERN extern
877 #if defined(HAVE_SECURITY_PAM_APPL_H)
878 #include <security/pam_appl.h>
879 #elif defined(HAVE_PAM_PAM_APPL_H)
880 #include <pam/pam_appl.h>
885 #if defined(HAVE_SECURITY_PAM_MODULES_H)
886 #include <security/pam_modules.h>
887 #elif defined(HAVE_PAM_PAM_MODULES_H)
888 #include <pam/pam_modules.h>
891 #if defined(HAVE_SECURITY__PAM_MACROS_H)
892 #include <security/_pam_macros.h>
893 #elif defined(HAVE_PAM__PAM_MACROS_H)
894 #include <pam/_pam_macros.h>
897 #ifdef HAVE_SECURITY_PAM_EXT_H
898 #include <security/pam_ext.h>
901 int i; i = PAM_RADIO_TYPE;
903 'HAVE_PAM_RADIO_TYPE',
905 msg
="Checking whether PAM_RADIO_TYPE is available");
907 conf
.DEFINE('WITH_PAM', 1)
908 conf
.DEFINE('WITH_PAM_MODULES', 1)
910 if Options
.options
.with_pam_smbpass
:
911 conf
.env
.with_pam_smbpass
= True
916 # Ensure we select the correct set of system calls on Linux.
918 if (host_os
.rfind('linux') > -1):
920 #if defined(HAVE_UNISTD_H)
925 #include <sys/types.h>
928 #ifdef HAVE_SYS_PRIV_H
929 #include <sys/priv.h>
935 #if defined(HAVE_SYSCALL_H)
939 #if defined(HAVE_SYS_SYSCALL_H)
940 #include <sys/syscall.h>
943 syscall(SYS_setresuid32, -1, -1, -1);
944 syscall(SYS_setresgid32, -1, -1, -1);
945 syscall(SYS_setreuid32, -1, -1);
946 syscall(SYS_setregid32, -1, -1);
947 syscall(SYS_setuid32, -1);
948 syscall(SYS_setgid32, -1);
949 syscall(SYS_setgroups32, 0, NULL);
951 'USE_LINUX_32BIT_SYSCALLS',
952 msg
="Checking whether Linux should use 32-bit credential calls");
954 if (conf
.CONFIG_SET('USE_LINUX_32BIT_SYSCALLS')):
955 seteuid
= conf
.CHECK_CODE('''
956 #define AUTOCONF_TEST 1
957 #define USE_LINUX_THREAD_CREDENTIALS 1
958 #define USE_LINUX_32BIT_SYSCALLS 1
959 #include "../lib/util/setid.c"
960 #include "./lib/util_sec.c"
962 'USE_LINUX_THREAD_CREDENTIALS',
965 msg
="Checking whether we can use Linux thread-specific credentials with 32-bit system calls")
967 seteuid
= conf
.CHECK_CODE('''
968 #define AUTOCONF_TEST 1
969 #define USE_LINUX_THREAD_CREDENTIALS 1
970 #include "../lib/util/setid.c"
971 #include "./lib/util_sec.c"
973 'USE_LINUX_THREAD_CREDENTIALS',
976 msg
="Checking whether we can use Linux thread-specific credentials")
978 seteuid
= conf
.CHECK_CODE('''
979 #define AUTOCONF_TEST 1
980 #define USE_SETREUID 1
981 #include "../lib/util/setid.c"
982 #include "./lib/util_sec.c"
987 msg
="Checking whether setreuid is available")
989 seteuid
= conf
.CHECK_CODE('''
990 #define AUTOCONF_TEST 1
991 #define USE_SETRESUID 1
992 #include "../lib/util/setid.c"
993 #include "./lib/util_sec.c"
998 msg
="Checking whether setresuid is available")
1000 seteuid
= conf
.CHECK_CODE('''
1001 #define AUTOCONF_TEST 1
1002 #define USE_SETEUID 1
1003 #include "../lib/util/setid.c"
1004 #include "./lib/util_sec.c"
1009 msg
="Checking whether seteuid is available")
1011 seteuid
= conf
.CHECK_CODE('''
1012 #define AUTOCONF_TEST 1
1013 #define USE_SETUIDX 1
1014 #include "../lib/util/setid.c"
1015 #include "./lib/util_sec.c"
1021 msg
="Checking whether setuidx is available")
1022 if Options
.options
.with_dnsupdate
:
1023 if not conf
.CONFIG_SET('HAVE_KRB5'):
1024 Logs
.warn("--with-dnsupdate=yes but gssapi support not sufficient")
1026 conf
.DEFINE('WITH_DNS_UPDATES', 1)
1027 conf
.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
1028 if Options
.options
.developer
:
1029 if conf
.CONFIG_SET('HAVE_VALGRIND_H') or conf
.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'):
1030 conf
.DEFINE('VALGRIND', '1')
1032 if conf
.CHECK_CODE('''
1033 #include <bits/sockaddr.h>
1034 #include <linux/netlink.h>
1036 'HAVE_LINUX_NETLINK_H',
1037 msg
="Checking whether Linux netlink is available"):
1040 #include <bits/sockaddr.h>
1041 #include <linux/netlink.h>
1042 #include <linux/rtnetlink.h>
1044 'HAVE_LINUX_RTNETLINK_H',
1045 msg
='Checking whether Linux rtnetlink is available')
1048 #include "../tests/fcntl_lock.c"
1053 msg
='Checking whether fcntl locking is available')
1055 # glibc up to 2.3.6 had dangerously broken posix_fallocate(). DON'T USE IT.
1056 if not conf
.CHECK_CODE('''
1057 #define _XOPEN_SOURCE 600
1059 #if defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4))
1060 #error probably broken posix_fallocate
1063 '_HAVE_UNBROKEN_POSIX_FALLOCATE',
1064 msg
='Checking for broken posix_fallocate'):
1065 conf
.DEFINE('HAVE_BROKEN_POSIX_FALLOCATE', '1')
1068 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec',
1069 define
='HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') # Linux, Solaris
1070 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimensec',
1071 define
='HAVE_STRUCT_STAT_ST_MTIMENSEC') # BSD, if defined _POSIX_SOURCE
1072 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimespec.tv_nsec',
1073 define
='HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') # BSD, if not defined _POSIX_SOURCE
1074 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtime_n',
1075 define
='HAVE_STRUCT_STAT_ST_MTIME_N') # AIX
1076 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_umtime',
1077 define
='HAVE_STRUCT_STAT_ST_UMTIME') # Tru64
1078 if conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') or \
1079 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMENSEC') or \
1080 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') or \
1081 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIME_N') or \
1082 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_UMTIME'):
1083 conf
.DEFINE('HAVE_STAT_HIRES_TIMESTAMPS', '1')
1085 # recent FreeBSD, NetBSD have creation timestamps called birthtime:
1086 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtime',
1087 define
='HAVE_STRUCT_STAT_ST_BIRTHTIME')
1088 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimespec.tv_nsec',
1089 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC')
1090 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimensec',
1091 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC')
1094 ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
1096 'HAVE_POSIX_FADVISE',
1097 msg
='Checking whether posix_fadvise is available',
1098 headers
='unistd.h fcntl.h')
1100 for v
in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]:
1103 return sysconf(%s) == -1 ? 1 : 0;
1106 msg
='Checking whether sysconf(%s) is available' % v
)
1109 #include <sys/syscall.h>
1111 syscall(SYS_initgroups, 16, NULL, NULL, 0);
1113 'HAVE_DARWIN_INITGROUPS',
1114 msg
='Checking whether to use the Darwin-specific initgroups system call')
1116 conf
.CHECK_CODE('''struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''',
1118 headers
='sys/types.h utime.h',
1119 msg
='Checking whether struct utimbuf is available')
1121 if conf
.CHECK_CODE('''struct sigevent s;''',
1122 'HAVE_STRUCT_SIGEVENT',
1123 headers
='sys/types.h stdlib.h stddef.h signal.h',
1124 msg
='Checking whether we have the struct sigevent'):
1125 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sival_ptr',
1126 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR',
1127 headers
='signal.h');
1128 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sigval_ptr',
1129 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR',
1130 headers
='signal.h');
1132 if os
.path
.exists('/proc/sys/kernel/core_pattern'):
1133 conf
.DEFINE('HAVE_SYS_KERNEL_PROC_CORE_PATTERN', '1')
1135 if conf
.CHECK_CODE('''
1139 if (sizeof(time_t) == 8) {
1140 time_t max_time = 0x7fffffffffffffffll;
1141 tm = gmtime(&max_time);
1142 /* This should fail with 32-bit tm_year. */
1144 /* Max time_t that works with 32-bit int tm_year in struct tm. */
1145 max_time = 67768036191676799ll;
1146 tm = gmtime(&max_time);
1157 msg
="Checking for the maximum value of the 'time_t' type"):
1158 conf
.DEFINE('TIME_T_MAX', '67768036191676799ll')
1161 #if defined(HAVE_UNISTD_H)
1164 #include <sys/types.h>
1165 main() { dev_t dev = makedev(1,2); return 0; }
1169 msg
='Checking whether the macro for makedev is available')
1176 void exit_on_core(int ignored) {
1182 signal(SIGSEGV, exit_on_core);
1183 newpath = realpath("/tmp", NULL);
1184 exit((newpath != NULL) ? 0 : 1);
1187 'REALPATH_TAKES_NULL',
1190 msg
='Checking whether the realpath function allows a NULL argument')
1192 conf
.CHECK_CODE('''#include "../tests/ftruncate.c"''',
1193 'HAVE_FTRUNCATE_EXTEND',
1194 msg
='Checking for ftruncate extend',
1198 if Options
.options
.with_sendfile_support
:
1199 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):
1204 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1207 headers
='sys/sendfile.h',
1208 msg
='Checking for linux sendfile support')
1210 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1211 conf
.DEFINE('HAVE_SENDFILE', '1')
1212 conf
.DEFINE('LINUX_SENDFILE_API', '1')
1213 conf
.DEFINE('WITH_SENDFILE', '1')
1214 elif (host_os
.rfind('freebsd') > -1) or (host_os
.rfind('dragonfly') > -1):
1216 #include <sys/types.h>
1218 #include <sys/socket.h>
1219 #include <sys/uio.h>
1220 int fromfd, tofd, ret, total=0;
1221 off_t offset, nwritten;
1224 hdr.headers = &hdtrl;
1226 hdr.trailers = NULL;
1228 hdtrl.iov_base = NULL;
1230 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0)
1233 msg
='Checking for freebsd sendfile support')
1234 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1235 conf
.DEFINE('HAVE_SENDFILE', '1')
1236 conf
.DEFINE('FREEBSD_SENDFILE_API', '1')
1237 conf
.DEFINE('WITH_SENDFILE', '1')
1238 elif (host_os
.rfind('darwin') > -1):
1240 #include <sys/types.h>
1241 #include <sys/socket.h>
1242 #include <sys/uio.h>
1243 int fromfd, tofd, ret;
1244 off_t offset, nwritten;
1247 hdr.headers = &hdtrl;
1249 hdr.trailers = (void *)0;
1251 hdtrl.iov_base = (void *)0;
1253 ret = sendfile(fromfd, tofd, offset, &nwritten, &hdr, 0);
1256 msg
='Checking for darwin sendfile support')
1257 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1258 conf
.DEFINE('HAVE_SENDFILE', '1')
1259 conf
.DEFINE('DARWIN_SENDFILE_API', '1')
1260 conf
.DEFINE('WITH_SENDFILE', '1')
1261 elif (host_os
.rfind('hpux') > -1) or (host_os
.rfind('osf') > -1):
1263 #include <sys/socket.h>
1264 #include <sys/uio.h>
1267 struct iovec hdtrl[2];
1270 hdtrl[0].iov_base = 0;
1271 hdtrl[0].iov_len = 0;
1272 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
1275 msg
='Checking for osf/hpux sendfile support')
1276 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1277 conf
.DEFINE('HAVE_SENDFILE', '1')
1278 conf
.DEFINE('HPUX_SENDFILE_API', '1')
1279 conf
.DEFINE('WITH_SENDFILE', '1')
1280 elif (host_os
.rfind('solaris') > -1):
1281 conf
.CHECK_FUNCS_IN('sendfile', 'sendfilev')
1283 #include <sys/sendfile.h>,
1286 struct sendfilevec vec[2];
1290 vec[0].sfv_fd = SFV_FD_SELF;
1291 vec[0].sfv_flag = 0;
1295 vec[1].sfv_flag = 0;
1298 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
1301 msg
='Checking for solaris sendfilev support')
1302 if conf
.CONFIG_SET('_HAVE_SENDFILEV'):
1303 conf
.DEFINE('HAVE_SENDFILEV', '1')
1304 conf
.DEFINE('SOLARIS_SENDFILE_API', '1')
1305 conf
.DEFINE('WITH_SENDFILE', '1')
1306 elif (host_os
.rfind('aix') > -1):
1308 #include <sys/socket.h>
1311 struct sf_parms hdtrl;
1313 hdtrl.header_data = 0;
1314 hdtrl.header_length = 0;
1315 hdtrl.file_descriptor = fromfd;
1316 hdtrl.file_offset = 0;
1317 hdtrl.file_bytes = 0;
1318 hdtrl.trailer_data = 0;
1319 hdtrl.trailer_length = 0;
1320 nwritten = send_file(&tofd, &hdtrl, 0);
1323 msg
='Checking for AIX send_file support')
1324 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1325 conf
.DEFINE('HAVE_SENDFILE', '1')
1326 conf
.DEFINE('AIX_SENDFILE_API', '1')
1327 conf
.DEFINE('WITH_SENDFILE', '1')
1329 # Check for getcwd allowing a NULL arg.
1333 char *s = getcwd(NULL,0);
1334 exit(s != NULL ? 0 : 1);
1335 }''', 'GETCWD_TAKES_NULL', addmain
=False, execute
=True,
1336 msg
="getcwd takes a NULL argument")
1339 # UnixWare 7.x has its getspnam in -lgen
1340 conf
.CHECK_FUNCS_IN('getspnam', 'gen')
1341 conf
.CHECK_FUNCS_IN('getspnam', 'security')
1342 conf
.CHECK_FUNCS_IN('getspnam', 'sec')
1344 if Options
.options
.with_quotas
:
1345 # For quotas on Veritas VxFS filesystems
1346 conf
.CHECK_HEADERS('sys/fs/vx_quota.h')
1347 # For sys/quota.h and linux/quota.h
1348 conf
.CHECK_HEADERS('sys/quota.h')
1349 # For quotas on BSD systems
1350 conf
.CHECK_HEADERS('ufs/ufs/quota.h')
1351 # For quotas on Linux XFS filesystems
1352 if conf
.CHECK_HEADERS('xfs/xqm.h'):
1353 conf
.DEFINE('HAVE_XFS_QUOTAS', '1')
1357 #include "confdefs.h"
1358 #ifdef HAVE_SYS_TYPES_H
1359 #include <sys/types.h>
1361 #ifdef HAVE_ASM_TYPES_H
1362 #include <asm/types.h>
1364 #include <sys/quota.h>
1365 int i = Q_XGETQUOTA;''',
1366 define
='HAVE_XFS_QUOTAS',
1367 msg
='for XFS QUOTA in <sys/quota.h>',
1369 local_include
=False)
1371 # For IRIX like dqb_isoftlimit instead of dqb_fsoftlimit in struc dqblk
1372 conf
.CHECK_STRUCTURE_MEMBER('struct dqblk', 'dqb_fsoftlimit', define
='HAVE_DQB_FSOFTLIMIT',
1373 headers
='sys/quota.h')
1374 #darwin style quota bytecount
1375 conf
.CHECK_STRUCTURE_MEMBER('struct dqblk', 'dqb_curbytes', define
='HAVE_STRUCT_DQBLK_DQB_CURBYTES',
1376 headers
='sys/quota.h')
1377 if conf
.CHECK_HEADERS('rpcsvc/rquota.h'):
1378 conf
.DEFINE('HAVE_NFS_QUOTAS', '1')
1379 conf
.CHECK_STRUCTURE_MEMBER('struct getquota_rslt', 'getquota_rslt_u',
1380 define
='HAVE_GETQUOTA_RSLT_GETQUOTA_RSLT_U',
1381 headers
='rpcsvc/rquota.h')
1383 if (host_os
.rfind('linux') > -1):
1384 conf
.DEFINE('HAVE_QUOTACTL_LINUX', '1')
1385 elif not conf
.CONFIG_SET("HAVE_XFS_QUOTAS"):
1386 if not conf
.CHECK_CODE('''
1387 #define HAVE_QUOTACTL_4A 1
1388 #define AUTOCONF_TEST 1
1389 #include "../tests/sysquotas.c"
1391 cflags
=conf
.env
['WERROR_CFLAGS'],
1392 define
='HAVE_QUOTACTL_4A',
1393 msg
='for QUOTACTL_4A: long quotactl(int cmd, char *special, qid_t id, caddr_t addr)',
1398 #define HAVE_QUOTACTL_4B 1
1399 #define AUTOCONF_TEST 1
1400 #include "../tests/sysquotas.c"
1402 cflags
=conf
.env
['WERROR_CFLAGS'],
1403 define
='HAVE_QUOTACTL_4B',
1404 msg
='for QUOTACTL_4B: int quotactl(const char *path, int cmd, int id, char *addr)',
1409 clnt_create("", RQUOTAPROG, RQUOTAVERS, "udp");
1411 headers
="rpc/rpc.h rpc/types.h rpcsvc/rquota.h rpc/nettype.h rpc/xdr.h",
1412 define
='HAVE_NFS_QUOTAS',
1413 msg
='for NFS QUOTAS',
1415 local_include
=False)
1417 if conf
.CONFIG_SET('HAVE_QUOTACTL_LINUX') or \
1418 conf
.CONFIG_SET('HAVE_QUOTACTL_4A') or \
1419 conf
.CONFIG_SET('HAVE_QUOTACTL_4B') or \
1420 conf
.CONFIG_SET('HAVE_XFS_QUOTAS'):
1421 conf
.DEFINE('HAVE_SYS_QUOTAS', '1')
1422 conf
.DEFINE('WITH_QUOTAS', '1')
1425 # checking for clustering extensions (CTDB)
1427 if Options
.options
.with_cluster_support
== False:
1428 # configure is called with --without-cluster-support,
1429 # so don't check for and build w/o ctdb support.
1430 have_cluster_support
= False
1434 if Options
.options
.ctdb_dir
:
1435 conf
.ADD_EXTRA_INCLUDES(Options
.options
.ctdb_dir
+ '/include')
1437 srcdir
= os
.path
.realpath(conf
.srcdir
)
1438 if 'EXTRA_INCLUDES' in conf
.env
:
1439 includes
= ' '.join(conf
.env
['EXTRA_INCLUDES']).replace('#', srcdir
+ '/')
1443 if not conf
.env
.USING_SYSTEM_TDB
:
1444 includes
= includes
+ ' ' + srcdir
+ '/lib/tdb/include'
1446 if not conf
.env
.USING_SYSTEM_TALLOC
:
1447 includes
= includes
+ ' ' + srcdir
+ '/lib/talloc'
1449 have_cluster_support
= True
1454 #include "replace.h"
1455 #include "system/wait.h"
1456 #include "system/network.h"
1457 #define private #error __USED_RESERVED_WORD_private__
1470 msg
='Checking for header ctdb.h')
1472 if not conf
.CONFIG_SET('HAVE_CTDB_H'):
1473 have_cluster_support
= False
1474 ctdb_broken
= "ctdb.h is required for cluster support"
1476 if have_cluster_support
:
1479 #include "replace.h"
1480 #include "system/wait.h"
1481 #include "system/network.h"
1482 #define private #error __USED_RESERVED_WORD_private__
1486 #include <ctdb_private.h>
1493 'HAVE_CTDB_PRIVATE_H',
1496 msg
='Checking for header ctdb_private.h')
1498 if not conf
.CONFIG_SET('HAVE_CTDB_PRIVATE_H'):
1499 have_cluster_support
= False
1500 ctdb_broken
= "ctdb_private.h is required for cluster support"
1502 if have_cluster_support
:
1505 #include "replace.h"
1506 #include "system/wait.h"
1507 #include "system/network.h"
1508 #define private #error __USED_RESERVED_WORD_private__
1512 #include <ctdb_protocol.h>
1519 'HAVE_CTDB_PROTOCOL_H',
1522 msg
='Checking for header ctdb_protocol.h')
1524 if have_cluster_support
:
1527 #include "replace.h"
1528 #include "system/wait.h"
1529 #include "system/network.h"
1533 #include <ctdb_private.h>
1537 int i = (int)CTDB_CONTROL_TRANS3_COMMIT;
1541 'HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL',
1544 msg
='Checking for transaction support (TRANS3_COMMIT control)')
1546 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL'):
1547 have_cluster_support
= False
1548 ctdb_broken
= "ctdb transaction support missing or too old"
1550 if have_cluster_support
:
1553 #include "replace.h"
1554 #include "system/wait.h"
1555 #include "system/network.h"
1559 #include <ctdb_private.h>
1563 int i = (int)CTDB_CONTROL_SCHEDULE_FOR_DELETION;
1567 'HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL',
1570 msg
='Checking for SCHEDULE_FOR_DELETION control')
1572 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL'):
1573 if not Options
.options
.enable_old_ctdb
:
1574 have_cluster_support
= False
1575 ctdb_broken
= "SCHEDULE_FOR_DELETION control missing"
1577 Logs
.warn("ignoring missing SCHEDULE_FOR_DELETION control (--enable-old-ctdb)")
1579 if have_cluster_support
:
1582 #include "replace.h"
1583 #include "system/wait.h"
1584 #include "system/network.h"
1588 #include <ctdb_private.h>
1592 struct ctdb_control_tcp _x;
1596 'HAVE_STRUCT_CTDB_CONTROL_TCP',
1599 msg
='Checking for ctdb ipv4 support')
1601 if not conf
.CONFIG_SET('HAVE_STRUCT_CTDB_CONTROL_TCP'):
1602 have_cluster_support
= False
1603 ctdb_broken
= "missing struct ctdb_control_tcp"
1605 if have_cluster_support
:
1608 #include "replace.h"
1609 #include "system/wait.h"
1610 #include "system/network.h"
1614 #include <ctdb_private.h>
1618 struct ctdb_control_tcp_addr _x;
1622 'HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR',
1625 msg
='Checking for ctdb ipv6 support')
1627 if have_cluster_support
:
1630 #include "replace.h"
1631 #include "system/wait.h"
1632 #include "system/network.h"
1636 #include <ctdb_private.h>
1640 int i = (int)CTDB_CONTROL_CHECK_SRVIDS;
1644 'HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL',
1647 msg
='Checking for CHECK_SRVIDS control')
1649 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL'):
1650 if not Options
.options
.enable_old_ctdb
:
1651 have_cluster_support
= False
1652 ctdb_broken
= "CHECK_SRVIDS control missing"
1654 Logs
.warn("ignoring missing CHECK_SRVIDS control (--enable-old-ctdb)")
1656 if have_cluster_support
:
1657 Logs
.info("building with cluster support")
1658 conf
.DEFINE('CLUSTER_SUPPORT', 1);
1660 if Options
.options
.with_cluster_support
== False:
1661 Logs
.info("building without cluster support (--without-cluster-support)")
1662 elif Options
.options
.with_cluster_support
== True:
1663 Logs
.error("Cluster support not available: " + ctdb_broken
)
1664 conf
.fatal("Cluster support not found, but --with-cluster-support was specified")
1666 Logs
.info("building without cluster support: " + ctdb_broken
)
1667 conf
.undefine('CLUSTER_SUPPORT')
1670 conf
.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }',
1671 'HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR',
1674 msg
='Checking whether we can compile with __attribute__((destructor))')
1676 conf
.CHECK_CODE('void seekdir(DIR *d, long loc) { return; }',
1677 'SEEKDIR_RETURNS_VOID',
1678 headers
='sys/types.h dirent.h',
1679 msg
='Checking whether seekdir returns void')
1681 if Options
.options
.with_profiling_data
:
1682 conf
.DEFINE('WITH_PROFILE', 1);
1684 PTHREAD_CFLAGS
='error'
1685 PTHREAD_LDFLAGS
='error'
1687 if PTHREAD_LDFLAGS
== 'error':
1688 if conf
.CHECK_FUNCS_IN('pthread_attr_init', 'pthread'):
1689 PTHREAD_CFLAGS
='-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS'
1690 PTHREAD_LDFLAGS
='-lpthread'
1691 if PTHREAD_LDFLAGS
== 'error':
1692 if conf
.CHECK_FUNCS_IN('pthread_attr_init', 'pthreads'):
1693 PTHREAD_CFLAGS
='-D_THREAD_SAFE'
1694 PTHREAD_LDFLAGS
='-lpthreads'
1695 if PTHREAD_LDFLAGS
== 'error':
1696 if conf
.CHECK_FUNCS_IN('pthread_attr_init', 'c_r'):
1697 PTHREAD_CFLAGS
='-D_THREAD_SAFE -pthread'
1698 PTHREAD_LDFLAGS
='-pthread'
1699 if PTHREAD_LDFLAGS
== 'error':
1700 if conf
.CHECK_FUNCS('pthread_attr_init'):
1701 PTHREAD_CFLAGS
='-D_REENTRANT'
1702 PTHREAD_LDFLAGS
='-lpthread'
1703 # especially for HP-UX, where the CHECK_FUNC macro fails to test for
1704 # pthread_attr_init. On pthread_mutex_lock it works there...
1705 if PTHREAD_LDFLAGS
== 'error':
1706 if conf
.CHECK_FUNCS_IN('pthread_mutex_lock', 'pthread'):
1707 PTHREAD_CFLAGS
='-D_REENTRANT'
1708 PTHREAD_LDFLAGS
='-lpthread'
1710 if PTHREAD_CFLAGS
!= 'error' and PTHREAD_LDFLAGS
!= 'error':
1711 conf
.ADD_CFLAGS(PTHREAD_CFLAGS
)
1712 conf
.ADD_LDFLAGS(PTHREAD_LDFLAGS
)
1713 conf
.CHECK_HEADERS('pthread.h')
1714 conf
.DEFINE('HAVE_PTHREAD', '1')
1716 if Options
.options
.with_pthreadpool
:
1717 if conf
.CONFIG_SET('HAVE_PTHREAD'):
1718 conf
.DEFINE('WITH_PTHREADPOOL', '1')
1720 Logs
.warn("pthreadpool support cannot be enabled when pthread support was not found")
1721 conf
.undefine('WITH_PTHREADPOOL')
1723 if conf
.CHECK_HEADERS('gpfs_gpl.h'):
1724 conf
.DEFINE('HAVE_GPFS', '1')
1726 default_static_modules
.extend(TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
1727 auth_sam auth_unix auth_winbind auth_wbc
1728 auth_domain auth_builtin vfs_default
1729 nss_info_template idmap_tdb idmap_passdb
1732 default_shared_modules
.extend(TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
1733 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
1734 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2
1735 auth_script vfs_readahead vfs_xattr_tdb vfs_posix_eadb
1736 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
1737 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
1740 vfs_crossrename vfs_linux_xfs_sgid
1741 vfs_time_audit idmap_autorid idmap_tdb2
1742 idmap_rid idmap_hash'''))
1744 if Options
.options
.developer
:
1745 default_static_modules
.extend(TO_LIST('charset_weird'))
1746 default_shared_modules
.extend(TO_LIST('perfcount_test'))
1747 default_shared_modules
.extend(TO_LIST('vfs_skel_opaque vfs_skel_transparent vfs_shadow_copy_test'))
1748 default_shared_modules
.extend(TO_LIST('auth_skel pdb_test'))
1750 if Options
.options
.enable_selftest
or Options
.options
.developer
:
1751 default_shared_modules
.extend(TO_LIST('vfs_fake_acls'))
1754 if conf
.CONFIG_SET('AD_DC_BUILD_IS_ENABLED'):
1755 default_static_modules
.extend(TO_LIST('pdb_samba_dsdb auth_samba4 vfs_dfs_samba4'))
1757 if conf
.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'):
1758 default_shared_modules
.extend(TO_LIST('vfs_zfsacl'))
1760 if conf
.CONFIG_SET('HAVE_DIRFD_DECL'):
1761 default_shared_modules
.extend(TO_LIST('vfs_syncops vfs_dirsort'))
1763 if conf
.CONFIG_SET('HAVE_STATFS_F_FSID'):
1764 default_shared_modules
.extend(TO_LIST('vfs_fileid'))
1766 if (conf
.CONFIG_SET('HAVE_MSGHDR_MSG_CONTROL') or conf
.CONFIG_SET('HAVE_MSGHDR_MSG_ACCTRIGHTS')):
1767 default_shared_modules
.extend(TO_LIST('vfs_aio_fork'))
1769 if Options
.options
.with_pthreadpool
:
1770 default_shared_modules
.extend(TO_LIST('vfs_aio_pthread'))
1772 if conf
.CONFIG_SET('HAVE_AIO'):
1773 default_shared_modules
.extend(TO_LIST('vfs_aio_posix'))
1775 if conf
.CONFIG_SET('HAVE_LINUX_KERNEL_AIO'):
1776 default_shared_modules
.extend(TO_LIST('vfs_aio_linux'))
1778 if conf
.CONFIG_SET('HAVE_LDAP'):
1779 default_static_modules
.extend(TO_LIST('pdb_ldapsam idmap_ldap'))
1781 if conf
.CONFIG_SET('DARWINOS'):
1782 default_static_modules
.extend(TO_LIST('charset_macosxfs'))
1784 if conf
.CONFIG_SET('HAVE_GPFS'):
1785 default_shared_modules
.extend(TO_LIST('vfs_gpfs'))
1787 if conf
.CONFIG_SET('SAMBA_FAM_LIBS'):
1788 default_shared_modules
.extend(TO_LIST('vfs_notify_fam'))
1790 explicit_shared_modules
= TO_LIST(Options
.options
.shared_modules
, delimiter
=',')
1791 explicit_static_modules
= TO_LIST(Options
.options
.static_modules
, delimiter
=',')
1793 def replace_list_item(lst
, item
, value
):
1795 idx
= lst
.index(item
)
1799 # PDB module file name should have the same name as module registers itself
1800 # In Autoconf build we export LDAP passdb module as ldapsam but WAF build
1801 # was always exporting pdb_ldap. In order to support existing packages
1802 # allow referring to pdb_ldapsam as pdb_ldap but use proper name internally.
1803 replace_list_item(explicit_shared_modules
, 'pdb_ldap', 'pdb_ldapsam')
1804 replace_list_item(explicit_static_modules
, 'pdb_ldap', 'pdb_ldapsam')
1806 final_static_modules
= default_static_modules
1807 final_shared_modules
= default_shared_modules
1809 for m
in explicit_static_modules
:
1810 if m
in final_shared_modules
:
1811 final_shared_modules
.remove(m
)
1812 final_static_modules
.append(m
)
1813 for m
in explicit_shared_modules
:
1814 if m
in final_static_modules
:
1815 final_static_modules
.remove(m
)
1816 final_shared_modules
.append(m
)
1818 if ("auth_domain" not in final_static_modules
) or \
1819 ("auth_builtin" not in final_static_modules
) or \
1820 ("auth_sam" not in final_static_modules
) or \
1821 ("auth_winbind" not in final_static_modules
):
1822 raise Utils
.WafError('These auth modules MUST be configured as static modules: auth_domain, auth_builtin, auth_sam, auth_winbind')
1824 conf
.env
['static_modules'] = final_static_modules
1825 conf
.env
['shared_modules'] = final_shared_modules
1827 conf
.DEFINE('STRING_STATIC_MODULES', ' '.join(final_static_modules
), quote
=True)
1832 prefixes
= ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
1833 conf
.env
['MODULE_PREFIXES'] = prefixes
1835 for m
in final_static_modules
:
1837 if not p
in static_list
:
1839 static_list
[p
].append(m
)
1840 for m
in final_shared_modules
:
1842 if not p
in shared_list
:
1844 shared_list
[p
].append(m
)
1847 static_env
= "%s_STATIC" % p
.upper()
1848 shared_env
= "%s_SHARED" % p
.upper()
1849 conf
.env
[static_env
] = []
1850 conf
.env
[shared_env
] = []
1851 if p
in static_list
:
1853 for entry
in static_list
[p
]:
1854 decl_list
+= "extern NTSTATUS %s_init(void); " % entry
1855 conf
.env
[static_env
].append('%s' % entry
)
1856 decl_list
= decl_list
.rstrip()
1857 conf
.DEFINE('static_decl_%s' % p
, decl_list
)
1858 conf
.DEFINE('static_init_%s' % p
, '{ %s_init(); }' % '_init(); '.join(static_list
[p
]))
1860 conf
.DEFINE('static_decl_%s' % p
, '')
1861 conf
.DEFINE('static_init_%s' % p
, '{}')
1862 if p
in shared_list
:
1863 for entry
in shared_list
[p
]:
1864 conf
.DEFINE('%s_init' % entry
, 'samba_init_module')
1865 conf
.env
[shared_env
].append('%s' % entry
)
1867 conf
.SAMBA_CONFIG_H('include/config.h')
1870 "build 'tags' file using ctags"
1872 source_root
= os
.path
.dirname(Utils
.g_module
.root_path
)
1873 cmd
= 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
1874 print("Running: %s" % cmd
)