VERSION: Disable git snapshots for the 4.2.11 release.
[Samba.git] / lib / uid_wrapper / wscript
blob6b585956e0d90c0b0dca9e2e9045617ea4c1ecdf
1 #!/usr/bin/env python
3 import os
5 VERSION="1.0.1"
7 def configure(conf):
8 if conf.CHECK_BUNDLED_SYSTEM('uid_wrapper', minversion=VERSION, set_target=False):
9 conf.DEFINE('USING_SYSTEM_UID_WRAPPER', 1)
10 libuid_wrapper_so_path = 'libuid_wrapper.so'
11 else:
12 # check HAVE_GCC_THREAD_LOCAL_STORAGE
13 conf.CHECK_CODE('''
14 __thread int tls;
16 int main(void) {
17 return 0;
19 ''',
20 'HAVE_GCC_THREAD_LOCAL_STORAGE',
21 addmain=False,
22 msg='Checking for thread local storage')
24 # check HAVE_DESTRUCTOR_ATTRIBUTE
25 conf.CHECK_CODE('''
26 void test_destructor_attribute(void) __attribute__ ((destructor));
28 void test_destructor_attribute(void)
30 return;
33 int main(void) {
34 return 0;
36 ''',
37 'HAVE_DESTRUCTOR_ATTRIBUTE',
38 addmain=False,
39 msg='Checking for library destructor support')
41 # check HAVE_FUNCTION_ATTRIBUTE_FORMAT
42 conf.CHECK_CODE('''
43 void log_fn(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
45 int main(void) {
46 return 0;
48 ''',
49 'HAVE_FUNCTION_ATTRIBUTE_FORMAT',
50 addmain=False,
51 msg='Checking for printf format validation support')
52 # Prototype checks
53 conf.CHECK_C_PROTOTYPE('setgroups',
54 'int setgroups(int ngroups, const gid_t *grouplist)',
55 define='HAVE_SETGROUPS_INT', headers='unistd.h sys/types.h')
56 conf.CHECK_C_PROTOTYPE('syscall',
57 'int syscall(int number, ...)',
58 define='HAVE_SYSCALL_INT', headers='unistd.h sys/syscall.h')
60 # Create full path to uid_wrapper
61 srcdir = os.path.realpath(conf.srcdir)
62 libuid_wrapper_so_path = srcdir + '/bin/default/lib/uid_wrapper/libuid-wrapper.so'
64 conf.DEFINE('LIBUID_WRAPPER_SO_PATH', libuid_wrapper_so_path)
65 conf.DEFINE('UID_WRAPPER', 1)
67 def build(bld):
68 if not bld.CONFIG_SET("USING_SYSTEM_UID_WRAPPER"):
69 # We need to do it this way or the library wont work.
70 # Using private_library=True will add symbol version which
71 # breaks preloading!
72 bld.SAMBA_LIBRARY('uid_wrapper',
73 source='uid_wrapper.c',
74 cflags='-DNDEBUG',
75 deps='dl',
76 install=False,
77 realname='libuid-wrapper.so')