diff options
author | Douglas Gregor <doug.gregor@gmail.com> | 2005-10-07 21:06:37 +0000 |
---|---|---|
committer | Douglas Gregor <doug.gregor@gmail.com> | 2005-10-07 21:06:37 +0000 |
commit | a3595d0d75705b4aadb496cd402cec77277531d2 (patch) | |
tree | c1cc087eb9045ba4a7afbdfba978f0a28dabb314 /configure | |
parent | 7f4105fa7a601e590ebb623a7ca5e8d180f5988c (diff) | |
download | boost-a3595d0d75705b4aadb496cd402cec77277531d2.tar.gz |
Initial shot at a configure script for Boost
[SVN r31227]
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 278 |
1 files changed, 278 insertions, 0 deletions
diff --git a/configure b/configure new file mode 100755 index 0000000000..0e1b7cd63c --- /dev/null +++ b/configure @@ -0,0 +1,278 @@ +#!/bin/sh + +BJAM="" +TOOLSET="" +BJAM_CONFIG="" +BUILD="" +PREFIX=/usr/local +EPREFIX= +LIBDIR= +INCLUDEDIR= +LIBS="" +PYTHON=python +PYTHON_VERSION= +PYTHON_ROOT= +ICU_ROOT= + +# Internal flags +flag_no_python= +flag_icu= +flag_show_libraries= + +for option +do + case $option in + + -help | --help | -h) + want_help=yes ;; + + -prefix=* | --prefix=*) + PREFIX=`expr "x$option" : "x-*prefix=\(.*\)"` + ;; + + -exec-prefix=* | --exec-prefix=*) + EPREFIX=`expr "x$option" : "x-*exec-prefix=\(.*\)"` + ;; + + -libdir=* | --libdir=*) + LIBDIR=`expr "x$option" : "x-*libdir=\(.*\)"` + ;; + + -includedir=* | --includedir=*) + INCLUDEDIR=`expr "x$option" : "x-*includedir=\(.*\)"` + ;; + + -show-libraries | --show-libraries ) + flag_show_libraries=yes + ;; + + -with-bjam=* | --with-bjam=* ) + BJAM=`expr "x$option" : "x-*with-bjam=\(.*\)"` + ;; + + -with-icu | --with-icu ) + flag_icu=yes + ;; + + -with-icu=* | --with-icu=* ) + flag_icu=yes + ICU_ROOT=`expr "x$option" : "x-*with-icu=\(.*\)"` + ;; + + -with-libraries=* | --with-libraries=* ) + library_list=`expr "x$option" : "x-*with-libraries=\(.*\)"` + if test "$library_list" != "all"; then + old_IFS=$IFS + IFS=, + for library in $library_list + do + LIBS="$LIBS --with-$library" + + if test $library == python; then + requested_python=yes + fi + done + IFS=$old_IFS + + if test "x$requested_python" != xyes; then + flag_no_python=yes + fi + fi + ;; + + -without-libraries=* | --without-libraries=* ) + library_list=`expr "x$option" : "x-*without-libraries=\(.*\)"` + old_IFS=$IFS + IFS=, + for library in $library_list + do + LIBS="$LIBS --without-$library" + + if test $library == python; then + flag_no_python=yes + fi + done + IFS=$old_IFS + ;; + + -with-python=* | --with-python=* ) + PYTHON=`expr "x$option" : "x-*with-python=\(.*\)"` + ;; + + -with-python-root=* | --with-python-root=* ) + PYTHON_ROOT=`expr "x$option" : "x-*with-python-root=\(.*\)"` + ;; + + -with-python-version=* | --with-python-version=* ) + PYTHON_VERSION=`expr "x$option" : "x-*with-python-version=\(.*\)"` + ;; + + -with-toolset=* | --with-toolset=* ) + TOOLSET=`expr "x$option" : "x-*with-toolset=\(.*\)"` + ;; + + -*) + { echo "error: unrecognized option: $option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + esac +done + +if test "x$want_help" = xyes; then + cat <<EOF +\`configure' configures Boost to adapt to a few kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --with-bjam=BJAM use existing Boost.Jam executable (bjam) + [automatically built] + --with-toolset=TOOLSET use specific Boost.Build toolset + [automatically detected] + --show-libraries show the set of libraries that require build + and installation steps (i.e., those libraries + that can be used with --with-libraries or + --without-libraries), then exit + --with-libraries=list build only a particular set of libraries, + describing using either a comma-separated list of + library names or "all" + [all] + --without-libraries=list build all libraries except the ones listed [] + --with-icu enable Unicode/ICU support in Regex [disabled] + --with-icu=DIR specify the root of the ICU library installation + and enable Unicode/ICU support in Regex [disabled] + --with-python=PYTHON specify the Python executable [python] + --with-python-root=DIR specify the root of the Python installation + [automatically detected] + --with-python-version=X.Y specify the Python version as X.Y + [automatically detected] + +Installation directories: + --prefix=PREFIX install Boost into the given PREFIX + [/usr/local] + --exec-prefix=EPREFIX install Boost binaries into the given EPREFIX + [PREFIX] + +More precise control over installation directories: + --libdir=DIR install libraries here [EPREFIX/lib] + --includedir=DIR install headers here [PREFIX/include] + +EOF +fi +test -n "$want_help" && exit 0 + +# TBD: Determine where the script is located +my_dir="." + +# Determine the toolset, if not already decided +if test "x$TOOLSET" == x; then + TOOLSET=`$my_dir/tools/build/jam_src/build.sh --guess-toolset` +fi + +# Build bjam +if test "x$BJAM" == x; then + echo "Building Boost.Jam..." + pwd=`pwd` + cd "$my_dir/tools/build/jam_src" && ./build.sh "$TOOLSET" + cd $pwd + arch=`cd $my_dir/tools/build/jam_src && ./bootstrap/jam0 -d0 -f build.jam --toolset=$TOOLSET --toolset-root= --show-locate-target && cd ..` + BJAM="$my_dir/tools/build/jam_src/$arch/bjam" +fi + +# If there is a list of libraries +if test "x$flag_show_libraries" == xyes; then + libraries=`$BJAM -d0 --show-libraries` + cat <<EOF +The following Boost libraries have portions that require a separate build +and installation step. Any library not listed here can be used via including +the headers only. + +The Boost libraries requiring separate building and installation are: +EOF + for lib in $libraries + do + echo " $lib" + done + exit 0 +fi + +# Setup paths +if test "x$EPREFIX" == x; then + EPREFIX=$PREFIX +fi + +if test "x$LIBDIR" == x; then + LIBDIR="$EPREFIX/lib" +fi + +if test "x$INCLUDEDIR" == x; then + INCLUDEDIR="$PREFIX/include" +fi + +# Find Python +if test "x$flag_no_python" == x; then + if test "x$PYTHON_VERSION" == x; then + echo -n "Detecting Python version... " + PYTHON_VERSION=`$PYTHON -c "import sys; print (\"%d.%d\" % (sys.version_info[0], sys.version_info[1]))"` + echo $PYTHON_VERSION + fi + + if test "x$PYTHON_ROOT" == x; then + echo -n "Detecting Python root... " + PYTHON_ROOT=`$PYTHON -c "import sys; print sys.prefix"` + echo $PYTHON_ROOT + fi + + BJAM_CONFIG="$BJAM_CONFIG -sPYTHON_ROOT=$PYTHON_ROOT -sPYTHON_VERSION=$PYTHON_VERSION" +fi + +# Configure ICU +if test "x$flag_icu" == xyes; then + echo -n "Unicode/ICU support enabled" + if test "x$ICU_ROOT" == x; then + BJAM_CONFIG="$BJAM_CONFIG -sHAVE_ICU=1" + echo "." + else + BJAM_CONFIG="$BJAM_CONFIG -sICU_PATH=$ICU_ROOT" + echo " in $ICU_ROOT " + fi +else + cat <<EOF +Unicode/ICU support disabled for Boost.Regex. Use --with-icu or --with-icu=DIR. +EOF +fi + + + +# Generate the Makefile +echo "Generating Makefile..." +cat > Makefile <<EOF +BJAM=$BJAM +TOOLSET=$TOOLSET +BJAM_CONFIG=$BJAM_CONFIG +PREFIX=$PREFIX +EPREFIX=$EPREFIX +LIBDIR=$LIBDIR +INCLUDEDIR=$INCLUDEDIR +LIBS=$LIBS + +all: .dummy + \$(BJAM) \$(BJAM_CONFIG) -sTOOLS=\$(TOOLSET) \$(LIBS) + +clean: .dummy + rm -rf bin + +distclean: clean + rm -rf Makefile + +install: .dummy + \$(BJAM) \$(BJAM_CONFIG) --prefix=\$(PREFIX) --exec-prefix=\$(EPREFIX) --libdir=\$(LIBDIR) --includedir=\$(INCLUDEDIR) -sTOOLS=\$(TOOLSET) \$(LIBS) install + +.dummy: + +EOF |