build: updates to waf scripts for replace and talloc
[nivanova/samba-autobuild/.git] / lib / replace / autoconf.py
1 # a waf tool to add autoconf-like macros to the configure section
2
3 from Configure import conf
4
5 @conf
6 def DEFUN(conf, d, v):
7     conf.define(d, v, quote=False)
8     conf.env.append_value('CCDEFINES', d + '=' + str(v))
9
10 @conf
11 def CHECK_HEADERS(conf, list):
12     for hdr in list.rsplit(' '):
13         if conf.check(header_name=hdr):
14             conf.env.hlist.append(hdr)
15
16 @conf
17 def CHECK_TYPES(conf, list):
18     for t in list.rsplit(' '):
19         conf.check(type_name=t, header_name=conf.env.hlist)
20
21 @conf
22 def CHECK_TYPE_IN(conf, t, hdr):
23     if conf.check(header_name=hdr):
24         conf.check(type_name=t, header_name=hdr)
25
26 @conf
27 def CHECK_TYPE(conf, t, alternate):
28     if not conf.check(type_name=t, header_name=conf.env.hlist):
29         conf.DEFUN(t, alternate)
30
31 @conf
32 def CHECK_FUNCS(conf, list):
33     for f in list.rsplit(' '):
34         conf.check(function_name=f, header_name=conf.env.hlist)
35
36 @conf
37 def CHECK_FUNCS_IN(conf, list, library):
38     if conf.check(lib=library, uselib_store=library):
39         for f in list.rsplit(' '):
40             conf.check(function_name=f, lib=library, header_name=conf.env.hlist)
41
42 # we want a different rpath when installing and when building
43 # this should really check if rpath is available on this platform
44 # and it should also honor an --enable-rpath option
45 def set_rpath(bld):
46     import Options
47     if Options.is_install:
48         bld.env['RPATH'] = ['-Wl,-rpath=' + bld.env.PREFIX + '/lib']
49     else:
50         bld.env.append_value('RPATH', '-Wl,-rpath=build/default')
51
52 import Build
53 Build.BuildContext.set_rpath = set_rpath