]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/src/tools/sun.jam
bump version to 18.2.4-pve3
[ceph.git] / ceph / src / boost / tools / build / src / tools / sun.jam
1 # Copyright (C) Christopher Currie 2003. Permission to copy, use,
2 # modify, sell and distribute this software is granted provided this
3 # copyright notice appears in all copies. This software is provided
4 # "as is" without express or implied warranty, and with no claim as
5 # to its suitability for any purpose.
6
7 #| tag::doc[]
8
9 [[bbv2.reference.tools.compiler.sun]]
10 = Sun Studio
11
12 The `sun` module supports the
13 http://developers.sun.com/sunstudio/index.jsp[Sun Studio] C++ compilers
14 for the Solaris OS.
15
16 The module is initialized using the following syntax:
17
18 ----
19 using sun : [version] : [c++-compile-command] : [compiler options] ;
20 ----
21
22 This statement may be repeated several times, if you want to configure
23 several versions of the compiler.
24
25 If the command is not specified, B2 will search for a binary
26 named `CC` in `/opt/SUNWspro/bin` and in PATH.
27
28 When using this compiler on complex C++ code, such as the
29 http://boost.org[Boost C++ library], it is recommended to specify the
30 following options when initializing the `sun` module:
31
32 ----
33 -library=stlport4 -features=tmplife -features=tmplrefstatic
34 ----
35
36 See the http://blogs.sun.com/sga/entry/command_line_options[Sun C++
37 Frontend Tales] for details.
38
39 The following options can be provided, using
40 _`<option-name>option-value syntax`_:
41
42 `cflags`::
43 Specifies additional compiler flags that will be used when compiling C
44 sources.
45
46 `cxxflags`::
47 Specifies additional compiler flags that will be used when compiling C++
48 sources.
49
50 `compileflags`::
51 Specifies additional compiler flags that will be used when compiling both C
52 and C++ sources.
53
54 `linkflags`::
55 Specifies additional command line options that will be passed to the linker.
56
57 Starting with Sun Studio 12, you can create 64-bit applications by using
58 the `address-model=64` property.
59
60 |# # end::doc[]
61
62 import property ;
63 import generators ;
64 import os ;
65 import toolset : flags ;
66 import feature ;
67 import type ;
68 import common ;
69
70 feature.extend toolset : sun ;
71 toolset.inherit sun : unix ;
72 generators.override sun.prebuilt : builtin.lib-generator ;
73 generators.override sun.prebuilt : builtin.prebuilt ;
74 generators.override sun.searched-lib-generator : searched-lib-generator ;
75
76
77 rule init ( version ? : command * : options * )
78 {
79 local condition = [
80 common.check-init-parameters sun : version $(version) ] ;
81
82 command = [ common.get-invocation-command sun : CC
83 : $(command) : "/opt/SUNWspro/bin" ] ;
84
85 # Even if the real compiler is not found, put CC to
86 # command line so that user see command line that would have being executed.
87 command ?= CC ;
88
89 common.handle-options sun : $(condition) : $(command) : $(options) ;
90
91 command_c = $(command[1--2]) $(command[-1]:B=cc) ;
92
93 toolset.flags sun CONFIG_C_COMMAND $(condition) : $(command_c) ;
94 }
95
96 # Declare generators
97 generators.register-c-compiler sun.compile.c : C : OBJ : <toolset>sun ;
98 generators.register-c-compiler sun.compile.c++ : CPP : OBJ : <toolset>sun ;
99
100 # Declare flags and actions for compilation
101 flags sun.compile OPTIONS <debug-symbols>on : -g ;
102 flags sun.compile OPTIONS <profiling>on : -xprofile=tcov ;
103 flags sun.compile OPTIONS <optimization>speed : -xO4 ;
104 flags sun.compile OPTIONS <optimization>space : -xO2 -xspace ;
105 flags sun.compile OPTIONS <threading>multi : -mt ;
106 flags sun.compile OPTIONS <warnings>off : -erroff ;
107 flags sun.compile OPTIONS <warnings>on : -erroff=%none ;
108 flags sun.compile OPTIONS <warnings>all : -erroff=%none ;
109 flags sun.compile OPTIONS <warnings>extra : -erroff=%none ;
110 flags sun.compile OPTIONS <warnings>pedantic : -erroff=%none ;
111 flags sun.compile OPTIONS <warnings-as-errors>on : -errwarn ;
112
113 flags sun.compile OPTIONS <local-visibility>hidden : -xldscope=hidden ;
114 flags sun.compile OPTIONS <local-visibility>protected : -xldscope=symbolic ;
115 flags sun.compile OPTIONS <local-visibility>global : -xldscope=global ;
116
117 flags sun.compile.c++ OPTIONS <inlining>off : +d ;
118
119 # There are no less than 5 standard library options:
120 # 1) The default, which uses an old version of the Rogue Wave std lib,
121 # also available via -std=sun03.
122 # 2) C++03 mode + STLport, selected via the -library option.
123 # 3) C++03 mode plus the Apache std lib, selected via the -library option.
124 # 4) C++03 or C++11 in g++ compatibility mode, and GNU libstdc++3, selected via -std=c++03/11.
125 #
126 # Note that the -std, -library and -compat compiler switches appear to be largely mutually
127 # incompatible, and that going forward the -std switch seems to be the preferred one.
128 #
129 # See http://docs.oracle.com/cd/E37069_01/html/E37075/bkamw.html#OSSCPgnaof
130 #
131
132 flags sun.compile.c++ OPTIONS <stdlib>sun-stlport : -library=stlport4 -compat=5 -features=zla ;
133 flags sun.link OPTIONS <stdlib>sun-stlport : -library=stlport4 -compat=5 ;
134
135 flags sun.compile.c++ OPTIONS <stdlib>apache : -library=stdcxx4 -compat=5 -features=zla ;
136 flags sun.link OPTIONS <stdlib>apache : -library=stdcxx4 -compat=5 ;
137
138 flags sun.compile.c++ OPTIONS <stdlib>gnu : -std=c++03 ;
139 flags sun.compile.c++ DEFINES <stdlib>gnu : _GLIBCXX_USE_CXX11_ABI=0 ;
140 flags sun.link OPTIONS <stdlib>gnu : -std=c++03 ;
141
142 flags sun.compile.c++ OPTIONS <stdlib>gnu11 : -std=c++11 ;
143 flags sun.compile.c++ DEFINES <stdlib>gnu11 : _GLIBCXX_USE_CXX11_ABI=1 ;
144 flags sun.link OPTIONS <stdlib>gnu11 : -std=c++11 ;
145
146 # The -m32 and -m64 options are supported starting
147 # with Sun Studio 12. On earlier compilers, the
148 # 'address-model' feature is not supported and should not
149 # be used. Instead, use -xarch=generic64 command line
150 # option.
151 # See http://svn.boost.org/trac/boost/ticket/1186
152 # for details.
153 flags sun OPTIONS <address-model>32 : -m32 ;
154 flags sun OPTIONS <address-model>64 : -m64 ;
155 # On sparc, there's a difference between -Kpic
156 # and -KPIC. The first is slightly more efficient,
157 # but has the limits on the size of GOT table.
158 # For minimal fuss on user side, we use -KPIC here.
159 # See http://svn.boost.org/trac/boost/ticket/1186#comment:6
160 # for detailed explanation.
161 flags sun OPTIONS <link>shared : -KPIC ;
162
163 flags sun.compile OPTIONS <cflags> ;
164 flags sun.compile.c++ OPTIONS <cxxflags> ;
165 flags sun.compile DEFINES <define> ;
166 flags sun.compile INCLUDES <include> ;
167
168 actions compile.c
169 {
170 "$(CONFIG_C_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
171 }
172
173 actions compile.c++
174 {
175 "$(CONFIG_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
176 }
177
178 # Declare flags and actions for linking
179 flags sun.link OPTIONS <debug-symbols>on : -g ;
180 # Strip the binary when no debugging is needed
181 flags sun.link OPTIONS <debug-symbols>off : -s ;
182 flags sun.link OPTIONS <profiling>on : -xprofile=tcov ;
183 flags sun.link OPTIONS <threading>multi : -mt ;
184 flags sun.link OPTIONS <linkflags> ;
185 flags sun.link LINKPATH <library-path> ;
186 flags sun.link FINDLIBS-ST <find-static-library> ;
187 flags sun.link FINDLIBS-SA <find-shared-library> ;
188 flags sun.link LIBRARIES <library-file> ;
189 flags sun.link LINK-RUNTIME <runtime-link>static : static ;
190 flags sun.link LINK-RUNTIME <runtime-link>shared : dynamic ;
191 flags sun.link RPATH <dll-path> ;
192 # On gcc, there are separate options for dll path at runtime and
193 # link time. On Solaris, there's only one: -R, so we have to use
194 # it, even though it's bad idea.
195 flags sun.link RPATH <xdll-path> ;
196
197 # The POSIX real-time library is always needed (nanosleep, clock_gettime etc.)
198 flags sun.link FINDLIBS-SA : rt ;
199
200 rule link ( targets * : sources * : properties * )
201 {
202 SPACE on $(targets) = " " ;
203 }
204
205 actions link bind LIBRARIES
206 {
207 "$(CONFIG_COMMAND)" $(OPTIONS) -L"$(LINKPATH)" -R"$(RPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -Bdynamic -l$(FINDLIBS-SA) -Bstatic -l$(FINDLIBS-ST) -B$(LINK-RUNTIME)
208 }
209
210 # Slight mods for dlls
211 rule link.dll ( targets * : sources * : properties * )
212 {
213 SPACE on $(targets) = " " ;
214 }
215
216 actions link.dll bind LIBRARIES
217 {
218 "$(CONFIG_COMMAND)" $(OPTIONS) -L"$(LINKPATH)" -R"$(RPATH)" -o "$(<)" -h$(<[1]:D=) -G "$(>)" "$(LIBRARIES)" -Bdynamic -l$(FINDLIBS-SA) -Bstatic -l$(FINDLIBS-ST) -B$(LINK-RUNTIME)
219 }
220
221 # Declare action for creating static libraries
222 actions piecemeal archive
223 {
224 "$(CONFIG_COMMAND)" -xar -o "$(<)" "$(>)"
225 }
226