samba-tool group show: only shows global security groups, this patch makes it show...
[bbaumbach/samba-autobuild/.git] / third_party / resolv_wrapper / wscript
1 #!/usr/bin/env python
2
3 import os
4
5 VERSION="1.1.6"
6
7 def configure(conf):
8     if conf.CHECK_RESOLV_WRAPPER():
9         conf.DEFINE('USING_SYSTEM_RESOLV_WRAPPER', 1)
10         libresolv_wrapper_so_path = 'libresolv_wrapper.so'
11     else:
12
13         if conf.CONFIG_SET("HAVE___THREAD"):
14             conf.DEFINE("HAVE_GCC_THREAD_LOCAL_STORAGE", 1)
15
16         # check HAVE_ATTRIBUTE_PRINTF_FORMAT
17         conf.CHECK_CODE('''
18             void log_fn(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
19
20             int main(void) {
21                 return 0;
22             }
23             ''',
24             'HAVE_ATTRIBUTE_PRINTF_FORMAT',
25             addmain=False,
26             strict=True,
27             msg='Checking for printf format validation support')
28
29         conf.CHECK_HEADERS('resolv.h')
30
31         conf.CHECK_STRUCTURE_MEMBER('struct __res_state',
32                                     '_u._ext.nsaddrs',
33                                     headers='sys/socket.h netinet/in.h resolv.h',
34                                     define='HAVE_RES_STATE_U_EXT_NSADDRS')
35         conf.CHECK_STRUCTURE_MEMBER('union res_sockaddr_union',
36                                     'sin',
37                                     headers='sys/socket.h netinet/in.h resolv.h',
38                                     define='HAVE_RES_SOCKADDR_UNION_SIN')
39         conf.CHECK_STRUCTURE_MEMBER('union res_sockaddr_union',
40                                     'sin6',
41                                     headers='sys/socket.h netinet/in.h resolv.h',
42                                     define='HAVE_RES_SOCKADDR_UNION_SIN6')
43
44         conf.CHECK_FUNCS_IN('res_ninit', 'resolv')
45         if conf.CONFIG_SET('HAVE_RES_NINIT'):
46             conf.DEFINE('HAVE_RES_NINIT_IN_LIBRESOLV', 1)
47
48         conf.CHECK_FUNCS_IN('res_nclose', 'resolv')
49         if conf.CONFIG_SET('HAVE_RES_NCLOSE'):
50             conf.DEFINE('HAVE_RES_NCLOSE_IN_LIBRESOLV', 1)
51
52         conf.CHECK_FUNCS_IN('res_init __res_init', 'resolv', checklibc=True)
53         conf.CHECK_FUNCS_IN('res_ninit __res_ninit', 'resolv', checklibc=True)
54         conf.CHECK_FUNCS_IN('res_close __res_close', 'resolv', checklibc=True)
55         conf.CHECK_FUNCS_IN('res_nclose __res_nclose', 'resolv', checklibc=True)
56         conf.CHECK_FUNCS_IN('res_query __res_query', 'resolv', checklibc=True)
57         conf.CHECK_FUNCS_IN('res_nquery __res_nquery', 'resolv', checklibc=True)
58         conf.CHECK_FUNCS_IN('res_search __res_search', 'resolv', checklibc=True)
59         conf.CHECK_FUNCS_IN('res_nsearch __res_nsearch', 'resolv', checklibc=True)
60
61         conf.CHECK_DECLS('ns_name_compress', headers='sys/types.h arpa/nameser.h')
62         if (conf.CONFIG_SET("HAVE_DECL_NS_NAME_COMPRESS")):
63             conf.DEFINE("HAVE_NS_NAME_COMPRESS", 1)
64
65         # Create full path to resolv_wrapper
66         blddir = os.path.realpath(conf.bldnode.abspath())
67         libresolv_wrapper_so_path = blddir + '/default/third_party/resolv_wrapper/libresolv-wrapper.so'
68
69     conf.DEFINE('LIBRESOLV_WRAPPER_SO_PATH', libresolv_wrapper_so_path)
70     conf.DEFINE('RESOLV_WRAPPER', 1)
71
72 def build(bld):
73     if bld.CONFIG_SET("HAVE_RESOLV_H") and not bld.CONFIG_SET("USING_SYSTEM_RESOLV_WRAPPER"):
74         # We need to do it this way or the library wont work.
75         # Using private_library=True will add symbol version which
76         # breaks preloading!
77         bld.SAMBA_LIBRARY('resolv_wrapper',
78                           source='resolv_wrapper.c',
79                           deps='dl resolv',
80                           install=False,
81                           realname='libresolv-wrapper.so')