third_party:waf: update to upstream 2.0.4 release
[amitay/samba.git] / third_party / waf / waflib / Tools / suncxx.py
1 #! /usr/bin/env python
2 # encoding: utf-8
3 # WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
4
5 #!/usr/bin/env python
6 # encoding: utf-8
7 # Thomas Nagy, 2006-2018 (ita)
8 # Ralf Habacker, 2006 (rh)
9
10 from waflib import Errors
11 from waflib.Tools import ccroot, ar
12 from waflib.Configure import conf
13
14 @conf
15 def find_sxx(conf):
16         """
17         Detects the sun C++ compiler
18         """
19         v = conf.env
20         cc = conf.find_program(['CC', 'c++'], var='CXX')
21         try:
22                 conf.cmd_and_log(cc + ['-flags'])
23         except Errors.WafError:
24                 conf.fatal('%r is not a Sun compiler' % cc)
25         v.CXX_NAME = 'sun'
26         conf.get_suncc_version(cc)
27
28 @conf
29 def sxx_common_flags(conf):
30         """
31         Flags required for executing the sun C++ compiler
32         """
33         v = conf.env
34
35         v.CXX_SRC_F           = []
36         v.CXX_TGT_F           = ['-c', '-o', '']
37
38         if not v.LINK_CXX:
39                 v.LINK_CXX = v.CXX
40
41         v.CXXLNK_SRC_F        = []
42         v.CXXLNK_TGT_F        = ['-o', '']
43         v.CPPPATH_ST          = '-I%s'
44         v.DEFINES_ST          = '-D%s'
45
46         v.LIB_ST              = '-l%s' # template for adding libs
47         v.LIBPATH_ST          = '-L%s' # template for adding libpaths
48         v.STLIB_ST            = '-l%s'
49         v.STLIBPATH_ST        = '-L%s'
50
51         v.SONAME_ST           = '-Wl,-h,%s'
52         v.SHLIB_MARKER        = '-Bdynamic'
53         v.STLIB_MARKER        = '-Bstatic'
54
55         v.cxxprogram_PATTERN  = '%s'
56
57         v.CXXFLAGS_cxxshlib   = ['-xcode=pic32', '-DPIC']
58         v.LINKFLAGS_cxxshlib  = ['-G']
59         v.cxxshlib_PATTERN    = 'lib%s.so'
60
61         v.LINKFLAGS_cxxstlib  = ['-Bstatic']
62         v.cxxstlib_PATTERN    = 'lib%s.a'
63
64 def configure(conf):
65         conf.find_sxx()
66         conf.find_ar()
67         conf.sxx_common_flags()
68         conf.cxx_load_tools()
69         conf.cxx_add_flags()
70         conf.link_add_flags()
71