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')
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('profiling-data', default
=False)
46 opt
.SAMBA3_ADD_OPTION('cluster-support')
48 opt
.add_option('--with-ctdb-dir',
49 help=("Directory under which ctdb is installed"),
50 action
="store", dest
='ctdb_dir', default
=None)
51 opt
.add_option('--enable-old-ctdb',
52 help=("enable building against (too) old version of ctdb (default=false)"),
53 action
="store_true", dest
='enable_old_ctdb', default
=False)
58 from samba_utils
import TO_LIST
60 default_static_modules
= []
61 default_shared_modules
= []
63 if Options
.options
.developer
:
64 conf
.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
65 conf
.env
.developer
= True
67 if Options
.options
.with_swat
:
68 conf
.env
['build_swat'] = True
70 if sys
.platform
!= 'openbsd5':
71 conf
.ADD_LDFLAGS("-Wl,--export-dynamic", testflags
=True)
73 conf
.CHECK_HEADERS('execinfo.h libexc.h libunwind.h netdb.h')
74 conf
.CHECK_HEADERS('linux/falloc.h')
76 conf
.CHECK_FUNCS('getcwd fchown chmod fchmod mknod')
77 conf
.CHECK_FUNCS('strtol strchr strupr chflags')
78 conf
.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
79 conf
.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
80 conf
.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr')
81 conf
.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
82 conf
.CHECK_FUNCS('setpriv setgidx setuidx setgroups syscall sysconf')
83 conf
.CHECK_FUNCS('atexit grantpt fallocate posix_fallocate')
84 conf
.CHECK_FUNCS('fseeko setluid')
85 conf
.CHECK_FUNCS('getpwnam', headers
='sys/types.h pwd.h')
86 conf
.CHECK_FUNCS('fdopendir')
87 conf
.CHECK_FUNCS('getpwent_r setenv strcasecmp fcvt fcvtl')
88 conf
.CHECK_FUNCS('syslog vsyslog timegm setlocale')
89 conf
.CHECK_FUNCS_IN('nanosleep', 'rt')
90 conf
.CHECK_FUNCS('lutimes futimes utimensat futimens')
91 conf
.CHECK_FUNCS('mlock munlock mlockall munlockall')
92 conf
.CHECK_FUNCS('memalign posix_memalign hstrerror')
93 conf
.CHECK_FUNCS('shmget')
94 conf
.CHECK_FUNCS_IN('shm_open', 'rt', checklibc
=True)
95 conf
.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain bind_textdomain_codeset')
96 #FIXME: for some reason this one still fails
97 conf
.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
98 conf
.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
99 conf
.CHECK_FUNCS_IN('dn_expand', 'inet')
100 conf
.CHECK_DECLS('fdatasync', reverse
=True)
101 conf
.CHECK_DECLS('readahead', reverse
=True, headers
='fcntl.h')
103 if conf
.CONFIG_SET('HAVE_LONG_LONG'):
104 conf
.DEFINE('HAVE_LONGLONG', 1)
106 if conf
.CHECK_CODE('''
107 #if defined(HAVE_UNISTD_H)
110 long ret = splice(0,0,1,0,400,SPLICE_F_MOVE);
114 conf
.CHECK_DECLS('splice', reverse
=True, headers
='fcntl.h')
116 # Check for inotify support
117 conf
.CHECK_HEADERS('sys/inotify.h')
118 if "HAVE_SYS_INOTIFY_H" in conf
.env
:
119 conf
.DEFINE('HAVE_INOTIFY', 1)
121 # Check for kernel change notify support
124 #define F_NOTIFY 1026
127 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
128 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain
=False, execute
=True,
129 headers
='fcntl.h signal.h',
130 msg
="Checking for kernel change notify support")
132 # Check for Linux kernel oplocks
134 #include <sys/types.h>
138 #define F_NOTIFY 1026
141 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
142 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain
=False, execute
=True,
143 msg
="Checking for Linux kernel oplocks")
145 # Check for IRIX kernel oplock types
146 conf
.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
147 'HAVE_KERNEL_OPLOCKS_IRIX', headers
='fcntl.h',
148 msg
="Checking for IRIX kernel oplock types")
150 # Check for kernel share modes
152 #include <sys/types.h>
155 #include <sys/file.h>
161 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
162 }''', 'HAVE_KERNEL_SHARE_MODES', addmain
=False, execute
=True,
163 msg
="Checking for krenel share modes")
165 # Check for various members of the stat structure
166 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define
='HAVE_STAT_ST_BLOCKS',
167 headers
='sys/stat.h')
168 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define
='HAVE_STAT_ST_BLKSIZE',
169 headers
='sys/stat.h')
170 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_flags', define
='HAVE_STAT_ST_FLAGS',
171 headers
='sys/types.h sys/stat.h unistd.h')
173 if "HAVE_BLKCNT_T" in conf
.env
:
175 return sizeof(blkcnt_t) == 4 ? 0 : 1''',
176 'SIZEOF_BLKCNT_T_4', execute
=True,
177 headers
='replace.h sys/types.h sys/stat.h unistd.h',
178 msg
="Checking whether blkcnt_t is 32 bit")
180 if "HAVE_BLKCNT_T" in conf
.env
:
182 return sizeof(blkcnt_t) == 8 ? 0 : 1''',
183 'SIZEOF_BLKCNT_T_8', execute
=True,
184 headers
='replace.h sys/types.h sys/stat.h unistd.h',
185 msg
="Checking whether blkcnt_t is 64 bit")
187 # Check for POSIX capability support
188 conf
.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers
='sys/capability.h')
190 if "HAVE_SYS_CAPABILITY_H" in conf
.env
:
194 if (!(cap = cap_get_proc())) exit(1);
196 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
197 cap_set_proc(cap);''',
198 'HAVE_POSIX_CAPABILITIES', execute
=True, lib
="cap",
199 headers
='sys/capability.h',
200 msg
="Checking whether POSIX capabilities are available")
202 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
203 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
205 if conf
.CONFIG_SET("HAVE_RPC_RPC_H"):
206 conf
.CHECK_TYPE('int16', headers
='rpc/rpc.h',
207 define
='HAVE_INT16_FROM_RPC_RPC_H',
208 msg
="Checking for int16 typedef included by rpc/rpc.h")
209 conf
.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
210 headers
='sys/types.h rpc/rpc.h',
211 msg
="Checking for uint16 typedef included by rpc/rpc.h")
212 conf
.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
213 headers
='sys/types.h rpc/rpc.h',
214 msg
="Checking for int32 typedef included by rpc/rpc.h")
215 conf
.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
216 headers
='sys/types.h rpc/rpc.h',
217 msg
="Checking for uint32 typedef included by rpc/rpc.h")
218 conf
.CHECK_CODE('int i;', 'BROKEN_NISPLUS_INCLUDE_FILES',
219 headers
='sys/types.h sys/acl.h rpcsvc/nis.h',
220 msg
="Checking for broken nisplus include files")
222 # Check if the compiler will optimize out functions
225 this_function_does_not_exist();
228 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
229 msg
="Checking if the compiler will optimize out functions")
231 # Check if the compiler supports the LL suffix on long long integers
233 conf
.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL',
235 msg
="Checking for LL suffix on long long integers")
239 bindtextdomain _chdir __chdir chflags chmod _close __close _closedir
240 __closedir crypt16 devnm dgettext dirfd
241 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
243 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
245 fsetxattr _fstat __fstat fsync
246 futimens futimes __fxstat getauthuid
247 getcwd _getcwd __getcwd getdents __getdents getdirentries
248 getgrent getgrnam getgrouplist getgrset getmntent getpagesize
249 getpwanam getpwent_r getrlimit gettext
250 glob grantpt hstrerror initgroups innetgr
251 llseek _llseek __llseek _lseek __lseek
252 _lstat __lstat lutimes
253 __lxstat memalign mknod mlock mlockall munlock munlockall
254 _open __open _opendir __opendir
255 pathconf poll posix_fallocate
256 posix_memalign prctl pread _pread __pread
257 pwrite _pwrite __pwrite
258 rdchk _read __read _readdir __readdir
260 select setenv setgidx setgroups setlocale setluid
261 setmntent setpgid setpriv setsid setuidx
262 shmget shm_open sigaction sigblock sigprocmask sigset
264 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctl sysctlbyname
265 __sys_llseek syslog _telldir __telldir textdomain timegm
266 utimensat vsyslog _write __write __xstat
270 #ifdef HAVE_SYS_PRCTL_H
271 #include <sys/prctl.h>
275 'HAVE_PRCTL', link
=False)
277 conf
.CHECK_SAMBA3_CHARSET() # see build/charset.py
279 # FIXME: these should be tests for features, but the old build system just
281 host_os
= sys
.platform
282 Logs
.info("building on %s" % host_os
)
284 # Python doesn't have case switches... :/
285 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
286 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
288 conf
.SET_TARGET_TYPE('sunacl', 'EMPTY')
289 if (host_os
.rfind('linux') > -1) or (host_os
.rfind('gnu') > -1) or (host_os
.rfind('qnx') > -1):
290 if host_os
.rfind('linux') > -1:
291 conf
.DEFINE('LINUX', '1')
292 elif host_os
.rfind('qnx') > -1:
293 conf
.DEFINE('QNX', '1')
294 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
295 elif (host_os
.rfind('darwin') > -1):
296 conf
.DEFINE('DARWINOS', 1)
297 conf
.ADD_CFLAGS('-fno-common')
298 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
299 elif (host_os
.rfind('freebsd') > -1):
300 if conf
.CHECK_HEADERS('sunacl.h'):
301 conf
.DEFINE('HAVE_FREEBSD_SUNACL_H', '1')
302 conf
.CHECK_FUNCS_IN('acl', 'sunacl')
303 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
304 elif (host_os
.rfind('irix') > -1):
305 conf
.DEFINE('IRIX', 1)
306 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
307 elif (host_os
.rfind('aix') > -1):
308 conf
.DEFINE('AIX', 1)
309 conf
.DEFINE('STAT_ST_BLOCKSIZE', 'DEV_BSIZE')
310 elif (host_os
.rfind('hpux') > -1):
311 conf
.DEFINE('HPUX', 1)
312 conf
.DEFINE('STAT_ST_BLOCKSIZE', '8192')
313 elif (host_os
.rfind('osf') > -1):
314 conf
.DEFINE('OSF1', 1)
315 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
317 # FIXME: Add more checks here.
319 conf
.DEFINE('STAT_ST_BLOCKSIZE', '512')
321 if Options
.options
.with_acl_support
:
322 if (host_os
.rfind('sysv5') > -1) and conf
.CHECK_FUNCS_IN('sec', 'facl', checklibc
=True):
323 Logs
.info('Using UnixWare ACLs')
324 conf
.DEFINE('HAVE_UNIXWARE_ACLS',1)
325 default_static_modules
.extend(TO_LIST('vfs_solarisacl'))
326 elif (host_os
.rfind('solaris') > -1) and conf
.CHECK_FUNCS_IN('sec', 'facl'):
327 Logs
.info('Using solaris ACLs')
328 conf
.DEFINE('HAVE_SOLARIS_ACLS',1)
329 default_static_modules
.extend(TO_LIST('vfs_solarisacl'))
330 elif (host_os
.rfind('hpux') > -1):
331 Logs
.info('Using HPUX ACLs')
332 conf
.DEFINE('HAVE_HPUX_ACLS',1)
333 conf
.DEFINE('POSIX_ACL_NEEDS_MASK',1)
334 default_static_modules
.extend(TO_LIST('vfs_hpuxacl'))
335 elif (host_os
.rfind('aix') > -1):
336 Logs
.info('Using AIX ACLs')
337 conf
.DEFINE('HAVE_AIX_ACLS',1)
338 default_static_modules
.extend(TO_LIST('vfs_aixacl'))
339 elif (host_os
.rfind('osf') > -1) and conf
.CHECK_FUNCS_IN('pacl', 'acl_get_fd'):
340 Logs
.info('Using Tru64 ACLs')
341 conf
.DEFINE('HAVE_TRU64_ACLS',1)
342 default_static_modules
.extend(TO_LIST('vfs_tru64acl'))
343 elif (host_os
.rfind('darwin') > -1):
344 Logs
.warn('ACLs on Dwarwin currently not supported')
346 conf
.CHECK_FUNCS_IN('acl_get_file', 'acl')
347 if conf
.CHECK_CODE('''
350 acl_entry_t *entry_p;
351 return acl_get_entry(acl, entry_id, entry_p);
354 headers
='sys/types.h sys/acl.h', link
=False,
355 msg
="Checking for POSIX ACL support") :
357 acl_permset_t permset_d;
359 return acl_get_perm_np(permset_d, perm);
361 'HAVE_ACL_GET_PERM_NP',
362 headers
='sys/types.h sys/acl.h', link
=True,
363 msg
="Checking whether acl_get_perm_np() is available")
364 default_static_modules
.extend(TO_LIST('vfs_posixacl'))
367 if conf
.CHECK_FUNCS('dirfd'):
368 conf
.DEFINE('HAVE_DIRFD_DECL', 1)
370 conf
.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
371 'HAVE_STATFS_F_FSID',
372 msg
="vfs_fileid: checking for statfs() and struct statfs.f_fsid",
373 headers
='sys/types.h sys/statfs.h',
376 if conf
.CONFIG_SET('HAVE_FALLOCATE'):
378 int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
379 'HAVE_LINUX_FALLOCATE',
380 msg
="Checking whether the Linux 'fallocate' function is available",
381 headers
='unistd.h sys/types.h fcntl.h linux/falloc.h')
383 ssize_t err = readahead(0,0,0x80000);''',
384 'HAVE_LINUX_READAHEAD',
385 msg
="Checking whether Linux readahead is available",
386 headers
='unistd.h fcntl.h')
387 conf
.CHECK_DECLS('readahead', headers
='fcntl.h', always
=True)
389 conf
.CHECK_CODE('int fd = openat(AT_FDCWD, ".", O_RDONLY);',
391 msg
='Checking for openat',
394 if Options
.options
.with_aio_support
:
395 conf
.CHECK_FUNCS_IN('aio_read', 'aio')
396 conf
.CHECK_FUNCS_IN('aio_read', 'rt')
397 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);',
399 msg
='Checking for asynchronous io support',
400 headers
='sys/types.h aio.h',
402 if conf
.CONFIG_SET('HAVE_AIO'):
403 conf
.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg
='Checking for aio_read', headers
='aio.h', lib
='aio rt')
404 conf
.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg
='Checking for aio_write', headers
='aio.h', lib
='aio rt')
405 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')
406 conf
.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg
='Checking for aio_return', headers
='aio.h', lib
='aio rt')
407 conf
.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg
='Checking for aio_error', headers
='aio.h', lib
='aio rt')
408 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')
409 conf
.CHECK_CODE('struct aiocb a; return aio_suspend(&a, 1, NULL);', 'HAVE_AIO_SUSPEND', msg
='Checking for aio_suspend', headers
='aio.h', lib
='aio rt')
410 if not conf
.CONFIG_SET('HAVE_AIO'):
411 conf
.DEFINE('HAVE_NO_AIO', '1')
413 conf
.DEFINE('HAVE_NO_AIO', '1')
415 if host_os
.rfind('linux') > -1:
416 conf
.CHECK_FUNCS_IN('io_submit', 'aio')
418 struct io_event ioev;
424 fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
425 io_queue_init(128,&ctx);
426 io_prep_pwrite(ioc, 1, buf, 1, 0);
427 io_prep_pread(ioc, 1, buf, 1, 0);
428 io_set_eventfd(ioc, fd);
429 io_set_callback(ioc, (io_callback_t)(0));
430 io_submit(ctx, 1, &ioc);
431 io_getevents(ctx, 1, 1, &ioev, &ts);
433 'HAVE_LINUX_KERNEL_AIO',
434 msg
='Checking for linux kernel asynchronous io support',
435 headers
='unistd.h stdlib.h sys/types.h fcntl.h sys/eventfd.h libaio.h',
442 char control[CMSG_SPACE(sizeof(int))];
444 msg.msg_control = control_un.control;
445 msg.msg_controllen = sizeof(control_un.control);
447 'HAVE_MSGHDR_MSG_CONTROL',
448 msg
='Checking if we can use msg_control for passing file descriptors',
449 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
453 msg.msg_acctrights = (caddr_t) &fd;
454 msg.msg_acctrightslen = sizeof(fd);
456 'HAVE_MSGHDR_MSG_ACCTRIGHTS',
457 msg
='Checking if we can use msg_acctrights for passing file descriptors',
458 headers
='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h')
460 if Options
.options
.with_winbind
:
461 conf
.env
.build_winbind
= True
462 conf
.DEFINE('WITH_WINBIND', '1')
464 conf
.find_program('awk', var
='AWK')
465 conf
.find_program('perl', var
='PERL')
467 conf
.CHECK_HEADERS('asm/types.h')
469 conf
.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
470 headers
='unistd.h sys/types.h',
471 msg
="Checking for major macro")
473 conf
.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
474 headers
='unistd.h sys/types.h',
475 msg
="Checking for minor macro")
477 conf
.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
478 headers
='unistd.h sys/types.h dirent.h',
479 define
='HAVE_DIRENT_D_OFF')
481 conf
.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent')
482 if conf
.CHECK_CFLAGS('-Werror-implicit-function-declaration'):
483 netgrent_cflags
= '-Werror-implicit-function-declaration'
486 conf
.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE',
487 msg
="Checking for setnetgrent prototype",
488 headers
='netdb.h netgroup.h',
489 cflags
=netgrent_cflags
)
490 conf
.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE',
491 msg
="Checking for getnetgrent prototype",
492 headers
='netdb.h netgroup.h',
493 cflags
=netgrent_cflags
)
494 conf
.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE',
495 msg
="Checking for endnetgrent prototype",
496 headers
='netdb.h netgroup.h',
497 cflags
=netgrent_cflags
)
501 if Options
.options
.with_cups
:
502 conf
.find_program('cups-config', var
='CUPS_CONFIG')
503 if conf
.env
.CUPS_CONFIG
:
504 # we would normally use --libs here, but cups-config incorrectly adds
505 # gssapi_krb5 and other libraries to its --libs output. That breaks the use
506 # of an in-tree heimdal kerberos
507 conf
.check_cfg(path
=conf
.env
.CUPS_CONFIG
, args
="--cflags --ldflags",
508 package
="", uselib_store
="CUPS")
509 conf
.CHECK_HEADERS('cups/cups.h cups/language.h', lib
='cups')
510 conf
.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups')
511 if conf
.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf
.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
512 conf
.DEFINE('HAVE_CUPS', '1')
514 conf
.undefine('HAVE_CUPS')
515 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
517 # define an empty subsystem for cups, to allow it to be used as an empty dependency
518 conf
.SET_TARGET_TYPE('cups', 'EMPTY')
520 if Options
.options
.with_iprint
:
521 if conf
.CONFIG_SET('HAVE_CUPS'):
522 conf
.DEFINE('HAVE_IPRINT', '1')
524 Logs
.warn("--enable-iprint=yes but cups support not sufficient")
525 if Options
.options
.with_syslog
:
526 conf
.DEFINE('WITH_SYSLOG', '1')
527 if Options
.options
.with_automount
:
528 conf
.DEFINE('WITH_AUTOMOUNT', '1')
531 if Options
.options
.with_ldap
:
532 conf
.CHECK_HEADERS('ldap.h lber.h ldap_pvt.h')
533 conf
.CHECK_TYPE('ber_tag_t', 'unsigned int', headers
='ldap.h lber.h')
534 conf
.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
535 conf
.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers
='ldap.h')
537 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
539 conf
.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
540 define
='HAVE_LBER_LOG_PRINT_FN', headers
='lber.h')
542 conf
.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', 'ldap')
543 conf
.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
545 # Check if ldap_set_rebind_proc() takes three arguments
546 if conf
.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
547 'LDAP_SET_REBIND_PROC_ARGS',
548 msg
="Checking whether ldap_set_rebind_proc takes 3 arguments",
549 headers
='ldap.h lber.h', link
=False):
550 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
552 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
554 # last but not least, if ldap_init() exists, we want to use ldap
555 if conf
.CONFIG_SET('HAVE_LDAP_INIT') and conf
.CONFIG_SET('HAVE_LDAP_H'):
556 conf
.DEFINE('HAVE_LDAP', '1')
557 conf
.DEFINE('LDAP_DEPRECATED', '1')
558 conf
.env
['HAVE_LDAP'] = '1'
559 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
560 # SASL wrapping hooks
561 if conf
.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
562 conf
.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
563 conf
.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
565 conf
.SET_TARGET_TYPE('ldap', 'EMPTY')
566 conf
.SET_TARGET_TYPE('lber', 'EMPTY')
568 if Options
.options
.with_ads
:
570 if not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and \
571 not conf
.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC'):
572 Logs
.warn("arcfour-hmac-md5 encryption type not found in -lkrb5")
574 if not conf
.CONFIG_SET('HAVE_KRB5_MK_REQ_EXTENDED'):
575 Logs
.warn("krb5_mk_req_extended not found in -lkrb5")
577 if not conf
.CONFIG_SET('HAVE_KRB5_GET_HOST_REALM'):
578 Logs
.warn("krb5_get_host_realm not found in -lkrb5")
580 if not conf
.CONFIG_SET('HAVE_KRB5_FREE_HOST_REALM'):
581 Logs
.warn("krb5_free_host_realm not found in -lkrb5")
583 if not conf
.CONFIG_SET('HAVE_KRB5_FWD_TGT_CREDS'):
584 Logs
.warn("krb5_fwd_tgt_creds found in -lkrb5")
586 if not conf
.CONFIG_SET('HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC'):
587 Logs
.warn("krb5_get_init_creds_opt_alloc not found in -lkrb5")
589 if not conf
.CONFIG_SET('KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT'):
590 Logs
.warn("krb5_get_init_creds_opt_free was not found or was too old in -lkrb5")
592 if not conf
.CONFIG_SET('HAVE_KRB5_GET_RENEWED_CREDS'):
593 Logs
.warn("krb5_get_renewed_creds not found in -lkrb5")
595 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL_COMPARE_ANY_REALM'):
596 Logs
.warn("krb5_principal_compare_any_realm not found in -lkrb5")
598 if not conf
.CONFIG_SET('HAVE_KRB5_C_STRING_TO_KEY') and \
599 not conf
.CONFIG_SET('HAVE_KRB5_STRING_TO_KEY_SALT'):
600 Logs
.warn("krb5_c_string_to_key not found in -lkrb5")
602 if not conf
.CONFIG_SET('HAVE_KRB5_PRINCIPAL2SALT') and \
603 not conf
.CONFIG_SET('HAVE_KRB5_GET_PW_SALT'):
604 Logs
.warn("no CREATE_KEY_FUNCTIONS detected")
606 if not conf
.CONFIG_SET('HAVE_KRB5_GET_PERMITTED_ENCTYPES') and \
607 not conf
.CONFIG_SET('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES'):
608 Logs
.warn("no GET_ENCTYPES_FUNCTIONS detected")
610 if not conf
.CONFIG_SET('HAVE_KRB5_KT_FREE_ENTRY') and \
611 not conf
.CONFIG_SET('HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS'):
612 Logs
.warn("no KT_FREE_FUNCTION detected")
614 if not conf
.CONFIG_SET('HAVE_KRB5_C_VERIFY_CHECKSUM'):
615 Logs
.warn("krb5_c_verify_checksum_compare not found in -lkrb5")
618 # We don't actually use
619 # gsskrb5_extract_authz_data_from_sec_context, but it is a
620 # clue that this Heimdal, which does the PAC processing we
621 # need on the standard gss_inquire_sec_context_by_oid
622 if not conf
.CONFIG_SET('HAVE_GSS_GET_NAME_ATTRIBUTE') and \
623 not (conf
.CONFIG_SET('HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT') and \
624 conf
.CONFIG_SET('HAVE_GSS_INQUIRE_SEC_CONTEXT_BY_OID')):
625 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")
628 if not conf
.CONFIG_SET('HAVE_GSS_KRB5_EXPORT_LUCID_SEC_CONTEXT'):
629 Logs
.warn("need gss_krb5_export_lucid_sec_context for SPNEGO and gss_wrap support")
633 conf
.DEFINE('WITH_ADS', '1')
634 conf
.DEFINE('HAVE_KRB5', '1')
635 if conf
.CONFIG_SET('HAVE_LDAP'):
636 conf
.env
['HAVE_ADS'] = '1'
638 Logs
.warn("krb5 libs don't have all features required for Active Directory support")
639 conf
.undefine('HAVE_KRB5_H')
640 conf
.undefine('HAVE_GSSAPI_H')
641 conf
.undefine('HAVE_GSSAPI_GSSAPI_GENERIC_H')
642 conf
.undefine('HAVE_GSSAPI_GSSAPI_H')
644 if Options
.options
.with_utmp
:
645 conf
.env
.with_utmp
= True
646 if not conf
.CHECK_HEADERS('utmp.h'): conf
.env
.with_utmp
= False
647 conf
.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent')
648 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers
='utmp.h',
649 define
='HAVE_UT_UT_NAME')
650 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers
='utmp.h',
651 define
='HAVE_UT_UT_USER')
652 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers
='utmp.h',
653 define
='HAVE_UT_UT_ID')
654 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers
='utmp.h',
655 define
='HAVE_UT_UT_HOST')
656 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers
='utmp.h',
657 define
='HAVE_UT_UT_TIME')
658 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers
='utmp.h',
659 define
='HAVE_UT_UT_TV')
660 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers
='utmp.h',
661 define
='HAVE_UT_UT_TYPE')
662 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers
='utmp.h',
663 define
='HAVE_UT_UT_PID')
664 conf
.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers
='utmp.h',
665 define
='HAVE_UT_UT_EXIT')
666 conf
.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers
='utmpx.h',
667 define
='HAVE_UX_UT_SYSLEN')
668 conf
.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',
669 'PUTUTLINE_RETURNS_UTMP', headers
='utmp.h',
670 msg
="Checking whether pututline returns pointer")
671 conf
.CHECK_SIZEOF(['((struct utmp *)NULL)->ut_line'], headers
='utmp.h',
672 define
='SIZEOF_UTMP_UT_LINE')
673 if not conf
.CONFIG_SET('SIZEOF_UTMP_UT_LINE'):
674 conf
.env
.with_utmp
= False
675 elif int(conf
.env
.SIZEOF_UTMP_UT_LINE
) < 15:
676 conf
.env
.with_utmp
= False
677 if conf
.env
.with_utmp
:
678 conf
.DEFINE('WITH_UTMP', 1)
680 Logs
.warn("--with-utmp but utmp support not sufficient")
682 if Options
.options
.with_avahi
:
683 conf
.env
.with_avahi
= True
684 if not conf
.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf
.env
.with_avahi
= False
685 if not conf
.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf
.env
.with_avahi
= False
686 if not conf
.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf
.env
.with_avahi
= False
687 if conf
.env
.with_avahi
:
688 conf
.DEFINE('WITH_AVAHI_SUPPORT', 1)
690 conf
.SET_TARGET_TYPE('avahi-common', 'EMPTY')
691 conf
.SET_TARGET_TYPE('avahi-client', 'EMPTY')
693 if Options
.options
.with_iconv
:
694 conf
.env
.with_iconv
= True
695 if not conf
.CHECK_FUNCS_IN('iconv_open', 'iconv', headers
='iconv.h'):
696 conf
.env
.with_iconv
= False
697 if conf
.env
.with_iconv
:
698 conf
.DEFINE('HAVE_ICONV', 1)
700 if Options
.options
.with_pam
:
702 conf
.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
703 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
704 Logs
.warn("--with-pam=yes but pam_appl.h not found")
706 conf
.CHECK_FUNCS_IN('pam_get_data', 'pam')
707 conf
.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h')
708 if not conf
.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf
.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'):
709 Logs
.warn("--with-pam=yes but pam_modules.h not found")
711 conf
.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h')
712 conf
.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h')
713 conf
.CHECK_FUNCS_IN('pam_vsyslog', 'pam')
715 #if defined(HAVE_SECURITY_PAM_APPL_H)
716 #include <security/pam_appl.h>
717 #elif defined(HAVE_PAM_PAM_APPL_H)
718 #include <pam/pam_appl.h>
720 pam_set_item(0, PAM_RHOST, 0);
724 msg
="Checking whether PAM_RHOST is available");
726 #if defined(HAVE_SECURITY_PAM_APPL_H)
727 #include <security/pam_appl.h>
728 #elif defined(HAVE_PAM_PAM_APPL_H)
729 #include <pam/pam_appl.h>
731 pam_set_item(0, PAM_TTY, 0);
735 msg
="Checking whether PAM_TTY is available");
737 #if (!defined(LINUX))
739 #define PAM_EXTERN extern
740 #if defined(HAVE_SECURITY_PAM_APPL_H)
741 #include <security/pam_appl.h>
742 #elif defined(HAVE_PAM_PAM_APPL_H)
743 #include <pam/pam_appl.h>
748 #if defined(HAVE_SECURITY_PAM_MODULES_H)
749 #include <security/pam_modules.h>
750 #elif defined(HAVE_PAM_PAM_MODULES_H)
751 #include <pam/pam_modules.h>
754 #if defined(HAVE_SECURITY__PAM_MACROS_H)
755 #include <security/_pam_macros.h>
756 #elif defined(HAVE_PAM__PAM_MACROS_H)
757 #include <pam/_pam_macros.h>
760 #ifdef HAVE_SECURITY_PAM_EXT_H
761 #include <security/pam_ext.h>
764 int i; i = PAM_RADIO_TYPE;
766 'HAVE_PAM_RADIO_TYPE',
768 msg
="Checking whether PAM_RADIO_TYPE is available");
770 conf
.DEFINE('WITH_PAM', 1)
771 conf
.DEFINE('WITH_PAM_MODULES', 1)
773 if Options
.options
.with_pam_smbpass
:
774 conf
.env
.with_pam_smbpass
= True
779 # Ensure we select the correct set of system calls on Linux.
781 if (host_os
.rfind('linux') > -1):
783 #if defined(HAVE_UNISTD_H)
788 #include <sys/types.h>
791 #ifdef HAVE_SYS_PRIV_H
792 #include <sys/priv.h>
798 #if defined(HAVE_SYSCALL_H)
802 #if defined(HAVE_SYS_SYSCALL_H)
803 #include <sys/syscall.h>
806 syscall(SYS_setresuid32, -1, -1, -1);
807 syscall(SYS_setresgid32, -1, -1, -1);
808 syscall(SYS_setreuid32, -1, -1);
809 syscall(SYS_setregid32, -1, -1);
810 syscall(SYS_setuid32, -1);
811 syscall(SYS_setgid32, -1);
812 syscall(SYS_setgroups32, 0, NULL);
814 'USE_LINUX_32BIT_SYSCALLS',
815 msg
="Checking whether Linux should use 32-bit credential calls");
817 if (conf
.CONFIG_SET('USE_LINUX_32BIT_SYSCALLS')):
818 seteuid
= conf
.CHECK_CODE('''
819 #define AUTOCONF_TEST 1
820 #define USE_LINUX_THREAD_CREDENTIALS 1
821 #define USE_LINUX_32BIT_SYSCALLS 1
822 #include "../lib/util/setid.c"
823 #include "./lib/util_sec.c"
825 'USE_LINUX_THREAD_CREDENTIALS',
828 msg
="Checking whether we can use Linux thread-specific credentials with 32-bit system calls")
830 seteuid
= conf
.CHECK_CODE('''
831 #define AUTOCONF_TEST 1
832 #define USE_LINUX_THREAD_CREDENTIALS 1
833 #include "../lib/util/setid.c"
834 #include "./lib/util_sec.c"
836 'USE_LINUX_THREAD_CREDENTIALS',
839 msg
="Checking whether we can use Linux thread-specific credentials")
841 seteuid
= conf
.CHECK_CODE('''
842 #define AUTOCONF_TEST 1
843 #define USE_SETREUID 1
844 #include "../lib/util/setid.c"
845 #include "./lib/util_sec.c"
850 msg
="Checking whether setreuid is available")
852 seteuid
= conf
.CHECK_CODE('''
853 #define AUTOCONF_TEST 1
854 #define USE_SETRESUID 1
855 #include "../lib/util/setid.c"
856 #include "./lib/util_sec.c"
861 msg
="Checking whether setresuid is available")
863 seteuid
= conf
.CHECK_CODE('''
864 #define AUTOCONF_TEST 1
865 #define USE_SETEUID 1
866 #include "../lib/util/setid.c"
867 #include "./lib/util_sec.c"
872 msg
="Checking whether seteuid is available")
874 seteuid
= conf
.CHECK_CODE('''
875 #define AUTOCONF_TEST 1
876 #define USE_SETUIDX 1
877 #include "../lib/util/setid.c"
878 #include "./lib/util_sec.c"
884 msg
="Checking whether setuidx is available")
885 if Options
.options
.with_dnsupdate
:
886 if not conf
.CONFIG_SET('HAVE_KRB5'):
887 Logs
.warn("--with-dnsupdate=yes but gssapi support not sufficient")
889 conf
.DEFINE('WITH_DNS_UPDATES', 1)
890 conf
.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
891 if Options
.options
.developer
:
892 if conf
.CONFIG_SET('HAVE_VALGRIND_H') or conf
.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'):
893 conf
.DEFINE('VALGRIND', '1')
895 if conf
.CHECK_CODE('''
896 #include <bits/sockaddr.h>
897 #include <linux/netlink.h>
899 'HAVE_LINUX_NETLINK_H',
900 msg
="Checking whether Linux netlink is available"):
903 #include <bits/sockaddr.h>
904 #include <linux/netlink.h>
905 #include <linux/rtnetlink.h>
907 'HAVE_LINUX_RTNETLINK_H',
908 msg
='Checking whether Linux rtnetlink is available')
911 #include "../tests/fcntl_lock.c"
916 msg
='Checking whether fcntl locking is available')
918 # glibc up to 2.3.6 had dangerously broken posix_fallocate(). DON'T USE IT.
919 if not conf
.CHECK_CODE('''
920 #define _XOPEN_SOURCE 600
922 #if defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4))
923 #error probably broken posix_fallocate
926 '_HAVE_UNBROKEN_POSIX_FALLOCATE',
927 msg
='Checking for broken posix_fallocate'):
928 conf
.DEFINE('HAVE_BROKEN_POSIX_FALLOCATE', '1')
931 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec',
932 define
='HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') # Linux, Solaris
933 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimensec',
934 define
='HAVE_STRUCT_STAT_ST_MTIMENSEC') # BSD, if defined _POSIX_SOURCE
935 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimespec.tv_nsec',
936 define
='HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') # BSD, if not defined _POSIX_SOURCE
937 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtime_n',
938 define
='HAVE_STRUCT_STAT_ST_MTIME_N') # AIX
939 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_umtime',
940 define
='HAVE_STRUCT_STAT_ST_UMTIME') # Tru64
941 if conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') or \
942 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMENSEC') or \
943 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') or \
944 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIME_N') or \
945 conf
.CONFIG_SET('HAVE_STRUCT_STAT_ST_UMTIME'):
946 conf
.DEFINE('HAVE_STAT_HIRES_TIMESTAMPS', '1')
948 # recent FreeBSD, NetBSD have creation timestamps called birthtime:
949 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtime',
950 define
='HAVE_STRUCT_STAT_ST_BIRTHTIME')
951 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimespec.tv_nsec',
952 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC')
953 conf
.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimensec',
954 define
='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC')
957 ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
959 'HAVE_POSIX_FADVISE',
960 msg
='Checking whether posix_fadvise is available',
961 headers
='unistd.h fcntl.h')
963 for v
in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]:
966 return sysconf(%s) == -1 ? 1 : 0;
969 msg
='Checking whether sysconf(%s) is available' % v
)
972 #include <sys/syscall.h>
974 syscall(SYS_initgroups, 16, NULL, NULL, 0);
976 'HAVE_DARWIN_INITGROUPS',
977 msg
='Checking whether to use the Darwin-specific initgroups system call')
979 conf
.CHECK_CODE('''struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''',
981 headers
='sys/types.h utime.h',
982 msg
='Checking whether struct utimbuf is available')
984 if conf
.CHECK_CODE('''struct sigevent s;''',
985 'HAVE_STRUCT_SIGEVENT',
986 headers
='sys/types.h stdlib.h stddef.h signal.h',
987 msg
='Checking whether we have the struct sigevent'):
988 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sival_ptr',
989 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR',
991 conf
.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sigval_ptr',
992 define
='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR',
995 if os
.path
.exists('/proc/sys/kernel/core_pattern'):
996 conf
.DEFINE('HAVE_SYS_KERNEL_PROC_CORE_PATTERN', '1')
998 if conf
.CHECK_CODE('''
1002 if (sizeof(time_t) == 8) {
1003 time_t max_time = 0x7fffffffffffffffll;
1004 tm = gmtime(&max_time);
1005 /* This should fail with 32-bit tm_year. */
1007 /* Max time_t that works with 32-bit int tm_year in struct tm. */
1008 max_time = 67768036191676799ll;
1009 tm = gmtime(&max_time);
1020 msg
="Checking for the maximum value of the 'time_t' type"):
1021 conf
.DEFINE('TIME_T_MAX', '67768036191676799ll')
1024 #if defined(HAVE_UNISTD_H)
1027 #include <sys/types.h>
1028 main() { dev_t dev = makedev(1,2); return 0; }
1032 msg
='Checking whether the macro for makedev is available')
1039 void exit_on_core(int ignored) {
1045 signal(SIGSEGV, exit_on_core);
1046 newpath = realpath("/tmp", NULL);
1047 exit((newpath != NULL) ? 0 : 1);
1050 'REALPATH_TAKES_NULL',
1053 msg
='Checking whether the realpath function allows a NULL argument')
1055 conf
.CHECK_CODE('''#include "../tests/ftruncate.c"''',
1056 'HAVE_FTRUNCATE_EXTEND',
1057 msg
='Checking for ftruncate extend',
1061 if Options
.options
.with_sendfile_support
:
1062 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):
1067 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
1070 headers
='sys/sendfile.h',
1071 msg
='Checking for linux sendfile support')
1073 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1074 conf
.DEFINE('HAVE_SENDFILE', '1')
1075 conf
.DEFINE('LINUX_SENDFILE_API', '1')
1076 conf
.DEFINE('WITH_SENDFILE', '1')
1077 elif (host_os
.rfind('freebsd') > -1) or (host_os
.rfind('dragonfly') > -1):
1079 #include <sys/types.h>
1081 #include <sys/socket.h>
1082 #include <sys/uio.h>
1083 int fromfd, tofd, ret, total=0;
1084 off_t offset, nwritten;
1087 hdr.headers = &hdtrl;
1089 hdr.trailers = NULL;
1091 hdtrl.iov_base = NULL;
1093 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0)
1096 msg
='Checking for freebsd sendfile support')
1097 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1098 conf
.DEFINE('HAVE_SENDFILE', '1')
1099 conf
.DEFINE('FREEBSD_SENDFILE_API', '1')
1100 conf
.DEFINE('WITH_SENDFILE', '1')
1101 elif (host_os
.rfind('darwin') > -1):
1103 #include <sys/types.h>
1104 #include <sys/socket.h>
1105 #include <sys/uio.h>
1106 int fromfd, tofd, ret;
1107 off_t offset, nwritten;
1110 hdr.headers = &hdtrl;
1112 hdr.trailers = (void *)0;
1114 hdtrl.iov_base = (void *)0;
1116 ret = sendfile(fromfd, tofd, offset, &nwritten, &hdr, 0);
1119 msg
='Checking for darwin sendfile support')
1120 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1121 conf
.DEFINE('HAVE_SENDFILE', '1')
1122 conf
.DEFINE('DARWIN_SENDFILE_API', '1')
1123 conf
.DEFINE('WITH_SENDFILE', '1')
1124 elif (host_os
.rfind('hpux') > -1) or (host_os
.rfind('osf') > -1):
1126 #include <sys/socket.h>
1127 #include <sys/uio.h>
1130 struct iovec hdtrl[2];
1133 hdtrl[0].iov_base = 0;
1134 hdtrl[0].iov_len = 0;
1135 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
1138 msg
='Checking for osf/hpux sendfile support')
1139 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1140 conf
.DEFINE('HAVE_SENDFILE', '1')
1141 conf
.DEFINE('HPUX_SENDFILE_API', '1')
1142 conf
.DEFINE('WITH_SENDFILE', '1')
1143 elif (host_os
.rfind('solaris') > -1):
1144 conf
.CHECK_FUNCS_IN('sendfile', 'sendfilev')
1146 #include <sys/sendfile.h>,
1149 struct sendfilevec vec[2];
1153 vec[0].sfv_fd = SFV_FD_SELF;
1154 vec[0].sfv_flag = 0;
1158 vec[1].sfv_flag = 0;
1161 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
1164 msg
='Checking for solaris sendfilev support')
1165 if conf
.CONFIG_SET('_HAVE_SENDFILEV'):
1166 conf
.DEFINE('HAVE_SENDFILEV', '1')
1167 conf
.DEFINE('SOLARIS_SENDFILE_API', '1')
1168 conf
.DEFINE('WITH_SENDFILE', '1')
1169 elif (host_os
.rfind('aix') > -1):
1171 #include <sys/socket.h>
1174 struct sf_parms hdtrl;
1176 hdtrl.header_data = 0;
1177 hdtrl.header_length = 0;
1178 hdtrl.file_descriptor = fromfd;
1179 hdtrl.file_offset = 0;
1180 hdtrl.file_bytes = 0;
1181 hdtrl.trailer_data = 0;
1182 hdtrl.trailer_length = 0;
1183 nwritten = send_file(&tofd, &hdtrl, 0);
1186 msg
='Checking for AIX send_file support')
1187 if conf
.CONFIG_SET('_HAVE_SENDFILE'):
1188 conf
.DEFINE('HAVE_SENDFILE', '1')
1189 conf
.DEFINE('AIX_SENDFILE_API', '1')
1190 conf
.DEFINE('WITH_SENDFILE', '1')
1192 # Check for getcwd allowing a NULL arg.
1196 char *s = getcwd(NULL,0);
1197 exit(s != NULL ? 0 : 1);
1198 }''', 'GETCWD_TAKES_NULL', addmain
=False, execute
=True,
1199 msg
="getcwd takes a NULL argument")
1202 # UnixWare 7.x has its getspnam in -lgen
1203 conf
.CHECK_FUNCS_IN('getspnam', 'gen')
1204 conf
.CHECK_FUNCS_IN('getspnam', 'security')
1205 conf
.CHECK_FUNCS_IN('getspnam', 'sec')
1207 if Options
.options
.with_quotas
:
1208 # For quotas on Veritas VxFS filesystems
1209 conf
.CHECK_HEADERS('sys/fs/vx_quota.h')
1210 # For sys/quota.h and linux/quota.h
1211 conf
.CHECK_HEADERS('sys/quota.h')
1212 # For quotas on BSD systems
1213 conf
.CHECK_HEADERS('ufs/ufs/quota.h')
1214 # For quotas on Linux XFS filesystems
1215 if conf
.CHECK_HEADERS('xfs/xqm.h'):
1216 conf
.DEFINE('HAVE_XFS_QUOTAS', '1')
1220 #include "confdefs.h"
1221 #ifdef HAVE_SYS_TYPES_H
1222 #include <sys/types.h>
1224 #ifdef HAVE_ASM_TYPES_H
1225 #include <asm/types.h>
1227 #include <sys/quota.h>
1228 int i = Q_XGETQUOTA;''',
1229 define
='HAVE_XFS_QUOTAS',
1230 msg
='for XFS QUOTA in <sys/quota.h>',
1232 local_include
=False)
1234 # For IRIX like dqb_isoftlimit instead of dqb_fsoftlimit in struc dqblk
1235 conf
.CHECK_STRUCTURE_MEMBER('struct dqblk', 'dqb_fsoftlimit', define
='HAVE_DQB_FSOFTLIMIT',
1236 headers
='sys/quota.h')
1237 #darwin style quota bytecount
1238 conf
.CHECK_STRUCTURE_MEMBER('struct dqblk', 'dqb_curbytes', define
='HAVE_STRUCT_DQBLK_DQB_CURBYTES',
1239 headers
='sys/quota.h')
1240 if conf
.CHECK_HEADERS('rpcsvc/rquota.h'):
1241 conf
.DEFINE('HAVE_NFS_QUOTAS', '1')
1242 conf
.CHECK_STRUCTURE_MEMBER('struct getquota_rslt', 'getquota_rslt_u',
1243 define
='HAVE_GETQUOTA_RSLT_GETQUOTA_RSLT_U',
1244 headers
='rpcsvc/rquota.h')
1246 if (host_os
.rfind('linux') > -1):
1247 conf
.DEFINE('HAVE_QUOTACTL_LINUX', '1')
1248 elif not conf
.CONFIG_SET("HAVE_XFS_QUOTAS"):
1249 if not conf
.CHECK_CODE('''
1250 #define HAVE_QUOTACTL_4A 1
1251 #define AUTOCONF_TEST 1
1252 #include "../tests/sysquotas.c"
1254 cflags
=conf
.env
['WERROR_CFLAGS'],
1255 define
='HAVE_QUOTACTL_4A',
1256 msg
='for QUOTACTL_4A: long quotactl(int cmd, char *special, qid_t id, caddr_t addr)',
1261 #define HAVE_QUOTACTL_4B 1
1262 #define AUTOCONF_TEST 1
1263 #include "../tests/sysquotas.c"
1265 cflags
=conf
.env
['WERROR_CFLAGS'],
1266 define
='HAVE_QUOTACTL_4B',
1267 msg
='for QUOTACTL_4B: int quotactl(const char *path, int cmd, int id, char *addr)',
1272 clnt_create("", RQUOTAPROG, RQUOTAVERS, "udp");
1274 headers
="rpc/rpc.h rpc/types.h rpcsvc/rquota.h rpc/nettype.h rpc/xdr.h",
1275 define
='HAVE_NFS_QUOTAS',
1276 msg
='for NFS QUOTAS',
1278 local_include
=False)
1280 if conf
.CONFIG_SET('HAVE_QUOTACTL_LINUX') or \
1281 conf
.CONFIG_SET('HAVE_QUOTACTL_4A') or \
1282 conf
.CONFIG_SET('HAVE_QUOTACTL_4B') or \
1283 conf
.CONFIG_SET('HAVE_XFS_QUOTAS'):
1284 conf
.DEFINE('HAVE_SYS_QUOTAS', '1')
1285 conf
.DEFINE('WITH_QUOTAS', '1')
1288 # checking for clustering extensions (CTDB)
1290 if not Options
.options
.with_cluster_support
:
1291 have_cluster_support
= False
1295 if Options
.options
.ctdb_dir
:
1296 conf
.ADD_EXTRA_INCLUDES(Options
.options
.ctdb_dir
+ '/include')
1298 srcdir
= os
.path
.realpath(conf
.srcdir
)
1299 if 'EXTRA_INCLUDES' in conf
.env
:
1300 includes
= ' '.join(conf
.env
['EXTRA_INCLUDES']).replace('#', srcdir
+ '/')
1304 have_cluster_support
= True
1309 #include "replace.h"
1310 #include "system/wait.h"
1311 #include "system/network.h"
1312 #define private #error __USED_RESERVED_WORD_private__
1325 msg
='Checking for header ctdb.h')
1327 if not conf
.CONFIG_SET('HAVE_CTDB_H'):
1328 have_cluster_support
= False
1329 ctdb_broken
= "ctdb.h is required for cluster support"
1331 if have_cluster_support
:
1334 #include "replace.h"
1335 #include "system/wait.h"
1336 #include "system/network.h"
1337 #define private #error __USED_RESERVED_WORD_private__
1341 #include <ctdb_private.h>
1348 'HAVE_CTDB_PRIVATE_H',
1351 msg
='Checking for header ctdb_private.h')
1353 if not conf
.CONFIG_SET('HAVE_CTDB_PRIVATE_H'):
1354 have_cluster_support
= False
1355 ctdb_broken
= "ctdb_private.h is required for cluster support"
1357 if have_cluster_support
:
1360 #include "replace.h"
1361 #include "system/wait.h"
1362 #include "system/network.h"
1366 #include <ctdb_private.h>
1370 int i = (int)CTDB_CONTROL_TRANS3_COMMIT;
1374 'HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL',
1377 msg
='Checking for transaction support (TRANS3_COMMIT control)')
1379 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL'):
1380 have_cluster_support
= False
1381 ctdb_broken
= "ctdb transaction support missing or too old"
1383 if have_cluster_support
:
1386 #include "replace.h"
1387 #include "system/wait.h"
1388 #include "system/network.h"
1392 #include <ctdb_private.h>
1396 int i = (int)CTDB_CONTROL_SCHEDULE_FOR_DELETION;
1400 'HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL',
1403 msg
='Checking for SCHEDULE_FOR_DELETION control')
1405 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL'):
1406 if not Options
.options
.enable_old_ctdb
:
1407 have_cluster_support
= False
1408 ctdb_broken
= "SCHEDULE_FOR_DELETION control missing"
1410 Logs
.warn("ignoring missing SCHEDULE_FOR_DELETION control (--enable-old-ctdb)")
1412 if have_cluster_support
:
1415 #include "replace.h"
1416 #include "system/wait.h"
1417 #include "system/network.h"
1421 #include <ctdb_private.h>
1425 struct ctdb_control_tcp _x;
1429 'HAVE_STRUCT_CTDB_CONTROL_TCP',
1432 msg
='Checking for ctdb ipv4 support')
1434 if not conf
.CONFIG_SET('HAVE_STRUCT_CTDB_CONTROL_TCP'):
1435 have_cluster_support
= False
1436 ctdb_broken
= "missing struct ctdb_control_tcp"
1438 if have_cluster_support
:
1441 #include "replace.h"
1442 #include "system/wait.h"
1443 #include "system/network.h"
1447 #include <ctdb_private.h>
1451 struct ctdb_control_tcp_addr _x;
1455 'HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR',
1458 msg
='Checking for ctdb ipv6 support')
1460 if have_cluster_support
:
1463 #include "replace.h"
1464 #include "system/wait.h"
1465 #include "system/network.h"
1469 #include <ctdb_private.h>
1473 int i = (int)CTDB_CONTROL_CHECK_SRVIDS;
1477 'HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL',
1480 msg
='Checking for CHECK_SRVIDS control')
1482 if not conf
.CONFIG_SET('HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL'):
1483 if not Options
.options
.enable_old_ctdb
:
1484 have_cluster_support
= False
1485 ctdb_broken
= "CHECK_SRVIDS control missing"
1487 Logs
.warn("ignoring missing CHECK_SRVIDS control (--enable-old-ctdb)")
1489 if have_cluster_support
:
1490 Logs
.info("building with cluster support")
1491 conf
.DEFINE('CLUSTER_SUPPORT', 1);
1493 if not Options
.options
.with_cluster_support
:
1494 Logs
.info("building without cluster support")
1496 Logs
.warn("building without cluster support: " + ctdb_broken
)
1497 conf
.undefine('CLUSTER_SUPPORT')
1501 conf
.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }',
1502 'HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR',
1505 msg
='Checking whether we can compile with __attribute__((destructor))')
1507 conf
.CHECK_CODE('void seekdir(DIR *d, long loc) { return; }',
1508 'SEEKDIR_RETURNS_VOID',
1509 headers
='sys/types.h dirent.h',
1510 msg
='Checking whether seekdir returns void')
1512 if Options
.options
.with_profiling_data
:
1513 conf
.DEFINE('WITH_PROFILE', 1);
1515 PTHREAD_CFLAGS
='error'
1516 PTHREAD_LDFLAGS
='error'
1518 if PTHREAD_LDFLAGS
== 'error':
1519 if conf
.CHECK_FUNCS_IN('pthread_attr_init', 'pthread'):
1520 PTHREAD_CFLAGS
='-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS'
1521 PTHREAD_LDFLAGS
='-lpthread'
1522 if PTHREAD_LDFLAGS
== 'error':
1523 if conf
.CHECK_FUNCS_IN('pthread_attr_init', 'pthreads'):
1524 PTHREAD_CFLAGS
='-D_THREAD_SAFE'
1525 PTHREAD_LDFLAGS
='-lpthreads'
1526 if PTHREAD_LDFLAGS
== 'error':
1527 if conf
.CHECK_FUNCS_IN('pthread_attr_init', 'c_r'):
1528 PTHREAD_CFLAGS
='-D_THREAD_SAFE -pthread'
1529 PTHREAD_LDFLAGS
='-pthread'
1530 if PTHREAD_LDFLAGS
== 'error':
1531 if conf
.CHECK_FUNCS('pthread_attr_init'):
1532 PTHREAD_CFLAGS
='-D_REENTRANT'
1533 PTHREAD_LDFLAGS
='-lpthread'
1534 # especially for HP-UX, where the CHECK_FUNC macro fails to test for
1535 # pthread_attr_init. On pthread_mutex_lock it works there...
1536 if PTHREAD_LDFLAGS
== 'error':
1537 if conf
.CHECK_FUNCS_IN('pthread_mutex_lock', 'pthread'):
1538 PTHREAD_CFLAGS
='-D_REENTRANT'
1539 PTHREAD_LDFLAGS
='-lpthread'
1541 if PTHREAD_CFLAGS
!= 'error' and PTHREAD_LDFLAGS
!= 'error':
1542 conf
.ADD_CFLAGS(PTHREAD_CFLAGS
)
1543 conf
.ADD_LDFLAGS(PTHREAD_LDFLAGS
)
1544 conf
.CHECK_HEADERS('pthread.h')
1545 conf
.DEFINE('HAVE_PTHREAD', '1')
1547 if Options
.options
.with_pthreadpool
:
1548 if conf
.CONFIG_SET('HAVE_PTHREAD'):
1549 conf
.DEFINE('WITH_PTHREADPOOL', '1')
1551 Logs
.warn("pthreadpool support cannot be enabled when pthread support was not found")
1552 conf
.undefine('WITH_PTHREADPOOL')
1554 if conf
.CHECK_HEADERS('gpfs_gpl.h'):
1555 conf
.DEFINE('HAVE_GPFS', '1')
1557 default_static_modules
.extend(TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
1558 auth_sam auth_unix auth_winbind auth_wbc
1559 auth_domain auth_builtin vfs_default
1560 nss_info_template idmap_tdb idmap_passdb
1563 default_shared_modules
.extend(TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk
1564 vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap
1565 vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2
1566 auth_script vfs_readahead vfs_xattr_tdb vfs_posix_eadb
1567 vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
1568 vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
1570 vfs_crossrename vfs_linux_xfs_sgid
1571 vfs_time_audit idmap_autorid idmap_tdb2
1572 idmap_rid idmap_hash'''))
1574 if Options
.options
.developer
:
1575 default_static_modules
.extend(TO_LIST('charset_weird'))
1576 default_shared_modules
.extend(TO_LIST('perfcount_test'))
1577 default_shared_modules
.extend(TO_LIST('vfs_skel_opaque vfs_skel_transparent vfs_shadow_copy_test'))
1578 default_shared_modules
.extend(TO_LIST('auth_skel pdb_test'))
1580 if Options
.options
.enable_selftest
or Options
.options
.developer
:
1581 default_shared_modules
.extend(TO_LIST('vfs_fake_acls'))
1584 if conf
.CONFIG_SET('AD_DC_BUILD_IS_ENABLED'):
1585 default_static_modules
.extend(TO_LIST('pdb_samba_dsdb auth_samba4 vfs_dfs_samba4'))
1587 if conf
.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'):
1588 default_shared_modules
.extend(TO_LIST('vfs_zfsacl'))
1590 if conf
.CONFIG_SET('HAVE_DIRFD_DECL'):
1591 default_shared_modules
.extend(TO_LIST('vfs_syncops vfs_dirsort'))
1593 if conf
.CONFIG_SET('HAVE_STATFS_F_FSID'):
1594 default_shared_modules
.extend(TO_LIST('vfs_fileid'))
1596 if (conf
.CONFIG_SET('HAVE_MSGHDR_MSG_CONTROL') or conf
.CONFIG_SET('HAVE_MSGHDR_MSG_ACCTRIGHTS')):
1597 default_shared_modules
.extend(TO_LIST('vfs_aio_fork'))
1599 if Options
.options
.with_pthreadpool
:
1600 default_shared_modules
.extend(TO_LIST('vfs_aio_pthread'))
1602 if conf
.CONFIG_SET('HAVE_AIO'):
1603 default_shared_modules
.extend(TO_LIST('vfs_aio_posix'))
1605 if conf
.CONFIG_SET('HAVE_LINUX_KERNEL_AIO'):
1606 default_shared_modules
.extend(TO_LIST('vfs_aio_linux'))
1608 if conf
.CONFIG_SET('HAVE_LDAP'):
1609 default_static_modules
.extend(TO_LIST('pdb_ldap idmap_ldap'))
1611 if conf
.CONFIG_SET('DARWINOS'):
1612 default_static_modules
.extend(TO_LIST('charset_macosxfs'))
1614 if conf
.CONFIG_SET('HAVE_GPFS'):
1615 default_shared_modules
.extend(TO_LIST('vfs_gpfs'))
1617 explicit_shared_modules
= TO_LIST(Options
.options
.shared_modules
, delimiter
=',')
1618 explicit_static_modules
= TO_LIST(Options
.options
.static_modules
, delimiter
=',')
1620 final_static_modules
= default_static_modules
1621 final_shared_modules
= default_shared_modules
1623 for m
in explicit_static_modules
:
1624 if m
in final_shared_modules
:
1625 final_shared_modules
.remove(m
)
1626 final_static_modules
.append(m
)
1627 for m
in explicit_shared_modules
:
1628 if m
in final_static_modules
:
1629 final_static_modules
.remove(m
)
1630 final_shared_modules
.append(m
)
1632 if ("auth_domain" not in final_static_modules
) or \
1633 ("auth_builtin" not in final_static_modules
) or \
1634 ("auth_sam" not in final_static_modules
) or \
1635 ("auth_winbind" not in final_static_modules
):
1636 raise Utils
.WafError('These auth modules MUST be configured as static modules: auth_domain, auth_builtin, auth_sam, auth_winbind')
1638 conf
.env
['static_modules'] = final_static_modules
1639 conf
.env
['shared_modules'] = final_shared_modules
1641 conf
.DEFINE('STRING_STATIC_MODULES', ' '.join(final_static_modules
), quote
=True)
1646 prefixes
= ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
1647 conf
.env
['MODULE_PREFIXES'] = prefixes
1649 for m
in final_static_modules
:
1651 if not p
in static_list
:
1653 static_list
[p
].append(m
)
1654 for m
in final_shared_modules
:
1656 if not p
in shared_list
:
1658 shared_list
[p
].append(m
)
1661 static_env
= "%s_STATIC" % p
.upper()
1662 shared_env
= "%s_SHARED" % p
.upper()
1663 conf
.env
[static_env
] = []
1664 conf
.env
[shared_env
] = []
1665 if p
in static_list
:
1667 for entry
in static_list
[p
]:
1668 decl_list
+= "extern NTSTATUS %s_init(void); " % entry
1669 conf
.env
[static_env
].append('%s' % entry
)
1670 decl_list
= decl_list
.rstrip()
1671 conf
.DEFINE('static_decl_%s' % p
, decl_list
)
1672 conf
.DEFINE('static_init_%s' % p
, '{ %s_init(); }' % '_init(); '.join(static_list
[p
]))
1674 conf
.DEFINE('static_decl_%s' % p
, '')
1675 conf
.DEFINE('static_init_%s' % p
, '{}')
1676 if p
in shared_list
:
1677 for entry
in shared_list
[p
]:
1678 conf
.DEFINE('%s_init' % entry
, 'samba_init_module')
1679 conf
.env
[shared_env
].append('%s' % entry
)
1681 conf
.SAMBA_CONFIG_H('include/config.h')
1684 "build 'tags' file using ctags"
1686 source_root
= os
.path
.dirname(Utils
.g_module
.root_path
)
1687 cmd
= 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
1688 print("Running: %s" % cmd
)