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