librpc:ndr: Don’t unnecessarily parenthesize macro arguments
[Samba.git] / third_party / nss_wrapper / wscript
blob178e4e16eef31f872098463747d081b0be6b654b
1 #!/usr/bin/env python
3 import os
5 VERSION="1.1.15"
7 def configure(conf):
8 if conf.CHECK_NSS_WRAPPER():
9 conf.DEFINE('USING_SYSTEM_NSS_WRAPPER', 1)
10 libnss_wrapper_so_path = 'libnss_wrapper.so'
11 else:
12 conf.CHECK_HEADERS('nss.h')
14 if conf.CONFIG_SET("HAVE___THREAD"):
15 conf.DEFINE("HAVE_GCC_THREAD_LOCAL_STORAGE", 1)
17 # check HAVE_ATTRIBUTE_PRINTF_FORMAT
18 conf.CHECK_CODE('''
19 void log_fn(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
21 int main(void) {
22 return 0;
24 ''',
25 'HAVE_ATTRIBUTE_PRINTF_FORMAT',
26 addmain=False,
27 strict=True,
28 msg='Checking for printf format validation support')
30 conf.CHECK_FUNCS('gethostbyaddr_r gethostbyname_r')
31 conf.CHECK_FUNCS('gethostbyname2 gethostbyname2_r')
32 # Solaris
33 conf.CHECK_FUNCS('__posix_getpwnam_r __posix_getpwuid_r')
34 conf.CHECK_FUNCS('__posix_getgrgid_r __posix_getgrnam_r')
36 conf.CHECK_LIB('nsl socket')
37 conf.CHECK_FUNCS_IN('gethostname',
38 'nsl',
39 checklibc=True,
40 headers='unistd.h')
42 # Prototype checks
43 conf.CHECK_C_PROTOTYPE('getpwent_r',
44 'struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)',
45 define='HAVE_SOLARIS_GETPWENT_R', headers='unistd.h pwd.h')
46 conf.CHECK_C_PROTOTYPE('getpwnam_r',
47 'int getpwnam_r(const char *name, struct passwd *pwd, char *buf, int buflen, struct passwd **ppwd)',
48 define='HAVE_SOLARIS_GETPWNAM_R', headers='unistd.h pwd.h')
49 conf.CHECK_C_PROTOTYPE('getpwuid_r',
50 'int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, int buflen, struct passwd **ppwd)',
51 define='HAVE_SOLARIS_GETPWUID_R', headers='unistd.h pwd.h')
52 conf.CHECK_C_PROTOTYPE('getgrent_r',
53 'struct group *getgrent_r(struct group *src, char *buf, int buflen)',
54 define='HAVE_SOLARIS_GETGRENT_R', headers='unistd.h grp.h')
55 conf.CHECK_C_PROTOTYPE('getgrnam_r',
56 'int getgrnam_r(const char *name, struct group *grp, char *buf, int buflen, struct group **pgrp)',
57 define='HAVE_SOLARIS_GETGRNAM_R', headers='unistd.h grp.h')
58 conf.CHECK_C_PROTOTYPE('getgrgid_r',
59 'int getgrgid_r(gid_t gid, struct group *grp, char *buf, int buflen, struct group **pgrp)',
60 define='HAVE_SOLARIS_GETGRGID_R', headers='unistd.h grp.h')
61 conf.CHECK_C_PROTOTYPE('sethostent',
62 'int sethostent(int stayopen)',
63 define='HAVE_SOLARIS_SETHOSTENT', headers='unistd.h netdb.h')
64 conf.CHECK_C_PROTOTYPE('endhostent',
65 'int endhostent(void)',
66 define='HAVE_SOLARIS_ENDHOSTENT', headers='unistd.h netdb.h')
67 conf.CHECK_C_PROTOTYPE('gethostname',
68 'int gethostname(char *name, int len)',
69 define='HAVE_SOLARIS_GETHOSTNAME', headers='unistd.h netdb.h')
70 conf.CHECK_C_PROTOTYPE('setgrent',
71 'int setgrent(void)',
72 define='HAVE_BSD_SETGRENT', headers='unistd.h grp.h')
73 conf.CHECK_C_PROTOTYPE('getnameinfo',
74 'int getnameinfo (const struct sockaddr *sa, socklen_t salen, char *host, socklen_t __hostlen, char *serv, socklen_t servlen, int flags)',
75 define='HAVE_LINUX_GETNAMEINFO', headers='unistd.h netdb.h')
76 conf.CHECK_C_PROTOTYPE('getnameinfo',
77 'int getnameinfo (const struct sockaddr *sa, socklen_t salen, char *host, socklen_t __hostlen, char *serv, socklen_t servlen, unsigned int flags)',
78 define='HAVE_LINUX_GETNAMEINFO_UNSIGNED', headers='unistd.h netdb.h')
80 # Create full path to nss_wrapper
81 blddir = os.path.realpath(conf.bldnode.abspath())
82 libnss_wrapper_so_path = blddir + '/default/third_party/nss_wrapper/libnss-wrapper.so'
84 conf.DEFINE('LIBNSS_WRAPPER_SO_PATH', libnss_wrapper_so_path)
85 conf.DEFINE('NSS_WRAPPER', 1)
87 def build(bld):
88 if bld.CONFIG_SET("HAVE_NSS_H") and not bld.CONFIG_SET("USING_SYSTEM_NSS_WRAPPER"):
89 # We need to do it this way or the library wont work.
90 # Using private_library=True will add symbol version which
91 # breaks preloading!
92 bld.SAMBA_LIBRARY('nss_wrapper',
93 source='nss_wrapper.c nss_utils.c',
94 deps='dl pthread',
95 install=False,
96 realname='libnss-wrapper.so')