smbd: Simplify strict_lock_default with early returns
[Samba.git] / lib / nss_wrapper / wscript
blob34026c06ed7960846af6cf142da630b0e63b410b
1 #!/usr/bin/env python
3 import os
5 VERSION="1.0.2"
7 def configure(conf):
8 if conf.CHECK_BUNDLED_SYSTEM('nss_wrapper', minversion=VERSION, set_target=False):
9 conf.DEFINE('USING_SYSTEM_NSS_WRAPPER', 1)
10 libnss_wrapper_so_path = 'libnss_wrapper.so'
11 else:
12 # check HAVE_GCC_THREAD_LOCAL_STORAGE
13 conf.CHECK_CODE('''
14 __thread int tls;
16 int main(void) {
17 return 0;
19 ''',
20 'HAVE_GCC_THREAD_LOCAL_STORAGE',
21 addmain=False,
22 msg='Checking for thread local storage')
24 # check HAVE_DESTRUCTOR_ATTRIBUTE
25 conf.CHECK_CODE('''
26 void test_destructor_attribute(void) __attribute__ ((destructor));
28 void test_destructor_attribute(void)
30 return;
33 int main(void) {
34 return 0;
36 ''',
37 'HAVE_DESTRUCTOR_ATTRIBUTE',
38 addmain=False,
39 msg='Checking for library destructor support')
41 conf.CHECK_FUNCS('gethostbyaddr_r gethostbyname_r')
42 # Solaris
43 conf.CHECK_FUNCS('__posix_getpwnam_r __posix_getpwuid_r')
44 conf.CHECK_FUNCS('__posix_getgrgid_r __posix_getgrnam_r')
46 conf.CHECK_FUNCS_IN('nsl',
47 'gethostname',
48 checklibc=True,
49 headers='unistd.h')
51 # Prototype checks
52 conf.CHECK_C_PROTOTYPE('getpwent_r',
53 'struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)',
54 define='HAVE_SOLARIS_GETPWENT_R', headers='unistd.h pwd.h')
55 conf.CHECK_C_PROTOTYPE('getpwnam_r',
56 'int getpwnam_r(const char *name, struct passwd *pwd, char *buf, int buflen, struct passwd **ppwd)',
57 define='HAVE_SOLARIS_GETPWNAM_R', headers='unistd.h pwd.h')
58 conf.CHECK_C_PROTOTYPE('getpwuid_r',
59 'int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, int buflen, struct passwd **ppwd)',
60 define='HAVE_SOLARIS_GETPWUID_R', headers='unistd.h pwd.h')
61 conf.CHECK_C_PROTOTYPE('getgrent_r',
62 'struct group *getgrent_r(struct group *src, char *buf, int buflen)',
63 define='SOLARIS_GETGRENT_R', headers='unistd.h grp.h')
64 conf.CHECK_C_PROTOTYPE('getgrnam_r',
65 'int getgrnam_r(const char *name, struct group *grp, char *buf, int buflen, struct group **pgrp)',
66 define='HAVE_SOLARIS_GETGRNAM_R', headers='unistd.h grp.h')
67 conf.CHECK_C_PROTOTYPE('getgrgid_r',
68 'int getgrgid_r(gid_t gid, struct group *grp, char *buf, int buflen, struct group **pgrp)',
69 define='HAVE_SOLARIS_GETGRGID_R', headers='unistd.h grp.h')
70 conf.CHECK_C_PROTOTYPE('sethostent',
71 'int sethostent(int stayopen)',
72 define='HAVE_SOLARIS_SETHOSTENT', headers='unistd.h netdb.h')
73 conf.CHECK_C_PROTOTYPE('endhostent',
74 'int endhostent(void)',
75 define='HAVE_SOLARIS_ENDHOSTENT', headers='unistd.h netdb.h')
76 conf.CHECK_C_PROTOTYPE('gethostname',
77 'int gethostname(char *name, int len)',
78 define='HAVE_SOLARIS_GETHOSTNAME', headers='unistd.h netdb.h')
79 conf.CHECK_C_PROTOTYPE('setgrent',
80 'int setgrent(void)',
81 define='HAVE_BSD_SETGRENT', headers='unistd.h grp.h')
82 conf.CHECK_C_PROTOTYPE('getnameinfo',
83 'int getnameinfo (const struct sockaddr *sa, socklen_t salen, char *host, socklen_t __hostlen, char *serv, socklen_t servlen, int flags)',
84 define='HAVE_LINUX_GETNAMEINFO', headers='unistd.h netdb.h')
85 conf.CHECK_C_PROTOTYPE('getnameinfo',
86 'int getnameinfo (const struct sockaddr *sa, socklen_t salen, char *host, socklen_t __hostlen, char *serv, socklen_t servlen, unsigned int flags)',
87 define='HAVE_LINUX_GETNAMEINFO_UNSIGNED', headers='unistd.h netdb.h')
89 # Create full path to nss_wrapper
90 srcdir = os.path.realpath(conf.srcdir)
91 libnss_wrapper_so_path = srcdir + '/bin/default/lib/nss_wrapper/libnss-wrapper.so'
93 conf.DEFINE('LIBNSS_WRAPPER_SO_PATH', libnss_wrapper_so_path)
94 conf.DEFINE('NSS_WRAPPER', 1)
96 def build(bld):
97 if not bld.CONFIG_SET("USING_SYSTEM_NSS_WRAPPER"):
98 # We need to do it this way or the library wont work.
99 # Using private_library=True will add symbol version which
100 # breaks preloading!
101 bld.SAMBA_LIBRARY('nss_wrapper',
102 source='nss_wrapper.c',
103 cflags='-DNDEBUG',
104 deps='dl',
105 install=False,
106 realname='libnss-wrapper.so')