7 opt.tool_options('compiler_cc')
8 opt.add_option('--disable-rpath',
9 help=("Disable use of rpath"),
10 action="store_true", dest='disable_rpath', default=False)
15 # load our local waf extensions
16 conf.check_tool('wafsamba', tooldir=conf.curdir)
18 conf.check_tool('compiler_cc')
19 conf.DEFUN('_GNU_SOURCE', 1)
20 conf.DEFUN('_XOPEN_SOURCE_EXTENDED', 1)
21 conf.DEFUN('LIBREPLACE_NETWORK_CHECKS', 1)
23 conf.CHECK_HEADERS('unistd.h sys/types.h stdlib.h stdio.h')
24 conf.CHECK_HEADERS('sys/wait.h sys/stat.h malloc.h grp.h')
25 conf.CHECK_HEADERS('crypt.h dlfcn.h dl.h standards.h stdbool.h stdint.h')
26 conf.CHECK_HEADERS('sys/select.h setjmp.h utime.h sys/syslog.h syslog.h')
27 conf.CHECK_HEADERS('sys/time.h time.h stdarg.h vararg.h sys/mount.h mntent.h')
28 conf.CHECK_HEADERS('stropts.h unix.h string.h strings.h sys/param.h limits.h')
29 conf.CHECK_HEADERS('sys/socket.h netinet/in.h netdb.h arpa/inet.h netinet/in_systm.h')
30 conf.CHECK_HEADERS('netinet/ip.h netinet/tcp.h netinet/in_ip.h sys/sockio.h sys/un.h')
31 conf.CHECK_HEADERS('sys/uio.h ifaddrs.h direct.h dirent.h')
32 conf.CHECK_HEADERS('windows.h winsock2.h ws2tcpip.h')
34 conf.check(type_name='long long')
35 conf.CHECK_TYPES('intptr_t uintptr_t ptrdiff_t')
36 conf.CHECK_TYPES('comparison_fn_t socklen_t bool')
38 conf.CHECK_TYPE('int8_t', 'char')
39 conf.CHECK_TYPE('int16_t', 'short')
40 conf.CHECK_TYPE('uint16_t', 'unsigned short')
41 conf.CHECK_TYPE('int32_t', 'int')
42 conf.CHECK_TYPE('uint32_t', 'unsigned')
43 conf.CHECK_TYPE('int64_t', 'long long')
44 conf.CHECK_TYPE('uint64_t', 'unsigned long long')
45 conf.CHECK_TYPE('size_t', 'unsigned int')
46 conf.CHECK_TYPE('ssize_t', 'int')
47 conf.CHECK_TYPE('ino_t', 'unsigned')
48 conf.CHECK_TYPE('loff_t', 'off_t')
49 conf.CHECK_TYPE('bool', 'off_t')
51 conf.CHECK_TYPE_IN('struct ifaddrs', 'ifaddrs.h')
52 conf.CHECK_TYPE_IN('struct addrinfo', 'netdb.h')
53 conf.CHECK_TYPE_IN('struct sockaddr', 'sys/socket.h')
55 conf.CHECK_FUNCS('shl_load shl_unload shl_findsym')
56 conf.CHECK_FUNCS('pipe strftime srandom random srand rand usleep setbuffer')
57 conf.CHECK_FUNCS('lstat getpgrp utime utimes seteuid setresuid setegid')
58 conf.CHECK_FUNCS('setresgid chroot bzero strerror vsyslog setlinebuf mktime')
59 conf.CHECK_FUNCS('ftruncate chsize rename waitpid wait4 strlcpy strlcat')
60 conf.CHECK_FUNCS('initgroups memmove strdup pread pwrite strndup strcasestr')
61 conf.CHECK_FUNCS('strtok_r mkdtemp dup2 dprintf vdprintf isatty chown lchown')
62 conf.CHECK_FUNCS('link readlink symlink realpath fdatasync snprintf vsnprintf')
63 conf.CHECK_FUNCS('asprintf vasprintf setenv unsetenv strnlen strtoull __strtoull')
64 conf.CHECK_FUNCS('strtouq strtoll __strtoll strtoq memmem printf memset memcpy')
65 conf.CHECK_FUNCS('connect gethostbyname if_nametoindex socketpair')
66 conf.CHECK_FUNCS('inet_ntoa inet_ntop dirfd getdirentries getdents syslog')
67 conf.CHECK_FUNCS('timegm getifaddrs freeifaddrs')
69 conf.CHECK_FUNCS_IN('dlopen dlsym dlerror dlclose', 'dl')
71 # we could also put code fragments like this in separate files,
72 # for example in test/snprintf.c
73 conf.check_cc(fragment='''
74 #include <sys/types.h>
78 void foo(const char *format, ...) {
82 long long l = 1234567890;
86 len = vsnprintf(buf, 0, format, ap);
88 if (len != 5) exit(1);
91 len = vsnprintf(0, 0, format, ap);
93 if (len != 5) exit(2);
95 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(3);
97 if (snprintf(buf, 20, "%lld", l) != 12 || strcmp(buf, "123456789000") != 0) exit(4);
98 if (snprintf(buf, 20, "%zu", 123456789) != 9 || strcmp(buf, "123456789") != 0) exit(5);
99 if (snprintf(buf, 20, "%2\$d %1\$d", 3, 4) != 3 || strcmp(buf, "4 3") != 0) exit(6);
100 if (snprintf(buf, 20, "%s", 0) < 3) exit(7);
105 main() { foo("hello"); }
107 define_name="HAVE_C99_VSNPRINTF",
111 msg="Checking for C99 vsnprintf")
113 conf.write_config_header('config.h')
118 REPLACE_SOURCE = 'replace.c snprintf.c'
120 bld.SAMBA_LIBRARY('replace',
123 TEST_SOURCES = '''test/testsuite.c test/main.c test/strptime.c
124 test/os2_delete.c test/getifaddrs.c'''
126 bld.SAMBA_BINARY('replace_testsuite',