4 from waflib
import Logs
9 if conf
.CHECK_RESOLV_WRAPPER():
10 conf
.DEFINE('USING_SYSTEM_RESOLV_WRAPPER', 1)
11 libresolv_wrapper_so_path
= 'libresolv_wrapper.so'
14 if conf
.CONFIG_SET("HAVE___THREAD"):
15 conf
.DEFINE("HAVE_GCC_THREAD_LOCAL_STORAGE", 1)
17 # check HAVE_ATTRIBUTE_PRINTF_FORMAT
19 void log_fn(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
25 'HAVE_ATTRIBUTE_PRINTF_FORMAT',
28 msg
='Checking for printf format validation support')
30 conf
.CHECK_HEADERS('resolv.h')
32 conf
.CHECK_STRUCTURE_MEMBER('struct __res_state',
34 headers
='sys/socket.h netinet/in.h resolv.h',
35 define
='HAVE_RES_STATE_U_EXT_NSADDRS')
36 conf
.CHECK_STRUCTURE_MEMBER('union res_sockaddr_union',
38 headers
='sys/socket.h netinet/in.h resolv.h',
39 define
='HAVE_RES_SOCKADDR_UNION_SIN')
40 conf
.CHECK_STRUCTURE_MEMBER('union res_sockaddr_union',
42 headers
='sys/socket.h netinet/in.h resolv.h',
43 define
='HAVE_RES_SOCKADDR_UNION_SIN6')
45 conf
.CHECK_FUNCS_IN('res_ninit', 'resolv')
46 if conf
.CONFIG_SET('HAVE_RES_NINIT'):
47 conf
.DEFINE('HAVE_RES_NINIT_IN_LIBRESOLV', 1)
49 conf
.CHECK_FUNCS_IN('res_nclose', 'resolv')
50 if conf
.CONFIG_SET('HAVE_RES_NCLOSE'):
51 conf
.DEFINE('HAVE_RES_NCLOSE_IN_LIBRESOLV', 1)
53 # If we find res_nquery in libc, we can't do resolv.conf redirect
54 conf
.CHECK_FUNCS('res_nquery __res_nquery')
55 if (conf
.CONFIG_SET('HAVE_RES_NQUERY')
56 or conf
.CONFIG_SET('HAVE___RES_NQUERY')):
57 Logs
.warn("Detection for resolv_wrapper: "
58 "Only dns faking will be available")
60 if conf
.CHECK_FUNCS('res_nquery', lib
='resolv'):
61 conf
.DEFINE('HAVE_RESOLV_CONF_SUPPORT', 1)
62 if conf
.CHECK_FUNCS('__res_nquery', lib
='resolv'):
63 conf
.DEFINE('HAVE_RESOLV_CONF_SUPPORT', 1)
65 conf
.CHECK_FUNCS_IN('res_init __res_init', 'resolv', checklibc
=True)
66 conf
.CHECK_FUNCS_IN('res_ninit __res_ninit', 'resolv', checklibc
=True)
67 conf
.CHECK_FUNCS_IN('res_close __res_close', 'resolv', checklibc
=True)
68 conf
.CHECK_FUNCS_IN('res_nclose __res_nclose', 'resolv', checklibc
=True)
69 conf
.CHECK_FUNCS_IN('res_query __res_query', 'resolv', checklibc
=True)
70 conf
.CHECK_FUNCS_IN('res_nquery __res_nquery', 'resolv', checklibc
=True)
71 conf
.CHECK_FUNCS_IN('res_search __res_search', 'resolv', checklibc
=True)
72 conf
.CHECK_FUNCS_IN('res_nsearch __res_nsearch', 'resolv', checklibc
=True)
74 conf
.CHECK_DECLS('ns_name_compress', headers
='sys/types.h arpa/nameser.h')
75 if (conf
.CONFIG_SET("HAVE_DECL_NS_NAME_COMPRESS")):
76 conf
.DEFINE("HAVE_NS_NAME_COMPRESS", 1)
78 # Create full path to resolv_wrapper
79 blddir
= os
.path
.realpath(conf
.bldnode
.abspath())
80 libresolv_wrapper_so_path
= blddir
+ '/default/third_party/resolv_wrapper/libresolv-wrapper.so'
82 conf
.DEFINE('LIBRESOLV_WRAPPER_SO_PATH', libresolv_wrapper_so_path
)
83 conf
.DEFINE('RESOLV_WRAPPER', 1)
86 if bld
.CONFIG_SET("HAVE_RESOLV_H") and not bld
.CONFIG_SET("USING_SYSTEM_RESOLV_WRAPPER"):
87 # We need to do it this way or the library wont work.
88 # We need force_unversioned=True as symbol versioning
90 bld
.SAMBA_LIBRARY('resolv_wrapper',
91 source
='resolv_wrapper.c',
94 force_unversioned
=True,
95 realname
='libresolv-wrapper.so')