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')
51 conf.CHECK_FUNCS('getpwanam', headers='sys/types.h pwd.h')
52 conf.CHECK_FUNCS('opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64')
53 conf.CHECK_FUNCS('getpwent_r getdents64 setenv strcasecmp fcvt fcvtl')
54 conf.CHECK_FUNCS('syslog vsyslog timegm setlocale nl_langinfo')
55 conf.CHECK_FUNCS_IN('nanosleep', 'rt')
56 conf.CHECK_FUNCS('lutimes futimes utimensat futimens')
57 conf.CHECK_FUNCS('mlock munlock mlockall munlockall')
58 conf.CHECK_FUNCS('memalign posix_memalign hstrerror')
59 conf.CHECK_FUNCS('shmget')
60 conf.CHECK_FUNCS_IN('shm_open', 'rt', checklibc=True)
61 conf.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain')
63 # Check for inotify support
64 conf.CHECK_HEADERS('linux/inotify.h asm/unistd.h sys/inotify.h')
65 conf.CHECK_FUNCS('inotify_init')
66 if "HAVE_LINUX_INOTIFY_H" in conf.env and "HAVE_INOTIFY_INIT" in conf.env:
67 conf.DEFINE('HAVE_INOTIFY', 1)
69 # Check for kernel change notify support
71 #include <sys/types.h>
78 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
79 }''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain=False, execute=True,
80 msg="Checking for kernel change notify support")
82 # Check for Linux kernel oplocks
84 #include <sys/types.h>
91 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
92 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain=False, execute=True,
93 msg="Checking for Linux kernel oplocks")
95 # Check for IRIX kernel oplock types
96 conf.CHECK_CODE('oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;',
97 'HAVE_KERNEL_OPLOCKS_IRIX', headers='sys/types.h fcntl.h',
98 msg="Checking for IRIX kernel oplock types")
100 # Check for krenel share modes
102 #include <sys/types.h>
105 #include <sys/file.h>
111 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
112 }''', 'HAVE_KERNEL_SHARE_MODES', addmain=False, execute=True,
113 msg="Checking for krenel share modes")
115 # Check for various members of the stat structure
116 conf.CHECK_TYPES('blksize_t blkcnt_t')
117 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define='HAVE_STAT_ST_BLOCKS',
118 headers='sys/types.h sys/stat.h unistd.h',)
119 conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blksize', define='HAVE_STAT_ST_BLKSIZE',
120 headers='sys/types.h sys/stat.h unistd.h')
122 # Check for POSIX capability support
123 if "HAVE_SYS_CAPABILITY_H" in conf.env:
124 conf.CHECK_FUNCS_IN('cap_get_proc', 'cap')
126 #include <sys/types.h>
127 #include <sys/capability.h>
131 if (!(cap = cap_get_proc()))
134 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
137 }''', 'HAVE_POSIX_CAPABILITIES', addmain=False, execute=True, lib="cap",
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 "HAVE_RPC_RPC_H" in conf.env:
144 conf.CHECK_CODE('int16 testvar;', 'HAVE_INT16_FROM_RPC_RPC_H',
145 headers='sys/types.h 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')
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')
182 conf.CHECK_HEADERS('gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h com_err.h')
184 conf.SAMBA_CONFIG_H('include/config.h')