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('ads')
27 opt
.SAMBA3_ADD_OPTION('ldap')
28 opt
.SAMBA3_ADD_OPTION('cups', with_name
="enable", without_name
="disable")
29 opt
.SAMBA3_ADD_OPTION('iprint', with_name
="enable", without_name
="disable")
30 opt
.SAMBA3_ADD_OPTION('pam')
31 opt
.SAMBA3_ADD_OPTION('pam_smbpass')
32 opt
.SAMBA3_ADD_OPTION('quotas')
33 opt
.SAMBA3_ADD_OPTION('sendfile-support')
34 opt
.SAMBA3_ADD_OPTION('utmp')
35 opt
.SAMBA3_ADD_OPTION('pthreadpool', with_name
="enable", without_name
="disable", default
=True)
36 opt
.SAMBA3_ADD_OPTION('avahi', with_name
="enable", without_name
="disable")
37 opt
.SAMBA3_ADD_OPTION('iconv')
38 opt
.SAMBA3_ADD_OPTION('acl-support')
39 opt
.SAMBA3_ADD_OPTION('dnsupdate')
40 opt
.SAMBA3_ADD_OPTION('syslog')
41 opt
.SAMBA3_ADD_OPTION('automount')
42 opt
.SAMBA3_ADD_OPTION('aio-support')
43 opt
.SAMBA3_ADD_OPTION('dmapi', default
=None) # None means autodetection
44 opt
.SAMBA3_ADD_OPTION('fam', default
=None) # None means autodetection
45 opt
.SAMBA3_ADD_OPTION('profiling-data', default
=False)
46 opt
.SAMBA3_ADD_OPTION('libarchive', default
=None)
48 opt
.SAMBA3_ADD_OPTION('cluster-support', default
=None)
50 opt
.SAMBA3_ADD_OPTION('regedit', default
=None)
52 opt
.SAMBA3_ADD_OPTION('fake-kaserver',
53 help=("Include AFS fake-kaserver support"), default
=False)
55 opt
.add_option('--with-ctdb-dir',
56 help=("Directory under which ctdb is installed"),
57 action
="store", dest
='ctdb_dir', default
=None)
58 opt
.add_option('--enable-old-ctdb',
59 help=("enable building against (too) old version of ctdb (default=false)"),
60 action
="store_true", dest
='enable_old_ctdb', default
=False)
62 opt
.add_option('--with-libcephfs',
63 help=("Directory under which libcephfs is installed"),
64 action
="store", dest
='libcephfs_dir', default
=None)
66 opt
.SAMBA3_ADD_OPTION('glusterfs', with_name
="enable", without_name
="disable", default
=True)
68 opt
.add_option('--enable-vxfs',
69 help=("enable support for VxFS (default=no)"),
70 action
="store_true", dest
='enable_vxfs', default
=False)
74 from samba_utils
import TO_LIST
76 default_static_modules
= []
77 default_shared_modules
= []
79 if Options
.options
.developer
:
80 conf
.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
81 conf
.env
.developer
= True
83 if sys
.platform
!= 'openbsd5':
84 conf
.ADD_LDFLAGS("-Wl,--export-dynamic", testflags
=True)
86 conf
.CHECK_HEADERS('execinfo.h libexc.h libunwind.h netdb.h')
87 conf
.CHECK_HEADERS('linux/falloc.h')
89 conf
.CHECK_FUNCS('getcwd fchown chmod fchmod mknod')
90 conf
.CHECK_FUNCS('strtol strchr strupr chflags')
91 conf
.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
92 conf
.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
93 conf
.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr')
94 conf
.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
95 conf
.CHECK_FUNCS('setpriv setgidx setuidx setgroups syscall sysconf')
96 conf
.CHECK_FUNCS('atexit grantpt posix_openpt fallocate posix_fallocate')
97 conf
.CHECK_FUNCS('fseeko setluid')
98 conf
.CHECK_FUNCS('getpwnam', headers
='sys/types.h pwd.h')
99 conf
.CHECK_FUNCS('fdopendir')
100 conf
.CHECK_FUNCS('fstatat')
101 conf
.CHECK_FUNCS('getpwent_r setenv strcasecmp fcvt fcvtl')
102 conf
.CHECK_FUNCS('syslog vsyslog timegm setlocale')
103 conf
.CHECK_FUNCS_IN('nanosleep', 'rt')
104 conf
.CHECK_FUNCS('lutimes futimes utimensat futimens')
105 conf
.CHECK_FUNCS('mlock munlock mlockall munlockall')
106 conf
.CHECK_FUNCS('memalign posix_memalign hstrerror')
107 conf
.CHECK_FUNCS('shmget')
108 conf
.CHECK_FUNCS_IN('shm_open', 'rt', checklibc
=True)
109 #FIXME: for some reason this one still fails
110 conf
.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
111 conf
.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
112 conf
.CHECK_FUNCS_IN('dn_expand', 'inet')
113 conf
.CHECK_DECLS('fdatasync', reverse
=True)
114 conf
.CHECK_DECLS('readahead', reverse
=True, headers
='fcntl.h')
116 if conf
.CHECK_CODE('''
117 #if defined(HAVE_UNISTD_H)
120 long ret = splice(0,0,1,0,400,SPLICE_F_MOVE);
124 conf
.CHECK_DECLS('splice', reverse
=True, headers
='fcntl.h')
126 # Check for inotify support
127 conf
.CHECK_HEADERS('sys/inotify.h')
128 if "HAVE_SYS_INOTIFY_H" in conf
.env
:
129 conf
.DEFINE('HAVE_INOTIFY', 1)
131 # Check for kernel change notify support
134 #define F_NOTIFY 1026
137 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
138 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain
=False, execute
=True,
139 headers
='fcntl.h signal.h',
140 msg
="Checking for kernel change notify support")
142 # Check for Linux kernel oplocks
144 #include <sys/types.h>
148 #define F_NOTIFY 1026
151 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
152 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain
=False, execute
=True,
153 msg
="Checking for Linux kernel oplocks")
155 # Check for IRIX kernel oplock types
156 conf
.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
157 'HAVE_KERNEL_OPLOCKS_IRIX', headers
='fcntl.h',
158 msg
="Checking for IRIX kernel oplock types")
160 # Check for kernel share modes
162 #include <sys/types.h>
165 #include <sys/file.h>
171 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
172 }''', 'HAVE_KERNEL_SHARE_MODES', addmain
=False, execute
=True,
173 msg
="Checking for kernel share modes")
178 if Options
.options
.with_fam
is None:
180 elif Options
.options
.with_fam
== True:
183 if check_for_fam
and conf
.CHECK_HEADERS('fam.h'):
184 if conf
.CHECK_FUNCS_IN('FAMOpen2', 'fam'):
186 elif conf
.CHECK_FUNCS_IN('FAMOpen2', 'fam C'):
187 samba_fam_libs
='fam C'
188 conf
.CHECK_TYPE('enum FAMCodes', headers
='fam.h',
189 define
='HAVE_FAM_H_FAMCODES_TYPEDEF',
190 msg
='Checking whether enum FAMCodes is available')
191 conf
.CHECK_FUNCS_IN('FAMNoExists', 'fam')
193 if samba_fam_libs
is not None:
194 conf
.DEFINE('SAMBA_FAM_LIBS', samba_fam_libs
)
196 if Options
.options
.with_fam
== True:
197 conf
.fatal('FAM support requested, but no suitable FAM library found')
199 Logs
.warn('no suitable FAM library found')
201 # check for libarchive (tar command in smbclient)
202 # None means autodetect, True/False means enable/disable
203 conf
.env
['archive_lib'] = ''
204 if Options
.options
.with_libarchive
is not False:
205 libarchive_mandatory
= Options
.options
.with_libarchive
== True
206 Logs
.info("Checking for libarchive existence")
207 if conf
.CHECK_BUNDLED_SYSTEM('libarchive', minversion
='3.1.2'):
208 conf
.env
['archive_lib'] = 'libarchive'
209 elif libarchive_mandatory
:
210 conf
.fatal('libarchive support requested, but no suitable pkgconfig found')
212 # check for DMAPI libs
213 if Options
.options
.with_dmapi
== False:
217 Logs
.info("Checking for DMAPI library existence")
219 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'dm'):
220 samba_dmapi_lib
= 'dm'
222 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'jfsdm'):
223 samba_dmapi_lib
= 'jfsdm'
225 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'dmapi'):
226 samba_dmapi_lib
= 'dmapi'
228 if conf
.CHECK_FUNCS_IN('dm_get_eventlist', 'xdsm'):
229 samba_dmapi_lib
= 'xdsm'
230 # only bother to test headers and compilation when a candidate
231 # library has been found
232 if samba_dmapi_lib
== '':
234 broken_dmapi
= "no suitable DMAPI library found"
237 conf
.CHECK_HEADERS('sys/dmi.h xfs/dmapi.h sys/jfsdmapi.h sys/dmapi.h dmapi.h')
239 #include <time.h> /* needed by Tru64 */
240 #include <sys/types.h> /* needed by AIX */
241 #ifdef HAVE_XFS_DMAPI_H
242 #include <xfs/dmapi.h>
243 #elif defined(HAVE_SYS_DMI_H)
245 #elif defined(HAVE_SYS_JFSDMAPI_H)
246 #include <sys/jfsdmapi.h>
247 #elif defined(HAVE_SYS_DMAPI_H)
248 #include <sys/dmapi.h>
249 #elif defined(HAVE_DMAPI_H)
253 /* This link test is designed to fail on IRI 6.4, but should
254 * succeed on Linux, IRIX 6.5 and AIX.
256 int main(int argc, char **argv)
259 dm_eventset_t events;
260 /* This doesn't take an argument on IRIX 6.4. */
261 dm_init_service(&version);
262 /* IRIX 6.4 expects events to be a pointer. */
263 DMEV_ISSET(DM_EVENT_READ, events);
268 'USEABLE_DMAPI_LIBRARY',
272 msg
='Checking whether DMAPI lib '+samba_dmapi_lib
+' can be used')
273 if not conf
.CONFIG_SET('USEABLE_DMAPI_LIBRARY'):
275 broken_dmapi
= "no usable DMAPI library found"
278 Logs
.info("Building with DMAPI support.")
279 conf
.env
['dmapi_lib'] = samba_dmapi_lib
280 conf
.DEFINE('USE_DMAPI', 1)
282 if Options
.options
.with_dmapi
== False:
283 Logs
.info("Building without DMAPI support (--without-dmapi).")
284 elif Options
.options
.with_dmapi
== True:
285 Logs
.error("DMAPI support not available: " + broken_dmapi
)
286 conf
.fatal('DMAPI support requested but not found.');
288 Logs
.warn("Building without DMAPI support: " + broken_dmapi
)
289 conf
.env
['dmapi_lib'] = ''
291 # Check for various members of the stat structure
292 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define
='HAVE_STAT_ST_BLOCKS',
293 headers
='sys/stat.h')
294 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define
='HAVE_STAT_ST_BLKSIZE',
295 headers
='sys/stat.h')
296 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_flags', define
='HAVE_STAT_ST_FLAGS',
297 headers
='sys/types.h sys/stat.h unistd.h')
299 if "HAVE_BLKCNT_T" in conf
.env
:
301 static int test_array[1 - 2 * !(((long int)(sizeof(blkcnt_t))) <= 4)];''',
303 headers
='replace.h sys/types.h sys/stat.h unistd.h',
304 msg
="Checking whether blkcnt_t is 32 bit")
306 # If sizeof is 4 it can't be 8
307 if "HAVE_BLKCNT_T" in conf
.env
:
308 if not conf
.CONFIG_SET('SIZEOF_BLKCNT_T_4'):
310 static int test_array[1 - 2 * !(((long int)(sizeof(blkcnt_t))) <= 8)];''',
312 headers
='replace.h sys/types.h sys/stat.h unistd.h',
313 msg
="Checking whether blkcnt_t is 64 bit")
315 # Check for POSIX capability support
316 conf
.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers
='sys/capability.h')
318 if "HAVE_SYS_CAPABILITY_H" in conf
.env
:
322 if (!(cap = cap_get_proc())) exit(1);
324 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
325 cap_set_proc(cap);''',
326 'HAVE_POSIX_CAPABILITIES', execute
=True, lib
="cap",
327 headers
='sys/capability.h',
328 msg
="Checking whether POSIX capabilities are available")
330 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
331 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
333 if conf
.CONFIG_SET("HAVE_RPC_RPC_H"):
334 conf
.CHECK_TYPE('int16', headers
='rpc/rpc.h',
335 define
='HAVE_INT16_FROM_RPC_RPC_H',
336 msg
="Checking for int16 typedef included by rpc/rpc.h")
337 conf
.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
338 headers
='sys/types.h rpc/rpc.h',
339 msg
="Checking for uint16 typedef included by rpc/rpc.h")
340 conf
.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
341 headers
='sys/types.h rpc/rpc.h',
342 msg
="Checking for int32 typedef included by rpc/rpc.h")
343 conf
.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
344 headers
='sys/types.h rpc/rpc.h',
345 msg
="Checking for uint32 typedef included by rpc/rpc.h")
346 conf
.CHECK_CODE('int i;', 'BROKEN_NISPLUS_INCLUDE_FILES',
347 headers
='sys/types.h sys/acl.h rpcsvc/nis.h',
348 msg
="Checking for broken nisplus include files")
350 # Check if the compiler will optimize out functions
353 this_function_does_not_exist();
356 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
357 msg
="Checking if the compiler will optimize out functions")
359 # Check if the compiler supports the LL suffix on long long integers
361 conf
.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL',
363 msg
="Checking for LL suffix on long long integers")
367 _chdir __chdir chflags chmod _close __close _closedir
368 __closedir crypt16 devnm dirfd
369 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
371 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
373 fsetxattr _fstat __fstat fsync
374 futimens futimes __fxstat getauthuid
375 getcwd _getcwd __getcwd getdents __getdents getdirentries
376 getgrent getgrnam getgrouplist getgrset getmntent getpagesize
377 getpwanam getpwent_r getrlimit
378 glob grantpt hstrerror initgroups innetgr
379 llseek _llseek __llseek _lseek __lseek
380 _lstat __lstat lutimes
381 __lxstat memalign mknod mlock mlockall munlock munlockall
382 _open __open _opendir __opendir
383 pathconf poll posix_fallocate
384 posix_memalign pread _pread __pread
385 pwrite _pwrite __pwrite
386 rdchk _read __read _readdir __readdir
388 select setenv setgidx setgroups setlocale setluid
389 setmntent setpgid setpriv setsid setuidx
390 shmget shm_open sigaction sigblock sigprocmask sigset
392 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctl sysctlbyname
393 __sys_llseek syslog _telldir __telldir timegm
394 utimensat vsyslog _write __write __xstat
397 conf
.CHECK_SAMBA3_CHARSET() # see build/charset.py
399 # FIXME: these should be tests for features, but the old build system just
401 host_os
= sys
.platform
402 Logs
.info("building on %s" % host_os
)
404 # Python doesn't have case switches... :/
405 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
406 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
408 conf
.SET_TARGET_TYPE('sunacl', 'EMPTY')
409 if (host_os
.rfind('linux') > -1) or (host_os
.rfind('gnu') > -1) or (host_os
.rfind('qnx') > -1):
410 if host_os
.rfind('linux') > -1:
411 conf
.DEFINE('LINUX', '1')
412 elif host_os
.rfind('qnx') > -1:
413 conf
.DEFINE('QNX', '1')
414 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
415 elif (host_os
.rfind('darwin') > -1):
416 conf
.DEFINE('DARWINOS', 1)
417 conf
.ADD_CFLAGS('-fno-common')
418 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
419 elif (host_os
.rfind('freebsd') > -1):
420 conf
.DEFINE('FREEBSD', 1)
421 if conf
.CHECK_HEADERS('sunacl.h'):
422 conf
.DEFINE('HAVE_FREEBSD_SUNACL_H', '1')
423 conf
.CHECK_FUNCS_IN(['acl'], 'sunacl')
424 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
425 elif (host_os
.rfind('irix') > -1):
426 conf
.DEFINE('IRIX', 1)
427 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
428 elif (host_os
.rfind('aix') > -1):
429 conf
.DEFINE('AIX', 1)
430 conf
.DEFINE('STAT_ST_BLOCKSIZE', 'DEV_BSIZE')
431 elif (host_os
.rfind('hpux') > -1):
432 conf
.DEFINE('HPUX', 1)
433 conf
.DEFINE('STAT_ST_BLOCKSIZE', '8192')
434 elif (host_os
.rfind('osf') > -1):
435 conf
.DEFINE('OSF1', 1)
436 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
438 # FIXME: Add more checks here.
440 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
442 if Options
.options
.with_acl_support
:
443 if (host_os
.rfind('hpux') > -1):
444 Logs
.info('Using HPUX ACLs')
445 conf
.DEFINE('HAVE_HPUX_ACLS',1)
446 conf
.DEFINE('POSIX_ACL_NEEDS_MASK',1)
447 default_static_modules
.extend(TO_LIST('vfs_hpuxacl'))
448 elif (host_os
.rfind('aix') > -1):
449 Logs
.info('Using AIX ACLs')
450 conf
.DEFINE('HAVE_AIX_ACLS',1)
451 default_static_modules
.extend(TO_LIST('vfs_aixacl vfs_aixacl2'))
452 elif (host_os
.rfind('darwin') > -1):
453 Logs
.warn('ACLs on Darwin currently not supported')
454 conf
.fatal("ACL support not available on Darwin/MacOS. "
455 "Use --without-acl-support for building without "
457 "ACL support is required to change permissions "
458 "from Windows clients.")
460 conf
.CHECK_FUNCS_IN(['acl_get_file'], 'acl')
461 if conf
.CHECK_CODE('''
464 acl_entry_t *entry_p;
465 return acl_get_entry(acl, entry_id, entry_p);
468 headers
='sys/types.h sys/acl.h', link
=False,
469 msg
="Checking for POSIX ACL support") :
471 acl_permset_t permset_d;
473 return acl_get_perm_np(permset_d, perm);
475 'HAVE_ACL_GET_PERM_NP',
476 headers
='sys/types.h sys/acl.h', link
=True,
477 msg
="Checking whether acl_get_perm_np() is available")
478 default_static_modules
.extend(TO_LIST('vfs_posixacl'))
479 elif conf
.CHECK_FUNCS_IN(['facl'], 'sec'):
480 Logs
.info('Using solaris or UnixWare ACLs')
481 conf
.DEFINE('HAVE_SOLARIS_UNIXWARE_ACLS',1)
482 default_static_modules
.extend(TO_LIST('vfs_solarisacl'))
483 elif conf
.CHECK_FUNCS_IN(['acl_get_fd'], 'pacl'):
484 Logs
.info('Using Tru64 ACLs')
485 conf
.DEFINE('HAVE_TRU64_ACLS',1)
486 default_static_modules
.extend(TO_LIST('vfs_tru64acl'))
488 conf
.fatal("ACL support not found. Try installing libacl1-dev "
490 "Otherwise, use --without-acl-support to build "
491 "without ACL support. "
492 "ACL support is required to change permissions from "
495 if conf
.CHECK_FUNCS('dirfd'):
496 conf
.DEFINE('HAVE_DIRFD_DECL', 1)
498 conf
.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
499 'HAVE_STATFS_F_FSID',
500 msg
="vfs_fileid checking for statfs() and struct statfs.f_fsid",
501 headers
='sys/types.h sys/statfs.h',
504 if conf
.CONFIG_SET('HAVE_FALLOCATE'):
506 int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
507 'HAVE_LINUX_FALLOCATE',
508 msg
="Checking whether the Linux 'fallocate' function is available",
509 headers
='unistd.h sys/types.h fcntl.h linux/falloc.h')
511 ssize_t err = readahead(0,0,0x80000);''',
512 'HAVE_LINUX_READAHEAD',
513 msg
="Checking whether Linux readahead is available",
514 headers
='unistd.h fcntl.h')
515 conf
.CHECK_DECLS('readahead', headers
='fcntl.h', always
=True)
517 conf
.CHECK_CODE('int fd = openat(AT_FDCWD, ".", O_RDONLY);',
519 msg
='Checking for openat',
522 if Options
.options
.with_aio_support
:
523 conf
.CHECK_FUNCS_IN('aio_read', 'aio')
524 conf
.CHECK_FUNCS_IN('aio_read', 'rt')
525 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);',
527 msg
='Checking for asynchronous io support',
528 headers
='sys/types.h aio.h',
530 if conf
.CONFIG_SET('HAVE_AIO'):
531 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg
='Checking for aio_read', headers
='aio.h', lib
='aio rt')
532 conf
.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg
='Checking for aio_write', headers
='aio.h', lib
='aio rt')
533 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')
534 conf
.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg
='Checking for aio_return', headers
='aio.h', lib
='aio rt')
535 conf
.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg
='Checking for aio_error', headers
='aio.h', lib
='aio rt')
536 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')
537 conf
.CHECK_CODE('const struct aiocb * const a[1]; struct timespec t; return aio_suspend(&a, 1, &t);', 'HAVE_AIO_SUSPEND', msg
='Checking for aio_suspend', headers
='aio.h', lib
='aio rt')
538 if not conf
.CONFIG_SET('HAVE_AIO'):
539 conf
.DEFINE('HAVE_NO_AIO', '1')
541 conf
.DEFINE('HAVE_NO_AIO', '1')
543 if host_os
.rfind('linux') > -1:
544 conf
.CHECK_FUNCS_IN('io_submit', 'aio')
546 struct io_event ioev;
552 fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
553 io_queue_init(128,&ctx);
554 io_prep_pwrite(ioc, 1, buf, 1, 0);
555 io_prep_pread(ioc, 1, buf, 1, 0);
556 io_set_eventfd(ioc, fd);
557 io_set_callback(ioc, (io_callback_t)(0));
558 io_submit(ctx, 1, &ioc);
559 io_getevents(ctx, 1, 1, &ioev, &ts);
561 'HAVE_LINUX_KERNEL_AIO',
562 msg
='Checking for linux kernel asynchronous io support',
563 headers
='unistd.h stdlib.h sys/types.h fcntl.h sys/eventfd.h libaio.h',
570 char control[CMSG_SPACE(sizeof(int))];
572 msg.msg_control = control_un.control;
573 msg.msg_controllen = sizeof(control_un.control);
575 'HAVE_STRUCT_MSGHDR_MSG_CONTROL',
576 msg
='Checking if we can use msg_control for passing file descriptors',
577 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
581 msg.msg_accrights = (caddr_t) &fd;
582 msg.msg_accrightslen = sizeof(fd);
584 'HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS',
585 msg
='Checking if we can use msg_accrights for passing file descriptors',
586 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
588 if Options
.options
.with_winbind
:
589 conf
.env
.build_winbind
= True
590 conf
.DEFINE('WITH_WINBIND', '1')
592 conf
.find_program('awk', var
='AWK')
594 conf
.CHECK_HEADERS('asm/types.h')
596 conf
.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
597 headers
='unistd.h sys/types.h',
598 msg
="Checking for major macro")
600 conf
.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
601 headers
='unistd.h sys/types.h',
602 msg
="Checking for minor macro")
604 conf
.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
605 headers
='unistd.h sys/types.h dirent.h',
606 define
='HAVE_DIRENT_D_OFF')
608 conf
.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent')
609 if conf
.CHECK_CFLAGS('-Werror-implicit-function-declaration'):
610 netgrent_cflags
= '-Werror-implicit-function-declaration'
613 conf
.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE',
614 msg
="Checking for setnetgrent prototype",
615 headers
='netdb.h netgroup.h',
616 cflags
=netgrent_cflags
)
617 conf
.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE',
618 msg
="Checking for getnetgrent prototype",
619 headers
='netdb.h netgroup.h',
620 cflags
=netgrent_cflags
)
621 conf
.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE',
622 msg
="Checking for endnetgrent prototype",
623 headers
='netdb.h netgroup.h',
624 cflags
=netgrent_cflags
)
628 if Options
.options
.with_cups
:
629 conf
.find_program('cups-config', var
='CUPS_CONFIG')
630 if conf
.env
.CUPS_CONFIG
:
631 # we would normally use --libs here, but cups-config incorrectly adds
632 # gssapi_krb5 and other libraries to its --libs output. That breaks the use
633 # of an in-tree heimdal kerberos
634 conf
.check_cfg(path
=conf
.env
.CUPS_CONFIG
, args
="--cflags --ldflags",
635 package
="", uselib_store
="CUPS")
636 conf
.CHECK_HEADERS('cups/cups.h cups/language.h', lib
='cups')
637 conf
.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups')
638 if conf
.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf
.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
639 conf
.DEFINE('HAVE_CUPS', '1')
641 conf
.undefine('HAVE_CUPS')
642 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
644 # define an empty subsystem for cups, to allow it to be used as an empty dependency
645 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
647 if Options
.options
.with_iprint
:
648 if conf
.CONFIG_SET('HAVE_CUPS'):
649 conf
.DEFINE('HAVE_IPRINT', '1')
651 Logs
.warn("--enable-iprint=yes but cups support not sufficient")
652 if Options
.options
.with_syslog
:
653 conf
.DEFINE('WITH_SYSLOG', '1')
654 if Options
.options
.with_automount
:
655 conf
.DEFINE('WITH_AUTOMOUNT', '1')
658 if Options
.options
.with_ldap
:
659 conf
.CHECK_HEADERS('ldap.h lber.h ldap_pvt.h')
660 conf
.CHECK_TYPE('ber_tag_t', 'unsigned int', headers
='ldap.h lber.h')
661 conf
.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
662 conf
.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers
='ldap.h')
664 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
666 conf
.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
667 define
='HAVE_LBER_LOG_PRINT_FN', headers
='lber.h')
669 conf
.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', 'ldap')
670 conf
.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
672 # Check if ldap_set_rebind_proc() takes three arguments
673 if conf
.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
674 'LDAP_SET_REBIND_PROC_ARGS',
675 msg
="Checking whether ldap_set_rebind_proc takes 3 arguments",
676 headers
='ldap.h lber.h', link
=False):
677 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
679 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
681 # last but not least, if ldap_init() exists, we want to use ldap
682 if conf
.CONFIG_SET('HAVE_LDAP_INIT') and conf
.CONFIG_SET('HAVE_LDAP_H'):
683 conf
.DEFINE('HAVE_LDAP', '1')
684 conf
.DEFINE('LDAP_DEPRECATED', '1')
685 conf
.env
['HAVE_LDAP'] = '1'
686 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
687 # SASL wrapping hooks
688 if conf
.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
689 conf
.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
690 conf
.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
692 conf
.fatal("LDAP support not found. "
693 "Try installing libldap2-dev or openldap-devel. "
694 "Otherwise, use --without-ldap to build without "
696 "LDAP support is required for the LDAP passdb backend, "
697 "LDAP idmap backends and ADS. "
698 "ADS support improves communication with "
699 "Active Directory domain controllers.")
701 conf
.SET_TARGET_TYPE('ldap', 'EMPTY')
702 conf
.SET_TARGET_TYPE('lber', 'EMPTY')
704 if Options
.options
.with_ads
== False:
712 if not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and \
713 not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC'):
714 Logs
.warn("arcfour-hmac-md5 encryption type not found in -lkrb5")
716 if not conf
.CONFIG_SET('HAVE_KRB5_MK_REQ_EXTENDED'):
717 Logs
.warn("krb5_mk_req_extended not found in -lkrb5")
719 if not conf
.CONFIG_SET('HAVE_KRB5_GET_HOST_REALM'):
720 Logs
.warn("krb5_get_host_realm not found in -lkrb5")
722 if not conf
.CONFIG_SET('HAVE_KRB5_FREE_HOST_REALM'):
723 Logs
.warn("krb5_free_host_realm not found in -lkrb5")
725 if not conf
.CONFIG_SET('HAVE_KRB5_FWD_TGT_CREDS'):
726 Logs
.warn("krb5_fwd_tgt_creds found in -lkrb5")
728 if not conf
.CONFIG_SET('HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC'):
729 Logs
.warn("krb5_get_init_creds_opt_alloc not found in -lkrb5")
731 if not conf
.CONFIG_SET('KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT'):
732 Logs
.warn("krb5_get_init_creds_opt_free was not found or was too old in -lkrb5")
734 if not conf
.CONFIG_SET('HAVE_KRB5_GET_RENEWED_CREDS'):
735 Logs
.warn("krb5_get_renewed_creds not found in -lkrb5")
737 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL_COMPARE_ANY_REALM'):
738 Logs
.warn("krb5_principal_compare_any_realm not found in -lkrb5")
740 if not conf
.CONFIG_SET('HAVE_KRB5_C_STRING_TO_KEY') and \
741 not conf
.CONFIG_SET('HAVE_KRB5_STRING_TO_KEY_SALT'):
742 Logs
.warn("krb5_c_string_to_key not found in -lkrb5")
744 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL2SALT') and \
745 not conf
.CONFIG_SET('HAVE_KRB5_GET_PW_SALT'):
746 Logs
.warn("no CREATE_KEY_FUNCTIONS detected")
748 if not conf
.CONFIG_SET('HAVE_KRB5_GET_PERMITTED_ENCTYPES') and \
749 not conf
.CONFIG_SET('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES'):
750 Logs
.warn("no GET_ENCTYPES_FUNCTIONS detected")
752 if not conf
.CONFIG_SET('HAVE_KRB5_KT_FREE_ENTRY') and \
753 not conf
.CONFIG_SET('HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS'):
754 Logs
.warn("no KT_FREE_FUNCTION detected")
756 if not conf
.CONFIG_SET('HAVE_KRB5_C_VERIFY_CHECKSUM'):
757 Logs
.warn("krb5_c_verify_checksum_compare not found in -lkrb5")
760 # We don't actually use
761 # gsskrb5_extract_authz_data_from_sec_context, but it is a
762 # clue that this Heimdal, which does the PAC processing we
763 # need on the standard gss_inquire_sec_context_by_oid
764 if not conf
.CONFIG_SET('HAVE_GSS_GET_NAME_ATTRIBUTE') and \
765 not (conf
.CONFIG_SET('HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT') and \
766 conf
.CONFIG_SET('HAVE_GSS_INQUIRE_SEC_CONTEXT_BY_OID')):
767 Logs
.warn("need either gss_get_name_attribute or gsskrb5_extract_authz_data_from_sec_context and gss_inquire_sec_context_by_oid in -lgssapi for PAC support")
770 if not conf
.CONFIG_SET('HAVE_GSS_KRB5_EXPORT_LUCID_SEC_CONTEXT'):
771 Logs
.warn("need gss_krb5_export_lucid_sec_context for SPNEGO and gss_wrap support")
775 conf
.DEFINE('HAVE_KRB5', '1')
776 conf
.env
['HAVE_KRB5'] = '1'
778 conf
.undefine('HAVE_KRB5_H')
779 conf
.undefine('HAVE_GSSAPI_H')
780 conf
.undefine('HAVE_GSSAPI_GSSAPI_GENERIC_H')
781 conf
.undefine('HAVE_GSSAPI_GSSAPI_H')
784 if not conf
.CONFIG_SET('HAVE_LDAP'):
789 conf
.DEFINE('WITH_ADS', '1')
790 conf
.env
['HAVE_ADS'] = '1'
791 Logs
.info("Building with Active Directory support.")
792 elif Options
.options
.with_ads
== False:
793 Logs
.info("Building without Active Directory support (--without-ads).")
796 Logs
.warn("Active Directory support not available: krb5 libs don't have all required features")
798 Logs
.warn("Active Directory support not available: LDAP support is not available.")
799 if Options
.options
.with_ads
:
800 conf
.fatal("Active Directory support not found. Use --without-ads "
801 "for building without Active Directory support. "
802 "ADS support improves communication with "
803 "Active Directory domain controllers.")
805 # this is the auto-mode case
806 Logs
.warn("Building without Active Directory support.")
809 if Options
.options
.with_utmp
:
810 conf
.env
.with_utmp
= True
811 if not conf
.CHECK_HEADERS('utmp.h'): conf
.env
.with_utmp
= False
812 conf
.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
813 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers
='utmp.h',
814 define
='HAVE_UT_UT_NAME')
815 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers
='utmp.h',
816 define
='HAVE_UT_UT_USER')
817 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers
='utmp.h',
818 define
='HAVE_UT_UT_ID')
819 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers
='utmp.h',
820 define
='HAVE_UT_UT_HOST')
821 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers
='utmp.h',
822 define
='HAVE_UT_UT_TIME')
823 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers
='utmp.h',
824 define
='HAVE_UT_UT_TV')
825 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers
='utmp.h',
826 define
='HAVE_UT_UT_TYPE')
827 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers
='utmp.h',
828 define
='HAVE_UT_UT_PID')
829 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers
='utmp.h',
830 define
='HAVE_UT_UT_EXIT')
831 conf
.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers
='utmpx.h',
832 define
='HAVE_UX_UT_SYSLEN')
833 conf
.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
834 'PUTUTLINE_RETURNS_UTMP', headers
='utmp.h',
835 msg
="Checking whether pututline returns pointer")
836 conf
.CHECK_SIZEOF(['((struct utmp *)NULL)->ut_line'], headers
='utmp.h',
837 define
='SIZEOF_UTMP_UT_LINE', critical
=False)
838 if not conf
.CONFIG_SET('SIZEOF_UTMP_UT_LINE'):
839 conf
.env
.with_utmp
= False
840 elif int(conf
.env
.SIZEOF_UTMP_UT_LINE
) < 15:
841 conf
.env
.with_utmp
= False
842 if conf
.env
.with_utmp
:
843 conf
.DEFINE('WITH_UTMP', 1)
845 Logs
.warn("--with-utmp but utmp support not sufficient")
847 if Options
.options
.with_avahi
:
848 conf
.env
.with_avahi
= True
849 if not conf
.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf
.env
.with_avahi
= False
850 if not conf
.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf
.env
.with_avahi
= False
851 if not conf
.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf
.env
.with_avahi
= False
852 if conf
.env
.with_avahi
:
853 conf
.DEFINE('WITH_AVAHI_SUPPORT', 1)
855 conf
.SET_TARGET_TYPE('avahi-common', 'EMPTY')
856 conf
.SET_TARGET_TYPE('avahi-client', 'EMPTY')
858 if Options
.options
.with_iconv
:
859 conf
.env
.with_iconv
= True
860 if not conf
.CHECK_FUNCS_IN('iconv_open', 'iconv', headers
='iconv.h'):
861 conf
.env
.with_iconv
= False
862 if conf
.env
.with_iconv
:
863 conf
.DEFINE('HAVE_ICONV', 1)
865 if Options
.options
.with_pam
:
867 conf
.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
868 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
869 Logs
.warn("--with-pam=yes but pam_appl.h not found")
871 conf
.CHECK_FUNCS_IN('pam_get_data', 'pam')
872 conf
.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h')
873 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'):
874 Logs
.warn("--with-pam=yes but pam_modules.h not found")
876 conf
.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h')
877 conf
.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h')
878 conf
.CHECK_FUNCS_IN('pam_vsyslog', 'pam')
880 #if defined(HAVE_SECURITY_PAM_APPL_H)
881 #include <security/pam_appl.h>
882 #elif defined(HAVE_PAM_PAM_APPL_H)
883 #include <pam/pam_appl.h>
885 pam_set_item(0, PAM_RHOST, 0);
889 msg
="Checking whether PAM_RHOST is available");
891 #if defined(HAVE_SECURITY_PAM_APPL_H)
892 #include <security/pam_appl.h>
893 #elif defined(HAVE_PAM_PAM_APPL_H)
894 #include <pam/pam_appl.h>
896 pam_set_item(0, PAM_TTY, 0);
900 msg
="Checking whether PAM_TTY is available");
902 #if (!defined(LINUX))
904 #define PAM_EXTERN extern
905 #if defined(HAVE_SECURITY_PAM_APPL_H)
906 #include <security/pam_appl.h>
907 #elif defined(HAVE_PAM_PAM_APPL_H)
908 #include <pam/pam_appl.h>
913 #if defined(HAVE_SECURITY_PAM_MODULES_H)
914 #include <security/pam_modules.h>
915 #elif defined(HAVE_PAM_PAM_MODULES_H)
916 #include <pam/pam_modules.h>
919 #if defined(HAVE_SECURITY__PAM_MACROS_H)
920 #include <security/_pam_macros.h>
921 #elif defined(HAVE_PAM__PAM_MACROS_H)
922 #include <pam/_pam_macros.h>
925 #ifdef HAVE_SECURITY_PAM_EXT_H
926 #include <security/pam_ext.h>
929 int i; i = PAM_RADIO_TYPE;
931 'HAVE_PAM_RADIO_TYPE',
933 msg
="Checking whether PAM_RADIO_TYPE is available");
935 conf
.DEFINE('WITH_PAM', 1)
936 conf
.DEFINE('WITH_PAM_MODULES', 1)
938 if Options
.options
.with_pam_smbpass
:
939 conf
.env
.with_pam_smbpass
= True
944 # Ensure we select the correct set of system calls on Linux.
946 if (host_os
.rfind('linux') > -1):
948 #if defined(HAVE_UNISTD_H)
953 #include <sys/types.h>
956 #ifdef HAVE_SYS_PRIV_H
957 #include <sys/priv.h>
963 #if defined(HAVE_SYSCALL_H)
967 #if defined(HAVE_SYS_SYSCALL_H)
968 #include <sys/syscall.h>
971 syscall(SYS_setresuid32, -1, -1, -1);
972 syscall(SYS_setresgid32, -1, -1, -1);
973 syscall(SYS_setreuid32, -1, -1);
974 syscall(SYS_setregid32, -1, -1);
975 syscall(SYS_setuid32, -1);
976 syscall(SYS_setgid32, -1);
977 syscall(SYS_setgroups32, 0, NULL);
979 'USE_LINUX_32BIT_SYSCALLS',
980 msg
="Checking whether Linux should use 32-bit credential calls");
982 if (conf
.CONFIG_SET('USE_LINUX_32BIT_SYSCALLS')):
983 seteuid
= conf
.CHECK_CODE('''
984 #define AUTOCONF_TEST 1
985 #define USE_LINUX_THREAD_CREDENTIALS 1
986 #define USE_LINUX_32BIT_SYSCALLS 1
987 #include "../lib/util/setid.c"
988 #include "./lib/util_sec.c"
990 'USE_LINUX_THREAD_CREDENTIALS',
993 msg
="Checking whether we can use Linux thread-specific credentials with 32-bit system calls")
995 seteuid
= conf
.CHECK_CODE('''
996 #define AUTOCONF_TEST 1
997 #define USE_LINUX_THREAD_CREDENTIALS 1
998 #include "../lib/util/setid.c"
999 #include "./lib/util_sec.c"
1001 'USE_LINUX_THREAD_CREDENTIALS',
1004 msg
="Checking whether we can use Linux thread-specific credentials")
1006 seteuid
= conf
.CHECK_CODE('''
1007 #define AUTOCONF_TEST 1
1008 #define USE_SETREUID 1
1009 #include "../lib/util/setid.c"
1010 #include "./lib/util_sec.c"
1015 msg
="Checking whether setreuid is available")
1017 seteuid
= conf
.CHECK_CODE('''
1018 #define AUTOCONF_TEST 1
1019 #define USE_SETRESUID 1
1020 #include "../lib/util/setid.c"
1021 #include "./lib/util_sec.c"
1026 msg
="Checking whether setresuid is available")
1028 seteuid
= conf
.CHECK_CODE('''
1029 #define AUTOCONF_TEST 1
1030 #define USE_SETEUID 1
1031 #include "../lib/util/setid.c"
1032 #include "./lib/util_sec.c"
1037 msg
="Checking whether seteuid is available")
1039 seteuid
= conf
.CHECK_CODE('''
1040 #define AUTOCONF_TEST 1
1041 #define USE_SETUIDX 1
1042 #include "../lib/util/setid.c"
1043 #include "./lib/util_sec.c"
1049 msg
="Checking whether setuidx is available")
1050 if Options
.options
.with_dnsupdate
:
1051 if not conf
.CONFIG_SET('HAVE_KRB5'):
1052 Logs
.warn("--with-dnsupdate=yes but gssapi support not sufficient")
1054 conf
.DEFINE('WITH_DNS_UPDATES', 1)
1055 conf
.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
1056 if Options
.options
.developer
:
1057 if conf
.CONFIG_SET('HAVE_VALGRIND_H') or conf
.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'):
1058 conf
.DEFINE('VALGRIND', '1')
1060 if conf
.CHECK_CODE('''
1061 #include <bits/sockaddr.h>
1062 #include <linux/netlink.h>
1064 'HAVE_LINUX_NETLINK_H',
1065 msg
="Checking whether Linux netlink is available"):
1068 #include <bits/sockaddr.h>
1069 #include <linux/netlink.h>
1070 #include <linux/rtnetlink.h>
1072 'HAVE_LINUX_RTNETLINK_H',
1073 msg
='Checking whether Linux rtnetlink is available')
1076 #include "../tests/fcntl_lock.c"
1081 msg
='Checking whether fcntl locking is available')
1083 # glibc up to 2.3.6 had dangerously broken posix_fallocate(). DON'T USE IT.
1084 if not conf
.CHECK_CODE('''
1085 #define _XOPEN_SOURCE 600
1087 #if defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4))
1088 #error probably broken posix_fallocate
1091 '_HAVE_UNBROKEN_POSIX_FALLOCATE',
1092 msg
='Checking for broken posix_fallocate'):
1093 conf
.DEFINE('HAVE_BROKEN_POSIX_FALLOCATE', '1')
1096 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec',
1097 define
='HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') # Linux, Solaris
1098 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimensec',
1099 define
='HAVE_STRUCT_STAT_ST_MTIMENSEC') # BSD, if defined _POSIX_SOURCE
1100 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimespec.tv_nsec',
1101 define
='HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') # BSD, if not defined _POSIX_SOURCE
1102 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtime_n',
1103 define
='HAVE_STRUCT_STAT_ST_MTIME_N') # AIX
1104 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_umtime',
1105 define
='HAVE_STRUCT_STAT_ST_UMTIME') # Tru64
1106 if conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') or \
1107 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMENSEC') or \
1108 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') or \
1109 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIME_N') or \
1110 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_UMTIME'):
1111 conf
.DEFINE('HAVE_STAT_HIRES_TIMESTAMPS', '1')
1113 # recent FreeBSD, NetBSD have creation timestamps called birthtime:
1114 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtime',
1115 define
='HAVE_STRUCT_STAT_ST_BIRTHTIME')
1116 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimespec.tv_nsec',
1117 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC')
1118 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimensec',
1119 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC')
1122 ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
1124 'HAVE_POSIX_FADVISE',
1125 msg
='Checking whether posix_fadvise is available',
1126 headers
='unistd.h fcntl.h')
1128 for v
in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]:
1131 return sysconf(%s) == -1 ? 1 : 0;
1134 msg
='Checking whether sysconf(%s) is available' % v
)
1137 #include <sys/syscall.h>
1139 syscall(SYS_initgroups, 16, NULL, NULL, 0);
1141 'HAVE_DARWIN_INITGROUPS',
1142 msg
='Checking whether to use the Darwin-specific initgroups system call')
1144 conf
.CHECK_CODE('''struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''',
1146 headers
='sys/types.h utime.h',
1147 msg
='Checking whether struct utimbuf is available')
1149 if conf
.CHECK_CODE('''struct sigevent s;''',
1150 'HAVE_STRUCT_SIGEVENT',
1151 headers
='sys/types.h stdlib.h stddef.h signal.h',
1152 msg
='Checking whether we have the struct sigevent'):
1153 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sival_ptr',
1154 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR',
1155 headers
='signal.h');
1156 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sigval_ptr',
1157 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR',
1158 headers
='signal.h');
1160 if os
.path
.exists('/proc/sys/kernel/core_pattern'):
1161 conf
.DEFINE('HAVE_SYS_KERNEL_PROC_CORE_PATTERN', '1')
1163 if conf
.CHECK_CODE('''
1167 if (sizeof(time_t) == 8) {
1168 time_t max_time = 0x7fffffffffffffffll;
1169 tm = gmtime(&max_time);
1170 /* This should fail with 32-bit tm_year. */
1172 /* Max time_t that works with 32-bit int tm_year in struct tm. */
1173 max_time = 67768036191676799ll;
1174 tm = gmtime(&max_time);
1185 msg
="Checking for the maximum value of the 'time_t' type"):
1186 conf
.DEFINE('TIME_T_MAX', '67768036191676799ll')
1189 #if defined(HAVE_UNISTD_H)
1192 #include <sys/types.h>
1193 main() { dev_t dev = makedev(1,2); return 0; }
1197 msg
='Checking whether the macro for makedev is available')
1204 void exit_on_core(int ignored) {
1210 signal(SIGSEGV, exit_on_core);
1211 newpath = realpath("/tmp", NULL);
1212 exit((newpath != NULL) ? 0 : 1);
1215 'REALPATH_TAKES_NULL',
1218 msg
='Checking whether the realpath function allows a NULL argument')
1220 conf
.CHECK_CODE('''#include "../tests/ftruncate.c"''',
1221 'HAVE_FTRUNCATE_EXTEND',
1222 msg
='Checking for ftruncate extend',
1226 if Options
.options
.with_sendfile_support
:
1227 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):
1232 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1235 headers
='sys/sendfile.h',
1236 msg
='Checking for linux sendfile support')
1238 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1239 conf
.DEFINE('HAVE_SENDFILE', '1')
1240 conf
.DEFINE('LINUX_SENDFILE_API', '1')
1241 conf
.DEFINE('WITH_SENDFILE', '1')
1242 elif (host_os
.rfind('freebsd') > -1) or (host_os
.rfind('dragonfly') > -1):
1244 #include <sys/types.h>
1246 #include <sys/socket.h>
1247 #include <sys/uio.h>
1248 int fromfd, tofd, ret, total=0;
1249 off_t offset, nwritten;
1252 hdr.headers = &hdtrl;
1254 hdr.trailers = NULL;
1256 hdtrl.iov_base = NULL;
1258 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0)
1261 msg
='Checking for freebsd sendfile support')
1262 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1263 conf
.DEFINE('HAVE_SENDFILE', '1')
1264 conf
.DEFINE('FREEBSD_SENDFILE_API', '1')
1265 conf
.DEFINE('WITH_SENDFILE', '1')
1266 elif (host_os
.rfind('darwin') > -1):
1268 #include <sys/types.h>
1269 #include <sys/socket.h>
1270 #include <sys/uio.h>
1271 int fromfd, tofd, ret;
1272 off_t offset, nwritten;
1275 hdr.headers = &hdtrl;
1277 hdr.trailers = (void *)0;
1279 hdtrl.iov_base = (void *)0;
1281 ret = sendfile(fromfd, tofd, offset, &nwritten, &hdr, 0);
1284 msg
='Checking for darwin sendfile support')
1285 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1286 conf
.DEFINE('HAVE_SENDFILE', '1')
1287 conf
.DEFINE('DARWIN_SENDFILE_API', '1')
1288 conf
.DEFINE('WITH_SENDFILE', '1')
1289 elif (host_os
.rfind('hpux') > -1) or (host_os
.rfind('osf') > -1):
1291 #include <sys/socket.h>
1292 #include <sys/uio.h>
1295 struct iovec hdtrl[2];
1298 hdtrl[0].iov_base = 0;
1299 hdtrl[0].iov_len = 0;
1300 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
1303 msg
='Checking for osf/hpux sendfile support')
1304 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1305 conf
.DEFINE('HAVE_SENDFILE', '1')
1306 conf
.DEFINE('HPUX_SENDFILE_API', '1')
1307 conf
.DEFINE('WITH_SENDFILE', '1')
1308 elif (host_os
.rfind('solaris') > -1):
1309 conf
.CHECK_FUNCS_IN('sendfile', 'sendfilev')
1311 #include <sys/sendfile.h>,
1314 struct sendfilevec vec[2];
1318 vec[0].sfv_fd = SFV_FD_SELF;
1319 vec[0].sfv_flag = 0;
1323 vec[1].sfv_flag = 0;
1326 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
1329 msg
='Checking for solaris sendfilev support')
1330 if conf
.CONFIG_SET('_HAVE_SENDFILEV'):
1331 conf
.DEFINE('HAVE_SENDFILEV', '1')
1332 conf
.DEFINE('SOLARIS_SENDFILE_API', '1')
1333 conf
.DEFINE('WITH_SENDFILE', '1')
1334 elif (host_os
.rfind('aix') > -1):
1336 #include <sys/socket.h>
1339 struct sf_parms hdtrl;
1341 hdtrl.header_data = 0;
1342 hdtrl.header_length = 0;
1343 hdtrl.file_descriptor = fromfd;
1344 hdtrl.file_offset = 0;
1345 hdtrl.file_bytes = 0;
1346 hdtrl.trailer_data = 0;
1347 hdtrl.trailer_length = 0;
1348 nwritten = send_file(&tofd, &hdtrl, 0);
1351 msg
='Checking for AIX send_file support')
1352 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1353 conf
.DEFINE('HAVE_SENDFILE', '1')
1354 conf
.DEFINE('AIX_SENDFILE_API', '1')
1355 conf
.DEFINE('WITH_SENDFILE', '1')
1357 # Check for getcwd allowing a NULL arg.
1361 char *s = getcwd(NULL,0);
1362 exit(s != NULL ? 0 : 1);
1363 }''', 'GETCWD_TAKES_NULL', addmain
=False, execute
=True,
1364 msg
="getcwd takes a NULL argument")
1367 # UnixWare 7.x has its getspnam in -lgen
1368 conf
.CHECK_FUNCS_IN('getspnam', 'gen')
1369 conf
.CHECK_FUNCS_IN('getspnam', 'security')
1370 conf
.CHECK_FUNCS_IN('getspnam', 'sec')
1372 if Options
.options
.with_quotas
:
1373 # For quotas on Veritas VxFS filesystems
1374 conf
.CHECK_HEADERS('sys/fs/vx_quota.h')
1375 # For sys/quota.h and linux/quota.h
1376 conf
.CHECK_HEADERS('sys/quota.h')
1377 # For quotas on BSD systems
1378 conf
.CHECK_HEADERS('ufs/ufs/quota.h')
1379 # For quotas on Linux XFS filesystems
1380 if conf
.CHECK_HEADERS('xfs/xqm.h'):
1381 conf
.DEFINE('HAVE_XFS_QUOTAS', '1')
1385 #include "confdefs.h"
1386 #ifdef HAVE_SYS_TYPES_H
1387 #include <sys/types.h>
1389 #ifdef HAVE_ASM_TYPES_H
1390 #include <asm/types.h>
1392 #include <sys/quota.h>
1393 int i = Q_XGETQUOTA;''',
1394 define
='HAVE_XFS_QUOTAS',
1395 msg
='for XFS QUOTA in <sys/quota.h>',
1397 local_include
=False)
1399 # For IRIX like dqb_isoftlimit instead of dqb_fsoftlimit in struc dqblk
1400 conf
.CHECK_STRUCTURE_MEMBER('struct dqblk', 'dqb_fsoftlimit', define
='HAVE_DQB_FSOFTLIMIT',
1401 headers
='sys/quota.h')
1402 #darwin style quota bytecount
1403 conf
.CHECK_STRUCTURE_MEMBER('struct dqblk', 'dqb_curbytes', define
='HAVE_STRUCT_DQBLK_DQB_CURBYTES',
1404 headers
='sys/quota.h')
1405 if conf
.CHECK_HEADERS('rpcsvc/rquota.h'):
1406 conf
.DEFINE('HAVE_NFS_QUOTAS', '1')
1407 conf
.CHECK_STRUCTURE_MEMBER('struct getquota_rslt', 'getquota_rslt_u',
1408 define
='HAVE_GETQUOTA_RSLT_GETQUOTA_RSLT_U',
1409 headers
='rpcsvc/rquota.h')
1411 if (host_os
.rfind('linux') > -1):
1412 conf
.DEFINE('HAVE_QUOTACTL_LINUX', '1')
1413 elif not conf
.CONFIG_SET("HAVE_XFS_QUOTAS"):
1414 if not conf
.CHECK_CODE('''
1415 #define HAVE_QUOTACTL_4A 1
1416 #define AUTOCONF_TEST 1
1417 #include "../tests/sysquotas.c"
1419 cflags
=conf
.env
['WERROR_CFLAGS'],
1420 define
='HAVE_QUOTACTL_4A',
1421 msg
='for QUOTACTL_4A: long quotactl(int cmd, char *special, qid_t id, caddr_t addr)',
1426 #define HAVE_QUOTACTL_4B 1
1427 #define AUTOCONF_TEST 1
1428 #include "../tests/sysquotas.c"
1430 cflags
=conf
.env
['WERROR_CFLAGS'],
1431 define
='HAVE_QUOTACTL_4B',
1432 msg
='for QUOTACTL_4B: int quotactl(const char *path, int cmd, int id, char *addr)',
1437 clnt_create("", RQUOTAPROG, RQUOTAVERS, "udp");
1439 headers
="rpc/rpc.h rpc/types.h rpcsvc/rquota.h rpc/nettype.h rpc/xdr.h",
1440 define
='HAVE_NFS_QUOTAS',
1441 msg
='for NFS QUOTAS',
1443 local_include
=False)
1445 if conf
.CONFIG_SET('HAVE_QUOTACTL_LINUX') or \
1446 conf
.CONFIG_SET('HAVE_QUOTACTL_4A') or \
1447 conf
.CONFIG_SET('HAVE_QUOTACTL_4B') or \
1448 conf
.CONFIG_SET('HAVE_XFS_QUOTAS'):
1449 conf
.DEFINE('HAVE_SYS_QUOTAS', '1')
1450 conf
.DEFINE('WITH_QUOTAS', '1')
1453 # checking for clustering extensions (CTDB)
1455 if Options
.options
.with_cluster_support
== False:
1456 # configure is called with --without-cluster-support,
1457 # so don't check for and build w/o ctdb support.
1458 have_cluster_support
= False
1462 have_cluster_support
= True
1466 srcdir
= os
.path
.realpath(conf
.srcdir
)
1467 if 'EXTRA_INCLUDES' in conf
.env
:
1468 includes
= ' '.join(conf
.env
['EXTRA_INCLUDES']).replace('#', srcdir
+ '/')
1472 if Options
.options
.ctdb_dir
:
1473 CTDB_INCLUDE
= Options
.options
.ctdb_dir
+ '/include'
1475 CTDB_INCLUDE
= conf
.srcdir
+ '/ctdb/include'
1476 includes
= includes
+ ' ' + CTDB_INCLUDE
1478 if not conf
.env
.USING_SYSTEM_TDB
:
1479 includes
= includes
+ ' ' + srcdir
+ '/lib/tdb/include'
1481 if not conf
.env
.USING_SYSTEM_TALLOC
:
1482 includes
= includes
+ ' ' + srcdir
+ '/lib/talloc'
1484 ok
= conf
.CHECK_CODE('''
1486 #include "replace.h"
1487 #include "system/wait.h"
1488 #include "system/network.h"
1489 #define private #error __USED_RESERVED_WORD_private__
1499 'HAVE_CTDB_CHECK_CODE',
1502 msg
='Checking for header ctdb.h')
1504 CTDB_CFLAGS
+= ' -DHAVE_CTDB_H=1'
1506 have_cluster_support
= False
1507 ctdb_broken
= "ctdb.h is required for cluster support"
1509 conf
.CONFIG_RESET('HAVE_CTDB_CHECK_CODE')
1510 if have_cluster_support
:
1511 ok
= conf
.CHECK_CODE('''
1513 #include "replace.h"
1514 #include "system/wait.h"
1515 #include "system/network.h"
1516 #define private #error __USED_RESERVED_WORD_private__
1520 #include <ctdb_private.h>
1527 'HAVE_CTDB_CHECK_CODE',
1530 msg
='Checking for header ctdb_private.h')
1532 CTDB_CFLAGS
+= ' -DHAVE_CTDB_PRIVATE_H=1'
1534 have_cluster_support
= False
1535 ctdb_broken
= "ctdb_private.h is required for cluster support"
1537 conf
.CONFIG_RESET('HAVE_CTDB_CHECK_CODE')
1538 if have_cluster_support
:
1539 ok
= conf
.CHECK_CODE('''
1541 #include "replace.h"
1542 #include "system/wait.h"
1543 #include "system/network.h"
1544 #define private #error __USED_RESERVED_WORD_private__
1548 #include <ctdb_protocol.h>
1555 'HAVE_CTDB_CHECK_CODE',
1558 msg
='Checking for header ctdb_protocol.h')
1560 CTDB_CFLAGS
+= ' -DHAVE_CTDB_PROTOCOL_H=1'
1562 conf
.CONFIG_RESET('HAVE_CTDB_CHECK_CODE')
1563 if have_cluster_support
:
1564 ok
= conf
.CHECK_CODE('''
1566 #include "replace.h"
1567 #include "system/wait.h"
1568 #include "system/network.h"
1572 #include <ctdb_private.h>
1576 int i = (int)CTDB_CONTROL_TRANS3_COMMIT;
1580 'HAVE_CTDB_CHECK_CODE',
1583 msg
='Checking for transaction support (TRANS3_COMMIT control)')
1585 CTDB_CFLAGS
+= ' -DHAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL=1'
1587 have_cluster_support
= False
1588 ctdb_broken
= "ctdb transaction support missing or too old"
1590 conf
.CONFIG_RESET('HAVE_CTDB_CHECK_CODE')
1591 if have_cluster_support
:
1592 ok
= conf
.CHECK_CODE('''
1594 #include "replace.h"
1595 #include "system/wait.h"
1596 #include "system/network.h"
1600 #include <ctdb_private.h>
1604 int i = (int)CTDB_CONTROL_SCHEDULE_FOR_DELETION;
1608 'HAVE_CTDB_CHECK_CODE',
1611 msg
='Checking for SCHEDULE_FOR_DELETION control')
1613 CTDB_CFLAGS
+= ' -DHAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL=1'
1615 if not Options
.options
.enable_old_ctdb
:
1616 have_cluster_support
= False
1617 ctdb_broken
= "SCHEDULE_FOR_DELETION control missing"
1619 Logs
.warn("ignoring missing SCHEDULE_FOR_DELETION control (--enable-old-ctdb)")
1621 conf
.CONFIG_RESET('HAVE_CTDB_CHECK_CODE')
1622 if have_cluster_support
:
1623 ok
= conf
.CHECK_CODE('''
1625 #include "replace.h"
1626 #include "system/wait.h"
1627 #include "system/network.h"
1634 int i = (int)CTDB_WANT_READONLY;
1638 'HAVE_CTDB_CHECK_CODE',
1641 msg
='Checking for CTDB readonly records support')
1643 CTDB_CFLAGS
+= ' -DHAVE_CTDB_WANT_READONLY_DECL=1'
1645 if not Options
.options
.enable_old_ctdb
:
1646 have_cluster_support
= False
1647 ctdb_broken
= "support for CTDB readonly records missing"
1649 Logs
.warn("ignoring missing READONLY support (--enable-old-ctdb)")
1651 conf
.CONFIG_RESET('HAVE_CTDB_CHECK_CODE')
1652 if have_cluster_support
:
1653 ok
= conf
.CHECK_CODE('''
1655 #include "replace.h"
1656 #include "system/wait.h"
1657 #include "system/network.h"
1661 #include <ctdb_private.h>
1665 struct ctdb_control_tcp _x;
1669 'HAVE_CTDB_CHECK_CODE',
1672 msg
='Checking for ctdb ipv4 support')
1674 CTDB_CFLAGS
+= ' -DHAVE_STRUCT_CTDB_CONTROL_TCP=1'
1676 have_cluster_support
= False
1677 ctdb_broken
= "missing struct ctdb_control_tcp"
1679 conf
.CONFIG_RESET('HAVE_CTDB_CHECK_CODE')
1680 if have_cluster_support
:
1681 ok
= conf
.CHECK_CODE('''
1683 #include "replace.h"
1684 #include "system/wait.h"
1685 #include "system/network.h"
1689 #include <ctdb_private.h>
1693 struct ctdb_control_tcp_addr _x;
1697 'HAVE_CTDB_CHECK_CODE',
1700 msg
='Checking for ctdb ipv6 support')
1702 CTDB_CFLAGS
+= ' -DHAVE_STRUCT_CTDB_CONTROL_TCP_ADDR=1'
1704 conf
.CONFIG_RESET('HAVE_CTDB_CHECK_CODE')
1705 if have_cluster_support
:
1706 ok
= conf
.CHECK_CODE('''
1708 #include "replace.h"
1709 #include "system/wait.h"
1710 #include "system/network.h"
1714 #include <ctdb_private.h>
1718 int i = (int)CTDB_CONTROL_CHECK_SRVIDS;
1722 'HAVE_CTDB_CHECK_CODE',
1725 msg
='Checking for CHECK_SRVIDS control')
1727 CTDB_CFLAGS
+= ' -DHAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL=1'
1729 if not Options
.options
.enable_old_ctdb
:
1730 have_cluster_support
= False
1731 ctdb_broken
= "CHECK_SRVIDS control missing"
1733 Logs
.warn("ignoring missing CHECK_SRVIDS control (--enable-old-ctdb)")
1735 conf
.CONFIG_RESET('HAVE_CTDB_CHECK_CODE')
1736 conf
.undefine('HAVE_CTDB_CHECK_CODE')
1737 if have_cluster_support
:
1738 Logs
.info("building with cluster support")
1739 conf
.env
['CTDB_CFLAGS'] = CTDB_CFLAGS
1740 conf
.env
['CTDB_INCLUDE'] = CTDB_INCLUDE
1742 if Options
.options
.with_cluster_support
== False:
1743 Logs
.info("building without cluster support (--without-cluster-support)")
1744 elif Options
.options
.with_cluster_support
== True:
1745 Logs
.error("Cluster support not available: " + ctdb_broken
)
1746 conf
.fatal("Cluster support not found, but --with-cluster-support was specified")
1748 Logs
.info("building without cluster support: " + ctdb_broken
)
1749 conf
.env
['CTDB_CFLAGS'] = ''
1752 conf
.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }',
1753 'HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR',
1756 msg
='Checking whether we can compile with __attribute__((destructor))')
1758 conf
.CHECK_CODE('void seekdir(DIR *d, long loc) { return; }',
1759 'SEEKDIR_RETURNS_VOID',
1760 headers
='sys/types.h dirent.h',
1761 msg
='Checking whether seekdir returns void')
1763 if Options
.options
.with_profiling_data
:
1764 conf
.DEFINE('WITH_PROFILE', 1);
1766 if Options
.options
.with_pthreadpool
:
1767 if conf
.CONFIG_SET('HAVE_PTHREAD'):
1768 conf
.DEFINE('WITH_PTHREADPOOL', '1')
1770 Logs
.warn("pthreadpool support cannot be enabled when pthread support was not found")
1771 conf
.undefine('WITH_PTHREADPOOL')
1773 if conf
.CHECK_HEADERS('gpfs_gpl.h'):
1774 conf
.DEFINE('HAVE_GPFS', '1')
1776 if (conf
.CHECK_HEADERS('linux/ioctl.h sys/ioctl.h linux/fs.h') and
1777 conf
.CHECK_DECLS('FS_IOC_GETFLAGS FS_COMPR_FL', headers
='linux/fs.h')):
1778 conf
.DEFINE('HAVE_LINUX_IOCTL', '1')
1780 conf
.env
['CCFLAGS_CEPHFS'] = "-D_FILE_OFFSET_BITS=64"
1781 if Options
.options
.libcephfs_dir
:
1782 conf
.env
['CPPPATH_CEPHFS'] = Options
.options
.libcephfs_dir
+ '/include'
1783 conf
.env
['LIBPATH_CEPHFS'] = Options
.options
.libcephfs_dir
+ '/lib'
1785 if conf
.CHECK_HEADERS('cephfs/libcephfs.h', False, False, 'cephfs') and conf
.CHECK_LIB('cephfs'):
1786 conf
.DEFINE('HAVE_CEPH', '1')
1788 if Options
.options
.with_glusterfs
:
1789 conf
.check_cfg(package
='glusterfs-api', args
='"glusterfs-api >= 4" --cflags --libs',
1790 msg
='Checking for glusterfs-api >= 4', uselib_store
="GFAPI")
1791 conf
.CHECK_HEADERS('api/glfs.h', lib
='gfapi')
1792 conf
.CHECK_LIB('gfapi', shlib
=True)
1794 if conf
.CONFIG_SET('HAVE_API_GLFS_H'):
1795 conf
.DEFINE('HAVE_GLUSTERFS', '1')
1797 conf
.SET_TARGET_TYPE('gfapi', 'EMPTY')
1798 conf
.undefine('HAVE_GLUSTERFS')
1800 conf
.SET_TARGET_TYPE('gfapi', 'EMPTY')
1801 conf
.undefine('HAVE_GLUSTERFS')
1803 if Options
.options
.enable_vxfs
:
1804 conf
.DEFINE('HAVE_VXFS', '1')
1806 if conf
.check_cfg(package
='dbus-1', args
='--cflags --libs',
1807 msg
='Checking for dbus', uselib_store
="DBUS-1"):
1808 if (conf
.CHECK_HEADERS('dbus/dbus.h', lib
='dbus-1')
1809 and conf
.CHECK_LIB('dbus-1', shlib
=True)):
1810 conf
.DEFINE('HAVE_DBUS', '1')
1812 conf
.env
.build_regedit
= False
1813 if not Options
.options
.with_regedit
== False:
1814 conf
.PROCESS_SEPARATE_RULE('system_ncurses')
1815 if conf
.CONFIG_SET('HAVE_NCURSES'):
1816 conf
.env
.build_regedit
= True
1818 if conf
.env
.build_regedit
:
1819 Logs
.info("building regedit")
1821 if Options
.options
.with_regedit
== False:
1822 Logs
.info("not building regedit (--without-regedit)")
1823 elif Options
.options
.with_regedit
== True:
1824 Logs
.error("ncurses not available, cannot build regedit")
1825 conf
.fatal("ncurses not available, but --with-regedit was specified")
1827 Logs
.info("ncurses not available, not building regedit")
1829 conf
.CHECK_FUNCS_IN('DES_pcbc_encrypt', 'crypto')
1830 if Options
.options
.with_fake_kaserver
== True:
1831 conf
.CHECK_HEADERS('afs/param.h afs/stds.h', together
=True)
1832 conf
.CHECK_HEADERS('afs/param.h afs/stds.h', together
=True)
1833 if (conf
.CONFIG_SET('HAVE_AFS_PARAM_H') and conf
.CONFIG_SET('HAVE_AFS_STDS_H') and conf
.CONFIG_SET('HAVE_DES_PCBC_ENCRYPT')):
1834 conf
.DEFINE('WITH_FAKE_KASERVER', '1')
1836 conf
.fatal('AFS headers not available, but --with-fake-kaserver was specified')
1840 default_static_modules
.extend(TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
1841 auth_sam auth_unix auth_winbind auth_wbc
1842 auth_domain auth_builtin vfs_default
1843 nss_info_template idmap_tdb idmap_passdb
1846 default_shared_modules
.extend(TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
1847 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
1848 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2
1849 auth_script vfs_readahead vfs_xattr_tdb vfs_posix_eadb
1850 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
1851 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
1852 vfs_media_harmony vfs_fruit
1855 vfs_crossrename vfs_linux_xfs_sgid
1856 vfs_time_audit idmap_autorid idmap_tdb2
1858 idmap_rid idmap_hash idmap_rfc2307'''))
1860 if Options
.options
.developer
:
1861 default_static_modules
.extend(TO_LIST('charset_weird'))
1862 default_shared_modules
.extend(TO_LIST('perfcount_test'))
1863 default_shared_modules
.extend(TO_LIST('vfs_skel_opaque vfs_skel_transparent vfs_shadow_copy_test'))
1864 default_shared_modules
.extend(TO_LIST('auth_skel pdb_test'))
1866 if Options
.options
.enable_selftest
or Options
.options
.developer
:
1867 default_shared_modules
.extend(TO_LIST('vfs_fake_acls vfs_nfs4acl_xattr'))
1870 if conf
.CONFIG_SET('AD_DC_BUILD_IS_ENABLED'):
1871 default_static_modules
.extend(TO_LIST('pdb_samba_dsdb auth_samba4 vfs_dfs_samba4'))
1873 if conf
.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'):
1874 default_shared_modules
.extend(TO_LIST('vfs_zfsacl'))
1876 if conf
.CONFIG_SET('HAVE_DIRFD_DECL'):
1877 default_shared_modules
.extend(TO_LIST('vfs_syncops vfs_dirsort'))
1879 if conf
.CONFIG_SET('HAVE_STATFS_F_FSID'):
1880 default_shared_modules
.extend(TO_LIST('vfs_fileid'))
1882 if (conf
.CONFIG_SET('HAVE_STRUCT_MSGHDR_MSG_CONTROL') or conf
.CONFIG_SET('HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS')):
1883 default_shared_modules
.extend(TO_LIST('vfs_aio_fork'))
1885 if Options
.options
.with_pthreadpool
:
1886 default_shared_modules
.extend(TO_LIST('vfs_aio_pthread'))
1888 if conf
.CONFIG_SET('HAVE_AIO'):
1889 default_shared_modules
.extend(TO_LIST('vfs_aio_posix'))
1891 if conf
.CONFIG_SET('HAVE_LINUX_KERNEL_AIO'):
1892 default_shared_modules
.extend(TO_LIST('vfs_aio_linux'))
1894 if conf
.CONFIG_SET('HAVE_LDAP'):
1895 default_static_modules
.extend(TO_LIST('pdb_ldapsam idmap_ldap'))
1897 if conf
.CONFIG_SET('DARWINOS'):
1898 default_static_modules
.extend(TO_LIST('charset_macosxfs'))
1900 if conf
.CONFIG_SET('HAVE_GPFS'):
1901 default_shared_modules
.extend(TO_LIST('vfs_gpfs'))
1903 if conf
.CONFIG_SET('HAVE_LINUX_IOCTL'):
1904 default_shared_modules
.extend(TO_LIST('vfs_btrfs'))
1906 if conf
.CONFIG_SET('SAMBA_FAM_LIBS'):
1907 default_shared_modules
.extend(TO_LIST('vfs_notify_fam'))
1909 if conf
.CONFIG_SET("HAVE_CEPH"):
1910 default_shared_modules
.extend(TO_LIST('vfs_ceph'))
1912 if conf
.CONFIG_SET('HAVE_GLUSTERFS'):
1913 default_shared_modules
.extend(TO_LIST('vfs_glusterfs'))
1915 if conf
.CONFIG_SET('HAVE_VXFS'):
1916 default_shared_modules
.extend(TO_LIST('vfs_vxfs'))
1918 if conf
.CONFIG_SET('HAVE_DBUS'):
1919 default_shared_modules
.extend(TO_LIST('vfs_snapper'))
1921 explicit_shared_modules
= TO_LIST(Options
.options
.shared_modules
, delimiter
=',')
1922 explicit_static_modules
= TO_LIST(Options
.options
.static_modules
, delimiter
=',')
1924 def replace_list_item(lst
, item
, value
):
1926 idx
= lst
.index(item
)
1930 # PDB module file name should have the same name as module registers itself
1931 # In Autoconf build we export LDAP passdb module as ldapsam but WAF build
1932 # was always exporting pdb_ldap. In order to support existing packages
1933 # allow referring to pdb_ldapsam as pdb_ldap but use proper name internally.
1934 replace_list_item(explicit_shared_modules
, 'pdb_ldap', 'pdb_ldapsam')
1935 replace_list_item(explicit_static_modules
, 'pdb_ldap', 'pdb_ldapsam')
1937 final_static_modules
= default_static_modules
1938 final_shared_modules
= default_shared_modules
1940 for m
in explicit_static_modules
:
1941 if m
in final_shared_modules
:
1942 final_shared_modules
.remove(m
)
1943 final_static_modules
.append(m
)
1944 for m
in explicit_shared_modules
:
1945 if m
in final_static_modules
:
1946 final_static_modules
.remove(m
)
1947 final_shared_modules
.append(m
)
1949 if ("auth_domain" not in final_static_modules
) or \
1950 ("auth_builtin" not in final_static_modules
) or \
1951 ("auth_sam" not in final_static_modules
) or \
1952 ("auth_winbind" not in final_static_modules
):
1953 raise Utils
.WafError('These auth modules MUST be configured as static modules: auth_domain, auth_builtin, auth_sam, auth_winbind')
1955 conf
.env
['static_modules'] = final_static_modules
1956 conf
.env
['shared_modules'] = final_shared_modules
1958 conf
.DEFINE('STRING_STATIC_MODULES', ' '.join(final_static_modules
), quote
=True)
1963 prefixes
= ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
1964 conf
.env
['MODULE_PREFIXES'] = prefixes
1966 for m
in final_static_modules
:
1968 if not p
in static_list
:
1970 static_list
[p
].append(m
)
1971 for m
in final_shared_modules
:
1973 if not p
in shared_list
:
1975 shared_list
[p
].append(m
)
1978 static_env
= "%s_STATIC" % p
.upper()
1979 shared_env
= "%s_SHARED" % p
.upper()
1980 conf
.env
[static_env
] = []
1981 conf
.env
[shared_env
] = []
1982 if p
in static_list
:
1984 for entry
in static_list
[p
]:
1985 decl_list
+= "extern NTSTATUS %s_init(void); " % entry
1986 conf
.env
[static_env
].append('%s' % entry
)
1987 decl_list
= decl_list
.rstrip()
1988 conf
.DEFINE('static_decl_%s' % p
, decl_list
)
1989 conf
.DEFINE('static_init_%s' % p
, '{ %s_init(); }' % '_init(); '.join(static_list
[p
]))
1991 conf
.DEFINE('static_decl_%s' % p
, '')
1992 conf
.DEFINE('static_init_%s' % p
, '{}')
1993 if p
in shared_list
:
1994 for entry
in shared_list
[p
]:
1995 conf
.DEFINE('%s_init' % entry
, 'samba_init_module')
1996 conf
.env
[shared_env
].append('%s' % entry
)
1998 conf
.SAMBA_CONFIG_H('include/config.h')
2001 "build 'tags' file using ctags"
2003 source_root
= os
.path
.dirname(Utils
.g_module
.root_path
)
2004 cmd
= 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
2005 print("Running: %s" % cmd
)