librpc: Shorten dcerpc_binding_handle_call a bit
[Samba/gebeck_regimport.git] / buildtools / wafadmin / Tools / xlc.py
blobe33b7a16458a17991ec36051a85b2670fb881795
1 #!/usr/bin/env python
2 # encoding: utf-8
3 # Thomas Nagy, 2006-2008 (ita)
4 # Ralf Habacker, 2006 (rh)
5 # Yinon Ehrlich, 2009
6 # Michael Kuhn, 2009
8 import os, sys
9 import Configure, Options, Utils
10 import ccroot, ar
11 from Configure import conftest
13 @conftest
14 def find_xlc(conf):
15 cc = conf.find_program(['xlc_r', 'xlc'], var='CC', mandatory=True)
16 cc = conf.cmd_to_list(cc)
17 conf.env.CC_NAME = 'xlc'
18 conf.env.CC = cc
20 @conftest
21 def find_cpp(conf):
22 v = conf.env
23 cpp = None
24 if v['CPP']: cpp = v['CPP']
25 elif 'CPP' in conf.environ: cpp = conf.environ['CPP']
26 #if not cpp: cpp = v['CC']
27 v['CPP'] = cpp
29 @conftest
30 def xlc_common_flags(conf):
31 v = conf.env
33 # CPPFLAGS CCDEFINES _CCINCFLAGS _CCDEFFLAGS
34 v['CCFLAGS_DEBUG'] = ['-g']
35 v['CCFLAGS_RELEASE'] = ['-O2']
37 v['CC_SRC_F'] = ''
38 v['CC_TGT_F'] = ['-c', '-o', ''] # shell hack for -MD
39 v['CPPPATH_ST'] = '-I%s' # template for adding include paths
41 # linker
42 if not v['LINK_CC']: v['LINK_CC'] = v['CC']
43 v['CCLNK_SRC_F'] = ''
44 v['CCLNK_TGT_F'] = ['-o', ''] # shell hack for -MD
46 v['LIB_ST'] = '-l%s' # template for adding libs
47 v['LIBPATH_ST'] = '-L%s' # template for adding libpaths
48 v['STATICLIB_ST'] = '-l%s'
49 v['STATICLIBPATH_ST'] = '-L%s'
50 v['RPATH_ST'] = '-Wl,-rpath,%s'
51 v['CCDEFINES_ST'] = '-D%s'
53 v['SONAME_ST'] = ''
54 v['SHLIB_MARKER'] = ''
55 v['STATICLIB_MARKER'] = ''
56 v['FULLSTATIC_MARKER'] = '-static'
58 # program
59 v['program_LINKFLAGS'] = ['-Wl,-brtl']
60 v['program_PATTERN'] = '%s'
62 # shared library
63 v['shlib_CCFLAGS'] = ['-fPIC', '-DPIC'] # avoid using -DPIC, -fPIC aleady defines the __PIC__ macro
64 v['shlib_LINKFLAGS'] = ['-G', '-Wl,-brtl,-bexpfull']
65 v['shlib_PATTERN'] = 'lib%s.so'
67 # static lib
68 v['staticlib_LINKFLAGS'] = ''
69 v['staticlib_PATTERN'] = 'lib%s.a'
71 def detect(conf):
72 conf.find_xlc()
73 conf.find_cpp()
74 conf.find_ar()
75 conf.xlc_common_flags()
76 conf.cc_load_tools()
77 conf.cc_add_flags()
78 conf.link_add_flags()