torture4: Replace direct netlogon ping calls with netlogon_pings()
[samba4-gss.git] / buildtools / wafsamba / generic_cc.py
blob1352c547acf6fb9a673db1a09a706c7b84be652c
2 # compiler definition for a generic C compiler
3 # based on suncc.py from waf
5 import os, optparse
6 from waflib import Errors
7 from waflib.Tools import ccroot, ar
8 from waflib.Configure import conf
11 # Let waflib provide useful defaults, but
12 # provide generic_cc as last resort fallback on
13 # all platforms
15 from waflib.Tools.compiler_c import c_compiler
16 for key in c_compiler.keys():
17 c_compiler[key].append('generic_cc')
19 @conf
20 def find_generic_cc(conf):
21 v = conf.env
22 cc = None
23 if v.CC:
24 cc = v.CC
25 elif 'CC' in conf.environ:
26 cc = conf.environ['CC']
27 if not cc:
28 cc = conf.find_program('cc', var='CC')
29 if not cc:
30 conf.fatal('generic_cc was not found')
32 try:
33 conf.cmd_and_log(cc + ['--version'])
34 except Errors.WafError:
35 conf.fatal('%r --version could not be executed' % cc)
37 v.CC = cc
38 v.CC_NAME = 'generic_cc'
40 @conf
41 def generic_cc_common_flags(conf):
42 v = conf.env
44 v.CC_SRC_F = ''
45 v.CC_TGT_F = ['-c', '-o']
46 v.CPPPATH_ST = '-I%s'
47 v.DEFINES_ST = '-D%s'
49 if not v.LINK_CC:
50 v.LINK_CC = v.CC
52 v.CCLNK_SRC_F = ''
53 v.CCLNK_TGT_F = ['-o']
55 v.LIB_ST = '-l%s' # template for adding libs
56 v.LIBPATH_ST = '-L%s' # template for adding libpaths
57 v.STLIB_ST = '-l%s'
58 v.STLIBPATH_ST = '-L%s'
60 v.cprogram_PATTERN = '%s'
61 v.cshlib_PATTERN = 'lib%s.so'
62 v.cstlib_PATTERN = 'lib%s.a'
64 def configure(conf):
65 conf.find_generic_cc()
66 conf.find_ar()
67 conf.generic_cc_common_flags()
68 conf.cc_load_tools()
69 conf.cc_add_flags()
70 conf.link_add_flags()