2010-03-28 01:48:49 +03:00
#!/usr/bin/env python
2014-01-31 18:57:43 +04:00
import os
2010-03-07 15:48:57 +03:00
2020-04-02 14:43:44 +03:00
VERSION="1.1.11"
2010-03-07 15:48:57 +03:00
def configure(conf):
2017-11-07 13:40:11 +03:00
if conf.CHECK_NSS_WRAPPER():
2014-01-31 18:57:43 +04:00
conf.DEFINE('USING_SYSTEM_NSS_WRAPPER', 1)
libnss_wrapper_so_path = 'libnss_wrapper.so'
else:
2014-10-15 13:29:12 +04:00
conf.CHECK_HEADERS('nss.h')
2018-07-18 09:54:22 +03:00
if conf.CONFIG_SET("HAVE___THREAD"):
conf.DEFINE("HAVE_GCC_THREAD_LOCAL_STORAGE", 1)
2014-01-31 18:57:43 +04:00
2016-08-08 07:09:10 +03:00
# check HAVE_ATTRIBUTE_PRINTF_FORMAT
conf.CHECK_CODE('''
void log_fn(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
int main(void) {
return 0;
}
''',
'HAVE_ATTRIBUTE_PRINTF_FORMAT',
addmain=False,
2018-07-03 07:44:48 +03:00
strict=True,
2016-08-08 07:09:10 +03:00
msg='Checking for printf format validation support')
2014-01-31 18:57:43 +04:00
conf.CHECK_FUNCS('gethostbyaddr_r gethostbyname_r')
2020-03-16 19:00:16 +03:00
conf.CHECK_FUNCS('gethostbyname2 gethostbyname2_r')
2014-01-31 18:57:43 +04:00
# Solaris
conf.CHECK_FUNCS('__posix_getpwnam_r __posix_getpwuid_r')
conf.CHECK_FUNCS('__posix_getgrgid_r __posix_getgrnam_r')
2019-02-16 03:23:29 +03:00
conf.CHECK_LIB('nsl socket')
2019-02-10 04:02:06 +03:00
conf.CHECK_FUNCS_IN('gethostname',
'nsl',
2014-01-31 18:57:43 +04:00
checklibc=True,
headers='unistd.h')
# Prototype checks
conf.CHECK_C_PROTOTYPE('getpwent_r',
'struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)',
define='HAVE_SOLARIS_GETPWENT_R', headers='unistd.h pwd.h')
conf.CHECK_C_PROTOTYPE('getpwnam_r',
'int getpwnam_r(const char *name, struct passwd *pwd, char *buf, int buflen, struct passwd **ppwd)',
define='HAVE_SOLARIS_GETPWNAM_R', headers='unistd.h pwd.h')
conf.CHECK_C_PROTOTYPE('getpwuid_r',
'int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, int buflen, struct passwd **ppwd)',
define='HAVE_SOLARIS_GETPWUID_R', headers='unistd.h pwd.h')
conf.CHECK_C_PROTOTYPE('getgrent_r',
'struct group *getgrent_r(struct group *src, char *buf, int buflen)',
2016-04-04 14:43:02 +03:00
define='HAVE_SOLARIS_GETGRENT_R', headers='unistd.h grp.h')
2014-01-31 18:57:43 +04:00
conf.CHECK_C_PROTOTYPE('getgrnam_r',
'int getgrnam_r(const char *name, struct group *grp, char *buf, int buflen, struct group **pgrp)',
define='HAVE_SOLARIS_GETGRNAM_R', headers='unistd.h grp.h')
conf.CHECK_C_PROTOTYPE('getgrgid_r',
'int getgrgid_r(gid_t gid, struct group *grp, char *buf, int buflen, struct group **pgrp)',
define='HAVE_SOLARIS_GETGRGID_R', headers='unistd.h grp.h')
conf.CHECK_C_PROTOTYPE('sethostent',
'int sethostent(int stayopen)',
define='HAVE_SOLARIS_SETHOSTENT', headers='unistd.h netdb.h')
conf.CHECK_C_PROTOTYPE('endhostent',
'int endhostent(void)',
define='HAVE_SOLARIS_ENDHOSTENT', headers='unistd.h netdb.h')
conf.CHECK_C_PROTOTYPE('gethostname',
'int gethostname(char *name, int len)',
define='HAVE_SOLARIS_GETHOSTNAME', headers='unistd.h netdb.h')
conf.CHECK_C_PROTOTYPE('setgrent',
'int setgrent(void)',
define='HAVE_BSD_SETGRENT', headers='unistd.h grp.h')
conf.CHECK_C_PROTOTYPE('getnameinfo',
'int getnameinfo (const struct sockaddr *sa, socklen_t salen, char *host, socklen_t __hostlen, char *serv, socklen_t servlen, int flags)',
define='HAVE_LINUX_GETNAMEINFO', headers='unistd.h netdb.h')
conf.CHECK_C_PROTOTYPE('getnameinfo',
'int getnameinfo (const struct sockaddr *sa, socklen_t salen, char *host, socklen_t __hostlen, char *serv, socklen_t servlen, unsigned int flags)',
define='HAVE_LINUX_GETNAMEINFO_UNSIGNED', headers='unistd.h netdb.h')
# Create full path to nss_wrapper
2018-02-02 17:34:32 +03:00
blddir = os.path.realpath(conf.bldnode.abspath())
2017-11-07 13:40:11 +03:00
libnss_wrapper_so_path = blddir + '/default/third_party/nss_wrapper/libnss-wrapper.so'
2014-01-31 18:57:43 +04:00
conf.DEFINE('LIBNSS_WRAPPER_SO_PATH', libnss_wrapper_so_path)
conf.DEFINE('NSS_WRAPPER', 1)
def build(bld):
2014-10-15 13:29:12 +04:00
if bld.CONFIG_SET("HAVE_NSS_H") and not bld.CONFIG_SET("USING_SYSTEM_NSS_WRAPPER"):
2014-01-31 18:57:43 +04:00
# We need to do it this way or the library wont work.
# Using private_library=True will add symbol version which
# breaks preloading!
bld.SAMBA_LIBRARY('nss_wrapper',
source='nss_wrapper.c',
2019-09-23 18:39:29 +03:00
deps='dl pthread',
2014-01-31 18:57:43 +04:00
install=False,
realname='libnss-wrapper.so')