7 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
8 import wafsamba, Options
12 opt.recurse('../lib/replace')
14 opt.recurse('../lib/nss_wrapper')
15 opt.recurse('../lib/socket_wrapper')
16 opt.recurse('../lib/uid_wrapper')
19 conf.define('PACKAGE_NAME', 'Samba')
20 conf.define('PACKAGE_STRING', 'Samba 3')
21 conf.define('PACKAGE_TARNAME', 'samba')
22 conf.define('PACKAGE_URL', '')
23 conf.define('PACKAGE_VERSION', '3')
24 conf.define('PACKAGE_BUGREPORT', 'samba-technical@samba.org')
26 conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
27 conf.DEFINE('_SAMBA_BUILD_', 3, add_to_cflags=True)
28 conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
29 if Options.options.developer:
30 conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
32 # set a limit on recursing in the waf preprocessor
33 conf.env.preprocessor_recursion_limit = 10
35 conf.ADD_EXTRA_INCLUDES('#source3 #source3/include #lib/replace #lib/talloc #lib/tevent #source3/libaddns #source3/librpc')
37 conf.sub_config('../lib/replace')
38 conf.sub_config('build')
39 conf.sub_config('../lib/tdb')
40 conf.sub_config('../lib/talloc')
41 conf.sub_config('../lib/tevent')
42 conf.sub_config('../lib/nss_wrapper')
43 conf.sub_config('../lib/socket_wrapper')
44 conf.sub_config('../lib/uid_wrapper')
46 conf.CHECK_HEADERS('execinfo.h libexc.h libunwind.h')
48 conf.CHECK_FUNCS('getcwd fchown chmod fchmod mknod mknod64')
49 conf.CHECK_FUNCS('strtol strchr strupr chflags')
50 conf.CHECK_FUNCS('getrlimit fsync fdatasync setpgid')
51 conf.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')
52 conf.CHECK_FUNCS('sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent')
53 conf.CHECK_FUNCS('initgroups select poll rdchk getgrnam getgrent pathconf')
54 conf.CHECK_FUNCS('setpriv setgidx setuidx setgroups sysconf stat64 fstat64')
55 conf.CHECK_FUNCS('lstat64 fopen64 atexit grantpt lseek64 ftruncate64 posix_fallocate posix_fallocate64')
56 conf.CHECK_FUNCS('fseek64 fseeko64 ftell64 ftello64 setluid')
57 conf.CHECK_FUNCS('getpwnam', headers='sys/types.h pwd.h')
58 conf.CHECK_FUNCS('opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64')
59 conf.CHECK_FUNCS('getpwent_r getdents64 setenv strcasecmp fcvt fcvtl')
60 conf.CHECK_FUNCS('syslog vsyslog timegm setlocale nl_langinfo')
61 conf.CHECK_FUNCS_IN('nanosleep', 'rt')
62 conf.CHECK_FUNCS('lutimes futimes utimensat futimens')
63 conf.CHECK_FUNCS('mlock munlock mlockall munlockall')
64 conf.CHECK_FUNCS('memalign posix_memalign hstrerror')
65 conf.CHECK_FUNCS('shmget')
66 conf.CHECK_FUNCS_IN('shm_open', 'rt', checklibc=True)
67 conf.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain')
69 # Check for inotify support
70 conf.CHECK_HEADERS('linux/inotify.h asm/unistd.h sys/inotify.h')
71 conf.CHECK_FUNCS('inotify_init')
72 if "HAVE_LINUX_INOTIFY_H" in conf.env and "HAVE_INOTIFY_INIT" in conf.env:
73 conf.DEFINE('HAVE_INOTIFY', 1)
75 # Check for kernel change notify support
81 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
82 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain=False, execute=True,
83 headers='fcntl.h signal.h',
84 msg="Checking for kernel change notify support")
86 # Check for Linux kernel oplocks
88 #include <sys/types.h>
95 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
96 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain=False, execute=True,
97 msg="Checking for Linux kernel oplocks")
99 # Check for IRIX kernel oplock types
100 conf.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
101 'HAVE_KERNEL_OPLOCKS_IRIX', headers='fcntl.h',
102 msg="Checking for IRIX kernel oplock types")
104 # Check for krenel share modes
106 #include <sys/types.h>
109 #include <sys/file.h>
115 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
116 }''', 'HAVE_KERNEL_SHARE_MODES', addmain=False, execute=True,
117 msg="Checking for krenel share modes")
119 # Check for various members of the stat structure
120 conf.CHECK_TYPES('blksize_t blkcnt_t')
121 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define='HAVE_STAT_ST_BLOCKS',
122 headers='sys/stat.h')
123 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define='HAVE_STAT_ST_BLKSIZE',
124 headers='sys/stat.h')
126 # Check for POSIX capability support
127 if "HAVE_SYS_CAPABILITY_H" in conf.env:
128 conf.CHECK_FUNCS_IN('cap_get_proc', 'cap')
132 if (!(cap = cap_get_proc())) exit(1);
134 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
135 cap_set_proc(cap);''',
136 'HAVE_POSIX_CAPABILITIES', execute=True, lib="cap",
137 headers='sys/capability.h',
138 msg="Checking whether POSIX capabilities are available")
140 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from
141 # rpc/rpc.h. This is *really* broken but some systems (DEC OSF1) do this.
143 if conf.CONFIG_SET("HAVE_RPC_RPC_H"):
144 conf.CHECK_TYPE('int16', headers='rpc/rpc.h',
145 define='HAVE_INT16_FROM_RPC_RPC_H',
146 msg="Checking for int16 typedef included by rpc/rpc.h")
147 conf.CHECK_CODE('uint16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
148 headers='sys/types.h rpc/rpc.h',
149 msg="Checking for uint16 typedef included by rpc/rpc.h")
150 conf.CHECK_CODE('int32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
151 headers='sys/types.h rpc/rpc.h',
152 msg="Checking for int32 typedef included by rpc/rpc.h")
153 conf.CHECK_CODE('uint32 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
154 headers='sys/types.h rpc/rpc.h',
155 msg="Checking for uint32 typedef included by rpc/rpc.h")
157 # Check if the compiler will optimize out functions
160 this_function_does_not_exist();
163 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
164 msg="Checking if the compiler will optimize out functions")
167 conf.find_program('cups-config', var='CUPS_CONFIG')
168 if conf.env.CUPS_CONFIG:
169 conf.check_cfg(path="cups-config", args="--cflags --ldflags --libs", package="", uselib_store="CUPS")
170 conf.CHECK_HEADERS('cups/cups.h cups/language.h', lib='CUPS')
173 conf.CHECK_HEADERS('ldap.h lber.h')
174 conf.CHECK_TYPE('ber_tag_t', 'unsigned int', headers='ldap.h lber.h')
177 conf.find_program('krb5-config', var='KRB5_CONFIG')
178 if conf.env.KRB5_CONFIG:
179 conf.check_cfg(path="krb5-config", args="--cflags --libs",
180 package="gssapi", uselib_store="KRB5")
181 conf.CHECK_HEADERS('krb5.h krb5/locate_plugin.h', lib='KRB5')
182 conf.CHECK_HEADERS('gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h com_err.h', lib='KRB5')
185 _acl __acl add_proplist_entry atexit attr_getf attr_list attr_listf
186 attropen attr_remove attr_removef attr_set attr_setf backtrace_symbols
187 bindtextdomain _chdir __chdir chflags chmod _close __close _closedir
188 __closedir closedir64 creat64 crypt16 delproplist devnm dgettext dirfd
189 DNSServiceRegister _dup __dup _dup2 __dup2 endmntent endnetgrent execl
190 extattr_delete_fd extattr_delete_link extattr_get_fd extattr_get_file
191 extattr_get_link extattr_list_fd extattr_list_file extattr_list_link
192 extattr_set_fd extattr_set_file extattr_set_link _facl __facl _fchdir
193 __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
194 fdelproplist fgetea fgetproplist fgetxattr flistea flistxattr fopen64
195 _fork __fork fremoveea fremovexattr fseek64 fseeko64 fsetea
196 fsetproplist fsetxattr _fstat __fstat fstat64 _fstat64 __fstat64 fsync
197 ftell64 ftello64 ftruncate64 futimens futimes __fxstat getauthuid
198 getcwd _getcwd __getcwd getdents __getdents getdents64 getdirentries
199 getgrent getgrnam getgrouplist getmntent getnetgrent getpagesize
200 getproplist get_proplist_entry getpwanam getpwent_r getrlimit gettext
201 getutmpx getutxent glob grantpt hstrerror initgroups innetgr
202 inotify_init lgetea lgetxattr listea listxattr llistea llistxattr
203 llseek _llseek __llseek lremoveea lremovexattr _lseek __lseek lseek64
204 lsetea lsetxattr _lstat __lstat lstat64 _lstat64 __lstat64 lutimes
205 __lxstat memalign mknod mknod64 mlock mlockall munlock munlockall
206 nl_langinfo _open __open open64 _open64 __open64 _opendir __opendir
207 opendir64 pathconf poll posix_fallocate posix_fallocate64
208 posix_memalign prctl pread _pread __pread pread64 _pread64 __pread64
209 pututline pututxline pwrite _pwrite __pwrite pwrite64 _pwrite64
210 __pwrite64 rdchk _read __read _readdir __readdir readdir64 _readdir64
211 __readdir64 removeea removexattr rewinddir64 _seekdir __seekdir
212 seekdir64 select setea setenv setgidx setgroups setlocale setluid
213 setmntent setnetgrent setpgid setpriv setproplist setsid setuidx
214 setxattr shmget shm_open sigaction sigblock sigprocmask sigset
215 sizeof_proplist_entry _stat __stat stat64 _stat64 __stat64 statvfs
216 strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctlbyname
217 __sys_llseek syslog _telldir __telldir telldir64 textdomain timegm
218 updwtmp updwtmpx utimensat vsyslog _write __write __xstat
219 yp_get_default_domain
222 conf.CHECK_TYPE('struct timespec', headers='sys/time.h time.h')
224 conf.CHECK_SAMBA3_CHARSET() # see build/charset.py
226 conf.SAMBA_CONFIG_H('include/config.h')