s4-waf: allow standalone tarball build of libraries
[samba.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
19
20 LIBREPLACE_DIR= srcdir + '/lib/replace'
21 LIBTALLOC_DIR=  srcdir + '/lib/talloc'
22
23 def set_options(opt):
24     opt.BUILTIN_DEFAULT('replace')
25     opt.BUNDLED_EXTENSION_DEFAULT('tevent', noextenion='tevent')
26     opt.recurse(LIBREPLACE_DIR)
27     opt.recurse(LIBTALLOC_DIR)
28
29 def configure(conf):
30     conf.DIST_DIRS('lib/tevent:. lib/replace:lib/replace lib/talloc:lib/talloc buildtools:buildtools')
31     conf.sub_config(LIBREPLACE_DIR)
32     conf.sub_config(LIBTALLOC_DIR)
33
34     if conf.CHECK_BUNDLED_SYSTEM('tevent', minversion=VERSION,
35                                  onlyif='talloc', implied_deps='replace talloc'):
36         conf.define('USING_SYSTEM_TEVENT', 1)
37
38     if conf.CHECK_FUNCS('epoll_create', headers='sys/epoll.h'):
39         conf.DEFINE('HAVE_EPOLL', 1)
40
41     conf.SAMBA_CONFIG_H()
42
43 def build(bld):
44     bld.BUILD_SUBDIR(LIBREPLACE_DIR)
45     bld.BUILD_SUBDIR(LIBTALLOC_DIR)
46
47     SRC = '''tevent.c tevent_debug.c tevent_fd.c tevent_immediate.c
48              tevent_queue.c tevent_req.c tevent_select.c
49              tevent_signal.c tevent_standard.c tevent_timed.c tevent_util.c tevent_wakeup.c'''
50
51     if bld.CONFIG_SET('HAVE_EPOLL'):
52         SRC += ' tevent_epoll.c'
53
54     if not bld.CONFIG_SET('USING_SYSTEM_TEVENT'):
55         bld.SAMBA_LIBRARY('tevent',
56                           SRC,
57                           deps='replace talloc',
58                           enabled= not bld.CONFIG_SET('USING_SYSTEM_TEVENT'),
59                           vnum=VERSION)