configure 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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. # Internal flags
  19. flag_no_python=
  20. flag_icu=
  21. flag_show_libraries=
  22. for option
  23. do
  24. case $option in
  25. -help | --help | -h)
  26. want_help=yes ;;
  27. -prefix=* | --prefix=*)
  28. PREFIX=`expr "x$option" : "x-*prefix=\(.*\)"`
  29. ;;
  30. -exec-prefix=* | --exec-prefix=*)
  31. EPREFIX=`expr "x$option" : "x-*exec-prefix=\(.*\)"`
  32. ;;
  33. -libdir=* | --libdir=*)
  34. LIBDIR=`expr "x$option" : "x-*libdir=\(.*\)"`
  35. ;;
  36. -includedir=* | --includedir=*)
  37. INCLUDEDIR=`expr "x$option" : "x-*includedir=\(.*\)"`
  38. ;;
  39. -show-libraries | --show-libraries )
  40. flag_show_libraries=yes
  41. ;;
  42. -with-bjam=* | --with-bjam=* )
  43. BJAM=`expr "x$option" : "x-*with-bjam=\(.*\)"`
  44. ;;
  45. -with-icu | --with-icu )
  46. flag_icu=yes
  47. ;;
  48. -with-icu=* | --with-icu=* )
  49. flag_icu=yes
  50. ICU_ROOT=`expr "x$option" : "x-*with-icu=\(.*\)"`
  51. ;;
  52. -with-libraries=* | --with-libraries=* )
  53. library_list=`expr "x$option" : "x-*with-libraries=\(.*\)"`
  54. if test "$library_list" != "all"; then
  55. old_IFS=$IFS
  56. IFS=,
  57. for library in $library_list
  58. do
  59. LIBS="$LIBS --with-$library"
  60. if test $library == python; then
  61. requested_python=yes
  62. fi
  63. done
  64. IFS=$old_IFS
  65. if test "x$requested_python" != xyes; then
  66. flag_no_python=yes
  67. fi
  68. fi
  69. ;;
  70. -without-libraries=* | --without-libraries=* )
  71. library_list=`expr "x$option" : "x-*without-libraries=\(.*\)"`
  72. old_IFS=$IFS
  73. IFS=,
  74. for library in $library_list
  75. do
  76. LIBS="$LIBS --without-$library"
  77. if test $library == python; then
  78. flag_no_python=yes
  79. fi
  80. done
  81. IFS=$old_IFS
  82. ;;
  83. -with-python=* | --with-python=* )
  84. PYTHON=`expr "x$option" : "x-*with-python=\(.*\)"`
  85. ;;
  86. -with-python-root=* | --with-python-root=* )
  87. PYTHON_ROOT=`expr "x$option" : "x-*with-python-root=\(.*\)"`
  88. ;;
  89. -with-python-version=* | --with-python-version=* )
  90. PYTHON_VERSION=`expr "x$option" : "x-*with-python-version=\(.*\)"`
  91. ;;
  92. -with-toolset=* | --with-toolset=* )
  93. TOOLSET=`expr "x$option" : "x-*with-toolset=\(.*\)"`
  94. ;;
  95. -*)
  96. { echo "error: unrecognized option: $option
  97. Try \`$0 --help' for more information." >&2
  98. { (exit 1); exit 1; }; }
  99. ;;
  100. esac
  101. done
  102. if test "x$want_help" = xyes; then
  103. cat <<EOF
  104. \`configure' configures Boost to adapt to a few kinds of systems.
  105. Usage: $0 [OPTION]...
  106. Defaults for the options are specified in brackets.
  107. Configuration:
  108. -h, --help display this help and exit
  109. --with-bjam=BJAM use existing Boost.Jam executable (bjam)
  110. [automatically built]
  111. --with-toolset=TOOLSET use specific Boost.Build toolset
  112. [automatically detected]
  113. --show-libraries show the set of libraries that require build
  114. and installation steps (i.e., those libraries
  115. that can be used with --with-libraries or
  116. --without-libraries), then exit
  117. --with-libraries=list build only a particular set of libraries,
  118. describing using either a comma-separated list of
  119. library names or "all"
  120. [all]
  121. --without-libraries=list build all libraries except the ones listed []
  122. --with-icu enable Unicode/ICU support in Regex [disabled]
  123. --with-icu=DIR specify the root of the ICU library installation
  124. and enable Unicode/ICU support in Regex [disabled]
  125. --with-python=PYTHON specify the Python executable [python]
  126. --with-python-root=DIR specify the root of the Python installation
  127. [automatically detected]
  128. --with-python-version=X.Y specify the Python version as X.Y
  129. [automatically detected]
  130. Installation directories:
  131. --prefix=PREFIX install Boost into the given PREFIX
  132. [/usr/local]
  133. --exec-prefix=EPREFIX install Boost binaries into the given EPREFIX
  134. [PREFIX]
  135. More precise control over installation directories:
  136. --libdir=DIR install libraries here [EPREFIX/lib]
  137. --includedir=DIR install headers here [PREFIX/include]
  138. EOF
  139. fi
  140. test -n "$want_help" && exit 0
  141. # TBD: Determine where the script is located
  142. my_dir="."
  143. # Determine the toolset, if not already decided
  144. if test "x$TOOLSET" == x; then
  145. TOOLSET=`$my_dir/tools/jam/src/build.sh --guess-toolset`
  146. fi
  147. rm -f config.log
  148. # Build bjam
  149. if test "x$BJAM" == x; then
  150. echo -n "Building Boost.Jam with toolset $TOOLSET... "
  151. pwd=`pwd`
  152. cd "$my_dir/tools/jam/src" && ./build.sh "$TOOLSET" > config.log 2>&1
  153. cd $pwd
  154. arch=`cd $my_dir/tools/jam/src && ./bootstrap/jam0 -d0 -f build.jam --toolset=$TOOLSET --toolset-root= --show-locate-target && cd ..`
  155. BJAM="$my_dir/tools/jam/src/$arch/bjam"
  156. echo "tools/jam/src/$arch/bjam"
  157. fi
  158. # TBD: Turn BJAM into an absolute path
  159. # If there is a list of libraries
  160. if test "x$flag_show_libraries" == xyes; then
  161. libraries=`$BJAM -d0 --show-libraries`
  162. cat <<EOF
  163. The following Boost libraries have portions that require a separate build
  164. and installation step. Any library not listed here can be used by including
  165. the headers only.
  166. The Boost libraries requiring separate building and installation are:
  167. EOF
  168. for lib in $libraries
  169. do
  170. echo " $lib"
  171. done
  172. exit 0
  173. fi
  174. # Setup paths
  175. if test "x$EPREFIX" == x; then
  176. EPREFIX=$PREFIX
  177. fi
  178. if test "x$LIBDIR" == x; then
  179. LIBDIR="$EPREFIX/lib"
  180. fi
  181. if test "x$INCLUDEDIR" == x; then
  182. INCLUDEDIR="$PREFIX/include"
  183. fi
  184. # Find Python
  185. if test "x$flag_no_python" == x; then
  186. if test "x$PYTHON_VERSION" == x; then
  187. echo -n "Detecting Python version... "
  188. PYTHON_VERSION=`$PYTHON -c "import sys; print (\"%d.%d\" % (sys.version_info[0], sys.version_info[1]))"`
  189. echo $PYTHON_VERSION
  190. fi
  191. if test "x$PYTHON_ROOT" == x; then
  192. echo -n "Detecting Python root... "
  193. PYTHON_ROOT=`$PYTHON -c "import sys; print sys.prefix"`
  194. echo $PYTHON_ROOT
  195. fi
  196. BJAM_CONFIG="$BJAM_CONFIG -sPYTHON_ROOT=$PYTHON_ROOT -sPYTHON_VERSION=$PYTHON_VERSION"
  197. fi
  198. # Configure ICU
  199. echo -n "Unicode/ICU support for Boost.Regex?... "
  200. if test "x$flag_icu" == xyes; then
  201. if test "x$ICU_ROOT" == x; then
  202. BJAM_CONFIG="$BJAM_CONFIG -sHAVE_ICU=1"
  203. echo "yes."
  204. else
  205. BJAM_CONFIG="$BJAM_CONFIG -sICU_PATH=$ICU_ROOT"
  206. echo "$ICU_ROOT"
  207. fi
  208. else
  209. echo "no."
  210. fi
  211. # Generate the Makefile
  212. echo "Generating Makefile..."
  213. cat > Makefile <<EOF
  214. BJAM=$BJAM
  215. TOOLSET=$TOOLSET
  216. BJAM_CONFIG=$BJAM_CONFIG
  217. PREFIX=$PREFIX
  218. EPREFIX=$EPREFIX
  219. LIBDIR=$LIBDIR
  220. INCLUDEDIR=$INCLUDEDIR
  221. LIBS=$LIBS
  222. all: .dummy
  223. @echo "\$(BJAM) \$(BJAM_CONFIG) -sTOOLS=\$(TOOLSET) \$(LIBS)"
  224. @\$(BJAM) \$(BJAM_CONFIG) -sTOOLS=\$(TOOLSET) \$(LIBS) || \\
  225. echo "Not all Boost libraries built properly."
  226. clean: .dummy
  227. rm -rf bin
  228. distclean: clean
  229. rm -rf Makefile config.log
  230. check: .dummy
  231. @cd status && ../\$(BJAM) \$(BJAM_CONFIG) -sTOOLS=\$(TOOLSET) test || echo "Some Boost regression tests failed. This is normal."
  232. install: .dummy
  233. @echo "\$(BJAM) \$(BJAM_CONFIG) --prefix=\$(PREFIX) --exec-prefix=\$(EPREFIX) --libdir=\$(LIBDIR) --includedir=\$(INCLUDEDIR) -sTOOLS=\$(TOOLSET) \$(LIBS) install"
  234. @\$(BJAM) \$(BJAM_CONFIG) --prefix=\$(PREFIX) --exec-prefix=\$(EPREFIX) --libdir=\$(LIBDIR) --includedir=\$(INCLUDEDIR) -sTOOLS=\$(TOOLSET) \$(LIBS) install || echo "Not all Boost libraries built properly."
  235. .dummy:
  236. EOF
粤ICP备19079148号