pypassdb: Do not use pytalloc_Object directly
[Samba.git] / lib / nss_wrapper / wscript
blob6c3d7f7940ca62939dc847f5379739e32554d73f
1 #!/usr/bin/env python
3 import os
5 VERSION="1.1.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 conf.CHECK_HEADERS('nss.h')
14 # check HAVE_GCC_THREAD_LOCAL_STORAGE
15 conf.CHECK_CODE('''
16 __thread int tls;
18 int main(void) {
19 return 0;
21 ''',
22 'HAVE_GCC_THREAD_LOCAL_STORAGE',
23 addmain=False,
24 msg='Checking for thread local storage')
26 # check HAVE_DESTRUCTOR_ATTRIBUTE
27 conf.CHECK_CODE('''
28 void test_destructor_attribute(void) __attribute__ ((destructor));
30 void test_destructor_attribute(void)
32 return;
35 int main(void) {
36 return 0;
38 ''',
39 'HAVE_DESTRUCTOR_ATTRIBUTE',
40 addmain=False,
41 msg='Checking for library destructor support')
43 conf.CHECK_FUNCS('gethostbyaddr_r gethostbyname_r')
44 # Solaris
45 conf.CHECK_FUNCS('__posix_getpwnam_r __posix_getpwuid_r')
46 conf.CHECK_FUNCS('__posix_getgrgid_r __posix_getgrnam_r')
48 conf.CHECK_FUNCS_IN('nsl',
49 'gethostname',
50 checklibc=True,
51 headers='unistd.h')
53 # Prototype checks
54 conf.CHECK_C_PROTOTYPE('getpwent_r',
55 'struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)',
56 define='HAVE_SOLARIS_GETPWENT_R', headers='unistd.h pwd.h')
57 conf.CHECK_C_PROTOTYPE('getpwnam_r',
58 'int getpwnam_r(const char *name, struct passwd *pwd, char *buf, int buflen, struct passwd **ppwd)',
59 define='HAVE_SOLARIS_GETPWNAM_R', headers='unistd.h pwd.h')
60 conf.CHECK_C_PROTOTYPE('getpwuid_r',
61 'int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, int buflen, struct passwd **ppwd)',
62 define='HAVE_SOLARIS_GETPWUID_R', headers='unistd.h pwd.h')
63 conf.CHECK_C_PROTOTYPE('getgrent_r',
64 'struct group *getgrent_r(struct group *src, char *buf, int buflen)',
65 define='SOLARIS_GETGRENT_R', headers='unistd.h grp.h')
66 conf.CHECK_C_PROTOTYPE('getgrnam_r',
67 'int getgrnam_r(const char *name, struct group *grp, char *buf, int buflen, struct group **pgrp)',
68 define='HAVE_SOLARIS_GETGRNAM_R', headers='unistd.h grp.h')
69 conf.CHECK_C_PROTOTYPE('getgrgid_r',
70 'int getgrgid_r(gid_t gid, struct group *grp, char *buf, int buflen, struct group **pgrp)',
71 define='HAVE_SOLARIS_GETGRGID_R', headers='unistd.h grp.h')
72 conf.CHECK_C_PROTOTYPE('sethostent',
73 'int sethostent(int stayopen)',
74 define='HAVE_SOLARIS_SETHOSTENT', headers='unistd.h netdb.h')
75 conf.CHECK_C_PROTOTYPE('endhostent',
76 'int endhostent(void)',
77 define='HAVE_SOLARIS_ENDHOSTENT', headers='unistd.h netdb.h')
78 conf.CHECK_C_PROTOTYPE('gethostname',
79 'int gethostname(char *name, int len)',
80 define='HAVE_SOLARIS_GETHOSTNAME', headers='unistd.h netdb.h')
81 conf.CHECK_C_PROTOTYPE('setgrent',
82 'int setgrent(void)',
83 define='HAVE_BSD_SETGRENT', headers='unistd.h grp.h')
84 conf.CHECK_C_PROTOTYPE('getnameinfo',
85 'int getnameinfo (const struct sockaddr *sa, socklen_t salen, char *host, socklen_t __hostlen, char *serv, socklen_t servlen, int flags)',
86 define='HAVE_LINUX_GETNAMEINFO', headers='unistd.h netdb.h')
87 conf.CHECK_C_PROTOTYPE('getnameinfo',
88 'int getnameinfo (const struct sockaddr *sa, socklen_t salen, char *host, socklen_t __hostlen, char *serv, socklen_t servlen, unsigned int flags)',
89 define='HAVE_LINUX_GETNAMEINFO_UNSIGNED', headers='unistd.h netdb.h')
91 # Create full path to nss_wrapper
92 srcdir = os.path.realpath(conf.srcdir)
93 libnss_wrapper_so_path = srcdir + '/bin/default/lib/nss_wrapper/libnss-wrapper.so'
95 conf.DEFINE('LIBNSS_WRAPPER_SO_PATH', libnss_wrapper_so_path)
96 conf.DEFINE('NSS_WRAPPER', 1)
98 def build(bld):
99 if bld.CONFIG_SET("HAVE_NSS_H") and not bld.CONFIG_SET("USING_SYSTEM_NSS_WRAPPER"):
100 # We need to do it this way or the library wont work.
101 # Using private_library=True will add symbol version which
102 # breaks preloading!
103 bld.SAMBA_LIBRARY('nss_wrapper',
104 source='nss_wrapper.c',
105 deps='dl',
106 install=False,
107 realname='libnss-wrapper.so')