3 SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org)
4 SPDX-License-Identifier: MIT
5 SPDX-FileType: DOCUMENTATION
7 This file is processed by the bin/SConsDoc.py module.
11 <!ENTITY % scons SYSTEM '../../doc/scons.mod'>
13 <!ENTITY % builders-mod SYSTEM '../../doc/generated/builders.mod'>
15 <!ENTITY % functions-mod SYSTEM '../../doc/generated/functions.mod'>
17 <!ENTITY % tools-mod SYSTEM '../../doc/generated/tools.mod'>
19 <!ENTITY % variables-mod SYSTEM '../../doc/generated/variables.mod'>
23 <sconsdoc xmlns="http://www.scons.org/dbxsd/v1.0"
24 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
25 xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0 http://www.scons.org/dbxsd/v1.0/scons.xsd">
30 Sets construction variables for generic POSIX linkers. This is
31 a "smart" linker tool which selects a compiler to complete the linking
32 based on the types of source files.
37 <item>LINKFLAGS</item>
39 <item>LIBDIRPREFIX</item>
40 <item>LIBDIRSUFFIX</item>
41 <item>LIBLINKPREFIX</item>
42 <item>LIBLINKSUFFIX</item>
44 <item>SHLINKFLAGS</item>
45 <item>SHLINKCOM</item>
46 <item>SHLIBSUFFIX</item>
47 <item>__SHLIBVERSIONFLAGS</item>
49 <item>LDMODULEPREFIX</item>
50 <item>LDMODULESUFFIX</item>
51 <item>LDMODULEFLAGS</item>
52 <item>LDMODULECOM</item>
53 <item>LDMODULEVERSION</item>
54 <item>LDMODULENOVERSIONSYMLINKS</item>
55 <item>LDMODULEVERSIONFLAGS</item>
56 <item>__LDMODULEVERSIONFLAGS</item>
59 <item>LINKCOMSTR</item>
60 <item>SHLINKCOMSTR</item>
61 <item>LDMODULECOMSTR</item>
65 <cvar name="__LDMODULEVERSIONFLAGS">
68 This construction variable automatically introduces &cv-link-_LDMODULEVERSIONFLAGS;
69 if &cv-link-LDMODULEVERSION; is set. Otherwise, it evaluates to an empty string.
74 <cvar name="__SHLIBVERSIONFLAGS">
77 This construction variable automatically introduces &cv-link-_SHLIBVERSIONFLAGS;
78 if &cv-link-SHLIBVERSION; is set. Otherwise, it evaluates to an empty string.
83 <cvar name="_LDMODULESONAME">
86 A macro that automatically generates loadable module's SONAME based on $TARGET,
87 $LDMODULEVERSION and $LDMODULESUFFIX. Used by &b-link-LoadableModule; builder
88 when the linker tool supports SONAME (e.g. &t-link-gnulink;).
93 <cvar name="_LDMODULEVERSIONFLAGS">
96 This macro automatically introduces extra flags to &cv-link-LDMODULECOM; when
97 building versioned &b-link-LoadableModule; (that is when
98 &cv-link-LDMODULEVERSION; is set). <literal>_LDMODULEVERSIONFLAGS</literal>
99 usually adds &cv-link-SHLIBVERSIONFLAGS; and some extra dynamically generated
100 options (such as <literal>-Wl,-soname=$_LDMODULESONAME</literal>). It is unused
101 by plain (unversioned) loadable modules.
106 <cvar name="_SHLIBVERSIONFLAGS">
109 This macro automatically introduces extra flags to &cv-link-SHLINKCOM; when
110 building versioned &b-link-SharedLibrary; (that is when &cv-link-SHLIBVERSION;
111 is set). <literal>_SHLIBVERSIONFLAGS</literal> usually adds &cv-link-SHLIBVERSIONFLAGS;
112 and some extra dynamically generated options (such as
113 <literal>-Wl,-soname=$_SHLIBSONAME</literal>. It is unused by "plain"
114 (unversioned) shared libraries.
119 <cvar name="_SHLIBSONAME">
122 A macro that automatically generates shared library's SONAME based on $TARGET,
123 $SHLIBVERSION and $SHLIBSUFFIX. Used by &b-link-SharedLibrary; builder when
124 the linker tool supports SONAME (e.g. &t-link-gnulink;).
129 <cvar name="IMPLIBPREFIX">
132 The prefix used for import library names. For example, cygwin uses import
133 libraries (<literal>libfoo.dll.a</literal>) in pair with dynamic libraries
134 (<literal>cygfoo.dll</literal>). The &t-link-cyglink; linker sets
135 &cv-link-IMPLIBPREFIX; to <literal>'lib'</literal> and &cv-link-SHLIBPREFIX;
136 to <literal>'cyg'</literal>.
141 <cvar name="IMPLIBSUFFIX">
144 The suffix used for import library names. For example, cygwin uses import
145 libraries (<literal>libfoo.dll.a</literal>) in pair with dynamic libraries
146 (<literal>cygfoo.dll</literal>). The &t-link-cyglink; linker sets
147 &cv-link-IMPLIBSUFFIX; to <literal>'.dll.a'</literal> and &cv-link-SHLIBSUFFIX;
148 to <literal>'.dll'</literal>.
153 <cvar name="IMPLIBNOVERSIONSYMLINKS">
156 Used to override &cv-link-SHLIBNOVERSIONSYMLINKS;/&cv-link-LDMODULENOVERSIONSYMLINKS; when
157 creating versioned import library for a shared library/loadable module. If not defined,
158 then &cv-link-SHLIBNOVERSIONSYMLINKS;/&cv-link-LDMODULENOVERSIONSYMLINKS; is used to determine
159 whether to disable symlink generation or not.
164 <cvar name="LDMODULE">
167 The linker for building loadable modules.
168 By default, this is the same as &cv-link-SHLINK;.
173 <cvar name="LDMODULECOM">
176 The command line for building loadable modules.
177 On Mac OS X, this uses the &cv-link-LDMODULE;,
178 &cv-link-LDMODULEFLAGS; and
179 &cv-link-FRAMEWORKSFLAGS; variables.
180 On other systems, this is the same as &cv-link-SHLINK;.
185 <cvar name="LDMODULECOMSTR">
188 If set, the string displayed when building loadable modules.
189 If not set, then &cv-link-LDMODULECOM; (the command line) is displayed.
194 <cvar name="LDMODULEFLAGS">
197 General user options passed to the linker for building loadable modules.
202 <cvar name="LDMODULENOVERSIONSYMLINKS">
205 Instructs the &b-link-LoadableModule; builder to not automatically create symlinks
206 for versioned modules. Defaults to <literal>$SHLIBNOVERSIONSYMLINKS</literal>
211 <cvar name="LDMODULEPREFIX">
214 The prefix used for loadable module file names.
215 On Mac OS X, this is null;
216 on other systems, this is
217 the same as &cv-link-SHLIBPREFIX;.
222 <cvar name="LDMODULESUFFIX">
225 The suffix used for loadable module file names.
226 On Mac OS X, this is null;
227 on other systems, this is
228 the same as $SHLIBSUFFIX.
233 <cvar name="LDMODULEVERSIONFLAGS">
236 Extra flags added to &cv-link-LDMODULECOM; when building versioned
237 &b-link-LoadableModule;. These flags are only used when &cv-link-LDMODULEVERSION; is
247 See also &cv-link-SHLINK; for linking shared objects.
250 On POSIX systems (those using the &t-link-link; tool),
251 you should normally not change this value as it defaults
252 to a "smart" linker tool which selects a compiler
253 driver matching the type of source files in use.
254 So for example, if you set &cv-link-CXX; to a specific
255 compiler name, and are compiling C++ sources,
256 the smartlink function will automatically select the same compiler
262 <cvar name="LINKCOM">
265 The command line used to link object files into an executable.
266 See also &cv-link-SHLINKCOM; for linking shared objects.
271 <cvar name="LINKCOMSTR">
274 If set, the string displayed when object files
275 are linked into an executable.
276 If not set, then &cv-link-LINKCOM; (the command line) is displayed.
277 See also &cv-link-SHLINKCOMSTR;. for linking shared objects.
281 env = Environment(LINKCOMSTR = "Linking $TARGET")
286 <cvar name="LINKFLAGS">
289 General user options passed to the linker.
290 Note that this variable should
291 <emphasis>not</emphasis>
294 (or similar) options for linking with the libraries listed in &cv-link-LIBS;,
297 (or similar) library search path options
298 that scons generates automatically from &cv-link-LIBPATH;.
302 for the variable that expands to library-link options,
304 &cv-link-_LIBDIRFLAGS;
306 for the variable that expands to library search path options.
307 See also &cv-link-SHLINKFLAGS;. for linking shared objects.
312 <cvar name="SHLIBNOVERSIONSYMLINKS">
315 Instructs the &b-link-SharedLibrary; builder to not create symlinks for versioned
321 <cvar name="SHLIBVERSIONFLAGS">
324 Extra flags added to &cv-link-SHLINKCOM; when building versioned
325 &b-link-SharedLibrary;. These flags are only used when &cv-link-SHLIBVERSION; is
334 The linker for programs that use shared libraries.
335 See also &cv-link-LINK; for linking static objects.
338 On POSIX systems (those using the &t-link-link; tool),
339 you should normally not change this value as it defaults
340 to a "smart" linker tool which selects a compiler
341 driver matching the type of source files in use.
342 So for example, if you set &cv-link-SHCXX; to a specific
343 compiler name, and are compiling C++ sources,
344 the smartlink function will automatically select the same compiler
350 <cvar name="SHLINKCOM">
353 The command line used to link programs using shared libraries.
354 See also &cv-link-LINKCOM; for linking static objects.
359 <cvar name="SHLINKCOMSTR">
362 The string displayed when programs using shared libraries are linked.
363 If this is not set, then &cv-link-SHLINKCOM; (the command line) is displayed.
364 See also &cv-link-LINKCOMSTR; for linking static objects.
368 env = Environment(SHLINKCOMSTR = "Linking shared $TARGET")
373 <cvar name="SHLINKFLAGS">
376 General user options passed to the linker for programs using shared libraries.
377 Note that this variable should
378 <emphasis>not</emphasis>
381 (or similar) options for linking with the libraries listed in &cv-link-LIBS;,
384 (or similar) include search path options
385 that scons generates automatically from &cv-link-LIBPATH;.
389 for the variable that expands to library-link options,
391 &cv-link-_LIBDIRFLAGS;
393 for the variable that expands to library search path options.
394 See also &cv-link-LINKFLAGS; for linking static objects.
402 Variable used to hard-code SONAME for versioned shared library/loadable module.
404 env.SharedLibrary('test', 'test.c', SHLIBVERSION='0.1.2', SONAME='libtest.so.2')
406 The variable is used, for example, by &t-link-gnulink; linker tool.
411 <cvar name="SOVERSION">
414 This will construct the <varname>SONAME</varname> using on the base library name
415 (<parameter>test</parameter> in the example below) and use specified <varname>SOVERSION</varname>
416 to create <varname>SONAME</varname>.
418 env.SharedLibrary('test', 'test.c', SHLIBVERSION='0.1.2', SOVERSION='2')
420 The variable is used, for example, by &t-link-gnulink; linker tool.
423 In the example above <varname>SONAME</varname> would be <filename>libtest.so.2</filename>
424 which would be a symlink and point to <filename>libtest.so.0.1.2</filename>
429 <cvar name="STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME">
432 When this variable is true, static objects and shared objects are assumed to be the same; that is, SCons does not check for linking static objects into a shared library.