#!/usr/bin/env python import os VERSION="1.0.1" def configure(conf): if conf.CHECK_BUNDLED_SYSTEM('uid_wrapper', minversion=VERSION, set_target=False): conf.DEFINE('USING_SYSTEM_UID_WRAPPER', 1) libuid_wrapper_so_path = 'libuid_wrapper.so' else: # check HAVE_GCC_THREAD_LOCAL_STORAGE conf.CHECK_CODE(''' __thread int tls; int main(void) { return 0; } ''', 'HAVE_GCC_THREAD_LOCAL_STORAGE', addmain=False, msg='Checking for thread local storage') # check HAVE_DESTRUCTOR_ATTRIBUTE conf.CHECK_CODE(''' void test_destructor_attribute(void) __attribute__ ((destructor)); void test_destructor_attribute(void) { return; } int main(void) { return 0; } ''', 'HAVE_DESTRUCTOR_ATTRIBUTE', addmain=False, msg='Checking for library destructor support') # Create full path to uid_wrapper srcdir = os.path.realpath(conf.srcdir) libuid_wrapper_so_path = srcdir + '/bin/default/lib/uid_wrapper/libuid-wrapper.so' conf.DEFINE('LIBUID_WRAPPER_SO_PATH', libuid_wrapper_so_path) conf.DEFINE('UID_WRAPPER', 1) def build(bld): if not bld.CONFIG_SET("USING_SYSTEM_UID_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('uid_wrapper', source='uid_wrapper.c', cflags='-DNDEBUG', deps='dl', install=False, realname='libuid-wrapper.so')