Detab
[boost.git] / configure
blob4e967e62275a272e6576c2142d8b5411de07c15d
1 #!/bin/sh
2 # Copyright (C) 2005, 2006 Douglas Gregor.
3 # Copyright (C) 2006 The Trustees of Indiana University
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)
8 # boostinspect:notab - Tabs are required for the Makefile.
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=
24 # Internal flags
25 flag_no_python=
26 flag_icu=
27 flag_show_libraries=
29 for option
31 case $option in
33 -help | --help | -h)
34 want_help=yes ;;
36 -prefix=* | --prefix=*)
37 PREFIX=`expr "x$option" : "x-*prefix=\(.*\)"`
40 -exec-prefix=* | --exec-prefix=*)
41 EPREFIX=`expr "x$option" : "x-*exec-prefix=\(.*\)"`
44 -libdir=* | --libdir=*)
45 LIBDIR=`expr "x$option" : "x-*libdir=\(.*\)"`
48 -includedir=* | --includedir=*)
49 INCLUDEDIR=`expr "x$option" : "x-*includedir=\(.*\)"`
52 -show-libraries | --show-libraries )
53 flag_show_libraries=yes
56 -with-bjam=* | --with-bjam=* )
57 BJAM=`expr "x$option" : "x-*with-bjam=\(.*\)"`
60 -with-icu | --with-icu )
61 flag_icu=yes
64 -with-icu=* | --with-icu=* )
65 flag_icu=yes
66 ICU_ROOT=`expr "x$option" : "x-*with-icu=\(.*\)"`
69 -without-icu | --without-icu )
70 flag_icu=no
73 -with-libraries=* | --with-libraries=* )
74 library_list=`expr "x$option" : "x-*with-libraries=\(.*\)"`
75 if test "$library_list" != "all"; then
76 old_IFS=$IFS
77 IFS=,
78 for library in $library_list
80 LIBS="$LIBS --with-$library"
82 if test $library = python; then
83 requested_python=yes
85 done
86 IFS=$old_IFS
88 if test "x$requested_python" != xyes; then
89 flag_no_python=yes
94 -without-libraries=* | --without-libraries=* )
95 library_list=`expr "x$option" : "x-*without-libraries=\(.*\)"`
96 old_IFS=$IFS
97 IFS=,
98 for library in $library_list
100 LIBS="$LIBS --without-$library"
102 if test $library = python; then
103 flag_no_python=yes
105 done
106 IFS=$old_IFS
109 -with-python=* | --with-python=* )
110 PYTHON=`expr "x$option" : "x-*with-python=\(.*\)"`
113 -with-python-root=* | --with-python-root=* )
114 PYTHON_ROOT=`expr "x$option" : "x-*with-python-root=\(.*\)"`
117 -with-python-version=* | --with-python-version=* )
118 PYTHON_VERSION=`expr "x$option" : "x-*with-python-version=\(.*\)"`
121 -with-toolset=* | --with-toolset=* )
122 TOOLSET=`expr "x$option" : "x-*with-toolset=\(.*\)"`
126 { echo "error: unrecognized option: $option
127 Try \`$0 --help' for more information." >&2
128 { (exit 1); exit 1; }; }
131 esac
132 done
134 if test "x$want_help" = xyes; then
135 cat <<EOF
136 \`configure' configures Boost to adapt to a few kinds of systems.
138 Usage: $0 [OPTION]...
140 Defaults for the options are specified in brackets.
142 Configuration:
143 -h, --help display this help and exit
144 --with-bjam=BJAM use existing Boost.Jam executable (bjam)
145 [automatically built]
146 --with-toolset=TOOLSET use specific Boost.Build toolset
147 [automatically detected]
148 --show-libraries show the set of libraries that require build
149 and installation steps (i.e., those libraries
150 that can be used with --with-libraries or
151 --without-libraries), then exit
152 --with-libraries=list build only a particular set of libraries,
153 describing using either a comma-separated list of
154 library names or "all"
155 [all]
156 --without-libraries=list build all libraries except the ones listed []
157 --with-icu enable Unicode/ICU support in Regex
158 [automatically detected]
159 --without-icu disable Unicode/ICU support in Regex
160 --with-icu=DIR specify the root of the ICU library installation
161 and enable Unicode/ICU support in Regex
162 [automatically detected]
163 --with-python=PYTHON specify the Python executable [python]
164 --with-python-root=DIR specify the root of the Python installation
165 [automatically detected]
166 --with-python-version=X.Y specify the Python version as X.Y
167 [automatically detected]
169 Installation directories:
170 --prefix=PREFIX install Boost into the given PREFIX
171 [/usr/local]
172 --exec-prefix=EPREFIX install Boost binaries into the given EPREFIX
173 [PREFIX]
175 More precise control over installation directories:
176 --libdir=DIR install libraries here [EPREFIX/lib]
177 --includedir=DIR install headers here [PREFIX/include]
181 test -n "$want_help" && exit 0
183 # TBD: Determine where the script is located
184 my_dir="."
186 # Determine the toolset, if not already decided
187 if test "x$TOOLSET" = x; then
188 guessed_toolset=`$my_dir/tools/jam/src/build.sh --guess-toolset`
189 case $guessed_toolset in
190 acc | darwin | gcc | como | mipspro | pathscale | pgi | qcc | vacpp )
191 TOOLSET=$guessed_toolset
194 intel-* )
195 TOOLSET=intel
198 mingw )
199 TOOLSET=gcc
202 sun* )
203 TOOLSET=sun
207 # Not supported by Boost.Build
209 esac
212 rm -f config.log
214 # Build bjam
215 if test "x$BJAM" = x; then
216 echo -n "Building Boost.Jam with toolset $TOOLSET... "
217 pwd=`pwd`
218 cd "$my_dir/tools/jam/src" && ./build.sh "$TOOLSET" > config.log 2>&1
219 cd $pwd
220 arch=`cd $my_dir/tools/jam/src && ./bootstrap/jam0 -d0 -f build.jam --toolset=$TOOLSET --toolset-root= --show-locate-target && cd ..`
221 BJAM="$my_dir/tools/jam/src/$arch/bjam"
222 echo "tools/jam/src/$arch/bjam"
225 # TBD: Turn BJAM into an absolute path
227 # If there is a list of libraries
228 if test "x$flag_show_libraries" = xyes; then
229 libraries=`$BJAM -d0 --show-libraries`
230 cat <<EOF
232 The following Boost libraries have portions that require a separate build
233 and installation step. Any library not listed here can be used by including
234 the headers only.
236 The Boost libraries requiring separate building and installation are:
238 for lib in $libraries
240 echo " $lib"
241 done
242 exit 0
245 # Setup paths
246 if test "x$EPREFIX" = x; then
247 EPREFIX="\$(prefix)"
250 if test "x$LIBDIR" = x; then
251 LIBDIR="\$(exec_prefix)/lib"
254 if test "x$INCLUDEDIR" = x; then
255 INCLUDEDIR="\$(prefix)/include"
258 # Find Python
259 if test "x$flag_no_python" = x; then
260 result=`$PYTHON -c "exit" > /dev/null 2>&1`
261 if [ "$?" -ne "0" ]; then
262 flag_no_python=yes
266 if test "x$flag_no_python" = x; then
267 if test "x$PYTHON_VERSION" = x; then
268 echo -n "Detecting Python version... "
269 PYTHON_VERSION=`$PYTHON -c "import sys; print (\"%d.%d\" % (sys.version_info[0], sys.version_info[1]))"`
270 echo $PYTHON_VERSION
273 if test "x$PYTHON_ROOT" = x; then
274 echo -n "Detecting Python root... "
275 PYTHON_ROOT=`$PYTHON -c "import sys; print sys.prefix"`
276 echo $PYTHON_ROOT
280 # Configure ICU
281 echo -n "Unicode/ICU support for Boost.Regex?... "
282 if test "x$flag_icu" != xno; then
283 if test "x$ICU_ROOT" = x; then
284 COMMON_ICU_PATHS="/usr /usr/local /sw"
285 for p in $COMMON_ICU_PATHS; do
286 if test -r $p/include/unicode/utypes.h; then
287 ICU_ROOT=$p
289 done
291 if test "x$ICU_ROOT" = x; then
292 echo "not found."
293 else
294 BJAM_CONFIG="$BJAM_CONFIG -sICU_PATH=$ICU_ROOT"
295 echo "$ICU_ROOT"
297 else
298 BJAM_CONFIG="$BJAM_CONFIG -sICU_PATH=$ICU_ROOT"
299 echo "$ICU_ROOT"
301 else
302 echo "disabled."
305 # Backup the user's existing user-config.jam
306 JAM_CONFIG_OUT="user-config.jam"
307 if test -r "user-config.jam"; then
308 counter=1
310 while test -r "user-config.jam.$counter"; do
311 counter=`expr $counter + 1`
312 done
314 echo "Backing up existing Boost.Build configuration in user-config.jam.$counter"
315 mv "user-config.jam" "user-config.jam.$counter"
318 # Generate user-config.jam
319 echo "Generating Boost.Build configuration in user-config.jam..."
320 cat > user-config.jam <<EOF
321 # Boost.Build Configuration
322 # Automatically generated by Boost configure
324 # Compiler configuration
325 using $TOOLSET ;
328 # - Python configuration
329 if test "x$flag_no_python" = x; then
330 cat >> user-config.jam <<EOF
332 # Python configuration
333 using python : $PYTHON_VERSION : $PYTHON_ROOT ;
337 # Generate the Makefile
338 echo "Generating Makefile..."
339 cat > Makefile <<EOF
340 BJAM=$BJAM
341 BJAM_CONFIG=$BJAM_CONFIG
342 prefix=$PREFIX
343 exec_prefix=$EPREFIX
344 libdir=$LIBDIR
345 includedir=$INCLUDEDIR
346 LIBS=$LIBS
348 all: .dummy
349 @echo "\$(BJAM) \$(BJAM_CONFIG) --user-config=user-config.jam \$(LIBS)"
350 @\$(BJAM) \$(BJAM_CONFIG) --user-config=user-config.jam \$(LIBS) || \\
351 echo "Not all Boost libraries built properly."
353 clean: .dummy
354 rm -rf bin.v2
356 distclean: clean
357 rm -rf Makefile config.log
359 check: .dummy
360 @cd status && ../\$(BJAM) \$(BJAM_CONFIG) --user-config=../user-config.jam || echo "Some Boost regression tests failed. This is normal for many compilers."
362 install: .dummy
363 @echo "\$(BJAM) \$(BJAM_CONFIG) --user-config=user-config.jam --prefix=\$(prefix) --exec-prefix=\$(exec_prefix) --libdir=\$(libdir) --includedir=\$(includedir) \$(LIBS) install"
364 @\$(BJAM) \$(BJAM_CONFIG) --user-config=user-config.jam --prefix=\$(prefix) --exec-prefix=\$(exec_prefix) --libdir=\$(libdir) --includedir=\$(includedir) \$(LIBS) install || echo "Not all Boost libraries built properly."
366 .dummy: