####
boost各版本下载地址
#####
#!/bin/sh
# Copyright (C) 2005, 2006 Douglas Gregor.
# Copyright (C) 2006 The Trustees of Indiana University
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
# boostinspect:notab - Tabs are required for the Makefile.
BJAM="" # boost中使用jam工具替代make工具,这里指定jam所在目录
TOOLSET=""# 指定工具链类型, acc | darwin | gcc | como | mipspro | pathscale | pgi | qcc | vacpp
BJAM_CONFIG="" # 知道嗯
BUILD=""
PREFIX=/usr/local
EPREFIX=
LIBDIR= #这里指定生成库文件的安装目录
INCLUDEDIR= #这里指定生成头文件的安装目录
LIBS=""
PYTHON=python
PYTHON_VERSION= #指定python的版本
PYTHON_ROOT= #指定python安装根目录
ICU_ROOT= #libicu是与国际化语言相关的东西
# Internal flags
flag_no_python=
flag_icu=
flag_show_libraries=
## 下边的脚本使用for 和case,用来检测输入的信息
for option
do
case $option in
-help | --help | -h)
want_help=yes ;; #设置帮助信息标签
-prefix=* | --prefix=*)
PREFIX=`expr "x$option" : "x-*prefix=\(.*\)"`
;; #更新PREFIX变量内容
-exec-prefix=* | --exec-prefix=*)
EPREFIX=`expr "x$option" : "x-*exec-prefix=\(.*\)"`
;;
-libdir=* | --libdir=*)
LIBDIR=`expr "x$option" : "x-*libdir=\(.*\)"`
;; #更新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=\(.*\)"`
;; #更新工具bjam所在目录
-with-icu | --with-icu )
flag_icu=yes #更新在ICU库支持标签
;;
-with-icu=* | --with-icu=* )
flag_icu=yes
ICU_ROOT=`expr "x$option" : "x-*with-icu=\(.*\)"`
;;
-without-icu | --without-icu )
flag_icu=no
;;
-with-libraries=* | --with-libraries=* )
#检测支持的boost库
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=* )
#检测不支持的boost库
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]...
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
[automatically detected]
--without-icu disable Unicode/ICU support in Regex
--with-icu=DIR specify the root of the ICU library installation
and enable Unicode/ICU support in Regex
[automatically detected]
--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没有设置,则会执行默认的脚本来确定 toolset
guessed_toolset=`$my_dir/tools/jam/src/build.sh --guess-toolset`
case $guessed_toolset in
acc | darwin | gcc | como | mipspro | pathscale | pgi | qcc | vacpp )
TOOLSET=$guessed_toolset
;;
intel-* )
TOOLSET=intel
;;
mingw )
TOOLSET=gcc
;;
sun* )
TOOLSET=sun
;;
* )
# Not supported by Boost.Build
;;
esac
fi
rm -f config.log
# Build bjam
# 编译bjam工具
if test "x$BJAM" = x; then
echo -n "Building Boost.Jam with toolset $TOOLSET... "
pwd=`pwd`
cd "$my_dir/tools/jam/src" && ./build.sh "$TOOLSET" > config.log 2>&1
cd $pwd
arch=`cd $my_dir/tools/jam/src && ./bootstrap/jam0 -d0 -f build.jam --toolset=$TOOLSET --toolset-root= --show-locate-target && cd ..`
BJAM="$my_dir/tools/jam/src/$arch/bjam"
echo "tools/jam/src/$arch/bjam"
fi
# TBD: Turn BJAM into an absolute path
# If there is a list of libraries
if test "x$flag_show_libraries" = xyes; then
libraries=`$BJAM -d0 --show-libraries`
cat <
The following Boost libraries have portions that require a separate build
and installation step. Any library not listed here can be used by 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="\$(exec_prefix)/lib"
fi
if test "x$INCLUDEDIR" = x; then
INCLUDEDIR="\$(prefix)/include"
fi
# Find Python
if test "x$flag_no_python" = x; then
result=`$PYTHON -c "exit" > /dev/null 2>&1`
if [ "$?" -ne "0" ]; then
flag_no_python=yes
fi
fi
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
fi
# Configure ICU
echo -n "Unicode/ICU support for Boost.Regex?... "
if test "x$flag_icu" != xno; then
if test "x$ICU_ROOT" = x; then
COMMON_ICU_PATHS="/usr /usr/local /sw"
for p in $COMMON_ICU_PATHS; do
if test -r $p/include/unicode/utypes.h; then
ICU_ROOT=$p
fi
done
if test "x$ICU_ROOT" = x; then
echo "not found."
else
BJAM_CONFIG="$BJAM_CONFIG -sICU_PATH=$ICU_ROOT"
echo "$ICU_ROOT"
fi
else
BJAM_CONFIG="$BJAM_CONFIG -sICU_PATH=$ICU_ROOT"
echo "$ICU_ROOT"
fi
else
echo "disabled."
fi
# 备份配置信息
# Backup the user's existing user-config.jam
JAM_CONFIG_OUT="user-config.jam"
if test -r "user-config.jam"; then
counter=1
while test -r "user-config.jam.$counter"; do
counter=`expr $counter + 1`
done
echo "Backing up existing Boost.Build configuration in user-config.jam.$counter"
mv "user-config.jam" "user-config.jam.$counter"
fi
# Generate user-config.jam
echo "Generating Boost.Build configuration in user-config.jam..."
cat > user-config.jam <<EOF
# Boost.Build Configuration
# Automatically generated by Boost configure
# Compiler configuration
using $TOOLSET ;
EOF
# 生成user-config-jam配置文件
# - Python configuration
if test "x$flag_no_python" = x; then
cat >> user-config.jam <<EOF
# Python configuration
using python : $PYTHON_VERSION : $PYTHON_ROOT ;
EOF
fi
# 在声称的user-config-jam配置文件中,追加Python配置信息
# Generate the Makefile
echo "Generating Makefile..."
# 生成总的Makefile文件
cat > Makefile <<EOF
BJAM=$BJAM
BJAM_CONFIG=$BJAM_CONFIG
prefix=$PREFIX
exec_prefix=$EPREFIX
libdir=$LIBDIR
includedir=$INCLUDEDIR
LIBS=$LIBS
all: .dummy
@echo "\$(BJAM) \$(BJAM_CONFIG) --user-config=user-config.jam \$(LIBS)"
@\$(BJAM) \$(BJAM_CONFIG) --user-config=user-config.jam \$(LIBS) || \\
echo "Not all Boost libraries built properly."
clean: .dummy
rm -rf bin.v2
distclean: clean
rm -rf Makefile config.log
check: .dummy
@cd status && ../\$(BJAM) \$(BJAM_CONFIG) --user-config=../user-config.jam || echo "Some Boost regression tests failed. This is normal for many compilers."
install: .dummy
@echo "\$(BJAM) \$(BJAM_CONFIG) --user-config=user-config.jam --prefix=\$(prefix) --exec-prefix=\$(exec_prefix) --libdir=\$(libdir) --includedir=\$(includedir) \$(LIBS) install" echo
@\$(BJAM) \$(BJAM_CONFIG) --user-config=user-config.jam --prefix=\$(prefix) --exec-prefix=\$(exec_prefix)--libdir=\$(libdir) --includedir=\$(includedir) \$(LIBS) install ||"Not all Boost libraries built properly."
.dummy:
EOF
|