#!/usr/bin/env python import os VERSION="1.1.13" def configure(conf): if conf.CHECK_NSS_WRAPPER(): conf.DEFINE('USING_SYSTEM_NSS_WRAPPER', 1) libnss_wrapper_so_path = 'libnss_wrapper.so' else: conf.CHECK_HEADERS('nss.h') if conf.CONFIG_SET("HAVE___THREAD"): conf.DEFINE("HAVE_GCC_THREAD_LOCAL_STORAGE", 1) # 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, strict=True, msg='Checking for printf format validation support') conf.CHECK_FUNCS('gethostbyaddr_r gethostbyname_r') conf.CHECK_FUNCS('gethostbyname2 gethostbyname2_r') # Solaris conf.CHECK_FUNCS('__posix_getpwnam_r __posix_getpwuid_r') conf.CHECK_FUNCS('__posix_getgrgid_r __posix_getgrnam_r') conf.CHECK_LIB('nsl socket') conf.CHECK_FUNCS_IN('gethostname', 'nsl', 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)', define='HAVE_SOLARIS_GETGRENT_R', headers='unistd.h grp.h') 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 blddir = os.path.realpath(conf.bldnode.abspath()) libnss_wrapper_so_path = blddir + '/default/third_party/nss_wrapper/libnss-wrapper.so' conf.DEFINE('LIBNSS_WRAPPER_SO_PATH', libnss_wrapper_so_path) conf.DEFINE('NSS_WRAPPER', 1) def build(bld): if bld.CONFIG_SET("HAVE_NSS_H") and not bld.CONFIG_SET("USING_SYSTEM_NSS_WRAPPER"): # 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', deps='dl pthread', install=False, realname='libnss-wrapper.so')