1 | #!/bin/sh |
---|
2 | # Copyright 2005 Douglas Gregor. |
---|
3 | # Distributed under the Boost Software License, Version 1.0. |
---|
4 | # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) |
---|
5 | BJAM="" |
---|
6 | TOOLSET="" |
---|
7 | BJAM_CONFIG="" |
---|
8 | BUILD="" |
---|
9 | PREFIX=/usr/local |
---|
10 | EPREFIX= |
---|
11 | LIBDIR= |
---|
12 | INCLUDEDIR= |
---|
13 | LIBS="" |
---|
14 | PYTHON=python |
---|
15 | PYTHON_VERSION= |
---|
16 | PYTHON_ROOT= |
---|
17 | ICU_ROOT= |
---|
18 | |
---|
19 | # Internal flags |
---|
20 | flag_no_python= |
---|
21 | flag_icu= |
---|
22 | flag_show_libraries= |
---|
23 | |
---|
24 | for option |
---|
25 | do |
---|
26 | case $option in |
---|
27 | |
---|
28 | -help | --help | -h) |
---|
29 | want_help=yes ;; |
---|
30 | |
---|
31 | -prefix=* | --prefix=*) |
---|
32 | PREFIX=`expr "x$option" : "x-*prefix=\(.*\)"` |
---|
33 | ;; |
---|
34 | |
---|
35 | -exec-prefix=* | --exec-prefix=*) |
---|
36 | EPREFIX=`expr "x$option" : "x-*exec-prefix=\(.*\)"` |
---|
37 | ;; |
---|
38 | |
---|
39 | -libdir=* | --libdir=*) |
---|
40 | LIBDIR=`expr "x$option" : "x-*libdir=\(.*\)"` |
---|
41 | ;; |
---|
42 | |
---|
43 | -includedir=* | --includedir=*) |
---|
44 | INCLUDEDIR=`expr "x$option" : "x-*includedir=\(.*\)"` |
---|
45 | ;; |
---|
46 | |
---|
47 | -show-libraries | --show-libraries ) |
---|
48 | flag_show_libraries=yes |
---|
49 | ;; |
---|
50 | |
---|
51 | -with-bjam=* | --with-bjam=* ) |
---|
52 | BJAM=`expr "x$option" : "x-*with-bjam=\(.*\)"` |
---|
53 | ;; |
---|
54 | |
---|
55 | -with-icu | --with-icu ) |
---|
56 | flag_icu=yes |
---|
57 | ;; |
---|
58 | |
---|
59 | -with-icu=* | --with-icu=* ) |
---|
60 | flag_icu=yes |
---|
61 | ICU_ROOT=`expr "x$option" : "x-*with-icu=\(.*\)"` |
---|
62 | ;; |
---|
63 | |
---|
64 | -with-libraries=* | --with-libraries=* ) |
---|
65 | library_list=`expr "x$option" : "x-*with-libraries=\(.*\)"` |
---|
66 | if test "$library_list" != "all"; then |
---|
67 | old_IFS=$IFS |
---|
68 | IFS=, |
---|
69 | for library in $library_list |
---|
70 | do |
---|
71 | LIBS="$LIBS --with-$library" |
---|
72 | |
---|
73 | if test $library = python; then |
---|
74 | requested_python=yes |
---|
75 | fi |
---|
76 | done |
---|
77 | IFS=$old_IFS |
---|
78 | |
---|
79 | if test "x$requested_python" != "xyes" ; then |
---|
80 | flag_no_python=yes |
---|
81 | fi |
---|
82 | fi |
---|
83 | ;; |
---|
84 | |
---|
85 | -without-libraries=* | --without-libraries=* ) |
---|
86 | library_list=`expr "x$option" : "x-*without-libraries=\(.*\)"` |
---|
87 | old_IFS=$IFS |
---|
88 | IFS=, |
---|
89 | for library in $library_list |
---|
90 | do |
---|
91 | LIBS="$LIBS --without-$library" |
---|
92 | |
---|
93 | if test $library = "python" ; then |
---|
94 | flag_no_python=yes |
---|
95 | fi |
---|
96 | done |
---|
97 | IFS=$old_IFS |
---|
98 | ;; |
---|
99 | |
---|
100 | -with-python=* | --with-python=* ) |
---|
101 | PYTHON=`expr "x$option" : "x-*with-python=\(.*\)"` |
---|
102 | ;; |
---|
103 | |
---|
104 | -with-python-root=* | --with-python-root=* ) |
---|
105 | PYTHON_ROOT=`expr "x$option" : "x-*with-python-root=\(.*\)"` |
---|
106 | ;; |
---|
107 | |
---|
108 | -with-python-version=* | --with-python-version=* ) |
---|
109 | PYTHON_VERSION=`expr "x$option" : "x-*with-python-version=\(.*\)"` |
---|
110 | ;; |
---|
111 | |
---|
112 | -with-toolset=* | --with-toolset=* ) |
---|
113 | TOOLSET=`expr "x$option" : "x-*with-toolset=\(.*\)"` |
---|
114 | ;; |
---|
115 | |
---|
116 | -*) |
---|
117 | { echo "error: unrecognized option: $option |
---|
118 | Try \`$0 --help' for more information." >&2 |
---|
119 | { (exit 1); exit 1; }; } |
---|
120 | ;; |
---|
121 | |
---|
122 | esac |
---|
123 | done |
---|
124 | |
---|
125 | if test "x$want_help" = xyes; then |
---|
126 | cat <<EOF |
---|
127 | \`configure' configures Boost to adapt to a few kinds of systems. |
---|
128 | |
---|
129 | Usage: $0 [OPTION]... |
---|
130 | |
---|
131 | Defaults for the options are specified in brackets. |
---|
132 | |
---|
133 | Configuration: |
---|
134 | -h, --help display this help and exit |
---|
135 | --with-bjam=BJAM use existing Boost.Jam executable (bjam) |
---|
136 | [automatically built] |
---|
137 | --with-toolset=TOOLSET use specific Boost.Build toolset |
---|
138 | [automatically detected] |
---|
139 | --show-libraries show the set of libraries that require build |
---|
140 | and installation steps (i.e., those libraries |
---|
141 | that can be used with --with-libraries or |
---|
142 | --without-libraries), then exit |
---|
143 | --with-libraries=list build only a particular set of libraries, |
---|
144 | describing using either a comma-separated list of |
---|
145 | library names or "all" |
---|
146 | [all] |
---|
147 | --without-libraries=list build all libraries except the ones listed [] |
---|
148 | --with-icu enable Unicode/ICU support in Regex [disabled] |
---|
149 | --with-icu=DIR specify the root of the ICU library installation |
---|
150 | and enable Unicode/ICU support in Regex [disabled] |
---|
151 | --with-python=PYTHON specify the Python executable [python] |
---|
152 | --with-python-root=DIR specify the root of the Python installation |
---|
153 | [automatically detected] |
---|
154 | --with-python-version=X.Y specify the Python version as X.Y |
---|
155 | [automatically detected] |
---|
156 | |
---|
157 | Installation directories: |
---|
158 | --prefix=PREFIX install Boost into the given PREFIX |
---|
159 | [/usr/local] |
---|
160 | --exec-prefix=EPREFIX install Boost binaries into the given EPREFIX |
---|
161 | [PREFIX] |
---|
162 | |
---|
163 | More precise control over installation directories: |
---|
164 | --libdir=DIR install libraries here [EPREFIX/lib] |
---|
165 | --includedir=DIR install headers here [PREFIX/include] |
---|
166 | |
---|
167 | EOF |
---|
168 | fi |
---|
169 | test -n "$want_help" && exit 0 |
---|
170 | |
---|
171 | # TBD: Determine where the script is located |
---|
172 | my_dir="." |
---|
173 | |
---|
174 | # Determine the toolset, if not already decided |
---|
175 | if test "x$TOOLSET" = "x" ; then |
---|
176 | TOOLSET=`$my_dir/tools/build/jam_src/build.sh --guess-toolset` |
---|
177 | fi |
---|
178 | |
---|
179 | rm -f config.log |
---|
180 | |
---|
181 | # Build bjam |
---|
182 | if test "x$BJAM" = "x" ; then |
---|
183 | echo -n "Building Boost.Jam with toolset $TOOLSET... " |
---|
184 | pwd=`pwd` |
---|
185 | cd "$my_dir/tools/build/jam_src" && ./build.sh "$TOOLSET" > config.log 2>&1 |
---|
186 | cd $pwd |
---|
187 | arch=`cd $my_dir/tools/build/jam_src && ./bootstrap/jam0 -d0 -f build.jam --toolset=$TOOLSET --toolset-root= --show-locate-target && cd ..` |
---|
188 | BJAM="$my_dir/tools/build/jam_src/$arch/bjam" |
---|
189 | echo "tools/build/jam_src/$arch/bjam" |
---|
190 | fi |
---|
191 | |
---|
192 | # TBD: Turn BJAM into an absolute path |
---|
193 | |
---|
194 | # If there is a list of libraries |
---|
195 | if test "x$flag_show_libraries" = "xyes" ; then |
---|
196 | libraries=`$BJAM -d0 --show-libraries` |
---|
197 | cat <<EOF |
---|
198 | |
---|
199 | The following Boost libraries have portions that require a separate build |
---|
200 | and installation step. Any library not listed here can be used by including |
---|
201 | the headers only. |
---|
202 | |
---|
203 | The Boost libraries requiring separate building and installation are: |
---|
204 | EOF |
---|
205 | for lib in $libraries |
---|
206 | do |
---|
207 | echo " $lib" |
---|
208 | done |
---|
209 | exit 0 |
---|
210 | fi |
---|
211 | |
---|
212 | # Setup paths |
---|
213 | if test "x$EPREFIX" = "x" ; then |
---|
214 | EPREFIX=$PREFIX |
---|
215 | fi |
---|
216 | |
---|
217 | if test "x$LIBDIR" = "x" ; then |
---|
218 | LIBDIR="$EPREFIX/lib" |
---|
219 | fi |
---|
220 | |
---|
221 | if test "x$INCLUDEDIR" = "x" ; then |
---|
222 | INCLUDEDIR="$PREFIX/include" |
---|
223 | fi |
---|
224 | |
---|
225 | # Find Python |
---|
226 | if test "x$flag_no_python" = "x" ; then |
---|
227 | if test "x$PYTHON_VERSION" = "x" ; then |
---|
228 | echo -n "Detecting Python version... " |
---|
229 | PYTHON_VERSION=`$PYTHON -c "import sys; print (\"%d.%d\" % (sys.version_info[0], sys.version_info[1]))" 2>&1` |
---|
230 | if test $? != 0 ; then |
---|
231 | echo "not found." |
---|
232 | flag_no_python="yes" |
---|
233 | LIBS="$LIBS --without-python" |
---|
234 | else |
---|
235 | echo $PYTHON_VERSION |
---|
236 | fi |
---|
237 | fi |
---|
238 | |
---|
239 | if test "x$flag_no_python" = "x" ; then |
---|
240 | if test "x$PYTHON_ROOT" = "x" ; then |
---|
241 | echo -n "Detecting Python root... " |
---|
242 | PYTHON_ROOT=`$PYTHON -c "import sys; print sys.prefix" 2>&1` |
---|
243 | if test $? != 0 ; then |
---|
244 | echo "not found." |
---|
245 | flag_no_python="yes" |
---|
246 | LIBS="$LIBS --without-python" |
---|
247 | else |
---|
248 | echo $PYTHON_ROOT |
---|
249 | fi |
---|
250 | fi |
---|
251 | fi |
---|
252 | |
---|
253 | echo -n "Python support?... " |
---|
254 | if test "x$flag_no_python" = "x" ; then |
---|
255 | echo "yes." |
---|
256 | BJAM_CONFIG="$BJAM_CONFIG -sPYTHON_ROOT=$PYTHON_ROOT -sPYTHON_VERSION=$PYTHON_VERSION" |
---|
257 | else |
---|
258 | echo "no." |
---|
259 | fi |
---|
260 | fi |
---|
261 | |
---|
262 | # Configure ICU |
---|
263 | echo -n "Unicode/ICU support for Boost.Regex?... " |
---|
264 | if test "x$flag_icu" = "xyes" ; then |
---|
265 | if test "x$ICU_ROOT" = "x" ; then |
---|
266 | BJAM_CONFIG="$BJAM_CONFIG -sHAVE_ICU=1" |
---|
267 | echo "yes." |
---|
268 | else |
---|
269 | BJAM_CONFIG="$BJAM_CONFIG -sICU_PATH=$ICU_ROOT" |
---|
270 | echo "$ICU_ROOT" |
---|
271 | fi |
---|
272 | else |
---|
273 | echo "no." |
---|
274 | fi |
---|
275 | |
---|
276 | |
---|
277 | |
---|
278 | # Generate the Makefile |
---|
279 | echo "Generating Makefile..." |
---|
280 | cat > Makefile <<EOF |
---|
281 | BJAM=$BJAM |
---|
282 | TOOLSET=$TOOLSET |
---|
283 | BJAM_CONFIG=$BJAM_CONFIG |
---|
284 | PREFIX=$PREFIX |
---|
285 | EPREFIX=$EPREFIX |
---|
286 | LIBDIR=$LIBDIR |
---|
287 | INCLUDEDIR=$INCLUDEDIR |
---|
288 | LIBS=$LIBS |
---|
289 | |
---|
290 | all: .dummy |
---|
291 | @echo "\$(BJAM) \$(BJAM_CONFIG) -sTOOLS=\$(TOOLSET) \$(LIBS)" |
---|
292 | @\$(BJAM) \$(BJAM_CONFIG) -sTOOLS=\$(TOOLSET) \$(LIBS) || \\ |
---|
293 | echo "Not all Boost libraries built properly." |
---|
294 | |
---|
295 | clean: .dummy |
---|
296 | rm -rf bin |
---|
297 | |
---|
298 | distclean: clean |
---|
299 | rm -rf Makefile config.log |
---|
300 | |
---|
301 | check: .dummy |
---|
302 | @cd status && ../\$(BJAM) \$(BJAM_CONFIG) -sTOOLS=\$(TOOLSET) test || echo "Some Boost regression tests failed. This is normal." |
---|
303 | |
---|
304 | install: .dummy |
---|
305 | @echo "\$(BJAM) \$(BJAM_CONFIG) --prefix=\$(PREFIX) --exec-prefix=\$(EPREFIX) --libdir=\$(LIBDIR) --includedir=\$(INCLUDEDIR) -sTOOLS=\$(TOOLSET) \$(LIBS) install" |
---|
306 | @\$(BJAM) \$(BJAM_CONFIG) --prefix=\$(PREFIX) --exec-prefix=\$(EPREFIX) --libdir=\$(LIBDIR) --includedir=\$(INCLUDEDIR) -sTOOLS=\$(TOOLSET) \$(LIBS) install || echo "Not all Boost libraries built properly." |
---|
307 | |
---|
308 | .dummy: |
---|
309 | |
---|
310 | EOF |
---|