summaryrefslogtreecommitdiffstats
path: root/lib/uid_wrapper/wscript
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2014-01-17 14:43:01 +0100
committerStefan Metzmacher <metze@samba.org>2014-04-17 14:56:05 +0200
commit6d23354f72a487741177dd83c561a1bb72fa6412 (patch)
tree1b34ec910d6c88e5120e9f0f39fbf2cd1ff0f4c0 /lib/uid_wrapper/wscript
parentf318a44ec79da33a8972da9822c9ac3e4b39acff (diff)
lib: Change uid_wrapper to preloadable version.
This imports version 1.0.1 of uid_wrapper. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'lib/uid_wrapper/wscript')
-rw-r--r--lib/uid_wrapper/wscript64
1 files changed, 53 insertions, 11 deletions
diff --git a/lib/uid_wrapper/wscript b/lib/uid_wrapper/wscript
index 1501d0e5ce..63be4734fa 100644
--- a/lib/uid_wrapper/wscript
+++ b/lib/uid_wrapper/wscript
@@ -1,17 +1,59 @@
#!/usr/bin/env python
-import Options
+import os
-def set_options(opt):
- gr = opt.option_group('developer options')
- gr.add_option('--enable-uid-wrapper',
- help=("Turn on uid wrapper library (default=no)"),
- action="store_true", dest='enable_uid_wrapper', default=False)
+VERSION="1.0.1"
def configure(conf):
- if (Options.options.enable_uid_wrapper or
- Options.options.developer or
- Options.options.enable_selftest):
- conf.DEFINE('UID_WRAPPER', 1)
- conf.ADD_GLOBAL_DEPENDENCY('uid_wrapper')
+ 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')