5 Permission is hereby granted, free of charge, to any person obtaining
6 a copy of this software and associated documentation files (the
7 "Software"), to deal in the Software without restriction, including
8 without limitation the rights to use, copy, modify, merge, publish,
9 distribute, sublicense, and/or sell copies of the Software, and to
10 permit persons to whom the Software is furnished to do so, subject to
11 the following conditions:
13 The above copyright notice and this permission notice shall be included
14 in all copies or substantial portions of the Software.
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 Configuring the right options to build programs to work with
29 libraries--especially shared libraries--that are available
30 on POSIX systems can be very complicated.
31 To help this situation,
32 various utilies with names that end in <filename>config</filename>
33 return the command-line options for the GNU Compiler Collection (GCC)
34 that are needed to use these libraries;
35 for example, the command-line options
36 to use a library named <filename>lib</filename>
37 would be found by calling a utility named <filename>lib-config</filename>.
43 A more recent convention is that these options
44 are available from the generic <filename>pkg-config</filename> program,
45 which has common framework, error handling, and the like,
46 so that all the package creator has to do is provide the set of strings
47 for his particular package.
53 &SCons; construction environments have a &ParseConfig; method
54 that executes a <filename>*config</filename> utility
55 (either <filename>pkg-config</filename> or a
56 more specific utility)
57 and configures the appropriate construction variables
59 based on the command-line options
60 returned by the specified command.
66 env['CPPPATH'] = ['/lib/compat']
67 env.ParseConfig("pkg-config x11 --cflags --libs")
73 &SCons; will execute the specified command string,
74 parse the resultant flags,
75 and add the flags to the appropriate environment variables.
80 % <userinput>scons -Q</userinput>
81 ['/lib/compat', '/usr/X11/include']
82 scons: `.' is up to date.
87 In the example above, &SCons; has added the include directory to
88 <varname>CPPPATH</varname>.
89 (Depending upon what other flags are emitted by the
90 <filename>pkg-config</filename> command,
91 other variables may have been extended as well.)
97 Note that the options are merged with existing options using
98 the &MergeFlags; method,
99 so that each option only occurs once in the construction variable:
105 env.ParseConfig("pkg-config x11 --cflags --libs")
106 env.ParseConfig("pkg-config x11 --cflags --libs")
111 % <userinput>scons -Q</userinput>
113 scons: `.' is up to date.