1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
samba-mirror/lib/uid_wrapper/wscript
Andreas Schneider 6bbf9fa6df uwrap: Check for HAVE_FUNCTION_ATTRIBUTE_FORMAT.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-07-31 18:49:47 +02:00

72 lines
2.2 KiB
Python

#!/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')
# check HAVE_FUNCTION_ATTRIBUTE_FORMAT
conf.CHECK_CODE('''
void log_fn(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
int main(void) {
return 0;
}
''',
'HAVE_FUNCTION_ATTRIBUTE_FORMAT',
addmain=False,
msg='Checking for printf format validation 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')