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