dcesrv_core: Add dcesrv_context_set_callbacks()
[Samba.git] / third_party / socket_wrapper / wscript
blob15ceefd168df3c86538f790f8736536fe58c229d
1 #!/usr/bin/env python
3 import os
5 VERSION="1.3.3"
7 def configure(conf):
8 if conf.CHECK_SOCKET_WRAPPER():
9 conf.DEFINE('USING_SYSTEM_SOCKET_WRAPPER', 1)
10 libsocket_wrapper_so_path = 'libsocket_wrapper.so'
11 else:
13 if conf.CONFIG_SET("HAVE___THREAD"):
14 conf.DEFINE("HAVE_GCC_THREAD_LOCAL_STORAGE", 1)
16 # check HAVE_FUNCTION_ATTRIBUTE_FORMAT
17 conf.CHECK_CODE('''
18 void log_fn(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
20 int main(void) {
21 return 0;
23 ''',
24 'HAVE_FUNCTION_ATTRIBUTE_FORMAT',
25 addmain=False,
26 strict=True,
27 msg='Checking for printf format validation support')
29 conf.CHECK_HEADERS('sys/signalfd.h')
30 conf.CHECK_HEADERS('sys/eventfd.h')
31 conf.CHECK_HEADERS('sys/timerfd.h')
32 conf.CHECK_HEADERS('gnu/lib-names.h')
33 conf.CHECK_HEADERS('rpc/rpc.h')
34 conf.CHECK_HEADERS('netinet/tcp_fsm.h')
36 conf.CHECK_STRUCTURE_MEMBER('struct msghdr',
37 'msg_control',
38 headers='sys/types.h sys/socket.h',
39 define='HAVE_STRUCT_MSGHDR_MSG_CONTROL')
41 conf.CHECK_STRUCTURE_MEMBER('struct in_pktinfo',
42 'ipi_addr',
43 headers='sys/types.h sys/socket.h netinet/in.h',
44 define='HAVE_STRUCT_IN_PKTINFO')
46 conf.CHECK_STRUCTURE_MEMBER('struct in6_pktinfo',
47 'ipi6_addr',
48 headers='sys/types.h sys/socket.h netinet/in.h',
49 define='HAVE_STRUCT_IN6_PKTINFO')
51 conf.CHECK_FUNCS('getaddrinfo')
52 conf.CHECK_FUNCS('signalfd eventfd timerfd_create')
53 conf.CHECK_FUNCS('bindresvport')
54 conf.CHECK_FUNCS('pledge')
55 conf.CHECK_FUNCS('accept4')
56 conf.CHECK_FUNCS('__close_nocancel')
58 conf.CHECK_FUNCS_IN('bind',
59 'socket',
60 checklibc=True,
61 headers='sys/types.h sys/socket.h')
63 conf.CHECK_C_PROTOTYPE('accept',
64 'int accept(int s, struct sockaddr *addr, Psocklen_t addrlen)',
65 define='HAVE_ACCEPT_PSOCKLEN_T', headers='sys/types.h sys/socket.h')
67 conf.CHECK_C_PROTOTYPE('ioctl',
68 'int ioctl(int s, int r, ...)',
69 define='HAVE_IOCTL_INT', headers='unistd.h sys/ioctl.h')
71 if conf.CONFIG_SET("HAVE_EVENTFD"):
72 conf.CHECK_C_PROTOTYPE('eventfd',
73 'int eventfd(unsigned int count, int flags)',
74 define='HAVE_EVENTFD_UNSIGNED_INT', headers='sys/eventfd.h')
76 # FreeBSD exports each syscall also with '_' as prefix
77 # and these symbols are used if called by system libraries itself.
78 # That means socket_wrapper needs to implement these too
79 # in order to inject itself into system libraries,
80 # we just check for _socket and _close and assume the rest
81 # is also there...
82 conf.CHECK_FUNCS('_socket _close')
84 # Create full path to socket_wrapper
85 blddir = os.path.realpath(conf.bldnode.abspath())
86 libsocket_wrapper_so_path = blddir + '/default/third_party/socket_wrapper/libsocket-wrapper.so'
88 conf.DEFINE('LIBSOCKET_WRAPPER_SO_PATH', libsocket_wrapper_so_path)
89 conf.DEFINE('SOCKET_WRAPPER', 1)
91 def build(bld):
92 if not bld.CONFIG_SET("USING_SYSTEM_SOCKET_WRAPPER"):
93 # We need to do it this way or the library wont work.
94 # Using private_library=True will add symbol version which
95 # breaks preloading!
96 bld.SAMBA_LIBRARY('socket_wrapper',
97 source='socket_wrapper.c',
98 cflags='-D%s="%s" -D%s="%s"' % (
99 "SOCKET_WRAPPER_PACKAGE",
100 "samba_socket_wrapper",
101 "SOCKET_WRAPPER_VERSION",
102 VERSION),
103 deps='dl pthread tirpc',
104 install=False,
105 realname='libsocket-wrapper.so')