7 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
8 import wafsamba, Options
11 opt.recurse('../lib/replace')
12 opt.recurse('../lib/nss_wrapper')
13 opt.recurse('../lib/socket_wrapper')
14 opt.recurse('../lib/uid_wrapper')
17 conf.define('PACKAGE_NAME', 'Samba')
18 conf.define('PACKAGE_STRING', 'Samba 3')
19 conf.define('PACKAGE_TARNAME', 'samba')
20 conf.define('PACKAGE_URL', '')
21 conf.define('PACKAGE_VERSION', '3')
22 conf.define('PACKAGE_BUGREPORT', 'samba-technical@samba.org')
24 conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
25 conf.DEFINE('_SAMBA_BUILD_', 3, add_to_cflags=True)
26 conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
27 if Options.options.developer:
28 conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
30 # set a limit on recursing in the waf preprocessor
31 conf.env.preprocessor_recursion_limit = 10
33 conf.ADD_EXTRA_INCLUDES('#source3 #source3/include #lib/replace #lib/talloc #lib/tevent #source3/libaddns #source3/librpc')
35 conf.sub_config('../lib/replace')
36 conf.sub_config('../lib/nss_wrapper')
37 conf.sub_config('../lib/socket_wrapper')
38 conf.sub_config('../lib/uid_wrapper')
40 conf.CHECK_HEADERS('execinfo.h libexc.h libunwind.h')
42 conf.CHECK_FUNCS('getcwd fchown chmod fchmod mknod mknod64')
43 conf.CHECK_FUNCS('strtol strchr strupr chflags')
44 conf.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
45 conf.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
46 conf.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent')
47 conf.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
48 conf.CHECK_FUNCS('setpriv setgidx setuidx setgroups sysconf stat64 fstat64')
49 conf.CHECK_FUNCS('lstat64 fopen64 atexit grantpt lseek64 ftruncate64 posix_fallocate posix_fallocate64')
50 conf.CHECK_FUNCS('fseek64 fseeko64 ftell64 ftello64 setluid getpwanam')
51 conf.CHECK_FUNCS('opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64')
52 conf.CHECK_FUNCS('getpwent_r getdents64 setenv strcasecmp fcvt fcvtl')
53 conf.CHECK_FUNCS('syslog vsyslog timegm setlocale nl_langinfo')
54 #TODO convert AC_CHECK_FUNCS(nanosleep,,[AC_CHECK_LIB_EXT(rt, LIBS, nanosleep)])
55 conf.CHECK_FUNCS('lutimes futimes utimensat futimens')
56 conf.CHECK_FUNCS('mlock munlock mlockall munlockall')
57 conf.CHECK_FUNCS('memalign posix_memalign hstrerror')
58 conf.CHECK_FUNCS('shmget shm_open')
59 conf.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain')
61 # Check for inotify support
62 conf.CHECK_HEADERS('linux/inotify.h asm/unistd.h sys/inotify.h', add_headers=False)
63 conf.CHECK_FUNCS('inotify_init')
64 if "HAVE_LINUX_INOTIFY_H" in conf.env and "HAVE_INOTIFY_INIT" in conf.env:
65 conf.DEFINE('HAVE_INOTIFY', 1)
67 # Check for kernel change notify support
69 #include <sys/types.h>
76 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
77 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain=False, execute=True,
78 msg="Checking for kernel change notify support")
80 # Check for Linux kernel oplocks
82 #include <sys/types.h>
89 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
90 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain=False, execute=True,
91 msg="Checking for Linux kernel oplocks")
93 # Check for IRIX kernel oplock types
94 conf.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
95 'HAVE_KERNEL_OPLOCKS_IRIX', headers='sys/types.h fcntl.h',
96 msg="Checking for IRIX kernel oplock types")
98 # Check for krenel share modes
100 #include <sys/types.h>
103 #include <sys/file.h>
109 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
110 }''', 'HAVE_KERNEL_SHARE_MODES', addmain=False, execute=True,
111 msg="Checking for krenel share modes")
113 # Check for various members of the stat structure
114 conf.CHECK_TYPES('blksize_t blkcnt_t')
115 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define='HAVE_STAT_ST_BLOCKS',
116 headers='sys/types.h sys/stat.h unistd.h',)
117 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define='HAVE_STAT_ST_BLKSIZE',
118 headers='sys/types.h sys/stat.h unistd.h')
120 # Check for POSIX capability support
121 if "HAVE_SYS_CAPABILITY_H" in conf.env:
122 conf.CHECK_FUNCS_IN('cap_get_proc', 'cap')
124 #include <sys/types.h>
125 #include <sys/capability.h>
129 if (!(cap = cap_get_proc()))
132 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
135 }''', 'HAVE_POSIX_CAPABILITIES', addmain=False, execute=True, cflags="-lcap",
136 msg="Checking whether POSIX capabilities are available")
138 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
139 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
141 if "HAVE_RPC_RPC_H" in conf.env:
142 conf.CHECK_CODE('int16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
143 headers='sys/types.h rpc/rpc.h',
144 msg="Checking for int16 typedef included by rpc/rpc.h")
145 conf.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
146 headers='sys/types.h rpc/rpc.h',
147 msg="Checking for uint16 typedef included by rpc/rpc.h")
148 conf.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
149 headers='sys/types.h rpc/rpc.h',
150 msg="Checking for int32 typedef included by rpc/rpc.h")
151 conf.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
152 headers='sys/types.h rpc/rpc.h',
153 msg="Checking for uint32 typedef included by rpc/rpc.h")
156 conf.find_program('cups-config', var='CUPS_CONFIG')
157 if conf.env.CUPS_CONFIG:
158 conf.check_cfg(path="cups-config", args="--cflags --ldflags --libs", package="", uselib_store="CUPS")
159 conf.CHECK_HEADERS('cups/cups.h cups/language.h', add_headers=False)
162 conf.CHECK_HEADERS('ldap.h lber.h')
163 conf.CHECK_TYPE('ber_tag_t', 'unsigned int')
166 conf.find_program('krb5-config', var='KRB5_CONFIG')
167 if conf.env.KRB5_CONFIG:
168 conf.check_cfg(path="krb5-config", args="--cflags --libs",
169 package="gssapi", uselib_store="KRB5")
170 conf.CHECK_HEADERS('krb5.h krb5/locate_plugin.h')
171 conf.CHECK_HEADERS('gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h com_err.h')
173 conf.SAMBA_CONFIG_H('include/config.h')