build: Check for functions needed by Samba3
[Samba/bb.git] / source3 / wscript
blob118af2bb78c30fa11f68aa97a328c97483bdca47
1 #! /usr/bin/env python
3 srcdir = '..'
4 blddir = 'bin'
6 import sys, os
7 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
8 import wafsamba, Options
10 def set_options(opt):
11 opt.recurse('../lib/replace')
12 opt.recurse('../lib/nss_wrapper')
13 opt.recurse('../lib/socket_wrapper')
14 opt.recurse('../lib/uid_wrapper')
16 def configure(conf):
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
68 conf.CHECK_CODE('''
69 #include <sys/types.h>
70 #include <fcntl.h>
71 #include <signal.h>
72 #ifndef F_NOTIFY
73 #define F_NOTIFY 1026
74 #endif
75 main() {
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
81 conf.CHECK_CODE('''
82 #include <sys/types.h>
83 #include <fcntl.h>
84 #include <signal.h>
85 #ifndef F_NOTIFY
86 #define F_NOTIFY 1026
87 #endif
88 main() {
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
99 conf.CHECK_CODE('''
100 #include <sys/types.h>
101 #include <fcntl.h>
102 #include <signal.h>
103 #include <sys/file.h>
104 #ifndef LOCK_MAND
105 #define LOCK_MAND 32
106 #define LOCK_READ 64
107 #endif
108 main() {
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 # Look for CUPS
114 conf.find_program('cups-config', var='CUPS_CONFIG')
115 if conf.env.CUPS_CONFIG:
116 conf.check_cfg(path="cups-config", args="--cflags --ldflags --libs", package="", uselib_store="CUPS")
117 conf.CHECK_HEADERS('cups/cups.h cups/language.h', add_headers=False)
119 # Check for LDAP
120 conf.CHECK_HEADERS('ldap.h lber.h')
121 conf.CHECK_TYPE('ber_tag_t', 'unsigned int')
123 # Check for kerberos
124 conf.find_program('krb5-config', var='KRB5_CONFIG')
125 if conf.env.KRB5_CONFIG:
126 conf.check_cfg(path="krb5-config", args="--cflags --libs",
127 package="gssapi", uselib_store="KRB5")
128 conf.CHECK_HEADERS('krb5.h krb5/locate_plugin.h')
129 conf.CHECK_HEADERS('gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h com_err.h')
131 conf.SAMBA_CONFIG_H('include/config.h')