build: allow specifying prerequisite flags when checking flags
[samba.git] / buildtools / wafsamba / hpuxcc.py
1 # compiler definition for HPUX
2 # based on suncc.py from waf
3
4 import os, optparse, sys
5 import Utils, Options, Configure
6 import ccroot, ar
7 from Configure import conftest
8 import gcc
9
10
11 @conftest
12 def gcc_modifier_hpux(conf):
13     v=conf.env
14     v['CCFLAGS_DEBUG']=['-g']
15     v['CCFLAGS_RELEASE']=['-O2']
16     v['CC_SRC_F']=''
17     v['CC_TGT_F']=['-c','-o','']
18     v['CPPPATH_ST']='-I%s'
19     if not v['LINK_CC']:v['LINK_CC']=v['CC']
20     v['CCLNK_SRC_F']=''
21     v['CCLNK_TGT_F']=['-o','']
22     v['LIB_ST']='-l%s'
23     v['LIBPATH_ST']='-L%s'
24     v['STATICLIB_ST']='-l%s'
25     v['STATICLIBPATH_ST']='-L%s'
26     v['RPATH_ST']='-Wl,-rpath,%s'
27     v['CCDEFINES_ST']='-D%s'
28     v['SONAME_ST']='-Wl,-h,%s'
29     v['SHLIB_MARKER']=[]
30 #    v['STATICLIB_MARKER']='-Wl,-Bstatic'
31     v['FULLSTATIC_MARKER']='-static'
32     v['program_PATTERN']='%s'
33     v['shlib_CCFLAGS']=['-fPIC','-DPIC']
34     v['shlib_LINKFLAGS']=['-shared']
35     v['shlib_PATTERN']='lib%s.sl'
36 #   v['staticlib_LINKFLAGS']=['-Wl,-Bstatic']
37     v['staticlib_PATTERN']='lib%s.a'
38
39 gcc.gcc_modifier_hpux = gcc_modifier_hpux
40
41 from TaskGen import feature, after
42 @feature('cprogram', 'cshlib')
43 @after('apply_link', 'apply_lib_vars', 'apply_obj_vars')
44 def hpux_addfullpath(self):
45   if sys.platform == 'hp-ux11':
46     link = getattr(self, 'link_task', None)
47     if link:
48         lst = link.env.LINKFLAGS
49         buf = []
50         for x in lst:
51            if x.startswith('-L'):
52                p2 = x[2:]
53                if not os.path.isabs(p2):
54                    x = x[:2] + self.bld.srcnode.abspath(link.env) + "/../" + x[2:].lstrip('.')
55            buf.append(x)
56         link.env.LINKFLAGS = buf