wafsamba: improve -fvisibility=hidden, we should check it together this WERROR_CFLAGS
[Samba.git] / buildtools / wafadmin / Tools / suncc.py
blobb1a2aad4037a256620f8942a275e9d31e66f29f3
1 #!/usr/bin/env python
2 # encoding: utf-8
3 # Thomas Nagy, 2006 (ita)
4 # Ralf Habacker, 2006 (rh)
6 import os, optparse
7 import Utils, Options, Configure
8 import ccroot, ar
9 from Configure import conftest
11 @conftest
12 def find_scc(conf):
13 v = conf.env
14 cc = None
15 if v['CC']: cc = v['CC']
16 elif 'CC' in conf.environ: cc = conf.environ['CC']
17 #if not cc: cc = conf.find_program('gcc', var='CC')
18 if not cc: cc = conf.find_program('cc', var='CC')
19 if not cc: conf.fatal('suncc was not found')
20 cc = conf.cmd_to_list(cc)
22 try:
23 if not Utils.cmd_output(cc + ['-flags']):
24 conf.fatal('suncc %r was not found' % cc)
25 except ValueError:
26 conf.fatal('suncc -flags could not be executed')
28 v['CC'] = cc
29 v['CC_NAME'] = 'sun'
31 @conftest
32 def scc_common_flags(conf):
33 v = conf.env
35 # CPPFLAGS CCDEFINES _CCINCFLAGS _CCDEFFLAGS
37 v['CC_SRC_F'] = ''
38 v['CC_TGT_F'] = ['-c', '-o', '']
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', ''] # solaris hack, separate the -o from the target
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['CCDEFINES_ST'] = '-D%s'
52 v['SONAME_ST'] = '-Wl,-h -Wl,%s'
53 v['SHLIB_MARKER'] = '-Bdynamic'
54 v['STATICLIB_MARKER'] = '-Bstatic'
56 # program
57 v['program_PATTERN'] = '%s'
59 # shared library
60 v['shlib_CCFLAGS'] = ['-Kpic', '-DPIC']
61 v['shlib_LINKFLAGS'] = ['-G']
62 v['shlib_PATTERN'] = 'lib%s.so'
64 # static lib
65 v['staticlib_LINKFLAGS'] = ['-Bstatic']
66 v['staticlib_PATTERN'] = 'lib%s.a'
68 detect = '''
69 find_scc
70 find_cpp
71 find_ar
72 scc_common_flags
73 cc_load_tools
74 cc_add_flags
75 link_add_flags
76 '''