s3: Do not free a string where we should not
[Samba/gbeck.git] / buildtools / wafsamba / generic_cc.py
blob504e902c2a6546c3c9263499042a34fe597c04b2
2 # compiler definition for a generic C compiler
3 # based on suncc.py from waf
5 import os, optparse
6 import Utils, Options, Configure
7 import ccroot, ar
8 from Configure import conftest
10 from compiler_cc import c_compiler
12 c_compiler['default'] = ['gcc', 'generic_cc']
13 c_compiler['hpux'] = ['gcc', 'generic_cc']
15 @conftest
16 def find_generic_cc(conf):
17 v = conf.env
18 cc = None
19 if v['CC']: cc = v['CC']
20 elif 'CC' in conf.environ: cc = conf.environ['CC']
21 if not cc: cc = conf.find_program('cc', var='CC')
22 if not cc: conf.fatal('generic_cc was not found')
23 cc = conf.cmd_to_list(cc)
24 v['CC'] = cc
25 v['CC_NAME'] = 'generic'
27 @conftest
28 def generic_cc_common_flags(conf):
29 v = conf.env
31 v['CC_SRC_F'] = ''
32 v['CC_TGT_F'] = ['-c', '-o', '']
33 v['CPPPATH_ST'] = '-I%s' # template for adding include paths
35 # linker
36 if not v['LINK_CC']: v['LINK_CC'] = v['CC']
37 v['CCLNK_SRC_F'] = ''
38 v['CCLNK_TGT_F'] = ['-o', '']
40 v['LIB_ST'] = '-l%s' # template for adding libs
41 v['LIBPATH_ST'] = '-L%s' # template for adding libpaths
42 v['STATICLIB_ST'] = '-l%s'
43 v['STATICLIBPATH_ST'] = '-L%s'
44 v['CCDEFINES_ST'] = '-D%s'
46 # v['SONAME_ST'] = '-Wl,-h -Wl,%s'
47 # v['SHLIB_MARKER'] = '-Bdynamic'
48 # v['STATICLIB_MARKER'] = '-Bstatic'
50 # program
51 v['program_PATTERN'] = '%s'
53 # shared library
54 # v['shlib_CCFLAGS'] = ['-Kpic', '-DPIC']
55 # v['shlib_LINKFLAGS'] = ['-G']
56 v['shlib_PATTERN'] = 'lib%s.so'
58 # static lib
59 # v['staticlib_LINKFLAGS'] = ['-Bstatic']
60 # v['staticlib_PATTERN'] = 'lib%s.a'
62 detect = '''
63 find_generic_cc
64 find_cpp
65 find_ar
66 generic_cc_common_flags
67 cc_load_tools
68 cc_add_flags
69 link_add_flags
70 '''