nsswitch: add test for parallel NSS & libwbclient calls
[samba.git] / nsswitch / wscript_build
1 #!/usr/bin/env python
2 from waflib import Utils
3 import sys
4 host_os = sys.platform
5
6 bld.SAMBA_LIBRARY('winbind-client',
7         source='wb_common.c',
8         deps='replace',
9         cflags='-DWINBINDD_SOCKET_DIR=\"%s\"' % bld.env.WINBINDD_SOCKET_DIR,
10         private_library=True
11         )
12
13
14 bld.SAMBA_BINARY('nsstest',
15                  source='nsstest.c',
16                  deps='replace dl',
17                  install=False
18                  )
19
20 if bld.CONFIG_SET('HAVE_PTHREAD'):
21     bld.SAMBA_BINARY('stress-nss-libwbclient',
22                      source='stress-nss-libwbclient.c',
23                      deps='wbclient',
24                      install=False
25                      )
26
27 # The nss_wrapper code relies strictly on the linux implementation and
28 # name, so compile but do not install a copy under this name.
29 bld.SAMBA_LIBRARY('nss_wrapper_winbind',
30                   source='winbind_nss_linux.c',
31                   deps='winbind-client',
32                   realname='libnss_wrapper_winbind.so.2',
33                   install=False,
34                   vnum='2')
35
36 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu)
37 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
38
39 if (Utils.unversioned_sys_platform() == 'linux' or (host_os.rfind('gnu') > -1)):
40     bld.SAMBA_LIBRARY('nss_winbind',
41               keep_underscore=True,
42               source='winbind_nss_linux.c',
43               deps='winbind-client',
44               public_headers=[],
45               public_headers_install=False,
46               pc_files=[],
47               vnum='2')
48
49     bld.SAMBA3_LIBRARY('nss_wins',
50                        keep_underscore=True,
51                        source='wins.c',
52                        deps='wbclient replace',
53                        public_headers=[],
54                        public_headers_install=False,
55                        pc_files=[],
56                        vnum='2')
57 elif (host_os.rfind('freebsd') > -1):
58         # FreeBSD winbind client is implemented as a wrapper around
59         # the Linux version.
60         bld.SAMBA_LIBRARY('nss_winbind',
61                           source='winbind_nss_linux.c winbind_nss_freebsd.c',
62                           deps='winbind-client',
63                           realname='nss_winbind.so.1',
64                           vnum='1')
65
66         bld.SAMBA3_LIBRARY('nss_wins',
67                           source='wins.c wins_freebsd.c',
68                           deps='''wbclient''',
69                           realname='nss_wins.so.1',
70                           vnum='1')
71
72 elif (host_os.rfind('netbsd') > -1):
73         # NetBSD winbind client is implemented as a wrapper
74         # around the Linux version. It needs getpwent_r() to
75         # indicate libc's use of the correct nsdispatch API.
76
77         if bld.CONFIG_SET("HAVE_GETPWENT_R"):
78                 bld.SAMBA_LIBRARY('nss_winbind',
79                                   source='winbind_nss_linux.c winbind_nss_netbsd.c',
80                                   deps='winbind-client', 
81                                   realname='libnss_winbind.so')
82 elif Utils.unversioned_sys_platform() == 'sunos':
83         bld.SAMBA_LIBRARY('nss_winbind',
84                           source='winbind_nss_solaris.c winbind_nss_linux.c',
85                           deps='winbind-client',
86                           realname='nss_winbind.so.1',
87                           vnum='1')
88 elif (host_os.rfind('hpux') > -1):
89         bld.SAMBA_LIBRARY('nss_winbind',
90                           source='winbind_nss_linux.c',
91                           deps='winbind-client', 
92                           realname='libnss_winbind.so')
93 elif (host_os.rfind('aix') > -1):
94         bld.SAMBA_LIBRARY('nss_winbind',
95                           source='winbind_nss_aix.c',
96                           deps='winbind-client', 
97                           realname='WINBIND')
98
99 if bld.CONFIG_SET('WITH_PAM_MODULES') and bld.CONFIG_SET('HAVE_PAM_START'):
100         bld.SAMBA_LIBRARY('pamwinbind',
101                 source='pam_winbind.c',
102                 deps='talloc wbclient winbind-client tiniparser pam samba_intl',
103                 cflags='-DLOCALEDIR=\"%s/locale\"' % bld.env.DATADIR,
104                 realname='pam_winbind.so',
105                 install_path='${PAMMODULESDIR}'
106                 )
107
108 if bld.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'):
109     bld.SAMBA_LIBRARY('winbind_krb5_locator',
110                       source='krb5_plugin/winbind_krb5_locator.c',
111                       deps='wbclient krb5 com_err',
112                       realname='winbind_krb5_locator.so',
113                       install_path='${MODULESDIR}/krb5')
114
115 if bld.CONFIG_SET('HAVE_KRB5_LOCALAUTH_PLUGIN_H'):
116     bld.SAMBA_LIBRARY('winbind_krb5_localauth',
117                       source='krb5_plugin/winbind_krb5_localauth.c',
118                       deps='wbclient krb5 com_err',
119                       realname='winbind_krb5_localauth.so',
120                       install_path='${MODULESDIR}/krb5')
121
122 bld.SAMBA_SUBSYSTEM('WB_REQTRANS',
123         source='wb_reqtrans.c',
124         deps='talloc tevent LIBASYNC_REQ'
125         )
126
127 bld.SAMBA_BINARY('wbinfo',
128         source='wbinfo.c',
129         deps='samba-util LIBCLI_AUTH popt POPT_SAMBA wbclient LIBAFS_SETTOKEN'
130         )