a84dad663c44fa09cbe9a8a51606feecf8ca218d
[samba.git] / lib / tevent / wscript
1 #!/usr/bin/env python
2
3 VERSION = '0.9.8'
4
5 srcdir = '../..'
6 blddir = 'bin'
7
8 import sys
9 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
10 import wafsamba
11
12 LIBREPLACE_DIR= srcdir + '/lib/replace'
13 LIBTALLOC_DIR=  srcdir + '/lib/talloc'
14
15 def set_options(opt):
16     opt.BUILTIN_DEFAULT('replace')
17     opt.BUNDLED_EXTENSION_DEFAULT('tevent', noextenion='tevent')
18     opt.recurse(LIBREPLACE_DIR)
19     opt.recurse(LIBTALLOC_DIR)
20
21 def configure(conf):
22     conf.sub_config(LIBREPLACE_DIR)
23     conf.sub_config(LIBTALLOC_DIR)
24
25     if conf.CHECK_BUNDLED_SYSTEM('tevent', minversion=VERSION, onlyif='talloc'):
26         conf.define('USING_SYSTEM_TEVENT', 1)
27
28     if conf.CHECK_FUNCS('epoll_create', headers='sys/epoll.h'):
29         conf.DEFINE('HAVE_EPOLL', 1)
30
31     conf.SAMBA_CONFIG_H()
32
33 def build(bld):
34     bld.BUILD_SUBDIR(LIBREPLACE_DIR)
35     bld.BUILD_SUBDIR(LIBTALLOC_DIR)
36
37     SRC = '''tevent.c tevent_debug.c tevent_fd.c tevent_immediate.c
38              tevent_queue.c tevent_req.c tevent_select.c
39              tevent_signal.c tevent_standard.c tevent_timed.c tevent_util.c tevent_wakeup.c'''
40
41     if bld.CONFIG_SET('HAVE_EPOLL'):
42         SRC += ' tevent_epoll.c'
43
44     if not bld.CONFIG_SET('USING_SYSTEM_TEVENT'):
45         bld.SAMBA_LIBRARY('tevent',
46                           SRC,
47                           deps='replace talloc',
48                           enabled= not bld.CONFIG_SET('USING_SYSTEM_TEVENT'),
49                           vnum=VERSION)