]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/bootstrap.sh
update sources to v12.2.3
[ceph.git] / ceph / src / boost / bootstrap.sh
1 #!/bin/sh
2 # Copyright (C) 2005, 2006 Douglas Gregor.
3 # Copyright (C) 2006 The Trustees of Indiana University
4 #
5 # Distributed under the Boost Software License, Version 1.0.
6 # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
7
8 # boostinspect:notab - Tabs are required for the Makefile.
9
10 BJAM=""
11 TOOLSET=""
12 BJAM_CONFIG=""
13 BUILD=""
14 PREFIX=/usr/local
15 EPREFIX=
16 LIBDIR=
17 INCLUDEDIR=
18 LIBS=""
19 PYTHON=python
20 PYTHON_VERSION=
21 PYTHON_ROOT=
22 ICU_ROOT=
23
24 # Handle case where builtin shell version of echo command doesn't
25 # support -n. Use the installed echo executable if there is one
26 # rather than builtin version to ensure -n is supported.
27 ECHO=`which echo`
28 if test "x$ECHO" = x; then
29 ECHO=echo
30 fi
31
32 # Internal flags
33 flag_no_python=
34 flag_icu=
35 flag_show_libraries=
36
37 for option
38 do
39 case $option in
40
41 -help | --help | -h)
42 want_help=yes ;;
43
44 -prefix=* | --prefix=*)
45 PREFIX=`expr "x$option" : "x-*prefix=\(.*\)"`
46 ;;
47
48 -exec-prefix=* | --exec-prefix=*)
49 EPREFIX=`expr "x$option" : "x-*exec-prefix=\(.*\)"`
50 ;;
51
52 -libdir=* | --libdir=*)
53 LIBDIR=`expr "x$option" : "x-*libdir=\(.*\)"`
54 ;;
55
56 -includedir=* | --includedir=*)
57 INCLUDEDIR=`expr "x$option" : "x-*includedir=\(.*\)"`
58 ;;
59
60 -show-libraries | --show-libraries )
61 flag_show_libraries=yes
62 ;;
63
64 -with-bjam=* | --with-bjam=* )
65 BJAM=`expr "x$option" : "x-*with-bjam=\(.*\)"`
66 ;;
67
68 -with-icu | --with-icu )
69 flag_icu=yes
70 ;;
71
72 -with-icu=* | --with-icu=* )
73 flag_icu=yes
74 ICU_ROOT=`expr "x$option" : "x-*with-icu=\(.*\)"`
75 ;;
76
77 -without-icu | --without-icu )
78 flag_icu=no
79 ;;
80
81 -with-libraries=* | --with-libraries=* )
82 library_list=`expr "x$option" : "x-*with-libraries=\(.*\)"`
83 if test "$library_list" != "all"; then
84 old_IFS=$IFS
85 IFS=,
86 for library in $library_list
87 do
88 LIBS="$LIBS --with-$library"
89
90 if test $library = python; then
91 requested_python=yes
92 fi
93 done
94 IFS=$old_IFS
95
96 if test "x$requested_python" != xyes; then
97 flag_no_python=yes
98 fi
99 fi
100 ;;
101
102 -without-libraries=* | --without-libraries=* )
103 library_list=`expr "x$option" : "x-*without-libraries=\(.*\)"`
104 old_IFS=$IFS
105 IFS=,
106 for library in $library_list
107 do
108 LIBS="$LIBS --without-$library"
109
110 if test $library = python; then
111 flag_no_python=yes
112 fi
113 done
114 IFS=$old_IFS
115 ;;
116
117 -with-python=* | --with-python=* )
118 PYTHON=`expr "x$option" : "x-*with-python=\(.*\)"`
119 ;;
120
121 -with-python-root=* | --with-python-root=* )
122 PYTHON_ROOT=`expr "x$option" : "x-*with-python-root=\(.*\)"`
123 ;;
124
125 -with-python-version=* | --with-python-version=* )
126 PYTHON_VERSION=`expr "x$option" : "x-*with-python-version=\(.*\)"`
127 ;;
128
129 -with-toolset=* | --with-toolset=* )
130 TOOLSET=`expr "x$option" : "x-*with-toolset=\(.*\)"`
131 ;;
132
133 -*)
134 { echo "error: unrecognized option: $option
135 Try \`$0 --help' for more information." >&2
136 { (exit 1); exit 1; }; }
137 ;;
138
139 esac
140 done
141
142 if test "x$want_help" = xyes; then
143 cat <<EOF
144 \`./bootstrap.sh' prepares Boost for building on a few kinds of systems.
145
146 Usage: $0 [OPTION]...
147
148 Defaults for the options are specified in brackets.
149
150 Configuration:
151 -h, --help display this help and exit
152 --with-bjam=BJAM use existing Boost.Jam executable (bjam)
153 [automatically built]
154 --with-toolset=TOOLSET use specific Boost.Build toolset
155 [automatically detected]
156 --show-libraries show the set of libraries that require build
157 and installation steps (i.e., those libraries
158 that can be used with --with-libraries or
159 --without-libraries), then exit
160 --with-libraries=list build only a particular set of libraries,
161 describing using either a comma-separated list of
162 library names or "all"
163 [all]
164 --without-libraries=list build all libraries except the ones listed []
165 --with-icu enable Unicode/ICU support in Regex
166 [automatically detected]
167 --without-icu disable Unicode/ICU support in Regex
168 --with-icu=DIR specify the root of the ICU library installation
169 and enable Unicode/ICU support in Regex
170 [automatically detected]
171 --with-python=PYTHON specify the Python executable [python]
172 --with-python-root=DIR specify the root of the Python installation
173 [automatically detected]
174 --with-python-version=X.Y specify the Python version as X.Y
175 [automatically detected]
176
177 Installation directories:
178 --prefix=PREFIX install Boost into the given PREFIX
179 [/usr/local]
180 --exec-prefix=EPREFIX install Boost binaries into the given EPREFIX
181 [PREFIX]
182
183 More precise control over installation directories:
184 --libdir=DIR install libraries here [EPREFIX/lib]
185 --includedir=DIR install headers here [PREFIX/include]
186
187 EOF
188 fi
189 test -n "$want_help" && exit 0
190
191 my_dir=$(dirname "$0")
192
193 # Determine the toolset, if not already decided
194 if test "x$TOOLSET" = x; then
195 guessed_toolset=`$my_dir/tools/build/src/engine/build.sh --guess-toolset`
196 case $guessed_toolset in
197 acc | darwin | gcc | como | mipspro | pathscale | pgi | qcc | vacpp )
198 TOOLSET=$guessed_toolset
199 ;;
200
201 intel-* )
202 TOOLSET=intel
203 ;;
204
205 mingw )
206 TOOLSET=gcc
207 ;;
208
209 sun* )
210 TOOLSET=sun
211 ;;
212
213 * )
214 # Not supported by Boost.Build
215 ;;
216 esac
217 fi
218
219 rm -f config.log
220
221 # Build bjam
222 if test "x$BJAM" = x; then
223 $ECHO -n "Building Boost.Build engine with toolset $TOOLSET... "
224 pwd=`pwd`
225 (cd "$my_dir/tools/build/src/engine" && ./build.sh "$TOOLSET") > bootstrap.log 2>&1
226 if [ $? -ne 0 ]; then
227 echo
228 echo "Failed to build Boost.Build build engine"
229 echo "Consult 'bootstrap.log' for more details"
230 exit 1
231 fi
232 cd "$pwd"
233 arch=`cd $my_dir/tools/build/src/engine && ./bootstrap/jam0 -d0 -f build.jam --toolset=$TOOLSET --toolset-root= --show-locate-target && cd ..`
234 BJAM="$my_dir/tools/build/src/engine/$arch/b2"
235 echo "tools/build/src/engine/$arch/b2"
236 cp "$BJAM" .
237 cp "$my_dir/tools/build/src/engine/$arch/bjam" .
238
239 fi
240
241 # TBD: Turn BJAM into an absolute path
242
243 # If there is a list of libraries
244 if test "x$flag_show_libraries" = xyes; then
245 cat <<EOF
246
247 The following Boost libraries have portions that require a separate build
248 and installation step. Any library not listed here can be used by including
249 the headers only.
250
251 The Boost libraries requiring separate building and installation are:
252 EOF
253 $BJAM -d0 --show-libraries | grep '^[[:space:]]*-'
254 exit 0
255 fi
256
257 # Setup paths
258 if test "x$EPREFIX" = x; then
259 EPREFIX="$PREFIX"
260 fi
261
262 if test "x$LIBDIR" = x; then
263 LIBDIR="$EPREFIX/lib"
264 fi
265
266 if test "x$INCLUDEDIR" = x; then
267 INCLUDEDIR="$PREFIX/include"
268 fi
269
270 # Find Python
271 if test "x$flag_no_python" = x; then
272 result=`$PYTHON -c "exit" > /dev/null 2>&1`
273 if [ "$?" -ne "0" ]; then
274 flag_no_python=yes
275 fi
276 fi
277
278 if test "x$flag_no_python" = x; then
279 if test "x$PYTHON_VERSION" = x; then
280 $ECHO -n "Detecting Python version... "
281 PYTHON_VERSION=`$PYTHON -c "import sys; print (\"%d.%d\" % (sys.version_info[0], sys.version_info[1]))"`
282 echo $PYTHON_VERSION
283 fi
284
285 if test "x$PYTHON_ROOT" = x; then
286 $ECHO -n "Detecting Python root... "
287 PYTHON_ROOT=`$PYTHON -c "import sys; print(sys.prefix)"`
288 echo $PYTHON_ROOT
289 fi
290 fi
291
292 # Configure ICU
293 $ECHO -n "Unicode/ICU support for Boost.Regex?... "
294 if test "x$flag_icu" != xno; then
295 if test "x$ICU_ROOT" = x; then
296 COMMON_ICU_PATHS="/usr /usr/local /sw"
297 for p in $COMMON_ICU_PATHS; do
298 if test -r $p/include/unicode/utypes.h; then
299 ICU_ROOT=$p
300 fi
301 done
302
303 if test "x$ICU_ROOT" = x; then
304 echo "not found."
305 else
306 BJAM_CONFIG="$BJAM_CONFIG -sICU_PATH=$ICU_ROOT"
307 echo "$ICU_ROOT"
308 fi
309 else
310 BJAM_CONFIG="$BJAM_CONFIG -sICU_PATH=$ICU_ROOT"
311 echo "$ICU_ROOT"
312 fi
313 else
314 echo "disabled."
315 fi
316
317 # Backup the user's existing project-config.jam
318 JAM_CONFIG_OUT="project-config.jam"
319 if test -r "project-config.jam"; then
320 counter=1
321
322 while test -r "project-config.jam.$counter"; do
323 counter=`expr $counter + 1`
324 done
325
326 echo "Backing up existing Boost.Build configuration in project-config.jam.$counter"
327 mv "project-config.jam" "project-config.jam.$counter"
328 fi
329
330 # Generate user-config.jam
331 echo "Generating Boost.Build configuration in project-config.jam..."
332 cat > project-config.jam <<EOF
333 # Boost.Build Configuration
334 # Automatically generated by bootstrap.sh
335
336 import option ;
337 import feature ;
338
339 # Compiler configuration. This definition will be used unless
340 # you already have defined some toolsets in your user-config.jam
341 # file.
342 if ! $TOOLSET in [ feature.values <toolset> ]
343 {
344 using $TOOLSET ;
345 }
346
347 project : default-build <toolset>$TOOLSET ;
348 EOF
349
350 # - Python configuration
351 if test "x$flag_no_python" = x; then
352 cat >> project-config.jam <<EOF
353
354 # Python configuration
355 import python ;
356 if ! [ python.configured ]
357 {
358 using python : $PYTHON_VERSION : $PYTHON_ROOT ;
359 }
360 EOF
361 fi
362
363 if test "x$ICU_ROOT" != x; then
364 cat >> project-config.jam << EOF
365
366 path-constant ICU_PATH : $ICU_ROOT ;
367
368 EOF
369 fi
370
371 cat >> project-config.jam << EOF
372
373 # List of --with-<library> and --without-<library>
374 # options. If left empty, all libraries will be built.
375 # Options specified on the command line completely
376 # override this variable.
377 libraries = $LIBS ;
378
379 # These settings are equivivalent to corresponding command-line
380 # options.
381 option.set prefix : $PREFIX ;
382 option.set exec-prefix : $EPREFIX ;
383 option.set libdir : $LIBDIR ;
384 option.set includedir : $INCLUDEDIR ;
385
386 # Stop on first error
387 option.set keep-going : false ;
388 EOF
389
390 cat << EOF
391
392 Bootstrapping is done. To build, run:
393
394 ./b2
395
396 To adjust configuration, edit 'project-config.jam'.
397 Further information:
398
399 - Command line help:
400 ./b2 --help
401
402 - Getting started guide:
403 http://www.boost.org/more/getting_started/unix-variants.html
404
405 - Boost.Build documentation:
406 http://www.boost.org/build/doc/html/index.html
407
408 EOF