| 1 | #! /usr/bin/env python | 
|---|
| 2 |  | 
|---|
| 3 | srcdir = '..' | 
|---|
| 4 | blddir = 'bin' | 
|---|
| 5 |  | 
|---|
| 6 | APPNAME='samba' | 
|---|
| 7 | VERSION=None | 
|---|
| 8 |  | 
|---|
| 9 | import sys, os | 
|---|
| 10 | from optparse import SUPPRESS_HELP | 
|---|
| 11 | sys.path.insert(0, srcdir+"/buildtools/wafsamba") | 
|---|
| 12 | sys.path.insert(0, "source3") | 
|---|
| 13 | import wafsamba, Options, Logs, Utils, Scripting | 
|---|
| 14 | import build.charset | 
|---|
| 15 | import samba_utils, samba_version | 
|---|
| 16 | import samba3 | 
|---|
| 17 |  | 
|---|
| 18 | def set_options(opt): | 
|---|
| 19 | if not os.getenv('TOPLEVEL_BUILD'): | 
|---|
| 20 | opt.BUILTIN_DEFAULT('NONE') | 
|---|
| 21 | opt.PRIVATE_EXTENSION_DEFAULT('s3') | 
|---|
| 22 | opt.RECURSE('../lib/replace') | 
|---|
| 23 | opt.RECURSE('build') | 
|---|
| 24 | opt.RECURSE('selftest') | 
|---|
| 25 | opt.RECURSE('../lib/nss_wrapper') | 
|---|
| 26 | opt.RECURSE('../lib/socket_wrapper') | 
|---|
| 27 | opt.RECURSE('../lib/tevent') | 
|---|
| 28 | opt.RECURSE('../lib/tdb') | 
|---|
| 29 |  | 
|---|
| 30 | opt.add_option('--with-static-modules', | 
|---|
| 31 | help=("Comma-separated list of names of modules to statically link in"), | 
|---|
| 32 | action="store", dest='static_modules', default=None) | 
|---|
| 33 | opt.add_option('--with-shared-modules', | 
|---|
| 34 | help=("Comma-separated list of names of modules to build shared"), | 
|---|
| 35 | action="store", dest='shared_modules', default=None) | 
|---|
| 36 | opt.add_option('--enable-selftest', | 
|---|
| 37 | help=("enable options necessary for selftest"), | 
|---|
| 38 | action="store_true", dest='enable_selftest', default=False) | 
|---|
| 39 |  | 
|---|
| 40 | opt.SAMBA3_ADD_OPTION('winbind') | 
|---|
| 41 | opt.SAMBA3_ADD_OPTION('swat') | 
|---|
| 42 | opt.SAMBA3_ADD_OPTION('ads') | 
|---|
| 43 | opt.SAMBA3_ADD_OPTION('krb5') | 
|---|
| 44 | opt.SAMBA3_ADD_OPTION('ldap') | 
|---|
| 45 | opt.SAMBA3_ADD_OPTION('cups', with_name="enable", without_name="disable") | 
|---|
| 46 | opt.SAMBA3_ADD_OPTION('iprint', with_name="enable", without_name="disable") | 
|---|
| 47 | opt.SAMBA3_ADD_OPTION('merged-build', with_name="enable", without_name="disable") | 
|---|
| 48 | opt.SAMBA3_ADD_OPTION('pam') | 
|---|
| 49 | opt.SAMBA3_ADD_OPTION('pam_smbpass') | 
|---|
| 50 | opt.SAMBA3_ADD_OPTION('quotas') | 
|---|
| 51 | opt.SAMBA3_ADD_OPTION('sys-quotas') | 
|---|
| 52 | opt.SAMBA3_ADD_OPTION('sendfile-support') | 
|---|
| 53 | opt.SAMBA3_ADD_OPTION('utmp') | 
|---|
| 54 | opt.SAMBA3_ADD_OPTION('pthreadpool', with_name="enable", without_name="disable") | 
|---|
| 55 | opt.SAMBA3_ADD_OPTION('avahi', with_name="enable", without_name="disable") | 
|---|
| 56 | opt.SAMBA3_ADD_OPTION('iconv') | 
|---|
| 57 | opt.SAMBA3_ADD_OPTION('acl-support') | 
|---|
| 58 | opt.SAMBA3_ADD_OPTION('dnsupdate') | 
|---|
| 59 | opt.SAMBA3_ADD_OPTION('syslog') | 
|---|
| 60 | opt.SAMBA3_ADD_OPTION('automount') | 
|---|
| 61 | opt.SAMBA3_ADD_OPTION('aio-support') | 
|---|
| 62 | opt.SAMBA3_ADD_OPTION('profiling-data') | 
|---|
| 63 |  | 
|---|
| 64 | opt.SAMBA3_ADD_OPTION('cluster-support') | 
|---|
| 65 |  | 
|---|
| 66 | opt.add_option('--with-ctdb-dir', | 
|---|
| 67 | help=("Directory under which ctdb is installed"), | 
|---|
| 68 | action="store", dest='ctdb_dir', default=None) | 
|---|
| 69 | opt.add_option('--enable-old-ctdb', | 
|---|
| 70 | help=("enable building against (too) old version of ctdb (default=false)"), | 
|---|
| 71 | action="store_true", dest='enable_old_ctdb', default=False) | 
|---|
| 72 |  | 
|---|
| 73 |  | 
|---|
| 74 |  | 
|---|
| 75 | def configure(conf): | 
|---|
| 76 | from samba_utils import TO_LIST | 
|---|
| 77 |  | 
|---|
| 78 | if not conf.env.toplevel_build: | 
|---|
| 79 | version = samba_version.load_version(env=conf.env) | 
|---|
| 80 | conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1) | 
|---|
| 81 | conf.DEFINE('_SAMBA_BUILD_', version.MAJOR, add_to_cflags=True) | 
|---|
| 82 | conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True) | 
|---|
| 83 |  | 
|---|
| 84 | if Options.options.developer: | 
|---|
| 85 | conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD') | 
|---|
| 86 | conf.env.developer = True | 
|---|
| 87 |  | 
|---|
| 88 | if Options.options.with_swat: | 
|---|
| 89 | conf.env['build_swat'] = True | 
|---|
| 90 |  | 
|---|
| 91 | if not conf.env.toplevel_build: | 
|---|
| 92 | conf.RECURSE('../lib/replace') | 
|---|
| 93 | conf.RECURSE('build') | 
|---|
| 94 | conf.RECURSE('../lib/tdb') | 
|---|
| 95 | conf.RECURSE('../lib/talloc') | 
|---|
| 96 | conf.RECURSE('../lib/tevent') | 
|---|
| 97 | conf.RECURSE('../lib/popt') | 
|---|
| 98 | conf.RECURSE('../lib/nss_wrapper') | 
|---|
| 99 | conf.RECURSE('../lib/socket_wrapper') | 
|---|
| 100 | conf.RECURSE('../lib/zlib') | 
|---|
| 101 | conf.RECURSE('../libcli/smbreadline') | 
|---|
| 102 | conf.RECURSE('../lib/util') | 
|---|
| 103 |  | 
|---|
| 104 | conf.ADD_EXTRA_INCLUDES('''#source3 #source3/include #lib/replace''') | 
|---|
| 105 | if not conf.env.USING_SYSTEM_TDB: | 
|---|
| 106 | conf.ADD_EXTRA_INCLUDES('#lib/tdb/include') | 
|---|
| 107 | if not conf.env.USING_SYSTEM_TEVENT: | 
|---|
| 108 | conf.ADD_EXTRA_INCLUDES('#lib/tevent') | 
|---|
| 109 | if not conf.env.USING_SYSTEM_TALLOC: | 
|---|
| 110 | conf.ADD_EXTRA_INCLUDES('#lib/talloc') | 
|---|
| 111 | if not conf.env.USING_SYSTEM_POPT: | 
|---|
| 112 | conf.ADD_EXTRA_INCLUDES('#lib/popt') | 
|---|
| 113 |  | 
|---|
| 114 | conf.ADD_LDFLAGS("-Wl,--export-dynamic", testflags=True) | 
|---|
| 115 |  | 
|---|
| 116 | conf.CHECK_HEADERS('execinfo.h libexc.h libunwind.h netdb.h') | 
|---|
| 117 | conf.CHECK_HEADERS('linux/falloc.h') | 
|---|
| 118 |  | 
|---|
| 119 | conf.CHECK_FUNCS('getcwd fchown chmod fchmod mknod mknod64') | 
|---|
| 120 | conf.CHECK_FUNCS('strtol strchr strupr chflags') | 
|---|
| 121 | conf.CHECK_FUNCS('getrlimit fsync fdatasync setpgid') | 
|---|
| 122 | conf.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid') | 
|---|
| 123 | conf.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr') | 
|---|
| 124 | conf.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf') | 
|---|
| 125 | conf.CHECK_FUNCS('setpriv setgidx setuidx setgroups sysconf stat64 fstat64') | 
|---|
| 126 | conf.CHECK_FUNCS('lstat64 fopen64 atexit grantpt posix_openpt lseek64 ftruncate64 fallocate fallocate64 posix_fallocate posix_fallocate64') | 
|---|
| 127 | conf.CHECK_FUNCS('fseeko fseek64 fseeko64 ftell64 ftello64 setluid') | 
|---|
| 128 | conf.CHECK_FUNCS('getpwnam', headers='sys/types.h pwd.h') | 
|---|
| 129 | conf.CHECK_FUNCS('opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64') | 
|---|
| 130 | conf.CHECK_FUNCS('fdopendir fdopendir64') | 
|---|
| 131 | conf.CHECK_FUNCS('getpwent_r getdents64 setenv strcasecmp fcvt fcvtl') | 
|---|
| 132 | conf.CHECK_FUNCS('syslog vsyslog timegm setlocale nl_langinfo') | 
|---|
| 133 | conf.CHECK_FUNCS_IN('nanosleep', 'rt') | 
|---|
| 134 | conf.CHECK_FUNCS('lutimes futimes utimensat futimens') | 
|---|
| 135 | conf.CHECK_FUNCS('mlock munlock mlockall munlockall') | 
|---|
| 136 | conf.CHECK_FUNCS('memalign posix_memalign hstrerror') | 
|---|
| 137 | conf.CHECK_FUNCS('shmget') | 
|---|
| 138 | conf.CHECK_FUNCS_IN('shm_open', 'rt', checklibc=True) | 
|---|
| 139 | conf.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain') | 
|---|
| 140 | #FIXME: for some reason this one still fails | 
|---|
| 141 | conf.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl') | 
|---|
| 142 | conf.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv') | 
|---|
| 143 | conf.CHECK_DECLS('fdatasync', reverse=True) | 
|---|
| 144 | conf.CHECK_DECLS('readahead', reverse=True, headers='fcntl.h') | 
|---|
| 145 |  | 
|---|
| 146 | if conf.CONFIG_SET('HAVE_LONG_LONG'): | 
|---|
| 147 | conf.DEFINE('HAVE_LONGLONG', 1) | 
|---|
| 148 |  | 
|---|
| 149 | if conf.CHECK_CODE(''' | 
|---|
| 150 | #if defined(HAVE_UNISTD_H) | 
|---|
| 151 | #include <unistd.h> | 
|---|
| 152 | #endif | 
|---|
| 153 | long ret = splice(0,0,1,0,400,0); | 
|---|
| 154 | ''', | 
|---|
| 155 | 'HAVE_LINUX_SPLICE', | 
|---|
| 156 | headers='fcntl.h'): | 
|---|
| 157 | conf.CHECK_DECLS('splice', reverse=True, headers='fcntl.h') | 
|---|
| 158 |  | 
|---|
| 159 | # Check for inotify support | 
|---|
| 160 | conf.CHECK_HEADERS('linux/inotify.h asm/unistd.h sys/inotify.h') | 
|---|
| 161 | conf.CHECK_FUNCS('inotify_init') | 
|---|
| 162 | if "HAVE_INOTIFY_INIT" in conf.env: | 
|---|
| 163 | if "HAVE_LINUX_INOTIFY_H" in conf.env or "HAVE_SYS_INOTIFY_H" in conf.env: | 
|---|
| 164 | conf.DEFINE('HAVE_INOTIFY', 1) | 
|---|
| 165 |  | 
|---|
| 166 | # Check for kernel change notify support | 
|---|
| 167 | conf.CHECK_CODE(''' | 
|---|
| 168 | #ifndef F_NOTIFY | 
|---|
| 169 | #define F_NOTIFY 1026 | 
|---|
| 170 | #endif | 
|---|
| 171 | main() { | 
|---|
| 172 | exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ?  1 : 0); | 
|---|
| 173 | }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain=False, execute=True, | 
|---|
| 174 | headers='fcntl.h signal.h', | 
|---|
| 175 | msg="Checking for kernel change notify support") | 
|---|
| 176 |  | 
|---|
| 177 | # Check for Linux kernel oplocks | 
|---|
| 178 | conf.CHECK_CODE(''' | 
|---|
| 179 | #include <sys/types.h> | 
|---|
| 180 | #include <fcntl.h> | 
|---|
| 181 | #include <signal.h> | 
|---|
| 182 | #ifndef F_NOTIFY | 
|---|
| 183 | #define F_NOTIFY 1026 | 
|---|
| 184 | #endif | 
|---|
| 185 | main() { | 
|---|
| 186 | exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ?  1 : 0); | 
|---|
| 187 | }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain=False, execute=True, | 
|---|
| 188 | msg="Checking for Linux kernel oplocks") | 
|---|
| 189 |  | 
|---|
| 190 | # Check for IRIX kernel oplock types | 
|---|
| 191 | conf.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;', | 
|---|
| 192 | 'HAVE_KERNEL_OPLOCKS_IRIX', headers='fcntl.h', | 
|---|
| 193 | msg="Checking for IRIX kernel oplock types") | 
|---|
| 194 |  | 
|---|
| 195 | # Check for kernel share modes | 
|---|
| 196 | conf.CHECK_CODE(''' | 
|---|
| 197 | #include <sys/types.h> | 
|---|
| 198 | #include <fcntl.h> | 
|---|
| 199 | #include <signal.h> | 
|---|
| 200 | #include <sys/file.h> | 
|---|
| 201 | #ifndef LOCK_MAND | 
|---|
| 202 | #define LOCK_MAND       32 | 
|---|
| 203 | #define LOCK_READ       64 | 
|---|
| 204 | #endif | 
|---|
| 205 | main() { | 
|---|
| 206 | exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0); | 
|---|
| 207 | }''', 'HAVE_KERNEL_SHARE_MODES', addmain=False, execute=True, | 
|---|
| 208 | msg="Checking for krenel share modes") | 
|---|
| 209 |  | 
|---|
| 210 | # Check for various members of the stat structure | 
|---|
| 211 | conf.CHECK_TYPES('blksize_t blkcnt_t') | 
|---|
| 212 | conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define='HAVE_STAT_ST_BLOCKS', | 
|---|
| 213 | headers='sys/stat.h') | 
|---|
| 214 | conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define='HAVE_STAT_ST_BLKSIZE', | 
|---|
| 215 | headers='sys/stat.h') | 
|---|
| 216 | conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_flags', define='HAVE_STAT_ST_FLAGS', | 
|---|
| 217 | headers='sys/types.h sys/stat.h unistd.h') | 
|---|
| 218 |  | 
|---|
| 219 | # Check for POSIX capability support | 
|---|
| 220 | conf.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers='sys/capability.h') | 
|---|
| 221 |  | 
|---|
| 222 | if "HAVE_SYS_CAPABILITY_H" in conf.env: | 
|---|
| 223 | conf.CHECK_CODE(''' | 
|---|
| 224 | cap_t cap; | 
|---|
| 225 | cap_value_t vals[1]; | 
|---|
| 226 | if (!(cap = cap_get_proc())) exit(1); | 
|---|
| 227 | vals[0] = CAP_CHOWN; | 
|---|
| 228 | cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR); | 
|---|
| 229 | cap_set_proc(cap);''', | 
|---|
| 230 | 'HAVE_POSIX_CAPABILITIES', execute=True, lib="cap", | 
|---|
| 231 | headers='sys/capability.h', | 
|---|
| 232 | msg="Checking whether POSIX capabilities are available") | 
|---|
| 233 |  | 
|---|
| 234 | # Check for int16, uint16, int32 and uint32 in rpc/types.h included from | 
|---|
| 235 | # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this. | 
|---|
| 236 | # -- JRA. | 
|---|
| 237 | if conf.CONFIG_SET("HAVE_RPC_RPC_H"): | 
|---|
| 238 | conf.CHECK_TYPE('int16', headers='rpc/rpc.h', | 
|---|
| 239 | define='HAVE_INT16_FROM_RPC_RPC_H', | 
|---|
| 240 | msg="Checking for int16 typedef included by rpc/rpc.h") | 
|---|
| 241 | conf.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H', | 
|---|
| 242 | headers='sys/types.h rpc/rpc.h', | 
|---|
| 243 | msg="Checking for uint16 typedef included by rpc/rpc.h") | 
|---|
| 244 | conf.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H', | 
|---|
| 245 | headers='sys/types.h rpc/rpc.h', | 
|---|
| 246 | msg="Checking for int32 typedef included by rpc/rpc.h") | 
|---|
| 247 | conf.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H', | 
|---|
| 248 | headers='sys/types.h rpc/rpc.h', | 
|---|
| 249 | msg="Checking for uint32 typedef included by rpc/rpc.h") | 
|---|
| 250 | conf.CHECK_CODE('int i;', 'BROKEN_NISPLUS_INCLUDE_FILES', | 
|---|
| 251 | headers='sys/types.h sys/acl.h rpcsvc/nis.h', | 
|---|
| 252 | msg="Checking for broken nisplus include files") | 
|---|
| 253 |  | 
|---|
| 254 | # Check if the compiler will optimize out functions | 
|---|
| 255 | conf.CHECK_CODE(''' | 
|---|
| 256 | if (0) { | 
|---|
| 257 | this_function_does_not_exist(); | 
|---|
| 258 | } else { | 
|---|
| 259 | return 1; | 
|---|
| 260 | }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS', | 
|---|
| 261 | msg="Checking if the compiler will optimize out functions") | 
|---|
| 262 |  | 
|---|
| 263 | # Check if the compiler supports the LL suffix on long long integers | 
|---|
| 264 | # AIX needs this | 
|---|
| 265 | conf.CHECK_CODE('long long i = 0x8000000000LL', 'COMPILER_SUPPORTS_LL', | 
|---|
| 266 | headers='stdio.h', | 
|---|
| 267 | msg="Checking for LL suffix on long long integers") | 
|---|
| 268 |  | 
|---|
| 269 | conf.CHECK_FUNCS(''' | 
|---|
| 270 | _acl __acl add_proplist_entry atexit attr_getf attr_list attr_listf | 
|---|
| 271 | attropen attr_remove attr_removef attr_set attr_setf backtrace_symbols | 
|---|
| 272 | bindtextdomain _chdir __chdir chflags chmod _close __close _closedir | 
|---|
| 273 | __closedir closedir64 creat64 crypt16 delproplist devnm dgettext dirfd | 
|---|
| 274 | DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl | 
|---|
| 275 | extattr_delete_fd extattr_delete_link extattr_get_fd extattr_get_file | 
|---|
| 276 | extattr_get_link extattr_list_fd extattr_list_file extattr_list_link | 
|---|
| 277 | extattr_set_fd extattr_set_file extattr_set_link _facl __facl _fchdir | 
|---|
| 278 | __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync | 
|---|
| 279 | fdelproplist fgetea fgetproplist fgetxattr flistea flistxattr fopen64 | 
|---|
| 280 | _fork __fork fremoveea fremovexattr fseeko fseek64 fseeko64 fsetea | 
|---|
| 281 | fsetproplist fsetxattr _fstat __fstat fstat64 _fstat64 __fstat64 fsync | 
|---|
| 282 | ftell64 ftello64 ftruncate64 futimens futimes __fxstat getauthuid | 
|---|
| 283 | getcwd _getcwd __getcwd getdents __getdents getdents64 getdirentries | 
|---|
| 284 | getgrent getgrnam getgrouplist getgrset getmntent getpagesize | 
|---|
| 285 | getproplist get_proplist_entry getpwanam getpwent_r getrlimit gettext | 
|---|
| 286 | glob grantpt hstrerror initgroups innetgr | 
|---|
| 287 | inotify_init lgetea lgetxattr listea listxattr llistea llistxattr | 
|---|
| 288 | llseek _llseek __llseek lremoveea lremovexattr _lseek __lseek lseek64 | 
|---|
| 289 | lsetea lsetxattr _lstat __lstat lstat64 _lstat64 __lstat64 lutimes | 
|---|
| 290 | __lxstat memalign mknod mknod64 mlock mlockall munlock munlockall | 
|---|
| 291 | nl_langinfo _open __open open64 _open64 __open64 _opendir __opendir | 
|---|
| 292 | opendir64 pathconf poll posix_fallocate posix_fallocate64 | 
|---|
| 293 | posix_memalign prctl pread _pread __pread pread64 _pread64 __pread64 | 
|---|
| 294 | pwrite _pwrite __pwrite pwrite64 _pwrite64 | 
|---|
| 295 | __pwrite64 rdchk _read __read _readdir __readdir readdir64 _readdir64 | 
|---|
| 296 | __readdir64 removeea removexattr rewinddir64 _seekdir __seekdir | 
|---|
| 297 | seekdir64 select setea setenv setgidx setgroups setlocale setluid | 
|---|
| 298 | setmntent setpgid setpriv setproplist setsid setuidx | 
|---|
| 299 | setxattr shmget shm_open sigaction sigblock sigprocmask sigset | 
|---|
| 300 | sizeof_proplist_entry _stat __stat stat64 _stat64 __stat64 statvfs | 
|---|
| 301 | strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctlbyname | 
|---|
| 302 | __sys_llseek syslog _telldir __telldir telldir64 textdomain timegm | 
|---|
| 303 | utimensat vsyslog _write __write __xstat | 
|---|
| 304 | ''') | 
|---|
| 305 |  | 
|---|
| 306 | conf.CHECK_SAMBA3_CHARSET() # see build/charset.py | 
|---|
| 307 |  | 
|---|
| 308 | # FIXME: these should be tests for features, but the old build system just | 
|---|
| 309 | # checks for OSes. | 
|---|
| 310 | import sys | 
|---|
| 311 | host_os = sys.platform | 
|---|
| 312 | Logs.info("building on %s" % host_os) | 
|---|
| 313 |  | 
|---|
| 314 | # Python doesn't have case switches... :/ | 
|---|
| 315 | # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*) | 
|---|
| 316 | # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad? | 
|---|
| 317 |  | 
|---|
| 318 | conf.SET_TARGET_TYPE('sunacl', 'EMPTY') | 
|---|
| 319 | if (host_os.rfind('linux') > -1) or (host_os.rfind('gnu') > -1) or (host_os.rfind('qnx') > -1): | 
|---|
| 320 | if host_os.rfind('linux') > -1: | 
|---|
| 321 | conf.DEFINE('LINUX', '1') | 
|---|
| 322 | elif host_os.rfind('qnx') > -1: | 
|---|
| 323 | conf.DEFINE('QNX', '1') | 
|---|
| 324 | conf.DEFINE('STAT_ST_BLOCKSIZE', '512') | 
|---|
| 325 | elif (host_os.rfind('darwin') > -1): | 
|---|
| 326 | conf.DEFINE('DARWINOS', 1) | 
|---|
| 327 | conf.DEFINE('STAT_ST_BLOCKSIZE', '512') | 
|---|
| 328 | conf.ADD_CFLAGS('-fno-common') | 
|---|
| 329 | elif (host_os.rfind('freebsd') > -1): | 
|---|
| 330 | if conf.CHECK_HEADERS('sunacl.h'): | 
|---|
| 331 | conf.define('HAVE_FREEBSD_SUNACL_H', '1') | 
|---|
| 332 | conf.CHECK_FUNCS_IN('acl', 'sunacl') | 
|---|
| 333 | conf.DEFINE('STAT_ST_BLOCKSIZE', '512') | 
|---|
| 334 | elif (host_os.rfind('netbsd') > -1): | 
|---|
| 335 | conf.DEFINE('STAT_ST_BLOCKSIZE', '512') | 
|---|
| 336 | elif (host_os.rfind('openbsd') > -1): | 
|---|
| 337 | conf.DEFINE('STAT_ST_BLOCKSIZE', '512') | 
|---|
| 338 | elif (host_os.rfind('sunos') > -1): | 
|---|
| 339 | conf.DEFINE('STAT_ST_BLOCKSIZE', '512') | 
|---|
| 340 | # FIXME: Add more checks here. | 
|---|
| 341 | else: | 
|---|
| 342 | Logs.warn("Unknown host_os '%s', please report this to samba-technical@samba.org" % host_os) | 
|---|
| 343 |  | 
|---|
| 344 | #FIXME: add more checks | 
|---|
| 345 | if Options.options.with_acl_support: | 
|---|
| 346 | if host_os.rfind('linux') > -1: | 
|---|
| 347 | conf.CHECK_FUNCS_IN('acl_get_file', 'acl') | 
|---|
| 348 | conf.CHECK_FUNCS_IN('getxattr', 'attr') | 
|---|
| 349 | if conf.CHECK_CODE(''' | 
|---|
| 350 | acl_t acl; | 
|---|
| 351 | int entry_id; | 
|---|
| 352 | acl_entry_t *entry_p; | 
|---|
| 353 | return acl_get_entry(acl, entry_id, entry_p); | 
|---|
| 354 | ''', | 
|---|
| 355 | 'HAVE_POSIX_ACLS', | 
|---|
| 356 | headers='sys/types.h sys/acl.h', link=False, | 
|---|
| 357 | msg="Checking for POSIX ACL support") : | 
|---|
| 358 | conf.CHECK_CODE(''' | 
|---|
| 359 | acl_permset_t permset_d; | 
|---|
| 360 | acl_perm_t perm; | 
|---|
| 361 | return acl_get_perm_np(permset_d, perm); | 
|---|
| 362 | ''', | 
|---|
| 363 | 'HAVE_ACL_GET_PERM_NP', | 
|---|
| 364 | headers='sys/types.h sys/acl.h', link=True, | 
|---|
| 365 | msg="Checking whether acl_get_perm_np() is available") | 
|---|
| 366 | else: | 
|---|
| 367 | conf.DEFINE('HAVE_NO_ACLS', 1) | 
|---|
| 368 | conf.SET_TARGET_TYPE('acl', 'EMPTY') | 
|---|
| 369 | else: | 
|---|
| 370 | conf.DEFINE('HAVE_NO_ACLS', 1) | 
|---|
| 371 | conf.SET_TARGET_TYPE('acl', 'EMPTY') | 
|---|
| 372 |  | 
|---|
| 373 | if conf.CHECK_FUNCS('dirfd'): | 
|---|
| 374 | conf.DEFINE('HAVE_DIRFD_DECL', 1) | 
|---|
| 375 |  | 
|---|
| 376 | conf.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);', | 
|---|
| 377 | 'HAVE_STATFS_F_FSID', | 
|---|
| 378 | msg="vfs_fileid: checking for statfs() and struct statfs.f_fsid", | 
|---|
| 379 | headers='sys/types.h sys/statfs.h', | 
|---|
| 380 | execute=True) | 
|---|
| 381 |  | 
|---|
| 382 | if conf.CONFIG_SET('HAVE_FALLOCATE'): | 
|---|
| 383 | conf.CHECK_CODE(''' | 
|---|
| 384 | #if defined(HAVE_UNISTD_H) | 
|---|
| 385 | #include <unistd.h> | 
|---|
| 386 | #endif | 
|---|
| 387 | #include <sys/types.h> | 
|---|
| 388 | #define _GNU_SOURCE | 
|---|
| 389 | #include <fcntl.h> | 
|---|
| 390 | #if defined(HAVE_LINUX_FALLOC_H) | 
|---|
| 391 | #include <linux/falloc.h> | 
|---|
| 392 | #endif | 
|---|
| 393 | int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''', | 
|---|
| 394 | 'HAVE_LINUX_FALLOCATE', | 
|---|
| 395 | msg="Checking whether the Linux 'fallocate' function is available") | 
|---|
| 396 | if conf.CONFIG_SET('HAVE_FALLOCATE64'): | 
|---|
| 397 | conf.CHECK_CODE(''' | 
|---|
| 398 | #if defined(HAVE_UNISTD_H) | 
|---|
| 399 | #include <unistd.h> | 
|---|
| 400 | #endif | 
|---|
| 401 | #include <sys/types.h> | 
|---|
| 402 | #define _GNU_SOURCE | 
|---|
| 403 | #include <fcntl.h> | 
|---|
| 404 | #if defined(HAVE_LINUX_FALLOC_H) | 
|---|
| 405 | #include <linux/falloc.h> | 
|---|
| 406 | #endif | 
|---|
| 407 | int ret = fallocate64(0, FALLOC_FL_KEEP_SIZE, 0, 10);''', | 
|---|
| 408 | 'HAVE_LINUX_FALLOCATE64', | 
|---|
| 409 | msg="Checking whether the Linux 'fallocate64' function is available") | 
|---|
| 410 | conf.CHECK_CODE(''' | 
|---|
| 411 | #if defined(HAVE_UNISTD_H) | 
|---|
| 412 | #include <unistd.h> | 
|---|
| 413 | #endif | 
|---|
| 414 | #include <fcntl.h> | 
|---|
| 415 | ssize_t err = readahead(0,0,0x80000);''', | 
|---|
| 416 | 'HAVE_LINUX_READAHEAD', | 
|---|
| 417 | msg="Checking whether Linux readahead is available") | 
|---|
| 418 | conf.CHECK_DECLS('readahead', headers='fcntl.h', always=True) | 
|---|
| 419 |  | 
|---|
| 420 | conf.CHECK_CODE(''' | 
|---|
| 421 | #include <sys/types.h> | 
|---|
| 422 | #include <sys/socket.h>], | 
|---|
| 423 | struct ucred cred; | 
|---|
| 424 | socklen_t cred_len; | 
|---|
| 425 | int ret = getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len);''', | 
|---|
| 426 | 'HAVE_PEERCRED', | 
|---|
| 427 | msg="Checking whether we can use SO_PEERCRED to get socket credentials") | 
|---|
| 428 |  | 
|---|
| 429 | conf.CHECK_CODE(''' | 
|---|
| 430 | #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8))) | 
|---|
| 431 | #include <sys/types.h> | 
|---|
| 432 | #else | 
|---|
| 433 | __COMPILE_ERROR_ | 
|---|
| 434 | #endif | 
|---|
| 435 | int i;''', | 
|---|
| 436 | 'HAVE_EXPLICIT_LARGEFILE_SUPPORT', | 
|---|
| 437 | msg="Checking whether large file support can be enabled") | 
|---|
| 438 |  | 
|---|
| 439 | if Options.options.with_aio_support: | 
|---|
| 440 | conf.CHECK_FUNCS_IN('aio_read', 'aio') | 
|---|
| 441 | conf.CHECK_FUNCS_IN('aio_read', 'rt') | 
|---|
| 442 | conf.CHECK_CODE('struct aiocb a; return aio_read(&a);', | 
|---|
| 443 | 'HAVE_AIO', | 
|---|
| 444 | msg='Checking for asynchronous io support', | 
|---|
| 445 | headers='sys/types.h aio.h', | 
|---|
| 446 | lib='aio rt') | 
|---|
| 447 | conf.CHECK_CODE('struct aiocb64 a; return aio_read64(&a);', | 
|---|
| 448 | 'HAVE_AIO64', | 
|---|
| 449 | msg='Checking for 64-bit asynchronous io support', | 
|---|
| 450 | headers='sys/types.h aio.h', | 
|---|
| 451 | lib='aio rt') | 
|---|
| 452 | if conf.CONFIG_SET('HAVE_AIO64'): | 
|---|
| 453 | conf.DEFINE('HAVE_AIOCB64', '1') | 
|---|
| 454 | conf.DEFINE('WITH_AIO', '1') | 
|---|
| 455 | elif conf.CONFIG_SET('HAVE_AIO'): | 
|---|
| 456 | conf.DEFINE('WITH_AIO', '1') | 
|---|
| 457 | if conf.CONFIG_SET('HAVE_AIO'): | 
|---|
| 458 | conf.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg='Checking for aio_read', headers='aio.h', lib='aio rt') | 
|---|
| 459 | conf.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg='Checking for aio_write', headers='aio.h', lib='aio rt') | 
|---|
| 460 | 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') | 
|---|
| 461 | conf.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg='Checking for aio_return', headers='aio.h', lib='aio rt') | 
|---|
| 462 | conf.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg='Checking for aio_error', headers='aio.h', lib='aio rt') | 
|---|
| 463 | 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') | 
|---|
| 464 | 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') | 
|---|
| 465 | if conf.CONFIG_SET('HAVE_AIO64'): | 
|---|
| 466 | conf.CHECK_CODE('struct aiocb a; return aio_read64(&a);', 'HAVE_AIO_READ64', msg='Checking for aio_read64', headers='aio.h', lib='aio rt') | 
|---|
| 467 | conf.CHECK_CODE('struct aiocb a; return aio_write64(&a);', 'HAVE_AIO_WRITE64', msg='Checking for aio_write64', headers='aio.h', lib='aio rt') | 
|---|
| 468 | conf.CHECK_CODE('struct aiocb a; return aio_fsync64(1, &a);', 'HAVE_AIO_FSYNC64', msg='Checking for aio_fsync64', headers='aio.h', lib='aio rt') | 
|---|
| 469 | conf.CHECK_CODE('struct aiocb a; return aio_return64(&a);', 'HAVE_AIO_RETURN64', msg='Checking for aio_return64', headers='aio.h', lib='aio rt') | 
|---|
| 470 | conf.CHECK_CODE('struct aiocb a; return aio_error64(&a);', 'HAVE_AIO_ERROR64', msg='Checking for aio_error64', headers='aio.h', lib='aio rt') | 
|---|
| 471 | conf.CHECK_CODE('struct aiocb a; return aio_cancel64(1, &a);', 'HAVE_AIO_CANCEL64', msg='Checking for aio_cancel64', headers='aio.h', lib='aio rt') | 
|---|
| 472 | conf.CHECK_CODE('struct aiocb a; return aio_suspend64(&a, 1, NULL);', 'HAVE_AIO_SUSPEND64', msg='Checking for aio_suspend64', headers='aio.h', lib='aio rt') | 
|---|
| 473 | if not conf.CONFIG_SET('HAVE_AIO'): | 
|---|
| 474 | conf.DEFINE('HAVE_NO_AIO', '1') | 
|---|
| 475 | else: | 
|---|
| 476 | conf.DEFINE('HAVE_NO_AIO', '1') | 
|---|
| 477 |  | 
|---|
| 478 | conf.CHECK_CODE(''' | 
|---|
| 479 | struct msghdr msg; | 
|---|
| 480 | union { | 
|---|
| 481 | struct cmsghdr cm; | 
|---|
| 482 | char control[CMSG_SPACE(sizeof(int))]; | 
|---|
| 483 | } control_un; | 
|---|
| 484 | msg.msg_control = control_un.control; | 
|---|
| 485 | msg.msg_controllen = sizeof(control_un.control); | 
|---|
| 486 | ''', | 
|---|
| 487 | 'HAVE_MSGHDR_MSG_CONTROL', | 
|---|
| 488 | msg='Checking if we can use msg_control for passing file descriptors', | 
|---|
| 489 | headers='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h') | 
|---|
| 490 | conf.CHECK_CODE(''' | 
|---|
| 491 | struct msghdr msg; | 
|---|
| 492 | int fd; | 
|---|
| 493 | msg.msg_acctrights = (caddr_t) &fd; | 
|---|
| 494 | msg.msg_acctrightslen = sizeof(fd); | 
|---|
| 495 | ''', | 
|---|
| 496 | 'HAVE_MSGHDR_MSG_ACCTRIGHTS', | 
|---|
| 497 | msg='Checking if we can use msg_acctrights for passing file descriptors', | 
|---|
| 498 | headers='sys/types.h stdlib.h stddef.h sys/socket.h sys/un.h') | 
|---|
| 499 |  | 
|---|
| 500 | if Options.options.with_winbind: | 
|---|
| 501 | conf.env.build_winbind = True | 
|---|
| 502 | conf.DEFINE('WITH_WINBIND', '1') | 
|---|
| 503 |  | 
|---|
| 504 | conf.find_program('awk', var='AWK') | 
|---|
| 505 | conf.find_program('perl', var='PERL') | 
|---|
| 506 |  | 
|---|
| 507 | # Darwin has extra options to xattr-family functions | 
|---|
| 508 | conf.CHECK_CODE('getxattr(0, 0, 0, 0, 0, 0);', | 
|---|
| 509 | 'XATTR_ADD_OPT', | 
|---|
| 510 | msg="Checking whether xattr interface takes additional options", | 
|---|
| 511 | headers='sys/types.h attr/xattr.h sys/xattr.h') | 
|---|
| 512 |  | 
|---|
| 513 | conf.CHECK_HEADERS('asm/types.h') | 
|---|
| 514 |  | 
|---|
| 515 | conf.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN", | 
|---|
| 516 | headers='unistd.h sys/types.h', | 
|---|
| 517 | msg="Checking for major macro") | 
|---|
| 518 |  | 
|---|
| 519 | conf.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN", | 
|---|
| 520 | headers='unistd.h sys/types.h', | 
|---|
| 521 | msg="Checking for minor macro") | 
|---|
| 522 |  | 
|---|
| 523 | conf.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off', | 
|---|
| 524 | headers='unistd.h sys/types.h dirent.h', | 
|---|
| 525 | define='HAVE_DIRENT_D_OFF') | 
|---|
| 526 |  | 
|---|
| 527 | conf.CHECK_FUNCS('setnetgrent getnetgrent endnetgrent') | 
|---|
| 528 | if conf.CHECK_CFLAGS('-Werror-implicit-function-declaration'): | 
|---|
| 529 | netgrent_cflags = '-Werror-implicit-function-declaration' | 
|---|
| 530 | else: | 
|---|
| 531 | netgrent_cflags = '' | 
|---|
| 532 | conf.CHECK_CODE('setnetgrent("foo")', 'HAVE_SETNETGRENT_PROTOTYPE', | 
|---|
| 533 | msg="Checking for setnetgrent prototype", | 
|---|
| 534 | headers='netdb.h netgroup.h', | 
|---|
| 535 | cflags=netgrent_cflags) | 
|---|
| 536 | conf.CHECK_CODE('getnetgrent', 'HAVE_GETNETGRENT_PROTOTYPE', | 
|---|
| 537 | msg="Checking for getnetgrent prototype", | 
|---|
| 538 | headers='netdb.h netgroup.h', | 
|---|
| 539 | cflags=netgrent_cflags) | 
|---|
| 540 | conf.CHECK_CODE('endnetgrent', 'HAVE_ENDNETGRENT_PROTOTYPE', | 
|---|
| 541 | msg="Checking for endnetgrent prototype", | 
|---|
| 542 | headers='netdb.h netgroup.h', | 
|---|
| 543 | cflags=netgrent_cflags) | 
|---|
| 544 |  | 
|---|
| 545 |  | 
|---|
| 546 | # Look for CUPS | 
|---|
| 547 | if Options.options.with_cups: | 
|---|
| 548 | conf.find_program('cups-config', var='CUPS_CONFIG') | 
|---|
| 549 | if conf.env.CUPS_CONFIG: | 
|---|
| 550 | # we would normally use --libs here, but cups-config incorrectly adds | 
|---|
| 551 | # gssapi_krb5 and other libraries to its --libs output. That breaks the use | 
|---|
| 552 | # of an in-tree heimdal kerberos | 
|---|
| 553 | conf.check_cfg(path=conf.env.CUPS_CONFIG, args="--cflags --ldflags", | 
|---|
| 554 | package="", uselib_store="cups") | 
|---|
| 555 | conf.CHECK_HEADERS('cups/cups.h cups/language.h', lib='cups') | 
|---|
| 556 | conf.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups') | 
|---|
| 557 | if conf.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'): | 
|---|
| 558 | conf.DEFINE('HAVE_CUPS', '1') | 
|---|
| 559 | else: | 
|---|
| 560 | conf.undefine('HAVE_CUPS') | 
|---|
| 561 | conf.SET_TARGET_TYPE('cups', 'EMPTY') | 
|---|
| 562 | else: | 
|---|
| 563 | # define an empty subsystem for cups, to allow it to be used as an empty dependency | 
|---|
| 564 | conf.SET_TARGET_TYPE('cups', 'EMPTY') | 
|---|
| 565 |  | 
|---|
| 566 | if Options.options.with_iprint: | 
|---|
| 567 | if conf.CONFIG_SET('HAVE_CUPS'): | 
|---|
| 568 | conf.DEFINE('HAVE_IPRINT', '1') | 
|---|
| 569 | else: | 
|---|
| 570 | Logs.warn("--enable-iprint=yes but cups support not sufficient") | 
|---|
| 571 | if Options.options.with_syslog: | 
|---|
| 572 | conf.DEFINE('WITH_SYSLOG', '1') | 
|---|
| 573 | if Options.options.with_automount: | 
|---|
| 574 | conf.DEFINE('WITH_AUTOMOUNT', '1') | 
|---|
| 575 |  | 
|---|
| 576 | # Check for LDAP | 
|---|
| 577 | if Options.options.with_ldap: | 
|---|
| 578 | conf.CHECK_HEADERS('ldap.h lber.h') | 
|---|
| 579 | conf.CHECK_TYPE('ber_tag_t', 'unsigned int', headers='ldap.h lber.h') | 
|---|
| 580 | conf.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber') | 
|---|
| 581 | conf.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers='ldap.h') | 
|---|
| 582 |  | 
|---|
| 583 | # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out | 
|---|
| 584 | # for the samba logs | 
|---|
| 585 | conf.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN', | 
|---|
| 586 | define='HAVE_LBER_LOG_PRINT_FN', headers='lber.h') | 
|---|
| 587 |  | 
|---|
| 588 | conf.CHECK_FUNCS_IN('ldap_init ldap_initialize ldap_set_rebind_proc', 'ldap') | 
|---|
| 589 | conf.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap') | 
|---|
| 590 |  | 
|---|
| 591 | # Check if ldap_set_rebind_proc() takes three arguments | 
|---|
| 592 | if conf.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)', | 
|---|
| 593 | 'LDAP_SET_REBIND_PROC_ARGS', | 
|---|
| 594 | msg="Checking whether ldap_set_rebind_proc takes 3 arguments", | 
|---|
| 595 | headers='ldap.h lber.h', link=False): | 
|---|
| 596 | conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3') | 
|---|
| 597 | else: | 
|---|
| 598 | conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2') | 
|---|
| 599 |  | 
|---|
| 600 | # last but not least, if ldap_init() exists, we want to use ldap | 
|---|
| 601 | if conf.CONFIG_SET('HAVE_LDAP_INIT'): | 
|---|
| 602 | conf.DEFINE('HAVE_LDAP', '1') | 
|---|
| 603 | conf.DEFINE('LDAP_DEPRECATED', '1') | 
|---|
| 604 | conf.env['HAVE_LDAP'] = '1' | 
|---|
| 605 | # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add | 
|---|
| 606 | # SASL wrapping hooks | 
|---|
| 607 | if conf.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \ | 
|---|
| 608 | conf.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'): | 
|---|
| 609 | conf.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1') | 
|---|
| 610 | else: | 
|---|
| 611 | conf.SET_TARGET_TYPE('ldap', 'EMPTY') | 
|---|
| 612 | conf.SET_TARGET_TYPE('lber', 'EMPTY') | 
|---|
| 613 |  | 
|---|
| 614 | # Check for kerberos | 
|---|
| 615 | have_gssapi=False | 
|---|
| 616 | if Options.options.with_krb5 and not conf.env.toplevel_build: | 
|---|
| 617 | Logs.info("Looking for kerberos features") | 
|---|
| 618 | conf.find_program('krb5-config', var='KRB5_CONFIG') | 
|---|
| 619 | if conf.env.KRB5_CONFIG: | 
|---|
| 620 | conf.check_cfg(path="krb5-config", args="--cflags --libs", | 
|---|
| 621 | package="gssapi", uselib_store="krb5") | 
|---|
| 622 | conf.CHECK_HEADERS('krb5.h krb5/locate_plugin.h', lib='krb5') | 
|---|
| 623 | conf.CHECK_HEADERS('gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h gssapi/gssapi_ext.h com_err.h', lib='krb5') | 
|---|
| 624 |  | 
|---|
| 625 | if conf.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'): | 
|---|
| 626 | conf.env['WINBIND_KRB5_LOCATOR'] = 'bin/winbind_krb5_locator.so' | 
|---|
| 627 |  | 
|---|
| 628 | conf.CHECK_FUNCS_IN('_et_list', 'com_err') | 
|---|
| 629 | conf.CHECK_FUNCS_IN('krb5_encrypt_data', 'k5crypto') | 
|---|
| 630 | conf.CHECK_FUNCS_IN('crypto', 'des_set_key') | 
|---|
| 631 | conf.CHECK_FUNCS_IN('copy_Authenticator', 'asn1') | 
|---|
| 632 | conf.CHECK_FUNCS_IN('roken_getaddrinfo_hostspec', 'roken') | 
|---|
| 633 | if conf.CHECK_FUNCS_IN('gss_display_status', 'gssapi') or \ | 
|---|
| 634 | conf.CHECK_FUNCS_IN('gss_display_status', 'gssapi_krb5'): | 
|---|
| 635 | have_gssapi=True | 
|---|
| 636 | conf.CHECK_FUNCS_IN('gss_wrap_iov', 'gssapi gssapi_krb5 krb5') | 
|---|
| 637 | conf.CHECK_FUNCS_IN('krb5_mk_req_extended krb5_kt_compare', 'krb5') | 
|---|
| 638 | conf.CHECK_FUNCS(''' | 
|---|
| 639 | krb5_set_real_time krb5_set_default_in_tkt_etypes krb5_set_default_tgs_enctypes | 
|---|
| 640 | krb5_set_default_tgs_ktypes krb5_principal2salt krb5_use_enctype | 
|---|
| 641 | krb5_string_to_key krb5_get_pw_salt krb5_string_to_key_salt krb5_auth_con_setkey | 
|---|
| 642 | krb5_auth_con_setuseruserkey krb5_get_permitted_enctypes | 
|---|
| 643 | krb5_get_default_in_tkt_etypes krb5_free_data_contents | 
|---|
| 644 | krb5_principal_get_comp_string krb5_free_unparsed_name | 
|---|
| 645 | krb5_free_keytab_entry_contents krb5_kt_free_entry krb5_krbhst_init | 
|---|
| 646 | krb5_krbhst_get_addrinfo krb5_c_enctype_compare krb5_enctypes_compatible_keys | 
|---|
| 647 | krb5_crypto_init krb5_crypto_destroy krb5_decode_ap_req free_AP_REQ | 
|---|
| 648 | krb5_verify_checksum krb5_c_verify_checksum krb5_principal_compare_any_realm | 
|---|
| 649 | krb5_parse_name_norealm krb5_princ_size krb5_get_init_creds_opt_set_pac_request | 
|---|
| 650 | krb5_get_renewed_creds krb5_get_kdc_cred krb5_free_error_contents | 
|---|
| 651 | initialize_krb5_error_table krb5_get_init_creds_opt_alloc | 
|---|
| 652 | krb5_get_init_creds_opt_free krb5_get_init_creds_opt_get_error | 
|---|
| 653 | krb5_enctype_to_string krb5_fwd_tgt_creds krb5_auth_con_set_req_cksumtype | 
|---|
| 654 | krb5_get_creds_opt_alloc krb5_get_creds_opt_set_impersonate krb5_get_creds | 
|---|
| 655 | krb5_get_credentials_for_user krb5_get_host_realm krb5_free_host_realm''', | 
|---|
| 656 | lib='krb5 k5crypto') | 
|---|
| 657 | conf.CHECK_DECLS('''krb5_get_credentials_for_user | 
|---|
| 658 | krb5_auth_con_set_req_cksumtype''', | 
|---|
| 659 | headers='krb5.h', always=True) | 
|---|
| 660 | conf.CHECK_VARIABLE('AP_OPTS_USE_SUBKEY', headers='krb5.h') | 
|---|
| 661 | conf.CHECK_VARIABLE('KV5M_KEYTAB', headers='krb5.h') | 
|---|
| 662 | conf.CHECK_VARIABLE('KRB5_KU_OTHER_CKSUM', headers='krb5.h') | 
|---|
| 663 | conf.CHECK_VARIABLE('KRB5_KEYUSAGE_APP_DATA_CKSUM', headers='krb5.h') | 
|---|
| 664 | conf.CHECK_VARIABLE('ENCTYPE_AES128_CTS_HMAC_SHA1_96', headers='krb5.h') | 
|---|
| 665 | conf.CHECK_VARIABLE('ENCTYPE_AES256_CTS_HMAC_SHA1_96', headers='krb5.h') | 
|---|
| 666 | conf.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'key', headers='krb5.h', | 
|---|
| 667 | define='HAVE_KRB5_KEYTAB_ENTRY_KEY') | 
|---|
| 668 | conf.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'keyblock', headers='krb5.h', | 
|---|
| 669 | define='HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK') | 
|---|
| 670 | conf.CHECK_STRUCTURE_MEMBER('krb5_address', 'magic', headers='krb5.h', | 
|---|
| 671 | define='HAVE_MAGIC_IN_KRB5_ADDRESS') | 
|---|
| 672 | conf.CHECK_STRUCTURE_MEMBER('krb5_address', 'addrtype', headers='krb5.h', | 
|---|
| 673 | define='HAVE_ADDRTYPE_IN_KRB5_ADDRESS') | 
|---|
| 674 | conf.CHECK_STRUCTURE_MEMBER('krb5_ticket', 'enc_part2', headers='krb5.h', | 
|---|
| 675 | define='HAVE_KRB5_TKT_ENC_PART2') | 
|---|
| 676 | conf.CHECK_STRUCTURE_MEMBER('krb5_creds', 'keyblock', headers='krb5.h', | 
|---|
| 677 | define='HAVE_KRB5_KEYBLOCK_IN_CREDS') | 
|---|
| 678 | conf.CHECK_STRUCTURE_MEMBER('krb5_creds', 'session', headers='krb5.h', | 
|---|
| 679 | define='HAVE_KRB5_SESSION_IN_CREDS') | 
|---|
| 680 | conf.CHECK_STRUCTURE_MEMBER('krb5_ap_req', 'ticket', headers='krb5.h', | 
|---|
| 681 | define='HAVE_TICKET_POINTER_IN_KRB5_AP_REQ') | 
|---|
| 682 |  | 
|---|
| 683 | conf.CHECK_TYPE('krb5_encrypt_block', headers='krb5.h') | 
|---|
| 684 |  | 
|---|
| 685 | conf.CHECK_CODE(''' | 
|---|
| 686 | krb5_ticket ticket; | 
|---|
| 687 | krb5_kvno kvno; | 
|---|
| 688 | krb5_enctype enctype; | 
|---|
| 689 | enctype = ticket.enc_part.enctype; | 
|---|
| 690 | kvno = ticket.enc_part.kvno; | 
|---|
| 691 | ''', | 
|---|
| 692 | 'KRB5_TICKET_HAS_KEYINFO', | 
|---|
| 693 | headers='krb5.h', link=False, | 
|---|
| 694 | msg="Checking whether the krb5_ticket structure contains the kvno and enctype") | 
|---|
| 695 | conf.CHECK_CODE(''' | 
|---|
| 696 | krb5_context ctx; | 
|---|
| 697 | krb5_get_init_creds_opt *opt = NULL; | 
|---|
| 698 | krb5_get_init_creds_opt_free(ctx, opt); | 
|---|
| 699 | ''', | 
|---|
| 700 | 'KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT', | 
|---|
| 701 | headers='krb5.h', link=False, | 
|---|
| 702 | msg="Checking whether krb5_get_init_creds_opt_free takes a context argument") | 
|---|
| 703 | conf.CHECK_CODE('krb5_mk_error(0,0,0)', | 
|---|
| 704 | 'HAVE_SHORT_KRB5_MK_ERROR_INTERFACE', | 
|---|
| 705 | headers='krb5.h', link=False, | 
|---|
| 706 | msg="Checking whether krb5_mk_error takes 3 arguments MIT or 9 Heimdal") | 
|---|
| 707 | conf.CHECK_CODE(''' | 
|---|
| 708 | const krb5_data *pkdata; | 
|---|
| 709 | krb5_context context; | 
|---|
| 710 | krb5_principal principal; | 
|---|
| 711 | pkdata = krb5_princ_component(context, principal, 0); | 
|---|
| 712 | ''', | 
|---|
| 713 | 'HAVE_KRB5_PRINC_COMPONENT', | 
|---|
| 714 | headers='krb5.h', lib='krb5', | 
|---|
| 715 | msg="Checking whether krb5_princ_component is available") | 
|---|
| 716 |  | 
|---|
| 717 | conf.CHECK_CODE(''' | 
|---|
| 718 | int main(void) { | 
|---|
| 719 | char buf[256]; | 
|---|
| 720 | krb5_enctype_to_string(1, buf, 256); | 
|---|
| 721 | return 0; | 
|---|
| 722 | }''', | 
|---|
| 723 | 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_SIZE_T_ARG', | 
|---|
| 724 | headers='krb5.h', lib='krb5 k5crypto', | 
|---|
| 725 | addmain=False, cflags='-Werror', | 
|---|
| 726 | msg="Checking whether krb5_enctype_to_string takes size_t argument") | 
|---|
| 727 |  | 
|---|
| 728 | conf.CHECK_CODE(''' | 
|---|
| 729 | int main(void) { | 
|---|
| 730 | krb5_context context = NULL; | 
|---|
| 731 | char *str = NULL; | 
|---|
| 732 | krb5_enctype_to_string(context, 1, &str); | 
|---|
| 733 | if (str) free (str); | 
|---|
| 734 | return 0; | 
|---|
| 735 | }''', | 
|---|
| 736 | 'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_KRB5_CONTEXT_ARG', | 
|---|
| 737 | headers='krb5.h stdlib.h', lib='krb5', | 
|---|
| 738 | addmain=False, cflags='-Werror', | 
|---|
| 739 | msg="Checking whether krb5_enctype_to_string takes krb5_context argument") | 
|---|
| 740 | conf.CHECK_CODE(''' | 
|---|
| 741 | int main(void) { | 
|---|
| 742 | krb5_context ctx = NULL; | 
|---|
| 743 | krb5_principal princ = NULL; | 
|---|
| 744 | const char *str = krb5_princ_realm(ctx, princ)->data; | 
|---|
| 745 | return 0; | 
|---|
| 746 | }''', | 
|---|
| 747 | 'HAVE_KRB5_PRINC_REALM', | 
|---|
| 748 | headers='krb5.h', lib='krb5', | 
|---|
| 749 | addmain=False, | 
|---|
| 750 | msg="Checking whether the macro krb5_princ_realm is defined") | 
|---|
| 751 | conf.CHECK_CODE(''' | 
|---|
| 752 | int main(void) { | 
|---|
| 753 | krb5_context context; | 
|---|
| 754 | krb5_principal principal; | 
|---|
| 755 | const char *realm; realm = krb5_principal_get_realm(context, principal); | 
|---|
| 756 | return 0; | 
|---|
| 757 | }''', | 
|---|
| 758 | 'HAVE_KRB5_PRINCIPAL_GET_REALM', | 
|---|
| 759 | headers='krb5.h', lib='krb5', | 
|---|
| 760 | addmain=False, | 
|---|
| 761 | msg="Checking whether krb5_principal_get_realm is defined") | 
|---|
| 762 | if conf.CHECK_CODE('''krb5_verify_checksum(0, 0, 0, 0, 0, 0, 0);''', | 
|---|
| 763 | 'KRB5_VERIFY_CHECKSUM_ARGS', | 
|---|
| 764 | headers='krb5.h', lib='krb5', | 
|---|
| 765 | msg="Checking whether krb5_verify_checksum takes 7 arguments"): | 
|---|
| 766 | conf.DEFINE('KRB5_VERIFY_CHECKSUM_ARGS', '7') | 
|---|
| 767 | else: | 
|---|
| 768 | conf.DEFINE('KRB5_VERIFY_CHECKSUM_ARGS', '6') | 
|---|
| 769 |  | 
|---|
| 770 | conf.CHECK_CODE(''' | 
|---|
| 771 | krb5_enctype enctype; | 
|---|
| 772 | enctype = ENCTYPE_ARCFOUR_HMAC_MD5; | 
|---|
| 773 | ''', | 
|---|
| 774 | '_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5', | 
|---|
| 775 | headers='krb5.h', lib='krb5', | 
|---|
| 776 | msg="Checking whether the ENCTYPE_ARCFOUR_HMAC_MD5 key type definition is available"); | 
|---|
| 777 | conf.CHECK_CODE(''' | 
|---|
| 778 | krb5_keytype keytype; | 
|---|
| 779 | keytype = KEYTYPE_ARCFOUR_56; | 
|---|
| 780 | ''', | 
|---|
| 781 | '_HAVE_KEYTYPE_ARCFOUR_56', | 
|---|
| 782 | headers='krb5.h', lib='krb5', | 
|---|
| 783 | msg="Checking whether the HAVE_KEYTYPE_ARCFOUR_56 key type definition is available"); | 
|---|
| 784 | if conf.CONFIG_SET('_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and conf.CONFIG_SET('_HAVE_KEYTYPE_ARCFOUR_56'): | 
|---|
| 785 | conf.DEFINE('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5', '1') | 
|---|
| 786 |  | 
|---|
| 787 | conf.CHECK_CODE(''' | 
|---|
| 788 | krb5_enctype enctype; | 
|---|
| 789 | enctype = ENCTYPE_ARCFOUR_HMAC; | 
|---|
| 790 | ''', | 
|---|
| 791 | 'HAVE_ENCTYPE_ARCFOUR_HMAC', | 
|---|
| 792 | headers='krb5.h', lib='krb5', | 
|---|
| 793 | msg="Checking whether the ENCTYPE_ARCFOUR_HMAC key type definition is available"); | 
|---|
| 794 |  | 
|---|
| 795 | conf.CHECK_CODE(''' | 
|---|
| 796 | krb5_context context; | 
|---|
| 797 | krb5_keytab keytab; | 
|---|
| 798 | krb5_init_context(&context); | 
|---|
| 799 | return krb5_kt_resolve(context, "WRFILE:api", &keytab); | 
|---|
| 800 | ''', | 
|---|
| 801 | 'HAVE_WRFILE_KEYTAB', | 
|---|
| 802 | headers='krb5.h', lib='krb5', execute=True, | 
|---|
| 803 | msg="Checking whether the WRFILE:-keytab is supported"); | 
|---|
| 804 |  | 
|---|
| 805 | # Check for KRB5_DEPRECATED handling | 
|---|
| 806 | conf.CHECK_CODE('''#define KRB5_DEPRECATED 1 | 
|---|
| 807 | #include <krb5.h>''', | 
|---|
| 808 | 'HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER', addmain=False, | 
|---|
| 809 | link=False, | 
|---|
| 810 | msg="Checking for KRB5_DEPRECATED define taking an identifier") | 
|---|
| 811 | elif conf.env.toplevel_build: | 
|---|
| 812 | # setup the right defines for a in-tree heimdal build | 
|---|
| 813 | Logs.info("Using in-tree heimdal kerberos defines") | 
|---|
| 814 | conf.define('HAVE_GSSAPI', 1) | 
|---|
| 815 | conf.define('HAVE_GSSAPI_GSSAPI_H', 1) | 
|---|
| 816 | conf.define('HAVE_AP_OPTS_USE_SUBKEY', 1) | 
|---|
| 817 | conf.define('HAVE_KRB5_ADDRESSES', 1) | 
|---|
| 818 | conf.define('HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK', 1) | 
|---|
| 819 | conf.define('HAVE_KRB5_SET_REAL_TIME', 1) | 
|---|
| 820 | conf.define('HAVE_COM_ERR_H', 1) | 
|---|
| 821 | conf.define('HAVE_ADDR_TYPE_IN_KRB5_ADDRESS', 1) | 
|---|
| 822 | conf.define('HAVE_GSS_DISPLAY_STATUS', 1) | 
|---|
| 823 | conf.define('HAVE_LIBGSSAPI', 1) | 
|---|
| 824 | conf.define('HAVE_ADDR_TYPE_IN_KRB5_ADDRESS', 1) | 
|---|
| 825 | conf.define('HAVE_CHECKSUM_IN_KRB5_CHECKSUM', 1) | 
|---|
| 826 | conf.define('HAVE_DECL_KRB5_AUTH_CON_SET_REQ_CKSUMTYPE', 0) | 
|---|
| 827 | conf.define('HAVE_DECL_KRB5_GET_CREDENTIALS_FOR_USER', 0) | 
|---|
| 828 | conf.define('HAVE_E_DATA_POINTER_IN_KRB5_ERROR', 1) | 
|---|
| 829 | conf.define('HAVE_INITIALIZE_KRB5_ERROR_TABLE', 1) | 
|---|
| 830 | conf.define('HAVE_KRB5_ADDRESSES', 1) | 
|---|
| 831 | conf.define('HAVE_KRB5_AUTH_CON_SETKEY', 1) | 
|---|
| 832 | conf.define('HAVE_KRB5_CRYPTO', 1) | 
|---|
| 833 | conf.define('HAVE_KRB5_CRYPTO_DESTROY', 1) | 
|---|
| 834 | conf.define('HAVE_KRB5_CRYPTO_INIT', 1) | 
|---|
| 835 | conf.define('HAVE_KRB5_C_ENCTYPE_COMPARE', 1) | 
|---|
| 836 | conf.define('HAVE_KRB5_C_VERIFY_CHECKSUM', 1) | 
|---|
| 837 | conf.define('HAVE_FREE_AP_REQ', 1) | 
|---|
| 838 | conf.define('HAVE_KRB5_DECODE_AP_REQ', 1) | 
|---|
| 839 | conf.define('HAVE_KRB5_ENCTYPES_COMPATIBLE_KEYS', 1) | 
|---|
| 840 | conf.define('HAVE_KRB5_ENCTYPE_TO_STRING', 1) | 
|---|
| 841 | conf.define('HAVE_KRB5_ENCTYPE_TO_STRING_WITH_KRB5_CONTEXT_ARG', 1) | 
|---|
| 842 | conf.define('HAVE_KRB5_FREE_ERROR_CONTENTS', 1) | 
|---|
| 843 | conf.define('HAVE_KRB5_FREE_HOST_REALM', 1) | 
|---|
| 844 | conf.define('HAVE_KRB5_FWD_TGT_CREDS', 1) | 
|---|
| 845 | conf.define('HAVE_KRB5_GET_CREDS', 1) | 
|---|
| 846 | conf.define('HAVE_KRB5_GET_CREDS_OPT_ALLOC', 1) | 
|---|
| 847 | conf.define('HAVE_KRB5_GET_CREDS_OPT_SET_IMPERSONATE', 1) | 
|---|
| 848 | conf.define('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES', 1) | 
|---|
| 849 | conf.define('HAVE_KRB5_GET_HOST_REALM', 1) | 
|---|
| 850 | conf.define('HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC', 1) | 
|---|
| 851 | conf.define('HAVE_KRB5_GET_INIT_CREDS_OPT_FREE', 1) | 
|---|
| 852 | conf.define('HAVE_KRB5_GET_INIT_CREDS_OPT_GET_ERROR', 1) | 
|---|
| 853 | conf.define('HAVE_KRB5_GET_INIT_CREDS_OPT_SET_PAC_REQUEST', 1) | 
|---|
| 854 | conf.define('HAVE_KRB5_GET_KDC_CRED', 1) | 
|---|
| 855 | conf.define('HAVE_KRB5_GET_PW_SALT', 1) | 
|---|
| 856 | conf.define('HAVE_KRB5_GET_RENEWED_CREDS', 1) | 
|---|
| 857 | conf.define('HAVE_KRB5_KEYBLOCK_KEYVALUE', 1) | 
|---|
| 858 | conf.define('HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK', 1) | 
|---|
| 859 | conf.define('HAVE_KRB5_KRBHST_GET_ADDRINFO', 1) | 
|---|
| 860 | conf.define('HAVE_KRB5_KRBHST_INIT', 1) | 
|---|
| 861 | conf.define('HAVE_KRB5_KT_COMPARE', 1) | 
|---|
| 862 | conf.define('HAVE_KRB5_KT_FREE_ENTRY', 1) | 
|---|
| 863 | conf.define('HAVE_KRB5_KU_OTHER_CKSUM', 1) | 
|---|
| 864 | conf.define('HAVE_KRB5_LOCATE_PLUGIN_H', 1) | 
|---|
| 865 | conf.define('HAVE_KRB5_MK_REQ_EXTENDED', 1) | 
|---|
| 866 | conf.define('HAVE_KRB5_PRINCIPAL_COMPARE_ANY_REALM', 1) | 
|---|
| 867 | conf.define('HAVE_KRB5_PRINCIPAL_GET_COMP_STRING', 1) | 
|---|
| 868 | conf.define('HAVE_KRB5_PRINCIPAL_GET_REALM', 1) | 
|---|
| 869 | conf.define('HAVE_KRB5_REALM_TYPE', 1) | 
|---|
| 870 | conf.define('HAVE_KRB5_SESSION_IN_CREDS', 1) | 
|---|
| 871 | conf.define('HAVE_KRB5_SET_DEFAULT_IN_TKT_ETYPES', 1) | 
|---|
| 872 | conf.define('HAVE_KRB5_SET_REAL_TIME', 1) | 
|---|
| 873 | conf.define('HAVE_KRB5_STRING_TO_KEY', 1) | 
|---|
| 874 | conf.define('HAVE_KRB5_STRING_TO_KEY_SALT', 1) | 
|---|
| 875 | conf.define('HAVE_KRB5_VERIFY_CHECKSUM', 1) | 
|---|
| 876 | conf.define('HAVE_LIBKRB5', 1) | 
|---|
| 877 | conf.define('KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT', 1) | 
|---|
| 878 | conf.define('KRB5_VERIFY_CHECKSUM_ARGS', 6) | 
|---|
| 879 | conf.define('HAVE_ETYPE_IN_ENCRYPTEDDATA', 1) | 
|---|
| 880 | conf.define('KRB5_PRINC_REALM_RETURNS_REALM', 1) | 
|---|
| 881 | conf.define('HAVE_KRB5_PRINCIPAL_GET_REALM', 1) | 
|---|
| 882 | conf.define('HAVE_KRB5_H', 1) | 
|---|
| 883 | conf.define('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5', 1) | 
|---|
| 884 | conf.define('HAVE_AP_OPTS_USE_SUBKEY', 1) | 
|---|
| 885 | conf.define('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5', 1) | 
|---|
| 886 | conf.define('HAVE_ENCTYPE_ARCFOUR_HMAC', 1) | 
|---|
| 887 | else: | 
|---|
| 888 | conf.SET_TARGET_TYPE('krb5', 'EMPTY') | 
|---|
| 889 | conf.SET_TARGET_TYPE('gssapi', 'EMPTY') | 
|---|
| 890 | conf.SET_TARGET_TYPE('gssapi_krb5', 'EMPTY') | 
|---|
| 891 | conf.SET_TARGET_TYPE('com_err', 'EMPTY') | 
|---|
| 892 | conf.SET_TARGET_TYPE('k5crypto', 'EMPTY') | 
|---|
| 893 |  | 
|---|
| 894 | if Options.options.with_ads: | 
|---|
| 895 | use_ads=True | 
|---|
| 896 | if not conf.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC_MD5') and \ | 
|---|
| 897 | not conf.CONFIG_SET('HAVE_ENCTYPE_ARCFOUR_HMAC'): | 
|---|
| 898 | Logs.warn("arcfour-hmac-md5 encryption type not found in -lkrb5") | 
|---|
| 899 | use_ads=False | 
|---|
| 900 | if not conf.CONFIG_SET('HAVE_KRB5_MK_REQ_EXTENDED'): | 
|---|
| 901 | Logs.warn("krb5_mk_req_extended not found in -lkrb5") | 
|---|
| 902 | use_ads=False | 
|---|
| 903 | if not conf.CONFIG_SET('HAVE_KRB5_PRINCIPAL2SALT') and \ | 
|---|
| 904 | not conf.CONFIG_SET('HAVE_KRB5_GET_PW_SALT'): | 
|---|
| 905 | Logs.warn("no CREATE_KEY_FUNCTIONS detected") | 
|---|
| 906 | use_ads=False | 
|---|
| 907 | if not conf.CONFIG_SET('HAVE_KRB5_GET_PERMITTED_ENCTYPES') and \ | 
|---|
| 908 | not conf.CONFIG_SET('HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES'): | 
|---|
| 909 | Logs.warn("no GET_ENCTYPES_FUNCTIONS detected") | 
|---|
| 910 | use_ads=False | 
|---|
| 911 | if not conf.CONFIG_SET('HAVE_KRB5_KT_FREE_ENTRY') and \ | 
|---|
| 912 | not conf.CONFIG_SET('HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS'): | 
|---|
| 913 | Logs.warn("no KT_FREE_FUNCTION detected") | 
|---|
| 914 | use_ads=False | 
|---|
| 915 | if not conf.CONFIG_SET('HAVE_KRB5_C_VERIFY_CHECKSUM') and \ | 
|---|
| 916 | not conf.CONFIG_SET('HAVE_KRB5_VERIFY_CHECKSUM'): | 
|---|
| 917 | Logs.warn("no KRB5_VERIFY_CHECKSUM_FUNCTION detected") | 
|---|
| 918 | use_ads=False | 
|---|
| 919 | if not conf.CONFIG_SET('KRB5_TICKET_HAS_KEYINFO'): | 
|---|
| 920 | # We only need the following functions if we can't get the enctype | 
|---|
| 921 | # and kvno out of the ticket directly (ie. on Heimdal). | 
|---|
| 922 | if not conf.CONFIG_SET('HAVE_FREE_AP_REQ'): | 
|---|
| 923 | Logs.warn("no KRB5_AP_REQ_FREE_FUNCTION detected") | 
|---|
| 924 | use_ads=False | 
|---|
| 925 | if not conf.CONFIG_SET('HAVE_KRB5_DECODE_AP_REQ'): | 
|---|
| 926 | Logs.warn("no KRB5_AP_REQ_DECODING_FUNCTION detected") | 
|---|
| 927 | use_ads=False | 
|---|
| 928 | if use_ads: | 
|---|
| 929 | conf.DEFINE('WITH_ADS', '1') | 
|---|
| 930 | conf.DEFINE('HAVE_KRB5', '1') | 
|---|
| 931 | if have_gssapi: | 
|---|
| 932 | conf.DEFINE('HAVE_GSSAPI', '1') | 
|---|
| 933 | if conf.CONFIG_SET('HAVE_LDAP'): | 
|---|
| 934 | conf.env['HAVE_ADS'] = '1' | 
|---|
| 935 | else: | 
|---|
| 936 | Logs.warn("krb5 libs don't have all features required for Active Directory support") | 
|---|
| 937 | conf.undefine('HAVE_KRB5_H') | 
|---|
| 938 | conf.undefine('HAVE_GSSAPI_H') | 
|---|
| 939 | conf.undefine('HAVE_GSSAPI_GSSAPI_GENERIC_H') | 
|---|
| 940 | conf.undefine('HAVE_GSSAPI_GSSAPI_H') | 
|---|
| 941 |  | 
|---|
| 942 | if Options.options.with_utmp: | 
|---|
| 943 | conf.CHECK_FUNCS('pututline pututxline updwtmp updwtmpx getutmpx getutxent') | 
|---|
| 944 | conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_name', headers='utmp.h', | 
|---|
| 945 | define='HAVE_UT_UT_NAME') | 
|---|
| 946 | conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_user', headers='utmp.h', | 
|---|
| 947 | define='HAVE_UT_UT_USER') | 
|---|
| 948 | conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_id', headers='utmp.h', | 
|---|
| 949 | define='HAVE_UT_UT_ID') | 
|---|
| 950 | conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_host', headers='utmp.h', | 
|---|
| 951 | define='HAVE_UT_UT_HOST') | 
|---|
| 952 | conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_time', headers='utmp.h', | 
|---|
| 953 | define='HAVE_UT_UT_TIME') | 
|---|
| 954 | conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_tv', headers='utmp.h', | 
|---|
| 955 | define='HAVE_UT_UT_TV') | 
|---|
| 956 | conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_type', headers='utmp.h', | 
|---|
| 957 | define='HAVE_UT_UT_TYPE') | 
|---|
| 958 | conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_pid', headers='utmp.h', | 
|---|
| 959 | define='HAVE_UT_UT_PID') | 
|---|
| 960 | conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers='utmp.h', | 
|---|
| 961 | define='HAVE_UT_UT_EXIT') | 
|---|
| 962 | conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr_v6', headers='utmp.h', | 
|---|
| 963 | define='HAVE_UT_UT_ADDR_V6') | 
|---|
| 964 | conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr', headers='utmp.h', | 
|---|
| 965 | define='HAVE_UT_UT_ADDR') | 
|---|
| 966 | conf.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers='utmpx.h', | 
|---|
| 967 | define='HAVE_UX_UT_SYSLEN') | 
|---|
| 968 | conf.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);', | 
|---|
| 969 | 'PUTUTLINE_RETURNS_UTMP', headers='utmp.h', | 
|---|
| 970 | msg="Checking whether pututline returns pointer") | 
|---|
| 971 | conf.DEFINE('WITH_UTMP', 1) | 
|---|
| 972 |  | 
|---|
| 973 | if Options.options.with_avahi: | 
|---|
| 974 | conf.env.with_avahi = True | 
|---|
| 975 | if not conf.CHECK_HEADERS('avahi-common/watch.h avahi-client/client.h'): conf.env.with_avahi = False | 
|---|
| 976 | if not conf.CHECK_FUNCS_IN('avahi_client_new', 'avahi-client'): conf.env.with_avahi = False | 
|---|
| 977 | if not conf.CHECK_FUNCS_IN('avahi_strerror', 'avahi-common'): conf.env.with_avahi = False | 
|---|
| 978 | if conf.env.with_avahi: | 
|---|
| 979 | conf.DEFINE('WITH_AVAHI_SUPPORT', 1) | 
|---|
| 980 | else: | 
|---|
| 981 | conf.SET_TARGET_TYPE('avahi-common', 'EMPTY') | 
|---|
| 982 | conf.SET_TARGET_TYPE('avahi-client', 'EMPTY') | 
|---|
| 983 |  | 
|---|
| 984 | if Options.options.with_iconv: | 
|---|
| 985 | conf.env.with_iconv = True | 
|---|
| 986 | if not conf.CHECK_FUNCS_IN('iconv_open', 'iconv', headers='iconv.h'): | 
|---|
| 987 | conf.env.with_iconv = False | 
|---|
| 988 | if conf.env.with_iconv: | 
|---|
| 989 | conf.DEFINE('HAVE_ICONV', 1) | 
|---|
| 990 |  | 
|---|
| 991 | if Options.options.with_pam: | 
|---|
| 992 | use_pam=True | 
|---|
| 993 | conf.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h') | 
|---|
| 994 | if not conf.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf.CONFIG_SET('HAVE_PAM_PAM_APPL_H'): | 
|---|
| 995 | Logs.warn("--with-pam=yes but pam_appl.h not found") | 
|---|
| 996 | use_pam=False | 
|---|
| 997 | conf.CHECK_FUNCS_IN('pam_get_data', 'pam') | 
|---|
| 998 | conf.CHECK_HEADERS('security/pam_modules.h pam/pam_modules.h') | 
|---|
| 999 | if not conf.CONFIG_SET('HAVE_SECURITY_PAM_MODULES_H') and not conf.CONFIG_SET('HAVE_PAM_PAM_MODULES_H'): | 
|---|
| 1000 | Logs.warn("--with-pam=yes but pam_modules.h not found") | 
|---|
| 1001 | use_pam=False | 
|---|
| 1002 | conf.CHECK_HEADERS('security/pam_ext.h security/_pam_macros.h') | 
|---|
| 1003 | conf.CHECK_HEADERS('pam/pam_ext.h pam/_pam_macros.h') | 
|---|
| 1004 | conf.CHECK_FUNCS_IN('pam_vsyslog', 'pam') | 
|---|
| 1005 | conf.CHECK_CODE(''' | 
|---|
| 1006 | #if defined(HAVE_SECURITY_PAM_APPL_H) | 
|---|
| 1007 | #include <security/pam_appl.h> | 
|---|
| 1008 | #elif defined(HAVE_PAM_PAM_APPL_H) | 
|---|
| 1009 | #include <pam/pam_appl.h> | 
|---|
| 1010 | #endif | 
|---|
| 1011 | pam_set_item(0, PAM_RHOST, 0); | 
|---|
| 1012 | ''', | 
|---|
| 1013 | 'HAVE_PAM_RHOST', | 
|---|
| 1014 | lib='pam', | 
|---|
| 1015 | msg="Checking whether PAM_RHOST is available"); | 
|---|
| 1016 | conf.CHECK_CODE(''' | 
|---|
| 1017 | #if defined(HAVE_SECURITY_PAM_APPL_H) | 
|---|
| 1018 | #include <security/pam_appl.h> | 
|---|
| 1019 | #elif defined(HAVE_PAM_PAM_APPL_H) | 
|---|
| 1020 | #include <pam/pam_appl.h> | 
|---|
| 1021 | #endif | 
|---|
| 1022 | pam_set_item(0, PAM_TTY, 0); | 
|---|
| 1023 | ''', | 
|---|
| 1024 | 'HAVE_PAM_TTY', | 
|---|
| 1025 | lib='pam', | 
|---|
| 1026 | msg="Checking whether PAM_TTY is available"); | 
|---|
| 1027 | conf.CHECK_CODE(''' | 
|---|
| 1028 | #if (!defined(LINUX)) | 
|---|
| 1029 |  | 
|---|
| 1030 | #define PAM_EXTERN extern | 
|---|
| 1031 | #if defined(HAVE_SECURITY_PAM_APPL_H) | 
|---|
| 1032 | #include <security/pam_appl.h> | 
|---|
| 1033 | #elif defined(HAVE_PAM_PAM_APPL_H) | 
|---|
| 1034 | #include <pam/pam_appl.h> | 
|---|
| 1035 | #endif | 
|---|
| 1036 |  | 
|---|
| 1037 | #endif | 
|---|
| 1038 |  | 
|---|
| 1039 | #if defined(HAVE_SECURITY_PAM_MODULES_H) | 
|---|
| 1040 | #include <security/pam_modules.h> | 
|---|
| 1041 | #elif defined(HAVE_PAM_PAM_MODULES_H) | 
|---|
| 1042 | #include <pam/pam_modules.h> | 
|---|
| 1043 | #endif | 
|---|
| 1044 |  | 
|---|
| 1045 | #if defined(HAVE_SECURITY__PAM_MACROS_H) | 
|---|
| 1046 | #include <security/_pam_macros.h> | 
|---|
| 1047 | #elif defined(HAVE_PAM__PAM_MACROS_H) | 
|---|
| 1048 | #include <pam/_pam_macros.h> | 
|---|
| 1049 | #endif | 
|---|
| 1050 |  | 
|---|
| 1051 | #ifdef HAVE_SECURITY_PAM_EXT_H | 
|---|
| 1052 | #include <security/pam_ext.h> | 
|---|
| 1053 | #endif | 
|---|
| 1054 |  | 
|---|
| 1055 | int i; i = PAM_RADIO_TYPE; | 
|---|
| 1056 | ''', | 
|---|
| 1057 | 'HAVE_PAM_RADIO_TYPE', | 
|---|
| 1058 | lib='pam', | 
|---|
| 1059 | msg="Checking whether PAM_RADIO_TYPE is available"); | 
|---|
| 1060 | if use_pam: | 
|---|
| 1061 | conf.DEFINE('WITH_PAM', 1) | 
|---|
| 1062 | conf.DEFINE('WITH_PAM_MODULES', 1) | 
|---|
| 1063 |  | 
|---|
| 1064 | seteuid = False | 
|---|
| 1065 | if not seteuid: | 
|---|
| 1066 | seteuid = conf.CHECK_CODE(''' | 
|---|
| 1067 | #define AUTOCONF_TEST 1 | 
|---|
| 1068 | #define USE_SETREUID 1 | 
|---|
| 1069 | #include "./lib/util_sec.c" | 
|---|
| 1070 | ''', | 
|---|
| 1071 | 'USE_SETREUID', | 
|---|
| 1072 | addmain=False, | 
|---|
| 1073 | execute=True, | 
|---|
| 1074 | msg="Checking whether setreuid is available") | 
|---|
| 1075 | if not seteuid: | 
|---|
| 1076 | seteuid = conf.CHECK_CODE(''' | 
|---|
| 1077 | #define AUTOCONF_TEST 1 | 
|---|
| 1078 | #define USE_SETRESUID 1 | 
|---|
| 1079 | #include "./lib/util_sec.c" | 
|---|
| 1080 | ''', | 
|---|
| 1081 | 'USE_SETRESUID', | 
|---|
| 1082 | addmain=False, | 
|---|
| 1083 | execute=True, | 
|---|
| 1084 | msg="Checking whether setresuid is available") | 
|---|
| 1085 | if not seteuid: | 
|---|
| 1086 | seteuid = conf.CHECK_CODE(''' | 
|---|
| 1087 | #define AUTOCONF_TEST 1 | 
|---|
| 1088 | #define USE_SETEUID 1 | 
|---|
| 1089 | #include "./lib/util_sec.c" | 
|---|
| 1090 | ''', | 
|---|
| 1091 | 'USE_SETEUID', | 
|---|
| 1092 | addmain=False, | 
|---|
| 1093 | execute=True, | 
|---|
| 1094 | msg="Checking whether seteuid is available") | 
|---|
| 1095 | if not seteuid: | 
|---|
| 1096 | seteuid = conf.CHECK_CODE(''' | 
|---|
| 1097 | #define AUTOCONF_TEST 1 | 
|---|
| 1098 | #define USE_SETUIDX 1 | 
|---|
| 1099 | #include "./lib/util_sec.c" | 
|---|
| 1100 | ''', | 
|---|
| 1101 | 'USE_SETUIDX', | 
|---|
| 1102 | addmain=False, | 
|---|
| 1103 | execute=True, | 
|---|
| 1104 | mandatory=True, | 
|---|
| 1105 | msg="Checking whether setuidx is available") | 
|---|
| 1106 | if Options.options.with_dnsupdate: | 
|---|
| 1107 | conf.CHECK_HEADERS('uuid/uuid.h') | 
|---|
| 1108 | conf.CHECK_FUNCS_IN('uuid_generate', 'uuid') | 
|---|
| 1109 | if not conf.CONFIG_SET('HAVE_UUID_UUID_H') and not conf.CONFIG_SET('HAVE_UUID_GENERATE'): | 
|---|
| 1110 | Logs.warn("--with-dnsupdate=yes but uuid support not sufficient") | 
|---|
| 1111 | elif not conf.CONFIG_SET('HAVE_GSSAPI'): | 
|---|
| 1112 | Logs.warn("--with-dnsupdate=yes but gssapi support not sufficient") | 
|---|
| 1113 | else: | 
|---|
| 1114 | conf.DEFINE('WITH_DNS_UPDATES', 1) | 
|---|
| 1115 | else: | 
|---|
| 1116 | conf.SET_TARGET_TYPE('uuid', 'EMPTY') | 
|---|
| 1117 | conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h') | 
|---|
| 1118 | if Options.options.developer: | 
|---|
| 1119 | if conf.CONFIG_SET('HAVE_VALGRIND_H') or conf.CONFIG_SET('HAVE_VALGRIND_VALGRIND_H'): | 
|---|
| 1120 | conf.DEFINE('VALGRIND', '1') | 
|---|
| 1121 |  | 
|---|
| 1122 | if conf.CHECK_CODE(''' | 
|---|
| 1123 | #include <bits/sockaddr.h> | 
|---|
| 1124 | #include <linux/netlink.h> | 
|---|
| 1125 | ''', | 
|---|
| 1126 | 'HAVE_LINUX_NETLINK_H', | 
|---|
| 1127 | msg="Checking whether Linux netlink is available"): | 
|---|
| 1128 | conf.CHECK_CODE(''' | 
|---|
| 1129 | #include <bits/sockaddr.h> | 
|---|
| 1130 | #include <linux/netlink.h> | 
|---|
| 1131 | #include <linux/rtnetlink.h> | 
|---|
| 1132 | ''', | 
|---|
| 1133 | 'HAVE_LINUX_RTNETLINK_H', | 
|---|
| 1134 | msg='Checking whether Linux rtnetlink is available') | 
|---|
| 1135 | if conf.CHECK_TYPE('struct dirent64', headers='sys/types.h dirent.h') and conf.CONFIG_SET('HAVE_READDIR64'): | 
|---|
| 1136 | conf.DEFINE('HAVE_STRUCT_DIRENT64', '1') | 
|---|
| 1137 | else: | 
|---|
| 1138 | conf.undefine('HAVE_STRUCT_DIRENT64') | 
|---|
| 1139 |  | 
|---|
| 1140 | conf.CHECK_CODE(''' | 
|---|
| 1141 | #include "../tests/fcntl_lock.c" | 
|---|
| 1142 | ''', | 
|---|
| 1143 | 'HAVE_FCNTL_LOCK', | 
|---|
| 1144 | addmain=False, | 
|---|
| 1145 | execute=True, | 
|---|
| 1146 | msg='Checking whether fcntl locking is available') | 
|---|
| 1147 |  | 
|---|
| 1148 | conf.CHECK_CODE(''' | 
|---|
| 1149 | #include "../tests/fcntl_lock64.c" | 
|---|
| 1150 | ''', | 
|---|
| 1151 | 'HAVE_BROKEN_FCNTL64_LOCKS', | 
|---|
| 1152 | addmain=False, | 
|---|
| 1153 | execute=True, | 
|---|
| 1154 | msg='Checking whether fcntl64 locks are broken') | 
|---|
| 1155 |  | 
|---|
| 1156 | if not conf.CONFIG_SET('HAVE_BROKEN_FCNTL64_LOCKS'): | 
|---|
| 1157 | conf.CHECK_CODE(''' | 
|---|
| 1158 | #if defined(HAVE_UNISTD_H) | 
|---|
| 1159 | #include <unistd.h> | 
|---|
| 1160 | #endif | 
|---|
| 1161 | #include <stdio.h> | 
|---|
| 1162 | #include <stdlib.h> | 
|---|
| 1163 |  | 
|---|
| 1164 | #ifdef HAVE_FCNTL_H | 
|---|
| 1165 | #include <fcntl.h> | 
|---|
| 1166 | #endif | 
|---|
| 1167 |  | 
|---|
| 1168 | #ifdef HAVE_SYS_FCNTL_H | 
|---|
| 1169 | #include <sys/fcntl.h> | 
|---|
| 1170 | #endif | 
|---|
| 1171 | main() { struct flock64 fl64; | 
|---|
| 1172 | #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64) | 
|---|
| 1173 | exit(0); | 
|---|
| 1174 | #else | 
|---|
| 1175 | exit(1); | 
|---|
| 1176 | #endif | 
|---|
| 1177 | } | 
|---|
| 1178 | ''', | 
|---|
| 1179 | 'HAVE_STRUCT_FLOCK64', | 
|---|
| 1180 | addmain=False, | 
|---|
| 1181 | execute=True, | 
|---|
| 1182 | msg="Checking whether the flock64 struct is available") | 
|---|
| 1183 |  | 
|---|
| 1184 | conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec', | 
|---|
| 1185 | define='HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') # Linux, Solaris | 
|---|
| 1186 | conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimensec', | 
|---|
| 1187 | define='HAVE_STRUCT_STAT_ST_MTIMENSEC') # BSD, if defined _POSIX_SOURCE | 
|---|
| 1188 | conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtimespec.tv_nsec', | 
|---|
| 1189 | define='HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') # BSD, if not defined _POSIX_SOURCE | 
|---|
| 1190 | conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtime_n', | 
|---|
| 1191 | define='HAVE_STRUCT_STAT_ST_MTIME_N') # AIX | 
|---|
| 1192 | conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_umtime', | 
|---|
| 1193 | define='HAVE_STRUCT_STAT_ST_UMTIME') # Tru64 | 
|---|
| 1194 | if conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC') or \ | 
|---|
| 1195 | conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMENSEC') or \ | 
|---|
| 1196 | conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC') or \ | 
|---|
| 1197 | conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_MTIME_N') or \ | 
|---|
| 1198 | conf.CONFIG_SET('HAVE_STRUCT_STAT_ST_UMTIME'): | 
|---|
| 1199 | conf.DEFINE('HAVE_STAT_HIRES_TIMESTAMPS', '1') | 
|---|
| 1200 |  | 
|---|
| 1201 | # recent FreeBSD, NetBSD have creation timestamps called birthtime: | 
|---|
| 1202 | conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtime', | 
|---|
| 1203 | define='HAVE_STRUCT_STAT_ST_BIRTHTIME') | 
|---|
| 1204 | conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimespec.tv_nsec', | 
|---|
| 1205 | define='HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC') | 
|---|
| 1206 | conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_birthtimensec', | 
|---|
| 1207 | define='HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC') | 
|---|
| 1208 |  | 
|---|
| 1209 | conf.CHECK_CODE(''' | 
|---|
| 1210 | #if defined(HAVE_UNISTD_H) | 
|---|
| 1211 | #include <unistd.h> | 
|---|
| 1212 | #endif | 
|---|
| 1213 | #include <fcntl.h>], | 
|---|
| 1214 | ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED); | 
|---|
| 1215 | ''', | 
|---|
| 1216 | 'HAVE_POSIX_FADVISE', | 
|---|
| 1217 | msg='Checking whether posix_fadvise is available') | 
|---|
| 1218 |  | 
|---|
| 1219 | for v in ['_SC_NGROUPS_MAX', '_SC_NPROC_ONLN', '_SC_NPROCESSORS_ONLN', '_SC_PAGESIZE' ]: | 
|---|
| 1220 | conf.CHECK_CODE(''' | 
|---|
| 1221 | #include <unistd.h> | 
|---|
| 1222 | return sysconf(%s) == -1 ? 1 : 0; | 
|---|
| 1223 | ''' % v, | 
|---|
| 1224 | 'SYSCONF%s' % v, | 
|---|
| 1225 | msg='Checking whether sysconf(%s) is available' % v) | 
|---|
| 1226 |  | 
|---|
| 1227 | conf.CHECK_DECLS('__NR_inotify_init', reverse=True, headers='asm/unistd.h') | 
|---|
| 1228 |  | 
|---|
| 1229 | conf.CHECK_CODE(''' | 
|---|
| 1230 | #include <sys/syscall.h> | 
|---|
| 1231 | #include <unistd.h> | 
|---|
| 1232 | syscall(SYS_initgroups, 16, NULL, NULL, 0); | 
|---|
| 1233 | ''', | 
|---|
| 1234 | 'HAVE_DARWIN_INITGROUPS', | 
|---|
| 1235 | msg='Checking whether to use the Darwin-specific initgroups system call') | 
|---|
| 1236 |  | 
|---|
| 1237 | conf.CHECK_CODE('''struct utimbuf tbuf;  tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));''', | 
|---|
| 1238 | 'HAVE_UTIMBUF', | 
|---|
| 1239 | headers='sys/types.h utime.h', | 
|---|
| 1240 | msg='Checking whether struct utimbuf is available') | 
|---|
| 1241 |  | 
|---|
| 1242 | if conf.CHECK_CODE('''struct sigevent s;''', | 
|---|
| 1243 | 'HAVE_STRUCT_SIGEVENT', | 
|---|
| 1244 | headers='sys/types.h stdlib.h stddef.h signal.h', | 
|---|
| 1245 | msg='Checking whether we have the struct sigevent'): | 
|---|
| 1246 | conf.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sival_ptr', | 
|---|
| 1247 | define='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR', | 
|---|
| 1248 | headers='signal.h'); | 
|---|
| 1249 | conf.CHECK_STRUCTURE_MEMBER('struct sigevent', 'sigev_value.sigval_ptr', | 
|---|
| 1250 | define='HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR', | 
|---|
| 1251 | headers='signal.h'); | 
|---|
| 1252 |  | 
|---|
| 1253 | if os.path.exists('/proc/sys/kernel/core_pattern'): | 
|---|
| 1254 | conf.DEFINE('HAVE_SYS_KERNEL_PROC_CORE_PATTERN', '1') | 
|---|
| 1255 |  | 
|---|
| 1256 | if conf.CHECK_CODE(''' | 
|---|
| 1257 | #include <time.h> | 
|---|
| 1258 | main() { | 
|---|
| 1259 | struct tm *tm; | 
|---|
| 1260 | if (sizeof(time_t) == 8) { | 
|---|
| 1261 | time_t max_time = 0x7fffffffffffffffll; | 
|---|
| 1262 | tm = gmtime(&max_time); | 
|---|
| 1263 | /* This should fail with 32-bit tm_year. */ | 
|---|
| 1264 | if (tm == NULL) { | 
|---|
| 1265 | /* Max time_t that works with 32-bit int tm_year in struct tm. */ | 
|---|
| 1266 | max_time = 67768036191676799ll; | 
|---|
| 1267 | tm = gmtime(&max_time); | 
|---|
| 1268 | if (tm) { | 
|---|
| 1269 | exit(0); | 
|---|
| 1270 | } | 
|---|
| 1271 | } | 
|---|
| 1272 | } | 
|---|
| 1273 | exit(1); | 
|---|
| 1274 | }''', | 
|---|
| 1275 | '__TIME_T_MAX', | 
|---|
| 1276 | addmain=False, | 
|---|
| 1277 | execute=True, | 
|---|
| 1278 | msg="Checking for the maximum value of the 'time_t' type"): | 
|---|
| 1279 | conf.DEFINE('TIME_T_MAX', '67768036191676799ll') | 
|---|
| 1280 |  | 
|---|
| 1281 | conf.CHECK_CODE(''' | 
|---|
| 1282 | #if defined(HAVE_UNISTD_H) | 
|---|
| 1283 | #include <unistd.h> | 
|---|
| 1284 | #endif | 
|---|
| 1285 | #include <sys/types.h> | 
|---|
| 1286 | main() { dev_t dev = makedev(1,2); return 0; } | 
|---|
| 1287 | ''', | 
|---|
| 1288 | 'HAVE_MAKEDEV', | 
|---|
| 1289 | addmain=False, | 
|---|
| 1290 | msg='Checking whether the macro for makedev is available') | 
|---|
| 1291 |  | 
|---|
| 1292 | conf.CHECK_CODE(''' | 
|---|
| 1293 | #include <stdio.h> | 
|---|
| 1294 | #include <limits.h> | 
|---|
| 1295 | #include <signal.h> | 
|---|
| 1296 |  | 
|---|
| 1297 | void exit_on_core(int ignored) { | 
|---|
| 1298 | exit(1); | 
|---|
| 1299 | } | 
|---|
| 1300 |  | 
|---|
| 1301 | main() { | 
|---|
| 1302 | char *newpath; | 
|---|
| 1303 | signal(SIGSEGV, exit_on_core); | 
|---|
| 1304 | newpath = realpath("/tmp", NULL); | 
|---|
| 1305 | exit((newpath != NULL) ? 0 : 1); | 
|---|
| 1306 | } | 
|---|
| 1307 | ''', | 
|---|
| 1308 | 'REALPATH_TAKES_NULL', | 
|---|
| 1309 | addmain=False, | 
|---|
| 1310 | execute=True, | 
|---|
| 1311 | msg='Checking whether the realpath function allows a NULL argument') | 
|---|
| 1312 |  | 
|---|
| 1313 | conf.CHECK_CODE('''#include "../tests/ftruncate.c"''', | 
|---|
| 1314 | 'HAVE_FTRUNCATE_EXTEND', | 
|---|
| 1315 | msg='Checking for ftruncate extend', | 
|---|
| 1316 | addmain=False, | 
|---|
| 1317 | execute=True) | 
|---|
| 1318 | if os.getenv('RUN_FROM_BUILD_FARM'): | 
|---|
| 1319 | Logs.info("enabling buildfarm hacks") | 
|---|
| 1320 | conf.DEFINE('ENABLE_BUILD_FARM_HACKS', '1') | 
|---|
| 1321 |  | 
|---|
| 1322 | if Options.options.with_sendfile_support: | 
|---|
| 1323 | 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): | 
|---|
| 1324 | conf.CHECK_CODE(''' | 
|---|
| 1325 | int tofd, fromfd; | 
|---|
| 1326 | off64_t offset; | 
|---|
| 1327 | size_t total; | 
|---|
| 1328 | ssize_t nwritten = sendfile64(tofd, fromfd, &offset, total); | 
|---|
| 1329 | ''', | 
|---|
| 1330 | '_HAVE_SENDFILE64', | 
|---|
| 1331 | headers='sys/sendfile', | 
|---|
| 1332 | msg='Checking for linux sendfile64 support') | 
|---|
| 1333 | conf.CHECK_CODE(''' | 
|---|
| 1334 | int tofd, fromfd; | 
|---|
| 1335 | off_t offset; | 
|---|
| 1336 | size_t total; | 
|---|
| 1337 | ssize_t nwritten = sendfile(tofd, fromfd, &offset, total); | 
|---|
| 1338 | ''', | 
|---|
| 1339 | '_HAVE_SENDFILE', | 
|---|
| 1340 | headers='sys/sendfile', | 
|---|
| 1341 | msg='Checking for linux sendfile support') | 
|---|
| 1342 |  | 
|---|
| 1343 | # Try and cope with broken Linux sendfile.... | 
|---|
| 1344 | conf.CHECK_CODE('''#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64) | 
|---|
| 1345 | #undef _FILE_OFFSET_BITS | 
|---|
| 1346 | #endif | 
|---|
| 1347 | #include <sys/sendfile.h> | 
|---|
| 1348 | int tofd, fromfd; | 
|---|
| 1349 | off_t offset; | 
|---|
| 1350 | size_t total; | 
|---|
| 1351 | ssize_t nwritten = sendfile(tofd, fromfd, &offset, total); | 
|---|
| 1352 | ''', | 
|---|
| 1353 | '_HAVE_BROKEN_LINUX_SENDFILE', | 
|---|
| 1354 | msg='Checking for broken linux sendfile support') | 
|---|
| 1355 | if conf.CONFIG_SET('_HAVE_SENDFILE64'): | 
|---|
| 1356 | conf.DEFINE('HAVE_SENDFILE64', '1') | 
|---|
| 1357 | conf.DEFINE('LINUX_SENDFILE_API', '1') | 
|---|
| 1358 | conf.DEFINE('WITH_SENDFILE', '1') | 
|---|
| 1359 | elif conf.CONFIG_SET('_HAVE_SENDFILE'): | 
|---|
| 1360 | conf.DEFINE('HAVE_SENDFILE', '1') | 
|---|
| 1361 | conf.DEFINE('LINUX_SENDFILE_API', '1') | 
|---|
| 1362 | conf.DEFINE('WITH_SENDFILE', '1') | 
|---|
| 1363 | elif conf.CONFIG_SET('_HAVE_BROKEN_LINUX_SENDFILE'): | 
|---|
| 1364 | conf.DEFINE('LINUX_BROKEN_SENDFILE_API', '1') | 
|---|
| 1365 | conf.DEFINE('WITH_SENDFILE', '1') | 
|---|
| 1366 | elif (host_os.rfind('freebsd') > -1) or (host_os.rfind('dragonfly') > -1): | 
|---|
| 1367 | conf.CHECK_CODE(''' | 
|---|
| 1368 | #include <sys/types.h> | 
|---|
| 1369 | #include <unistd.h> | 
|---|
| 1370 | #include <sys/socket.h> | 
|---|
| 1371 | #include <sys/uio.h> | 
|---|
| 1372 | int fromfd, tofd, ret, total=0; | 
|---|
| 1373 | off_t offset, nwritten; | 
|---|
| 1374 | struct sf_hdtr hdr; | 
|---|
| 1375 | struct iovec hdtrl; | 
|---|
| 1376 | hdr.headers = &hdtrl; | 
|---|
| 1377 | hdr.hdr_cnt = 1; | 
|---|
| 1378 | hdr.trailers = NULL; | 
|---|
| 1379 | hdr.trl_cnt = 0; | 
|---|
| 1380 | hdtrl.iov_base = NULL; | 
|---|
| 1381 | hdtrl.iov_len = 0; | 
|---|
| 1382 | ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0) | 
|---|
| 1383 | ''', | 
|---|
| 1384 | '_HAVE_SENDFILE', | 
|---|
| 1385 | msg='Checking for freebsd sendfile support') | 
|---|
| 1386 | if conf.CONFIG_SET('_HAVE_SENDFILE'): | 
|---|
| 1387 | conf.DEFINE('HAVE_SENDFILE', '1') | 
|---|
| 1388 | conf.DEFINE('FREEBSD_SENDFILE_API', '1') | 
|---|
| 1389 | conf.DEFINE('WITH_SENDFILE', '1') | 
|---|
| 1390 | elif (host_os.rfind('hpux') > -1): | 
|---|
| 1391 | conf.CHECK_CODE(''' | 
|---|
| 1392 | #include <sys/socket.h> | 
|---|
| 1393 | #include <sys/uio.h> | 
|---|
| 1394 | int fromfd, tofd; | 
|---|
| 1395 | size_t total=0; | 
|---|
| 1396 | struct iovec hdtrl[2]; | 
|---|
| 1397 | ssize_t nwritten; | 
|---|
| 1398 | off64_t offset; | 
|---|
| 1399 | hdtrl[0].iov_base = 0; | 
|---|
| 1400 | hdtrl[0].iov_len = 0; | 
|---|
| 1401 | nwritten = sendfile64(tofd, fromfd, offset, total, &hdtrl[0], 0); | 
|---|
| 1402 | ''', | 
|---|
| 1403 | '_HAVE_SENDFILE64', | 
|---|
| 1404 | msg='Checking for hpux sendfile64 support') | 
|---|
| 1405 | conf.CHECK_CODE(''' | 
|---|
| 1406 | #include <sys/socket.h> | 
|---|
| 1407 | #include <sys/uio.h> | 
|---|
| 1408 | int fromfd, tofd; | 
|---|
| 1409 | size_t total=0; | 
|---|
| 1410 | struct iovec hdtrl[2]; | 
|---|
| 1411 | ssize_t nwritten; | 
|---|
| 1412 | off_t offset; | 
|---|
| 1413 | hdtrl[0].iov_base = 0; | 
|---|
| 1414 | hdtrl[0].iov_len = 0; | 
|---|
| 1415 | nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0); | 
|---|
| 1416 | ''', | 
|---|
| 1417 | '_HAVE_SENDFILE', | 
|---|
| 1418 | msg='Checking for hpux sendfile support') | 
|---|
| 1419 | if conf.CONFIG_SET('_HAVE_SENDFILE64'): | 
|---|
| 1420 | conf.DEFINE('HAVE_SENDFILE64', '1') | 
|---|
| 1421 | conf.DEFINE('HPUX_SENDFILE_API', '1') | 
|---|
| 1422 | conf.DEFINE('WITH_SENDFILE', '1') | 
|---|
| 1423 | elif conf.CONFIG_SET('_HAVE_SENDFILE'): | 
|---|
| 1424 | conf.DEFINE('HAVE_SENDFILE', '1') | 
|---|
| 1425 | conf.DEFINE('HPUX_SENDFILE_API', '1') | 
|---|
| 1426 | conf.DEFINE('WITH_SENDFILE', '1') | 
|---|
| 1427 | elif (host_os.rfind('solaris') > -1): | 
|---|
| 1428 | conf.CHECK_FUNCS_IN('sendfile', 'sendfilev') | 
|---|
| 1429 | conf.CHECK_CODE(''' | 
|---|
| 1430 | #include <sys/sendfile.h> | 
|---|
| 1431 | int sfvcnt; | 
|---|
| 1432 | size_t xferred; | 
|---|
| 1433 | struct sendfilevec vec[2]; | 
|---|
| 1434 | ssize_t nwritten; | 
|---|
| 1435 | int tofd; | 
|---|
| 1436 | sfvcnt = 2; | 
|---|
| 1437 | vec[0].sfv_fd = SFV_FD_SELF; | 
|---|
| 1438 | vec[0].sfv_flag = 0; | 
|---|
| 1439 | vec[0].sfv_off = 0; | 
|---|
| 1440 | vec[0].sfv_len = 0; | 
|---|
| 1441 | vec[1].sfv_fd = 0; | 
|---|
| 1442 | vec[1].sfv_flag = 0; | 
|---|
| 1443 | vec[1].sfv_off = 0; | 
|---|
| 1444 | vec[1].sfv_len = 0; | 
|---|
| 1445 | nwritten = sendfilev64(tofd, vec, sfvcnt, &xferred); | 
|---|
| 1446 | ''', | 
|---|
| 1447 | '_HAVE_SENDFILEV64', | 
|---|
| 1448 | msg='Checking for solaris sendfilev64 support') | 
|---|
| 1449 | conf.CHECK_CODE(''' | 
|---|
| 1450 | #include <sys/sendfile.h>, | 
|---|
| 1451 | int sfvcnt; | 
|---|
| 1452 | size_t xferred; | 
|---|
| 1453 | struct sendfilevec vec[2]; | 
|---|
| 1454 | ssize_t nwritten; | 
|---|
| 1455 | int tofd; | 
|---|
| 1456 | sfvcnt = 2; | 
|---|
| 1457 | vec[0].sfv_fd = SFV_FD_SELF; | 
|---|
| 1458 | vec[0].sfv_flag = 0; | 
|---|
| 1459 | vec[0].sfv_off = 0; | 
|---|
| 1460 | vec[0].sfv_len = 0; | 
|---|
| 1461 | vec[1].sfv_fd = 0; | 
|---|
| 1462 | vec[1].sfv_flag = 0; | 
|---|
| 1463 | vec[1].sfv_off = 0; | 
|---|
| 1464 | vec[1].sfv_len = 0; | 
|---|
| 1465 | nwritten = sendfilev(tofd, vec, sfvcnt, &xferred); | 
|---|
| 1466 | ''', | 
|---|
| 1467 | '_HAVE_SENDFILEV', | 
|---|
| 1468 | msg='Checking for solaris sendfilev support') | 
|---|
| 1469 | if conf.CONFIG_SET('_HAVE_SENDFILEV64'): | 
|---|
| 1470 | conf.DEFINE('HAVE_SENDFILEV64', '1') | 
|---|
| 1471 | conf.DEFINE('SOLARIS_SENDFILE_API', '1') | 
|---|
| 1472 | conf.DEFINE('WITH_SENDFILE', '1') | 
|---|
| 1473 | elif conf.CONFIG_SET('_HAVE_SENDFILEV'): | 
|---|
| 1474 | conf.DEFINE('HAVE_SENDFILEV', '1') | 
|---|
| 1475 | conf.DEFINE('SOLARIS_SENDFILE_API', '1') | 
|---|
| 1476 | conf.DEFINE('WITH_SENDFILE', '1') | 
|---|
| 1477 | elif (host_os.rfind('aix') > -1): | 
|---|
| 1478 | conf.CHECK_CODE(''' | 
|---|
| 1479 | #include <sys/socket.h> | 
|---|
| 1480 | int fromfd, tofd; | 
|---|
| 1481 | size_t total=0; | 
|---|
| 1482 | struct sf_parms hdtrl; | 
|---|
| 1483 | ssize_t nwritten; | 
|---|
| 1484 | off64_t offset; | 
|---|
| 1485 | hdtrl.header_data = 0; | 
|---|
| 1486 | hdtrl.header_length = 0; | 
|---|
| 1487 | hdtrl.file_descriptor = fromfd; | 
|---|
| 1488 | hdtrl.file_offset = 0; | 
|---|
| 1489 | hdtrl.file_bytes = 0; | 
|---|
| 1490 | hdtrl.trailer_data = 0; | 
|---|
| 1491 | hdtrl.trailer_length = 0; | 
|---|
| 1492 | nwritten = send_file(&tofd, &hdtrl, 0); | 
|---|
| 1493 | ''', | 
|---|
| 1494 | '_HAVE_SENDFILE', | 
|---|
| 1495 | msg='Checking for AIX send_file support') | 
|---|
| 1496 | if conf.CONFIG_SET('_HAVE_SENDFILE'): | 
|---|
| 1497 | conf.DEFINE('HAVE_SENDFILE', '1') | 
|---|
| 1498 | conf.DEFINE('AIX_SENDFILE_API', '1') | 
|---|
| 1499 | conf.DEFINE('WITH_SENDFILE', '1') | 
|---|
| 1500 |  | 
|---|
| 1501 | conf.CHECK_CODE('''enum TDB_ERROR err = TDB_ERR_NESTING''', | 
|---|
| 1502 | 'HAVE_TDB_ERR_NESTING', | 
|---|
| 1503 | headers='tdb.h', | 
|---|
| 1504 | msg='Checking whether we have TDB_ERR_NESTING') | 
|---|
| 1505 |  | 
|---|
| 1506 | # UnixWare 7.x has its getspnam in -lgen | 
|---|
| 1507 | conf.CHECK_FUNCS_IN('getspnam', 'gen') | 
|---|
| 1508 | conf.CHECK_FUNCS_IN('getspnam', 'security') | 
|---|
| 1509 | conf.CHECK_FUNCS_IN('getspnam', 'sec') | 
|---|
| 1510 |  | 
|---|
| 1511 | if Options.options.with_quotas: | 
|---|
| 1512 | # For quotas on Veritas VxFS filesystems | 
|---|
| 1513 | conf.CHECK_HEADERS('sys/fs/vx_quota.h') | 
|---|
| 1514 | # For quotas on Linux XFS filesystems | 
|---|
| 1515 | conf.CHECK_HEADERS('linux/dqblk_xfs.h') | 
|---|
| 1516 | # For sys/quota.h and linux/quota.h | 
|---|
| 1517 | conf.CHECK_HEADERS('sys/quota.h') | 
|---|
| 1518 |  | 
|---|
| 1519 |  | 
|---|
| 1520 | # | 
|---|
| 1521 | # checking for clustering extensions (CTDB) | 
|---|
| 1522 | # | 
|---|
| 1523 | if not Options.options.with_cluster_support: | 
|---|
| 1524 | have_cluster_support = False | 
|---|
| 1525 |  | 
|---|
| 1526 | else: | 
|---|
| 1527 |  | 
|---|
| 1528 | if Options.options.ctdb_dir: | 
|---|
| 1529 | conf.ADD_EXTRA_INCLUDES(Options.options.ctdb_dir + '/include') | 
|---|
| 1530 |  | 
|---|
| 1531 | srcdir = os.path.realpath(conf.srcdir) | 
|---|
| 1532 | if 'EXTRA_INCLUDES' in conf.env: | 
|---|
| 1533 | includes = ' '.join(conf.env['EXTRA_INCLUDES']).replace('#', srcdir + '/') | 
|---|
| 1534 | else: | 
|---|
| 1535 | includes = '' | 
|---|
| 1536 |  | 
|---|
| 1537 | have_cluster_support = True | 
|---|
| 1538 | ctdb_broken = "" | 
|---|
| 1539 |  | 
|---|
| 1540 | conf.CHECK_CODE(''' | 
|---|
| 1541 | #define NO_CONFIG_H | 
|---|
| 1542 | #include "replace.h" | 
|---|
| 1543 | #include "system/wait.h" | 
|---|
| 1544 | #include "system/network.h" | 
|---|
| 1545 | #define private #error __USED_RESERVED_WORD_private__ | 
|---|
| 1546 | #include <talloc.h> | 
|---|
| 1547 | #include <tdb.h> | 
|---|
| 1548 | #include <ctdb.h> | 
|---|
| 1549 |  | 
|---|
| 1550 | int main(void) | 
|---|
| 1551 | { | 
|---|
| 1552 | return 0; | 
|---|
| 1553 | } | 
|---|
| 1554 | ''', | 
|---|
| 1555 | 'HAVE_CTDB_H', | 
|---|
| 1556 | addmain=False, | 
|---|
| 1557 | includes=includes, | 
|---|
| 1558 | msg='Checking for header ctdb.h') | 
|---|
| 1559 |  | 
|---|
| 1560 | if not conf.CONFIG_SET('HAVE_CTDB_H'): | 
|---|
| 1561 | have_cluster_support = False | 
|---|
| 1562 | ctdb_broken = "ctdb.h is required for cluster support" | 
|---|
| 1563 |  | 
|---|
| 1564 | if have_cluster_support: | 
|---|
| 1565 | conf.CHECK_CODE(''' | 
|---|
| 1566 | #define NO_CONFIG_H | 
|---|
| 1567 | #include "replace.h" | 
|---|
| 1568 | #include "system/wait.h" | 
|---|
| 1569 | #include "system/network.h" | 
|---|
| 1570 | #define private #error __USED_RESERVED_WORD_private__ | 
|---|
| 1571 | #include <talloc.h> | 
|---|
| 1572 | #include <tdb.h> | 
|---|
| 1573 | #include <ctdb.h> | 
|---|
| 1574 | #include <ctdb_private.h> | 
|---|
| 1575 |  | 
|---|
| 1576 | int main(void) | 
|---|
| 1577 | { | 
|---|
| 1578 | return 0; | 
|---|
| 1579 | } | 
|---|
| 1580 | ''', | 
|---|
| 1581 | 'HAVE_CTDB_PRIVATE_H', | 
|---|
| 1582 | addmain=False, | 
|---|
| 1583 | includes=includes, | 
|---|
| 1584 | msg='Checking for header ctdb_private.h') | 
|---|
| 1585 |  | 
|---|
| 1586 | if not conf.CONFIG_SET('HAVE_CTDB_PRIVATE_H'): | 
|---|
| 1587 | have_cluster_support = False | 
|---|
| 1588 | ctdb_broken = "ctdb_private.h is required for cluster support" | 
|---|
| 1589 |  | 
|---|
| 1590 | if have_cluster_support: | 
|---|
| 1591 | conf.CHECK_CODE(''' | 
|---|
| 1592 | #define NO_CONFIG_H | 
|---|
| 1593 | #include "replace.h" | 
|---|
| 1594 | #include "system/wait.h" | 
|---|
| 1595 | #include "system/network.h" | 
|---|
| 1596 | #include <talloc.h> | 
|---|
| 1597 | #include <tdb.h> | 
|---|
| 1598 | #include <ctdb.h> | 
|---|
| 1599 | #include <ctdb_private.h> | 
|---|
| 1600 |  | 
|---|
| 1601 | int main(void) | 
|---|
| 1602 | { | 
|---|
| 1603 | int i = (int)CTDB_CONTROL_TRANS3_COMMIT; | 
|---|
| 1604 | return 0; | 
|---|
| 1605 | } | 
|---|
| 1606 | ''', | 
|---|
| 1607 | 'HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL', | 
|---|
| 1608 | addmain=False, | 
|---|
| 1609 | includes=includes, | 
|---|
| 1610 | msg='Checking for transaction support (TRANS3_COMMIT control)') | 
|---|
| 1611 |  | 
|---|
| 1612 | if not conf.CONFIG_SET('HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL'): | 
|---|
| 1613 | have_cluster_support = False | 
|---|
| 1614 | ctdb_broken = "ctdb transaction support missing or too old" | 
|---|
| 1615 |  | 
|---|
| 1616 | if have_cluster_support: | 
|---|
| 1617 | conf.CHECK_CODE(''' | 
|---|
| 1618 | #define NO_CONFIG_H | 
|---|
| 1619 | #include "replace.h" | 
|---|
| 1620 | #include "system/wait.h" | 
|---|
| 1621 | #include "system/network.h" | 
|---|
| 1622 | #include <talloc.h> | 
|---|
| 1623 | #include <tdb.h> | 
|---|
| 1624 | #include <ctdb.h> | 
|---|
| 1625 | #include <ctdb_private.h> | 
|---|
| 1626 |  | 
|---|
| 1627 | int main(void) | 
|---|
| 1628 | { | 
|---|
| 1629 | int i = (int)CTDB_CONTROL_SCHEDULE_FOR_DELETION; | 
|---|
| 1630 | return 0; | 
|---|
| 1631 | } | 
|---|
| 1632 | ''', | 
|---|
| 1633 | 'HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL', | 
|---|
| 1634 | addmain=False, | 
|---|
| 1635 | includes=includes, | 
|---|
| 1636 | msg='Checking for SCHEDULE_FOR_DELETION control') | 
|---|
| 1637 |  | 
|---|
| 1638 | if not conf.CONFIG_SET('HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL'): | 
|---|
| 1639 | if not Options.options.enable_old_ctdb: | 
|---|
| 1640 | have_cluster_support = False | 
|---|
| 1641 | ctdb_broken = "SCHEDULE_FOR_DELETION control missing" | 
|---|
| 1642 | else: | 
|---|
| 1643 | Logs.warn("ignoring missing SCHEDULE_FOR_DELETION control (--enable-old-ctdb)") | 
|---|
| 1644 |  | 
|---|
| 1645 | if have_cluster_support: | 
|---|
| 1646 | conf.CHECK_CODE(''' | 
|---|
| 1647 | #define NO_CONFIG_H | 
|---|
| 1648 | #include "replace.h" | 
|---|
| 1649 | #include "system/wait.h" | 
|---|
| 1650 | #include "system/network.h" | 
|---|
| 1651 | #include <talloc.h> | 
|---|
| 1652 | #include <tdb.h> | 
|---|
| 1653 | #include <ctdb.h> | 
|---|
| 1654 | #include <ctdb_private.h> | 
|---|
| 1655 |  | 
|---|
| 1656 | int main(void) | 
|---|
| 1657 | { | 
|---|
| 1658 | struct ctdb_control_tcp _x; | 
|---|
| 1659 | return 0; | 
|---|
| 1660 | } | 
|---|
| 1661 | ''', | 
|---|
| 1662 | 'HAVE_STRUCT_CTDB_CONTROL_TCP', | 
|---|
| 1663 | addmain=False, | 
|---|
| 1664 | includes=includes, | 
|---|
| 1665 | msg='Checking for ctdb ipv4 support') | 
|---|
| 1666 |  | 
|---|
| 1667 | if not conf.CONFIG_SET('HAVE_STRUCT_CTDB_CONTROL_TCP'): | 
|---|
| 1668 | have_cluster_support = False | 
|---|
| 1669 | ctdb_broken = "missing struct ctdb_control_tcp" | 
|---|
| 1670 |  | 
|---|
| 1671 | if have_cluster_support: | 
|---|
| 1672 | conf.CHECK_CODE(''' | 
|---|
| 1673 | #define NO_CONFIG_H | 
|---|
| 1674 | #include "replace.h" | 
|---|
| 1675 | #include "system/wait.h" | 
|---|
| 1676 | #include "system/network.h" | 
|---|
| 1677 | #include <talloc.h> | 
|---|
| 1678 | #include <tdb.h> | 
|---|
| 1679 | #include <ctdb.h> | 
|---|
| 1680 | #include <ctdb_private.h> | 
|---|
| 1681 |  | 
|---|
| 1682 | int main(void) | 
|---|
| 1683 | { | 
|---|
| 1684 | struct ctdb_control_tcp_addr _x; | 
|---|
| 1685 | return 0; | 
|---|
| 1686 | } | 
|---|
| 1687 | ''', | 
|---|
| 1688 | 'HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR', | 
|---|
| 1689 | addmain=False, | 
|---|
| 1690 | includes=includes, | 
|---|
| 1691 | msg='Checking for ctdb ipv6 support') | 
|---|
| 1692 |  | 
|---|
| 1693 | if have_cluster_support: | 
|---|
| 1694 | Logs.info("building with cluster support") | 
|---|
| 1695 | conf.DEFINE('CLUSTER_SUPPORT', 1); | 
|---|
| 1696 | else: | 
|---|
| 1697 | if not Options.options.with_cluster_support: | 
|---|
| 1698 | Logs.info("building without cluster support") | 
|---|
| 1699 | else: | 
|---|
| 1700 | Logs.warn("building without cluster support: " + ctdb_broken) | 
|---|
| 1701 | conf.undefine('CLUSTER_SUPPORT') | 
|---|
| 1702 |  | 
|---|
| 1703 |  | 
|---|
| 1704 |  | 
|---|
| 1705 | conf.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }', | 
|---|
| 1706 | 'HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR', | 
|---|
| 1707 | addmain=False, | 
|---|
| 1708 | link=False, | 
|---|
| 1709 | msg='Checking whether we can compile with __attribute__((destructor))') | 
|---|
| 1710 |  | 
|---|
| 1711 | conf.CHECK_CODE('void seekdir(DIR *d, long loc) { return; }', | 
|---|
| 1712 | 'SEEKDIR_RETURNS_VOID', | 
|---|
| 1713 | headers='sys/types.h dirent.h', | 
|---|
| 1714 | msg='Checking whether seekdir returns void') | 
|---|
| 1715 |  | 
|---|
| 1716 | if Options.options.with_profiling_data: | 
|---|
| 1717 | conf.DEFINE('WITH_PROFILE', 1); | 
|---|
| 1718 |  | 
|---|
| 1719 | PTHREAD_CFLAGS='error' | 
|---|
| 1720 | PTHREAD_LDFLAGS='error' | 
|---|
| 1721 |  | 
|---|
| 1722 | if PTHREAD_LDFLAGS == 'error': | 
|---|
| 1723 | if conf.CHECK_FUNCS_IN('pthread_attr_init', 'pthread'): | 
|---|
| 1724 | PTHREAD_CFLAGS='-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS' | 
|---|
| 1725 | PTHREAD_LDFLAGS='-lpthread' | 
|---|
| 1726 | if PTHREAD_LDFLAGS == 'error': | 
|---|
| 1727 | if conf.CHECK_FUNCS_IN('pthread_attr_init', 'pthreads'): | 
|---|
| 1728 | PTHREAD_CFLAGS='-D_THREAD_SAFE' | 
|---|
| 1729 | PTHREAD_LDFLAGS='-lpthreads' | 
|---|
| 1730 | if PTHREAD_LDFLAGS == 'error': | 
|---|
| 1731 | if conf.CHECK_FUNCS_IN('pthread_attr_init', 'c_r'): | 
|---|
| 1732 | PTHREAD_CFLAGS='-D_THREAD_SAFE -pthread' | 
|---|
| 1733 | PTHREAD_LDFLAGS='-pthread' | 
|---|
| 1734 | if PTHREAD_LDFLAGS == 'error': | 
|---|
| 1735 | if conf.CHECK_FUNC('pthread_attr_init'): | 
|---|
| 1736 | PTHREAD_CFLAGS='-D_REENTRANT' | 
|---|
| 1737 | PTHREAD_LDFLAGS='-lpthread' | 
|---|
| 1738 | # especially for HP-UX, where the CHECK_FUNC macro fails to test for | 
|---|
| 1739 | # pthread_attr_init. On pthread_mutex_lock it works there... | 
|---|
| 1740 | if PTHREAD_LDFLAGS == 'error': | 
|---|
| 1741 | if conf.CHECK_FUNCS_IN('pthread_mutex_lock', 'pthread'): | 
|---|
| 1742 | PTHREAD_CFLAGS='-D_REENTRANT' | 
|---|
| 1743 | PTHREAD_LDFLAGS='-lpthread' | 
|---|
| 1744 |  | 
|---|
| 1745 | if PTHREAD_CFLAGS != 'error' and PTHREAD_LDFLAGS != 'error': | 
|---|
| 1746 | conf.ADD_CFLAGS(PTHREAD_CFLAGS) | 
|---|
| 1747 | conf.ADD_LDFLAGS(PTHREAD_LDFLAGS) | 
|---|
| 1748 | conf.CHECK_HEADERS('pthread.h') | 
|---|
| 1749 | conf.DEFINE('HAVE_PTHREAD', '1') | 
|---|
| 1750 |  | 
|---|
| 1751 | if conf.CHECK_HEADERS('gpfs_gpl.h'): | 
|---|
| 1752 | conf.DEFINE('HAVE_GPFS', '1') | 
|---|
| 1753 |  | 
|---|
| 1754 | default_static_modules=TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam | 
|---|
| 1755 | auth_sam auth_unix auth_winbind auth_wbc auth_server | 
|---|
| 1756 | auth_domain auth_builtin vfs_default | 
|---|
| 1757 | nss_info_template idmap_tdb idmap_passdb | 
|---|
| 1758 | idmap_nss''') | 
|---|
| 1759 |  | 
|---|
| 1760 | default_shared_modules=TO_LIST('''vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk | 
|---|
| 1761 | vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap | 
|---|
| 1762 | vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850 | 
|---|
| 1763 | charset_CP437 auth_script vfs_readahead vfs_xattr_tdb | 
|---|
| 1764 | vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb | 
|---|
| 1765 | vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly | 
|---|
| 1766 | vfs_crossrename vfs_linux_xfs_sgid | 
|---|
| 1767 | vfs_time_audit idmap_autorid''') | 
|---|
| 1768 |  | 
|---|
| 1769 | if Options.options.developer: | 
|---|
| 1770 | default_static_modules.extend(TO_LIST('pdb_ads auth_netlogond')) | 
|---|
| 1771 | default_shared_modules.extend(TO_LIST('charset_weird perfcount_test')) | 
|---|
| 1772 |  | 
|---|
| 1773 | if Options.options.with_acl_support and conf.CONFIG_SET('HAVE_POSIX_ACLS'): | 
|---|
| 1774 | default_static_modules.extend(TO_LIST('vfs_posixacl')) | 
|---|
| 1775 |  | 
|---|
| 1776 | if conf.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'): | 
|---|
| 1777 | default_shared_modules.extend(TO_LIST('vfs_zfsacl')) | 
|---|
| 1778 |  | 
|---|
| 1779 | if conf.CONFIG_SET('HAVE_DIRFD_DECL'): | 
|---|
| 1780 | default_shared_modules.extend(TO_LIST('vfs_syncops vfs_dirsort')) | 
|---|
| 1781 |  | 
|---|
| 1782 | if conf.CONFIG_SET('HAVE_STATFS_F_FSID'): | 
|---|
| 1783 | default_shared_modules.extend(TO_LIST('vfs_fileid')) | 
|---|
| 1784 |  | 
|---|
| 1785 | if conf.CONFIG_SET('HAVE_AIO') and (conf.CONFIG_SET('HAVE_MSGHDR_MSG_CONTROL') or conf.CONFIG_SET('HAVE_MSGHDR_MSG_ACCTRIGHTS')): | 
|---|
| 1786 | default_shared_modules.extend(TO_LIST('vfs_aio_fork')) | 
|---|
| 1787 |  | 
|---|
| 1788 | if conf.CONFIG_SET('HAVE_LDAP'): | 
|---|
| 1789 | default_static_modules.extend(TO_LIST('pdb_ldap idmap_ldap')) | 
|---|
| 1790 |  | 
|---|
| 1791 | if conf.CONFIG_SET('DARWINOS'): | 
|---|
| 1792 | default_shared_modules.extend(TO_LIST('charset_macosxfs')) | 
|---|
| 1793 |  | 
|---|
| 1794 | if conf.CONFIG_SET('HAVE_GPFS'): | 
|---|
| 1795 | default_shared_modules.extend(TO_LIST('vfs_gpfs vfs_gpfs_hsm_notify')) | 
|---|
| 1796 |  | 
|---|
| 1797 | explicit_shared_modules = TO_LIST(Options.options.shared_modules, delimiter=',') | 
|---|
| 1798 | explicit_static_modules = TO_LIST(Options.options.static_modules, delimiter=',') | 
|---|
| 1799 |  | 
|---|
| 1800 | final_static_modules = default_static_modules | 
|---|
| 1801 | final_shared_modules = default_shared_modules | 
|---|
| 1802 |  | 
|---|
| 1803 | for m in explicit_static_modules: | 
|---|
| 1804 | if m in final_shared_modules: | 
|---|
| 1805 | final_shared_modules.remove(m) | 
|---|
| 1806 | final_static_modules.append(m) | 
|---|
| 1807 | for m in explicit_shared_modules: | 
|---|
| 1808 | if m in final_static_modules: | 
|---|
| 1809 | final_static_modules.remove(m) | 
|---|
| 1810 | final_shared_modules.append(m) | 
|---|
| 1811 |  | 
|---|
| 1812 | conf.env['static_modules'] = final_static_modules | 
|---|
| 1813 | conf.env['shared_modules'] = final_shared_modules | 
|---|
| 1814 |  | 
|---|
| 1815 | conf.DEFINE('STRING_STATIC_MODULES', ' '.join(final_static_modules), quote=True) | 
|---|
| 1816 |  | 
|---|
| 1817 | static_list = {} | 
|---|
| 1818 | shared_list = {} | 
|---|
| 1819 |  | 
|---|
| 1820 | prefixes = ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount'] | 
|---|
| 1821 | conf.env['MODULE_PREFIXES'] = prefixes | 
|---|
| 1822 | for p in prefixes: | 
|---|
| 1823 | for m in final_static_modules: | 
|---|
| 1824 | if m.find(p) == 0: | 
|---|
| 1825 | if not p in static_list: | 
|---|
| 1826 | static_list[p] = [] | 
|---|
| 1827 | static_list[p].append(m) | 
|---|
| 1828 | for m in final_shared_modules: | 
|---|
| 1829 | if m.find(p) == 0: | 
|---|
| 1830 | if not p in shared_list: | 
|---|
| 1831 | shared_list[p] = [] | 
|---|
| 1832 | shared_list[p].append(m) | 
|---|
| 1833 |  | 
|---|
| 1834 | for p in prefixes: | 
|---|
| 1835 | static_env = "%s_STATIC" % p.upper() | 
|---|
| 1836 | shared_env = "%s_SHARED" % p.upper() | 
|---|
| 1837 | conf.env[static_env] = [] | 
|---|
| 1838 | conf.env[shared_env] = [] | 
|---|
| 1839 | if p in static_list: | 
|---|
| 1840 | decl_list="" | 
|---|
| 1841 | for entry in static_list[p]: | 
|---|
| 1842 | decl_list += "extern NTSTATUS %s_init(void); " % entry | 
|---|
| 1843 | conf.env[static_env].append('%s' % entry) | 
|---|
| 1844 | decl_list = decl_list.rstrip() | 
|---|
| 1845 | conf.DEFINE('static_decl_%s' % p, decl_list) | 
|---|
| 1846 | conf.DEFINE('static_init_%s' % p, '{ %s_init(); }' % '_init();  '.join(static_list[p])) | 
|---|
| 1847 | else: | 
|---|
| 1848 | conf.DEFINE('static_decl_%s' % p, '') | 
|---|
| 1849 | conf.DEFINE('static_init_%s' % p, '{}') | 
|---|
| 1850 | if p in shared_list: | 
|---|
| 1851 | for entry in shared_list[p]: | 
|---|
| 1852 | conf.DEFINE('%s_init' % entry, 'init_samba_module') | 
|---|
| 1853 | conf.env[shared_env].append('%s' % entry) | 
|---|
| 1854 |  | 
|---|
| 1855 | conf.SAMBA_CONFIG_H('include/config.h') | 
|---|
| 1856 |  | 
|---|
| 1857 | def ctags(ctx): | 
|---|
| 1858 | "build 'tags' file using ctags" | 
|---|
| 1859 | import Utils | 
|---|
| 1860 | source_root = os.path.dirname(Utils.g_module.root_path) | 
|---|
| 1861 | cmd = 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root | 
|---|
| 1862 | print("Running: %s" % cmd) | 
|---|
| 1863 | os.system(cmd) | 
|---|
| 1864 |  | 
|---|
| 1865 | if not os.getenv('TOPLEVEL_BUILD'): | 
|---|
| 1866 | def wildcard_cmd(cmd): | 
|---|
| 1867 | '''called on a unknown command''' | 
|---|
| 1868 | from samba_wildcard import run_named_build_task | 
|---|
| 1869 | run_named_build_task(cmd) | 
|---|
| 1870 | def main(): | 
|---|
| 1871 | from samba_wildcard import wildcard_main | 
|---|
| 1872 | wildcard_main(wildcard_cmd) | 
|---|
| 1873 | Scripting.main = main | 
|---|